diff options
author | Yimin Li <ymli@google.com> | 2022-10-18 04:48:51 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-10-18 18:56:04 +0000 |
commit | 7d6c41b4b5a6078634e807d265df2578691dd22b (patch) | |
tree | 552979ef8fef4ae9a489f13710c071e38ae11375 | |
parent | 3a3063d4abc747ec2f49f7c7c3fa816e8b854d06 (diff) | |
download | base-7d6c41b4b5a6078634e807d265df2578691dd22b.tar.gz |
resolve Coastguard cherrypick merge conflict for change: 20218951
Change-Id: If04afb00b45e9fda054f46a23a9f59ab847015e4
(cherry picked from commit b4a6a0ce71520a19f50fa578d79832cb241fb753)
Merged-In: If04afb00b45e9fda054f46a23a9f59ab847015e4
2 files changed, 33 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowControllerImpl.java index 8c76a1bf4f83..787f9852c1f1 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowControllerImpl.java @@ -28,6 +28,7 @@ import android.content.Context; import android.content.pm.ActivityInfo; import android.graphics.PixelFormat; import android.os.Binder; +import android.os.Build; import android.os.RemoteException; import android.os.Trace; import android.util.Log; @@ -325,6 +326,16 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW Trace.setCounter("display_max_refresh_rate", (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) { diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationShadeWindowControllerImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationShadeWindowControllerImplTest.java index cb468108880a..88d951fd6a8b 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationShadeWindowControllerImplTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationShadeWindowControllerImplTest.java @@ -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; @@ -90,7 +91,12 @@ public class NotificationShadeWindowControllerImplTest extends SysuiTestCase { mWindowManager, mActivityManager, mDozeParameters, mStatusBarStateController, mConfigurationController, mKeyguardViewMediator, mKeyguardBypassController, mColorExtractor, mDumpManager, mKeyguardStateController, - mUnlockedScreenOffAnimationController, mAuthController); + mUnlockedScreenOffAnimationController, mAuthController) { + @Override + protected boolean isDebuggable() { + return false; + } + }; mNotificationShadeWindowController.setScrimsVisibilityListener((visibility) -> {}); mNotificationShadeWindowController.setNotificationShadeView(mNotificationShadeWindowView); @@ -238,5 +244,20 @@ public class NotificationShadeWindowControllerImplTest extends SysuiTestCase { verify(mWindowManager, never()).updateViewLayout(any(), any()); }); verify(mWindowManager).updateViewLayout(any(), any()); + + @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(); } } |