Use resource processor for Settings

Bug: 293810334
Test: m Settings
Test: robotests
Change-Id: Ie515e137648eddfdfcab5e8095f5be99721d9e1b
diff --git a/Android.bp b/Android.bp
index 861f95f..e3f68e1 100644
--- a/Android.bp
+++ b/Android.bp
@@ -55,6 +55,7 @@
     ],
 
     srcs: ["src/**/*.java", "src/**/*.kt"],
+    use_resource_processor: true,
     resource_dirs: [
         "res",
         "res-export", // for external usage
@@ -136,6 +137,7 @@
     ],
     static_libs: ["Settings-core"],
     uses_libs: ["org.apache.http.legacy"],
+    use_resource_processor: true,
     resource_dirs: [],
     optimize: {
         proguard_flags_files: ["proguard.flags"],
diff --git a/src/com/android/settings/biometrics2/ui/view/FingerprintEnrollIntroFragment.kt b/src/com/android/settings/biometrics2/ui/view/FingerprintEnrollIntroFragment.kt
index 4205225..7b27637 100644
--- a/src/com/android/settings/biometrics2/ui/view/FingerprintEnrollIntroFragment.kt
+++ b/src/com/android/settings/biometrics2/ui/view/FingerprintEnrollIntroFragment.kt
@@ -50,9 +50,9 @@
 import com.google.android.setupdesign.util.DeviceHelper
 import com.google.android.setupdesign.util.DynamicColorPalette
 import com.google.android.setupdesign.util.DynamicColorPalette.ColorType.ACCENT
+import java.util.function.Supplier
 import kotlinx.coroutines.flow.first
 import kotlinx.coroutines.launch
-import java.util.function.Supplier
 
 /**
  * Fingerprint intro onboarding page fragment implementation
@@ -324,6 +324,6 @@
         )
     }
 
-    view.findViewById<ScrollView>(R.id.sud_scroll_view)?.importantForAccessibility =
-        View.IMPORTANT_FOR_ACCESSIBILITY_YES
+    view.findViewById<ScrollView>(com.google.android.setupdesign.R.id.sud_scroll_view)
+        ?.importantForAccessibility = View.IMPORTANT_FOR_ACCESSIBILITY_YES
 }
diff --git a/src/com/android/settings/remoteauth/finish/RemoteAuthEnrollFinish.kt b/src/com/android/settings/remoteauth/finish/RemoteAuthEnrollFinish.kt
index c55b4ed..98df572 100644
--- a/src/com/android/settings/remoteauth/finish/RemoteAuthEnrollFinish.kt
+++ b/src/com/android/settings/remoteauth/finish/RemoteAuthEnrollFinish.kt
@@ -18,12 +18,10 @@
 
 import android.os.Bundle
 import android.view.View
-
+import com.airbnb.lottie.LottieAnimationView
 import com.android.settings.R
 import com.android.settings.remoteauth.RemoteAuthEnrollBase
 import com.android.settingslib.widget.LottieColorUtils
-
-import com.airbnb.lottie.LottieAnimationView
 import com.google.android.setupcompat.template.FooterButton
 
 /**
@@ -45,7 +43,7 @@
             .setText(R.string.security_settings_remoteauth_enroll_finish_btn_next)
             .setListener(this::onPrimaryFooterButtonClick)
             .setButtonType(FooterButton.ButtonType.NEXT)
-            .setTheme(R.style.SudGlifButton_Primary)
+            .setTheme(com.google.android.setupdesign.R.style.SudGlifButton_Primary)
             .build()
     }
 
diff --git a/src/com/android/settings/remoteauth/introduction/RemoteAuthEnrollIntroduction.kt b/src/com/android/settings/remoteauth/introduction/RemoteAuthEnrollIntroduction.kt
index 21b8af2..f0de88e 100644
--- a/src/com/android/settings/remoteauth/introduction/RemoteAuthEnrollIntroduction.kt
+++ b/src/com/android/settings/remoteauth/introduction/RemoteAuthEnrollIntroduction.kt
@@ -49,7 +49,7 @@
             .setText(R.string.security_settings_remoteauth_enroll_introduction_agree)
             .setListener(::onPrimaryFooterButtonClick)
             .setButtonType(FooterButton.ButtonType.OPT_IN)
-            .setTheme(R.style.SudGlifButton_Primary)
+            .setTheme(com.google.android.setupdesign.R.style.SudGlifButton_Primary)
             .build()
     }
 
@@ -58,7 +58,7 @@
             .setText(R.string.security_settings_remoteauth_enroll_introduction_disagree)
             .setListener(::onSecondaryFooterButtonClick)
             .setButtonType(FooterButton.ButtonType.NEXT)
-            .setTheme(R.style.SudGlifButton_Primary)
+            .setTheme(com.google.android.setupdesign.R.style.SudGlifButton_Primary)
             .build()
     }
 
diff --git a/src/com/android/settings/search/actionbar/SearchMenuController.java b/src/com/android/settings/search/actionbar/SearchMenuController.java
index 98c9c1f..8d0c89a 100644
--- a/src/com/android/settings/search/actionbar/SearchMenuController.java
+++ b/src/com/android/settings/search/actionbar/SearchMenuController.java
@@ -86,8 +86,8 @@
             return;
         }
         final MenuItem searchItem = menu.add(Menu.NONE, MENU_SEARCH, 0 /* order */,
-                R.string.search_menu);
-        searchItem.setIcon(R.drawable.ic_search_24dp);
+                com.android.settingslib.search.R.string.search_menu);
+        searchItem.setIcon(com.android.settingslib.search.R.drawable.ic_search_24dp);
         searchItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
 
         searchItem.setOnMenuItemClickListener(target -> {
diff --git a/tests/robotests/Android.bp b/tests/robotests/Android.bp
index c2b7c6a..2bd8721 100644
--- a/tests/robotests/Android.bp
+++ b/tests/robotests/Android.bp
@@ -1,7 +1,3 @@
-    //############################################################
-// Build SettingsRoboTestStub.apk which includes test-only resources.#
-//############################################################
-
 package {
     // See: http://go/android-license-faq
     // A large-scale-change added 'default_applicable_licenses' to import
@@ -11,6 +7,7 @@
     default_applicable_licenses: ["packages_apps_Settings_license"],
 }
 
+// Build SettingsRoboTestStub.apk which includes test-only resources.
 android_app {
     name: "SettingsRoboTestStub",
     defaults: [
@@ -25,33 +22,8 @@
 
     static_libs: [
         "Settings-core",
-        "androidx-constraintlayout_constraintlayout",
-        "androidx.slice_slice-builders",
-        "androidx.slice_slice-core",
-        "androidx.slice_slice-view",
-        "androidx.core_core",
-        "androidx.appcompat_appcompat",
-        "androidx.cardview_cardview",
         "androidx.fragment_fragment-testing",
-        "androidx.preference_preference",
-        "androidx.recyclerview_recyclerview",
-        "androidx.window_window",
-        "com.google.android.material_material",
-        "setupcompat",
-        "setupdesign",
-        "androidx.lifecycle_lifecycle-runtime",
-        "androidx.test.core",
-        "androidx.test.runner",
-        "androidx.test.ext.junit",
         "frameworks-base-testutils",
-        "guava",
-        "jsr305",
-        "settings-contextual-card-protos-lite",
-        "settings-log-bridge-protos-lite",
-        "settings-telephony-protos-lite",
-        "contextualcards",
-        "settings-logtags",
-        "zxing-core-1.7",
     ],
 
     aaptflags: ["--extra-packages com.android.settings"],
@@ -67,9 +39,7 @@
     ],
 }
 
-//############################################################
-// Settings Robolectric test target.                         #
-//############################################################
+// Settings Robolectric test target.
 android_robolectric_test {
     name: "SettingsRoboTests",
     srcs: [
@@ -79,12 +49,12 @@
 
     static_libs: [
         "SettingsLib-robo-testutils",
-        "android-support-annotations",
+        "Settings-robo-testutils",
         "androidx.test.core",
+        "androidx.test.espresso.core",
+        "androidx.test.ext.junit",
         "androidx.test.rules",
         "androidx.test.runner",
-        "androidx.test.ext.junit",
-        "androidx.test.espresso.core",
     ],
 
     libs: [
@@ -109,7 +79,7 @@
 
 java_library {
     name: "Settings-robo-testutils",
-    srcs: ["src/com/android/settings/testutils/**/*.java"],
+    srcs: ["testutils/**/*.java"],
 
     libs: [
         "Settings-core",
diff --git a/tests/robotests/src/com/android/settings/remoteauth/finish/RemoteAuthEnrollFinishTest.kt b/tests/robotests/src/com/android/settings/remoteauth/finish/RemoteAuthEnrollFinishTest.kt
index 7bb5c45..0f9911b 100644
--- a/tests/robotests/src/com/android/settings/remoteauth/finish/RemoteAuthEnrollFinishTest.kt
+++ b/tests/robotests/src/com/android/settings/remoteauth/finish/RemoteAuthEnrollFinishTest.kt
@@ -35,21 +35,29 @@
 
     @Test
     fun testRemoteAuthenticatorEnrollFinish_hasHeader() {
-        launchFragmentInContainer<RemoteAuthEnrollFinish>(Bundle(), R.style.SudThemeGlif)
-            .onFragment {
-                assertThat((it.view as GlifLayout).headerText)
-                    .isEqualTo(mContext.getString(
-                        R.string.security_settings_remoteauth_enroll_finish_title))
-            }
+        launchFragmentInContainer<RemoteAuthEnrollFinish>(
+            Bundle(),
+            com.google.android.setupdesign.R.style.SudThemeGlif,
+        ).onFragment {
+            assertThat((it.view as GlifLayout).headerText)
+                .isEqualTo(
+                    mContext.getString(R.string.security_settings_remoteauth_enroll_finish_title)
+                )
+        }
     }
 
     @Test
     fun testRemoteAuthenticatorEnrollFinish_hasDescription() {
-        launchFragmentInContainer<RemoteAuthEnrollFinish>(Bundle(), R.style.SudThemeGlif)
-            .onFragment {
-                assertThat((it.view as GlifLayout).descriptionText)
-                    .isEqualTo(mContext.getString(
-                        R.string.security_settings_remoteauth_enroll_finish_description))
-            }
+        launchFragmentInContainer<RemoteAuthEnrollFinish>(
+            Bundle(),
+            com.google.android.setupdesign.R.style.SudThemeGlif,
+        ).onFragment {
+            assertThat((it.view as GlifLayout).descriptionText)
+                .isEqualTo(
+                    mContext.getString(
+                        R.string.security_settings_remoteauth_enroll_finish_description
+                    )
+                )
+        }
     }
-}
\ No newline at end of file
+}
diff --git a/tests/robotests/src/com/android/settings/remoteauth/introduction/RemoteAuthEnrollIntroductionTest.kt b/tests/robotests/src/com/android/settings/remoteauth/introduction/RemoteAuthEnrollIntroductionTest.kt
index a271184..1ca0119 100644
--- a/tests/robotests/src/com/android/settings/remoteauth/introduction/RemoteAuthEnrollIntroductionTest.kt
+++ b/tests/robotests/src/com/android/settings/remoteauth/introduction/RemoteAuthEnrollIntroductionTest.kt
@@ -30,23 +30,31 @@
 
 @RunWith(RobolectricTestRunner::class)
 class RemoteAuthEnrollIntroductionTest {
-    private var mContext : Context = ApplicationProvider.getApplicationContext()
+    private var mContext: Context = ApplicationProvider.getApplicationContext()
 
     @Test
     fun testRemoteAuthenticatorEnrollIntroduction_hasHeader() {
-        launchFragmentInContainer<RemoteAuthEnrollIntroduction>(Bundle(), R.style.SudThemeGlif)
-            .onFragment {
-                assertThat((it.view as GlifLayout).headerText)
-                    .isEqualTo(mContext.getString(R.string.security_settings_remoteauth_enroll_introduction_title))
-            }
+        launchFragmentInContainer<RemoteAuthEnrollIntroduction>(
+            Bundle(),
+            com.google.android.setupdesign.R.style.SudThemeGlif,
+        ).onFragment {
+            assertThat((it.view as GlifLayout).headerText)
+                .isEqualTo(mContext.getString(R.string.security_settings_remoteauth_enroll_introduction_title))
+        }
     }
 
     @Test
     fun testRemoteAuthenticatorEnrollIntroduction_hasDescription() {
-        launchFragmentInContainer<RemoteAuthEnrollIntroduction>(Bundle(), R.style.SudThemeGlif)
-            .onFragment {
-                assertThat((it.view as GlifLayout).descriptionText)
-                    .isEqualTo(mContext.getString(R.string.security_settings_remoteauth_enroll_introduction_message))
-            }
+        launchFragmentInContainer<RemoteAuthEnrollIntroduction>(
+            Bundle(),
+            com.google.android.setupdesign.R.style.SudThemeGlif,
+        ).onFragment {
+            assertThat((it.view as GlifLayout).descriptionText)
+                .isEqualTo(
+                    mContext.getString(
+                        R.string.security_settings_remoteauth_enroll_introduction_message
+                    )
+                )
+        }
     }
-}
\ No newline at end of file
+}
diff --git a/tests/robotests/src/com/android/settings/search/actionbar/SearchMenuControllerTest.java b/tests/robotests/src/com/android/settings/search/actionbar/SearchMenuControllerTest.java
index eb6ad0c..d898e64 100644
--- a/tests/robotests/src/com/android/settings/search/actionbar/SearchMenuControllerTest.java
+++ b/tests/robotests/src/com/android/settings/search/actionbar/SearchMenuControllerTest.java
@@ -33,7 +33,6 @@
 
 import androidx.fragment.app.FragmentActivity;
 
-import com.android.settings.R;
 import com.android.settings.core.InstrumentedFragment;
 import com.android.settings.testutils.shadow.ShadowUtils;
 
@@ -72,7 +71,7 @@
 
         when(mHost.getActivity()).thenReturn(mActivity);
         when(mMenu.add(Menu.NONE, MENU_SEARCH, 0 /* order */,
-                R.string.search_menu))
+                com.android.settingslib.search.R.string.search_menu))
                 .thenReturn(mock(MenuItem.class));
     }
 
@@ -82,7 +81,7 @@
         mHost.getSettingsLifecycle().onCreateOptionsMenu(mMenu, null /* inflater */);
 
         verify(mMenu).add(Menu.NONE, MENU_SEARCH, 0 /* order */,
-                R.string.search_menu);
+                com.android.settingslib.search.R.string.search_menu);
     }
 
     @Test
