Merge "Move ServiceListing to SettingsLib"
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 68cac15..c13e5f3 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -29,6 +29,7 @@
     <uses-permission android:name="android.permission.READ_CONTACTS" />
     <uses-permission android:name="android.permission.WRITE_CONTACTS" />
     <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
+    <uses-permission android:name="android.permission.LOCAL_MAC_ADDRESS" />
     <uses-permission android:name="android.permission.ACCESS_WIMAX_STATE" />
     <uses-permission android:name="android.permission.CHANGE_WIMAX_STATE" />
     <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
@@ -1861,35 +1862,43 @@
 
         <!-- Exported for SystemUI to launch into -->
         <activity android:name=".deviceinfo.StorageWizardInit"
-                android:theme="@style/SuwThemeMaterial.Light"
+                android:theme="@style/SetupWizardStorageStyle"
                 android:taskAffinity="com.android.settings.storage_wizard"
                 android:exported="true"
                 android:permission="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
         <activity android:name=".deviceinfo.StorageWizardFormatConfirm"
+                android:theme="@style/SetupWizardStorageStyle"
                 android:taskAffinity="com.android.settings.storage_wizard"
                 android:exported="false" />
         <activity android:name=".deviceinfo.StorageWizardFormatProgress"
+                android:theme="@style/SetupWizardStorageStyle"
                 android:taskAffinity="com.android.settings.storage_wizard"
                 android:exported="false" />
         <activity android:name=".deviceinfo.StorageWizardMigrate"
+                android:theme="@style/SetupWizardStorageStyle"
                 android:taskAffinity="com.android.settings.storage_wizard"
                 android:exported="false" />
         <activity android:name=".deviceinfo.StorageWizardMigrateConfirm"
+                android:theme="@style/SetupWizardStorageStyle"
                 android:taskAffinity="com.android.settings.storage_wizard"
                 android:exported="false" />
         <activity android:name=".deviceinfo.StorageWizardMigrateProgress"
+                android:theme="@style/SetupWizardStorageStyle"
                 android:taskAffinity="com.android.settings.storage_wizard"
                 android:exported="true"
                 android:permission="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
         <activity android:name=".deviceinfo.StorageWizardReady"
+                android:theme="@style/SetupWizardStorageStyle"
                 android:taskAffinity="com.android.settings.storage_wizard"
                 android:exported="true"
                 android:permission="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
 
         <activity android:name=".deviceinfo.StorageWizardMoveConfirm"
+                android:theme="@style/SetupWizardStorageStyle"
                 android:taskAffinity="com.android.settings.storage_wizard"
                 android:exported="false" />
         <activity android:name=".deviceinfo.StorageWizardMoveProgress"
+                android:theme="@style/SetupWizardStorageStyle"
                 android:taskAffinity="com.android.settings.storage_wizard"
                 android:exported="true"
                 android:permission="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
diff --git a/res/layout/storage_wizard_footer.xml b/res/layout/storage_wizard_footer.xml
new file mode 100644
index 0000000..f8384dc
--- /dev/null
+++ b/res/layout/storage_wizard_footer.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Copyright (C) 2017 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
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    style="@style/SuwGlifButtonBar"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content">
+
+    <Space
+        android:layout_width="0dp"
+        android:layout_height="0dp"
+        android:layout_weight="1" />
+
+    <Button
+        android:id="@+id/storage_next_button"
+        style="@style/SuwGlifButton.Primary"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="@string/suw_next_button_label" />
+
+</LinearLayout>
diff --git a/res/layout/storage_wizard_generic.xml b/res/layout/storage_wizard_generic.xml
index 3050c67..b6aab28 100644
--- a/res/layout/storage_wizard_generic.xml
+++ b/res/layout/storage_wizard_generic.xml
@@ -14,13 +14,13 @@
      limitations under the License.
 -->
 
-<com.android.setupwizardlib.SetupWizardLayout
+<com.android.setupwizardlib.GlifLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     android:id="@+id/setup_wizard_layout"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    app:suwBackgroundTile="@drawable/bg_tile_teal">
+    app:suwFooter="@layout/storage_wizard_footer">
 
     <LinearLayout
         style="@style/SuwContentFrame"
@@ -49,4 +49,4 @@
 
     </LinearLayout>
 
-</com.android.setupwizardlib.SetupWizardLayout>
+</com.android.setupwizardlib.GlifLayout>
diff --git a/res/layout/storage_wizard_init.xml b/res/layout/storage_wizard_init.xml
index 638bfe8..5fc298e 100644
--- a/res/layout/storage_wizard_init.xml
+++ b/res/layout/storage_wizard_init.xml
@@ -14,13 +14,13 @@
      limitations under the License.
 -->
 
