Remove redundant color resources

Limit the min scope of resources for RRO

Test: atest DocumentsUITests
Bug: 125291705
Change-Id: Id3029f9a1c558bb4b26404d9ecef95e24050c2f9
diff --git a/res/color/search_chip_background_color.xml b/res/color/search_chip_background_color.xml
index b45ebdf..85b55e5 100644
--- a/res/color/search_chip_background_color.xml
+++ b/res/color/search_chip_background_color.xml
@@ -18,5 +18,5 @@
 <selector xmlns:android="http://schemas.android.com/apk/res/android">
     <item android:state_selected="true" android:color="@color/chip_selected_background_color"/>
     <item android:state_enabled="true" android:color="?attr/colorBackgroundFloating"/>
-    <item android:state_enabled="false" android:color="@color/g_light_grey"/>
+    <item android:state_enabled="false" android:color="@color/chip_background_disable_color"/>
 </selector>
\ No newline at end of file
diff --git a/res/values-night/colors.xml b/res/values-night/colors.xml
index a5f1ff4..22b6fa6 100644
--- a/res/values-night/colors.xml
+++ b/res/values-night/colors.xml
@@ -15,14 +15,15 @@
 -->
 <resources>
     <color name="accent">#2297f0</color>
+    <color name="app_background_color">#ff202124</color>
 
     <color name="root_icon_color">#9AA0A6</color>
     <color name="chip_stroke_color">@android:color/transparent</color>
     <color name="chip_selected_background_color">#FF3D4657</color>
     <color name="chip_ripple_color">#FF5195EA</color>
 
-    <color name="item_doc_background">@color/g_grey</color>
-    <color name="item_doc_background_disabled">@color/g_light_grey</color>
+    <color name="item_doc_background">#ff3c4043</color>
+    <color name="item_doc_background_disabled">#fff1f3f4</color>
     <color name="item_doc_background_selected">#4d2297f0</color>
     <color name="item_grid_tint">#ff0e70e8</color>
     <color name="item_hover_color">#ff5f6368</color>
diff --git a/res/values-night/styles.xml b/res/values-night/styles.xml
index a554924..4b0cdb5 100644
--- a/res/values-night/styles.xml
+++ b/res/values-night/styles.xml
@@ -24,7 +24,7 @@
 
     <style name="BottomSheetDialogStyle" parent="@style/Theme.MaterialComponents.BottomSheetDialog">
         <item name="colorBackgroundFloating">@drawable/grid_item_background</item>
-        <item name="android:textColorPrimary">@color/g_light_grey</item>
+        <item name="android:textColorPrimary">?android:textColorPrimaryInverse</item>
         <item name="android:statusBarColor">@android:color/transparent</item>
         <item name="android:windowIsFloating">false</item>
         <item name="bottomSheetStyle">@style/BottomSheet</item>
diff --git a/res/values-night/themes.xml b/res/values-night/themes.xml
index e162130..41d66ef 100644
--- a/res/values-night/themes.xml
+++ b/res/values-night/themes.xml
@@ -21,9 +21,8 @@
         <item name="bottomSheetDialogTheme">@style/BottomSheetDialogStyle</item>
         <item name="snackbarButtonStyle">@style/SnackbarButtonStyle</item>
 
-        <item name="colorPrimaryDark">@color/g_grey</item>
         <item name="colorPrimary">?attr/colorAccent</item>
-        <item name="colorSecondary">@color/g_dark_grey</item>
+        <item name="colorSecondary">@color/text_secondary</item>
         <item name="colorAccent">@color/accent</item>
 
         <item name="queryBackground">@color/menu_search_background</item>
@@ -41,7 +40,7 @@
         <item name="gridItemSelectedColor">@color/item_doc_background_selected</item>
         <item name="gridItemDisableColor">@color/item_doc_background_disabled</item>
 
-        <item name="android:colorBackground">@color/g_dark_grey</item>
+        <item name="android:colorBackground">@color/app_background_color</item>
         <item name="android:windowBackground">?android:attr/colorBackground</item>
         <item name="android:statusBarColor">?android:attr/colorBackground</item>
         <item name="android:windowLightStatusBar">false</item>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index e68920f..61da77e 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -18,9 +18,8 @@
     <!-- This is the window background, but also the background for anything
          else that needs to manually declare a background matching the "default"
          app background (e.g. the drawer overlay). -->