diff --git a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowAccessPoint.java b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowAccessPoint.java
deleted file mode 100644
index 7d206f4..0000000
--- a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowAccessPoint.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.settings.testutils.shadow;
-
-import com.android.settingslib.wifi.AccessPoint;
-
-import org.robolectric.annotation.Implementation;
-import org.robolectric.annotation.Implements;
-
-@Implements(AccessPoint.class)
-public class ShadowAccessPoint {
-
-    @Implementation
-    protected String getSavedNetworkSummary() {
-        return "saved";
-    }
-}
diff --git a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowAppInfoBase.java b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowAppInfoBase.java
deleted file mode 100644
index f8cdb22..0000000
--- a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowAppInfoBase.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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
- */
-
-package com.android.settings.testutils.shadow;
-
-import com.android.settings.applications.AppInfoBase;
-
-import org.robolectric.annotation.Implementation;
-import org.robolectric.annotation.Implements;
-
-@Implements(AppInfoBase.class)
-public class ShadowAppInfoBase {
-
-    @Implementation
-    protected void onResume() {
-        // No-op.
-    }
-
-    @Implementation
-    protected void onPause() {
-        // No-op.
-    }
-}
diff --git a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowDataSaverBackend.java b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowDataSaverBackend.java
deleted file mode 100644
index 4d1a2ed..0000000
--- a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowDataSaverBackend.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.android.settings.testutils.shadow;
-
-import com.android.settings.datausage.DataSaverBackend;
-
-import org.robolectric.annotation.Implementation;
-import org.robolectric.annotation.Implements;
-
-@Implements(DataSaverBackend.class)
-public class ShadowDataSaverBackend {
-
-    private static boolean isEnabled = true;
-
-    @Implementation
-    protected boolean isDataSaverEnabled() {
-        return isEnabled;
-    }
-
-    @Implementation
-    protected void setDataSaverEnabled(boolean enabled) {
-        isEnabled = enabled;
-    }
-}
diff --git a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowInputManager.java b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowInputManager.java
deleted file mode 100644
index c0f7134..0000000
--- a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowInputManager.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2016 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
- */
-
-package com.android.settings.testutils.shadow;
-
-import static org.robolectric.util.ReflectionHelpers.ClassParameter.from;
-
-import android.hardware.input.IInputManager;
-import android.hardware.input.InputManager;
-import android.os.Handler;
-
-import org.robolectric.annotation.Implementation;
-import org.robolectric.annotation.Implements;
-import org.robolectric.util.ReflectionHelpers;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Shadow for {@link InputManager} that has accessors for registered
- * {@link InputManager.InputDeviceListener}s.
- */
-@Implements(value = InputManager.class, callThroughByDefault = false)
-public class ShadowInputManager {
-
-    private List<InputManager.InputDeviceListener> mInputDeviceListeners;
-
-    @Implementation
-    protected void __constructor__(IInputManager service) {
-        mInputDeviceListeners = new ArrayList<>();
-    }
-
-    @Implementation
-    protected static InputManager getInstance() {
-        return ReflectionHelpers.callConstructor(
-                InputManager.class,
-                from(IInputManager.class, null));
-    }
-
-    @Implementation
-    protected void registerInputDeviceListener(InputManager.InputDeviceListener listener,
-            Handler handler) {
-        // TODO: Use handler.
-        if (!mInputDeviceListeners.contains(listener)) {
-            mInputDeviceListeners.add(listener);
-        }
-    }
-
-    @Implementation
-    protected void unregisterInputDeviceListener(InputManager.InputDeviceListener listener) {
-        mInputDeviceListeners.remove(listener);
-    }
-}
diff --git a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowNetworkDetailsTracker.java b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowNetworkDetailsTracker.java
deleted file mode 100644
index 5df9ba5..0000000
--- a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowNetworkDetailsTracker.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-package com.android.settings.testutils.shadow;
-
-import static org.mockito.Mockito.mock;
-
-import android.content.Context;
-import android.net.ConnectivityManager;
-import android.net.NetworkScoreManager;
-import android.net.wifi.WifiManager;
-import android.os.Handler;
-
-import androidx.annotation.NonNull;
-import androidx.lifecycle.Lifecycle;
-
-import com.android.wifitrackerlib.NetworkDetailsTracker;
-import com.android.wifitrackerlib.WifiEntry;
-
-import org.robolectric.annotation.Implementation;
-import org.robolectric.annotation.Implements;
-
-import java.time.Clock;
-
-@Implements(NetworkDetailsTracker.class)
-public class ShadowNetworkDetailsTracker {
-
-    @Implementation
-    public static NetworkDetailsTracker createNetworkDetailsTracker(@NonNull Lifecycle lifecycle,
-            @NonNull Context context,
-            @NonNull WifiManager wifiManager,
-            @NonNull ConnectivityManager connectivityManager,
-            @NonNull NetworkScoreManager networkScoreManager,
-            @NonNull Handler mainHandler,
-            @NonNull Handler workerHandler,
-            @NonNull Clock clock,
-            long maxScanAgeMillis,
-            long scanIntervalMillis,
-            String key) {
-        return mock(NetworkDetailsTracker.class);
-    }
-
-    @Implementation
-    public WifiEntry getWifiEntry() {
-        return mock(WifiEntry.class);
-    }
-}
diff --git a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowPermissionControllerManager.java b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowPermissionControllerManager.java
deleted file mode 100644
index 6a6f710..0000000
--- a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowPermissionControllerManager.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-package com.android.settings.testutils.shadow;
-
-import android.annotation.CallbackExecutor;
-import android.content.Context;
-import android.os.Handler;
-import android.permission.PermissionControllerManager;
-
-import androidx.annotation.NonNull;
-
-import org.robolectric.annotation.Implementation;
-import org.robolectric.annotation.Implements;
-
-import java.util.concurrent.Executor;
-
-@Implements(PermissionControllerManager.class)
-public class ShadowPermissionControllerManager {
-
-    protected void __constructor__(Context contexts, Handler handler) {
-        // no nothing, everything is shadowed
-    }
-
-    @Implementation
-    public void getPermissionUsages(boolean countSystem, long numMillis,
-            @NonNull @CallbackExecutor Executor executor,
-            @NonNull PermissionControllerManager.OnPermissionUsageResultCallback callback) {
-
-        // Do nothing
-    }
-}
diff --git a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowWifiManager.java b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowWifiManager.java
deleted file mode 100644
index ea57bf7..0000000
--- a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowWifiManager.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.settings.testutils.shadow;
-
-import static org.robolectric.RuntimeEnvironment.application;
-
-import android.net.wifi.ScanResult;
-import android.net.wifi.SoftApConfiguration;
-import android.net.wifi.WifiConfiguration;
-import android.net.wifi.WifiManager;
-import android.net.wifi.hotspot2.PasspointConfiguration;
-
-import org.robolectric.annotation.HiddenApi;
-import org.robolectric.annotation.Implementation;
-import org.robolectric.annotation.Implements;
-import org.robolectric.shadow.api.Shadow;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-@Implements(value = WifiManager.class)
-public class ShadowWifiManager extends org.robolectric.shadows.ShadowWifiManager {
-
-    private List<PasspointConfiguration> mPasspointConfiguration;
-
-    public WifiConfiguration savedWifiConfig;
-    private SoftApConfiguration mSavedApConfig;
-
-    @Implementation
-    protected SoftApConfiguration getSoftApConfiguration() {
-        return mSavedApConfig;
-    }
-
-    @Implementation
-    protected boolean setSoftApConfiguration(SoftApConfiguration softApConfig) {
-        mSavedApConfig = softApConfig;
-        return true;
-    }
-
-    @HiddenApi // @SystemApi
-    @Implementation
-    protected void connect(WifiConfiguration config, WifiManager.ActionListener listener) {
-        savedWifiConfig = config;
-    }
-
-    @HiddenApi
-    @Implementation
-    protected void save(WifiConfiguration config, WifiManager.ActionListener listener) {
-        savedWifiConfig = config;
-    }
-
-    @Implementation
-    protected List<PasspointConfiguration> getPasspointConfigurations() {
-        return mPasspointConfiguration == null ? Collections.emptyList() : mPasspointConfiguration;
-    }
-
-    @Implementation
-    protected void addOrUpdatePasspointConfiguration(PasspointConfiguration config) {
-        if (mPasspointConfiguration == null) {
-            mPasspointConfiguration = new ArrayList<>();
-        }
-        mPasspointConfiguration.add(config);
-    }
-
-    @Implementation
-    protected boolean isDualModeSupported() {
-        return false;
-    }
-
-    @Implementation
-    protected List<ScanResult> getScanResults() {
-        return new ArrayList<ScanResult>();
-    }
-
-    public static ShadowWifiManager get() {
-        return Shadow.extract(application.getSystemService(WifiManager.class));
-    }
-}
diff --git a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowWifiP2pManager.java b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowWifiP2pManager.java
deleted file mode 100644
index 2fd8f6b..0000000
--- a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowWifiP2pManager.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.settings.testutils.shadow;
-
-import android.net.wifi.p2p.WifiP2pManager;
-
-import org.robolectric.annotation.Implementation;
-import org.robolectric.annotation.Implements;
-import org.robolectric.annotation.Resetter;
-
-/**
- * Shadow class for WifiP2pManager.
- */
-@Implements(value = WifiP2pManager.class)
-public class ShadowWifiP2pManager extends org.robolectric.shadows.ShadowWifiP2pManager {
-
-    private static int sFactoryResetCount;
-
-    @Implementation
-    protected void factoryReset(WifiP2pManager.Channel c, WifiP2pManager.ActionListener listener) {
-        if (c != null) {
-            sFactoryResetCount++;
-        } else {
-            throw new IllegalArgumentException("channel must be non-null.");
-        }
-    }
-
-    @Resetter
-    public static void reset() {
-        sFactoryResetCount = 0;
-    }
-
-    /**
-     * Return the count of factoryReset called.
-     *
-     * @return the count of factoryReset called.
-     */
-    public static int getFactoryResetCount() {
-        return sFactoryResetCount;
-    }
-}
diff --git a/tests/robotests/src/com/android/settings/testutils/CustomActivity.java b/tests/robotests/testutils/com/android/settings/testutils/CustomActivity.java
similarity index 100%
rename from tests/robotests/src/com/android/settings/testutils/CustomActivity.java
rename to tests/robotests/testutils/com/android/settings/testutils/CustomActivity.java
diff --git a/tests/robotests/src/com/android/settings/testutils/DatabaseTestUtils.java b/tests/robotests/testutils/com/android/settings/testutils/DatabaseTestUtils.java
similarity index 100%
rename from tests/robotests/src/com/android/settings/testutils/DatabaseTestUtils.java
rename to tests/robotests/testutils/com/android/settings/testutils/DatabaseTestUtils.java
diff --git a/tests/robotests/src/com/android/settings/testutils/FakeFeatureFactory.java b/tests/robotests/testutils/com/android/settings/testutils/FakeFeatureFactory.java
similarity index 99%
rename from tests/robotests/src/com/android/settings/testutils/FakeFeatureFactory.java
rename to tests/robotests/testutils/com/android/settings/testutils/FakeFeatureFactory.java
index d586db5..c8db62f 100644
--- a/tests/robotests/src/com/android/settings/testutils/FakeFeatureFactory.java
+++ b/tests/robotests/testutils/com/android/settings/testutils/FakeFeatureFactory.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 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.
@@ -11,7 +11,7 @@
  * 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
