Add padlocks to more preferences that can be disabled by policy.

Change-Id: I7cc999dd1d46c20c888e0ba67053564e4d50946b
This commit is contained in:
Sudheer Shanka
2016-01-18 11:17:23 +00:00
parent 4ccc2c3537
commit 9c32468cd5
12 changed files with 149 additions and 49 deletions

View File

@@ -20,11 +20,16 @@ import android.content.Context;
import android.graphics.drawable.Drawable;
import android.support.v7.preference.Preference;
import com.android.settingslib.RestrictedLockUtils;
import com.android.settingslib.RestrictedPreference;
import static com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
/**
* ProviderPreference is used to display an image to the left of a provider name.
* The preference ultimately calls AccountManager.addAccount() for the account type.
*/
public class ProviderPreference extends Preference {
public class ProviderPreference extends RestrictedPreference {
private String mAccountType;
public ProviderPreference(
@@ -39,4 +44,10 @@ public class ProviderPreference extends Preference {
public String getAccountType() {
return mAccountType;
}
public void checkAccountManagementAndSetDisabled() {
EnforcedAdmin admin = RestrictedLockUtils.checkIfAccountManagementDisabled(
getContext(), getAccountType());
setDisabledByAdmin(admin);
}
}