Merge "Import translations. DO NOT MERGE" into qt-dev
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 2bf356f..dfbc02c 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -534,6 +534,18 @@
</activity>
<activity
+ android:name="Settings$DataSaverSummaryActivity"
+ android:label="@string/data_saver_title"
+ android:parentActivityName="Settings">
+ <intent-filter android:priority="1">
+ <action android:name="android.settings.DATA_SAVER_SETTINGS" />
+ <category android:name="android.intent.category.DEFAULT" />
+ </intent-filter>
+ <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
+ android:value="com.android.settings.datausage.DataSaverSummary" />
+ </activity>
+
+ <activity
android:name="Settings$DateTimeSettingsActivity"
android:label="@string/date_and_time"
android:icon="@drawable/ic_settings_date_time"
@@ -1590,10 +1602,6 @@
android:permission="android.permission.MANAGE_FINGERPRINT"
android:icon="@drawable/ic_suggestion_fingerprint"
android:theme="@style/GlifTheme.Light">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="com.android.settings.suggested.category.FINGERPRINT_ENROLL" />
- </intent-filter>
<meta-data android:name="com.android.settings.require_feature"
android:value="android.hardware.fingerprint" />
<meta-data android:name="com.android.settings.title"
@@ -1602,6 +1610,22 @@
android:resource="@string/suggestion_additional_fingerprints_summary" />
</activity>
+ <activity-alias android:name=".SetupFingerprintSuggestionActivity"
+ android:enabled="false"
+ android:exported="true"
+ android:targetActivity=".biometrics.fingerprint.FingerprintSuggestionActivity">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="com.android.settings.suggested.category.FINGERPRINT_ENROLL" />
+ </intent-filter>
+ <meta-data android:name="com.android.settings.require_feature"
+ android:value="android.hardware.fingerprint" />
+ <meta-data android:name="com.android.settings.title"
+ android:resource="@string/suggestion_additional_fingerprints" />
+ <meta-data android:name="com.android.settings.summary"
+ android:resource="@string/suggestion_additional_fingerprints_summary" />
+ </activity-alias>
+
<!-- Note this must not be exported since it returns the password in the intent -->
<activity android:name=".password.ConfirmLockPattern$InternalActivity"
android:exported="false"
@@ -2871,6 +2895,19 @@
android:value="com.android.settings.deletionhelper.AutomaticStorageManagerSettings" />
</activity>
+ <!-- Show app-level advanced power usage details (app passed in as extras) -->
+ <activity
+ android:name=".fuelgauge.AdvancedPowerUsageDetailActivity"
+ android:excludeFromRecents="true"
+ android:launchMode="singleInstance"
+ android:theme="@android:style/Theme.NoDisplay">
+ <intent-filter>
+ <action android:name="android.settings.VIEW_ADVANCED_POWER_USAGE_DETAIL" />
+ <category android:name="android.intent.category.DEFAULT" />
+ <data android:scheme="package" />
+ </intent-filter>
+ </activity>
+
<activity
android:name=".Settings$AppAndNotificationDashboardActivity"
android:label="@string/app_and_notification_dashboard_title"
diff --git a/color-check-baseline.xml b/color-check-baseline.xml
index 3424e76..02b00e2 100644
--- a/color-check-baseline.xml
+++ b/color-check-baseline.xml
@@ -2277,6 +2277,102 @@
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 android:color="#333E2723" android:offset="0"/>"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="res/drawable/ic_accessibility_magnification.xml"
+ line="30"
+ column="23"/>
+ </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 android:color="#003E2723" android:offset="1"/>"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="res/drawable/ic_accessibility_magnification.xml"
+ line="31"
+ column="23"/>
+ </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 android:color="#333E2723" android:offset="0"/>"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="res/drawable/ic_accessibility_magnification.xml"
+ line="39"
+ column="23"/>
+ </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 android:color="#003E2723" android:offset="1"/>"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="res/drawable/ic_accessibility_magnification.xml"
+ line="40"
+ column="23"/>
+ </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 android:color="#19FFFFFF" android:offset="0"/>"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="res/drawable/ic_accessibility_magnification.xml"
+ line="60"
+ column="23"/>
+ </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 android:color="#00FFFFFF" android:offset="1"/>"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="res/drawable/ic_accessibility_magnification.xml"
+ line="61"
+ column="23"/>
+ </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:background="#FF80CBC4" >"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
diff --git a/res/drawable/ic_accessibility_magnification.xml b/res/drawable/ic_accessibility_magnification.xml
new file mode 100644
index 0000000..0dd3e2e
--- /dev/null
+++ b/res/drawable/ic_accessibility_magnification.xml
@@ -0,0 +1,65 @@
+<!--
+ Copyright 2019 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<vector android:height="32dp" android:viewportHeight="192"
+ android:viewportWidth="192" android:width="32dp"
+ xmlns:aapt="http://schemas.android.com/aapt" xmlns:android="http://schemas.android.com/apk/res/android">
+ <path android:fillColor="#F50057" android:pathData="M96,104m-24,0a24,24 0,1 1,48 0a24,24 0,1 1,-48 0"/>
+ <path android:fillColor="#F50057" android:pathData="M178.57,70.06l-73.81,-58.94C99.6,7.01 92.35,6.96 87.15,11L13.59,68.14C8.87,71.8 6.9,78.02 8.61,83.77l28.53,89.97c1.83,6.09 7.39,10.26 13.7,10.26h90.38c6.28,0 11.82,-4.13 13.67,-10.19l0.69,-2.13l-34.94,-34.88v-4.7l-0.96,-0.99c-6.33,5.54 -14.61,8.9 -23.68,8.9c-19.89,0 -36.02,-16.12 -36.02,-36.01S76.11,68 96,68s36.01,16.12 36.01,36.01c0,8.68 -3.08,16.65 -8.2,22.87l1.05,1.01h4.7l30.34,30.39l23.47,-72.65C185.1,79.94 183.2,73.76 178.57,70.06z"/>
+ <path android:fillColor="#F50057" android:pathData="M65.25,73c0,0 -16.75,31.96 -9.25,45.1s21.02,29.15 40.01,32.65s32.99,10.5 39.99,14s19.58,6.93 19.58,6.93s-5.34,-9.49 4.32,-13.4c0.73,-3.53 -11.9,-42.35 -11.9,-42.35L127.92,73L81.79,62.25L65.25,73z"/>
+ <path android:fillAlpha="0.2" android:fillColor="#3E2723"
+ android:pathData="M155.33,171.43l-0.44,1.37c-1.85,6.06 -7.39,10.19 -13.67,10.19H50.84c-6.31,0 -11.87,-4.17 -13.7,-10.26L8.61,82.77c-0.36,-1.22 -0.55,-2.46 -0.59,-3.69c-0.06,1.56 0.13,3.14 0.59,4.69l28.53,89.97c1.83,6.09 7.39,10.26 13.7,10.26h90.38c6.28,0 11.82,-4.13 13.67,-10.19l0.69,-2.13L155.33,171.43z" android:strokeAlpha="0.2"/>
+ <path android:fillAlpha="0.2" android:fillColor="#3E2723"
+ android:pathData="M183.37,84.63l-23.71,73.41l0.24,0.24l23.47,-72.66c0.48,-1.57 0.67,-3.17 0.61,-4.75C183.94,82.13 183.74,83.39 183.37,84.63z" android:strokeAlpha="0.2"/>
+ <path android:pathData="M155.57,171.67l-34.93,-34.87v-4.7l-0.96,-0.99c-6.33,5.54 -14.61,8.9 -23.68,8.9c-9.81,0 -18.71,-3.93 -25.2,-10.29L125.07,184h16.14c6.28,0 11.81,-4.13 13.67,-10.19L155.57,171.67z">
+ <aapt:attr name="android:fillColor">
+ <gradient android:endX="138.7146" android:endY="173.8946"
+ android:startX="69.035" android:startY="104.215" android:type="linear">
+ <item android:color="#333E2723" android:offset="0"/>
+ <item android:color="#003E2723" android:offset="1"/>
+ </gradient>
+ </aapt:attr>
+ </path>
+ <path android:pathData="M132.01,104.01c0,8.68 -3.08,16.65 -8.2,22.87l1.05,1.01h4.7l30.34,30.39L170,127l-49,-49.03l-0.19,-0.04C127.71,84.49 132.01,93.74 132.01,104.01z">
+ <aapt:attr name="android:fillColor">
+ <gradient android:endX="157.0018" android:endY="137.0219"
+ android:startX="103.615" android:startY="83.635" android:type="linear">
+ <item android:color="#333E2723" android:offset="0"/>
+ <item android:color="#003E2723" android:offset="1"/>
+ </gradient>
+ </aapt:attr>
+ </path>
+ <path android:fillAlpha="0.2" android:fillColor="#3E2723"
+ android:pathData="M124.27,127.32c4.85,-6.13 7.75,-13.88 7.75,-22.3c0,-0.16 -0.01,-0.31 -0.01,-0.47c-0.12,8.47 -3.17,16.24 -8.19,22.34L124.27,127.32z" android:strokeAlpha="0.2"/>
+ <path android:fillAlpha="0.2" android:fillColor="#3E2723"
+ android:pathData="M96.01,80.01c-13.25,0 -24,10.75 -24,24c0,0.17 0.01,0.33 0.01,0.5c0.27,-13.02 10.91,-23.5 23.99,-23.5s23.72,10.48 23.99,23.5c0,-0.17 0.01,-0.33 0.01,-0.5C120.01,90.76 109.26,80.01 96.01,80.01z" android:strokeAlpha="0.2"/>
+ <path android:fillAlpha="0.2" android:fillColor="#3E2723"
+ android:pathData="M155.58,171.68l-34.93,-34.87l0,1l34.68,34.62z" android:strokeAlpha="0.2"/>
+ <path android:fillAlpha="0.2" android:fillColor="#3E2723"
+ android:pathData="M119.69,131.12c-6.33,5.54 -14.61,8.9 -23.68,8.9c-9.97,0 -19,-4.06 -25.52,-10.61h-0.01l5.59,5.59c5.71,3.8 12.57,6.03 19.94,6.03c9.07,0 17.35,-3.36 23.68,-8.9l0.96,0.99v-1L119.69,131.12z" android:strokeAlpha="0.2"/>
+ <path android:fillAlpha="0.2" android:fillColor="#FFFFFF"
+ android:pathData="M13.59,69.14L87.15,12c5.2,-4.04 12.45,-3.99 17.61,0.12l73.81,58.94c3.36,2.68 5.27,6.67 5.41,10.82c0.15,-4.51 -1.79,-8.93 -5.41,-11.82l-73.81,-58.94C99.6,7.01 92.35,6.96 87.15,11L13.59,68.14c-3.72,2.88 -5.72,7.36 -5.57,11.94C8.17,75.85 10.14,71.81 13.59,69.14z" android:strokeAlpha="0.2"/>
+ <path android:fillColor="#F8BBD0" android:pathData="M112,108h-12v12h-8v-12H80v-8h12V88h8v12h12V108z"/>
+ <path android:fillColor="#FFFFFF" android:pathData="M129.57,127.9h-4.7l-1.05,-1.01c5.12,-6.22 8.2,-14.19 8.2,-22.87c0,-19.89 -16.12,-36.01 -36.01,-36.01s-36.02,16.11 -36.02,36s16.13,36.01 36.02,36.01c9.07,0 17.35,-3.36 23.68,-8.9l0.96,0.99v4.7l34.93,34.87l4.33,-13.39L129.57,127.9zM96.01,128.01c-13.25,0 -24,-10.75 -24,-24s10.75,-24 24,-24s24,10.75 24,24S109.26,128.01 96.01,128.01z"/>
+ <path android:pathData="M37.14,173.74L8.61,83.77C6.9,78.02 8.87,71.8 13.59,68.14L87.15,11c5.2,-4.04 12.45,-3.99 17.61,0.12l73.81,58.94c4.63,3.7 6.53,9.88 4.8,15.57l-28.48,88.18c-1.85,6.06 -7.39,10.19 -13.67,10.19H50.84C44.53,184 38.97,179.83 37.14,173.74z">
+ <aapt:attr name="android:fillColor">
+ <gradient android:endX="163.5051" android:endY="178.712"
+ android:startX="38.1466" android:startY="53.3534" android:type="linear">
+ <item android:color="#19FFFFFF" android:offset="0"/>
+ <item android:color="#00FFFFFF" android:offset="1"/>
+ </gradient>
+ </aapt:attr>
+ </path>
+</vector>
diff --git a/res/drawable/settings_panel_background.xml b/res/drawable/settings_panel_background.xml
index 36c58e0..adb4646 100644
--- a/res/drawable/settings_panel_background.xml
+++ b/res/drawable/settings_panel_background.xml
@@ -16,7 +16,7 @@
<inset xmlns:android="http://schemas.android.com/apk/res/android" android:inset="4dp">
<shape android:shape="rectangle">
- <corners android:radius="8dp" />
+ <corners android:radius="?android:attr/dialogCornerRadius" />
<solid android:color="?android:attr/colorBackground" />
</shape>
</inset>
\ No newline at end of file
diff --git a/res/layout/conditional_card_footer.xml b/res/layout/conditional_card_footer.xml
index 56687fe..bf5ea27 100644
--- a/res/layout/conditional_card_footer.xml
+++ b/res/layout/conditional_card_footer.xml
@@ -18,12 +18,12 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
- android:layout_height="@dimen/homepage_condition_footer_height"
+ android:layout_height="@dimen/contextual_condition_footer_height"
android:contentDescription="@string/homepage_condition_footer_content_description"
android:gravity="end"
android:orientation="horizontal"
- android:paddingTop="@dimen/homepage_condition_footer_padding_top"
- android:paddingEnd="@dimen/homepage_condition_footer_padding_end">
+ android:paddingTop="@dimen/contextual_condition_footer_padding_top"
+ android:paddingEnd="@dimen/contextual_condition_footer_padding_end">
<ImageView
android:id="@+id/collapse_button"
diff --git a/res/layout/conditional_card_full_tile.xml b/res/layout/conditional_card_full_tile.xml
index e90a0cb..ee23498 100644
--- a/res/layout/conditional_card_full_tile.xml
+++ b/res/layout/conditional_card_full_tile.xml
@@ -30,32 +30,32 @@
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:paddingStart="@dimen/homepage_card_icon_padding_start"
- android:paddingEnd="@dimen/homepage_full_card_padding_end"
- android:paddingTop="@dimen/homepage_condition_full_card_padding_top"
- android:paddingBottom="@dimen/homepage_condition_full_card_padding_bottom"
+ android:paddingStart="@dimen/contextual_card_icon_padding_start"
+ android:paddingEnd="@dimen/contextual_full_card_padding_end"
+ android:paddingTop="@dimen/contextual_condition_full_card_padding_top"
+ android:paddingBottom="@dimen/contextual_condition_full_card_padding_bottom"
android:orientation="horizontal"
android:gravity="center_vertical">
<ImageView
android:id="@android:id/icon"
- android:layout_width="@dimen/homepage_card_icon_size"
- android:layout_height="@dimen/homepage_card_icon_size"
+ android:layout_width="@dimen/contextual_card_icon_size"
+ android:layout_height="@dimen/contextual_card_icon_size"
android:tint="?android:attr/colorAccent"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
- android:paddingStart="@dimen/homepage_condition_full_card_padding_start"
- android:paddingEnd="@dimen/homepage_condition_full_card_padding_end"
+ android:paddingStart="@dimen/contextual_condition_full_card_padding_start"
+ android:paddingEnd="@dimen/contextual_condition_full_card_padding_end"
android:orientation="vertical">
<TextView
android:id="@android:id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginBottom="@dimen/homepage_condition_card_title_margin_bottom"
+ android:layout_marginBottom="@dimen/contextual_condition_card_title_margin_bottom"
android:textAppearance="@style/TextAppearance.ConditionCardTitle"/>
<TextView
diff --git a/res/layout/conditional_card_half_tile.xml b/res/layout/conditional_card_half_tile.xml
index 1086f2d..3e30409 100644
--- a/res/layout/conditional_card_half_tile.xml
+++ b/res/layout/conditional_card_half_tile.xml
@@ -25,20 +25,20 @@
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:paddingTop="@dimen/homepage_condition_half_card_padding_top"
+ android:paddingTop="@dimen/contextual_condition_half_card_padding_top"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:paddingEnd="@dimen/homepage_card_padding_end"
+ android:paddingEnd="@dimen/contextual_card_padding_end"
android:orientation="vertical">
<ImageView
android:id="@android:id/icon"
- android:layout_width="@dimen/homepage_card_icon_size"
- android:layout_height="@dimen/homepage_card_icon_size"
- android:layout_marginStart="@dimen/homepage_card_icon_padding_start"
+ android:layout_width="@dimen/contextual_card_icon_size"
+ android:layout_height="@dimen/contextual_card_icon_size"
+ android:layout_marginStart="@dimen/contextual_card_icon_padding_start"
android:tint="?android:attr/colorAccent"/>
<TextView
@@ -47,9 +47,9 @@
android:layout_height="wrap_content"
android:maxLines="1"
android:ellipsize="end"
- android:layout_marginStart="@dimen/homepage_card_text_padding_start"
- android:layout_marginTop="@dimen/homepage_condition_half_card_title_margin_top"
- android:layout_marginBottom="@dimen/homepage_condition_card_title_margin_bottom"
+ android:layout_marginStart="@dimen/contextual_card_text_padding_start"
+ android:layout_marginTop="@dimen/contextual_condition_half_card_title_margin_top"
+ android:layout_marginBottom="@dimen/contextual_condition_card_title_margin_bottom"
android:textAppearance="@style/TextAppearance.ConditionCardTitle"/>
<TextView
@@ -58,8 +58,8 @@
android:layout_height="wrap_content"
android:lines="2"
android:ellipsize="end"
- android:layout_marginStart="@dimen/homepage_card_text_padding_start"
- android:layout_marginBottom="@dimen/homepage_condition_half_card_summary_margin_bottom"
+ android:layout_marginStart="@dimen/contextual_card_text_padding_start"
+ android:layout_marginBottom="@dimen/contextual_condition_half_card_summary_margin_bottom"
android:textAppearance="@style/TextAppearance.ConditionCardSummary"/>
</LinearLayout>
diff --git a/res/layout/conditional_card_header.xml b/res/layout/conditional_card_header.xml
index 30b9033..219468a 100644
--- a/res/layout/conditional_card_header.xml
+++ b/res/layout/conditional_card_header.xml
@@ -25,8 +25,8 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:paddingTop="@dimen/homepage_condition_header_padding_top"
- android:paddingBottom="@dimen/homepage_condition_header_padding_bottom"
+ android:paddingTop="@dimen/contextual_condition_header_padding_top"
+ android:paddingBottom="@dimen/contextual_condition_header_padding_bottom"
android:orientation="horizontal"
android:gravity="center_vertical">
@@ -35,7 +35,7 @@
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
- android:layout_marginStart="@dimen/homepage_condition_header_icons_margin_start"
+ android:layout_marginStart="@dimen/contextual_condition_header_icons_margin_start"
android:orientation="horizontal"
android:gravity="center_vertical"/>
@@ -43,9 +43,9 @@
android:id="@+id/expand_indicator"
android:layout_width="wrap_content"
android:layout_height="match_parent"
- android:paddingTop="@dimen/homepage_condition_header_indicator_padding_top"
- android:paddingStart="@dimen/homepage_condition_header_indicator_padding_start"
- android:paddingEnd="@dimen/homepage_condition_header_indicator_padding_end"
+ android:paddingTop="@dimen/contextual_condition_header_indicator_padding_top"
+ android:paddingStart="@dimen/contextual_condition_header_indicator_padding_start"
+ android:paddingEnd="@dimen/contextual_condition_header_indicator_padding_end"
android:src="@drawable/ic_expand_more_inverse"
android:tint="?android:attr/colorControlNormal"/>
diff --git a/res/layout/conditional_card_header_icon.xml b/res/layout/conditional_card_header_icon.xml
index ae75140..c8886a8 100644
--- a/res/layout/conditional_card_header_icon.xml
+++ b/res/layout/conditional_card_header_icon.xml
@@ -17,7 +17,7 @@
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/icon"
- android:layout_width="@dimen/homepage_condition_header_icon_width_height"
- android:layout_height="@dimen/homepage_condition_header_icon_width_height"
- android:layout_marginEnd="@dimen/homepage_condition_header_icon_margin_end"
+ android:layout_width="@dimen/contextual_condition_header_icon_width_height"
+ android:layout_height="@dimen/contextual_condition_header_icon_width_height"
+ android:layout_marginEnd="@dimen/contextual_condition_header_icon_margin_end"
android:tint="?android:attr/colorAccent"/>
\ No newline at end of file
diff --git a/res/layout/contextual_card_dismissal_view.xml b/res/layout/contextual_card_dismissal_view.xml
index 181fa3b..0406422 100644
--- a/res/layout/contextual_card_dismissal_view.xml
+++ b/res/layout/contextual_card_dismissal_view.xml
@@ -20,15 +20,15 @@
android:id="@+id/dismissal_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:background="@color/homepage_card_dismissal_background"
+ android:background="@color/contextual_card_dismissal_background"
android:orientation="vertical"
android:visibility="gone">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginStart="@dimen/homepage_card_dismissal_side_margin"
- android:layout_marginTop="@dimen/homepage_card_dismissal_margin_top"
+ android:layout_marginStart="@dimen/contextual_card_dismissal_side_margin"
+ android:layout_marginTop="@dimen/contextual_card_dismissal_margin_top"
android:text="@string/contextual_card_dismiss_confirm_message"
android:textAppearance="@style/TextAppearance.ContextualCardDismissalText"/>
@@ -49,8 +49,8 @@
style="@style/ContextualCardDismissalButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginStart="@dimen/homepage_card_dismissal_button_margin_start"
- android:layout_marginEnd="@dimen/homepage_card_dismissal_button_margin_end"
+ android:layout_marginStart="@dimen/contextual_card_dismissal_button_margin_start"
+ android:layout_marginEnd="@dimen/contextual_card_dismissal_button_margin_end"
android:text="@string/contextual_card_dismiss_remove"/>
</LinearLayout>
diff --git a/res/layout/contextual_slice_deferred_setup.xml b/res/layout/contextual_slice_deferred_setup.xml
index ed096b0..e695d1d 100644
--- a/res/layout/contextual_slice_deferred_setup.xml
+++ b/res/layout/contextual_slice_deferred_setup.xml
@@ -27,22 +27,22 @@
android:layout_height="match_parent"
android:gravity="left"
android:orientation="vertical"
- android:paddingEnd="@dimen/homepage_card_padding_end"
- android:paddingTop="@dimen/homepage_deferred_setup_card_padding_top"
- android:paddingBottom="@dimen/homepage_deferred_setup_card_padding_bottom">
+ android:paddingEnd="@dimen/contextual_card_padding_end"
+ android:paddingTop="@dimen/contextual_deferred_setup_card_padding_top"
+ android:paddingBottom="@dimen/contextual_deferred_setup_card_padding_bottom">
<ImageView
android:id="@android:id/icon"
- android:layout_width="@dimen/homepage_card_icon_size"
- android:layout_height="@dimen/homepage_card_icon_size"
- android:layout_marginStart="@dimen/homepage_card_icon_padding_start"/>
+ android:layout_width="@dimen/contextual_card_icon_size"
+ android:layout_height="@dimen/contextual_card_icon_size"
+ android:layout_marginStart="@dimen/contextual_card_icon_padding_start"/>
<TextView
android:id="@android:id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginStart="@dimen/homepage_card_text_padding_start"
- android:layout_marginTop="@dimen/homepage_deferred_setup_card_title_margin_top"
+ android:layout_marginStart="@dimen/contextual_card_text_padding_start"
+ android:layout_marginTop="@dimen/contextual_deferred_setup_card_title_margin_top"
android:ellipsize="end"
android:maxLines="2"
android:minLines="1"
@@ -52,8 +52,8 @@
android:id="@android:id/summary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginStart="@dimen/homepage_card_text_padding_start"
- android:layout_marginTop="@dimen/homepage_deferred_setup_card_summary_margin_top"
+ android:layout_marginStart="@dimen/contextual_card_text_padding_start"
+ android:layout_marginTop="@dimen/contextual_deferred_setup_card_summary_margin_top"
android:ellipsize="end"
android:maxLines="2"
android:minLines="1"
@@ -64,8 +64,8 @@
style="@style/DeferredSetupCardButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginStart="@dimen/homepage_card_text_padding_start"
- android:layout_marginTop="@dimen/homepage_deferred_setup_card_button_margin_top"
+ android:layout_marginStart="@dimen/contextual_card_text_padding_start"
+ android:layout_marginTop="@dimen/contextual_deferred_setup_card_button_margin_top"
android:text="@string/suggestion_button_text"/>
</LinearLayout>
diff --git a/res/layout/contextual_slice_half_tile.xml b/res/layout/contextual_slice_half_tile.xml
index f0cad21..83b1df7 100644
--- a/res/layout/contextual_slice_half_tile.xml
+++ b/res/layout/contextual_slice_half_tile.xml
@@ -31,17 +31,17 @@
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:paddingEnd="@dimen/homepage_card_padding_end"
- android:paddingTop="@dimen/homepage_half_card_padding_top"
- android:paddingBottom="@dimen/homepage_half_card_padding_bottom"
+ android:paddingEnd="@dimen/contextual_card_padding_end"
+ android:paddingTop="@dimen/contextual_half_card_padding_top"
+ android:paddingBottom="@dimen/contextual_half_card_padding_bottom"
android:background="@color/contextual_card_background"
android:orientation="vertical">
<ImageView
android:id="@android:id/icon"
- android:layout_width="@dimen/homepage_card_icon_size"
- android:layout_height="@dimen/homepage_card_icon_size"
- android:layout_marginStart="@dimen/homepage_card_icon_padding_start"/>
+ android:layout_width="@dimen/contextual_card_icon_size"
+ android:layout_height="@dimen/contextual_card_icon_size"
+ android:layout_marginStart="@dimen/contextual_card_icon_padding_start"/>
<TextView
android:id="@android:id/title"
@@ -50,8 +50,8 @@
android:maxLines="2"
android:minLines="1"
android:ellipsize="end"
- android:layout_marginStart="@dimen/homepage_card_text_padding_start"
- android:layout_marginTop="@dimen/homepage_half_card_title_margin_top"
+ android:layout_marginStart="@dimen/contextual_card_text_padding_start"
+ android:layout_marginTop="@dimen/contextual_half_card_title_margin_top"
android:textAppearance="@style/TextAppearance.ConditionCardTitle"/>
</LinearLayout>
diff --git a/res/layout/dismissal_swipe_background.xml b/res/layout/dismissal_swipe_background.xml
index 49e6129..49f6266 100644
--- a/res/layout/dismissal_swipe_background.xml
+++ b/res/layout/dismissal_swipe_background.xml
@@ -20,7 +20,7 @@
android:id="@+id/dismissal_swipe_background"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:background="@color/homepage_card_dismissal_background">
+ android:background="@color/contextual_card_dismissal_background">
<ImageView
android:id="@+id/dismissal_icon_start"
@@ -28,7 +28,7 @@
android:layout_height="wrap_content"
android:src="@drawable/ic_delete"
android:layout_gravity="start|center_vertical"
- android:layout_marginStart="@dimen/homepage_card_dismissal_side_margin"/>
+ android:layout_marginStart="@dimen/contextual_card_dismissal_side_margin"/>
<Space
android:layout_width="0dp"
@@ -41,6 +41,6 @@
android:layout_height="wrap_content"
android:src="@drawable/ic_delete"
android:layout_gravity="end|center_vertical"
- android:layout_marginEnd="@dimen/homepage_card_dismissal_side_margin"/>
+ android:layout_marginEnd="@dimen/contextual_card_dismissal_side_margin"/>
</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/legacy_suggestion_tile.xml b/res/layout/legacy_suggestion_tile.xml
index 5d3a79c..9af5b6b 100644
--- a/res/layout/legacy_suggestion_tile.xml
+++ b/res/layout/legacy_suggestion_tile.xml
@@ -36,8 +36,8 @@
<ImageView
android:id="@android:id/icon"
- android:layout_width="@dimen/homepage_card_icon_size"
- android:layout_height="@dimen/homepage_card_icon_size"
+ android:layout_width="@dimen/contextual_card_icon_size"
+ android:layout_height="@dimen/contextual_card_icon_size"
style="@style/SuggestionCardIcon"
android:layout_marginTop="16dp"
android:layout_marginBottom="6dp"/>
diff --git a/res/layout/settings_homepage_container.xml b/res/layout/settings_homepage_container.xml
index 9332463..c86bccf 100644
--- a/res/layout/settings_homepage_container.xml
+++ b/res/layout/settings_homepage_container.xml
@@ -39,14 +39,15 @@
android:id="@+id/contextual_cards_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginStart="@dimen/homepage_card_side_margin"
- android:layout_marginEnd="@dimen/homepage_card_side_margin"/>
+ android:layout_marginStart="@dimen/contextual_card_side_margin"
+ android:layout_marginEnd="@dimen/contextual_card_side_margin"/>
<FrameLayout
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:animateLayoutChanges="true"/>
+ android:animateLayoutChanges="true"
+ android:background="?android:attr/windowBackground"/>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
diff --git a/res/layout/time_zone_search_header.xml b/res/layout/time_zone_search_header.xml
index 5c4e0ee..0c867f56 100644
--- a/res/layout/time_zone_search_header.xml
+++ b/res/layout/time_zone_search_header.xml
@@ -18,7 +18,7 @@
instead of an ImageView -->
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+android:id/title"
+ android:id="@android:id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
diff --git a/res/mipmap-hdpi/ic_accessibility_magnification.png b/res/mipmap-hdpi/ic_accessibility_magnification.png
deleted file mode 100755
index a91bc6e..0000000
--- a/res/mipmap-hdpi/ic_accessibility_magnification.png
+++ /dev/null
Binary files differ
diff --git a/res/mipmap-mdpi/ic_accessibility_magnification.png b/res/mipmap-mdpi/ic_accessibility_magnification.png
deleted file mode 100755
index 9ec5107..0000000
--- a/res/mipmap-mdpi/ic_accessibility_magnification.png
+++ /dev/null
Binary files differ
diff --git a/res/mipmap-xhdpi/ic_accessibility_magnification.png b/res/mipmap-xhdpi/ic_accessibility_magnification.png
deleted file mode 100755
index 0b3a32e..0000000
--- a/res/mipmap-xhdpi/ic_accessibility_magnification.png
+++ /dev/null
Binary files differ
diff --git a/res/mipmap-xxhdpi/ic_accessibility_magnification.png b/res/mipmap-xxhdpi/ic_accessibility_magnification.png
deleted file mode 100755
index 3eeb1c9..0000000
--- a/res/mipmap-xxhdpi/ic_accessibility_magnification.png
+++ /dev/null
Binary files differ
diff --git a/res/mipmap-xxxhdpi/ic_accessibility_magnification.png b/res/mipmap-xxxhdpi/ic_accessibility_magnification.png
deleted file mode 100755
index 7d37612..0000000
--- a/res/mipmap-xxxhdpi/ic_accessibility_magnification.png
+++ /dev/null
Binary files differ
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 9f99755..5d681ca 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -98,8 +98,8 @@
<color name="homepage_about_background">#6F86DA</color>
<color name="homepage_privacy_background">#5E97F6</color>
- <color name="homepage_card_stroke_color">#1f000000</color>
- <color name="homepage_card_dismissal_background">@*android:color/material_grey_100</color>
+ <color name="contextual_card_stroke_color">#1f000000</color>
+ <color name="contextual_card_dismissal_background">@*android:color/material_grey_100</color>
<color name="contextual_card_background">@*android:color/background_device_default_light</color>
<!-- End of dashboard/homepage icon background colors -->
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index ff970c3..0982855 100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -327,32 +327,32 @@
<dimen name="reset_checkbox_summary_text_size">14sp</dimen>
<!-- Homepage cards size and padding -->
- <dimen name="homepage_card_icon_size">24dp</dimen>
- <dimen name="homepage_card_vertical_margin">8dp</dimen>
- <dimen name="homepage_card_side_margin">4dp</dimen>
- <dimen name="homepage_card_icon_padding_start">14dp</dimen>
- <dimen name="homepage_card_text_padding_start">16dp</dimen>
- <dimen name="homepage_card_padding_end">16dp</dimen>
- <dimen name="homepage_card_corner_radius">@*android:dimen/config_dialogCornerRadius</dimen>
- <dimen name="homepage_full_card_padding_end">12dp</dimen>
- <dimen name="homepage_half_card_padding_top">12dp</dimen>
- <dimen name="homepage_half_card_padding_bottom">16dp</dimen>
- <dimen name="homepage_half_card_title_margin_top">12dp</dimen>
- <dimen name="homepage_deferred_setup_card_padding_top">16dp</dimen>
- <dimen name="homepage_deferred_setup_card_padding_bottom">12dp</dimen>
- <dimen name="homepage_deferred_setup_card_title_margin_top">12dp</dimen>
- <dimen name="homepage_deferred_setup_card_summary_margin_top">2dp</dimen>
- <dimen name="homepage_deferred_setup_card_button_margin_top">8dp</dimen>
- <dimen name="homepage_deferred_setup_card_button_padding_top">8dp</dimen>
- <dimen name="homepage_deferred_setup_card_button_padding_bottom">8dp</dimen>
- <dimen name="homepage_deferred_setup_card_button_padding_start">24dp</dimen>
- <dimen name="homepage_deferred_setup_card_button_padding_end">24dp</dimen>
+ <dimen name="contextual_card_icon_size">24dp</dimen>
+ <dimen name="contextual_card_vertical_margin">8dp</dimen>
+ <dimen name="contextual_card_side_margin">4dp</dimen>
+ <dimen name="contextual_card_icon_padding_start">14dp</dimen>
+ <dimen name="contextual_card_text_padding_start">16dp</dimen>
+ <dimen name="contextual_card_padding_end">16dp</dimen>
+ <dimen name="contextual_card_corner_radius">@*android:dimen/config_dialogCornerRadius</dimen>
+ <dimen name="contextual_full_card_padding_end">12dp</dimen>
+ <dimen name="contextual_half_card_padding_top">12dp</dimen>
+ <dimen name="contextual_half_card_padding_bottom">16dp</dimen>
+ <dimen name="contextual_half_card_title_margin_top">12dp</dimen>
+ <dimen name="contextual_deferred_setup_card_padding_top">16dp</dimen>
+ <dimen name="contextual_deferred_setup_card_padding_bottom">12dp</dimen>
+ <dimen name="contextual_deferred_setup_card_title_margin_top">12dp</dimen>
+ <dimen name="contextual_deferred_setup_card_summary_margin_top">2dp</dimen>
+ <dimen name="contextual_deferred_setup_card_button_margin_top">8dp</dimen>
+ <dimen name="contextual_deferred_setup_card_button_padding_top">8dp</dimen>
+ <dimen name="contextual_deferred_setup_card_button_padding_bottom">8dp</dimen>
+ <dimen name="contextual_deferred_setup_card_button_padding_start">24dp</dimen>
+ <dimen name="contextual_deferred_setup_card_button_padding_end">24dp</dimen>
<!-- Homepage dismissal cards size and padding -->
- <dimen name="homepage_card_dismissal_margin_top">12dp</dimen>
- <dimen name="homepage_card_dismissal_side_margin">16dp</dimen>
- <dimen name="homepage_card_dismissal_button_margin_start">4dp</dimen>
- <dimen name="homepage_card_dismissal_button_margin_end">6dp</dimen>
+ <dimen name="contextual_card_dismissal_margin_top">12dp</dimen>
+ <dimen name="contextual_card_dismissal_side_margin">16dp</dimen>
+ <dimen name="contextual_card_dismissal_button_margin_start">4dp</dimen>
+ <dimen name="contextual_card_dismissal_button_margin_end">6dp</dimen>
<!-- Horizontal divider size and margin -->
<dimen name="horizontal_divider_height">.75dp</dimen>
@@ -364,25 +364,25 @@
<dimen name="signal_strength_icon_size">24dp</dimen>
<!-- Condition cards size and padding -->
- <dimen name="homepage_condition_card_title_margin_bottom">2dp</dimen>
- <dimen name="homepage_condition_half_card_padding_top">12dp</dimen>
- <dimen name="homepage_condition_half_card_title_margin_top">12dp</dimen>
- <dimen name="homepage_condition_half_card_summary_margin_bottom">12dp</dimen>
- <dimen name="homepage_condition_full_card_padding_start">24dp</dimen>
- <dimen name="homepage_condition_full_card_padding_end">16dp</dimen>
- <dimen name="homepage_condition_full_card_padding_top">12dp</dimen>
- <dimen name="homepage_condition_full_card_padding_bottom">12dp</dimen>
- <dimen name="homepage_condition_header_padding_top">10dp</dimen>
- <dimen name="homepage_condition_header_padding_bottom">10dp</dimen>
- <dimen name="homepage_condition_header_icons_margin_start">14dp</dimen>
- <dimen name="homepage_condition_header_indicator_padding_top">4dp</dimen>
- <dimen name="homepage_condition_header_indicator_padding_start">16dp</dimen>
- <dimen name="homepage_condition_header_indicator_padding_end">16dp</dimen>
- <dimen name="homepage_condition_footer_height">48dp</dimen>
- <dimen name="homepage_condition_footer_padding_top">10dp</dimen>
- <dimen name="homepage_condition_footer_padding_end">10dp</dimen>
- <dimen name="homepage_condition_header_icon_width_height">24dp</dimen>
- <dimen name="homepage_condition_header_icon_margin_end">24dp</dimen>
+ <dimen name="contextual_condition_card_title_margin_bottom">2dp</dimen>
+ <dimen name="contextual_condition_half_card_padding_top">12dp</dimen>
+ <dimen name="contextual_condition_half_card_title_margin_top">12dp</dimen>
+ <dimen name="contextual_condition_half_card_summary_margin_bottom">12dp</dimen>
+ <dimen name="contextual_condition_full_card_padding_start">24dp</dimen>
+ <dimen name="contextual_condition_full_card_padding_end">16dp</dimen>
+ <dimen name="contextual_condition_full_card_padding_top">12dp</dimen>
+ <dimen name="contextual_condition_full_card_padding_bottom">12dp</dimen>
+ <dimen name="contextual_condition_header_padding_top">10dp</dimen>
+ <dimen name="contextual_condition_header_padding_bottom">10dp</dimen>
+ <dimen name="contextual_condition_header_icons_margin_start">14dp</dimen>
+ <dimen name="contextual_condition_header_indicator_padding_top">4dp</dimen>
+ <dimen name="contextual_condition_header_indicator_padding_start">16dp</dimen>
+ <dimen name="contextual_condition_header_indicator_padding_end">16dp</dimen>
+ <dimen name="contextual_condition_footer_height">48dp</dimen>
+ <dimen name="contextual_condition_footer_padding_top">10dp</dimen>
+ <dimen name="contextual_condition_footer_padding_end">10dp</dimen>
+ <dimen name="contextual_condition_header_icon_width_height">24dp</dimen>
+ <dimen name="contextual_condition_header_icon_margin_end">24dp</dimen>
<!-- QR code picture size -->
<dimen name="qrcode_size">264dp</dimen>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index d9d95b9..1567c75 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1053,11 +1053,11 @@
<string name="face_lock_screen_setup_skip_dialog_text" product="device">Protect your device with a screen lock option so no one will be able to use it if it is lost or stolen. You also need a screen lock option to set up face authentication. Tap Cancel, then set a PIN or choose another screen lock option.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set face authentication. (default) [CHAR LIMIT=NONE] -->
<string name="face_lock_screen_setup_skip_dialog_text" product="default">Protect your phone with a screen lock option so no one will be able to use it if it is lost or stolen. You also need a screen lock option to set up face authentication. Tap Cancel, then set a PIN or choose another screen lock option.</string>
- <!-- Title of dialog shown when the user tries to skip setting up a PIN, warning them of potential consequences of not doing so [CHAR LIMIT=30]-->
+ <!-- Title of dialog shown when the user tries to skip setting up a PIN, warning them of potential consequences of not doing so [CHAR LIMIT=48]-->
<string name="lock_screen_pin_skip_title">Skip PIN Setup?</string>
- <!-- Title of dialog shown when the user tries to skip setting up a password, warning them of potential consequences of not doing so [CHAR LIMIT=30]-->
+ <!-- Title of dialog shown when the user tries to skip setting up a password, warning them of potential consequences of not doing so [CHAR LIMIT=48]-->
<string name="lock_screen_password_skip_title">Skip Password Setup?</string>
- <!-- Title of dialog shown when the user tries to skip setting up a pattern, warning them of potential consequences of not doing so [CHAR LIMIT=30]-->
+ <!-- Title of dialog shown when the user tries to skip setting up a pattern, warning them of potential consequences of not doing so [CHAR LIMIT=48]-->
<string name="lock_screen_pattern_skip_title">Skip Pattern Setup?</string>
<!-- Button text to setup screen lock in onboard dialog [CHAR LIMIT=34] -->
@@ -2846,7 +2846,7 @@
<string name="night_display_not_currently_on">Night Light not currently on</string>
<!-- Sound & display settings screen, setting option name to change screen timeout -->
- <string name="screen_timeout">Sleep</string>
+ <string name="screen_timeout">Screen timeout</string>
<!-- Sound & display settings screen, setting option name to change screen timeout [CHAR LIMIT=30] -->
<string name="screen_timeout_title">Screen turns off</string>
<!-- Sound & display settings screen, setting option summary to change screen timeout -->
@@ -2854,7 +2854,7 @@
<!-- Wallpaper settings title [CHAR LIMIT=30] -->
<string name="wallpaper_settings_title">Wallpaper</string>
<!-- Styles & Wallpapers settings title [CHAR LIMIT=30] -->
- <string name="style_and_wallpaper_settings_title">Styles & Wallpapers</string>
+ <string name="style_and_wallpaper_settings_title">Styles & wallpapers</string>
<!-- Wallpaper settings summary when default wallpaper is used [CHAR LIMIT=NONE] -->
<string name="wallpaper_settings_summary_default">Default</string>
<!-- Wallpaper settings summary when wallpaper has been updated [CHAR LIMIT=NONE] -->
@@ -9322,7 +9322,7 @@
<string name="display_dashboard_summary">Wallpaper, sleep, font size</string>
<!-- Summary for Display settings, explaining a few important settings under it [CHAR LIMIT=NONE]-->
- <string name="display_dashboard_summary_with_style">Styles & Wallpapers, sleep, font size</string>
+ <string name="display_dashboard_summary_with_style">Styles, wallpapers, screen timeout, font size</string>
<!-- Summary for Display settings, explaining a few important settings under it [CHAR LIMIT=NONE]-->
<string name="display_dashboard_nowallpaper_summary">Sleep, font size</string>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 9ce8af0..b51a45d 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -414,13 +414,13 @@
</style>
<style name="ContextualCardStyle">
- <item name="android:layout_marginBottom">@dimen/homepage_card_vertical_margin</item>
- <item name="android:layout_marginStart">@dimen/homepage_card_side_margin</item>
- <item name="android:layout_marginEnd">@dimen/homepage_card_side_margin</item>
+ <item name="android:layout_marginBottom">@dimen/contextual_card_vertical_margin</item>
+ <item name="android:layout_marginStart">@dimen/contextual_card_side_margin</item>
+ <item name="android:layout_marginEnd">@dimen/contextual_card_side_margin</item>
<item name="cardBackgroundColor">@color/contextual_card_background</item>
- <item name="cardCornerRadius">@dimen/homepage_card_corner_radius</item>
+ <item name="cardCornerRadius">@dimen/contextual_card_corner_radius</item>
<item name="cardElevation">0dp</item>
- <item name="strokeColor">@color/homepage_card_stroke_color</item>
+ <item name="strokeColor">@color/contextual_card_stroke_color</item>
<item name="strokeWidth">1dp</item>
</style>
@@ -475,10 +475,10 @@
<style name="DeferredSetupCardButton" parent="android:Widget.DeviceDefault.Button.Colored">
<item name="android:fontFamily">@*android:string/config_headlineFontFamilyMedium</item>
- <item name="android:paddingBottom">@dimen/homepage_deferred_setup_card_button_padding_bottom</item>
- <item name="android:paddingEnd">@dimen/homepage_deferred_setup_card_button_padding_end</item>
- <item name="android:paddingStart">@dimen/homepage_deferred_setup_card_button_padding_start</item>
- <item name="android:paddingTop">@dimen/homepage_deferred_setup_card_button_padding_top</item>
+ <item name="android:paddingBottom">@dimen/contextual_deferred_setup_card_button_padding_bottom</item>
+ <item name="android:paddingEnd">@dimen/contextual_deferred_setup_card_button_padding_end</item>
+ <item name="android:paddingStart">@dimen/contextual_deferred_setup_card_button_padding_start</item>
+ <item name="android:paddingTop">@dimen/contextual_deferred_setup_card_button_padding_top</item>
<item name="android:textAllCaps">false</item>
<item name="android:textSize">14sp</item>
</style>
diff --git a/res/xml/accessibility_settings.xml b/res/xml/accessibility_settings.xml
index 0e417c9..26849d1 100644
--- a/res/xml/accessibility_settings.xml
+++ b/res/xml/accessibility_settings.xml
@@ -68,7 +68,7 @@
android:fragment="com.android.settings.accessibility.MagnificationPreferenceFragment"
android:key="magnification_preference_screen"
android:title="@string/accessibility_screen_magnification_title"
- android:icon="@mipmap/ic_accessibility_magnification" />
+ android:icon="@drawable/ic_accessibility_magnification" />
<SwitchPreference
android:key="toggle_large_pointer_icon"
diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java
index 90ffc5a..4cc2f44 100644
--- a/src/com/android/settings/Settings.java
+++ b/src/com/android/settings/Settings.java
@@ -36,6 +36,7 @@
public static class TetherSettingsActivity extends SettingsActivity { /* empty */ }
public static class WifiTetherSettingsActivity extends SettingsActivity { /* empty */ }
public static class VpnSettingsActivity extends SettingsActivity { /* empty */ }
+ public static class DataSaverSummaryActivity extends SettingsActivity{ /* empty */ }
public static class DateTimeSettingsActivity extends SettingsActivity { /* empty */ }
public static class PrivateVolumeForgetActivity extends SettingsActivity { /* empty */ }
public static class PrivateVolumeSettingsActivity extends SettingsActivity { /* empty */ }
diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFinish.java b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFinish.java
index 3f02b6f..05ee7be 100644
--- a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFinish.java
+++ b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFinish.java
@@ -17,11 +17,15 @@
package com.android.settings.biometrics.fingerprint;
import android.app.settings.SettingsEnums;
+import android.content.ComponentName;
import android.content.Intent;
+import android.content.pm.PackageManager;
import android.hardware.fingerprint.FingerprintManager;
import android.os.Bundle;
import android.view.View;
+import androidx.annotation.VisibleForTesting;
+
import com.android.settings.R;
import com.android.settings.Utils;
import com.android.settings.biometrics.BiometricEnrollBase;
@@ -34,7 +38,11 @@
*/
public class FingerprintEnrollFinish extends BiometricEnrollBase {
- private static final int REQUEST_ADD_ANOTHER = 1;
+ @VisibleForTesting
+ static final int REQUEST_ADD_ANOTHER = 1;
+ @VisibleForTesting
+ static final String FINGERPRINT_SUGGESTION_ACTIVITY =
+ "com.android.settings.SetupFingerprintSuggestionActivity";
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -85,16 +93,37 @@
@Override
protected void onNextButtonClick(View view) {
+ setFingerprintSuggestionEnabled();
setResult(RESULT_FINISHED);
finish();
}
+ private void setFingerprintSuggestionEnabled() {
+ final FingerprintManager fpm = Utils.getFingerprintManagerOrNull(this);
+ if (fpm != null) {
+ int enrolled = fpm.getEnrolledFingerprints(mUserId).size();
+
+ // Only show "Add another fingerprint" if the user already enrolled one.
+ // "Add fingerprint" will be shown in the main flow if the user hasn't enrolled any
+ // fingerprints. If the user already added more than one fingerprint, they already know
+ // to add multiple fingerprints so we don't show the suggestion.
+ int flag = (enrolled == 1) ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED
+ : PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
+
+ ComponentName componentName = new ComponentName(getApplicationContext(),
+ FINGERPRINT_SUGGESTION_ACTIVITY);
+ getPackageManager().setComponentEnabledSetting(
+ componentName, flag, PackageManager.DONT_KILL_APP);
+ }
+ }
+
private void onAddAnotherButtonClick(View view) {
startActivityForResult(getFingerprintEnrollingIntent(), REQUEST_ADD_ANOTHER);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+ setFingerprintSuggestionEnabled();
if (requestCode == REQUEST_ADD_ANOTHER && resultCode != RESULT_CANCELED) {
setResult(resultCode, data);
finish();
diff --git a/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderController.java b/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderController.java
index 9a651d2..d6a668e 100644
--- a/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderController.java
+++ b/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderController.java
@@ -39,6 +39,7 @@
import com.android.settings.R;
import com.android.settings.core.BasePreferenceController;
import com.android.settings.fuelgauge.BatteryMeterView;
+import com.android.settingslib.bluetooth.BluetoothUtils;
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnDestroy;
@@ -69,13 +70,12 @@
@VisibleForTesting
Handler mHandler = new Handler(Looper.getMainLooper());
@VisibleForTesting
- final BluetoothAdapter.MetadataListener mMetadataListener =
- new BluetoothAdapter.MetadataListener() {
+ final BluetoothAdapter.OnMetadataChangedListener mMetadataListener =
+ new BluetoothAdapter.OnMetadataChangedListener() {
@Override
- public void onMetadataChanged(BluetoothDevice device, int key, String value) {
- super.onMetadataChanged(device, key, value);
+ public void onMetadataChanged(BluetoothDevice device, int key, byte[] value) {
Log.i(TAG, String.format("Metadata updated in Device %s: %d = %s.", device, key,
- value));
+ value == null ? null : new String(value)));
refresh();
}
};
@@ -88,9 +88,9 @@
@Override
public int getAvailabilityStatus() {
- final boolean unthetheredHeadset = Utils.getBooleanMetaData(mCachedDevice.getDevice(),
- BluetoothDevice.METADATA_IS_UNTHETHERED_HEADSET);
- return unthetheredHeadset ? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
+ final boolean untetheredHeadset = BluetoothUtils.getBooleanMetaData(
+ mCachedDevice.getDevice(), BluetoothDevice.METADATA_IS_UNTETHERED_HEADSET);
+ return untetheredHeadset ? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
}
@Override
@@ -108,8 +108,8 @@
return;
}
mCachedDevice.registerCallback(this::onDeviceAttributesChanged);
- mBluetoothAdapter.registerMetadataListener(mCachedDevice.getDevice(), mMetadataListener,
- mHandler);
+ mBluetoothAdapter.addOnMetadataChangedListener(mCachedDevice.getDevice(),
+ mContext.getMainExecutor(), mMetadataListener);
}
@Override
@@ -118,7 +118,8 @@
return;
}
mCachedDevice.unregisterCallback(this::onDeviceAttributesChanged);
- mBluetoothAdapter.unregisterMetadataListener(mCachedDevice.getDevice());
+ mBluetoothAdapter.removeOnMetadataChangedListener(mCachedDevice.getDevice(),
+ mMetadataListener);
}
@Override
@@ -154,21 +155,21 @@
}
updateSubLayout(mLayoutPreference.findViewById(R.id.layout_left),
- BluetoothDevice.METADATA_UNTHETHERED_LEFT_ICON,
- BluetoothDevice.METADATA_UNTHETHERED_LEFT_BATTERY,
- BluetoothDevice.METADATA_UNTHETHERED_LEFT_CHARGING,
+ BluetoothDevice.METADATA_UNTETHERED_LEFT_ICON,
+ BluetoothDevice.METADATA_UNTETHERED_LEFT_BATTERY,
+ BluetoothDevice.METADATA_UNTETHERED_LEFT_CHARGING,
R.string.bluetooth_left_name);
updateSubLayout(mLayoutPreference.findViewById(R.id.layout_middle),
- BluetoothDevice.METADATA_UNTHETHERED_CASE_ICON,
- BluetoothDevice.METADATA_UNTHETHERED_CASE_BATTERY,
- BluetoothDevice.METADATA_UNTHETHERED_CASE_CHARGING,
+ BluetoothDevice.METADATA_UNTETHERED_CASE_ICON,
+ BluetoothDevice.METADATA_UNTETHERED_CASE_BATTERY,
+ BluetoothDevice.METADATA_UNTETHERED_CASE_CHARGING,
R.string.bluetooth_middle_name);
updateSubLayout(mLayoutPreference.findViewById(R.id.layout_right),
- BluetoothDevice.METADATA_UNTHETHERED_RIGHT_ICON,
- BluetoothDevice.METADATA_UNTHETHERED_RIGHT_BATTERY,
- BluetoothDevice.METADATA_UNTHETHERED_RIGHT_CHARGING,
+ BluetoothDevice.METADATA_UNTETHERED_RIGHT_ICON,
+ BluetoothDevice.METADATA_UNTETHERED_RIGHT_BATTERY,
+ BluetoothDevice.METADATA_UNTETHERED_RIGHT_CHARGING,
R.string.bluetooth_right_name);
}
}
@@ -194,15 +195,15 @@
return;
}
final BluetoothDevice bluetoothDevice = mCachedDevice.getDevice();
- final String iconUri = Utils.getStringMetaData(bluetoothDevice, iconMetaKey);
+ final String iconUri = BluetoothUtils.getStringMetaData(bluetoothDevice, iconMetaKey);
if (iconUri != null) {
final ImageView imageView = linearLayout.findViewById(R.id.header_icon);
updateIcon(imageView, iconUri);
}
- final int batteryLevel = Utils.getIntMetaData(bluetoothDevice, batteryMetaKey);
- final boolean charging = Utils.getBooleanMetaData(bluetoothDevice, chargeMetaKey);
- if (batteryLevel != Utils.META_INT_ERROR) {
+ final int batteryLevel = BluetoothUtils.getIntMetaData(bluetoothDevice, batteryMetaKey);
+ final boolean charging = BluetoothUtils.getBooleanMetaData(bluetoothDevice, chargeMetaKey);
+ if (batteryLevel != BluetoothUtils.META_INT_ERROR) {
linearLayout.setVisibility(View.VISIBLE);
final ImageView imageView = linearLayout.findViewById(R.id.bt_battery_icon);
imageView.setImageDrawable(createBtBatteryIcon(mContext, batteryLevel, charging));
@@ -233,7 +234,7 @@
// Only show bluetooth icon
final BluetoothDevice bluetoothDevice = mCachedDevice.getDevice();
- final String iconUri = Utils.getStringMetaData(bluetoothDevice,
+ final String iconUri = BluetoothUtils.getStringMetaData(bluetoothDevice,
BluetoothDevice.METADATA_MAIN_ICON);
if (iconUri != null) {
final ImageView imageView = linearLayout.findViewById(R.id.header_icon);
diff --git a/src/com/android/settings/bluetooth/BluetoothDetailsHeaderController.java b/src/com/android/settings/bluetooth/BluetoothDetailsHeaderController.java
index 47d56bc..ee63045 100644
--- a/src/com/android/settings/bluetooth/BluetoothDetailsHeaderController.java
+++ b/src/com/android/settings/bluetooth/BluetoothDetailsHeaderController.java
@@ -53,8 +53,8 @@
@Override
public boolean isAvailable() {
- return !Utils.getBooleanMetaData(mCachedDevice.getDevice(),
- BluetoothDevice.METADATA_IS_UNTHETHERED_HEADSET);
+ return !BluetoothUtils.getBooleanMetaData(mCachedDevice.getDevice(),
+ BluetoothDevice.METADATA_IS_UNTETHERED_HEADSET);
}
@Override
diff --git a/src/com/android/settings/bluetooth/BluetoothFeatureProviderImpl.java b/src/com/android/settings/bluetooth/BluetoothFeatureProviderImpl.java
index e486b68..cd75951 100644
--- a/src/com/android/settings/bluetooth/BluetoothFeatureProviderImpl.java
+++ b/src/com/android/settings/bluetooth/BluetoothFeatureProviderImpl.java
@@ -33,8 +33,8 @@
@Override
public Uri getBluetoothDeviceSettingsUri(BluetoothDevice bluetoothDevice) {
- final String uriString = bluetoothDevice.getMetadata(
+ final byte[] uriByte = bluetoothDevice.getMetadata(
BluetoothDevice.METADATA_ENHANCED_SETTINGS_UI_URI);
- return uriString != null ? Uri.parse(uriString) : null;
+ return uriByte == null ? null : Uri.parse(new String(uriByte));
}
}
diff --git a/src/com/android/settings/bluetooth/Utils.java b/src/com/android/settings/bluetooth/Utils.java
index a86e1d5..d6e395e 100755
--- a/src/com/android/settings/bluetooth/Utils.java
+++ b/src/com/android/settings/bluetooth/Utils.java
@@ -47,8 +47,6 @@
static final boolean V = BluetoothUtils.V; // verbose logging
static final boolean D = BluetoothUtils.D; // regular logging
- public static final int META_INT_ERROR = -1;
-
private Utils() {
}
@@ -154,30 +152,4 @@
return Settings.Global.getInt(context.getContentResolver(),
Settings.Global.BLE_SCAN_ALWAYS_AVAILABLE, 0) == 1;
}
-
- public static boolean getBooleanMetaData(BluetoothDevice bluetoothDevice, int key) {
- if (bluetoothDevice == null) {
- return false;
- }
-
- return Boolean.parseBoolean(bluetoothDevice.getMetadata(key));
- }
-
- public static String getStringMetaData(BluetoothDevice bluetoothDevice, int key) {
- if (bluetoothDevice == null) {
- return null;
- }
- return bluetoothDevice.getMetadata(key);
- }
-
- public static int getIntMetaData(BluetoothDevice bluetoothDevice, int key) {
- if (bluetoothDevice == null) {
- return META_INT_ERROR;
- }
- try {
- return Integer.parseInt(bluetoothDevice.getMetadata(key));
- } catch (NumberFormatException e) {
- return META_INT_ERROR;
- }
- }
}
diff --git a/src/com/android/settings/core/gateway/SettingsGateway.java b/src/com/android/settings/core/gateway/SettingsGateway.java
index 35a1627..19843a6 100644
--- a/src/com/android/settings/core/gateway/SettingsGateway.java
+++ b/src/com/android/settings/core/gateway/SettingsGateway.java
@@ -59,6 +59,7 @@
import com.android.settings.connecteddevice.ConnectedDeviceDashboardFragment;
import com.android.settings.connecteddevice.PreviouslyConnectedDeviceDashboardFragment;
import com.android.settings.connecteddevice.usb.UsbDetailsFragment;
+import com.android.settings.datausage.DataSaverSummary;
import com.android.settings.datausage.DataUsageList;
import com.android.settings.datausage.DataUsageSummary;
import com.android.settings.deletionhelper.AutomaticStorageManagerSettings;
@@ -163,6 +164,7 @@
WifiTetherSettings.class.getName(),
BackgroundCheckSummary.class.getName(),
VpnSettings.class.getName(),
+ DataSaverSummary.class.getName(),
DateTimeSettings.class.getName(),
LocaleListEditor.class.getName(),
AvailableVirtualKeyboardFragment.class.getName(),
diff --git a/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetail.java b/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetail.java
index e19cfb8..e8d5f33 100644
--- a/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetail.java
+++ b/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetail.java
@@ -169,7 +169,7 @@
try {
args.putInt(EXTRA_UID, packageManager.getPackageUid(packageName, 0 /* no flag */));
} catch (PackageManager.NameNotFoundException e) {
- Log.e(TAG, "Cannot find package: " + packageName, e);
+ Log.w(TAG, "Cannot find package: " + packageName, e);
}
new SubSettingLauncher(caller)
diff --git a/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetailActivity.java b/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetailActivity.java
new file mode 100644
index 0000000..03ddde5
--- /dev/null
+++ b/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetailActivity.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.fuelgauge;
+
+import static com.android.settings.fuelgauge.AdvancedPowerUsageDetail.EXTRA_PACKAGE_NAME;
+import static com.android.settings.fuelgauge.AdvancedPowerUsageDetail.EXTRA_POWER_USAGE_PERCENT;
+import static com.android.settings.fuelgauge.AdvancedPowerUsageDetail.EXTRA_UID;
+
+import android.app.settings.SettingsEnums;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.net.Uri;
+import android.os.Bundle;
+import android.util.Log;
+
+import androidx.appcompat.app.AppCompatActivity;
+
+import com.android.settings.core.SubSettingLauncher;
+import com.android.settings.fuelgauge.AdvancedPowerUsageDetail;
+import com.android.settings.R;
+import com.android.settings.Utils;
+
+/**
+ * Trampoline activity for launching the {@link AdvancedPowerUsageDetail} fragment.
+ */
+public class AdvancedPowerUsageDetailActivity extends AppCompatActivity {
+
+ private static final String TAG = "AdvancedPowerDetailActivity";
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ final Intent intent = getIntent();
+ final Uri data = intent == null ? null : intent.getData();
+ final String packageName = data == null ? null : data.getSchemeSpecificPart();
+ if (packageName != null) {
+ final Bundle args = new Bundle(4);
+ final PackageManager packageManager = getPackageManager();
+ args.putString(EXTRA_PACKAGE_NAME, packageName);
+ args.putString(EXTRA_POWER_USAGE_PERCENT, Utils.formatPercentage(0));
+
+ if (intent.getBooleanExtra("request_ignore_background_restriction", false)) {
+ args.putString(":settings:fragment_args_key", "background_activity");
+ }
+
+ try {
+ args.putInt(EXTRA_UID, packageManager.getPackageUid(packageName, 0 /* no flag */));
+ } catch (PackageManager.NameNotFoundException e) {
+ Log.w(TAG, "Cannot find package: " + packageName, e);
+ }
+
+ new SubSettingLauncher(this)
+ .setDestination(AdvancedPowerUsageDetail.class.getName())
+ .setTitleRes(R.string.battery_details_title)
+ .setArguments(args)
+ .setSourceMetricsCategory(SettingsEnums.APPLICATIONS_INSTALLED_APP_DETAILS)
+ .launch();
+ }
+
+ finish();
+ }
+}
diff --git a/src/com/android/settings/fuelgauge/BatteryMeterView.java b/src/com/android/settings/fuelgauge/BatteryMeterView.java
index aa26ff4..4485508 100644
--- a/src/com/android/settings/fuelgauge/BatteryMeterView.java
+++ b/src/com/android/settings/fuelgauge/BatteryMeterView.java
@@ -61,7 +61,6 @@
mDrawable = new BatteryMeterDrawable(context, frameColor);
mDrawable.setColorFilter(mAccentColorFilter);
setImageDrawable(mDrawable);
- setLayerType(LAYER_TYPE_SOFTWARE, null);
}
public void setBatteryLevel(int level) {
diff --git a/src/com/android/settings/fuelgauge/batterysaver/BatterySaverScheduleRadioButtonsController.java b/src/com/android/settings/fuelgauge/batterysaver/BatterySaverScheduleRadioButtonsController.java
index 57bae45..2cf2b6d 100644
--- a/src/com/android/settings/fuelgauge/batterysaver/BatterySaverScheduleRadioButtonsController.java
+++ b/src/com/android/settings/fuelgauge/batterysaver/BatterySaverScheduleRadioButtonsController.java
@@ -17,6 +17,7 @@
import android.content.ContentResolver;
import android.content.Context;
+import android.os.Bundle;
import android.os.PowerManager;
import android.provider.Settings;
import android.provider.Settings.Global;
@@ -38,6 +39,7 @@
public static final String KEY_NO_SCHEDULE = "key_battery_saver_no_schedule";
public static final String KEY_ROUTINE = "key_battery_saver_routine";
public static final String KEY_PERCENTAGE = "key_battery_saver_percentage";
+ public static final int TRIGGER_LEVEL_MIN = 5;
private Context mContext;
private BatterySaverScheduleSeekBarController mSeekBarController;
@@ -67,30 +69,43 @@
}
public boolean setDefaultKey(String key) {
+ if (key == null) {
+ return false;
+ }
+
final ContentResolver resolver = mContext.getContentResolver();
-
int mode = PowerManager.POWER_SAVE_MODE_TRIGGER_PERCENTAGE;
int triggerLevel = 0;
- if (!TextUtils.equals(key, KEY_NO_SCHEDULE)
- && BatterySaverUtils.maybeShowBatterySaverConfirmation(
- mContext, true /* confirmOnly */)) {
- return true;
- } else {
- switch (key) {
- case KEY_NO_SCHEDULE:
- break;
- case KEY_PERCENTAGE:
- triggerLevel = 5;
- break;
- case KEY_ROUTINE:
- mode = PowerManager.POWER_SAVE_MODE_TRIGGER_DYNAMIC;
- break;
- default:
- throw new IllegalStateException(
- "Not a valid key for " + this.getClass().getSimpleName());
- }
+ final Bundle confirmationExtras = new Bundle(3);
+ switch (key) {
+ case KEY_NO_SCHEDULE:
+ break;
+ case KEY_PERCENTAGE:
+ triggerLevel = TRIGGER_LEVEL_MIN;
+ confirmationExtras.putBoolean(BatterySaverUtils.EXTRA_CONFIRM_TEXT_ONLY, true);
+ confirmationExtras.putInt(BatterySaverUtils.EXTRA_POWER_SAVE_MODE_TRIGGER,
+ PowerManager.POWER_SAVE_MODE_TRIGGER_PERCENTAGE);
+ confirmationExtras.putInt(BatterySaverUtils.EXTRA_POWER_SAVE_MODE_TRIGGER_LEVEL,
+ triggerLevel);
+ break;
+ case KEY_ROUTINE:
+ mode = PowerManager.POWER_SAVE_MODE_TRIGGER_DYNAMIC;
+ confirmationExtras.putBoolean(BatterySaverUtils.EXTRA_CONFIRM_TEXT_ONLY, true);
+ confirmationExtras.putInt(BatterySaverUtils.EXTRA_POWER_SAVE_MODE_TRIGGER,
+ PowerManager.POWER_SAVE_MODE_TRIGGER_DYNAMIC);
+ break;
+ default:
+ throw new IllegalStateException(
+ "Not a valid key for " + this.getClass().getSimpleName());
}
+ if (!TextUtils.equals(key, KEY_NO_SCHEDULE)
+ && BatterySaverUtils.maybeShowBatterySaverConfirmation(
+ mContext, confirmationExtras)) {
+ // reset this if we need to show the confirmation message
+ mode = PowerManager.POWER_SAVE_MODE_TRIGGER_PERCENTAGE;
+ triggerLevel = 0;
+ }
// Trigger level is intentionally left alone when going between dynamic and percentage modes
// so that a users percentage based schedule is preserved when they toggle between the two.
Settings.Global.putInt(resolver, Global.AUTOMATIC_POWER_SAVE_MODE, mode);
diff --git a/src/com/android/settings/homepage/contextualcards/ContextualCardFeatureProvider.java b/src/com/android/settings/homepage/contextualcards/ContextualCardFeatureProvider.java
index c296c7a..bba7f53 100644
--- a/src/com/android/settings/homepage/contextualcards/ContextualCardFeatureProvider.java
+++ b/src/com/android/settings/homepage/contextualcards/ContextualCardFeatureProvider.java
@@ -20,17 +20,4 @@
/** Feature provider for the contextual card feature. */
public interface ContextualCardFeatureProvider {
-
- /** Homepage displays. */
- void logHomepageDisplay(long latency);
-
- /** When user clicks dismiss in contextual card */
- void logContextualCardDismiss(ContextualCard card);
-
- /** After ContextualCardManager decides which cards will be displayed/hidden */
- void logContextualCardDisplay(List<ContextualCard> showedCards,
- List<ContextualCard> hiddenCards);
-
- /** When user clicks toggle/title area of a contextual card. */
- void logContextualCardClick(ContextualCard card, int sliceRow, int tapTarget, int uiPosition);
}
diff --git a/src/com/android/settings/homepage/contextualcards/ContextualCardFeatureProviderImpl.java b/src/com/android/settings/homepage/contextualcards/ContextualCardFeatureProviderImpl.java
index 793134f..03a1550 100644
--- a/src/com/android/settings/homepage/contextualcards/ContextualCardFeatureProviderImpl.java
+++ b/src/com/android/settings/homepage/contextualcards/ContextualCardFeatureProviderImpl.java
@@ -16,161 +16,12 @@
package com.android.settings.homepage.contextualcards;
-import android.annotation.NonNull;
import android.content.Context;
-import android.content.Intent;
-import android.os.UserHandle;
-import android.text.TextUtils;
-import android.util.Log;
-
-import androidx.annotation.VisibleForTesting;
-import androidx.slice.widget.EventInfo;
-
-import com.android.settings.R;
-import com.android.settings.intelligence.ContextualCardProto.ContextualCardList;
-
-import java.util.List;
public class ContextualCardFeatureProviderImpl implements ContextualCardFeatureProvider {
- private static final String TAG = "ContextualCardFeature";
-
- // Contextual card interaction logs
- // Settings Homepage shows
- private static final int CONTEXTUAL_HOME_SHOW = 38;
-
- // Contextual card shows, log card name and rank
- private static final int CONTEXTUAL_CARD_SHOW = 39;
-
- // Contextual card is dismissed, log card name
- private static final int CONTEXTUAL_CARD_DISMISS = 41;
-
- // Contextual card is clicked , log card name, score, tap area
- private static final int CONTEXTUAL_CARD_CLICK = 42;
-
- // SettingsLogBroadcastReceiver contracts
- // contextual card name
- private static final String EXTRA_CONTEXTUALCARD_NAME = "name";
-
- // contextual card uri
- private static final String EXTRA_CONTEXTUALCARD_URI = "uri";
-
- // contextual card score
- private static final String EXTRA_CONTEXTUALCARD_SCORE = "score";
-
- // contextual card clicked row
- private static final String EXTRA_CONTEXTUALCARD_ROW = "row";
-
- // contextual card tap target
- private static final String EXTRA_CONTEXTUALCARD_TAP_TARGET = "target";
-
- // contextual card ui position
- private static final String EXTRA_CONTEXTUALCARD_UI_POSTITION = "ui_position";
-
- // contextual homepage display latency
- private static final String EXTRA_LATENCY = "latency";
-
- // log type
- private static final String EXTRA_CONTEXTUALCARD_ACTION_TYPE = "type";
-
- // displayed contextual cards
- private static final String EXTRA_CONTEXTUALCARD_VISIBLE = "visible";
-
- // hidden contextual cards
- private static final String EXTRA_CONTEXTUALCARD_HIDDEN = "hidden";
-
- // Contextual card tap target
- private static final int TARGET_DEFAULT = 0;
-
- // Click title area
- private static final int TARGET_TITLE = 1;
-
- // Click toggle
- private static final int TARGET_TOGGLE = 2;
-
- // Click slider
- private static final int TARGET_SLIDER = 3;
-
private final Context mContext;
public ContextualCardFeatureProviderImpl(Context context) {
mContext = context;
}
-
- @Override
- public void logHomepageDisplay(long latency) {
- sendBroadcast(new Intent()
- .putExtra(EXTRA_CONTEXTUALCARD_ACTION_TYPE, CONTEXTUAL_HOME_SHOW)
- .putExtra(EXTRA_LATENCY, latency));
- }
-
- @Override
- public void logContextualCardDismiss(ContextualCard card) {
- final Intent intent = new Intent();
- intent.putExtra(EXTRA_CONTEXTUALCARD_ACTION_TYPE, CONTEXTUAL_CARD_DISMISS);
- intent.putExtra(EXTRA_CONTEXTUALCARD_NAME, card.getName());
- intent.putExtra(EXTRA_CONTEXTUALCARD_URI, card.getSliceUri().toString());
- intent.putExtra(EXTRA_CONTEXTUALCARD_SCORE, card.getRankingScore());
- sendBroadcast(intent);
- }
-
- @Override
- public void logContextualCardDisplay(List<ContextualCard> visibleCards,
- List<ContextualCard> hiddenCards) {
- final Intent intent = new Intent();
- intent.putExtra(EXTRA_CONTEXTUALCARD_ACTION_TYPE, CONTEXTUAL_CARD_SHOW);
- intent.putExtra(EXTRA_CONTEXTUALCARD_VISIBLE, serialize(visibleCards));
- intent.putExtra(EXTRA_CONTEXTUALCARD_HIDDEN, serialize(hiddenCards));
- sendBroadcast(intent);
- }
-
- @Override
- public void logContextualCardClick(ContextualCard card, int row,
- int actionType, int uiPosition) {
- final Intent intent = new Intent();
- intent.putExtra(EXTRA_CONTEXTUALCARD_ACTION_TYPE, CONTEXTUAL_CARD_CLICK);
- intent.putExtra(EXTRA_CONTEXTUALCARD_NAME, card.getName());
- intent.putExtra(EXTRA_CONTEXTUALCARD_URI, card.getSliceUri().toString());
- intent.putExtra(EXTRA_CONTEXTUALCARD_SCORE, card.getRankingScore());
- intent.putExtra(EXTRA_CONTEXTUALCARD_ROW, row);
- intent.putExtra(EXTRA_CONTEXTUALCARD_TAP_TARGET, actionTypeToTapTarget(actionType));
- intent.putExtra(EXTRA_CONTEXTUALCARD_UI_POSTITION, uiPosition);
- sendBroadcast(intent);
- }
-
- @VisibleForTesting
- void sendBroadcast(final Intent intent) {
- intent.setPackage(mContext.getString(R.string.config_settingsintelligence_package_name));
- final String action = mContext.getString(R.string.config_settingsintelligence_log_action);
- if (!TextUtils.isEmpty(action)) {
- intent.setAction(action);
- mContext.sendBroadcastAsUser(intent, UserHandle.CURRENT);
- }
- }
-
- private int actionTypeToTapTarget(int actionType) {
- switch (actionType) {
- case EventInfo.ACTION_TYPE_CONTENT:
- return TARGET_TITLE;
- case EventInfo.ACTION_TYPE_TOGGLE:
- return TARGET_TOGGLE;
- case EventInfo.ACTION_TYPE_SLIDER:
- return TARGET_SLIDER;
- default:
- Log.w(TAG, "unknown type " + actionType);
- return TARGET_DEFAULT;
- }
- }
-
- @VisibleForTesting
- @NonNull
- byte[] serialize(List<ContextualCard> cards) {
- final ContextualCardList.Builder builder = ContextualCardList.newBuilder();
- cards.stream().forEach(card -> builder.addCard(
- com.android.settings.intelligence.ContextualCardProto.ContextualCard.newBuilder()
- .setSliceUri(card.getSliceUri().toString())
- .setCardName(card.getName())
- .setCardScore(card.getRankingScore())
- .build()));
- return builder.build().toByteArray();
- }
}
diff --git a/src/com/android/settings/homepage/contextualcards/ContextualCardManager.java b/src/com/android/settings/homepage/contextualcards/ContextualCardManager.java
index d8361a9..b39058b 100644
--- a/src/com/android/settings/homepage/contextualcards/ContextualCardManager.java
+++ b/src/com/android/settings/homepage/contextualcards/ContextualCardManager.java
@@ -37,6 +37,7 @@
import androidx.loader.app.LoaderManager;
import androidx.loader.content.Loader;
+import com.android.settings.homepage.contextualcards.conditional.ConditionalCardController;
import com.android.settings.homepage.contextualcards.slices.SliceContextualCardRenderer;
import com.android.settings.overlay.FeatureFactory;
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
@@ -82,12 +83,13 @@
{ContextualCard.CardType.CONDITIONAL, ContextualCard.CardType.LEGACY_SUGGESTION};
private final Context mContext;
- private final ControllerRendererPool mControllerRendererPool;
private final Lifecycle mLifecycle;
private final List<LifecycleObserver> mLifecycleObservers;
private ContextualCardUpdateListener mListener;
@VisibleForTesting
+ final ControllerRendererPool mControllerRendererPool;
+ @VisibleForTesting
final List<ContextualCard> mContextualCards;
@VisibleForTesting
long mStartTime;
@@ -228,8 +230,6 @@
}
//only log homepage display upon a fresh launch
final long totalTime = System.currentTimeMillis() - mStartTime;
- FeatureFactory.getFactory(mContext).getContextualCardFeatureProvider(mContext)
- .logHomepageDisplay(totalTime);
metricsFeatureProvider.action(mContext,
SettingsEnums.ACTION_CONTEXTUAL_HOME_SHOW, (int) totalTime);
@@ -248,9 +248,25 @@
public void onWindowFocusChanged(boolean hasWindowFocus) {
// Duplicate a list to avoid java.util.ConcurrentModificationException.
final List<ContextualCard> cards = new ArrayList<>(mContextualCards);
+ boolean hasConditionController = false;
for (ContextualCard card : cards) {
- final ContextualCardController controller = mControllerRendererPool
+ final ContextualCardController controller = getControllerRendererPool()
.getController(mContext, card.getCardType());
+ if (controller instanceof ConditionalCardController) {
+ hasConditionController = true;
+ }
+ if (hasWindowFocus && controller instanceof OnStart) {
+ ((OnStart) controller).onStart();
+ }
+ if (!hasWindowFocus && controller instanceof OnStop) {
+ ((OnStop) controller).onStop();
+ }
+ }
+ // Conditional cards will always be refreshed whether or not there are conditional cards
+ // in the homepage.
+ if (!hasConditionController) {
+ final ContextualCardController controller = getControllerRendererPool()
+ .getController(mContext, ContextualCard.CardType.CONDITIONAL);
if (hasWindowFocus && controller instanceof OnStart) {
((OnStart) controller).onStart();
}
diff --git a/src/com/android/settings/network/telephony/RenameMobileNetworkDialogFragment.java b/src/com/android/settings/network/telephony/RenameMobileNetworkDialogFragment.java
index 488f930..7a131d7 100644
--- a/src/com/android/settings/network/telephony/RenameMobileNetworkDialogFragment.java
+++ b/src/com/android/settings/network/telephony/RenameMobileNetworkDialogFragment.java
@@ -99,7 +99,8 @@
mSubId);
String newName = mNameView.getText().toString();
if (currentInfo != null && !currentInfo.getDisplayName().equals(newName)) {
- mSubscriptionManager.setDisplayName(newName, mSubId);
+ mSubscriptionManager.setDisplayName(newName, mSubId,
+ SubscriptionManager.NAME_SOURCE_USER_INPUT);
}
})
.setNegativeButton(android.R.string.cancel, null);
diff --git a/src/com/android/settings/nfc/OWNERS b/src/com/android/settings/nfc/OWNERS
index f11f74f..2017826 100644
--- a/src/com/android/settings/nfc/OWNERS
+++ b/src/com/android/settings/nfc/OWNERS
@@ -1,5 +1,5 @@
# Default reviewers for this and subdirectories.
-eisenbach@google.com
-kandoiruchi@google.com
+rmojumder@google.com
-# Emergency approvers in case the above are not available
\ No newline at end of file
+# Emergency approvers in case the above are not available
+zachoverflow@google.com
diff --git a/src/com/android/settings/notification/AssistantCapabilityPreferenceController.java b/src/com/android/settings/notification/AssistantCapabilityPreferenceController.java
index be90a04..812bc65 100644
--- a/src/com/android/settings/notification/AssistantCapabilityPreferenceController.java
+++ b/src/com/android/settings/notification/AssistantCapabilityPreferenceController.java
@@ -17,7 +17,6 @@
package com.android.settings.notification;
import android.content.Context;
-import android.os.UserHandle;
import android.service.notification.Adjustment;
import com.android.settings.core.TogglePreferenceController;
@@ -44,7 +43,7 @@
@Override
public boolean isChecked() {
- List<String> capabilities = mBackend.getAssistantCapabilities(mContext.getPackageName());
+ List<String> capabilities = mBackend.getAssistantAdjustments(mContext.getPackageName());
if (PRIORITIZER_KEY.equals(getPreferenceKey())) {
return capabilities.contains(Adjustment.KEY_IMPORTANCE);
} else if (SMART_KEY.equals(getPreferenceKey())) {
@@ -57,10 +56,10 @@
@Override
public boolean setChecked(boolean isChecked) {
if (PRIORITIZER_KEY.equals(getPreferenceKey())) {
- mBackend.allowAssistantCapability(Adjustment.KEY_IMPORTANCE, isChecked);
+ mBackend.allowAssistantAdjustment(Adjustment.KEY_IMPORTANCE, isChecked);
} else if (SMART_KEY.equals(getPreferenceKey())) {
- mBackend.allowAssistantCapability(Adjustment.KEY_CONTEXTUAL_ACTIONS, isChecked);
- mBackend.allowAssistantCapability(Adjustment.KEY_TEXT_REPLIES, isChecked);
+ mBackend.allowAssistantAdjustment(Adjustment.KEY_CONTEXTUAL_ACTIONS, isChecked);
+ mBackend.allowAssistantAdjustment(Adjustment.KEY_TEXT_REPLIES, isChecked);
}
return true;
}
diff --git a/src/com/android/settings/notification/NotificationBackend.java b/src/com/android/settings/notification/NotificationBackend.java
index 4227050..765193b 100644
--- a/src/com/android/settings/notification/NotificationBackend.java
+++ b/src/com/android/settings/notification/NotificationBackend.java
@@ -339,21 +339,21 @@
}
}
- public void allowAssistantCapability(String capability, boolean allowed) {
+ public void allowAssistantAdjustment(String capability, boolean allowed) {
try {
if (allowed) {
- sINM.allowAssistantCapability(capability);
+ sINM.allowAssistantAdjustment(capability);
} else {
- sINM.disallowAssistantCapability(capability);
+ sINM.disallowAssistantAdjustment(capability);
}
} catch (Exception e) {
Log.w(TAG, "Error calling NoMan", e);
}
}
- public List<String> getAssistantCapabilities(String pkg) {
+ public List<String> getAssistantAdjustments(String pkg) {
try {
- return sINM.getAllowedAssistantCapabilities(pkg);
+ return sINM.getAllowedAssistantAdjustments(pkg);
} catch (Exception e) {
Log.w(TAG, "Error calling NoMan", e);
}
diff --git a/src/com/android/settings/security/CredentialStorage.java b/src/com/android/settings/security/CredentialStorage.java
index 99937ee..0ea37b5 100644
--- a/src/com/android/settings/security/CredentialStorage.java
+++ b/src/com/android/settings/security/CredentialStorage.java
@@ -242,14 +242,20 @@
@Override
public void onDismiss(DialogInterface dialog) {
- if (mResetConfirmed) {
- mResetConfirmed = false;
- if (confirmKeyGuard(CONFIRM_CLEAR_SYSTEM_CREDENTIAL_REQUEST)) {
- // will return password value via onActivityResult
- return;
- }
+ if (!mResetConfirmed) {
+ finish();
+ return;
}
- finish();
+
+ mResetConfirmed = false;
+ if (!mUtils.isSecure(UserHandle.myUserId())) {
+ // This task will call finish() in the end.
+ new ResetKeyStoreAndKeyChain().execute();
+ } else if (!confirmKeyGuard(CONFIRM_CLEAR_SYSTEM_CREDENTIAL_REQUEST)) {
+ Log.w(TAG, "Failed to launch credential confirmation for a secure user.");
+ finish();
+ }
+ // Confirmation result will be handled in onActivityResult if needed.
}
}
diff --git a/src/com/android/settings/system/SystemUpdatePreferenceController.java b/src/com/android/settings/system/SystemUpdatePreferenceController.java
index dd04409..38a88b9 100644
--- a/src/com/android/settings/system/SystemUpdatePreferenceController.java
+++ b/src/com/android/settings/system/SystemUpdatePreferenceController.java
@@ -139,7 +139,8 @@
}
Log.d(TAG, "ciActionOnSysUpdate: broadcasting intent " + intentStr +
" with extra " + extra + ", " + extraVal);
+ intent.addFlags(Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND);
mContext.getApplicationContext().sendBroadcast(intent);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/com/android/settings/users/MultiUserSwitchBarController.java b/src/com/android/settings/users/MultiUserSwitchBarController.java
index 58de149..a5fdf9b 100644
--- a/src/com/android/settings/users/MultiUserSwitchBarController.java
+++ b/src/com/android/settings/users/MultiUserSwitchBarController.java
@@ -52,6 +52,8 @@
mListener = listener;
mUserCapabilities = UserCapabilities.create(context);
mSwitchBar.setChecked(mUserCapabilities.mUserSwitcherEnabled);
+ Settings.Global.putInt(mContext.getContentResolver(),
+ Settings.Global.USER_SWITCHER_ENABLED, mSwitchBar.isChecked() ? 1 : 0);
if (mUserCapabilities.mDisallowSwitchUser) {
mSwitchBar.setDisabledByAdmin(RestrictedLockUtilsInternal
diff --git a/src/com/android/settings/vpn2/OWNERS b/src/com/android/settings/vpn2/OWNERS
new file mode 100644
index 0000000..0419e24
--- /dev/null
+++ b/src/com/android/settings/vpn2/OWNERS
@@ -0,0 +1,9 @@
+# People who can approve changes for submission.
+jchalard@google.com
+lorenzo@google.com
+maze@google.com
+reminv@google.com
+xiaom@google.com
+
+# Emergency approvers in case the above are not available
+satk@google.com
diff --git a/src/com/android/settings/wifi/AddWifiNetworkPreference.java b/src/com/android/settings/wifi/AddWifiNetworkPreference.java
index e49f2ab..03a80a4 100644
--- a/src/com/android/settings/wifi/AddWifiNetworkPreference.java
+++ b/src/com/android/settings/wifi/AddWifiNetworkPreference.java
@@ -36,7 +36,7 @@
private static final String TAG = "AddWifiNetworkPreference";
- private boolean mInitialized;
+ private final Drawable mScanIconDrawable;
public AddWifiNetworkPreference(Context context) {
super(context);
@@ -45,24 +45,22 @@
setWidgetLayoutResource(R.layout.wifi_button_preference_widget);
setIcon(R.drawable.ic_menu_add);
setTitle(R.string.wifi_add_network);
+
+ mScanIconDrawable = getDrawable(R.drawable.ic_scan_24dp);
}
@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
super.onBindViewHolder(holder);
- if (!mInitialized) {
- mInitialized = true;
-
- final ImageButton imageButton = (ImageButton) holder.findViewById(R.id.button_icon);
- imageButton.setImageDrawable(getDrawable(R.drawable.ic_scan_24dp));
- imageButton.setContentDescription(
- getContext().getString(R.string.wifi_dpp_scan_qr_code));
- imageButton.setOnClickListener(view -> {
- getContext().startActivity(
- WifiDppUtils.getEnrolleeQrCodeScannerIntent(/* ssid */ null));
- });
- }
+ final ImageButton scanButton = (ImageButton) holder.findViewById(R.id.button_icon);
+ scanButton.setImageDrawable(mScanIconDrawable);
+ scanButton.setContentDescription(
+ getContext().getString(R.string.wifi_dpp_scan_qr_code));
+ scanButton.setOnClickListener(view -> {
+ getContext().startActivity(
+ WifiDppUtils.getEnrolleeQrCodeScannerIntent(/* ssid */ null));
+ });
}
private Drawable getDrawable(@DrawableRes int iconResId) {
diff --git a/src/com/android/settings/wifi/calling/WifiCallingSettingsForSub.java b/src/com/android/settings/wifi/calling/WifiCallingSettingsForSub.java
index 525b59b..252193d 100644
--- a/src/com/android/settings/wifi/calling/WifiCallingSettingsForSub.java
+++ b/src/com/android/settings/wifi/calling/WifiCallingSettingsForSub.java
@@ -122,7 +122,8 @@
final CarrierConfigManager configManager = (CarrierConfigManager)
activity.getSystemService(Context.CARRIER_CONFIG_SERVICE);
if (configManager != null) {
- PersistableBundle b = configManager.getConfigForSubId(mSubId);
+ PersistableBundle b =
+ configManager.getConfigForSubId(WifiCallingSettingsForSub.this.mSubId);
if (b != null) {
isWfcModeEditable = b.getBoolean(
CarrierConfigManager.KEY_EDITABLE_WFC_MODE_BOOL);
diff --git a/src/com/android/settings/wifi/dpp/WifiDppUtils.java b/src/com/android/settings/wifi/dpp/WifiDppUtils.java
index 695de76..98673d4 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppUtils.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppUtils.java
@@ -128,18 +128,26 @@
return intent;
}
- private static String getPresharedKey(WifiManager wifiManager, WifiConfiguration config) {
- String preSharedKey = config.preSharedKey;
+ private static String getPresharedKey(WifiManager wifiManager,
+ WifiConfiguration wifiConfiguration) {
+ final List<WifiConfiguration> privilegedWifiConfiguratios =
+ wifiManager.getPrivilegedConfiguredNetworks();
- final List<WifiConfiguration> wifiConfigs = wifiManager.getPrivilegedConfiguredNetworks();
- for (WifiConfiguration wifiConfig : wifiConfigs) {
- if (wifiConfig.networkId == config.networkId) {
- preSharedKey = wifiConfig.preSharedKey;
- break;
+ for (WifiConfiguration privilegedWifiConfiguration : privilegedWifiConfiguratios) {
+ if (privilegedWifiConfiguration.networkId == wifiConfiguration.networkId) {
+ // WEP uses a shared key hence the AuthAlgorithm.SHARED is used
+ // to identify it.
+ if (wifiConfiguration.allowedKeyManagement.get(KeyMgmt.NONE)
+ && wifiConfiguration.allowedAuthAlgorithms.get(
+ WifiConfiguration.AuthAlgorithm.SHARED)) {
+ return privilegedWifiConfiguration
+ .wepKeys[privilegedWifiConfiguration.wepTxKeyIndex];
+ } else {
+ return privilegedWifiConfiguration.preSharedKey;
+ }
}
}
-
- return preSharedKey;
+ return wifiConfiguration.preSharedKey;
}
private static String removeFirstAndLastDoubleQuotes(String str) {
@@ -268,14 +276,11 @@
WifiConfiguration wifiConfiguration) {
final String ssid = removeFirstAndLastDoubleQuotes(wifiConfiguration.SSID);
final String security = getSecurityString(wifiConfiguration);
- String preSharedKey = wifiConfiguration.preSharedKey;
- if (preSharedKey != null) {
- // When the value of this key is read, the actual key is not returned, just a "*".
- // Call privileged system API to obtain actual key.
- preSharedKey = removeFirstAndLastDoubleQuotes(getPresharedKey(wifiManager,
- wifiConfiguration));
- }
+ // When the value of this key is read, the actual key is not returned, just a "*".
+ // Call privileged system API to obtain actual key.
+ final String preSharedKey = removeFirstAndLastDoubleQuotes(getPresharedKey(wifiManager,
+ wifiConfiguration));
if (!TextUtils.isEmpty(ssid)) {
intent.putExtra(EXTRA_WIFI_SSID, ssid);
diff --git a/src/com/android/settings/wifi/tether/WifiTetherSsidPreference.java b/src/com/android/settings/wifi/tether/WifiTetherSsidPreference.java
index 7d4ebec..4343fcc 100644
--- a/src/com/android/settings/wifi/tether/WifiTetherSsidPreference.java
+++ b/src/com/android/settings/wifi/tether/WifiTetherSsidPreference.java
@@ -37,9 +37,7 @@
public class WifiTetherSsidPreference extends ValidatedEditTextPreference {
private static final String TAG = "WifiTetherSsidPreference";
- private ImageButton mImageButton;
- private Drawable mButtonIcon;
- private View mDivider;
+ private Drawable mShareIconDrawable;
private View.OnClickListener mClickListener;
private boolean mVisible;
@@ -72,30 +70,29 @@
// TODO(b/129019971): use methods of divider line in parent object
setLayoutResource(com.android.settingslib.R.layout.preference_two_target);
setWidgetLayoutResource(R.layout.wifi_button_preference_widget);
+
+ mShareIconDrawable = getDrawable(R.drawable.ic_qrcode_24dp);
}
@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
super.onBindViewHolder(holder);
- if (mImageButton == null) {
- mImageButton = (ImageButton) holder.findViewById(R.id.button_icon);
-
- mImageButton.setContentDescription(
- getContext().getString(R.string.wifi_dpp_share_hotspot));
- setButtonIcon(R.drawable.ic_qrcode_24dp);
- mImageButton.setImageDrawable(mButtonIcon);
-
- mDivider = holder.findViewById(R.id.two_target_divider);
- }
+ final ImageButton shareButton = (ImageButton) holder.findViewById(R.id.button_icon);
+ final View dividerView = holder.findViewById(R.id.two_target_divider);
if (mVisible) {
- mImageButton.setOnClickListener(mClickListener);
- mImageButton.setVisibility(View.VISIBLE);
- mDivider.setVisibility(View.VISIBLE);
+ shareButton.setOnClickListener(mClickListener);
+ shareButton.setVisibility(View.VISIBLE);
+ shareButton.setContentDescription(
+ getContext().getString(R.string.wifi_dpp_share_hotspot));
+ shareButton.setImageDrawable(mShareIconDrawable);
+
+ dividerView.setVisibility(View.VISIBLE);
} else {
- mImageButton.setVisibility(View.GONE);
- mDivider.setVisibility(View.GONE);
+ shareButton.setVisibility(View.GONE);
+
+ dividerView.setVisibility(View.GONE);
}
}
@@ -107,12 +104,15 @@
mVisible = visible;
}
- private void setButtonIcon(@DrawableRes int iconResId) {
+ private Drawable getDrawable(@DrawableRes int iconResId) {
+ Drawable buttonIcon = null;
+
try {
- mButtonIcon = getContext().getDrawable(iconResId);
+ buttonIcon = getContext().getDrawable(iconResId);
} catch (Resources.NotFoundException exception) {
Log.e(TAG, "Resource does not exist: " + iconResId);
}
+ return buttonIcon;
}
@VisibleForTesting
diff --git a/tests/robotests/res/values-mcc999/config.xml b/tests/robotests/res/values-mcc999/config.xml
index cacecd6..78c3c08 100644
--- a/tests/robotests/res/values-mcc999/config.xml
+++ b/tests/robotests/res/values-mcc999/config.xml
@@ -78,11 +78,6 @@
<item>fake_package/fake_service</item>
</string-array>
- <!-- Settings intelligence interaction log intent action -->
- <string name="config_settingsintelligence_log_action" translatable="false">
- aaa.bbb.ccc
- </string>
-
<!-- List of packages that should be whitelisted for slice uri access. Do not translate -->
<string-array name="slice_whitelist_package_names" translatable="false">
<item>com.android.settings.slice_whitelist_package</item>
diff --git a/tests/robotests/src/com/android/settings/biometrics/fingerprint/SetupFingerprintEnrollFinishTest.java b/tests/robotests/src/com/android/settings/biometrics/fingerprint/SetupFingerprintEnrollFinishTest.java
new file mode 100644
index 0000000..74b35c9
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/biometrics/fingerprint/SetupFingerprintEnrollFinishTest.java
@@ -0,0 +1,145 @@
+/*
+ * Copyright (C) 2019 Google Inc.
+ *
+ * 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.biometrics.fingerprint;
+
+import static com.android.settings.biometrics.fingerprint.FingerprintEnrollFinish.FINGERPRINT_SUGGESTION_ACTIVITY;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.robolectric.RuntimeEnvironment.application;
+
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.pm.PackageManager;
+import android.hardware.fingerprint.FingerprintManager;
+
+import com.android.settings.R;
+import com.android.settings.testutils.shadow.ShadowFingerprintManager;
+
+import com.google.android.setupcompat.PartnerCustomizationLayout;
+import com.google.android.setupcompat.template.FooterBarMixin;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.robolectric.Robolectric;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.Shadows;
+import org.robolectric.annotation.Config;
+import org.robolectric.shadows.ShadowActivity;
+
+@RunWith(RobolectricTestRunner.class)
+@Config(shadows = {ShadowFingerprintManager.class})
+public class SetupFingerprintEnrollFinishTest {
+
+ private FingerprintEnrollFinish mActivity;
+ private ComponentName mComponentName;
+ private PartnerCustomizationLayout mLayout;
+ private FingerprintManager mFingerprintManager;
+
+ @Before
+ public void setUp() {
+ mActivity = Robolectric.buildActivity(FingerprintEnrollFinish.class).setup().get();
+ mLayout = mActivity.findViewById(R.id.setup_wizard_layout);
+ Shadows.shadowOf(application.getPackageManager())
+ .setSystemFeature(PackageManager.FEATURE_FINGERPRINT, true);
+
+ mFingerprintManager = (FingerprintManager) application.getSystemService(
+ Context.FINGERPRINT_SERVICE);
+ Shadows.shadowOf(mFingerprintManager).setIsHardwareDetected(true);
+
+ mComponentName = new ComponentName(
+ application, FINGERPRINT_SUGGESTION_ACTIVITY);
+ }
+
+ @Test
+ public void clickAddAnother_shouldLaunchEnrolling() {
+ final ComponentName enrollingComponent = new ComponentName(
+ application,
+ FingerprintEnrollEnrolling.class);
+
+ mLayout.getMixin(FooterBarMixin.class).getSecondaryButtonView().performClick();
+
+ ShadowActivity.IntentForResult startedActivity =
+ Shadows.shadowOf(mActivity).getNextStartedActivityForResult();
+ assertThat(startedActivity).named("Next activity").isNotNull();
+ assertThat(startedActivity.intent.getComponent())
+ .isEqualTo(enrollingComponent);
+ }
+
+ @Test
+ public void clickAddAnother_shouldPropagateResults() {
+ final ComponentName enrollingComponent = new ComponentName(
+ application,
+ FingerprintEnrollEnrolling.class);
+
+ mLayout.getMixin(FooterBarMixin.class).getSecondaryButtonView().performClick();
+
+ ShadowActivity.IntentForResult startedActivity =
+ Shadows.shadowOf(mActivity).getNextStartedActivityForResult();
+ assertThat(startedActivity).named("Next activity").isNotNull();
+ assertThat(startedActivity.intent.getComponent())
+ .isEqualTo(enrollingComponent);
+ }
+
+ @Test
+ public void clickNext_shouldFinish() {
+ mLayout.getMixin(FooterBarMixin.class).getPrimaryButtonView().performClick();
+
+ assertThat(mActivity.isFinishing()).isTrue();
+ }
+
+ @Test
+ public void onActivityResult_fingerprintCountIsNotOne_fingerprintSuggestionActivityDisabled() {
+ Shadows.shadowOf((FingerprintManager) mFingerprintManager).setDefaultFingerprints(0);
+
+ mActivity.onActivityResult(0, 0, null);
+
+ assertThat(application.getPackageManager().getComponentEnabledSetting(
+ mComponentName)).isEqualTo(PackageManager.COMPONENT_ENABLED_STATE_DISABLED);
+ }
+
+ @Test
+ public void onActivityResult_fingerprintCountIsOne_fingerprintSuggestionActivityEnabled() {
+ Shadows.shadowOf((FingerprintManager) mFingerprintManager).setDefaultFingerprints(1);
+
+ mActivity.onActivityResult(0, 0, null);
+
+ assertThat(application.getPackageManager().getComponentEnabledSetting(
+ mComponentName)).isEqualTo(PackageManager.COMPONENT_ENABLED_STATE_ENABLED);
+ }
+
+ @Test
+ public void clickNext_fingerprintCountIsNotOne_fingerprintSuggestionActivityDisabled() {
+ Shadows.shadowOf((FingerprintManager) mFingerprintManager).setDefaultFingerprints(2);
+
+ mLayout.getMixin(FooterBarMixin.class).getPrimaryButtonView().performClick();
+
+ assertThat(application.getPackageManager().getComponentEnabledSetting(
+ mComponentName)).isEqualTo(PackageManager.COMPONENT_ENABLED_STATE_DISABLED);
+ }
+
+ @Test
+ public void clickNext_fingerprintCountIsOne_fngerprintSuggestionActivityEnabled() {
+ Shadows.shadowOf((FingerprintManager) mFingerprintManager).setDefaultFingerprints(1);
+
+ mLayout.getMixin(FooterBarMixin.class).getPrimaryButtonView().performClick();
+
+ assertThat(application.getPackageManager().getComponentEnabledSetting(
+ mComponentName)).isEqualTo(PackageManager.COMPONENT_ENABLED_STATE_ENABLED);
+ }
+}
\ No newline at end of file
diff --git a/tests/robotests/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderControllerTest.java b/tests/robotests/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderControllerTest.java
index 3532bf8..362b003 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderControllerTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderControllerTest.java
@@ -104,14 +104,14 @@
@Test
public void refresh_connected_updateCorrectInfo() {
when(mBluetoothDevice.getMetadata(
- BluetoothDevice.METADATA_UNTHETHERED_LEFT_BATTERY)).thenReturn(
- String.valueOf(BATTERY_LEVEL_LEFT));
+ BluetoothDevice.METADATA_UNTETHERED_LEFT_BATTERY)).thenReturn(
+ String.valueOf(BATTERY_LEVEL_LEFT).getBytes());
when(mBluetoothDevice.getMetadata(
- BluetoothDevice.METADATA_UNTHETHERED_RIGHT_BATTERY)).thenReturn(
- String.valueOf(BATTERY_LEVEL_RIGHT));
+ BluetoothDevice.METADATA_UNTETHERED_RIGHT_BATTERY)).thenReturn(
+ String.valueOf(BATTERY_LEVEL_RIGHT).getBytes());
when(mBluetoothDevice.getMetadata(
- BluetoothDevice.METADATA_UNTHETHERED_CASE_BATTERY)).thenReturn(
- String.valueOf(BATTERY_LEVEL_MAIN));
+ BluetoothDevice.METADATA_UNTETHERED_CASE_BATTERY)).thenReturn(
+ String.valueOf(BATTERY_LEVEL_MAIN).getBytes());
when(mCachedDevice.isConnected()).thenReturn(true);
mController.refresh();
@@ -141,18 +141,18 @@
}
@Test
- public void getAvailabilityStatus_unthetheredHeadset_returnAvailable() {
- when(mBluetoothDevice.getMetadata(BluetoothDevice.METADATA_IS_UNTHETHERED_HEADSET))
- .thenReturn("true");
+ public void getAvailabilityStatus_untetheredHeadset_returnAvailable() {
+ when(mBluetoothDevice.getMetadata(BluetoothDevice.METADATA_IS_UNTETHERED_HEADSET))
+ .thenReturn("true".getBytes());
assertThat(mController.getAvailabilityStatus()).isEqualTo(
BasePreferenceController.AVAILABLE);
}
@Test
- public void getAvailabilityStatus_notUnthetheredHeadset_returnUnavailable() {
- when(mBluetoothDevice.getMetadata(BluetoothDevice.METADATA_IS_UNTHETHERED_HEADSET))
- .thenReturn("false");
+ public void getAvailabilityStatus_notUntetheredHeadset_returnUnavailable() {
+ when(mBluetoothDevice.getMetadata(BluetoothDevice.METADATA_IS_UNTETHERED_HEADSET))
+ .thenReturn("false".getBytes());
assertThat(mController.getAvailabilityStatus()).isEqualTo(
BasePreferenceController.CONDITIONALLY_UNAVAILABLE);
@@ -169,50 +169,52 @@
@Test
public void onStart_isAvailable_registerCallback() {
- when(mBluetoothDevice.getMetadata(BluetoothDevice.METADATA_IS_UNTHETHERED_HEADSET))
- .thenReturn("true");
+ when(mBluetoothDevice.getMetadata(BluetoothDevice.METADATA_IS_UNTETHERED_HEADSET))
+ .thenReturn("true".getBytes());
mController.onStart();
- verify(mBluetoothAdapter).registerMetadataListener(mBluetoothDevice,
- mController.mMetadataListener, mController.mHandler);
+ verify(mBluetoothAdapter).addOnMetadataChangedListener(mBluetoothDevice,
+ mContext.getMainExecutor() ,mController.mMetadataListener);
}
@Test
public void onStop_isAvailable_unregisterCallback() {
- when(mBluetoothDevice.getMetadata(BluetoothDevice.METADATA_IS_UNTHETHERED_HEADSET))
- .thenReturn("true");
+ when(mBluetoothDevice.getMetadata(BluetoothDevice.METADATA_IS_UNTETHERED_HEADSET))
+ .thenReturn("true".getBytes());
mController.onStop();
- verify(mBluetoothAdapter).unregisterMetadataListener(mBluetoothDevice);
+ verify(mBluetoothAdapter).removeOnMetadataChangedListener(mBluetoothDevice,
+ mController.mMetadataListener);
}
@Test
public void onStart_notAvailable_registerCallback() {
- when(mBluetoothDevice.getMetadata(BluetoothDevice.METADATA_IS_UNTHETHERED_HEADSET))
- .thenReturn("false");
+ when(mBluetoothDevice.getMetadata(BluetoothDevice.METADATA_IS_UNTETHERED_HEADSET))
+ .thenReturn("false".getBytes());
mController.onStart();
- verify(mBluetoothAdapter, never()).registerMetadataListener(mBluetoothDevice,
- mController.mMetadataListener, mController.mHandler);
+ verify(mBluetoothAdapter, never()).addOnMetadataChangedListener(mBluetoothDevice,
+ mContext.getMainExecutor() ,mController.mMetadataListener);
}
@Test
public void onStop_notAvailable_unregisterCallback() {
- when(mBluetoothDevice.getMetadata(BluetoothDevice.METADATA_IS_UNTHETHERED_HEADSET))
- .thenReturn("false");
+ when(mBluetoothDevice.getMetadata(BluetoothDevice.METADATA_IS_UNTETHERED_HEADSET))
+ .thenReturn("false".getBytes());
mController.onStop();
- verify(mBluetoothAdapter, never()).unregisterMetadataListener(mBluetoothDevice);
+ verify(mBluetoothAdapter, never()).removeOnMetadataChangedListener(mBluetoothDevice,
+ mController.mMetadataListener);
}
@Test
public void onDestroy_isAvailable_recycleBitmap() {
- when(mBluetoothDevice.getMetadata(BluetoothDevice.METADATA_IS_UNTHETHERED_HEADSET))
- .thenReturn("true");
+ when(mBluetoothDevice.getMetadata(BluetoothDevice.METADATA_IS_UNTETHERED_HEADSET))
+ .thenReturn("true".getBytes());
mController.mIconCache.put(ICON_URI, mBitmap);
mController.onDestroy();
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsHeaderControllerTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsHeaderControllerTest.java
index cf119ea..1ee1de6 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsHeaderControllerTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsHeaderControllerTest.java
@@ -123,9 +123,9 @@
}
@Test
- public void isAvailable_unthetheredHeadset_returnFalse() {
+ public void isAvailable_untetheredHeadset_returnFalse() {
when(mBluetoothDevice.getMetadata(
- BluetoothDevice.METADATA_IS_UNTHETHERED_HEADSET)).thenReturn("true");
+ BluetoothDevice.METADATA_IS_UNTETHERED_HEADSET)).thenReturn("true".getBytes());
assertThat(mController.isAvailable()).isFalse();
}
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothFeatureProviderImplTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothFeatureProviderImplTest.java
index a921215..9ab1d87 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothFeatureProviderImplTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothFeatureProviderImplTest.java
@@ -49,7 +49,8 @@
@Test
public void getBluetoothDeviceSettingsUri_containCorrectMacAddress() {
when(mBluetoothDevice.getMetadata(
- BluetoothDevice.METADATA_ENHANCED_SETTINGS_UI_URI)).thenReturn(SETTINGS_URI);
+ BluetoothDevice.METADATA_ENHANCED_SETTINGS_UI_URI)).thenReturn(
+ SETTINGS_URI.getBytes());
final Uri uri = mBluetoothFeatureProvider.getBluetoothDeviceSettingsUri(mBluetoothDevice);
assertThat(uri.toString()).isEqualTo(SETTINGS_URI);
}
diff --git a/tests/robotests/src/com/android/settings/bluetooth/UtilsTest.java b/tests/robotests/src/com/android/settings/bluetooth/UtilsTest.java
index ee79d61..1920019 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/UtilsTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/UtilsTest.java
@@ -43,14 +43,8 @@
@RunWith(RobolectricTestRunner.class)
public class UtilsTest {
- private static final String STRING_METADATA = "string_metadata";
- private static final String BOOL_METADATA = "true";
- private static final String INT_METADATA = "25";
-
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
private Context mContext;
- @Mock
- private BluetoothDevice mBluetoothDevice;
private MetricsFeatureProvider mMetricsFeatureProvider;
@@ -69,41 +63,4 @@
verify(mMetricsFeatureProvider).visible(eq(mContext), anyInt(),
eq(MetricsEvent.ACTION_SETTINGS_BLUETOOTH_CONNECT_ERROR));
}
-
- @Test
- public void getStringMetaData_hasMetaData_getCorrectMetaData() {
- when(mBluetoothDevice.getMetadata(
- BluetoothDevice.METADATA_UNTHETHERED_LEFT_ICON)).thenReturn(STRING_METADATA);
-
- assertThat(Utils.getStringMetaData(mBluetoothDevice,
- BluetoothDevice.METADATA_UNTHETHERED_LEFT_ICON)).isEqualTo(STRING_METADATA);
- }
-
- @Test
- public void getIntMetaData_hasMetaData_getCorrectMetaData() {
- when(mBluetoothDevice.getMetadata(
- BluetoothDevice.METADATA_UNTHETHERED_LEFT_BATTERY)).thenReturn(INT_METADATA);
-
- assertThat(Utils.getIntMetaData(mBluetoothDevice,
- BluetoothDevice.METADATA_UNTHETHERED_LEFT_BATTERY))
- .isEqualTo(Integer.parseInt(INT_METADATA));
- }
-
- @Test
- public void getIntMetaData_invalidMetaData_getErrorCode() {
- when(mBluetoothDevice.getMetadata(
- BluetoothDevice.METADATA_UNTHETHERED_LEFT_BATTERY)).thenReturn(STRING_METADATA);
-
- assertThat(Utils.getIntMetaData(mBluetoothDevice,
- BluetoothDevice.METADATA_UNTHETHERED_LEFT_ICON)).isEqualTo(Utils.META_INT_ERROR);
- }
-
- @Test
- public void getBooleanMetaData_hasMetaData_getCorrectMetaData() {
- when(mBluetoothDevice.getMetadata(
- BluetoothDevice.METADATA_IS_UNTHETHERED_HEADSET)).thenReturn(BOOL_METADATA);
-
- assertThat(Utils.getBooleanMetaData(mBluetoothDevice,
- BluetoothDevice.METADATA_IS_UNTHETHERED_HEADSET)).isEqualTo(true);
- }
}
diff --git a/tests/robotests/src/com/android/settings/homepage/contextualcards/ContextualCardFeatureProviderImplTest.java b/tests/robotests/src/com/android/settings/homepage/contextualcards/ContextualCardFeatureProviderImplTest.java
deleted file mode 100644
index 0683bd8..0000000
--- a/tests/robotests/src/com/android/settings/homepage/contextualcards/ContextualCardFeatureProviderImplTest.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.homepage.contextualcards;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.verify;
-
-import android.content.Context;
-import android.content.Intent;
-import android.net.Uri;
-import android.os.UserHandle;
-
-import com.android.settings.intelligence.ContextualCardProto.ContextualCardList;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.robolectric.RobolectricTestRunner;
-import org.robolectric.RuntimeEnvironment;
-import org.robolectric.annotation.Config;
-
-import java.util.ArrayList;
-import java.util.List;
-
-@RunWith(RobolectricTestRunner.class)
-public class ContextualCardFeatureProviderImplTest {
-
- private Context mContext;
- private ContextualCardFeatureProviderImpl mImpl;
-
- @Before
- public void setUp() {
- mContext = spy(RuntimeEnvironment.application);
- mImpl = new ContextualCardFeatureProviderImpl(mContext);
- }
-
- @Test
- public void sendBroadcast_emptyAction_notSendBroadcast() {
- final Intent intent = new Intent();
- mImpl.sendBroadcast(intent);
-
- verify(mContext, never()).sendBroadcastAsUser(intent, UserHandle.CURRENT);
- }
-
- @Test
- @Config(qualifiers = "mcc999")
- public void sendBroadcast_hasAction_sendBroadcast() {
- final Intent intent = new Intent();
- mImpl.sendBroadcast(intent);
-
- verify(mContext).sendBroadcastAsUser(intent, UserHandle.CURRENT);
- }
-
- @Test
- @Config(qualifiers = "mcc999")
- public void logContextualCardDisplay_hasAction_sendBroadcast() {
- mImpl.logContextualCardDisplay(new ArrayList<>(), new ArrayList<>());
-
- verify(mContext).sendBroadcastAsUser(any(Intent.class), any());
- }
-
- @Test
- public void serialize_hasSizeTwo_returnSizeTwo() {
- final List<ContextualCard> cards = new ArrayList<>();
- cards.add(new ContextualCard.Builder()
- .setName("name1")
- .setSliceUri(Uri.parse("uri1"))
- .build());
- cards.add(new ContextualCard.Builder()
- .setName("name2")
- .setSliceUri(Uri.parse("uri2"))
- .build());
-
-
- final byte[] data = mImpl.serialize(cards);
-
- try {
- assertThat(ContextualCardList
- .parseFrom(data).getCardCount()).isEqualTo(cards.size());
- } catch (Exception e) {
- throw new RuntimeException(e.getMessage());
- }
- }
-}
\ No newline at end of file
diff --git a/tests/robotests/src/com/android/settings/homepage/contextualcards/ContextualCardLoaderTest.java b/tests/robotests/src/com/android/settings/homepage/contextualcards/ContextualCardLoaderTest.java
index d3f6499..f025ee8 100644
--- a/tests/robotests/src/com/android/settings/homepage/contextualcards/ContextualCardLoaderTest.java
+++ b/tests/robotests/src/com/android/settings/homepage/contextualcards/ContextualCardLoaderTest.java
@@ -197,8 +197,8 @@
mContextualCardLoader.getDisplayableCards(new ArrayList<>());
- verify(mFakeFeatureFactory.mContextualCardFeatureProvider, never())
- .logContextualCardDisplay(anyList(), anyList());
+ verify(mFakeFeatureFactory.metricsFeatureProvider, never()).action(any(),
+ eq(SettingsEnums.ACTION_CONTEXTUAL_CARD_SHOW), any(String.class));
}
private ContextualCard getContextualCard(String sliceUri) {
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 9759f98..895492e 100644
--- a/tests/robotests/src/com/android/settings/homepage/contextualcards/ContextualCardManagerTest.java
+++ b/tests/robotests/src/com/android/settings/homepage/contextualcards/ContextualCardManagerTest.java
@@ -26,7 +26,9 @@
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyMap;
import static org.mockito.ArgumentMatchers.nullable;
+import static org.mockito.Mockito.atLeast;
import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
@@ -38,6 +40,7 @@
import android.provider.Settings;
import android.util.ArrayMap;
+import com.android.settings.homepage.contextualcards.conditional.ConditionContextualCardController;
import com.android.settings.homepage.contextualcards.conditional.ConditionFooterContextualCard;
import com.android.settings.homepage.contextualcards.conditional.ConditionHeaderContextualCard;
import com.android.settings.homepage.contextualcards.conditional.ConditionalContextualCard;
@@ -45,6 +48,8 @@
import com.android.settings.slices.CustomSliceRegistry;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
+import com.android.settingslib.core.lifecycle.events.OnStart;
+import com.android.settingslib.core.lifecycle.events.OnStop;
import org.junit.Before;
import org.junit.Test;
@@ -312,6 +317,74 @@
}
@Test
+ public void onWindowFocusChanged_hasFocusAndNoConditional_startMonitoringConditionCard() {
+ final ContextualCardManager manager = spy(mManager);
+ final ControllerRendererPool pool = spy(mManager.mControllerRendererPool);
+ doReturn(pool).when(manager).getControllerRendererPool();
+ final ConditionContextualCardController conditionController =
+ pool.getController(mContext,
+ ContextualCard.CardType.CONDITIONAL);
+ final OnStart controller = spy((OnStart)conditionController);
+ doReturn(controller).when(pool).getController(mContext, ContextualCard.CardType.CONDITIONAL);
+
+ manager.onWindowFocusChanged(true /* hasWindowFocus */);
+
+ verify(controller, atLeast(1)).onStart();
+ }
+
+ @Test
+ public void onWindowFocusChanged_hasFocusAndHasConditionals_startMonitoringConditionCard() {
+ mManager.mContextualCards.add(new ConditionalContextualCard.Builder().build());
+ mManager.mContextualCards.add(new ConditionFooterContextualCard.Builder().build());
+ final ContextualCardManager manager = spy(mManager);
+ final ControllerRendererPool pool = spy(mManager.mControllerRendererPool);
+ doReturn(pool).when(manager).getControllerRendererPool();
+ final ConditionContextualCardController conditionController =
+ pool.getController(mContext,
+ ContextualCard.CardType.CONDITIONAL);
+ final OnStart controller = spy((OnStart)conditionController);
+ doReturn(controller).when(pool).getController(mContext, ContextualCard.CardType.CONDITIONAL);
+
+ manager.onWindowFocusChanged(true /* hasWindowFocus */);
+
+ verify(controller, atLeast(2)).onStart();
+ }
+
+ @Test
+ public void onWindowFocusChanged_loseFocusAndHasConditionals_stopMonitoringConditionCard() {
+ mManager.mContextualCards.add(new ConditionalContextualCard.Builder().build());
+ mManager.mContextualCards.add(new ConditionFooterContextualCard.Builder().build());
+ final ContextualCardManager manager = spy(mManager);
+ final ControllerRendererPool pool = spy(mManager.mControllerRendererPool);
+ doReturn(pool).when(manager).getControllerRendererPool();
+ final ConditionContextualCardController conditionController =
+ pool.getController(mContext,
+ ContextualCard.CardType.CONDITIONAL);
+ final OnStop controller = spy((OnStop) conditionController);
+ doReturn(controller).when(pool).getController(mContext, ContextualCard.CardType.CONDITIONAL);
+
+ manager.onWindowFocusChanged(false /* hasWindowFocus */);
+
+ verify(controller, atLeast(2)).onStop();
+ }
+
+ @Test
+ public void onWindowFocusChanged_loseFocusAndNoConditional_stopMonitoringConditionCard() {
+ final ContextualCardManager manager = spy(mManager);
+ final ControllerRendererPool pool = spy(mManager.mControllerRendererPool);
+ doReturn(pool).when(manager).getControllerRendererPool();
+ final ConditionContextualCardController conditionController =
+ pool.getController(mContext,
+ ContextualCard.CardType.CONDITIONAL);
+ final OnStop controller = spy((OnStop) conditionController);
+ doReturn(controller).when(pool).getController(mContext, ContextualCard.CardType.CONDITIONAL);
+
+ manager.onWindowFocusChanged(false /* hasWindowFocus */);
+
+ verify(controller, atLeast(1)).onStop();
+ }
+
+ @Test
public void getCardsWithViewType_noSuggestionCards_shouldNotHaveHalfCards() {
final List<Integer> categories = Arrays.asList(
ContextualCardProto.ContextualCard.Category.IMPORTANT_VALUE,
diff --git a/tests/robotests/src/com/android/settings/network/telephony/RenameMobileNetworkDialogFragmentTest.java b/tests/robotests/src/com/android/settings/network/telephony/RenameMobileNetworkDialogFragmentTest.java
index df52302..70816ea 100644
--- a/tests/robotests/src/com/android/settings/network/telephony/RenameMobileNetworkDialogFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/network/telephony/RenameMobileNetworkDialogFragmentTest.java
@@ -102,7 +102,7 @@
final Button negativeButton = dialog.getButton(DialogInterface.BUTTON_NEGATIVE);
negativeButton.performClick();
- verify(mSubscriptionMgr, never()).setDisplayName(anyString(), anyInt());
+ verify(mSubscriptionMgr, never()).setDisplayName(anyString(), anyInt(), anyInt());
}
@Test
@@ -118,7 +118,8 @@
positiveButton.performClick();
final ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class);
- verify(mSubscriptionMgr).setDisplayName(captor.capture(), eq(mSubscriptionId));
+ verify(mSubscriptionMgr).setDisplayName(captor.capture(), eq(mSubscriptionId),
+ eq(SubscriptionManager.NAME_SOURCE_USER_INPUT));
assertThat(captor.getValue()).isEqualTo("test2");
}
diff --git a/tests/robotests/src/com/android/settings/notification/AssistantCapabilityPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/AssistantCapabilityPreferenceControllerTest.java
index 182ce8a..397b72e 100644
--- a/tests/robotests/src/com/android/settings/notification/AssistantCapabilityPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/notification/AssistantCapabilityPreferenceControllerTest.java
@@ -101,7 +101,7 @@
public void isChecked_prioritizerSettingIsOff_false() {
List<String> capabilities = new ArrayList<>();
capabilities.add(Adjustment.KEY_USER_SENTIMENT);
- when(mBackend.getAssistantCapabilities(anyString())).thenReturn(capabilities);
+ when(mBackend.getAssistantAdjustments(anyString())).thenReturn(capabilities);
assertThat(mPrioritizerController.isChecked()).isFalse();
}
@@ -109,7 +109,7 @@
public void isChecked_prioritizerSettingIsOn_true() {
List<String> capabilities = new ArrayList<>();
capabilities.add(Adjustment.KEY_IMPORTANCE);
- when(mBackend.getAssistantCapabilities(anyString())).thenReturn(capabilities);
+ when(mBackend.getAssistantAdjustments(anyString())).thenReturn(capabilities);
assertThat(mPrioritizerController.isChecked()).isTrue();
}
@@ -117,17 +117,17 @@
public void isChecked_chipSettingIsOff_false() {
List<String> capabilities = new ArrayList<>();
capabilities.add(Adjustment.KEY_IMPORTANCE);
- when(mBackend.getAssistantCapabilities(anyString())).thenReturn(capabilities);
+ when(mBackend.getAssistantAdjustments(anyString())).thenReturn(capabilities);
assertThat(mChipController.isChecked()).isFalse();
capabilities = new ArrayList<>();
capabilities.add(Adjustment.KEY_CONTEXTUAL_ACTIONS);
- when(mBackend.getAssistantCapabilities(anyString())).thenReturn(capabilities);
+ when(mBackend.getAssistantAdjustments(anyString())).thenReturn(capabilities);
assertThat(mChipController.isChecked()).isFalse();
capabilities = new ArrayList<>();
capabilities.add(Adjustment.KEY_TEXT_REPLIES);
- when(mBackend.getAssistantCapabilities(anyString())).thenReturn(capabilities);
+ when(mBackend.getAssistantAdjustments(anyString())).thenReturn(capabilities);
assertThat(mChipController.isChecked()).isFalse();
}
@@ -136,34 +136,34 @@
List<String> capabilities = new ArrayList<>();
capabilities.add(Adjustment.KEY_TEXT_REPLIES);
capabilities.add(Adjustment.KEY_CONTEXTUAL_ACTIONS);
- when(mBackend.getAssistantCapabilities(anyString())).thenReturn(capabilities);
+ when(mBackend.getAssistantAdjustments(anyString())).thenReturn(capabilities);
assertThat(mChipController.isChecked()).isTrue();
}
@Test
public void onPreferenceChange_prioritizerOn() {
mPrioritizerController.onPreferenceChange(mPrioritizerPreference, true);
- verify(mBackend).allowAssistantCapability(Adjustment.KEY_IMPORTANCE, true);
+ verify(mBackend).allowAssistantAdjustment(Adjustment.KEY_IMPORTANCE, true);
}
@Test
public void onPreferenceChange_prioritizerOff() {
mPrioritizerController.onPreferenceChange(mPrioritizerPreference, false);
- verify(mBackend).allowAssistantCapability(Adjustment.KEY_IMPORTANCE, false);
+ verify(mBackend).allowAssistantAdjustment(Adjustment.KEY_IMPORTANCE, false);
}
@Test
public void onPreferenceChange_chipsOn() {
mChipController.onPreferenceChange(mChipPreference, true);
- verify(mBackend).allowAssistantCapability(Adjustment.KEY_CONTEXTUAL_ACTIONS, true);
- verify(mBackend).allowAssistantCapability(Adjustment.KEY_TEXT_REPLIES, true);
+ verify(mBackend).allowAssistantAdjustment(Adjustment.KEY_CONTEXTUAL_ACTIONS, true);
+ verify(mBackend).allowAssistantAdjustment(Adjustment.KEY_TEXT_REPLIES, true);
}
@Test
public void onPreferenceChange_chipsOff() {
mChipController.onPreferenceChange(mChipPreference, false);
- verify(mBackend).allowAssistantCapability(Adjustment.KEY_CONTEXTUAL_ACTIONS, false);
- verify(mBackend).allowAssistantCapability(Adjustment.KEY_TEXT_REPLIES, false);
+ verify(mBackend).allowAssistantAdjustment(Adjustment.KEY_CONTEXTUAL_ACTIONS, false);
+ verify(mBackend).allowAssistantAdjustment(Adjustment.KEY_TEXT_REPLIES, false);
}
}