summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Weaver <pweaver@google.com>2017-08-19 01:09:28 (GMT)
committerDan Pasanen <dan.pasanen@gmail.com>2017-11-15 20:40:35 (GMT)
commitce6a4621a549b27f7566f4f9525788b2c5fb4c17 (patch)
treeaf57313c8dd91813a4e0c484cd490fa1e3ed1d6d
parent4b0c302eae8d772d09346718559cc42548485f75 (diff)
downloadandroid_packages_apps_PackageInstaller-ce6a4621a549b27f7566f4f9525788b2c5fb4c17.zip
android_packages_apps_PackageInstaller-ce6a4621a549b27f7566f4f9525788b2c5fb4c17.tar.gz
android_packages_apps_PackageInstaller-ce6a4621a549b27f7566f4f9525788b2c5fb4c17.tar.bz2
Backport overlay security fix
Replacing app opps fix with the flag that is used elsewhere. Bug: 37442941 Test: Verified that toast and system overlay still goes away on permission and a11y service capability screens. Merged-In: I27d357b2aa61193380b7ef1dcc88bbac9553644e Change-Id: Ib7a7251109ed0f125db2bd49f5fc0baa67207b5d (cherry picked from commit bb1948fe1a3fa2ca93f508af2e97f5ec21e71ade)
-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);
}
}