Classify call chips by SystemUI structure
This commit is contained in:
+3
-15
@@ -6,7 +6,6 @@ import android.content.pm.PackageManager;
|
|||||||
import android.telecom.TelecomManager;
|
import android.telecom.TelecomManager;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import java.util.ArrayDeque;
|
import java.util.ArrayDeque;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
@@ -33,13 +32,9 @@ public final class StatusChipCallSupport {
|
|||||||
View view = queue.removeFirst();
|
View view = queue.removeFirst();
|
||||||
String className = view.getClass().getName().toLowerCase(Locale.ROOT);
|
String className = view.getClass().getName().toLowerCase(Locale.ROOT);
|
||||||
String idName = ViewIdNames.idName(view).toLowerCase(Locale.ROOT);
|
String idName = ViewIdNames.idName(view).toLowerCase(Locale.ROOT);
|
||||||
if (className.contains("call") || idName.contains("call")) {
|
if (className.contains("ongoingcall")
|
||||||
return true;
|
|| className.contains("ongoing_call")
|
||||||
}
|
|| idName.contains("ongoing_call")) {
|
||||||
if (containsCallToken(view.getContentDescription())) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (view instanceof TextView textView && containsCallToken(textView.getText())) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (view instanceof ViewGroup childGroup) {
|
if (view instanceof ViewGroup childGroup) {
|
||||||
@@ -66,11 +61,4 @@ public final class StatusChipCallSupport {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean containsCallToken(CharSequence value) {
|
|
||||||
if (value == null || value.length() == 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
String text = value.toString().toLowerCase(Locale.ROOT);
|
|
||||||
return text.contains("call") || text.contains("phone");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user