Merge "Only update mutable shortcuts."
diff --git a/color-check-baseline.xml b/color-check-baseline.xml
index 365cbe7..cbfae2e 100644
--- a/color-check-baseline.xml
+++ b/color-check-baseline.xml
@@ -117,6 +117,22 @@
priority="4"
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
+ errorLine1=" <color name="switch_bar_background">#dadce0</color>"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="res/values-night/colors.xml"
+ line="19"
+ column="3"/>
+ </issue>
+
+ <issue
+ id="HardCodedColor"
+ severity="Error"
+ message="Avoid using hardcoded color"
+ category="Correctness"
+ priority="4"
+ summary="Using hardcoded color"
+ explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" <color name="red">#F00</color>"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
@@ -133,6 +149,22 @@
priority="4"
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
+ errorLine1=" <color name="switchbar_switch_track_tint">#82000000</color>"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="res/values-night/colors.xml"
+ line="20"
+ column="3"/>
+ </issue>
+
+ <issue
+ id="HardCodedColor"
+ severity="Error"
+ message="Avoid using hardcoded color"
+ category="Correctness"
+ priority="4"
+ summary="Using hardcoded color"
+ explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" <color name="blue">#00F</color>"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
@@ -1221,8 +1253,8 @@
priority="4"
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
- errorLine1=" <color name="homepage_location_background">#1A73E8</color>"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ errorLine1=" <color name="homepage_location_background">#2EC7DC</color>"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="128"
@@ -1238,7 +1270,7 @@
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" <color name="homepage_about_background">#9FA8DA</color>"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="129"
@@ -1253,12 +1285,28 @@
priority="4"
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
- errorLine1=" <color name="homepage_privacy_background">#1A73E8</color>"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ errorLine1=" <color name="homepage_privacy_background">#5E97F6</color>"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
- file="res/values/colors.xml"
- line="130"
- column="5"/>
+ file="res/values/colors.xml"
+ line="130"
+ column="5"/>
+ </issue>
+
+ <issue
+ id="HardCodedColor"
+ severity="Error"
+ message="Avoid using hardcoded color"
+ category="Correctness"
+ priority="4"
+ summary="Using hardcoded color"
+ explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
+ errorLine1=" <color name="switchbar_switch_track_tint">#BFFFFFFF</color>"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="res/values/colors.xml"
+ line="134"
+ column="5"/>
</issue>
<issue
@@ -1273,70 +1321,6 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
- line="135"
- column="5"/>
- </issue>
-
- <issue
- id="HardCodedColor"
- severity="Error"
- message="Avoid using hardcoded color"
- category="Correctness"
- priority="4"
- summary="Using hardcoded color"
- explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
- errorLine1=" <color name="battery_maybe_color_light">#ef6c00</color> <!-- Material Orange 800 -->"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="res/values/colors.xml"
- line="136"
- column="5"/>
- </issue>
-
- <issue
- id="HardCodedColor"
- severity="Error"
- message="Avoid using hardcoded color"
- category="Correctness"
- priority="4"
- summary="Using hardcoded color"
- explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
- errorLine1=" <color name="battery_bad_color_light">#f44336</color> <!-- Material Red 500 -->"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="res/values/colors.xml"
- line="137"
- column="5"/>
- </issue>
-
- <issue
- id="HardCodedColor"
- severity="Error"
- message="Avoid using hardcoded color"
- category="Correctness"
- priority="4"
- summary="Using hardcoded color"
- explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
- errorLine1=" <color name="battery_good_color_dark">#4caf50</color> <!-- Material Green 500 -->"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="res/values/colors.xml"
- line="138"
- column="5"/>
- </issue>
-
- <issue
- id="HardCodedColor"
- severity="Error"
- message="Avoid using hardcoded color"
- category="Correctness"
- priority="4"
- summary="Using hardcoded color"
- explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
- errorLine1=" <color name="battery_maybe_color_dark">#fdd835</color> <!-- Material Yellow 600 -->"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="res/values/colors.xml"
line="139"
column="5"/>
</issue>
@@ -1349,11 +1333,75 @@
priority="4"
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
+ errorLine1=" <color name="battery_maybe_color_light">#ef6c00</color> <!-- Material Orange 800 -->"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="res/values/colors.xml"
+ line="140"
+ column="5"/>
+ </issue>
+
+ <issue
+ id="HardCodedColor"
+ severity="Error"
+ message="Avoid using hardcoded color"
+ category="Correctness"
+ priority="4"
+ summary="Using hardcoded color"
+ explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
+ errorLine1=" <color name="battery_bad_color_light">#f44336</color> <!-- Material Red 500 -->"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="res/values/colors.xml"
+ line="141"
+ column="5"/>
+ </issue>
+
+ <issue
+ id="HardCodedColor"
+ severity="Error"
+ message="Avoid using hardcoded color"
+ category="Correctness"
+ priority="4"
+ summary="Using hardcoded color"
+ explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
+ errorLine1=" <color name="battery_good_color_dark">#4caf50</color> <!-- Material Green 500 -->"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="res/values/colors.xml"
+ line="142"
+ column="5"/>
+ </issue>
+
+ <issue
+ id="HardCodedColor"
+ severity="Error"
+ message="Avoid using hardcoded color"
+ category="Correctness"
+ priority="4"
+ summary="Using hardcoded color"
+ explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
+ errorLine1=" <color name="battery_maybe_color_dark">#fdd835</color> <!-- Material Yellow 600 -->"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="res/values/colors.xml"
+ line="143"
+ column="5"/>
+ </issue>
+
+ <issue
+ id="HardCodedColor"
+ severity="Error"
+ message="Avoid using hardcoded color"
+ category="Correctness"
+ priority="4"
+ summary="Using hardcoded color"
+ explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" <color name="battery_bad_color_dark">#f44336</color> <!-- Material Red 500 -->"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
- line="140"
+ line="144"
column="5"/>
</issue>
@@ -1369,7 +1417,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
- line="143"
+ line="147"
column="5"/>
</issue>
@@ -1385,7 +1433,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
- line="144"
+ line="148"
column="5"/>
</issue>
@@ -1401,7 +1449,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
- line="145"
+ line="149"
column="5"/>
</issue>
@@ -1417,7 +1465,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
- line="146"
+ line="150"
column="5"/>
</issue>
@@ -1433,7 +1481,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
- line="147"
+ line="151"
column="5"/>
</issue>
@@ -1449,7 +1497,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/layout-land/confirm_lock_pattern_normal.xml"
- line="111"
+ line="103"
column="17"/>
</issue>
@@ -1734,7 +1782,7 @@
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" android:color="@color/homepage_about_background" />"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/drawable/ic_homepage_about.xml"
line="23"
@@ -1861,6 +1909,22 @@
priority="4"
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
+ errorLine1=" android:color="@color/homepage_location_background"/>"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="res/drawable/ic_homepage_location.xml"
+ line="23"
+ column="17"/>
+ </issue>
+
+ <issue
+ id="HardCodedColor"
+ severity="Error"
+ message="Avoid using hardcoded color"
+ category="Correctness"
+ priority="4"
+ summary="Using hardcoded color"
+ explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" android:color="@color/homepage_network_background" />"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
@@ -1877,6 +1941,22 @@
priority="4"
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
+ errorLine1=" android:color="@color/homepage_privacy_background"/>"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="res/drawable/ic_homepage_privacy.xml"
+ line="23"
+ column="17"/>
+ </issue>
+
+ <issue
+ id="HardCodedColor"
+ severity="Error"
+ message="Avoid using hardcoded color"
+ category="Correctness"
+ priority="4"
+ summary="Using hardcoded color"
+ explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" android:color="@color/homepage_security_background" />"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
@@ -1925,54 +2005,6 @@
priority="4"
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
- errorLine1=" android:color="@color/homepage_location_background" />"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="res/drawable/ic_homepage_privacy.xml"
- line="23"
- column="17"/>
- </issue>
-
- <issue
- id="HardCodedColor"
- severity="Error"
- message="Avoid using hardcoded color"
- category="Correctness"
- priority="4"
- summary="Using hardcoded color"
- explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
- errorLine1=" android:color="@color/homepage_location_background" />"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="res/drawable/ic_homepage_location.xml"
- line="23"
- column="17"/>
- </issue>
-
- <issue
- id="HardCodedColor"
- severity="Error"
- message="Avoid using hardcoded color"
- category="Correctness"
- priority="4"
- summary="Using hardcoded color"
- explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
- errorLine1=" android:color="@color/homepage_location_background" />"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="res/drawable/ic_preference_location.xml"
- line="23"
- column="17"/>
- </issue>
-
- <issue
- id="HardCodedColor"
- severity="Error"
- message="Avoid using hardcoded color"
- category="Correctness"
- priority="4"
- summary="Using hardcoded color"
- explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" android:color="@color/homepage_support_background" />"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
@@ -2005,6 +2037,22 @@
priority="4"
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
+ errorLine1=" android:color="@color/homepage_location_background"/>"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="res/drawable/ic_preference_location.xml"
+ line="23"
+ column="17"/>
+ </issue>
+
+ <issue
+ id="HardCodedColor"
+ severity="Error"
+ message="Avoid using hardcoded color"
+ category="Correctness"
+ priority="4"
+ summary="Using hardcoded color"
+ explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" android:tint="#db4437""
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~">
<location
@@ -2505,7 +2553,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
<location
file="res/values-en-rXC/strings.xml"
- line="2524"
+ line="2530"
column="168"/>
</issue>
@@ -2521,7 +2569,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
<location
file="res/values-en-rAU/strings.xml"
- line="2525"
+ line="2531"
column="64"/>
</issue>
@@ -2537,7 +2585,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
<location
file="res/values-en-rCA/strings.xml"
- line="2525"
+ line="2531"
column="64"/>
</issue>
@@ -2553,7 +2601,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
<location
file="res/values-en-rGB/strings.xml"
- line="2525"
+ line="2531"
column="64"/>
</issue>
@@ -2569,7 +2617,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
<location
file="res/values-en-rIN/strings.xml"
- line="2525"
+ line="2531"
column="64"/>
</issue>
@@ -2585,7 +2633,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/strings.xml"
- line="5865"
+ line="5886"
column="36"/>
</issue>
@@ -2601,7 +2649,7 @@
errorLine2=" ^">
<location
file="res/values/styles.xml"
- line="171"
+ line="179"
column="41"/>
</issue>
@@ -2617,7 +2665,7 @@
errorLine2=" ^">
<location
file="res/values/styles.xml"
- line="425"
+ line="443"
column="44"/>
</issue>
@@ -2633,7 +2681,7 @@
errorLine2=" ^">
<location
file="res/values/styles.xml"
- line="431"
+ line="449"
column="44"/>
</issue>
@@ -2649,7 +2697,7 @@
errorLine2=" ^">
<location
file="res/values/styles.xml"
- line="432"
+ line="450"
column="44"/>
</issue>
@@ -2713,7 +2761,7 @@
errorLine2=" ^">
<location
file="res/values/themes.xml"
- line="86"
+ line="91"
column="47"/>
</issue>
@@ -2725,12 +2773,12 @@
priority="4"
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
- errorLine1=" <item name="android:statusBarColor">#00000000</item>"
- errorLine2=" ^">
+ errorLine1=" <item name="switchBarBackgroundColor">@color/switch_bar_background</item>"
+ errorLine2=" ^">
<location
file="res/values/themes.xml"
- line="151"
- column="45"/>
+ line="91"
+ column="47"/>
</issue>
<issue
@@ -2741,12 +2789,28 @@
priority="4"
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
- errorLine1=" <item name="android:navigationBarColor">#00000000</item>"
- errorLine2=" ^">
+ errorLine1=" <item name="android:trackTint">@color/switchbar_switch_track_tint</item>"
+ errorLine2=" ^">
<location
file="res/values/themes.xml"
- line="152"
- column="49"/>
+ line="97"
+ column="40"/>
+ </issue>
+
+ <issue
+ id="HardCodedColor"
+ severity="Error"
+ message="Avoid using hardcoded color"
+ category="Correctness"
+ priority="4"
+ summary="Using hardcoded color"
+ explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
+ errorLine1=" <item name="android:trackTint">@color/switchbar_switch_track_tint</item>"
+ errorLine2=" ^">
+ <location
+ file="res/values/themes.xml"
+ line="97"
+ column="40"/>
</issue>
<issue
@@ -2789,12 +2853,28 @@
priority="4"
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
- errorLine1=" <item name="android:navigationBarDividerColor">#1f000000</item>"
- errorLine2=" ^">
+ errorLine1=" <item name="android:statusBarColor">#00000000</item>"
+ errorLine2=" ^">
<location
file="res/values/themes.xml"
- line="175"
- column="56"/>
+ line="169"
+ column="45"/>
+ </issue>
+
+ <issue
+ id="HardCodedColor"
+ severity="Error"
+ message="Avoid using hardcoded color"
+ category="Correctness"
+ priority="4"
+ summary="Using hardcoded color"
+ explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
+ errorLine1=" <item name="android:navigationBarColor">#00000000</item>"
+ errorLine2=" ^">
+ <location
+ file="res/values/themes.xml"
+ line="170"
+ column="49"/>
</issue>
<issue
@@ -2905,7 +2985,7 @@
errorLine2=" ^">
<location
file="res/values/themes_suw.xml"
- line="187"
+ line="186"
column="43"/>
</issue>
@@ -2921,7 +3001,7 @@
errorLine2=" ^">
<location
file="res/values/themes_suw.xml"
- line="188"
+ line="187"
column="42"/>
</issue>
@@ -2937,7 +3017,7 @@
errorLine2=" ^">
<location
file="res/values/themes_suw.xml"
- line="189"
+ line="188"
column="45"/>
</issue>
diff --git a/res/color/switchbar_switch_track_tint.xml b/res/color/switchbar_switch_track_tint.xml
deleted file mode 100644
index 141f977..0000000
--- a/res/color/switchbar_switch_track_tint.xml
+++ /dev/null
@@ -1,21 +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.
- -->
-
-<selector
- xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:color="#BFFFFFFF" />
-</selector>
\ No newline at end of file
diff --git a/res/drawable/ic_friction_lock_closed.xml b/res/drawable/ic_friction_lock_closed.xml
index 194c9af..dab8c91 100644
--- a/res/drawable/ic_friction_lock_closed.xml
+++ b/res/drawable/ic_friction_lock_closed.xml
@@ -21,6 +21,5 @@
android:height="18dp">
<path
android:pathData="M36 16l-2 0 0 -4C34 6.48 29.52 2 24 2 18.48 2 14 6.48 14 12l0 4 -2 0c-2.21 0 -4 1.79 -4 4l0 20c0 2.21 1.79 4 4 4l24 0c2.21 0 4 -1.79 4 -4l0 -20c0 -2.21 -1.79 -4 -4 -4zM24 34c-2.21 0 -4 -1.79 -4 -4 0 -2.21 1.79 -4 4 -4 2.21 0 4 1.79 4 4 0 2.21 -1.79 4 -4 4zm6.2 -18l-12.4 0 0 -4c0 -3.42 2.78 -6.2 6.2 -6.2 3.42 0 6.2 2.78 6.2 6.2l0 4z"
- android:fillColor="?android:attr/colorForeground"
- android:fillAlpha="0.54" />
+ android:fillColor="?attr/frictionIconColor" />
</vector>
diff --git a/res/drawable/ic_friction_money.xml b/res/drawable/ic_friction_money.xml
index 1018533..b170921 100644
--- a/res/drawable/ic_friction_money.xml
+++ b/res/drawable/ic_friction_money.xml
@@ -20,8 +20,7 @@
android:width="18dp"
android:height="18dp">
- <path android:fillColor="?android:attr/colorForeground"
- android:fillAlpha="0.54"
+ <path android:fillColor="?attr/frictionIconColor"
android:pathData="M9.56 8.1c-1.6-.51-2.66-.71-2.66-1.88 0-.83 .72 -1.62 2.1-1.62 1.59 0 2.1 .88
2.1 1.94H13c0-1.79-1.17-3.09-3-3.44V1H8v2.11c-1.58 .32 -3 1.37-3 3.12 0 2.25
1.78 2.8 4 3.52 1.88 .61 2.25 1.04 2.25 2.09 0 .9-.67 1.56-2.25 1.56-1.2
diff --git a/res/color/switchbar_switch_thumb_tint.xml b/res/drawable/ic_settings_close.xml
similarity index 61%
rename from res/color/switchbar_switch_thumb_tint.xml
rename to res/drawable/ic_settings_close.xml
index 4c75a7e..058b4b5 100644
--- a/res/color/switchbar_switch_thumb_tint.xml
+++ b/res/drawable/ic_settings_close.xml
@@ -1,4 +1,3 @@
-<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2018 The Android Open Source Project
@@ -15,6 +14,12 @@
limitations under the License.
-->
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:color="#FFFFFF" />
-</selector>
\ No newline at end of file
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41z"/>
+</vector>
diff --git a/res/drawable/ic_settings_delete.xml b/res/drawable/ic_settings_delete.xml
new file mode 100644
index 0000000..10125ac
--- /dev/null
+++ b/res/drawable/ic_settings_delete.xml
@@ -0,0 +1,31 @@
+<!--
+ 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.
+ -->
+
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M15,4V3H9v1H4v2h1v13c0,1.1 0.9,2 2,2h10c1.1,0 2,-0.9 2,-2V6h1V4H15zM17,19H7V6h10V19z"/>
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M9,8h2v9h-2z"/>
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M13,8h2v9h-2z"/>
+</vector>
diff --git a/res/drawable/ic_settings_force_stop.xml b/res/drawable/ic_settings_force_stop.xml
new file mode 100644
index 0000000..eda6079
--- /dev/null
+++ b/res/drawable/ic_settings_force_stop.xml
@@ -0,0 +1,31 @@
+<!--
+ 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.
+ -->
+
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M12,5.99L19.53,19H4.47L12,5.99M12,2L1,21h22L12,2L12,2z"/>
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M13,16l-2,0l0,2l2,0l0,-2z"/>
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M13,10l-2,0l0,4l2,0l0,-4z"/>
+</vector>
diff --git a/res/drawable/ic_settings_install.xml b/res/drawable/ic_settings_install.xml
new file mode 100644
index 0000000..5bd5e30
--- /dev/null
+++ b/res/drawable/ic_settings_install.xml
@@ -0,0 +1,28 @@
+<!--
+ 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.
+ -->
+
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M18,15v3H6v-3H4v3c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2v-3H18z"/>
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M17,11.5l-1.41,-1.41l-2.59,2.58l0,-8.67l-2,0l0,8.67l-2.59,-2.58l-1.41,1.41l5,5z"/>
+</vector>
diff --git a/res/drawable/ic_settings_open.xml b/res/drawable/ic_settings_open.xml
new file mode 100644
index 0000000..ea77710
--- /dev/null
+++ b/res/drawable/ic_settings_open.xml
@@ -0,0 +1,25 @@
+<!--
+ 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.
+ -->
+
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M19,19H5V5h7V3H5C3.89,3 3,3.9 3,5v14c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2v-7h-2V19zM14,3v2h3.59l-9.83,9.83l1.41,1.41L19,6.41V10h2V3H14z"/>
+</vector>
diff --git a/res/layout/search_bar.xml b/res/layout/search_bar.xml
index 3d4d0d6..9135ebf 100644
--- a/res/layout/search_bar.xml
+++ b/res/layout/search_bar.xml
@@ -21,15 +21,15 @@
android:id="@+id/search_bar_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- app:layout_scrollFlags="scroll|enterAlways"
- android:background="?android:attr/colorPrimary">
+ android:background="?android:attr/colorBackground"
+ android:theme="@style/ThemeOverlay.Settings.SearchBar"
+ app:layout_scrollFlags="scroll|enterAlways">
<androidx.cardview.widget.CardView
android:id="@+id/search_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/search_bar_margin"
app:cardCornerRadius="@dimen/search_bar_corner_radius"
- app:cardBackgroundColor="?android:attr/colorBackground"
app:cardElevation="@dimen/search_bar_card_elevation">
<Toolbar
android:id="@+id/search_action_bar"
@@ -37,8 +37,7 @@
android:layout_height="@dimen/search_bar_height"
android:background="?android:attr/selectableItemBackground"
android:contentInsetStartWithNavigation="@dimen/search_bar_content_inset"
- android:navigationIcon="@drawable/ic_search_24dp"
- android:theme="?android:attr/actionBarTheme">
+ android:navigationIcon="@drawable/ic_search_24dp">
<TextView
android:id="@+id/search_action_bar_title"
style="@style/TextAppearance.SearchBar"
diff --git a/res/layout/switch_bar.xml b/res/layout/switch_bar.xml
index 8cb6f51..3bdfbd4 100644
--- a/res/layout/switch_bar.xml
+++ b/res/layout/switch_bar.xml
@@ -28,7 +28,7 @@
android:maxLines="2"
android:ellipsize="end"
android:textAppearance="@style/TextAppearance.Switch"
- android:textColor="?android:attr/textColorPrimary"
+ android:textColor="?android:attr/textColorPrimaryInverse"
android:textAlignment="viewStart"/>
<ImageView
diff --git a/res/layout/two_action_buttons.xml b/res/layout/two_action_buttons.xml
index 23bb886..2b4aa5d 100644
--- a/res/layout/two_action_buttons.xml
+++ b/res/layout/two_action_buttons.xml
@@ -19,47 +19,28 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:gravity="center"
- android:paddingTop="24dp"
- android:paddingStart="68dp"
- android:paddingEnd="24dp"
+ android:paddingStart="8dp"
+ android:paddingEnd="8dp"
android:orientation="horizontal">
- <FrameLayout
+ <Button
+ android:id="@+id/button1"
+ style="@style/SettingsActionButton"
android:layout_width="0dp"
+ android:layout_height="wrap_content"
android:layout_weight="1"
- android:layout_height="wrap_content">
- <Button
- android:id="@+id/button1_positive"
- style="@style/ActionPrimaryButton"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginBottom="4dp" />
- <Button
- android:id="@+id/button1_negative"
- style="@style/ActionSecondaryButton"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginBottom="4dp" />
- </FrameLayout>
+ android:paddingTop="20dp"
+ android:paddingBottom="20dp"/>
<Space
- android:layout_width="16dp"
+ android:layout_width="8dp"
android:layout_height="wrap_content" />
- <FrameLayout
+
+ <Button
+ android:id="@+id/button2"
+ style="@style/SettingsActionButton"
android:layout_width="0dp"
+ android:layout_height="wrap_content"
android:layout_weight="1"
- android:layout_height="wrap_content">
- <Button
- android:id="@+id/button2_positive"
- style="@style/ActionPrimaryButton"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginBottom="4dp" />
- <Button
- android:id="@+id/button2_negative"
- style="@style/ActionSecondaryButton"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginBottom="4dp" />
- </FrameLayout>
+ android:paddingTop="20dp"
+ android:paddingBottom="20dp"/>
</LinearLayout>
\ No newline at end of file
diff --git a/res/values-night/colors.xml b/res/values-night/colors.xml
new file mode 100644
index 0000000..595f429
--- /dev/null
+++ b/res/values-night/colors.xml
@@ -0,0 +1,23 @@
+<?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="switchbar_text_color">@android:color/black</color>
+ <color name="switch_bar_background">#dadce0</color>
+ <color name="switchbar_switch_track_tint">#82000000</color>
+ <color name="switchbar_switch_thumb_tint">@android:color/black</color>
+</resources>
+
diff --git a/res/values-night/styles.xml b/res/values-night/styles.xml
new file mode 100644
index 0000000..87159b8
--- /dev/null
+++ b/res/values-night/styles.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2018 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<resources>
+
+<style name="Widget.ActionBar.Base" parent="@android:style/Widget.DeviceDefault.ActionBar.Solid">
+ <item name="android:background">?android:attr/colorPrimaryDark</item>
+</style>
+
+</resources>
\ No newline at end of file
diff --git a/res/values-night/themes.xml b/res/values-night/themes.xml
index 725fe17..8deae1c 100644
--- a/res/values-night/themes.xml
+++ b/res/values-night/themes.xml
@@ -20,6 +20,21 @@
<style name="Theme.Settings.Home" parent="Theme.Settings.HomeBase">
<item name="colorPrimary">@*android:color/primary_device_default_settings</item>
<item name="colorPrimaryDark">@*android:color/primary_dark_device_default_settings</item>
+ <item name="android:colorBackground">?android:attr/colorPrimaryDark</item>
+ </style>
+
+ <style name="ThemeOverlay.Settings.SearchBar" parent="Theme.Settings">
+ <item name="android:colorBackground">?android:attr/colorPrimaryDark</item>
+ <item name="cardBackgroundColor">?android:attr/colorPrimary</item>
+ <item name="android:colorControlNormal">?android:attr/colorAccent</item>
+ </style>
+
+ <style name="Theme.SubSettings" parent="Theme.SubSettings.Base">
+ <item name="android:colorControlNormal">?android:attr/colorAccent</item>
+ </style>
+
+ <style name="Theme.AlertDialog.Base" parent="@style/Theme.AppCompat.DayNight.Dialog.Alert">
+ <item name="colorAccent">@*android:color/accent_device_default_dark</item>
</style>
</resources>
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index afff3ce..752fd3d 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -154,4 +154,5 @@
<attr name="side_margin" format="reference|dimension" />
<attr name="wifi_signal_color" format="reference" />
+ <attr name="frictionIconColor" format="reference|color" />
</resources>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index f55eb1a..34885b4 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -130,6 +130,10 @@
<color name="homepage_privacy_background">#5E97F6</color>
<!-- End of dashboard/homepage icon background colors -->
+ <color name="switchbar_text_color">@android:color/white</color>
+ <color name="switchbar_switch_track_tint">#BFFFFFFF</color>
+ <color name="switchbar_switch_thumb_tint">@android:color/white</color>
+
<color name="glif_error_color">@*android:color/material_red_A700</color>
<color name="battery_good_color_light">#43a047</color> <!-- Material Green 600 -->
diff --git a/res/values/strings.xml b/res/values/strings.xml
index fee22d2..d9ac590 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -4002,8 +4002,6 @@
<string name="uninstall_all_users_text">Uninstall for all users</string>
<!-- [CHAR LIMIT=NONE] Manage applications, individual application info screen, button label under Storage heading. Button to install an application for the user. -->
<string name="install_text">Install</string>
- <!-- [CHAR LIMIT=25] Manage applications, individual application info screen, button label under Storage heading. Button to disable an existing application. -->
- <string name="disable_text">Disable</string>
<!-- [CHAR LIMIT=25] Manage applications, individual application info screen, button label under Storage heading. Button to re-enable an existing application. -->
<string name="enable_text">Enable</string>
<!-- Manage applications, individual application info screen, button label under Storage heading. Button to clear all data associated with tis app (for example, remove all cached emails for an Email app) -->
@@ -10333,4 +10331,7 @@
<string name="contextual_card_dismiss_keep">Keep</string>
<!-- String for contextual card dismissal [CHAR LIMIT=NONE] -->
<string name="contextual_card_dismiss_confirm_message">Remove this suggestion?</string>
+
+ <!-- Summary for low storage slice. [CHAR LIMIT=NONE] -->
+ <string name="low_storage_summary">Storage is low. <xliff:g id="percentage" example="54%">%1$s</xliff:g> used - <xliff:g id="free_space" example="32GB">%2$s</xliff:g> free</string>
</resources>
\ No newline at end of file
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 8fa357b..28bc1a0 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -16,12 +16,15 @@
<resources>
- <style name="Theme.ActionBar"
- parent="@android:style/Widget.DeviceDefault.Light.ActionBar.Solid">
+ <style name="Widget.ActionBar.Base"
+ parent="@android:style/Widget.DeviceDefault.Light.ActionBar.Solid"/>
+
+ <style name="Widget.ActionBar"
+ parent="Widget.ActionBar.Base">
<item name="android:contentInsetStart">@dimen/actionbar_contentInsetStart</item>
</style>
- <style name="Theme.ActionBar.SubSettings" parent="Theme.ActionBar">
+ <style name="Widget.ActionBar.SubSettings" parent="Widget.ActionBar">
<item name="android:contentInsetStart">@dimen/actionbar_subsettings_contentInsetStart</item>
</style>
@@ -426,6 +429,11 @@
<style name="ActionSecondaryButton" parent="android:Widget.DeviceDefault.Button"/>
+ <style name="SettingsActionButton" parent="android:Widget.DeviceDefault.Button.Borderless.Colored">
+ <item name="android:drawablePadding">4dp</item>
+ <item name="android:drawableTint">@*android:color/btn_colored_borderless_text_material</item>
+ </style>
+
<style name="LockPatternContainerStyle">
<item name="android:maxHeight">400dp</item>
<item name="android:maxWidth">420dp</item>
diff --git a/res/values/themes.xml b/res/values/themes.xml
index 4050cb2..4f44a36 100644
--- a/res/values/themes.xml
+++ b/res/values/themes.xml
@@ -39,7 +39,7 @@
<item name="suwListItemIconColor">?android:attr/colorAccent</item>
<!-- Redefine the ActionBar style for contentInsetStart -->
- <item name="android:actionBarStyle">@style/Theme.ActionBar</item>
+ <item name="android:actionBarStyle">@style/Widget.ActionBar</item>
<item name="switchBarTheme">@style/ThemeOverlay.SwitchBar.Settings</item>
@@ -62,13 +62,18 @@
<item name="android:windowNoTitle">true</item>
</style>
- <style name="Theme.SubSettings" parent="Theme.Settings">
+ <style name="Theme.SubSettings.Base" parent="Theme.Settings">
<!-- Redefine the ActionBar style for contentInsetStart -->
- <item name="android:actionBarStyle">@style/Theme.ActionBar.SubSettings</item>
+ <item name="android:actionBarStyle">@style/Widget.ActionBar.SubSettings</item>
<item name="switchBarTheme">@style/ThemeOverlay.SwitchBar.Settings</item>
+
+ <!-- Friction icon color for wifi preferences -->
+ <item name="frictionIconColor">?android:colorControlNormal</item>
</style>
+ <style name="Theme.SubSettings" parent="Theme.SubSettings.Base"/>
+
<style name="Theme.ProvisioningActivity" parent="@android:style/Theme.Translucent.NoTitleBar">
<item name="android:windowAnimationStyle">@null</item>
<item name="android:windowIsTranslucent">true</item>
@@ -80,7 +85,6 @@
</style>
<style name="ThemeOverlay.SwitchBar.Settings" parent="@android:style/ThemeOverlay.Material.ActionBar">
- <item name="android:textColorPrimary">@android:color/white</item>
<item name="switchBarMarginStart">@dimen/switchbar_subsettings_margin_start</item>
<item name="switchBarMarginEnd">@dimen/switchbar_subsettings_margin_end</item>
<item name="switchBarBackgroundColor">@color/switch_bar_background</item>
@@ -107,14 +111,17 @@
<item name="android:windowSoftInputMode">adjustResize</item>
</style>
- <style name="Theme.AlertDialog" parent="@style/Theme.AppCompat.DayNight.Dialog.Alert">
+ <style name="Theme.AlertDialog.Base" parent="@style/Theme.AppCompat.DayNight.Dialog.Alert">
+ <item name="colorAccent">@*android:color/accent_device_default_light</item>
+ </style>
+
+ <style name="Theme.AlertDialog" parent="Theme.AlertDialog.Base">
<item name="android:windowSoftInputMode">adjustResize</item>
<!-- Redefine the ActionBar style for contentInsetStart -->
- <item name="android:actionBarStyle">@style/Theme.ActionBar</item>
+ <item name="android:actionBarStyle">@style/Widget.ActionBar</item>
<!-- copied from Theme.DeviceDefault.Light.Dialog.Alert -->
- <item name="colorAccent">@*android:color/accent_device_default_light</item>
<item name="dialogCornerRadius">@*android:dimen/config_dialogCornerRadius</item>
</style>
@@ -183,4 +190,9 @@
<item name="android:windowLightNavigationBar">true</item>
</style>
+ <style name="ThemeOverlay.Settings.SearchBar" parent="Theme.Settings">
+ <item name="android:colorBackground">?android:attr/colorPrimary</item>
+ <item name="cardBackgroundColor">?android:attr/colorBackground</item>
+ </style>
+
</resources>
diff --git a/res/xml/app_info_settings.xml b/res/xml/app_info_settings.xml
index 81afc1a..84ea14d 100644
--- a/res/xml/app_info_settings.xml
+++ b/res/xml/app_info_settings.xml
@@ -25,7 +25,8 @@
android:key="header_view"
android:layout="@layout/settings_entity_header"
android:selectable="false"
- android:order="-10000" />
+ android:order="-10000"
+ settings:allowDividerBelow="true"/>
<com.android.settings.applications.LayoutPreference
android:key="instant_app_buttons"
@@ -40,7 +41,8 @@
<Preference
android:key="notification_settings"
android:title="@string/notifications_label"
- settings:controller="com.android.settings.applications.appinfo.AppNotificationPreferenceController" />
+ settings:controller="com.android.settings.applications.appinfo.AppNotificationPreferenceController"
+ settings:allowDividerAbove="true"/>
<com.android.settings.widget.FixedLineSummaryPreference
android:key="permission_settings"
diff --git a/res/xml/bluetooth_device_details_fragment.xml b/res/xml/bluetooth_device_details_fragment.xml
index c8f5c1b..01114b6 100644
--- a/res/xml/bluetooth_device_details_fragment.xml
+++ b/res/xml/bluetooth_device_details_fragment.xml
@@ -16,12 +16,14 @@
-->
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:settings="http://schemas.android.com/apk/res-auto"
android:title="@string/device_details_title">
<com.android.settings.applications.LayoutPreference
android:key="bluetooth_device_header"
android:layout="@layout/settings_entity_header"
- android:selectable="false"/>
+ android:selectable="false"
+ settings:allowDividerBelow="true"/>
<com.android.settings.widget.ActionButtonPreference
android:key="action_buttons" />
diff --git a/res/xml/wifi_network_details_fragment.xml b/res/xml/wifi_network_details_fragment.xml
index 7c8d9a0..4198b76 100644
--- a/res/xml/wifi_network_details_fragment.xml
+++ b/res/xml/wifi_network_details_fragment.xml
@@ -23,7 +23,8 @@
android:key="connection_header"
android:layout="@layout/settings_entity_header"
android:selectable="false"
- android:order="-10000"/>
+ android:order="-10000"
+ settings:allowDividerBelow="true"/>
<!-- Buttons -->
<com.android.settings.widget.ActionButtonPreference
diff --git a/src/com/android/settings/applications/AppStorageSettings.java b/src/com/android/settings/applications/AppStorageSettings.java
index c926da3..841fb51 100644
--- a/src/com/android/settings/applications/AppStorageSettings.java
+++ b/src/com/android/settings/applications/AppStorageSettings.java
@@ -167,10 +167,7 @@
.setComputingString(R.string.computing_size)
.setErrorString(R.string.invalid_size_value)
.build();
- mButtonsPref = ((ActionButtonPreference) findPreference(KEY_HEADER_BUTTONS))
- .setButton1Positive(false)
- .setButton2Positive(false);
-
+ mButtonsPref = ((ActionButtonPreference) findPreference(KEY_HEADER_BUTTONS));
mStorageUsed = findPreference(KEY_STORAGE_USED);
mChangeStorageButton = (Button) ((LayoutPreference) findPreference(KEY_CHANGE_STORAGE))
.findViewById(R.id.button);
@@ -178,7 +175,9 @@
mChangeStorageButton.setOnClickListener(this);
// Cache section
- mButtonsPref.setButton2Text(R.string.clear_cache_btn_text);
+ mButtonsPref
+ .setButton2Text(R.string.clear_cache_btn_text)
+ .setButton2Icon(R.drawable.ic_settings_delete);
// URI permissions section
mUri = (PreferenceCategory) findPreference(KEY_URI_CATEGORY);
@@ -304,16 +303,20 @@
|| !isManageSpaceActivityAvailable) {
mButtonsPref
.setButton1Text(R.string.clear_user_data_text)
+ .setButton1Icon(R.drawable.ic_settings_delete)
.setButton1Enabled(false);
mCanClearData = false;
} else {
if (appHasSpaceManagementUI) {
mButtonsPref.setButton1Text(R.string.manage_space_text);
} else {
- mButtonsPref.setButton1Text(R.string.clear_user_data_text);
+ mButtonsPref
+ .setButton1Text(R.string.clear_user_data_text)
+ .setButton1Icon(R.drawable.ic_settings_delete);
}
mButtonsPref
.setButton1Text(R.string.clear_user_data_text)
+ .setButton1Icon(R.drawable.ic_settings_delete)
.setButton1OnClickListener(v -> handleClearDataClick());
}
@@ -384,7 +387,9 @@
private void processClearMsg(Message msg) {
int result = msg.arg1;
String packageName = mAppEntry.info.packageName;
- mButtonsPref.setButton1Text(R.string.clear_user_data_text);
+ mButtonsPref
+ .setButton1Text(R.string.clear_user_data_text)
+ .setButton1Icon(R.drawable.ic_settings_delete);
if (result == OP_SUCCESSFUL) {
Log.i(TAG, "Cleared user data for package : " + packageName);
updateSize();
diff --git a/src/com/android/settings/applications/ApplicationFeatureProviderImpl.java b/src/com/android/settings/applications/ApplicationFeatureProviderImpl.java
index d29fc95..c246c58 100644
--- a/src/com/android/settings/applications/ApplicationFeatureProviderImpl.java
+++ b/src/com/android/settings/applications/ApplicationFeatureProviderImpl.java
@@ -32,6 +32,7 @@
import android.util.ArraySet;
import com.android.internal.telephony.SmsApplication;
+import com.android.settings.R;
import java.util.ArrayList;
import java.util.List;
@@ -138,6 +139,9 @@
if (defaultSms != null) {
keepEnabledPackages.add(defaultSms.getPackageName());
}
+ // Keep Settings intelligence enabled, otherwise search feature will be disabled.
+ keepEnabledPackages.add(
+ mContext.getString(R.string.config_settingsintelligence_package_name));
return keepEnabledPackages;
}
diff --git a/src/com/android/settings/applications/appinfo/AppButtonsPreferenceController.java b/src/com/android/settings/applications/appinfo/AppButtonsPreferenceController.java
index 6d726b9..9740ecb 100644
--- a/src/com/android/settings/applications/appinfo/AppButtonsPreferenceController.java
+++ b/src/com/android/settings/applications/appinfo/AppButtonsPreferenceController.java
@@ -167,11 +167,11 @@
if (isAvailable()) {
mButtonsPref = ((ActionButtonPreference) screen.findPreference(KEY_ACTION_BUTTONS))
.setButton1Text(R.string.uninstall_text)
+ .setButton1Icon(R.drawable.ic_settings_delete)
.setButton2Text(R.string.force_stop)
+ .setButton2Icon(R.drawable.ic_settings_force_stop)
.setButton1OnClickListener(new UninstallAndDisableButtonListener())
.setButton2OnClickListener(new ForceStopButtonListener())
- .setButton1Positive(false)
- .setButton2Positive(false)
.setButton2Enabled(false);
}
}
@@ -547,16 +547,16 @@
if (mHomePackages.contains(mAppEntry.info.packageName)
|| isSystemPackage(mActivity.getResources(), mPm, mPackageInfo)) {
// Disable button for core system applications.
- mButtonsPref.setButton1Text(R.string.disable_text)
- .setButton1Positive(false);
+ mButtonsPref.setButton1Text(R.string.uninstall_text)
+ .setButton1Icon(R.drawable.ic_settings_delete);
} else if (mAppEntry.info.enabled && !isDisabledUntilUsed()) {
- mButtonsPref.setButton1Text(R.string.disable_text)
- .setButton1Positive(false);
+ mButtonsPref.setButton1Text(R.string.uninstall_text)
+ .setButton1Icon(R.drawable.ic_settings_delete);
disableable = !mApplicationFeatureProvider.getKeepEnabledPackages()
.contains(mAppEntry.info.packageName);
} else {
- mButtonsPref.setButton1Text(R.string.enable_text)
- .setButton1Positive(true);
+ mButtonsPref.setButton1Text(R.string.install_text)
+ .setButton1Icon(R.drawable.ic_settings_install);
disableable = true;
}
diff --git a/src/com/android/settings/applications/appinfo/AppInfoDashboardFragment.java b/src/com/android/settings/applications/appinfo/AppInfoDashboardFragment.java
index 64fd36d..32880d3 100755
--- a/src/com/android/settings/applications/appinfo/AppInfoDashboardFragment.java
+++ b/src/com/android/settings/applications/appinfo/AppInfoDashboardFragment.java
@@ -88,7 +88,7 @@
// Result code identifiers
@VisibleForTesting
static final int REQUEST_UNINSTALL = 0;
- private static final int REQUEST_REMOVE_DEVICE_ADMIN = 1;
+ private static final int REQUEST_REMOVE_DEVICE_ADMIN = 5;
static final int SUB_INFO_FRAGMENT = 1;
diff --git a/src/com/android/settings/bluetooth/BluetoothDetailsButtonsController.java b/src/com/android/settings/bluetooth/BluetoothDetailsButtonsController.java
index 09632df..563a06a 100644
--- a/src/com/android/settings/bluetooth/BluetoothDetailsButtonsController.java
+++ b/src/com/android/settings/bluetooth/BluetoothDetailsButtonsController.java
@@ -53,8 +53,8 @@
protected void init(PreferenceScreen screen) {
mActionButtons = ((ActionButtonPreference) screen.findPreference(getPreferenceKey()))
.setButton1Text(R.string.forget)
+ .setButton1Icon(R.drawable.ic_settings_delete)
.setButton1OnClickListener((view) -> onForgetButtonPressed())
- .setButton1Positive(false)
.setButton1Enabled(true);
}
@@ -68,17 +68,17 @@
if (!mConnectButtonInitialized || !previouslyConnected) {
mActionButtons
.setButton2Text(R.string.bluetooth_device_context_disconnect)
- .setButton2OnClickListener(view -> mCachedDevice.disconnect())
- .setButton2Positive(false);
+ .setButton2Icon(R.drawable.ic_settings_close)
+ .setButton2OnClickListener(view -> mCachedDevice.disconnect());
mConnectButtonInitialized = true;
}
} else {
if (!mConnectButtonInitialized || previouslyConnected) {
mActionButtons
.setButton2Text(R.string.bluetooth_device_context_connect)
+ // TODO (b/119646923) Icon is not ready.
.setButton2OnClickListener(
- view -> mCachedDevice.connect(true /* connectAllProfiles */))
- .setButton2Positive(true);
+ view -> mCachedDevice.connect(true /* connectAllProfiles */));
mConnectButtonInitialized = true;
}
}
diff --git a/src/com/android/settings/homepage/contextualcards/ContextualCardManager.java b/src/com/android/settings/homepage/contextualcards/ContextualCardManager.java
index 8bb8b4d..30eae29 100644
--- a/src/com/android/settings/homepage/contextualcards/ContextualCardManager.java
+++ b/src/com/android/settings/homepage/contextualcards/ContextualCardManager.java
@@ -62,10 +62,12 @@
private static final int[] SETTINGS_CARDS =
{ContextualCard.CardType.CONDITIONAL, ContextualCard.CardType.LEGACY_SUGGESTION};
+ @VisibleForTesting
+ final List<ContextualCard> mContextualCards;
+
private final Context mContext;
private final ControllerRendererPool mControllerRendererPool;
private final Lifecycle mLifecycle;
- private final List<ContextualCard> mContextualCards;
private final List<LifecycleObserver> mLifecycleObservers;
private ContextualCardUpdateListener mListener;
@@ -122,10 +124,23 @@
public void onContextualCardUpdated(Map<Integer, List<ContextualCard>> updateList) {
final Set<Integer> cardTypes = updateList.keySet();
//Remove the existing data that matches the certain cardType before inserting new data.
- final List<ContextualCard> cardsToKeep = mContextualCards
- .stream()
- .filter(card -> !cardTypes.contains(card.getCardType()))
- .collect(Collectors.toList());
+ List<ContextualCard> cardsToKeep;
+
+ // We are not sure how many card types will be in the database, so when the list coming
+ // from the database is empty (e.g. no eligible cards/cards are dismissed), we cannot
+ // assign a specific card type for its map which is sending here. Thus, we assume that
+ // except Conditional cards, all other cards are from the database. So when the map sent
+ // here is empty, we only keep Conditional cards.
+ if (cardTypes.isEmpty()) {
+ cardsToKeep = mContextualCards.stream()
+ .filter(card -> card.getCardType() == ContextualCard.CardType.CONDITIONAL)
+ .collect(Collectors.toList());
+ } else {
+ cardsToKeep = mContextualCards.stream()
+ .filter(card -> !cardTypes.contains(card.getCardType()))
+ .collect(Collectors.toList());
+ }
+
final List<ContextualCard> allCards = new ArrayList<>();
allCards.addAll(cardsToKeep);
allCards.addAll(
diff --git a/src/com/android/settings/homepage/contextualcards/SettingsContextualCardProvider.java b/src/com/android/settings/homepage/contextualcards/SettingsContextualCardProvider.java
index c736c4d..f58ec74 100644
--- a/src/com/android/settings/homepage/contextualcards/SettingsContextualCardProvider.java
+++ b/src/com/android/settings/homepage/contextualcards/SettingsContextualCardProvider.java
@@ -22,6 +22,7 @@
import com.android.settings.homepage.contextualcards.deviceinfo.BatterySlice;
import com.android.settings.homepage.contextualcards.slices.ConnectedDeviceSlice;
+import com.android.settings.homepage.contextualcards.slices.LowStorageSlice;
import com.android.settings.intelligence.ContextualCardProto.ContextualCard;
import com.android.settings.intelligence.ContextualCardProto.ContextualCardList;
import com.android.settings.wifi.WifiSlice;
@@ -54,10 +55,17 @@
.setCardName(ConnectedDeviceSlice.PATH_CONNECTED_DEVICE)
.setCardCategory(ContextualCard.Category.IMPORTANT)
.build();
+ final ContextualCard lowStorageCard =
+ ContextualCard.newBuilder()
+ .setSliceUri(LowStorageSlice.LOW_STORAGE_URI.toString())
+ .setCardName(LowStorageSlice.PATH_LOW_STORAGE)
+ .setCardCategory(ContextualCard.Category.IMPORTANT)
+ .build();
final ContextualCardList cards = ContextualCardList.newBuilder()
.addCard(wifiCard)
.addCard(batteryInfoCard)
.addCard(connectedDeviceCard)
+ .addCard(lowStorageCard)
.build();
return cards;
diff --git a/src/com/android/settings/homepage/contextualcards/slices/LowStorageSlice.java b/src/com/android/settings/homepage/contextualcards/slices/LowStorageSlice.java
new file mode 100644
index 0000000..7f6efcc
--- /dev/null
+++ b/src/com/android/settings/homepage/contextualcards/slices/LowStorageSlice.java
@@ -0,0 +1,144 @@
+/*
+ * 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.homepage.contextualcards.slices;
+
+import android.app.PendingIntent;
+import android.content.ContentResolver;
+import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.storage.StorageManager;
+import android.text.format.Formatter;
+import android.util.Log;
+
+import androidx.core.graphics.drawable.IconCompat;
+import androidx.slice.Slice;
+import androidx.slice.builders.ListBuilder;
+import androidx.slice.builders.ListBuilder.RowBuilder;
+import androidx.slice.builders.SliceAction;
+
+import com.android.internal.logging.nano.MetricsProto;
+import com.android.settings.R;
+import com.android.settings.SubSettings;
+import com.android.settings.Utils;
+import com.android.settings.deviceinfo.StorageSettings;
+import com.android.settings.slices.CustomSliceable;
+import com.android.settings.slices.SettingsSliceProvider;
+import com.android.settings.slices.SliceBuilderUtils;
+import com.android.settingslib.deviceinfo.PrivateStorageInfo;
+import com.android.settingslib.deviceinfo.StorageManagerVolumeProvider;
+
+import java.text.NumberFormat;
+
+public class LowStorageSlice implements CustomSliceable {
+
+ /**
+ * The path denotes the unique name of Low storage Slice.
+ */
+ public static final String PATH_LOW_STORAGE = "low_storage";
+
+ /**
+ * Backing Uri for Low storage Slice.
+ */
+ public static final Uri LOW_STORAGE_URI = new Uri.Builder()
+ .scheme(ContentResolver.SCHEME_CONTENT)
+ .authority(SettingsSliceProvider.SLICE_AUTHORITY)
+ .appendPath(PATH_LOW_STORAGE)
+ .build();
+
+ private static final String TAG = "LowStorageSlice";
+
+ /**
+ * If user used >= 85% storage.
+ */
+ private static final double LOW_STORAGE_THRESHOLD = 0.85;
+
+ private final Context mContext;
+
+ public LowStorageSlice(Context context) {
+ mContext = context;
+ }
+
+ /**
+ * Return a Low storage Slice bound to {@link #LOW_STORAGE_URI}
+ */
+ @Override
+ public Slice getSlice() {
+ // Get current storage percentage from StorageManager.
+ final PrivateStorageInfo info = PrivateStorageInfo.getPrivateStorageInfo(
+ new StorageManagerVolumeProvider(mContext.getSystemService(StorageManager.class)));
+ final double currentStoragePercentage =
+ (double) (info.totalBytes - info.freeBytes) / info.totalBytes;
+
+ // Used storage < 85%. NOT show Low storage Slice.
+ if (currentStoragePercentage < LOW_STORAGE_THRESHOLD) {
+ /**
+ * TODO(b/114808204): Contextual Home Page - "Low Storage"
+ * The behavior is under decision making, will update new behavior or remove TODO later.
+ */
+ Log.i(TAG, "Not show low storage slice, not match condition.");
+ return null;
+ }
+
+ // Show Low storage Slice.
+ final IconCompat icon = IconCompat.createWithResource(mContext, R.drawable.ic_storage);
+ final CharSequence title = mContext.getText(R.string.storage_menu_free);
+ final SliceAction primarySliceAction = new SliceAction(
+ PendingIntent.getActivity(mContext, 0, getIntent(), 0), icon, title);
+ final String lowStorageSummary = mContext.getString(R.string.low_storage_summary,
+ NumberFormat.getPercentInstance().format(currentStoragePercentage),
+ Formatter.formatFileSize(mContext, info.freeBytes));
+
+ /**
+ * TODO(b/114808204): Contextual Home Page - "Low Storage"
+ * Slices doesn't support "Icon on the left" in header. Now we intend to start with Icon
+ * right aligned. Will update the icon to left until Slices support it.
+ */
+ return new ListBuilder(mContext, LOW_STORAGE_URI, ListBuilder.INFINITY)
+ .setAccentColor(Utils.getColorAccentDefaultColor(mContext))
+ .addRow(new RowBuilder()
+ .setTitle(title)
+ .setSubtitle(lowStorageSummary)
+ .addEndItem(icon, ListBuilder.ICON_IMAGE)
+ .setPrimaryAction(primarySliceAction))
+ .build();
+ }
+
+ @Override
+ public Uri getUri() {
+ return LOW_STORAGE_URI;
+ }
+
+ @Override
+ public void onNotifyChange(Intent intent) {
+
+ }
+
+ @Override
+ public Intent getIntent() {
+ final String screenTitle = mContext.getText(R.string.storage_label)
+ .toString();
+ final Uri contentUri = new Uri.Builder().appendPath(PATH_LOW_STORAGE).build();
+
+ return SliceBuilderUtils.buildSearchResultPageIntent(mContext,
+ StorageSettings.class.getName(), PATH_LOW_STORAGE,
+ screenTitle,
+ MetricsProto.MetricsEvent.SLICE)
+ .setClassName(mContext.getPackageName(), SubSettings.class.getName())
+ .setData(contentUri);
+ }
+}
\ No newline at end of file
diff --git a/src/com/android/settings/search/SearchFeatureProvider.java b/src/com/android/settings/search/SearchFeatureProvider.java
index 464b8f5..3c1c62b 100644
--- a/src/com/android/settings/search/SearchFeatureProvider.java
+++ b/src/com/android/settings/search/SearchFeatureProvider.java
@@ -23,6 +23,7 @@
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
+import android.content.pm.PackageManager;
import android.provider.Settings;
import android.view.View;
import android.view.ViewGroup;
@@ -88,6 +89,11 @@
intent.setPackage(getSettingsIntelligencePkgName(activity));
final Context context = activity.getApplicationContext();
+ if (activity.getPackageManager().queryIntentActivities(intent,
+ PackageManager.MATCH_DEFAULT_ONLY).isEmpty()) {
+ return;
+ }
+
FeatureFactory.getFactory(context).getSlicesFeatureProvider()
.indexSliceDataAsync(activity.getApplicationContext());
FeatureFactory.getFactory(context).getMetricsFeatureProvider()
diff --git a/src/com/android/settings/search/actionbar/SearchMenuController.java b/src/com/android/settings/search/actionbar/SearchMenuController.java
index 22adbeb..643f0c3 100644
--- a/src/com/android/settings/search/actionbar/SearchMenuController.java
+++ b/src/com/android/settings/search/actionbar/SearchMenuController.java
@@ -19,6 +19,7 @@
import android.annotation.NonNull;
import android.content.Context;
import android.content.Intent;
+import android.content.pm.PackageManager;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
@@ -80,6 +81,12 @@
searchItem.setOnMenuItemClickListener(target -> {
final Intent intent = SearchFeatureProvider.SEARCH_UI_INTENT;
intent.setPackage(SettingsIntelligencePkgName);
+
+ if (context.getPackageManager().queryIntentActivities(intent,
+ PackageManager.MATCH_DEFAULT_ONLY).isEmpty()) {
+ return true;
+ }
+
FeatureFactory.getFactory(context).getMetricsFeatureProvider()
.action(context, MetricsProto.MetricsEvent.ACTION_SEARCH_RESULTS);
mHost.startActivityForResult(intent, 0 /* requestCode */);
diff --git a/src/com/android/settings/slices/CustomSliceManager.java b/src/com/android/settings/slices/CustomSliceManager.java
index 556c698..5b25498 100644
--- a/src/com/android/settings/slices/CustomSliceManager.java
+++ b/src/com/android/settings/slices/CustomSliceManager.java
@@ -25,6 +25,7 @@
import com.android.settings.homepage.contextualcards.deviceinfo.DeviceInfoSlice;
import com.android.settings.homepage.contextualcards.deviceinfo.StorageSlice;
import com.android.settings.homepage.contextualcards.slices.ConnectedDeviceSlice;
+import com.android.settings.homepage.contextualcards.slices.LowStorageSlice;
import com.android.settings.wifi.WifiSlice;
import java.util.Map;
@@ -105,5 +106,6 @@
mUriMap.put(StorageSlice.STORAGE_CARD_URI, StorageSlice.class);
mUriMap.put(BatterySlice.BATTERY_CARD_URI, BatterySlice.class);
mUriMap.put(ConnectedDeviceSlice.CONNECTED_DEVICE_URI, ConnectedDeviceSlice.class);
+ mUriMap.put(LowStorageSlice.LOW_STORAGE_URI, LowStorageSlice.class);
}
}
diff --git a/src/com/android/settings/tts/TextToSpeechSettings.java b/src/com/android/settings/tts/TextToSpeechSettings.java
index cce871b..b1a1f8f 100644
--- a/src/com/android/settings/tts/TextToSpeechSettings.java
+++ b/src/com/android/settings/tts/TextToSpeechSettings.java
@@ -171,11 +171,9 @@
mActionButtons = ((ActionButtonPreference) findPreference(KEY_ACTION_BUTTONS))
.setButton1Text(R.string.tts_play)
- .setButton1Positive(true)
.setButton1OnClickListener(v -> speakSampleText())
.setButton1Enabled(false)
.setButton2Text(R.string.tts_reset)
- .setButton2Positive(false)
.setButton2OnClickListener(v -> resetTts())
.setButton1Enabled(true);
diff --git a/src/com/android/settings/widget/ActionButtonPreference.java b/src/com/android/settings/widget/ActionButtonPreference.java
index 347a784..7ce84bd 100644
--- a/src/com/android/settings/widget/ActionButtonPreference.java
+++ b/src/com/android/settings/widget/ActionButtonPreference.java
@@ -17,11 +17,15 @@
package com.android.settings.widget;
import android.content.Context;
+import android.content.res.Resources;
+import android.graphics.drawable.Drawable;
import android.text.TextUtils;
import android.util.AttributeSet;
+import android.util.Log;
import android.view.View;
import android.widget.Button;
+import androidx.annotation.DrawableRes;
import androidx.annotation.StringRes;
import androidx.preference.Preference;
import androidx.preference.PreferenceViewHolder;
@@ -30,6 +34,7 @@
public class ActionButtonPreference extends Preference {
+ private final String TAG = "ActionButtonPreference";
private final ButtonInfo mButton1Info = new ButtonInfo();
private final ButtonInfo mButton2Info = new ButtonInfo();
@@ -62,12 +67,11 @@
@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
super.onBindViewHolder(holder);
- holder.setDividerAllowedAbove(false);
- holder.setDividerAllowedBelow(false);
- mButton1Info.mPositiveButton = (Button) holder.findViewById(R.id.button1_positive);
- mButton1Info.mNegativeButton = (Button) holder.findViewById(R.id.button1_negative);
- mButton2Info.mPositiveButton = (Button) holder.findViewById(R.id.button2_positive);
- mButton2Info.mNegativeButton = (Button) holder.findViewById(R.id.button2_negative);
+ holder.setDividerAllowedAbove(true);
+ holder.setDividerAllowedBelow(true);
+
+ mButton1Info.mButton = (Button) holder.findViewById(R.id.button1);
+ mButton2Info.mButton = (Button) holder.findViewById(R.id.button2);
mButton1Info.setUpButton();
mButton2Info.setUpButton();
@@ -82,6 +86,22 @@
return this;
}
+ public ActionButtonPreference setButton1Icon(@DrawableRes int iconResId) {
+ if (iconResId == 0) {
+ return this;
+ }
+
+ final Drawable icon;
+ try {
+ icon = getContext().getDrawable(iconResId);
+ mButton1Info.mIcon = icon;
+ notifyChanged();
+ } catch (Resources.NotFoundException exception) {
+ Log.e(TAG, "Resource does not exist: " + iconResId);
+ }
+ return this;
+ }
+
public ActionButtonPreference setButton1Enabled(boolean isEnabled) {
if (isEnabled != mButton1Info.mIsEnabled) {
mButton1Info.mIsEnabled = isEnabled;
@@ -99,6 +119,22 @@
return this;
}
+ public ActionButtonPreference setButton2Icon(@DrawableRes int iconResId) {
+ if (iconResId == 0) {
+ return this;
+ }
+
+ final Drawable icon;
+ try {
+ icon = getContext().getDrawable(iconResId);
+ mButton2Info.mIcon = icon;
+ notifyChanged();
+ } catch (Resources.NotFoundException exception) {
+ Log.e(TAG, "Resource does not exist: " + iconResId);
+ }
+ return this;
+ }
+
public ActionButtonPreference setButton2Enabled(boolean isEnabled) {
if (isEnabled != mButton2Info.mIsEnabled) {
mButton2Info.mIsEnabled = isEnabled;
@@ -123,65 +159,41 @@
return this;
}
- public ActionButtonPreference setButton1Positive(boolean isPositive) {
- if (isPositive != mButton1Info.mIsPositive) {
- mButton1Info.mIsPositive = isPositive;
+ public ActionButtonPreference setButton1Visible(boolean isVisible) {
+ if (isVisible != mButton1Info.mIsVisible) {
+ mButton1Info.mIsVisible = isVisible;
notifyChanged();
}
return this;
}
- public ActionButtonPreference setButton2Positive(boolean isPositive) {
- if (isPositive != mButton2Info.mIsPositive) {
- mButton2Info.mIsPositive = isPositive;
- notifyChanged();
- }
- return this;
- }
- public ActionButtonPreference setButton1Visible(boolean isPositive) {
- if (isPositive != mButton1Info.mIsVisible) {
- mButton1Info.mIsVisible = isPositive;
- notifyChanged();
- }
- return this;
- }
-
- public ActionButtonPreference setButton2Visible(boolean isPositive) {
- if (isPositive != mButton2Info.mIsVisible) {
- mButton2Info.mIsVisible = isPositive;
+ public ActionButtonPreference setButton2Visible(boolean isVisible) {
+ if (isVisible != mButton2Info.mIsVisible) {
+ mButton2Info.mIsVisible = isVisible;
notifyChanged();
}
return this;
}
static class ButtonInfo {
- private Button mPositiveButton;
- private Button mNegativeButton;
+ private Button mButton;
private CharSequence mText;
+ private Drawable mIcon;
private View.OnClickListener mListener;
- private boolean mIsPositive = true;
private boolean mIsEnabled = true;
private boolean mIsVisible = true;
void setUpButton() {
- setUpButton(mPositiveButton);
- setUpButton(mNegativeButton);
- if (!mIsVisible) {
- mPositiveButton.setVisibility(View.INVISIBLE);
- mNegativeButton.setVisibility(View.INVISIBLE);
- } else if (mIsPositive) {
- mPositiveButton.setVisibility(View.VISIBLE);
- mNegativeButton.setVisibility(View.INVISIBLE);
+ mButton.setText(mText);
+ mButton.setOnClickListener(mListener);
+ mButton.setEnabled(mIsEnabled);
+ mButton.setCompoundDrawablesWithIntrinsicBounds(
+ null /* left */, mIcon /* top */, null /* right */, null /* bottom */);
+ if (mIsVisible) {
+ mButton.setVisibility(View.VISIBLE);
} else {
- mPositiveButton.setVisibility(View.INVISIBLE);
- mNegativeButton.setVisibility(View.VISIBLE);
+ mButton.setVisibility(View.GONE);
}
}
-
- private void setUpButton(Button button) {
- button.setText(mText);
- button.setOnClickListener(mListener);
- button.setEnabled(mIsEnabled);
- }
}
}
\ No newline at end of file
diff --git a/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java b/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java
index 46f485c..3bf38a7 100644
--- a/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java
+++ b/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java
@@ -278,10 +278,9 @@
mButtonsPref = ((ActionButtonPreference) screen.findPreference(KEY_BUTTONS_PREF))
.setButton1Text(R.string.forget)
- .setButton1Positive(false)
+ .setButton1Icon(R.drawable.ic_settings_delete)
.setButton1OnClickListener(view -> forgetNetwork())
.setButton2Text(R.string.wifi_sign_in_button_text)
- .setButton2Positive(true)
.setButton2OnClickListener(view -> signIntoNetwork());
mSignalStrengthPref =
diff --git a/src/com/android/settings/wifi/qrcode/QrDecorateView.java b/src/com/android/settings/wifi/qrcode/QrDecorateView.java
new file mode 100644
index 0000000..253bdb8
--- /dev/null
+++ b/src/com/android/settings/wifi/qrcode/QrDecorateView.java
@@ -0,0 +1,136 @@
+/*
+ * 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.wifi.qrcode;
+
+import android.content.Context;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.Paint;
+import android.graphics.Point;
+import android.graphics.Rect;
+import android.graphics.RectF;
+import android.util.AttributeSet;
+import android.util.TypedValue;
+import android.view.View;
+
+import com.android.settings.R;
+
+/**
+ * Draws the lines at the corner of the inner frame.
+ */
+public class QrDecorateView extends View {
+ private static final float CORNER_STROKE_WIDTH = 3f; // 3dp
+ private static final float CORNER_LINE_LENGTH = 20f; // 20dp
+
+ final private Paint mPaint;
+ private RectF mFrame;
+ private boolean mFocused;
+
+ public QrDecorateView(Context context) {
+ this(context, null);
+ }
+
+ public QrDecorateView(Context context, AttributeSet attrs) {
+ this(context, attrs, 0);
+ }
+
+ public QrDecorateView(Context context, AttributeSet attrs, int defStyleAttr) {
+ this(context, attrs, defStyleAttr, 0);
+ }
+
+ public QrDecorateView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
+ super(context, attrs, defStyleAttr, defStyleRes);
+ final float strokeWidth = TypedValue.applyDimension(
+ TypedValue.COMPLEX_UNIT_DIP,
+ CORNER_STROKE_WIDTH,
+ getResources().getDisplayMetrics()
+ );
+ mPaint = new Paint();
+ mPaint.setStrokeWidth(strokeWidth);
+ mFocused = false;
+ }
+
+ @Override
+ protected void onDraw(Canvas canvas) {
+ calculateFramePos();
+ final float cornerLineLength = TypedValue.applyDimension(
+ TypedValue.COMPLEX_UNIT_DIP,
+ CORNER_LINE_LENGTH,
+ getResources().getDisplayMetrics()
+ );
+ mPaint.setColor(mFocused ? Color.GREEN : Color.WHITE);
+ drawCorner(mFrame, cornerLineLength, canvas);
+ super.onDraw(canvas);
+ }
+
+ private void drawCorner(RectF frame, float lineLength, Canvas canvas) {
+ final float strokeWidth = TypedValue.applyDimension(
+ TypedValue.COMPLEX_UNIT_DIP,
+ CORNER_STROKE_WIDTH,
+ getResources().getDisplayMetrics()
+ );
+ // Draw top-left corner.
+ canvas.drawLine(
+ frame.left - strokeWidth / 2,
+ frame.top,
+ frame.left + lineLength,
+ frame.top,
+ mPaint);
+ canvas.drawLine(frame.left, frame.top, frame.left, frame.top + lineLength, mPaint);
+ // Draw top-right corner.
+ canvas.drawLine(
+ frame.right + strokeWidth / 2,
+ frame.top,
+ frame.right - lineLength,
+ frame.top,
+ mPaint);
+ canvas.drawLine(frame.right, frame.top, frame.right, frame.top + lineLength, mPaint);
+ // Draw bottom-left corner.
+ canvas.drawLine(
+ frame.left - strokeWidth / 2,
+ frame.bottom,
+ frame.left + lineLength,
+ frame.bottom,
+ mPaint);
+ canvas.drawLine(frame.left, frame.bottom, frame.left, frame.bottom - lineLength, mPaint);
+ // Draw bottom-right corner.
+ canvas.drawLine(
+ frame.right + strokeWidth / 2,
+ frame.bottom,
+ frame.right - lineLength,
+ frame.bottom,
+ mPaint);
+ canvas.drawLine(frame.right, frame.bottom, frame.right, frame.bottom - lineLength, mPaint);
+ }
+
+ private void calculateFramePos() {
+ final int centralX = getWidth() / 2;
+ final int centralY = getHeight() / 2;
+ final float halfFrameWidth = getWidth() / 3;
+ mFrame = new RectF(
+ centralX - halfFrameWidth,
+ centralY - halfFrameWidth,
+ centralX + halfFrameWidth,
+ centralY + halfFrameWidth);
+ }
+
+ // Draws green lines if focued. Otherwise, draws white lines.
+ public void setFocused(boolean focused) {
+ mFocused = focused;
+ invalidate();
+ }
+}
diff --git a/tests/robotests/src/com/android/settings/SettingsPreferenceFragmentTest.java b/tests/robotests/src/com/android/settings/SettingsPreferenceFragmentTest.java
index 6848793..2fc3dcb 100644
--- a/tests/robotests/src/com/android/settings/SettingsPreferenceFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/SettingsPreferenceFragmentTest.java
@@ -69,6 +69,7 @@
mContext = RuntimeEnvironment.application;
mFragment = spy(new TestFragment());
doReturn(mActivity).when(mFragment).getActivity();
+ when(mFragment.getContext()).thenReturn(mContext);
mEmptyView = new View(mContext);
ReflectionHelpers.setField(mFragment, "mEmptyView", mEmptyView);
diff --git a/tests/robotests/src/com/android/settings/applications/ApplicationFeatureProviderImplTest.java b/tests/robotests/src/com/android/settings/applications/ApplicationFeatureProviderImplTest.java
index ba07dc5..128f345 100644
--- a/tests/robotests/src/com/android/settings/applications/ApplicationFeatureProviderImplTest.java
+++ b/tests/robotests/src/com/android/settings/applications/ApplicationFeatureProviderImplTest.java
@@ -34,6 +34,7 @@
import android.os.UserHandle;
import android.os.UserManager;
+import com.android.settings.R;
import com.android.settings.testutils.ApplicationTestUtils;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settingslib.testutils.shadow.ShadowDefaultDialerManager;
@@ -258,13 +259,16 @@
public void getKeepEnabledPackages_shouldContainDefaultPhoneAndSms() {
final String testDialer = "com.android.test.defaultdialer";
final String testSms = "com.android.test.defaultsms";
+ final String settingsIntelligence = RuntimeEnvironment.application.getString(
+ R.string.config_settingsintelligence_package_name);
ShadowSmsApplication.setDefaultSmsApplication(new ComponentName(testSms, "receiver"));
ShadowDefaultDialerManager.setDefaultDialerApplication(testDialer);
ReflectionHelpers.setField(mProvider, "mContext", RuntimeEnvironment.application);
final Set<String> keepEnabledPackages = mProvider.getKeepEnabledPackages();
- final List<String> expectedPackages = Arrays.asList(testDialer, testSms);
+ final List<String> expectedPackages = Arrays.asList(testDialer, testSms,
+ settingsIntelligence);
assertThat(keepEnabledPackages).containsExactlyElementsIn(expectedPackages);
}
diff --git a/tests/robotests/src/com/android/settings/applications/LayoutPreferenceTest.java b/tests/robotests/src/com/android/settings/applications/LayoutPreferenceTest.java
index da65165..1d2bb3a 100644
--- a/tests/robotests/src/com/android/settings/applications/LayoutPreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/applications/LayoutPreferenceTest.java
@@ -75,12 +75,12 @@
@Test
public void disableSomeView_shouldMaintainStateAfterBind() {
- mPreference.findViewById(R.id.button1_positive).setEnabled(false);
- mPreference.findViewById(R.id.button2_positive).setEnabled(true);
+ mPreference.findViewById(R.id.button1).setEnabled(false);
+ mPreference.findViewById(R.id.button2).setEnabled(true);
mPreference.onBindViewHolder(mHolder);
- assertThat(mPreference.findViewById(R.id.button1_positive).isEnabled()).isFalse();
- assertThat(mPreference.findViewById(R.id.button2_positive).isEnabled()).isTrue();
+ assertThat(mPreference.findViewById(R.id.button1).isEnabled()).isFalse();
+ assertThat(mPreference.findViewById(R.id.button2).isEnabled()).isTrue();
}
}
diff --git a/tests/robotests/src/com/android/settings/applications/appinfo/AppButtonsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/applications/appinfo/AppButtonsPreferenceControllerTest.java
index f7b2700..815c76b 100644
--- a/tests/robotests/src/com/android/settings/applications/appinfo/AppButtonsPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/appinfo/AppButtonsPreferenceControllerTest.java
@@ -308,7 +308,7 @@
final boolean controllable = mController.handleDisableable();
- verify(mButtonPrefs).setButton1Text(R.string.disable_text);
+ verify(mButtonPrefs).setButton1Text(R.string.uninstall_text);
assertThat(controllable).isFalse();
}
@@ -320,7 +320,7 @@
final boolean controllable = mController.handleDisableable();
- verify(mButtonPrefs).setButton1Text(R.string.disable_text);
+ verify(mButtonPrefs).setButton1Text(R.string.uninstall_text);
assertThat(controllable).isTrue();
}
@@ -332,7 +332,7 @@
final boolean controllable = mController.handleDisableable();
- verify(mButtonPrefs).setButton1Text(R.string.enable_text);
+ verify(mButtonPrefs).setButton1Text(R.string.install_text);
assertThat(controllable).isTrue();
}
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsButtonsControllerTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsButtonsControllerTest.java
index d17fd96..6c555dd 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsButtonsControllerTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsButtonsControllerTest.java
@@ -56,8 +56,8 @@
super.setUp();
final View buttons = View.inflate(
RuntimeEnvironment.application, R.layout.two_action_buttons, null /* parent */);
- mConnectButton = buttons.findViewById(R.id.button2_positive);
- mForgetButton = buttons.findViewById(R.id.button1_positive);
+ mConnectButton = buttons.findViewById(R.id.button2);
+ mForgetButton = buttons.findViewById(R.id.button1);
mController =
new BluetoothDetailsButtonsController(mContext, mFragment, mCachedDevice, mLifecycle);
mButtonsPref = ActionButtonPreferenceTest.createMock();
diff --git a/tests/robotests/src/com/android/settings/bluetooth/RemoteDeviceNameDialogFragmentTest.java b/tests/robotests/src/com/android/settings/bluetooth/RemoteDeviceNameDialogFragmentTest.java
index 31dec3f..945d9b0 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/RemoteDeviceNameDialogFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/RemoteDeviceNameDialogFragmentTest.java
@@ -41,6 +41,7 @@
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Answers;
@@ -83,6 +84,7 @@
return (AlertDialog) ShadowDialog.getLatestDialog();
}
+ @Ignore("b/119592320")
@Test
public void deviceNameDisplayIsCorrect() {
String deviceName = "ABC Corp Headphones";
@@ -98,6 +100,7 @@
assertThat(negativeButton.isEnabled()).isTrue();
}
+ @Ignore("b/119592320")
@Test
public void deviceNameEditSucceeds() {
String deviceNameInitial = "ABC Corp Headphones";
@@ -120,6 +123,7 @@
verify(mCachedDevice).setName(deviceNameModified);
}
+ @Ignore("b/119592320")
@Test
public void deviceNameEditThenCancelDoesntRename() {
String deviceNameInitial = "ABC Corp Headphones";
diff --git a/tests/robotests/src/com/android/settings/homepage/contextualcards/ContextualCardManagerTest.java b/tests/robotests/src/com/android/settings/homepage/contextualcards/ContextualCardManagerTest.java
index 091a51b..8287672 100644
--- a/tests/robotests/src/com/android/settings/homepage/contextualcards/ContextualCardManagerTest.java
+++ b/tests/robotests/src/com/android/settings/homepage/contextualcards/ContextualCardManagerTest.java
@@ -18,8 +18,12 @@
import static com.google.common.truth.Truth.assertThat;
+import static org.mockito.ArgumentMatchers.anyMap;
+import static org.mockito.Mockito.doNothing;
+
import android.content.Context;
import android.net.Uri;
+import android.util.ArrayMap;
import com.android.settings.homepage.contextualcards.conditional.ConditionalContextualCard;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
@@ -27,6 +31,8 @@
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
import org.robolectric.RuntimeEnvironment;
import java.util.ArrayList;
@@ -35,11 +41,17 @@
@RunWith(SettingsRobolectricTestRunner.class)
public class ContextualCardManagerTest {
+ private static final String TEST_SLICE_URI = "context://test/test";
+
+ @Mock
+ ContextualCardUpdateListener mListener;
+
private Context mContext;
private ContextualCardManager mManager;
@Before
public void setUp() {
+ MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
final ContextualCardsFragment fragment = new ContextualCardsFragment();
mManager = new ContextualCardManager(mContext, fragment.getSettingsLifecycle());
@@ -47,10 +59,9 @@
@Test
public void sortCards_hasConditionalAndSliceCards_conditionalShouldAlwaysBeTheLast() {
- final String sliceUri = "content://com.android.settings.slices/action/flashlight";
final List<ContextualCard> cards = new ArrayList<>();
cards.add(new ConditionalContextualCard.Builder().build());
- cards.add(buildContextualCard(sliceUri));
+ cards.add(buildContextualCard(TEST_SLICE_URI));
final List<ContextualCard> sortedCards = mManager.sortCards(cards);
@@ -58,6 +69,21 @@
.isEqualTo(ContextualCard.CardType.CONDITIONAL);
}
+ @Test
+ public void onContextualCardUpdated_emtpyMapWithExistingCards_shouldOnlyKeepConditionalCard() {
+ mManager.mContextualCards.add(new ConditionalContextualCard.Builder().build());
+ mManager.mContextualCards.add(
+ buildContextualCard(TEST_SLICE_URI));
+ mManager.setListener(mListener);
+
+ //Simulate database returns no contents.
+ mManager.onContextualCardUpdated(new ArrayMap<>());
+
+ assertThat(mManager.mContextualCards).hasSize(1);
+ assertThat(mManager.mContextualCards.get(0).getCardType())
+ .isEqualTo(ContextualCard.CardType.CONDITIONAL);
+ }
+
private ContextualCard buildContextualCard(String sliceUri) {
return new ContextualCard.Builder()
.setName("test_name")
diff --git a/tests/robotests/src/com/android/settings/homepage/contextualcards/slices/LowStorageSliceTest.java b/tests/robotests/src/com/android/settings/homepage/contextualcards/slices/LowStorageSliceTest.java
new file mode 100644
index 0000000..0be55d9
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/homepage/contextualcards/slices/LowStorageSliceTest.java
@@ -0,0 +1,109 @@
+/*
+ * 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.homepage.contextualcards.slices;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.content.Context;
+
+import androidx.slice.Slice;
+import androidx.slice.SliceItem;
+import androidx.slice.SliceProvider;
+import androidx.slice.widget.SliceLiveData;
+
+import com.android.settings.R;
+import com.android.settings.testutils.SettingsRobolectricTestRunner;
+import com.android.settings.testutils.SliceTester;
+import com.android.settingslib.deviceinfo.PrivateStorageInfo;
+import com.android.settingslib.deviceinfo.StorageVolumeProvider;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.robolectric.RuntimeEnvironment;
+import org.robolectric.annotation.Config;
+import org.robolectric.annotation.Implementation;
+import org.robolectric.annotation.Implements;
+import org.robolectric.annotation.Resetter;
+
+import java.util.List;
+
+@RunWith(SettingsRobolectricTestRunner.class)
+public class LowStorageSliceTest {
+
+ private Context mContext;
+ private LowStorageSlice mLowStorageSlice;
+
+ @Before
+ public void setUp() {
+ mContext = RuntimeEnvironment.application;
+
+ // Set-up specs for SliceMetadata.
+ SliceProvider.setSpecs(SliceLiveData.SUPPORTED_SPECS);
+
+ mLowStorageSlice = new LowStorageSlice(mContext);
+ }
+
+ @After
+ public void tearDown() {
+ ShadowPrivateStorageInfo.reset();
+ }
+
+ @Test
+ @Config(shadows = ShadowPrivateStorageInfo.class)
+ public void getSlice_hasLowStorage_shouldBeCorrectSliceContent() {
+ ShadowPrivateStorageInfo.setPrivateStorageInfo(new PrivateStorageInfo(10L, 100L));
+
+ final Slice slice = mLowStorageSlice.getSlice();
+
+ final List<SliceItem> sliceItems = slice.getItems();
+ SliceTester.assertTitle(sliceItems, mContext.getString(R.string.storage_menu_free));
+ }
+
+ @Test
+ @Config(shadows = ShadowPrivateStorageInfo.class)
+ public void getSlice_hasNoLowStorage_shouldBeNull() {
+ ShadowPrivateStorageInfo.setPrivateStorageInfo(new PrivateStorageInfo(100L, 100L));
+
+ final Slice slice = mLowStorageSlice.getSlice();
+
+ assertThat(slice).isNull();
+ }
+
+ @Implements(PrivateStorageInfo.class)
+ public static class ShadowPrivateStorageInfo {
+
+ private static PrivateStorageInfo sPrivateStorageInfo = null;
+
+ @Resetter
+ public static void reset() {
+ sPrivateStorageInfo = null;
+ }
+
+ @Implementation
+ public static PrivateStorageInfo getPrivateStorageInfo(
+ StorageVolumeProvider storageVolumeProvider) {
+ return sPrivateStorageInfo;
+ }
+
+ public static void setPrivateStorageInfo(
+ PrivateStorageInfo privateStorageInfo) {
+ sPrivateStorageInfo = privateStorageInfo;
+ }
+ }
+}
\ No newline at end of file
diff --git a/tests/robotests/src/com/android/settings/network/ApnEditorTest.java b/tests/robotests/src/com/android/settings/network/ApnEditorTest.java
index b6242c3..db970fb 100644
--- a/tests/robotests/src/com/android/settings/network/ApnEditorTest.java
+++ b/tests/robotests/src/com/android/settings/network/ApnEditorTest.java
@@ -57,6 +57,7 @@
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.robolectric.Robolectric;
+import org.robolectric.RuntimeEnvironment;
@RunWith(SettingsRobolectricTestRunner.class)
public class ApnEditorTest {
@@ -113,6 +114,7 @@
doReturn(mResources).when(mApnEditorUT).getResources();
doNothing().when(mApnEditorUT).finish();
doNothing().when(mApnEditorUT).showError();
+ when(mApnEditorUT.getContext()).thenReturn(RuntimeEnvironment.application);
setMockPreference(mActivity);
mApnEditorUT.mApnData = new FakeApnData(APN_DATA);
diff --git a/tests/robotests/src/com/android/settings/search/SearchFeatureProviderImplTest.java b/tests/robotests/src/com/android/settings/search/SearchFeatureProviderImplTest.java
index bcb9372..b0e4025 100644
--- a/tests/robotests/src/com/android/settings/search/SearchFeatureProviderImplTest.java
+++ b/tests/robotests/src/com/android/settings/search/SearchFeatureProviderImplTest.java
@@ -19,14 +19,15 @@
import static com.google.common.truth.Truth.assertThat;
-import static org.mockito.Mockito.spy;
-
import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
+import android.content.pm.ActivityInfo;
+import android.content.pm.ResolveInfo;
import android.provider.Settings;
import android.widget.Toolbar;
+import com.android.settings.R;
import com.android.settings.testutils.FakeFeatureFactory;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.testutils.shadow.ShadowUtils;
@@ -37,25 +38,34 @@
import org.robolectric.Robolectric;
import org.robolectric.Shadows;
import org.robolectric.annotation.Config;
+import org.robolectric.shadows.ShadowPackageManager;
@RunWith(SettingsRobolectricTestRunner.class)
public class SearchFeatureProviderImplTest {
private SearchFeatureProviderImpl mProvider;
private Activity mActivity;
+ private ShadowPackageManager mPackageManager;
@Before
public void setUp() {
FakeFeatureFactory.setupForTest();
mActivity = Robolectric.setupActivity(Activity.class);
- mProvider = spy(new SearchFeatureProviderImpl());
+ mProvider = new SearchFeatureProviderImpl();
+ mPackageManager = Shadows.shadowOf(mActivity.getPackageManager());
}
@Test
@Config(shadows = ShadowUtils.class)
- public void initSearchToolbar_shouldInitWithOnClickListener() {
- mProvider.initSearchToolbar(mActivity, null);
+ public void initSearchToolbar_hasResolvedInfo_shouldStartCorrectIntent() {
+ final Intent searchIntent = new Intent(SearchFeatureProvider.SEARCH_UI_INTENT)
+ .setPackage(mActivity.getString(R.string.config_settingsintelligence_package_name));
+ final ResolveInfo info = new ResolveInfo();
+ info.activityInfo = new ActivityInfo();
+ mPackageManager.addResolveInfoForIntent(searchIntent, info);
+
// Should not crash.
+ mProvider.initSearchToolbar(mActivity, null);
final Toolbar toolbar = new Toolbar(mActivity);
// This ensures navigationView is created.
@@ -70,6 +80,21 @@
.isEqualTo(Settings.ACTION_APP_SEARCH_SETTINGS);
}
+ @Test
+ @Config(shadows = ShadowUtils.class)
+ public void initSearchToolbar_NotHaveResolvedInfo_shouldNotStartActivity() {
+ final Toolbar toolbar = new Toolbar(mActivity);
+ // This ensures navigationView is created.
+ toolbar.setNavigationContentDescription("test");
+ mProvider.initSearchToolbar(mActivity, toolbar);
+
+ toolbar.performClick();
+
+ final Intent launchIntent = Shadows.shadowOf(mActivity).getNextStartedActivity();
+
+ assertThat(launchIntent).isNull();
+ }
+
@Test(expected = IllegalArgumentException.class)
public void verifyLaunchSearchResultPageCaller_nullCaller_shouldCrash() {
mProvider.verifyLaunchSearchResultPageCaller(mActivity, null /* caller */);
diff --git a/tests/robotests/src/com/android/settings/widget/ActionButtonPreferenceTest.java b/tests/robotests/src/com/android/settings/widget/ActionButtonPreferenceTest.java
index a66f6d5..2a15127 100644
--- a/tests/robotests/src/com/android/settings/widget/ActionButtonPreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/widget/ActionButtonPreferenceTest.java
@@ -25,6 +25,7 @@
import static org.mockito.Mockito.when;
import android.content.Context;
+import android.graphics.drawable.Drawable;
import android.view.View;
import android.widget.Button;
@@ -59,41 +60,17 @@
mPref.setButton1Visible(false).setButton2Visible(false);
mPref.onBindViewHolder(mHolder);
- assertThat(mRootView.findViewById(R.id.button1_positive).getVisibility())
- .isEqualTo(View.INVISIBLE);
- assertThat(mRootView.findViewById(R.id.button1_negative).getVisibility())
- .isEqualTo(View.INVISIBLE);
-
- assertThat(mRootView.findViewById(R.id.button2_positive).getVisibility())
- .isEqualTo(View.INVISIBLE);
- assertThat(mRootView.findViewById(R.id.button2_negative).getVisibility())
- .isEqualTo(View.INVISIBLE);
+ assertThat(mRootView.findViewById(R.id.button1).getVisibility())
+ .isEqualTo(View.GONE);
+ assertThat(mRootView.findViewById(R.id.button2).getVisibility())
+ .isEqualTo(View.GONE);
mPref.setButton1Visible(true).setButton2Visible(true);
mPref.onBindViewHolder(mHolder);
- assertThat(mRootView.findViewById(R.id.button1_positive).getVisibility())
+ assertThat(mRootView.findViewById(R.id.button1).getVisibility())
.isEqualTo(View.VISIBLE);
- assertThat(mRootView.findViewById(R.id.button1_negative).getVisibility())
- .isEqualTo(View.INVISIBLE);
- assertThat(mRootView.findViewById(R.id.button2_positive).getVisibility())
- .isEqualTo(View.VISIBLE);
- assertThat(mRootView.findViewById(R.id.button2_negative).getVisibility())
- .isEqualTo(View.INVISIBLE);
- }
-
- @Test
- public void setPositiveNegative_shouldHideOppositeButton() {
- mPref.setButton1Positive(true).setButton2Positive(false);
- mPref.onBindViewHolder(mHolder);
-
- assertThat(mRootView.findViewById(R.id.button1_positive).getVisibility())
- .isEqualTo(View.VISIBLE);
- assertThat(mRootView.findViewById(R.id.button1_negative).getVisibility())
- .isEqualTo(View.INVISIBLE);
- assertThat(mRootView.findViewById(R.id.button2_positive).getVisibility())
- .isEqualTo(View.INVISIBLE);
- assertThat(mRootView.findViewById(R.id.button2_negative).getVisibility())
+ assertThat(mRootView.findViewById(R.id.button2).getVisibility())
.isEqualTo(View.VISIBLE);
}
@@ -102,36 +79,69 @@
mPref.setButton1Enabled(true).setButton2Enabled(false);
mPref.onBindViewHolder(mHolder);
- assertThat(mRootView.findViewById(R.id.button1_positive).isEnabled()).isTrue();
- assertThat(mRootView.findViewById(R.id.button1_negative).isEnabled()).isTrue();
- assertThat(mRootView.findViewById(R.id.button2_positive).isEnabled()).isFalse();
- assertThat(mRootView.findViewById(R.id.button2_negative).isEnabled()).isFalse();
+ assertThat(mRootView.findViewById(R.id.button1).isEnabled()).isTrue();
+ assertThat(mRootView.findViewById(R.id.button2).isEnabled()).isFalse();
}
@Test
- public void setText() {
+ public void setText_shouldShowSameText() {
mPref.setButton1Text(R.string.settings_label);
mPref.onBindViewHolder(mHolder);
- assertThat(((Button) mRootView.findViewById(R.id.button1_positive)).getText())
+ assertThat(((Button) mRootView.findViewById(R.id.button1)).getText())
.isEqualTo(mContext.getText(R.string.settings_label));
- assertThat(((Button) mRootView.findViewById(R.id.button1_negative)).getText())
- .isEqualTo(mContext.getText(R.string.settings_label));
+ }
+
+ @Test
+ public void setButtonIcon_iconMustDisplayAboveText() {
+ mPref.setButton1Text(R.string.settings_label);
+ mPref.setButton1Icon(R.drawable.ic_settings);
+ mPref.onBindViewHolder(mHolder);
+ final Drawable[] drawablesAroundText =
+ ((Button) mRootView.findViewById(R.id.button1))
+ .getCompoundDrawables();
+
+ assertThat(drawablesAroundText[1 /* top */]).isNotNull();
+ }
+
+ @Test
+ public void setButtonIcon_iconResourceIdIsZero_shouldNotDisplayIcon() {
+ mPref.setButton1Text(R.string.settings_label);
+ mPref.setButton1Icon(0);
+ mPref.onBindViewHolder(mHolder);
+ final Drawable[] drawablesAroundText =
+ ((Button) mRootView.findViewById(R.id.button1))
+ .getCompoundDrawables();
+
+ assertThat(drawablesAroundText[1 /* top */]).isNull();
+ }
+
+ @Test
+ public void setButtonIcon_iconResourceIdNotExisting_shouldNotDisplayIconAndCrash() {
+ mPref.setButton1Text(R.string.settings_label);
+ mPref.setButton1Icon(999999999 /* not existing id */);
+ // Should not crash here
+ mPref.onBindViewHolder(mHolder);
+ final Drawable[] drawablesAroundText =
+ ((Button) mRootView.findViewById(R.id.button1))
+ .getCompoundDrawables();
+
+ assertThat(drawablesAroundText[1 /* top */]).isNull();
}
public static ActionButtonPreference createMock() {
final ActionButtonPreference pref = mock(ActionButtonPreference.class);
when(pref.setButton1Text(anyInt())).thenReturn(pref);
- when(pref.setButton1Positive(anyBoolean())).thenReturn(pref);
+ when(pref.setButton1Icon(anyInt())).thenReturn(pref);
when(pref.setButton1Enabled(anyBoolean())).thenReturn(pref);
when(pref.setButton1Visible(anyBoolean())).thenReturn(pref);
when(pref.setButton1OnClickListener(any(View.OnClickListener.class))).thenReturn(pref);
when(pref.setButton2Text(anyInt())).thenReturn(pref);
- when(pref.setButton2Positive(anyBoolean())).thenReturn(pref);
+ when(pref.setButton2Icon(anyInt())).thenReturn(pref);
when(pref.setButton2Enabled(anyBoolean())).thenReturn(pref);
when(pref.setButton2Visible(anyBoolean())).thenReturn(pref);
when(pref.setButton2OnClickListener(any(View.OnClickListener.class))).thenReturn(pref);
return pref;
}
-}
+}
\ No newline at end of file