diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 5b4e81ff629e6..b2906ff1420f8 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -5739,7 +5739,30 @@ public static void setShowGTalkServiceStatusForUser(ContentResolver cr, boolean
* @hide
*/
public static final String NETWORK_TRAFFIC_AUTOHIDE_THRESHOLD = "network_traffic_autohide_threshold";
-
+
+ /**
+ * @hide
+ */
+ public static final String USE_OLD_MOBILETYPE = "use_old_mobiletype";
+
+ /**
+ * Whether to display roaming indicator for roaming signal connection
+ * @hide
+ */
+ public static final String ROAMING_INDICATOR_ICON = "roaming_indicator_icon";
+
+ /**
+ * Whether to display 4G icon instead LTE
+ * @hide
+ */
+ public static final String SHOW_FOURG_ICON = "show_fourg_icon";
+
+ /**
+ * Whether to display cross sign for a data disabled connection
+ * @hide
+ */
+ public static final String DATA_DISABLED_ICON = "data_disabled_icon";
+
/**
* Whether to enable statusbar brightness control
* @hide
@@ -6544,48 +6567,6 @@ public static void setShowGTalkServiceStatusForUser(ContentResolver cr, boolean
*/
public static final String LESS_BORING_HEADS_UP = "less_boring_heads_up";
- /**
- * Whether to display VoLTE icon when VoLTE present
- * @hide
- */
- public static final String VOLTE_ICON_STYLE = "volte_icon_style";
-
- /**
- * VoWiFi icon style
- * @hide
- */
- public static final String VOWIFI_ICON_STYLE = "vowifi_icon_style";
-
- /**
- * Whether VoWiFi icon should override VoLTE icon
- * @hide
- */
- public static final String VOLTE_VOWIFI_OVERRIDE = "volte_vowifi_override";
-
- /**
- * Whether to display roaming indicator for roaming signal connection
- * @hide
- */
- public static final String ROAMING_INDICATOR_ICON = "roaming_indicator_icon";
-
- /**
- * Whether to display 4G icon instead LTE
- * @hide
- */
- public static final String SHOW_FOURG_ICON = "show_fourg_icon";
-
- /**
- * Whether to display cross sign for a data disabled connection
- * @hide
- */
- public static final String DATA_DISABLED_ICON = "data_disabled_icon";
-
- /**
- * Bring back old style mobile data indicators.
- * @hide
- */
- public static final String USE_OLD_MOBILETYPE = "use_old_mobiletype";
-
/**
* Whether to show data usage in qs footer
* @hide
@@ -6623,6 +6604,7 @@ public static void setShowGTalkServiceStatusForUser(ContentResolver cr, boolean
public static final String NOTIFICATION_MATERIAL_DISMISS = "notification_material_dismiss";
/**
+<<<<<<< HEAD
* @hide
*/
public static final String NOTIFICATION_MATERIAL_DISMISS_STYLE = "notification_material_dismiss_style";
@@ -6657,6 +6639,8 @@ public static void setShowGTalkServiceStatusForUser(ContentResolver cr, boolean
};
/**
+ * These are all public system settings
+ *
* @hide
*/
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
@@ -12196,11 +12180,6 @@ public static boolean putFloatForUser(ContentResolver cr, String name, float val
*/
public static final String PULSE_VERTICAL_MIRROR = "pulse_vertical_mirror";
- /**
- * @hide
- */
- public static final String ENABLE_COMBINED_SIGNAL_ICONS = "enable_combined_signal_icons";
-
/**
* Keys we no longer back up under the current schema, but want to continue to
* process when restoring historical backup datasets.
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 750a379e58699..de6e557d71f51 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -58,6 +58,7 @@
- @string/status_bar_bluetooth
- @string/status_bar_wifi
- @string/status_bar_hotspot
+ - @string/status_bar_ims
- @string/status_bar_mobile
- @string/status_bar_airplane
- @string/status_bar_battery
@@ -100,6 +101,7 @@
call_strength
sensors_off
screen_record
+ ims
diff --git a/packages/SettingsLib/res/drawable/ic_vowifi.xml b/packages/SettingsLib/res/drawable/ic_vowifi.xml
deleted file mode 100644
index 6f9245f39d37c..0000000000000
--- a/packages/SettingsLib/res/drawable/ic_vowifi.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/packages/SettingsLib/res/drawable/ic_vowifi_asus.xml b/packages/SettingsLib/res/drawable/ic_vowifi_asus.xml
deleted file mode 100644
index 44e44ca7ea43c..0000000000000
--- a/packages/SettingsLib/res/drawable/ic_vowifi_asus.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/packages/SettingsLib/res/drawable/ic_vowifi_calling.xml b/packages/SettingsLib/res/drawable/ic_vowifi_calling.xml
deleted file mode 100644
index 6f9245f39d37c..0000000000000
--- a/packages/SettingsLib/res/drawable/ic_vowifi_calling.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/packages/SettingsLib/res/drawable/ic_vowifi_emui.xml b/packages/SettingsLib/res/drawable/ic_vowifi_emui.xml
deleted file mode 100644
index c98a70fdd2e8c..0000000000000
--- a/packages/SettingsLib/res/drawable/ic_vowifi_emui.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/packages/SettingsLib/res/drawable/ic_vowifi_margaritov.xml b/packages/SettingsLib/res/drawable/ic_vowifi_margaritov.xml
deleted file mode 100644
index 64f3f4d5bd5f6..0000000000000
--- a/packages/SettingsLib/res/drawable/ic_vowifi_margaritov.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
diff --git a/packages/SettingsLib/res/drawable/ic_vowifi_moto.xml b/packages/SettingsLib/res/drawable/ic_vowifi_moto.xml
deleted file mode 100644
index 90b977d5eff73..0000000000000
--- a/packages/SettingsLib/res/drawable/ic_vowifi_moto.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/packages/SettingsLib/res/drawable/ic_vowifi_oneplus.xml b/packages/SettingsLib/res/drawable/ic_vowifi_oneplus.xml
deleted file mode 100644
index 4574f36d31d5c..0000000000000
--- a/packages/SettingsLib/res/drawable/ic_vowifi_oneplus.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/packages/SettingsLib/res/drawable/ic_vowifi_oneplus_compact.xml b/packages/SettingsLib/res/drawable/ic_vowifi_oneplus_compact.xml
deleted file mode 100644
index fc26e243f8795..0000000000000
--- a/packages/SettingsLib/res/drawable/ic_vowifi_oneplus_compact.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
diff --git a/packages/SettingsLib/res/drawable/ic_vowifi_vivo.xml b/packages/SettingsLib/res/drawable/ic_vowifi_vivo.xml
deleted file mode 100644
index 3f8a683b311c4..0000000000000
--- a/packages/SettingsLib/res/drawable/ic_vowifi_vivo.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/packages/SettingsLib/res/drawable/stat_sys_3g_mobiledata.xml b/packages/SettingsLib/res/drawable/stat_sys_3g_mobiledata.xml
new file mode 100644
index 0000000000000..85c55f27a3a87
--- /dev/null
+++ b/packages/SettingsLib/res/drawable/stat_sys_3g_mobiledata.xml
@@ -0,0 +1,4 @@
+
diff --git a/packages/SettingsLib/res/drawable/stat_sys_4g_mobiledata.xml b/packages/SettingsLib/res/drawable/stat_sys_4g_mobiledata.xml
new file mode 100644
index 0000000000000..dabfdc43116c5
--- /dev/null
+++ b/packages/SettingsLib/res/drawable/stat_sys_4g_mobiledata.xml
@@ -0,0 +1,4 @@
+
diff --git a/packages/SettingsLib/res/drawable/stat_sys_4g_plus_mobiledata.xml b/packages/SettingsLib/res/drawable/stat_sys_4g_plus_mobiledata.xml
new file mode 100644
index 0000000000000..856f649cdb569
--- /dev/null
+++ b/packages/SettingsLib/res/drawable/stat_sys_4g_plus_mobiledata.xml
@@ -0,0 +1,4 @@
+
diff --git a/packages/SettingsLib/res/drawable/stat_sys_5g_mobiledata.xml b/packages/SettingsLib/res/drawable/stat_sys_5g_mobiledata.xml
new file mode 100644
index 0000000000000..cb35d1393fc23
--- /dev/null
+++ b/packages/SettingsLib/res/drawable/stat_sys_5g_mobiledata.xml
@@ -0,0 +1,4 @@
+
diff --git a/packages/SettingsLib/res/drawable/stat_sys_lte_mobiledata.xml b/packages/SettingsLib/res/drawable/stat_sys_lte_mobiledata.xml
new file mode 100644
index 0000000000000..75a98c9b95ffe
--- /dev/null
+++ b/packages/SettingsLib/res/drawable/stat_sys_lte_mobiledata.xml
@@ -0,0 +1,4 @@
+
diff --git a/packages/SettingsLib/res/drawable/stat_sys_lte_plus_mobiledata.xml b/packages/SettingsLib/res/drawable/stat_sys_lte_plus_mobiledata.xml
new file mode 100644
index 0000000000000..be5fc0516cf19
--- /dev/null
+++ b/packages/SettingsLib/res/drawable/stat_sys_lte_plus_mobiledata.xml
@@ -0,0 +1,4 @@
+
diff --git a/packages/SettingsLib/src/com/android/settingslib/mobile/MobileMappings.java b/packages/SettingsLib/src/com/android/settingslib/mobile/MobileMappings.java
index d5f24fca9cf8f..d45b21ae3f229 100644
--- a/packages/SettingsLib/src/com/android/settingslib/mobile/MobileMappings.java
+++ b/packages/SettingsLib/src/com/android/settingslib/mobile/MobileMappings.java
@@ -214,7 +214,7 @@ public static class Config {
public boolean showAtLeast3G = false;
public boolean show4gFor3g = false;
public boolean alwaysShowCdmaRssi = false;
- public boolean show4gForLte = false;
+ public boolean show4gForLte = true;
public boolean show4glteForLte = false;
public boolean hideLtePlus = false;
public boolean hspaDataDistinguishable;
@@ -232,7 +232,6 @@ public static Config readConfig(Context context) {
res.getBoolean(com.android.internal.R.bool.config_alwaysUseCdmaRssi);
config.hspaDataDistinguishable =
res.getBoolean(R.bool.config_hspa_data_distinguishable);
-
config.show4gForLte = Settings.System.getIntForUser(context.getContentResolver(),
Settings.System.SHOW_FOURG_ICON, 0,
UserHandle.USER_CURRENT) == 1;
diff --git a/packages/SettingsLib/src/com/android/settingslib/mobile/MobileStatusTracker.java b/packages/SettingsLib/src/com/android/settingslib/mobile/MobileStatusTracker.java
index 1b4d9d50b7742..1a08366734bcd 100644
--- a/packages/SettingsLib/src/com/android/settingslib/mobile/MobileStatusTracker.java
+++ b/packages/SettingsLib/src/com/android/settingslib/mobile/MobileStatusTracker.java
@@ -43,7 +43,6 @@ public class MobileStatusTracker {
private final SubscriptionDefaults mDefaults;
private final Handler mReceiverHandler;
private final MobileTelephonyCallback mTelephonyCallback;
- private boolean mListening = false;
/**
* MobileStatusTracker constructors
@@ -77,17 +76,12 @@ public MobileTelephonyCallback getTelephonyCallback() {
* Config the MobileStatusTracker to start or stop monitoring platform signals.
*/
public void setListening(boolean listening) {
- mListening = listening;
if (listening) {
mPhone.registerTelephonyCallback(mReceiverHandler::post, mTelephonyCallback);
} else {
mPhone.unregisterTelephonyCallback(mTelephonyCallback);
}
}
-
- public boolean isListening() {
- return mListening;
- }
private void updateDataSim() {
int activeDataSubId = mDefaults.getActiveDataSubId();
diff --git a/packages/SettingsLib/src/com/android/settingslib/mobile/TelephonyIcons.java b/packages/SettingsLib/src/com/android/settingslib/mobile/TelephonyIcons.java
index c651248773d37..8617291f071d3 100644
--- a/packages/SettingsLib/src/com/android/settingslib/mobile/TelephonyIcons.java
+++ b/packages/SettingsLib/src/com/android/settingslib/mobile/TelephonyIcons.java
@@ -30,31 +30,22 @@ public class TelephonyIcons {
//***** Data connection icons
public static final int FLIGHT_MODE_ICON = R.drawable.stat_sys_airplane_mode;
- public static final int ICON_LTE = R.drawable.ic_lte_mobiledata;
- public static final int ICON_LTE_PLUS = R.drawable.ic_lte_plus_mobiledata;
+ public static final int ICON_LTE = R.drawable.stat_sys_lte_mobiledata;
+ public static final int ICON_LTE_PLUS = R.drawable.stat_sys_lte_plus_mobiledata;
public static final int ICON_G = R.drawable.ic_g_mobiledata;
public static final int ICON_E = R.drawable.ic_e_mobiledata;
public static final int ICON_H = R.drawable.ic_h_mobiledata;
public static final int ICON_H_PLUS = R.drawable.ic_h_plus_mobiledata;
- public static final int ICON_3G = R.drawable.ic_3g_mobiledata;
- public static final int ICON_4G = R.drawable.ic_4g_mobiledata;
- public static final int ICON_4G_PLUS = R.drawable.ic_4g_plus_mobiledata;
+ public static final int ICON_3G = R.drawable.stat_sys_3g_mobiledata;
+ public static final int ICON_4G = R.drawable.stat_sys_4g_mobiledata;
+ public static final int ICON_4G_PLUS = R.drawable.stat_sys_4g_plus_mobiledata;
public static final int ICON_4G_LTE = R.drawable.ic_4g_lte_mobiledata;
public static final int ICON_4G_LTE_PLUS = R.drawable.ic_4g_lte_plus_mobiledata;
public static final int ICON_5G_E = R.drawable.ic_5g_e_mobiledata;
public static final int ICON_1X = R.drawable.ic_1x_mobiledata;
- public static final int ICON_5G = R.drawable.ic_5g_mobiledata;
+ public static final int ICON_5G = R.drawable.stat_sys_5g_mobiledata;
public static final int ICON_5G_PLUS = R.drawable.ic_5g_plus_mobiledata;
public static final int ICON_CWF = R.drawable.ic_carrier_wifi;
- public static final int ICON_VOWIFI = R.drawable.ic_vowifi;
- public static final int ICON_VOWIFI_CALLING = R.drawable.ic_vowifi_calling;
- public static final int ICON_VOWIFI_ASUS = R.drawable.ic_vowifi_asus;
- public static final int ICON_VOWIFI_MOTO = R.drawable.ic_vowifi_moto;
- public static final int ICON_VOWIFI_ONEPLUS = R.drawable.ic_vowifi_oneplus;
- public static final int ICON_VOWIFI_EMUI = R.drawable.ic_vowifi_emui;
- public static final int ICON_VOWIFI_ONEPLUS_COMPACT = R.drawable.ic_vowifi_oneplus_compact;
- public static final int ICON_VOWIFI_VIVO = R.drawable.ic_vowifi_vivo;
- public static final int ICON_VOWIFI_Margaritov = R.drawable.ic_vowifi_margaritov;
public static final MobileIconGroup CARRIER_NETWORK_CHANGE = new MobileIconGroup(
"CARRIER_NETWORK_CHANGE",
@@ -348,114 +339,6 @@ public class TelephonyIcons {
TelephonyIcons.ICON_CWF
);
- public static final MobileIconGroup VOWIFI = new MobileIconGroup(
- "VoWIFI",
- null,
- null,
- AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
- 0, 0,
- 0,
- 0,
- AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
- 0,
- TelephonyIcons.ICON_VOWIFI);
-
- public static final MobileIconGroup VOWIFI_CALLING = new MobileIconGroup(
- "VoWIFICall",
- null,
- null,
- AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
- 0, 0,
- 0,
- 0,
- AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
- 0,
- TelephonyIcons.ICON_VOWIFI_CALLING);
-
- public static final MobileIconGroup VOWIFI_MOTO = new MobileIconGroup(
- "VoWIFI_Moto",
- null,
- null,
- AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
- 0, 0,
- 0,
- 0,
- AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
- 0,
- TelephonyIcons.ICON_VOWIFI_MOTO);
-
- public static final MobileIconGroup VOWIFI_ASUS = new MobileIconGroup(
- "VoWIFI_ASUS",
- null,
- null,
- AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
- 0, 0,
- 0,
- 0,
- AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
- 0,
- TelephonyIcons.ICON_VOWIFI_ASUS);
-
- public static final MobileIconGroup VOWIFI_ONEPLUS = new MobileIconGroup(
- "VoWIFI_OnePlus",
- null,
- null,
- AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
- 0, 0,
- 0,
- 0,
- AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
- 0,
- TelephonyIcons.ICON_VOWIFI_ONEPLUS);
-
- public static final MobileIconGroup VOWIFI_EMUI = new MobileIconGroup(
- "VoWIFI_Emui",
- null,
- null,
- AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
- 0, 0,
- 0,
- 0,
- AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
- 0,
- TelephonyIcons.ICON_VOWIFI_EMUI);
-
- public static final MobileIconGroup VOWIFI_ONEPLUS_COMPACT = new MobileIconGroup(
- "VoWIFI_Oneplus_Compact",
- null,
- null,
- AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
- 0, 0,
- 0,
- 0,
- AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
- 0,
- TelephonyIcons.ICON_VOWIFI_ONEPLUS_COMPACT);
-
- public static final MobileIconGroup VOWIFI_VIVO = new MobileIconGroup(
- "VoWIFI_VIVO",
- null,
- null,
- AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
- 0, 0,
- 0,
- 0,
- AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
- 0,
- TelephonyIcons.ICON_VOWIFI_VIVO);
-
- public static final MobileIconGroup VOWIFI_Margaritov = new MobileIconGroup(
- "VoWIFI_Margaritov",
- null,
- null,
- AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
- 0, 0,
- 0,
- 0,
- AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
- 0,
- TelephonyIcons.ICON_VOWIFI_Margaritov);
-
// When adding a new MobileIconGround, check if the dataContentDescription has to be filtered
// in QSCarrier#hasValidTypeContentDescription
diff --git a/packages/SettingsProvider/src/android/provider/settings/backup/SystemSettings.java b/packages/SettingsProvider/src/android/provider/settings/backup/SystemSettings.java
index 5cdac78d05d23..17ff1e48a3237 100644
--- a/packages/SettingsProvider/src/android/provider/settings/backup/SystemSettings.java
+++ b/packages/SettingsProvider/src/android/provider/settings/backup/SystemSettings.java
@@ -92,6 +92,7 @@ public class SystemSettings {
Settings.System.NAVIGATION_BAR_INVERSE,
Settings.System.NETWORK_TRAFFIC_STATE,
Settings.System.NETWORK_TRAFFIC_AUTOHIDE_THRESHOLD,
+ Settings.System.USE_OLD_MOBILETYPE,
Settings.System.STATUS_BAR_BRIGHTNESS_CONTROL,
Settings.System.LOCKSCREEN_BATTERY_INFO,
Settings.System.VOLUME_KEY_CURSOR_CONTROL,
diff --git a/packages/SettingsProvider/src/android/provider/settings/validators/SystemSettingsValidators.java b/packages/SettingsProvider/src/android/provider/settings/validators/SystemSettingsValidators.java
index 1bc89e8b64424..5fd401b81f387 100644
--- a/packages/SettingsProvider/src/android/provider/settings/validators/SystemSettingsValidators.java
+++ b/packages/SettingsProvider/src/android/provider/settings/validators/SystemSettingsValidators.java
@@ -214,6 +214,7 @@ public boolean validate(@Nullable String value) {
VALIDATORS.put(System.NAVIGATION_BAR_INVERSE, BOOLEAN_VALIDATOR);
VALIDATORS.put(System.NETWORK_TRAFFIC_STATE, BOOLEAN_VALIDATOR);
VALIDATORS.put(System.NETWORK_TRAFFIC_AUTOHIDE_THRESHOLD, BOOLEAN_VALIDATOR);
+ VALIDATORS.put(System.USE_OLD_MOBILETYPE, BOOLEAN_VALIDATOR);
VALIDATORS.put(System.STATUS_BAR_BRIGHTNESS_CONTROL, BOOLEAN_VALIDATOR);
VALIDATORS.put(System.INCREASING_RING, BOOLEAN_VALIDATOR);
VALIDATORS.put(System.INCREASING_RING_START_VOLUME, new InclusiveFloatRangeValidator(0, 1));
diff --git a/packages/SystemUI/Android.bp b/packages/SystemUI/Android.bp
index 031020ffdf532..afa6708a0f196 100644
--- a/packages/SystemUI/Android.bp
+++ b/packages/SystemUI/Android.bp
@@ -126,7 +126,6 @@ android_library {
"jsr330",
"lottie",
"LowLightDreamLib",
- "bcsmartspace-google",
"faceunlock_framework",
"vendor.lineage.powershare-V1.0-java",
],
diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml
index 7f23137835421..abe39cb6a27be 100644
--- a/packages/SystemUI/AndroidManifest.xml
+++ b/packages/SystemUI/AndroidManifest.xml
@@ -371,15 +371,6 @@
-
-
-
-
-
-
-
-
-
+ android:exported="true">
diff --git a/packages/SystemUI/bcsmartspace/Android.bp b/packages/SystemUI/bcsmartspace/Android.bp
deleted file mode 100644
index 727bc083f1fc3..0000000000000
--- a/packages/SystemUI/bcsmartspace/Android.bp
+++ /dev/null
@@ -1,36 +0,0 @@
-android_library {
- name: "bcsmartspace-res",
-
- static_libs: [
- "androidx.cardview_cardview",
- "androidx-constraintlayout_constraintlayout",
- ],
-
- optimize: {
- enabled: false,
- },
-
- resource_dirs: ["res"],
-}
-
-android_library {
- name: "bcsmartspace-google",
- srcs: [
- "src/**/*.kt",
- "src/**/*.java",
- "src/**/I*.aidl",
- ],
- static_libs: [
- "bcsmartspace-res",
- "smartspace-proto-java",
- "SystemUIPluginLib",
- "SystemUISharedLib",
- "SystemUI-statsd",
- "iconloader_base",
- ],
- manifest: "AndroidManifest.xml",
-
- kotlincflags: ["-Xjvm-default=enable"],
-
- plugins: ["dagger2-compiler"],
-}
diff --git a/packages/SystemUI/bcsmartspace/AndroidManifest.xml b/packages/SystemUI/bcsmartspace/AndroidManifest.xml
deleted file mode 100644
index b6d117af09fde..0000000000000
--- a/packages/SystemUI/bcsmartspace/AndroidManifest.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
diff --git a/packages/SystemUI/bcsmartspace/res/drawable/bg_image_generic.xml b/packages/SystemUI/bcsmartspace/res/drawable/bg_image_generic.xml
deleted file mode 100644
index 72c39f6ab7fbe..0000000000000
--- a/packages/SystemUI/bcsmartspace/res/drawable/bg_image_generic.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/packages/SystemUI/bcsmartspace/res/drawable/bg_smartspace_card_secondary.xml b/packages/SystemUI/bcsmartspace/res/drawable/bg_smartspace_card_secondary.xml
deleted file mode 100644
index 7973a2b8d7dd6..0000000000000
--- a/packages/SystemUI/bcsmartspace/res/drawable/bg_smartspace_card_secondary.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/packages/SystemUI/bcsmartspace/res/drawable/bg_smartspace_combination_sub_card.xml b/packages/SystemUI/bcsmartspace/res/drawable/bg_smartspace_combination_sub_card.xml
deleted file mode 100644
index c2a767db32c04..0000000000000
--- a/packages/SystemUI/bcsmartspace/res/drawable/bg_smartspace_combination_sub_card.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/packages/SystemUI/bcsmartspace/res/drawable/bg_smartspace_media_item.xml b/packages/SystemUI/bcsmartspace/res/drawable/bg_smartspace_media_item.xml
deleted file mode 100644
index a964c7b174511..0000000000000
--- a/packages/SystemUI/bcsmartspace/res/drawable/bg_smartspace_media_item.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/packages/SystemUI/bcsmartspace/res/drawable/page_indicator_dot.xml b/packages/SystemUI/bcsmartspace/res/drawable/page_indicator_dot.xml
deleted file mode 100644
index ece3fb67a17d9..0000000000000
--- a/packages/SystemUI/bcsmartspace/res/drawable/page_indicator_dot.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
diff --git a/packages/SystemUI/bcsmartspace/res/drawable/videocam.xml b/packages/SystemUI/bcsmartspace/res/drawable/videocam.xml
deleted file mode 100644
index a0a09ddfaf2cf..0000000000000
--- a/packages/SystemUI/bcsmartspace/res/drawable/videocam.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/packages/SystemUI/bcsmartspace/res/drawable/videocam_off.xml b/packages/SystemUI/bcsmartspace/res/drawable/videocam_off.xml
deleted file mode 100644
index 54b7d45f55f14..0000000000000
--- a/packages/SystemUI/bcsmartspace/res/drawable/videocam_off.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_base_card_doorbell.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_base_card_doorbell.xml
deleted file mode 100644
index 83788088f829f..0000000000000
--- a/packages/SystemUI/bcsmartspace/res/layout/smartspace_base_card_doorbell.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_base_card_package_delivery.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_base_card_package_delivery.xml
deleted file mode 100644
index 15a3d54defaab..0000000000000
--- a/packages/SystemUI/bcsmartspace/res/layout/smartspace_base_card_package_delivery.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_card.xml
deleted file mode 100644
index 05479d79d18c4..0000000000000
--- a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_at_store.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_at_store.xml
deleted file mode 100644
index 0011f7d6ccbd8..0000000000000
--- a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_at_store.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_combination.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_combination.xml
deleted file mode 100644
index f029a6fd299de..0000000000000
--- a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_combination.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_combination_at_store.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_combination_at_store.xml
deleted file mode 100644
index a8b5bda21f4a8..0000000000000
--- a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_combination_at_store.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_date.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_date.xml
deleted file mode 100644
index 0b807c3e07bea..0000000000000
--- a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_date.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_doorbell.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_doorbell.xml
deleted file mode 100644
index dd59161e91fd9..0000000000000
--- a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_doorbell.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_flight.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_flight.xml
deleted file mode 100644
index f4461ab96771f..0000000000000
--- a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_flight.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_generic_image_with_bg.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_generic_image_with_bg.xml
deleted file mode 100644
index 09239aafa8599..0000000000000
--- a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_generic_image_with_bg.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_generic_landscape_image.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_generic_landscape_image.xml
deleted file mode 100644
index 8d654119b9818..0000000000000
--- a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_generic_landscape_image.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_generic_portrait_image.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_generic_portrait_image.xml
deleted file mode 100644
index d06d860df4a11..0000000000000
--- a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_generic_portrait_image.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_loyalty.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_loyalty.xml
deleted file mode 100644
index 62777f3c6b213..0000000000000
--- a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_loyalty.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_shopping_list.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_shopping_list.xml
deleted file mode 100644
index 61e1f12480f62..0000000000000
--- a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_shopping_list.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_sports.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_sports.xml
deleted file mode 100644
index 0f8a8cc5960b5..0000000000000
--- a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_sports.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_weather_forecast.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_weather_forecast.xml
deleted file mode 100644
index bdacf33ebc87e..0000000000000
--- a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_weather_forecast.xml
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_weather_forecast_column.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_weather_forecast_column.xml
deleted file mode 100644
index c16d386bab509..0000000000000
--- a/packages/SystemUI/bcsmartspace/res/layout/smartspace_card_weather_forecast_column.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_combination_sub_card.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_combination_sub_card.xml
deleted file mode 100644
index 7e03db36c07d2..0000000000000
--- a/packages/SystemUI/bcsmartspace/res/layout/smartspace_combination_sub_card.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_enhanced.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_enhanced.xml
deleted file mode 100644
index 34332eaf29a28..0000000000000
--- a/packages/SystemUI/bcsmartspace/res/layout/smartspace_enhanced.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_extras.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_extras.xml
deleted file mode 100644
index 2bbe120e5baf6..0000000000000
--- a/packages/SystemUI/bcsmartspace/res/layout/smartspace_extras.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_subtitle_pane.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_subtitle_pane.xml
deleted file mode 100644
index 79742bc38d69e..0000000000000
--- a/packages/SystemUI/bcsmartspace/res/layout/smartspace_subtitle_pane.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/packages/SystemUI/bcsmartspace/res/layout/smartspace_title_subtile_pane.xml b/packages/SystemUI/bcsmartspace/res/layout/smartspace_title_subtile_pane.xml
deleted file mode 100644
index 5708eb2436e50..0000000000000
--- a/packages/SystemUI/bcsmartspace/res/layout/smartspace_title_subtile_pane.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/packages/SystemUI/bcsmartspace/res/values/colors.xml b/packages/SystemUI/bcsmartspace/res/values/colors.xml
deleted file mode 100644
index 5fcb8971ae6e0..0000000000000
--- a/packages/SystemUI/bcsmartspace/res/values/colors.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
- #40000000
-
diff --git a/packages/SystemUI/bcsmartspace/res/values/dimens.xml b/packages/SystemUI/bcsmartspace/res/values/dimens.xml
deleted file mode 100644
index 0058a800a4b87..0000000000000
--- a/packages/SystemUI/bcsmartspace/res/values/dimens.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
- 1.5dip
- 8.0dip
- 20.0dip
- 16.0dip
- 104.0dip
- 6.0dip
- 20.0dip
- 16.0dip
- 16.0dip
- 28.0dip
- 1.0dip
- 8.0dip
- 9dp
- 16.0sp
- 20.0sp
- #89000000
- 0.5dip
- 0.5dip
- 0.5dip
- 3dp
- 6dp
- 2dp
- 8dp
- 16dp
- 1.0dip
- 0.02
- 40.0dip
-
diff --git a/packages/SystemUI/bcsmartspace/res/values/plurals.xml b/packages/SystemUI/bcsmartspace/res/values/plurals.xml
deleted file mode 100644
index 5a4ffc0e04a97..0000000000000
--- a/packages/SystemUI/bcsmartspace/res/values/plurals.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
- - %d hr
- - %d hr
-
-
- - %d min
- - %d min
-
-
diff --git a/packages/SystemUI/bcsmartspace/res/values/strings.xml b/packages/SystemUI/bcsmartspace/res/values/strings.xml
deleted file mode 100644
index 73fea0dc26b02..0000000000000
--- a/packages/SystemUI/bcsmartspace/res/values/strings.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
- Next alarm at %s
- Page %1$d of %2$d
- %1$s, %2$s
- Gate
- Seat
- %1$s %2$s
- EEEMMMd
- Now
- %1$s: %2$s
- + %1$d more
- %1$s, %2$s
-
diff --git a/packages/SystemUI/bcsmartspace/res/values/styles.xml b/packages/SystemUI/bcsmartspace/res/values/styles.xml
deleted file mode 100644
index 8632242210a92..0000000000000
--- a/packages/SystemUI/bcsmartspace/res/values/styles.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartSpaceUtil.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartSpaceUtil.java
deleted file mode 100644
index 48607643230c1..0000000000000
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartSpaceUtil.java
+++ /dev/null
@@ -1,228 +0,0 @@
-package com.google.android.systemui.smartspace;
-
-import android.app.PendingIntent;
-import android.app.smartspace.SmartspaceAction;
-import android.app.smartspace.SmartspaceTarget;
-import android.app.smartspace.SmartspaceTargetEvent;
-import android.content.ActivityNotFoundException;
-import android.content.ComponentName;
-import android.content.ContentUris;
-import android.content.Context;
-import android.content.Intent;
-import android.graphics.drawable.BitmapDrawable;
-import android.graphics.drawable.Drawable;
-import android.graphics.drawable.Icon;
-import android.os.Bundle;
-import android.os.UserHandle;
-import android.provider.CalendarContract;
-import android.util.Log;
-import android.view.View;
-
-import com.android.systemui.bcsmartspace.R;
-import com.android.systemui.plugins.BcSmartspaceDataPlugin;
-import com.android.systemui.plugins.FalsingManager;
-
-import com.google.android.systemui.smartspace.logging.BcSmartspaceCardLogger;
-import com.google.android.systemui.smartspace.logging.BcSmartspaceCardLoggingInfo;
-
-public final class BcSmartSpaceUtil {
- private static FalsingManager sFalsingManager;
- private static BcSmartspaceDataPlugin.IntentStarter sIntentStarter;
-
- public static void setOnClickListener(
- View view,
- SmartspaceTarget smartspaceTarget,
- SmartspaceAction smartspaceAction,
- String str,
- BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier,
- BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo) {
- setOnClickListener(
- view,
- smartspaceTarget,
- smartspaceAction,
- null,
- str,
- smartspaceEventNotifier,
- bcSmartspaceCardLoggingInfo,
- 0);
- }
-
- public static void setOnClickListener(
- View view,
- SmartspaceTarget smartspaceTarget,
- SmartspaceAction smartspaceAction,
- String str,
- BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier,
- BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo,
- int i) {
- setOnClickListener(
- view,
- smartspaceTarget,
- smartspaceAction,
- null,
- str,
- smartspaceEventNotifier,
- bcSmartspaceCardLoggingInfo,
- i);
- }
-
- public static void setOnClickListener(
- View view,
- final SmartspaceTarget smartspaceTarget,
- final SmartspaceAction smartspaceAction,
- final View.OnClickListener onClickListener,
- final String str,
- final BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier,
- final BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo,
- final int i) {
- if (view == null || smartspaceAction == null) {
- Log.e(str, "No tap action can be set up");
- return;
- }
- final boolean z =
- smartspaceAction.getExtras() != null
- && smartspaceAction.getExtras().getBoolean("show_on_lockscreen");
- final boolean z2 =
- smartspaceAction.getIntent() == null && smartspaceAction.getPendingIntent() == null;
- BcSmartspaceDataPlugin.IntentStarter intentStarter = sIntentStarter;
- if (intentStarter == null) {
- intentStarter = defaultIntentStarter(str);
- }
- final BcSmartspaceDataPlugin.IntentStarter intentStarter2 = intentStarter;
- view.setOnClickListener(
- new View.OnClickListener() {
- @Override
- public final void onClick(View view2) {
- if (bcSmartspaceCardLoggingInfo != null) {
- if (bcSmartspaceCardLoggingInfo.getSubcardInfo() != null) {
- bcSmartspaceCardLoggingInfo
- .getSubcardInfo()
- .setClickedSubcardIndex(i);
- }
- BcSmartspaceCardLogger.log(
- BcSmartspaceEvent.SMARTSPACE_CARD_CLICK,
- bcSmartspaceCardLoggingInfo);
- }
- FalsingManager falsingManager = sFalsingManager;
- if (falsingManager == null || !falsingManager.isFalseTap(1)) {
- if (!z) {
- intentStarter2.startFromAction(smartspaceAction, view2, z2);
- }
- if (onClickListener != null) {
- onClickListener.onClick(view2);
- }
- if (smartspaceEventNotifier == null) {
- Log.w(
- str,
- "Cannot notify target interaction smartspace event: event"
- + " notifier null.");
- } else {
- smartspaceEventNotifier.notifySmartspaceEvent(
- new SmartspaceTargetEvent.Builder(1)
- .setSmartspaceTarget(smartspaceTarget)
- .setSmartspaceActionId(smartspaceAction.getId())
- .build());
- }
- }
- }
- });
- }
-
- public static String getDimensionRatio(Bundle bundle) {
- if (bundle != null
- && bundle.containsKey("imageRatioWidth")
- && bundle.containsKey("imageRatioHeight")) {
- int i = bundle.getInt("imageRatioWidth");
- int i2 = bundle.getInt("imageRatioHeight");
- if (i > 0 && i2 > 0) {
- return i + ":" + i2;
- }
- }
- return null;
- }
-
- public static Drawable getIconDrawable(Icon icon, Context context) {
- Drawable drawable;
- if (icon == null) {
- return null;
- }
- if (icon.getType() == 1 || icon.getType() == 5) {
- drawable = new BitmapDrawable(context.getResources(), icon.getBitmap());
- } else {
- drawable = icon.loadDrawable(context);
- }
- if (drawable != null) {
- int dimensionPixelSize =
- context.getResources()
- .getDimensionPixelSize(R.dimen.enhanced_smartspace_icon_size);
- drawable.setBounds(0, 0, dimensionPixelSize, dimensionPixelSize);
- }
- return drawable;
- }
-
- public static void setFalsingManager(FalsingManager falsingManager) {
- sFalsingManager = falsingManager;
- }
-
- public static void setIntentStarter(BcSmartspaceDataPlugin.IntentStarter intentStarter) {
- sIntentStarter = intentStarter;
- }
-
- private static BcSmartspaceDataPlugin.IntentStarter defaultIntentStarter(final String str) {
- return new BcSmartspaceDataPlugin.IntentStarter() {
- @Override
- public void startIntent(View view, Intent intent, boolean z) {
- try {
- view.getContext().startActivity(intent);
- } catch (ActivityNotFoundException | NullPointerException | SecurityException e) {
- Log.e(str, "Cannot invoke smartspace intent", e);
- }
- }
-
- @Override
- public void startPendingIntent(PendingIntent pendingIntent, boolean z) {
- try {
- pendingIntent.send();
- } catch (PendingIntent.CanceledException e) {
- Log.e(str, "Cannot invoke canceled smartspace intent", e);
- }
- }
- };
- }
-
- public static boolean isLoggable(String str) {
- return Log.isLoggable(str, 2);
- }
-
- public static int getLoggingDisplaySurface(String str, float f) {
- str.hashCode();
- if (!str.equals("com.google.android.apps.nexuslauncher")) {
- if (!str.equals("com.android.systemui")) {
- return 0;
- }
- if (f == 1.0f) {
- return 3;
- }
- return f == 0.0f ? 2 : -1;
- }
- return 1;
- }
-
- public static SmartspaceTarget createUpcomingAlarmTarget(
- ComponentName componentName, UserHandle userHandle) {
- return new SmartspaceTarget.Builder(
- "upcoming_alarm_card_94510_12684", componentName, userHandle)
- .setFeatureType(23)
- .build();
- }
-
- public static Intent getOpenCalendarIntent() {
- return new Intent("android.intent.action.VIEW")
- .setData(
- ContentUris.appendId(
- CalendarContract.CONTENT_URI.buildUpon().appendPath("time"),
- System.currentTimeMillis())
- .build())
- .addFlags(270532608);
- }
-}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCard.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCard.java
deleted file mode 100644
index 6d24d1c51c630..0000000000000
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCard.java
+++ /dev/null
@@ -1,563 +0,0 @@
-package com.google.android.systemui.smartspace;
-
-import android.app.smartspace.SmartspaceAction;
-import android.app.smartspace.SmartspaceTarget;
-import android.content.Context;
-import android.content.Intent;
-import android.graphics.drawable.Drawable;
-import android.os.Bundle;
-import android.text.TextUtils;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.accessibility.AccessibilityNodeInfo;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.TextView;
-
-import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
-
-import com.android.launcher3.icons.GraphicsUtils;
-import com.android.systemui.bcsmartspace.R;
-import com.android.systemui.plugins.BcSmartspaceDataPlugin;
-
-import com.google.android.systemui.smartspace.logging.BcSmartspaceCardLoggingInfo;
-import com.google.android.systemui.smartspace.logging.BcSmartspaceCardMetadataLoggingInfo;
-
-import java.util.List;
-import java.util.Locale;
-import java.util.UUID;
-
-public class BcSmartspaceCard extends LinearLayout {
- private static final SmartspaceAction SHOW_ALARMS_ACTION =
- new SmartspaceAction.Builder("nextAlarmId", "Next alarm")
- .setIntent(new Intent("android.intent.action.SHOW_ALARMS"))
- .build();
- private DoubleShadowTextView mBaseActionIconSubtitleView;
- private IcuDateTextView mDateView;
- private ImageView mDndImageView;
- private float mDozeAmount;
- private BcSmartspaceDataPlugin.SmartspaceEventNotifier mEventNotifier;
- private ViewGroup mExtrasGroup;
- private DoubleShadowIconDrawable mIconDrawable;
- private int mIconTintColor;
- private BcSmartspaceCardLoggingInfo mLoggingInfo;
- private ImageView mNextAlarmImageView;
- private TextView mNextAlarmTextView;
- private BcSmartspaceCardSecondary mSecondaryCard;
- private TextView mSubtitleTextView;
- private SmartspaceTarget mTarget;
- private TextView mTitleTextView;
- private int mTopPadding;
- private boolean mUsePageIndicatorUi;
-
- public BcSmartspaceCard(Context context) {
- this(context, null);
- }
-
- public BcSmartspaceCard(Context context, AttributeSet attributeSet) {
- super(context, attributeSet);
- mSecondaryCard = null;
- mIconTintColor = GraphicsUtils.getAttrColor(getContext(), 16842806);
- mDateView = null;
- mTitleTextView = null;
- mSubtitleTextView = null;
- mBaseActionIconSubtitleView = null;
- mExtrasGroup = null;
- mDndImageView = null;
- mNextAlarmImageView = null;
- mNextAlarmTextView = null;
- }
-
- @Override
- protected void onFinishInflate() {
- super.onFinishInflate();
- mDateView = (IcuDateTextView) findViewById(R.id.date);
- mTitleTextView = (TextView) findViewById(R.id.title_text);
- mSubtitleTextView = (TextView) findViewById(R.id.subtitle_text);
- mBaseActionIconSubtitleView =
- (DoubleShadowTextView) findViewById(R.id.base_action_icon_subtitle);
- mExtrasGroup = (ViewGroup) findViewById(R.id.smartspace_extras_group);
- mTopPadding = getPaddingTop();
- ViewGroup viewGroup = mExtrasGroup;
- if (viewGroup != null) {
- mDndImageView = (ImageView) viewGroup.findViewById(R.id.dnd_icon);
- mNextAlarmImageView = (ImageView) mExtrasGroup.findViewById(R.id.alarm_icon);
- mNextAlarmTextView = (TextView) mExtrasGroup.findViewById(R.id.alarm_text);
- }
- }
-
- public void setEventNotifier(
- BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier) {
- mEventNotifier = smartspaceEventNotifier;
- }
-
- public void setSmartspaceTarget(
- SmartspaceTarget smartspaceTarget,
- BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo,
- boolean z) {
- String str;
- int i;
- mTarget = smartspaceTarget;
- SmartspaceAction headerAction = smartspaceTarget.getHeaderAction();
- SmartspaceAction baseAction = smartspaceTarget.getBaseAction();
- mLoggingInfo = bcSmartspaceCardLoggingInfo;
- mUsePageIndicatorUi = z;
- if (headerAction != null) {
- BcSmartspaceCardSecondary bcSmartspaceCardSecondary = mSecondaryCard;
- if (bcSmartspaceCardSecondary != null) {
- mSecondaryCard.setVisibility(
- bcSmartspaceCardSecondary.setSmartspaceActions(
- smartspaceTarget,
- mEventNotifier,
- bcSmartspaceCardLoggingInfo)
- ? View.VISIBLE
- : View.GONE);
- }
- Drawable iconDrawable =
- BcSmartSpaceUtil.getIconDrawable(headerAction.getIcon(), getContext());
- mIconDrawable =
- iconDrawable == null
- ? null
- : new DoubleShadowIconDrawable(iconDrawable, getContext());
- CharSequence title = headerAction.getTitle();
- CharSequence subtitle = headerAction.getSubtitle();
- boolean z2 = smartspaceTarget.getFeatureType() == 1 || !TextUtils.isEmpty(title);
- boolean z3 = !TextUtils.isEmpty(subtitle);
- updateZenVisibility();
- if (!z2) {
- title = subtitle;
- }
- setTitle(title, headerAction.getContentDescription(), z2 != z3);
- if (!z2 || !z3) {
- subtitle = null;
- }
- setSubtitle(subtitle, headerAction.getContentDescription());
- updateIconTint();
- }
- if (baseAction != null && mBaseActionIconSubtitleView != null) {
- Drawable iconDrawable2 =
- baseAction.getIcon() == null
- ? null
- : BcSmartSpaceUtil.getIconDrawable(baseAction.getIcon(), getContext());
- if (iconDrawable2 == null) {
- mBaseActionIconSubtitleView.setVisibility(View.INVISIBLE);
- mBaseActionIconSubtitleView.setOnClickListener(null);
- mBaseActionIconSubtitleView.setContentDescription(null);
- } else {
- iconDrawable2.setTintList(null);
- mBaseActionIconSubtitleView.setText(baseAction.getSubtitle());
- mBaseActionIconSubtitleView.setCompoundDrawablesRelative(
- iconDrawable2, null, null, null);
- mBaseActionIconSubtitleView.setVisibility(View.VISIBLE);
- int subcardType = getSubcardType(baseAction);
- if (subcardType != -1) {
- i = getClickedIndex(bcSmartspaceCardLoggingInfo, subcardType);
- } else {
- Log.d(
- "BcSmartspaceCard",
- String.format(
- "Subcard expected but missing type. loggingInfo=%s,"
- + " baseAction=%s",
- bcSmartspaceCardLoggingInfo.toString(), baseAction.toString()));
- i = 0;
- }
- BcSmartSpaceUtil.setOnClickListener(
- mBaseActionIconSubtitleView,
- smartspaceTarget,
- baseAction,
- "BcSmartspaceCard",
- mEventNotifier,
- bcSmartspaceCardLoggingInfo,
- i);
- setFormattedContentDescription(
- mBaseActionIconSubtitleView,
- baseAction.getSubtitle(),
- baseAction.getContentDescription());
- }
- }
- if (mDateView != null) {
- if (headerAction != null) {
- str = headerAction.getId();
- } else if (baseAction != null) {
- str = baseAction.getId();
- } else {
- str = UUID.randomUUID().toString();
- }
- BcSmartSpaceUtil.setOnClickListener(
- mDateView,
- smartspaceTarget,
- new SmartspaceAction.Builder(str, "unusedTitle")
- .setIntent(BcSmartSpaceUtil.getOpenCalendarIntent())
- .build(),
- "BcSmartspaceCard",
- mEventNotifier,
- bcSmartspaceCardLoggingInfo);
- }
- if (hasIntent(headerAction)) {
- BcSmartSpaceUtil.setOnClickListener(
- this,
- smartspaceTarget,
- headerAction,
- "BcSmartspaceCard",
- mEventNotifier,
- bcSmartspaceCardLoggingInfo,
- (smartspaceTarget.getFeatureType() == 1
- && bcSmartspaceCardLoggingInfo.getFeatureType() == 39)
- ? getClickedIndex(bcSmartspaceCardLoggingInfo, 1)
- : 0);
- } else if (hasIntent(baseAction)) {
- BcSmartSpaceUtil.setOnClickListener(
- this,
- smartspaceTarget,
- baseAction,
- "BcSmartspaceCard",
- mEventNotifier,
- bcSmartspaceCardLoggingInfo);
- } else {
- BcSmartSpaceUtil.setOnClickListener(
- this,
- smartspaceTarget,
- headerAction,
- "BcSmartspaceCard",
- mEventNotifier,
- bcSmartspaceCardLoggingInfo);
- }
- }
-
- private int getClickedIndex(BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo, int i) {
- if (bcSmartspaceCardLoggingInfo == null
- || bcSmartspaceCardLoggingInfo.getSubcardInfo() == null
- || bcSmartspaceCardLoggingInfo.getSubcardInfo().getSubcards() == null) {
- return 0;
- }
- List subcards =
- bcSmartspaceCardLoggingInfo.getSubcardInfo().getSubcards();
- for (int i2 = 0; i2 < subcards.size(); i2++) {
- BcSmartspaceCardMetadataLoggingInfo bcSmartspaceCardMetadataLoggingInfo =
- subcards.get(i2);
- if (bcSmartspaceCardMetadataLoggingInfo != null
- && bcSmartspaceCardMetadataLoggingInfo.getCardTypeId() == i) {
- return i2 + 1;
- }
- }
- return 0;
- }
-
- private int getSubcardType(SmartspaceAction smartspaceAction) {
- if (smartspaceAction == null
- || smartspaceAction.getExtras() == null
- || smartspaceAction.getExtras().isEmpty()) {
- return -1;
- }
- return smartspaceAction.getExtras().getInt("subcardType", -1);
- }
-
- public void setSecondaryCard(BcSmartspaceCardSecondary bcSmartspaceCardSecondary) {
- mSecondaryCard = bcSmartspaceCardSecondary;
- if (getChildAt(1) != null) {
- removeViewAt(1);
- }
- if (bcSmartspaceCardSecondary != null) {
- LinearLayout.LayoutParams layoutParams =
- new LinearLayout.LayoutParams(
- 0,
- getResources()
- .getDimensionPixelSize(R.dimen.enhanced_smartspace_height));
- layoutParams.weight = 3.0f;
- layoutParams.setMarginStart(
- getResources()
- .getDimensionPixelSize(
- R.dimen.enhanced_smartspace_secondary_card_start_margin));
- layoutParams.setMarginEnd(
- getResources()
- .getDimensionPixelSize(
- R.dimen.enhanced_smartspace_secondary_card_end_margin));
- addView(bcSmartspaceCardSecondary, 1, layoutParams);
- }
- }
-
- public void setDozeAmount(float f) {
- mDozeAmount = f;
- BcSmartspaceCardSecondary bcSmartspaceCardSecondary = mSecondaryCard;
- if (bcSmartspaceCardSecondary != null) {
- bcSmartspaceCardSecondary.setAlpha(1.0f - f);
- }
- if (getTarget() != null
- && getTarget().getBaseAction() != null
- && getTarget().getBaseAction().getExtras() != null) {
- Bundle extras = getTarget().getBaseAction().getExtras();
- if (mTitleTextView != null && extras.getBoolean("hide_title_on_aod")) {
- mTitleTextView.setAlpha(1.0f - f);
- }
- if (mSubtitleTextView != null && extras.getBoolean("hide_subtitle_on_aod")) {
- mSubtitleTextView.setAlpha(1.0f - f);
- }
- }
- ImageView imageView = mDndImageView;
- if (imageView != null) {
- imageView.setAlpha(mDozeAmount);
- }
- }
-
- public void setPrimaryTextColor(int i) {
- TextView textView = mTitleTextView;
- if (textView != null) {
- textView.setTextColor(i);
- }
- IcuDateTextView icuDateTextView = mDateView;
- if (icuDateTextView != null) {
- icuDateTextView.setTextColor(i);
- }
- TextView textView2 = mSubtitleTextView;
- if (textView2 != null) {
- textView2.setTextColor(i);
- }
- DoubleShadowTextView doubleShadowTextView = mBaseActionIconSubtitleView;
- if (doubleShadowTextView != null) {
- doubleShadowTextView.setTextColor(i);
- }
- mIconTintColor = i;
- updateZenColors();
- updateIconTint();
- }
-
- @Override
- public AccessibilityNodeInfo createAccessibilityNodeInfo() {
- AccessibilityNodeInfo createAccessibilityNodeInfo = super.createAccessibilityNodeInfo();
- AccessibilityNodeInfoCompat.wrap(createAccessibilityNodeInfo).setRoleDescription(" ");
- return createAccessibilityNodeInfo;
- }
-
- void setTitle(CharSequence charSequence, CharSequence charSequence2, boolean z) {
- boolean z2;
- TextView textView = mTitleTextView;
- if (textView == null) {
- Log.w("BcSmartspaceCard", "No title view to update");
- return;
- }
- textView.setText(charSequence);
- SmartspaceAction headerAction = mTarget.getHeaderAction();
- Bundle extras = headerAction == null ? null : headerAction.getExtras();
- if (extras != null && extras.containsKey("titleEllipsize")) {
- String string = extras.getString("titleEllipsize");
- try {
- mTitleTextView.setEllipsize(TextUtils.TruncateAt.valueOf(string));
- } catch (IllegalArgumentException unused) {
- Log.w("BcSmartspaceCard", "Invalid TruncateAt value: " + string);
- }
- } else if (mTarget.getFeatureType() == 2
- && Locale.ENGLISH
- .getLanguage()
- .equals(mContext.getResources().getConfiguration().locale.getLanguage())) {
- mTitleTextView.setEllipsize(TextUtils.TruncateAt.MIDDLE);
- } else {
- mTitleTextView.setEllipsize(TextUtils.TruncateAt.END);
- }
- boolean z3 = false;
- if (extras != null) {
- int i = extras.getInt("titleMaxLines");
- if (i != 0) {
- mTitleTextView.setMaxLines(i);
- }
- z2 = extras.getBoolean("disableTitleIcon");
- } else {
- z2 = false;
- }
- if (z && !z2) {
- z3 = true;
- }
- if (z3) {
- setFormattedContentDescription(mTitleTextView, charSequence, charSequence2);
- }
- mTitleTextView.setCompoundDrawablesRelative(z3 ? mIconDrawable : null, null, null, null);
- }
-
- void setSubtitle(CharSequence charSequence, CharSequence charSequence2) {
- TextView textView = mSubtitleTextView;
- if (textView == null) {
- Log.w("BcSmartspaceCard", "No subtitle view to update");
- return;
- }
- textView.setText(charSequence);
- mSubtitleTextView.setCompoundDrawablesRelative(
- TextUtils.isEmpty(charSequence) ? null : mIconDrawable, null, null, null);
- mSubtitleTextView.setMaxLines(
- (mTarget.getFeatureType() != 5 || mUsePageIndicatorUi) ? 1 : 2);
- setFormattedContentDescription(mSubtitleTextView, charSequence, charSequence2);
- }
-
- void updateIconTint() {
- SmartspaceTarget smartspaceTarget = mTarget;
- if (smartspaceTarget == null || mIconDrawable == null) {
- return;
- }
- boolean z = true;
- if (smartspaceTarget.getFeatureType() == 1) {
- z = false;
- }
- if (z) {
- mIconDrawable.setTint(mIconTintColor);
- } else {
- mIconDrawable.setTintList(null);
- }
- }
-
- void updateZenColors() {
- TextView textView = mNextAlarmTextView;
- if (textView != null) {
- textView.setTextColor(mIconTintColor);
- }
- updateTint(mNextAlarmImageView);
- updateTint(mDndImageView);
- }
-
- private void updateTint(ImageView imageView) {
- if (imageView == null || imageView.getDrawable() == null) {
- return;
- }
- imageView.getDrawable().setTint(mIconTintColor);
- }
-
- public void setDnd(Drawable drawable, String str) {
- ImageView imageView = mDndImageView;
- if (imageView == null) {
- return;
- }
- if (drawable == null) {
- imageView.setVisibility(View.GONE);
- } else {
- imageView.setImageDrawable(
- new DoubleShadowIconDrawable(drawable.mutate(), getContext()));
- mDndImageView.setContentDescription(str);
- mDndImageView.setVisibility(View.VISIBLE);
- }
- updateZenVisibility();
- }
-
- public void setNextAlarm(Drawable drawable, String str, SmartspaceTarget smartspaceTarget) {
- ImageView imageView = mNextAlarmImageView;
- if (imageView == null || mNextAlarmTextView == null) {
- return;
- }
- if (drawable == null) {
- imageView.setVisibility(View.GONE);
- mNextAlarmTextView.setVisibility(View.GONE);
- } else {
- String maybeAppendHolidayInfoToNextAlarm =
- maybeAppendHolidayInfoToNextAlarm(str, smartspaceTarget);
- mNextAlarmImageView.setImageDrawable(
- new DoubleShadowIconDrawable(drawable.mutate(), getContext()));
- mNextAlarmImageView.setVisibility(View.VISIBLE);
- mNextAlarmTextView.setContentDescription(
- getContext()
- .getString(
- R.string.accessibility_next_alarm,
- maybeAppendHolidayInfoToNextAlarm));
- mNextAlarmTextView.setText(maybeAppendHolidayInfoToNextAlarm);
- mNextAlarmTextView.setVisibility(View.VISIBLE);
- setNextAlarmClickListener(mNextAlarmImageView, smartspaceTarget);
- setNextAlarmClickListener(mNextAlarmTextView, smartspaceTarget);
- }
- updateZenVisibility();
- }
-
- private void setNextAlarmClickListener(View view, SmartspaceTarget smartspaceTarget) {
- BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo;
- if (smartspaceTarget == null) {
- bcSmartspaceCardLoggingInfo =
- new BcSmartspaceCardLoggingInfo.Builder()
- .setInstanceId(InstanceId.create("upcoming_alarm_card_94510_12684"))
- .setFeatureType(23)
- .setDisplaySurface(
- BcSmartSpaceUtil.getLoggingDisplaySurface(
- getContext().getPackageName(), mDozeAmount))
- .build();
- } else {
- bcSmartspaceCardLoggingInfo =
- new BcSmartspaceCardLoggingInfo.Builder()
- .setInstanceId(InstanceId.create(smartspaceTarget))
- .setFeatureType(smartspaceTarget.getFeatureType())
- .setDisplaySurface(
- BcSmartSpaceUtil.getLoggingDisplaySurface(
- getContext().getPackageName(), mDozeAmount))
- .build();
- }
- BcSmartSpaceUtil.setOnClickListener(
- view,
- smartspaceTarget,
- SHOW_ALARMS_ACTION,
- "BcSmartspaceCard",
- mEventNotifier,
- bcSmartspaceCardLoggingInfo);
- }
-
- private String maybeAppendHolidayInfoToNextAlarm(
- String str, SmartspaceTarget smartspaceTarget) {
- CharSequence holidayAlarmsText = getHolidayAlarmsText(smartspaceTarget);
- if (!TextUtils.isEmpty(holidayAlarmsText)) {
- return str + " · " + ((Object) holidayAlarmsText);
- }
- return str;
- }
-
- public static CharSequence getHolidayAlarmsText(SmartspaceTarget smartspaceTarget) {
- SmartspaceAction headerAction;
- if (smartspaceTarget == null
- || (headerAction = smartspaceTarget.getHeaderAction()) == null) {
- return null;
- }
- return headerAction.getTitle();
- }
-
- private void updateZenVisibility() {
- if (mExtrasGroup == null) {
- return;
- }
- ImageView imageView = mDndImageView;
- boolean z = true;
- int i = 0;
- boolean z2 = imageView != null && imageView.getVisibility() == 0;
- ImageView imageView2 = mNextAlarmImageView;
- boolean z3 = imageView2 != null && imageView2.getVisibility() == 0;
- if ((!z2 && !z3) || (mUsePageIndicatorUi && mTarget.getFeatureType() != 1)) {
- z = false;
- }
- int i2 = mTopPadding;
- if (!z) {
- mExtrasGroup.setVisibility(View.INVISIBLE);
- i = i2;
- } else {
- mExtrasGroup.setVisibility(View.VISIBLE);
- updateZenColors();
- }
- setPadding(getPaddingLeft(), i, getPaddingRight(), getPaddingBottom());
- }
-
- public SmartspaceTarget getTarget() {
- return mTarget;
- }
-
- private void setFormattedContentDescription(
- TextView textView, CharSequence charSequence, CharSequence charSequence2) {
- if (TextUtils.isEmpty(charSequence)) {
- charSequence = charSequence2;
- } else if (!TextUtils.isEmpty(charSequence2)) {
- charSequence =
- mContext.getString(
- R.string.generic_smartspace_concatenated_desc,
- charSequence2,
- charSequence);
- }
- textView.setContentDescription(charSequence);
- }
-
- private boolean hasIntent(SmartspaceAction smartspaceAction) {
- return (smartspaceAction == null
- || (smartspaceAction.getIntent() == null
- && smartspaceAction.getPendingIntent() == null))
- ? false
- : true;
- }
-}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardCombination.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardCombination.java
deleted file mode 100644
index 565a6f0a6e354..0000000000000
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardCombination.java
+++ /dev/null
@@ -1,138 +0,0 @@
-package com.google.android.systemui.smartspace;
-
-import android.app.smartspace.SmartspaceAction;
-import android.app.smartspace.SmartspaceTarget;
-import android.content.Context;
-import android.graphics.drawable.Drawable;
-import android.text.TextUtils;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.View;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.TextView;
-
-import androidx.constraintlayout.widget.ConstraintLayout;
-
-import com.android.systemui.bcsmartspace.R;
-import com.android.systemui.plugins.BcSmartspaceDataPlugin;
-
-import com.google.android.systemui.smartspace.logging.BcSmartspaceCardLoggingInfo;
-
-import java.util.List;
-
-public class BcSmartspaceCardCombination extends BcSmartspaceCardSecondary {
- protected ConstraintLayout mFirstSubCard;
- protected ConstraintLayout mSecondSubCard;
-
- public BcSmartspaceCardCombination(Context context) {
- super(context);
- }
-
- public BcSmartspaceCardCombination(Context context, AttributeSet attributeSet) {
- super(context, attributeSet);
- }
-
- @Override
- protected void onFinishInflate() {
- super.onFinishInflate();
- mFirstSubCard = (ConstraintLayout) findViewById(R.id.first_sub_card);
- mSecondSubCard = (ConstraintLayout) findViewById(R.id.second_sub_card);
- }
-
- @Override
- public boolean setSmartspaceActions(
- SmartspaceTarget smartspaceTarget,
- BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier,
- BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo) {
- SmartspaceAction smartspaceAction;
- List actionChips = smartspaceTarget.getActionChips();
- if (actionChips == null
- || actionChips.size() < 1
- || (smartspaceAction = (SmartspaceAction) actionChips.get(0)) == null) {
- return false;
- }
- ConstraintLayout constraintLayout = mFirstSubCard;
- boolean z =
- constraintLayout != null
- && fillSubCard(
- constraintLayout,
- smartspaceTarget,
- smartspaceAction,
- smartspaceEventNotifier,
- bcSmartspaceCardLoggingInfo);
- boolean z2 = actionChips.size() > 1 && actionChips.get(1) != null;
- boolean fillSubCard =
- z2
- ? fillSubCard(
- mSecondSubCard,
- smartspaceTarget,
- (SmartspaceAction) actionChips.get(1),
- smartspaceEventNotifier,
- bcSmartspaceCardLoggingInfo)
- : true;
- if (getLayoutParams() instanceof LinearLayout.LayoutParams) {
- LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) getLayoutParams();
- if (z2 && fillSubCard) {
- layoutParams.weight = 3.0f;
- } else {
- layoutParams.weight = 1.0f;
- }
- setLayoutParams(layoutParams);
- }
- return z && fillSubCard;
- }
-
- public boolean fillSubCard(
- ConstraintLayout constraintLayout,
- SmartspaceTarget smartspaceTarget,
- SmartspaceAction smartspaceAction,
- BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier,
- BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo) {
- boolean z;
- TextView textView = (TextView) constraintLayout.findViewById(R.id.sub_card_text);
- ImageView imageView = (ImageView) constraintLayout.findViewById(R.id.sub_card_icon);
- if (textView == null) {
- Log.w("BcSmartspaceCardCombination", "No sub-card text field to update");
- return false;
- } else if (imageView == null) {
- Log.w("BcSmartspaceCardCombination", "No sub-card image field to update");
- return false;
- } else {
- BcSmartSpaceUtil.setOnClickListener(
- constraintLayout,
- smartspaceTarget,
- smartspaceAction,
- "BcSmartspaceCardCombination",
- smartspaceEventNotifier,
- bcSmartspaceCardLoggingInfo);
- Drawable iconDrawable =
- BcSmartSpaceUtil.getIconDrawable(smartspaceAction.getIcon(), getContext());
- boolean z2 = true;
- if (iconDrawable == null) {
- imageView.setVisibility(View.GONE);
- z = false;
- } else {
- imageView.setImageDrawable(iconDrawable);
- imageView.setVisibility(View.VISIBLE);
- z = true;
- }
- CharSequence title = smartspaceAction.getTitle();
- if (TextUtils.isEmpty(title)) {
- textView.setVisibility(View.GONE);
- z2 = z;
- } else {
- textView.setText(title);
- textView.setVisibility(View.VISIBLE);
- }
- constraintLayout.setContentDescription(
- z2 ? smartspaceAction.getContentDescription() : null);
- if (z2) {
- constraintLayout.setVisibility(View.VISIBLE);
- } else {
- constraintLayout.setVisibility(View.GONE);
- }
- return z2;
- }
- }
-}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardCombinationAtStore.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardCombinationAtStore.java
deleted file mode 100644
index 993e0788a1f2b..0000000000000
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardCombinationAtStore.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package com.google.android.systemui.smartspace;
-
-import android.app.smartspace.SmartspaceAction;
-import android.app.smartspace.SmartspaceTarget;
-import android.content.Context;
-import android.util.AttributeSet;
-
-import androidx.constraintlayout.widget.ConstraintLayout;
-
-import com.android.systemui.bcsmartspace.R;
-import com.android.systemui.plugins.BcSmartspaceDataPlugin;
-
-import com.google.android.systemui.smartspace.logging.BcSmartspaceCardLoggingInfo;
-
-import java.util.List;
-
-public class BcSmartspaceCardCombinationAtStore extends BcSmartspaceCardCombination {
- public BcSmartspaceCardCombinationAtStore(Context context) {
- super(context);
- }
-
- public BcSmartspaceCardCombinationAtStore(Context context, AttributeSet attributeSet) {
- super(context, attributeSet);
- }
-
- @Override
- public boolean setSmartspaceActions(
- SmartspaceTarget smartspaceTarget,
- BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier,
- BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo) {
- SmartspaceAction smartspaceAction;
- List actionChips = smartspaceTarget.getActionChips();
- if (actionChips == null
- || actionChips.isEmpty()
- || (smartspaceAction = (SmartspaceAction) actionChips.get(0)) == null) {
- return false;
- }
- ConstraintLayout constraintLayout = mFirstSubCard;
- boolean z =
- (constraintLayout instanceof BcSmartspaceCardShoppingList)
- && ((BcSmartspaceCardShoppingList) constraintLayout)
- .setSmartspaceActions(
- smartspaceTarget,
- smartspaceEventNotifier,
- bcSmartspaceCardLoggingInfo);
- ConstraintLayout constraintLayout2 = mSecondSubCard;
- boolean z2 =
- constraintLayout2 != null
- && fillSubCard(
- constraintLayout2,
- smartspaceTarget,
- smartspaceAction,
- smartspaceEventNotifier,
- bcSmartspaceCardLoggingInfo);
- if (z) {
- mFirstSubCard.setBackgroundResource(R.drawable.bg_smartspace_combination_sub_card);
- }
- return z && z2;
- }
-}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardDoorbell.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardDoorbell.java
deleted file mode 100644
index 4435659a25ae8..0000000000000
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardDoorbell.java
+++ /dev/null
@@ -1,283 +0,0 @@
-package com.google.android.systemui.smartspace;
-
-import android.app.smartspace.SmartspaceAction;
-import android.app.smartspace.SmartspaceTarget;
-import android.content.ContentResolver;
-import android.content.Context;
-import android.content.res.Resources;
-import android.graphics.Bitmap;
-import android.graphics.ImageDecoder;
-import android.graphics.drawable.AnimationDrawable;
-import android.graphics.drawable.ColorDrawable;
-import android.graphics.drawable.Drawable;
-import android.net.Uri;
-import android.os.AsyncTask;
-import android.os.Bundle;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.util.Size;
-import android.view.View;
-import android.widget.ImageView;
-import android.widget.ProgressBar;
-
-import androidx.cardview.widget.CardView;
-import androidx.constraintlayout.widget.ConstraintLayout;
-import androidx.core.content.ContextCompat;
-import androidx.core.graphics.drawable.RoundedBitmapDrawable;
-import androidx.core.graphics.drawable.RoundedBitmapDrawableFactory;
-
-import com.android.launcher3.icons.RoundDrawableWrapper;
-import com.android.systemui.bcsmartspace.R;
-import com.android.systemui.plugins.BcSmartspaceDataPlugin;
-
-import com.google.android.systemui.smartspace.logging.BcSmartspaceCardLoggingInfo;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.function.Function;
-import java.util.stream.Collectors;
-
-public class BcSmartspaceCardDoorbell extends BcSmartspaceCardGenericImage {
- private ImageView mLoadingIcon;
- private CardView mLoadingScreenView;
- private ProgressBar mProgressBar;
- private final Map mUriToDrawable = new HashMap();
- private int mGifFrameDurationInMs = 200;
-
- public BcSmartspaceCardDoorbell(Context context) {
- super(context);
- }
-
- public BcSmartspaceCardDoorbell(Context context, AttributeSet attributeSet) {
- super(context, attributeSet);
- }
-
- @Override
- public boolean setSmartspaceActions(
- SmartspaceTarget smartspaceTarget,
- BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier,
- BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo) {
- if (!isSysUiContext()) {
- return false;
- }
- SmartspaceAction baseAction = smartspaceTarget.getBaseAction();
- Bundle extras = baseAction == null ? null : baseAction.getExtras();
- List imageUris = getImageUris(smartspaceTarget);
- if (!imageUris.isEmpty()) {
- if (extras != null && extras.containsKey("frameDurationMs")) {
- mGifFrameDurationInMs = extras.getInt("frameDurationMs");
- }
- loadImageUris(imageUris);
- hideLoadingState(extras);
- Log.d("BcSmartspaceCardBell", "imageUri is set");
- return true;
- } else if (extras != null && extras.containsKey("imageBitmap")) {
- setRoundedBitmapDrawable((Bitmap) extras.get("imageBitmap"));
- hideLoadingState(extras);
- Log.d("BcSmartspaceCardBell", "imageBitmap is set");
- return true;
- } else if (extras == null || !extras.containsKey("loadingScreenState")) {
- return false;
- } else {
- int i = extras.getInt("loadingScreenState");
- String dimensionRatio = BcSmartSpaceUtil.getDimensionRatio(extras);
- if (dimensionRatio == null) {
- return false;
- }
- showLoadingScreen(dimensionRatio, i);
- return true;
- }
- }
-
- private void hideLoadingState(Bundle bundle) {
- if (bundle == null || bundle.getBoolean("hideLoadingScreen")) {
- mLoadingScreenView.setVisibility(View.GONE);
- }
- if (mLoadingScreenView.getVisibility() == 0) {
- mProgressBar.setVisibility(View.GONE);
- mLoadingIcon.setVisibility(View.GONE);
- }
- }
-
- private void showLoadingScreen(String str, int i) {
- ((ConstraintLayout.LayoutParams) mLoadingScreenView.getLayoutParams()).dimensionRatio = str;
- mLoadingScreenView.setVisibility(View.VISIBLE);
- toggleProgressBarAndLoadingIcon(i);
- }
-
- private void toggleProgressBarAndLoadingIcon(int i) {
- if (i == 2) {
- mLoadingIcon.setImageDrawable(
- ContextCompat.getDrawable(getContext(), R.drawable.videocam));
- }
- if (i == 3) {
- mLoadingIcon.setImageDrawable(
- ContextCompat.getDrawable(getContext(), R.drawable.videocam_off));
- }
- boolean z = true;
- int i2 = 0;
- if (i != 1) {
- z = false;
- }
- mProgressBar.setVisibility(z ? View.VISIBLE : View.GONE);
- ImageView imageView = mLoadingIcon;
- if (z) {
- i2 = 8;
- }
- imageView.setVisibility(i2);
- }
-
- private void setRoundedBitmapDrawable(Bitmap bitmap) {
- if (bitmap.getHeight() != 0) {
- int dimension = (int) getResources().getDimension(R.dimen.enhanced_smartspace_height);
- bitmap =
- Bitmap.createScaledBitmap(
- bitmap,
- (int) (dimension * (bitmap.getWidth() / bitmap.getHeight())),
- dimension,
- true);
- }
- RoundedBitmapDrawable create = RoundedBitmapDrawableFactory.create(getResources(), bitmap);
- create.setCornerRadius(
- getResources()
- .getDimension(R.dimen.enhanced_smartspace_secondary_card_corner_radius));
- mImageView.setImageDrawable(create);
- }
-
- private void loadImageUris(List list) {
- final ContentResolver contentResolver =
- getContext().getApplicationContext().getContentResolver();
- final int dimensionPixelOffset =
- getResources().getDimensionPixelOffset(R.dimen.enhanced_smartspace_height);
- final float dimension =
- getResources()
- .getDimension(R.dimen.enhanced_smartspace_secondary_card_corner_radius);
- addFramesToAnimatedDrawable(
- (List)
- list.stream()
- .map(
- new Function() {
- @Override
- public final Object apply(Object obj) {
- DrawableWithUri drawableWithUri =
- new DrawableWithUri(
- (Uri) obj,
- contentResolver,
- dimensionPixelOffset,
- dimension);
- new LoadUriTask().execute(drawableWithUri);
- return drawableWithUri;
- }
- })
- .filter(drawableWithUri -> drawableWithUri != null)
- .collect(Collectors.toList()));
- }
-
- private void addFramesToAnimatedDrawable(List list) {
- AnimationDrawable animationDrawable = new AnimationDrawable();
- for (Drawable drawable : list) {
- animationDrawable.addFrame(drawable, mGifFrameDurationInMs);
- }
- mImageView.setImageDrawable(animationDrawable);
- animationDrawable.start();
- }
-
- private List getImageUris(SmartspaceTarget smartspaceTarget) {
- return (List)
- smartspaceTarget.getIconGrid().stream()
- .filter(
- smartspaceAction ->
- smartspaceAction.getExtras().containsKey("imageUri"))
- .map(smartspaceAction -> smartspaceAction.getExtras().getString("imageUri"))
- .map(uri -> Uri.parse(uri))
- .collect(Collectors.toList());
- }
-
- private boolean isSysUiContext() {
- return getContext().getPackageName().equals("com.android.systemui");
- }
-
- public static class DrawableWithUri extends RoundDrawableWrapper {
- ContentResolver mContentResolver;
- Drawable mDrawable;
- int mHeightInPx;
- Uri mUri;
-
- DrawableWithUri(Uri uri, ContentResolver contentResolver, int i, float f) {
- super(new ColorDrawable(0), f);
- mUri = uri;
- mHeightInPx = i;
- mContentResolver = contentResolver;
- }
- }
-
- @Override
- public void onFinishInflate() {
- super.onFinishInflate();
- mLoadingScreenView = (CardView) findViewById(R.id.loading_screen);
- mProgressBar = (ProgressBar) findViewById(R.id.indeterminateBar);
- mLoadingIcon = (ImageView) findViewById(R.id.loading_screen_icon);
- }
-
- public static Drawable getSampleBitmapDrawable(InputStream inputStream, final int i) {
- try {
- return ImageDecoder.decodeDrawable(
- ImageDecoder.createSource((Resources) null, inputStream),
- new ImageDecoder.OnHeaderDecodedListener() {
- @Override
- public final void onHeaderDecoded(
- ImageDecoder imageDecoder,
- ImageDecoder.ImageInfo imageInfo,
- ImageDecoder.Source source) {
- imageDecoder.setAllocator(3);
- imageDecoder.setTargetSize((int) (i * getTargetRatio(imageInfo)), i);
- }
- });
- } catch (IOException e) {
- Log.e("BcSmartspaceCardBell", "Unable to decode stream: " + e);
- return null;
- }
- }
-
- private static float getTargetRatio(ImageDecoder.ImageInfo imageInfo) {
- Size size = imageInfo.getSize();
- if (size.getHeight() != 0) {
- return size.getWidth() / size.getHeight();
- }
- return 0.0f;
- }
-
- public static class LoadUriTask extends AsyncTask {
- private LoadUriTask() {}
-
- public DrawableWithUri doInBackground(DrawableWithUri... drawableWithUriArr) {
- if (drawableWithUriArr.length > 0) {
- DrawableWithUri drawableWithUri = drawableWithUriArr[0];
- try {
- drawableWithUri.mDrawable =
- BcSmartspaceCardDoorbell.getSampleBitmapDrawable(
- drawableWithUri.mContentResolver.openInputStream(
- drawableWithUri.mUri),
- drawableWithUri.mHeightInPx);
- } catch (Exception e) {
- Log.w(
- "BcSmartspaceCardBell",
- "open uri:" + drawableWithUri.mUri + " got exception:" + e);
- }
- return drawableWithUri;
- }
- return null;
- }
-
- public void onPostExecute(DrawableWithUri drawableWithUri) {
- Drawable drawable;
- if (drawableWithUri == null || (drawable = drawableWithUri.mDrawable) == null) {
- return;
- }
- drawableWithUri.setDrawable(drawable);
- }
- }
-}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardFlight.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardFlight.java
deleted file mode 100644
index ef8ed643b2962..0000000000000
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardFlight.java
+++ /dev/null
@@ -1,140 +0,0 @@
-package com.google.android.systemui.smartspace;
-
-import android.app.smartspace.SmartspaceAction;
-import android.app.smartspace.SmartspaceTarget;
-import android.content.Context;
-import android.graphics.Bitmap;
-import android.os.Bundle;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.View;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-import androidx.constraintlayout.widget.ConstraintLayout;
-
-import com.android.systemui.bcsmartspace.R;
-import com.android.systemui.plugins.BcSmartspaceDataPlugin;
-
-import com.google.android.systemui.smartspace.logging.BcSmartspaceCardLoggingInfo;
-
-public class BcSmartspaceCardFlight extends BcSmartspaceCardSecondary {
- private ConstraintLayout mBoardingPassUI;
- private ImageView mCardPromptLogoView;
- private TextView mCardPromptView;
- private TextView mGateValueView;
- private ImageView mQrCodeView;
- private TextView mSeatValueView;
-
- public BcSmartspaceCardFlight(Context context) {
- super(context);
- }
-
- public BcSmartspaceCardFlight(Context context, AttributeSet attributeSet) {
- super(context, attributeSet);
- }
-
- @Override
- public boolean setSmartspaceActions(
- SmartspaceTarget smartspaceTarget,
- BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier,
- BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo) {
- SmartspaceAction baseAction = smartspaceTarget.getBaseAction();
- Bundle extras = baseAction == null ? null : baseAction.getExtras();
- boolean z = true;
- if (extras != null) {
- mBoardingPassUI.setVisibility(View.GONE);
- mCardPromptView.setVisibility(View.GONE);
- mCardPromptLogoView.setVisibility(View.GONE);
- if (extras.containsKey("cardPrompt") || extras.containsKey("cardPromptBitmap")) {
- if (extras.containsKey("cardPrompt")) {
- setCardPrompt(extras.getString("cardPrompt"));
- mCardPromptView.setVisibility(View.VISIBLE);
- }
- if (!extras.containsKey("cardPromptBitmap")) {
- return true;
- }
- setCardPromptLogo((Bitmap) extras.get("cardPromptBitmap"));
- mCardPromptLogoView.setVisibility(View.VISIBLE);
- return true;
- }
- if (extras.containsKey("qrCodeBitmap")) {
- setFlightQrCode((Bitmap) extras.get("qrCodeBitmap"));
- mBoardingPassUI.setVisibility(View.VISIBLE);
- } else {
- z = false;
- }
- if (extras.containsKey("gate")) {
- setFlightGateText(extras.getString("gate"));
- } else {
- setFlightGateText("-");
- }
- if (extras.containsKey("seat")) {
- setFlightSeatText(extras.getString("seat"));
- return z;
- }
- setFlightSeatText("-");
- return z;
- }
- return false;
- }
-
- @Override
- protected void onFinishInflate() {
- super.onFinishInflate();
- mCardPromptView = (TextView) findViewById(R.id.card_prompt);
- mCardPromptLogoView = (ImageView) findViewById(R.id.card_prompt_logo);
- ConstraintLayout constraintLayout = (ConstraintLayout) findViewById(R.id.boarding_pass_ui);
- mBoardingPassUI = constraintLayout;
- if (constraintLayout != null) {
- mGateValueView = (TextView) constraintLayout.findViewById(R.id.gate_value);
- mSeatValueView = (TextView) mBoardingPassUI.findViewById(R.id.seat_value);
- mQrCodeView = (ImageView) mBoardingPassUI.findViewById(R.id.flight_qr_code);
- }
- }
-
- protected void setCardPrompt(String str) {
- TextView textView = mCardPromptView;
- if (textView == null) {
- Log.w("BcSmartspaceCardFlight", "No card prompt view to update");
- } else {
- textView.setText(str);
- }
- }
-
- protected void setCardPromptLogo(Bitmap bitmap) {
- ImageView imageView = mCardPromptLogoView;
- if (imageView == null) {
- Log.w("BcSmartspaceCardFlight", "No card prompt logo view to update");
- } else {
- imageView.setImageBitmap(bitmap);
- }
- }
-
- void setFlightGateText(CharSequence charSequence) {
- TextView textView = mGateValueView;
- if (textView == null) {
- Log.w("BcSmartspaceCardFlight", "No flight gate value view to update");
- } else {
- textView.setText(charSequence);
- }
- }
-
- void setFlightSeatText(CharSequence charSequence) {
- TextView textView = mSeatValueView;
- if (textView == null) {
- Log.w("BcSmartspaceCardFlight", "No flight seat value view to update");
- } else {
- textView.setText(charSequence);
- }
- }
-
- void setFlightQrCode(Bitmap bitmap) {
- ImageView imageView = mQrCodeView;
- if (imageView == null) {
- Log.w("BcSmartspaceCardFlight", "No flight QR code view to update");
- } else {
- imageView.setImageBitmap(bitmap);
- }
- }
-}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardGenericImage.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardGenericImage.java
deleted file mode 100644
index 9176054107a52..0000000000000
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardGenericImage.java
+++ /dev/null
@@ -1,79 +0,0 @@
-package com.google.android.systemui.smartspace;
-
-import android.app.smartspace.SmartspaceAction;
-import android.app.smartspace.SmartspaceTarget;
-import android.content.Context;
-import android.graphics.Bitmap;
-import android.os.Bundle;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.ViewGroup;
-import android.widget.ImageView;
-
-import androidx.constraintlayout.widget.ConstraintLayout;
-
-import com.android.systemui.bcsmartspace.R;
-import com.android.systemui.plugins.BcSmartspaceDataPlugin;
-
-import com.google.android.systemui.smartspace.logging.BcSmartspaceCardLoggingInfo;
-
-public class BcSmartspaceCardGenericImage extends BcSmartspaceCardSecondary {
- protected ImageView mImageView;
-
- public BcSmartspaceCardGenericImage(Context context) {
- super(context);
- }
-
- public BcSmartspaceCardGenericImage(Context context, AttributeSet attributeSet) {
- super(context, attributeSet);
- }
-
- @Override
- public boolean setSmartspaceActions(
- SmartspaceTarget smartspaceTarget,
- BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier,
- BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo) {
- SmartspaceAction baseAction = smartspaceTarget.getBaseAction();
- Bundle extras = baseAction == null ? null : baseAction.getExtras();
- if (extras == null || !extras.containsKey("imageBitmap")) {
- return false;
- }
- if (extras.containsKey("imageScaleType")) {
- String string = extras.getString("imageScaleType");
- try {
- mImageView.setScaleType(ImageView.ScaleType.valueOf(string));
- } catch (IllegalArgumentException unused) {
- Log.w("SmartspaceGenericImg", "Invalid imageScaleType value: " + string);
- }
- }
- String dimensionRatio = BcSmartSpaceUtil.getDimensionRatio(extras);
- if (dimensionRatio != null) {
- ((ConstraintLayout.LayoutParams) mImageView.getLayoutParams()).dimensionRatio =
- dimensionRatio;
- }
- if (extras.containsKey("imageLayoutWidth")) {
- ((ViewGroup.MarginLayoutParams)
- ((ConstraintLayout.LayoutParams) mImageView.getLayoutParams()))
- .width =
- extras.getInt("imageLayoutWidth");
- }
- if (extras.containsKey("imageLayoutHeight")) {
- ((ViewGroup.MarginLayoutParams)
- ((ConstraintLayout.LayoutParams) mImageView.getLayoutParams()))
- .height =
- extras.getInt("imageLayoutHeight");
- }
- setImageBitmap((Bitmap) extras.get("imageBitmap"));
- return true;
- }
-
- @Override
- public void onFinishInflate() {
- super.onFinishInflate();
- mImageView = (ImageView) findViewById(R.id.image_view);
- }
-
- public void setImageBitmap(Bitmap bitmap) {
- mImageView.setImageBitmap(bitmap);
- }
-}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardLoyalty.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardLoyalty.java
deleted file mode 100644
index c6b70ca2af6fe..0000000000000
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardLoyalty.java
+++ /dev/null
@@ -1,102 +0,0 @@
-package com.google.android.systemui.smartspace;
-
-import android.app.smartspace.SmartspaceAction;
-import android.app.smartspace.SmartspaceTarget;
-import android.content.Context;
-import android.graphics.Bitmap;
-import android.os.Bundle;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.View;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-import com.android.systemui.bcsmartspace.R;
-import com.android.systemui.plugins.BcSmartspaceDataPlugin;
-
-import com.google.android.systemui.smartspace.logging.BcSmartspaceCardLoggingInfo;
-
-public class BcSmartspaceCardLoyalty extends BcSmartspaceCardGenericImage {
- private TextView mCardPromptView;
- private ImageView mLoyaltyProgramLogoView;
- private TextView mLoyaltyProgramNameView;
-
- public BcSmartspaceCardLoyalty(Context context) {
- super(context);
- }
-
- public BcSmartspaceCardLoyalty(Context context, AttributeSet attributeSet) {
- super(context, attributeSet);
- }
-
- @Override
- public boolean setSmartspaceActions(
- SmartspaceTarget smartspaceTarget,
- BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier,
- BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo) {
- super.setSmartspaceActions(
- smartspaceTarget, smartspaceEventNotifier, bcSmartspaceCardLoggingInfo);
- SmartspaceAction baseAction = smartspaceTarget.getBaseAction();
- Bundle extras = baseAction == null ? null : baseAction.getExtras();
- mImageView.setVisibility(View.GONE);
- mLoyaltyProgramLogoView.setVisibility(View.GONE);
- mLoyaltyProgramNameView.setVisibility(View.GONE);
- mCardPromptView.setVisibility(View.GONE);
- if (extras != null) {
- boolean containsKey = extras.containsKey("imageBitmap");
- if (extras.containsKey("cardPrompt")) {
- setCardPrompt(extras.getString("cardPrompt"));
- mCardPromptView.setVisibility(View.VISIBLE);
- if (containsKey) {
- mImageView.setVisibility(View.VISIBLE);
- }
- return true;
- } else if (!extras.containsKey("loyaltyProgramName")) {
- if (containsKey) {
- mLoyaltyProgramLogoView.setVisibility(View.VISIBLE);
- }
- return containsKey;
- } else {
- setLoyaltyProgramName(extras.getString("loyaltyProgramName"));
- mLoyaltyProgramNameView.setVisibility(View.VISIBLE);
- if (containsKey) {
- mLoyaltyProgramLogoView.setVisibility(View.VISIBLE);
- }
- return true;
- }
- }
- return false;
- }
-
- @Override
- public void onFinishInflate() {
- super.onFinishInflate();
- mLoyaltyProgramLogoView = (ImageView) findViewById(R.id.loyalty_program_logo);
- mLoyaltyProgramNameView = (TextView) findViewById(R.id.loyalty_program_name);
- mCardPromptView = (TextView) findViewById(R.id.card_prompt);
- }
-
- @Override
- public void setImageBitmap(Bitmap bitmap) {
- super.setImageBitmap(bitmap);
- mLoyaltyProgramLogoView.setImageBitmap(bitmap);
- }
-
- void setCardPrompt(String str) {
- TextView textView = mCardPromptView;
- if (textView == null) {
- Log.w("BcSmartspaceCardLoyalty", "No card prompt view to update");
- } else {
- textView.setText(str);
- }
- }
-
- void setLoyaltyProgramName(String str) {
- TextView textView = mLoyaltyProgramNameView;
- if (textView == null) {
- Log.w("BcSmartspaceCardLoyalty", "No loyalty program name view to update");
- } else {
- textView.setText(str);
- }
- }
-}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardSecondary.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardSecondary.java
deleted file mode 100644
index 30b818c6c6fa7..0000000000000
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardSecondary.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.google.android.systemui.smartspace;
-
-import android.app.smartspace.SmartspaceTarget;
-import android.content.Context;
-import android.util.AttributeSet;
-
-import androidx.constraintlayout.widget.ConstraintLayout;
-
-import com.android.systemui.plugins.BcSmartspaceDataPlugin;
-
-import com.google.android.systemui.smartspace.logging.BcSmartspaceCardLoggingInfo;
-
-public abstract class BcSmartspaceCardSecondary extends ConstraintLayout {
- public abstract boolean setSmartspaceActions(
- SmartspaceTarget smartspaceTarget,
- BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier,
- BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo);
-
- public BcSmartspaceCardSecondary(Context context) {
- super(context);
- }
-
- public BcSmartspaceCardSecondary(Context context, AttributeSet attributeSet) {
- super(context, attributeSet);
- }
-}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardShoppingList.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardShoppingList.java
deleted file mode 100644
index 6928a402e8ea1..0000000000000
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardShoppingList.java
+++ /dev/null
@@ -1,155 +0,0 @@
-package com.google.android.systemui.smartspace;
-
-import android.app.smartspace.SmartspaceAction;
-import android.app.smartspace.SmartspaceTarget;
-import android.content.Context;
-import android.graphics.Bitmap;
-import android.os.Bundle;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.View;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-import com.android.systemui.bcsmartspace.R;
-import com.android.systemui.plugins.BcSmartspaceDataPlugin;
-
-import com.google.android.systemui.smartspace.logging.BcSmartspaceCardLoggingInfo;
-
-import java.util.Locale;
-
-public class BcSmartspaceCardShoppingList extends BcSmartspaceCardSecondary {
- private static final int[] LIST_ITEM_TEXT_VIEW_IDS = {
- R.id.list_item_1, R.id.list_item_2, R.id.list_item_3
- };
- private ImageView mCardPromptIconView;
- private TextView mCardPromptView;
- private TextView mEmptyListMessageView;
- private ImageView mListIconView;
-
- public BcSmartspaceCardShoppingList(Context context) {
- super(context);
- }
-
- public BcSmartspaceCardShoppingList(Context context, AttributeSet attributeSet) {
- super(context, attributeSet);
- }
-
- @Override
- public boolean setSmartspaceActions(
- SmartspaceTarget smartspaceTarget,
- BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier,
- BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo) {
- SmartspaceAction baseAction = smartspaceTarget.getBaseAction();
- Bitmap bitmap = null;
- Bundle extras = baseAction == null ? null : baseAction.getExtras();
- if (extras != null) {
- mEmptyListMessageView.setVisibility(View.GONE);
- mListIconView.setVisibility(View.GONE);
- mCardPromptIconView.setVisibility(View.GONE);
- mCardPromptView.setVisibility(View.GONE);
- for (int i = 0; i < 3; i++) {
- TextView textView = (TextView) findViewById(LIST_ITEM_TEXT_VIEW_IDS[i]);
- if (textView != null) {
- textView.setVisibility(View.GONE);
- }
- }
- if (extras.containsKey("appIcon")) {
- bitmap = (Bitmap) extras.get("appIcon");
- } else if (extras.containsKey("imageBitmap")) {
- bitmap = (Bitmap) extras.get("imageBitmap");
- }
- setIconBitmap(bitmap);
- if (extras.containsKey("cardPrompt")) {
- setCardPrompt(extras.getString("cardPrompt"));
- mCardPromptView.setVisibility(View.VISIBLE);
- if (bitmap != null) {
- mCardPromptIconView.setVisibility(View.VISIBLE);
- }
- return true;
- } else if (extras.containsKey("emptyListString")) {
- setEmptyListMessage(extras.getString("emptyListString"));
- mEmptyListMessageView.setVisibility(View.VISIBLE);
- mListIconView.setVisibility(View.VISIBLE);
- return true;
- } else if (extras.containsKey("listItems")) {
- String[] stringArray = extras.getStringArray("listItems");
- if (stringArray.length == 0) {
- return false;
- }
- mListIconView.setVisibility(View.VISIBLE);
- setShoppingItems(stringArray, extras.getInt("listSize", -1));
- return true;
- }
- }
- return false;
- }
-
- @Override
- protected void onFinishInflate() {
- super.onFinishInflate();
- mCardPromptView = (TextView) findViewById(R.id.card_prompt);
- mEmptyListMessageView = (TextView) findViewById(R.id.empty_list_message);
- mCardPromptIconView = (ImageView) findViewById(R.id.card_prompt_icon);
- mListIconView = (ImageView) findViewById(R.id.list_icon);
- }
-
- void setIconBitmap(Bitmap bitmap) {
- mCardPromptIconView.setImageBitmap(bitmap);
- mListIconView.setImageBitmap(bitmap);
- }
-
- void setCardPrompt(String str) {
- TextView textView = mCardPromptView;
- if (textView == null) {
- Log.w("BcSmartspaceCardShoppingList", "No card prompt view to update");
- } else {
- textView.setText(str);
- }
- }
-
- void setEmptyListMessage(String str) {
- TextView textView = mEmptyListMessageView;
- if (textView == null) {
- Log.w("BcSmartspaceCardShoppingList", "No empty list message view to update");
- } else {
- textView.setText(str);
- }
- }
-
- void setShoppingItems(String[] strArr, int i) {
- if (strArr == null) {
- Log.w("BcSmartspaceCardShoppingList", "Shopping list items array is null.");
- return;
- }
- int[] iArr = LIST_ITEM_TEXT_VIEW_IDS;
- if (iArr.length < 3) {
- Log.w(
- "BcSmartspaceCardShoppingList",
- String.format(
- Locale.US,
- "Missing %d list item view(s) to update",
- Integer.valueOf(3 - iArr.length)));
- return;
- }
- for (int i2 = 0; i2 < 3; i2++) {
- TextView textView = (TextView) findViewById(LIST_ITEM_TEXT_VIEW_IDS[i2]);
- if (textView == null) {
- Log.w(
- "BcSmartspaceCardShoppingList",
- String.format(
- Locale.US,
- "Missing list item view to update at row: %d",
- Integer.valueOf(i2 + 1)));
- return;
- }
- if (i2 < strArr.length) {
- textView.setVisibility(View.VISIBLE);
- textView.setText(strArr[i2]);
- } else {
- textView.setVisibility(View.GONE);
- textView.setText("");
- }
- }
- }
-}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardSports.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardSports.java
deleted file mode 100644
index 178aae24d6c12..0000000000000
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardSports.java
+++ /dev/null
@@ -1,105 +0,0 @@
-package com.google.android.systemui.smartspace;
-
-import android.app.smartspace.SmartspaceAction;
-import android.app.smartspace.SmartspaceTarget;
-import android.content.Context;
-import android.graphics.Bitmap;
-import android.os.Bundle;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-import com.android.systemui.bcsmartspace.R;
-import com.android.systemui.plugins.BcSmartspaceDataPlugin;
-
-import com.google.android.systemui.smartspace.logging.BcSmartspaceCardLoggingInfo;
-
-public class BcSmartspaceCardSports extends BcSmartspaceCardSecondary {
- public BcSmartspaceCardSports(Context context) {
- super(context);
- }
-
- public BcSmartspaceCardSports(Context context, AttributeSet attributeSet) {
- super(context, attributeSet);
- }
-
- @Override
- public boolean setSmartspaceActions(
- SmartspaceTarget smartspaceTarget,
- BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier,
- BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo) {
- SmartspaceAction baseAction = smartspaceTarget.getBaseAction();
- Bundle extras = baseAction == null ? null : baseAction.getExtras();
- boolean z = false;
- if (extras != null) {
- if (extras.containsKey("matchTimeSummary")) {
- setMatchTimeSummaryText(extras.getString("matchTimeSummary"));
- z = true;
- }
- if (extras.containsKey("firstCompetitorScore")) {
- setFirstCompetitorScore(extras.getString("firstCompetitorScore"));
- z = true;
- }
- if (extras.containsKey("secondCompetitorScore")) {
- setSecondCompetitorScore(extras.getString("secondCompetitorScore"));
- z = true;
- }
- if (extras.containsKey("firstCompetitorLogo")) {
- setFirstCompetitorLogo((Bitmap) extras.get("firstCompetitorLogo"));
- z = true;
- }
- if (!extras.containsKey("secondCompetitorLogo")) {
- return z;
- }
- setSecondCompetitorLogo((Bitmap) extras.get("secondCompetitorLogo"));
- return true;
- }
- return false;
- }
-
- void setMatchTimeSummaryText(String str) {
- TextView textView = (TextView) findViewById(R.id.match_time_summary);
- if (textView == null) {
- Log.w("BcSmartspaceCardSports", "No match time summary view to update");
- } else {
- textView.setText(str);
- }
- }
-
- void setFirstCompetitorScore(String str) {
- TextView textView = (TextView) findViewById(R.id.first_competitor_score);
- if (textView == null) {
- Log.w("BcSmartspaceCardSports", "No first competitor logo view to update");
- } else {
- textView.setText(str);
- }
- }
-
- void setSecondCompetitorScore(String str) {
- TextView textView = (TextView) findViewById(R.id.second_competitor_score);
- if (textView == null) {
- Log.w("BcSmartspaceCardSports", "No second competitor logo view to update");
- } else {
- textView.setText(str);
- }
- }
-
- void setFirstCompetitorLogo(Bitmap bitmap) {
- ImageView imageView = (ImageView) findViewById(R.id.first_competitor_logo);
- if (imageView == null) {
- Log.w("BcSmartspaceCardSports", "No first competitor logo view to update");
- } else {
- imageView.setImageBitmap(bitmap);
- }
- }
-
- void setSecondCompetitorLogo(Bitmap bitmap) {
- ImageView imageView = (ImageView) findViewById(R.id.second_competitor_logo);
- if (imageView == null) {
- Log.w("BcSmartspaceCardSports", "No second competitor logo view to update");
- } else {
- imageView.setImageBitmap(bitmap);
- }
- }
-}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardWeatherForecast.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardWeatherForecast.java
deleted file mode 100644
index 8d7425ab9297f..0000000000000
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceCardWeatherForecast.java
+++ /dev/null
@@ -1,240 +0,0 @@
-package com.google.android.systemui.smartspace;
-
-import android.app.smartspace.SmartspaceAction;
-import android.app.smartspace.SmartspaceTarget;
-import android.content.Context;
-import android.graphics.Bitmap;
-import android.os.Bundle;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-import androidx.constraintlayout.widget.ConstraintLayout;
-import androidx.constraintlayout.widget.Constraints;
-
-import com.android.systemui.bcsmartspace.R;
-import com.android.systemui.plugins.BcSmartspaceDataPlugin;
-
-import com.google.android.systemui.smartspace.logging.BcSmartspaceCardLoggingInfo;
-
-import java.util.Locale;
-
-public class BcSmartspaceCardWeatherForecast extends BcSmartspaceCardSecondary {
- public BcSmartspaceCardWeatherForecast(Context context) {
- super(context);
- }
-
- public BcSmartspaceCardWeatherForecast(Context context, AttributeSet attributeSet) {
- super(context, attributeSet);
- }
-
- @Override
- protected void onFinishInflate() {
- super.onFinishInflate();
- createWeatherForecastColumns();
- }
-
- @Override
- public boolean setSmartspaceActions(
- SmartspaceTarget smartspaceTarget,
- BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier,
- BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo) {
- SmartspaceAction baseAction = smartspaceTarget.getBaseAction();
- Bundle extras = baseAction == null ? null : baseAction.getExtras();
- boolean z = false;
- if (extras != null) {
- if (extras.containsKey("temperatureValues")) {
- setTemperatureValues(extras.getStringArray("temperatureValues"));
- z = true;
- }
- if (extras.containsKey("weatherIcons")) {
- setWeatherIcons((Bitmap[]) extras.get("weatherIcons"));
- z = true;
- }
- if (!extras.containsKey("timestamps")) {
- return z;
- }
- setTimestamps(extras.getStringArray("timestamps"));
- return true;
- }
- return false;
- }
-
- void setTemperatureValues(String[] strArr) {
- if (strArr == null) {
- Log.w("BcSmartspaceCardWeatherForecast", "Temperature values array is null.");
- } else if (getChildCount() < 4) {
- Log.w(
- "BcSmartspaceCardWeatherForecast",
- String.format(
- Locale.US,
- "Missing %d temperature value view(s) to update.",
- Integer.valueOf(4 - getChildCount())));
- } else {
- if (strArr.length < 4) {
- Log.w(
- "BcSmartspaceCardWeatherForecast",
- String.format(
- Locale.US,
- "Missing %d temperature value(s). Hiding incomplete columns.",
- Integer.valueOf(4 - strArr.length)));
- hideIncompleteColumns(4 - strArr.length);
- }
- int min = Math.min(4, strArr.length);
- for (int i = 0; i < min; i++) {
- TextView textView = (TextView) getChildAt(i).findViewById(R.id.temperature_value);
- if (textView == null) {
- Log.w(
- "BcSmartspaceCardWeatherForecast",
- String.format(
- Locale.US,
- "Missing temperature value view to update at column: %d.",
- Integer.valueOf(i + 1)));
- return;
- }
- textView.setText(strArr[i]);
- }
- }
- }
-
- void setWeatherIcons(Bitmap[] bitmapArr) {
- if (bitmapArr == null) {
- Log.w("BcSmartspaceCardWeatherForecast", "Weather icons array is null.");
- } else if (getChildCount() < 4) {
- Log.w(
- "BcSmartspaceCardWeatherForecast",
- String.format(
- Locale.US,
- "Missing %d weather icon view(s) to update.",
- Integer.valueOf(4 - getChildCount())));
- } else {
- if (bitmapArr.length < 4) {
- Log.w(
- "BcSmartspaceCardWeatherForecast",
- String.format(
- Locale.US,
- "Missing %d weather icon(s). Hiding incomplete columns.",
- Integer.valueOf(4 - bitmapArr.length)));
- hideIncompleteColumns(4 - bitmapArr.length);
- }
- int min = Math.min(4, bitmapArr.length);
- for (int i = 0; i < min; i++) {
- ImageView imageView = (ImageView) getChildAt(i).findViewById(R.id.weather_icon);
- if (imageView == null) {
- Log.w(
- "BcSmartspaceCardWeatherForecast",
- String.format(
- Locale.US,
- "Missing weather logo view to update at column: %d.",
- Integer.valueOf(i + 1)));
- return;
- }
- imageView.setImageBitmap(bitmapArr[i]);
- }
- }
- }
-
- void setTimestamps(String[] strArr) {
- if (strArr == null) {
- Log.w("BcSmartspaceCardWeatherForecast", "Timestamps array is null.");
- } else if (getChildCount() < 4) {
- Log.w(
- "BcSmartspaceCardWeatherForecast",
- String.format(
- Locale.US,
- "Missing %d timestamp view(s) to update.",
- Integer.valueOf(4 - getChildCount())));
- } else {
- if (strArr.length < 4) {
- Log.w(
- "BcSmartspaceCardWeatherForecast",
- String.format(
- Locale.US,
- "Missing %d timestamp(s). Hiding incomplete columns.",
- Integer.valueOf(4 - strArr.length)));
- hideIncompleteColumns(4 - strArr.length);
- }
- int min = Math.min(4, strArr.length);
- for (int i = 0; i < min; i++) {
- TextView textView = (TextView) getChildAt(i).findViewById(R.id.timestamp);
- if (textView == null) {
- Log.w(
- "BcSmartspaceCardWeatherForecast",
- String.format(
- Locale.US,
- "Missing timestamp view to update at column: %d.",
- Integer.valueOf(i + 1)));
- return;
- }
- textView.setText(strArr[i]);
- }
- }
- }
-
- private void createWeatherForecastColumns() {
- View[] viewArr = new ConstraintLayout[4];
- for (int i = 0; i < 4; i++) {
- ConstraintLayout constraintLayout =
- (ConstraintLayout)
- ViewGroup.inflate(
- getContext(),
- R.layout.smartspace_card_weather_forecast_column,
- null);
- constraintLayout.setId(View.generateViewId());
- viewArr[i] = constraintLayout;
- }
- int i2 = 0;
- while (i2 < 4) {
- Constraints.LayoutParams layoutParams = new Constraints.LayoutParams(-2, 0);
- View view = viewArr[i2];
- ConstraintLayout constraintLayout2 =
- i2 > 0 ? ((ConstraintLayout) viewArr[i2 - 1]) : null;
- ConstraintLayout constraintLayout3 =
- i2 < 3 ? ((ConstraintLayout) viewArr[i2 + 1]) : null;
- if (i2 == 0) {
- layoutParams.startToStart = 0;
- layoutParams.horizontalChainStyle = 1;
- } else {
- layoutParams.startToEnd = constraintLayout2.getId();
- }
- if (i2 == 3) {
- layoutParams.endToEnd = 0;
- } else {
- layoutParams.endToStart = constraintLayout3.getId();
- }
- layoutParams.topToTop = 0;
- layoutParams.bottomToBottom = 0;
- addView(view, layoutParams);
- i2++;
- }
- }
-
- private void hideIncompleteColumns(int i) {
- int i2 = 1;
- if (getChildCount() < 4) {
- Log.w(
- "BcSmartspaceCardWeatherForecast",
- String.format(
- Locale.US,
- "Missing %d columns to update.",
- Integer.valueOf(4 - getChildCount())));
- return;
- }
- int i3 = 3 - i;
- int i4 = 0;
- while (i4 < 4) {
- getChildAt(i4).setVisibility(i4 <= i3 ? View.VISIBLE : View.GONE);
- i4++;
- }
- ConstraintLayout.LayoutParams layoutParams =
- (ConstraintLayout.LayoutParams)
- ((ConstraintLayout) getChildAt(0)).getLayoutParams();
- if (i != 0) {
- i2 = 0;
- }
- layoutParams.horizontalChainStyle = i2;
- }
-}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceDataProvider.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceDataProvider.java
deleted file mode 100644
index 25ed655c2f585..0000000000000
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceDataProvider.java
+++ /dev/null
@@ -1,109 +0,0 @@
-package com.google.android.systemui.smartspace;
-
-import android.app.smartspace.SmartspaceTarget;
-import android.app.smartspace.SmartspaceTargetEvent;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-
-import com.android.systemui.bcsmartspace.R;
-import com.android.systemui.plugins.BcSmartspaceDataPlugin;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.function.Consumer;
-
-public class BcSmartspaceDataProvider implements BcSmartspaceDataPlugin {
- private final Set mSmartspaceTargetListeners =
- new HashSet();
- private final List mSmartspaceTargets = new ArrayList();
- private Set mViews = new HashSet();
- private Set mAttachListeners = new HashSet();
- private BcSmartspaceDataPlugin.SmartspaceEventNotifier mEventNotifier = null;
- private View.OnAttachStateChangeListener mStateChangeListener =
- new View.OnAttachStateChangeListener() {
- @Override
- public void onViewAttachedToWindow(View view) {
- mViews.add(view);
- for (View.OnAttachStateChangeListener onAttachStateChangeListener :
- mAttachListeners) {
- onAttachStateChangeListener.onViewAttachedToWindow(view);
- }
- }
-
- @Override
- public void onViewDetachedFromWindow(View view) {
- mViews.remove(view);
- view.removeOnAttachStateChangeListener(this);
- for (View.OnAttachStateChangeListener onAttachStateChangeListener :
- mAttachListeners) {
- onAttachStateChangeListener.onViewDetachedFromWindow(view);
- }
- }
- };
-
- @Override
- public void registerListener(
- BcSmartspaceDataPlugin.SmartspaceTargetListener smartspaceTargetListener) {
- mSmartspaceTargetListeners.add(smartspaceTargetListener);
- smartspaceTargetListener.onSmartspaceTargetsUpdated(mSmartspaceTargets);
- }
-
- @Override
- public void unregisterListener(
- BcSmartspaceDataPlugin.SmartspaceTargetListener smartspaceTargetListener) {
- mSmartspaceTargetListeners.remove(smartspaceTargetListener);
- }
-
- @Override
- public void registerSmartspaceEventNotifier(
- BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier) {
- mEventNotifier = smartspaceEventNotifier;
- }
-
- @Override
- public void notifySmartspaceEvent(SmartspaceTargetEvent smartspaceTargetEvent) {
- BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier = mEventNotifier;
- if (smartspaceEventNotifier != null) {
- smartspaceEventNotifier.notifySmartspaceEvent(smartspaceTargetEvent);
- }
- }
-
- @Override
- public BcSmartspaceDataPlugin.SmartspaceView getView(ViewGroup viewGroup) {
- View inflate =
- LayoutInflater.from(viewGroup.getContext())
- .inflate(R.layout.smartspace_enhanced, viewGroup, false);
- inflate.addOnAttachStateChangeListener(mStateChangeListener);
- return (BcSmartspaceDataPlugin.SmartspaceView) inflate;
- }
-
- @Override
- public void addOnAttachStateChangeListener(
- View.OnAttachStateChangeListener onAttachStateChangeListener) {
- mAttachListeners.add(onAttachStateChangeListener);
- for (View view : mViews) {
- onAttachStateChangeListener.onViewAttachedToWindow(view);
- }
- }
-
- @Override
- public void onTargetsAvailable(List list) {
- mSmartspaceTargets.clear();
- for (SmartspaceTarget smartspaceTarget : list) {
- if (smartspaceTarget.getFeatureType() != 15) {
- mSmartspaceTargets.add(smartspaceTarget);
- }
- }
- mSmartspaceTargetListeners.forEach(
- new Consumer() {
- @Override
- public final void accept(Object obj) {
- ((BcSmartspaceDataPlugin.SmartspaceTargetListener) obj)
- .onSmartspaceTargetsUpdated(mSmartspaceTargets);
- }
- });
- }
-}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceEvent.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceEvent.java
deleted file mode 100644
index 11e673ef70a70..0000000000000
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceEvent.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.google.android.systemui.smartspace;
-
-public enum BcSmartspaceEvent implements EventEnum {
- IGNORE(-1),
- SMARTSPACE_CARD_RECEIVED(759),
- SMARTSPACE_CARD_CLICK(760),
- SMARTSPACE_CARD_DISMISS(761),
- SMARTSPACE_CARD_SEEN(800),
- ENABLED_SMARTSPACE(822),
- DISABLED_SMARTSPACE(823);
-
- private final int mId;
-
- BcSmartspaceEvent(int i) {
- mId = i;
- }
-
- @Override
- public int getId() {
- return mId;
- }
-}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceView.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceView.java
deleted file mode 100644
index 044fa1b388491..0000000000000
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/BcSmartspaceView.java
+++ /dev/null
@@ -1,475 +0,0 @@
-package com.google.android.systemui.smartspace;
-
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-import android.animation.AnimatorSet;
-import android.animation.ObjectAnimator;
-import android.app.smartspace.SmartspaceAction;
-import android.app.smartspace.SmartspaceTarget;
-import android.app.smartspace.SmartspaceTargetEvent;
-import android.content.ComponentName;
-import android.content.Context;
-import android.database.ContentObserver;
-import android.graphics.drawable.Drawable;
-import android.os.Handler;
-import android.os.Parcelable;
-import android.provider.Settings;
-import android.text.TextUtils;
-import android.util.ArraySet;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.FrameLayout;
-
-import androidx.viewpager.widget.ViewPager;
-
-import com.android.systemui.bcsmartspace.R;
-import com.android.systemui.plugins.BcSmartspaceDataPlugin;
-import com.android.systemui.plugins.FalsingManager;
-
-import com.google.android.systemui.smartspace.logging.BcSmartspaceCardLogger;
-import com.google.android.systemui.smartspace.logging.BcSmartspaceCardLoggerUtil;
-import com.google.android.systemui.smartspace.logging.BcSmartspaceCardLoggingInfo;
-
-import java.time.DateTimeException;
-import java.time.Instant;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.stream.Collectors;
-
-public class BcSmartspaceView extends FrameLayout
- implements BcSmartspaceDataPlugin.SmartspaceTargetListener,
- BcSmartspaceDataPlugin.SmartspaceView {
- private static ArraySet mLastReceivedTargets = new ArraySet<>();
- private static int sLastSurface = -1;
- private BcSmartspaceDataPlugin mDataProvider;
- private PageIndicator mPageIndicator;
- private List extends Parcelable> mPendingTargets;
- private Animator mRunningAnimation;
- private ViewPager mViewPager;
- private boolean mIsAodEnabled = false;
- private int mCardPosition = 0;
- private boolean mAnimateSmartspaceUpdate = false;
- private int mScrollState = 0;
- private final ContentObserver mAodObserver =
- new ContentObserver(new Handler()) {
- @Override
- public void onChange(boolean z) {
- onSettingsChanged();
- }
- };
- private final CardPagerAdapter mAdapter = new CardPagerAdapter(this);
- private final ViewPager.OnPageChangeListener mOnPageChangeListener =
- new ViewPager.OnPageChangeListener() {
- private int mCurrentPosition = -1;
-
- @Override
- public void onPageScrollStateChanged(int i) {
- mScrollState = i;
- if (i != 0 || mPendingTargets == null) {
- return;
- }
- BcSmartspaceView bcSmartspaceView = BcSmartspaceView.this;
- onSmartspaceTargetsUpdated(mPendingTargets);
- mPendingTargets = null;
- }
-
- @Override
- public void onPageScrolled(int i, float f, int i2) {
- if (mPageIndicator != null) {
- mPageIndicator.setPageOffset(i, f);
- }
- }
-
- @Override
- public void onPageSelected(int i) {
- mCardPosition = i;
- BcSmartspaceCard cardAtPosition = mAdapter.getCardAtPosition(mCurrentPosition);
- mCurrentPosition = i;
- SmartspaceTarget targetAtPosition =
- mAdapter.getTargetAtPosition(mCurrentPosition);
- logSmartspaceEvent(
- targetAtPosition,
- mCurrentPosition,
- BcSmartspaceEvent.SMARTSPACE_CARD_SEEN);
- if (mDataProvider == null) {
- Log.w(
- "BcSmartspaceView",
- "Cannot notify target hidden/shown smartspace events: data provider"
- + " null");
- return;
- }
- if (cardAtPosition == null) {
- Log.w(
- "BcSmartspaceView",
- "Cannot notify target hidden smartspace event: hidden card null.");
- } else {
- SmartspaceTarget target = cardAtPosition.getTarget();
- if (target == null) {
- Log.w(
- "BcSmartspaceView",
- "Cannot notify target hidden smartspace event: hidden card"
- + " smartspace target null.");
- } else {
- SmartspaceTargetEvent.Builder builder =
- new SmartspaceTargetEvent.Builder(3);
- builder.setSmartspaceTarget(target);
- SmartspaceAction baseAction = target.getBaseAction();
- if (baseAction != null) {
- builder.setSmartspaceActionId(baseAction.getId());
- }
- mDataProvider.notifySmartspaceEvent(builder.build());
- }
- }
- if (targetAtPosition == null) {
- Log.w(
- "BcSmartspaceView",
- "Cannot notify target shown smartspace event: shown card smartspace"
- + " target null.");
- return;
- }
- SmartspaceTargetEvent.Builder builder2 = new SmartspaceTargetEvent.Builder(2);
- builder2.setSmartspaceTarget(targetAtPosition);
- SmartspaceAction baseAction2 = targetAtPosition.getBaseAction();
- if (baseAction2 != null) {
- builder2.setSmartspaceActionId(baseAction2.getId());
- }
- mDataProvider.notifySmartspaceEvent(builder2.build());
- }
- };
-
- public BcSmartspaceView(Context context, AttributeSet attributeSet) {
- super(context, attributeSet);
- }
-
- @Override
- public void onVisibilityAggregated(boolean z) {
- super.onVisibilityAggregated(z);
- BcSmartspaceDataPlugin bcSmartspaceDataPlugin = mDataProvider;
- if (bcSmartspaceDataPlugin != null) {
- bcSmartspaceDataPlugin.notifySmartspaceEvent(
- new SmartspaceTargetEvent.Builder(z ? 6 : 7).build());
- }
- }
-
- public void logCurrentDisplayedCardSeen() {
- SmartspaceTarget targetAtPosition = mAdapter.getTargetAtPosition(mCardPosition);
- if (targetAtPosition == null) {
- Log.w("BcSmartspaceView", "Current card is not present in the Adapter; cannot log.");
- } else {
- logSmartspaceEvent(
- targetAtPosition, mCardPosition, BcSmartspaceEvent.SMARTSPACE_CARD_SEEN);
- }
- if (mAdapter.getNextAlarmImage() != null) {
- SmartspaceTarget createUpcomingAlarmTarget =
- BcSmartSpaceUtil.createUpcomingAlarmTarget(
- new ComponentName(getContext(), getClass()), getContext().getUser());
- BcSmartspaceEvent bcSmartspaceEvent = BcSmartspaceEvent.SMARTSPACE_CARD_SEEN;
- logSmartspaceEvent(createUpcomingAlarmTarget, 0, bcSmartspaceEvent);
- SmartspaceTarget holidayAlarmsTarget = mAdapter.getHolidayAlarmsTarget();
- if (TextUtils.isEmpty(BcSmartspaceCard.getHolidayAlarmsText(holidayAlarmsTarget))) {
- return;
- }
- logSmartspaceEvent(holidayAlarmsTarget, 0, bcSmartspaceEvent);
- }
- }
-
- @Override
- protected void onFinishInflate() {
- super.onFinishInflate();
- mViewPager = (ViewPager) findViewById(R.id.smartspace_card_pager);
- mPageIndicator = (PageIndicator) findViewById(R.id.smartspace_page_indicator);
- }
-
- @Override
- protected void onAttachedToWindow() {
- super.onAttachedToWindow();
- mViewPager.setAdapter(mAdapter);
- mViewPager.addOnPageChangeListener(mOnPageChangeListener);
- mPageIndicator.setNumPages(mAdapter.getCount());
- try {
- getContext()
- .getContentResolver()
- .registerContentObserver(
- Settings.Secure.getUriFor("doze_always_on"), false, mAodObserver, -1);
- mIsAodEnabled = isAodEnabled(getContext());
- } catch (Exception e) {
- Log.w("BcSmartspaceView", "Unable to register Doze Always on content observer.", e);
- }
- BcSmartspaceDataPlugin bcSmartspaceDataPlugin = mDataProvider;
- if (bcSmartspaceDataPlugin != null) {
- registerDataProvider(bcSmartspaceDataPlugin);
- }
- }
-
- @Override
- protected void onDetachedFromWindow() {
- super.onDetachedFromWindow();
- getContext().getContentResolver().unregisterContentObserver(mAodObserver);
- BcSmartspaceDataPlugin bcSmartspaceDataPlugin = mDataProvider;
- if (bcSmartspaceDataPlugin != null) {
- bcSmartspaceDataPlugin.unregisterListener(this);
- }
- }
-
- @Override
- protected void onMeasure(int i, int i2) {
- int size = View.MeasureSpec.getSize(i2);
- int dimensionPixelSize =
- getContext()
- .getResources()
- .getDimensionPixelSize(R.dimen.enhanced_smartspace_height);
- if (size > 0 && size < dimensionPixelSize) {
- float f = size;
- float f2 = dimensionPixelSize;
- float f3 = f / f2;
- super.onMeasure(
- View.MeasureSpec.makeMeasureSpec(
- Math.round(View.MeasureSpec.getSize(i) / f3), 1073741824),
- View.MeasureSpec.makeMeasureSpec(dimensionPixelSize, 1073741824));
- setScaleX(f3);
- setScaleY(f3);
- setPivotX(0.0f);
- setPivotY(f2 / 2.0f);
- return;
- }
- super.onMeasure(i, i2);
- setScaleX(1.0f);
- setScaleY(1.0f);
- resetPivot();
- }
-
- @Override
- public void registerDataProvider(BcSmartspaceDataPlugin bcSmartspaceDataPlugin) {
- mDataProvider = bcSmartspaceDataPlugin;
- bcSmartspaceDataPlugin.registerListener(this);
- mAdapter.setDataProvider(mDataProvider);
- }
-
- @Override
- public void onSmartspaceTargetsUpdated(List extends Parcelable> list) {
- int i;
- boolean z = true;
- if (mScrollState != 0 && mAdapter.getCount() > 1) {
- mPendingTargets = list;
- return;
- }
- if (getLayoutDirection() != 1) {
- z = false;
- }
- int currentItem = mViewPager.getCurrentItem();
- if (z) {
- i = mAdapter.getCount() - currentItem;
- ArrayList arrayList = new ArrayList(list);
- Collections.reverse(arrayList);
- list = arrayList;
- } else {
- i = currentItem;
- }
- BcSmartspaceCard cardAtPosition = mAdapter.getCardAtPosition(currentItem);
- mAdapter.setTargets(list);
- int count = mAdapter.getCount();
- if (z) {
- mViewPager.setCurrentItem(Math.max(0, Math.min(count - 1, count - i)), false);
- }
- PageIndicator pageIndicator = mPageIndicator;
- if (pageIndicator != null) {
- pageIndicator.setNumPages(count);
- }
- if (mAnimateSmartspaceUpdate) {
- animateSmartspaceUpdate(cardAtPosition);
- }
- for (int i2 = 0; i2 < count; i2++) {
- SmartspaceTarget targetAtPosition = mAdapter.getTargetAtPosition(i2);
- if (!mLastReceivedTargets.contains(targetAtPosition.getSmartspaceTargetId())) {
- logSmartspaceEvent(
- targetAtPosition, i2, BcSmartspaceEvent.SMARTSPACE_CARD_RECEIVED);
- SmartspaceTargetEvent.Builder builder = new SmartspaceTargetEvent.Builder(8);
- builder.setSmartspaceTarget(targetAtPosition);
- SmartspaceAction baseAction = targetAtPosition.getBaseAction();
- if (baseAction != null) {
- builder.setSmartspaceActionId(baseAction.getId());
- }
- mDataProvider.notifySmartspaceEvent(builder.build());
- }
- }
- mLastReceivedTargets.clear();
- mLastReceivedTargets.addAll(
- (Collection)
- mAdapter.getTargets().stream()
- .map(smartspaceTarget -> smartspaceTarget.getSmartspaceTargetId())
- .collect(Collectors.toList()));
- mAdapter.notifyDataSetChanged();
- }
-
- @Override
- public final int getCurrentCardTopPadding() {
- BcSmartspaceCard card = mAdapter.getCardAtPosition(getSelectedPage());
- if (card != null) {
- return card.getPaddingTop();
- }
- return 0;
- }
-
- @Override
- public final int getSelectedPage() {
- return mViewPager.getCurrentItem();
- }
-
- public void logSmartspaceEvent(
- SmartspaceTarget smartspaceTarget, int i, BcSmartspaceEvent bcSmartspaceEvent) {
- int i2;
- if (bcSmartspaceEvent == BcSmartspaceEvent.SMARTSPACE_CARD_RECEIVED) {
- try {
- i2 =
- (int)
- Instant.now()
- .minusMillis(smartspaceTarget.getCreationTimeMillis())
- .toEpochMilli();
- } catch (ArithmeticException | DateTimeException e) {
- Log.e(
- "BcSmartspaceView",
- "received_latency_millis will be -1 due to exception ",
- e);
- i2 = -1;
- }
- } else {
- i2 = 0;
- }
- BcSmartspaceCardLoggingInfo build =
- new BcSmartspaceCardLoggingInfo.Builder()
- .setInstanceId(InstanceId.create(smartspaceTarget))
- .setFeatureType(smartspaceTarget.getFeatureType())
- .setDisplaySurface(
- BcSmartSpaceUtil.getLoggingDisplaySurface(
- getContext().getPackageName(), mAdapter.getDozeAmount()))
- .setRank(i)
- .setCardinality(mAdapter.getCount())
- .setReceivedLatency(i2)
- .setSubcardInfo(
- BcSmartspaceCardLoggerUtil.createSubcardLoggingInfo(
- smartspaceTarget))
- .build();
- BcSmartspaceCardLoggerUtil.forcePrimaryFeatureTypeAndInjectWeatherSubcard(
- build, smartspaceTarget, 39);
- BcSmartspaceCardLogger.log(bcSmartspaceEvent, build);
- }
-
- private void animateSmartspaceUpdate(final BcSmartspaceCard bcSmartspaceCard) {
- if (bcSmartspaceCard != null
- && mRunningAnimation == null
- && bcSmartspaceCard.getParent() == null) {
- final ViewGroup viewGroup = (ViewGroup) mViewPager.getParent();
- bcSmartspaceCard.measure(
- View.MeasureSpec.makeMeasureSpec(mViewPager.getWidth(), 1073741824),
- View.MeasureSpec.makeMeasureSpec(mViewPager.getHeight(), 1073741824));
- bcSmartspaceCard.layout(
- mViewPager.getLeft(),
- mViewPager.getTop(),
- mViewPager.getRight(),
- mViewPager.getBottom());
- AnimatorSet animatorSet = new AnimatorSet();
- float dimension =
- getContext()
- .getResources()
- .getDimension(R.dimen.enhanced_smartspace_dismiss_margin);
- animatorSet.play(
- ObjectAnimator.ofFloat(
- bcSmartspaceCard,
- View.TRANSLATION_Y,
- 0.0f,
- (-getHeight()) - dimension));
- animatorSet.play(ObjectAnimator.ofFloat(bcSmartspaceCard, View.ALPHA, 1.0f, 0.0f));
- animatorSet.play(
- ObjectAnimator.ofFloat(
- mViewPager, View.TRANSLATION_Y, getHeight() + dimension, 0.0f));
- animatorSet.addListener(
- new AnimatorListenerAdapter() {
- @Override
- public void onAnimationStart(Animator animator) {
- viewGroup.getOverlay().add(bcSmartspaceCard);
- }
-
- @Override
- public void onAnimationEnd(Animator animator) {
- viewGroup.getOverlay().remove(bcSmartspaceCard);
- mRunningAnimation = null;
- mAnimateSmartspaceUpdate = false;
- }
- });
- mRunningAnimation = animatorSet;
- animatorSet.start();
- }
- }
-
- @Override
- public void setPrimaryTextColor(int i) {
- mAdapter.setPrimaryTextColor(i);
- mPageIndicator.setPrimaryColor(i);
- }
-
- @Override
- public void setDozeAmount(float f) {
- mPageIndicator.setAlpha(1.0f - f);
- mAdapter.setDozeAmount(f);
- int loggingDisplaySurface =
- BcSmartSpaceUtil.getLoggingDisplaySurface(
- getContext().getPackageName(), mAdapter.getDozeAmount());
- if (loggingDisplaySurface == -1 || loggingDisplaySurface == sLastSurface) {
- return;
- }
- sLastSurface = loggingDisplaySurface;
- if (loggingDisplaySurface == 3 && !mIsAodEnabled) {
- return;
- }
- logCurrentDisplayedCardSeen();
- }
-
- @Override
- public void setIsDreaming(boolean z) {
- mAdapter.setIsDreaming(z);
- }
-
- @Override
- public void setIntentStarter(BcSmartspaceDataPlugin.IntentStarter intentStarter) {
- BcSmartSpaceUtil.setIntentStarter(intentStarter);
- }
-
- @Override
- public void setFalsingManager(FalsingManager falsingManager) {
- BcSmartSpaceUtil.setFalsingManager(falsingManager);
- }
-
- @Override
- public void setDnd(Drawable drawable, String str) {
- mAdapter.setDnd(drawable, str);
- }
-
- @Override
- public void setNextAlarm(Drawable drawable, String str) {
- mAdapter.setNextAlarm(drawable, str);
- }
-
- @Override
- public void setMediaTarget(SmartspaceTarget smartspaceTarget) {
- mAdapter.setMediaTarget(smartspaceTarget);
- }
-
- @Override
- public void setOnLongClickListener(View.OnLongClickListener onLongClickListener) {
- mViewPager.setOnLongClickListener(onLongClickListener);
- }
-
- public void onSettingsChanged() {
- mIsAodEnabled = isAodEnabled(getContext());
- }
-
- private static boolean isAodEnabled(Context context) {
- return Settings.Secure.getIntForUser(
- context.getContentResolver(), "doze_always_on", 0, context.getUserId())
- == 1;
- }
-}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/CardPagerAdapter.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/CardPagerAdapter.java
deleted file mode 100644
index 56de6d22760e9..0000000000000
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/CardPagerAdapter.java
+++ /dev/null
@@ -1,352 +0,0 @@
-package com.google.android.systemui.smartspace;
-
-import android.app.smartspace.SmartspaceTarget;
-import android.app.smartspace.SmartspaceTargetEvent;
-import android.content.ComponentName;
-import android.graphics.drawable.Drawable;
-import android.os.Parcelable;
-import android.util.SparseArray;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-
-import androidx.viewpager.widget.PagerAdapter;
-
-import com.android.internal.graphics.ColorUtils;
-import com.android.launcher3.icons.GraphicsUtils;
-import com.android.systemui.bcsmartspace.R;
-import com.android.systemui.plugins.BcSmartspaceDataPlugin;
-
-import com.google.android.systemui.smartspace.logging.BcSmartspaceCardLoggerUtil;
-import com.google.android.systemui.smartspace.logging.BcSmartspaceCardLoggingInfo;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-import java.util.function.Consumer;
-
-public class CardPagerAdapter extends PagerAdapter {
- private int mCurrentTextColor;
- private BcSmartspaceDataPlugin mDataProvider;
- private int mPrimaryTextColor;
- private final View mRoot;
- private List mSmartspaceTargets = new ArrayList();
- private final List mTargetsExcludingMediaAndHolidayAlarms = new ArrayList();
- private final List mMediaTargets = new ArrayList();
- private boolean mHasOnlyDefaultDateCard = false;
- private final SparseArray mHolders = new SparseArray<>();
- private float mDozeAmount = 0.0f;
- private int mDozeColor = -1;
- private String mDndDescription = null;
- private Drawable mDndImage = null;
- private String mNextAlarmDescription = null;
- private Drawable mNextAlarmImage = null;
- private SmartspaceTarget mHolidayAlarmsTarget = null;
- private boolean mIsDreaming = false;
-
- public CardPagerAdapter(View view) {
- mRoot = view;
- int attrColor = GraphicsUtils.getAttrColor(view.getContext(), 16842806);
- mPrimaryTextColor = attrColor;
- mCurrentTextColor = attrColor;
- }
-
- @Override
- public int getCount() {
- return mSmartspaceTargets.size();
- }
-
- @Override
- public boolean isViewFromObject(View view, Object obj) {
- return view == ((ViewHolder) obj).card;
- }
-
- @Override
- public void destroyItem(ViewGroup viewGroup, int i, Object obj) {
- ViewHolder viewHolder = (ViewHolder) obj;
- viewGroup.removeView(viewHolder.card);
- if (mHolders.get(i) == viewHolder) {
- mHolders.remove(i);
- }
- }
-
- public BcSmartspaceCard getCardAtPosition(int i) {
- ViewHolder viewHolder = mHolders.get(i);
- if (viewHolder == null) {
- return null;
- }
- return viewHolder.card;
- }
-
- public SmartspaceTarget getTargetAtPosition(int i) {
- if (mSmartspaceTargets.isEmpty() || i < 0 || i >= mSmartspaceTargets.size()) {
- return null;
- }
- return mSmartspaceTargets.get(i);
- }
-
- public List getTargets() {
- return mSmartspaceTargets;
- }
-
- @Override
- public int getItemPosition(Object obj) {
- ViewHolder viewHolder = (ViewHolder) obj;
- SmartspaceTarget targetAtPosition = getTargetAtPosition(viewHolder.position);
- if (viewHolder.target == targetAtPosition) {
- return -1;
- }
- if (targetAtPosition == null
- || getFeatureType(targetAtPosition) != getFeatureType(viewHolder.target)
- || !Objects.equals(
- targetAtPosition.getSmartspaceTargetId(),
- viewHolder.target.getSmartspaceTargetId())) {
- return -2;
- }
- viewHolder.target = targetAtPosition;
- onBindViewHolder(viewHolder);
- return -1;
- }
-
- @Override
- public ViewHolder instantiateItem(ViewGroup viewGroup, int i) {
- SmartspaceTarget smartspaceTarget = mSmartspaceTargets.get(i);
- BcSmartspaceCard createBaseCard =
- createBaseCard(viewGroup, getFeatureType(smartspaceTarget));
- ViewHolder viewHolder = new ViewHolder(i, createBaseCard, smartspaceTarget);
- onBindViewHolder(viewHolder);
- viewGroup.addView(createBaseCard);
- mHolders.put(i, viewHolder);
- return viewHolder;
- }
-
- private int getFeatureType(SmartspaceTarget smartspaceTarget) {
- List actionChips = smartspaceTarget.getActionChips();
- int featureType = smartspaceTarget.getFeatureType();
- return (actionChips == null || actionChips.isEmpty())
- ? featureType
- : (featureType == 13 && actionChips.size() == 1) ? -2 : -1;
- }
-
- private BcSmartspaceCard createBaseCard(ViewGroup viewGroup, int i) {
- int i2;
- int i3;
- if (i == -2) {
- i2 = R.layout.smartspace_card_at_store;
- } else if (i == 1) {
- i2 = R.layout.smartspace_card_date;
- } else if (i == 20) {
- i2 = R.layout.smartspace_base_card_package_delivery;
- } else if (i == 30) {
- i2 = R.layout.smartspace_base_card_doorbell;
- } else {
- i2 = R.layout.smartspace_card;
- }
- LayoutInflater from = LayoutInflater.from(viewGroup.getContext());
- BcSmartspaceCard bcSmartspaceCard = (BcSmartspaceCard) from.inflate(i2, viewGroup, false);
- if (i == -2) {
- i3 = R.layout.smartspace_card_combination_at_store;
- } else if (i == -1) {
- i3 = R.layout.smartspace_card_combination;
- } else {
- if (i != 3) {
- if (i == 4) {
- i3 = R.layout.smartspace_card_flight;
- } else if (i == 9) {
- i3 = R.layout.smartspace_card_sports;
- } else if (i == 10) {
- i3 = R.layout.smartspace_card_weather_forecast;
- } else if (i == 13) {
- i3 = R.layout.smartspace_card_shopping_list;
- } else if (i == 14) {
- i3 = R.layout.smartspace_card_loyalty;
- } else if (i != 18) {
- i3 = (i == 20 || i == 30) ? R.layout.smartspace_card_doorbell : 0;
- }
- }
- i3 = R.layout.smartspace_card_generic_landscape_image;
- }
- if (i3 != 0) {
- bcSmartspaceCard.setSecondaryCard(
- (BcSmartspaceCardSecondary)
- from.inflate(i3, (ViewGroup) bcSmartspaceCard, false));
- }
- return bcSmartspaceCard;
- }
-
- private void onBindViewHolder(ViewHolder viewHolder) {
- BcSmartspaceDataPlugin.SmartspaceEventNotifier smartspaceEventNotifier;
- SmartspaceTarget smartspaceTarget = mSmartspaceTargets.get(viewHolder.position);
- BcSmartspaceCard bcSmartspaceCard = viewHolder.card;
- BcSmartspaceCardLoggingInfo build =
- new BcSmartspaceCardLoggingInfo.Builder()
- .setInstanceId(InstanceId.create(smartspaceTarget))
- .setFeatureType(smartspaceTarget.getFeatureType())
- .setDisplaySurface(
- BcSmartSpaceUtil.getLoggingDisplaySurface(
- mRoot.getContext().getPackageName(), mDozeAmount))
- .setRank(viewHolder.position)
- .setCardinality(mSmartspaceTargets.size())
- .setSubcardInfo(
- BcSmartspaceCardLoggerUtil.createSubcardLoggingInfo(
- smartspaceTarget))
- .build();
- final BcSmartspaceDataPlugin bcSmartspaceDataPlugin = mDataProvider;
- if (bcSmartspaceDataPlugin == null) {
- smartspaceEventNotifier = null;
- } else {
- smartspaceEventNotifier = (smartspaceTargetEvent) -> {
- bcSmartspaceDataPlugin.notifySmartspaceEvent(smartspaceTargetEvent);
- };
- }
- bcSmartspaceCard.setEventNotifier(smartspaceEventNotifier);
- BcSmartspaceCardLoggerUtil.forcePrimaryFeatureTypeAndInjectWeatherSubcard(
- build, smartspaceTarget, 39);
- boolean z = true;
- if (mSmartspaceTargets.size() <= 1) {
- z = false;
- }
- bcSmartspaceCard.setSmartspaceTarget(smartspaceTarget, build, z);
- bcSmartspaceCard.setPrimaryTextColor(mCurrentTextColor);
- bcSmartspaceCard.setDozeAmount(mDozeAmount);
- bcSmartspaceCard.setDnd(mDndImage, mDndDescription);
- bcSmartspaceCard.setNextAlarm(mNextAlarmImage, mNextAlarmDescription, mHolidayAlarmsTarget);
- }
-
- private boolean isHolidayAlarmsTarget(SmartspaceTarget smartspaceTarget) {
- return smartspaceTarget.getFeatureType() == 34;
- }
-
- public void setTargets(List extends Parcelable> list) {
- mTargetsExcludingMediaAndHolidayAlarms.clear();
- mHolidayAlarmsTarget = null;
- list.forEach(
- new Consumer() {
- @Override
- public final void accept(Object obj) {
- SmartspaceTarget smartspaceTarget = (SmartspaceTarget) (Parcelable) obj;
- if (isHolidayAlarmsTarget(smartspaceTarget)) {
- mHolidayAlarmsTarget = smartspaceTarget;
- } else {
- mTargetsExcludingMediaAndHolidayAlarms.add(smartspaceTarget);
- }
- }
- });
- boolean z = true;
- if (mTargetsExcludingMediaAndHolidayAlarms.isEmpty()) {
- mTargetsExcludingMediaAndHolidayAlarms.add(
- new SmartspaceTarget.Builder(
- "date_card_794317_92634",
- new ComponentName(mRoot.getContext(), CardPagerAdapter.class),
- mRoot.getContext().getUser())
- .setFeatureType(1)
- .build());
- }
- if (mTargetsExcludingMediaAndHolidayAlarms.size() != 1
- || mTargetsExcludingMediaAndHolidayAlarms.get(0).getFeatureType() != 1) {
- z = false;
- }
- mHasOnlyDefaultDateCard = z;
- updateTargetVisibility();
- notifyDataSetChanged();
- }
-
- public void setDataProvider(BcSmartspaceDataPlugin bcSmartspaceDataPlugin) {
- mDataProvider = bcSmartspaceDataPlugin;
- }
-
- public void setPrimaryTextColor(int i) {
- mPrimaryTextColor = i;
- setDozeAmount(mDozeAmount);
- }
-
- public void setDozeAmount(float f) {
- mCurrentTextColor = ColorUtils.blendARGB(mPrimaryTextColor, mDozeColor, f);
- mDozeAmount = f;
- updateTargetVisibility();
- refreshCardColors();
- }
-
- public float getDozeAmount() {
- return mDozeAmount;
- }
-
- public void setDnd(Drawable drawable, String str) {
- mDndImage = drawable;
- mDndDescription = str;
- refreshCards();
- }
-
- public void setNextAlarm(Drawable drawable, String str) {
- mNextAlarmImage = drawable;
- mNextAlarmDescription = str;
- refreshCards();
- }
-
- public void setMediaTarget(SmartspaceTarget smartspaceTarget) {
- mMediaTargets.clear();
- if (smartspaceTarget != null) {
- mMediaTargets.add(smartspaceTarget);
- }
- updateTargetVisibility();
- }
-
- public Drawable getNextAlarmImage() {
- return mNextAlarmImage;
- }
-
- public SmartspaceTarget getHolidayAlarmsTarget() {
- return mHolidayAlarmsTarget;
- }
-
- public void setIsDreaming(boolean z) {
- mIsDreaming = z;
- }
-
- public boolean getIsDreaming() {
- return mIsDreaming;
- }
-
- private void refreshCards() {
- for (int i = 0; i < mHolders.size(); i++) {
- onBindViewHolder(mHolders.get(i));
- }
- }
-
- private void refreshCardColors() {
- for (int i = 0; i < mHolders.size(); i++) {
- mHolders.get(i).card.setPrimaryTextColor(mCurrentTextColor);
- mHolders.get(i).card.setDozeAmount(mDozeAmount);
- }
- }
-
- private void updateTargetVisibility() {
- boolean z;
- if (mMediaTargets.isEmpty()) {
- mSmartspaceTargets = mTargetsExcludingMediaAndHolidayAlarms;
- notifyDataSetChanged();
- return;
- }
- float f = mDozeAmount;
- if (f == 0.0f || !(z = mHasOnlyDefaultDateCard)) {
- mSmartspaceTargets = mTargetsExcludingMediaAndHolidayAlarms;
- notifyDataSetChanged();
- } else if (f != 1.0f || !z) {
- } else {
- mSmartspaceTargets = mMediaTargets;
- notifyDataSetChanged();
- }
- }
-
- public static class ViewHolder {
- public final BcSmartspaceCard card;
- public final int position;
- public SmartspaceTarget target;
-
- ViewHolder(int i, BcSmartspaceCard bcSmartspaceCard, SmartspaceTarget smartspaceTarget) {
- position = i;
- card = bcSmartspaceCard;
- target = smartspaceTarget;
- }
- }
-}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/DoubleShadowIconDrawable.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/DoubleShadowIconDrawable.java
deleted file mode 100644
index 382a5f52b38f8..0000000000000
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/DoubleShadowIconDrawable.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package com.google.android.systemui.smartspace;
-
-import android.content.Context;
-import android.graphics.Bitmap;
-import android.graphics.BlurMaskFilter;
-import android.graphics.Canvas;
-import android.graphics.Paint;
-import android.graphics.drawable.BitmapDrawable;
-import android.graphics.drawable.Drawable;
-import android.graphics.drawable.LayerDrawable;
-
-import com.android.internal.graphics.ColorUtils;
-import com.android.systemui.bcsmartspace.R;
-
-public class DoubleShadowIconDrawable extends LayerDrawable {
- private Drawable mIconDrawable;
- private Drawable mShadowDrawable;
-
- public DoubleShadowIconDrawable(Drawable drawable, Context context) {
- super(new Drawable[0]);
- int dimensionPixelSize =
- context.getResources().getDimensionPixelSize(R.dimen.enhanced_smartspace_icon_size);
- generateIconAndShadow(
- drawable, context, dimensionPixelSize, dimensionPixelSize, dimensionPixelSize);
- }
-
- private void generateIconAndShadow(Drawable drawable, Context context, int i, int i2, int i3) {
- Bitmap createBitmap = Bitmap.createBitmap(i3, i3, Bitmap.Config.ARGB_8888);
- Canvas canvas = new Canvas(createBitmap);
- drawable.setBounds(0, 0, i, i2);
- int i4 = i3 / 2;
- canvas.translate(((-i) / 2) + i4, ((-i2) / 2) + i4);
- drawable.draw(canvas);
- mIconDrawable = new BitmapDrawable(context.getResources(), createBitmap);
- Drawable generateShadowDrawable = generateShadowDrawable(createBitmap, context);
- mShadowDrawable = generateShadowDrawable;
- addLayer(generateShadowDrawable);
- addLayer(mIconDrawable);
- setBounds(0, 0, i3, i3);
- }
-
- private static Drawable generateShadowDrawable(Bitmap bitmap, Context context) {
- Bitmap createBitmap =
- Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Bitmap.Config.ARGB_8888);
- Canvas canvas = new Canvas(createBitmap);
- float dimensionPixelSize =
- context.getResources().getDimensionPixelSize(R.dimen.ambient_text_shadow_radius);
- float dimensionPixelSize2 =
- context.getResources().getDimensionPixelSize(R.dimen.key_text_shadow_radius);
- float dimensionPixelSize3 =
- context.getResources().getDimensionPixelSize(R.dimen.key_text_shadow_dx);
- float dimensionPixelSize4 =
- context.getResources().getDimensionPixelSize(R.dimen.key_text_shadow_dy);
- int[] iArr = new int[2];
- Paint paint = new Paint(3);
- Paint paint2 = new Paint(3);
- if (dimensionPixelSize != 0.0f) {
- paint.setMaskFilter(new BlurMaskFilter(dimensionPixelSize, BlurMaskFilter.Blur.NORMAL));
- Bitmap extractAlpha = bitmap.extractAlpha(paint, iArr);
- paint2.setAlpha(64);
- canvas.drawBitmap(extractAlpha, iArr[0], iArr[1], paint2);
- }
- if (dimensionPixelSize2 != 0.0f) {
- paint.setMaskFilter(
- new BlurMaskFilter(dimensionPixelSize2, BlurMaskFilter.Blur.NORMAL));
- Bitmap extractAlpha2 = bitmap.extractAlpha(paint, iArr);
- paint2.setAlpha(72);
- canvas.drawBitmap(
- extractAlpha2,
- iArr[0] + dimensionPixelSize3,
- iArr[1] + dimensionPixelSize4,
- paint2);
- }
- return new BitmapDrawable(context.getResources(), createBitmap);
- }
-
- @Override
- public void setTint(int i) {
- Drawable drawable = mIconDrawable;
- if (drawable != null) {
- drawable.setTint(i);
- }
- Drawable drawable2 = mShadowDrawable;
- if (drawable2 != null) {
- drawable2.setAlpha(ColorUtils.calculateLuminance(i) > 0.5d ? 255 : 0);
- }
- }
-}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/DoubleShadowTextView.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/DoubleShadowTextView.java
deleted file mode 100644
index 3384dc53def30..0000000000000
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/DoubleShadowTextView.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package com.google.android.systemui.smartspace;
-
-import android.content.Context;
-import android.graphics.Canvas;
-import android.util.AttributeSet;
-import android.widget.TextView;
-
-import androidx.core.graphics.ColorUtils;
-
-import com.android.systemui.bcsmartspace.R;
-
-public class DoubleShadowTextView extends TextView {
- private final float mAmbientShadowBlur;
- private final int mAmbientShadowColor;
- private boolean mDrawShadow;
- private final float mKeyShadowBlur;
- private final int mKeyShadowColor;
- private final float mKeyShadowOffsetX;
- private final float mKeyShadowOffsetY;
-
- public DoubleShadowTextView(Context context) {
- this(context, null);
- }
-
- public DoubleShadowTextView(Context context, AttributeSet attributeSet) {
- this(context, attributeSet, 0);
- }
-
- public DoubleShadowTextView(Context context, AttributeSet attributeSet, int i) {
- super(context, attributeSet, i);
- updateDrawShadow(getCurrentTextColor());
- mKeyShadowBlur =
- context.getResources().getDimensionPixelSize(R.dimen.key_text_shadow_radius);
- mKeyShadowOffsetX =
- context.getResources().getDimensionPixelSize(R.dimen.key_text_shadow_dx);
- mKeyShadowOffsetY =
- context.getResources().getDimensionPixelSize(R.dimen.key_text_shadow_dy);
- mKeyShadowColor = context.getResources().getColor(R.color.key_text_shadow_color);
- mAmbientShadowBlur =
- context.getResources().getDimensionPixelSize(R.dimen.ambient_text_shadow_radius);
- mAmbientShadowColor = context.getResources().getColor(R.color.ambient_text_shadow_color);
- }
-
- @Override
- public void onDraw(Canvas canvas) {
- if (!mDrawShadow) {
- getPaint().clearShadowLayer();
- super.onDraw(canvas);
- return;
- }
- getPaint().setShadowLayer(mAmbientShadowBlur, 0.0f, 0.0f, mAmbientShadowColor);
- super.onDraw(canvas);
- canvas.save();
- canvas.clipRect(
- getScrollX(),
- getScrollY() + getExtendedPaddingTop(),
- getScrollX() + getWidth(),
- getScrollY() + getHeight());
- getPaint()
- .setShadowLayer(
- mKeyShadowBlur, mKeyShadowOffsetX, mKeyShadowOffsetY, mKeyShadowColor);
- super.onDraw(canvas);
- canvas.restore();
- }
-
- @Override
- public void setTextColor(int i) {
- super.setTextColor(i);
- updateDrawShadow(i);
- }
-
- private void updateDrawShadow(int i) {
- mDrawShadow = ColorUtils.calculateLuminance(i) > 0.5d;
- }
-}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/EventEnum.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/EventEnum.java
deleted file mode 100644
index 08cd108831630..0000000000000
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/EventEnum.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package com.google.android.systemui.smartspace;
-
-public interface EventEnum {
- int getId();
-}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/IcuDateTextView.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/IcuDateTextView.java
deleted file mode 100644
index ebadccf66b80d..0000000000000
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/IcuDateTextView.java
+++ /dev/null
@@ -1,109 +0,0 @@
-package com.google.android.systemui.smartspace;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.icu.text.DateFormat;
-import android.icu.text.DisplayContext;
-import android.os.Handler;
-import android.os.SystemClock;
-import android.util.AttributeSet;
-
-import com.android.systemui.bcsmartspace.R;
-
-import java.util.Locale;
-import java.util.Objects;
-
-public class IcuDateTextView extends DoubleShadowTextView {
- private DateFormat mFormatter;
- private Handler mHandler;
- private final BroadcastReceiver mIntentReceiver;
- private String mText;
- private final Runnable mTicker;
-
- public IcuDateTextView(Context context) {
- this(context, null);
- }
-
- public IcuDateTextView(Context context, AttributeSet attributeSet) {
- super(context, attributeSet, 0);
- mTicker =
- new Runnable() {
- @Override
- public final void run() {
- onTimeTick();
- }
- };
- mIntentReceiver =
- new BroadcastReceiver() {
- @Override
- public void onReceive(Context context2, Intent intent) {
- onTimeChanged(
- !"android.intent.action.TIME_TICK".equals(intent.getAction()));
- }
- };
- }
-
- @Override
- protected void onAttachedToWindow() {
- super.onAttachedToWindow();
- IntentFilter intentFilter = new IntentFilter();
- intentFilter.addAction("android.intent.action.TIME_SET");
- intentFilter.addAction("android.intent.action.TIMEZONE_CHANGED");
- getContext().registerReceiver(mIntentReceiver, intentFilter);
- onTimeChanged(true);
- mHandler = new Handler();
- }
-
- @Override
- protected void onDetachedFromWindow() {
- super.onDetachedFromWindow();
- if (mHandler != null) {
- getContext().unregisterReceiver(mIntentReceiver);
- mHandler = null;
- }
- }
-
- public void onTimeTick() {
- onTimeChanged(false);
- if (mHandler != null) {
- long uptimeMillis = SystemClock.uptimeMillis();
- mHandler.postAtTime(mTicker, uptimeMillis + (1000 - (uptimeMillis % 1000)));
- }
- }
-
- @Override
- public void onVisibilityAggregated(boolean z) {
- super.onVisibilityAggregated(z);
- Handler handler = mHandler;
- if (handler != null) {
- handler.removeCallbacks(mTicker);
- if (!z) {
- return;
- }
- mTicker.run();
- }
- }
-
- public void onTimeChanged(boolean z) {
- if (!isShown()) {
- return;
- }
- if (mFormatter == null || z) {
- DateFormat instanceForSkeleton =
- DateFormat.getInstanceForSkeleton(
- getContext().getString(R.string.smartspace_icu_date_pattern),
- Locale.getDefault());
- mFormatter = instanceForSkeleton;
- instanceForSkeleton.setContext(DisplayContext.CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE);
- }
- String format = mFormatter.format(Long.valueOf(System.currentTimeMillis()));
- if (Objects.equals(mText, format)) {
- return;
- }
- mText = format;
- setText(format);
- setContentDescription(format);
- }
-}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/InstanceId.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/InstanceId.java
deleted file mode 100644
index ca36cc167e5c9..0000000000000
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/InstanceId.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.google.android.systemui.smartspace;
-
-import android.app.smartspace.SmartspaceTarget;
-
-import java.util.UUID;
-
-public class InstanceId {
- public static int create(SmartspaceTarget smartspaceTarget) {
- if (smartspaceTarget == null) {
- return SmallHash.hash(UUID.randomUUID().toString());
- }
- String smartspaceTargetId = smartspaceTarget.getSmartspaceTargetId();
- if (smartspaceTargetId != null && !smartspaceTargetId.isEmpty()) {
- return SmallHash.hash(smartspaceTargetId);
- }
- return SmallHash.hash(String.valueOf(smartspaceTarget.getCreationTimeMillis()));
- }
-
- public static int create(String str) {
- if (str != null && !str.isEmpty()) {
- return SmallHash.hash(str);
- }
- return SmallHash.hash(UUID.randomUUID().toString());
- }
-}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/InterceptingViewPager.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/InterceptingViewPager.java
deleted file mode 100644
index b952091fa64c6..0000000000000
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/InterceptingViewPager.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package com.google.android.systemui.smartspace;
-
-import android.content.Context;
-import android.util.AttributeSet;
-import android.view.MotionEvent;
-import android.view.ViewConfiguration;
-
-import androidx.viewpager.widget.ViewPager;
-
-public class InterceptingViewPager extends ViewPager {
- private boolean mHasPerformedLongPress;
- private boolean mHasPostedLongPress;
- private final EventProxy mSuperOnTouch = (motionEvent) -> {
- return super.onTouchEvent(motionEvent);
- };
- private final EventProxy mSuperOnIntercept = (motionEvent) -> {
- return super.onInterceptTouchEvent(motionEvent);
- };
- private final Runnable mLongPressCallback = () -> {
- triggerLongPress();
- };
-
- public interface EventProxy {
- boolean delegateEvent(MotionEvent motionEvent);
- }
-
- public InterceptingViewPager(Context context) {
- super(context);
- }
-
- public InterceptingViewPager(Context context, AttributeSet attributeSet) {
- super(context, attributeSet);
- }
-
- @Override
- public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
- return handleTouchOverride(motionEvent, mSuperOnIntercept);
- }
-
- @Override
- public boolean onTouchEvent(MotionEvent motionEvent) {
- return handleTouchOverride(motionEvent, mSuperOnTouch);
- }
-
- private boolean handleTouchOverride(MotionEvent motionEvent, EventProxy eventProxy) {
- int action = motionEvent.getAction();
- if (action == 0) {
- mHasPerformedLongPress = false;
- if (isLongClickable()) {
- cancelScheduledLongPress();
- mHasPostedLongPress = true;
- postDelayed(mLongPressCallback, ViewConfiguration.getLongPressTimeout());
- }
- } else if (action == 1 || action == 3) {
- cancelScheduledLongPress();
- }
- if (mHasPerformedLongPress) {
- cancelScheduledLongPress();
- return true;
- } else if (!eventProxy.delegateEvent(motionEvent)) {
- return false;
- } else {
- cancelScheduledLongPress();
- return true;
- }
- }
-
- private void cancelScheduledLongPress() {
- if (mHasPostedLongPress) {
- mHasPostedLongPress = false;
- removeCallbacks(mLongPressCallback);
- }
- }
-
- public void triggerLongPress() {
- mHasPerformedLongPress = true;
- if (performLongClick()) {
- getParent().requestDisallowInterceptTouchEvent(true);
- }
- }
-}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/NewCardInfo.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/NewCardInfo.java
deleted file mode 100644
index 83fd3e258b9e2..0000000000000
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/NewCardInfo.java
+++ /dev/null
@@ -1,126 +0,0 @@
-package com.google.android.systemui.smartspace;
-
-import android.content.Context;
-import android.content.Intent;
-import android.content.pm.PackageInfo;
-import android.content.res.Resources;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.net.Uri;
-import android.provider.MediaStore;
-import android.text.TextUtils;
-import android.util.Log;
-
-import com.android.systemui.smartspace.nano.SmartspaceProto.CardWrapper;
-import com.android.systemui.smartspace.nano.SmartspaceProto.SmartspaceUpdate;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-
-public class NewCardInfo {
- private final SmartspaceUpdate.SmartspaceCard mCard;
- private final Intent mIntent;
- private final boolean mIsPrimary;
- private final PackageInfo mPackageInfo;
- private final long mPublishTime;
-
- public NewCardInfo(
- SmartspaceUpdate.SmartspaceCard smartspaceCard,
- Intent intent,
- boolean z,
- long j,
- PackageInfo packageInfo) {
- mCard = smartspaceCard;
- mIsPrimary = z;
- mIntent = intent;
- mPublishTime = j;
- mPackageInfo = packageInfo;
- }
-
- public boolean isPrimary() {
- return mIsPrimary;
- }
-
- public Bitmap retrieveIcon(Context context) {
- SmartspaceUpdate.SmartspaceCard.Image image = mCard.icon;
- if (image == null) {
- return null;
- }
- Bitmap bitmap = (Bitmap) retrieveFromIntent(image.key, mIntent);
- if (bitmap != null) {
- return bitmap;
- }
- try {
- } catch (Exception unused) {
- Log.e(
- "NewCardInfo",
- "retrieving bitmap uri=" + image.uri + " gsaRes=" + image.gsaResourceName);
- }
- if (!TextUtils.isEmpty(image.uri)) {
- try {
- return MediaStore.Images.Media.getBitmap(
- context.getContentResolver(), Uri.parse(image.uri));
- } catch (IOException e) {
- Log.e("NewCardInfo", "failed to get bitmap from uri");
- }
- }
- if (!TextUtils.isEmpty(image.gsaResourceName)) {
- Intent.ShortcutIconResource shortcutIconResource = new Intent.ShortcutIconResource();
- shortcutIconResource.packageName = "com.google.android.googlequicksearchbox";
- shortcutIconResource.resourceName = image.gsaResourceName;
- return createIconBitmap(shortcutIconResource, context);
- }
- return null;
- }
-
- public CardWrapper toWrapper(Context context) {
- CardWrapper cardWrapper = new CardWrapper();
- Bitmap retrieveIcon = retrieveIcon(context);
- if (retrieveIcon != null) {
- ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
- retrieveIcon.compress(Bitmap.CompressFormat.PNG, 100, byteArrayOutputStream);
- cardWrapper.icon = byteArrayOutputStream.toByteArray();
- }
- cardWrapper.card = mCard;
- cardWrapper.publishTime = mPublishTime;
- PackageInfo packageInfo = mPackageInfo;
- if (packageInfo != null) {
- cardWrapper.gsaVersionCode = packageInfo.versionCode;
- cardWrapper.gsaUpdateTime = packageInfo.lastUpdateTime;
- }
- return cardWrapper;
- }
-
- private static T retrieveFromIntent(String str, Intent intent) {
- if (!TextUtils.isEmpty(str)) {
- return (T) intent.getParcelableExtra(str);
- }
- return null;
- }
-
- static Bitmap createIconBitmap(
- Intent.ShortcutIconResource shortcutIconResource, Context context) {
- try {
- Resources resourcesForApplication =
- context.getPackageManager()
- .getResourcesForApplication(shortcutIconResource.packageName);
- if (resourcesForApplication != null) {
- return BitmapFactory.decodeResource(
- resourcesForApplication,
- resourcesForApplication.getIdentifier(
- shortcutIconResource.resourceName, null, null));
- }
- } catch (Exception unused) {
- }
- return null;
- }
-
- public int getUserId() {
- return mIntent.getIntExtra("uid", -1);
- }
-
- public boolean shouldDiscard() {
- SmartspaceUpdate.SmartspaceCard smartspaceCard = mCard;
- return smartspaceCard == null || smartspaceCard.shouldDiscard;
- }
-}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/PageIndicator.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/PageIndicator.java
deleted file mode 100644
index 1ac372ba1ab8b..0000000000000
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/PageIndicator.java
+++ /dev/null
@@ -1,152 +0,0 @@
-package com.google.android.systemui.smartspace;
-
-import android.content.Context;
-import android.content.res.TypedArray;
-import android.graphics.drawable.Drawable;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.View;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-
-import androidx.appcompat.content.res.AppCompatResources;
-
-import com.android.systemui.bcsmartspace.R;
-
-public class PageIndicator extends LinearLayout {
- private int mPrimaryColor = getAttrColor(getContext(), 16842806);
- private int mCurrentPageIndex = -1;
- private int mNumPages = -1;
-
- public PageIndicator(Context context) {
- super(context);
- }
-
- public PageIndicator(Context context, AttributeSet attributeSet) {
- super(context, attributeSet);
- }
-
- public PageIndicator(Context context, AttributeSet attributeSet, int i) {
- super(context, attributeSet, i);
- }
-
- public PageIndicator(Context context, AttributeSet attributeSet, int i, int i2) {
- super(context, attributeSet, i, i2);
- }
-
- public void setNumPages(int i) {
- if (i <= 0) {
- Log.w("PageIndicator", "Total number of pages invalid: " + i + ". Assuming 1 page.");
- i = 1;
- }
- if (i < 2) {
- setVisibility(View.GONE);
- return;
- }
- setVisibility(View.VISIBLE);
- if (i == mNumPages) {
- return;
- }
- mNumPages = i;
- initializePageIndicators();
- }
-
- public void setPageOffset(int i, float f) {
- int i2 = (f > 0.0f ? 1 : (f == 0.0f ? 0 : -1));
- if (!(i2 == 0 && i == mCurrentPageIndex) && i >= 0 && i < getChildCount() - 1) {
- ImageView imageView = (ImageView) getChildAt(i);
- int i3 = i + 1;
- ImageView imageView2 = (ImageView) getChildAt(i3);
- if (imageView == null || imageView2 == null) {
- return;
- }
- imageView.setAlpha(((1.0f - f) * 0.6f) + 0.4f);
- imageView2.setAlpha((0.6f * f) + 0.4f);
- Context context = getContext();
- int i4 = R.string.accessibility_smartspace_page;
- Object[] objArr = new Object[2];
- objArr[0] = Integer.valueOf(((double) f) < 0.5d ? i3 : i + 2);
- objArr[1] = Integer.valueOf(mNumPages);
- setContentDescription(context.getString(i4, objArr));
- if (i2 != 0 && f < 0.99f) {
- return;
- }
- if (i2 != 0) {
- i = i3;
- }
- mCurrentPageIndex = i;
- }
- }
-
- private void initializePageIndicators() {
- LinearLayout.LayoutParams layoutParams;
- int childCount = getChildCount() - mNumPages;
- for (int i = 0; i < childCount; i++) {
- removeViewAt(0);
- }
- int dimensionPixelSize =
- getContext()
- .getResources()
- .getDimensionPixelSize(R.dimen.page_indicator_dot_margin);
- int i2 = 0;
- while (i2 < mNumPages) {
- ImageView imageView =
- i2 < getChildCount() ? (ImageView) getChildAt(i2) : new ImageView(getContext());
- if (i2 < getChildCount()) {
- layoutParams = (LinearLayout.LayoutParams) imageView.getLayoutParams();
- } else {
- layoutParams = new LinearLayout.LayoutParams(-2, -2);
- }
- if (i2 == 0) {
- layoutParams.setMarginStart(0);
- } else {
- layoutParams.setMarginStart(dimensionPixelSize);
- }
- if (i2 == mNumPages - 1) {
- layoutParams.setMarginEnd(0);
- } else {
- layoutParams.setMarginEnd(dimensionPixelSize);
- }
- if (i2 < getChildCount()) {
- imageView.setLayoutParams(layoutParams);
- } else {
- Drawable drawable =
- AppCompatResources.getDrawable(getContext(), R.drawable.page_indicator_dot);
- drawable.setTint(mPrimaryColor);
- imageView.setImageDrawable(drawable);
- addView(imageView, layoutParams);
- }
- int i3 = mCurrentPageIndex;
- if (i3 < 0) {
- mCurrentPageIndex = 0;
- } else {
- int i4 = mNumPages;
- if (i3 >= i4) {
- mCurrentPageIndex = i4 - 1;
- }
- }
- imageView.setAlpha(i2 == mCurrentPageIndex ? 1.0f : 0.4f);
- i2++;
- }
- setContentDescription(
- getContext()
- .getString(
- R.string.accessibility_smartspace_page,
- 1,
- Integer.valueOf(mNumPages)));
- }
-
- public void setPrimaryColor(int i) {
- mPrimaryColor = i;
- for (int i2 = 0; i2 < getChildCount(); i2++) {
- ((ImageView) getChildAt(i2)).getDrawable().setTint(mPrimaryColor);
- }
- }
-
- public static int getAttrColor(Context context, int i) {
- TypedArray obtainStyledAttributes = context.obtainStyledAttributes(new int[] {i});
- int color = obtainStyledAttributes.getColor(0, 0);
- obtainStyledAttributes.recycle();
- return color;
- }
-}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/ProtoStore.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/ProtoStore.java
deleted file mode 100644
index 6477ad66d5140..0000000000000
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/ProtoStore.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package com.google.android.systemui.smartspace;
-
-import android.content.Context;
-import android.util.Log;
-
-import com.google.protobuf.nano.MessageNano;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-
-public class ProtoStore {
- private final Context mContext;
-
- public ProtoStore(Context context) {
- mContext = context.getApplicationContext();
- }
-
- public void store(MessageNano messageNano, String str) {
- try {
- FileOutputStream openFileOutput = mContext.openFileOutput(str, 0);
- if (messageNano != null) {
- openFileOutput.write(MessageNano.toByteArray(messageNano));
- } else {
- Log.d("ProtoStore", "deleting " + str);
- mContext.deleteFile(str);
- }
- if (openFileOutput == null) {
- return;
- }
- openFileOutput.close();
- } catch (FileNotFoundException unused) {
- Log.d("ProtoStore", "file does not exist");
- } catch (Exception e) {
- Log.e("ProtoStore", "unable to write file", e);
- }
- }
-
- public boolean load(String str, T t) {
- File fileStreamPath = mContext.getFileStreamPath(str);
- try {
- FileInputStream fileInputStream = new FileInputStream(fileStreamPath);
- try {
- int length = (int) fileStreamPath.length();
- byte[] bArr = new byte[length];
- fileInputStream.read(bArr, 0, length);
- MessageNano.mergeFrom(t, bArr);
- fileInputStream.close();
- return true;
- } catch (Throwable th) {
- try {
- fileInputStream.close();
- } catch (Throwable th2) {
- th.addSuppressed(th2);
- }
- throw th;
- }
- } catch (FileNotFoundException unused) {
- Log.d("ProtoStore", "no cached data");
- return false;
- } catch (Exception e) {
- Log.e("ProtoStore", "unable to load data", e);
- return false;
- }
- }
-}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/SmallHash.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/SmallHash.java
deleted file mode 100644
index 063089fcae344..0000000000000
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/SmallHash.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.google.android.systemui.smartspace;
-
-import java.util.Objects;
-
-public final class SmallHash {
- public static int hash(String str) {
- return hash(Objects.hashCode(str));
- }
-
- public static int hash(int i) {
- return Math.abs(Math.floorMod(i, 8192));
- }
-}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/logging/BcSmartspaceCardLogger.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/logging/BcSmartspaceCardLogger.java
deleted file mode 100644
index e91a82046b58e..0000000000000
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/logging/BcSmartspaceCardLogger.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package com.google.android.systemui.smartspace.logging;
-
-import android.util.Log;
-
-import com.android.systemui.shared.system.SysUiStatsLog;
-
-import com.google.android.systemui.smartspace.BcSmartSpaceUtil;
-import com.google.android.systemui.smartspace.EventEnum;
-
-public class BcSmartspaceCardLogger {
- private static final boolean IS_VERBOSE = BcSmartSpaceUtil.isLoggable("StatsLog");
-
- public static void log(
- EventEnum eventEnum, BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo) {
- SysUiStatsLog.write(
- 352,
- eventEnum.getId(),
- bcSmartspaceCardLoggingInfo.getInstanceId(),
- 0,
- bcSmartspaceCardLoggingInfo.getDisplaySurface(),
- bcSmartspaceCardLoggingInfo.getRank(),
- bcSmartspaceCardLoggingInfo.getCardinality(),
- bcSmartspaceCardLoggingInfo.getFeatureType(),
- -1,
- 0,
- 0,
- bcSmartspaceCardLoggingInfo.getReceivedLatency(),
- BcSmartspaceCardLoggerUtil.convertSubcardInfoToBytes(
- bcSmartspaceCardLoggingInfo.getSubcardInfo()));
- if (IS_VERBOSE) {
- Log.d(
- "StatsLog",
- String.format(
- "\nLogged Smartspace event(%s), info(%s)",
- eventEnum, bcSmartspaceCardLoggingInfo.toString()));
- }
- }
-}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/logging/BcSmartspaceCardLoggerUtil.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/logging/BcSmartspaceCardLoggerUtil.java
deleted file mode 100644
index aa714323267fa..0000000000000
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/logging/BcSmartspaceCardLoggerUtil.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package com.google.android.systemui.smartspace.logging;
-
-import android.app.smartspace.SmartspaceAction;
-import android.app.smartspace.SmartspaceTarget;
-
-import com.android.systemui.smartspace.nano.SmartspaceProto.SmartSpaceCardMetadata;
-import com.android.systemui.smartspace.nano.SmartspaceProto.SmartSpaceSubcards;
-
-import com.google.android.systemui.smartspace.InstanceId;
-import com.google.protobuf.nano.MessageNano;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class BcSmartspaceCardLoggerUtil {
- public static byte[] convertSubcardInfoToBytes(
- BcSmartspaceSubcardLoggingInfo bcSmartspaceSubcardLoggingInfo) {
- if (bcSmartspaceSubcardLoggingInfo == null
- || bcSmartspaceSubcardLoggingInfo.getSubcards() == null
- || bcSmartspaceSubcardLoggingInfo.getSubcards().isEmpty()) {
- return null;
- }
- SmartSpaceSubcards smartSpaceSubcards = new SmartSpaceSubcards();
- smartSpaceSubcards.clickedSubcardIndex =
- bcSmartspaceSubcardLoggingInfo.getClickedSubcardIndex();
- List subcards =
- bcSmartspaceSubcardLoggingInfo.getSubcards();
- ArrayList arrayList = new ArrayList();
- for (int i = 0; i < subcards.size(); i++) {
- BcSmartspaceCardMetadataLoggingInfo bcSmartspaceCardMetadataLoggingInfo =
- subcards.get(i);
- SmartSpaceCardMetadata smartSpaceCardMetadata = new SmartSpaceCardMetadata();
- smartSpaceCardMetadata.instanceId = bcSmartspaceCardMetadataLoggingInfo.getInstanceId();
- smartSpaceCardMetadata.cardTypeId = bcSmartspaceCardMetadataLoggingInfo.getCardTypeId();
- arrayList.add(smartSpaceCardMetadata);
- }
- smartSpaceSubcards.subcards =
- (SmartSpaceCardMetadata[])
- arrayList.toArray(new SmartSpaceCardMetadata[arrayList.size()]);
- return MessageNano.toByteArray(smartSpaceSubcards);
- }
-
- public static void forcePrimaryFeatureTypeAndInjectWeatherSubcard(
- BcSmartspaceCardLoggingInfo bcSmartspaceCardLoggingInfo,
- SmartspaceTarget smartspaceTarget,
- int i) {
- if (bcSmartspaceCardLoggingInfo == null
- || bcSmartspaceCardLoggingInfo.getFeatureType() != 1) {
- return;
- }
- bcSmartspaceCardLoggingInfo.setFeatureType(i);
- if ("date_card_794317_92634".equals(smartspaceTarget.getSmartspaceTargetId())) {
- return;
- }
- if (bcSmartspaceCardLoggingInfo.getSubcardInfo() == null) {
- bcSmartspaceCardLoggingInfo.setSubcardInfo(
- new BcSmartspaceSubcardLoggingInfo.Builder()
- .setClickedSubcardIndex(0)
- .setSubcards(new ArrayList())
- .build());
- }
- if (bcSmartspaceCardLoggingInfo.getSubcardInfo().getSubcards() == null) {
- bcSmartspaceCardLoggingInfo.getSubcardInfo().setSubcards(new ArrayList());
- }
- bcSmartspaceCardLoggingInfo
- .getSubcardInfo()
- .getSubcards()
- .add(
- new BcSmartspaceCardMetadataLoggingInfo.Builder()
- .setInstanceId(InstanceId.create(smartspaceTarget))
- .setCardTypeId(1)
- .build());
- }
-
- public static BcSmartspaceSubcardLoggingInfo createSubcardLoggingInfo(
- SmartspaceTarget smartspaceTarget) {
- if (smartspaceTarget == null
- || smartspaceTarget.getBaseAction() == null
- || smartspaceTarget.getBaseAction().getExtras() == null
- || smartspaceTarget.getBaseAction().getExtras().isEmpty()
- || smartspaceTarget.getBaseAction().getExtras().getInt("subcardType", -1) == -1) {
- return null;
- }
- SmartspaceAction baseAction = smartspaceTarget.getBaseAction();
- int create = InstanceId.create(baseAction.getExtras().getString("subcardId"));
- BcSmartspaceCardMetadataLoggingInfo build =
- new BcSmartspaceCardMetadataLoggingInfo.Builder()
- .setInstanceId(create)
- .setCardTypeId(baseAction.getExtras().getInt("subcardType"))
- .build();
- ArrayList arrayList = new ArrayList();
- arrayList.add(build);
- return new BcSmartspaceSubcardLoggingInfo.Builder()
- .setSubcards(arrayList)
- .setClickedSubcardIndex(0)
- .build();
- }
-}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/logging/BcSmartspaceCardLoggingInfo.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/logging/BcSmartspaceCardLoggingInfo.java
deleted file mode 100644
index 808ae135a8f23..0000000000000
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/logging/BcSmartspaceCardLoggingInfo.java
+++ /dev/null
@@ -1,124 +0,0 @@
-package com.google.android.systemui.smartspace.logging;
-
-public class BcSmartspaceCardLoggingInfo {
- private final int mCardinality;
- private final int mDisplaySurface;
- private int mFeatureType;
- private final int mInstanceId;
- private final int mRank;
- private final int mReceivedLatency;
- private BcSmartspaceSubcardLoggingInfo mSubcardInfo;
-
- private BcSmartspaceCardLoggingInfo(Builder builder) {
- mInstanceId = builder.mInstanceId;
- mDisplaySurface = builder.mDisplaySurface;
- mRank = builder.mRank;
- mCardinality = builder.mCardinality;
- mFeatureType = builder.mFeatureType;
- mReceivedLatency = builder.mReceivedLatency;
- mSubcardInfo = builder.mSubcardInfo;
- }
-
- public int getInstanceId() {
- return mInstanceId;
- }
-
- public int getDisplaySurface() {
- return mDisplaySurface;
- }
-
- public int getRank() {
- return mRank;
- }
-
- public int getCardinality() {
- return mCardinality;
- }
-
- public int getFeatureType() {
- return mFeatureType;
- }
-
- public int getReceivedLatency() {
- return mReceivedLatency;
- }
-
- public BcSmartspaceSubcardLoggingInfo getSubcardInfo() {
- return mSubcardInfo;
- }
-
- public void setFeatureType(int i) {
- mFeatureType = i;
- }
-
- public void setSubcardInfo(BcSmartspaceSubcardLoggingInfo bcSmartspaceSubcardLoggingInfo) {
- mSubcardInfo = bcSmartspaceSubcardLoggingInfo;
- }
-
- public String toString() {
- return "instance_id = "
- + getInstanceId()
- + ", feature type = "
- + getFeatureType()
- + ", display surface = "
- + getDisplaySurface()
- + ", rank = "
- + getRank()
- + ", cardinality = "
- + getCardinality()
- + ", receivedLatencyMillis = "
- + getReceivedLatency()
- + ", subcardInfo = "
- + getSubcardInfo();
- }
-
- public static class Builder {
- private int mCardinality;
- private int mDisplaySurface = 1;
- private int mFeatureType;
- private int mInstanceId;
- private int mRank;
- private int mReceivedLatency;
- private BcSmartspaceSubcardLoggingInfo mSubcardInfo;
-
- public Builder setInstanceId(int i) {
- mInstanceId = i;
- return this;
- }
-
- public Builder setDisplaySurface(int i) {
- mDisplaySurface = i;
- return this;
- }
-
- public Builder setRank(int i) {
- mRank = i;
- return this;
- }
-
- public Builder setCardinality(int i) {
- mCardinality = i;
- return this;
- }
-
- public Builder setFeatureType(int i) {
- mFeatureType = i;
- return this;
- }
-
- public Builder setReceivedLatency(int i) {
- mReceivedLatency = i;
- return this;
- }
-
- public Builder setSubcardInfo(
- BcSmartspaceSubcardLoggingInfo bcSmartspaceSubcardLoggingInfo) {
- mSubcardInfo = bcSmartspaceSubcardLoggingInfo;
- return this;
- }
-
- public BcSmartspaceCardLoggingInfo build() {
- return new BcSmartspaceCardLoggingInfo(this);
- }
- }
-}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/logging/BcSmartspaceCardMetadataLoggingInfo.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/logging/BcSmartspaceCardMetadataLoggingInfo.java
deleted file mode 100644
index ae47291c646b2..0000000000000
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/logging/BcSmartspaceCardMetadataLoggingInfo.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.google.android.systemui.smartspace.logging;
-
-public class BcSmartspaceCardMetadataLoggingInfo {
- private final int mCardTypeId;
- private final int mInstanceId;
-
- private BcSmartspaceCardMetadataLoggingInfo(Builder builder) {
- mInstanceId = builder.mInstanceId;
- mCardTypeId = builder.mCardTypeId;
- }
-
- public int getInstanceId() {
- return mInstanceId;
- }
-
- public int getCardTypeId() {
- return mCardTypeId;
- }
-
- public String toString() {
- return "BcSmartspaceCardMetadataLoggingInfo{mInstanceId="
- + mInstanceId
- + ", mCardTypeId="
- + mCardTypeId
- + '}';
- }
-
- public static class Builder {
- private int mCardTypeId;
- private int mInstanceId;
-
- public Builder setInstanceId(int i) {
- mInstanceId = i;
- return this;
- }
-
- public Builder setCardTypeId(int i) {
- mCardTypeId = i;
- return this;
- }
-
- public BcSmartspaceCardMetadataLoggingInfo build() {
- return new BcSmartspaceCardMetadataLoggingInfo(this);
- }
- }
-}
diff --git a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/logging/BcSmartspaceSubcardLoggingInfo.java b/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/logging/BcSmartspaceSubcardLoggingInfo.java
deleted file mode 100644
index 7d00cb1b8af01..0000000000000
--- a/packages/SystemUI/bcsmartspace/src/com/google/android/systemui/smartspace/logging/BcSmartspaceSubcardLoggingInfo.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package com.google.android.systemui.smartspace.logging;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class BcSmartspaceSubcardLoggingInfo {
- private int mClickedSubcardIndex;
- private List mSubcards;
-
- private BcSmartspaceSubcardLoggingInfo(Builder builder) {
- if (builder.mSubcards == null) {
- mSubcards = new ArrayList();
- } else {
- mSubcards = builder.mSubcards;
- }
- mClickedSubcardIndex = builder.mClickedSubcardIndex;
- }
-
- public List getSubcards() {
- return mSubcards;
- }
-
- public void setSubcards(List list) {
- mSubcards = list;
- }
-
- public int getClickedSubcardIndex() {
- return mClickedSubcardIndex;
- }
-
- public void setClickedSubcardIndex(int i) {
- mClickedSubcardIndex = i;
- }
-
- public String toString() {
- return "BcSmartspaceSubcardLoggingInfo{mSubcards="
- + mSubcards
- + ", mClickedSubcardIndex="
- + mClickedSubcardIndex
- + '}';
- }
-
- public static class Builder {
- private int mClickedSubcardIndex;
- private List mSubcards;
-
- public Builder setSubcards(List list) {
- mSubcards = list;
- return this;
- }
-
- public Builder setClickedSubcardIndex(int i) {
- mClickedSubcardIndex = i;
- return this;
- }
-
- public BcSmartspaceSubcardLoggingInfo build() {
- return new BcSmartspaceSubcardLoggingInfo(this);
- }
- }
-}
diff --git a/packages/SystemUI/proto/Android.bp b/packages/SystemUI/proto/Android.bp
deleted file mode 100644
index 2c2be70a90341..0000000000000
--- a/packages/SystemUI/proto/Android.bp
+++ /dev/null
@@ -1,10 +0,0 @@
-java_library {
- name: "smartspace-proto-java",
- proto: {
- type: "nano",
- },
- srcs: [
- "smartspace.proto",
- ],
- sdk_version: "current",
-}
diff --git a/packages/SystemUI/proto/smartspace.proto b/packages/SystemUI/proto/smartspace.proto
deleted file mode 100644
index a7a5e7539a281..0000000000000
--- a/packages/SystemUI/proto/smartspace.proto
+++ /dev/null
@@ -1,104 +0,0 @@
-syntax = "proto2";
-
-package SmartspaceProto;
-
-option java_package = "com.android.systemui.smartspace";
-option java_outer_classname = "SmartspaceProto";
-
-message CardWrapper {
- required bytes icon = 1;
- required SmartspaceUpdate.SmartspaceCard card = 2;
- required int64 publishTime = 3;
- required int32 gsaVersionCode = 4;
- required int64 gsaUpdateTime = 5;
- required bool isIconGrayscale = 6;
-}
-
-message SmartSpaceCardMetadata {
- required int32 instanceId = 1;
- required int32 cardTypeId = 2;
-}
-
-message SmartSpaceSubcards {
- required int32 clickedSubcardIndex = 1;
- repeated SmartSpaceCardMetadata subcards = 2;
-}
-
-message SmartspaceUpdate {
- message SmartspaceCard {
- message ExpiryCriteria {
- required int64 expirationTimeMillis = 1;
- required int32 maxImpressions = 2;
- }
-
- message Image {
- required string key = 1;
- required string gsaResourceName = 2;
- required string uri = 3;
- }
-
- message Message {
- message FormattedText {
- message FormatParam {
- enum FormatParamArgs {
- SOMETHING0 = 0;
- SOMETHING1 = 1;
- SOMETHING2 = 2;
- SOMETHING3 = 3;
- }
-
- required string text = 1;
- required int32 truncateLocation = 2;
- required FormatParamArgs formatParamArgs = 3;
- required bool updateTimeLocally = 4;
- }
-
- required string text = 1;
- required int32 truncateLocation = 2;
- repeated FormatParam formatParam = 3;
- }
-
- required FormattedText title = 1;
- required FormattedText subtitle = 2;
- }
-
- message TapAction {
- enum ActionType {
- ACTION0 = 0;
- ACTION1 = 1;
- ACTION2 = 2;
- }
-
- required ActionType actionType = 1;
- required string intent = 2;
- }
-
- enum CardType {
- CARD0 = 0;
- CARD1 = 1;
- CARD2 = 2;
- CARD3 = 3;
- CARD4 = 4;
- CARD5 = 5;
- CARD6 = 6;
- }
-
- required bool shouldDiscard = 1;
- required int32 cardId = 2;
- required Message preEvent = 3;
- required Message duringEvent = 4;
- required Message postEvent = 5;
- required Image icon = 6;
- required CardType cardType = 7;
- required TapAction tapAction = 8;
- required int64 updateTimeMillis = 9;
- required int64 eventTimeMillis = 10;
- required int64 eventDurationMillis = 11;
- required ExpiryCriteria expiryCriteria = 12;
- required int32 cardPriority = 13;
- required bool isSensitive = 14;
- required bool isWorkProfile = 15;
- }
-
- repeated SmartspaceCard card = 1;
-}
diff --git a/packages/SystemUI/res/drawable/ic_statusbar_volte.xml b/packages/SystemUI/res/drawable/ic_statusbar_volte.xml
new file mode 100644
index 0000000000000..6b81bcdfba0bf
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_statusbar_volte.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
diff --git a/packages/SystemUI/res/drawable/ic_volte.xml b/packages/SystemUI/res/drawable/ic_volte.xml
new file mode 100644
index 0000000000000..0597b0eb0141a
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_volte.xml
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/packages/SystemUI/res/drawable/ic_volte1.xml b/packages/SystemUI/res/drawable/ic_volte1.xml
deleted file mode 100644
index a68f64ccd2bd7..0000000000000
--- a/packages/SystemUI/res/drawable/ic_volte1.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/packages/SystemUI/res/drawable/ic_volte2.xml b/packages/SystemUI/res/drawable/ic_volte2.xml
deleted file mode 100644
index ac3ea86092d3e..0000000000000
--- a/packages/SystemUI/res/drawable/ic_volte2.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
diff --git a/packages/SystemUI/res/drawable/ic_volte3.xml b/packages/SystemUI/res/drawable/ic_volte3.xml
deleted file mode 100644
index 1b3f515e24eb9..0000000000000
--- a/packages/SystemUI/res/drawable/ic_volte3.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
diff --git a/packages/SystemUI/res/drawable/ic_volte4.xml b/packages/SystemUI/res/drawable/ic_volte4.xml
deleted file mode 100644
index 3b4e323e86f4f..0000000000000
--- a/packages/SystemUI/res/drawable/ic_volte4.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/packages/SystemUI/res/drawable/ic_volte5.xml b/packages/SystemUI/res/drawable/ic_volte5.xml
deleted file mode 100644
index f1b9bee4f7371..0000000000000
--- a/packages/SystemUI/res/drawable/ic_volte5.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
diff --git a/packages/SystemUI/res/drawable/ic_volte6.xml b/packages/SystemUI/res/drawable/ic_volte6.xml
deleted file mode 100644
index 4cf345398dfeb..0000000000000
--- a/packages/SystemUI/res/drawable/ic_volte6.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
diff --git a/packages/SystemUI/res/drawable/ic_volte7.xml b/packages/SystemUI/res/drawable/ic_volte7.xml
deleted file mode 100644
index 6503f7e7ad8bf..0000000000000
--- a/packages/SystemUI/res/drawable/ic_volte7.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/packages/SystemUI/res/drawable/ic_volte8.xml b/packages/SystemUI/res/drawable/ic_volte8.xml
deleted file mode 100644
index 6151914b923ed..0000000000000
--- a/packages/SystemUI/res/drawable/ic_volte8.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/packages/SystemUI/res/drawable/ic_volte9.xml b/packages/SystemUI/res/drawable/ic_volte9.xml
deleted file mode 100644
index 60dbc943f0481..0000000000000
--- a/packages/SystemUI/res/drawable/ic_volte9.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
diff --git a/packages/SystemUI/res/drawable/ic_volte_margaritov.xml b/packages/SystemUI/res/drawable/ic_volte_margaritov.xml
deleted file mode 100644
index 0dfb215d2cd9c..0000000000000
--- a/packages/SystemUI/res/drawable/ic_volte_margaritov.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
-
-
-
diff --git a/packages/SystemUI/res/drawable/ic_volte_margaritov2.xml b/packages/SystemUI/res/drawable/ic_volte_margaritov2.xml
deleted file mode 100644
index 1a4b9969657b7..0000000000000
--- a/packages/SystemUI/res/drawable/ic_volte_margaritov2.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/packages/SystemUI/res/drawable/ic_volte_vivo.xml b/packages/SystemUI/res/drawable/ic_volte_vivo.xml
deleted file mode 100644
index a3c30fb40fce5..0000000000000
--- a/packages/SystemUI/res/drawable/ic_volte_vivo.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
diff --git a/packages/SystemUI/res/drawable/stat_sys_roaming.xml b/packages/SystemUI/res/drawable/stat_sys_roaming.xml
index d7151c67176e9..0dd9f5a39f91f 100644
--- a/packages/SystemUI/res/drawable/stat_sys_roaming.xml
+++ b/packages/SystemUI/res/drawable/stat_sys_roaming.xml
@@ -14,8 +14,8 @@
limitations under the License.
-->
diff --git a/packages/SystemUI/res/drawable/stat_sys_volte.xml b/packages/SystemUI/res/drawable/stat_sys_volte.xml
new file mode 100644
index 0000000000000..f4db5a430c3bf
--- /dev/null
+++ b/packages/SystemUI/res/drawable/stat_sys_volte.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
diff --git a/packages/SystemUI/res/drawable/stat_sys_volte_slot1.xml b/packages/SystemUI/res/drawable/stat_sys_volte_slot1.xml
new file mode 100644
index 0000000000000..6b5c83a3e507e
--- /dev/null
+++ b/packages/SystemUI/res/drawable/stat_sys_volte_slot1.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
diff --git a/packages/SystemUI/res/drawable/stat_sys_volte_slot12.xml b/packages/SystemUI/res/drawable/stat_sys_volte_slot12.xml
new file mode 100644
index 0000000000000..a1ac96a151d7a
--- /dev/null
+++ b/packages/SystemUI/res/drawable/stat_sys_volte_slot12.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
diff --git a/packages/SystemUI/res/drawable/stat_sys_volte_slot2.xml b/packages/SystemUI/res/drawable/stat_sys_volte_slot2.xml
new file mode 100644
index 0000000000000..b3127fb6b0165
--- /dev/null
+++ b/packages/SystemUI/res/drawable/stat_sys_volte_slot2.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
diff --git a/packages/SystemUI/res/drawable/stat_sys_vowifi.xml b/packages/SystemUI/res/drawable/stat_sys_vowifi.xml
new file mode 100644
index 0000000000000..02e5e779218f0
--- /dev/null
+++ b/packages/SystemUI/res/drawable/stat_sys_vowifi.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
diff --git a/packages/SystemUI/res/drawable/stat_sys_vowifi_slot1.xml b/packages/SystemUI/res/drawable/stat_sys_vowifi_slot1.xml
new file mode 100644
index 0000000000000..cf54850c9414f
--- /dev/null
+++ b/packages/SystemUI/res/drawable/stat_sys_vowifi_slot1.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
diff --git a/packages/SystemUI/res/drawable/stat_sys_vowifi_slot12.xml b/packages/SystemUI/res/drawable/stat_sys_vowifi_slot12.xml
new file mode 100644
index 0000000000000..9504b390ff99c
--- /dev/null
+++ b/packages/SystemUI/res/drawable/stat_sys_vowifi_slot12.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
diff --git a/packages/SystemUI/res/drawable/stat_sys_vowifi_slot2.xml b/packages/SystemUI/res/drawable/stat_sys_vowifi_slot2.xml
new file mode 100644
index 0000000000000..e851158d82805
--- /dev/null
+++ b/packages/SystemUI/res/drawable/stat_sys_vowifi_slot2.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
diff --git a/packages/SystemUI/res/layout/status_bar.xml b/packages/SystemUI/res/layout/status_bar.xml
index 0c44e75cd10f2..23d75ef32a838 100644
--- a/packages/SystemUI/res/layout/status_bar.xml
+++ b/packages/SystemUI/res/layout/status_bar.xml
@@ -101,15 +101,15 @@
systemui:isStatusBar="true" />
-
-
+
+
diff --git a/packages/SystemUI/res/layout/status_bar_ims_group.xml b/packages/SystemUI/res/layout/status_bar_ims_group.xml
new file mode 100644
index 0000000000000..eb29f02b42b1e
--- /dev/null
+++ b/packages/SystemUI/res/layout/status_bar_ims_group.xml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/packages/SystemUI/res/layout/status_bar_mobile_signal_group.xml b/packages/SystemUI/res/layout/status_bar_mobile_signal_group.xml
index a9ba04c8d9175..bc449cf287a5f 100644
--- a/packages/SystemUI/res/layout/status_bar_mobile_signal_group.xml
+++ b/packages/SystemUI/res/layout/status_bar_mobile_signal_group.xml
@@ -30,14 +30,7 @@
android:layout_height="match_parent"
android:gravity="center_vertical"
android:orientation="horizontal" >
-
+
+
false
+
+
+
+
+
+ true
+ true
+ true
+ true
+
diff --git a/packages/SystemUI/res/values/cherish_dimens.xml b/packages/SystemUI/res/values/cherish_dimens.xml
index c6e4aeb6c3e74..0ec6bd3eb963d 100644
--- a/packages/SystemUI/res/values/cherish_dimens.xml
+++ b/packages/SystemUI/res/values/cherish_dimens.xml
@@ -44,6 +44,13 @@
25sp
+
+
+ 18dp
+ 18dp
+ 16dp
+ 9dp
+ 12dp
14.5dp
@@ -90,13 +97,6 @@
4dp
-
- 18dp
- 18dp
- 16dp
- 9dp
- 12dp
-
10dp
55dp
diff --git a/packages/SystemUI/res/values/cr_strings.xml b/packages/SystemUI/res/values/cr_strings.xml
new file mode 100644
index 0000000000000..cd9317f7bc0d3
--- /dev/null
+++ b/packages/SystemUI/res/values/cr_strings.xml
@@ -0,0 +1,166 @@
+
+
+
+
+
+ Sound
+ Ring
+ Vibrate
+ Do not disturb
+
+
+
+ Delete
+
+ Screen recording deleted
+
+
+ Show stop dot
+ Longpress to move it
+ Lower quality
+ For smaller file size
+ Bigger file size limit
+ Limit recording size to 15 GB
+ Skip timer
+ Remove 3 second wait
+ Enable HEVC
+ Use more efficient HEVC video encoding
+
+
+ Delete
+
+ Delete screenshot
+
+
+ NFC
+ VPN
+ Data saver
+ Call strength
+ Firewall
+ VoLTE/VoWiFi
+
+
+ \u221E
+
+
+ %2$s • Dash Charging (%1$s until full)
+ %s • Dash Charging
+
+
+ %2$s • Warp Charging (%1$s until full)
+ %s • Warp Charging
+
+
+ %2$s • VOOC Charging (%1$s until full)
+ %s • VOOC Charging
+
+
+ %2$s • Turbo Charging (%1$s until full)
+ %s • Turbo Charging
+
+
+ used today
+ Data
+ Wi-Fi
+
+
+ On-The-Go activated
+ On-The-Go is active
+ Stop
+ Options
+ Unable to start On-The-Go
+ Restart On-The-Go
+ Camera mode changed
+ Transparency
+ Use front camera
+ Automatically restart service
+ Main
+ On-The-Go
+
+
+ On-The-Go
+
+
+ CPU Info
+
+
+ FPS Info
+
+
+ FPS: %1$d
+
+
+ Compass
+ %1$.0f\u00b0 %2$s
+ Initializing\u2026
+ N
+ NE
+ E
+ SE
+ S
+ SW
+ W
+ NW
+
+
+ Switch data card
+
+
+ Volume panel
+
+
+ Priority
+ Alarms
+ DnD
+ Torch
+ Torch on
+ Torch off
+ Torch blink
+ Max-brightness
+ Min-brightness
+ Auto-brightness
+ Auto-rotate
+ Portrait
+ Landscape (90°)
+ Landscape (270°)
+
+
+
+ - %d device connected
+ - %d devices connected
+
+
+
+ Force stop?
+ If you force stop an app, it may misbehave.
+
+
+ Smart Pixels
+ Auto-enabled Smart Pixels
+
+
+ Error loading weather data
+ No weather data
+ Weather
+
+
+ Recognizing face...
+
+
+ Refresh rate
+ Auto
+
diff --git a/packages/SystemUI/res/values/flags.xml b/packages/SystemUI/res/values/flags.xml
index 4bcf99a54d052..30faeec2dfb9c 100644
--- a/packages/SystemUI/res/values/flags.xml
+++ b/packages/SystemUI/res/values/flags.xml
@@ -30,7 +30,7 @@
true
- true
+ false
diff --git a/packages/SystemUI/res/xml/status_bar_prefs.xml b/packages/SystemUI/res/xml/status_bar_prefs.xml
index 6c675b4374a6b..b8190b125765f 100644
--- a/packages/SystemUI/res/xml/status_bar_prefs.xml
+++ b/packages/SystemUI/res/xml/status_bar_prefs.xml
@@ -70,6 +70,11 @@
android:key="volume"
android:title="@*android:string/volume_unknown" />
+
+
provideBubblesManager(Context context,
@Binds
abstract FgsManagerController bindFgsManagerController(FgsManagerControllerImpl impl);
-
- @Provides
- @SysUISingleton
- static KeyguardSmartspaceController provideKeyguardSmartspaceController(FeatureFlags featureFlags,
- KeyguardZenAlarmViewController keyguardZenAlarmViewController, KeyguardMediaViewController keyguardMediaViewController) {
- return new KeyguardSmartspaceController(featureFlags, keyguardZenAlarmViewController, keyguardMediaViewController);
- }
-
- @Provides
- @SysUISingleton
- static KeyguardZenAlarmViewController provideKeyguardZenAlarmViewController(Context context, BcSmartspaceDataPlugin bcSmartspaceDataPlugin, ZenModeController zenModeController,
- AlarmManager alarmManager, NextAlarmController nextAlarmController, Handler handler) {
- return new KeyguardZenAlarmViewController(context, bcSmartspaceDataPlugin, zenModeController, alarmManager, nextAlarmController, handler);
- }
-
- @Provides
- @SysUISingleton
- static KeyguardMediaViewController provideKeyguardMediaViewController(Context context, BcSmartspaceDataPlugin bcSmartspaceDataPlugin,
- @Main DelayableExecutor delayableExecutor, NotificationMediaManager notificationMediaManager, BroadcastDispatcher broadcastDispatcher) {
- return new KeyguardMediaViewController(context, bcSmartspaceDataPlugin, delayableExecutor, notificationMediaManager, broadcastDispatcher);
- }
-
- @Provides
- @SysUISingleton
- static BcSmartspaceDataPlugin provideBcSmartspaceDataPlugin() {
- return new BcSmartspaceDataProvider();
- }
}
diff --git a/packages/SystemUI/src/com/android/systemui/flags/Flags.java b/packages/SystemUI/src/com/android/systemui/flags/Flags.java
index d13477aecd2f7..96d2a395b4408 100644
--- a/packages/SystemUI/src/com/android/systemui/flags/Flags.java
+++ b/packages/SystemUI/src/com/android/systemui/flags/Flags.java
@@ -156,9 +156,9 @@ public class Flags {
/***************************************/
// 600- status bar
- public static final SysPropBooleanFlag COMBINED_STATUS_BAR_SIGNAL_ICONS =
- new SysPropBooleanFlag(601, "persist.sys.enable.combined_signal_icons", false);
-
+ public static final UnreleasedFlag COMBINED_STATUS_BAR_SIGNAL_ICONS =
+ new UnreleasedFlag(601, false);
+
public static final ResourceBooleanFlag STATUS_BAR_USER_SWITCHER =
new ResourceBooleanFlag(602, R.bool.flag_user_switcher_chip);
@@ -200,7 +200,7 @@ public class Flags {
/***************************************/
// 900 - media
public static final UnreleasedFlag MEDIA_TAP_TO_TRANSFER = new UnreleasedFlag(900);
- public static final ReleasedFlag MEDIA_SESSION_ACTIONS = new ReleasedFlag(901, true);
+ public static final ReleasedFlag MEDIA_SESSION_ACTIONS = new ReleasedFlag(901);
public static final ReleasedFlag MEDIA_NEARBY_DEVICES = new ReleasedFlag(903);
public static final ReleasedFlag MEDIA_MUTE_AWAIT = new ReleasedFlag(904);
public static final UnreleasedFlag DREAM_MEDIA_COMPLICATION = new UnreleasedFlag(905);
diff --git a/packages/SystemUI/src/com/android/systemui/shade/LargeScreenShadeHeaderController.kt b/packages/SystemUI/src/com/android/systemui/shade/LargeScreenShadeHeaderController.kt
index af43e9cbb02a0..9ef042ea5ff6c 100644
--- a/packages/SystemUI/src/com/android/systemui/shade/LargeScreenShadeHeaderController.kt
+++ b/packages/SystemUI/src/com/android/systemui/shade/LargeScreenShadeHeaderController.kt
@@ -276,14 +276,8 @@ class LargeScreenShadeHeaderController @Inject constructor(
Utils.getColorAttrDefaultColor(header.context, android.R.attr.textColorPrimary)
)
- carrierIconSlots = if (featureFlags.isEnabled(Flags.COMBINED_STATUS_BAR_SIGNAL_ICONS)) {
- listOf(
- header.context.getString(com.android.internal.R.string.status_bar_no_calling),
- header.context.getString(com.android.internal.R.string.status_bar_call_strength)
- )
- } else {
+ carrierIconSlots =
listOf(header.context.getString(com.android.internal.R.string.status_bar_mobile))
- }
qsCarrierGroupController = qsCarrierGroupControllerBuilder
.setQSCarrierGroup(qsCarrierGroup)
.build()
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarImsView.java b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarImsView.java
new file mode 100644
index 0000000000000..5813ab402b6a9
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarImsView.java
@@ -0,0 +1,218 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.systemui.statusbar;
+
+import android.content.Context;
+import android.content.res.ColorStateList;
+import android.graphics.Rect;
+import android.os.UserHandle;
+import android.provider.Settings;
+import android.util.AttributeSet;
+import android.view.Gravity;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.FrameLayout;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+
+import com.android.systemui.R;
+import com.android.systemui.statusbar.connectivity.ImsIconState;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import static com.android.systemui.plugins.DarkIconDispatcher.getTint;
+import static com.android.systemui.statusbar.StatusBarIconView.STATE_DOT;
+import static com.android.systemui.statusbar.StatusBarIconView.STATE_HIDDEN;
+import static com.android.systemui.statusbar.StatusBarIconView.STATE_ICON;
+
+public class StatusBarImsView extends FrameLayout implements
+ StatusIconDisplayable {
+ private static final String TAG = "StatusBarImsView";
+
+ /// Used to show etc dots
+ private StatusBarIconView mDotView;
+
+ private ImsIconState mState;
+ private LinearLayout mImsGroup;
+ private ImageView mVowifiIcon;
+ private ImageView mVolteIcon;
+ private String mSlot;
+ private int mVisibleState = -1;
+
+ public StatusBarImsView(Context context) {
+ super(context);
+ }
+
+ public StatusBarImsView(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ public StatusBarImsView(Context context, AttributeSet attrs, int defStyleAttr) {
+ super(context, attrs, defStyleAttr);
+ }
+
+ public StatusBarImsView(Context context, AttributeSet attrs, int defStyleAttr,
+ int defStyleRes) {
+ super(context, attrs, defStyleAttr, defStyleRes);
+ }
+
+ public static StatusBarImsView fromContext(Context context, String slot) {
+ LayoutInflater inflater = LayoutInflater.from(context);
+ StatusBarImsView v = (StatusBarImsView) inflater.inflate(R.layout.status_bar_ims_group, null);
+ v.setSlot(slot);
+ v.init();
+ v.setVisibleState(STATE_ICON);
+ return v;
+ }
+
+ public void init() {
+ mImsGroup = findViewById(R.id.ims_group);
+ mVowifiIcon = findViewById(R.id.vowifi_icon);
+ mVolteIcon = findViewById(R.id.volte_icon);
+
+ initDotView();
+ }
+
+ private void initDotView() {
+ mDotView = new StatusBarIconView(mContext, mSlot, null);
+ mDotView.setVisibleState(STATE_DOT);
+
+ int width = mContext.getResources().getDimensionPixelSize(R.dimen.status_bar_icon_size);
+ LayoutParams lp = new LayoutParams(width, width);
+ lp.gravity = Gravity.CENTER_VERTICAL | Gravity.START;
+ addView(mDotView, lp);
+ }
+
+ @Override
+ public String getSlot() {
+ return mSlot;
+ }
+
+ public void setSlot(String slot) {
+ mSlot = slot;
+ }
+
+ @Override
+ public void setVisibleState(int state, boolean animate) {
+ if (state == mVisibleState) {
+ return;
+ }
+ mVisibleState = state;
+
+ switch (state) {
+ case STATE_ICON:
+ mImsGroup.setVisibility(View.VISIBLE);
+ mDotView.setVisibility(View.GONE);
+ break;
+ case STATE_DOT:
+ mImsGroup.setVisibility(View.GONE);
+ mDotView.setVisibility(View.VISIBLE);
+ break;
+ case STATE_HIDDEN:
+ default:
+ mImsGroup.setVisibility(View.GONE);
+ mDotView.setVisibility(View.GONE);
+ break;
+ }
+ }
+
+ @Override
+ public int getVisibleState() {
+ return mVisibleState;
+ }
+
+ @Override
+ public boolean isIconVisible() {
+ return mState != null && mState.visible;
+ }
+
+ public void applyImsState(ImsIconState state) {
+ boolean requestLayout = false;
+
+ if (state == null) {
+ requestLayout = getVisibility() != View.GONE;
+ setVisibility(View.GONE);
+ mState = null;
+ } else if (mState == null) {
+ requestLayout = true;
+ mState = state;
+ initViewState(state);
+ } else if (!mState.equals(state)) {
+ requestLayout = updateState(state);
+ }
+
+ if (requestLayout) {
+ requestLayout();
+ }
+ }
+
+ private boolean updateState(ImsIconState state) {
+ boolean needsLayout = false;
+
+ if (mState.visible != state.visible
+ || mState.vowifiVisible != state.vowifiVisible
+ || mState.volteVisible != state.volteVisible) {
+ initViewState(state);
+ needsLayout = true;
+ }
+
+ mState = state;
+ return needsLayout;
+ }
+
+ private void initViewState(ImsIconState state) {
+ setContentDescription(state.contentDescription);
+ if (state.vowifiVisible) {
+ mVolteIcon.setVisibility(View.GONE);
+ mVowifiIcon.setImageDrawable(mContext.getDrawable(state.vowifiIcon));
+ mVowifiIcon.setVisibility(View.VISIBLE);
+ } else if (state.volteVisible) {
+ mVowifiIcon.setVisibility(View.GONE);
+ mVolteIcon.setImageDrawable(mContext.getDrawable(state.volteIcon));
+ mVolteIcon.setVisibility(View.VISIBLE);
+ } else {
+ mVolteIcon.setVisibility(View.GONE);
+ mVowifiIcon.setVisibility(View.GONE);
+ }
+ setVisibility(state.visible ? View.VISIBLE : View.GONE);
+ }
+
+ @Override
+ public void setDecorColor(int color) {
+ mDotView.setDecorColor(color);
+ }
+
+ @Override
+ public void setStaticDrawableColor(int color) {
+ ColorStateList list = ColorStateList.valueOf(color);
+ mVolteIcon.setImageTintList(list);
+ mVowifiIcon.setImageTintList(list);
+ mDotView.setDecorColor(color);
+ }
+
+ @Override
+ public void onDarkChanged(ArrayList areas, float darkIntensity, int tint) {
+ int areaTint = getTint(areas, this, tint);
+ ColorStateList color = ColorStateList.valueOf(areaTint);
+ mVolteIcon.setImageTintList(color);
+ mVowifiIcon.setImageTintList(color);
+ mDotView.setDecorColor(areaTint);
+ mDotView.setIconColor(areaTint, false);
+ }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarMobileView.java b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarMobileView.java
index 0a2c1c08c8092..83c80de3602ce 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarMobileView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarMobileView.java
@@ -40,6 +40,7 @@
import com.android.systemui.DualToneHandler;
import com.android.systemui.R;
import com.android.systemui.plugins.DarkIconDispatcher.DarkReceiver;
+import com.android.systemui.statusbar.phone.StatusBarIconController;
import com.android.systemui.statusbar.phone.StatusBarSignalPolicy.MobileIconState;
import java.util.ArrayList;
@@ -60,31 +61,35 @@ public class StatusBarMobileView extends FrameLayout implements DarkReceiver,
private ImageView mOut;
private ImageView mMobile, mMobileType, mMobileRoaming;
private View mMobileSignalType;
- private View mMobileRoamingSpace;
+ private View mMobileTypeSpace, mMobileRoamingSpace;
@StatusBarIconView.VisibleState
private int mVisibleState = STATE_HIDDEN;
private DualToneHandler mDualToneHandler;
private boolean mForceHidden;
- private boolean mProviderModel;
-
- private ImageView mVolte;
-
private boolean mOldStyleType;
private ImageView mMobileTypeSmall;
/**
* Designated constructor
+ *
+ * This view is special, in that it is the only view in SystemUI that allows for a configuration
+ * override on a MCC/MNC-basis. This means that for every mobile view inflated, we have to
+ * construct a context with that override, since the resource system doesn't have a way to
+ * handle this for us.
+ *
+ * @param context A context with resources configured by MCC/MNC
+ * @param slot The string key defining which slot this icon refers to. Always "mobile" for the
+ * mobile icon
*/
public static StatusBarMobileView fromContext(
Context context,
- String slot,
- boolean providerModel
+ String slot
) {
LayoutInflater inflater = LayoutInflater.from(context);
StatusBarMobileView v = (StatusBarMobileView)
inflater.inflate(R.layout.status_bar_mobile_signal_group, null);
v.setSlot(slot);
- v.init(providerModel);
+ v.init();
v.setVisibleState(STATE_ICON);
return v;
}
@@ -123,22 +128,17 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
setMeasuredDimension(mMobileGroup.getMeasuredWidth(), mMobileGroup.getMeasuredHeight());
}
- private void init(boolean providerModel) {
- mProviderModel = providerModel;
+ private void init() {
mDualToneHandler = new DualToneHandler(getContext());
mMobileGroup = findViewById(R.id.mobile_group);
mMobile = findViewById(R.id.mobile_signal);
mMobileType = findViewById(R.id.mobile_type);
- if (mProviderModel) {
- mMobileRoaming = findViewById(R.id.mobile_roaming_large);
- } else {
- mMobileRoaming = findViewById(R.id.mobile_roaming);
- }
- mMobileRoamingSpace = findViewById(R.id.mobile_roaming_space);
+ mMobileRoaming = findViewById(R.id.mobile_roaming);
+ mMobileRoamingSpace = findViewById(R.id.mobile_roaming_space);
+ mMobileTypeSpace = findViewById(R.id.mobile_type_space);
mIn = findViewById(R.id.mobile_in);
mOut = findViewById(R.id.mobile_out);
mInoutContainer = findViewById(R.id.inout_container);
- mVolte = findViewById(R.id.mobile_volte);
mMobileSignalType = findViewById(R.id.mobile_signal_type);
mMobileTypeSmall = findViewById(R.id.mobile_type_small);
@@ -185,8 +185,18 @@ private void initViewState() {
mMobileGroup.setVisibility(View.VISIBLE);
}
mMobileDrawable.setLevel(mState.strengthId);
+ if (mState.typeId > 0) {
+ mMobileType.setContentDescription(mState.typeContentDescription);
+ mMobileType.setImageResource(mState.typeId);
+ mMobileType.setVisibility(View.VISIBLE);
+ } else {
+ mMobile.setVisibility(View.GONE);
+ }
+
boolean showRoamingSpace = mOldStyleType ? true : false;
if (mState.typeId > 0) {
+ mMobileType.setScaleX(getContext().getResources().getConfiguration().fontScale);
+ mMobileType.setScaleY(getContext().getResources().getConfiguration().fontScale);
if (mOldStyleType) {
showOldStyle(mState);
} else {
@@ -199,6 +209,7 @@ private void initViewState() {
mMobileTypeSmall.setVisibility(View.GONE);
setMobileSignalWidth(true);
}
+ mMobileTypeSpace.setVisibility(mState.typeSpacerVisible ? View.VISIBLE : View.GONE);
mMobile.setVisibility(mState.showTriangle ? View.VISIBLE : View.GONE);
mMobileRoaming.setVisibility(mState.roaming ? View.VISIBLE : View.GONE);
mMobileRoamingSpace.setVisibility(mState.roaming || showRoamingSpace ? View.VISIBLE : View.GONE);
@@ -206,12 +217,6 @@ private void initViewState() {
mOut.setVisibility(mState.activityOut ? View.VISIBLE : View.GONE);
mInoutContainer.setVisibility((mState.activityIn || mState.activityOut)
? View.VISIBLE : View.GONE);
- if (mState.volteId > 0 ) {
- mVolte.setImageResource(mState.volteId);
- mVolte.setVisibility(View.VISIBLE);
- }else {
- mVolte.setVisibility(View.GONE);
- }
}
private void setMobileSignalWidth(boolean small) {
@@ -235,16 +240,15 @@ private boolean updateState(MobileIconState state) {
mMobileGroup.setVisibility(newVisibility);
needsLayout = true;
}
- if (state.strengthId > 0) {
+ if (mState.strengthId != state.strengthId) {
mMobileDrawable.setLevel(state.strengthId);
- mMobile.setVisibility(View.VISIBLE);
- } else {
- mMobile.setVisibility(View.GONE);
}
boolean showRoamingSpace = mOldStyleType ? true : false;
if (mState.typeId != state.typeId) {
needsLayout |= state.typeId == 0 || mState.typeId == 0;
if (state.typeId != 0) {
+ mMobileType.setScaleX(getContext().getResources().getConfiguration().fontScale);
+ mMobileType.setScaleY(getContext().getResources().getConfiguration().fontScale);
if (mOldStyleType) {
showOldStyle(state);
} else {
@@ -255,12 +259,13 @@ private boolean updateState(MobileIconState state) {
}
}
+ mMobile.setVisibility(state.showTriangle ? View.VISIBLE : View.GONE);
if (state.roaming) {
mMobileTypeSmall.setVisibility(View.GONE);
setMobileSignalWidth(true);
}
- mMobile.setVisibility(state.showTriangle ? View.VISIBLE : View.GONE);
+ mMobileTypeSpace.setVisibility(state.typeSpacerVisible ? View.VISIBLE : View.GONE);
mMobileRoaming.setVisibility(state.roaming ? View.VISIBLE : View.GONE);
mMobileRoamingSpace.setVisibility(showRoamingSpace || state.roaming ? View.VISIBLE : View.GONE);
mIn.setVisibility(state.activityIn ? View.VISIBLE : View.GONE);
@@ -268,15 +273,6 @@ private boolean updateState(MobileIconState state) {
mInoutContainer.setVisibility((state.activityIn || state.activityOut)
? View.VISIBLE : View.GONE);
- if (mState.volteId != state.volteId) {
- if (state.volteId != 0) {
- mVolte.setImageResource(state.volteId);
- mVolte.setVisibility(View.VISIBLE);
- } else {
- mVolte.setVisibility(View.GONE);
- }
- }
-
needsLayout |= state.roaming != mState.roaming
|| state.activityIn != mState.activityIn
|| state.activityOut != mState.activityOut
@@ -297,7 +293,6 @@ public void onDarkChanged(ArrayList areas, float darkIntensity, int tint)
mMobileType.setImageTintList(color);
mMobileTypeSmall.setImageTintList(color);
mMobileRoaming.setImageTintList(color);
- mVolte.setImageTintList(color);
mDotView.setDecorColor(tint);
mDotView.setIconColor(tint, false);
}
@@ -318,9 +313,8 @@ public void setStaticDrawableColor(int color) {
mIn.setImageTintList(list);
mOut.setImageTintList(list);
mMobileType.setImageTintList(list);
- mMobileRoaming.setImageTintList(list);
- mVolte.setImageTintList(list);
mMobileTypeSmall.setImageTintList(list);
+ mMobileRoaming.setImageTintList(list);
mDotView.setDecorColor(color);
}
@@ -403,7 +397,7 @@ public void updateDisplayType(boolean oldStyleType) {
showNewStyle(mState);
}
} else {
- hideIndicators();
+ hideIndicators();
}
}
if (mState.roaming) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/CallbackHandler.java b/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/CallbackHandler.java
index 1638780041772..bb1ad3487433c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/CallbackHandler.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/CallbackHandler.java
@@ -48,6 +48,7 @@ public class CallbackHandler extends Handler implements EmergencyListener, Signa
private static final int MSG_MOBILE_DATA_ENABLED_CHANGED = 5;
private static final int MSG_ADD_REMOVE_EMERGENCY = 6;
private static final int MSG_ADD_REMOVE_SIGNAL = 7;
+ private static final int MSG_IMS_STATE_CHANGED = 8;
private static final int HISTORY_SIZE = 64;
private static final SimpleDateFormat SSDF = new SimpleDateFormat("MM-dd HH:mm:ss.SSS");
@@ -115,6 +116,11 @@ public void handleMessage(Message msg) {
mSignalCallbacks.remove((SignalCallback) msg.obj);
}
break;
+ case MSG_IMS_STATE_CHANGED:
+ for (SignalCallback signalCluster : mSignalCallbacks) {
+ signalCluster.setImsIcon((ImsIconState) msg.obj);
+ }
+ break;
}
}
@@ -253,6 +259,11 @@ public void setIsAirplaneMode(IconState icon) {
obtainMessage(MSG_AIRPLANE_MODE_CHANGED, icon).sendToTarget();
}
+ @Override
+ public void setImsIcon(ImsIconState icon) {
+ obtainMessage(MSG_IMS_STATE_CHANGED, icon).sendToTarget();;
+ }
+
void setListening(EmergencyListener listener, boolean listening) {
obtainMessage(MSG_ADD_REMOVE_EMERGENCY, listening ? 1 : 0, 0, listener).sendToTarget();
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/MobileSignalController.java b/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/MobileSignalController.java
index 2b5c5ea441395..cd80201276da7 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/MobileSignalController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/MobileSignalController.java
@@ -20,11 +20,10 @@
import static com.android.settingslib.mobile.MobileMappings.mapIconSets;
import android.content.BroadcastReceiver;
-import android.content.ContentResolver;
import android.content.Context;
+import android.content.ContentResolver;
import android.content.Intent;
import android.content.IntentFilter;
-import android.content.res.Resources;
import android.database.ContentObserver;
import android.net.NetworkCapabilities;
import android.os.Handler;
@@ -34,29 +33,22 @@
import android.telephony.AccessNetworkConstants;
import android.telephony.CellSignalStrength;
import android.telephony.CellSignalStrengthCdma;
-import android.telephony.NetworkRegistrationInfo;
-import android.telephony.ims.ImsMmTelManager;
-import android.telephony.ims.ImsReasonInfo;
-import android.telephony.ims.feature.ImsFeature;
-import android.telephony.ims.feature.MmTelFeature;
-import android.telephony.PhoneStateListener;
import android.telephony.ServiceState;
import android.telephony.SignalStrength;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
+import android.telephony.ims.ImsException;
import android.telephony.ims.ImsMmTelManager;
import android.telephony.ims.ImsReasonInfo;
import android.telephony.ims.ImsRegistrationAttributes;
import android.telephony.ims.RegistrationManager.RegistrationCallback;
+import android.telephony.ims.ImsStateCallback;
+import android.telephony.ims.feature.MmTelFeature;
import android.text.Html;
import android.text.TextUtils;
import android.util.Log;
-import com.android.ims.ImsException;
-import com.android.ims.ImsManager;
-import com.android.ims.FeatureConnector;
-import com.android.internal.util.ConcurrentUtils;
import com.android.internal.annotations.VisibleForTesting;
import com.android.settingslib.AccessibilityContentDescriptions;
import com.android.settingslib.SignalIcon.MobileIconGroup;
@@ -70,15 +62,13 @@
import com.android.settingslib.net.SignalStrengthUtil;
import com.android.systemui.Dependency;
import com.android.systemui.R;
-import com.android.systemui.dagger.qualifiers.Background;
+import com.android.systemui.tuner.TunerService;
import com.android.systemui.flags.FeatureFlags;
import com.android.systemui.flags.Flags;
-import com.android.systemui.tuner.TunerService;
import com.android.systemui.util.CarrierConfigTracker;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
-import java.util.ArrayList;
import java.util.BitSet;
import java.util.List;
import java.util.Map;
@@ -88,6 +78,7 @@
*/
public class MobileSignalController extends SignalController
implements TunerService.Tunable {
+
private static final SimpleDateFormat SSDF = new SimpleDateFormat("MM-dd HH:mm:ss.SSS");
private static final int STATUS_HISTORY_SIZE = 64;
private static final int IMS_TYPE_WWAN = 1;
@@ -102,6 +93,7 @@ public class MobileSignalController extends SignalController mFeatureConnector;
- private int mCallState = TelephonyManager.CALL_STATE_IDLE;
-
- private int mVoLTEicon = 0;
- private int mVoWIFIicon = 0;
- private boolean mOverride = true;
+ private boolean mIsVowifiAvailable;
private boolean mRoamingIconAllowed;
private boolean mDataDisabledIcon;
- private static final String VOLTE_ICON_STYLE =
- "system:" + Settings.System.VOLTE_ICON_STYLE;
- public static final String VOWIFI_ICON_STYLE =
- "system:" + Settings.System.VOWIFI_ICON_STYLE;
- public static final String VOLTE_VOWIFI_OVERRIDE =
- "system:" + Settings.System.VOLTE_VOWIFI_OVERRIDE;
private static final String ROAMING_INDICATOR_ICON =
"system:" + Settings.System.ROAMING_INDICATOR_ICON;
private static final String SHOW_FOURG_ICON =
@@ -208,14 +188,14 @@ public void onRegistered(ImsRegistrationAttributes attributes) {
notifyCallStateChange(statusIcon, mSubscriptionInfo.getSubscriptionId());
}
}
- mCurrentState.imsRegistered = true;
- notifyListenersIfNecessary();
- }
+ mCurrentState.imsRegistered = true;
+ notifyListenersIfNecessary();
+ }
- @Override
- public void onRegistering(ImsRegistrationAttributes attr) {
- mCurrentState.imsRegistered = false;
- notifyListenersIfNecessary();
+ @Override
+ public void onRegistering(ImsRegistrationAttributes attr) {
+ mCurrentState.imsRegistered = false;
+ notifyListenersIfNecessary();
}
@Override
@@ -245,6 +225,7 @@ public MobileSignalController(
SubscriptionDefaults defaults,
Looper receiverLooper,
CarrierConfigTracker carrierConfigTracker,
+ MobileStatusTrackerFactory mobileStatusTrackerFactory,
FeatureFlags featureFlags
) {
super("MobileSignalController(" + info.getSubscriptionId() + ")", context,
@@ -270,32 +251,6 @@ public MobileSignalController(
mLastState.networkNameData = mCurrentState.networkNameData = networkName;
mLastState.enabled = mCurrentState.enabled = hasMobileData;
mLastState.iconGroup = mCurrentState.iconGroup = mDefaultIcons;
-
- int phoneId = mSubscriptionInfo.getSimSlotIndex();
- mFeatureConnector = new FeatureConnector(mContext, phoneId,
- new FeatureConnector.ManagerFactory () {
- @Override
- public ImsManager createManager(Context context, int phoneId) {
- return ImsManager.getInstance(context, phoneId);
- }
- }, "Ims",
- new ArrayList(ImsFeature.STATE_LOG_MAP.keySet()),
- new FeatureConnector.Listener () {
- @Override
- public void connectionReady(ImsManager manager, int subId)
- throws ImsException {
- Log.d(mTag, "ImsManager: connection ready.");
- mImsManager = manager;
- setListeners();
- }
-
- @Override
- public void connectionUnavailable(int reason) {
- Log.d(mTag, "ImsManager: connection unavailable. reason: " + reason);
- removeListeners();
- }
- }, ConcurrentUtils.DIRECT_EXECUTOR);
-
mObserver = new ContentObserver(new Handler(receiverLooper)) {
@Override
public void onChange(boolean selfChange) {
@@ -303,12 +258,9 @@ public void onChange(boolean selfChange) {
}
};
mImsMmTelManager = ImsMmTelManager.createForSubscriptionId(info.getSubscriptionId());
- mMobileStatusTracker = new MobileStatusTracker(mPhone, receiverLooper,
- info, mDefaults, mMobileCallback);
- mProviderModelBehavior = featureFlags.isEnabled(Flags.COMBINED_STATUS_BAR_SIGNAL_ICONS);
- Dependency.get(TunerService.class).addTunable(this, VOLTE_ICON_STYLE);
- Dependency.get(TunerService.class).addTunable(this, VOWIFI_ICON_STYLE);
- Dependency.get(TunerService.class).addTunable(this, VOLTE_VOWIFI_OVERRIDE);
+ mMobileStatusTracker = mobileStatusTrackerFactory.createTracker(mMobileCallback);
+ mProviderModelBehavior = featureFlags.isEnabled(Flags.COMBINED_STATUS_BAR_SIGNAL_ICONS);
+
Dependency.get(TunerService.class).addTunable(this, ROAMING_INDICATOR_ICON);
Dependency.get(TunerService.class).addTunable(this, SHOW_FOURG_ICON);
Dependency.get(TunerService.class).addTunable(this, DATA_DISABLED_ICON);
@@ -317,24 +269,9 @@ public void onChange(boolean selfChange) {
@Override
public void onTuningChanged(String key, String newValue) {
switch (key) {
- case VOLTE_ICON_STYLE:
- mVoLTEicon =
- TunerService.parseInteger(newValue, 0);
- notifyListeners();
- break;
- case VOWIFI_ICON_STYLE:
- mVoWIFIicon =
- TunerService.parseInteger(newValue, 0);
- notifyListeners();
- break;
- case VOLTE_VOWIFI_OVERRIDE:
- mOverride =
- TunerService.parseIntegerSwitch(newValue, true);
- notifyListeners();
- break;
case ROAMING_INDICATOR_ICON:
mRoamingIconAllowed =
- TunerService.parseIntegerSwitch(newValue, true);
+ TunerService.parseIntegerSwitch(newValue, false);
updateTelephony();
break;
case SHOW_FOURG_ICON:
@@ -343,10 +280,10 @@ public void onTuningChanged(String key, String newValue) {
notifyListeners();
break;
case DATA_DISABLED_ICON:
- mDataDisabledIcon =
+ mDataDisabledIcon =
TunerService.parseIntegerSwitch(newValue, true);
updateTelephony();
- break;
+ break;
default:
break;
}
@@ -379,6 +316,12 @@ public void updateConnectivity(BitSet connectedTransports, BitSet validatedTrans
notifyListenersIfNecessary();
}
+ @Override
+ void notifyListenersIfNecessary() {
+ super.notifyListenersIfNecessary();
+ mNetworkController.updateImsIcon();
+ }
+
void setCarrierNetworkChangeMode(boolean carrierNetworkChangeMode) {
mCurrentState.carrierNetworkChangeMode = carrierNetworkChangeMode;
updateTelephony();
@@ -397,10 +340,14 @@ public void registerListener() {
if (mProviderModelBehavior) {
mReceiverHandler.post(mTryRegisterIms);
}
-
- mContext.registerReceiver(mVolteSwitchObserver,
+ mContext.registerReceiver(mVolteSwitchObserver,
new IntentFilter("org.codeaurora.intent.action.ACTION_ENHANCE_4G_SWITCH"));
- mFeatureConnector.connect();
+ try {
+ mImsMmTelManager.registerImsStateCallback(mContext.getMainExecutor(),
+ mImsStateCallback);
+ } catch (ImsException exception) {
+ Log.e(mTag, "failed to call registerImsStateCallback ", exception);
+ }
}
// There is no listener to monitor whether the IMS service is ready, so we have to retry the
@@ -416,7 +363,8 @@ public void run() {
mImsMmTelManager.registerImsRegistrationCallback(
mReceiverHandler::post, mRegistrationCallback);
Log.d(mTag, "registerImsRegistrationCallback succeeded");
- } catch (RuntimeException | android.telephony.ims.ImsException e) {
+ queryImsState();
+ } catch (RuntimeException | ImsException e) {
if (mRetryCount < MAX_RETRY) {
Log.e(mTag, mRetryCount + " registerImsRegistrationCallback failed", e);
// Wait for 5 seconds to retry
@@ -432,9 +380,13 @@ public void run() {
public void unregisterListener() {
mMobileStatusTracker.setListening(false);
mContext.getContentResolver().unregisterContentObserver(mObserver);
- mImsMmTelManager.unregisterImsRegistrationCallback(mRegistrationCallback);
+ try {
+ mImsMmTelManager.unregisterImsRegistrationCallback(mRegistrationCallback);
+ } catch (Exception e){
+ Log.e(mTag, "unregisterListener: fail to call unregisterImsRegistrationCallback", e);
+ }
mContext.unregisterReceiver(mVolteSwitchObserver);
- mFeatureConnector.disconnect();
+ mImsMmTelManager.unregisterImsStateCallback(mImsStateCallback);
}
private void updateInflateSignalStrength() {
@@ -477,151 +429,25 @@ public int getQsCurrentIconId() {
return getCurrentIconId();
}
- private boolean isVolteSwitchOn() {
- return mImsManager != null && mImsManager.isEnhanced4gLteModeSettingEnabledByUser();
- }
-
- private int getVolteVowifiResId() {
+ private int getVolteResId() {
int resId = 0;
- if (mOverride && mVoWIFIicon > 0 && isVowifiAvailable()) {
- if (!isCallIdle()) {
- resId = R.drawable.ic_vowifi_calling;
- } else {
- switch (mVoWIFIicon) {
- case 1:
- default:
- resId = com.android.settingslib.R.drawable.ic_vowifi;
- break;
- case 2:
- resId = com.android.settingslib.R.drawable.ic_vowifi_oneplus;
- break;
- case 3:
- resId = com.android.settingslib.R.drawable.ic_vowifi_moto;
- break;
- case 4:
- resId = com.android.settingslib.R.drawable.ic_vowifi_asus;
- break;
- case 5:
- resId = com.android.settingslib.R.drawable.ic_vowifi_emui;
- break;
- case 6:
- resId = com.android.settingslib.R.drawable.ic_vowifi_oneplus_compact;
- break;
- case 7:
- resId = com.android.settingslib.R.drawable.ic_vowifi_vivo;
- break;
- case 8:
- resId = com.android.settingslib.R.drawable.ic_vowifi_margaritov;
- break;
- }
- }
- } else if (mVoLTEicon > 0 && isVolteAvailable()) {
- switch (mVoLTEicon) {
- case 1:
- resId = R.drawable.ic_volte1;
- break;
- case 2:
- resId = R.drawable.ic_volte2;
- break;
- case 3:
- resId = R.drawable.ic_volte3;
- break;
- case 4:
- resId = R.drawable.ic_volte4;
- break;
- case 5:
- resId = R.drawable.ic_volte5;
- break;
- case 6:
- resId = R.drawable.ic_volte6;
- break;
- case 7:
- resId = R.drawable.ic_volte7;
- break;
- case 8:
- resId = R.drawable.ic_volte8; // EMUI icon
- break;
- case 9:
- resId = R.drawable.ic_volte9; //Oneplus Compact
- break;
- // Margaritov's VoLTE icon
- case 10:
- resId = R.drawable.ic_volte_margaritov;
- break;
- // Margaritov's VoLTE icon2
- case 11:
- resId = R.drawable.ic_volte_margaritov2;
- break;
- // Vivo VoLTE icon
- case 12:
- resId = R.drawable.ic_volte_vivo;
- break;
- case 15:
- resId = R.drawable.ic_volte_aris;
- break;
- case 16:
- resId = R.drawable.ic_volte_beast;
- break;
- case 17:
- resId = R.drawable.ic_volte_ios;
- break;
- case 18:
- resId = R.drawable.ic_volte_lr;
- break;
- case 19:
- resId = R.drawable.ic_volte_realme;
- break;
- case 20:
- resId = R.drawable.ic_volte_typeA;
- break;
- case 21:
- resId = R.drawable.ic_volte_typeB;
- break;
- case 22:
- resId = R.drawable.ic_volte_typeC;
- break;
- case 23:
- resId = R.drawable.ic_volte_typeD;
- break;
- case 24:
- resId = R.drawable.ic_volte_typeE;
- break;
- case 25:
- resId = R.drawable.ic_volte_vcircle;
- break;
- case 26:
- resId = R.drawable.ic_volte_vimeo;
- break;
- case 27:
- resId = R.drawable.ic_volte_volit;
- break;
- case 28:
- resId = R.drawable.ic_volte_zirco;
- break;
- default:
- break;
- }
+ if ((mCurrentState.voiceCapable || mCurrentState.videoCapable)
+ && mCurrentState.imsRegistered) {
+ resId = R.drawable.ic_volte;
}
return resId;
}
private void setListeners() {
- if (mImsManager == null) {
- Log.e(mTag, "setListeners mImsManager is null");
- return;
- }
-
try {
- mImsManager.addCapabilitiesCallback(mCapabilityCallback,
- ConcurrentUtils.DIRECT_EXECUTOR);
- mImsManager.addRegistrationCallback(mRegistrationCallback,
- ConcurrentUtils.DIRECT_EXECUTOR);
- Log.d(mTag, "addCapabilitiesCallback " + mCapabilityCallback + " into " + mImsManager);
- Log.d(mTag, "addRegistrationCallback " + mRegistrationCallback
- + " into " + mImsManager);
+ Log.d(mTag, "setListeners: register CapabilitiesCallback and RegistrationCallback");
+ mImsMmTelManager.registerMmTelCapabilityCallback(mContext.getMainExecutor(),
+ mCapabilityCallback);
+ mImsMmTelManager.registerImsRegistrationCallback (mContext.getMainExecutor(),
+ mRegistrationCallback);
} catch (ImsException e) {
- Log.d(mTag, "unable to addCapabilitiesCallback callback.");
+ Log.e(mTag, "unable to register listeners.", e);
}
queryImsState();
}
@@ -631,31 +457,32 @@ private void queryImsState() {
mCurrentState.voiceCapable = tm.isVolteAvailable();
mCurrentState.videoCapable = tm.isVideoTelephonyAvailable();
mCurrentState.imsRegistered = mPhone.isImsRegistered(mSubscriptionInfo.getSubscriptionId());
+ mIsVowifiAvailable = tm.isWifiCallingAvailable();
if (DEBUG) {
Log.d(mTag, "queryImsState tm=" + tm + " phone=" + mPhone
+ " voiceCapable=" + mCurrentState.voiceCapable
+ " videoCapable=" + mCurrentState.videoCapable
- + " imsResitered=" + mCurrentState.imsRegistered);
+ + " imsRegistered=" + mCurrentState.imsRegistered
+ + " mIsVowifiAvailable=" + mIsVowifiAvailable);
}
notifyListenersIfNecessary();
}
private void removeListeners() {
- if (mImsManager == null) {
- Log.e(mTag, "removeListeners mImsManager is null");
- return;
+ try {
+ Log.d(mTag,
+ "removeListeners: unregister CapabilitiesCallback and RegistrationCallback");
+ mImsMmTelManager.unregisterMmTelCapabilityCallback(mCapabilityCallback);
+ mImsMmTelManager.unregisterImsRegistrationCallback(mRegistrationCallback);
+ } catch (Exception e) {
+ Log.e(mTag, "removeListeners", e);
}
-
- mImsManager.removeCapabilitiesCallback(mCapabilityCallback);
- mImsManager.removeRegistrationListener(mRegistrationCallback);
- Log.d(mTag, "removeCapabilitiesCallback " + mCapabilityCallback
- + " from " + mImsManager);
- Log.d(mTag, "removeRegistrationCallback " + mRegistrationCallback
- + " from " + mImsManager);
+ queryImsState();
}
@Override
public void notifyListeners(SignalCallback callback) {
+ mHandler.post(() -> {
// If the device is on carrier merged WiFi, we should let WifiSignalController to control
// the SysUI states.
if (mNetworkController.isCarrierMergedWifi(mSubscriptionInfo.getSubscriptionId())) {
@@ -678,8 +505,6 @@ public void notifyListeners(SignalCallback callback) {
final QsInfo qsInfo = getQsInfo(contentDescription, icons.dataType);
final SbInfo sbInfo = getSbInfo(contentDescription, icons.dataType);
- int voltewifiIcon = getVolteVowifiResId();
-
MobileDataIndicators mobileDataIndicators = new MobileDataIndicators(
sbInfo.icon,
qsInfo.icon,
@@ -692,9 +517,9 @@ public void notifyListeners(SignalCallback callback) {
qsInfo.description,
mSubscriptionInfo.getSubscriptionId(),
mCurrentState.roaming,
- sbInfo.showTriangle,
- voltewifiIcon);
+ sbInfo.showTriangle);
callback.setMobileDataIndicators(mobileDataIndicators);
+ });
}
private QsInfo getQsInfo(String contentDescription, int dataTypeIcon) {
@@ -703,7 +528,7 @@ private QsInfo getQsInfo(String contentDescription, int dataTypeIcon) {
CharSequence qsDescription = null;
if (mCurrentState.dataSim) {
- // If using provider model behavior, only show QS icons if the state is also default
+ // only show QS icons if the state is also default
if (!mCurrentState.isDefault) {
return new QsInfo(qsTypeIcon, qsIcon, qsDescription);
}
@@ -738,13 +563,7 @@ private SbInfo getSbInfo(String contentDescription, int dataTypeIcon) {
statusIcon = new IconState(
showDataIconStatusBar && !mCurrentState.airplaneMode,
getCurrentIconId(), contentDescription);
- MobileIconGroup vowifiIconGroup = getVowifiIconGroup();
- if (vowifiIconGroup != null) {
- typeIcon = vowifiIconGroup.dataType;
- statusIcon = new IconState(true,
- mCurrentState.enabled && !mCurrentState.airplaneMode? statusIcon.icon : -1,
- statusIcon.contentDescription);
- }
+
showTriangle = showDataIconStatusBar && !mCurrentState.airplaneMode;
} else {
statusIcon = new IconState(
@@ -755,19 +574,17 @@ private SbInfo getSbInfo(String contentDescription, int dataTypeIcon) {
(mCurrentState.dataConnected && mCurrentState.isDefault) || dataDisabled;
typeIcon =
(showDataIconInStatusBar || mConfig.alwaysShowDataRatIcon) ? dataTypeIcon : 0;
- MobileIconGroup vowifiIconGroup = getVowifiIconGroup();
- if (vowifiIconGroup != null) {
- typeIcon = vowifiIconGroup.dataType;
- statusIcon = new IconState(true,
- mCurrentState.enabled && !mCurrentState.airplaneMode? statusIcon.icon : -1,
- statusIcon.contentDescription);
- }
showTriangle = mCurrentState.enabled && !mCurrentState.airplaneMode;
}
return new SbInfo(showTriangle, typeIcon, statusIcon);
}
+ public boolean isVolteAvailable() {
+ return mCurrentState.imsRegistered
+ && (mCurrentState.voiceCapable || mCurrentState.videoCapable);
+ }
+
@Override
protected MobileState cleanState() {
return new MobileState();
@@ -1127,61 +944,16 @@ private void recordLastMobileStatus(String mobileStatus) {
void setImsType(int imsType) {
mImsType = imsType;
}
-
- private boolean isCallIdle() {
- return mCallState == TelephonyManager.CALL_STATE_IDLE;
- }
-
- private int getDataNetworkType() {
+
+ private int getDataNetworkType() {
return mCurrentState != null ?
mCurrentState.getDataNetworkType() : TelephonyManager.NETWORK_TYPE_UNKNOWN;
}
- private boolean isVolteAvailable() {
- return isVolteSwitchOn()
- && (mCurrentState.voiceCapable || mCurrentState.videoCapable) && mCurrentState.imsRegistered;
- }
-
- private boolean isVowifiAvailable() {
- return isVolteAvailable()
- && getDataNetworkType() == TelephonyManager.NETWORK_TYPE_IWLAN;
- }
-
- private MobileIconGroup getVowifiIconGroup() {
- if (mVoWIFIicon == 0 || mOverride) return null;
-
- if (isVowifiAvailable() && !isCallIdle()) {
- return TelephonyIcons.VOWIFI_CALLING;
- } else if (isVowifiAvailable()) {
- switch (mVoWIFIicon) {
- case 1:
- default:
- return TelephonyIcons.VOWIFI;
- // OOS
- case 2:
- return TelephonyIcons.VOWIFI_ONEPLUS;
- // Motorola
- case 3:
- return TelephonyIcons.VOWIFI_MOTO;
- // ASUS
- case 4:
- return TelephonyIcons.VOWIFI_ASUS;
- // EMUI (Huawei P10)
- case 5:
- return TelephonyIcons.VOWIFI_EMUI;
- // Oneplus Compact
- case 6:
- return TelephonyIcons.VOWIFI_ONEPLUS_COMPACT;
- // Vivo
- case 7:
- return TelephonyIcons.VOWIFI_VIVO;
- // Margaritov
- case 8:
- return TelephonyIcons.VOWIFI_Margaritov;
- }
- } else {
- return null;
- }
+ public boolean isVowifiAvailable() {
+ return mCurrentState.voiceCapable && mCurrentState.imsRegistered
+ && (getDataNetworkType() == TelephonyManager.NETWORK_TYPE_IWLAN
+ || mIsVowifiAvailable);
}
@Override
@@ -1210,6 +982,46 @@ public void dump(PrintWriter pw) {
dumpTableData(pw);
}
+ private ImsMmTelManager.CapabilityCallback mCapabilityCallback = new ImsMmTelManager.CapabilityCallback() {
+ @Override
+ public void onCapabilitiesStatusChanged(MmTelFeature.MmTelCapabilities config) {
+ mCurrentState.voiceCapable =
+ config.isCapable(MmTelFeature.MmTelCapabilities.CAPABILITY_TYPE_VOICE);
+ mCurrentState.videoCapable =
+ config.isCapable(MmTelFeature.MmTelCapabilities.CAPABILITY_TYPE_VIDEO);
+ Log.d(mTag, "onCapabilitiesStatusChanged isVoiceCapable=" + mCurrentState.voiceCapable
+ + " isVideoCapable=" + mCurrentState.videoCapable);
+ notifyListenersIfNecessary();
+ }
+ };
+
+ private final BroadcastReceiver mVolteSwitchObserver = new BroadcastReceiver() {
+ public void onReceive(Context context, Intent intent) {
+ Log.d(mTag, "action=" + intent.getAction());
+ notifyListeners();
+ }
+ };
+
+ private final ImsStateCallback mImsStateCallback = new ImsStateCallback() {
+ @Override
+ public void onUnavailable(int reason) {
+ Log.d(mTag, "ImsStateCallback.onUnavailable: reason=" + reason);
+ removeListeners();
+ }
+
+ @Override
+ public void onAvailable() {
+ Log.d(mTag, "ImsStateCallback.onAvailable");
+ setListeners();
+ }
+
+ @Override
+ public void onError() {
+ Log.e(mTag, "ImsStateCallback.onError");
+ removeListeners();
+ }
+ };
+
/** Box for QS icon info */
private static final class QsInfo {
final int ratTypeIcon;
@@ -1235,26 +1047,4 @@ private static final class SbInfo {
icon = iconState;
}
}
-
- private ImsMmTelManager.CapabilityCallback mCapabilityCallback = new ImsMmTelManager.CapabilityCallback() {
- @Override
- public void onCapabilitiesStatusChanged(MmTelFeature.MmTelCapabilities config) {
- mCurrentState.voiceCapable =
- config.isCapable(MmTelFeature.MmTelCapabilities.CAPABILITY_TYPE_VOICE);
- mCurrentState.videoCapable =
- config.isCapable(MmTelFeature.MmTelCapabilities.CAPABILITY_TYPE_VIDEO);
- Log.d(mTag, "onCapabilitiesStatusChanged isVoiceCapable=" + mCurrentState.voiceCapable
- + " isVideoCapable=" + mCurrentState.videoCapable);
- notifyListenersIfNecessary();
- }
- };
-
- private final BroadcastReceiver mVolteSwitchObserver = new BroadcastReceiver() {
- public void onReceive(Context context, Intent intent) {
- Log.d(mTag, "action=" + intent.getAction());
- if (isVolteSwitchOn()) {
- notifyListeners();
- }
- }
- };
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/MobileSignalControllerFactory.kt b/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/MobileSignalControllerFactory.kt
index 36155210e09c1..5033a78791400 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/MobileSignalControllerFactory.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/MobileSignalControllerFactory.kt
@@ -45,6 +45,12 @@ internal class MobileSignalControllerFactory @Inject constructor(
subscriptionDefaults: MobileStatusTracker.SubscriptionDefaults,
receiverLooper: Looper // TODO: no!
): MobileSignalController {
+ val mobileTrackerFactory = MobileStatusTrackerFactory(
+ phone,
+ receiverLooper,
+ subscriptionInfo,
+ subscriptionDefaults)
+
return MobileSignalController(
context,
config,
@@ -56,6 +62,7 @@ internal class MobileSignalControllerFactory @Inject constructor(
subscriptionDefaults,
receiverLooper,
carrierConfigTracker,
+ mobileTrackerFactory,
featureFlags,
)
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/MobileState.kt b/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/MobileState.kt
index 0f236816289c6..10fcb8efc6a78 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/MobileState.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/MobileState.kt
@@ -89,9 +89,9 @@ internal class MobileState(
roaming = o.roaming
dataState = o.dataState
defaultDataOff = o.defaultDataOff
- imsRegistered = o.imsRegistered
- voiceCapable = o.voiceCapable
- videoCapable = o.videoCapable
+ imsRegistered = o.imsRegistered;
+ voiceCapable = o.voiceCapable;
+ videoCapable = o.videoCapable;
telephonyDisplayInfo = o.telephonyDisplayInfo
serviceState = o.serviceState
@@ -264,9 +264,6 @@ internal class MobileState(
result = 31 * result + roaming.hashCode()
result = 31 * result + dataState
result = 31 * result + defaultDataOff.hashCode()
- result = 31 * result + imsRegistered.hashCode()
- result = 31 * result + voiceCapable.hashCode()
- result = 31 * result + videoCapable.hashCode()
result = 31 * result + telephonyDisplayInfo.hashCode()
result = 31 * result + (serviceState?.hashCode() ?: 0)
result = 31 * result + (signalStrength?.hashCode() ?: 0)
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/MobileStatusTrackerFactory.kt b/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/MobileStatusTrackerFactory.kt
new file mode 100644
index 0000000000000..a4c1a19899331
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/MobileStatusTrackerFactory.kt
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.systemui.statusbar.connectivity
+
+import android.os.Looper
+import android.telephony.SubscriptionInfo
+import android.telephony.TelephonyManager
+import com.android.settingslib.mobile.MobileStatusTracker
+
+/**
+ * Factory for [MobileStatusTracker], which lives in SettingsLib
+ */
+class MobileStatusTrackerFactory (
+ val phone: TelephonyManager,
+ val receiverLooper: Looper,
+ val info: SubscriptionInfo,
+ val defaults: MobileStatusTracker.SubscriptionDefaults,
+) {
+ fun createTracker(
+ callback: MobileStatusTracker.Callback
+ ): MobileStatusTracker {
+ return MobileStatusTracker(
+ phone,
+ receiverLooper,
+ info,
+ defaults,
+ callback)
+ }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/NetworkControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/NetworkControllerImpl.java
index 6be347b55bc51..3bc3825f94f76 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/NetworkControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/NetworkControllerImpl.java
@@ -142,6 +142,8 @@ public class NetworkControllerImpl extends BroadcastReceiver
private final LogBuffer mLogBuffer;
private final MobileSignalControllerFactory mMobileFactory;
+ private boolean mSwap = false;
+
private TelephonyCallback.ActiveDataSubscriptionIdListener mPhoneStateListener;
private int mActiveMobileDataSubscription = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
@@ -755,9 +757,90 @@ public void addCallback(@NonNull SignalCallback cb) {
mobileSignalController.refreshCallIndicator(cb);
}
}
+ if (mMobileSignalControllers.size() == 2) {
+ boolean volte1 = mMobileSignalControllers.valueAt(0).isVolteAvailable();
+ boolean volte2 = mMobileSignalControllers.valueAt(1).isVolteAvailable();
+ boolean vowifi1 = mMobileSignalControllers.valueAt(0).isVowifiAvailable();
+ boolean vowifi2 = mMobileSignalControllers.valueAt(1).isVowifiAvailable();
+ cb.setImsIcon(new ImsIconState((volte1 || volte2),
+ (vowifi1 || vowifi2),
+ getVolteResId(volte1, volte2),
+ getVowifiResId(vowifi1, vowifi2),
+ mContext.getString(com.android.internal.R.string.status_bar_ims)
+ ));
+ } else if (mMobileSignalControllers.size() == 1) {
+ boolean volte = mMobileSignalControllers.valueAt(0).isVolteAvailable();
+ boolean vowifi = mMobileSignalControllers.valueAt(0).isVowifiAvailable();
+ cb.setImsIcon(new ImsIconState(volte,
+ vowifi,
+ volte ? R.drawable.stat_sys_volte : 0,
+ vowifi ? R.drawable.stat_sys_vowifi : 0,
+ mContext.getString(com.android.internal.R.string.status_bar_ims)
+ ));
+ } else {
+ cb.setImsIcon(new ImsIconState(false,
+ false,
+ 0,
+ 0,
+ mContext.getString(com.android.internal.R.string.status_bar_ims)
+ ));
+ }
mCallbackHandler.setListening(cb, true);
}
+ public void updateImsIcon() {
+ if (mMobileSignalControllers.size() == 2) {
+ boolean volte1 = mMobileSignalControllers.valueAt(0).isVolteAvailable();
+ boolean volte2 = mMobileSignalControllers.valueAt(1).isVolteAvailable();
+ boolean vowifi1 = mMobileSignalControllers.valueAt(0).isVowifiAvailable();
+ boolean vowifi2 = mMobileSignalControllers.valueAt(1).isVowifiAvailable();
+ mCallbackHandler.setImsIcon(new ImsIconState((volte1 || volte2),
+ (vowifi1 || vowifi2),
+ getVolteResId(volte1, volte2),
+ getVowifiResId(vowifi1, vowifi2),
+ mContext.getString(com.android.internal.R.string.status_bar_ims)
+ ));
+ } else if (mMobileSignalControllers.size() == 1) {
+ boolean volte = mMobileSignalControllers.valueAt(0).isVolteAvailable();
+ boolean vowifi = mMobileSignalControllers.valueAt(0).isVowifiAvailable();
+ mCallbackHandler.setImsIcon(new ImsIconState(volte,
+ vowifi,
+ volte ? R.drawable.stat_sys_volte : 0,
+ vowifi ? R.drawable.stat_sys_vowifi : 0,
+ mContext.getString(com.android.internal.R.string.status_bar_ims)
+ ));
+ } else {
+ mCallbackHandler.setImsIcon(new ImsIconState(false,
+ false,
+ 0,
+ 0,
+ mContext.getString(com.android.internal.R.string.status_bar_ims)
+ ));
+ }
+ }
+
+ private int getVolteResId(boolean volte1, boolean volte2) {
+ if (volte1 && volte2) {
+ return R.drawable.stat_sys_volte_slot12;
+ } else if (volte1) {
+ return mSwap ? R.drawable.stat_sys_volte_slot2 : R.drawable.stat_sys_volte_slot1;
+ } else if (volte2) {
+ return mSwap ? R.drawable.stat_sys_volte_slot1 : R.drawable.stat_sys_volte_slot2;
+ }
+ return 0;
+ }
+
+ private int getVowifiResId(boolean vowifi1, boolean vowifi2) {
+ if (vowifi1 && vowifi2) {
+ return R.drawable.stat_sys_vowifi_slot12;
+ } else if (vowifi1) {
+ return mSwap ? R.drawable.stat_sys_vowifi_slot2 : R.drawable.stat_sys_vowifi_slot1;
+ } else if (vowifi2) {
+ return mSwap ? R.drawable.stat_sys_vowifi_slot1 : R.drawable.stat_sys_vowifi_slot2;
+ }
+ return 0;
+ }
+
@Override
public void removeCallback(@NonNull SignalCallback cb) {
mCallbackHandler.setListening(cb, false);
@@ -877,6 +960,7 @@ void handleConfigurationChanged() {
private void updateMobileControllers() {
if (!mListening) {
+ updateImsIcon();
return;
}
doUpdateMobileControllers();
@@ -921,6 +1005,7 @@ void doUpdateMobileControllers() {
// Such as on boot, don't need any controllers, because there are no sims,
// but we still need to update the no sim state.
updateNoSims();
+ updateImsIcon();
return;
}
synchronized (mLock) {
@@ -928,6 +1013,7 @@ void doUpdateMobileControllers() {
}
updateNoSims();
recalculateEmergency();
+ updateImsIcon();
}
@VisibleForTesting
@@ -953,6 +1039,14 @@ private boolean hasAnySim() {
return false;
}
+ private boolean isSwap(final @Nullable List list) {
+ if (list != null && list.size() == 2) {
+ if (list.get(0).getSubscriptionId() > list.get(1).getSubscriptionId())
+ return true;
+ }
+ return false;
+ }
+
@GuardedBy("mLock")
@VisibleForTesting
void setCurrentSubscriptionsLocked(List subscriptions) {
@@ -964,6 +1058,7 @@ public int compare(SubscriptionInfo lhs, SubscriptionInfo rhs) {
: lhs.getSimSlotIndex() - rhs.getSimSlotIndex();
}
});
+ mSwap = isSwap(subscriptions);
Log.i(
TAG,
String.format(
@@ -1093,6 +1188,7 @@ private void notifyAllListeners() {
}
mWifiSignalController.notifyListeners();
mEthernetSignalController.notifyListeners();
+ updateImsIcon();
}
/**
@@ -1166,6 +1262,7 @@ private void updateConnectivity() {
&& !mConnectedTransports.get(NetworkCapabilities.TRANSPORT_ETHERNET);
mCallbackHandler.setConnectivityStatus(mNoDefaultNetwork, !mInetCondition,
mNoNetworksAvailable);
+ updateImsIcon();
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/SignalCallback.kt b/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/SignalCallback.kt
index 779efba023405..aa35cb4538f18 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/SignalCallback.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/SignalCallback.kt
@@ -91,6 +91,9 @@ interface SignalCallback {
@JvmDefault
fun setMobileDataEnabled(enabled: Boolean) {}
+ @JvmDefault
+ fun setImsIcon(icon: ImsIconState) {}
+
/**
* Callback for listeners to be able to update the connectivity status
* @param noDefaultNetwork whether there is any default network.
@@ -151,8 +154,7 @@ data class MobileDataIndicators(
@JvmField val qsDescription: CharSequence?,
@JvmField val subId: Int,
@JvmField val roaming: Boolean,
- @JvmField val showTriangle: Boolean,
- @JvmField val volteId: Int
+ @JvmField val showTriangle: Boolean
) {
override fun toString(): String {
return java.lang.StringBuilder("MobileDataIndicators[")
@@ -168,7 +170,6 @@ data class MobileDataIndicators(
.append(",subId=").append(subId)
.append(",roaming=").append(roaming)
.append(",showTriangle=").append(showTriangle)
- .append(",volteId=").append(volteId)
.append(']').toString()
}
}
@@ -187,3 +188,37 @@ data class IconState(
.toString()
}
}
+
+data class ImsIconState(
+ @JvmField var visible: Boolean,
+ @JvmField val volteVisible: Boolean,
+ @JvmField val vowifiVisible: Boolean,
+ @JvmField val volteIcon: Int,
+ @JvmField val vowifiIcon: Int,
+ @JvmField val contentDescription: String
+) {
+ constructor(
+ volteVisible: Boolean,
+ vowifiVisible: Boolean,
+ volteIcon: Int,
+ vowifiIcon: Int,
+ contentDescription: String
+ ): this(
+ volteVisible || vowifiVisible,
+ volteVisible,
+ vowifiVisible,
+ volteIcon,
+ vowifiIcon,
+ contentDescription) {}
+
+ override fun toString(): String {
+ return java.lang.StringBuilder("ImsIconState[")
+ .append("visible=").append(visible)
+ .append(",volteVisible=").append(volteVisible)
+ .append(",vowifiVisible=").append(vowifiVisible)
+ .append(",volteIcon=").append(volteIcon)
+ .append(",vowifiIcon=").append(vowifiIcon)
+ .append(",contentDescription=").append(contentDescription)
+ .append(']').toString()
+ }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/WifiSignalController.java b/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/WifiSignalController.java
index 597a0c9e38355..87cdb17245f5a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/WifiSignalController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/WifiSignalController.java
@@ -150,7 +150,7 @@ private void notifyListenersForCarrierWifi(SignalCallback callback) {
statusIcon, qsIcon, typeIcon, qsTypeIcon,
mCurrentState.activityIn, mCurrentState.activityOut, dataContentDescription,
dataContentDescriptionHtml, description,
- mCurrentState.subId, /* roaming= */ false, /* showTriangle= */ true, 0
+ mCurrentState.subId, /* roaming= */ false, /* showTriangle= */ true
);
callback.setMobileDataIndicators(mobileDataIndicators);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DemoStatusIcons.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DemoStatusIcons.java
index 38f21008d2aa7..b14b9ce77ab12 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DemoStatusIcons.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DemoStatusIcons.java
@@ -16,6 +16,8 @@
package com.android.systemui.statusbar.phone;
+import android.content.Context;
+import android.content.res.Configuration;
import android.graphics.Rect;
import android.graphics.drawable.Icon;
import android.os.Bundle;
@@ -29,14 +31,13 @@
import com.android.internal.statusbar.StatusBarIcon;
import com.android.systemui.R;
import com.android.systemui.demomode.DemoMode;
-import com.android.systemui.flags.FeatureFlags;
-import com.android.systemui.flags.Flags;
import com.android.systemui.plugins.DarkIconDispatcher;
import com.android.systemui.plugins.DarkIconDispatcher.DarkReceiver;
import com.android.systemui.statusbar.StatusBarIconView;
import com.android.systemui.statusbar.StatusBarMobileView;
import com.android.systemui.statusbar.StatusBarWifiView;
import com.android.systemui.statusbar.StatusIconDisplayable;
+import com.android.systemui.statusbar.connectivity.ui.MobileContextProvider;
import com.android.systemui.statusbar.phone.StatusBarSignalPolicy.MobileIconState;
import com.android.systemui.statusbar.phone.StatusBarSignalPolicy.WifiIconState;
@@ -50,7 +51,6 @@ public class DemoStatusIcons extends StatusIconContainer implements DemoMode, Da
private final LinearLayout mStatusIcons;
private final ArrayList mMobileViews = new ArrayList<>();
private final int mIconSize;
- private final FeatureFlags mFeatureFlags;
private StatusBarWifiView mWifiView;
private boolean mDemoMode;
@@ -58,14 +58,12 @@ public class DemoStatusIcons extends StatusIconContainer implements DemoMode, Da
public DemoStatusIcons(
LinearLayout statusIcons,
- int iconSize,
- FeatureFlags featureFlags
+ int iconSize
) {
super(statusIcons.getContext());
mStatusIcons = statusIcons;
mIconSize = iconSize;
mColor = DarkIconDispatcher.DEFAULT_ICON_TINT;
- mFeatureFlags = featureFlags;
if (statusIcons instanceof StatusIconContainer) {
setShouldRestrictIcons(((StatusIconContainer) statusIcons).isRestrictingIcons());
@@ -248,10 +246,13 @@ public void updateWifiState(WifiIconState state) {
}
}
- public void addMobileView(MobileIconState state) {
+ /**
+ * Add a new mobile icon view
+ */
+ public void addMobileView(MobileIconState state, Context mobileContext) {
Log.d(TAG, "addMobileView: ");
StatusBarMobileView view = StatusBarMobileView
- .fromContext(mContext, state.slot, mFeatureFlags.isEnabled(Flags.COMBINED_STATUS_BAR_SIGNAL_ICONS));
+ .fromContext(mobileContext, state.slot);
view.applyMobileState(state);
view.setStaticDrawableColor(mColor);
@@ -261,19 +262,24 @@ public void addMobileView(MobileIconState state) {
addView(view, getChildCount(), createLayoutParams());
}
- public void updateMobileState(MobileIconState state) {
- Log.d(TAG, "updateMobileState: ");
- // If the view for this subId exists already, use it
+ /**
+ * Apply an update to a mobile icon view for the given {@link MobileIconState}. For
+ * compatibility with {@link MobileContextProvider}, we have to recreate the view every time we
+ * update it, since the context (and thus the {@link Configuration}) may have changed
+ */
+ public void updateMobileState(MobileIconState state, Context mobileContext) {
+ Log.d(TAG, "updateMobileState: " + state);
+
+ // The mobile config provided by MobileContextProvider could have changed; always recreate
for (int i = 0; i < mMobileViews.size(); i++) {
StatusBarMobileView view = mMobileViews.get(i);
if (view.getState().subId == state.subId) {
- view.applyMobileState(state);
- return;
+ removeView(view);
}
}
- // Else we have to add it
- addMobileView(state);
+ // Add the replacement or new icon
+ addMobileView(state, mobileContext);
}
public void onRemoveIcon(StatusIconDisplayable view) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconController.java
index df18112f409dd..90ddf6ac58bbc 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconController.java
@@ -16,6 +16,7 @@
import static com.android.systemui.statusbar.phone.StatusBarIconHolder.TYPE_BLUETOOTH;
import static com.android.systemui.statusbar.phone.StatusBarIconHolder.TYPE_ICON;
+import static com.android.systemui.statusbar.phone.StatusBarIconHolder.TYPE_IMS;
import static com.android.systemui.statusbar.phone.StatusBarIconHolder.TYPE_MOBILE;
import static com.android.systemui.statusbar.phone.StatusBarIconHolder.TYPE_NETWORK_TRAFFIC;
import static com.android.systemui.statusbar.phone.StatusBarIconHolder.TYPE_WIFI;
@@ -33,7 +34,6 @@
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
-import com.android.systemui.Dependency;
import androidx.annotation.VisibleForTesting;
@@ -41,16 +41,17 @@
import com.android.systemui.R;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.demomode.DemoModeCommandReceiver;
-import com.android.systemui.flags.FeatureFlags;
-import com.android.systemui.flags.Flags;
import com.android.systemui.plugins.DarkIconDispatcher;
import com.android.systemui.plugins.DarkIconDispatcher.DarkReceiver;
import com.android.systemui.statusbar.BaseStatusBarWifiView;
import com.android.systemui.statusbar.StatusBarBluetoothView;
import com.android.systemui.statusbar.StatusBarIconView;
+import com.android.systemui.statusbar.StatusBarImsView;
import com.android.systemui.statusbar.StatusBarMobileView;
import com.android.systemui.statusbar.StatusBarWifiView;
import com.android.systemui.statusbar.StatusIconDisplayable;
+import com.android.systemui.statusbar.connectivity.ImsIconState;
+import com.android.systemui.statusbar.connectivity.ui.MobileContextProvider;
import com.android.systemui.statusbar.phone.PhoneStatusBarPolicy.BluetoothIconState;
import com.android.systemui.statusbar.phone.StatusBarSignalPolicy.CallIndicatorIconState;
import com.android.systemui.statusbar.phone.StatusBarSignalPolicy.MobileIconState;
@@ -61,8 +62,6 @@
import com.android.systemui.statusbar.policy.NetworkTrafficSB;
import com.android.systemui.util.Assert;
-import com.android.systemui.tuner.TunerService.Tunable;
-import com.android.systemui.tuner.TunerService;
import java.util.ArrayList;
import java.util.List;
@@ -80,6 +79,7 @@ public interface StatusBarIconController {
void addIconGroup(IconManager iconManager);
/** */
void removeIconGroup(IconManager iconManager);
+
/** Refresh the state of an IconManager by recreating the views */
void refreshIconGroup(IconManager iconManager);
/** */
@@ -94,10 +94,12 @@ public interface StatusBarIconController {
void setBluetoothIcon(String slot, BluetoothIconState state);
/** */
void setMobileIcons(String slot, List states);
+
/**
* Display the no calling & SMS icons.
*/
void setCallStrengthIcons(String slot, List states);
+
/**
* Display the no calling & SMS icons.
*/
@@ -105,11 +107,14 @@ public interface StatusBarIconController {
public void setIconVisibility(String slot, boolean b);
+ public void setImsIcon(String slot, ImsIconState state);
+
/**
* Sets the live region mode for the icon
- * @see android.view.View#setAccessibilityLiveRegion(int)
- * @param slot Icon slot to set region for
+ *
+ * @param slot Icon slot to set region for
* @param accessibilityLiveRegion live region mode for the icon
+ * @see android.view.View#setAccessibilityLiveRegion(int)
*/
void setIconAccessibilityLiveRegion(String slot, int accessibilityLiveRegion);
@@ -128,8 +133,8 @@ public interface StatusBarIconController {
static ArraySet getIconHideList(Context context, String hideListStr) {
ArraySet ret = new ArraySet<>();
String[] hideList = hideListStr == null
- ? context.getResources().getStringArray(R.array.config_statusBarIconsToExclude)
- : hideListStr.split(",");
+ ? context.getResources().getStringArray(R.array.config_statusBarIconsToExclude)
+ : hideListStr.split(",");
for (String slot : hideList) {
if (!TextUtils.isEmpty(slot)) {
ret.add(slot);
@@ -147,16 +152,16 @@ class DarkIconManager extends IconManager {
public DarkIconManager(
LinearLayout linearLayout,
- FeatureFlags featureFlags,
StatusBarLocation location,
StatusBarPipelineFlags statusBarPipelineFlags,
WifiViewModel wifiViewModel,
+ MobileContextProvider mobileContextProvider,
DarkIconDispatcher darkIconDispatcher) {
super(linearLayout,
- featureFlags,
location,
statusBarPipelineFlags,
- wifiViewModel);
+ wifiViewModel,
+ mobileContextProvider);
mIconHPadding = mContext.getResources().getDimensionPixelSize(
R.dimen.status_bar_icon_padding);
mDarkIconDispatcher = darkIconDispatcher;
@@ -215,50 +220,52 @@ protected void exitDemoMode() {
@SysUISingleton
public static class Factory {
- private final FeatureFlags mFeatureFlags;
private final StatusBarPipelineFlags mStatusBarPipelineFlags;
private final WifiViewModel mWifiViewModel;
+ private final MobileContextProvider mMobileContextProvider;
private final DarkIconDispatcher mDarkIconDispatcher;
@Inject
public Factory(
- FeatureFlags featureFlags,
StatusBarPipelineFlags statusBarPipelineFlags,
WifiViewModel wifiViewModel,
+ MobileContextProvider mobileContextProvider,
DarkIconDispatcher darkIconDispatcher) {
- mFeatureFlags = featureFlags;
mStatusBarPipelineFlags = statusBarPipelineFlags;
mWifiViewModel = wifiViewModel;
+ mMobileContextProvider = mobileContextProvider;
mDarkIconDispatcher = darkIconDispatcher;
}
public DarkIconManager create(LinearLayout group, StatusBarLocation location) {
return new DarkIconManager(
group,
- mFeatureFlags,
location,
mStatusBarPipelineFlags,
mWifiViewModel,
+ mMobileContextProvider,
mDarkIconDispatcher);
}
}
}
- /** */
+ /**
+ *
+ */
class TintedIconManager extends IconManager {
private int mColor;
public TintedIconManager(
ViewGroup group,
- FeatureFlags featureFlags,
StatusBarLocation location,
StatusBarPipelineFlags statusBarPipelineFlags,
- WifiViewModel wifiViewModel) {
+ WifiViewModel wifiViewModel,
+ MobileContextProvider mobileContextProvider) {
super(group,
- featureFlags,
location,
statusBarPipelineFlags,
- wifiViewModel);
+ wifiViewModel,
+ mobileContextProvider);
}
@Override
@@ -290,27 +297,27 @@ protected DemoStatusIcons createDemoStatusIcons() {
@SysUISingleton
public static class Factory {
- private final FeatureFlags mFeatureFlags;
private final StatusBarPipelineFlags mStatusBarPipelineFlags;
private final WifiViewModel mWifiViewModel;
+ private final MobileContextProvider mMobileContextProvider;
@Inject
public Factory(
- FeatureFlags featureFlags,
StatusBarPipelineFlags statusBarPipelineFlags,
- WifiViewModel wifiViewModel) {
- mFeatureFlags = featureFlags;
+ WifiViewModel wifiViewModel,
+ MobileContextProvider mobileContextProvider) {
mStatusBarPipelineFlags = statusBarPipelineFlags;
mWifiViewModel = wifiViewModel;
+ mMobileContextProvider = mobileContextProvider;
}
public TintedIconManager create(ViewGroup group, StatusBarLocation location) {
return new TintedIconManager(
group,
- mFeatureFlags,
location,
mStatusBarPipelineFlags,
- mWifiViewModel);
+ mWifiViewModel,
+ mMobileContextProvider);
}
}
}
@@ -318,12 +325,12 @@ public TintedIconManager create(ViewGroup group, StatusBarLocation location) {
/**
* Turns info from StatusBarIconController into ImageViews in a ViewGroup.
*/
- class IconManager implements DemoModeCommandReceiver, TunerService.Tunable {
+ class IconManager implements DemoModeCommandReceiver {
protected final ViewGroup mGroup;
private final StatusBarLocation mLocation;
private final StatusBarPipelineFlags mStatusBarPipelineFlags;
private final WifiViewModel mWifiViewModel;
- private final FeatureFlags mFeatureFlags;
+ private final MobileContextProvider mMobileContextProvider;
protected final Context mContext;
protected final int mIconSize;
// Whether or not these icons show up in dumpsys
@@ -336,25 +343,23 @@ class IconManager implements DemoModeCommandReceiver, TunerService.Tunable {
protected DemoStatusIcons mDemoStatusIcons;
protected ArrayList mBlockList = new ArrayList<>();
- private final boolean mNewIconStyle;
- private final boolean mShowNotificationCount;
- private boolean mOldStyleType;
+ private boolean mIsOldSignalStyle = false;
- private static final String USE_OLD_MOBILETYPE =
- "system:" + Settings.System.USE_OLD_MOBILETYPE;
+ private final boolean mNewIconStyle;
+ private final boolean mShowNotificationCount;
public IconManager(
ViewGroup group,
- FeatureFlags featureFlags,
StatusBarLocation location,
StatusBarPipelineFlags statusBarPipelineFlags,
- WifiViewModel wifiViewModel) {
+ WifiViewModel wifiViewModel,
+ MobileContextProvider mobileContextProvider) {
mGroup = group;
- mFeatureFlags = featureFlags;
mLocation = location;
mStatusBarPipelineFlags = statusBarPipelineFlags;
mWifiViewModel = wifiViewModel;
+ mMobileContextProvider = mobileContextProvider;
mContext = group.getContext();
mIconSize = mContext.getResources().getDimensionPixelSize(
com.android.internal.R.dimen.status_bar_icon_size);
@@ -422,6 +427,9 @@ protected StatusIconDisplayable addHolder(int index, String slot, boolean blocke
case TYPE_BLUETOOTH:
return addBluetoothIcon(index, slot, holder.getBluetoothState());
+
+ case TYPE_IMS:
+ return addImsIcon(index, slot, holder.getImsState());
}
return null;
@@ -466,13 +474,16 @@ protected NetworkTrafficSB addNetworkTraffic(int index, String slot) {
@VisibleForTesting
protected StatusBarMobileView addMobileIcon(int index, String slot, MobileIconState state) {
- StatusBarMobileView view = onCreateStatusBarMobileView(slot);
+ // Use the `subId` field as a key to query for the correct context
+ StatusBarMobileView view = onCreateStatusBarMobileView(state.subId, slot);
view.applyMobileState(state);
mGroup.addView(view, index, onCreateLayoutParams());
- Dependency.get(TunerService.class).addTunable(this, USE_OLD_MOBILETYPE);
+ view.updateDisplayType(mIsOldSignalStyle);
if (mIsInDemoMode) {
- mDemoStatusIcons.addMobileView(state);
+ Context mobileContext = mMobileContextProvider
+ .getMobileContextForSub(state.subId, mContext);
+ mDemoStatusIcons.addMobileView(state, mobileContext);
}
return view;
}
@@ -485,6 +496,13 @@ protected StatusBarBluetoothView addBluetoothIcon(
return view;
}
+ protected StatusBarImsView addImsIcon(int index, String slot, ImsIconState state) {
+ StatusBarImsView view = onCreateStatusBarImsView(slot);
+ view.applyImsState(state);
+ mGroup.addView(view, index, onCreateLayoutParams());
+ return view;
+ }
+
private StatusBarIconView onCreateStatusBarIconView(String slot, boolean blocked) {
return new StatusBarIconView(mContext, slot, null, blocked);
}
@@ -499,9 +517,10 @@ private ModernStatusBarWifiView onCreateModernStatusBarWifiView(String slot) {
mContext, slot, mWifiViewModel, mLocation);
}
- private StatusBarMobileView onCreateStatusBarMobileView(String slot) {
+ private StatusBarMobileView onCreateStatusBarMobileView(int subId, String slot) {
+ Context mobileContext = mMobileContextProvider.getMobileContextForSub(subId, mContext);
StatusBarMobileView view = StatusBarMobileView
- .fromContext(mContext, slot, mFeatureFlags.isEnabled(Flags.COMBINED_STATUS_BAR_SIGNAL_ICONS));
+ .fromContext(mobileContext, slot);
return view;
}
@@ -516,13 +535,17 @@ private StatusBarBluetoothView onCreateStatusBarBluetoothView(String slot) {
return view;
}
+ private StatusBarImsView onCreateStatusBarImsView(String slot) {
+ StatusBarImsView view = StatusBarImsView.fromContext(mContext, slot);
+ return view;
+ }
+
protected LinearLayout.LayoutParams onCreateLayoutParams() {
return new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, mIconSize);
}
protected void destroy() {
mGroup.removeAllViews();
- Dependency.get(TunerService.class).removeTunable(this);
}
protected void onIconExternal(int viewIndex, int height) {
@@ -581,6 +604,9 @@ public void onSetIconHolder(int viewIndex, StatusBarIconHolder holder) {
case TYPE_BLUETOOTH:
onSetBluetoothIcon(viewIndex, holder.getBluetoothState());
return;
+ case TYPE_IMS:
+ onSetImsIcon(viewIndex, holder.getImsState());
+ return;
default:
break;
}
@@ -610,7 +636,9 @@ public void onSetMobileIcon(int viewIndex, MobileIconState state) {
}
if (mIsInDemoMode) {
- mDemoStatusIcons.updateMobileState(state);
+ Context mobileContext = mMobileContextProvider
+ .getMobileContextForSub(state.subId, mContext);
+ mDemoStatusIcons.updateMobileState(state, mobileContext);
}
}
@@ -621,6 +649,13 @@ public void onSetBluetoothIcon(int viewIndex, BluetoothIconState state) {
}
}
+ public void onSetImsIcon(int viewIndex, ImsIconState state) {
+ StatusBarImsView view = (StatusBarImsView) mGroup.getChildAt(viewIndex);
+ if (view != null) {
+ view.applyImsState(state);
+ }
+ }
+
@Override
public void dispatchDemoCommand(String command, Bundle args) {
if (!mDemoable) {
@@ -654,27 +689,18 @@ protected void exitDemoMode() {
}
protected DemoStatusIcons createDemoStatusIcons() {
- return new DemoStatusIcons((LinearLayout) mGroup, mIconSize, mFeatureFlags);
+ return new DemoStatusIcons((LinearLayout) mGroup, mIconSize);
}
- @Override
- public void onTuningChanged(String key, String newValue) {
- switch (key) {
- case USE_OLD_MOBILETYPE:
- mOldStyleType =
- TunerService.parseIntegerSwitch(newValue, false);
- updateOldStyleMobileDataIcons();
- break;
- default:
- break;
- }
+ protected void setMobileSignalStyle(boolean isOldSignalStyle) {
+ mIsOldSignalStyle = isOldSignalStyle;
}
- private void updateOldStyleMobileDataIcons() {
+ protected void updateMobileIconStyle() {
for (int i = 0; i < mGroup.getChildCount(); i++) {
- View child = mGroup.getChildAt(i);
+ final View child = mGroup.getChildAt(i);
if (child instanceof StatusBarMobileView) {
- ((StatusBarMobileView) child).updateDisplayType(mOldStyleType);
+ ((StatusBarMobileView) child).updateDisplayType(mIsOldSignalStyle);
}
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconControllerImpl.java
index fc1bdb0db191f..89c24e273fb43 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconControllerImpl.java
@@ -20,9 +20,12 @@
import android.annotation.NonNull;
import android.content.Context;
+import android.database.ContentObserver;
import android.graphics.drawable.Icon;
import android.os.Bundle;
+import android.os.Handler;
import android.os.UserHandle;
+import android.provider.Settings;
import android.util.ArrayMap;
import android.util.ArraySet;
import android.util.Log;
@@ -31,12 +34,14 @@
import com.android.internal.statusbar.StatusBarIcon;
import com.android.systemui.Dumpable;
import com.android.systemui.R;
+import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.demomode.DemoMode;
import com.android.systemui.demomode.DemoModeController;
import com.android.systemui.dump.DumpManager;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.StatusIconDisplayable;
+import com.android.systemui.statusbar.connectivity.ImsIconState;
import com.android.systemui.statusbar.phone.PhoneStatusBarPolicy.BluetoothIconState;
import com.android.systemui.statusbar.phone.StatusBarSignalPolicy.CallIndicatorIconState;
import com.android.systemui.statusbar.phone.StatusBarSignalPolicy.MobileIconState;
@@ -45,6 +50,7 @@
import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener;
import com.android.systemui.tuner.TunerService;
import com.android.systemui.tuner.TunerService.Tunable;
+import com.android.systemui.util.settings.SystemSettings;
import java.io.PrintWriter;
import java.util.ArrayList;
@@ -68,7 +74,10 @@ public class StatusBarIconControllerImpl implements Tunable,
private final ArrayList mIconGroups = new ArrayList<>();
private final ArraySet mIconHideList = new ArraySet<>();
- private Context mContext;
+ private final Context mContext;
+ private final SystemSettings mSystemSettings;
+
+ private boolean mIsOldSignalStyle = false;
/** */
@Inject
@@ -79,28 +88,57 @@ public StatusBarIconControllerImpl(
ConfigurationController configurationController,
TunerService tunerService,
DumpManager dumpManager,
+ @Main Handler handler,
+ SystemSettings systemSettings,
StatusBarIconList statusBarIconList) {
mStatusBarIconList = statusBarIconList;
mContext = context;
+ mSystemSettings = systemSettings;
configurationController.addCallback(this);
commandQueue.addCallback(this);
tunerService.addTunable(this, ICON_HIDE_LIST);
demoModeController.addCallback(this);
dumpManager.registerDumpable(getClass().getSimpleName(), this);
+
+ mIsOldSignalStyle = getIsOldSignalStyle();
+ final ContentObserver settingsObserver = new ContentObserver(handler) {
+ @Override
+ public void onChange(boolean selfChange) {
+ final boolean isOldSignalStyle = getIsOldSignalStyle();
+ if (mIsOldSignalStyle == isOldSignalStyle) return;
+ mIsOldSignalStyle = isOldSignalStyle;
+ mIconGroups.forEach(group -> {
+ group.setMobileSignalStyle(mIsOldSignalStyle);
+ group.updateMobileIconStyle();
+ });
+ }
+ };
+ mSystemSettings.registerContentObserverForUser(
+ Settings.System.USE_OLD_MOBILETYPE,
+ settingsObserver,
+ UserHandle.USER_ALL
+ );
+ }
+
+ private boolean getIsOldSignalStyle() {
+ return mSystemSettings.getIntForUser(
+ Settings.System.USE_OLD_MOBILETYPE,
+ 0, UserHandle.USER_CURRENT
+ ) == 1;
}
/** */
@Override
public void addIconGroup(IconManager group) {
- for (IconManager existingIconManager : mIconGroups) {
- if (existingIconManager.mGroup == group.mGroup) {
- // Remove existing icon group
- removeIconGroup(existingIconManager);
- }
- }
+ // Remove existing icon group if present
+ mIconGroups.stream()
+ .filter(i -> i.mGroup == group.mGroup)
+ .findFirst()
+ .ifPresent(i -> removeIconGroup(i));
group.setController(this);
+ group.setMobileSignalStyle(mIsOldSignalStyle);
mIconGroups.add(group);
List allSlots = mStatusBarIconList.getSlots();
for (int i = 0; i < allSlots.size(); i++) {
@@ -315,6 +353,23 @@ public void setExternalIcon(String slot) {
mIconGroups.forEach(l -> l.onIconExternal(viewIndex, height));
}
+ @Override
+ public void setImsIcon(String slot, ImsIconState state) {
+ if (state == null) {
+ removeIcon(slot, 0);
+ return;
+ }
+
+ StatusBarIconHolder holder = mStatusBarIconList.getIconHolder(slot, 0);
+ if (holder == null) {
+ holder = StatusBarIconHolder.fromImsIconState(state);
+ setIcon(slot, holder);
+ } else {
+ holder.setImsState(state);
+ handleSet(slot, holder);
+ }
+ }
+
//TODO: remove this (used in command queue and for 3rd party tiles?)
public void setIcon(String slot, StatusBarIcon icon) {
if (icon == null) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconHolder.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconHolder.java
index 2aa97e023c79c..e668316dd81fc 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconHolder.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconHolder.java
@@ -22,6 +22,7 @@
import android.os.UserHandle;
import com.android.internal.statusbar.StatusBarIcon;
+import com.android.systemui.statusbar.connectivity.ImsIconState;
import com.android.systemui.statusbar.phone.PhoneStatusBarPolicy.BluetoothIconState;
import com.android.systemui.statusbar.phone.StatusBarSignalPolicy.CallIndicatorIconState;
import com.android.systemui.statusbar.phone.StatusBarSignalPolicy.MobileIconState;
@@ -35,12 +36,14 @@ public class StatusBarIconHolder {
public static final int TYPE_WIFI = 1;
public static final int TYPE_MOBILE = 2;
public static final int TYPE_BLUETOOTH = 3;
+ public static final int TYPE_IMS = 4;
public static final int TYPE_NETWORK_TRAFFIC = 42;
private StatusBarIcon mIcon;
private WifiIconState mWifiState;
private MobileIconState mMobileState;
private BluetoothIconState mBluetoothState;
+ private ImsIconState mImsState;
private int mType = TYPE_ICON;
private int mTag = 0;
@@ -67,6 +70,13 @@ public static StatusBarIconHolder fromResId(
return holder;
}
+ public static StatusBarIconHolder fromImsIconState(ImsIconState state) {
+ StatusBarIconHolder holder = new StatusBarIconHolder();
+ holder.mImsState = state;
+ holder.mType = TYPE_IMS;
+ return holder;
+ }
+
/** */
public static StatusBarIconHolder fromWifiIconState(WifiIconState state) {
StatusBarIconHolder holder = new StatusBarIconHolder();
@@ -154,6 +164,14 @@ public void setBluetoothState(BluetoothIconState state) {
mBluetoothState = state;
}
+ public ImsIconState getImsState() {
+ return mImsState;
+ }
+
+ public void setImsState(ImsIconState state) {
+ mImsState = state;
+ }
+
public boolean isVisible() {
switch (mType) {
case TYPE_ICON:
@@ -164,6 +182,8 @@ public boolean isVisible() {
return mMobileState.visible;
case TYPE_BLUETOOTH:
return mBluetoothState.visible;
+ case TYPE_IMS:
+ return mImsState.visible;
case TYPE_NETWORK_TRAFFIC:
return true;
@@ -192,6 +212,10 @@ public void setVisible(boolean visible) {
case TYPE_BLUETOOTH:
mBluetoothState.visible = visible;
break;
+
+ case TYPE_IMS:
+ mImsState.visible = visible;
+ break;
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarSignalPolicy.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarSignalPolicy.java
index 33538d91eabde..940fa568379c0 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarSignalPolicy.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarSignalPolicy.java
@@ -29,6 +29,7 @@
import com.android.systemui.flags.FeatureFlags;
import com.android.systemui.flags.Flags;
import com.android.systemui.statusbar.connectivity.IconState;
+import com.android.systemui.statusbar.connectivity.ImsIconState;
import com.android.systemui.statusbar.connectivity.MobileDataIndicators;
import com.android.systemui.statusbar.connectivity.NetworkController;
import com.android.systemui.statusbar.connectivity.SignalCallback;
@@ -58,6 +59,7 @@ public class StatusBarSignalPolicy implements SignalCallback,
private final String mSlotVpn;
private final String mSlotNoCalling;
private final String mSlotCallStrength;
+ private final String mSlotIms;
private final Context mContext;
private final StatusBarIconController mIconController;
@@ -74,6 +76,7 @@ public class StatusBarSignalPolicy implements SignalCallback,
private boolean mHideEthernet;
private boolean mActivityEnabled;
private boolean mHideVpn;
+ private boolean mHideIms;
// Track as little state as possible, and only for padding purposes
private boolean mIsAirplaneMode = false;
@@ -112,6 +115,7 @@ public StatusBarSignalPolicy(
mSlotCallStrength =
mContext.getString(com.android.internal.R.string.status_bar_call_strength);
mActivityEnabled = mContext.getResources().getBoolean(R.bool.config_showActivity);
+ mSlotIms = mContext.getString(com.android.internal.R.string.status_bar_ims);
}
/** Call to initilaize and register this classw with the system. */
@@ -167,17 +171,17 @@ public void onTuningChanged(String key, String newValue) {
boolean hideWifi = hideList.contains(mSlotWifi);
boolean hideEthernet = hideList.contains(mSlotEthernet);
boolean hideVpn = hideList.contains(mSlotVpn);
+ boolean hideIms = hideList.contains(mSlotIms);
- if (hideVpn != mHideVpn) {
- mHideVpn = hideVpn;
- mHandler.post(this::updateVpn);
- }
if (hideAirplane != mHideAirplane || hideMobile != mHideMobile
- || hideEthernet != mHideEthernet || hideWifi != mHideWifi) {
+ || hideEthernet != mHideEthernet || hideWifi != mHideWifi
+ || hideVpn != mHideVpn || hideIms != mHideIms) {
mHideAirplane = hideAirplane;
mHideMobile = hideMobile;
mHideEthernet = hideEthernet;
mHideWifi = hideWifi;
+ mHideVpn = hideVpn;
+ mHideIms = hideIms;
// Re-register to get new callbacks.
mNetworkController.removeCallback(this);
mNetworkController.addCallback(this);
@@ -285,7 +289,9 @@ public void setMobileDataIndicators(@NonNull MobileDataIndicators indicators) {
state.roaming = indicators.roaming;
state.activityIn = indicators.activityIn && mActivityEnabled;
state.activityOut = indicators.activityOut && mActivityEnabled;
- state.volteId = indicators.volteId;
+ state.typeSpacerVisible = mMobileStates.size() > 1
+ && mMobileStates.get(1).subId == state.subId
+ && state.typeId != 0;
if (DEBUG) {
Log.d(TAG, "MobileIconStates: "
@@ -459,6 +465,16 @@ public void setMobileDataEnabled(boolean enabled) {
// Don't care.
}
+ @Override
+ public void setImsIcon(ImsIconState icon) {
+ if (icon.visible && !mHideIms) {
+ mIconController.setImsIcon(mSlotIms, icon);
+ mIconController.setIconVisibility(mSlotIms, true);
+ } else {
+ mIconController.setIconVisibility(mSlotIms, false);
+ }
+ }
+
/**
* Stores the statusbar state for no Calling & SMS.
*/
@@ -619,7 +635,7 @@ public static class MobileIconState extends SignalIconState {
public boolean roaming;
public boolean needsLeadingPadding;
public CharSequence typeContentDescription;
- public int volteId;
+ public boolean typeSpacerVisible;
private MobileIconState(int subId) {
super();
@@ -641,8 +657,8 @@ public boolean equals(Object o) {
&& showTriangle == that.showTriangle
&& roaming == that.roaming
&& needsLeadingPadding == that.needsLeadingPadding
- && volteId == that.volteId
- && Objects.equals(typeContentDescription, that.typeContentDescription);
+ && Objects.equals(typeContentDescription, that.typeContentDescription)
+ && typeSpacerVisible == that.typeSpacerVisible;
}
@Override
@@ -668,7 +684,7 @@ public void copyTo(MobileIconState other) {
other.roaming = roaming;
other.needsLeadingPadding = needsLeadingPadding;
other.typeContentDescription = typeContentDescription;
- other.volteId = volteId;
+ other.typeSpacerVisible = typeSpacerVisible;
}
private static List copyStates(List inStates) {
@@ -685,7 +701,8 @@ private static List copyStates(List inStates)
@Override public String toString() {
return "MobileIconState(subId=" + subId + ", strengthId=" + strengthId
+ ", showTriangle=" + showTriangle + ", roaming=" + roaming
- + ", typeId=" + typeId + ", visible=" + visible + ", volteId=" + volteId + ")";
+ + ", typeId=" + typeId + ", typeSpacerVisible=" + typeSpacerVisible
+ + ", visible=" + visible + ")";
}
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/theme/ThemeOverlayController.java b/packages/SystemUI/src/com/android/systemui/theme/ThemeOverlayController.java
index 1746aac38b996..ee6df5c193fd0 100644
--- a/packages/SystemUI/src/com/android/systemui/theme/ThemeOverlayController.java
+++ b/packages/SystemUI/src/com/android/systemui/theme/ThemeOverlayController.java
@@ -43,7 +43,6 @@
import android.graphics.Color;
import android.net.Uri;
import android.os.Handler;
-import android.os.RemoteException;
import android.os.UserHandle;
import android.os.UserManager;
import android.provider.Settings;
@@ -59,7 +58,6 @@
import androidx.annotation.VisibleForTesting;
import com.android.internal.graphics.ColorUtils;
-import com.android.internal.statusbar.IStatusBarService;
import com.android.systemui.CoreStartable;
import com.android.systemui.Dumpable;
import com.android.systemui.broadcast.BroadcastDispatcher;
@@ -122,7 +120,6 @@ public class ThemeOverlayController extends CoreStartable implements Dumpable {
private final UserTracker mUserTracker;
private final DeviceProvisionedController mDeviceProvisionedController;
private final Resources mResources;
- private final IStatusBarService mBarService;
// Current wallpaper colors associated to a user.
private final SparseArray mCurrentColors = new SparseArray<>();
private final WallpaperManager mWallpaperManager;
@@ -361,7 +358,7 @@ public ThemeOverlayController(Context context, BroadcastDispatcher broadcastDisp
SecureSettings secureSettings, WallpaperManager wallpaperManager,
UserManager userManager, DeviceProvisionedController deviceProvisionedController,
UserTracker userTracker, DumpManager dumpManager, FeatureFlags featureFlags,
- @Main Resources resources, WakefulnessLifecycle wakefulnessLifecycle, SystemSettings systemSettings, IStatusBarService barService) {
+ @Main Resources resources, WakefulnessLifecycle wakefulnessLifecycle, SystemSettings systemSettings) {
super(context);
mIsMonetEnabled = featureFlags.isEnabled(Flags.MONET);
@@ -379,7 +376,6 @@ public ThemeOverlayController(Context context, BroadcastDispatcher broadcastDisp
mResources = resources;
mWakefulnessLifecycle = wakefulnessLifecycle;
dumpManager.registerDumpable(TAG, this);
- mBarService = barService;
}
@Override
@@ -428,18 +424,6 @@ public void onChange(boolean selfChange, Collection collection, int flags,
},
UserHandle.USER_ALL);
- mSecureSettings.registerContentObserverForUser(
- Settings.Secure.getUriFor(Settings.Secure.ENABLE_COMBINED_SIGNAL_ICONS),
- false,
- new ContentObserver(mBgHandler) {
- @Override
- public void onChange(boolean selfChange, Collection collection, int flags,
- int userId) {
- restartAndroid();
- }
- },
- UserHandle.USER_ALL);
-
mUserTracker.addCallback(mUserTrackerCallback, mMainExecutor);
mDeviceProvisionedController.addCallback(mDeviceProvisionedListener);
@@ -491,13 +475,6 @@ public void onFinishedGoingToSleep() {
});
}
- private void restartAndroid() {
- try {
- mBarService.restart();
- } catch (RemoteException e) {
- }
- }
-
private void reevaluateSystemTheme(boolean forceReload) {
final WallpaperColors currentColors = mCurrentColors.get(mUserTracker.getUserId());
final int mainColor;
diff --git a/packages/SystemUI/src/com/google/android/systemui/smartspace/KeyguardMediaViewController.java b/packages/SystemUI/src/com/google/android/systemui/smartspace/KeyguardMediaViewController.java
deleted file mode 100644
index 5b2e6aecd049e..0000000000000
--- a/packages/SystemUI/src/com/google/android/systemui/smartspace/KeyguardMediaViewController.java
+++ /dev/null
@@ -1,186 +0,0 @@
-package com.google.android.systemui.smartspace;
-
-import android.app.smartspace.SmartspaceAction;
-import android.app.smartspace.SmartspaceTarget;
-import android.content.ComponentName;
-import android.content.Context;
-import android.media.MediaMetadata;
-import android.os.UserHandle;
-import android.text.TextUtils;
-import android.view.View;
-
-import com.android.systemui.R;
-import com.android.systemui.broadcast.BroadcastDispatcher;
-import com.android.systemui.dagger.SysUISingleton;
-import com.android.systemui.plugins.BcSmartspaceDataPlugin;
-import com.android.systemui.settings.CurrentUserTracker;
-import com.android.systemui.statusbar.NotificationMediaManager;
-import com.android.systemui.util.concurrency.DelayableExecutor;
-
-import javax.inject.Inject;
-
-import kotlin.Unit;
-import kotlin.jvm.internal.Intrinsics;
-
-/* compiled from: KeyguardMediaViewController.kt */
-@SysUISingleton
-public final class KeyguardMediaViewController {
- private CharSequence artist;
- private final BroadcastDispatcher broadcastDispatcher;
- private final Context context;
- private final ComponentName mediaComponent;
- private final NotificationMediaManager.MediaListener mediaListener =
- new NotificationMediaManager.MediaListener() {
- @Override
- public void onPrimaryMetadataOrStateChanged(
- final MediaMetadata mediaMetadata, final int i) {
- DelayableExecutor uiExecutor = getUiExecutor();
- final KeyguardMediaViewController keyguardMediaViewController =
- KeyguardMediaViewController.this;
- uiExecutor.execute(
- new Runnable() {
- @Override
- public final void run() {
- updateMediaInfo(mediaMetadata, i);
- }
- });
- }
- };
- private final NotificationMediaManager mediaManager;
- private final BcSmartspaceDataPlugin plugin;
- private BcSmartspaceDataPlugin.SmartspaceView smartspaceView;
- private CharSequence title;
- private final DelayableExecutor uiExecutor;
- private CurrentUserTracker userTracker;
-
- @Inject
- public KeyguardMediaViewController(
- Context context,
- BcSmartspaceDataPlugin plugin,
- DelayableExecutor uiExecutor,
- NotificationMediaManager mediaManager,
- BroadcastDispatcher broadcastDispatcher) {
- Intrinsics.checkNotNullParameter(context, "context");
- Intrinsics.checkNotNullParameter(plugin, "plugin");
- Intrinsics.checkNotNullParameter(uiExecutor, "uiExecutor");
- Intrinsics.checkNotNullParameter(mediaManager, "mediaManager");
- Intrinsics.checkNotNullParameter(broadcastDispatcher, "broadcastDispatcher");
- this.context = context;
- this.plugin = plugin;
- this.uiExecutor = uiExecutor;
- this.mediaManager = mediaManager;
- this.broadcastDispatcher = broadcastDispatcher;
- mediaComponent = new ComponentName(context, KeyguardMediaViewController.class);
- }
-
- public final DelayableExecutor getUiExecutor() {
- return uiExecutor;
- }
-
- public final BcSmartspaceDataPlugin.SmartspaceView getSmartspaceView() {
- return smartspaceView;
- }
-
- public final void setSmartspaceView(BcSmartspaceDataPlugin.SmartspaceView smartspaceView) {
- this.smartspaceView = smartspaceView;
- }
-
- public final void init() {
- plugin.addOnAttachStateChangeListener(
- new View.OnAttachStateChangeListener() {
- @Override
- public void onViewAttachedToWindow(View v) {
- NotificationMediaManager notificationMediaManager;
- NotificationMediaManager.MediaListener keyguardMediaViewController;
- Intrinsics.checkNotNullParameter(v, "v");
- setSmartspaceView((BcSmartspaceDataPlugin.SmartspaceView) v);
- notificationMediaManager = mediaManager;
- keyguardMediaViewController = mediaListener;
- notificationMediaManager.addCallback(keyguardMediaViewController);
- }
-
- @Override
- public void onViewDetachedFromWindow(View v) {
- NotificationMediaManager notificationMediaManager;
- NotificationMediaManager.MediaListener keyguardMediaViewController;
- Intrinsics.checkNotNullParameter(v, "v");
- setSmartspaceView(null);
- notificationMediaManager = mediaManager;
- keyguardMediaViewController = mediaListener;
- notificationMediaManager.removeCallback(keyguardMediaViewController);
- }
- });
- userTracker =
- new CurrentUserTracker(broadcastDispatcher) {
- @Override
- public void onUserSwitched(int i) {
- reset();
- }
- };
- }
-
- public final void updateMediaInfo(MediaMetadata mediaMetadata, int i) {
- CharSequence charSequence;
- if (!NotificationMediaManager.isPlayingState(i)) {
- reset();
- return;
- }
- Unit unit = null;
- if (mediaMetadata == null) {
- charSequence = null;
- } else {
- charSequence = mediaMetadata.getText("android.media.metadata.TITLE");
- if (TextUtils.isEmpty(charSequence)) {
- charSequence = context.getResources().getString(R.string.music_controls_no_title);
- }
- }
- CharSequence text =
- mediaMetadata == null
- ? null
- : mediaMetadata.getText("android.media.metadata.ARTIST");
- if (TextUtils.equals(title, charSequence) && TextUtils.equals(artist, text)) {
- return;
- }
- title = charSequence;
- artist = text;
- if (charSequence != null) {
- SmartspaceAction build =
- new SmartspaceAction.Builder("deviceMediaTitle", charSequence.toString())
- .setSubtitle(artist)
- .setIcon(mediaManager.getMediaIcon())
- .build();
- CurrentUserTracker currentUserTracker = userTracker;
- if (currentUserTracker == null) {
- Intrinsics.throwUninitializedPropertyAccessException("userTracker");
- throw null;
- }
- SmartspaceTarget build2 =
- new SmartspaceTarget.Builder(
- "deviceMedia",
- mediaComponent,
- UserHandle.of(currentUserTracker.getCurrentUserId()))
- .setFeatureType(41)
- .setHeaderAction(build)
- .build();
- BcSmartspaceDataPlugin.SmartspaceView smartspaceView = getSmartspaceView();
- if (smartspaceView != null) {
- smartspaceView.setMediaTarget(build2);
- unit = Unit.INSTANCE;
- }
- }
- if (unit != null) {
- return;
- }
- reset();
- }
-
- public final void reset() {
- title = null;
- artist = null;
- BcSmartspaceDataPlugin.SmartspaceView smartspaceView = getSmartspaceView();
- if (smartspaceView == null) {
- return;
- }
- smartspaceView.setMediaTarget(null);
- }
-}
diff --git a/packages/SystemUI/src/com/google/android/systemui/smartspace/KeyguardSmartspaceController.kt b/packages/SystemUI/src/com/google/android/systemui/smartspace/KeyguardSmartspaceController.kt
deleted file mode 100644
index ffb9a564c5f2d..0000000000000
--- a/packages/SystemUI/src/com/google/android/systemui/smartspace/KeyguardSmartspaceController.kt
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.google.android.systemui.smartspace
-
-import com.android.systemui.dagger.SysUISingleton
-import com.android.systemui.flags.FeatureFlags
-import com.android.systemui.flags.Flags
-
-import com.google.android.systemui.smartspace.KeyguardMediaViewController
-import com.google.android.systemui.smartspace.KeyguardZenAlarmViewController
-
-import javax.inject.Inject
-
-@SysUISingleton
-class KeyguardSmartspaceController @Inject constructor(
- private val featureFlags: FeatureFlags,
- private val zenController: KeyguardZenAlarmViewController,
- private val mediaController: KeyguardMediaViewController,
-) {
- init {
- if (featureFlags.isEnabled(Flags.SMARTSPACE)) {
- mediaController.init()
- zenController.init()
- }
- }
-}
diff --git a/packages/SystemUI/src/com/google/android/systemui/smartspace/KeyguardZenAlarmViewController.kt b/packages/SystemUI/src/com/google/android/systemui/smartspace/KeyguardZenAlarmViewController.kt
deleted file mode 100644
index f18ace7264caa..0000000000000
--- a/packages/SystemUI/src/com/google/android/systemui/smartspace/KeyguardZenAlarmViewController.kt
+++ /dev/null
@@ -1,142 +0,0 @@
-package com.google.android.systemui.smartspace
-
-import android.app.ActivityManager
-import android.app.AlarmManager
-import android.content.Context
-import android.graphics.drawable.Drawable
-import android.graphics.drawable.InsetDrawable
-import android.os.Handler
-import android.text.format.DateFormat
-import android.view.View
-import com.android.internal.annotations.VisibleForTesting
-import com.android.systemui.R
-import com.android.systemui.dagger.SysUISingleton
-import com.android.systemui.plugins.BcSmartspaceDataPlugin
-import com.android.systemui.statusbar.policy.NextAlarmController
-import com.android.systemui.statusbar.policy.ZenModeController
-import java.util.LinkedHashSet
-import java.util.concurrent.TimeUnit
-import javax.inject.Inject
-
-@SysUISingleton
-class KeyguardZenAlarmViewController @Inject constructor(
- val context: Context,
- val plugin: BcSmartspaceDataPlugin,
- val zenModeController: ZenModeController,
- val alarmManager: AlarmManager,
- val nextAlarmController: NextAlarmController,
- val handler: Handler
-) {
- val alarmImage = context.getResources().getDrawable(R.drawable.ic_access_alarms_big, null)
- val smartspaceViews = LinkedHashSet()
- val zenModeCallback = object : ZenModeController.Callback {
- override fun onZenChanged(i: Int) {
- updateDnd()
- }
- }
-
- val nextAlarmCallback = object : NextAlarmController.NextAlarmChangeCallback {
- override fun onNextAlarmChanged(alarmClockInfo: AlarmManager.AlarmClockInfo?) {
- updateNextAlarm()
- }
- }
-
- val dndImage: Drawable = loadDndImage()
-
- fun init() {
- plugin.addOnAttachStateChangeListener(object : View.OnAttachStateChangeListener {
- override fun onViewAttachedToWindow(v: View?) {
- smartspaceViews.add(v as BcSmartspaceDataPlugin.SmartspaceView)
- if (smartspaceViews.size === 1) {
- zenModeController.addCallback(zenModeCallback)
- nextAlarmController.addCallback(nextAlarmCallback)
- }
- refresh()
- }
-
- override fun onViewDetachedFromWindow(v: View?) {
- smartspaceViews.remove(v as BcSmartspaceDataPlugin.SmartspaceView)
- if (smartspaceViews.isEmpty()) {
- zenModeController.removeCallback(zenModeCallback)
- nextAlarmController.removeCallback(nextAlarmCallback)
- }
- }
- })
- updateNextAlarm()
- }
-
- fun refresh() {
- updateDnd()
- updateNextAlarm()
- }
-
- private fun loadDndImage(): Drawable {
- val drawable: Drawable = context.getResources().getDrawable(R.drawable.stat_sys_dnd, null)
- val drawable2: Drawable = (drawable as InsetDrawable).getDrawable()
- return drawable2
- }
-
- fun updateDnd() {
- if (zenModeController.getZen() !== 0) {
- val string: String =
- context.getResources().getString(R.string.accessibility_quick_settings_dnd)
- for (smartspaceView in smartspaceViews) {
- smartspaceView.setDnd(dndImage, string)
- }
- return
- }
- for (smartspaceView in smartspaceViews) {
- smartspaceView.setDnd(null, null)
- }
- }
-
- fun updateNextAlarm() {
- alarmManager.cancel(object : AlarmManager.OnAlarmListener {
- override fun onAlarm() {
- showAlarm()
- }
- })
- val nextAlarm: Long = zenModeController.getNextAlarm()
- if (nextAlarm > 0) {
- val millis: Long = nextAlarm - TimeUnit.HOURS.toMillis(12L)
- if (millis > 0) {
- alarmManager.setExact(
- 1,
- millis,
- "lock_screen_next_alarm",
- object : AlarmManager.OnAlarmListener {
- override fun onAlarm() {
- showAlarm()
- }
- },
- handler
- )
- }
- }
- showAlarm()
- }
-
- fun showAlarm() {
- val nextAlarm: Long = zenModeController.getNextAlarm()
- if (nextAlarm > 0 && withinNHours(nextAlarm, 12L)) {
- val obj: String = DateFormat.format(
- if (DateFormat.is24HourFormat(
- context,
- ActivityManager.getCurrentUser()
- )
- ) "HH:mm" else "h:mm", nextAlarm
- ).toString()
- for (smartspaceView in smartspaceViews) {
- smartspaceView.setNextAlarm(alarmImage, obj)
- }
- return
- }
- for (smartspaceView in smartspaceViews) {
- smartspaceView.setNextAlarm(null, null)
- }
- }
-
- private fun withinNHours(j: Long, j2: Long): Boolean {
- return j <= System.currentTimeMillis() + TimeUnit.HOURS.toMillis(j2)
- }
-}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/connectivity/ui/MobileContextProviderTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/connectivity/ui/MobileContextProviderTest.kt
new file mode 100644
index 0000000000000..0fdda62e3b301
--- /dev/null
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/connectivity/ui/MobileContextProviderTest.kt
@@ -0,0 +1,122 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.systemui.statusbar.connectivity.ui
+
+import android.telephony.SubscriptionInfo
+import androidx.test.filters.SmallTest
+import com.android.systemui.SysuiTestCase
+import com.android.systemui.demomode.DemoModeController
+import com.android.systemui.dump.DumpManager
+import com.android.systemui.statusbar.connectivity.NetworkController
+import com.android.systemui.statusbar.connectivity.SignalCallback
+import com.android.systemui.util.mockito.mock
+import com.android.systemui.util.mockito.withArgCaptor
+import com.google.common.truth.Truth.assertThat
+import org.junit.Before
+import org.junit.Test
+import org.mockito.Mock
+import org.mockito.Mockito.verify
+import org.mockito.Mockito.`when` as whenever
+import org.mockito.MockitoAnnotations
+
+@SmallTest
+class MobileContextProviderTest : SysuiTestCase() {
+ @Mock private lateinit var networkController: NetworkController
+ @Mock private lateinit var dumpManager: DumpManager
+ @Mock private lateinit var demoModeController: DemoModeController
+
+ private lateinit var provider: MobileContextProvider
+ private lateinit var signalCallback: SignalCallback
+
+ @Before
+ fun setup() {
+ MockitoAnnotations.initMocks(this)
+ provider =
+ MobileContextProvider(
+ networkController,
+ dumpManager,
+ demoModeController,
+ )
+
+ signalCallback = withArgCaptor { verify(networkController).addCallback(capture()) }
+ }
+
+ @Test
+ fun test_oneSubscription_contextHasMccMnc() {
+ // GIVEN there is one SubscriptionInfo
+ signalCallback.setSubs(listOf(SUB_1))
+
+ // WHEN we ask for a mobile context
+ val ctx = provider.getMobileContextForSub(SUB_1_ID, context)
+
+ // THEN the configuration of that context reflect this subscription's MCC/MNC override
+ val config = ctx.resources.configuration
+ assertThat(config.mcc).isEqualTo(SUB_1_MCC)
+ assertThat(config.mnc).isEqualTo(SUB_1_MNC)
+ }
+
+ @Test
+ fun test_twoSubscriptions_eachContextReflectsMccMnc() {
+ // GIVEN there are two SubscriptionInfos
+ signalCallback.setSubs(listOf(SUB_1, SUB_2))
+
+ // WHEN we ask for a mobile context for each sub
+ val ctx1 = provider.getMobileContextForSub(SUB_1_ID, context)
+ val ctx2 = provider.getMobileContextForSub(SUB_2_ID, context)
+
+ // THEN the configuration of each context reflect this subscription's MCC/MNC override
+ val config1 = ctx1.resources.configuration
+ assertThat(config1.mcc).isEqualTo(SUB_1_MCC)
+ assertThat(config1.mnc).isEqualTo(SUB_1_MNC)
+
+ val config2 = ctx2.resources.configuration
+ assertThat(config2.mcc).isEqualTo(SUB_2_MCC)
+ assertThat(config2.mnc).isEqualTo(SUB_2_MNC)
+ }
+
+ @Test
+ fun test_requestingContextForNonexistentSubscription_returnsGivenContext() {
+ // GIVEN no SubscriptionInfos
+ signalCallback.setSubs(listOf())
+
+ // WHEN we ask for a mobile context for an unknown subscription
+ val ctx = provider.getMobileContextForSub(SUB_1_ID, context)
+
+ // THEN we get the original context back
+ assertThat(ctx).isEqualTo(context)
+ }
+
+ private val SUB_1_ID = 1
+ private val SUB_1_MCC = 123
+ private val SUB_1_MNC = 456
+ private val SUB_1 =
+ mock().also {
+ whenever(it.subscriptionId).thenReturn(SUB_1_ID)
+ whenever(it.mcc).thenReturn(SUB_1_MCC)
+ whenever(it.mnc).thenReturn(SUB_1_MNC)
+ }
+
+ private val SUB_2_ID = 2
+ private val SUB_2_MCC = 666
+ private val SUB_2_MNC = 777
+ private val SUB_2 =
+ mock().also {
+ whenever(it.subscriptionId).thenReturn(SUB_2_ID)
+ whenever(it.mcc).thenReturn(SUB_2_MCC)
+ whenever(it.mnc).thenReturn(SUB_2_MNC)
+ }
+}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarIconControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarIconControllerTest.java
index c5ea96873d99f..34399b80c9f7e 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarIconControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarIconControllerTest.java
@@ -20,7 +20,10 @@
import static junit.framework.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
import android.testing.AndroidTestingRunner;
import android.testing.TestableLooper.RunWithLooper;
@@ -30,12 +33,12 @@
import androidx.test.filters.SmallTest;
import com.android.internal.statusbar.StatusBarIcon;
-import com.android.systemui.flags.FeatureFlags;
import com.android.systemui.plugins.DarkIconDispatcher;
import com.android.systemui.statusbar.StatusBarIconView;
import com.android.systemui.statusbar.StatusBarMobileView;
import com.android.systemui.statusbar.StatusBarWifiView;
import com.android.systemui.statusbar.StatusIconDisplayable;
+import com.android.systemui.statusbar.connectivity.ui.MobileContextProvider;
import com.android.systemui.statusbar.phone.StatusBarIconController.DarkIconManager;
import com.android.systemui.statusbar.phone.StatusBarIconController.IconManager;
import com.android.systemui.statusbar.phone.StatusBarSignalPolicy.MobileIconState;
@@ -53,15 +56,19 @@
@SmallTest
public class StatusBarIconControllerTest extends LeakCheckedTest {
+ private MobileContextProvider mMobileContextProvider = mock(MobileContextProvider.class);
+
@Before
public void setup() {
injectLeakCheckedDependencies(ALL_SUPPORTED_CLASSES);
+ // For testing, ignore context overrides
+ when(mMobileContextProvider.getMobileContextForSub(anyInt(), any())).thenReturn(mContext);
}
@Test
public void testSetCalledOnAdd_IconManager() {
LinearLayout layout = new LinearLayout(mContext);
- TestIconManager manager = new TestIconManager(layout);
+ TestIconManager manager = new TestIconManager(layout, mMobileContextProvider);
testCallOnAdd_forManager(manager);
}
@@ -157,7 +164,7 @@ protected StatusBarMobileView addMobileIcon(int index, String slot, MobileIconSt
}
private static class TestIconManager extends IconManager implements TestableIconManager {
- TestIconManager(ViewGroup group) {
+ TestIconManager(ViewGroup group, MobileContextProvider contextProvider) {
super(group,
StatusBarLocation.HOME,
mock(StatusBarPipelineFlags.class),