Merge "Add policy transparency to disallow remove user."
diff --git a/res/layout/admin_support_details_dialog.xml b/res/layout/admin_support_details_dialog.xml
index 7de91d0..8c33b1a 100644
--- a/res/layout/admin_support_details_dialog.xml
+++ b/res/layout/admin_support_details_dialog.xml
@@ -27,7 +27,8 @@
         <ImageView android:id="@+id/admin_support_icon"
                 android:layout_width="@dimen/admin_details_dialog_icon_size"
                 android:layout_height="@dimen/admin_details_dialog_icon_size"
-                android:src="@drawable/ic_info"
+                android:tint="?android:attr/colorAccent"
+                android:src="@*android:drawable/ic_info"
                 android:scaleType="fitCenter"
                 android:contentDescription="@null" />
         <TextView android:id="@+id/admin_support_dialog_title"
diff --git a/res/layout/lockscreen_remote_input.xml b/res/layout/lockscreen_remote_input.xml
index 1c565a3..68b35f9 100644
--- a/res/layout/lockscreen_remote_input.xml
+++ b/res/layout/lockscreen_remote_input.xml
@@ -36,10 +36,11 @@
 
     <ImageView
             android:id="@+id/restricted_lock_icon_remote_input"
-            android:layout_width="@dimen/restricted_icon_size"
-            android:layout_height="@dimen/restricted_icon_size"
-            android:src="@drawable/ic_info"
+            android:layout_width="@*android:dimen/config_restricted_icon_size"
+            android:layout_height="@*android:dimen/config_restricted_icon_size"
+            android:tint="?android:attr/colorAccent"
+            android:src="@*android:drawable/ic_info"
             android:layout_marginEnd="?android:attr/dialogPreferredPadding"
             android:layout_gravity="center_vertical"
             android:scaleType="centerInside" />
-</LinearLayout>
\ No newline at end of file
+</LinearLayout>
diff --git a/res/layout/printer_dropdown_item.xml b/res/layout/printer_dropdown_item.xml
index 1036e24..fd581bb 100644
--- a/res/layout/printer_dropdown_item.xml
+++ b/res/layout/printer_dropdown_item.xml
@@ -77,7 +77,7 @@
             android:layout_gravity="center_vertical"
             android:paddingLeft="16dip"
             android:contentDescription="@string/printer_info_desc"
-            android:src="@drawable/ic_info"
+            android:src="@*android:drawable/ic_info"
             android:tint="?android:attr/colorControlNormal"
             android:tintMode="src_in" />
 
diff --git a/res/layout/restricted_dialog_singlechoice.xml b/res/layout/restricted_dialog_singlechoice.xml
index 3daedc7..48f62ce 100644
--- a/res/layout/restricted_dialog_singlechoice.xml
+++ b/res/layout/restricted_dialog_singlechoice.xml
@@ -37,11 +37,12 @@
             android:ellipsize="marquee" />
     <ImageView
             android:id="@+id/restricted_lock_icon"
-            android:layout_width="@dimen/restricted_icon_size"
-            android:layout_height="@dimen/restricted_icon_size"
-            android:src="@drawable/ic_info"
+            android:layout_width="@*android:dimen/config_restricted_icon_size"
+            android:layout_height="@*android:dimen/config_restricted_icon_size"
+            android:tint="?android:attr/colorAccent"
+            android:src="@*android:drawable/ic_info"
             android:layout_marginLeft="@dimen/restricted_icon_padding"
             android:baselineAlignBottom="true"
             android:scaleType="centerInside"
             android:visibility="gone" />
-</com.android.settings.CheckableLinearLayout>
\ No newline at end of file
+</com.android.settings.CheckableLinearLayout>
diff --git a/res/layout/restricted_popup_menu_item.xml b/res/layout/restricted_popup_menu_item.xml
index 78a09ef..9f6da73 100644
--- a/res/layout/restricted_popup_menu_item.xml
+++ b/res/layout/restricted_popup_menu_item.xml
@@ -34,10 +34,11 @@
         android:layout_alignParentLeft="true" />
     <ImageView
         android:id="@+id/restricted_icon"
