Skip to content

Commit 81d22c9

Browse files
Jay WangAndroid Build Coastguard Worker
authored andcommitted
Whiskey icon patch
Bug: 406894719 Test: local test (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:d3c4a764721ee8936b9bfcddedd2189f4c44cfbe) (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:923b10bd201074c4bd49857030a89572769e5f7b) Merged-In: Iead9c06835a227ae870ba71d70a9e9461ef64be9 Change-Id: Iead9c06835a227ae870ba71d70a9e9461ef64be9
1 parent 1253aad commit 81d22c9

File tree

4 files changed

+13
-19
lines changed

4 files changed

+13
-19
lines changed

packages/SettingsLib/res/values/strings.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1850,6 +1850,6 @@
18501850
<!-- The name of the screen for seeing and installing system updates. [CHAR LIMIT=40]-->
18511851
<string name="system_update_settings_list_item_title">System Updates</string>
18521852

1853-
<!-- The exclamation symbol defined for the batterymeter. [CHAR LIMIT=NONE]-->
1854-
<string name="config_batterymeterExclamationPath" translatable="false">M7 12.5h.5V12 6 5.5H7 5 4.5V6v6 .5H5 7ZM4.9064 16.0629l.0147.016.016.0147c.2966.2719.6605.4064 1.0629.4064.4024 0 .7673-.1352 1.0536-.4214.294-.294.4464-.6629.4464-1.0786 0-.4092-.1485-.7731-.4462-1.0538C6.7731 13.6485 6.4092 13.5 6 13.5c-.4157 0-.7846.1525-1.0785.4464L5.275 14.3l-.3536-.3536C4.6352 14.2327 4.5 14.5976 4.5 15c0 .4023.1345.7663.4064 1.0629Z</string>
1853+
<!-- The exclamation symbol defined for the battery meter. [CHAR LIMIT=NONE]-->
1854+
<string name="config_batteryMeterExclamationPath" translatable="false">M7 12.5h.5V12 6 5.5H7 5 4.5V6v6 .5H5 7ZM4.9064 16.0629l.0147.016.016.0147c.2966.2719.6605.4064 1.0629.4064.4024 0 .7673-.1352 1.0536-.4214.294-.294.4464-.6629.4464-1.0786 0-.4092-.1485-.7731-.4462-1.0538C6.7731 13.6485 6.4092 13.5 6 13.5c-.4157 0-.7846.1525-1.0785.4464L5.275 14.3l-.3536-.3536C4.6352 14.2327 4.5 14.5976 4.5 15c0 .4023.1345.7663.4064 1.0629Z</string>
18551855
</resources>

packages/SettingsLib/src/com/android/settingslib/graph/ThemedBatteryDrawable.kt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -261,11 +261,10 @@ open class ThemedBatteryDrawable(private val context: Context, frameColor: Int)
261261
}
262262
} else if (alertEnabled) {
263263
c.clipOutPath(scaledExclamation)
264-
if (invertFillIcon) {
265-
c.drawPath(scaledExclamation, fillColorStrokePaint)
266-
} else {
267-
c.drawPath(scaledExclamation, fillColorStrokeProtection)
268-
}
264+
c.drawPath(
265+
scaledExclamation,
266+
if (invertFillIcon) fillColorStrokePaint else fillColorStrokeProtection
267+
)
269268
} else if (powerSaveEnabled) {
270269
// If power save is enabled draw the level path with colorError
271270
c.drawPath(levelPath, errorPaint)
@@ -433,7 +432,7 @@ open class ThemedBatteryDrawable(private val context: Context, frameColor: Int)
433432
plusPath.set(PathParser.createPathFromPathData(plusPathString))
434433

435434
val exclamationPathString = context.resources.getString(
436-
R.string.config_batterymeterExclamationPath)
435+
R.string.config_batteryMeterExclamationPath)
437436
exclamationPath.set(PathParser.createPathFromPathData(exclamationPathString))
438437

439438
dualTone = context.resources.getBoolean(

packages/SystemUI/src/com/android/systemui/battery/BatteryMeterViewController.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,17 +111,17 @@ public void onIsIncompatibleChargingChanged(boolean isIncompatibleCharging) {
111111
}
112112
}
113113

114+
@Override
115+
public void onBatteryAlertStateChanged(boolean isAlert) {
116+
mView.onBatteryAlertStateChanged(isAlert);
117+
}
118+
114119
@Override
115120
public void dump(@NonNull PrintWriter pw, @NonNull String[] args) {
116121
pw.print(super.toString());
117122
pw.println(" location=" + mLocation);
118123
mView.dump(pw, args);
119124
}
120-
121-
@Override
122-
public void onBatteryAlertStateChanged(boolean isAlert) {
123-
mView.onBatteryAlertStateChanged(isAlert);
124-
}
125125
};
126126

127127
private final UserTracker.Callback mUserChangedCallback =

packages/SystemUI/src/com/android/systemui/statusbar/policy/BatteryControllerImpl.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -526,12 +526,7 @@ private void fireIsIncompatibleChargingChanged() {
526526
}
527527

528528
private void fireBatteryAlertStateChanged() {
529-
synchronized (mChangeCallbacks) {
530-
final int n = mChangeCallbacks.size();
531-
for (int i = 0; i < n; i++) {
532-
mChangeCallbacks.get(i).onBatteryAlertStateChanged(mStateAlert);
533-
}
534-
}
529+
dispatchSafeChange((callback) -> callback.onBatteryAlertStateChanged(mStateAlert));
535530
}
536531

537532
@Override

0 commit comments

Comments
 (0)