Merge "Fix Settings app ANR due to blocking IDumpstateDevice IPC call" into udc-qpr-dev
diff --git a/res-product/values/strings.xml b/res-product/values/strings.xml
index cc22617..dd2af3f 100644
--- a/res-product/values/strings.xml
+++ b/res-product/values/strings.xml
@@ -692,6 +692,12 @@
     <!-- Description for interrupting the voice call alert. [CHAR_LIMIT=NONE] -->
     <string name="reset_internet_text" product="tablet">This will end your phone call</string>
 
+    <!-- Help URI, battery saver page [DO NOT TRANSLATE] -->
+    <string name="help_url_battery_saver_settings" translatable="false" product="default"></string>
+
+    <!-- Help URI, app usage page [DO NOT TRANSLATE] -->
+    <string name="help_url_app_usage_settings" translatable="false" product="default"></string>
+
     <!-- An explanation text that the pattern needs to be solved because the device was factory reset. [CHAR LIMIT=100] -->
     <string name="lockpassword_confirm_your_pattern_details_frp" product="default">Your phone was reset to factory settings. To use this phone, enter your previous pattern.</string>
     <!-- An explanation text that the pattern needs to be solved because the device was factory reset. [CHAR LIMIT=100] -->
diff --git a/res/drawable/button_border_selected.xml b/res/drawable/button_border_selected.xml
deleted file mode 100644
index 3757517..0000000
--- a/res/drawable/button_border_selected.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-  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.
-  -->
-<shape xmlns:android="http://schemas.android.com/apk/res/android"
-       xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
-       android:shape="rectangle">
-    <solid
-        android:color="?androidprv:attr/materialColorSecondaryContainer" />
-    <stroke
-        android:width="1dp"
-        android:color="?androidprv:attr/materialColorOnSecondaryContainer"/>
-    <corners android:radius="@dimen/rect_button_radius" />
-</shape>
diff --git a/res/drawable/button_border_unselected.xml b/res/drawable/notification_importance_button_background_selected.xml
similarity index 81%
copy from res/drawable/button_border_unselected.xml
copy to res/drawable/notification_importance_button_background_selected.xml
index c97a5ba..3c513cd 100644
--- a/res/drawable/button_border_unselected.xml
+++ b/res/drawable/notification_importance_button_background_selected.xml
@@ -15,10 +15,11 @@
   limitations under the License.
   -->
 <shape xmlns:android="http://schemas.android.com/apk/res/android"
-       xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
        android:shape="rectangle">
+    <solid
+        android:color="?attr/notification_importance_button_background_color_selected"/>
     <stroke
         android:width="1dp"
-        android:color="?androidprv:attr/materialColorOutlineVariant"/>
+        android:color="?attr/notification_importance_button_border_color_selected"/>
     <corners android:radius="@dimen/rect_button_radius" />
 </shape>
diff --git a/res/drawable/button_border_unselected.xml b/res/drawable/notification_importance_button_background_unselected.xml
similarity index 81%
rename from res/drawable/button_border_unselected.xml
rename to res/drawable/notification_importance_button_background_unselected.xml
index c97a5ba..beccfd4 100644
--- a/res/drawable/button_border_unselected.xml
+++ b/res/drawable/notification_importance_button_background_unselected.xml
@@ -15,10 +15,11 @@
   limitations under the License.
   -->
 <shape xmlns:android="http://schemas.android.com/apk/res/android"
-       xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
        android:shape="rectangle">
+    <solid
+        android:color="?attr/notification_importance_button_background_color_unselected"/>
     <stroke
         android:width="1dp"
-        android:color="?androidprv:attr/materialColorOutlineVariant"/>
+        android:color="?attr/notification_importance_button_border_color_unselected"/>
     <corners android:radius="@dimen/rect_button_radius" />
 </shape>
