Loading packages/SystemUI/src/com/android/systemui/doze/DozeUi.java +13 −2 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.app.AlarmManager; import android.content.Context; import android.os.Handler; import android.os.SystemClock; import android.provider.Settings; import android.text.format.Formatter; import android.util.Log; Loading @@ -32,6 +33,7 @@ import com.android.keyguard.KeyguardUpdateMonitorCallback; import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.doze.dagger.DozeScope; import com.android.systemui.statusbar.phone.DozeParameters; import com.android.systemui.tuner.TunerService; import com.android.systemui.util.AlarmTimeout; import com.android.systemui.util.wakelock.WakeLock; Loading @@ -43,7 +45,7 @@ import javax.inject.Inject; * The policy controlling doze. */ @DozeScope public class DozeUi implements DozeMachine.Part { public class DozeUi implements DozeMachine.Part, TunerService.Tunable { private static final long TIME_TICK_DEADLINE_MILLIS = 90 * 1000; // 1.5min private final Context mContext; Loading Loading @@ -73,7 +75,7 @@ public class DozeUi implements DozeMachine.Part { public DozeUi(Context context, AlarmManager alarmManager, WakeLock wakeLock, DozeHost host, @Main Handler handler, DozeParameters params, KeyguardUpdateMonitor keyguardUpdateMonitor, DozeLog dozeLog) { DozeLog dozeLog, TunerService tunerService) { mContext = context; mWakeLock = wakeLock; mHost = host; Loading @@ -83,6 +85,8 @@ public class DozeUi implements DozeMachine.Part { mTimeTicker = new AlarmTimeout(alarmManager, this::onTimeTick, "doze_time_tick", handler); keyguardUpdateMonitor.registerCallback(mKeyguardVisibilityCallback); mDozeLog = dozeLog; tunerService.addTunable(this, Settings.Secure.DOZE_ALWAYS_ON); } @Override Loading Loading @@ -238,4 +242,11 @@ public class DozeUi implements DozeMachine.Part { KeyguardUpdateMonitorCallback getKeyguardCallback() { return mKeyguardVisibilityCallback; } @Override public void onTuningChanged(String key, String newValue) { if (key.equals(Settings.Secure.DOZE_ALWAYS_ON)) { updateAnimateScreenOff(); } } } packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +4 −1 Original line number Diff line number Diff line Loading @@ -2395,6 +2395,9 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable, return; } mDozing = dozing; if (!dozing) { mAnimatingScreenOff = false; } setShowingLocked(mShowing); } Loading @@ -2404,7 +2407,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable, // is 1f), then show the activity lock screen. if (mAnimatingScreenOff && mDozing && linear == 1f) { mAnimatingScreenOff = false; setShowingLocked(mShowing); setShowingLocked(mShowing, true); } } Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinator.kt +14 −9 Original line number Diff line number Diff line Loading @@ -264,6 +264,20 @@ class NotificationWakeUpCoordinator @Inject constructor( } override fun onStateChanged(newState: Int) { if (dozeParameters.shouldControlUnlockedScreenOff()) { if (animatingScreenOff && state == StatusBarState.KEYGUARD && newState == StatusBarState.SHADE) { // If we're animating the screen off and going from KEYGUARD back to SHADE, the // animation was cancelled and we are unlocking. Override the doze amount to 0f (not // dozing) so that the notifications are no longer hidden. setDozeAmount(0f, 0f) } animatingScreenOff = state == StatusBarState.SHADE && newState == StatusBarState.KEYGUARD } overrideDozeAmountIfBypass() if (bypassController.bypassEnabled && newState == StatusBarState.KEYGUARD && state == StatusBarState.SHADE_LOCKED && Loading @@ -273,13 +287,6 @@ class NotificationWakeUpCoordinator @Inject constructor( setNotificationsVisible(visible = false, increaseSpeed = false, animate = true) } // If we want to control the screen off animation, check whether we are going from SHADE to // KEYGUARD. if (dozeParameters.shouldControlUnlockedScreenOff()) { animatingScreenOff = state == StatusBarState.SHADE && newState == StatusBarState.KEYGUARD } this.state = newState } Loading Loading @@ -386,8 +393,6 @@ class NotificationWakeUpCoordinator @Inject constructor( override fun onDozingChanged(isDozing: Boolean) { if (isDozing) { setNotificationsVisible(visible = false, animate = false, increaseSpeed = false) } else { animatingScreenOff = false } } Loading packages/SystemUI/tests/src/com/android/systemui/doze/DozeUiTest.java +5 −2 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ import androidx.test.runner.AndroidJUnit4; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.systemui.SysuiTestCase; import com.android.systemui.statusbar.phone.DozeParameters; import com.android.systemui.tuner.TunerService; import com.android.systemui.util.wakelock.WakeLockFake; import org.junit.After; Loading @@ -67,6 +68,8 @@ public class DozeUiTest extends SysuiTestCase { private DozeHost mHost; @Mock private DozeLog mDozeLog; @Mock private TunerService mTunerService; private WakeLockFake mWakeLock; private Handler mHandler; private HandlerThread mHandlerThread; Loading @@ -82,7 +85,7 @@ public class DozeUiTest extends SysuiTestCase { mHandler = mHandlerThread.getThreadHandler(); mDozeUi = new DozeUi(mContext, mAlarmManager, mWakeLock, mHost, mHandler, mDozeParameters, mKeyguardUpdateMonitor, mDozeLog); mDozeParameters, mKeyguardUpdateMonitor, mDozeLog, mTunerService); mDozeUi.setDozeMachine(mMachine); } Loading Loading @@ -138,7 +141,7 @@ public class DozeUiTest extends SysuiTestCase { reset(mHost); when(mDozeParameters.getDisplayNeedsBlanking()).thenReturn(true); mDozeUi = new DozeUi(mContext, mAlarmManager, mWakeLock, mHost, mHandler, mDozeParameters, mKeyguardUpdateMonitor, mDozeLog); mDozeParameters, mKeyguardUpdateMonitor, mDozeLog, mTunerService); mDozeUi.setDozeMachine(mMachine); // Never animate if display doesn't support it. Loading Loading
packages/SystemUI/src/com/android/systemui/doze/DozeUi.java +13 −2 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.app.AlarmManager; import android.content.Context; import android.os.Handler; import android.os.SystemClock; import android.provider.Settings; import android.text.format.Formatter; import android.util.Log; Loading @@ -32,6 +33,7 @@ import com.android.keyguard.KeyguardUpdateMonitorCallback; import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.doze.dagger.DozeScope; import com.android.systemui.statusbar.phone.DozeParameters; import com.android.systemui.tuner.TunerService; import com.android.systemui.util.AlarmTimeout; import com.android.systemui.util.wakelock.WakeLock; Loading @@ -43,7 +45,7 @@ import javax.inject.Inject; * The policy controlling doze. */ @DozeScope public class DozeUi implements DozeMachine.Part { public class DozeUi implements DozeMachine.Part, TunerService.Tunable { private static final long TIME_TICK_DEADLINE_MILLIS = 90 * 1000; // 1.5min private final Context mContext; Loading Loading @@ -73,7 +75,7 @@ public class DozeUi implements DozeMachine.Part { public DozeUi(Context context, AlarmManager alarmManager, WakeLock wakeLock, DozeHost host, @Main Handler handler, DozeParameters params, KeyguardUpdateMonitor keyguardUpdateMonitor, DozeLog dozeLog) { DozeLog dozeLog, TunerService tunerService) { mContext = context; mWakeLock = wakeLock; mHost = host; Loading @@ -83,6 +85,8 @@ public class DozeUi implements DozeMachine.Part { mTimeTicker = new AlarmTimeout(alarmManager, this::onTimeTick, "doze_time_tick", handler); keyguardUpdateMonitor.registerCallback(mKeyguardVisibilityCallback); mDozeLog = dozeLog; tunerService.addTunable(this, Settings.Secure.DOZE_ALWAYS_ON); } @Override Loading Loading @@ -238,4 +242,11 @@ public class DozeUi implements DozeMachine.Part { KeyguardUpdateMonitorCallback getKeyguardCallback() { return mKeyguardVisibilityCallback; } @Override public void onTuningChanged(String key, String newValue) { if (key.equals(Settings.Secure.DOZE_ALWAYS_ON)) { updateAnimateScreenOff(); } } }
packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +4 −1 Original line number Diff line number Diff line Loading @@ -2395,6 +2395,9 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable, return; } mDozing = dozing; if (!dozing) { mAnimatingScreenOff = false; } setShowingLocked(mShowing); } Loading @@ -2404,7 +2407,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable, // is 1f), then show the activity lock screen. if (mAnimatingScreenOff && mDozing && linear == 1f) { mAnimatingScreenOff = false; setShowingLocked(mShowing); setShowingLocked(mShowing, true); } } Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinator.kt +14 −9 Original line number Diff line number Diff line Loading @@ -264,6 +264,20 @@ class NotificationWakeUpCoordinator @Inject constructor( } override fun onStateChanged(newState: Int) { if (dozeParameters.shouldControlUnlockedScreenOff()) { if (animatingScreenOff && state == StatusBarState.KEYGUARD && newState == StatusBarState.SHADE) { // If we're animating the screen off and going from KEYGUARD back to SHADE, the // animation was cancelled and we are unlocking. Override the doze amount to 0f (not // dozing) so that the notifications are no longer hidden. setDozeAmount(0f, 0f) } animatingScreenOff = state == StatusBarState.SHADE && newState == StatusBarState.KEYGUARD } overrideDozeAmountIfBypass() if (bypassController.bypassEnabled && newState == StatusBarState.KEYGUARD && state == StatusBarState.SHADE_LOCKED && Loading @@ -273,13 +287,6 @@ class NotificationWakeUpCoordinator @Inject constructor( setNotificationsVisible(visible = false, increaseSpeed = false, animate = true) } // If we want to control the screen off animation, check whether we are going from SHADE to // KEYGUARD. if (dozeParameters.shouldControlUnlockedScreenOff()) { animatingScreenOff = state == StatusBarState.SHADE && newState == StatusBarState.KEYGUARD } this.state = newState } Loading Loading @@ -386,8 +393,6 @@ class NotificationWakeUpCoordinator @Inject constructor( override fun onDozingChanged(isDozing: Boolean) { if (isDozing) { setNotificationsVisible(visible = false, animate = false, increaseSpeed = false) } else { animatingScreenOff = false } } Loading
packages/SystemUI/tests/src/com/android/systemui/doze/DozeUiTest.java +5 −2 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ import androidx.test.runner.AndroidJUnit4; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.systemui.SysuiTestCase; import com.android.systemui.statusbar.phone.DozeParameters; import com.android.systemui.tuner.TunerService; import com.android.systemui.util.wakelock.WakeLockFake; import org.junit.After; Loading @@ -67,6 +68,8 @@ public class DozeUiTest extends SysuiTestCase { private DozeHost mHost; @Mock private DozeLog mDozeLog; @Mock private TunerService mTunerService; private WakeLockFake mWakeLock; private Handler mHandler; private HandlerThread mHandlerThread; Loading @@ -82,7 +85,7 @@ public class DozeUiTest extends SysuiTestCase { mHandler = mHandlerThread.getThreadHandler(); mDozeUi = new DozeUi(mContext, mAlarmManager, mWakeLock, mHost, mHandler, mDozeParameters, mKeyguardUpdateMonitor, mDozeLog); mDozeParameters, mKeyguardUpdateMonitor, mDozeLog, mTunerService); mDozeUi.setDozeMachine(mMachine); } Loading Loading @@ -138,7 +141,7 @@ public class DozeUiTest extends SysuiTestCase { reset(mHost); when(mDozeParameters.getDisplayNeedsBlanking()).thenReturn(true); mDozeUi = new DozeUi(mContext, mAlarmManager, mWakeLock, mHost, mHandler, mDozeParameters, mKeyguardUpdateMonitor, mDozeLog); mDozeParameters, mKeyguardUpdateMonitor, mDozeLog, mTunerService); mDozeUi.setDozeMachine(mMachine); // Never animate if display doesn't support it. Loading