Merge "[DO NOT MERGE] Update window with FLAG_SECURE when bouncer is showing" into sc-dev
This commit is contained in:
@@ -28,6 +28,7 @@ import android.content.Context;
|
|||||||
import android.content.pm.ActivityInfo;
|
import android.content.pm.ActivityInfo;
|
||||||
import android.graphics.PixelFormat;
|
import android.graphics.PixelFormat;
|
||||||
import android.os.Binder;
|
import android.os.Binder;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.os.Trace;
|
import android.os.Trace;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@@ -319,6 +320,16 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
|||||||
Trace.setCounter("display_max_refresh_rate",
|
Trace.setCounter("display_max_refresh_rate",
|
||||||
(long) mLpChanged.preferredMaxDisplayRefreshRate);
|
(long) mLpChanged.preferredMaxDisplayRefreshRate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (state.mBouncerShowing && !isDebuggable()) {
|
||||||
|
mLpChanged.flags |= LayoutParams.FLAG_SECURE;
|
||||||
|
} else {
|
||||||
|
mLpChanged.flags &= ~LayoutParams.FLAG_SECURE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean isDebuggable() {
|
||||||
|
return Build.IS_DEBUGGABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void adjustScreenOrientation(State state) {
|
private void adjustScreenOrientation(State state) {
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ package com.android.systemui.statusbar.phone;
|
|||||||
|
|
||||||
import static android.view.WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
|
import static android.view.WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
|
||||||
import static android.view.WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
|
import static android.view.WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
|
||||||
|
import static android.view.WindowManager.LayoutParams.FLAG_SECURE;
|
||||||
import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
|
import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
@@ -89,7 +90,12 @@ public class NotificationShadeWindowControllerImplTest extends SysuiTestCase {
|
|||||||
mWindowManager, mActivityManager, mDozeParameters, mStatusBarStateController,
|
mWindowManager, mActivityManager, mDozeParameters, mStatusBarStateController,
|
||||||
mConfigurationController, mKeyguardViewMediator, mKeyguardBypassController,
|
mConfigurationController, mKeyguardViewMediator, mKeyguardBypassController,
|
||||||
mColorExtractor, mDumpManager, mKeyguardStateController,
|
mColorExtractor, mDumpManager, mKeyguardStateController,
|
||||||
mUnlockedScreenOffAnimationController, mAuthController);
|
mUnlockedScreenOffAnimationController, mAuthController) {
|
||||||
|
@Override
|
||||||
|
protected boolean isDebuggable() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
mNotificationShadeWindowController.setScrimsVisibilityListener((visibility) -> {});
|
mNotificationShadeWindowController.setScrimsVisibilityListener((visibility) -> {});
|
||||||
mNotificationShadeWindowController.setNotificationShadeView(mNotificationShadeWindowView);
|
mNotificationShadeWindowController.setNotificationShadeView(mNotificationShadeWindowView);
|
||||||
|
|
||||||
@@ -225,4 +231,20 @@ public class NotificationShadeWindowControllerImplTest extends SysuiTestCase {
|
|||||||
assertThat((mLayoutParameters.getValue().flags & FLAG_NOT_FOCUSABLE) != 0).isTrue();
|
assertThat((mLayoutParameters.getValue().flags & FLAG_NOT_FOCUSABLE) != 0).isTrue();
|
||||||
assertThat((mLayoutParameters.getValue().flags & FLAG_ALT_FOCUSABLE_IM) == 0).isTrue();
|
assertThat((mLayoutParameters.getValue().flags & FLAG_ALT_FOCUSABLE_IM) == 0).isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void setKeyguardShowing_enablesSecureFlag() {
|
||||||
|
mNotificationShadeWindowController.setBouncerShowing(true);
|
||||||
|
|
||||||
|
verify(mWindowManager).updateViewLayout(any(), mLayoutParameters.capture());
|
||||||
|
assertThat((mLayoutParameters.getValue().flags & FLAG_SECURE) != 0).isTrue();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void setKeyguardNotShowing_disablesSecureFlag() {
|
||||||
|
mNotificationShadeWindowController.setBouncerShowing(false);
|
||||||
|
|
||||||
|
verify(mWindowManager).updateViewLayout(any(), mLayoutParameters.capture());
|
||||||
|
assertThat((mLayoutParameters.getValue().flags & FLAG_SECURE) == 0).isTrue();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user