Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f2d545e3 authored by Adrian Roos's avatar Adrian Roos
Browse files

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
parent 2f19ad4a
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -31,6 +31,7 @@ public interface DozeHost {
    void dozeTimeTick();
    void dozeTimeTick();
    boolean isPowerSaveActive();
    boolean isPowerSaveActive();
    boolean isPulsingBlocked();
    boolean isPulsingBlocked();
    boolean isProvisioned();


    void startPendingIntentDismissingKeyguard(PendingIntent intent);
    void startPendingIntentDismissingKeyguard(PendingIntent intent);
    void abortPulsing();
    void abortPulsing();
@@ -40,6 +41,7 @@ public interface DozeHost {


    void onDoubleTap(float x, float y);
    void onDoubleTap(float x, float y);



    interface Callback {
    interface Callback {
        default void onNotificationHeadsUp() {}
        default void onNotificationHeadsUp() {}
        default void onPowerSaveChanged(boolean active) {}
        default void onPowerSaveChanged(boolean active) {}
+6 −15
Original line number Original line Diff line number Diff line
@@ -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
    @Override
    public void transitionTo(DozeMachine.State oldState, DozeMachine.State newState) {
    public void transitionTo(DozeMachine.State oldState, DozeMachine.State newState) {
        switch (newState) {
        switch (newState) {
@@ -215,11 +207,10 @@ public class DozeTriggers implements DozeMachine.Part {
    }
    }


    private void checkTriggersAtInit() {
    private void checkTriggersAtInit() {
        if (mUiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_CAR) {
        if (mUiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_CAR
            onCarMode();
                || mDozeHost.isPowerSaveActive()
        }
                || !mDozeHost.isProvisioned()) {
        if (mDozeHost.isPowerSaveActive()) {
            mMachine.requestState(DozeMachine.State.FINISH);
            onPowerSave();
        }
        }
    }
    }


@@ -355,7 +346,7 @@ public class DozeTriggers implements DozeMachine.Part {
                requestPulse(DozeLog.PULSE_REASON_INTENT, false /* performedProxCheck */);
                requestPulse(DozeLog.PULSE_REASON_INTENT, false /* performedProxCheck */);
            }
            }
            if (UiModeManager.ACTION_ENTER_CAR_MODE.equals(intent.getAction())) {
            if (UiModeManager.ACTION_ENTER_CAR_MODE.equals(intent.getAction())) {
                onCarMode();
                mMachine.requestState(DozeMachine.State.FINISH);
            }
            }
            if (Intent.ACTION_USER_SWITCHED.equals(intent.getAction())) {
            if (Intent.ACTION_USER_SWITCHED.equals(intent.getAction())) {
                mDozeSensors.onUserSwitched();
                mDozeSensors.onUserSwitched();
@@ -391,7 +382,7 @@ public class DozeTriggers implements DozeMachine.Part {
        @Override
        @Override
        public void onPowerSaveChanged(boolean active) {
        public void onPowerSaveChanged(boolean active) {
            if (active) {
            if (active) {
                onPowerSave();
                mMachine.requestState(DozeMachine.State.FINISH);
            }
            }
        }
        }
    };
    };
+6 −0
Original line number Original line Diff line number Diff line
@@ -5368,6 +5368,12 @@ public class StatusBar extends SystemUI implements DemoMode,
                    == FingerprintUnlockController.MODE_WAKE_AND_UNLOCK;
                    == FingerprintUnlockController.MODE_WAKE_AND_UNLOCK;
        }
        }


        @Override
        public boolean isProvisioned() {
            return mDeviceProvisionedController.isDeviceProvisioned()
                    && mDeviceProvisionedController.isCurrentUserSetup();
        }

        @Override
        @Override
        public void startPendingIntentDismissingKeyguard(PendingIntent intent) {
        public void startPendingIntentDismissingKeyguard(PendingIntent intent) {
            StatusBar.this.startPendingIntentDismissingKeyguard(intent);
            StatusBar.this.startPendingIntentDismissingKeyguard(intent);
+5 −0
Original line number Original line Diff line number Diff line
@@ -71,6 +71,11 @@ class DozeHostFake implements DozeHost {
        return false;
        return false;
    }
    }


    @Override
    public boolean isProvisioned() {
        return false;
    }

    @Override
    @Override
    public void startPendingIntentDismissingKeyguard(PendingIntent intent) {
    public void startPendingIntentDismissingKeyguard(PendingIntent intent) {
        throw new RuntimeException("not implemented");
        throw new RuntimeException("not implemented");