Update Special App Access Compose Components for ECM
This is the first in a series of changes to wire up all app settings to
be ECM restrictable. We introduce a new method in
RestrictedLockUtilsInternal which determines whether or not a setting is
restricted based on a passed in key. It currently duplicates the current
implementation, but will eventually be replaced by a call to permissions
mainline.
The settings under SpaPrivileged are then updated to have a new
BlockedByEcm which is decided by the RestrictedLockUtilsInternal call.
Bug: 297372999
Test: Manually tested on device. Automaated tests to follow
Change-Id: Ic295bdb41270b0f18f2ba3dffdffc062d532cabe
diff --git a/src/com/android/settings/spa/app/specialaccess/AlarmsAndRemindersAppList.kt b/src/com/android/settings/spa/app/specialaccess/AlarmsAndRemindersAppList.kt
index c990927..3e48aa5 100644
--- a/src/com/android/settings/spa/app/specialaccess/AlarmsAndRemindersAppList.kt
+++ b/src/com/android/settings/spa/app/specialaccess/AlarmsAndRemindersAppList.kt
@@ -18,6 +18,7 @@
import android.Manifest
import android.app.AlarmManager
+import android.app.AppOpsManager
import android.app.compat.CompatChanges
import android.app.settings.SettingsEnums
import android.content.Context
@@ -56,6 +57,7 @@
override val pageTitleResId = R.string.alarms_and_reminders_title
override val switchTitleResId = R.string.alarms_and_reminders_switch_title
override val footerResId = R.string.alarms_and_reminders_footer_title
+ override val enhancedConfirmationKey: String = AppOpsManager.OPSTR_SCHEDULE_EXACT_ALARM
override fun transform(userIdFlow: Flow<Int>, appListFlow: Flow<List<ApplicationInfo>>) =
userIdFlow.map { userId ->
diff --git a/src/com/android/settings/spa/app/specialaccess/InstallUnknownApps.kt b/src/com/android/settings/spa/app/specialaccess/InstallUnknownApps.kt
index 7f63e38..dc98330 100644
--- a/src/com/android/settings/spa/app/specialaccess/InstallUnknownApps.kt
+++ b/src/com/android/settings/spa/app/specialaccess/InstallUnknownApps.kt
@@ -18,6 +18,7 @@
import android.Manifest
import android.app.AppGlobals
+import android.app.AppOpsManager
import android.app.AppOpsManager.MODE_DEFAULT
import android.app.AppOpsManager.OP_REQUEST_INSTALL_PACKAGES
import android.content.Context
@@ -55,6 +56,7 @@
UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES,
UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES_GLOBALLY,
)
+ override val enhancedConfirmationKey: String = AppOpsManager.OPSTR_REQUEST_INSTALL_PACKAGES
override fun transformItem(app: ApplicationInfo) =
InstallUnknownAppsRecord(
diff --git a/src/com/android/settings/spa/app/specialaccess/PictureInPicture.kt b/src/com/android/settings/spa/app/specialaccess/PictureInPicture.kt
index cd615919..fe8f103 100644
--- a/src/com/android/settings/spa/app/specialaccess/PictureInPicture.kt
+++ b/src/com/android/settings/spa/app/specialaccess/PictureInPicture.kt
@@ -16,6 +16,7 @@
package com.android.settings.spa.app.specialaccess
+import android.app.AppOpsManager
import android.app.AppOpsManager.OP_PICTURE_IN_PICTURE
import android.content.Context
import android.content.pm.ActivityInfo
@@ -53,6 +54,7 @@
override val pageTitleResId = R.string.picture_in_picture_title
override val switchTitleResId = R.string.picture_in_picture_app_detail_switch
override val footerResId = R.string.picture_in_picture_app_detail_summary
+ override val enhancedConfirmationKey: String = AppOpsManager.OPSTR_PICTURE_IN_PICTURE
private val packageManager = context.packageManager