RESTRICT AUTOMERGE
Don't allow tapjacking permissioncontroller

Use the filterTouchesWhenObscured attribute throughout the permission
controller.

Bug: 155287782
Test: Manual using PoC app from b/154015447#comment1
Change-Id: I205395fdcabe68055df15ce9414468a833a0807c
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 9c4bf5b..73bc297 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -49,7 +49,8 @@
             android:allowClearUserData="false"
             android:supportsRtl="true"
             android:defaultToDeviceProtectedStorage="true"
-            android:directBootAware="true">
+            android:directBootAware="true"
+            android:theme="@style/FilterTouches">
 
         <provider
             android:name="androidx.lifecycle.ProcessLifecycleOwnerInitializer"
@@ -82,7 +83,7 @@
         <activity android:name="com.android.packageinstaller.permission.ui.GrantPermissionsActivity"
                 android:configChanges="keyboardHidden|screenSize"
                 android:excludeFromRecents="true"
-                android:theme="@style/GrantPermissions"
+                android:theme="@style/GrantPermissions.FilterTouches"
                 android:visibleToInstantApps="true"
                 android:inheritShowWhenLocked="true">
             <intent-filter android:priority="1">
@@ -94,7 +95,7 @@
         <activity android:name="com.android.packageinstaller.permission.ui.ManagePermissionsActivity"
                   android:configChanges="orientation|keyboardHidden|screenSize"
                   android:label="@string/app_permissions"
-                  android:theme="@style/Settings"
+                  android:theme="@style/Settings.FilterTouches"
                   android:permission="android.permission.GRANT_RUNTIME_PERMISSIONS">
             <intent-filter android:priority="1">
                 <action android:name="android.intent.action.MANAGE_APP_PERMISSIONS" />
@@ -125,7 +126,7 @@
 
         <activity android:name="com.android.packageinstaller.permission.ui.AppPermissionActivity"
                   android:configChanges="orientation|keyboardHidden|screenSize"
-                  android:theme="@style/Settings"
+                  android:theme="@style/Settings.FilterTouches"
                   android:permission="android.permission.GRANT_RUNTIME_PERMISSIONS">
             <intent-filter android:priority="1">
                 <action android:name="android.intent.action.MANAGE_APP_PERMISSION" />
@@ -135,7 +136,7 @@
 
         <activity android:name="com.android.packageinstaller.permission.ui.ReviewPermissionsActivity"
                   android:excludeFromRecents="true"
-                  android:theme="@style/ReviewPermissions"
+                  android:theme="@style/ReviewPermissions.FilterTouches"
                   android:permission="android.permission.GRANT_RUNTIME_PERMISSIONS">
             <intent-filter android:priority="1">
                 <action android:name="android.intent.action.REVIEW_PERMISSIONS" />
@@ -149,7 +150,7 @@
 
         <activity android:name="com.android.packageinstaller.permission.ui.LocationProviderInterceptDialog"
                   android:excludeFromRecents="true"
-                  android:theme="@style/PermissionDialog" />
+                  android:theme="@style/PermissionDialog.FilterTouches" />
 
         <activity android:name="com.android.packageinstaller.permission.ui.ReviewOngoingUsageActivity"
                   android:excludeFromRecents="true"
@@ -164,7 +165,7 @@
 
         <activity android:name="com.android.packageinstaller.permission.ui.ReviewAccessibilityServicesActivity"
                   android:excludeFromRecents="true"
-                  android:theme="@style/PermissionDialog"
+                  android:theme="@style/PermissionDialog.FilterTouches"
                   android:permission="android.permission.REVIEW_ACCESSIBILITY_SERVICES" >
             <intent-filter android:priority="1">
                 <action android:name="android.intent.action.REVIEW_ACCESSIBILITY_SERVICES" />
@@ -174,7 +175,7 @@
 
         <activity android:name="com.android.packageinstaller.role.ui.RequestRoleActivity"
                   android:excludeFromRecents="true"
-                  android:theme="@style/RequestRole">
+                  android:theme="@style/RequestRole.FilterTouches">
             <intent-filter android:priority="1">
                 <action android:name="android.app.role.action.REQUEST_ROLE" />
                 <category android:name="android.intent.category.DEFAULT" />
@@ -191,7 +192,7 @@
 
         <activity android:name="com.android.packageinstaller.role.ui.DefaultAppListActivity"
                   android:label="@string/default_apps"
-                  android:theme="@style/Settings">
+                  android:theme="@style/Settings.FilterTouches">
             <intent-filter android:priority="2">
                 <action android:name="android.settings.MANAGE_DEFAULT_APPS_SETTINGS" />
                 <category android:name="android.intent.category.DEFAULT" />
@@ -200,7 +201,7 @@
 
         <activity android:name="com.android.packageinstaller.role.ui.DefaultAppActivity"
                   android:permission="android.permission.MANAGE_ROLE_HOLDERS"
-                  android:theme="@style/Settings">
+                  android:theme="@style/Settings.FilterTouches">
             <intent-filter android:priority="1">
                 <action android:name="android.intent.action.MANAGE_DEFAULT_APP" />
                 <category android:name="android.intent.category.DEFAULT" />
@@ -220,7 +221,7 @@
         <activity android:name="com.android.packageinstaller.role.ui.SpecialAppAccessListActivity"
                   android:label="@string/special_app_access"
                   android:permission="android.permission.MANAGE_ROLE_HOLDERS"
-                  android:theme="@style/Settings">
+                  android:theme="@style/Settings.FilterTouches">
             <intent-filter android:priority="1">
                 <action android:name="android.intent.action.MANAGE_SPECIAL_APP_ACCESSES" />
                 <category android:name="android.intent.category.DEFAULT" />
@@ -229,7 +230,7 @@
 
         <!-- TODO: Override other Settings intents when we've done migrating them. -->
         <activity android:name="com.android.packageinstaller.role.ui.SpecialAppAccessActivity"
-                  android:theme="@style/Settings" />
+                  android:theme="@style/Settings.FilterTouches" />
 
         <activity android:name="com.android.packageinstaller.role.ui.RoleSearchTrampolineActivity"
                   android:excludeFromRecents="true"
diff --git a/res/values/themes.xml b/res/values/themes.xml
index 5db43f7..53cbaae 100644
--- a/res/values/themes.xml
+++ b/res/values/themes.xml
@@ -84,4 +84,32 @@
         <item name="preferenceFragmentListStyle">@style/CarPreferenceFragmentList</item>
     </style>
 
+
+
+<!-- Do not allow OEMs to overlay these themes.
+ Must Guarantee that filterTouches is set for these activities -->
+    <style name="FilterTouches">
+        <item name="android:filterTouchesWhenObscured">true</item>
+    </style>
+
+    <style name="Settings.FilterTouches">
+        <item name="android:filterTouchesWhenObscured">true</item>
+    </style>
+
+    <style name="ReviewPermissions.FilterTouches">
+        <item name="android:filterTouchesWhenObscured">true</item>
+    </style>
+
+    <style name="GrantPermissions.FilterTouches">
+        <item name="android:filterTouchesWhenObscured">true</item>
+    </style>
+
+    <style name="RequestRole.FilterTouches">
+        <item name="android:filterTouchesWhenObscured">true</item>
+    </style>
+
+    <style name="PermissionDialog.FilterTouches">
+        <item name="android:filterTouchesWhenObscured">true</item>
+    </style>
+
 </resources>