Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c92af83b authored by Julia Reynolds's avatar Julia Reynolds Committed by Android (Google) Code Review
Browse files

Merge "Settings user restriction changes: wireless & networks changes."

parents 51d898fd ee27b9de
Loading
Loading
Loading
Loading
+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
+6 −0
Original line number Diff line number Diff line
@@ -3132,6 +3132,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>
+21 −0
Original line number Diff line number Diff line
@@ -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;
@@ -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) {
@@ -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);

@@ -130,6 +143,10 @@ public class ApnSettings extends PreferenceActivity implements
    protected void onResume() {
        super.onResume();

        if (mUnavailable) {
            return;
        }

        registerReceiver(mMobileStateReceiver, mMobileStateFilter);

        if (!mRestoreDefaultApnMode) {
@@ -143,6 +160,10 @@ public class ApnSettings extends PreferenceActivity implements
    protected void onPause() {
        super.onPause();

        if (mUnavailable) {
            return;
        }

        unregisterReceiver(mMobileStateReceiver);
    }

+3 −0
Original line number Diff line number Diff line
@@ -467,6 +467,9 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
    public void onPause() {
        super.onPause();

        if (mUnavailable) {
            return;
        }
        mSwitchBar.removeOnSwitchChangeListener(this);
        mSwitchBar.hide();
    }
+25 −0
Original line number Diff line number Diff line
@@ -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;
@@ -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;
@@ -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) {
@@ -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());
@@ -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