Fix to hide Display over other apps permission setting for the Scone

application.

Bug: 349195999
Test: manually testing that the setting is removed from Adaptive
Connectivity Services advanced settings page.

Change-Id: I3f306d24040f500c7fed4f44309e9f58f5f766be
Merged-In: I3f306d24040f500c7fed4f44309e9f58f5f766be
This commit is contained in:
Steve Statia
2024-06-27 00:22:07 +00:00
parent f1b3c2b9c9
commit 74670e4923
2 changed files with 14 additions and 0 deletions

View File

@@ -1517,4 +1517,8 @@
<item>2</item> <item>2</item>
</string-array> </string-array>
<!-- Packages that will not show Display over other apps permission -->
<string-array name="display_over_apps_permission_change_exempt" translatable="false">
</string-array>
</resources> </resources>

View File

@@ -44,6 +44,16 @@ class DisplayOverOtherAppsListModel(context: Context) : AppOpPermissionListModel
logPermissionChange(newAllowed) logPermissionChange(newAllowed)
} }
// TODO(b/349195999)
override fun isChangeable(record: AppOpPermissionRecord): Boolean {
if (record.app.packageName in
context.resources.getStringArray(R.array.display_over_apps_permission_change_exempt)
&& record.app.isSystemApp()) {
return false
}
return super.isChangeable(record)
}
private fun logPermissionChange(newAllowed: Boolean) { private fun logPermissionChange(newAllowed: Boolean) {
val category = when { val category = when {
newAllowed -> SettingsEnums.APP_SPECIAL_PERMISSION_APPDRAW_ALLOW newAllowed -> SettingsEnums.APP_SPECIAL_PERMISSION_APPDRAW_ALLOW