-<com.android.setupwizardlib.SetupWizardLayout
+<com.android.setupwizardlib.GlifLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     android:id="@+id/setup_wizard_layout"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    app:suwBackgroundTile="@drawable/bg_tile_teal">
+    app:suwFooter="@layout/storage_wizard_footer">
 
     <LinearLayout
         style="@style/SuwContentFrame"
@@ -66,4 +66,4 @@
 
     </LinearLayout>
 
-</com.android.setupwizardlib.SetupWizardLayout>
+</com.android.setupwizardlib.GlifLayout>
diff --git a/res/layout/storage_wizard_migrate.xml b/res/layout/storage_wizard_migrate.xml
index 6d041fa..a1c1168 100644
--- a/res/layout/storage_wizard_migrate.xml
+++ b/res/layout/storage_wizard_migrate.xml
@@ -14,13 +14,13 @@
      limitations under the License.
 -->
 
-<com.android.setupwizardlib.SetupWizardLayout
+<com.android.setupwizardlib.GlifLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     android:id="@+id/setup_wizard_layout"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    app:suwBackgroundTile="@drawable/bg_tile_teal">
+    app:suwFooter="@layout/storage_wizard_footer">
 
     <LinearLayout
         style="@style/SuwContentFrame"
@@ -58,4 +58,4 @@
 
     </LinearLayout>
 
-</com.android.setupwizardlib.SetupWizardLayout>
+</com.android.setupwizardlib.GlifLayout>
diff --git a/res/layout/storage_wizard_progress.xml b/res/layout/storage_wizard_progress.xml
index e3b37f8..dbeaf66 100644
--- a/res/layout/storage_wizard_progress.xml
+++ b/res/layout/storage_wizard_progress.xml
@@ -14,13 +14,13 @@
      limitations under the License.
 -->
 
-<com.android.setupwizardlib.SetupWizardLayout
+<com.android.setupwizardlib.GlifLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     android:id="@+id/setup_wizard_layout"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    app:suwBackgroundTile="@drawable/bg_tile_teal">
+    app:suwFooter="@layout/storage_wizard_footer">
 
     <LinearLayout
         style="@style/SuwContentFrame"
@@ -54,4 +54,4 @@
 
     </LinearLayout>
 
-</com.android.setupwizardlib.SetupWizardLayout>
+</com.android.setupwizardlib.GlifLayout>
diff --git a/res/layout/storage_wizard_ready.xml b/res/layout/storage_wizard_ready.xml
index d53038d..043b89f 100644
--- a/res/layout/storage_wizard_ready.xml
+++ b/res/layout/storage_wizard_ready.xml
@@ -14,13 +14,13 @@
      limitations under the License.
 -->
 
-<com.android.setupwizardlib.SetupWizardLayout
+<com.android.setupwizardlib.GlifLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     android:id="@+id/setup_wizard_layout"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    app:suwBackgroundTile="@drawable/bg_tile_teal">
+    app:suwFooter="@layout/storage_wizard_footer">
 
     <LinearLayout
         style="@style/SuwContentFrame"
@@ -39,4 +39,4 @@
 
     </LinearLayout>
 
-</com.android.setupwizardlib.SetupWizardLayout>
+</com.android.setupwizardlib.GlifLayout>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index c68eb72..a07bade 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -362,8 +362,7 @@
         <item name="android:textColor">?android:attr/textColorPrimary</item>
     </style>
 
-    <style name="SetupWizardStorageStyle" parent="@style/SuwThemeMaterial.Light">
-        <item name="android:colorAccent">#ff009688</item>
+    <style name="SetupWizardStorageStyle" parent="@style/SuwThemeGlif.Light">
     </style>
 
     <style name="PreviewPagerPageIndicator">
diff --git a/res/xml/location_settings.xml b/res/xml/location_settings.xml
index 96fe905..f8ac192 100644
--- a/res/xml/location_settings.xml
+++ b/res/xml/location_settings.xml
@@ -20,19 +20,9 @@
         android:title="@string/location_settings_title"
         settings:keywords="@string/keywords_location">
 
