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

Commit d052bc04 authored by Matt Pietal's avatar Matt Pietal
Browse files

Remove settings check for FLAG_SECURE disabling

Window manager handles all of this now at a lower level. No need
for additional logic.

Fixes: 375675418
Test: atest NotificationShadeWindowControllerImplTest
Flag: EXEMPT bugfix
Change-Id: I55f3256ec35dddd5514e53e0329a3cf96f643923
parent c86d8f05
Loading
Loading
Loading
Loading
+0 −20
Original line number Diff line number Diff line
@@ -41,7 +41,6 @@ import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.graphics.Rect;
import android.platform.test.flag.junit.FlagsParameterization;
import android.provider.Settings;
import android.testing.TestableLooper.RunWithLooper;
import android.view.View;
import android.view.WindowManager;
@@ -71,7 +70,6 @@ import com.android.systemui.statusbar.phone.ScrimController;
import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.user.domain.interactor.SelectedUserInteractor;
import com.android.systemui.util.settings.FakeSettings;

import com.google.common.util.concurrent.MoreExecutors;

@@ -113,7 +111,6 @@ public class NotificationShadeWindowControllerImplTest extends SysuiTestCase {
    @Captor private ArgumentCaptor<WindowManager.LayoutParams> mLayoutParameters;
    @Captor private ArgumentCaptor<StatusBarStateController.StateListener> mStateListener;

    private FakeSettings mSecureSettings;
    private final Executor mMainExecutor = MoreExecutors.directExecutor();
    private final Executor mBackgroundExecutor = MoreExecutors.directExecutor();
    private final KosmosJavaAdapter mKosmos = new KosmosJavaAdapter(this);
@@ -135,9 +132,6 @@ public class NotificationShadeWindowControllerImplTest extends SysuiTestCase {
    public void setUp() {
        MockitoAnnotations.initMocks(this);

        mSecureSettings = new FakeSettings();
        mSecureSettings.putInt(Settings.Secure.DISABLE_SECURE_WINDOWS, 0);

        // Preferred refresh rate is equal to the first displayMode's refresh rate
        mPreferredRefreshRate = mContext.getDisplay().getSystemSupportedModes()[0].getRefreshRate();
        overrideResource(
@@ -171,7 +165,6 @@ public class NotificationShadeWindowControllerImplTest extends SysuiTestCase {
                () -> mSelectedUserInteractor,
                mUserTracker,
                mKosmos.getNotificationShadeWindowModel(),
                mSecureSettings,
                mKosmos::getCommunalInteractor,
                mKosmos.getShadeLayoutParams());
        mNotificationShadeWindowController.setScrimsVisibilityListener((visibility) -> {});
@@ -354,19 +347,6 @@ public class NotificationShadeWindowControllerImplTest extends SysuiTestCase {
                .isTrue();
    }

    @Test
    public void setKeyguardShowingWithSecureWindowsDisabled_disablesSecureFlag() {
        mSecureSettings.putInt(Settings.Secure.DISABLE_SECURE_WINDOWS, 1);
        mNotificationShadeWindowController.setBouncerShowing(true);

        verify(mWindowManager).updateViewLayout(any(), mLayoutParameters.capture());
        assertThat((mLayoutParameters.getValue().flags & FLAG_SECURE) == 0).isTrue();
        assertThat(
                (mLayoutParameters.getValue().inputFeatures & INPUT_FEATURE_SENSITIVE_FOR_PRIVACY)
                        != 0)
                .isTrue();
    }

    @Test
    public void setKeyguardNotShowing_disablesSecureFlag() {
        mNotificationShadeWindowController.setBouncerShowing(false);
+1 −14
Original line number Diff line number Diff line
@@ -30,8 +30,6 @@ import android.graphics.Region;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.Trace;
import android.os.UserHandle;
import android.provider.Settings;
import android.util.Log;
import android.view.Display;
import android.view.IWindow;
@@ -75,7 +73,6 @@ import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener;
import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.user.domain.interactor.SelectedUserInteractor;
import com.android.systemui.util.settings.SecureSettings;

import dagger.Lazy;

@@ -134,7 +131,6 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW

    private final SysuiColorExtractor mColorExtractor;
    private final NotificationShadeWindowModel mNotificationShadeWindowModel;
    private final SecureSettings mSecureSettings;
    /**
     * Layout params would be aggregated and dispatched all at once if this is > 0.
     *
@@ -168,7 +164,6 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
            Lazy<SelectedUserInteractor> userInteractor,
            UserTracker userTracker,
            NotificationShadeWindowModel notificationShadeWindowModel,
            SecureSettings secureSettings,
            Lazy<CommunalInteractor> communalInteractor,
            @ShadeDisplayAware LayoutParams shadeWindowLayoutParams) {
        mContext = context;
@@ -186,7 +181,6 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
        mBackgroundExecutor = backgroundExecutor;
        mColorExtractor = colorExtractor;
        mNotificationShadeWindowModel = notificationShadeWindowModel;
        mSecureSettings = secureSettings;
        // prefix with {slow} to make sure this dumps at the END of the critical section.
        dumpManager.registerCriticalDumpable("{slow}NotificationShadeWindowControllerImpl", this);
        mAuthController = authController;
@@ -424,7 +418,7 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
                    (long) mLpChanged.preferredMaxDisplayRefreshRate);
        }

        if (state.bouncerShowing && !isSecureWindowsDisabled()) {
        if (state.bouncerShowing) {
            mLpChanged.flags |= LayoutParams.FLAG_SECURE;
        } else {
            mLpChanged.flags &= ~LayoutParams.FLAG_SECURE;
@@ -437,13 +431,6 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
        }
    }

    private boolean isSecureWindowsDisabled() {
        return mSecureSettings.getIntForUser(
            Settings.Secure.DISABLE_SECURE_WINDOWS,
            0,
            UserHandle.USER_CURRENT) == 1;
    }

    private void adjustScreenOrientation(NotificationShadeWindowState state) {
        if (state.bouncerShowing || state.isKeyguardShowingAndNotOccluded() || state.dozing) {
            if (mKeyguardStateController.isKeyguardScreenRotationAllowed()) {
+0 −1
Original line number Diff line number Diff line
@@ -283,7 +283,6 @@ public class KeyguardViewMediatorTest extends SysuiTestCase {
                () -> mSelectedUserInteractor,
                mock(UserTracker.class),
                mKosmos.getNotificationShadeWindowModel(),
                mSecureSettings,
                mKosmos::getCommunalInteractor,
                mKosmos.getShadeLayoutParams());
        mFeatureFlags = new FakeFeatureFlags();
+2 −5
Original line number Diff line number Diff line
@@ -33,6 +33,8 @@ import static com.android.wm.shell.Flags.FLAG_ENABLE_BUBBLE_BAR;

import static com.google.common.truth.Truth.assertThat;

import static kotlinx.coroutines.flow.StateFlowKt.MutableStateFlow;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
@@ -55,8 +57,6 @@ import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;

import static kotlinx.coroutines.flow.StateFlowKt.MutableStateFlow;

import android.app.ActivityManager;
import android.app.IActivityManager;
import android.app.INotificationManager;
@@ -136,7 +136,6 @@ import com.android.systemui.statusbar.RankingBuilder;
import com.android.systemui.statusbar.SysuiStatusBarStateController;
import com.android.systemui.statusbar.notification.NotifPipelineFlags;
import com.android.systemui.statusbar.notification.collection.GroupEntry;
import com.android.systemui.statusbar.notification.collection.GroupEntryBuilder;
import com.android.systemui.statusbar.notification.collection.NotifPipeline;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.collection.NotificationEntryBuilder;
@@ -166,7 +165,6 @@ import com.android.systemui.statusbar.policy.data.repository.FakeDeviceProvision
import com.android.systemui.user.domain.interactor.SelectedUserInteractor;
import com.android.systemui.util.FakeEventLog;
import com.android.systemui.util.settings.FakeGlobalSettings;
import com.android.systemui.util.settings.FakeSettings;
import com.android.systemui.util.settings.SystemSettings;
import com.android.systemui.util.time.SystemClock;
import com.android.wm.shell.Flags;
@@ -451,7 +449,6 @@ public class BubblesTest extends SysuiTestCase {
                () -> mSelectedUserInteractor,
                mUserTracker,
                mNotificationShadeWindowModel,
                new FakeSettings(),
                mKosmos::getCommunalInteractor,
                mKosmos.getShadeLayoutParams()
        );