+ * limitations under the License.
  */
 package com.android.settings.testutils;
 
@@ -23,7 +23,6 @@
 import com.android.settings.accessibility.AccessibilitySearchFeatureProvider;
 import com.android.settings.accounts.AccountFeatureProvider;
 import com.android.settings.applications.ApplicationFeatureProvider;
-import com.android.settings.onboarding.OnboardingFeatureProvider;
 import com.android.settings.biometrics.face.FaceFeatureProvider;
 import com.android.settings.biometrics2.factory.BiometricsRepositoryProvider;
 import com.android.settings.bluetooth.BluetoothFeatureProvider;
@@ -39,6 +38,7 @@
 import com.android.settings.homepage.contextualcards.ContextualCardFeatureProvider;
 import com.android.settings.inputmethod.KeyboardSettingsFeatureProvider;
 import com.android.settings.localepicker.LocaleFeatureProvider;
+import com.android.settings.onboarding.OnboardingFeatureProvider;
 import com.android.settings.overlay.DockUpdaterFeatureProvider;
 import com.android.settings.overlay.FeatureFactory;
 import com.android.settings.overlay.SupportFeatureProvider;
diff --git a/tests/robotests/src/com/android/settings/testutils/ResolveInfoBuilder.java b/tests/robotests/testutils/com/android/settings/testutils/ResolveInfoBuilder.java
similarity index 100%
rename from tests/robotests/src/com/android/settings/testutils/ResolveInfoBuilder.java
rename to tests/robotests/testutils/com/android/settings/testutils/ResolveInfoBuilder.java
diff --git a/tests/robotests/src/com/android/settings/testutils/shadow/SettingsShadowResources.java b/tests/robotests/testutils/com/android/settings/testutils/shadow/SettingsShadowResources.java
similarity index 82%
rename from tests/robotests/src/com/android/settings/testutils/shadow/SettingsShadowResources.java
rename to tests/robotests/testutils/com/android/settings/testutils/shadow/SettingsShadowResources.java
index 8ca577c..b2d5484 100644
--- a/tests/robotests/src/com/android/settings/testutils/shadow/SettingsShadowResources.java
+++ b/tests/robotests/testutils/com/android/settings/testutils/shadow/SettingsShadowResources.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2023 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.
+ */
+
 package com.android.settings.testutils.shadow;
 
 import static org.robolectric.RuntimeEnvironment.application;