-        android:layout_width="@dimen/restricted_icon_size"
-        android:layout_height="@dimen/restricted_icon_size"
+        android:layout_width="@*android:dimen/config_restricted_icon_size"
+        android:layout_height="@*android:dimen/config_restricted_icon_size"
         android:scaleType="centerInside"
-        android:src="@drawable/ic_info"
+        android:tint="?android:attr/colorAccent"
+        android:src="@*android:drawable/ic_info"
         android:layout_alignParentRight="true"
         android:visibility="gone" />
-</RelativeLayout>
\ No newline at end of file
+</RelativeLayout>
diff --git a/res/layout/restricted_radio_with_summary.xml b/res/layout/restricted_radio_with_summary.xml
index 55f158c..4808460 100644
--- a/res/layout/restricted_radio_with_summary.xml
+++ b/res/layout/restricted_radio_with_summary.xml
@@ -41,10 +41,11 @@
             android:ellipsize="marquee" />
         <ImageView
             android:id="@+id/restricted_icon"
-            android:layout_width="@dimen/restricted_icon_size"
+            android:layout_width="@*android:dimen/config_restricted_icon_size"
             android:layout_height="match_parent"
             android:scaleType="centerInside"
-            android:src="@drawable/ic_info"
+            android:tint="?android:attr/colorAccent"
+            android:src="@*android:drawable/ic_info"
             android:layout_marginLeft="@dimen/restricted_icon_padding"
             android:visibility="gone" />
     </com.android.settings.CheckableLinearLayout>
@@ -59,4 +60,4 @@
         android:textColor="?android:attr/textColorSecondary"
         android:maxLines="10" />
 
-</com.android.settings.CheckableLinearLayout>
\ No newline at end of file
+</com.android.settings.CheckableLinearLayout>
diff --git a/res/layout/spinner_dropdown_restricted_item.xml b/res/layout/spinner_dropdown_restricted_item.xml
index 823b430..be85966 100644
--- a/res/layout/spinner_dropdown_restricted_item.xml
+++ b/res/layout/spinner_dropdown_restricted_item.xml
@@ -26,11 +26,12 @@
             android:layout_height="?android:attr/listPreferredItemHeightSmall"
             android:ellipsize="marquee" />
     <ImageView android:id="@+id/restricted_icon"
-            android:layout_width="@dimen/restricted_icon_size"
-            android:layout_height="@dimen/restricted_icon_size"
-            android:src="@drawable/ic_info"
+            android:layout_width="@*android:dimen/config_restricted_icon_size"
+            android:layout_height="@*android:dimen/config_restricted_icon_size"
+            android:tint="?android:attr/colorAccent"
+            android:src="@*android:drawable/ic_info"
             android:baselineAlignBottom="true"
             android:layout_marginEnd="@dimen/restricted_icon_padding"
             android:gravity="end|center_vertical"
             android:visibility="gone" />
-</LinearLayout>
\ No newline at end of file
+</LinearLayout>
diff --git a/res/layout/switch_bar.xml b/res/layout/switch_bar.xml
index a172051..e305f9d 100644
--- a/res/layout/switch_bar.xml
+++ b/res/layout/switch_bar.xml
@@ -29,24 +29,23 @@
         android:ellipsize="end"
         android:textAppearance="@style/TextAppearance.Switch"
         android:textColor="?android:attr/textColorPrimary"
-        android:textAlignment="viewStart" />
+        android:textAlignment="viewStart"/>
 
     <ImageView
         android:id="@+id/restricted_icon"
         android:layout_width="@dimen/restricted_icon_size"
         android:layout_height="@dimen/restricted_icon_size"
-        android:src="@drawable/ic_info"
+        android:tint="?android:attr/colorAccent"
         android:theme="@android:style/Theme.Material"
         android:layout_gravity="center_vertical"
-        android:layout_marginEnd="@dimen/restricted_icon_margin_end"
-        android:visibility="gone" />
+        android:layout_marginEnd="@dimen/restricted_icon_margin_end"/>
 
     <com.android.settings.widget.ToggleSwitch
         android:id="@+id/switch_widget"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_gravity="center_vertical"
