Cleanup remaining USER_OWNER in Settings
Bug: 19913735 Change-Id: I6894a7c81ed7504b02d533d9e9f65f800dbca895
This commit is contained in:
@@ -70,8 +70,9 @@ public final class ActiveNetworkScorerDialog extends AlertActivity implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean buildDialog() {
|
private boolean buildDialog() {
|
||||||
if (UserHandle.myUserId() != UserHandle.USER_OWNER) {
|
// TOOD: http://b/23422763
|
||||||
Log.i(TAG, "Can only set scorer for owner user.");
|
if (UserHandle.myUserId() != UserHandle.USER_SYSTEM) {
|
||||||
|
Log.i(TAG, "Can only set scorer for owner/system user.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
NetworkScorerAppData newScorer = NetworkScorerAppManager.getScorer(this, mNewPackageName);
|
NetworkScorerAppData newScorer = NetworkScorerAppManager.getScorer(this, mNewPackageName);
|
||||||
|
@@ -193,7 +193,7 @@ public class PrivacySettings extends SettingsPreferenceFragment implements Index
|
|||||||
public PrivacySearchIndexProvider() {
|
public PrivacySearchIndexProvider() {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
mIsPrimary = UserHandle.myUserId() == UserHandle.USER_OWNER;
|
mIsPrimary = UserHandle.myUserId() == UserHandle.USER_SYSTEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -203,6 +203,7 @@ public class PrivacySettings extends SettingsPreferenceFragment implements Index
|
|||||||
List<SearchIndexableResource> result = new ArrayList<SearchIndexableResource>();
|
List<SearchIndexableResource> result = new ArrayList<SearchIndexableResource>();
|
||||||
|
|
||||||
// For non-primary user, no backup or reset is available
|
// For non-primary user, no backup or reset is available
|
||||||
|
// TODO: http://b/22388012
|
||||||
if (!mIsPrimary) {
|
if (!mIsPrimary) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@@ -26,6 +26,7 @@ import android.content.Context;
|
|||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
|
import android.content.pm.UserInfo;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
import android.net.NetworkInfo;
|
import android.net.NetworkInfo;
|
||||||
@@ -225,8 +226,7 @@ public class WirelessSettings extends SettingsPreferenceFragment implements Inde
|
|||||||
|
|
||||||
addPreferencesFromResource(R.xml.wireless_settings);
|
addPreferencesFromResource(R.xml.wireless_settings);
|
||||||
|
|
||||||
final int myUserId = UserHandle.myUserId();
|
final boolean isAdmin = mUm.isAdminUser();
|
||||||
final boolean isSecondaryUser = myUserId != UserHandle.USER_OWNER;
|
|
||||||
|
|
||||||
final Activity activity = getActivity();
|
final Activity activity = getActivity();
|
||||||
mAirplaneModePreference = (SwitchPreference) findPreference(KEY_TOGGLE_AIRPLANE);
|
mAirplaneModePreference = (SwitchPreference) findPreference(KEY_TOGGLE_AIRPLANE);
|
||||||
@@ -247,17 +247,17 @@ public class WirelessSettings extends SettingsPreferenceFragment implements Inde
|
|||||||
Settings.Global.AIRPLANE_MODE_TOGGLEABLE_RADIOS);
|
Settings.Global.AIRPLANE_MODE_TOGGLEABLE_RADIOS);
|
||||||
|
|
||||||
//enable/disable wimax depending on the value in config.xml
|
//enable/disable wimax depending on the value in config.xml
|
||||||
final boolean isWimaxEnabled = !isSecondaryUser && this.getResources().getBoolean(
|
final boolean isWimaxEnabled = isAdmin && this.getResources().getBoolean(
|
||||||
com.android.internal.R.bool.config_wimaxEnabled);
|
com.android.internal.R.bool.config_wimaxEnabled);
|
||||||
if (!isWimaxEnabled
|
if (!isWimaxEnabled
|
||||||
|| mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS)) {
|
|| mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS)) {
|
||||||
PreferenceScreen root = getPreferenceScreen();
|
PreferenceScreen root = getPreferenceScreen();
|
||||||
Preference ps = (Preference) findPreference(KEY_WIMAX_SETTINGS);
|
Preference ps = findPreference(KEY_WIMAX_SETTINGS);
|
||||||
if (ps != null) root.removePreference(ps);
|
if (ps != null) root.removePreference(ps);
|
||||||
} else {
|
} else {
|
||||||
if (toggleable == null || !toggleable.contains(Settings.Global.RADIO_WIMAX )
|
if (toggleable == null || !toggleable.contains(Settings.Global.RADIO_WIMAX )
|
||||||
&& isWimaxEnabled) {
|
&& isWimaxEnabled) {
|
||||||
Preference ps = (Preference) findPreference(KEY_WIMAX_SETTINGS);
|
Preference ps = findPreference(KEY_WIMAX_SETTINGS);
|
||||||
ps.setDependency(KEY_TOGGLE_AIRPLANE);
|
ps.setDependency(KEY_TOGGLE_AIRPLANE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -267,7 +267,8 @@ public class WirelessSettings extends SettingsPreferenceFragment implements Inde
|
|||||||
findPreference(KEY_VPN_SETTINGS).setDependency(KEY_TOGGLE_AIRPLANE);
|
findPreference(KEY_VPN_SETTINGS).setDependency(KEY_TOGGLE_AIRPLANE);
|
||||||
}
|
}
|
||||||
// Disable VPN.
|
// Disable VPN.
|
||||||
if (isSecondaryUser || mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_VPN)) {
|
// TODO: http://b/23693383
|
||||||
|
if (!isAdmin || mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_VPN)) {
|
||||||
removePreference(KEY_VPN_SETTINGS);
|
removePreference(KEY_VPN_SETTINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -292,7 +293,7 @@ public class WirelessSettings extends SettingsPreferenceFragment implements Inde
|
|||||||
|
|
||||||
// Remove Mobile Network Settings and Manage Mobile Plan for secondary users,
|
// Remove Mobile Network Settings and Manage Mobile Plan for secondary users,
|
||||||
// if it's a wifi-only device, or if the settings are restricted.
|
// if it's a wifi-only device, or if the settings are restricted.
|
||||||
if (isSecondaryUser || Utils.isWifiOnly(getActivity())
|
if (!isAdmin || Utils.isWifiOnly(getActivity())
|
||||||
|| mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS)) {
|
|| mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS)) {
|
||||||
removePreference(KEY_MOBILE_NETWORK_SETTINGS);
|
removePreference(KEY_MOBILE_NETWORK_SETTINGS);
|
||||||
removePreference(KEY_MANAGE_MOBILE_PLAN);
|
removePreference(KEY_MANAGE_MOBILE_PLAN);
|
||||||
@@ -324,7 +325,7 @@ public class WirelessSettings extends SettingsPreferenceFragment implements Inde
|
|||||||
// Disable Tethering if it's not allowed or if it's a wifi-only device
|
// Disable Tethering if it's not allowed or if it's a wifi-only device
|
||||||
final ConnectivityManager cm =
|
final ConnectivityManager cm =
|
||||||
(ConnectivityManager) activity.getSystemService(Context.CONNECTIVITY_SERVICE);
|
(ConnectivityManager) activity.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||||
if (isSecondaryUser || !cm.isTetheringSupported()
|
if (!isAdmin || !cm.isTetheringSupported()
|
||||||
|| mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_TETHERING)) {
|
|| mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_TETHERING)) {
|
||||||
getPreferenceScreen().removePreference(findPreference(KEY_TETHER_SETTINGS));
|
getPreferenceScreen().removePreference(findPreference(KEY_TETHER_SETTINGS));
|
||||||
} else {
|
} else {
|
||||||
@@ -349,7 +350,7 @@ public class WirelessSettings extends SettingsPreferenceFragment implements Inde
|
|||||||
} catch (IllegalArgumentException ignored) {
|
} catch (IllegalArgumentException ignored) {
|
||||||
isCellBroadcastAppLinkEnabled = false; // CMAS app not installed
|
isCellBroadcastAppLinkEnabled = false; // CMAS app not installed
|
||||||
}
|
}
|
||||||
if (isSecondaryUser || !isCellBroadcastAppLinkEnabled
|
if (!isAdmin || !isCellBroadcastAppLinkEnabled
|
||||||
|| mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_CELL_BROADCASTS)) {
|
|| mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_CELL_BROADCASTS)) {
|
||||||
PreferenceScreen root = getPreferenceScreen();
|
PreferenceScreen root = getPreferenceScreen();
|
||||||
Preference ps = findPreference(KEY_CELL_BROADCAST_SETTINGS);
|
Preference ps = findPreference(KEY_CELL_BROADCAST_SETTINGS);
|
||||||
|
@@ -24,8 +24,8 @@ import android.content.pm.PackageManager.NameNotFoundException;
|
|||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
|
import android.os.UserManager;
|
||||||
import android.preference.Preference;
|
import android.preference.Preference;
|
||||||
import android.preference.PreferenceActivity;
|
|
||||||
import android.telephony.CellBroadcastMessage;
|
import android.telephony.CellBroadcastMessage;
|
||||||
import android.telephony.PhoneNumberUtils;
|
import android.telephony.PhoneNumberUtils;
|
||||||
import android.telephony.PhoneStateListener;
|
import android.telephony.PhoneStateListener;
|
||||||
@@ -43,7 +43,6 @@ import com.android.internal.telephony.Phone;
|
|||||||
import com.android.internal.telephony.PhoneFactory;
|
import com.android.internal.telephony.PhoneFactory;
|
||||||
import com.android.settings.InstrumentedPreferenceActivity;
|
import com.android.settings.InstrumentedPreferenceActivity;
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.Utils;
|
|
||||||
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
@@ -53,7 +52,6 @@ import android.widget.TabHost.TabContentFactory;
|
|||||||
import android.widget.TabHost.TabSpec;
|
import android.widget.TabHost.TabSpec;
|
||||||
import android.widget.TabWidget;
|
import android.widget.TabWidget;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
@@ -379,9 +377,10 @@ public class SimStatus extends InstrumentedPreferenceActivity {
|
|||||||
|
|
||||||
private void updatePhoneInfos() {
|
private void updatePhoneInfos() {
|
||||||
if (mSir != null) {
|
if (mSir != null) {
|
||||||
|
// TODO: http://b/23763013
|
||||||
final Phone phone = PhoneFactory.getPhone(SubscriptionManager.getPhoneId(
|
final Phone phone = PhoneFactory.getPhone(SubscriptionManager.getPhoneId(
|
||||||
mSir.getSubscriptionId()));
|
mSir.getSubscriptionId()));
|
||||||
if (UserHandle.myUserId() == UserHandle.USER_OWNER
|
if (UserManager.get(this).isAdminUser()
|
||||||
&& SubscriptionManager.isValidSubscriptionId(mSir.getSubscriptionId())) {
|
&& SubscriptionManager.isValidSubscriptionId(mSir.getSubscriptionId())) {
|
||||||
if (phone == null) {
|
if (phone == null) {
|
||||||
Log.e(TAG, "Unable to locate a phone object for the given Subscription ID.");
|
Log.e(TAG, "Unable to locate a phone object for the given Subscription ID.");
|
||||||
|
@@ -238,7 +238,7 @@ public class NotificationStation extends SettingsPreferenceFragment {
|
|||||||
if (pkg != null) {
|
if (pkg != null) {
|
||||||
try {
|
try {
|
||||||
if (userId == UserHandle.USER_ALL) {
|
if (userId == UserHandle.USER_ALL) {
|
||||||
userId = UserHandle.USER_OWNER;
|
userId = UserHandle.USER_SYSTEM;
|
||||||
}
|
}
|
||||||
r = mPm.getResourcesForApplicationAsUser(pkg, userId);
|
r = mPm.getResourcesForApplicationAsUser(pkg, userId);
|
||||||
} catch (PackageManager.NameNotFoundException ex) {
|
} catch (PackageManager.NameNotFoundException ex) {
|
||||||
|
@@ -1004,7 +1004,7 @@ public class WifiSettings extends RestrictedSettingsFragment
|
|||||||
if (deviceOwnerPackageName != null) {
|
if (deviceOwnerPackageName != null) {
|
||||||
try {
|
try {
|
||||||
final int deviceOwnerUid = pm.getPackageUid(deviceOwnerPackageName,
|
final int deviceOwnerUid = pm.getPackageUid(deviceOwnerPackageName,
|
||||||
UserHandle.USER_OWNER);
|
UserHandle.USER_SYSTEM);
|
||||||
isConfigEligibleForLockdown = deviceOwnerUid == config.creatorUid;
|
isConfigEligibleForLockdown = deviceOwnerUid == config.creatorUid;
|
||||||
} catch (NameNotFoundException e) {
|
} catch (NameNotFoundException e) {
|
||||||
// don't care
|
// don't care
|
||||||
|
Reference in New Issue
Block a user