diff --git a/res/values-night/themes.xml b/res/values-night/themes.xml
index 946cd91..c28bfbb 100644
--- a/res/values-night/themes.xml
+++ b/res/values-night/themes.xml
@@ -34,6 +34,16 @@
         <item name="android:colorBackground">@*android:color/surface_dark</item>
     </style>
 
+    <style name="Theme.Panel.Material" parent="Theme.Panel" >
+        <item name="notification_importance_button_background_color_unselected">@android:color/transparent</item>
+        <item name="notification_importance_button_border_color_unselected">@android:color/system_outline_variant_dark</item>
+        <item name="notification_importance_button_foreground_color_unselected">@android:color/system_on_surface_variant_dark</item>
+
+        <item name="notification_importance_button_background_color_selected">@android:color/system_secondary_container_dark</item>
+        <item name="notification_importance_button_border_color_selected">@android:color/system_on_secondary_container_dark</item>
+        <item name="notification_importance_button_foreground_color_selected">@android:color/system_on_secondary_container_dark</item>
+    </style>
+
     <!-- Material theme for the pages containing TabLayout and ViewPager -->
     <style name="Theme.TabTheme" parent="@style/Theme.MaterialComponents.DayNight">
         <item name="colorPrimary">@*android:color/edge_effect_device_default_dark</item>
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index 90a308e..6f024a3 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -194,4 +194,12 @@
         <attr name="biometricsEnrollProgressHelp" format="reference|color" />
         <attr name="biometricsEnrollProgressHelpWithTalkback" format="reference|color" />
     </declare-styleable>
+
+    <attr name="notification_importance_button_background_color_unselected" format="color" />
+    <attr name="notification_importance_button_border_color_unselected" format="color" />
+    <attr name="notification_importance_button_foreground_color_unselected" format="color" />
+
+    <attr name="notification_importance_button_background_color_selected" format="color" />
+    <attr name="notification_importance_button_border_color_selected" format="color" />
+    <attr name="notification_importance_button_foreground_color_selected" format="color" />
 </resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 6ce7bdf..3184a1f 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -10447,15 +10447,9 @@
     <!-- Help URI, restricted apps page [DO NOT TRANSLATE] -->
     <string name="help_uri_restricted_apps" translatable="false"></string>
 
-    <!-- Help URI, battery saver page [DO NOT TRANSLATE] -->
-    <string name="help_url_battery_saver_settings" translatable="false"></string>
-
     <!-- Help URI, auto rotate page [DO NOT TRANSLATE] -->
     <string name="help_url_auto_rotate_settings" translatable="false"></string>
 
-    <!-- Help URI, app usage page [DO NOT TRANSLATE] -->
-    <string name="help_url_app_usage_settings" translatable="false"></string>
-
     <!-- Help URI, smart battery page [DO NOT TRANSLATE] -->
     <string name="help_uri_smart_battery_settings" translatable="false"></string>
 
diff --git a/res/values/themes.xml b/res/values/themes.xml
index 5cf4532..3e6192b 100644
--- a/res/values/themes.xml
+++ b/res/values/themes.xml
@@ -14,7 +14,8 @@
      limitations under the License.
 -->
 
-<resources>
+<resources
+    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
 
     <style name="Transparent">
         <item name="alertDialogTheme">@style/Theme.AlertDialog</item>
@@ -66,6 +67,14 @@
 
         <!-- For slice view in settings -->
         <item name="sliceViewStyle">@style/Widget.SliceView.Settings</item>
+
+        <item name="notification_importance_button_background_color_unselected">@android:color/transparent</item>
+        <item name="notification_importance_button_border_color_unselected">?androidprv:attr/materialColorOutlineVariant</item>
+        <item name="notification_importance_button_foreground_color_unselected">?androidprv:attr/materialColorOnSurfaceVariant</item>
+
+        <item name="notification_importance_button_background_color_selected">?androidprv:attr/materialColorSecondaryContainer</item>
+        <item name="notification_importance_button_border_color_selected">?androidprv:attr/materialColorOnSecondaryContainer</item>
+        <item name="notification_importance_button_foreground_color_selected">?androidprv:attr/materialColorOnSecondaryContainer</item>
     </style>
 
     <!-- Variant of the settings theme with no action bar. -->
