1 /* 2 * Copyright 2019 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.car.settings.applications.specialaccess; 18 19 import android.Manifest; 20 import android.app.AppOpsManager; 21 import android.content.Context; 22 23 import androidx.annotation.XmlRes; 24 25 import com.android.car.settings.R; 26 import com.android.car.settings.applications.AppListFragment; 27 28 /** 29 * Displays apps which have requested to modify system settings and their current allowed status. 30 */ 31 public class ModifySystemSettingsFragment extends AppListFragment { 32 33 @Override 34 @XmlRes getPreferenceScreenResId()35 protected int getPreferenceScreenResId() { 36 return R.xml.modify_system_settings_fragment; 37 } 38 39 @Override onAttach(Context context)40 public void onAttach(Context context) { 41 super.onAttach(context); 42 use(AppOpsPreferenceController.class, R.string.pk_modify_system_settings).init( 43 AppOpsManager.OP_WRITE_SETTINGS, 44 Manifest.permission.WRITE_SETTINGS, 45 AppOpsManager.MODE_ERRORED); 46 } 47 48 @Override onToggleShowSystemApps(boolean showSystem)49 protected void onToggleShowSystemApps(boolean showSystem) { 50 use(AppOpsPreferenceController.class, R.string.pk_modify_system_settings).setShowSystem( 51 showSystem); 52 } 53 } 54