diff options
author | Anton Philippov <philippov@google.com> | 2017-03-07 15:52:42 +0000 |
---|---|---|
committer | Anton Philippov <philippov@google.com> | 2017-03-07 16:37:36 +0000 |
commit | 66084a53684099dbd441f3b294f3a8a28911865b (patch) | |
tree | 1c604ca7ab56da3845c8fff427c085cfd208b1a9 /src/com/android/settings/system/FactoryResetPreferenceController.java | |
parent | 01b721ee1182ddb3959c8cf25d40829cbc09cace (diff) | |
download | packages_apps_Settings-66084a53684099dbd441f3b294f3a8a28911865b.tar.gz packages_apps_Settings-66084a53684099dbd441f3b294f3a8a28911865b.tar.bz2 packages_apps_Settings-66084a53684099dbd441f3b294f3a8a28911865b.zip |
Hide "Factory reset" item for secondary users
Bug: 35415714
Test: make RunSettingsRoboTests
Change-Id: I48d6d094476c5fc83dbc17906d84cc848e499624
Diffstat (limited to 'src/com/android/settings/system/FactoryResetPreferenceController.java')
-rw-r--r-- | src/com/android/settings/system/FactoryResetPreferenceController.java | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/com/android/settings/system/FactoryResetPreferenceController.java b/src/com/android/settings/system/FactoryResetPreferenceController.java new file mode 100644 index 0000000000..95a9e5494c --- /dev/null +++ b/src/com/android/settings/system/FactoryResetPreferenceController.java @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2017 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.system; + +import android.content.Context; + +import android.os.UserManager; + +import com.android.settings.R; +import com.android.settings.core.PreferenceController; + +public class FactoryResetPreferenceController extends PreferenceController { + /** Key of the "Factory reset" preference in {@link R.xml.system_dashboard_fragment}.*/ + private static final String KEY_FACTORY_RESET = "factory_reset"; + + private final UserManager mUm; + + public FactoryResetPreferenceController(Context context, UserManager um) { + super(context); + mUm = um; + } + + /** Hide "Factory reset" settings for secondary users. */ + @Override + public boolean isAvailable() { + return mUm.isAdminUser(); + } + + @Override + public String getPreferenceKey() { + return KEY_FACTORY_RESET; + } +} |