summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--AndroidManifest.xml1
-rw-r--r--src/com/android/packageinstaller/permission/ui/OverlayTouchActivity.java31
2 files changed, 7 insertions, 25 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index a5d682c..5fb0f5a 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -20,6 +20,7 @@
<uses-permission android:name="android.permission.KILL_UID" />
<uses-permission android:name="android.permission.MANAGE_APP_OPS_RESTRICTIONS" />
<uses-permission android:name="android.permission.INTERNET" />
+ <uses-permission android:name="android.permission.HIDE_NON_SYSTEM_OVERLAY_WINDOWS" />
<uses-permission android:name="com.google.android.permission.INSTALL_WEARABLE_PACKAGES" />
diff --git a/src/com/android/packageinstaller/permission/ui/OverlayTouchActivity.java b/src/com/android/packageinstaller/permission/ui/OverlayTouchActivity.java
index a7800ca..5e1e146 100644
--- a/src/com/android/packageinstaller/permission/ui/OverlayTouchActivity.java
+++ b/src/com/android/packageinstaller/permission/ui/OverlayTouchActivity.java
@@ -15,33 +15,14 @@
*/
package com.android.packageinstaller.permission.ui;
+import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
+
import android.app.Activity;
-import android.app.AppOpsManager;
-import android.os.Binder;
-import android.os.IBinder;
+import android.os.Bundle;
public class OverlayTouchActivity extends Activity {
- private final IBinder mToken = new Binder();
-
- @Override
- protected void onResume() {
- super.onResume();
- setOverlayAllowed(false);
- }
-
- @Override
- protected void onPause() {
- super.onPause();
- setOverlayAllowed(true);
- }
-
- private void setOverlayAllowed(boolean allowed) {
- AppOpsManager appOpsManager = getSystemService(AppOpsManager.class);
- if (appOpsManager != null) {
- appOpsManager.setUserRestriction(AppOpsManager.OP_SYSTEM_ALERT_WINDOW,
- !allowed, mToken);
- appOpsManager.setUserRestriction(AppOpsManager.OP_TOAST_WINDOW,
- !allowed, mToken);
- }
+ protected void onCreate(Bundle savedInstanceState) {
+ getWindow().addPrivateFlags(PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
+ super.onCreate(savedInstanceState);
}
}