@@ -229,9 +238,18 @@
         <item name="android:fontFamily">@*android:string/config_headlineFontFamilyMedium</item>
     </style>
 
-    <style name="Theme.Panel.Material" parent="Theme.Panel" >
+    <style name="Theme.Panel.Material" parent="Theme.Panel">
         <item name="android:switchStyle">@style/Switch.SettingsLib</item>
+
+        <item name="notification_importance_button_background_color_unselected">@android:color/transparent</item>
+        <item name="notification_importance_button_border_color_unselected">@android:color/system_outline_variant_light</item>
+        <item name="notification_importance_button_foreground_color_unselected">@android:color/system_on_surface_variant_light</item>
+
+        <item name="notification_importance_button_background_color_selected">@android:color/system_secondary_container_light</item>
+        <item name="notification_importance_button_border_color_selected">@android:color/system_on_secondary_container_light</item>
+        <item name="notification_importance_button_foreground_color_selected">@android:color/system_on_secondary_container_light</item>
     </style>
+
     <!-- Material theme for the pages containing TabLayout and ViewPager -->
     <style name="Theme.TabTheme" parent="@style/Theme.MaterialComponents.DayNight">
         <item name="colorPrimary">@*android:color/edge_effect_device_default_light</item>
diff --git a/src/com/android/settings/accessibility/AccessibilityQuickSettingsPrimarySwitchPreferenceController.java b/src/com/android/settings/accessibility/AccessibilityQuickSettingsPrimarySwitchPreferenceController.java
index 4707363..e82cd96 100644
--- a/src/com/android/settings/accessibility/AccessibilityQuickSettingsPrimarySwitchPreferenceController.java
+++ b/src/com/android/settings/accessibility/AccessibilityQuickSettingsPrimarySwitchPreferenceController.java
@@ -130,10 +130,17 @@
             return;
         }
 
-        mTooltipWindow = new AccessibilityQuickSettingsTooltipWindow(mContext);
-        mTooltipWindow.setup(getTileTooltipContent(),
-                R.drawable.accessibility_auto_added_qs_tooltip_illustration);
-        mTooltipWindow.showAtTopCenter(mPreference.getSwitch());
+        // TODO (287728819): Move tooltip showing to SystemUI
+        // Since the lifecycle of controller is independent of that of the preference, doing
+        // null check on switch is a temporary solution for the case that switch view
+        // is not ready when we would like to show the tooltip.  If the switch is not ready,
+        // we give up showing the tooltip and also do not reshow it in the future.
+        if (mPreference.getSwitch() != null) {
+            mTooltipWindow = new AccessibilityQuickSettingsTooltipWindow(mContext);
+            mTooltipWindow.setup(getTileTooltipContent(),
+                    R.drawable.accessibility_auto_added_qs_tooltip_illustration);
+            mTooltipWindow.showAtTopCenter(mPreference.getSwitch());
+        }
         AccessibilityQuickSettingUtils.optInValueToSharedPreferences(mContext, tileComponentName);
         mNeedsQSTooltipReshow = false;
     }
diff --git a/src/com/android/settings/accessibility/PreviewSizeSeekBarController.java b/src/com/android/settings/accessibility/PreviewSizeSeekBarController.java
index 9603739..6bd8747 100644
--- a/src/com/android/settings/accessibility/PreviewSizeSeekBarController.java
+++ b/src/com/android/settings/accessibility/PreviewSizeSeekBarController.java
@@ -213,11 +213,19 @@
             return;
         }
 
