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

Commit b988f8d1 authored by Prince's avatar Prince Committed by Prince Donkor
Browse files

Removing LOCKSCREEN_WITHOUT_SECURE_LOCK_WHEN_DREAMING flag

Test: atest SystemUITests
Fixes: b/289111003
Change-Id: I962436308794e9e8b84cf771e7c709791c00091f
parent 8297bd84
Loading
Loading
Loading
Loading
+0 −5
Original line number Original line Diff line number Diff line
@@ -144,11 +144,6 @@ object Flags {
            "lockscreen_custom_clocks"
            "lockscreen_custom_clocks"
        )
        )


    // TODO(b/275694445): Tracking Bug
    @JvmField
    val LOCKSCREEN_WITHOUT_SECURE_LOCK_WHEN_DREAMING =
        releasedFlag("lockscreen_without_secure_lock_when_dreaming")

    // TODO(b/286092087): Tracking Bug
    // TODO(b/286092087): Tracking Bug
    @JvmField
    @JvmField
    val ENABLE_SYSTEM_UI_DREAM_CONTROLLER = unreleasedFlag("enable_system_ui_dream_controller")
    val ENABLE_SYSTEM_UI_DREAM_CONTROLLER = unreleasedFlag("enable_system_ui_dream_controller")
+5 −6
Original line number Original line Diff line number Diff line
@@ -171,6 +171,8 @@ import com.android.systemui.util.time.SystemClock;
import com.android.systemui.wallpapers.data.repository.WallpaperRepository;
import com.android.systemui.wallpapers.data.repository.WallpaperRepository;
import com.android.wm.shell.keyguard.KeyguardTransitions;
import com.android.wm.shell.keyguard.KeyguardTransitions;


import dagger.Lazy;

import java.io.PrintWriter;
import java.io.PrintWriter;
import java.lang.annotation.Retention;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.RetentionPolicy;
@@ -180,7 +182,8 @@ import java.util.Objects;
import java.util.concurrent.Executor;
import java.util.concurrent.Executor;
import java.util.function.Consumer;
import java.util.function.Consumer;


import dagger.Lazy;


import kotlinx.coroutines.CoroutineDispatcher;
import kotlinx.coroutines.CoroutineDispatcher;


/**
/**
@@ -1933,11 +1936,7 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
    public void onDreamingStarted() {
    public void onDreamingStarted() {
        mUpdateMonitor.dispatchDreamingStarted();
        mUpdateMonitor.dispatchDreamingStarted();
        synchronized (this) {
        synchronized (this) {
            final boolean alwaysShowKeyguard =
            if (mDeviceInteractive) {
                mFeatureFlags.isEnabled(Flags.LOCKSCREEN_WITHOUT_SECURE_LOCK_WHEN_DREAMING);
            if (mDeviceInteractive
                && (alwaysShowKeyguard ||
                mLockPatternUtils.isSecure(KeyguardUpdateMonitor.getCurrentUser()))) {
                doKeyguardLaterLocked();
                doKeyguardLaterLocked();
            }
            }
        }
        }
+0 −26
Original line number Original line Diff line number Diff line
@@ -16,7 +16,6 @@


package com.android.systemui.keyguard;
package com.android.systemui.keyguard;


import static android.os.PowerManager.WAKE_REASON_WAKE_MOTION;
import static android.provider.Settings.Secure.LOCK_SCREEN_LOCK_AFTER_TIMEOUT;
import static android.provider.Settings.Secure.LOCK_SCREEN_LOCK_AFTER_TIMEOUT;
import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_GOING_AWAY;
import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_GOING_AWAY;
import static android.view.WindowManagerPolicyConstants.OFF_BECAUSE_OF_TIMEOUT;
import static android.view.WindowManagerPolicyConstants.OFF_BECAUSE_OF_TIMEOUT;
@@ -634,29 +633,6 @@ public class KeyguardViewMediatorTest extends SysuiTestCase {
        assertEquals(DELAYED_KEYGUARD_ACTION, pendingIntent.getValue().getIntent().getAction());
        assertEquals(DELAYED_KEYGUARD_ACTION, pendingIntent.getValue().getIntent().getAction());
    }
    }


    @Test
    public void lockAfterSpecifiedAfterDreamStarted() {
        int currentUserId = 99;
        int userSpecificTimeout = 5999;
        KeyguardUpdateMonitor.setCurrentUser(currentUserId);

        // set mDeviceInteractive to true
        mViewMediator.onStartedWakingUp(WAKE_REASON_WAKE_MOTION, false);
        mFeatureFlags.set(Flags.LOCKSCREEN_WITHOUT_SECURE_LOCK_WHEN_DREAMING, false);
        when(mLockPatternUtils.isSecure(currentUserId)).thenReturn(true);
        when(mDevicePolicyManager.getMaximumTimeToLock(null, currentUserId)).thenReturn(0L);
        when(mSecureSettings.getIntForUser(LOCK_SCREEN_LOCK_AFTER_TIMEOUT,
                KEYGUARD_LOCK_AFTER_DELAY_DEFAULT, currentUserId)).thenReturn(userSpecificTimeout);
        mSystemClock.setElapsedRealtime(0L);
        ArgumentCaptor<PendingIntent> pendingIntent = ArgumentCaptor.forClass(PendingIntent.class);

        mViewMediator.onDreamingStarted();

        verify(mAlarmManager).setExactAndAllowWhileIdle(eq(AlarmManager.ELAPSED_REALTIME_WAKEUP),
                eq(Long.valueOf(userSpecificTimeout)), pendingIntent.capture());
        assertEquals(DELAYED_KEYGUARD_ACTION, pendingIntent.getValue().getIntent().getAction());
    }

    @Test
    @Test
    public void testHideSurfaceBehindKeyguardMarksKeyguardNotGoingAway() {
    public void testHideSurfaceBehindKeyguardMarksKeyguardNotGoingAway() {
        mViewMediator.hideSurfaceBehindKeyguard();
        mViewMediator.hideSurfaceBehindKeyguard();
@@ -1023,7 +999,6 @@ public class KeyguardViewMediatorTest extends SysuiTestCase {
        mViewMediator.setShowingLocked(false);
        mViewMediator.setShowingLocked(false);
        when(mKeyguardStateController.isShowing()).thenReturn(false);
        when(mKeyguardStateController.isShowing()).thenReturn(false);


        mFeatureFlags.set(Flags.LOCKSCREEN_WITHOUT_SECURE_LOCK_WHEN_DREAMING, false);
        mViewMediator.onDreamingStarted();
        mViewMediator.onDreamingStarted();
        assertFalse(mViewMediator.isShowingAndNotOccluded());
        assertFalse(mViewMediator.isShowingAndNotOccluded());
    }
    }
@@ -1034,7 +1009,6 @@ public class KeyguardViewMediatorTest extends SysuiTestCase {
        mViewMediator.setShowingLocked(true);
        mViewMediator.setShowingLocked(true);
        when(mKeyguardStateController.isShowing()).thenReturn(true);
        when(mKeyguardStateController.isShowing()).thenReturn(true);


        mFeatureFlags.set(Flags.LOCKSCREEN_WITHOUT_SECURE_LOCK_WHEN_DREAMING, true);
        mViewMediator.onDreamingStarted();
        mViewMediator.onDreamingStarted();
        assertTrue(mViewMediator.isShowingAndNotOccluded());
        assertTrue(mViewMediator.isShowingAndNotOccluded());
    }
    }