Application restrictions UI
Refactored User Settings UI to have two types of users. Display a list of apps to select. Edit user restrictions. Handle saving and updating RestrictionEntry items via User Manager. Change-Id: I3ad5aa71d5ef66dffd39e17ba0556f075ac10a0f
This commit is contained in:
@@ -22,6 +22,7 @@ import android.accounts.OnAccountsUpdateListener;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.RestrictionEntry;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
@@ -56,6 +57,7 @@ import com.android.settings.accounts.AuthenticatorHelper;
|
||||
import com.android.settings.accounts.ManageAccountsSettings;
|
||||
import com.android.settings.bluetooth.BluetoothEnabler;
|
||||
import com.android.settings.bluetooth.BluetoothSettings;
|
||||
import com.android.settings.users.RestrictionsReceiver;
|
||||
import com.android.settings.wfd.WifiDisplaySettings;
|
||||
import com.android.settings.wifi.WifiEnabler;
|
||||
import com.android.settings.wifi.WifiSettings;
|
||||
@@ -133,12 +135,16 @@ public class Settings extends PreferenceActivity
|
||||
private Header mLastHeader;
|
||||
private boolean mListeningToAccountUpdates;
|
||||
|
||||
private List<RestrictionEntry> mAppRestrictions;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
if (getIntent().hasExtra(EXTRA_UI_OPTIONS)) {
|
||||
getWindow().setUiOptions(getIntent().getIntExtra(EXTRA_UI_OPTIONS, 0));
|
||||
}
|
||||
|
||||
mAppRestrictions = getApplicationRestrictions();
|
||||
|
||||
mAuthenticatorHelper = new AuthenticatorHelper();
|
||||
mAuthenticatorHelper.updateAuthDescriptions(this);
|
||||
mAuthenticatorHelper.onAccountsUpdated(this, null);
|
||||
@@ -408,7 +414,6 @@ public class Settings extends PreferenceActivity
|
||||
DevelopmentSettings.PREF_SHOW,
|
||||
android.os.Build.TYPE.equals("eng"));
|
||||
int i = 0;
|
||||
|
||||
mHeaderIndexMap.clear();
|
||||
while (i < target.size()) {
|
||||
Header header = target.get(i);
|
||||
@@ -450,6 +455,15 @@ public class Settings extends PreferenceActivity
|
||||
if (!showDev) {
|
||||
target.remove(i);
|
||||
}
|
||||
} else if (id == R.id.application_settings) {
|
||||
if (mAppRestrictions != null) {
|
||||
for (RestrictionEntry entry : mAppRestrictions) {
|
||||
if (entry.key.equals(RestrictionsReceiver.KEY_ENABLE_APPS)
|
||||
&& !entry.getBooleanValue()) {
|
||||
target.remove(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (i < target.size() && target.get(i) == header
|
||||
@@ -828,4 +842,5 @@ public class Settings extends PreferenceActivity
|
||||
public static class WifiDisplaySettingsActivity extends Settings { /* empty */ }
|
||||
public static class DreamSettingsActivity extends Settings { /* empty */ }
|
||||
public static class NotificationStationActivity extends Settings { /* empty */ }
|
||||
public static class UserSettingsActivity extends Settings { /* empty */ }
|
||||
}
|
||||
|
Reference in New Issue
Block a user