-        mTooltipWindow = new AccessibilityQuickSettingsTooltipWindow(mContext);
-        mTooltipWindow.setup(getTileTooltipContent(),
-                R.drawable.accessibility_auto_added_qs_tooltip_illustration);
-        mTooltipWindow.showAtTopCenter(mSeekBarPreference.getSeekbar());
-        AccessibilityQuickSettingUtils.optInValueToSharedPreferences(mContext, tileComponentName);
+        // TODO (287728819): Move tooltip showing to SystemUI
+        // Since the lifecycle of controller is independent of that of the preference, doing
+        // null check on seekbar is a temporary solution for the case that seekbar view
+        // is not ready when we would like to show the tooltip.  If the seekbar is not ready,
+        // we give up showing the tooltip and also do not reshow it in the future.
+        if (mSeekBarPreference.getSeekbar() != null) {
+            mTooltipWindow = new AccessibilityQuickSettingsTooltipWindow(mContext);
+            mTooltipWindow.setup(getTileTooltipContent(),
+                    R.drawable.accessibility_auto_added_qs_tooltip_illustration);
+            mTooltipWindow.showAtTopCenter(mSeekBarPreference.getSeekbar());
+        }
+        AccessibilityQuickSettingUtils.optInValueToSharedPreferences(mContext,
+                tileComponentName);
         mNeedsQSTooltipReshow = false;
     }
 
diff --git a/src/com/android/settings/deviceinfo/batteryinfo/BatteryFirstUseDatePreferenceController.java b/src/com/android/settings/deviceinfo/batteryinfo/BatteryFirstUseDatePreferenceController.java
index 7d10b5b..6c7a743 100644
--- a/src/com/android/settings/deviceinfo/batteryinfo/BatteryFirstUseDatePreferenceController.java
+++ b/src/com/android/settings/deviceinfo/batteryinfo/BatteryFirstUseDatePreferenceController.java
@@ -45,7 +45,7 @@
 
     @Override
     public int getAvailabilityStatus() {
-        return mBatterySettingsFeatureProvider.isFirstUseDateAvailable(getFirstUseDate())
+        return mBatterySettingsFeatureProvider.isFirstUseDateAvailable(mContext, getFirstUseDate())
                 ? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
     }
 
diff --git a/src/com/android/settings/deviceinfo/batteryinfo/BatteryManufactureDatePreferenceController.java b/src/com/android/settings/deviceinfo/batteryinfo/BatteryManufactureDatePreferenceController.java
index d1b9df0..ff54c77 100644
--- a/src/com/android/settings/deviceinfo/batteryinfo/BatteryManufactureDatePreferenceController.java
+++ b/src/com/android/settings/deviceinfo/batteryinfo/BatteryManufactureDatePreferenceController.java
@@ -45,7 +45,8 @@
 
     @Override
     public int getAvailabilityStatus() {
-        return mBatterySettingsFeatureProvider.isManufactureDateAvailable(getManufactureDate())
+        return mBatterySettingsFeatureProvider.isManufactureDateAvailable(mContext,
+                getManufactureDate())
                 ? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
     }
 
diff --git a/src/com/android/settings/fuelgauge/BatterySettingsFeatureProvider.java b/src/com/android/settings/fuelgauge/BatterySettingsFeatureProvider.java
index dd13f1c..260fde0 100644
--- a/src/com/android/settings/fuelgauge/BatterySettingsFeatureProvider.java
+++ b/src/com/android/settings/fuelgauge/BatterySettingsFeatureProvider.java
@@ -16,12 +16,14 @@
 
 package com.android.settings.fuelgauge;
 
+import android.content.Context;
+
 /** Feature provider for battery settings usage. */
 public interface BatterySettingsFeatureProvider {
 
     /** Returns true if manufacture date should be shown */
-    boolean isManufactureDateAvailable(long manufactureDateMs);
+    boolean isManufactureDateAvailable(Context context, long manufactureDateMs);
 
     /** Returns true if first use date should be shown */
-    boolean isFirstUseDateAvailable(long firstUseDateMs);
+    boolean isFirstUseDateAvailable(Context context, long firstUseDateMs);
 }
