Use SYSTEM_... window manager flags

Test: Built
Bug: 116798569
Change-Id: Iac0728b348b6105b843d83415f0abde2de3cb074
This commit is contained in:
Philip P. Moltmann
2018-10-09 13:45:10 -07:00
parent 1e80322df8
commit fc9951091f
4 changed files with 10 additions and 10 deletions

View File

@@ -16,7 +16,7 @@
package com.android.settings.accessibility;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
import android.accessibilityservice.AccessibilityServiceInfo;
import android.app.Activity;
@@ -72,7 +72,7 @@ public class AccessibilityServiceWarning {
Window window = ad.getWindow();
WindowManager.LayoutParams params = window.getAttributes();
params.privateFlags |= PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
params.privateFlags |= SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
window.setAttributes(params);
ad.create();
ad.getButton(AlertDialog.BUTTON_POSITIVE).setOnTouchListener(filterTouchListener);

View File

@@ -15,7 +15,7 @@
*/
package com.android.settings.applications.appinfo;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
import android.app.AppOpsManager;
import android.content.Context;
@@ -83,7 +83,7 @@ public class DrawOverlayDetails extends AppInfoWithHeader implements OnPreferenc
@Override
public void onResume() {
super.onResume();
getActivity().getWindow().addPrivateFlags(PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
getActivity().getWindow().addSystemFlags(SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
}
@Override
@@ -91,7 +91,7 @@ public class DrawOverlayDetails extends AppInfoWithHeader implements OnPreferenc
super.onPause();
Window window = getActivity().getWindow();
WindowManager.LayoutParams attrs = window.getAttributes();
attrs.privateFlags &= ~PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
attrs.privateFlags &= ~SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
window.setAttributes(attrs);
}

View File

@@ -87,13 +87,13 @@ public class NotificationAccessConfirmationActivity extends Activity
public void onResume() {
super.onResume();
getWindow().addFlags(
WindowManager.LayoutParams.PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
}
@Override
public void onPause() {
getWindow().clearFlags(
WindowManager.LayoutParams.PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
super.onPause();
}

View File

@@ -16,7 +16,7 @@
package com.android.settings.applications.appinfo;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
import static org.junit.Assert.assertEquals;
import static org.mockito.Matchers.eq;
@@ -91,7 +91,7 @@ public class DrawOverlayDetailsTest {
when(mWindow.getAttributes()).thenReturn(layoutParams);
mFragment.onResume();
verify(mWindow).addPrivateFlags(PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
verify(mWindow).addSystemFlags(SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
mFragment.onPause();
@@ -99,6 +99,6 @@ public class DrawOverlayDetailsTest {
ArgumentCaptor<LayoutParams> paramCaptor = ArgumentCaptor.forClass(LayoutParams.class);
verify(mWindow).setAttributes(paramCaptor.capture());
assertEquals(0,
paramCaptor.getValue().privateFlags & PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
paramCaptor.getValue().privateFlags & SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
}
}