Loading packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +1 −1 Original line number Diff line number Diff line Loading @@ -3375,8 +3375,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab */ private void handleBatteryUpdate(BatteryStatus status) { Assert.isMainThread(); mLogger.d("handleBatteryUpdate"); final boolean batteryUpdateInteresting = isBatteryUpdateInteresting(mBatteryStatus, status); mLogger.logHandleBatteryUpdate(batteryUpdateInteresting); mBatteryStatus = status; if (batteryUpdateInteresting) { for (int i = 0; i < mCallbacks.size(); i++) { Loading packages/SystemUI/src/com/android/keyguard/logging/KeyguardLogger.kt +37 −0 Original line number Diff line number Diff line Loading @@ -97,6 +97,21 @@ constructor( ) } fun logUpdateBatteryIndication( powerIndication: String, pluggedIn: Boolean, ) { buffer.log( KeyguardIndicationController.TAG, LogLevel.DEBUG, { str1 = powerIndication bool1 = pluggedIn }, { "updateBatteryIndication powerIndication:$str1 pluggedIn:$bool1" } ) } fun logKeyguardSwitchIndication( type: Int, message: String?, Loading @@ -112,6 +127,28 @@ constructor( ) } fun logRefreshBatteryInfo( isChargingOrFull: Boolean, powerPluggedIn: Boolean, batteryLevel: Int, batteryOverheated: Boolean ) { buffer.log( KeyguardIndicationController.TAG, LogLevel.DEBUG, { bool1 = isChargingOrFull bool2 = powerPluggedIn bool3 = batteryOverheated int1 = batteryLevel }, { "refreshBatteryInfo isChargingOrFull:$bool1 powerPluggedIn:$bool2" + " batteryOverheated:$bool3 batteryLevel:$int1" } ) } fun getKeyguardSwitchIndicationNonSensitiveLog(type: Int, message: String?): String { // only show the battery string. other strings may contain sensitive info return if (type == KeyguardIndicationRotateTextViewController.INDICATION_TYPE_BATTERY) { Loading packages/SystemUI/src/com/android/keyguard/logging/KeyguardUpdateMonitorLogger.kt +11 −0 Original line number Diff line number Diff line Loading @@ -657,4 +657,15 @@ constructor(@KeyguardUpdateMonitorLog private val logBuffer: LogBuffer) { } ) } fun logHandleBatteryUpdate(isInteresting: Boolean) { logBuffer.log( TAG, DEBUG, { bool1 = isInteresting }, { "handleBatteryUpdate: $bool1" } ) } } packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java +22 −7 Original line number Diff line number Diff line Loading @@ -177,10 +177,12 @@ public class KeyguardIndicationController { private boolean mVisible; private boolean mOrganizationOwnedDevice; // these all assume the device is plugged in (wired/wireless/docked) AND chargingOrFull: private boolean mPowerPluggedIn; private boolean mPowerPluggedInWired; private boolean mPowerPluggedInWireless; private boolean mPowerPluggedInDock; private boolean mPowerCharged; private boolean mBatteryOverheated; private boolean mEnableBatteryDefender; Loading Loading @@ -499,6 +501,7 @@ public class KeyguardIndicationController { powerIndication += ", " + (mChargingWattage / 1000) + " mW"; } mKeyguardLogger.logUpdateBatteryIndication(powerIndication, mPowerPluggedIn); mRotateTextViewController.updateIndication( INDICATION_TYPE_BATTERY, new KeyguardIndication.Builder() Loading @@ -507,6 +510,7 @@ public class KeyguardIndicationController { .build(), animate); } else { mKeyguardLogger.log(TAG, LogLevel.DEBUG, "hide battery indication"); // don't show the charging information if device isn't plugged in mRotateTextViewController.hideIndication(INDICATION_TYPE_BATTERY); } Loading Loading @@ -885,6 +889,9 @@ public class KeyguardIndicationController { updateLockScreenIndications(animate, getCurrentUser()); } /** * Assumption: device is charging */ protected String computePowerIndication() { int chargingId; if (mBatteryOverheated) { Loading Loading @@ -1035,6 +1042,12 @@ public class KeyguardIndicationController { } } /** * KeyguardUpdateMonitor only sends "interesting" battery updates * {@link KeyguardUpdateMonitor#isBatteryUpdateInteresting}. * Therefore, make sure to always check plugged in state along with any charging status * change, or else we could end up with stale state. */ @Override public void onRefreshBatteryInfo(BatteryStatus status) { boolean isChargingOrFull = status.status == BatteryManager.BATTERY_STATUS_CHARGING Loading @@ -1050,7 +1063,9 @@ public class KeyguardIndicationController { mBatteryLevel = status.level; mBatteryPresent = status.present; mBatteryOverheated = status.isOverheated(); // when the battery is overheated, device doesn't charge so only guard on pluggedIn: mEnableBatteryDefender = mBatteryOverheated && status.isPluggedIn(); try { mChargingTimeRemaining = mPowerPluggedIn ? mBatteryInfo.computeChargeTimeRemaining() : -1; Loading @@ -1058,14 +1073,10 @@ public class KeyguardIndicationController { mKeyguardLogger.log(TAG, ERROR, "Error calling IBatteryStats", e); mChargingTimeRemaining = -1; } mKeyguardLogger.logRefreshBatteryInfo(isChargingOrFull, mPowerPluggedIn, mBatteryLevel, mBatteryOverheated); updateDeviceEntryIndication(!wasPluggedIn && mPowerPluggedInWired); if (mDozing) { if (!wasPluggedIn && mPowerPluggedIn) { showTransientIndication(computePowerIndication()); } else if (wasPluggedIn && !mPowerPluggedIn) { hideTransientIndication(); } } } @Override Loading Loading @@ -1317,6 +1328,10 @@ public class KeyguardIndicationController { } } protected boolean isPluggedInAndCharging() { return mPowerPluggedIn; } private boolean isCurrentUser(int userId) { return getCurrentUser() == userId; } Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardIndicationTextView.java +1 −0 Original line number Diff line number Diff line Loading @@ -76,6 +76,7 @@ public class KeyguardIndicationTextView extends TextView { if (mLastAnimator != null) { mLastAnimator.cancel(); } mMessage = ""; setText(""); } Loading Loading
packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +1 −1 Original line number Diff line number Diff line Loading @@ -3375,8 +3375,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab */ private void handleBatteryUpdate(BatteryStatus status) { Assert.isMainThread(); mLogger.d("handleBatteryUpdate"); final boolean batteryUpdateInteresting = isBatteryUpdateInteresting(mBatteryStatus, status); mLogger.logHandleBatteryUpdate(batteryUpdateInteresting); mBatteryStatus = status; if (batteryUpdateInteresting) { for (int i = 0; i < mCallbacks.size(); i++) { Loading
packages/SystemUI/src/com/android/keyguard/logging/KeyguardLogger.kt +37 −0 Original line number Diff line number Diff line Loading @@ -97,6 +97,21 @@ constructor( ) } fun logUpdateBatteryIndication( powerIndication: String, pluggedIn: Boolean, ) { buffer.log( KeyguardIndicationController.TAG, LogLevel.DEBUG, { str1 = powerIndication bool1 = pluggedIn }, { "updateBatteryIndication powerIndication:$str1 pluggedIn:$bool1" } ) } fun logKeyguardSwitchIndication( type: Int, message: String?, Loading @@ -112,6 +127,28 @@ constructor( ) } fun logRefreshBatteryInfo( isChargingOrFull: Boolean, powerPluggedIn: Boolean, batteryLevel: Int, batteryOverheated: Boolean ) { buffer.log( KeyguardIndicationController.TAG, LogLevel.DEBUG, { bool1 = isChargingOrFull bool2 = powerPluggedIn bool3 = batteryOverheated int1 = batteryLevel }, { "refreshBatteryInfo isChargingOrFull:$bool1 powerPluggedIn:$bool2" + " batteryOverheated:$bool3 batteryLevel:$int1" } ) } fun getKeyguardSwitchIndicationNonSensitiveLog(type: Int, message: String?): String { // only show the battery string. other strings may contain sensitive info return if (type == KeyguardIndicationRotateTextViewController.INDICATION_TYPE_BATTERY) { Loading
packages/SystemUI/src/com/android/keyguard/logging/KeyguardUpdateMonitorLogger.kt +11 −0 Original line number Diff line number Diff line Loading @@ -657,4 +657,15 @@ constructor(@KeyguardUpdateMonitorLog private val logBuffer: LogBuffer) { } ) } fun logHandleBatteryUpdate(isInteresting: Boolean) { logBuffer.log( TAG, DEBUG, { bool1 = isInteresting }, { "handleBatteryUpdate: $bool1" } ) } }
packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java +22 −7 Original line number Diff line number Diff line Loading @@ -177,10 +177,12 @@ public class KeyguardIndicationController { private boolean mVisible; private boolean mOrganizationOwnedDevice; // these all assume the device is plugged in (wired/wireless/docked) AND chargingOrFull: private boolean mPowerPluggedIn; private boolean mPowerPluggedInWired; private boolean mPowerPluggedInWireless; private boolean mPowerPluggedInDock; private boolean mPowerCharged; private boolean mBatteryOverheated; private boolean mEnableBatteryDefender; Loading Loading @@ -499,6 +501,7 @@ public class KeyguardIndicationController { powerIndication += ", " + (mChargingWattage / 1000) + " mW"; } mKeyguardLogger.logUpdateBatteryIndication(powerIndication, mPowerPluggedIn); mRotateTextViewController.updateIndication( INDICATION_TYPE_BATTERY, new KeyguardIndication.Builder() Loading @@ -507,6 +510,7 @@ public class KeyguardIndicationController { .build(), animate); } else { mKeyguardLogger.log(TAG, LogLevel.DEBUG, "hide battery indication"); // don't show the charging information if device isn't plugged in mRotateTextViewController.hideIndication(INDICATION_TYPE_BATTERY); } Loading Loading @@ -885,6 +889,9 @@ public class KeyguardIndicationController { updateLockScreenIndications(animate, getCurrentUser()); } /** * Assumption: device is charging */ protected String computePowerIndication() { int chargingId; if (mBatteryOverheated) { Loading Loading @@ -1035,6 +1042,12 @@ public class KeyguardIndicationController { } } /** * KeyguardUpdateMonitor only sends "interesting" battery updates * {@link KeyguardUpdateMonitor#isBatteryUpdateInteresting}. * Therefore, make sure to always check plugged in state along with any charging status * change, or else we could end up with stale state. */ @Override public void onRefreshBatteryInfo(BatteryStatus status) { boolean isChargingOrFull = status.status == BatteryManager.BATTERY_STATUS_CHARGING Loading @@ -1050,7 +1063,9 @@ public class KeyguardIndicationController { mBatteryLevel = status.level; mBatteryPresent = status.present; mBatteryOverheated = status.isOverheated(); // when the battery is overheated, device doesn't charge so only guard on pluggedIn: mEnableBatteryDefender = mBatteryOverheated && status.isPluggedIn(); try { mChargingTimeRemaining = mPowerPluggedIn ? mBatteryInfo.computeChargeTimeRemaining() : -1; Loading @@ -1058,14 +1073,10 @@ public class KeyguardIndicationController { mKeyguardLogger.log(TAG, ERROR, "Error calling IBatteryStats", e); mChargingTimeRemaining = -1; } mKeyguardLogger.logRefreshBatteryInfo(isChargingOrFull, mPowerPluggedIn, mBatteryLevel, mBatteryOverheated); updateDeviceEntryIndication(!wasPluggedIn && mPowerPluggedInWired); if (mDozing) { if (!wasPluggedIn && mPowerPluggedIn) { showTransientIndication(computePowerIndication()); } else if (wasPluggedIn && !mPowerPluggedIn) { hideTransientIndication(); } } } @Override Loading Loading @@ -1317,6 +1328,10 @@ public class KeyguardIndicationController { } } protected boolean isPluggedInAndCharging() { return mPowerPluggedIn; } private boolean isCurrentUser(int userId) { return getCurrentUser() == userId; } Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardIndicationTextView.java +1 −0 Original line number Diff line number Diff line Loading @@ -76,6 +76,7 @@ public class KeyguardIndicationTextView extends TextView { if (mLastAnimator != null) { mLastAnimator.cancel(); } mMessage = ""; setText(""); } Loading