diff --git a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowAccessibilityServiceInfo.java b/tests/robotests/testutils/com/android/settings/testutils/shadow/ShadowAccessibilityServiceInfo.java
similarity index 100%
rename from tests/robotests/src/com/android/settings/testutils/shadow/ShadowAccessibilityServiceInfo.java
rename to tests/robotests/testutils/com/android/settings/testutils/shadow/ShadowAccessibilityServiceInfo.java
diff --git a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowActivity.java b/tests/robotests/testutils/com/android/settings/testutils/shadow/ShadowActivity.java
similarity index 100%
rename from tests/robotests/src/com/android/settings/testutils/shadow/ShadowActivity.java
rename to tests/robotests/testutils/com/android/settings/testutils/shadow/ShadowActivity.java
diff --git a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowActivityEmbeddingUtils.java b/tests/robotests/testutils/com/android/settings/testutils/shadow/ShadowActivityEmbeddingUtils.java
similarity index 100%
rename from tests/robotests/src/com/android/settings/testutils/shadow/ShadowActivityEmbeddingUtils.java
rename to tests/robotests/testutils/com/android/settings/testutils/shadow/ShadowActivityEmbeddingUtils.java
diff --git a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowAlertDialogCompat.java b/tests/robotests/testutils/com/android/settings/testutils/shadow/ShadowAlertDialogCompat.java
similarity index 82%
rename from tests/robotests/src/com/android/settings/testutils/shadow/ShadowAlertDialogCompat.java
rename to tests/robotests/testutils/com/android/settings/testutils/shadow/ShadowAlertDialogCompat.java
index e595cb6..d6d17f8 100644
--- a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowAlertDialogCompat.java
+++ b/tests/robotests/testutils/com/android/settings/testutils/shadow/ShadowAlertDialogCompat.java
@@ -38,39 +38,40 @@
 
     @SuppressLint("StaticFieldLeak")
     @Nullable
