From 291e6043bfd36d92322cfdbecf98ee100fe5c5e0 Mon Sep 17 00:00:00 2001 From: Hani Kazmi Date: Thu, 26 Oct 2023 13:08:39 +0000 Subject: [PATCH] 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 --- .../settings/spa/app/specialaccess/AlarmsAndRemindersAppList.kt | 2 ++ .../settings/spa/app/specialaccess/InstallUnknownApps.kt | 2 ++ .../android/settings/spa/app/specialaccess/PictureInPicture.kt | 2 ++ 3 files changed, 6 insertions(+) diff --git a/src/com/android/settings/spa/app/specialaccess/AlarmsAndRemindersAppList.kt b/src/com/android/settings/spa/app/specialaccess/AlarmsAndRemindersAppList.kt index c99092720f0..3e48aa5b4c9 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 @@ package com.android.settings.spa.app.specialaccess 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 @@ class AlarmsAndRemindersAppListModel( 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, appListFlow: Flow>) = 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 7f63e3898cb..dc983307197 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 @@ package com.android.settings.spa.app.specialaccess 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 @@ class InstallUnknownAppsListModel(private val context: Context) : 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 cd615919fe3..fe8f1031268 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 @@ class PictureInPictureListModel(private val context: Context) : 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