Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 291e6043 authored by Hani Kazmi's avatar Hani Kazmi
Browse files

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
parent 62702e3c
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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<Int>, appListFlow: Flow<List<ApplicationInfo>>) =
        userIdFlow.map { userId ->
+2 −0
Original line number Diff line number Diff line
@@ -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(
+2 −0
Original line number Diff line number Diff line
@@ -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