diff options
| author | 2017-07-05 16:45:42 +0200 | |
|---|---|---|
| committer | 2017-07-05 16:45:42 +0200 | |
| commit | f2d545e30717c09c39df36aa601cf39e44dcdc50 (patch) | |
| tree | 0bc76af58afb3f7bc478ac182a4f5ffc1a5c371d | |
| parent | 2f19ad4aedc85f2929afb5ab662f30a0838dc521 (diff) | |
AOD: Disable if device is not yet provisioned
Change-Id: If1563d9558205936a8c78d1232eb0879700ff6b3
Fixes: 62263216
Test: adb shell settings put user_setup_complete 0; turn off screen; verify AOD does not show
4 files changed, 19 insertions, 15 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeHost.java b/packages/SystemUI/src/com/android/systemui/doze/DozeHost.java index 5aaa6c78f5fd..180b3caab65b 100644 --- a/packages/SystemUI/src/com/android/systemui/doze/DozeHost.java +++ b/packages/SystemUI/src/com/android/systemui/doze/DozeHost.java @@ -31,6 +31,7 @@ public interface DozeHost { void dozeTimeTick(); boolean isPowerSaveActive(); boolean isPulsingBlocked(); + boolean isProvisioned(); void startPendingIntentDismissingKeyguard(PendingIntent intent); void abortPulsing(); @@ -40,6 +41,7 @@ public interface DozeHost { void onDoubleTap(float x, float y); + interface Callback { default void onNotificationHeadsUp() {} default void onPowerSaveChanged(boolean active) {} diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeTriggers.java b/packages/SystemUI/src/com/android/systemui/doze/DozeTriggers.java index 9981972a96c5..179f5b8858ae 100644 --- a/packages/SystemUI/src/com/android/systemui/doze/DozeTriggers.java +++ b/packages/SystemUI/src/com/android/systemui/doze/DozeTriggers.java @@ -172,14 +172,6 @@ public class DozeTriggers implements DozeMachine.Part { } } - private void onCarMode() { - mMachine.requestState(DozeMachine.State.FINISH); - } - - private void onPowerSave() { - mMachine.requestState(DozeMachine.State.FINISH); - } - @Override public void transitionTo(DozeMachine.State oldState, DozeMachine.State newState) { switch (newState) { @@ -215,11 +207,10 @@ public class DozeTriggers implements DozeMachine.Part { } private void checkTriggersAtInit() { - if (mUiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_CAR) { - onCarMode(); - } - if (mDozeHost.isPowerSaveActive()) { - onPowerSave(); + if (mUiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_CAR + || mDozeHost.isPowerSaveActive() + || !mDozeHost.isProvisioned()) { + mMachine.requestState(DozeMachine.State.FINISH); } } @@ -355,7 +346,7 @@ public class DozeTriggers implements DozeMachine.Part { requestPulse(DozeLog.PULSE_REASON_INTENT, false /* performedProxCheck */); } if (UiModeManager.ACTION_ENTER_CAR_MODE.equals(intent.getAction())) { - onCarMode(); + mMachine.requestState(DozeMachine.State.FINISH); } if (Intent.ACTION_USER_SWITCHED.equals(intent.getAction())) { mDozeSensors.onUserSwitched(); @@ -391,7 +382,7 @@ public class DozeTriggers implements DozeMachine.Part { @Override public void onPowerSaveChanged(boolean active) { if (active) { - onPowerSave(); + mMachine.requestState(DozeMachine.State.FINISH); } } }; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java index bcba789fe284..de23e10e8c7b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -5369,6 +5369,12 @@ public class StatusBar extends SystemUI implements DemoMode, } @Override + public boolean isProvisioned() { + return mDeviceProvisionedController.isDeviceProvisioned() + && mDeviceProvisionedController.isCurrentUserSetup(); + } + + @Override public void startPendingIntentDismissingKeyguard(PendingIntent intent) { StatusBar.this.startPendingIntentDismissingKeyguard(intent); } diff --git a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeHostFake.java b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeHostFake.java index 23451106a20c..8ff9fa9fe6f3 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeHostFake.java +++ b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeHostFake.java @@ -72,6 +72,11 @@ class DozeHostFake implements DozeHost { } @Override + public boolean isProvisioned() { + return false; + } + + @Override public void startPendingIntentDismissingKeyguard(PendingIntent intent) { throw new RuntimeException("not implemented"); } |