diff --git a/src/com/android/settings/fuelgauge/BatterySettingsFeatureProviderImpl.java b/src/com/android/settings/fuelgauge/BatterySettingsFeatureProviderImpl.java
index 2dcb1b1..6b456b7 100644
--- a/src/com/android/settings/fuelgauge/BatterySettingsFeatureProviderImpl.java
+++ b/src/com/android/settings/fuelgauge/BatterySettingsFeatureProviderImpl.java
@@ -16,16 +16,18 @@
 
 package com.android.settings.fuelgauge;
 
+import android.content.Context;
+
 /** Feature provider implementation for battery settings usage. */
 public class BatterySettingsFeatureProviderImpl implements BatterySettingsFeatureProvider {
 
     @Override
-    public boolean isManufactureDateAvailable(long manufactureDateMs) {
+    public boolean isManufactureDateAvailable(Context context, long manufactureDateMs) {
         return false;
     }
 
     @Override
-    public boolean isFirstUseDateAvailable(long firstUseDateMs) {
+    public boolean isFirstUseDateAvailable(Context context, long firstUseDateMs) {
         return false;
     }
 }
diff --git a/src/com/android/settings/notification/app/BubblePreference.java b/src/com/android/settings/notification/app/BubblePreference.java
index 44b8d17..ab5fc39 100644
--- a/src/com/android/settings/notification/app/BubblePreference.java
+++ b/src/com/android/settings/notification/app/BubblePreference.java
@@ -163,13 +163,13 @@
 
         void setSelected(Context context, boolean selected) {
             mView.setBackground(mContext.getDrawable(selected
-                ? R.drawable.button_border_selected
-                : R.drawable.button_border_unselected));
+                ? R.drawable.notification_importance_button_background_selected
+                : R.drawable.notification_importance_button_background_unselected));
             mView.setSelected(selected);
 
             int colorResId = selected
-                    ? com.android.internal.R.attr.materialColorOnSecondaryContainer
-                    : com.android.internal.R.attr.materialColorOnSurfaceVariant;
+                    ? R.attr.notification_importance_button_foreground_color_selected
+                    : R.attr.notification_importance_button_foreground_color_unselected;
             ColorStateList stateList = Utils.getColorAttr(context, colorResId);
             mImageView.setImageTintList(stateList);
             mTextView.setTextColor(stateList);
diff --git a/src/com/android/settings/notification/app/ConversationPriorityPreference.java b/src/com/android/settings/notification/app/ConversationPriorityPreference.java
index 3e503a3..e1e7960 100644
--- a/src/com/android/settings/notification/app/ConversationPriorityPreference.java
+++ b/src/com/android/settings/notification/app/ConversationPriorityPreference.java
@@ -127,12 +127,14 @@
         });
     }
 
