Loading res/layout/apn_disallowed_preference_screen.xml 0 → 100644 +39 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- /* * Copyright (C) 2014 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. */ --> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/listContainer" android:layout_width="match_parent" android:layout_height="match_parent"> <ListView android:id="@android:id/list" android:layout_width="match_parent" android:layout_height="match_parent" android:drawSelectorOnTop="false" android:scrollbarStyle="insideOverlay" android:background="@android:color/white" android:cacheColorHint="@android:color/white" android:fadingEdgeLength="16dip" /> <TextView android:id="@+android:id/empty" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:text="@string/apn_settings_not_available" android:textAppearance="?android:attr/textAppearanceMedium" /> </FrameLayout> No newline at end of file res/values/strings.xml +6 −0 Original line number Diff line number Diff line Loading @@ -3126,6 +3126,12 @@ <!-- Setting checkbox title for Whether to enable USB debugging support on the phone. --> <!-- Error message for users that aren't allowed to modify developer options [CHAR LIMIT=none] --> <string name="development_settings_not_available">Developer options are not available for this user</string> <!-- Error message for users that aren't allowed to modify VPN settings [CHAR LIMIT=none] --> <string name="vpn_settings_not_available">VPN settings are not available for this user</string> <!-- Error message for users that aren't allowed to modify Tethering settings [CHAR LIMIT=none] --> <string name="tethering_settings_not_available">Tethering settings are not available for this user</string> <!-- Error message for users that aren't allowed to modify Access Point Names settings [CHAR LIMIT=none] --> <string name="apn_settings_not_available">Access Point Name settings are not available for this user</string> <string name="enable_adb">USB debugging</string> <!-- Setting checkbox summary for Whether to enable USB debugging support on the phone --> <string name="enable_adb_summary">Debug mode when USB is connected</string> Loading src/com/android/settings/ApnSettings.java +21 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import android.os.Handler; import android.os.HandlerThread; import android.os.Looper; import android.os.Message; import android.os.UserManager; import android.preference.Preference; import android.preference.PreferenceActivity; import android.preference.PreferenceGroup; Loading Loading @@ -83,10 +84,14 @@ public class ApnSettings extends PreferenceActivity implements private RestoreApnProcessHandler mRestoreApnProcessHandler; private HandlerThread mRestoreDefaultApnThread; private UserManager mUm; private String mSelectedKey; private IntentFilter mMobileStateFilter; private boolean mUnavailable; private final BroadcastReceiver mMobileStateReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { Loading Loading @@ -119,6 +124,14 @@ public class ApnSettings extends PreferenceActivity implements protected void onCreate(Bundle icicle) { super.onCreate(icicle); mUm = (UserManager) getSystemService(Context.USER_SERVICE); if (mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS)) { mUnavailable = true; setContentView(R.layout.apn_disallowed_preference_screen); return; } addPreferencesFromResource(R.xml.apn_settings); getListView().setItemsCanFocus(true); Loading @@ -130,6 +143,10 @@ public class ApnSettings extends PreferenceActivity implements protected void onResume() { super.onResume(); if (mUnavailable) { return; } registerReceiver(mMobileStateReceiver, mMobileStateFilter); if (!mRestoreDefaultApnMode) { Loading @@ -143,6 +160,10 @@ public class ApnSettings extends PreferenceActivity implements protected void onPause() { super.onPause(); if (mUnavailable) { return; } unregisterReceiver(mMobileStateReceiver); } Loading src/com/android/settings/DevelopmentSettings.java +3 −0 Original line number Diff line number Diff line Loading @@ -465,6 +465,9 @@ public class DevelopmentSettings extends SettingsPreferenceFragment public void onPause() { super.onPause(); if (mUnavailable) { return; } mSwitchBar.removeOnSwitchChangeListener(this); mSwitchBar.hide(); } Loading src/com/android/settings/TetherSettings.java +25 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ import android.text.TextUtils; import android.view.ViewGroup; import android.view.ViewParent; import android.webkit.WebView; import android.widget.TextView; import java.io.InputStream; import java.util.ArrayList; Loading Loading @@ -92,6 +93,7 @@ public class TetherSettings extends SettingsPreferenceFragment private WifiApDialog mDialog; private WifiManager mWifiManager; private WifiConfiguration mWifiConfig = null; private UserManager mUm; private boolean mUsbConnected; private boolean mMassStorageActive; Loading @@ -110,11 +112,21 @@ public class TetherSettings extends SettingsPreferenceFragment private String[] mProvisionApp; private static final int PROVISION_REQUEST = 0; private boolean mUnavailable; @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); addPreferencesFromResource(R.xml.tether_prefs); mUm = (UserManager) getSystemService(Context.USER_SERVICE); if (mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_TETHERING)) { mUnavailable = true; setPreferenceScreen(new PreferenceScreen(getActivity(), null)); return; } final Activity activity = getActivity(); BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter(); if (adapter != null) { Loading Loading @@ -264,6 +276,15 @@ public class TetherSettings extends SettingsPreferenceFragment public void onStart() { super.onStart(); if (mUnavailable) { TextView emptyView = (TextView) getView().findViewById(android.R.id.empty); getListView().setEmptyView(emptyView); if (emptyView != null) { emptyView.setText(R.string.tethering_settings_not_available); } return; } final Activity activity = getActivity(); mMassStorageActive = Environment.MEDIA_SHARED.equals(Environment.getExternalStorageState()); Loading Loading @@ -297,6 +318,10 @@ public class TetherSettings extends SettingsPreferenceFragment @Override public void onStop() { super.onStop(); if (mUnavailable) { return; } getActivity().unregisterReceiver(mTetherChangeReceiver); mTetherChangeReceiver = null; if (mWifiApEnabler != null) { Loading Loading
res/layout/apn_disallowed_preference_screen.xml 0 → 100644 +39 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- /* * Copyright (C) 2014 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. */ --> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/listContainer" android:layout_width="match_parent" android:layout_height="match_parent"> <ListView android:id="@android:id/list" android:layout_width="match_parent" android:layout_height="match_parent" android:drawSelectorOnTop="false" android:scrollbarStyle="insideOverlay" android:background="@android:color/white" android:cacheColorHint="@android:color/white" android:fadingEdgeLength="16dip" /> <TextView android:id="@+android:id/empty" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:text="@string/apn_settings_not_available" android:textAppearance="?android:attr/textAppearanceMedium" /> </FrameLayout> No newline at end of file
res/values/strings.xml +6 −0 Original line number Diff line number Diff line Loading @@ -3126,6 +3126,12 @@ <!-- Setting checkbox title for Whether to enable USB debugging support on the phone. --> <!-- Error message for users that aren't allowed to modify developer options [CHAR LIMIT=none] --> <string name="development_settings_not_available">Developer options are not available for this user</string> <!-- Error message for users that aren't allowed to modify VPN settings [CHAR LIMIT=none] --> <string name="vpn_settings_not_available">VPN settings are not available for this user</string> <!-- Error message for users that aren't allowed to modify Tethering settings [CHAR LIMIT=none] --> <string name="tethering_settings_not_available">Tethering settings are not available for this user</string> <!-- Error message for users that aren't allowed to modify Access Point Names settings [CHAR LIMIT=none] --> <string name="apn_settings_not_available">Access Point Name settings are not available for this user</string> <string name="enable_adb">USB debugging</string> <!-- Setting checkbox summary for Whether to enable USB debugging support on the phone --> <string name="enable_adb_summary">Debug mode when USB is connected</string> Loading
src/com/android/settings/ApnSettings.java +21 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import android.os.Handler; import android.os.HandlerThread; import android.os.Looper; import android.os.Message; import android.os.UserManager; import android.preference.Preference; import android.preference.PreferenceActivity; import android.preference.PreferenceGroup; Loading Loading @@ -83,10 +84,14 @@ public class ApnSettings extends PreferenceActivity implements private RestoreApnProcessHandler mRestoreApnProcessHandler; private HandlerThread mRestoreDefaultApnThread; private UserManager mUm; private String mSelectedKey; private IntentFilter mMobileStateFilter; private boolean mUnavailable; private final BroadcastReceiver mMobileStateReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { Loading Loading @@ -119,6 +124,14 @@ public class ApnSettings extends PreferenceActivity implements protected void onCreate(Bundle icicle) { super.onCreate(icicle); mUm = (UserManager) getSystemService(Context.USER_SERVICE); if (mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS)) { mUnavailable = true; setContentView(R.layout.apn_disallowed_preference_screen); return; } addPreferencesFromResource(R.xml.apn_settings); getListView().setItemsCanFocus(true); Loading @@ -130,6 +143,10 @@ public class ApnSettings extends PreferenceActivity implements protected void onResume() { super.onResume(); if (mUnavailable) { return; } registerReceiver(mMobileStateReceiver, mMobileStateFilter); if (!mRestoreDefaultApnMode) { Loading @@ -143,6 +160,10 @@ public class ApnSettings extends PreferenceActivity implements protected void onPause() { super.onPause(); if (mUnavailable) { return; } unregisterReceiver(mMobileStateReceiver); } Loading
src/com/android/settings/DevelopmentSettings.java +3 −0 Original line number Diff line number Diff line Loading @@ -465,6 +465,9 @@ public class DevelopmentSettings extends SettingsPreferenceFragment public void onPause() { super.onPause(); if (mUnavailable) { return; } mSwitchBar.removeOnSwitchChangeListener(this); mSwitchBar.hide(); } Loading
src/com/android/settings/TetherSettings.java +25 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ import android.text.TextUtils; import android.view.ViewGroup; import android.view.ViewParent; import android.webkit.WebView; import android.widget.TextView; import java.io.InputStream; import java.util.ArrayList; Loading Loading @@ -92,6 +93,7 @@ public class TetherSettings extends SettingsPreferenceFragment private WifiApDialog mDialog; private WifiManager mWifiManager; private WifiConfiguration mWifiConfig = null; private UserManager mUm; private boolean mUsbConnected; private boolean mMassStorageActive; Loading @@ -110,11 +112,21 @@ public class TetherSettings extends SettingsPreferenceFragment private String[] mProvisionApp; private static final int PROVISION_REQUEST = 0; private boolean mUnavailable; @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); addPreferencesFromResource(R.xml.tether_prefs); mUm = (UserManager) getSystemService(Context.USER_SERVICE); if (mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_TETHERING)) { mUnavailable = true; setPreferenceScreen(new PreferenceScreen(getActivity(), null)); return; } final Activity activity = getActivity(); BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter(); if (adapter != null) { Loading Loading @@ -264,6 +276,15 @@ public class TetherSettings extends SettingsPreferenceFragment public void onStart() { super.onStart(); if (mUnavailable) { TextView emptyView = (TextView) getView().findViewById(android.R.id.empty); getListView().setEmptyView(emptyView); if (emptyView != null) { emptyView.setText(R.string.tethering_settings_not_available); } return; } final Activity activity = getActivity(); mMassStorageActive = Environment.MEDIA_SHARED.equals(Environment.getExternalStorageState()); Loading Loading @@ -297,6 +318,10 @@ public class TetherSettings extends SettingsPreferenceFragment @Override public void onStop() { super.onStop(); if (mUnavailable) { return; } getActivity().unregisterReceiver(mTetherChangeReceiver); mTetherChangeReceiver = null; if (mWifiApEnabler != null) { Loading