[DO NOT MERGE] Update window with FLAG_SECURE when bouncer is showing am: bc2146966b
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19952038 Change-Id: I18ee62f32bf7c7364ad5e88643a6cd3ac7f8eb71 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -29,6 +29,7 @@ import android.content.pm.ActivityInfo;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.os.Binder;
|
||||
import android.os.Build;
|
||||
import android.os.RemoteException;
|
||||
import android.os.SystemProperties;
|
||||
import android.os.Trace;
|
||||
@@ -266,6 +267,16 @@ public class NotificationShadeWindowController implements Callback, Dumpable,
|
||||
}
|
||||
Trace.setCounter("display_mode_id", mLpChanged.preferredDisplayModeId);
|
||||
}
|
||||
|
||||
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) {
|
||||
|
||||
@@ -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_NOT_FOCUSABLE;
|
||||
import static android.view.WindowManager.LayoutParams.FLAG_SECURE;
|
||||
import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
@@ -83,7 +84,12 @@ public class NotificationShadeWindowControllerTest extends SysuiTestCase {
|
||||
mNotificationShadeWindowController = new NotificationShadeWindowController(mContext,
|
||||
mWindowManager, mActivityManager, mDozeParameters, mStatusBarStateController,
|
||||
mConfigurationController, mKeyguardViewMediator, mKeyguardBypassController,
|
||||
mColorExtractor, mDumpManager);
|
||||
mColorExtractor, mDumpManager) {
|
||||
@Override
|
||||
protected boolean isDebuggable() {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
mNotificationShadeWindowController.setNotificationShadeView(mNotificationShadeWindowView);
|
||||
|
||||
mNotificationShadeWindowController.attach();
|
||||
@@ -183,4 +189,20 @@ public class NotificationShadeWindowControllerTest extends SysuiTestCase {
|
||||
assertThat((mLayoutParameters.getValue().flags & FLAG_NOT_FOCUSABLE) != 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