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

Commit 186eb66c authored by Chaohui Wang's avatar Chaohui Wang
Browse files

Add 4 app op permission App List

- All files access
- Display over other apps
- Media management apps
- Modify system settings

Bug: 235727273
Test: Manual with Settings App
Change-Id: I60abb44558f535d5e26d498164d5429ede4033f8
parent 7f82ea18
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -17,7 +17,11 @@
package com.android.settings.spa

import com.android.settings.spa.app.AppsMainPageProvider
import com.android.settings.spa.app.specialaccess.AllFilesAccessAppListProvider
import com.android.settings.spa.app.specialaccess.DisplayOverOtherAppsAppListProvider
import com.android.settings.spa.app.specialaccess.InstallUnknownAppsListProvider
import com.android.settings.spa.app.specialaccess.MediaManagementAppsAppListProvider
import com.android.settings.spa.app.specialaccess.ModifySystemSettingsAppListProvider
import com.android.settings.spa.app.specialaccess.PictureInPictureListProvider
import com.android.settings.spa.app.specialaccess.SpecialAppAccessPageProvider
import com.android.settings.spa.home.HomePageProvider
@@ -33,6 +37,10 @@ object SpaEnvironment {
    lazy(LazyThreadSafetyMode.SYNCHRONIZED) {
        val togglePermissionAppListTemplate = TogglePermissionAppListTemplate(
            allProviders = listOf(
                AllFilesAccessAppListProvider,
                DisplayOverOtherAppsAppListProvider,
                MediaManagementAppsAppListProvider,
                ModifySystemSettingsAppListProvider,
                InstallUnknownAppsListProvider,
                PictureInPictureListProvider,
            ),
+37 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2022 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.settings.spa.app.specialaccess

import android.Manifest
import android.app.AppOpsManager
import android.content.Context
import com.android.settings.R
import com.android.settingslib.spaprivileged.template.app.AppOpPermissionListModel
import com.android.settingslib.spaprivileged.template.app.TogglePermissionAppListProvider

object AllFilesAccessAppListProvider : TogglePermissionAppListProvider {
    override val permissionType = "AllFilesAccess"
    override fun createModel(context: Context) = AllFilesAccessListModel(context)
}

class AllFilesAccessListModel(context: Context) : AppOpPermissionListModel(context) {
    override val pageTitleResId = R.string.manage_external_storage_title
    override val switchTitleResId = R.string.permit_manage_external_storage
    override val footerResId = R.string.allow_manage_external_storage_description
    override val appOp = AppOpsManager.OP_MANAGE_EXTERNAL_STORAGE
    override val permission = Manifest.permission.MANAGE_EXTERNAL_STORAGE
}
+37 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2022 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.settings.spa.app.specialaccess

import android.Manifest
import android.app.AppOpsManager
import android.content.Context
import com.android.settings.R
import com.android.settingslib.spaprivileged.template.app.AppOpPermissionListModel
import com.android.settingslib.spaprivileged.template.app.TogglePermissionAppListProvider

object DisplayOverOtherAppsAppListProvider : TogglePermissionAppListProvider {
    override val permissionType = "DisplayOverOtherApps"
    override fun createModel(context: Context) = DisplayOverOtherAppsListModel(context)
}

class DisplayOverOtherAppsListModel(context: Context) : AppOpPermissionListModel(context) {
    override val pageTitleResId = R.string.system_alert_window_settings
    override val switchTitleResId = R.string.permit_draw_overlay
    override val footerResId = R.string.allow_overlay_description
    override val appOp = AppOpsManager.OP_SYSTEM_ALERT_WINDOW
    override val permission = Manifest.permission.SYSTEM_ALERT_WINDOW
}
+37 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2022 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.settings.spa.app.specialaccess

import android.Manifest
import android.app.AppOpsManager
import android.content.Context
import com.android.settings.R
import com.android.settingslib.spaprivileged.template.app.AppOpPermissionListModel
import com.android.settingslib.spaprivileged.template.app.TogglePermissionAppListProvider

object MediaManagementAppsAppListProvider : TogglePermissionAppListProvider {
    override val permissionType = "MediaManagementApps"
    override fun createModel(context: Context) = MediaManagementAppsListModel(context)
}

class MediaManagementAppsListModel(context: Context) : AppOpPermissionListModel(context) {
    override val pageTitleResId = R.string.media_management_apps_title
    override val switchTitleResId = R.string.media_management_apps_toggle_label
    override val footerResId = R.string.media_management_apps_description
    override val appOp = AppOpsManager.OP_MANAGE_MEDIA
    override val permission = Manifest.permission.MANAGE_MEDIA
}
 No newline at end of file
+37 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2022 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.settings.spa.app.specialaccess

import android.Manifest
import android.app.AppOpsManager
import android.content.Context
import com.android.settings.R
import com.android.settingslib.spaprivileged.template.app.AppOpPermissionListModel
import com.android.settingslib.spaprivileged.template.app.TogglePermissionAppListProvider

object ModifySystemSettingsAppListProvider : TogglePermissionAppListProvider {
    override val permissionType = "ModifySystemSettings"
    override fun createModel(context: Context) = ModifySystemSettingsListModel(context)
}

class ModifySystemSettingsListModel(context: Context) : AppOpPermissionListModel(context) {
    override val pageTitleResId = R.string.write_system_settings
    override val switchTitleResId = R.string.permit_write_settings
    override val footerResId = R.string.write_settings_description
    override val appOp = AppOpsManager.OP_WRITE_SETTINGS
    override val permission = Manifest.permission.WRITE_SETTINGS
}
 No newline at end of file
Loading