-        android:theme="@style/Widget.SwitchBar.Switch" />
+        android:theme="@style/Widget.SwitchBar.Switch"/>
 
 </merge>
 
diff --git a/res/values-night/themes.xml b/res/values-night/themes.xml
new file mode 100644
index 0000000..eb0a749
--- /dev/null
+++ b/res/values-night/themes.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     Copyright (C) 2018 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.
+-->
+
+<resources>
+
+    <style name="Theme.Settings.Home" parent="Theme.Settings.HomeBase">
+        <item name="colorPrimaryDark">@*android:color/primary_dark_device_default_settings</item>
+    </style>
+
+</resources>
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index a4ce9f0..e729126 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -101,6 +101,7 @@
     <attr name="switchBarMarginEnd" format="dimension" />
     <attr name="switchBarBackgroundColor" format="color" />
     <attr name="switchBarBackgroundActivatedColor" format="color" />
+    <attr name="switchBarRestrictionIcon" format="reference" />
 
     <attr name="preferenceBackgroundColor" format="color" />
 
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 16d9f96..70672ca 100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -267,6 +267,8 @@
 
     <!-- Restricted icon in switch bar -->
     <dimen name="restricted_icon_margin_end">16dp</dimen>
+    <!-- Restricted icon size in switch bar -->
+    <dimen name="restricted_icon_size">@*android:dimen/config_restricted_icon_size</dimen>
 
     <!-- Display Size and Font Size preview screen -->
     <dimen name="preview_pager_padding">8dp</dimen>
diff --git a/res/values/themes.xml b/res/values/themes.xml
index 4bd6f52..df490f2 100644
--- a/res/values/themes.xml
+++ b/res/values/themes.xml
@@ -85,6 +85,7 @@
         <item name="switchBarMarginEnd">@dimen/switchbar_subsettings_margin_end</item>
         <item name="switchBarBackgroundColor">@color/switch_bar_background</item>
         <item name="switchBarBackgroundActivatedColor">?android:attr/colorAccent</item>
+        <item name="switchBarRestrictionIcon">@*android:drawable/ic_info</item>
     </style>
 
     <style name="Widget.SwitchBar.Switch" parent="@android:style/Widget.Material.CompoundButton.Switch">
@@ -165,14 +166,18 @@
         <item name="android:windowNoTitle">true</item>
     </style>
 
-    <style name="Theme.Settings.Home" parent="Theme.AppCompat.DayNight.NoActionBar">
-        <!-- Color names copied from frameworks/base/core/res/res/values/themes_device_defaults.xml -->
-        <!-- TODO (b/113964702) : fix theme color -->
+    <style name="Theme.Settings.HomeBase" parent="Theme.AppCompat.DayNight.NoActionBar">
         <item name="colorPrimary">@*android:color/primary_device_default_settings_light</item>
-        <item name="colorPrimaryDark">@*android:color/primary_dark_device_default_settings_light</item>
         <item name="colorAccent">@*android:color/accent_device_default_light</item>
         <item name="preferenceTheme">@style/PreferenceTheme</item>
+    </style>
+
+    <style name="Theme.Settings.Home" parent="Theme.Settings.HomeBase">
+        <item name="colorPrimaryDark">@*android:color/primary_dark_device_default_settings_light</item>
         <item name="android:windowLightStatusBar">true</item>
+        <item name="android:navigationBarDividerColor">@*android:color/ripple_material_light</item>
+        <item name="android:navigationBarColor">@android:color/white</item>
+        <item name="android:windowLightNavigationBar">true</item>
     </style>
 
 </resources>