-    <color name="g_dark_grey">#ff202124</color>
-    <color name="g_grey">#ff3c4043</color>
-    <color name="g_light_grey">#fff1f3f4</color>
+
+    <color name="app_background_color">#fff1f3f4</color>
     <color name="drawer_border">#ffd4d4d4</color>
     <color name="menu_search_background">@android:color/transparent</color>
 
@@ -80,6 +79,7 @@
     <color name="inspector_title_background">#40000000</color>
     <color name="inspector_debug_mode_color">#607d8b</color>
 
+    <color name="chip_background_disable_color">#fff1f3f4</color>
     <color name="chip_stroke_color">#FFDADCE0</color>
     <color name="chip_selected_background_color">#FFE8F0FE</color>
     <color name="chip_ripple_color">#FF4285f4</color>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 19c2223..cdf690b 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -69,7 +69,7 @@
 
     <style name="BottomSheetDialogStyle" parent="@style/Theme.MaterialComponents.BottomSheetDialog">
         <item name="android:colorBackground">@android:color/white</item>
-        <item name="android:textColorPrimary">@color/g_grey</item>
+        <item name="android:textColorPrimary">?android:textColorPrimaryInverse</item>
         <item name="android:windowLightNavigationBar">true</item>
         <item name="android:statusBarColor">@android:color/transparent</item>
         <item name="android:navigationBarColor">?android:attr/colorBackground</item>
diff --git a/res/values/themes.xml b/res/values/themes.xml
index f5b1ad4..388e775 100644
--- a/res/values/themes.xml
+++ b/res/values/themes.xml
@@ -21,7 +21,6 @@
         <item name="bottomSheetDialogTheme">@style/BottomSheetDialogStyle</item>
         <item name="snackbarButtonStyle">@style/SnackbarButtonStyle</item>
 
-        <item name="colorPrimaryDark">@color/g_grey</item>
         <item name="colorPrimary">?attr/colorAccent</item>
         <item name="colorSecondary">@android:color/white</item>
         <item name="colorAccent">@color/accent</item>
diff --git a/src/com/android/documentsui/AbstractActionHandler.java b/src/com/android/documentsui/AbstractActionHandler.java
index aaa9612..86bd0a1 100644
--- a/src/com/android/documentsui/AbstractActionHandler.java
+++ b/src/com/android/documentsui/AbstractActionHandler.java
@@ -434,7 +434,7 @@
             mActivity.getActionBar().setBackgroundDrawable(new ColorDrawable(
                     mActivity.getResources().getColor(R.color.primary)));
             mActivity.getWindow().setStatusBarColor(
-                    mActivity.getResources().getColor(R.color.g_dark_grey));
+                    mActivity.getResources().getColor(android.R.color.background_dark));
         }
     }
 
diff --git a/src/com/android/documentsui/dirlist/DirectoryFragment.java b/src/com/android/documentsui/dirlist/DirectoryFragment.java
index a781b19..89d6c83 100644
--- a/src/com/android/documentsui/dirlist/DirectoryFragment.java
+++ b/src/com/android/documentsui/dirlist/DirectoryFragment.java
@@ -210,7 +210,7 @@
 
         mRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.refresh_layout);
         mRefreshLayout.setOnRefreshListener(this);
-        mRecView.setItemAnimator(new DirectoryItemAnimator(mActivity));
+        mRecView.setItemAnimator(new DirectoryItemAnimator());
 
         mInjector = mActivity.getInjector();
         // Initially, this selection tracker (delegator) uses a dummy implementation, so it must be
diff --git a/src/com/android/documentsui/dirlist/DirectoryItemAnimator.java b/src/com/android/documentsui/dirlist/DirectoryItemAnimator.java
index 14b448a..626710e 100644
--- a/src/com/android/documentsui/dirlist/DirectoryItemAnimator.java
+++ b/src/com/android/documentsui/dirlist/DirectoryItemAnimator.java
@@ -43,17 +43,6 @@
     private final List<ColorAnimation> mPendingAnimations = new ArrayList<>();
     private final Map<RecyclerView.ViewHolder, ColorAnimation> mRunningAnimations =
             new ArrayMap<>();
