Merge "Settings page to manage FSI permission"

This commit is contained in:
Lyn Han
2023-02-07 22:52:09 +00:00
committed by Android (Google) Code Review
7 changed files with 121 additions and 0 deletions

View File

@@ -31,6 +31,7 @@ import com.android.settings.spa.app.specialaccess.ModifySystemSettingsAppListPro
import com.android.settings.spa.app.specialaccess.PictureInPictureListProvider
import com.android.settings.spa.app.specialaccess.SpecialAppAccessPageProvider
import com.android.settings.spa.app.specialaccess.WifiControlAppListProvider
import com.android.settings.spa.app.specialaccess.UseFullScreenIntentAppListProvider
import com.android.settings.spa.development.UsageStatsPageProvider
import com.android.settings.spa.home.HomePageProvider
import com.android.settings.spa.notification.AppListNotificationsPageProvider
@@ -51,6 +52,7 @@ open class SettingsSpaEnvironment(context: Context) : SpaEnvironment(context) {
DisplayOverOtherAppsAppListProvider,
MediaManagementAppsAppListProvider,
ModifySystemSettingsAppListProvider,
UseFullScreenIntentAppListProvider,
PictureInPictureListProvider,
InstallUnknownAppsListProvider,
AlarmsAndRemindersAppListProvider,

View File

@@ -60,6 +60,7 @@ object SpecialAppAccessPageProvider : SettingsPageProvider {
DisplayOverOtherAppsAppListProvider,
MediaManagementAppsAppListProvider,
ModifySystemSettingsAppListProvider,
UseFullScreenIntentAppListProvider,
PictureInPictureListProvider,
InstallUnknownAppsListProvider,
AlarmsAndRemindersAppListProvider,

View File

@@ -0,0 +1,38 @@
/*
* Copyright (C) 2023 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 UseFullScreenIntentAppListProvider : TogglePermissionAppListProvider {
override val permissionType = "UseFullScreenIntent"
override fun createModel(context: Context) = UseFullScreenIntentListModel(context)
}
class UseFullScreenIntentListModel(context: Context) : AppOpPermissionListModel(context) {
override val pageTitleResId = R.string.full_screen_intent_title
override val switchTitleResId = R.string.permit_full_screen_intent
override val footerResId = R.string.footer_description_full_screen_intent
override val appOp = AppOpsManager.OP_USE_FULL_SCREEN_INTENT
override val permission = Manifest.permission.USE_FULL_SCREEN_INTENT
override val setModeByUid = true
}

View File

@@ -0,0 +1,47 @@
/*
* Copyright (C) 2023 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.content.Context;
import android.os.Build;
import android.text.TextUtils;
import androidx.preference.Preference;
import com.android.settings.core.BasePreferenceController;
import com.android.settings.spa.SpaActivity;
public class UseFullScreenIntentPreferenceController extends BasePreferenceController {
public UseFullScreenIntentPreferenceController(Context context, String preferenceKey) {
super(context, preferenceKey);
}
@Override
public int getAvailabilityStatus() {
return AVAILABLE;
}
@Override
public boolean handlePreferenceTreeClick(Preference preference) {
if (TextUtils.equals(preference.getKey(), mPreferenceKey)) {
SpaActivity.startSpaActivity(
mContext, UseFullScreenIntentAppListProvider.INSTANCE.getAppListRoute());
return true;
}
return false;
}
}