diff --git a/src/com/android/settings/applications/appinfo/AppDataUsagePreferenceController.java b/src/com/android/settings/applications/appinfo/AppDataUsagePreferenceController.java
index 049b212..4337b88 100644
--- a/src/com/android/settings/applications/appinfo/AppDataUsagePreferenceController.java
+++ b/src/com/android/settings/applications/appinfo/AppDataUsagePreferenceController.java
@@ -132,7 +132,7 @@
     }
 
     private static NetworkTemplate getTemplate(Context context) {
-        if (DataUsageList.hasReadyMobileRadio(context)) {
+        if (DataUsageUtils.hasReadyMobileRadio(context)) {
             return NetworkTemplate.buildTemplateMobileWildcard();
         }
         if (DataUsageUtils.hasWifiRadio(context)) {
diff --git a/src/com/android/settings/datausage/DataUsageList.java b/src/com/android/settings/datausage/DataUsageList.java
index 057cdd7..a3c9612 100644
--- a/src/com/android/settings/datausage/DataUsageList.java
+++ b/src/com/android/settings/datausage/DataUsageList.java
@@ -479,63 +479,6 @@
         return Math.max(largest, item.total);
     }
 
-    /**
-     * Test if device has a mobile data radio with SIM in ready state.
-     */
-    public static boolean hasReadyMobileRadio(Context context) {
-        if (DataUsageUtils.TEST_RADIOS) {
-            return SystemProperties.get(DataUsageUtils.TEST_RADIOS_PROP).contains("mobile");
-        }
-
-        final ConnectivityManager conn = ConnectivityManager.from(context);
-        final TelephonyManager tele = TelephonyManager.from(context);
-
-        final List<SubscriptionInfo> subInfoList =
-                SubscriptionManager.from(context).getActiveSubscriptionInfoList();
-        // No activated Subscriptions
-        if (subInfoList == null) {
-            if (LOGD) Log.d(TAG, "hasReadyMobileRadio: subInfoList=null");
-            return false;
-        }
-        // require both supported network and ready SIM
-        boolean isReady = true;
-        for (SubscriptionInfo subInfo : subInfoList) {
-            isReady = isReady & tele.getSimState(subInfo.getSimSlotIndex()) == SIM_STATE_READY;
-            if (LOGD) Log.d(TAG, "hasReadyMobileRadio: subInfo=" + subInfo);
-        }
-        boolean retVal = conn.isNetworkSupported(TYPE_MOBILE) && isReady;
-        if (LOGD) {
-            Log.d(TAG, "hasReadyMobileRadio:"
-                    + " conn.isNetworkSupported(TYPE_MOBILE)="
-                    + conn.isNetworkSupported(TYPE_MOBILE)
-                    + " isReady=" + isReady);
-        }
-        return retVal;
-    }
-
-    /*
-     * TODO: consider adding to TelephonyManager or SubscriptionManager.
-     */
-    public static boolean hasReadyMobileRadio(Context context, int subId) {
-        if (DataUsageUtils.TEST_RADIOS) {
-            return SystemProperties.get(DataUsageUtils.TEST_RADIOS_PROP).contains("mobile");
-        }
-
-        final ConnectivityManager conn = ConnectivityManager.from(context);
-        final TelephonyManager tele = TelephonyManager.from(context);
-        final int slotId = SubscriptionManager.getSlotIndex(subId);
-        final boolean isReady = tele.getSimState(slotId) == SIM_STATE_READY;
-
-        boolean retVal = conn.isNetworkSupported(TYPE_MOBILE) && isReady;
-        if (LOGD) {
-            Log.d(TAG, "hasReadyMobileRadio: subId=" + subId
-                    + " conn.isNetworkSupported(TYPE_MOBILE)="
-                    + conn.isNetworkSupported(TYPE_MOBILE)
-                    + " isReady=" + isReady);
-        }
-        return retVal;
-    }
-
     private OnItemSelectedListener mCycleListener = new OnItemSelectedListener() {
         @Override
         public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
diff --git a/src/com/android/settings/datausage/DataUsageListV2.java b/src/com/android/settings/datausage/DataUsageListV2.java
index 4a05af3..c3b2bb2 100644
--- a/src/com/android/settings/datausage/DataUsageListV2.java
+++ b/src/com/android/settings/datausage/DataUsageListV2.java
@@ -483,63 +483,6 @@
         return Math.max(largest, item.total);
     }
 
-    /**
-     * Test if device has a mobile data radio with SIM in ready state.
-     */
-    public static boolean hasReadyMobileRadio(Context context) {
-        if (DataUsageUtils.TEST_RADIOS) {
-            return SystemProperties.get(DataUsageUtils.TEST_RADIOS_PROP).contains("mobile");
-        }
-
-        final ConnectivityManager conn = ConnectivityManager.from(context);
-        final TelephonyManager tele = TelephonyManager.from(context);
-
-        final List<SubscriptionInfo> subInfoList =
-                SubscriptionManager.from(context).getActiveSubscriptionInfoList();
-        // No activated Subscriptions
-        if (subInfoList == null) {
-            if (LOGD) Log.d(TAG, "hasReadyMobileRadio: subInfoList=null");
-            return false;
-        }
-        // require both supported network and ready SIM
-        boolean isReady = true;
-        for (SubscriptionInfo subInfo : subInfoList) {
-            isReady = isReady & tele.getSimState(subInfo.getSimSlotIndex()) == SIM_STATE_READY;
-            if (LOGD) Log.d(TAG, "hasReadyMobileRadio: subInfo=" + subInfo);
-        }
-        boolean retVal = conn.isNetworkSupported(TYPE_MOBILE) && isReady;
-        if (LOGD) {
-            Log.d(TAG, "hasReadyMobileRadio:"
-                    + " conn.isNetworkSupported(TYPE_MOBILE)="
-                    + conn.isNetworkSupported(TYPE_MOBILE)
-                    + " isReady=" + isReady);
-        }
-        return retVal;
-    }
-
-    /*
-     * TODO: consider adding to TelephonyManager or SubscriptionManager.
-     */
-    public static boolean hasReadyMobileRadio(Context context, int subId) {
-        if (DataUsageUtils.TEST_RADIOS) {
-            return SystemProperties.get(DataUsageUtils.TEST_RADIOS_PROP).contains("mobile");
-        }
-
-        final ConnectivityManager conn = ConnectivityManager.from(context);
-        final TelephonyManager tele = TelephonyManager.from(context);
-        final int slotId = SubscriptionManager.getSlotIndex(subId);
-        final boolean isReady = tele.getSimState(slotId) == SIM_STATE_READY;
-
-        boolean retVal = conn.isNetworkSupported(TYPE_MOBILE) && isReady;
-        if (LOGD) {
-            Log.d(TAG, "hasReadyMobileRadio: subId=" + subId
-                    + " conn.isNetworkSupported(TYPE_MOBILE)="
-                    + conn.isNetworkSupported(TYPE_MOBILE)
-                    + " isReady=" + isReady);
-        }
-        return retVal;
-    }
-
     private OnItemSelectedListener mCycleListener = new OnItemSelectedListener() {
         @Override
         public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
diff --git a/src/com/android/settings/datausage/DataUsageUtils.java b/src/com/android/settings/datausage/DataUsageUtils.java
index 803bc37..096bdfe 100644
--- a/src/com/android/settings/datausage/DataUsageUtils.java
+++ b/src/com/android/settings/datausage/DataUsageUtils.java
@@ -14,7 +14,9 @@
 
 package com.android.settings.datausage;
 
+import static android.net.ConnectivityManager.TYPE_MOBILE;
 import static android.net.ConnectivityManager.TYPE_WIFI;
+import static android.telephony.TelephonyManager.SIM_STATE_READY;
 
 import android.content.Context;
 import android.net.ConnectivityManager;
@@ -31,6 +33,7 @@
 import android.text.BidiFormatter;
 import android.text.format.Formatter;
 import android.text.format.Formatter.BytesResult;
+import android.util.Log;
 
 import java.util.List;
 
@@ -40,7 +43,9 @@
 public final class DataUsageUtils {
     static final boolean TEST_RADIOS = false;
     static final String TEST_RADIOS_PROP = "test.radios";
+    private static final boolean LOGD = false;
     private static final String ETHERNET = "ethernet";
+    private static final String TAG = "DataUsageUtils";
 
     private DataUsageUtils() {
     }
@@ -99,6 +104,42 @@
     }
 
     /**
+     * Test if device has a mobile data radio with SIM in ready state.
+     */
+    public static boolean hasReadyMobileRadio(Context context) {
+        if (DataUsageUtils.TEST_RADIOS) {
+            return SystemProperties.get(DataUsageUtils.TEST_RADIOS_PROP).contains("mobile");
+        }
+        final List<SubscriptionInfo> subInfoList =
+            SubscriptionManager.from(context).getActiveSubscriptionInfoList();
+        // No activated Subscriptions
+        if (subInfoList == null) {
+            if (LOGD) {
+                Log.d(TAG, "hasReadyMobileRadio: subInfoList=null");
+            }
+            return false;
+        }
+        final TelephonyManager tele = TelephonyManager.from(context);
+        // require both supported network and ready SIM
+        boolean isReady = true;
+        for (SubscriptionInfo subInfo : subInfoList) {
+            isReady = isReady & tele.getSimState(subInfo.getSimSlotIndex()) == SIM_STATE_READY;
+            if (LOGD) {
+                Log.d(TAG, "hasReadyMobileRadio: subInfo=" + subInfo);
+            }
+        }
+        final ConnectivityManager conn = ConnectivityManager.from(context);
+        final boolean retVal = conn.isNetworkSupported(TYPE_MOBILE) && isReady;
+        if (LOGD) {
+            Log.d(TAG, "hasReadyMobileRadio:"
+                + " conn.isNetworkSupported(TYPE_MOBILE)="
+                + conn.isNetworkSupported(TYPE_MOBILE)
+                + " isReady=" + isReady);
+        }
+        return retVal;
+    }
+
+    /**
      * Whether device has a Wi-Fi data radio.
      */
     public static boolean hasWifiRadio(Context context) {
diff --git a/src/com/android/settings/widget/SwitchBar.java b/src/com/android/settings/widget/SwitchBar.java
index 52a3288..8afba40 100644
--- a/src/com/android/settings/widget/SwitchBar.java
+++ b/src/com/android/settings/widget/SwitchBar.java
@@ -21,6 +21,7 @@
 import android.content.Context;
 import android.content.res.TypedArray;
 import android.graphics.Rect;
+import android.graphics.drawable.Drawable;
 import android.os.Parcel;
 import android.os.Parcelable;
 import android.text.SpannableStringBuilder;
@@ -32,6 +33,7 @@
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.CompoundButton;
+import android.widget.ImageView;
 import android.widget.LinearLayout;
 import android.widget.Switch;
 import android.widget.TextView;
@@ -64,14 +66,15 @@
             R.attr.switchBarMarginStart,
             R.attr.switchBarMarginEnd,
             R.attr.switchBarBackgroundColor,
-            R.attr.switchBarBackgroundActivatedColor};
+            R.attr.switchBarBackgroundActivatedColor,
+            R.attr.switchBarRestrictionIcon};
 
     private final List<OnSwitchChangeListener> mSwitchChangeListeners = new ArrayList<>();
     private final MetricsFeatureProvider mMetricsFeatureProvider;
     private final TextAppearanceSpan mSummarySpan;
 
     private ToggleSwitch mSwitch;
-    private View mRestrictedIcon;
+    private ImageView mRestrictedIcon;
     private TextView mTextView;
     private String mLabel;
     private String mSummary;
@@ -108,10 +111,11 @@
         LayoutInflater.from(context).inflate(R.layout.switch_bar, this);
 
         final TypedArray a = context.obtainStyledAttributes(attrs, XML_ATTRIBUTES);
-        int switchBarMarginStart = (int) a.getDimension(0, 0);
-        int switchBarMarginEnd = (int) a.getDimension(1, 0);
+        final int switchBarMarginStart = (int) a.getDimension(0, 0);
+        final int switchBarMarginEnd = (int) a.getDimension(1, 0);
         mBackgroundColor = a.getColor(2, 0);
         mBackgroundActivatedColor = a.getColor(3, 0);
+        final Drawable restrictedIconDrawable = a.getDrawable(4);
         a.recycle();
 
         mTextView = findViewById(R.id.switch_text);
@@ -134,14 +138,15 @@
                 (switchView, isChecked) -> setTextViewLabelAndBackground(isChecked));
 
         mRestrictedIcon = findViewById(R.id.restricted_icon);
+        mRestrictedIcon.setImageDrawable(restrictedIconDrawable);
         mRestrictedIcon.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
                 if (mDisabledByAdmin) {
                     mMetricsFeatureProvider.count(mContext,
-                        mMetricsTag + "/switch_bar|restricted", 1);
+                            mMetricsTag + "/switch_bar|restricted", 1);
                     RestrictedLockUtils.sendShowAdminSupportDetailsIntent(context,
-                        mEnforcedAdmin);
+                            mEnforcedAdmin);
                 }
             }
         });