-    private static ShadowAlertDialogCompat latestSupportAlertDialog;
+    private static ShadowAlertDialogCompat sLatestSupportAlertDialog;
     @RealObject
-    private AlertDialog realAlertDialog;
+    private AlertDialog mRealAlertDialog;
 
     @Implementation
     public void show() {
         super.show();
-        latestSupportAlertDialog = this;
+        sLatestSupportAlertDialog = this;
     }
 
     public CharSequence getMessage() {
-        final Object alertController = ReflectionHelpers.getField(realAlertDialog, "mAlert");
+        final Object alertController = ReflectionHelpers.getField(mRealAlertDialog, "mAlert");
         return ReflectionHelpers.getField(alertController, "mMessage");
     }
 
     public CharSequence getTitle() {
-        final Object alertController = ReflectionHelpers.getField(realAlertDialog, "mAlert");
+        final Object alertController = ReflectionHelpers.getField(mRealAlertDialog, "mAlert");
         return ReflectionHelpers.getField(alertController, "mTitle");
     }
 
     public View getView() {
-        final Object alertController = ReflectionHelpers.getField(realAlertDialog, "mAlert");
+        final Object alertController = ReflectionHelpers.getField(mRealAlertDialog, "mAlert");
         return ReflectionHelpers.getField(alertController, "mView");
     }
 
     @Nullable
     public static AlertDialog getLatestAlertDialog() {
-        return latestSupportAlertDialog == null ? null : latestSupportAlertDialog.realAlertDialog;
+        return sLatestSupportAlertDialog == null
+                ? null : sLatestSupportAlertDialog.mRealAlertDialog;
     }
 
     @Resetter
     public static void reset() {
-        latestSupportAlertDialog = null;
+        sLatestSupportAlertDialog = null;
     }
 
     public static ShadowAlertDialogCompat shadowOf(AlertDialog alertDialog) {
@@ -78,6 +79,6 @@
     }
 
     public void clickOnItem(int index) {
-        Shadows.shadowOf(realAlertDialog.getListView()).performItemClick(index);
+        Shadows.shadowOf(mRealAlertDialog.getListView()).performItemClick(index);
     }
