summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderController.java
diff options
context:
space:
mode:
authorhughchen <hughchen@google.com>2020-05-08 15:10:14 +0800
committerhughchen <hughchen@google.com>2020-05-08 15:15:15 +0800
commit6060bc66e5a15bbce6b7a53e647f17f71d9de7e0 (patch)
treeac44ae5d8aeb0900849f3f8cea0d7feb16195732 /src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderController.java
parentcb8be1de6fe610573bbe46e486f54a69bb9977b1 (diff)
downloadpackages_apps_Settings-6060bc66e5a15bbce6b7a53e647f17f71d9de7e0.tar.gz
packages_apps_Settings-6060bc66e5a15bbce6b7a53e647f17f71d9de7e0.tar.bz2
packages_apps_Settings-6060bc66e5a15bbce6b7a53e647f17f71d9de7e0.zip
Add low battery level for case
- Add low battery level for case, because case and headset have different low battery level. - Update test case Bug: 154569936 Test: make -j42 RunSettingsRoboTests Change-Id: Icf045b62992dde8d789e66343764849e43df1933
Diffstat (limited to 'src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderController.java')
-rw-r--r--src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderController.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderController.java b/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderController.java
index a86b441c3b..a147656f6c 100644
--- a/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderController.java
+++ b/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderController.java
@@ -63,6 +63,7 @@ public class AdvancedBluetoothDetailsHeaderController extends BasePreferenceCont
LifecycleObserver, OnStart, OnStop, OnDestroy, CachedBluetoothDevice.Callback {
private static final String TAG = "AdvancedBtHeaderCtrl";
private static final int LOW_BATTERY_LEVEL = 15;
+ private static final int CASE_LOW_BATTERY_LEVEL = 19;
private static final boolean DBG = Log.isLoggable(TAG, Log.DEBUG);
@VisibleForTesting
@@ -226,7 +227,7 @@ public class AdvancedBluetoothDetailsHeaderController extends BasePreferenceCont
final TextView textView = linearLayout.findViewById(R.id.bt_battery_summary);
textView.setText(com.android.settings.Utils.formatPercentage(batteryLevel));
textView.setVisibility(View.VISIBLE);
- showBatteryIcon(linearLayout, batteryLevel, charging);
+ showBatteryIcon(linearLayout, batteryLevel, charging, batteryMetaKey);
} else {
// Hide it if it doesn't have battery information
linearLayout.setVisibility(View.GONE);
@@ -237,8 +238,12 @@ public class AdvancedBluetoothDetailsHeaderController extends BasePreferenceCont
textView.setVisibility(View.VISIBLE);
}
- private void showBatteryIcon(LinearLayout linearLayout, int level, boolean charging) {
- boolean enableLowBattery = level <= LOW_BATTERY_LEVEL && !charging;
+ private void showBatteryIcon(LinearLayout linearLayout, int level, boolean charging,
+ int batteryMetaKey) {
+ final int lowBatteryLevel =
+ batteryMetaKey == BluetoothDevice.METADATA_UNTETHERED_CASE_BATTERY
+ ? CASE_LOW_BATTERY_LEVEL : LOW_BATTERY_LEVEL;
+ final boolean enableLowBattery = level <= lowBatteryLevel && !charging;
final ImageView imageView = linearLayout.findViewById(R.id.bt_battery_icon);
if (enableLowBattery) {
imageView.setImageDrawable(mContext.getDrawable(R.drawable.ic_battery_alert_24dp));