@@ -235,7 +240,7 @@
             setEnabled(true);
         }
         setTouchDelegate(new TouchDelegate(new Rect(0, 0, getWidth(), getHeight()),
-            getDelegatingView()));
+                getDelegatingView()));
     }
 
     public final ToggleSwitch getSwitch() {
@@ -249,7 +254,7 @@
             // Make the entire bar work as a switch
             post(() -> setTouchDelegate(
                     new TouchDelegate(new Rect(0, 0, getWidth(), getHeight()),
-                        getDelegatingView())));
+                            getDelegatingView())));
         }
     }
 
@@ -264,7 +269,7 @@
     protected void onSizeChanged(int w, int h, int oldw, int oldh) {
         if ((w > 0) && (h > 0)) {
             setTouchDelegate(new TouchDelegate(new Rect(0, 0, w, h),
-                getDelegatingView()));
+                    getDelegatingView()));
         }
     }
 
diff --git a/tests/robotests/res/values/config.xml b/tests/robotests/res/values/config.xml
index bbf2520..1252ece 100644
--- a/tests/robotests/res/values/config.xml
+++ b/tests/robotests/res/values/config.xml
@@ -21,4 +21,8 @@
     <bool name="config_show_connectivity_monitor">true</bool>
     <bool name="config_display_recent_apps">true</bool>
     <bool name="config_wifi_support_connected_mac_randomization">true</bool>
