Bug: 35415714 Test: make RunSettingsRoboTests Change-Id: I48d6d094476c5fc83dbc17906d84cc848e499624
47 lines
1.4 KiB
Java
47 lines
1.4 KiB
Java
/*
|
|
* 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;
|
|
}
|
|
}
|