-    private ColorStateList getAccentTint() {
-        return Utils.getColorAccent(getContext());
+    private ColorStateList getSelectedColor() {
+        return Utils.getColorAttr(getContext(),
+                R.attr.notification_importance_button_foreground_color_selected);
     }
 
-    private ColorStateList getRegularTint() {
-        return Utils.getColorAttr(getContext(), android.R.attr.textColorPrimary);
+    private ColorStateList getUnselectedColor() {
+        return Utils.getColorAttr(getContext(),
+                R.attr.notification_importance_button_foreground_color_unselected);
     }
 
     void updateToggles(ViewGroup parent, int importance, boolean isPriority,
@@ -161,20 +163,21 @@
     }
 
     void setSelected(View view, boolean selected) {
-        ColorStateList colorAccent = getAccentTint();
-        ColorStateList colorNormal = getRegularTint();
+        ColorStateList colorSelected = getSelectedColor();
+        ColorStateList colorUnselected = getUnselectedColor();
 
         ImageView icon = view.findViewById(R.id.icon);
         TextView label = view.findViewById(R.id.label);
         TextView summary = view.findViewById(R.id.summary);
 
-        icon.setImageTintList(selected ? colorAccent : colorNormal);
-        label.setTextColor(selected ? colorAccent : colorNormal);
+        icon.setImageTintList(selected ? colorSelected : colorUnselected);
+        label.setTextColor(selected ? colorSelected : colorUnselected);
+        summary.setTextColor(selected ? colorSelected : colorUnselected);
         summary.setVisibility(selected ? VISIBLE : GONE);
 
         view.setBackground(mContext.getDrawable(selected
-                ? R.drawable.button_border_selected
-                : R.drawable.button_border_unselected));
+                ? R.drawable.notification_importance_button_background_selected
+                : R.drawable.notification_importance_button_background_unselected));
         // a11y service won't always read the newly appearing text in the right order if the
         // selection happens too soon (readback happens on a different thread as layout). post
         // the selection to make that conflict less likely
diff --git a/src/com/android/settings/notification/app/ImportancePreference.java b/src/com/android/settings/notification/app/ImportancePreference.java
index 857c94e..be53eda 100644
--- a/src/com/android/settings/notification/app/ImportancePreference.java
+++ b/src/com/android/settings/notification/app/ImportancePreference.java
@@ -77,8 +77,10 @@
 
     private void init(Context context) {
         mContext = context;
-        selectedBackground = mContext.getDrawable(R.drawable.button_border_selected);
-        unselectedBackground = mContext.getDrawable(R.drawable.button_border_unselected);
+        selectedBackground = mContext.getDrawable(
+                R.drawable.notification_importance_button_background_selected);
+        unselectedBackground = mContext.getDrawable(
+                R.drawable.notification_importance_button_background_unselected);
         setLayoutResource(R.layout.notif_importance_preference);
     }
 
@@ -152,12 +154,14 @@
         });
     }
 
