Merge "Prevent app bar title from drawing twice" into sc-dev
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 86d7992..6ac1ac9 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -954,12 +954,29 @@
<category android:name="com.android.settings.SHORTCUT" />
</intent-filter>
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
- android:value="com.android.settings.display.SmartAutoRotatePreferenceFragment" />
+ android:value="com.android.settings.DisplaySettings" />
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
android:value="true" />
</activity>
<activity
+ android:name="Settings$SmartAutoRotateSettingsActivity"
+ android:label="@string/accelerometer_title"
+ android:icon="@drawable/ic_homepage_notification"
+ android:exported="true">
+ <intent-filter android:priority="1">
+ <action android:name="android.settings.AUTO_ROTATE_SETTINGS" />
+ <category android:name="android.intent.category.DEFAULT" />
+ </intent-filter>
+ <intent-filter android:priority="32">
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="com.android.settings.SHORTCUT" />
+ </intent-filter>
+ <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
+ android:value="com.android.settings.display.SmartAutoRotatePreferenceFragment" />
+ </activity>
+
+ <activity
android:name="Settings$NightDisplaySettingsActivity"
android:label="@string/night_display_title"
android:enabled="@*android:bool/config_nightDisplayAvailable"
diff --git a/res/layout-land/fingerprint_enroll_enrolling.xml b/res/layout-land/fingerprint_enroll_enrolling.xml
deleted file mode 100644
index 184c9c6..0000000
--- a/res/layout-land/fingerprint_enroll_enrolling.xml
+++ /dev/null
@@ -1,135 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2015 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
- -->
-
-<com.google.android.setupdesign.GlifLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/setup_wizard_layout"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout="@layout/sud_glif_blank_template"
- style="?attr/fingerprint_layout_theme">
-
- <ScrollView
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:fillViewport="true">
- <LinearLayout
- style="@style/SudContentFrame"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="horizontal"
- android:clipToPadding="false"
- android:clipChildren="false"
- android:paddingBottom="0dp">
-
- <!-- Both texts are kept as separate text views so it doesn't jump around in portrait.
- See layouts/fingerprint_enroll_enrolling_base.xml. -->
- <LinearLayout
- android:layout_width="0dp"
- android:layout_weight="1"
- android:layout_height="match_parent"
- android:layout_marginStart="?attr/sudMarginStart"
- android:layout_marginBottom="@dimen/sud_content_frame_padding_bottom"
- android:clipChildren="false"
- android:clipToPadding="false"
- android:orientation="vertical">
-
- <ImageView
- android:id="@+id/sud_layout_icon"
- style="@style/SudGlifIcon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="?attr/sudGlifHeaderGravity"
- android:layout_marginStart="0dp"
- android:layout_marginEnd="0dp"
- android:src="@drawable/ic_fingerprint_header" />
-
- <TextView
- android:id="@+id/suc_layout_title"
- style="@style/SudGlifHeaderTitle"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginStart="0dp"
- android:layout_marginEnd="0dp" />
-
- <FrameLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
-
- <TextView
- style="@style/SudDescription.Glif"
- android:id="@+id/sud_layout_description"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="@string/security_settings_fingerprint_enroll_start_message"/>
-
- <TextView
- style="@style/SudDescription.Glif"
- android:id="@+id/repeat_message"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="@string/security_settings_fingerprint_enroll_repeat_message"
- android:visibility="invisible"/>
-
- </FrameLayout>
-
- <Space
- android:layout_width="0dp"
- android:layout_height="0dp"
- android:layout_weight="1" />
-
- </LinearLayout>
-
- <LinearLayout
- android:layout_width="0dp"
- android:layout_weight="1"
- android:layout_height="match_parent"
- android:gravity="center"
- android:orientation="vertical">
-
- <com.google.android.setupdesign.view.FillContentLayout
- android:layout_width="wrap_content"
- android:layout_height="0dp"
- android:layout_marginVertical="24dp"
- android:layout_weight="1"
- android:paddingTop="0dp"
- android:paddingBottom="0dp">
-
- <include layout="@layout/fingerprint_enroll_enrolling_content"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_gravity="center" />
- </com.google.android.setupdesign.view.FillContentLayout>
-
- <TextView
- style="@style/TextAppearance.ErrorText"
- android:id="@+id/error_text"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginBottom="16dp"
- android:layout_gravity="center_horizontal|bottom"
- android:accessibilityLiveRegion="polite"
- android:gravity="center_horizontal"
- android:paddingEnd="5dp"
- android:paddingStart="5dp"
- android:visibility="invisible"/>
-
- </LinearLayout>
-
- </LinearLayout>
- </ScrollView>
-</com.google.android.setupdesign.GlifLayout>
diff --git a/res/layout-land/fingerprint_enroll_finish.xml b/res/layout-land/fingerprint_enroll_finish.xml
deleted file mode 100644
index 4159516..0000000
--- a/res/layout-land/fingerprint_enroll_finish.xml
+++ /dev/null
@@ -1,92 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2015 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
- -->
-
-<com.google.android.setupdesign.GlifLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/setup_wizard_layout"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout="@layout/sud_glif_blank_template"
- style="?attr/fingerprint_layout_theme">
-
- <ScrollView
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:fillViewport="true">
-
- <LinearLayout
- style="@style/SudContentFrame"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="horizontal"
- android:clipToPadding="false"
- android:clipChildren="false">
-
- <LinearLayout
- android:layout_width="0dp"
- android:layout_weight="1"
- android:layout_height="match_parent"
- android:clipChildren="false"
- android:clipToPadding="false"
- android:orientation="vertical">
-
- <ImageView
- android:id="@+id/sud_layout_icon"
- style="@style/SudGlifIcon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="?attr/sudGlifHeaderGravity"
- android:layout_marginLeft="0dp"
- android:layout_marginRight="0dp"
- android:contentDescription="@null"
- android:src="@drawable/ic_fingerprint_header"/>
-
- <TextView
- android:id="@+id/suc_layout_title"
- style="@style/SudGlifHeaderTitle"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginLeft="0dp"
- android:layout_marginRight="0dp"/>
-
- <TextView
- android:id="@+id/sud_layout_description"
- style="@style/SudDescription.Glif"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="@string/security_settings_fingerprint_enroll_finish_message"/>
-
- </LinearLayout>
-
- <com.google.android.setupdesign.view.FillContentLayout
- android:layout_width="0dp"
- android:layout_weight="1"
- android:layout_height="match_parent">
-
- <ImageView
- android:id="@+id/fingerprint_in_app_indicator"
- style="@style/SudContentIllustration"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:contentDescription="@android:string/fingerprint_icon_content_description"
- android:src="@drawable/fingerprint_enroll_finish" />
-
- </com.google.android.setupdesign.view.FillContentLayout>
-
- </LinearLayout>
- </ScrollView>
-</com.google.android.setupdesign.GlifLayout>
diff --git a/res/layout/fingerprint_enroll_enrolling_base.xml b/res/layout/fingerprint_enroll_enrolling_base.xml
index e1a9707..a0805ba 100644
--- a/res/layout/fingerprint_enroll_enrolling_base.xml
+++ b/res/layout/fingerprint_enroll_enrolling_base.xml
@@ -30,31 +30,6 @@
android:clipToPadding="false"
android:clipChildren="false">
- <!-- Make both texts included for layout, so the lower part doesn't jump around when we
- switch the text -->
- <FrameLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
-
- <TextView
- style="@style/SudDescription.Glif"
- android:id="@+id/sud_layout_description"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:minLines="3"
- android:text="@string/security_settings_fingerprint_enroll_start_message"/>
-
- <TextView
- style="@style/SudDescription.Glif"
- android:id="@+id/repeat_message"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:minLines="3"
- android:text="@string/security_settings_fingerprint_enroll_repeat_message"
- android:visibility="invisible"/>
-
- </FrameLayout>
-
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
diff --git a/res/layout/fingerprint_enroll_finish_base.xml b/res/layout/fingerprint_enroll_finish_base.xml
index 1f9167e..262374d 100644
--- a/res/layout/fingerprint_enroll_finish_base.xml
+++ b/res/layout/fingerprint_enroll_finish_base.xml
@@ -30,15 +30,6 @@
android:clipToPadding="false"
android:clipChildren="false">
- <TextView
- android:id="@+id/sud_layout_description"
- style="@style/SudDescription.Glif"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="@dimen/sud_description_glif_margin_top"
- android:minLines="3"
- android:text="@string/security_settings_fingerprint_enroll_finish_message"/>
-
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
diff --git a/res/layout/udfps_enroll_enrolling.xml b/res/layout/udfps_enroll_enrolling.xml
index 6b3382c..67c127b 100644
--- a/res/layout/udfps_enroll_enrolling.xml
+++ b/res/layout/udfps_enroll_enrolling.xml
@@ -30,28 +30,6 @@
android:clipChildren="false"
android:orientation="vertical">
- <FrameLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
-
- <TextView
- android:id="@+id/sud_layout_description"
- style="@style/SudDescription.Glif"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:minLines="3"
- android:text="@string/security_settings_fingerprint_enroll_start_message" />
-
- <TextView
- android:id="@+id/repeat_message"
- style="@style/SudDescription.Glif"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="@string/security_settings_fingerprint_enroll_repeat_message"
- android:visibility="invisible" />
-
- </FrameLayout>
-
<TextView
android:id="@+id/error_text"
style="@style/TextAppearance.ErrorText"
diff --git a/res/layout/wifi_dialog.xml b/res/layout/wifi_dialog.xml
index 2cc6c8a..6f83e5c 100644
--- a/res/layout/wifi_dialog.xml
+++ b/res/layout/wifi_dialog.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
-<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/dialog_scrollview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -704,4 +704,4 @@
</LinearLayout>
</LinearLayout>
</LinearLayout>
-</ScrollView>
+</androidx.core.widget.NestedScrollView>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 7a8c5c3..9bae3a5 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -102,8 +102,7 @@
<!-- Disclaimer for camera based rotate [CHAR_LIMIT=NONE] -->
<string name="smart_rotate_text_headline">
- Face based Autorotate uses the front camera to see if and how someone is looking at the screen. It allows
- for reading while lying down and images are never stored or sent to Google.<br><br>
+ Face Detection uses the front-facing camera to improve Auto-Rotate accuracy. Images are never stored or sent to Google.<br><br>
<a href="<xliff:g example="http://www.google.com" id="url">http://support.google.com/mobile?p=telephony_rtt</xliff:g>">Learn more</a>
</string>
<string name="font_size_preview_text_headline">Sample text</string>
@@ -963,10 +962,18 @@
<string name="security_settings_fingerprint_enroll_start_title">Touch the sensor</string>
<!-- Message shown in fingerprint enrollment dialog to begin enrollment [CHAR LIMIT=NONE] -->
<string name="security_settings_fingerprint_enroll_start_message">Put your finger on the sensor and lift after you feel a vibration</string>
+ <!-- Message shown in fingerprint enrollment dialog to begin enrollment [CHAR LIMIT=NONE] -->
+ <string name="security_settings_udfps_enroll_start_message">Each time you touch, keep your finger on the icon until you feel a vibration</string>
<!-- Title shown in fingerprint enrollment dialog to repeat touching the fingerprint sensor [CHAR LIMIT=40] -->
<string name="security_settings_fingerprint_enroll_repeat_title">Lift, then touch again</string>
+ <!-- Title shown in fingerprint enrollment dialog to repeat touching the fingerprint sensor [CHAR LIMIT=40] -->
+ <string name="security_settings_udfps_enroll_title_one_more_time">One more time</string>
+ <!-- Title shown in fingerprint enrollment dialog to repeat touching the fingerprint sensor [CHAR LIMIT=60] -->
+ <string name="security_settings_udfps_enroll_repeat_title_touch_icon">Touch the fingerprint icon as it moves</string>
<!-- Message shown in fingerprint enrollment dialog to repeat touching the fingerprint sensor [CHAR LIMIT=NONE] -->
<string name="security_settings_fingerprint_enroll_repeat_message">Keep lifting your finger to add the different parts of your fingerprint</string>
+ <!-- Message shown in fingerprint enrollment dialog to repeat touching the fingerprint sensor [CHAR LIMIT=NONE] -->
+ <string name="security_settings_udfps_enroll_repeat_message">This helps capture your full fingerprint</string>
<!-- Title shown in fingerprint enrollment dialog once enrollment is completed [CHAR LIMIT=29] -->
<string name="security_settings_fingerprint_enroll_finish_title">Fingerprint added</string>
<!-- Message shown in fingerprint enrollment dialog once enrollment is completed -->
@@ -3999,7 +4006,7 @@
<string name="managed_profile_location_switch_title">Location for work profile</string>
<!-- [CHAR LIMIT=30] Location settings screen. It's a link that directs the user to a page that
shows the location permission setting for each installed app -->
- <string name="location_app_level_permissions">App access to location</string>
+ <string name="location_app_level_permissions">Manage location permissions</string>
<!-- Summary for app permission on Location settings page when location is off [CHAR LIMIT=NONE] -->
<string name="location_app_permission_summary_location_off">Location is off</string>
<!--
@@ -4024,7 +4031,9 @@
apps have access to location</item>
</plurals>
<!-- [CHAR LIMIT=50] Location settings screen, sub category for recent location access -->
- <string name="location_category_recent_location_access">Recent location access</string>
+ <string name="location_category_recent_location_access">Past 24 hour access</string>
+ <!-- Location settings screen, displayed when there're more than three recent location access apps [CHAR LIMIT=30] -->
+ <string name="location_recent_location_access_see_all">See all</string>
<!-- [CHAR LIMIT=30] Location settings screen, button to bring the user to view the details of recent location access -->
<string name="location_recent_location_access_view_details">View details</string>
<!-- Location settings screen, displayed when there's no recent app accessing location
diff --git a/res/xml/location_recent_access_see_all.xml b/res/xml/location_recent_access_see_all.xml
new file mode 100644
index 0000000..97b71ec
--- /dev/null
+++ b/res/xml/location_recent_access_see_all.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2021 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.
+-->
+<PreferenceScreen
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:settings="http://schemas.android.com/apk/res-auto"
+ android:title="@string/location_category_recent_location_access"
+ android:key="all_recent_location_access"
+ settings:controller="com.android.settings.location.RecentLocationAccessSeeAllPreferenceController">
+
+</PreferenceScreen>
diff --git a/res/xml/location_services.xml b/res/xml/location_services.xml
index 7096d2c..ef94886 100644
--- a/res/xml/location_services.xml
+++ b/res/xml/location_services.xml
@@ -33,6 +33,6 @@
<PreferenceCategory
android:key="location_services"
android:layout="@layout/preference_category_no_label"
- settings:controller="com.android.settings.location.LocationServicePreferenceController"/>
+ settings:controller="com.android.settings.location.LocationInjectedServicesPreferenceController"/>
</PreferenceScreen>
diff --git a/res/xml/location_services_workprofile.xml b/res/xml/location_services_workprofile.xml
new file mode 100644
index 0000000..6db2083
--- /dev/null
+++ b/res/xml/location_services_workprofile.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2021 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.
+-->
+
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:settings="http://schemas.android.com/apk/res-auto"
+ android:title="@string/location_services_screen_title">
+
+ <PreferenceCategory
+ android:title="@string/managed_profile_location_services"
+ android:layout="@layout/preference_category_no_label"
+ android:key="location_services_managed_profile"
+ settings:controller="com.android.settings.location.LocationInjectedServicesForWorkPreferenceController"/>
+
+</PreferenceScreen>
diff --git a/res/xml/location_settings.xml b/res/xml/location_settings.xml
index 7a79136..1646b1d 100644
--- a/res/xml/location_settings.xml
+++ b/res/xml/location_settings.xml
@@ -27,6 +27,13 @@
settings:controller=
"com.android.settings.location.RecentLocationAccessPreferenceController"/>
+ <Preference
+ android:key="recent_location_access_see_all_button"
+ android:title="@string/location_recent_location_access_see_all"
+ android:icon="@drawable/ic_chevron_right_24dp"
+ android:fragment="com.android.settings.location.RecentLocationAccessSeeAllFragment"
+ settings:searchable="false"/>
+
<PreferenceCategory
android:key="location_advanced_settings"
android:layout="@layout/preference_category_no_label"
@@ -47,7 +54,7 @@
android:fragment="com.android.settings.location.LocationServices"
android:key="location_services"
android:title="@string/location_services_screen_title"
- settings:controller="com.android.settings.location.LocationScanningPreferenceController"/>
+ settings:controller="com.android.settings.location.LocationServicesPreferenceController"/>
<!-- This preference gets removed if there is no managed profile -->
<com.android.settingslib.RestrictedSwitchPreference
@@ -64,7 +71,7 @@
android:key="location_services_managed_profile"
android:title="@string/managed_profile_location_services"
settings:forWork="true"
- settings:controller="com.android.settings.location.LocationServiceForWorkPreferenceController"/>
+ settings:controller="com.android.settings.location.LocationInjectedServicesForWorkPreferenceController"/>
</PreferenceCategory>
diff --git a/res/xml/location_settings_personal.xml b/res/xml/location_settings_personal.xml
index 2e1cb7e..479c61f 100644
--- a/res/xml/location_settings_personal.xml
+++ b/res/xml/location_settings_personal.xml
@@ -23,11 +23,18 @@
settings:keywords="@string/keywords_location">
<PreferenceCategory
- android:key="recent_location_requests"
- android:title="@string/location_category_recent_location_requests"
+ android:key="recent_location_access"
+ android:title="@string/location_category_recent_location_access"
settings:controller=
"com.android.settings.location.RecentLocationAccessPreferenceController"/>
+ <Preference
+ android:key="recent_location_access_see_all_button"
+ android:title="@string/location_recent_location_access_see_all"
+ android:icon="@drawable/ic_chevron_right_24dp"
+ android:fragment="com.android.settings.location.RecentLocationAccessSeeAllFragment"
+ settings:searchable="false"/>
+
<!-- This preference category gets removed if new_recent_location_ui is disabled -->
<Preference
android:key="app_level_permissions"
@@ -43,7 +50,7 @@
android:key="location_services"
android:title="@string/location_services_screen_title"
android:fragment="com.android.settings.location.LocationServices"
- settings:controller="com.android.settings.location.LocationScanningPreferenceController"/>
+ settings:controller="com.android.settings.location.LocationServicesPreferenceController"/>
<PreferenceCategory
android:key="location_footer"
diff --git a/res/xml/location_settings_workprofile.xml b/res/xml/location_settings_workprofile.xml
index f6f2d96..40a822c 100644
--- a/res/xml/location_settings_workprofile.xml
+++ b/res/xml/location_settings_workprofile.xml
@@ -23,11 +23,20 @@
settings:keywords="@string/keywords_location">
<PreferenceCategory
- android:key="recent_location_requests"
- android:title="@string/location_category_recent_location_requests"
+ android:key="recent_location_access"
+ android:title="@string/location_category_recent_location_access"
settings:controller=
"com.android.settings.location.RecentLocationAccessPreferenceController"/>
+ <Preference
+ android:key="recent_location_access_see_all_button"
+ android:title="@string/location_recent_location_access_see_all"
+ android:icon="@drawable/ic_chevron_right_24dp"
+ android:fragment="com.android.settings.location.RecentLocationAccessSeeAllFragment"
+ settings:controller="com.android.settings.core.WorkPreferenceController"
+ settings:forWork="true"
+ settings:searchable="false"/>
+
<com.android.settingslib.RestrictedSwitchPreference
android:key="managed_profile_location_switch"
android:title="@string/managed_profile_location_switch_title"
@@ -46,11 +55,11 @@
</intent>
</Preference>
- <PreferenceCategory
- android:title="@string/managed_profile_location_services"
- android:layout="@layout/preference_category_no_label"
- android:key="location_services_managed_profile"
- settings:controller="com.android.settings.location.LocationServiceForWorkPreferenceController"/>
+ <Preference
+ android:key="location_services_for_work"
+ android:title="@string/location_services_screen_title"
+ android:fragment="com.android.settings.location.LocationServicesForWork"
+ settings:controller="com.android.settings.location.LocationServicesForWorkPreferenceController"/>
<PreferenceCategory
android:key="location_footer"
diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java
index 8f71507..cf43827 100644
--- a/src/com/android/settings/Settings.java
+++ b/src/com/android/settings/Settings.java
@@ -97,6 +97,7 @@
public static class DisplaySettingsActivity extends SettingsActivity { /* empty */ }
public static class NightDisplaySettingsActivity extends SettingsActivity { /* empty */ }
public static class NightDisplaySuggestionActivity extends NightDisplaySettingsActivity { /* empty */ }
+ public static class SmartAutoRotateSettingsActivity extends SettingsActivity { /* empty */ }
public static class MyDeviceInfoActivity extends SettingsActivity { /* empty */ }
public static class ModuleLicensesActivity extends SettingsActivity { /* empty */ }
public static class ApplicationSettingsActivity extends SettingsActivity { /* empty */ }
diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java
index 1b2a6a5..b403e42 100644
--- a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java
+++ b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java
@@ -52,7 +52,6 @@
import com.google.android.setupcompat.template.FooterBarMixin;
import com.google.android.setupcompat.template.FooterButton;
-import com.google.android.setupdesign.util.DescriptionStyler;
import java.util.List;
@@ -66,6 +65,10 @@
private static final int PROGRESS_BAR_MAX = 10000;
private static final int FINISH_DELAY = 250;
+ /**
+ * Enroll with two center touches before going to guided enrollment.
+ */
+ private static final int NUM_CENTER_TOUCHES = 2;
/**
* If we don't see progress during this time, we show an error message to remind the users that
@@ -95,8 +98,6 @@
private boolean mCanAssumeUdfps;
@Nullable private ProgressBar mProgressBar;
private ObjectAnimator mProgressAnim;
- private TextView mStartMessage;
- private TextView mRepeatMessage;
private TextView mErrorText;
private Interpolator mFastOutSlowInInterpolator;
private Interpolator mLinearOutSlowInInterpolator;
@@ -145,23 +146,18 @@
if (mCanAssumeUdfps) {
setContentView(R.layout.udfps_enroll_enrolling);
+ setDescriptionText(R.string.security_settings_udfps_enroll_start_message);
} else {
setContentView(R.layout.fingerprint_enroll_enrolling);
+ setDescriptionText(R.string.security_settings_fingerprint_enroll_start_message);
}
setHeaderText(R.string.security_settings_fingerprint_enroll_repeat_title);
- mStartMessage = findViewById(R.id.sud_layout_description);
- mRepeatMessage = findViewById(R.id.repeat_message);
mErrorText = findViewById(R.id.error_text);
mProgressBar = findViewById(R.id.fingerprint_progress_bar);
mVibrator = getSystemService(Vibrator.class);
- if (getLayout().shouldApplyPartnerHeavyThemeResource()) {
- DescriptionStyler.applyPartnerCustomizationHeavyStyle(mRepeatMessage);
- } else if (getLayout().shouldApplyPartnerResource()) {
- DescriptionStyler.applyPartnerCustomizationLightStyle(mRepeatMessage);
- }
mFooterBarMixin = getLayout().getMixin(FooterBarMixin.class);
mFooterBarMixin.setSecondaryButton(
new FooterButton.Builder(this)
@@ -229,7 +225,7 @@
protected void onStart() {
super.onStart();
updateProgress(false /* animate */);
- updateDescription();
+ updateTitleAndDescription();
if (mRestoring) {
startIconAnimation();
}
@@ -297,16 +293,34 @@
return new Intent(this, FingerprintEnrollFinish.class);
}
- private void updateDescription() {
+ private void updateTitleAndDescription() {
if (mSidecar == null || mSidecar.getEnrollmentSteps() == -1) {
- mStartMessage.setVisibility(View.VISIBLE);
- mRepeatMessage.setVisibility(View.INVISIBLE);
+ if (mCanAssumeUdfps) {
+ setDescriptionText(R.string.security_settings_udfps_enroll_start_message);
+ } else {
+ setDescriptionText(R.string.security_settings_fingerprint_enroll_start_message);
+ }
+ } else if (mCanAssumeUdfps && !isCenterEnrollmentComplete()) {
+ setHeaderText(R.string.security_settings_udfps_enroll_title_one_more_time);
+ setDescriptionText(R.string.security_settings_udfps_enroll_start_message);
} else {
- mStartMessage.setVisibility(View.INVISIBLE);
- mRepeatMessage.setVisibility(View.VISIBLE);
+ if (mCanAssumeUdfps) {
+ setHeaderText(R.string.security_settings_udfps_enroll_repeat_title_touch_icon);
+ setDescriptionText(R.string.security_settings_udfps_enroll_repeat_message);
+ } else {
+ setDescriptionText(R.string.security_settings_fingerprint_enroll_repeat_message);
+ }
}
}
+ private boolean isCenterEnrollmentComplete() {
+ if (mSidecar == null || mSidecar.getEnrollmentSteps() == -1) {
+ return false;
+ }
+ final int stepsEnrolled = mSidecar.getEnrollmentSteps() - mSidecar.getEnrollmentRemaining();
+ return stepsEnrolled >= NUM_CENTER_TOUCHES;
+ }
+
@Override
public void onEnrollmentHelp(int helpMsgId, CharSequence helpString) {
if (!TextUtils.isEmpty(helpString)) {
@@ -337,7 +351,7 @@
@Override
public void onEnrollmentProgressChange(int steps, int remaining) {
updateProgress(true /* animate */);
- updateDescription();
+ updateTitleAndDescription();
clearError();
animateFlash();
mErrorText.removeCallbacks(mTouchAgainRunnable);
diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFinish.java b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFinish.java
index 3adbd0d..481da1b 100644
--- a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFinish.java
+++ b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFinish.java
@@ -55,6 +55,7 @@
super.onCreate(savedInstanceState);
setContentView(R.layout.fingerprint_enroll_finish);
setHeaderText(R.string.security_settings_fingerprint_enroll_finish_title);
+ setDescriptionText(R.string.security_settings_fingerprint_enroll_finish_message);
mFooterBarMixin = getLayout().getMixin(FooterBarMixin.class);
mFooterBarMixin.setSecondaryButton(
diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java b/src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java
index 88920ad..1d2793a 100644
--- a/src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java
+++ b/src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java
@@ -230,7 +230,10 @@
protected void handleError(int errMsgId, CharSequence msg) {
switch (errMsgId) {
case FingerprintManager.FINGERPRINT_ERROR_CANCELED:
- return; // Only happens if we get preempted by another activity. Ignored.
+ case FingerprintManager.FINGERPRINT_ERROR_USER_CANCELED:
+ // Only happens if we get preempted by another activity, or canceled by the
+ // user (e.g. swipe up to home). Ignored.
+ return;
case FingerprintManager.FINGERPRINT_ERROR_LOCKOUT:
mInFingerprintLockout = true;
// We've been locked out. Reset after 30s.
diff --git a/src/com/android/settings/bluetooth/BluetoothDevicePreference.java b/src/com/android/settings/bluetooth/BluetoothDevicePreference.java
index f895032..373d929 100644
--- a/src/com/android/settings/bluetooth/BluetoothDevicePreference.java
+++ b/src/com/android/settings/bluetooth/BluetoothDevicePreference.java
@@ -175,7 +175,7 @@
mHideSecondTarget = hideSecondTarget;
}
- private void onPreferenceAttributesChanged() {
+ void onPreferenceAttributesChanged() {
ThreadUtils.postOnBackgroundThread(() -> {
final Pair<Drawable, String> pair =
BluetoothUtils.getBtRainbowDrawableWithDescription(getContext(), mCachedDevice);
diff --git a/src/com/android/settings/bluetooth/BluetoothDeviceUpdater.java b/src/com/android/settings/bluetooth/BluetoothDeviceUpdater.java
index 8cb698f..d65500b 100644
--- a/src/com/android/settings/bluetooth/BluetoothDeviceUpdater.java
+++ b/src/com/android/settings/bluetooth/BluetoothDeviceUpdater.java
@@ -317,4 +317,13 @@
}
return device.getBondState() == BluetoothDevice.BOND_BONDED && device.isConnected();
}
+
+ /**
+ * Update the attributes of {@link Preference}.
+ */
+ public void refreshPreference() {
+ for (Preference preference : mPreferenceMap.values()) {
+ ((BluetoothDevicePreference) preference).onPreferenceAttributesChanged();
+ }
+ }
}
diff --git a/src/com/android/settings/connecteddevice/AvailableMediaDeviceGroupController.java b/src/com/android/settings/connecteddevice/AvailableMediaDeviceGroupController.java
index d895154..ec122df 100644
--- a/src/com/android/settings/connecteddevice/AvailableMediaDeviceGroupController.java
+++ b/src/com/android/settings/connecteddevice/AvailableMediaDeviceGroupController.java
@@ -68,6 +68,7 @@
}
mBluetoothDeviceUpdater.registerCallback();
mLocalBluetoothManager.getEventManager().registerCallback(this);
+ mBluetoothDeviceUpdater.refreshPreference();
}
@Override
diff --git a/src/com/android/settings/connecteddevice/ConnectedDeviceGroupController.java b/src/com/android/settings/connecteddevice/ConnectedDeviceGroupController.java
index 957737a..8cec9a6 100644
--- a/src/com/android/settings/connecteddevice/ConnectedDeviceGroupController.java
+++ b/src/com/android/settings/connecteddevice/ConnectedDeviceGroupController.java
@@ -61,6 +61,7 @@
mBluetoothDeviceUpdater.registerCallback();
mConnectedUsbDeviceUpdater.registerCallback();
mConnectedDockUpdater.registerCallback();
+ mBluetoothDeviceUpdater.refreshPreference();
}
@Override
diff --git a/src/com/android/settings/connecteddevice/PreviouslyConnectedDevicePreferenceController.java b/src/com/android/settings/connecteddevice/PreviouslyConnectedDevicePreferenceController.java
index a7bae3b..4a29485 100644
--- a/src/com/android/settings/connecteddevice/PreviouslyConnectedDevicePreferenceController.java
+++ b/src/com/android/settings/connecteddevice/PreviouslyConnectedDevicePreferenceController.java
@@ -111,6 +111,7 @@
mBluetoothDeviceUpdater.registerCallback();
mSavedDockUpdater.registerCallback();
mContext.registerReceiver(mReceiver, mIntentFilter);
+ mBluetoothDeviceUpdater.refreshPreference();
}
@Override
diff --git a/src/com/android/settings/connecteddevice/SavedDeviceGroupController.java b/src/com/android/settings/connecteddevice/SavedDeviceGroupController.java
index 062fa2d..df721f1 100644
--- a/src/com/android/settings/connecteddevice/SavedDeviceGroupController.java
+++ b/src/com/android/settings/connecteddevice/SavedDeviceGroupController.java
@@ -63,6 +63,7 @@
public void onStart() {
mBluetoothDeviceUpdater.registerCallback();
mSavedDockUpdater.registerCallback();
+ mBluetoothDeviceUpdater.refreshPreference();
}
@Override
diff --git a/src/com/android/settings/dashboard/profileselector/ProfileFragmentBridge.java b/src/com/android/settings/dashboard/profileselector/ProfileFragmentBridge.java
index 04fccb3..2891e3a 100644
--- a/src/com/android/settings/dashboard/profileselector/ProfileFragmentBridge.java
+++ b/src/com/android/settings/dashboard/profileselector/ProfileFragmentBridge.java
@@ -21,7 +21,7 @@
import com.android.settings.accounts.AccountDashboardFragment;
import com.android.settings.applications.manageapplications.ManageApplications;
import com.android.settings.location.LocationSettings;
-import com.android.settings.location.RecentLocationRequestSeeAllFragment;
+import com.android.settings.location.RecentLocationAccessSeeAllFragment;
import java.util.Map;
@@ -44,7 +44,7 @@
ProfileSelectManageApplications.class.getName());
FRAGMENT_MAP.put(LocationSettings.class.getName(),
ProfileSelectLocationFragment.class.getName());
- FRAGMENT_MAP.put(RecentLocationRequestSeeAllFragment.class.getName(),
- ProfileSelectRecentLocationRequestFragment.class.getName());
+ FRAGMENT_MAP.put(RecentLocationAccessSeeAllFragment.class.getName(),
+ ProfileSelectRecentLocationAccessFragment.class.getName());
}
}
diff --git a/src/com/android/settings/dashboard/profileselector/ProfileSelectRecentLocationAccessFragment.java b/src/com/android/settings/dashboard/profileselector/ProfileSelectRecentLocationAccessFragment.java
new file mode 100644
index 0000000..3cb77c5
--- /dev/null
+++ b/src/com/android/settings/dashboard/profileselector/ProfileSelectRecentLocationAccessFragment.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2021 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.dashboard.profileselector;
+
+import android.os.Bundle;
+
+import androidx.fragment.app.Fragment;
+
+import com.android.settings.location.RecentLocationAccessSeeAllFragment;
+
+/**
+ * Recent location request page for personal/managed profile.
+ */
+public class ProfileSelectRecentLocationAccessFragment extends ProfileSelectFragment {
+
+ @Override
+ public Fragment[] getFragments() {
+ final Bundle workOnly = new Bundle();
+ workOnly.putInt(EXTRA_PROFILE, ProfileType.WORK);
+ final Fragment workFragment = new RecentLocationAccessSeeAllFragment();
+ workFragment.setArguments(workOnly);
+
+ final Bundle personalOnly = new Bundle();
+ personalOnly.putInt(EXTRA_PROFILE, ProfileType.PERSONAL);
+ final Fragment personalFragment = new RecentLocationAccessSeeAllFragment();
+ personalFragment.setArguments(personalOnly);
+ return new Fragment[]{
+ personalFragment, //0
+ workFragment
+ };
+ }
+}
diff --git a/src/com/android/settings/fuelgauge/FakeUid.java b/src/com/android/settings/fuelgauge/FakeUid.java
index db35e73..e1fc7f4 100644
--- a/src/com/android/settings/fuelgauge/FakeUid.java
+++ b/src/com/android/settings/fuelgauge/FakeUid.java
@@ -356,12 +356,12 @@
}
@Override
- public long getScreenOnEnergy() {
+ public long getScreenOnMeasuredBatteryConsumptionUC() {
return 0;
}
@Override
- public long[] getCustomMeasuredEnergiesMicroJoules() {
+ public long[] getCustomConsumerMeasuredBatteryConsumptionUC() {
return null;
}
diff --git a/src/com/android/settings/location/LocationForWorkPreferenceController.java b/src/com/android/settings/location/LocationForWorkPreferenceController.java
index 41d26ef..45fb5f1 100644
--- a/src/com/android/settings/location/LocationForWorkPreferenceController.java
+++ b/src/com/android/settings/location/LocationForWorkPreferenceController.java
@@ -27,6 +27,9 @@
import com.android.settingslib.RestrictedLockUtils;
import com.android.settingslib.RestrictedSwitchPreference;
+/**
+ * Preference Controller for Location for Work Profile.
+ */
public class LocationForWorkPreferenceController extends LocationBasePreferenceController {
private RestrictedSwitchPreference mPreference;
diff --git a/src/com/android/settings/location/LocationServiceForWorkPreferenceController.java b/src/com/android/settings/location/LocationInjectedServicesForWorkPreferenceController.java
similarity index 83%
rename from src/com/android/settings/location/LocationServiceForWorkPreferenceController.java
rename to src/com/android/settings/location/LocationInjectedServicesForWorkPreferenceController.java
index 6b172dd..571b4a7 100644
--- a/src/com/android/settings/location/LocationServiceForWorkPreferenceController.java
+++ b/src/com/android/settings/location/LocationInjectedServicesForWorkPreferenceController.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2019 The Android Open Source Project
+ * Copyright (C) 2021 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.
@@ -27,13 +27,13 @@
import java.util.Map;
/**
- * Retrieve the Location Services used in profile user.
+ * Retrieve the Location Services used in work profile user.
*/
-public class LocationServiceForWorkPreferenceController extends
- LocationServicePreferenceController {
+public class LocationInjectedServicesForWorkPreferenceController extends
+ LocationInjectedServicesPreferenceController {
private static final String TAG = "LocationWorkPrefCtrl";
- public LocationServiceForWorkPreferenceController(Context context, String key) {
+ public LocationInjectedServicesForWorkPreferenceController(Context context, String key) {
super(context, key);
}
diff --git a/src/com/android/settings/location/LocationServicePreferenceController.java b/src/com/android/settings/location/LocationInjectedServicesPreferenceController.java
similarity index 87%
rename from src/com/android/settings/location/LocationServicePreferenceController.java
rename to src/com/android/settings/location/LocationInjectedServicesPreferenceController.java
index 04a9250..8573307 100644
--- a/src/com/android/settings/location/LocationServicePreferenceController.java
+++ b/src/com/android/settings/location/LocationInjectedServicesPreferenceController.java
@@ -1,15 +1,17 @@
/*
- * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2021 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
+ * 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.
+ * 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.location;
@@ -36,7 +38,10 @@
import java.util.List;
import java.util.Map;
-public class LocationServicePreferenceController extends LocationBasePreferenceController
+/**
+ * Preference controller for the injected Location Services.
+ */
+public class LocationInjectedServicesPreferenceController extends LocationBasePreferenceController
implements LifecycleObserver, OnResume, OnPause {
private static final String TAG = "LocationPrefCtrl";
@@ -51,7 +56,7 @@
@VisibleForTesting
BroadcastReceiver mInjectedSettingsReceiver;
- public LocationServicePreferenceController(Context context, String key) {
+ public LocationInjectedServicesPreferenceController(Context context, String key) {
super(context, key);
}
diff --git a/src/com/android/settings/location/LocationServices.java b/src/com/android/settings/location/LocationServices.java
index 8f05584..aceb9d5 100644
--- a/src/com/android/settings/location/LocationServices.java
+++ b/src/com/android/settings/location/LocationServices.java
@@ -60,7 +60,7 @@
public void onAttach(Context context) {
super.onAttach(context);
- use(LocationServicePreferenceController.class).init(this);
+ use(LocationInjectedServicesPreferenceController.class).init(this);
}
private static List<AbstractPreferenceController> buildPreferenceControllers(Context context) {
diff --git a/src/com/android/settings/location/LocationServicesForWork.java b/src/com/android/settings/location/LocationServicesForWork.java
new file mode 100644
index 0000000..4b3124e
--- /dev/null
+++ b/src/com/android/settings/location/LocationServicesForWork.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2021 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.location;
+
+import android.app.settings.SettingsEnums;
+import android.content.Context;
+
+import com.android.settings.R;
+import com.android.settings.dashboard.DashboardFragment;
+import com.android.settings.search.BaseSearchIndexProvider;
+import com.android.settingslib.core.AbstractPreferenceController;
+import com.android.settingslib.search.SearchIndexable;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * A page that configures the Location Services settings for work profile.
+ */
+@SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC)
+public class LocationServicesForWork extends DashboardFragment {
+ private static final String TAG = "LocationServicesForWork";
+
+ @Override
+ public int getMetricsCategory() {
+ return SettingsEnums.LOCATION_SERVICES;
+ }
+
+ @Override
+ protected int getPreferenceScreenResId() {
+ return R.xml.location_services_workprofile;
+ }
+
+ @Override
+ protected String getLogTag() {
+ return TAG;
+ }
+
+ @Override
+ protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
+ return buildPreferenceControllers(context);
+ }
+
+ @Override
+ public void onAttach(Context context) {
+ super.onAttach(context);
+ use(LocationInjectedServicesForWorkPreferenceController.class).init(this);
+ }
+
+ private static List<AbstractPreferenceController> buildPreferenceControllers(Context context) {
+ final List<AbstractPreferenceController> controllers = new ArrayList<>();
+ return controllers;
+ }
+
+ /**
+ * For Search.
+ */
+ public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
+ new BaseSearchIndexProvider(R.xml.location_services_workprofile) {
+
+ @Override
+ public List<AbstractPreferenceController> createPreferenceControllers(Context
+ context) {
+ return buildPreferenceControllers(context);
+ }
+ };
+}
diff --git a/src/com/android/settings/location/LocationServicesForWorkPreferenceController.java b/src/com/android/settings/location/LocationServicesForWorkPreferenceController.java
new file mode 100644
index 0000000..f8167df
--- /dev/null
+++ b/src/com/android/settings/location/LocationServicesForWorkPreferenceController.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2021 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.location;
+
+import android.content.Context;
+
+import com.android.settings.core.BasePreferenceController;
+
+/**
+ * Preference controller for Location Services for Work Profile.
+ */
+public class LocationServicesForWorkPreferenceController extends BasePreferenceController {
+
+ public LocationServicesForWorkPreferenceController(Context context, String key) {
+ super(context, key);
+ }
+
+ @Override
+ public CharSequence getSummary() {
+ return null;
+ }
+
+ @AvailabilityStatus
+ public int getAvailabilityStatus() {
+ return AVAILABLE;
+ }
+}
diff --git a/src/com/android/settings/location/LocationScanningPreferenceController.java b/src/com/android/settings/location/LocationServicesPreferenceController.java
similarity index 91%
rename from src/com/android/settings/location/LocationScanningPreferenceController.java
rename to src/com/android/settings/location/LocationServicesPreferenceController.java
index a0c3241..f7a3388 100644
--- a/src/com/android/settings/location/LocationScanningPreferenceController.java
+++ b/src/com/android/settings/location/LocationServicesPreferenceController.java
@@ -23,12 +23,14 @@
import com.android.settings.R;
import com.android.settings.core.BasePreferenceController;
-
-public class LocationScanningPreferenceController extends BasePreferenceController {
+/**
+ * Preference controller for Location Services.
+ */
+public class LocationServicesPreferenceController extends BasePreferenceController {
private final WifiManager mWifiManager;
- public LocationScanningPreferenceController(Context context, String key) {
+ public LocationServicesPreferenceController(Context context, String key) {
super(context, key);
mWifiManager = context.getSystemService(WifiManager.class);
}
@@ -57,4 +59,4 @@
? AVAILABLE
: UNSUPPORTED_ON_DEVICE;
}
-}
\ No newline at end of file
+}
diff --git a/src/com/android/settings/location/LocationSettings.java b/src/com/android/settings/location/LocationSettings.java
index 9a61b31..d58ad5b 100644
--- a/src/com/android/settings/location/LocationSettings.java
+++ b/src/com/android/settings/location/LocationSettings.java
@@ -85,7 +85,7 @@
use(RecentLocationAccessPreferenceController.class).init(this);
use(LocationFooterPreferenceController.class).init(this);
use(LocationForWorkPreferenceController.class).init(this);
- use(LocationServiceForWorkPreferenceController.class).init(this);
+ use(LocationInjectedServicesForWorkPreferenceController.class).init(this);
}
@Override
diff --git a/src/com/android/settings/location/LocationWorkProfileSettings.java b/src/com/android/settings/location/LocationWorkProfileSettings.java
index 601ec23..18936fd 100644
--- a/src/com/android/settings/location/LocationWorkProfileSettings.java
+++ b/src/com/android/settings/location/LocationWorkProfileSettings.java
@@ -50,7 +50,6 @@
super.onAttach(context);
use(AppLocationPermissionPreferenceController.class).init(this);
- use(LocationServiceForWorkPreferenceController.class).init(this);
use(LocationFooterPreferenceController.class).init(this);
use(LocationForWorkPreferenceController.class).init(this);
diff --git a/src/com/android/settings/location/RecentLocationAccessPreferenceController.java b/src/com/android/settings/location/RecentLocationAccessPreferenceController.java
index f4ef0eb..383fbea 100644
--- a/src/com/android/settings/location/RecentLocationAccessPreferenceController.java
+++ b/src/com/android/settings/location/RecentLocationAccessPreferenceController.java
@@ -38,6 +38,7 @@
* Preference controller that handles the display of apps that access locations.
*/
public class RecentLocationAccessPreferenceController extends LocationBasePreferenceController {
+ public static final int MAX_APPS = 3;
@VisibleForTesting
RecentLocationAccesses mRecentLocationApps;
private PreferenceCategory mCategoryRecentLocationRequests;
@@ -89,6 +90,9 @@
/* showSystemApps= */ false)) {
if (isRequestMatchesProfileType(userManager, access, mType)) {
recentLocationAccesses.add(access);
+ if (recentLocationAccesses.size() == MAX_APPS) {
+ break;
+ }
}
}
diff --git a/src/com/android/settings/location/RecentLocationAccessSeeAllFragment.java b/src/com/android/settings/location/RecentLocationAccessSeeAllFragment.java
new file mode 100644
index 0000000..e8e3c59
--- /dev/null
+++ b/src/com/android/settings/location/RecentLocationAccessSeeAllFragment.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2021 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.location;
+
+import android.content.Context;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+
+import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
+import com.android.settings.R;
+import com.android.settings.dashboard.DashboardFragment;
+import com.android.settings.dashboard.profileselector.ProfileSelectFragment;
+import com.android.settings.search.BaseSearchIndexProvider;
+import com.android.settingslib.search.SearchIndexable;
+
+/** Dashboard Fragment to display all recent location access (apps), sorted by recency. */
+@SearchIndexable
+public class RecentLocationAccessSeeAllFragment extends DashboardFragment {
+ private static final String TAG = "RecentLocAccessSeeAll";
+ public static final String PATH =
+ "com.android.settings.location.RecentLocationAccessSeeAllFragment";
+
+ private static final int MENU_SHOW_SYSTEM = Menu.FIRST + 1;
+ private static final int MENU_HIDE_SYSTEM = Menu.FIRST + 2;
+
+ private boolean mShowSystem = false;
+ private MenuItem mShowSystemMenu;
+ private MenuItem mHideSystemMenu;
+ private RecentLocationAccessSeeAllPreferenceController mController;
+
+ @Override
+ public int getMetricsCategory() {
+ return MetricsEvent.RECENT_LOCATION_REQUESTS_ALL;
+ }
+
+ @Override
+ public void onAttach(Context context) {
+ super.onAttach(context);
+ final int profileType = getArguments().getInt(ProfileSelectFragment.EXTRA_PROFILE);
+
+ mController = use(RecentLocationAccessSeeAllPreferenceController.class);
+ mController.init(this);
+ if (profileType != 0) {
+ mController.setProfileType(profileType);
+ }
+ }
+
+ @Override
+ protected int getPreferenceScreenResId() {
+ return R.xml.location_recent_access_see_all;
+ }
+
+ @Override
+ protected String getLogTag() {
+ return TAG;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem menuItem) {
+ switch (menuItem.getItemId()) {
+ case MENU_SHOW_SYSTEM:
+ case MENU_HIDE_SYSTEM:
+ mShowSystem = menuItem.getItemId() == MENU_SHOW_SYSTEM;
+ updateMenu();
+ if (mController != null) {
+ mController.setShowSystem(mShowSystem);
+ }
+ return true;
+ default:
+ return super.onOptionsItemSelected(menuItem);
+ }
+ }
+
+ private void updateMenu() {
+ mShowSystemMenu.setVisible(!mShowSystem);
+ mHideSystemMenu.setVisible(mShowSystem);
+ }
+
+ @Override
+ public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
+ super.onCreateOptionsMenu(menu, inflater);
+ mShowSystemMenu = menu.add(Menu.NONE, MENU_SHOW_SYSTEM, Menu.NONE,
+ R.string.menu_show_system);
+ mHideSystemMenu = menu.add(Menu.NONE, MENU_HIDE_SYSTEM, Menu.NONE,
+ R.string.menu_hide_system);
+ updateMenu();
+ }
+
+ /**
+ * For Search.
+ */
+ public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
+ new BaseSearchIndexProvider(R.xml.location_recent_access_see_all);
+}
diff --git a/src/com/android/settings/location/RecentLocationAccessSeeAllPreferenceController.java b/src/com/android/settings/location/RecentLocationAccessSeeAllPreferenceController.java
new file mode 100644
index 0000000..c147ee7
--- /dev/null
+++ b/src/com/android/settings/location/RecentLocationAccessSeeAllPreferenceController.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2021 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.location;
+
+import static com.android.settings.location.RecentLocationAccessPreferenceController.createAppPreference;
+import static com.android.settings.location.RecentLocationAccessPreferenceController.isRequestMatchesProfileType;
+
+import android.content.Context;
+import android.os.UserManager;
+
+import androidx.preference.Preference;
+import androidx.preference.PreferenceScreen;
+
+import com.android.settings.R;
+import com.android.settings.dashboard.profileselector.ProfileSelectFragment;
+import com.android.settingslib.location.RecentLocationAccesses;
+import com.android.settingslib.widget.AppPreference;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/** Preference controller for preference category displaying all recent location access (apps). */
+public class RecentLocationAccessSeeAllPreferenceController
+ extends LocationBasePreferenceController {
+
+ private PreferenceScreen mCategoryAllRecentLocationAccess;
+ private RecentLocationAccesses mRecentLocationAccesses;
+ private boolean mShowSystem = false;
+ private Preference mPreference;
+ private int mType = ProfileSelectFragment.ProfileType.ALL;
+
+ public RecentLocationAccessSeeAllPreferenceController(Context context, String key) {
+ super(context, key);
+ mRecentLocationAccesses = new RecentLocationAccesses(context);
+ }
+
+ @Override
+ public void onLocationModeChanged(int mode, boolean restricted) {
+ mCategoryAllRecentLocationAccess.setEnabled(mLocationEnabler.isEnabled(mode));
+ }
+
+ @Override
+ public void displayPreference(PreferenceScreen screen) {
+ super.displayPreference(screen);
+ mCategoryAllRecentLocationAccess = screen.findPreference(getPreferenceKey());
+ }
+
+ @Override
+ public void updateState(Preference preference) {
+ mCategoryAllRecentLocationAccess.removeAll();
+ mPreference = preference;
+
+ final UserManager userManager = UserManager.get(mContext);
+
+ final List<RecentLocationAccesses.Access> recentLocationAccesses = new ArrayList<>();
+ for (RecentLocationAccesses.Access access : mRecentLocationAccesses.getAppListSorted(
+ mShowSystem)) {
+ if (isRequestMatchesProfileType(userManager, access, mType)) {
+ recentLocationAccesses.add(access);
+ }
+ }
+
+ if (recentLocationAccesses.isEmpty()) {
+ // If there's no item to display, add a "No recent apps" item.
+ final Preference banner = new AppPreference(mContext);
+ banner.setTitle(R.string.location_no_recent_apps);
+ banner.setSelectable(false);
+ mCategoryAllRecentLocationAccess.addPreference(banner);
+ } else {
+ for (RecentLocationAccesses.Access request : recentLocationAccesses) {
+ final Preference appPreference = createAppPreference(
+ preference.getContext(),
+ request, mFragment);
+ mCategoryAllRecentLocationAccess.addPreference(appPreference);
+ }
+ }
+ }
+
+ /**
+ * Initialize {@link ProfileSelectFragment.ProfileType} of the controller
+ *
+ * @param type {@link ProfileSelectFragment.ProfileType} of the controller.
+ */
+ public void setProfileType(@ProfileSelectFragment.ProfileType int type) {
+ mType = type;
+ }
+
+ /**
+ * Set the value of {@link #mShowSystem}.
+ */
+ public void setShowSystem(boolean showSystem) {
+ mShowSystem = showSystem;
+ if (mPreference != null) {
+ updateState(mPreference);
+ }
+ }
+}
diff --git a/src/com/android/settings/network/TetherPreferenceController.java b/src/com/android/settings/network/TetherPreferenceController.java
index 8df0ac1..f91f787 100644
--- a/src/com/android/settings/network/TetherPreferenceController.java
+++ b/src/com/android/settings/network/TetherPreferenceController.java
@@ -27,7 +27,6 @@
import android.content.Intent;
import android.content.IntentFilter;
import android.database.ContentObserver;
-import android.net.ConnectivityManager;
import android.net.TetheringManager;
import android.net.Uri;
import android.os.Bundle;
@@ -61,7 +60,6 @@
private final boolean mAdminDisallowedTetherConfig;
private final AtomicReference<BluetoothPan> mBluetoothPan;
- private final ConnectivityManager mConnectivityManager;
private final BluetoothAdapter mBluetoothAdapter;
private final TetheringManager mTetheringManager;
@VisibleForTesting
@@ -86,7 +84,6 @@
super(null);
mAdminDisallowedTetherConfig = false;
mBluetoothPan = new AtomicReference<>();
- mConnectivityManager = null;
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
mTetheringManager = null;
}
@@ -95,8 +92,6 @@
super(context);
mBluetoothPan = new AtomicReference<>();
mAdminDisallowedTetherConfig = isTetherConfigDisallowed(context);
- mConnectivityManager =
- (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
mTetheringManager = context.getSystemService(TetheringManager.class);
if (lifecycle != null) {
@@ -110,7 +105,7 @@
mPreference = screen.findPreference(KEY_TETHER_SETTINGS);
if (mPreference != null && !mAdminDisallowedTetherConfig) {
mPreference.setTitle(
- com.android.settingslib.Utils.getTetheringLabel(mConnectivityManager));
+ com.android.settingslib.Utils.getTetheringLabel(mTetheringManager));
}
}
diff --git a/src/com/android/settings/search/CustomSiteMapRegistry.java b/src/com/android/settings/search/CustomSiteMapRegistry.java
index cd716fa..8448846 100644
--- a/src/com/android/settings/search/CustomSiteMapRegistry.java
+++ b/src/com/android/settings/search/CustomSiteMapRegistry.java
@@ -27,7 +27,7 @@
import com.android.settings.gestures.GestureNavigationSettingsFragment;
import com.android.settings.gestures.SystemNavigationGestureSettings;
import com.android.settings.location.LocationSettings;
-import com.android.settings.location.RecentLocationRequestSeeAllFragment;
+import com.android.settings.location.RecentLocationAccessSeeAllFragment;
import com.android.settings.network.NetworkDashboardFragment;
import com.android.settings.notification.zen.ZenModeBlockedEffectsSettings;
import com.android.settings.notification.zen.ZenModeRestrictNotificationsSettings;
@@ -57,7 +57,7 @@
CUSTOM_SITE_MAP.put(
WifiSettings.class.getName(), NetworkDashboardFragment.class.getName());
CUSTOM_SITE_MAP.put(PowerUsageAdvanced.class.getName(), PowerUsageSummary.class.getName());
- CUSTOM_SITE_MAP.put(RecentLocationRequestSeeAllFragment.class.getName(),
+ CUSTOM_SITE_MAP.put(RecentLocationAccessSeeAllFragment.class.getName(),
LocationSettings.class.getName());
CUSTOM_SITE_MAP.put(UsbDetailsFragment.class.getName(),
ConnectedDeviceDashboardFragment.class.getName());
diff --git a/src/com/android/settings/widget/SettingsMainSwitchBar.java b/src/com/android/settings/widget/SettingsMainSwitchBar.java
index d7fbd6a..733be0a 100644
--- a/src/com/android/settings/widget/SettingsMainSwitchBar.java
+++ b/src/com/android/settings/widget/SettingsMainSwitchBar.java
@@ -20,11 +20,14 @@
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
+import android.widget.ImageView;
import android.widget.Switch;
import com.android.settings.overlay.FeatureFactory;
+import com.android.settingslib.RestrictedLockUtils;
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
import com.android.settingslib.widget.MainSwitchBar;
+import com.android.settingslib.widget.R;
/**
* A {@link MainSwitchBar} with a customized Switch and provides the metrics feature.
@@ -43,10 +46,13 @@
boolean onBeforeCheckedChanged(Switch switchView, boolean isChecked);
}
+ private ImageView mRestrictedIcon;
+ private RestrictedLockUtils.EnforcedAdmin mEnforcedAdmin;
+ private boolean mDisabledByAdmin;
+
private final MetricsFeatureProvider mMetricsFeatureProvider;
private OnBeforeCheckedChangeListener mOnBeforeListener;
- private Switch mSwitch;
private String mMetricsTag;
public SettingsMainSwitchBar(Context context) {
@@ -66,12 +72,57 @@
super(context, attrs, defStyleAttr, defStyleRes);
mMetricsFeatureProvider = FeatureFactory.getFactory(context).getMetricsFeatureProvider();
- mSwitch = (Switch) findViewById(android.R.id.switch_widget);
-
addOnSwitchChangeListener((switchView, isChecked) -> logMetrics(isChecked));
+
+ mRestrictedIcon = findViewById(R.id.restricted_icon);
+ mRestrictedIcon.setOnClickListener((View v) -> {
+ if (mDisabledByAdmin) {
+ RestrictedLockUtils.sendShowAdminSupportDetailsIntent(context, mEnforcedAdmin);
+ onRestrictedIconClick();
+ }
+ });
+ }
+
+ /**
+ * If admin is not null, disables the text and switch but keeps the view clickable.
+ * Otherwise, calls setEnabled which will enables the entire view including
+ * the text and switch.
+ */
+ public void setDisabledByAdmin(RestrictedLockUtils.EnforcedAdmin admin) {
+ mEnforcedAdmin = admin;
+ if (admin != null) {
+ super.setEnabled(true);
+ mDisabledByAdmin = true;
+ mTextView.setEnabled(false);
+ mSwitch.setEnabled(false);
+ mSwitch.setVisibility(View.GONE);
+ mRestrictedIcon.setVisibility(View.VISIBLE);
+ } else {
+ mDisabledByAdmin = false;
+ mSwitch.setVisibility(View.VISIBLE);
+ mRestrictedIcon.setVisibility(View.GONE);
+ setEnabled(true);
+ }
}
@Override
+ public void setEnabled(boolean enabled) {
+ if (enabled && mDisabledByAdmin) {
+ setDisabledByAdmin(null);
+ return;
+ }
+ super.setEnabled(enabled);
+ }
+
+ /**
+ * Called by the restricted icon clicked.
+ */
+
+ @Override
+ public boolean performClick() {
+ return getDelegatingView().performClick();
+ }
+
protected void onRestrictedIconClick() {
mMetricsFeatureProvider.action(
SettingsEnums.PAGE_UNKNOWN,
@@ -105,19 +156,16 @@
}
/**
- * Returns if this view is visible.
- */
- public boolean isShowing() {
- return (getVisibility() == View.VISIBLE);
- }
-
- /**
* Set the metrics tag.
*/
public void setMetricsTag(String tag) {
mMetricsTag = tag;
}
+ private View getDelegatingView() {
+ return mDisabledByAdmin ? mRestrictedIcon : mSwitch;
+ }
+
private void logMetrics(boolean isChecked) {
mMetricsFeatureProvider.action(
SettingsEnums.PAGE_UNKNOWN,
diff --git a/src/com/android/settings/wifi/WifiConfigController.java b/src/com/android/settings/wifi/WifiConfigController.java
index ee2abf8..e3ca575 100644
--- a/src/com/android/settings/wifi/WifiConfigController.java
+++ b/src/com/android/settings/wifi/WifiConfigController.java
@@ -60,7 +60,6 @@
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.EditText;
import android.widget.ImageButton;
-import android.widget.ScrollView;
import android.widget.Spinner;
import android.widget.TextView;
@@ -167,7 +166,6 @@
private String mUseSystemCertsString;
private String mDoNotProvideEapUserCertString;
- private ScrollView mDialogContainer;
private Spinner mSecuritySpinner;
@VisibleForTesting Spinner mEapMethodSpinner;
@VisibleForTesting Spinner mEapSimSpinner; // For EAP-SIM, EAP-AKA and EAP-AKA-PRIME.
@@ -275,7 +273,6 @@
mContext.getString(R.string.wifi_do_not_provide_eap_user_cert);
mSsidScanButton = (ImageButton) mView.findViewById(R.id.ssid_scanner_button);
- mDialogContainer = mView.findViewById(R.id.dialog_scrollview);
mIpSettingsSpinner = (Spinner) mView.findViewById(R.id.ip_settings);
mIpSettingsSpinner.setOnItemSelectedListener(this);
mProxySettingsSpinner = (Spinner) mView.findViewById(R.id.proxy_settings);
diff --git a/src/com/android/settings/wifi/WifiConfigController2.java b/src/com/android/settings/wifi/WifiConfigController2.java
index 32152de..e42c538 100644
--- a/src/com/android/settings/wifi/WifiConfigController2.java
+++ b/src/com/android/settings/wifi/WifiConfigController2.java
@@ -58,7 +58,6 @@
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.EditText;
import android.widget.ImageButton;
-import android.widget.ScrollView;
import android.widget.Spinner;
import android.widget.TextView;
@@ -160,7 +159,6 @@
private String mUseSystemCertsString;
private String mDoNotProvideEapUserCertString;
- private ScrollView mDialogContainer;
private Spinner mSecuritySpinner;
@VisibleForTesting Spinner mEapMethodSpinner;
private int mLastShownEapMethod;
@@ -261,7 +259,6 @@
mContext.getString(R.string.wifi_do_not_provide_eap_user_cert);
mSsidScanButton = (ImageButton) mView.findViewById(R.id.ssid_scanner_button);
- mDialogContainer = mView.findViewById(R.id.dialog_scrollview);
mIpSettingsSpinner = (Spinner) mView.findViewById(R.id.ip_settings);
mIpSettingsSpinner.setOnItemSelectedListener(this);
mProxySettingsSpinner = (Spinner) mView.findViewById(R.id.proxy_settings);
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceUpdaterTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceUpdaterTest.java
index fcc7f51..e0a61fe 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceUpdaterTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceUpdaterTest.java
@@ -58,6 +58,7 @@
private static final String MAC_ADDRESS = "04:52:C7:0B:D8:3C";
private static final String SUB_MAC_ADDRESS = "05:52:C7:0B:D8:3C";
+ private static final String TEST_NAME = "test_name";
@Mock
private DashboardFragment mDashboardFragment;
@@ -256,4 +257,15 @@
verify(mDevicePreferenceCallback).onDeviceRemoved(mPreference);
assertThat(mBluetoothDeviceUpdater.mPreferenceMap.containsKey(mBluetoothDevice)).isFalse();
}
+
+ @Test
+ public void havePreference_refreshPreference() {
+ mBluetoothDeviceUpdater.mPreferenceMap.put(mBluetoothDevice, mPreference);
+ mPreference.setTitle("fake_name");
+
+ when(mCachedBluetoothDevice.getName()).thenReturn(TEST_NAME);
+ mBluetoothDeviceUpdater.refreshPreference();
+
+ assertThat(mPreference.getTitle()).isEqualTo(TEST_NAME);
+ }
}
diff --git a/tests/robotests/src/com/android/settings/connecteddevice/AvailableMediaDeviceGroupControllerTest.java b/tests/robotests/src/com/android/settings/connecteddevice/AvailableMediaDeviceGroupControllerTest.java
index ad630ff..da1c493 100644
--- a/tests/robotests/src/com/android/settings/connecteddevice/AvailableMediaDeviceGroupControllerTest.java
+++ b/tests/robotests/src/com/android/settings/connecteddevice/AvailableMediaDeviceGroupControllerTest.java
@@ -157,9 +157,11 @@
public void testRegister() {
// register the callback in onStart()
mAvailableMediaDeviceGroupController.onStart();
+
verify(mAvailableMediaBluetoothDeviceUpdater).registerCallback();
verify(mLocalBluetoothManager.getEventManager()).registerCallback(
any(BluetoothCallback.class));
+ verify(mAvailableMediaBluetoothDeviceUpdater).refreshPreference();
}
@Test
diff --git a/tests/robotests/src/com/android/settings/connecteddevice/ConnectedDeviceGroupControllerTest.java b/tests/robotests/src/com/android/settings/connecteddevice/ConnectedDeviceGroupControllerTest.java
index 946d639..4c85713 100644
--- a/tests/robotests/src/com/android/settings/connecteddevice/ConnectedDeviceGroupControllerTest.java
+++ b/tests/robotests/src/com/android/settings/connecteddevice/ConnectedDeviceGroupControllerTest.java
@@ -139,9 +139,11 @@
public void onStart_shouldRegisterUpdaters() {
// register the callback in onStart()
mConnectedDeviceGroupController.onStart();
+
verify(mConnectedBluetoothDeviceUpdater).registerCallback();
verify(mConnectedUsbDeviceUpdater).registerCallback();
verify(mConnectedDockUpdater).registerCallback();
+ verify(mConnectedBluetoothDeviceUpdater).refreshPreference();
}
@Test
diff --git a/tests/robotests/src/com/android/settings/connecteddevice/PreviouslyConnectedDevicePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/connecteddevice/PreviouslyConnectedDevicePreferenceControllerTest.java
index 420b1a4..0e03365 100644
--- a/tests/robotests/src/com/android/settings/connecteddevice/PreviouslyConnectedDevicePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/connecteddevice/PreviouslyConnectedDevicePreferenceControllerTest.java
@@ -147,13 +147,16 @@
public void callbackCanRegisterAndUnregister() {
// register the callback in onStart()
mPreConnectedDeviceController.onStart();
+
verify(mBluetoothDeviceUpdater).registerCallback();
verify(mDockUpdater).registerCallback();
verify(mContext).registerReceiver(mPreConnectedDeviceController.mReceiver,
mPreConnectedDeviceController.mIntentFilter);
+ verify(mBluetoothDeviceUpdater).refreshPreference();
// unregister the callback in onStop()
mPreConnectedDeviceController.onStop();
+
verify(mBluetoothDeviceUpdater).unregisterCallback();
verify(mDockUpdater).unregisterCallback();
verify(mContext).unregisterReceiver(mPreConnectedDeviceController.mReceiver);
diff --git a/tests/robotests/src/com/android/settings/connecteddevice/SavedDeviceGroupControllerTest.java b/tests/robotests/src/com/android/settings/connecteddevice/SavedDeviceGroupControllerTest.java
index 6c6cf47..d2c44f9 100644
--- a/tests/robotests/src/com/android/settings/connecteddevice/SavedDeviceGroupControllerTest.java
+++ b/tests/robotests/src/com/android/settings/connecteddevice/SavedDeviceGroupControllerTest.java
@@ -79,8 +79,10 @@
public void testRegister() {
// register the callback in onStart()
mSavedDeviceGroupController.onStart();
+
verify(mBluetoothDeviceUpdater).registerCallback();
verify(mSavedDockUpdater).registerCallback();
+ verify(mBluetoothDeviceUpdater).refreshPreference();
}
@Test
diff --git a/tests/robotests/src/com/android/settings/location/LocationServicePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/location/LocationInjectedServicesPreferenceControllerTest.java
similarity index 96%
rename from tests/robotests/src/com/android/settings/location/LocationServicePreferenceControllerTest.java
rename to tests/robotests/src/com/android/settings/location/LocationInjectedServicesPreferenceControllerTest.java
index 62c13af..0370781 100644
--- a/tests/robotests/src/com/android/settings/location/LocationServicePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/location/LocationInjectedServicesPreferenceControllerTest.java
@@ -58,7 +58,7 @@
@RunWith(RobolectricTestRunner.class)
@Config(shadows = ShadowUserManager.class)
-public class LocationServicePreferenceControllerTest {
+public class LocationInjectedServicesPreferenceControllerTest {
private static final String KEY_LOCATION_SERVICES = "location_service";
@@ -76,7 +76,7 @@
private DevicePolicyManager mDevicePolicyManager;
private Context mContext;
- private LocationServicePreferenceController mController;
+ private LocationInjectedServicesPreferenceController mController;
private LifecycleOwner mLifecycleOwner;
private Lifecycle mLifecycle;
@@ -86,7 +86,8 @@
mContext = spy(RuntimeEnvironment.application);
mLifecycleOwner = () -> mLifecycle;
mLifecycle = new Lifecycle(mLifecycleOwner);
- mController = spy(new LocationServicePreferenceController(mContext, KEY_LOCATION_SERVICES));
+ mController = spy(
+ new LocationInjectedServicesPreferenceController(mContext, KEY_LOCATION_SERVICES));
when(mFragment.getSettingsLifecycle()).thenReturn(mLifecycle);
mController.init(mFragment);
mController.mInjector = mSettingsInjector;
diff --git a/tests/robotests/src/com/android/settings/location/LocationScanningPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/location/LocationServicesPreferenceControllerTest.java
similarity index 94%
rename from tests/robotests/src/com/android/settings/location/LocationScanningPreferenceControllerTest.java
rename to tests/robotests/src/com/android/settings/location/LocationServicesPreferenceControllerTest.java
index 1492766..d7d76be 100644
--- a/tests/robotests/src/com/android/settings/location/LocationScanningPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/location/LocationServicesPreferenceControllerTest.java
@@ -37,18 +37,18 @@
import org.robolectric.annotation.Config;
@RunWith(RobolectricTestRunner.class)
-public class LocationScanningPreferenceControllerTest {
+public class LocationServicesPreferenceControllerTest {
@Mock
private WifiManager mWifiManager;
private Context mContext;
- private LocationScanningPreferenceController mController;
+ private LocationServicesPreferenceController mController;
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = spy(RuntimeEnvironment.application);
when(mContext.getSystemService(WifiManager.class)).thenReturn(mWifiManager);
- mController = new LocationScanningPreferenceController(mContext, "key");
+ mController = new LocationServicesPreferenceController(mContext, "key");
}
@Test
@@ -97,4 +97,4 @@
public void testLocationScanning_ifDisabled_shouldNotBeShown() {
assertThat(mController.isAvailable()).isFalse();
}
-}
\ No newline at end of file
+}
diff --git a/tests/unit/src/com/android/settings/search/CustomSiteMapRegistryTest.java b/tests/unit/src/com/android/settings/search/CustomSiteMapRegistryTest.java
index 1a4737b..b8c3d57 100644
--- a/tests/unit/src/com/android/settings/search/CustomSiteMapRegistryTest.java
+++ b/tests/unit/src/com/android/settings/search/CustomSiteMapRegistryTest.java
@@ -29,7 +29,7 @@
import com.android.settings.gestures.GestureNavigationSettingsFragment;
import com.android.settings.gestures.SystemNavigationGestureSettings;
import com.android.settings.location.LocationSettings;
-import com.android.settings.location.RecentLocationRequestSeeAllFragment;
+import com.android.settings.location.RecentLocationAccessSeeAllFragment;
import com.android.settings.network.NetworkDashboardFragment;
import com.android.settings.notification.zen.ZenModeBlockedEffectsSettings;
import com.android.settings.notification.zen.ZenModeRestrictNotificationsSettings;
@@ -73,7 +73,7 @@
@Test
public void shouldContainRecentLocationRequestSeeAllFragmentPairs() {
assertThat(CustomSiteMapRegistry.CUSTOM_SITE_MAP.get(
- RecentLocationRequestSeeAllFragment.class.getName())).isEqualTo(
+ RecentLocationAccessSeeAllFragment.class.getName())).isEqualTo(
LocationSettings.class.getName());
}