-        <Preference
-            android:key="location_mode"
-            android:title="@string/location_mode_title"
-            settings:keywords="@string/keywords_location_mode"
-            android:summary="@string/summary_placeholder" />
-
-        <!-- This preference category gets removed if there is no managed profile -->
-        <com.android.settingslib.RestrictedSwitchPreference
-            android:key="managed_profile_location_switch"
-            android:title="@string/managed_profile_location_switch_title"
-            settings:useAdminDisabledSummary="true"
-            android:enabled="false"
-            android:selectable="true" />
+        <PreferenceCategory
+            android:key="recent_location_requests"
+            android:title="@string/location_category_recent_location_requests"/>
 
         <!-- This preference category gets removed if new_recent_location_ui is disabled -->
         <Preference
@@ -49,12 +39,21 @@
             android:title="@string/location_scanning_screen_title"
             android:fragment="com.android.settings.location.ScanningSettings"/>
 
-        <PreferenceCategory
-            android:key="recent_location_requests"
-            android:title="@string/location_category_recent_location_requests" />
+        <!-- This preference category gets removed if there is no managed profile -->
+        <com.android.settingslib.RestrictedSwitchPreference
+            android:key="managed_profile_location_switch"
+            android:title="@string/managed_profile_location_switch_title"
+            settings:useAdminDisabledSummary="true"
+            android:enabled="false"
+            android:selectable="true" />
 
         <PreferenceCategory
             android:key="location_services"
             android:title="@string/location_category_location_services" />
 
+        <Preference
+            android:key="location_mode"
+            android:title="@string/location_mode_title"
+            settings:keywords="@string/keywords_location_mode"
+            android:summary="@string/summary_placeholder" />
 </PreferenceScreen>