-    private final Integer mDefaultColor;
-    private final Integer mSelectedColor;
-
-    public DirectoryItemAnimator(Context context) {
-        TypedArray ta = context.obtainStyledAttributes(R.styleable.GridItem);
-        mSelectedColor = ta.getColor(R.styleable.GridItem_gridItemSelectedColor
-                , R.color.item_doc_background_selected);
-        mDefaultColor = ta.getColor(R.styleable.GridItem_gridItemColor
-                , R.color.item_doc_background);
-        ta.recycle();
-    }
 
     @Override
     public void runPendingAnimations() {
diff --git a/tests/AndroidManifest.xml b/tests/AndroidManifest.xml
index 69513b5..698da33 100644
--- a/tests/AndroidManifest.xml
+++ b/tests/AndroidManifest.xml
@@ -3,7 +3,6 @@
     package="com.android.documentsui.tests">
 
     <uses-permission android:name="android.permission.INTERNET" />
-    <uses-permission android:name="android.permission.MODIFY_DAY_NIGHT_MODE" />
 
     <application android:label="DocumentsUI Tests">
         <uses-library android:name="android.test.runner" />
diff --git a/tests/res/values/colors.xml b/tests/res/values/colors.xml
deleted file mode 100644
index a831b9a..0000000
--- a/tests/res/values/colors.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2018 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-
-<resources>
-    <color name="expected_g_dark_grey">#ff202124</color>     <!--M2 Grey 900-->
-    <color name="expected_g_grey">#ff3c4043</color>          <!--M2 Grey 800-->
-</resources>
diff --git a/tests/unit/com/android/documentsui/ui/DarkThemeUiTest.java b/tests/unit/com/android/documentsui/ui/DarkThemeUiTest.java
index b6c8ce3..3871f2d 100644
--- a/tests/unit/com/android/documentsui/ui/DarkThemeUiTest.java
+++ b/tests/unit/com/android/documentsui/ui/DarkThemeUiTest.java
@@ -38,30 +38,24 @@
 @RunWith(AndroidJUnit4.class)
 public class DarkThemeUiTest extends ThemeUiTestBase {
     Context mTestContext;
-    int mExpectedDarkGreyColor, mExpectedGreyColor, mExpectedDarkColor;
 
     @Before
     public void setUp() throws Exception {
         super.setUp();
         mTestContext = InstrumentationRegistry.getContext();
         mTheme = getThemeByUiMode(mTargetContext, Configuration.UI_MODE_NIGHT_YES);
-        mExpectedDarkGreyColor = mTestContext.getResources().getColor(
-                com.android.documentsui.tests.R.color.expected_g_dark_grey);
-        mExpectedGreyColor = mTestContext.getResources().getColor(
-                com.android.documentsui.tests.R.color.expected_g_grey);
-        mExpectedDarkColor = Color.BLACK;
     }
 
     @Test
     public void themeNightModeEnable_actionBarColorShouldBeDark() {
-
         assertTheme(R.styleable.ActionBarView, R.styleable.ActionBarView_android_colorBackground,
-                mExpectedDarkGreyColor);
+                mTheme.getResources().getColor(R.color.app_background_color, mTheme));
     }
 
     @Test
     public void themeNightModeEnable_gridItemBackgroundColorShouldBeDark() {
-        assertTheme(R.styleable.GridItem, R.styleable.GridItem_gridItemColor, mExpectedGreyColor);
+        assertTheme(R.styleable.GridItem, R.styleable.GridItem_gridItemColor,
+                mTheme.getResources().getColor(R.color.item_doc_background, mTheme));
     }
 
     @Test
@@ -85,19 +79,19 @@
     @Test
     public void themeNightModeEnable_navigationBarColorShouldBeDark() {
         assertTheme(R.styleable.SystemWindow, R.styleable.SystemWindow_android_navigationBarColor,
-                mExpectedDarkColor);
+                mTheme.getResources().getColor(android.R.color.background_dark, mTheme));
     }
 
     @Test
     public void themeNightModeEnable_windowBackgroundColorShouldBeDark() {
         assertTheme(R.styleable.SystemWindow, R.styleable.SystemWindow_android_windowBackground,
-                mExpectedDarkGreyColor);
+                mTheme.getResources().getColor(R.color.app_background_color, mTheme));
     }
 
     @Test
     public void themeNightModeEnable_statusBarColorShouldBeDark() {
         assertTheme(R.styleable.SystemWindow, R.styleable.SystemWindow_android_statusBarColor,
-                mExpectedDarkGreyColor);
+                mTheme.getResources().getColor(R.color.app_background_color, mTheme));
     }
 
     @Test