Loading src/com/android/settings/ActiveNetworkScorerDialog.java +3 −2 Original line number Diff line number Diff line Loading @@ -70,8 +70,9 @@ public final class ActiveNetworkScorerDialog extends AlertActivity implements } private boolean buildDialog() { if (UserHandle.myUserId() != UserHandle.USER_OWNER) { Log.i(TAG, "Can only set scorer for owner user."); // TOOD: http://b/23422763 if (UserHandle.myUserId() != UserHandle.USER_SYSTEM) { Log.i(TAG, "Can only set scorer for owner/system user."); return false; } NetworkScorerAppData newScorer = NetworkScorerAppManager.getScorer(this, mNewPackageName); Loading src/com/android/settings/PrivacySettings.java +2 −1 Original line number Diff line number Diff line Loading @@ -193,7 +193,7 @@ public class PrivacySettings extends SettingsPreferenceFragment implements Index public PrivacySearchIndexProvider() { super(); mIsPrimary = UserHandle.myUserId() == UserHandle.USER_OWNER; mIsPrimary = UserHandle.myUserId() == UserHandle.USER_SYSTEM; } @Override Loading @@ -203,6 +203,7 @@ public class PrivacySettings extends SettingsPreferenceFragment implements Index List<SearchIndexableResource> result = new ArrayList<SearchIndexableResource>(); // For non-primary user, no backup or reset is available // TODO: http://b/22388012 if (!mIsPrimary) { return result; } Loading src/com/android/settings/WirelessSettings.java +10 −9 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.UserInfo; import android.content.res.Resources; import android.net.ConnectivityManager; import android.net.NetworkInfo; Loading Loading @@ -225,8 +226,7 @@ public class WirelessSettings extends SettingsPreferenceFragment implements Inde addPreferencesFromResource(R.xml.wireless_settings); final int myUserId = UserHandle.myUserId(); final boolean isSecondaryUser = myUserId != UserHandle.USER_OWNER; final boolean isAdmin = mUm.isAdminUser(); final Activity activity = getActivity(); mAirplaneModePreference = (SwitchPreference) findPreference(KEY_TOGGLE_AIRPLANE); Loading @@ -247,17 +247,17 @@ public class WirelessSettings extends SettingsPreferenceFragment implements Inde Settings.Global.AIRPLANE_MODE_TOGGLEABLE_RADIOS); //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); if (!isWimaxEnabled || mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS)) { PreferenceScreen root = getPreferenceScreen(); Preference ps = (Preference) findPreference(KEY_WIMAX_SETTINGS); Preference ps = findPreference(KEY_WIMAX_SETTINGS); if (ps != null) root.removePreference(ps); } else { if (toggleable == null || !toggleable.contains(Settings.Global.RADIO_WIMAX ) && isWimaxEnabled) { Preference ps = (Preference) findPreference(KEY_WIMAX_SETTINGS); Preference ps = findPreference(KEY_WIMAX_SETTINGS); ps.setDependency(KEY_TOGGLE_AIRPLANE); } } Loading @@ -267,7 +267,8 @@ public class WirelessSettings extends SettingsPreferenceFragment implements Inde findPreference(KEY_VPN_SETTINGS).setDependency(KEY_TOGGLE_AIRPLANE); } // 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); } Loading @@ -292,7 +293,7 @@ public class WirelessSettings extends SettingsPreferenceFragment implements Inde // 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 (isSecondaryUser || Utils.isWifiOnly(getActivity()) if (!isAdmin || Utils.isWifiOnly(getActivity()) || mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS)) { removePreference(KEY_MOBILE_NETWORK_SETTINGS); removePreference(KEY_MANAGE_MOBILE_PLAN); Loading Loading @@ -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 final ConnectivityManager cm = (ConnectivityManager) activity.getSystemService(Context.CONNECTIVITY_SERVICE); if (isSecondaryUser || !cm.isTetheringSupported() if (!isAdmin || !cm.isTetheringSupported() || mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_TETHERING)) { getPreferenceScreen().removePreference(findPreference(KEY_TETHER_SETTINGS)); } else { Loading @@ -349,7 +350,7 @@ public class WirelessSettings extends SettingsPreferenceFragment implements Inde } catch (IllegalArgumentException ignored) { isCellBroadcastAppLinkEnabled = false; // CMAS app not installed } if (isSecondaryUser || !isCellBroadcastAppLinkEnabled if (!isAdmin || !isCellBroadcastAppLinkEnabled || mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_CELL_BROADCASTS)) { PreferenceScreen root = getPreferenceScreen(); Preference ps = findPreference(KEY_CELL_BROADCAST_SETTINGS); Loading src/com/android/settings/deviceinfo/SimStatus.java +3 −4 Original line number Diff line number Diff line Loading @@ -24,8 +24,8 @@ import android.content.pm.PackageManager.NameNotFoundException; import android.content.res.Resources; import android.os.Bundle; import android.os.UserHandle; import android.os.UserManager; import android.preference.Preference; import android.preference.PreferenceActivity; import android.telephony.CellBroadcastMessage; import android.telephony.PhoneNumberUtils; import android.telephony.PhoneStateListener; Loading @@ -43,7 +43,6 @@ import com.android.internal.telephony.Phone; import com.android.internal.telephony.PhoneFactory; import com.android.settings.InstrumentedPreferenceActivity; import com.android.settings.R; import com.android.settings.Utils; import android.view.View; import android.widget.ListView; Loading @@ -53,7 +52,6 @@ import android.widget.TabHost.TabContentFactory; import android.widget.TabHost.TabSpec; import android.widget.TabWidget; import java.util.ArrayList; import java.util.List; Loading Loading @@ -379,9 +377,10 @@ public class SimStatus extends InstrumentedPreferenceActivity { private void updatePhoneInfos() { if (mSir != null) { // TODO: http://b/23763013 final Phone phone = PhoneFactory.getPhone(SubscriptionManager.getPhoneId( mSir.getSubscriptionId())); if (UserHandle.myUserId() == UserHandle.USER_OWNER if (UserManager.get(this).isAdminUser() && SubscriptionManager.isValidSubscriptionId(mSir.getSubscriptionId())) { if (phone == null) { Log.e(TAG, "Unable to locate a phone object for the given Subscription ID."); Loading src/com/android/settings/notification/NotificationStation.java +1 −1 Original line number Diff line number Diff line Loading @@ -238,7 +238,7 @@ public class NotificationStation extends SettingsPreferenceFragment { if (pkg != null) { try { if (userId == UserHandle.USER_ALL) { userId = UserHandle.USER_OWNER; userId = UserHandle.USER_SYSTEM; } r = mPm.getResourcesForApplicationAsUser(pkg, userId); } catch (PackageManager.NameNotFoundException ex) { Loading Loading
src/com/android/settings/ActiveNetworkScorerDialog.java +3 −2 Original line number Diff line number Diff line Loading @@ -70,8 +70,9 @@ public final class ActiveNetworkScorerDialog extends AlertActivity implements } private boolean buildDialog() { if (UserHandle.myUserId() != UserHandle.USER_OWNER) { Log.i(TAG, "Can only set scorer for owner user."); // TOOD: http://b/23422763 if (UserHandle.myUserId() != UserHandle.USER_SYSTEM) { Log.i(TAG, "Can only set scorer for owner/system user."); return false; } NetworkScorerAppData newScorer = NetworkScorerAppManager.getScorer(this, mNewPackageName); Loading
src/com/android/settings/PrivacySettings.java +2 −1 Original line number Diff line number Diff line Loading @@ -193,7 +193,7 @@ public class PrivacySettings extends SettingsPreferenceFragment implements Index public PrivacySearchIndexProvider() { super(); mIsPrimary = UserHandle.myUserId() == UserHandle.USER_OWNER; mIsPrimary = UserHandle.myUserId() == UserHandle.USER_SYSTEM; } @Override Loading @@ -203,6 +203,7 @@ public class PrivacySettings extends SettingsPreferenceFragment implements Index List<SearchIndexableResource> result = new ArrayList<SearchIndexableResource>(); // For non-primary user, no backup or reset is available // TODO: http://b/22388012 if (!mIsPrimary) { return result; } Loading
src/com/android/settings/WirelessSettings.java +10 −9 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.UserInfo; import android.content.res.Resources; import android.net.ConnectivityManager; import android.net.NetworkInfo; Loading Loading @@ -225,8 +226,7 @@ public class WirelessSettings extends SettingsPreferenceFragment implements Inde addPreferencesFromResource(R.xml.wireless_settings); final int myUserId = UserHandle.myUserId(); final boolean isSecondaryUser = myUserId != UserHandle.USER_OWNER; final boolean isAdmin = mUm.isAdminUser(); final Activity activity = getActivity(); mAirplaneModePreference = (SwitchPreference) findPreference(KEY_TOGGLE_AIRPLANE); Loading @@ -247,17 +247,17 @@ public class WirelessSettings extends SettingsPreferenceFragment implements Inde Settings.Global.AIRPLANE_MODE_TOGGLEABLE_RADIOS); //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); if (!isWimaxEnabled || mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS)) { PreferenceScreen root = getPreferenceScreen(); Preference ps = (Preference) findPreference(KEY_WIMAX_SETTINGS); Preference ps = findPreference(KEY_WIMAX_SETTINGS); if (ps != null) root.removePreference(ps); } else { if (toggleable == null || !toggleable.contains(Settings.Global.RADIO_WIMAX ) && isWimaxEnabled) { Preference ps = (Preference) findPreference(KEY_WIMAX_SETTINGS); Preference ps = findPreference(KEY_WIMAX_SETTINGS); ps.setDependency(KEY_TOGGLE_AIRPLANE); } } Loading @@ -267,7 +267,8 @@ public class WirelessSettings extends SettingsPreferenceFragment implements Inde findPreference(KEY_VPN_SETTINGS).setDependency(KEY_TOGGLE_AIRPLANE); } // 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); } Loading @@ -292,7 +293,7 @@ public class WirelessSettings extends SettingsPreferenceFragment implements Inde // 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 (isSecondaryUser || Utils.isWifiOnly(getActivity()) if (!isAdmin || Utils.isWifiOnly(getActivity()) || mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS)) { removePreference(KEY_MOBILE_NETWORK_SETTINGS); removePreference(KEY_MANAGE_MOBILE_PLAN); Loading Loading @@ -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 final ConnectivityManager cm = (ConnectivityManager) activity.getSystemService(Context.CONNECTIVITY_SERVICE); if (isSecondaryUser || !cm.isTetheringSupported() if (!isAdmin || !cm.isTetheringSupported() || mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_TETHERING)) { getPreferenceScreen().removePreference(findPreference(KEY_TETHER_SETTINGS)); } else { Loading @@ -349,7 +350,7 @@ public class WirelessSettings extends SettingsPreferenceFragment implements Inde } catch (IllegalArgumentException ignored) { isCellBroadcastAppLinkEnabled = false; // CMAS app not installed } if (isSecondaryUser || !isCellBroadcastAppLinkEnabled if (!isAdmin || !isCellBroadcastAppLinkEnabled || mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_CELL_BROADCASTS)) { PreferenceScreen root = getPreferenceScreen(); Preference ps = findPreference(KEY_CELL_BROADCAST_SETTINGS); Loading
src/com/android/settings/deviceinfo/SimStatus.java +3 −4 Original line number Diff line number Diff line Loading @@ -24,8 +24,8 @@ import android.content.pm.PackageManager.NameNotFoundException; import android.content.res.Resources; import android.os.Bundle; import android.os.UserHandle; import android.os.UserManager; import android.preference.Preference; import android.preference.PreferenceActivity; import android.telephony.CellBroadcastMessage; import android.telephony.PhoneNumberUtils; import android.telephony.PhoneStateListener; Loading @@ -43,7 +43,6 @@ import com.android.internal.telephony.Phone; import com.android.internal.telephony.PhoneFactory; import com.android.settings.InstrumentedPreferenceActivity; import com.android.settings.R; import com.android.settings.Utils; import android.view.View; import android.widget.ListView; Loading @@ -53,7 +52,6 @@ import android.widget.TabHost.TabContentFactory; import android.widget.TabHost.TabSpec; import android.widget.TabWidget; import java.util.ArrayList; import java.util.List; Loading Loading @@ -379,9 +377,10 @@ public class SimStatus extends InstrumentedPreferenceActivity { private void updatePhoneInfos() { if (mSir != null) { // TODO: http://b/23763013 final Phone phone = PhoneFactory.getPhone(SubscriptionManager.getPhoneId( mSir.getSubscriptionId())); if (UserHandle.myUserId() == UserHandle.USER_OWNER if (UserManager.get(this).isAdminUser() && SubscriptionManager.isValidSubscriptionId(mSir.getSubscriptionId())) { if (phone == null) { Log.e(TAG, "Unable to locate a phone object for the given Subscription ID."); Loading
src/com/android/settings/notification/NotificationStation.java +1 −1 Original line number Diff line number Diff line Loading @@ -238,7 +238,7 @@ public class NotificationStation extends SettingsPreferenceFragment { if (pkg != null) { try { if (userId == UserHandle.USER_ALL) { userId = UserHandle.USER_OWNER; userId = UserHandle.USER_SYSTEM; } r = mPm.getResourcesForApplicationAsUser(pkg, userId); } catch (PackageManager.NameNotFoundException ex) { Loading