-}
\ No newline at end of file
+}
diff --git a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowBluetoothAdapter.java b/tests/robotests/testutils/com/android/settings/testutils/shadow/ShadowBluetoothAdapter.java
similarity index 100%
rename from tests/robotests/src/com/android/settings/testutils/shadow/ShadowBluetoothAdapter.java
rename to tests/robotests/testutils/com/android/settings/testutils/shadow/ShadowBluetoothAdapter.java
diff --git a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowConnectivityManager.java b/tests/robotests/testutils/com/android/settings/testutils/shadow/ShadowConnectivityManager.java
similarity index 100%
rename from tests/robotests/src/com/android/settings/testutils/shadow/ShadowConnectivityManager.java
rename to tests/robotests/testutils/com/android/settings/testutils/shadow/ShadowConnectivityManager.java
diff --git a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowApplicationsState.java b/tests/robotests/testutils/com/android/settings/testutils/shadow/ShadowDataSaverBackend.java
similarity index 63%
rename from tests/robotests/src/com/android/settings/testutils/shadow/ShadowApplicationsState.java
rename to tests/robotests/testutils/com/android/settings/testutils/shadow/ShadowDataSaverBackend.java
index 8239ed9..f97a70e 100644
--- a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowApplicationsState.java
+++ b/tests/robotests/testutils/com/android/settings/testutils/shadow/ShadowDataSaverBackend.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 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.
@@ -16,17 +16,23 @@
 
 package com.android.settings.testutils.shadow;
 