+
+    <!-- Fake dimen value for restricted icon size - needed to get around Robolectric
+         issue loading framework hidden resources -->
+    <dimen name="restricted_icon_size">24dp</dimen>
 </resources>
\ No newline at end of file
diff --git a/tests/robotests/res/values/themes.xml b/tests/robotests/res/values/themes.xml
index d3ba69f..7bfbe10 100644
--- a/tests/robotests/res/values/themes.xml
+++ b/tests/robotests/res/values/themes.xml
@@ -16,4 +16,14 @@
         <item name="preferenceTheme">@style/PreferenceTheme</item>
         <item name="android:windowLightStatusBar">true</item>
     </style>
+
+    <style name="ThemeOverlay.SwitchBar.Settings" parent="@android:style/ThemeOverlay.Material.ActionBar">
+        <item name="android:textColorPrimary">@android:color/white</item>
+        <item name="switchBarMarginStart">@dimen/switchbar_subsettings_margin_start</item>
+        <item name="switchBarMarginEnd">@dimen/switchbar_subsettings_margin_end</item>
+        <item name="switchBarBackgroundColor">@color/switch_bar_background</item>
+        <item name="switchBarBackgroundActivatedColor">?android:attr/colorAccent</item>
+        <item name="switchBarRestrictionIcon">@drawable/ic_help</item>
+    </style>
+
 </resources>
diff --git a/tests/robotests/src/com/android/settings/testutils/SettingsRobolectricTestRunner.java b/tests/robotests/src/com/android/settings/testutils/SettingsRobolectricTestRunner.java
index 87f0a37..14d5c75 100644
--- a/tests/robotests/src/com/android/settings/testutils/SettingsRobolectricTestRunner.java
+++ b/tests/robotests/src/com/android/settings/testutils/SettingsRobolectricTestRunner.java
@@ -78,6 +78,8 @@
             paths.add(new ResourcePath(null,
                     Fs.fromURL(new URL("file:frameworks/base/packages/SettingsLib/HelpUtils/res/")), null));
             paths.add(new ResourcePath(null,
+                    Fs.fromURL(new URL("file:frameworks/base/packages/SettingsLib/RestrictedLockUtils/res/")), null));
+            paths.add(new ResourcePath(null,
                 Fs.fromURL(new URL("file:frameworks/base/core/res/res")), null));
             paths.add(new ResourcePath(null,
                 Fs.fromURL(new URL("file:frameworks/opt/setupwizard/library/main/res")), null));