diff --git a/src/com/android/settings/accounts/ManagedProfileSettings.java b/src/com/android/settings/accounts/ManagedProfileSettings.java
index 156631c..50b9ecc 100644
--- a/src/com/android/settings/accounts/ManagedProfileSettings.java
+++ b/src/com/android/settings/accounts/ManagedProfileSettings.java
@@ -128,11 +128,8 @@
     @Override
     public boolean onPreferenceChange(Preference preference, Object newValue) {
         if (preference == mWorkModePreference) {
-            if ((boolean) newValue) {
-                mUserManager.trySetQuietModeDisabled(mManagedUser.getIdentifier(), null);
-            } else {
-                mUserManager.setQuietModeEnabled(mManagedUser.getIdentifier(), true);
-            }
+            boolean quietModeEnabled = !(boolean) newValue;
+            mUserManager.trySetQuietModeEnabled(quietModeEnabled, mManagedUser);
             return true;
         }
         if (preference == mContactPrefrence) {
diff --git a/src/com/android/settings/dashboard/conditional/WorkModeCondition.java b/src/com/android/settings/dashboard/conditional/WorkModeCondition.java
index beed7b4..297e35a 100644
--- a/src/com/android/settings/dashboard/conditional/WorkModeCondition.java
+++ b/src/com/android/settings/dashboard/conditional/WorkModeCondition.java
@@ -91,7 +91,7 @@
     public void onActionClick(int index) {
         if (index == 0) {
             if (mUserHandle != null) {
-                mUm.trySetQuietModeDisabled(mUserHandle.getIdentifier(), null);
+                mUm.trySetQuietModeEnabled(false, mUserHandle);
             }
             setActive(false);
         } else {
diff --git a/src/com/android/settings/deviceinfo/StorageWizardBase.java b/src/com/android/settings/deviceinfo/StorageWizardBase.java
index c2ea2d2..5b48666 100644
--- a/src/com/android/settings/deviceinfo/StorageWizardBase.java
+++ b/src/com/android/settings/deviceinfo/StorageWizardBase.java
@@ -20,7 +20,9 @@
 
 import android.annotation.LayoutRes;
 import android.app.Activity;
-import android.graphics.Color;
+import android.content.Context;
+import android.content.res.TypedArray;
+import android.graphics.drawable.Drawable;
 import android.os.Bundle;
 import android.os.SystemClock;
 import android.os.storage.DiskInfo;
@@ -30,16 +32,12 @@
 import android.text.TextUtils;
 import android.util.Log;
 import android.view.View;
-import android.view.ViewGroup;
-import android.view.Window;
-import android.view.WindowManager;
 import android.widget.Button;
 import android.widget.ProgressBar;
 import android.widget.TextView;
 
 import com.android.settings.R;
-import com.android.setupwizardlib.SetupWizardLayout;
-import com.android.setupwizardlib.view.Illustration;
+import com.android.setupwizardlib.GlifLayout;
 
 import java.text.NumberFormat;
 import java.util.List;
@@ -51,8 +49,7 @@
     protected VolumeInfo mVolume;
     protected DiskInfo mDisk;
 
-    private View mCustomNav;
-    private Button mCustomNext;
+    private Button mNext;
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
@@ -72,8 +69,6 @@
             mDisk = mVolume.getDisk();
         }
 
-        setTheme(R.style.SetupWizardStorageStyle);
-
         if (mDisk != null) {
             mStorage.registerListener(mStorageListener);
         }
@@ -83,53 +78,13 @@
     public void setContentView(@LayoutRes int layoutResID) {
         super.setContentView(layoutResID);
 
-        // Our wizard is a unique flower, so it has custom buttons
-        final ViewGroup navParent = (ViewGroup) findViewById(R.id.suw_layout_navigation_bar)
-                .getParent();
-        mCustomNav = getLayoutInflater().inflate(R.layout.storage_wizard_navigation,
-                navParent, false);
-
-        mCustomNext = (Button) mCustomNav.findViewById(R.id.suw_navbar_next);
-        mCustomNext.setOnClickListener(new View.OnClickListener() {
+        mNext = (Button) findViewById(R.id.storage_next_button);
+        mNext.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
                 onNavigateNext();
             }
         });
-
-        // Swap our custom navigation bar into place
-        for (int i = 0; i < navParent.getChildCount(); i++) {
-            if (navParent.getChildAt(i).getId() == R.id.suw_layout_navigation_bar) {
-                navParent.removeViewAt(i);
-                navParent.addView(mCustomNav, i);
-                break;
-            }
-        }
-    }
-
-    @Override
-    protected void onPostCreate(Bundle savedInstanceState) {
-        super.onPostCreate(savedInstanceState);
-
-        final Window window = getWindow();
-        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS |
-                WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN |
-                WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR);
-        window.setStatusBarColor(Color.TRANSPARENT);
-
-        mCustomNav.setSystemUiVisibility(
-                View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
-
-        final View scrollView = findViewById(R.id.suw_bottom_scroll_view);
-        scrollView.setVerticalFadingEdgeEnabled(true);
-        scrollView.setFadingEdgeLength(scrollView.getVerticalFadingEdgeLength() * 2);
-
-        if (findViewById(R.id.suw_layout_decor) instanceof Illustration) {
-            // Our header illustration already have padding baked in
-            final View title = findViewById(R.id.suw_layout_title);
-            title.setPadding(title.getPaddingLeft(), 0, title.getPaddingRight(),
-                    title.getPaddingBottom());
-        }
     }
 
     @Override
@@ -139,11 +94,11 @@
     }
 
     protected Button getNextButton() {
-        return mCustomNext;
+        return mNext;
     }
 
-    protected SetupWizardLayout getSetupWizardLayout() {
-        return (SetupWizardLayout) findViewById(R.id.setup_wizard_layout);
+    protected GlifLayout getGlifLayout() {
+        return (GlifLayout) findViewById(R.id.setup_wizard_layout);
     }
 
     protected ProgressBar getProgressBar() {
@@ -158,7 +113,7 @@
 
     protected void setHeaderText(int resId, String... args) {
         final CharSequence headerText = TextUtils.expandTemplate(getText(resId), args);
-        getSetupWizardLayout().setHeaderText(headerText);
+        getGlifLayout().setHeaderText(headerText);
         setTitle(headerText);
     }
 
@@ -178,27 +133,16 @@
     protected static final int ILLUSTRATION_PORTABLE = 2;
 
     protected void setIllustrationType(int type) {
-        switch (type) {
-            case ILLUSTRATION_SETUP:
-                getSetupWizardLayout().setIllustration(
-                        R.drawable.bg_setup_header,
-                        R.drawable.bg_header_horizontal_tile);
-                break;
-            case ILLUSTRATION_INTERNAL:
-                getSetupWizardLayout().setIllustration(
-                        R.drawable.bg_internal_storage_header,
-                        R.drawable.bg_header_horizontal_tile);
-                break;
-            case ILLUSTRATION_PORTABLE:
-                getSetupWizardLayout().setIllustration(
-                        R.drawable.bg_portable_storage_header,
-                        R.drawable.bg_header_horizontal_tile);
-                break;
-        }
+        // TODO: map type to updated icons once provided by UX
+        TypedArray array = obtainStyledAttributes(new int[] {android.R.attr.colorAccent});
+        Drawable icon = getDrawable(com.android.internal.R.drawable.ic_sd_card_48dp).mutate();
+        icon.setTint(array.getColor(0, 0));
+        array.recycle();
+        getGlifLayout().setIcon(icon);
     }
 
     protected void setKeepScreenOn(boolean keepScreenOn) {
-        getSetupWizardLayout().setKeepScreenOn(keepScreenOn);
+        getGlifLayout().setKeepScreenOn(keepScreenOn);
     }
 
     public void onNavigateNext() {
diff --git a/src/com/android/settings/display/TimeoutPreferenceController.java b/src/com/android/settings/display/TimeoutPreferenceController.java
index 3e1d86a..1d86999 100644
--- a/src/com/android/settings/display/TimeoutPreferenceController.java
+++ b/src/com/android/settings/display/TimeoutPreferenceController.java
@@ -65,7 +65,7 @@
             final RestrictedLockUtils.EnforcedAdmin admin =
                     RestrictedLockUtils.checkIfMaximumTimeToLockIsSet(mContext);
             final long maxTimeout =
-                    dpm.getMaximumTimeToLockForUserAndProfiles(UserHandle.myUserId());
+                    dpm.getMaximumTimeToLock(null /* admin */, UserHandle.myUserId());
             timeoutListPreference.removeUnusableTimeouts(maxTimeout, admin);
         }
         updateTimeoutPreferenceDescription(timeoutListPreference, currentTimeout);
diff --git a/src/com/android/settings/fuelgauge/FakeUid.java b/src/com/android/settings/fuelgauge/FakeUid.java
index 2b5afe1..cbd9c3f 100644
--- a/src/com/android/settings/fuelgauge/FakeUid.java
+++ b/src/com/android/settings/fuelgauge/FakeUid.java
@@ -361,4 +361,14 @@
     public long[] getScreenOffCpuFreqTimes(int which) {
         return null;
     }
+
+    @Override
+    public long[] getCpuFreqTimes(int procState, int which) {
+        return null;
+    }
+
+    @Override
+    public long[] getScreenOffCpuFreqTimes(int procState, int which) {
+        return null;
+    }
 }
diff --git a/src/com/android/settings/location/LocationSettings.java b/src/com/android/settings/location/LocationSettings.java
index 3330421..1279d67 100644
--- a/src/com/android/settings/location/LocationSettings.java
+++ b/src/com/android/settings/location/LocationSettings.java
@@ -73,6 +73,16 @@
     private LocationSwitchBarController mSwitchBarController;
 
     @Override
+    public void onCreate(Bundle icicle) {
+        super.onCreate(icicle);
+        final RecentLocationApps recentLocationApps = new RecentLocationApps(getActivity());
+        int locationRequestsApps = recentLocationApps.getAppList().size();
+        int locationRequestsPrefs = locationRequestsApps == 0 ? 1 : locationRequestsApps;
+        getPreferenceScreen().setInitialExpandedChildrenCount(locationRequestsPrefs + 2);
+    }
+
+
+    @Override
     public int getMetricsCategory() {
         return MetricsEvent.LOCATION;
     }
diff --git a/src/com/android/settings/search/indexing/PreIndexDataCollector.java b/src/com/android/settings/search/indexing/PreIndexDataCollector.java
index a4e1131..63000b4 100644
--- a/src/com/android/settings/search/indexing/PreIndexDataCollector.java
+++ b/src/com/android/settings/search/indexing/PreIndexDataCollector.java
@@ -287,8 +287,14 @@
             String[] projection) {
 
         final ContentResolver resolver = packageContext.getContentResolver();
-        final Cursor cursor = resolver.query(uri, projection, null, null, null);
         final List<String> result = new ArrayList<>();
+        Cursor cursor;
+        try {
+            cursor = resolver.query(uri, projection, null, null, null);
+        } catch (NullPointerException e) {
+            Log.e(TAG, "Exception querying the keys!", e);
+            return result;
+        }
 
         if (cursor == null) {
             Log.w(TAG, "Cannot add index data for Uri: " + uri.toString());
diff --git a/src/com/android/settings/security/screenlock/LockAfterTimeoutPreferenceController.java b/src/com/android/settings/security/screenlock/LockAfterTimeoutPreferenceController.java
index 71c82f0..08e244e 100644
--- a/src/com/android/settings/security/screenlock/LockAfterTimeoutPreferenceController.java
+++ b/src/com/android/settings/security/screenlock/LockAfterTimeoutPreferenceController.java
@@ -107,8 +107,8 @@
         if (mDPM != null) {
             final RestrictedLockUtils.EnforcedAdmin admin =
                     RestrictedLockUtils.checkIfMaximumTimeToLockIsSet(mContext);
-            final long adminTimeout = mDPM
-                    .getMaximumTimeToLockForUserAndProfiles(UserHandle.myUserId());
+            final long adminTimeout =
+                    mDPM.getMaximumTimeToLock(null /* admin */, UserHandle.myUserId());
             final long displayTimeout = Math.max(0,
                     Settings.System.getInt(mContext.getContentResolver(), SCREEN_OFF_TIMEOUT, 0));
             // This setting is a slave to display timeout when a device policy is enforced.
diff --git a/src/com/android/settings/wrapper/DevicePolicyManagerWrapper.java b/src/com/android/settings/wrapper/DevicePolicyManagerWrapper.java
index 2de964f..ccf6c53 100644
--- a/src/com/android/settings/wrapper/DevicePolicyManagerWrapper.java
+++ b/src/com/android/settings/wrapper/DevicePolicyManagerWrapper.java
@@ -223,7 +223,7 @@
      *
      * @see DevicePolicyManager#getMaximumTimeToLock(ComponentName, int)
      */
-    public long getMaximumTimeToLockForUserAndProfiles(@UserIdInt int userHandle) {
-        return mDpm.getMaximumTimeToLockForUserAndProfiles(userHandle);
+    public long getMaximumTimeToLock(@Nullable ComponentName admin, @UserIdInt int userHandle) {
+        return mDpm.getMaximumTimeToLock(admin, userHandle);
     }
 }
diff --git a/tests/robotests/src/com/android/settings/display/TimeoutPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/display/TimeoutPreferenceControllerTest.java
index 80a8ade..33bc4f8 100644
--- a/tests/robotests/src/com/android/settings/display/TimeoutPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/display/TimeoutPreferenceControllerTest.java
@@ -88,8 +88,7 @@
         final int profileUserId = UserHandle.myUserId();
         final long timeout = 10000;
         when(mUserManager.getProfiles(profileUserId)).thenReturn(Collections.emptyList());
-        ShadowDevicePolicyManagerWrapper
-                .setMaximumTimeToLockForUserAndProfiles(profileUserId, timeout);
+        ShadowDevicePolicyManagerWrapper.setMaximumTimeToLock(profileUserId, timeout);
 
         mController.updateState(mPreference);
         verify(mPreference).removeUnusableTimeouts(timeout, null);
diff --git a/tests/robotests/src/com/android/settings/security/screenlock/LockAfterTimeoutPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/security/screenlock/LockAfterTimeoutPreferenceControllerTest.java
index 4541e21..6afd25e 100644
--- a/tests/robotests/src/com/android/settings/security/screenlock/LockAfterTimeoutPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/security/screenlock/LockAfterTimeoutPreferenceControllerTest.java
@@ -129,8 +129,7 @@
         when(mPreference.getEntryValues()).thenReturn(new CharSequence[] {"10000"} );
 
         Settings.System.putInt(mContext.getContentResolver(), SCREEN_OFF_TIMEOUT, displayTimeout);
-        ShadowDevicePolicyManagerWrapper
-                .setMaximumTimeToLockForUserAndProfiles(userId, adminTimeout);
+        ShadowDevicePolicyManagerWrapper.setMaximumTimeToLock(userId, adminTimeout);
 
         mController.updateState((Preference) mPreference);
 
diff --git a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowDevicePolicyManagerWrapper.java b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowDevicePolicyManagerWrapper.java
index 46a0038..5502b37 100644
--- a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowDevicePolicyManagerWrapper.java
+++ b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowDevicePolicyManagerWrapper.java
@@ -47,7 +47,7 @@
     }
 
     @Implementation
-    public long getMaximumTimeToLockForUserAndProfiles(@UserIdInt int userHandle) {
+    public long getMaximumTimeToLock(ComponentName admin, @UserIdInt int userHandle) {
         return profileTimeouts.getOrDefault(userHandle, 0L);
     }
 
@@ -59,8 +59,7 @@
         ShadowDevicePolicyManagerWrapper.deviceOwnerUserId = deviceOwnerUserId;
     }
 
-    public static void setMaximumTimeToLockForUserAndProfiles(
-            @UserIdInt int userHandle, Long timeout) {
+    public static void setMaximumTimeToLock(@UserIdInt int userHandle, Long timeout) {
         profileTimeouts.put(userHandle, timeout);
     }
 }