-    private ColorStateList getAccentTint() {
-        return Utils.getColorAccent(getContext());
+    private ColorStateList getSelectedColor() {
+        return Utils.getColorAttr(getContext(),
+                R.attr.notification_importance_button_foreground_color_selected);
     }
 
-    private ColorStateList getRegularTint() {
-        return Utils.getColorAttr(getContext(), android.R.attr.textColorPrimary);
+    private ColorStateList getUnselectedColor() {
+        return Utils.getColorAttr(getContext(),
+                R.attr.notification_importance_button_foreground_color_unselected);
     }
 
     void setImportanceSummary(ViewGroup parent, int importance, boolean fromUser) {
@@ -167,25 +171,25 @@
             TransitionManager.beginDelayedTransition(parent, transition);
         }
 
-        ColorStateList colorAccent = getAccentTint();
-        ColorStateList colorNormal = getRegularTint();
+        ColorStateList colorSelected = getSelectedColor();
+        ColorStateList colorUnselected = getUnselectedColor();
 
         if (importance >= IMPORTANCE_DEFAULT) {
             parent.findViewById(R.id.silence_summary).setVisibility(GONE);
-            ((ImageView) parent.findViewById(R.id.silence_icon)).setImageTintList(colorNormal);
-            ((TextView) parent.findViewById(R.id.silence_label)).setTextColor(colorNormal);
+            ((ImageView) parent.findViewById(R.id.silence_icon)).setImageTintList(colorUnselected);
+            ((TextView) parent.findViewById(R.id.silence_label)).setTextColor(colorUnselected);
 
-            ((ImageView) parent.findViewById(R.id.alert_icon)).setImageTintList(colorAccent);
-            ((TextView) parent.findViewById(R.id.alert_label)).setTextColor(colorAccent);
+            ((ImageView) parent.findViewById(R.id.alert_icon)).setImageTintList(colorSelected);
+            ((TextView) parent.findViewById(R.id.alert_label)).setTextColor(colorSelected);
 
             parent.findViewById(R.id.alert_summary).setVisibility(VISIBLE);
         } else {
             parent.findViewById(R.id.alert_summary).setVisibility(GONE);
-            ((ImageView) parent.findViewById(R.id.alert_icon)).setImageTintList(colorNormal);
-            ((TextView) parent.findViewById(R.id.alert_label)).setTextColor(colorNormal);
+            ((ImageView) parent.findViewById(R.id.alert_icon)).setImageTintList(colorUnselected);
+            ((TextView) parent.findViewById(R.id.alert_label)).setTextColor(colorUnselected);
 
-            ((ImageView) parent.findViewById(R.id.silence_icon)).setImageTintList(colorAccent);
-            ((TextView) parent.findViewById(R.id.silence_label)).setTextColor(colorAccent);
+            ((ImageView) parent.findViewById(R.id.silence_icon)).setImageTintList(colorSelected);
+            ((TextView) parent.findViewById(R.id.silence_label)).setTextColor(colorSelected);
             parent.findViewById(R.id.silence_summary).setVisibility(VISIBLE);
         }
     }
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/batteryinfo/BatteryFirstUseDatePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/deviceinfo/batteryinfo/BatteryFirstUseDatePreferenceControllerTest.java
index 9ac69af..ff8ea62 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/batteryinfo/BatteryFirstUseDatePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/batteryinfo/BatteryFirstUseDatePreferenceControllerTest.java
@@ -22,6 +22,7 @@
 import static com.google.common.truth.Truth.assertThat;
 
 import static org.mockito.ArgumentMatchers.anyLong;
+import static org.mockito.Mockito.eq;
 import static org.mockito.Mockito.when;
 import static org.robolectric.Shadows.shadowOf;
 
@@ -60,24 +61,24 @@
 
     @Test
     public void getAvailabilityStatus_dateAvailable_returnAvailable() {
-        when(mFactory.batterySettingsFeatureProvider.isFirstUseDateAvailable(anyLong()))
-                .thenReturn(true);
+        when(mFactory.batterySettingsFeatureProvider.isFirstUseDateAvailable(eq(mContext),
+                anyLong())).thenReturn(true);
 
         assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
     }
 
     @Test
     public void getAvailabilityStatus_dateUnavailable_returnNotAvailable() {
-        when(mFactory.batterySettingsFeatureProvider.isFirstUseDateAvailable(anyLong()))
-                .thenReturn(false);
+        when(mFactory.batterySettingsFeatureProvider.isFirstUseDateAvailable(eq(mContext),
+                anyLong())).thenReturn(false);
 
         assertThat(mController.getAvailabilityStatus()).isEqualTo(CONDITIONALLY_UNAVAILABLE);
     }
 
     @Test
     public void getSummary_available_returnExpectedDate() {
-        when(mFactory.batterySettingsFeatureProvider.isFirstUseDateAvailable(anyLong()))
-                .thenReturn(true);
+        when(mFactory.batterySettingsFeatureProvider.isFirstUseDateAvailable(eq(mContext),
+                anyLong())).thenReturn(true);
         mShadowBatteryManager.setLongProperty(BatteryManager.BATTERY_PROPERTY_FIRST_USAGE_DATE,
                 1669680000L);
 
@@ -88,8 +89,8 @@
 
     @Test
     public void getSummary_unavailable_returnNull() {
-        when(mFactory.batterySettingsFeatureProvider.isFirstUseDateAvailable(anyLong()))
-                .thenReturn(false);
+        when(mFactory.batterySettingsFeatureProvider.isFirstUseDateAvailable(eq(mContext),
+                anyLong())).thenReturn(false);
 
         assertThat(mController.getSummary()).isNull();
     }
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/batteryinfo/BatteryManufactureDatePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/deviceinfo/batteryinfo/BatteryManufactureDatePreferenceControllerTest.java
index fed74f3..608ce00 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/batteryinfo/BatteryManufactureDatePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/batteryinfo/BatteryManufactureDatePreferenceControllerTest.java
@@ -22,6 +22,7 @@
 import static com.google.common.truth.Truth.assertThat;
 
 import static org.mockito.ArgumentMatchers.anyLong;
+import static org.mockito.Mockito.eq;
 import static org.mockito.Mockito.when;
 import static org.robolectric.Shadows.shadowOf;
 
@@ -61,7 +62,7 @@
 
     @Test
     public void getAvailabilityStatus_dateAvailable_returnAvailable() {
-        when(mFactory.batterySettingsFeatureProvider.isManufactureDateAvailable(
+        when(mFactory.batterySettingsFeatureProvider.isManufactureDateAvailable(eq(mContext),
                 anyLong())).thenReturn(true);
 
         assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
@@ -69,15 +70,15 @@
 
     @Test
     public void getAvailabilityStatus_dateUnavailable_returnNotAvailable() {
-        when(mFactory.batterySettingsFeatureProvider.isManufactureDateAvailable(anyLong()))
-                .thenReturn(false);
+        when(mFactory.batterySettingsFeatureProvider.isManufactureDateAvailable(eq(mContext),
+                anyLong())).thenReturn(false);
 
         assertThat(mController.getAvailabilityStatus()).isEqualTo(CONDITIONALLY_UNAVAILABLE);
     }
 
     @Test
     public void getSummary_available_returnExpectedDate() {
-        when(mFactory.batterySettingsFeatureProvider.isManufactureDateAvailable(
+        when(mFactory.batterySettingsFeatureProvider.isManufactureDateAvailable(eq(mContext),
                 anyLong())).thenReturn(true);
         mShadowBatteryManager.setLongProperty(BatteryManager.BATTERY_PROPERTY_MANUFACTURING_DATE,
                 1669680000L);
@@ -89,8 +90,8 @@
 
     @Test
     public void getSummary_unavailable_returnNull() {
-        when(mFactory.batterySettingsFeatureProvider.isManufactureDateAvailable(anyLong()))
-                .thenReturn(false);
+        when(mFactory.batterySettingsFeatureProvider.isManufactureDateAvailable(eq(mContext),
+                anyLong())).thenReturn(false);
 
         assertThat(mController.getSummary()).isNull();
     }
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/BatterySettingsFeatureProviderImplTest.java b/tests/robotests/src/com/android/settings/fuelgauge/BatterySettingsFeatureProviderImplTest.java
index 6c09125..29f09ea 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/BatterySettingsFeatureProviderImplTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/BatterySettingsFeatureProviderImplTest.java
@@ -19,6 +19,11 @@
 import static com.google.common.truth.Truth.assertThat;
 
 import static org.mockito.ArgumentMatchers.anyLong;
+import static org.mockito.Mockito.eq;
+
+import android.content.Context;
+
+import androidx.test.core.app.ApplicationProvider;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -28,19 +33,21 @@
 @RunWith(RobolectricTestRunner.class)
 public class BatterySettingsFeatureProviderImplTest {
     private BatterySettingsFeatureProviderImpl mImpl;
+    private Context mContext;
 
     @Before
     public void setUp() {
         mImpl = new BatterySettingsFeatureProviderImpl();
+        mContext = ApplicationProvider.getApplicationContext();
     }
 
     @Test
     public void isManufactureDateAvailable_returnFalse() {
-        assertThat(mImpl.isManufactureDateAvailable(anyLong())).isFalse();
+        assertThat(mImpl.isManufactureDateAvailable(eq(mContext), anyLong())).isFalse();
     }
 
     @Test
     public void isFirstUseDateAvailable_returnFalse() {
-        assertThat(mImpl.isFirstUseDateAvailable(anyLong())).isFalse();
+        assertThat(mImpl.isFirstUseDateAvailable(eq(mContext), anyLong())).isFalse();
     }
 }