-import android.os.Looper;
-
-import com.android.settingslib.applications.ApplicationsState;
+import com.android.settings.datausage.DataSaverBackend;
 
 import org.robolectric.annotation.Implementation;
 import org.robolectric.annotation.Implements;
 
-@Implements(ApplicationsState.class)
-public class ShadowApplicationsState {
+@Implements(DataSaverBackend.class)
+public class ShadowDataSaverBackend {
+
+    private static boolean sIsEnabled = true;
+
     @Implementation
-    protected Looper getBackgroundLooper() {
-        return Looper.getMainLooper();
+    protected boolean isDataSaverEnabled() {
+        return sIsEnabled;
+    }
+
+    @Implementation
+    protected void setDataSaverEnabled(boolean enabled) {
+        sIsEnabled = enabled;
     }
 }
diff --git a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowFragment.java b/tests/robotests/testutils/com/android/settings/testutils/shadow/ShadowFragment.java
similarity index 100%
rename from tests/robotests/src/com/android/settings/testutils/shadow/ShadowFragment.java
rename to tests/robotests/testutils/com/android/settings/testutils/shadow/ShadowFragment.java
diff --git a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowInteractionJankMonitor.java b/tests/robotests/testutils/com/android/settings/testutils/shadow/ShadowInteractionJankMonitor.java
similarity index 100%
rename from tests/robotests/src/com/android/settings/testutils/shadow/ShadowInteractionJankMonitor.java
rename to tests/robotests/testutils/com/android/settings/testutils/shadow/ShadowInteractionJankMonitor.java
diff --git a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowLockPatternUtils.java b/tests/robotests/testutils/com/android/settings/testutils/shadow/ShadowLockPatternUtils.java
similarity index 94%
rename from tests/robotests/src/com/android/settings/testutils/shadow/ShadowLockPatternUtils.java
rename to tests/robotests/testutils/com/android/settings/testutils/shadow/ShadowLockPatternUtils.java
index 9afcd37..d0bb2bf 100644
--- a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowLockPatternUtils.java
+++ b/tests/robotests/testutils/com/android/settings/testutils/shadow/ShadowLockPatternUtils.java
@@ -114,8 +114,8 @@
     }
 
     @Implementation
-    protected byte[] getPasswordHistoryHashFactor(LockscreenCredential currentPassword,
-            int userId) {
+    protected byte[] getPasswordHistoryHashFactor(
+            LockscreenCredential currentPassword, int userId) {
         return null;
     }
 
@@ -130,8 +130,8 @@
     }
 
     @Implementation
-    public @DevicePolicyManager.PasswordComplexity int getRequestedPasswordComplexity(int userId,
-            boolean deviceWideOnly) {
+    @DevicePolicyManager.PasswordComplexity
+    public int getRequestedPasswordComplexity(int userId, boolean deviceWideOnly) {
         int complexity = sUserToComplexityMap.getOrDefault(userId,
                 DevicePolicyManager.PASSWORD_COMPLEXITY_NONE);
         if (!deviceWideOnly) {
@@ -178,14 +178,16 @@
     }
 
     @Implementation
-    public boolean setLockCredential(@NonNull LockscreenCredential newCredential,
+    public boolean setLockCredential(
+            @NonNull LockscreenCredential newCredential,
             @NonNull LockscreenCredential savedCredential, int userHandle) {
         setIsSecure(userHandle, true);
         return true;
     }
 
     @Implementation
-    public boolean checkCredential(@NonNull LockscreenCredential credential, int userId,
+    public boolean checkCredential(
+            @NonNull LockscreenCredential credential, int userId,
             @Nullable LockPatternUtils.CheckCredentialProgressCallback progressCallback)
             throws LockPatternUtils.RequestThrottledException {
         return true;
diff --git a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowThreadUtils.java b/tests/robotests/testutils/com/android/settings/testutils/shadow/ShadowThreadUtils.java
similarity index 100%
rename from tests/robotests/src/com/android/settings/testutils/shadow/ShadowThreadUtils.java
rename to tests/robotests/testutils/com/android/settings/testutils/shadow/ShadowThreadUtils.java
diff --git a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowUserManager.java b/tests/robotests/testutils/com/android/settings/testutils/shadow/ShadowUserManager.java
similarity index 98%
rename from tests/robotests/src/com/android/settings/testutils/shadow/ShadowUserManager.java
rename to tests/robotests/testutils/com/android/settings/testutils/shadow/ShadowUserManager.java
index 324a829..0b3d3f9 100644
--- a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowUserManager.java
+++ b/tests/robotests/testutils/com/android/settings/testutils/shadow/ShadowUserManager.java
@@ -52,7 +52,7 @@
     private final Set<Integer> mManagedProfiles = new HashSet<>();
     private final Set<String> mEnabledTypes = new HashSet<>();
     private boolean mIsQuietModeEnabled = false;
-    private int[] profileIdsForUser = new int[0];
+    private int[] mProfileIdsForUser = new int[0];
     private boolean mUserSwitchEnabled;
     private Bundle mDefaultGuestUserRestriction = new Bundle();
     private boolean mIsGuestUser = false;
@@ -154,11 +154,11 @@
 
     @Implementation
     protected int[] getProfileIdsWithDisabled(@UserIdInt int userId) {
-        return profileIdsForUser;
+        return mProfileIdsForUser;
     }
 
     public void setProfileIdsWithDisabled(int[] profileIds) {
-        profileIdsForUser = profileIds;
+        mProfileIdsForUser = profileIds;
     }
 
     @Implementation
diff --git a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowUtils.java b/tests/robotests/testutils/com/android/settings/testutils/shadow/ShadowUtils.java
similarity index 100%
rename from tests/robotests/src/com/android/settings/testutils/shadow/ShadowUtils.java
rename to tests/robotests/testutils/com/android/settings/testutils/shadow/ShadowUtils.java