Merge "Add settings for notification bubbling"
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index b457977..a007f99 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -57,6 +57,7 @@
<uses-permission android:name="android.permission.READ_SYNC_STATS" />
<uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />
+ <uses-permission android:name="android.permission.READ_DEVICE_CONFIG" />
<uses-permission android:name="android.permission.STATUS_BAR" />
<uses-permission android:name="android.permission.MANAGE_USB" />
<uses-permission android:name="android.permission.MANAGE_DEBUGGING" />
@@ -1235,6 +1236,10 @@
android:configChanges="orientation|keyboardHidden|screenSize"
android:parentActivityName="Settings">
<intent-filter>
+ <action android:name="android.settings.PRIVACY_SETTINGS" />
+ <category android:name="android.intent.category.DEFAULT" />
+ </intent-filter>
+ <intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.VOICE_LAUNCH" />
@@ -2791,10 +2796,6 @@
<activity android:name=".backup.UserBackupSettingsActivity"
android:label="@string/privacy_settings_title"
android:icon="@drawable/ic_settings_backup">
- <intent-filter android:priority="1">
- <action android:name="android.settings.PRIVACY_SETTINGS" />
- <category android:name="android.intent.category.DEFAULT" />
- </intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
diff --git a/res/drawable/ic_homepage_about.xml b/res/drawable/ic_homepage_about.xml
index d47a740..07dbb34 100644
--- a/res/drawable/ic_homepage_about.xml
+++ b/res/drawable/ic_homepage_about.xml
@@ -18,13 +18,10 @@
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
- <shape android:shape="oval">
- <solid
- android:color="@color/homepage_about_background" />
- <size
- android:width="@dimen/dashboard_tile_image_size"
- android:height="@dimen/dashboard_tile_image_size" />
- </shape>
+ <com.android.settings.homepage.AdaptiveIconShapeDrawable
+ android:width="@dimen/dashboard_tile_image_size"
+ android:height="@dimen/dashboard_tile_image_size"
+ android:color="@color/homepage_about_background" />
</item>
<item
diff --git a/res/drawable/ic_homepage_accessibility.xml b/res/drawable/ic_homepage_accessibility.xml
index 07c9ef2..39f241b 100644
--- a/res/drawable/ic_homepage_accessibility.xml
+++ b/res/drawable/ic_homepage_accessibility.xml
@@ -18,13 +18,10 @@
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
- <shape android:shape="oval">
- <solid
- android:color="@color/homepage_accessibility_background" />
- <size
- android:width="@dimen/dashboard_tile_image_size"
- android:height="@dimen/dashboard_tile_image_size" />
- </shape>
+ <com.android.settings.homepage.AdaptiveIconShapeDrawable
+ android:width="@dimen/dashboard_tile_image_size"
+ android:height="@dimen/dashboard_tile_image_size"
+ android:color="@color/homepage_accessibility_background" />
</item>
<item
diff --git a/res/drawable/ic_homepage_accounts.xml b/res/drawable/ic_homepage_accounts.xml
index ee33505..17408ed 100644
--- a/res/drawable/ic_homepage_accounts.xml
+++ b/res/drawable/ic_homepage_accounts.xml
@@ -18,13 +18,10 @@
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
- <shape android:shape="oval">
- <solid
- android:color="@color/homepage_accounts_background" />
- <size
- android:width="@dimen/dashboard_tile_image_size"
- android:height="@dimen/dashboard_tile_image_size" />
- </shape>
+ <com.android.settings.homepage.AdaptiveIconShapeDrawable
+ android:width="@dimen/dashboard_tile_image_size"
+ android:height="@dimen/dashboard_tile_image_size"
+ android:color="@color/homepage_accounts_background" />
</item>
<item
diff --git a/res/drawable/ic_homepage_apps.xml b/res/drawable/ic_homepage_apps.xml
index 3d18d09..2a6789c 100644
--- a/res/drawable/ic_homepage_apps.xml
+++ b/res/drawable/ic_homepage_apps.xml
@@ -18,13 +18,10 @@
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
- <shape android:shape="oval">
- <solid
- android:color="@color/homepage_app_and_notification_background" />
- <size
- android:width="@dimen/dashboard_tile_image_size"
- android:height="@dimen/dashboard_tile_image_size" />
- </shape>
+ <com.android.settings.homepage.AdaptiveIconShapeDrawable
+ android:width="@dimen/dashboard_tile_image_size"
+ android:height="@dimen/dashboard_tile_image_size"
+ android:color="@color/homepage_app_and_notification_background" />
</item>
<item
diff --git a/res/drawable/ic_homepage_battery.xml b/res/drawable/ic_homepage_battery.xml
index abafdcb..87bb5be 100644
--- a/res/drawable/ic_homepage_battery.xml
+++ b/res/drawable/ic_homepage_battery.xml
@@ -18,13 +18,10 @@
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
- <shape android:shape="oval">
- <solid
- android:color="@color/homepage_battery_background" />
- <size
- android:width="@dimen/dashboard_tile_image_size"
- android:height="@dimen/dashboard_tile_image_size" />
- </shape>
+ <com.android.settings.homepage.AdaptiveIconShapeDrawable
+ android:width="@dimen/dashboard_tile_image_size"
+ android:height="@dimen/dashboard_tile_image_size"
+ android:color="@color/homepage_battery_background" />
</item>
<item
diff --git a/res/drawable/ic_homepage_connected_device.xml b/res/drawable/ic_homepage_connected_device.xml
index 483427c..f3ce186 100644
--- a/res/drawable/ic_homepage_connected_device.xml
+++ b/res/drawable/ic_homepage_connected_device.xml
@@ -18,13 +18,10 @@
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
- <shape android:shape="oval">
- <solid
- android:color="@color/homepage_connected_device_background" />
- <size
- android:width="@dimen/dashboard_tile_image_size"
- android:height="@dimen/dashboard_tile_image_size" />
- </shape>
+ <com.android.settings.homepage.AdaptiveIconShapeDrawable
+ android:width="@dimen/dashboard_tile_image_size"
+ android:height="@dimen/dashboard_tile_image_size"
+ android:color="@color/homepage_connected_device_background" />
</item>
<item
diff --git a/res/drawable/ic_homepage_display.xml b/res/drawable/ic_homepage_display.xml
index 893a583..fba7149 100644
--- a/res/drawable/ic_homepage_display.xml
+++ b/res/drawable/ic_homepage_display.xml
@@ -18,13 +18,10 @@
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
- <shape android:shape="oval">
- <solid
- android:color="@color/homepage_display_background" />
- <size
- android:width="@dimen/dashboard_tile_image_size"
- android:height="@dimen/dashboard_tile_image_size" />
- </shape>
+ <com.android.settings.homepage.AdaptiveIconShapeDrawable
+ android:width="@dimen/dashboard_tile_image_size"
+ android:height="@dimen/dashboard_tile_image_size"
+ android:color="@color/homepage_display_background" />
</item>
<item
diff --git a/res/drawable/ic_homepage_generic_background.xml b/res/drawable/ic_homepage_generic_background.xml
deleted file mode 100644
index 37273a0..0000000
--- a/res/drawable/ic_homepage_generic_background.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2018 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-<shape xmlns:android="http://schemas.android.com/apk/res/android"
- android:shape="oval">
- <solid
- android:color="@color/homepage_generic_icon_background" />
- <size
- android:width="@dimen/dashboard_tile_image_size"
- android:height="@dimen/dashboard_tile_image_size" />
-</shape>
\ No newline at end of file
diff --git a/res/drawable/ic_homepage_location.xml b/res/drawable/ic_homepage_location.xml
index 413801b..c5d6e89 100644
--- a/res/drawable/ic_homepage_location.xml
+++ b/res/drawable/ic_homepage_location.xml
@@ -18,13 +18,10 @@
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
- <shape android:shape="oval">
- <solid
- android:color="@color/homepage_location_background"/>
- <size
- android:width="@dimen/dashboard_tile_image_size"
- android:height="@dimen/dashboard_tile_image_size"/>
- </shape>
+ <com.android.settings.homepage.AdaptiveIconShapeDrawable
+ android:width="@dimen/dashboard_tile_image_size"
+ android:height="@dimen/dashboard_tile_image_size"
+ android:color="@color/homepage_location_background" />
</item>
<item
diff --git a/res/drawable/ic_homepage_network.xml b/res/drawable/ic_homepage_network.xml
index 5ed023a..1457ab9 100644
--- a/res/drawable/ic_homepage_network.xml
+++ b/res/drawable/ic_homepage_network.xml
@@ -18,13 +18,10 @@
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
- <shape android:shape="oval">
- <solid
- android:color="@color/homepage_network_background" />
- <size
- android:width="@dimen/dashboard_tile_image_size"
- android:height="@dimen/dashboard_tile_image_size" />
- </shape>
+ <com.android.settings.homepage.AdaptiveIconShapeDrawable
+ android:width="@dimen/dashboard_tile_image_size"
+ android:height="@dimen/dashboard_tile_image_size"
+ android:color="@color/homepage_network_background" />
</item>
<item
diff --git a/res/drawable/ic_homepage_privacy.xml b/res/drawable/ic_homepage_privacy.xml
index eec3c94..a102905 100644
--- a/res/drawable/ic_homepage_privacy.xml
+++ b/res/drawable/ic_homepage_privacy.xml
@@ -18,13 +18,10 @@
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
- <shape android:shape="oval">
- <solid
- android:color="@color/homepage_privacy_background"/>
- <size
- android:width="@dimen/dashboard_tile_image_size"
- android:height="@dimen/dashboard_tile_image_size"/>
- </shape>
+ <com.android.settings.homepage.AdaptiveIconShapeDrawable
+ android:width="@dimen/dashboard_tile_image_size"
+ android:height="@dimen/dashboard_tile_image_size"
+ android:color="@color/homepage_privacy_background" />
</item>
<item
diff --git a/res/drawable/ic_homepage_security.xml b/res/drawable/ic_homepage_security.xml
index 5a6ed97..0b6a1fd 100644
--- a/res/drawable/ic_homepage_security.xml
+++ b/res/drawable/ic_homepage_security.xml
@@ -18,13 +18,10 @@
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
- <shape android:shape="oval">
- <solid
- android:color="@color/homepage_security_background" />
- <size
- android:width="@dimen/dashboard_tile_image_size"
- android:height="@dimen/dashboard_tile_image_size" />
- </shape>
+ <com.android.settings.homepage.AdaptiveIconShapeDrawable
+ android:width="@dimen/dashboard_tile_image_size"
+ android:height="@dimen/dashboard_tile_image_size"
+ android:color="@color/homepage_security_background" />
</item>
<item
diff --git a/res/drawable/ic_homepage_sound.xml b/res/drawable/ic_homepage_sound.xml
index a7369ad..21995c5 100644
--- a/res/drawable/ic_homepage_sound.xml
+++ b/res/drawable/ic_homepage_sound.xml
@@ -18,13 +18,10 @@
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
- <shape android:shape="oval">
- <solid
- android:color="@color/homepage_sound_background" />
- <size
- android:width="@dimen/dashboard_tile_image_size"
- android:height="@dimen/dashboard_tile_image_size" />
- </shape>
+ <com.android.settings.homepage.AdaptiveIconShapeDrawable
+ android:width="@dimen/dashboard_tile_image_size"
+ android:height="@dimen/dashboard_tile_image_size"
+ android:color="@color/homepage_sound_background" />
</item>
<item
diff --git a/res/drawable/ic_homepage_storage.xml b/res/drawable/ic_homepage_storage.xml
index 604cf51..5e5c3ab 100644
--- a/res/drawable/ic_homepage_storage.xml
+++ b/res/drawable/ic_homepage_storage.xml
@@ -18,13 +18,10 @@
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
- <shape android:shape="oval">
- <solid
- android:color="@color/homepage_storage_background" />
- <size
- android:width="@dimen/dashboard_tile_image_size"
- android:height="@dimen/dashboard_tile_image_size" />
- </shape>
+ <com.android.settings.homepage.AdaptiveIconShapeDrawable
+ android:width="@dimen/dashboard_tile_image_size"
+ android:height="@dimen/dashboard_tile_image_size"
+ android:color="@color/homepage_storage_background" />
</item>
<item
diff --git a/res/drawable/ic_homepage_support.xml b/res/drawable/ic_homepage_support.xml
index 0936304..906dd6c 100644
--- a/res/drawable/ic_homepage_support.xml
+++ b/res/drawable/ic_homepage_support.xml
@@ -18,13 +18,10 @@
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
- <shape android:shape="oval">
- <solid
- android:color="@color/homepage_support_background" />
- <size
- android:width="@dimen/dashboard_tile_image_size"
- android:height="@dimen/dashboard_tile_image_size" />
- </shape>
+ <com.android.settings.homepage.AdaptiveIconShapeDrawable
+ android:width="@dimen/dashboard_tile_image_size"
+ android:height="@dimen/dashboard_tile_image_size"
+ android:color="@color/homepage_support_background" />
</item>
<item
diff --git a/res/drawable/ic_homepage_system_dashboard.xml b/res/drawable/ic_homepage_system_dashboard.xml
index 60f0476..5e9f372 100644
--- a/res/drawable/ic_homepage_system_dashboard.xml
+++ b/res/drawable/ic_homepage_system_dashboard.xml
@@ -18,13 +18,10 @@
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
- <shape android:shape="oval">
- <solid
- android:color="@color/homepage_system_background" />
- <size
- android:width="@dimen/dashboard_tile_image_size"
- android:height="@dimen/dashboard_tile_image_size" />
- </shape>
+ <com.android.settings.homepage.AdaptiveIconShapeDrawable
+ android:width="@dimen/dashboard_tile_image_size"
+ android:height="@dimen/dashboard_tile_image_size"
+ android:color="@color/homepage_system_background" />
</item>
<item
diff --git a/res/drawable/ic_menu_add_white.xml b/res/drawable/ic_menu_add_white.xml
deleted file mode 100644
index 25a8ff0..0000000
--- a/res/drawable/ic_menu_add_white.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2016 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<vector
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="24dp"
- android:height="24dp"
- android:viewportWidth="24.0"
- android:viewportHeight="24.0"
- android:tint="?android:attr/colorControlNormal">
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>
-</vector>
diff --git a/res/menu/vpn.xml b/res/menu/vpn.xml
index 7b35c70..a3b8090 100644
--- a/res/menu/vpn.xml
+++ b/res/menu/vpn.xml
@@ -18,6 +18,6 @@
<item
android:id="@+id/vpn_create"
android:title="@string/vpn_create"
- android:icon="@drawable/ic_menu_add_white"
+ android:icon="@drawable/ic_menu_add"
android:showAsAction="always" />
</menu>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index c0526d8..8c6b9db 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -820,9 +820,9 @@
<string name="lockdown_settings_summary">Display power button option that turns off Smart Lock, fingerprint unlocking, and notifications on the lock screen</string>
<!-- Text shown for the title of the extend unlock mode option for trust agents [CHAR LIMIT=40] -->
- <string name="trust_agents_extend_unlock_title">SmartLock only extends unlock</string>
+ <string name="trust_agents_extend_unlock_title">Trust agents only extend unlock</string>
<!-- Text shown for the description of the extend unlock mode option [CHAR LIMIT=NONE] -->
- <string name="trust_agents_extend_unlock_summary">If enabled, SmartLock will keep your device unlocked for longer, but can no longer unlock a locked device.</string>
+ <string name="trust_agents_extend_unlock_summary">If enabled, trust agents will keep your device unlocked for longer, but can no longer unlock a locked device.</string>
<!-- Text shown for the title of the lock when trust lost option [CHAR LIMIT=40] -->
<string name="trust_lost_locks_screen_title">Lock screen when trust is lost</string>
@@ -4487,8 +4487,8 @@
<string name="keyboard_shortcuts_helper">Keyboard shortcuts helper</string>
<!-- Summary text for the 'keyboard shortcuts helper' dialog. [CHAR LIMIT=100] -->
<string name="keyboard_shortcuts_helper_summary">Display available shortcuts</string>
- <!-- Title for the 'Work profile' preference category inside Languages and inputs'. [CHAR LIMIT=45] -->
- <string name="language_and_input_for_work_category_title">Work profile</string>
+ <!-- Title for the 'Work profile input & assistance' preference category inside Languages and inputs'. [CHAR LIMIT=50] -->
+ <string name="language_and_input_for_work_category_title">Work profile input & assistance</string>
<!-- Title for the 'Virtual keyboards for work' preference. [CHAR LIMIT=45] -->
<string name="virtual_keyboards_for_work_title">Virtual keyboard for work</string>
@@ -4771,13 +4771,13 @@
<!-- Summary for the accessibility preference for hearing aid when not connected. [CHAR LIMIT=50] -->
<string name="accessibility_hearingaid_not_connected_summary">No hearing aids connected</string>
<!-- Summary for the accessibility preference for hearing aid when adding new devices. [CHAR LIMIT=50] -->
- <string name="accessibility_hearingaid_adding_summary">Add hearing aid</string>
+ <string name="accessibility_hearingaid_adding_summary">Add hearing aids</string>
<!-- Message to ask the user that if they want to pair the hearing aid, then they should find and tap the hearing aid device from the list on the next screen. [CHAR LIMIT=NONE] -->
<string name="accessibility_hearingaid_pair_instructions_first_message">To pair your hearing aids, find and tap your device on the next screen.</string>
<!-- Message to ask the user to make sure that their hearing aid devices are in pairing mode. [CHAR LIMIT=NONE] -->
<string name="accessibility_hearingaid_pair_instructions_second_message">Make sure your hearing aids are in pairing mode.</string>
<!-- Summary for the accessibility preference for hearing aid when there is an active device. [CHAR LIMIT=50] -->
- <string name="accessibility_hearingaid_active_device_summary"><xliff:g id="device_name">%1$s</xliff:g> currently active</string>
+ <string name="accessibility_hearingaid_active_device_summary"><xliff:g id="device_name">%1$s</xliff:g> active</string>
<!-- Summary for the accessibility preference for hearing aid when there are saved devices. [CHAR LIMIT=50] -->
<plurals name="show_number_hearingaid_count">
<item quantity="one"><xliff:g id="number_device_count">%1$d</xliff:g> saved hearing aid</item>
@@ -5850,6 +5850,10 @@
<string name="sms_access_restriction_enabled">Restrict SMS & call log access</string>
<!-- Summary for whether to enable SMS access restriction [CHAR LIMIT=NONE]-->
<string name="sms_access_restriction_enabled_summary">Only default phone and messaging apps have SMS & call log permissions</string>
+ <!-- Title for the new device identifier access restrictions [CHAR LIMIT=50]-->
+ <string name="device_identifier_access_restrictions_title">Enable device identifier restrictions</string>
+ <!-- Summary for the new device identifier access restrictions [CHAR LIMIT=NONE]-->
+ <string name="device_identifier_access_restrictions_summary">Enable the new access restrictions for device identifiers.</string>
<!-- Message when there are no available trust agents to display -->
@@ -10273,11 +10277,11 @@
<!-- Summary for battery Suggestion. [CHAR LIMIT=55] -->
<string name="battery_suggestion_summary"></string>
- <!-- Title for prevent ringing gesture screen -->
+ <!-- Title for prevent ringing gesture screen [CHAR LIMIT=60]-->
<string name="gesture_prevent_ringing_screen_title">Prevent ringing</string>
- <!-- Title for prevent ringing setting -->
+ <!-- Title for prevent ringing setting [CHAR LIMIT=60]-->
<string name="gesture_prevent_ringing_title">Press Power & Volume Up together to</string>
- <!-- Title for prevent ringing setting -->
+ <!-- Title for prevent ringing setting [CHAR LIMIT=60]-->
<string name="gesture_prevent_ringing_sound_title">Shortcut to prevent ringing</string>
<!-- Option for prevent ringing setting -->
<string name="prevent_ringing_option_vibrate">Vibrate</string>
diff --git a/res/xml/development_settings.xml b/res/xml/development_settings.xml
index d7fcaec..d9b592c 100644
--- a/res/xml/development_settings.xml
+++ b/res/xml/development_settings.xml
@@ -114,6 +114,17 @@
android:key="quick_settings_tiles"
android:title="@string/quick_settings_developer_tiles"
android:fragment="com.android.settings.development.qstile.DevelopmentTileConfigFragment" />
+
+ <!-- Configure trust agent behavior -->
+ <SwitchPreference
+ android:key="security_setting_trust_agents_extend_unlock"
+ android:title="@string/trust_agents_extend_unlock_title"
+ android:summary="@string/trust_agents_extend_unlock_summary" />
+
+ <SwitchPreference
+ android:key="security_setting_trust_lost_locks_screen"
+ android:title="@string/trust_lost_locks_screen_title"
+ android:summary="@string/trust_lost_locks_screen_summary" />
</PreferenceCategory>
<PreferenceCategory
@@ -529,6 +540,11 @@
android:key="sms_access_restriction_enabled"
android:title="@string/sms_access_restriction_enabled"
android:summary="@string/sms_access_restriction_enabled_summary" />
+
+ <SwitchPreference
+ android:key="device_identifier_access_restrictions"
+ android:title="@string/device_identifier_access_restrictions_title"
+ android:summary="@string/device_identifier_access_restrictions_summary" />
</PreferenceCategory>
<com.android.settings.development.autofill.AutofillPreferenceCategory
diff --git a/res/xml/location_settings.xml b/res/xml/location_settings.xml
index 72ea312..29d4048 100644
--- a/res/xml/location_settings.xml
+++ b/res/xml/location_settings.xml
@@ -28,7 +28,7 @@
<PreferenceCategory
android:key="location_advanced_settings"
- settings:initialExpandedChildrenCount="0">
+ settings:initialExpandedChildrenCount="2">
<!-- This preference category gets removed if new_recent_location_ui is disabled -->
<Preference
diff --git a/res/xml/screen_lock_settings.xml b/res/xml/screen_lock_settings.xml
index 29c8de9..dd4ac34 100644
--- a/res/xml/screen_lock_settings.xml
+++ b/res/xml/screen_lock_settings.xml
@@ -40,17 +40,4 @@
android:key="power_button_instantly_locks"
android:title="@string/lockpattern_settings_enable_power_button_instantly_locks" />
- <!-- Temporarily available to evaluate extend unlock mode for SmartLock -->
- <SwitchPreference
- android:key="security_setting_trust_agents_extend_unlock"
- android:title="@string/trust_agents_extend_unlock_title"
- android:summary="@string/trust_agents_extend_unlock_summary"
- settings:controller="com.android.settings.security.trustagent.TrustAgentsExtendUnlockPreferenceController" />
-
- <SwitchPreference
- android:key="security_setting_trust_lost_locks_screen"
- android:title="@string/trust_lost_locks_screen_title"
- android:summary="@string/trust_lost_locks_screen_summary"
- settings:controller="com.android.settings.security.trustagent.TrustLostLocksScreenPreferenceController" />
-
</PreferenceScreen>
diff --git a/src/com/android/settings/applications/appinfo/AppDataUsagePreferenceController.java b/src/com/android/settings/applications/appinfo/AppDataUsagePreferenceController.java
index 1bfcd7d..7d9fdcf 100644
--- a/src/com/android/settings/applications/appinfo/AppDataUsagePreferenceController.java
+++ b/src/com/android/settings/applications/appinfo/AppDataUsagePreferenceController.java
@@ -89,7 +89,7 @@
public Loader<List<NetworkCycleDataForUid>> onCreateLoader(int id, Bundle args) {
final NetworkTemplate template = getTemplate(mContext);
return NetworkCycleDataForUidLoader.builder(mContext)
- .setUid(mParent.getAppEntry().info.uid)
+ .addUid(mParent.getAppEntry().info.uid)
.setRetrieveDetail(false)
.setNetworkTemplate(template)
.setSubscriberId(template.getSubscriberId())
diff --git a/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java b/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java
index 69e86cd..6348b91 100644
--- a/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java
+++ b/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java
@@ -46,7 +46,7 @@
import com.android.settings.SettingsActivity;
import com.android.settings.dashboard.profileselector.ProfileSelectDialog;
import com.android.settings.overlay.FeatureFactory;
-import com.android.settings.widget.RoundedHomepageIcon;
+import com.android.settings.widget.AdaptiveHomepageIcon;
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
import com.android.settingslib.drawer.DashboardCategory;
import com.android.settingslib.drawer.Tile;
@@ -197,8 +197,8 @@
Drawable iconDrawable = tileIcon.loadDrawable(preference.getContext());
if (forceRoundedIcon
&& !TextUtils.equals(mContext.getPackageName(), tile.getPackageName())) {
- iconDrawable = new RoundedHomepageIcon(mContext, iconDrawable);
- ((RoundedHomepageIcon) iconDrawable).setBackgroundColor(mContext, tile);
+ iconDrawable = new AdaptiveHomepageIcon(mContext, iconDrawable);
+ ((AdaptiveHomepageIcon) iconDrawable).setBackgroundColor(mContext, tile);
}
preference.setIcon(iconDrawable);
} else if (tile.getMetaData() != null
diff --git a/src/com/android/settings/datausage/AppDataUsage.java b/src/com/android/settings/datausage/AppDataUsage.java
index 329bf68..4f38843 100644
--- a/src/com/android/settings/datausage/AppDataUsage.java
+++ b/src/com/android/settings/datausage/AppDataUsage.java
@@ -94,10 +94,12 @@
private SpinnerPreference mCycle;
private RestrictedSwitchPreference mUnrestrictedData;
private DataSaverBackend mDataSaverBackend;
+ private Context mContext;
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
+ mContext = getContext();
mPackageManager = getPackageManager();
final Bundle args = getArguments();
@@ -105,9 +107,8 @@
mTemplate = (args != null) ? (NetworkTemplate) args.getParcelable(ARG_NETWORK_TEMPLATE)
: null;
if (mTemplate == null) {
- Context context = getContext();
- mTemplate = DataUsageUtils.getDefaultTemplate(context,
- DataUsageUtils.getDefaultSubscriptionId(context));
+ mTemplate = DataUsageUtils.getDefaultTemplate(mContext,
+ DataUsageUtils.getDefaultSubscriptionId(mContext));
}
if (mAppItem == null) {
int uid = (args != null) ? args.getInt(AppInfoBase.ARG_PACKAGE_UID, -1)
@@ -131,7 +132,7 @@
mBackgroundUsage = findPreference(KEY_BACKGROUND_USAGE);
mCycle = (SpinnerPreference) findPreference(KEY_CYCLE);
- mCycleAdapter = new CycleAdapter(getContext(), mCycle, mCycleListener);
+ mCycleAdapter = new CycleAdapter(mContext, mCycle, mCycleListener);
if (mAppItem.key > 0) {
if (mPackages.size() != 0) {
@@ -155,7 +156,7 @@
KEY_UNRESTRICTED_DATA);
mUnrestrictedData.setOnPreferenceChangeListener(this);
}
- mDataSaverBackend = new DataSaverBackend(getContext());
+ mDataSaverBackend = new DataSaverBackend(mContext);
mAppSettings = findPreference(KEY_APP_SETTINGS);
mAppSettingsIntent = new Intent(Intent.ACTION_MANAGE_NETWORK_USAGE);
@@ -256,7 +257,7 @@
private void updatePrefs(boolean restrictBackground, boolean unrestrictData) {
final EnforcedAdmin admin = RestrictedLockUtilsInternal.checkIfMeteredDataRestricted(
- getContext(), mPackageName, UserHandle.getUserId(mAppItem.key));
+ mContext, mPackageName, UserHandle.getUserId(mAppItem.key));
if (mRestrictBackground != null) {
mRestrictBackground.setChecked(!restrictBackground);
mRestrictBackground.setDisabledByAdmin(admin);
@@ -294,11 +295,10 @@
foregroundBytes = data.getForegroudUsage();
}
final long totalBytes = backgroundBytes + foregroundBytes;
- final Context context = getContext();
- mTotalUsage.setSummary(DataUsageUtils.formatDataUsage(context, totalBytes));
- mForegroundUsage.setSummary(DataUsageUtils.formatDataUsage(context, foregroundBytes));
- mBackgroundUsage.setSummary(DataUsageUtils.formatDataUsage(context, backgroundBytes));
+ mTotalUsage.setSummary(DataUsageUtils.formatDataUsage(mContext, totalBytes));
+ mForegroundUsage.setSummary(DataUsageUtils.formatDataUsage(mContext, foregroundBytes));
+ mBackgroundUsage.setSummary(DataUsageUtils.formatDataUsage(mContext, backgroundBytes));
}
private boolean getAppRestrictBackground() {
@@ -364,16 +364,24 @@
}
};
- private final LoaderManager.LoaderCallbacks<List<NetworkCycleDataForUid>> mUidDataCallbacks =
+ @VisibleForTesting
+ final LoaderManager.LoaderCallbacks<List<NetworkCycleDataForUid>> mUidDataCallbacks =
new LoaderManager.LoaderCallbacks<List<NetworkCycleDataForUid>>() {
@Override
public Loader<List<NetworkCycleDataForUid>> onCreateLoader(int id, Bundle args) {
- return NetworkCycleDataForUidLoader.builder(getContext())
- .setUid(mAppItem.key)
- .setRetrieveDetail(true)
+ final NetworkCycleDataForUidLoader.Builder builder
+ = NetworkCycleDataForUidLoader.builder(mContext);
+ builder.setRetrieveDetail(true)
.setNetworkTemplate(mTemplate)
- .setSubscriberId(mTemplate.getSubscriberId())
- .build();
+ .setSubscriberId(mTemplate.getSubscriberId());
+ if (mAppItem.category == AppItem.CATEGORY_USER) {
+ for (int i = 0; i < mAppItem.uids.size(); i++) {
+ builder.addUid(mAppItem.uids.keyAt(i));
+ }
+ } else {
+ builder.addUid(mAppItem.key);
+ }
+ return builder.build();
}
@Override
diff --git a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
index 5135fbf..78520c6 100644
--- a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
+++ b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
@@ -478,6 +478,7 @@
controllers.add(new FreeformWindowsPreferenceController(context));
controllers.add(new DesktopModePreferenceController(context));
controllers.add(new SmsAccessRestrictionPreferenceController(context));
+ controllers.add(new DeviceIdentifierAccessRestrictionsPreferenceController(context));
controllers.add(new ShortcutManagerThrottlingPreferenceController(context));
controllers.add(new EnableGnssRawMeasFullTrackingPreferenceController(context));
controllers.add(new DefaultLaunchPreferenceController(context, "running_apps"));
@@ -497,6 +498,8 @@
"android.theme.customization.font"));
controllers.add(new OverlayCategoryPreferenceController(context,
"android.theme.customization.adaptive_icon_shape"));
+ controllers.add(new TrustAgentsExtendUnlockPreferenceController(context));
+ controllers.add(new TrustLostLocksScreenPreferenceController(context));
return controllers;
}
diff --git a/src/com/android/settings/development/DeviceIdentifierAccessRestrictionsPreferenceController.java b/src/com/android/settings/development/DeviceIdentifierAccessRestrictionsPreferenceController.java
new file mode 100644
index 0000000..1fdbe77
--- /dev/null
+++ b/src/com/android/settings/development/DeviceIdentifierAccessRestrictionsPreferenceController.java
@@ -0,0 +1,70 @@
+/*
+ * 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.development;
+
+import android.content.Context;
+import android.provider.DeviceConfig;
+
+import androidx.preference.Preference;
+import androidx.preference.SwitchPreference;
+
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.development.DeveloperOptionsPreferenceController;
+
+public class DeviceIdentifierAccessRestrictionsPreferenceController
+ extends DeveloperOptionsPreferenceController
+ implements Preference.OnPreferenceChangeListener, PreferenceControllerMixin {
+
+ private static final String DEVICE_IDENTIFIER_ACCESS_RESTRICTIONS_KEY =
+ "device_identifier_access_restrictions";
+
+ public DeviceIdentifierAccessRestrictionsPreferenceController(Context context) {
+ super(context);
+ }
+
+ @Override
+ public String getPreferenceKey() {
+ return DEVICE_IDENTIFIER_ACCESS_RESTRICTIONS_KEY;
+ }
+
+ @Override
+ public boolean onPreferenceChange(Preference preference, Object newValue) {
+ writeSetting((boolean) newValue);
+ return true;
+ }
+
+ private void writeSetting(boolean isEnabled) {
+ DeviceConfig.setProperty(DeviceConfig.Privacy.NAMESPACE,
+ DeviceConfig.Privacy.PROPERTY_DEVICE_IDENTIFIER_ACCESS_RESTRICTIONS_DISABLED,
+ String.valueOf(!isEnabled), false);
+ }
+
+ @Override
+ public void updateState(Preference preference) {
+ boolean isEnabled = !Boolean.parseBoolean(
+ DeviceConfig.getProperty(DeviceConfig.Privacy.NAMESPACE,
+ DeviceConfig.Privacy.PROPERTY_DEVICE_IDENTIFIER_ACCESS_RESTRICTIONS_DISABLED));
+ ((SwitchPreference) mPreference).setChecked(isEnabled);
+ }
+
+ @Override
+ protected void onDeveloperOptionsSwitchDisabled() {
+ super.onDeveloperOptionsSwitchDisabled();
+ writeSetting(true);
+ ((SwitchPreference) mPreference).setChecked(true);
+ }
+}
diff --git a/src/com/android/settings/development/TrustAgentsExtendUnlockPreferenceController.java b/src/com/android/settings/development/TrustAgentsExtendUnlockPreferenceController.java
new file mode 100644
index 0000000..0834f9b
--- /dev/null
+++ b/src/com/android/settings/development/TrustAgentsExtendUnlockPreferenceController.java
@@ -0,0 +1,58 @@
+/*
+ * 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.development;
+
+import android.content.Context;
+import android.provider.Settings;
+
+import androidx.preference.Preference;
+import androidx.preference.SwitchPreference;
+
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.development.DeveloperOptionsPreferenceController;
+
+public class TrustAgentsExtendUnlockPreferenceController extends
+ DeveloperOptionsPreferenceController implements
+ Preference.OnPreferenceChangeListener, PreferenceControllerMixin {
+
+ private static final String KEY_TRUST_AGENTS_EXTEND_UNLOCK =
+ "security_setting_trust_agents_extend_unlock";
+
+ public TrustAgentsExtendUnlockPreferenceController(Context context) {
+ super(context);
+ }
+
+ @Override
+ public String getPreferenceKey() {
+ return KEY_TRUST_AGENTS_EXTEND_UNLOCK;
+ }
+
+ @Override
+ public boolean onPreferenceChange(Preference preference, Object newValue) {
+ final boolean isEnabled = (Boolean) newValue;
+ Settings.Secure.putInt(mContext.getContentResolver(),
+ Settings.Secure.TRUST_AGENTS_EXTEND_UNLOCK, isEnabled ? 1 : 0);
+ return true;
+ }
+
+ @Override
+ public void updateState(Preference preference) {
+ int trustAgentsExtendUnlock = Settings.Secure.getInt(mContext.getContentResolver(),
+ Settings.Secure.TRUST_AGENTS_EXTEND_UNLOCK, 0);
+ ((SwitchPreference) mPreference).setChecked(trustAgentsExtendUnlock != 0);
+ }
+}
diff --git a/src/com/android/settings/development/TrustLostLocksScreenPreferenceController.java b/src/com/android/settings/development/TrustLostLocksScreenPreferenceController.java
new file mode 100644
index 0000000..3800fd6
--- /dev/null
+++ b/src/com/android/settings/development/TrustLostLocksScreenPreferenceController.java
@@ -0,0 +1,58 @@
+/*
+ * 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.development;
+
+import android.content.Context;
+import android.provider.Settings;
+
+import androidx.preference.Preference;
+import androidx.preference.SwitchPreference;
+
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.development.DeveloperOptionsPreferenceController;
+
+public class TrustLostLocksScreenPreferenceController
+ extends DeveloperOptionsPreferenceController implements
+ Preference.OnPreferenceChangeListener, PreferenceControllerMixin {
+
+ private static final String KEY_TRUST_LOST_LOCKS_SCREEN =
+ "security_setting_trust_lost_locks_screen";
+
+ public TrustLostLocksScreenPreferenceController(Context context) {
+ super(context);
+ }
+
+ @Override
+ public String getPreferenceKey() {
+ return KEY_TRUST_LOST_LOCKS_SCREEN;
+ }
+
+ @Override
+ public boolean onPreferenceChange(Preference preference, Object newValue) {
+ final boolean isEnabled = (Boolean) newValue;
+ Settings.Secure.putInt(mContext.getContentResolver(),
+ Settings.Secure.LOCK_SCREEN_WHEN_TRUST_LOST, isEnabled ? 1 : 0);
+ return true;
+ }
+
+ @Override
+ public void updateState(Preference preference) {
+ int lockOnTrustLost = Settings.Secure.getInt(mContext.getContentResolver(),
+ Settings.Secure.LOCK_SCREEN_WHEN_TRUST_LOST, 0);
+ ((SwitchPreference) mPreference).setChecked(lockOnTrustLost != 0);
+ }
+}
diff --git a/src/com/android/settings/homepage/AdaptiveIconShapeDrawable.java b/src/com/android/settings/homepage/AdaptiveIconShapeDrawable.java
new file mode 100644
index 0000000..62b768a
--- /dev/null
+++ b/src/com/android/settings/homepage/AdaptiveIconShapeDrawable.java
@@ -0,0 +1,43 @@
+package com.android.settings.homepage;
+
+import android.content.res.Resources;
+import android.content.res.Resources.Theme;
+import android.graphics.Path;
+import android.graphics.drawable.AdaptiveIconDrawable;
+import android.graphics.drawable.ShapeDrawable;
+import android.graphics.drawable.shapes.PathShape;
+import android.util.AttributeSet;
+import android.util.PathParser;
+
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+
+import java.io.IOException;
+
+/**
+ * Draws a filled {@link ShapeDrawable} using the path from {@link AdaptiveIconDrawable}.
+ */
+public class AdaptiveIconShapeDrawable extends ShapeDrawable {
+ public AdaptiveIconShapeDrawable() {
+ super();
+ }
+
+ public AdaptiveIconShapeDrawable(Resources resources) {
+ super();
+ init(resources);
+ }
+
+ @Override
+ public void inflate(Resources r, XmlPullParser parser, AttributeSet attrs, Theme theme)
+ throws XmlPullParserException, IOException {
+ super.inflate(r, parser, attrs, theme);
+ init(r);
+ }
+
+ private void init(Resources resources) {
+ final float pathSize = AdaptiveIconDrawable.MASK_SIZE;
+ final Path path = new Path(PathParser.createPathFromPathData(
+ resources.getString(com.android.internal.R.string.config_icon_mask)));
+ setShape(new PathShape(path, pathSize, pathSize));
+ }
+}
diff --git a/src/com/android/settings/inputmethod/UserDictionarySettings.java b/src/com/android/settings/inputmethod/UserDictionarySettings.java
index eccfb3c..c8fb625 100644
--- a/src/com/android/settings/inputmethod/UserDictionarySettings.java
+++ b/src/com/android/settings/inputmethod/UserDictionarySettings.java
@@ -154,7 +154,7 @@
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
MenuItem actionItem =
menu.add(0, OPTIONS_MENU_ADD, 0, R.string.user_dict_settings_add_menu_title)
- .setIcon(R.drawable.ic_menu_add_white);
+ .setIcon(R.drawable.ic_menu_add);
actionItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM |
MenuItem.SHOW_AS_ACTION_WITH_TEXT);
}
diff --git a/src/com/android/settings/location/RecentLocationAccessPreferenceController.java b/src/com/android/settings/location/RecentLocationAccessPreferenceController.java
index 3adc489..214dcd5 100644
--- a/src/com/android/settings/location/RecentLocationAccessPreferenceController.java
+++ b/src/com/android/settings/location/RecentLocationAccessPreferenceController.java
@@ -18,6 +18,7 @@
import android.Manifest;
import android.content.Context;
import android.content.Intent;
+import android.provider.DeviceConfig;
import android.view.View;
import androidx.annotation.VisibleForTesting;
@@ -60,7 +61,9 @@
@Override
public boolean isAvailable() {
- return true;
+ return Boolean.parseBoolean(
+ DeviceConfig.getProperty(DeviceConfig.Privacy.NAMESPACE,
+ DeviceConfig.Privacy.PROPERTY_PERMISSIONS_HUB_ENABLED));
}
@Override
diff --git a/src/com/android/settings/network/ApnSettings.java b/src/com/android/settings/network/ApnSettings.java
index 174257b..c397600 100755
--- a/src/com/android/settings/network/ApnSettings.java
+++ b/src/com/android/settings/network/ApnSettings.java
@@ -351,7 +351,7 @@
if (mAllowAddingApns) {
menu.add(0, MENU_NEW, 0,
getResources().getString(R.string.menu_new))
- .setIcon(R.drawable.ic_menu_add_white)
+ .setIcon(R.drawable.ic_menu_add)
.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
}
menu.add(0, MENU_RESTORE, 0,
diff --git a/src/com/android/settings/privacy/PermissionBarChartPreferenceController.java b/src/com/android/settings/privacy/PermissionBarChartPreferenceController.java
index e43140f..8b9b595 100644
--- a/src/com/android/settings/privacy/PermissionBarChartPreferenceController.java
+++ b/src/com/android/settings/privacy/PermissionBarChartPreferenceController.java
@@ -26,6 +26,7 @@
import android.graphics.drawable.Drawable;
import android.permission.PermissionControllerManager;
import android.permission.RuntimePermissionUsageInfo;
+import android.provider.DeviceConfig;
import android.util.Log;
import android.view.View;
@@ -38,6 +39,7 @@
import com.android.settingslib.widget.BarChartInfo;
import com.android.settingslib.widget.BarChartPreference;
import com.android.settingslib.widget.BarViewInfo;
+import com.android.settingslib.Utils;
import java.util.ArrayList;
import java.util.Comparator;
@@ -62,7 +64,10 @@
@Override
public int getAvailabilityStatus() {
- return AVAILABLE_UNSEARCHABLE;
+ return Boolean.parseBoolean(
+ DeviceConfig.getProperty(DeviceConfig.Privacy.NAMESPACE,
+ DeviceConfig.Privacy.PROPERTY_PERMISSIONS_HUB_ENABLED)) ?
+ AVAILABLE_UNSEARCHABLE : UNSUPPORTED_ON_DEVICE;
}
@Override
@@ -143,6 +148,7 @@
try {
icon = mPackageManager.getPermissionGroupInfo(permissionGroup.toString(), 0)
.loadIcon(mPackageManager);
+ icon.setTintList(Utils.getColorAttr(mContext, android.R.attr.textColorSecondary));
} catch (PackageManager.NameNotFoundException e) {
Log.w(TAG, "Cannot find group icon for " + permissionGroup, e);
}
diff --git a/src/com/android/settings/security/trustagent/TrustAgentsExtendUnlockPreferenceController.java b/src/com/android/settings/security/trustagent/TrustAgentsExtendUnlockPreferenceController.java
deleted file mode 100644
index 036e07f..0000000
--- a/src/com/android/settings/security/trustagent/TrustAgentsExtendUnlockPreferenceController.java
+++ /dev/null
@@ -1,47 +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.security.trustagent;
-
-import android.content.Context;
-import android.provider.Settings;
-
-import com.android.settings.core.TogglePreferenceController;
-
-public class TrustAgentsExtendUnlockPreferenceController extends TogglePreferenceController {
-
- public TrustAgentsExtendUnlockPreferenceController(Context context, String key) {
- super(context, key);
- }
-
- @Override
- public int getAvailabilityStatus() {
- return AVAILABLE;
- }
-
- @Override
- public boolean isChecked() {
- return Settings.Secure.getInt(mContext.getContentResolver(),
- Settings.Secure.TRUST_AGENTS_EXTEND_UNLOCK, 1) == 1;
- }
-
- @Override
- public boolean setChecked(boolean isChecked) {
- Settings.Secure.putInt(mContext.getContentResolver(),
- Settings.Secure.TRUST_AGENTS_EXTEND_UNLOCK, isChecked ? 1 : 0);
- return true;
- }
-}
diff --git a/src/com/android/settings/security/trustagent/TrustLostLocksScreenPreferenceController.java b/src/com/android/settings/security/trustagent/TrustLostLocksScreenPreferenceController.java
deleted file mode 100644
index e0c5168..0000000
--- a/src/com/android/settings/security/trustagent/TrustLostLocksScreenPreferenceController.java
+++ /dev/null
@@ -1,47 +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.security.trustagent;
-
-import android.content.Context;
-import android.provider.Settings;
-
-import com.android.settings.core.TogglePreferenceController;
-
-public class TrustLostLocksScreenPreferenceController extends TogglePreferenceController {
-
- public TrustLostLocksScreenPreferenceController(Context context, String key) {
- super(context, key);
- }
-
- @Override
- public int getAvailabilityStatus() {
- return AVAILABLE;
- }
-
- @Override
- public boolean isChecked() {
- return Settings.Secure.getInt(mContext.getContentResolver(),
- Settings.Secure.LOCK_SCREEN_WHEN_TRUST_LOST, 1) == 1;
- }
-
- @Override
- public boolean setChecked(boolean isChecked) {
- Settings.Secure.putInt(mContext.getContentResolver(),
- Settings.Secure.LOCK_SCREEN_WHEN_TRUST_LOST, isChecked ? 1 : 0);
- return true;
- }
-}
diff --git a/src/com/android/settings/slices/SlicesDatabaseAccessor.java b/src/com/android/settings/slices/SlicesDatabaseAccessor.java
index ae77dd2..fcc42e4 100644
--- a/src/com/android/settings/slices/SlicesDatabaseAccessor.java
+++ b/src/com/android/settings/slices/SlicesDatabaseAccessor.java
@@ -75,8 +75,9 @@
if (pathData == null) {
throw new IllegalStateException("Invalid Slices uri: " + uri);
}
- Cursor cursor = getIndexedSliceData(pathData.second /* key */);
- return buildSliceData(cursor, uri, pathData.first /* isIntentOnly */);
+ try (Cursor cursor = getIndexedSliceData(pathData.second /* key */)) {
+ return buildSliceData(cursor, uri, pathData.first /* isIntentOnly */);
+ }
}
/**
@@ -85,8 +86,9 @@
* Used when handling the action of the {@link Slice}.
*/
public SliceData getSliceDataFromKey(String key) {
- Cursor cursor = getIndexedSliceData(key);
- return buildSliceData(cursor, null /* uri */, false /* isIntentOnly */);
+ try (Cursor cursor = getIndexedSliceData(key)) {
+ return buildSliceData(cursor, null /* uri */, false /* isIntentOnly */);
+ }
}
/**
diff --git a/src/com/android/settings/widget/RoundedHomepageIcon.java b/src/com/android/settings/widget/AdaptiveHomepageIcon.java
similarity index 90%
rename from src/com/android/settings/widget/RoundedHomepageIcon.java
rename to src/com/android/settings/widget/AdaptiveHomepageIcon.java
index f7927e7..bec5d8d 100644
--- a/src/com/android/settings/widget/RoundedHomepageIcon.java
+++ b/src/com/android/settings/widget/AdaptiveHomepageIcon.java
@@ -32,18 +32,19 @@
import androidx.annotation.VisibleForTesting;
import com.android.settings.R;
+import com.android.settings.homepage.AdaptiveIconShapeDrawable;
import com.android.settingslib.drawer.Tile;
-public class RoundedHomepageIcon extends LayerDrawable {
+public class AdaptiveHomepageIcon extends LayerDrawable {
- private static final String TAG = "RoundedHomepageIcon";
+ private static final String TAG = "AdaptiveHomepageIcon";
@VisibleForTesting(otherwise = NONE)
int mBackgroundColor = -1;
- public RoundedHomepageIcon(Context context, Drawable foreground) {
+ public AdaptiveHomepageIcon(Context context, Drawable foreground) {
super(new Drawable[]{
- context.getDrawable(R.drawable.ic_homepage_generic_background),
+ new AdaptiveIconShapeDrawable(context.getResources()),
foreground
});
final int insetPx = context.getResources()
diff --git a/tests/robotests/src/com/android/settings/datausage/AppDataUsageTest.java b/tests/robotests/src/com/android/settings/datausage/AppDataUsageTest.java
index 37bb3cd..12559f4 100644
--- a/tests/robotests/src/com/android/settings/datausage/AppDataUsageTest.java
+++ b/tests/robotests/src/com/android/settings/datausage/AppDataUsageTest.java
@@ -16,6 +16,8 @@
package com.android.settings.datausage;
+import static com.google.common.truth.Truth.assertThat;
+
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyInt;
@@ -31,7 +33,9 @@
import android.content.Context;
import android.content.pm.PackageManager;
import android.net.NetworkPolicyManager;
+import android.net.NetworkTemplate;
import android.os.Bundle;
+import android.text.format.DateUtils;
import android.util.ArraySet;
import android.view.View;
@@ -47,6 +51,7 @@
import com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
import com.android.settingslib.RestrictedSwitchPreference;
import com.android.settingslib.net.NetworkCycleDataForUid;
+import com.android.settingslib.net.NetworkCycleDataForUidLoader;
import org.junit.After;
import org.junit.Before;
@@ -188,7 +193,7 @@
ReflectionHelpers.setField(mFragment, "mBackgroundUsage", preference);
ReflectionHelpers.setField(mFragment, "mForegroundUsage", preference);
ReflectionHelpers.setField(mFragment, "mTotalUsage", preference);
- doReturn(RuntimeEnvironment.application).when(mFragment).getContext();
+ ReflectionHelpers.setField(mFragment, "mContext", RuntimeEnvironment.application);
mFragment.bindData(0 /* position */);
@@ -199,7 +204,7 @@
public void bindData_hasAppUsageData_shouldShowCycleSpinnerAndUpdateUsageSummary() {
mFragment = spy(new AppDataUsage());
final Context context = RuntimeEnvironment.application;
- doReturn(context).when(mFragment).getContext();
+ ReflectionHelpers.setField(mFragment, "mContext", context);
final long backgroundBytes = 1234L;
final long foregroundBytes = 5678L;
final List<NetworkCycleDataForUid> appUsage = new ArrayList<>();
@@ -223,4 +228,53 @@
verify(backgroundPref).setSummary(DataUsageUtils.formatDataUsage(context, backgroundBytes));
verify(foregroundPref).setSummary(DataUsageUtils.formatDataUsage(context, foregroundBytes));
}
+
+ @Test
+ public void onCreateLoader_categoryApp_shouldQueryDataUsageUsingAppKey() {
+ mFragment = new AppDataUsage();
+ final Context context = RuntimeEnvironment.application;
+ final int testUid = 123123;
+ final AppItem appItem = new AppItem(testUid);
+ appItem.category = AppItem.CATEGORY_APP;
+ ReflectionHelpers.setField(mFragment, "mContext", context);
+ ReflectionHelpers.setField(mFragment, "mAppItem", appItem);
+ ReflectionHelpers.setField(mFragment, "mTemplate",
+ NetworkTemplate.buildTemplateWifiWildcard());
+ final long end = System.currentTimeMillis();
+ final long start = end - (DateUtils.WEEK_IN_MILLIS * 4);
+
+ final NetworkCycleDataForUidLoader loader = (NetworkCycleDataForUidLoader)
+ mFragment.mUidDataCallbacks.onCreateLoader(0, Bundle.EMPTY);
+
+ final List<Integer> uids = loader.getUids();
+ assertThat(uids).hasSize(1);
+ assertThat(uids.get(0)).isEqualTo(testUid);
+ }
+
+ @Test
+ public void onCreateLoader_categoryUser_shouldQueryDataUsageUsingAssociatedUids() {
+ mFragment = new AppDataUsage();
+ final Context context = RuntimeEnvironment.application;
+ final int testUserId = 11;
+ final AppItem appItem = new AppItem(testUserId);
+ appItem.category = AppItem.CATEGORY_USER;
+ appItem.addUid(123);
+ appItem.addUid(456);
+ appItem.addUid(789);
+ ReflectionHelpers.setField(mFragment, "mContext", context);
+ ReflectionHelpers.setField(mFragment, "mAppItem", appItem);
+ ReflectionHelpers.setField(mFragment, "mTemplate",
+ NetworkTemplate.buildTemplateWifiWildcard());
+ final long end = System.currentTimeMillis();
+ final long start = end - (DateUtils.WEEK_IN_MILLIS * 4);
+
+ final NetworkCycleDataForUidLoader loader = (NetworkCycleDataForUidLoader)
+ mFragment.mUidDataCallbacks.onCreateLoader(0, Bundle.EMPTY);
+
+ final List<Integer> uids = loader.getUids();
+ assertThat(uids).hasSize(3);
+ assertThat(uids.get(0)).isEqualTo(123);
+ assertThat(uids.get(1)).isEqualTo(456);
+ assertThat(uids.get(2)).isEqualTo(789);
+ }
}
diff --git a/tests/robotests/src/com/android/settings/location/RecentLocationAccessPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/location/RecentLocationAccessPreferenceControllerTest.java
index 8cba1de..2d3cb0c 100644
--- a/tests/robotests/src/com/android/settings/location/RecentLocationAccessPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/location/RecentLocationAccessPreferenceControllerTest.java
@@ -24,6 +24,7 @@
import android.content.Context;
import android.graphics.drawable.Drawable;
+import android.provider.DeviceConfig;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
@@ -32,9 +33,11 @@
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
+import com.android.settings.testutils.shadow.ShadowDeviceConfig;
import com.android.settingslib.location.RecentLocationAccesses;
import com.android.settingslib.widget.LayoutPreference;
+import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
@@ -43,11 +46,13 @@
import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
+import org.robolectric.annotation.Config;
import java.util.ArrayList;
import java.util.List;
@RunWith(RobolectricTestRunner.class)
+@Config(shadows = {ShadowDeviceConfig.class})
public class RecentLocationAccessPreferenceControllerTest {
@Mock
private LayoutPreference mLayoutPreference;
@@ -76,6 +81,25 @@
mAppEntitiesHeaderView);
}
+ @After
+ public void tearDown() {
+ ShadowDeviceConfig.reset();
+ }
+
+ @Test
+ public void isAvailable_permissionHubNotSet_shouldReturnFalse() {
+ // We have not yet set the property to show the Permissions Hub.
+ assertThat(mController.isAvailable()).isEqualTo(false);
+ }
+
+ @Test
+ public void isAvailable_permissionHubEnabled_shouldReturnTrue() {
+ DeviceConfig.setProperty(DeviceConfig.Privacy.NAMESPACE,
+ DeviceConfig.Privacy.PROPERTY_PERMISSIONS_HUB_ENABLED, "true", true);
+
+ assertThat(mController.isAvailable()).isEqualTo(true);
+ }
+
/** Verifies the title text, details text are correct, and the click listener is set. */
@Test
@Ignore
diff --git a/tests/robotests/src/com/android/settings/privacy/PermissionBarChartPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/privacy/PermissionBarChartPreferenceControllerTest.java
index 119ac7d..b947630 100644
--- a/tests/robotests/src/com/android/settings/privacy/PermissionBarChartPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/privacy/PermissionBarChartPreferenceControllerTest.java
@@ -17,6 +17,7 @@
package com.android.settings.privacy;
import static com.android.settings.core.BasePreferenceController.AVAILABLE_UNSEARCHABLE;
+import static com.android.settings.core.BasePreferenceController.UNSUPPORTED_ON_DEVICE;
import static com.google.common.truth.Truth.assertThat;
@@ -28,13 +29,16 @@
import android.content.Context;
import android.permission.RuntimePermissionUsageInfo;
+import android.provider.DeviceConfig;
import androidx.preference.PreferenceScreen;
+import com.android.settings.testutils.shadow.ShadowDeviceConfig;
import com.android.settingslib.widget.BarChartInfo;
import com.android.settingslib.widget.BarChartPreference;
import com.android.settingslib.widget.BarViewInfo;
+import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -42,11 +46,13 @@
import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
+import org.robolectric.annotation.Config;
import java.util.ArrayList;
import java.util.List;
@RunWith(RobolectricTestRunner.class)
+@Config(shadows = {ShadowDeviceConfig.class})
public class PermissionBarChartPreferenceControllerTest {
@Mock
@@ -65,8 +71,22 @@
.thenReturn((BarChartPreference) mPreference);
}
+ @After
+ public void tearDown() {
+ ShadowDeviceConfig.reset();
+ }
+
@Test
- public void getAvailabilityStatus_shouldReturnAvailableUnsearchable() {
+ public void getAvailabilityStatus_permissionHubNotSet_shouldReturnUnsupported() {
+ // We have not yet set the property to show the Permissions Hub.
+ assertThat(mController.getAvailabilityStatus()).isEqualTo(UNSUPPORTED_ON_DEVICE);
+ }
+
+ @Test
+ public void getAvailabilityStatus_permissionHubEnabled_shouldReturnAvailableUnsearchable() {
+ DeviceConfig.setProperty(DeviceConfig.Privacy.NAMESPACE,
+ DeviceConfig.Privacy.PROPERTY_PERMISSIONS_HUB_ENABLED, "true", true);
+
assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE_UNSEARCHABLE);
}
diff --git a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowDeviceConfig.java b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowDeviceConfig.java
index d46e755..dfd0988 100644
--- a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowDeviceConfig.java
+++ b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowDeviceConfig.java
@@ -19,21 +19,32 @@
import org.robolectric.annotation.Config;
import org.robolectric.annotation.Implementation;
import org.robolectric.annotation.Implements;
+import org.robolectric.annotation.Resetter;
+
+import java.util.HashMap;
+import java.util.Map;
@Implements(android.provider.DeviceConfig.class)
public class ShadowDeviceConfig {
- private static String configValue;
+ private static Map<String, String> sPropertyMaps = new HashMap<>();
+
+ @Resetter
+ public static void reset() {
+ sPropertyMaps.clear();
+ }
@Implementation
- protected static boolean setProperty(
- String namespace, String name, String value, boolean makeDefault) {
- configValue = value;
+ public static boolean setProperty(
+ String namespace, String name, String value, boolean makeDefault) {
+ sPropertyMaps.put(name, value);
return true;
}
@Implementation
- protected static String getProperty(String ns, String key) { return configValue; }
+ public static String getProperty(String namespace, String name) {
+ return sPropertyMaps.get(name);
+ }
}
diff --git a/tests/robotests/src/com/android/settings/widget/RoundedHomepageIconTest.java b/tests/robotests/src/com/android/settings/widget/AdaptiveHomepageIconTest.java
similarity index 83%
rename from tests/robotests/src/com/android/settings/widget/RoundedHomepageIconTest.java
rename to tests/robotests/src/com/android/settings/widget/AdaptiveHomepageIconTest.java
index 21ba907..32690a3 100644
--- a/tests/robotests/src/com/android/settings/widget/RoundedHomepageIconTest.java
+++ b/tests/robotests/src/com/android/settings/widget/AdaptiveHomepageIconTest.java
@@ -37,9 +37,9 @@
import android.os.Bundle;
import com.android.settings.R;
+import com.android.settings.homepage.AdaptiveIconShapeDrawable;
import com.android.settingslib.drawer.CategoryKey;
import com.android.settingslib.drawer.Tile;
-import com.android.settingslib.testutils.DrawableTestHelper;
import org.junit.Before;
import org.junit.Test;
@@ -48,7 +48,7 @@
import org.robolectric.RuntimeEnvironment;
@RunWith(RobolectricTestRunner.class)
-public class RoundedHomepageIconTest {
+public class AdaptiveHomepageIconTest {
private Context mContext;
private ActivityInfo mActivityInfo;
@@ -64,18 +64,17 @@
@Test
public void createIcon_shouldSetBackgroundAndInset() {
- final RoundedHomepageIcon icon =
- new RoundedHomepageIcon(mContext, new ColorDrawable(Color.BLACK));
+ final AdaptiveHomepageIcon icon =
+ new AdaptiveHomepageIcon(mContext, new ColorDrawable(Color.BLACK));
assertThat(icon.getNumberOfLayers()).isEqualTo(2);
- DrawableTestHelper.assertDrawableResId(icon.getDrawable(0),
- R.drawable.ic_homepage_generic_background);
+ assertThat(icon.getDrawable(0)).isInstanceOf(AdaptiveIconShapeDrawable.class);
}
@Test
public void setBackgroundColor_shouldUpdateColorFilter() {
- final RoundedHomepageIcon icon =
- spy(new RoundedHomepageIcon(mContext, new ColorDrawable(Color.BLACK)));
+ final AdaptiveHomepageIcon icon =
+ spy(new AdaptiveHomepageIcon(mContext, new ColorDrawable(Color.BLACK)));
final ShapeDrawable background = mock(ShapeDrawable.class);
when(icon.getDrawable(0)).thenReturn(background);
@@ -90,8 +89,8 @@
mActivityInfo.metaData.putInt(META_DATA_PREFERENCE_ICON_BACKGROUND_ARGB, 0xff0000);
doReturn(Icon.createWithResource(mContext, R.drawable.ic_settings))
.when(tile).getIcon(mContext);
- final RoundedHomepageIcon icon =
- new RoundedHomepageIcon(mContext, new ColorDrawable(Color.BLACK));
+ final AdaptiveHomepageIcon icon =
+ new AdaptiveHomepageIcon(mContext, new ColorDrawable(Color.BLACK));
icon.setBackgroundColor(mContext, tile);
assertThat(icon.mBackgroundColor).isEqualTo(0xff0000);
@@ -105,8 +104,8 @@
doReturn(Icon.createWithResource(mContext, R.drawable.ic_settings))
.when(tile).getIcon(mContext);
- final RoundedHomepageIcon icon =
- new RoundedHomepageIcon(mContext, new ColorDrawable(Color.BLACK));
+ final AdaptiveHomepageIcon icon =
+ new AdaptiveHomepageIcon(mContext, new ColorDrawable(Color.BLACK));
icon.setBackgroundColor(mContext, tile);
assertThat(icon.mBackgroundColor)