Merge "Add test cases for the collapsible feature of conditional card"
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 2d2f584..b69cac7 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -2959,6 +2959,17 @@
android:value="true" />
</activity>
+ <activity android:name=".panel.SettingsPanelActivity"
+ android:label="@string/settings_panel_title"
+ android:theme="@style/Theme.BottomDialog"
+ android:excludeFromRecents="true"
+ android:launchMode="singleTask">
+ <intent-filter>
+ <action android:name="android.settings.SETTINGSPANEL" />
+ <category android:name="android.intent.category.DEFAULT" />
+ </intent-filter>
+ </activity>
+
<provider android:name=".slices.SettingsSliceProvider"
android:authorities="com.android.settings.slices;android.settings.slices"
android:exported="true"
diff --git a/color-check-baseline.xml b/color-check-baseline.xml
index 0ae001d..1a69b13 100644
--- a/color-check-baseline.xml
+++ b/color-check-baseline.xml
@@ -1177,7 +1177,7 @@
priority="4"
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
- errorLine1=" <color name="homepage_accessibility_background">#5011C1</color>"
+ errorLine1=" <color name="homepage_accessibility_background">#783BE5</color>"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
@@ -1209,7 +1209,7 @@
priority="4"
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
- errorLine1=" <color name="homepage_support_background">#26459C</color>"
+ errorLine1=" <color name="homepage_support_background">#3F5FBD</color>"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
diff --git a/res/drawable/ic_launcher_settings.xml b/res/drawable/ic_launcher_settings.xml
index cdf9e35..9ede59d 100644
--- a/res/drawable/ic_launcher_settings.xml
+++ b/res/drawable/ic_launcher_settings.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
- <background android:drawable="@*android:color/accent_device_default_light"/>
+ <background android:drawable="@color/icon_launcher_setting_color"/>
<foreground android:drawable="@mipmap/ic_launcher_settings"/>
</adaptive-icon>
diff --git a/res/layout/layout_preference_frame.xml b/res/drawable/settings_panel_background.xml
similarity index 61%
copy from res/layout/layout_preference_frame.xml
copy to res/drawable/settings_panel_background.xml
index eec3d7a..36c58e0 100644
--- a/res/layout/layout_preference_frame.xml
+++ b/res/drawable/settings_panel_background.xml
@@ -1,5 +1,5 @@
-<!--
- Copyright (C) 2015 The Android Open Source Project
+<?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.
@@ -13,6 +13,10 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content" />
+
+<inset xmlns:android="http://schemas.android.com/apk/res/android" android:inset="4dp">
+ <shape android:shape="rectangle">
+ <corners android:radius="8dp" />
+ <solid android:color="?android:attr/colorBackground" />
+ </shape>
+</inset>
\ No newline at end of file
diff --git a/res/layout/homepage_slice_tile.xml b/res/layout/homepage_slice_tile.xml
index dbdb91b..e062dba 100644
--- a/res/layout/homepage_slice_tile.xml
+++ b/res/layout/homepage_slice_tile.xml
@@ -30,8 +30,6 @@
android:id="@+id/slice_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginBottom="@dimen/homepage_card_vertical_margin"
- android:layout_marginTop="@dimen/homepage_card_vertical_margin"
android:paddingStart="@dimen/homepage_card_padding_start"
android:paddingEnd="@dimen/homepage_card_padding_end"/>
diff --git a/res/layout/panel_layout.xml b/res/layout/panel_layout.xml
new file mode 100644
index 0000000..cbdd53f
--- /dev/null
+++ b/res/layout/panel_layout.xml
@@ -0,0 +1,26 @@
+<?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
+ -->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/panel_parent_layout"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingLeft="24dp"
+ android:paddingRight="24dp"
+ android:paddingBottom="8dp"
+ android:layout_margin="4dp"
+ android:orientation="vertical">
+</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/settings_entity_header.xml b/res/layout/settings_entity_header.xml
deleted file mode 100644
index 5f5fe00..0000000
--- a/res/layout/settings_entity_header.xml
+++ /dev/null
@@ -1,105 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2017 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.
- -->
-
-<!-- Entity header -->
-<RelativeLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/entity_header"
- style="@style/EntityHeader"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal">
-
- <LinearLayout
- android:id="@+id/entity_header_content"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_centerHorizontal="true"
- android:gravity="center_horizontal"
- android:orientation="vertical">
-
- <ImageView
- android:id="@+id/entity_header_icon"
- android:layout_width="48dp"
- android:layout_height="48dp"
- android:scaleType="fitXY"
- android:antialias="true"/>
-
- <TextView
- android:id="@+id/entity_header_title"
- style="@style/TextAppearance.EntityHeaderTitle"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:singleLine="false"
- android:ellipsize="marquee"
- android:textDirection="locale"
- android:layout_marginTop="8dp"/>
-
- <TextView
- android:id="@+id/install_type"
- style="@style/TextAppearance.EntityHeaderSummary"
- android:visibility="gone"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="2dp"/>
-
- <TextView
- android:id="@+id/entity_header_summary"
- style="@style/TextAppearance.EntityHeaderSummary"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="2dp"/>
-
- <TextView
- android:id="@+id/entity_header_second_summary"
- style="@style/TextAppearance.EntityHeaderSummary"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content" />
-
- </LinearLayout>
-
- <LinearLayout
- android:id="@+id/entity_header_links"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:layout_centerVertical="true"
- android:layout_alignParentEnd="true"
- android:orientation="vertical">
-
- <ImageButton
- android:id="@android:id/button1"
- style="?android:attr/actionOverflowButtonStyle"
- android:layout_width="wrap_content"
- android:layout_weight="1"
- android:layout_height="0dp"
- android:minWidth="@dimen/min_tap_target_size"
- android:src="@null"
- android:tint="?android:attr/colorAccent" />
-
- <ImageButton
- android:id="@android:id/button2"
- style="?android:attr/actionOverflowButtonStyle"
- android:layout_width="wrap_content"
- android:layout_weight="1"
- android:layout_height="0dp"
- android:minWidth="@dimen/min_tap_target_size"
- android:src="@null"
- android:tint="?android:attr/colorAccent" />
-
- </LinearLayout>
-
-</RelativeLayout>
diff --git a/res/layout/settings_homepage_container.xml b/res/layout/settings_homepage_container.xml
index 7a84e32..42b78b4 100644
--- a/res/layout/settings_homepage_container.xml
+++ b/res/layout/settings_homepage_container.xml
@@ -42,7 +42,9 @@
<FrameLayout
android:id="@+id/contextual_cards_content"
android:layout_width="match_parent"
- android:layout_height="wrap_content"/>
+ android:layout_height="wrap_content"
+ android:layout_marginStart="@dimen/homepage_card_side_margin"
+ android:layout_marginEnd="@dimen/homepage_card_side_margin"/>
<FrameLayout
android:id="@+id/main_content"
diff --git a/res/layout/layout_preference_frame.xml b/res/layout/settings_panel.xml
similarity index 75%
rename from res/layout/layout_preference_frame.xml
rename to res/layout/settings_panel.xml
index eec3d7a..aec898c 100644
--- a/res/layout/layout_preference_frame.xml
+++ b/res/layout/settings_panel.xml
@@ -1,5 +1,5 @@
-<!--
- Copyright (C) 2015 The Android Open Source Project
+<?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.
@@ -14,5 +14,6 @@
limitations under the License.
-->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content" />
+ android:id="@+id/main_content"
+ android:layout_height="match_parent"
+ android:layout_width="match_parent"/>
\ No newline at end of file
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 34885b4..f470610 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -121,9 +121,9 @@
<color name="homepage_storage_background">#C14CE6</color>
<color name="homepage_security_background">#0F9D58</color>
<color name="homepage_accounts_background">#F15B8D</color>
- <color name="homepage_accessibility_background">#5011C1</color>
+ <color name="homepage_accessibility_background">#783BE5</color>
<color name="homepage_system_background">#9E9E9E</color>
- <color name="homepage_support_background">#26459C</color>
+ <color name="homepage_support_background">#3F5FBD</color>
<color name="homepage_generic_icon_background">#1A73E8</color>
<color name="homepage_location_background">#2EC7DC</color>
<color name="homepage_about_background">#9FA8DA</color>
@@ -149,5 +149,8 @@
<color name="face_anim_particle_color_3">#ff4caf50</color> <!-- Material Green 500 -->
<color name="face_anim_particle_color_4">#fffdd835</color> <!-- Material Yellow 600 -->
<color name="face_anim_particle_error">#ff9e9e9e</color> <!-- Material Gray 500 -->
+
+ <!-- launcher icon color -->
+ <color name="icon_launcher_setting_color">@*android:color/accent_device_default_light</color>
</resources>
diff --git a/res/values/config.xml b/res/values/config.xml
index d487f46..917f14d 100755
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -150,4 +150,14 @@
<string name="config_settingsintelligence_package_name" translatable="false">
com.android.settings.intelligence
</string>
+
+ <!-- Emergency app package name -->
+ <string name="config_emergency_package_name" translatable="false">
+ com.android.emergency
+ </string>
+ <!-- Emergency app intent action -->
+ <string name="config_emergency_intent_action" translatable="false">
+ android.settings.EDIT_EMERGENCY_INFO
+ </string>
+
</resources>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 8f44c69..075979d 100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -329,8 +329,8 @@
<dimen name="homepage_card_icon_size">24dp</dimen>
<dimen name="homepage_card_corner_radius">8dp</dimen>
<dimen name="homepage_card_elevation">2dp</dimen>
- <dimen name="homepage_card_vertical_margin">4dp</dimen>
- <dimen name="homepage_card_side_margin">8dp</dimen>
+ <dimen name="homepage_card_vertical_margin">8dp</dimen>
+ <dimen name="homepage_card_side_margin">4dp</dimen>
<dimen name="homepage_card_padding_start">16dp</dimen>
<dimen name="homepage_card_padding_end">16dp</dimen>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index e93e06f..bec62e9 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -4578,22 +4578,24 @@
<!-- Summary for the accessibility preference for master mono. [CHAR LIMIT=50] -->
<string name="accessibility_toggle_master_mono_summary">Combine channels when playing audio</string>
- <!-- Title for accessibility preference to accessibility timeout. [CHAR LIMIT=35] -->
+ <!-- Option heading to leave the timeout requirement for accessibility users at its default level. [CHAR LIMIT=35] -->
<string name="accessibility_timeout_default">Default</string>
- <!-- Title for accessibility preference to accessibility timeout. [CHAR LIMIT=35] -->
+ <!-- Option heading to leave the timeout requirement for accessibility users at 10 secs. [CHAR LIMIT=35] -->
<string name="accessibility_timeout_10secs">10 seconds</string>
- <!-- Title for accessibility preference to accessibility timeout. [CHAR LIMIT=35] -->
+ <!-- Option heading to leave the timeout requirement for accessibility users at 30 secs. [CHAR LIMIT=35] -->
<string name="accessibility_timeout_30secs">30 seconds</string>
- <!-- Title for accessibility preference to accessibility timeout. [CHAR LIMIT=35] -->
+ <!-- Option heading to leave the timeout requirement for accessibility users at 1 min. [CHAR LIMIT=35] -->
<string name="accessibility_timeout_1min">1 minute</string>
- <!-- Title for accessibility preference to accessibility timeout. [CHAR LIMIT=35] -->
+ <!-- Option heading to leave the timeout requirement for accessibility users at 2 mins. [CHAR LIMIT=35] -->
<string name="accessibility_timeout_2mins">2 minutes</string>
- <!-- Title for accessibility preference to accessibility message_timeout. [CHAR LIMIT=35] -->
- <string name="accessibility_accessibility_content_timeout_preference_title">Content Timeout</string>
- <!-- Title for accessibility preference to accessibility message_timeout. [CHAR LIMIT=35] -->
- <string name="accessibility_accessibility_control_timeout_preference_title">Control Timeout</string>
- <!-- Title for accessibility preference to accessibility message_timeout. [CHAR LIMIT=NONE] -->
- <string name="accessibility_accessibility_timeout_preference_summary">Choose how long it takes before automatically disappearing messages go away.\nSome apps may not support this setting yet.</string>
+ <!-- Title for accessibility preference to accessibility timeout. [CHAR LIMIT=35] -->
+ <string name="accessibility_content_timeout_preference_title">Time to read</string>
+ <!-- Title for accessibility preference to accessibility timeout. [CHAR LIMIT=35] -->
+ <string name="accessibility_control_timeout_preference_title">Time to take action</string>
+ <!-- Descriptive text for accessibility preference to accessibility content timeout. [CHAR LIMIT=NONE] -->
+ <string name="accessibility_content_timeout_preference_summary">Choose how much time you want to read and take action on messages that automatically go away.\n\nSupport for this setting is up to each app.</string>
+ <!-- Descriptive text for accessibility preference to accessibility control timeout. [CHAR LIMIT=NONE] -->
+ <string name="accessibility_control_timeout_preference_summary">Choose how long to show messages that ask you to take action, but are visible only temporarily.\n\nNot all apps support this setting.</string>
<!-- Title for accessibility preference to choose long-press delay i.e. timeout before it is detected. [CHAR LIMIT=35] -->
<string name="accessibility_long_press_timeout_preference_title">Touch & hold delay</string>
@@ -5424,9 +5426,9 @@
<string name="battery_saver_turn_on_automatically_pct">at <xliff:g id="percent">%1$s</xliff:g> battery</string>
<!-- [CHAR_LIMIT=40] Battery percentage: Title -->
- <string name="battery_percentage">Battery percentage</string>
+ <string name="battery_info">Battery Information</string>
<!-- [CHAR_LIMIT=NONE] Battery percentage: Description for preference -->
- <string name="battery_percentage_description">Show battery percentage in status bar</string>
+ <string name="battery_info_description">Show percentage and time left before charge is needed</string>
<!-- Process Stats strings -->
<skip />
@@ -10079,6 +10081,9 @@
<!-- Title for HFP(hands free profile) output switch button in settings. -->
<string name="take_call_on_title">Take call on</string>
+ <!-- Toast that appears when users tap an APN for which parameters cannot be viewed. [CHAR LIMIT=NONE] -->
+ <string name="cannot_change_apn_toast">This APN cannot be changed.</string>
+
<!-- Title for battery Suggestion. (tablet) [CHAR LIMIT=46] -->
<string name="battery_suggestion_title" product="tablet" >Improve tablet\'s battery life</string>
<!-- Title for battery Suggestion. (device) [CHAR LIMIT=46] -->
@@ -10294,8 +10299,8 @@
<!-- Available networks screen, summary when button disallowed due to permanent automatic mode [CHAR LIMIT=NONE] -->
<string name="manual_mode_disallowed_summary">Unavailable when connected to <xliff:g id="carrier" example="verizon">%1$s</xliff:g></string>
- <!-- Used for EmergencyInfoSlice slice helper class -->
- <string name="emergency_info_contextual_card_summary" translatable="false">Medical info, emergency contacts</string>
+ <!-- Used for EmergencyInfoSlice slice helper class [CHAR LIMIT=NONE]-->
+ <string name="emergency_info_contextual_card_summary">Medical info, emergency contacts</string>
<!-- See more items in contextual homepage [CHAR LIMIT=30]-->
<string name="see_more">See more</string>
@@ -10317,6 +10322,12 @@
<!-- Title for no connected devices in connected device slice. [CHAR LIMIT=NONE] -->
<string name="no_connected_devices">No connected devices</string>
+ <!-- Default title for the settings panel [CHAR LIMIT=NONE] -->
+ <string name="settings_panel_title">Settings Panel</string>
+
+ <!-- Title for the Internet Connectivity dialog (settings panel) with Internet related settings [CHAR LIMIT=50] -->
+ <string name="internet_connectivity_panel_title">Internet Connectivity</string>
+
<!-- UI debug setting: force desktop mode [CHAR LIMIT=50] -->
<string name="force_desktop_mode">Force desktop mode</string>
<!-- UI debug setting: force desktop mode summary [CHAR LIMIT=NONE] -->
diff --git a/res/values/styles.xml b/res/values/styles.xml
index cfc5fd3..4be1bb3 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -331,23 +331,6 @@
<item name="android:textColor">?android:attr/textColorSecondary</item>
</style>
- <style name="TextAppearance.EntityHeaderTitle"
- parent="@android:style/TextAppearance.Material.Subhead">
- <item name="android:fontFamily">@*android:string/config_headlineFontFamilyMedium</item>
- <item name="android:textColor">?android:attr/textColorPrimary</item>
- <item name="android:textSize">20sp</item>
- </style>
-
- <style name="TextAppearance.EntityHeaderSummary"
- parent="@android:style/TextAppearance.Material.Body1">
- <item name="android:textAlignment">viewStart</item>
- <item name="android:textColor">?android:attr/textColorSecondary</item>
- <item name="android:gravity">start</item>
- <item name="android:singleLine">true</item>
- <item name="android:ellipsize">marquee</item>
- <item name="android:textSize">14sp</item>
- </style>
-
<style name="TextAppearance.ZenOnboardingButton">
<item name="android:fontFamily">sans-serif-medium</item>
<item name="android:textSize">14sp</item>
@@ -418,13 +401,6 @@
<item name="android:progressDrawable">@drawable/ring_progress</item>
</style>
- <style name="EntityHeader">
- <item name="android:background">?android:attr/colorPrimaryDark</item>
- <item name="android:paddingTop">24dp</item>
- <item name="android:paddingBottom">16dp</item>
- <item name="android:paddingEnd">16dp</item>
- </style>
-
<style name="ActionPrimaryButton" parent="android:Widget.DeviceDefault.Button.Colored"/>
<style name="ActionSecondaryButton" parent="android:Widget.DeviceDefault.Button"/>
@@ -482,7 +458,6 @@
</style>
<style name="ContextualCardStyle">
- <item name="android:layout_marginTop">@dimen/homepage_card_vertical_margin</item>
<item name="android:layout_marginBottom">@dimen/homepage_card_vertical_margin</item>
<item name="android:layout_marginStart">@dimen/homepage_card_side_margin</item>
<item name="android:layout_marginEnd">@dimen/homepage_card_side_margin</item>
diff --git a/res/values/themes.xml b/res/values/themes.xml
index b280482..873216d 100644
--- a/res/values/themes.xml
+++ b/res/values/themes.xml
@@ -200,4 +200,8 @@
<item name="cardBackgroundColor">?android:attr/colorBackground</item>
</style>
+ <style name="Theme.BottomDialog" parent="@*android:style/Theme.DeviceDefault.Settings.Dialog">
+ <item name="android:windowBackground">@drawable/settings_panel_background</item>
+ </style>
+
</resources>
diff --git a/res/xml/accessibility_content_timeout_settings.xml b/res/xml/accessibility_content_timeout_settings.xml
index 51573c9..d450449 100644
--- a/res/xml/accessibility_content_timeout_settings.xml
+++ b/res/xml/accessibility_content_timeout_settings.xml
@@ -19,7 +19,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:key="accessibility_content_timeout_preference"
- android:title="@string/accessibility_accessibility_content_timeout_preference_title"
+ android:title="@string/accessibility_content_timeout_preference_title"
android:persistent="false" >
<com.android.settings.widget.VideoPreference
@@ -32,7 +32,7 @@
android:key="accessibility_content_timeout_summary"
android:selectable="false"
android:enabled="true"
- android:summary="@string/accessibility_accessibility_timeout_preference_summary"
+ android:summary="@string/accessibility_content_timeout_preference_summary"
android:persistent="false" />
<com.android.settings.widget.RadioButtonPreference
diff --git a/res/xml/accessibility_control_timeout_settings.xml b/res/xml/accessibility_control_timeout_settings.xml
index 4559650..6d8e1d0 100644
--- a/res/xml/accessibility_control_timeout_settings.xml
+++ b/res/xml/accessibility_control_timeout_settings.xml
@@ -19,7 +19,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:key="accessibility_control_timeout_preference"
- android:title="@string/accessibility_accessibility_control_timeout_preference_title"
+ android:title="@string/accessibility_control_timeout_preference_title"
android:persistent="false" >
<com.android.settings.widget.VideoPreference
@@ -32,7 +32,7 @@
android:key="accessibility_control_timeout_summary"
android:selectable="false"
android:enabled="true"
- android:summary="@string/accessibility_accessibility_timeout_preference_summary"
+ android:summary="@string/accessibility_control_timeout_preference_summary"
android:persistent="false" />
<com.android.settings.widget.RadioButtonPreference
diff --git a/res/xml/accessibility_settings.xml b/res/xml/accessibility_settings.xml
index 1cd4a48..cc07ce1 100644
--- a/res/xml/accessibility_settings.xml
+++ b/res/xml/accessibility_settings.xml
@@ -75,8 +75,7 @@
<Preference
android:fragment="com.android.settings.accessibility.AccessibilityContentTimeoutPreferenceFragment"
android:key="accessibility_content_timeout_preference_fragment"
- android:title="@string/accessibility_accessibility_content_timeout_preference_title"
- android:icon="@drawable/ic_accessibility_generic"
+ android:title="@string/accessibility_content_timeout_preference_title"
android:persistent="false" />
</PreferenceCategory>
@@ -111,8 +110,7 @@
<Preference
android:fragment="com.android.settings.accessibility.AccessibilityControlTimeoutPreferenceFragment"
android:key="accessibility_control_timeout_preference_fragment"
- android:title="@string/accessibility_accessibility_control_timeout_preference_title"
- android:icon="@drawable/ic_accessibility_generic"
+ android:title="@string/accessibility_control_timeout_preference_title"
android:persistent="false" />
<Preference
diff --git a/res/xml/account_type_settings.xml b/res/xml/account_type_settings.xml
index 29f92ea..98a5e8b 100644
--- a/res/xml/account_type_settings.xml
+++ b/res/xml/account_type_settings.xml
@@ -19,7 +19,7 @@
android:title="@string/account_settings_title"
settings:keywords="@string/keywords_accounts">
- <com.android.settings.applications.LayoutPreference
+ <com.android.settingslib.widget.LayoutPreference
android:key="account_header"
android:layout="@layout/settings_entity_header"
android:selectable="false"
@@ -35,7 +35,7 @@
android:icon="@drawable/ic_sync"
android:order="200"/>
- <com.android.settings.applications.LayoutPreference
+ <com.android.settingslib.widget.LayoutPreference
android:key="remove_account"
android:layout="@layout/remove_account_button"
android:order="1000"
diff --git a/res/xml/app_data_usage.xml b/res/xml/app_data_usage.xml
index 5eaee96..e64a1c5 100644
--- a/res/xml/app_data_usage.xml
+++ b/res/xml/app_data_usage.xml
@@ -21,7 +21,8 @@
android:title="@string/data_usage_app_summary_title">
<com.android.settings.datausage.SpinnerPreference
- android:key="cycle" />
+ android:key="cycle"
+ settings:isPreferenceVisible="false" />
<PreferenceCategory
android:key="app_data_usage_summary_category">
diff --git a/res/xml/app_info_settings.xml b/res/xml/app_info_settings.xml
index 1e320e4..c13215a 100644
--- a/res/xml/app_info_settings.xml
+++ b/res/xml/app_info_settings.xml
@@ -21,14 +21,14 @@
android:key="installed_app_detail_settings_screen"
settings:initialExpandedChildrenCount="6">
- <com.android.settings.applications.LayoutPreference
+ <com.android.settingslib.widget.LayoutPreference
android:key="header_view"
android:layout="@layout/settings_entity_header"
android:selectable="false"
android:order="-10000"
settings:allowDividerBelow="true"/>
- <com.android.settings.applications.LayoutPreference
+ <com.android.settingslib.widget.LayoutPreference
android:key="instant_app_buttons"
android:layout="@layout/instant_app_buttons"
android:selectable="false"
diff --git a/res/xml/app_notification_settings.xml b/res/xml/app_notification_settings.xml
index 0056ef2..49d64a9 100644
--- a/res/xml/app_notification_settings.xml
+++ b/res/xml/app_notification_settings.xml
@@ -18,11 +18,11 @@
xmlns:settings="http://schemas.android.com/apk/res-auto"
android:key="app_notifications">
- <com.android.settings.applications.LayoutPreference
+ <com.android.settingslib.widget.LayoutPreference
android:key="pref_app_header"
android:layout="@layout/settings_entity_header" />
- <com.android.settings.applications.LayoutPreference
+ <com.android.settingslib.widget.LayoutPreference
android:key="block"
android:layout="@layout/styled_switch_bar" />
diff --git a/res/xml/app_storage_settings.xml b/res/xml/app_storage_settings.xml
index 14ad180..7036d27 100644
--- a/res/xml/app_storage_settings.xml
+++ b/res/xml/app_storage_settings.xml
@@ -34,7 +34,7 @@
android:selectable="false"
android:layout="@layout/horizontal_preference" />
- <com.android.settings.applications.LayoutPreference
+ <com.android.settingslib.widget.LayoutPreference
android:key="change_storage_button"
android:selectable="false"
android:layout="@layout/single_button_panel" />
@@ -78,7 +78,7 @@
android:layout="@layout/preference_category_no_label"
settings:allowDividerAbove="false"
settings:allowDividerBelow="false">
- <com.android.settings.applications.LayoutPreference
+ <com.android.settingslib.widget.LayoutPreference
android:key="clear_uri_button"
android:layout="@layout/single_button_panel"
android:selectable="false" />
diff --git a/res/xml/bluetooth_device_details_fragment.xml b/res/xml/bluetooth_device_details_fragment.xml
index 01114b6..6449e4b 100644
--- a/res/xml/bluetooth_device_details_fragment.xml
+++ b/res/xml/bluetooth_device_details_fragment.xml
@@ -19,7 +19,7 @@
xmlns:settings="http://schemas.android.com/apk/res-auto"
android:title="@string/device_details_title">
- <com.android.settings.applications.LayoutPreference
+ <com.android.settingslib.widget.LayoutPreference
android:key="bluetooth_device_header"
android:layout="@layout/settings_entity_header"
android:selectable="false"
diff --git a/res/xml/channel_notification_settings.xml b/res/xml/channel_notification_settings.xml
index 5afc70d..9e9e7a9 100644
--- a/res/xml/channel_notification_settings.xml
+++ b/res/xml/channel_notification_settings.xml
@@ -20,12 +20,12 @@
android:key="channel_settings"
android:title="@string/notification_channel_title" >
- <com.android.settings.applications.LayoutPreference
+ <com.android.settingslib.widget.LayoutPreference
android:key="pref_app_header"
android:order="1"
android:layout="@layout/settings_entity_header" />
- <com.android.settings.applications.LayoutPreference
+ <com.android.settingslib.widget.LayoutPreference
android:key="block"
android:order="2"
android:layout="@layout/styled_switch_bar" />
diff --git a/res/xml/dream_fragment_overview.xml b/res/xml/dream_fragment_overview.xml
index a6214d1..e4c2eb5 100644
--- a/res/xml/dream_fragment_overview.xml
+++ b/res/xml/dream_fragment_overview.xml
@@ -35,7 +35,7 @@
<!-- Layout preference doesn't obey allowDividerAbove, so put it in a PreferenceCategory -->
<PreferenceCategory
android:key="dream_start_now_category">
- <com.android.settings.applications.LayoutPreference
+ <com.android.settingslib.widget.LayoutPreference
android:key="dream_start_now_button_container"
android:selectable="false"
android:layout="@layout/dream_start_button" />
diff --git a/res/xml/my_device_info.xml b/res/xml/my_device_info.xml
index 7165218..998a2f9 100644
--- a/res/xml/my_device_info.xml
+++ b/res/xml/my_device_info.xml
@@ -21,7 +21,7 @@
android:key="my_device_info_pref_screen"
android:title="@string/about_settings">
- <com.android.settings.applications.LayoutPreference
+ <com.android.settingslib.widget.LayoutPreference
android:key="my_device_info_header"
android:order="0"
android:layout="@layout/settings_entity_header"
diff --git a/res/xml/network_and_internet.xml b/res/xml/network_and_internet.xml
index 8e36e91..c218869 100644
--- a/res/xml/network_and_internet.xml
+++ b/res/xml/network_and_internet.xml
@@ -64,7 +64,7 @@
settings:useAdminDisabledSummary="true" />
<com.android.settingslib.RestrictedSwitchPreference
- android:key="toggle_airplane"
+ android:key="airplane_mode"
android:title="@string/airplane_mode"
android:icon="@drawable/ic_airplanemode_active"
android:disableDependentsState="true"
diff --git a/res/xml/night_display_settings.xml b/res/xml/night_display_settings.xml
index 12c8bc7..b6f6251 100644
--- a/res/xml/night_display_settings.xml
+++ b/res/xml/night_display_settings.xml
@@ -43,7 +43,7 @@
settings:keywords="@string/keywords_display_night_display"
settings:controller="com.android.settings.display.NightDisplayIntensityPreferenceController" />
- <com.android.settings.applications.LayoutPreference
+ <com.android.settingslib.widget.LayoutPreference
android:key="night_display_activated"
android:title="@string/night_display_title"
android:selectable="false"
diff --git a/res/xml/notification_group_settings.xml b/res/xml/notification_group_settings.xml
index 0d4184d..7192f90 100644
--- a/res/xml/notification_group_settings.xml
+++ b/res/xml/notification_group_settings.xml
@@ -17,11 +17,11 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res-auto">
- <com.android.settings.applications.LayoutPreference
+ <com.android.settingslib.widget.LayoutPreference
android:key="pref_app_header"
android:layout="@layout/settings_entity_header" />
- <com.android.settings.applications.LayoutPreference
+ <com.android.settingslib.widget.LayoutPreference
android:key="block"
android:layout="@layout/styled_switch_bar" />
diff --git a/res/xml/power_usage_detail.xml b/res/xml/power_usage_detail.xml
index c854f77..12c7e21 100644
--- a/res/xml/power_usage_detail.xml
+++ b/res/xml/power_usage_detail.xml
@@ -19,7 +19,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res-auto">
- <com.android.settings.applications.LayoutPreference
+ <com.android.settingslib.widget.LayoutPreference
android:key="header_view"
android:layout="@layout/settings_entity_header"
android:selectable="false"
diff --git a/res/xml/power_usage_details.xml b/res/xml/power_usage_details.xml
index 85a2ce7..8c79116 100644
--- a/res/xml/power_usage_details.xml
+++ b/res/xml/power_usage_details.xml
@@ -17,7 +17,7 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res-auto">
- <com.android.settings.applications.LayoutPreference
+ <com.android.settingslib.widget.LayoutPreference
android:key="two_buttons"
android:layout="@layout/two_buttons_panel"
android:selectable="false" />
diff --git a/res/xml/power_usage_summary.xml b/res/xml/power_usage_summary.xml
index b4db4ed..14d8eda 100644
--- a/res/xml/power_usage_summary.xml
+++ b/res/xml/power_usage_summary.xml
@@ -21,7 +21,7 @@
android:title="@string/power_usage_summary_title"
settings:keywords="@string/keywords_battery">
- <com.android.settings.applications.LayoutPreference
+ <com.android.settingslib.widget.LayoutPreference
android:key="battery_header"
android:title="@string/summary_placeholder"
android:selectable="false"
@@ -50,8 +50,8 @@
<SwitchPreference
android:key="battery_percentage"
- android:title="@string/battery_percentage"
- android:summary="@string/battery_percentage_description"
+ android:title="@string/battery_info"
+ android:summary="@string/battery_info_description"
settings:controller="com.android.settings.display.BatteryPercentagePreferenceController" />
diff --git a/res/xml/privacy_dashboard_settings.xml b/res/xml/privacy_dashboard_settings.xml
index 5d11936..79e2e71 100644
--- a/res/xml/privacy_dashboard_settings.xml
+++ b/res/xml/privacy_dashboard_settings.xml
@@ -21,6 +21,7 @@
android:key="privacy_dashboard_page"
android:title="@string/privacy_dashboard_title">
+ <!-- App permissions -->
<Preference
android:key="privacy_manage_perms"
android:title="@string/app_permissions"
@@ -29,6 +30,14 @@
<intent android:action="android.intent.action.MANAGE_PERMISSIONS"/>
</Preference>
+ <!-- On lock screen notifications -->
+ <com.android.settings.RestrictedListPreference
+ android:key="privacy_lock_screen_notifications"
+ android:title="@string/lock_screen_notifications_title"
+ android:summary="@string/summary_placeholder"
+ settings:searchable="false"/>
+
+ <!-- Show passwords -->
<SwitchPreference
android:key="show_password"
android:title="@string/show_password"
@@ -42,4 +51,20 @@
<PreferenceCategory
android:key="dashboard_tile_placeholder"/>
+ <!-- Work profile settings are at the bottom with high order value to avoid users thinking that
+ any of the above settings (including dynamic) are specific to the work profile. -->
+ <PreferenceCategory
+ android:key="privacy_work_profile_notifications_category"
+ android:title="@string/profile_section_header"
+ android:order="998"
+ settings:searchable="false">
+
+ <com.android.settings.RestrictedListPreference
+ android:key="privacy_lock_screen_work_profile_notifications"
+ android:title="@string/locked_work_profile_notification_title"
+ android:summary="@string/summary_placeholder"
+ android:order="999"
+ settings:searchable="false"/>
+ </PreferenceCategory>
+
</PreferenceScreen>
\ No newline at end of file
diff --git a/res/xml/security_settings_face.xml b/res/xml/security_settings_face.xml
index 2bdfdc8..c202a6c 100644
--- a/res/xml/security_settings_face.xml
+++ b/res/xml/security_settings_face.xml
@@ -55,7 +55,7 @@
android:title="@string/security_settings_face_settings_improve_face">
</Preference>
- <com.android.settings.applications.LayoutPreference
+ <com.android.settingslib.widget.LayoutPreference
android:key="security_settings_face_delete_faces_container"
android:selectable="false"
android:layout="@layout/face_remove_button" />
diff --git a/res/xml/usb_details_fragment.xml b/res/xml/usb_details_fragment.xml
index 5c1efcf..4a6cefa 100644
--- a/res/xml/usb_details_fragment.xml
+++ b/res/xml/usb_details_fragment.xml
@@ -20,7 +20,7 @@
android:title="@string/usb_preference"
android:key="usb_details_fragment">
- <com.android.settings.applications.LayoutPreference
+ <com.android.settingslib.widget.LayoutPreference
android:key="usb_device_header"
android:layout="@layout/settings_entity_header"
android:selectable="false"/>
diff --git a/res/xml/wifi_network_details_fragment.xml b/res/xml/wifi_network_details_fragment.xml
index 4198b76..45e7349 100644
--- a/res/xml/wifi_network_details_fragment.xml
+++ b/res/xml/wifi_network_details_fragment.xml
@@ -19,7 +19,7 @@
xmlns:settings="http://schemas.android.com/apk/res-auto"
settings:initialExpandedChildrenCount="5">
- <com.android.settings.applications.LayoutPreference
+ <com.android.settingslib.widget.LayoutPreference
android:key="connection_header"
android:layout="@layout/settings_entity_header"
android:selectable="false"
diff --git a/res/xml/zen_mode_event_rule_settings.xml b/res/xml/zen_mode_event_rule_settings.xml
index ea37855..c871fe1 100644
--- a/res/xml/zen_mode_event_rule_settings.xml
+++ b/res/xml/zen_mode_event_rule_settings.xml
@@ -20,11 +20,11 @@
android:key="zen_mode_event_rule_settings"
android:title="@string/zen_mode_automatic_rule_settings_page_title">
- <com.android.settings.applications.LayoutPreference
+ <com.android.settingslib.widget.LayoutPreference
android:key="pref_app_header"
android:layout="@layout/settings_entity_header" />
- <com.android.settings.applications.LayoutPreference
+ <com.android.settingslib.widget.LayoutPreference
android:key="zen_automatic_rule_switch"
android:layout="@layout/styled_switch_bar" />
diff --git a/res/xml/zen_mode_schedule_rule_settings.xml b/res/xml/zen_mode_schedule_rule_settings.xml
index e201b87..d05bbd2 100644
--- a/res/xml/zen_mode_schedule_rule_settings.xml
+++ b/res/xml/zen_mode_schedule_rule_settings.xml
@@ -20,11 +20,11 @@
android:key="zen_mode_schedule_rule_settings"
android:title="@string/zen_mode_automatic_rule_settings_page_title">
- <com.android.settings.applications.LayoutPreference
+ <com.android.settingslib.widget.LayoutPreference
android:key="pref_app_header"
android:layout="@layout/settings_entity_header" />
- <com.android.settings.applications.LayoutPreference
+ <com.android.settingslib.widget.LayoutPreference
android:key="zen_automatic_rule_switch"
android:layout="@layout/styled_switch_bar" />
diff --git a/res/xml/zen_mode_settings.xml b/res/xml/zen_mode_settings.xml
index 1966484..832150a 100644
--- a/res/xml/zen_mode_settings.xml
+++ b/res/xml/zen_mode_settings.xml
@@ -37,11 +37,6 @@
android:title="@string/zen_mode_messages_title"
android:fragment="com.android.settings.notification.ZenModeMessagesSettings" />
- <!-- Alarms -->
- <SwitchPreference
- android:key="zen_mode_behavior_alarms"
- android:title="@string/zen_mode_alarms"/>
-
<!-- All sounds -->
<Preference
android:key="zen_sound_vibration_settings"
@@ -70,7 +65,7 @@
android:fragment="com.android.settings.notification.ZenModeAutomationSettings"/>
<!-- Turn on DND button -->
- <com.android.settings.applications.LayoutPreference
+ <com.android.settingslib.widget.LayoutPreference
android:key="zen_mode_settings_button_container"
android:selectable="false"
android:layout="@layout/zen_mode_settings_button"
diff --git a/src/com/android/settings/SettingsPreferenceFragment.java b/src/com/android/settings/SettingsPreferenceFragment.java
index 5cfe218..6933cfd 100644
--- a/src/com/android/settings/SettingsPreferenceFragment.java
+++ b/src/com/android/settings/SettingsPreferenceFragment.java
@@ -42,7 +42,6 @@
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
-import com.android.settings.applications.LayoutPreference;
import com.android.settings.core.InstrumentedPreferenceFragment;
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
import com.android.settings.search.Indexable;
@@ -55,6 +54,7 @@
import com.android.settingslib.CustomEditTextPreferenceCompat;
import com.android.settingslib.core.instrumentation.Instrumentable;
import com.android.settingslib.widget.FooterPreferenceMixinCompat;
+import com.android.settingslib.widget.LayoutPreference;
import java.util.UUID;
diff --git a/src/com/android/settings/accounts/AccountHeaderPreferenceController.java b/src/com/android/settings/accounts/AccountHeaderPreferenceController.java
index 36a7021..d762095 100644
--- a/src/com/android/settings/accounts/AccountHeaderPreferenceController.java
+++ b/src/com/android/settings/accounts/AccountHeaderPreferenceController.java
@@ -29,7 +29,6 @@
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
-import com.android.settings.applications.LayoutPreference;
import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.widget.EntityHeaderController;
import com.android.settingslib.accounts.AuthenticatorHelper;
@@ -37,6 +36,7 @@
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnResume;
+import com.android.settingslib.widget.LayoutPreference;
public class AccountHeaderPreferenceController extends AbstractPreferenceController
implements PreferenceControllerMixin, LifecycleObserver, OnResume {
diff --git a/src/com/android/settings/accounts/EmergencyInfoPreferenceController.java b/src/com/android/settings/accounts/EmergencyInfoPreferenceController.java
index 31e5613..408db09 100644
--- a/src/com/android/settings/accounts/EmergencyInfoPreferenceController.java
+++ b/src/com/android/settings/accounts/EmergencyInfoPreferenceController.java
@@ -22,6 +22,7 @@
import android.content.res.Resources;
import android.os.UserHandle;
import android.os.UserManager;
+import android.util.FeatureFlagUtils;
import androidx.preference.Preference;
@@ -63,7 +64,7 @@
@Override
public boolean handlePreferenceTreeClick(Preference preference) {
if (KEY_EMERGENCY_INFO.equals(preference.getKey())) {
- Intent intent = new Intent(ACTION_EDIT_EMERGENCY_INFO);
+ Intent intent = new Intent(getIntentAction(mContext));
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
mContext.startActivity(intent);
return true;
@@ -73,7 +74,7 @@
@Override
public boolean isAvailable() {
- Intent intent = new Intent(ACTION_EDIT_EMERGENCY_INFO).setPackage(PACKAGE_NAME_EMERGENCY);
+ Intent intent = new Intent(getIntentAction(mContext)).setPackage(getPackageName(mContext));
List<ResolveInfo> infos = mContext.getPackageManager().queryIntentActivities(intent, 0);
return infos != null && !infos.isEmpty();
}
@@ -82,4 +83,20 @@
public String getPreferenceKey() {
return KEY_EMERGENCY_INFO;
}
+
+ private String getIntentAction(Context context) {
+ if (FeatureFlagUtils.isEnabled(context, FeatureFlagUtils.SAFETY_HUB)) {
+ return context.getResources().getString(R.string.config_emergency_intent_action);
+ }
+
+ return ACTION_EDIT_EMERGENCY_INFO;
+ }
+
+ private String getPackageName(Context context) {
+ if (FeatureFlagUtils.isEnabled(context, FeatureFlagUtils.SAFETY_HUB)) {
+ return context.getResources().getString(R.string.config_emergency_package_name);
+ }
+
+ return PACKAGE_NAME_EMERGENCY;
+ }
}
diff --git a/src/com/android/settings/accounts/RemoveAccountPreferenceController.java b/src/com/android/settings/accounts/RemoveAccountPreferenceController.java
index 9770332..06eddd3 100644
--- a/src/com/android/settings/accounts/RemoveAccountPreferenceController.java
+++ b/src/com/android/settings/accounts/RemoveAccountPreferenceController.java
@@ -39,13 +39,13 @@
import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R;
-import com.android.settings.applications.LayoutPreference;
import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
import com.android.settingslib.RestrictedLockUtils;
import com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
import com.android.settingslib.RestrictedLockUtilsInternal;
import com.android.settingslib.core.AbstractPreferenceController;
+import com.android.settingslib.widget.LayoutPreference;
import java.io.IOException;
diff --git a/src/com/android/settings/applications/AppStorageSettings.java b/src/com/android/settings/applications/AppStorageSettings.java
index 841fb51..61ce33d 100644
--- a/src/com/android/settings/applications/AppStorageSettings.java
+++ b/src/com/android/settings/applications/AppStorageSettings.java
@@ -58,6 +58,7 @@
import com.android.settingslib.applications.ApplicationsState.Callbacks;
import com.android.settingslib.applications.StorageStatsSource;
import com.android.settingslib.applications.StorageStatsSource.AppStorageStats;
+import com.android.settingslib.widget.LayoutPreference;
import java.util.Collections;
import java.util.List;
diff --git a/src/com/android/settings/applications/LayoutPreference.java b/src/com/android/settings/applications/LayoutPreference.java
deleted file mode 100644
index 9c3cfaf..0000000
--- a/src/com/android/settings/applications/LayoutPreference.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.settings.applications;
-
-import android.content.Context;
-import android.content.res.TypedArray;
-import android.util.AttributeSet;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.FrameLayout;
-
-import androidx.core.content.res.TypedArrayUtils;
-import androidx.preference.Preference;
-import androidx.preference.PreferenceViewHolder;
-
-import com.android.settings.R;
-import com.android.settings.Utils;
-
-public class LayoutPreference extends Preference {
-
- private final View.OnClickListener mClickListener = v -> performClick(v);
- private boolean mAllowDividerAbove;
- private boolean mAllowDividerBelow;
- private View mRootView;
-
- public LayoutPreference(Context context, AttributeSet attrs) {
- super(context, attrs);
- init(context, attrs, 0 /* defStyleAttr */);
- }
-
- public LayoutPreference(Context context, AttributeSet attrs, int defStyleAttr) {
- super(context, attrs, defStyleAttr);
- init(context, attrs, defStyleAttr);
- }
-
- public LayoutPreference(Context context, int resource) {
- this(context, LayoutInflater.from(context).inflate(resource, null, false));
- }
-
- public LayoutPreference(Context context, View view) {
- super(context);
- setView(view);
- }
-
- private void init(Context context, AttributeSet attrs, int defStyleAttr) {
- TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.Preference);
- mAllowDividerAbove = TypedArrayUtils.getBoolean(a, R.styleable.Preference_allowDividerAbove,
- R.styleable.Preference_allowDividerAbove, false);
- mAllowDividerBelow = TypedArrayUtils.getBoolean(a, R.styleable.Preference_allowDividerBelow,
- R.styleable.Preference_allowDividerBelow, false);
- a.recycle();
-
- a = context.obtainStyledAttributes(
- attrs, com.android.internal.R.styleable.Preference, defStyleAttr, 0);
- int layoutResource = a.getResourceId(com.android.internal.R.styleable.Preference_layout,
- 0);
- if (layoutResource == 0) {
- throw new IllegalArgumentException("LayoutPreference requires a layout to be defined");
- }
- a.recycle();
-
- // Need to create view now so that findViewById can be called immediately.
- final View view = LayoutInflater.from(getContext())
- .inflate(layoutResource, null, false);
- setView(view);
- }
-
- private void setView(View view) {
- setLayoutResource(R.layout.layout_preference_frame);
- final ViewGroup allDetails = view.findViewById(R.id.all_details);
- if (allDetails != null) {
- Utils.forceCustomPadding(allDetails, true /* additive padding */);
- }
- mRootView = view;
- setShouldDisableView(false);
- }
-
- @Override
- public void onBindViewHolder(PreferenceViewHolder holder) {
- holder.itemView.setOnClickListener(mClickListener);
-
- final boolean selectable = isSelectable();
- holder.itemView.setFocusable(selectable);
- holder.itemView.setClickable(selectable);
- holder.setDividerAllowedAbove(mAllowDividerAbove);
- holder.setDividerAllowedBelow(mAllowDividerBelow);
-
- FrameLayout layout = (FrameLayout) holder.itemView;
- layout.removeAllViews();
- ViewGroup parent = (ViewGroup) mRootView.getParent();
- if (parent != null) {
- parent.removeView(mRootView);
- }
- layout.addView(mRootView);
- }
-
- public <T extends View> T findViewById(int id) {
- return mRootView.findViewById(id);
- }
-
- public void setAllowDividerBelow(boolean allowed) {
- mAllowDividerBelow = allowed;
- }
-
- public boolean isAllowDividerBelow() {
- return mAllowDividerBelow;
- }
-}
\ No newline at end of file
diff --git a/src/com/android/settings/applications/appinfo/AppHeaderViewPreferenceController.java b/src/com/android/settings/applications/appinfo/AppHeaderViewPreferenceController.java
index 5f41ae0..f65bb9b 100644
--- a/src/com/android/settings/applications/appinfo/AppHeaderViewPreferenceController.java
+++ b/src/com/android/settings/applications/appinfo/AppHeaderViewPreferenceController.java
@@ -23,8 +23,6 @@
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
-import com.android.settings.Utils;
-import com.android.settings.applications.LayoutPreference;
import com.android.settings.core.BasePreferenceController;
import com.android.settings.widget.EntityHeaderController;
import com.android.settingslib.applications.AppUtils;
@@ -32,6 +30,7 @@
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnStart;
+import com.android.settingslib.widget.LayoutPreference;
public class AppHeaderViewPreferenceController extends BasePreferenceController
implements AppInfoDashboardFragment.Callback, LifecycleObserver, OnStart {
diff --git a/src/com/android/settings/applications/appinfo/InstantAppButtonsPreferenceController.java b/src/com/android/settings/applications/appinfo/InstantAppButtonsPreferenceController.java
index f710f2e..23c0121 100644
--- a/src/com/android/settings/applications/appinfo/InstantAppButtonsPreferenceController.java
+++ b/src/com/android/settings/applications/appinfo/InstantAppButtonsPreferenceController.java
@@ -34,7 +34,6 @@
import com.android.settings.R;
import com.android.settings.applications.AppStoreUtil;
-import com.android.settings.applications.LayoutPreference;
import com.android.settings.core.BasePreferenceController;
import com.android.settingslib.applications.AppUtils;
import com.android.settingslib.core.lifecycle.Lifecycle;
@@ -42,6 +41,7 @@
import com.android.settingslib.core.lifecycle.events.OnCreateOptionsMenu;
import com.android.settingslib.core.lifecycle.events.OnOptionsItemSelected;
import com.android.settingslib.core.lifecycle.events.OnPrepareOptionsMenu;
+import com.android.settingslib.widget.LayoutPreference;
import java.util.List;
diff --git a/src/com/android/settings/biometrics/face/FaceSettingsRemoveButtonPreferenceController.java b/src/com/android/settings/biometrics/face/FaceSettingsRemoveButtonPreferenceController.java
index d1fdc48..8e41eff 100644
--- a/src/com/android/settings/biometrics/face/FaceSettingsRemoveButtonPreferenceController.java
+++ b/src/com/android/settings/biometrics/face/FaceSettingsRemoveButtonPreferenceController.java
@@ -23,8 +23,8 @@
import androidx.preference.Preference;
import com.android.settings.R;
-import com.android.settings.applications.LayoutPreference;
import com.android.settings.core.BasePreferenceController;
+import com.android.settingslib.widget.LayoutPreference;
/**
* Controller for the remove button.
diff --git a/src/com/android/settings/bluetooth/BluetoothDetailsHeaderController.java b/src/com/android/settings/bluetooth/BluetoothDetailsHeaderController.java
index 1795c07..11bd174 100644
--- a/src/com/android/settings/bluetooth/BluetoothDetailsHeaderController.java
+++ b/src/com/android/settings/bluetooth/BluetoothDetailsHeaderController.java
@@ -25,13 +25,13 @@
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
-import com.android.settings.applications.LayoutPreference;
import com.android.settings.widget.EntityHeaderController;
import com.android.settingslib.bluetooth.BluetoothUtils;
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
import com.android.settingslib.bluetooth.CachedBluetoothDeviceManager;
import com.android.settingslib.bluetooth.LocalBluetoothManager;
import com.android.settingslib.core.lifecycle.Lifecycle;
+import com.android.settingslib.widget.LayoutPreference;
/**
* This class adds a header with device name and status (connected/disconnected, etc.).
diff --git a/src/com/android/settings/connecteddevice/usb/UsbDetailsHeaderController.java b/src/com/android/settings/connecteddevice/usb/UsbDetailsHeaderController.java
index 0e1811d..26b21a1 100644
--- a/src/com/android/settings/connecteddevice/usb/UsbDetailsHeaderController.java
+++ b/src/com/android/settings/connecteddevice/usb/UsbDetailsHeaderController.java
@@ -21,8 +21,8 @@
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
-import com.android.settings.applications.LayoutPreference;
import com.android.settings.widget.EntityHeaderController;
+import com.android.settingslib.widget.LayoutPreference;
/**
* This class adds a header with device name.
diff --git a/src/com/android/settings/deviceinfo/aboutphone/MyDeviceInfoFragment.java b/src/com/android/settings/deviceinfo/aboutphone/MyDeviceInfoFragment.java
index 8c6c5ae..8b21f0d 100644
--- a/src/com/android/settings/deviceinfo/aboutphone/MyDeviceInfoFragment.java
+++ b/src/com/android/settings/deviceinfo/aboutphone/MyDeviceInfoFragment.java
@@ -29,9 +29,7 @@
import com.android.settings.R;
import com.android.settings.Utils;
import com.android.settings.accounts.EmergencyInfoPreferenceController;
-import com.android.settings.applications.LayoutPreference;
import com.android.settings.dashboard.DashboardFragment;
-import com.android.settings.dashboard.SummaryLoader;
import com.android.settings.deviceinfo.BluetoothAddressPreferenceController;
import com.android.settings.deviceinfo.BrandedAccountPreferenceController;
import com.android.settings.deviceinfo.BuildNumberPreferenceController;
@@ -53,6 +51,7 @@
import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.search.SearchIndexable;
+import com.android.settingslib.widget.LayoutPreference;
import java.util.ArrayList;
import java.util.Arrays;
diff --git a/src/com/android/settings/display/ColorModePreferenceFragment.java b/src/com/android/settings/display/ColorModePreferenceFragment.java
index bf307b6..2a21379 100644
--- a/src/com/android/settings/display/ColorModePreferenceFragment.java
+++ b/src/com/android/settings/display/ColorModePreferenceFragment.java
@@ -23,12 +23,12 @@
import com.android.internal.app.ColorDisplayController;
import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R;
-import com.android.settings.applications.LayoutPreference;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.search.Indexable;
import com.android.settings.widget.RadioButtonPickerFragment;
import com.android.settingslib.search.SearchIndexable;
import com.android.settingslib.widget.CandidateInfo;
+import com.android.settingslib.widget.LayoutPreference;
import java.util.ArrayList;
import java.util.Arrays;
diff --git a/src/com/android/settings/display/NightDisplayActivationPreferenceController.java b/src/com/android/settings/display/NightDisplayActivationPreferenceController.java
index 706ac85..35cb5ed 100644
--- a/src/com/android/settings/display/NightDisplayActivationPreferenceController.java
+++ b/src/com/android/settings/display/NightDisplayActivationPreferenceController.java
@@ -28,8 +28,8 @@
import com.android.internal.app.ColorDisplayController;
import com.android.settings.R;
-import com.android.settings.applications.LayoutPreference;
import com.android.settings.core.TogglePreferenceController;
+import com.android.settingslib.widget.LayoutPreference;
public class NightDisplayActivationPreferenceController extends TogglePreferenceController {
diff --git a/src/com/android/settings/dream/StartNowPreferenceController.java b/src/com/android/settings/dream/StartNowPreferenceController.java
index 5519a0e..9e45ea3 100644
--- a/src/com/android/settings/dream/StartNowPreferenceController.java
+++ b/src/com/android/settings/dream/StartNowPreferenceController.java
@@ -23,10 +23,10 @@
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
-import com.android.settings.applications.LayoutPreference;
import com.android.settings.core.PreferenceControllerMixin;
import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.dream.DreamBackend;
+import com.android.settingslib.widget.LayoutPreference;
public class StartNowPreferenceController extends AbstractPreferenceController implements
PreferenceControllerMixin {
diff --git a/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetail.java b/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetail.java
index ce9cabc..6ad50a9 100644
--- a/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetail.java
+++ b/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetail.java
@@ -39,7 +39,6 @@
import com.android.settings.R;
import com.android.settings.SettingsActivity;
import com.android.settings.Utils;
-import com.android.settings.applications.LayoutPreference;
import com.android.settings.applications.appinfo.AppButtonsPreferenceController;
import com.android.settings.applications.appinfo.ButtonActionDialogFragment;
import com.android.settings.core.InstrumentedPreferenceFragment;
@@ -52,6 +51,7 @@
import com.android.settingslib.applications.ApplicationsState;
import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.utils.StringUtil;
+import com.android.settingslib.widget.LayoutPreference;
import java.util.ArrayList;
import java.util.List;
diff --git a/src/com/android/settings/fuelgauge/BatteryHeaderPreferenceController.java b/src/com/android/settings/fuelgauge/BatteryHeaderPreferenceController.java
index e5a2e5e..48f4cc1 100644
--- a/src/com/android/settings/fuelgauge/BatteryHeaderPreferenceController.java
+++ b/src/com/android/settings/fuelgauge/BatteryHeaderPreferenceController.java
@@ -30,7 +30,6 @@
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
-import com.android.settings.applications.LayoutPreference;
import com.android.settings.core.BasePreferenceController;
import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.widget.EntityHeaderController;
@@ -38,6 +37,7 @@
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnStart;
+import com.android.settingslib.widget.LayoutPreference;
/**
* Controller that update the battery header view
diff --git a/src/com/android/settings/fuelgauge/PowerUsageSummary.java b/src/com/android/settings/fuelgauge/PowerUsageSummary.java
index f7c31e5..85aa915 100644
--- a/src/com/android/settings/fuelgauge/PowerUsageSummary.java
+++ b/src/com/android/settings/fuelgauge/PowerUsageSummary.java
@@ -39,7 +39,6 @@
import com.android.settings.R;
import com.android.settings.SettingsActivity;
import com.android.settings.Utils;
-import com.android.settings.applications.LayoutPreference;
import com.android.settings.core.SubSettingLauncher;
import com.android.settings.fuelgauge.batterytip.BatteryTipLoader;
import com.android.settings.fuelgauge.batterytip.BatteryTipPreferenceController;
@@ -49,6 +48,7 @@
import com.android.settingslib.search.SearchIndexable;
import com.android.settingslib.utils.PowerUtil;
import com.android.settingslib.utils.StringUtil;
+import com.android.settingslib.widget.LayoutPreference;
import java.util.Collections;
import java.util.List;
diff --git a/src/com/android/settings/homepage/contextualcards/ContextualCardLoader.java b/src/com/android/settings/homepage/contextualcards/ContextualCardLoader.java
index c723cfd..4c06601 100644
--- a/src/com/android/settings/homepage/contextualcards/ContextualCardLoader.java
+++ b/src/com/android/settings/homepage/contextualcards/ContextualCardLoader.java
@@ -23,7 +23,6 @@
import android.content.ContentProviderClient;
import android.content.ContentResolver;
import android.content.Context;
-import android.content.pm.PackageManager;
import android.database.ContentObserver;
import android.database.Cursor;
import android.net.Uri;
@@ -35,7 +34,6 @@
import androidx.annotation.VisibleForTesting;
import androidx.slice.Slice;
-import com.android.settings.homepage.contextualcards.deviceinfo.BatterySlice;
import com.android.settings.homepage.contextualcards.slices.ConnectedDeviceSlice;
import com.android.settings.wifi.WifiSlice;
import com.android.settingslib.utils.AsyncLoaderCompat;
@@ -52,11 +50,17 @@
private static final String TAG = "ContextualCardLoader";
- private Context mContext;
+ private final ContentObserver mObserver = new ContentObserver(
+ new Handler(Looper.getMainLooper())) {
+ @Override
+ public void onChange(boolean selfChange) {
+ if (isStarted()) {
+ forceLoad();
+ }
+ }
+ };
- public interface CardContentLoaderListener {
- void onFinishCardLoading(List<ContextualCard> contextualCards);
- }
+ private Context mContext;
ContextualCardLoader(Context context) {
super(context);
@@ -86,9 +90,7 @@
public List<ContextualCard> loadInBackground() {
final List<ContextualCard> result = new ArrayList<>();
try (Cursor cursor = getContextualCardsFromProvider()) {
- if (cursor.getCount() == 0) {
- result.addAll(createStaticCards());
- } else {
+ if (cursor.getCount() > 0) {
for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) {
final ContextualCard card = new ContextualCard(cursor);
if (card.isCustomCard()) {
@@ -131,24 +133,6 @@
}
@VisibleForTesting
- List<ContextualCard> createStaticCards() {
- final long appVersionCode = getAppVersionCode();
- final String packageName = mContext.getPackageName();
- final double rankingScore = 0.0;
- final List<ContextualCard> result = new ArrayList();
- result.add(new ContextualCard.Builder()
- .setSliceUri(BatterySlice.BATTERY_CARD_URI)
- .setName(BatterySlice.PATH_BATTERY_INFO)
- .setPackageName(packageName)
- .setRankingScore(rankingScore)
- .setAppVersion(appVersionCode)
- .setCardType(ContextualCard.CardType.SLICE)
- .setIsHalfWidth(false)
- .build());
- return result;
- }
-
- @VisibleForTesting
List<ContextualCard> filterEligibleCards(List<ContextualCard> candidates) {
return candidates.stream().filter(card -> isCardEligibleToDisplay(card))
.collect(Collectors.toList());
@@ -191,23 +175,7 @@
.count();
}
- private long getAppVersionCode() {
- try {
- return mContext.getPackageManager().getPackageInfo(mContext.getPackageName(),
- 0 /* flags */).getLongVersionCode();
- } catch (PackageManager.NameNotFoundException e) {
- Log.e(TAG, "Invalid package name for context", e);
- }
- return -1L;
+ public interface CardContentLoaderListener {
+ void onFinishCardLoading(List<ContextualCard> contextualCards);
}
-
- private final ContentObserver mObserver = new ContentObserver(
- new Handler(Looper.getMainLooper())) {
- @Override
- public void onChange(boolean selfChange) {
- if (isStarted()) {
- forceLoad();
- }
- }
- };
-}
+}
\ No newline at end of file
diff --git a/src/com/android/settings/homepage/contextualcards/SettingsContextualCardProvider.java b/src/com/android/settings/homepage/contextualcards/SettingsContextualCardProvider.java
index db3fddc..5ff3e90 100644
--- a/src/com/android/settings/homepage/contextualcards/SettingsContextualCardProvider.java
+++ b/src/com/android/settings/homepage/contextualcards/SettingsContextualCardProvider.java
@@ -20,7 +20,6 @@
import android.annotation.Nullable;
-import com.android.settings.homepage.contextualcards.deviceinfo.BatterySlice;
import com.android.settings.homepage.contextualcards.slices.BatteryFixSlice;
import com.android.settings.homepage.contextualcards.slices.ConnectedDeviceSlice;
import com.android.settings.homepage.contextualcards.slices.LowStorageSlice;
@@ -44,12 +43,6 @@
.setCardName(KEY_WIFI)
.setCardCategory(ContextualCard.Category.IMPORTANT)
.build();
- final ContextualCard batteryInfoCard =
- ContextualCard.newBuilder()
- .setSliceUri(BatterySlice.BATTERY_CARD_URI.toString())
- .setCardName(BatterySlice.PATH_BATTERY_INFO)
- .setCardCategory(ContextualCard.Category.DEFAULT)
- .build();
final ContextualCard connectedDeviceCard =
ContextualCard.newBuilder()
.setSliceUri(ConnectedDeviceSlice.CONNECTED_DEVICE_URI.toString())
@@ -70,7 +63,6 @@
.build();
final ContextualCardList cards = ContextualCardList.newBuilder()
.addCard(wifiCard)
- .addCard(batteryInfoCard)
.addCard(connectedDeviceCard)
.addCard(lowStorageCard)
.addCard(batteryFixCard)
@@ -78,4 +70,4 @@
return cards;
}
-}
+}
\ No newline at end of file
diff --git a/src/com/android/settings/network/AirplaneModePreferenceController.java b/src/com/android/settings/network/AirplaneModePreferenceController.java
index 80cca2c..1c4e351 100644
--- a/src/com/android/settings/network/AirplaneModePreferenceController.java
+++ b/src/com/android/settings/network/AirplaneModePreferenceController.java
@@ -93,7 +93,7 @@
@Override
public boolean isSliceable() {
- return TextUtils.equals(getPreferenceKey(), "toggle_airplane");
+ return true;
}
@Override
diff --git a/src/com/android/settings/network/ApnPreference.java b/src/com/android/settings/network/ApnPreference.java
index a7fbb6e..f039539 100755
--- a/src/com/android/settings/network/ApnPreference.java
+++ b/src/com/android/settings/network/ApnPreference.java
@@ -27,6 +27,7 @@
import android.view.View;
import android.widget.CompoundButton;
import android.widget.RadioButton;
+import android.widget.Toast;
import androidx.preference.Preference;
import androidx.preference.PreferenceViewHolder;
@@ -54,6 +55,7 @@
private static CompoundButton mCurrentChecked = null;
private boolean mProtectFromCheckedChange = false;
private boolean mSelectable = true;
+ private boolean mHideDetails = false;
@Override
public void onBindViewHolder(PreferenceViewHolder view) {
@@ -113,6 +115,11 @@
super.onClick();
Context context = getContext();
if (context != null) {
+ if (mHideDetails) {
+ Toast.makeText(context, context.getString(
+ R.string.cannot_change_apn_toast), Toast.LENGTH_LONG).show();
+ return;
+ }
int pos = Integer.parseInt(getKey());
Uri url = ContentUris.withAppendedId(Telephony.Carriers.CONTENT_URI, pos);
Intent editIntent = new Intent(Intent.ACTION_EDIT, url);
@@ -132,4 +139,8 @@
public void setSubId(int subId) {
mSubId = subId;
}
+
+ public void setHideDetails() {
+ mHideDetails = true;
+ }
}
diff --git a/src/com/android/settings/network/ApnSettings.java b/src/com/android/settings/network/ApnSettings.java
index a71dfaa..3b1e14c 100755
--- a/src/com/android/settings/network/ApnSettings.java
+++ b/src/com/android/settings/network/ApnSettings.java
@@ -78,12 +78,23 @@
public static final String MVNO_TYPE = "mvno_type";
public static final String MVNO_MATCH_DATA = "mvno_match_data";
+ private static final String[] CARRIERS_PROJECTION = new String[] {
+ Telephony.Carriers._ID,
+ Telephony.Carriers.NAME,
+ Telephony.Carriers.APN,
+ Telephony.Carriers.TYPE,
+ Telephony.Carriers.MVNO_TYPE,
+ Telephony.Carriers.MVNO_MATCH_DATA,
+ Telephony.Carriers.EDITED,
+ };
+
private static final int ID_INDEX = 0;
private static final int NAME_INDEX = 1;
private static final int APN_INDEX = 2;
private static final int TYPES_INDEX = 3;
private static final int MVNO_TYPE_INDEX = 4;
private static final int MVNO_MATCH_DATA_INDEX = 5;
+ private static final int EDITED_INDEX = 6;
private static final int MENU_NEW = Menu.FIRST;
private static final int MENU_RESTORE = Menu.FIRST + 1;
@@ -116,6 +127,7 @@
private boolean mHideImsApn;
private boolean mAllowAddingApns;
+ private boolean mHidePresetApnDetails;
public ApnSettings() {
super(UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS);
@@ -196,6 +208,7 @@
mAllowAddingApns = false;
}
}
+ mHidePresetApnDetails = b.getBoolean(CarrierConfigManager.KEY_HIDE_PRESET_APN_DETAILS_BOOL);
mUserManager = UserManager.get(activity);
}
@@ -277,9 +290,8 @@
where.append(" AND NOT (type='ims')");
}
- Cursor cursor = getContentResolver().query(Telephony.Carriers.CONTENT_URI, new String[] {
- "_id", "name", "apn", "type", "mvno_type", "mvno_match_data"}, where.toString(),
- null, Telephony.Carriers.DEFAULT_SORT_ORDER);
+ Cursor cursor = getContentResolver().query(Telephony.Carriers.CONTENT_URI,
+ CARRIERS_PROJECTION, where.toString(), null, Telephony.Carriers.DEFAULT_SORT_ORDER);
if (cursor != null) {
IccRecords r = null;
@@ -304,14 +316,19 @@
String type = cursor.getString(TYPES_INDEX);
String mvnoType = cursor.getString(MVNO_TYPE_INDEX);
String mvnoMatchData = cursor.getString(MVNO_MATCH_DATA_INDEX);
+ int edited = cursor.getInt(EDITED_INDEX);
ApnPreference pref = new ApnPreference(getPrefContext());
pref.setKey(key);
pref.setTitle(name);
- pref.setSummary(apn);
pref.setPersistent(false);
pref.setSubId(subId);
+ if (mHidePresetApnDetails && edited == Telephony.Carriers.UNEDITED) {
+ pref.setHideDetails();
+ } else {
+ pref.setSummary(apn);
+ }
boolean selectable = ((type == null) || !type.equals("mms"));
pref.setSelectable(selectable);
diff --git a/src/com/android/settings/notification/BlockPreferenceController.java b/src/com/android/settings/notification/BlockPreferenceController.java
index bee32f5..960526c 100644
--- a/src/com/android/settings/notification/BlockPreferenceController.java
+++ b/src/com/android/settings/notification/BlockPreferenceController.java
@@ -27,9 +27,9 @@
import androidx.preference.Preference;
import com.android.settings.R;
-import com.android.settings.applications.LayoutPreference;
import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.widget.SwitchBar;
+import com.android.settingslib.widget.LayoutPreference;
public class BlockPreferenceController extends NotificationPreferenceController
implements PreferenceControllerMixin, SwitchBar.OnSwitchChangeListener {
diff --git a/src/com/android/settings/notification/HeaderPreferenceController.java b/src/com/android/settings/notification/HeaderPreferenceController.java
index f0c860f..0c091b4 100644
--- a/src/com/android/settings/notification/HeaderPreferenceController.java
+++ b/src/com/android/settings/notification/HeaderPreferenceController.java
@@ -31,10 +31,10 @@
import androidx.preference.PreferenceFragmentCompat;
import com.android.settings.R;
-import com.android.settings.applications.LayoutPreference;
import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.widget.EntityHeaderController;
import com.android.settingslib.core.lifecycle.Lifecycle;
+import com.android.settingslib.widget.LayoutPreference;
public class HeaderPreferenceController extends NotificationPreferenceController
implements PreferenceControllerMixin, LifecycleObserver {
diff --git a/src/com/android/settings/notification/NotificationSwitchBarPreference.java b/src/com/android/settings/notification/NotificationSwitchBarPreference.java
index ff42987..01c4f6a 100644
--- a/src/com/android/settings/notification/NotificationSwitchBarPreference.java
+++ b/src/com/android/settings/notification/NotificationSwitchBarPreference.java
@@ -22,9 +22,9 @@
import androidx.preference.PreferenceViewHolder;
-import com.android.settings.applications.LayoutPreference;
import com.android.settings.widget.ToggleSwitch;
import com.android.settingslib.RestrictedLockUtils;
+import com.android.settingslib.widget.LayoutPreference;
public class NotificationSwitchBarPreference extends LayoutPreference {
private ToggleSwitch mSwitch;
diff --git a/src/com/android/settings/notification/ZenAutomaticRuleHeaderPreferenceController.java b/src/com/android/settings/notification/ZenAutomaticRuleHeaderPreferenceController.java
index 41eb111..72bb0e3 100644
--- a/src/com/android/settings/notification/ZenAutomaticRuleHeaderPreferenceController.java
+++ b/src/com/android/settings/notification/ZenAutomaticRuleHeaderPreferenceController.java
@@ -28,17 +28,17 @@
import android.util.Slog;
import android.view.View;
-import com.android.internal.logging.nano.MetricsProto;
-import com.android.settings.R;
-import com.android.settings.applications.LayoutPreference;
-import com.android.settings.core.PreferenceControllerMixin;
-import com.android.settings.widget.EntityHeaderController;
-import com.android.settingslib.core.lifecycle.Lifecycle;
-
import androidx.fragment.app.Fragment;
import androidx.preference.Preference;
import androidx.preference.PreferenceFragmentCompat;
+import com.android.internal.logging.nano.MetricsProto;
+import com.android.settings.R;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settings.widget.EntityHeaderController;
+import com.android.settingslib.core.lifecycle.Lifecycle;
+import com.android.settingslib.widget.LayoutPreference;
+
public class ZenAutomaticRuleHeaderPreferenceController extends AbstractZenModePreferenceController
implements PreferenceControllerMixin {
diff --git a/src/com/android/settings/notification/ZenAutomaticRuleSwitchPreferenceController.java b/src/com/android/settings/notification/ZenAutomaticRuleSwitchPreferenceController.java
index d411402..f38deb3 100644
--- a/src/com/android/settings/notification/ZenAutomaticRuleSwitchPreferenceController.java
+++ b/src/com/android/settings/notification/ZenAutomaticRuleSwitchPreferenceController.java
@@ -25,9 +25,9 @@
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
-import com.android.settings.applications.LayoutPreference;
import com.android.settings.widget.SwitchBar;
import com.android.settingslib.core.lifecycle.Lifecycle;
+import com.android.settingslib.widget.LayoutPreference;
public class ZenAutomaticRuleSwitchPreferenceController extends
AbstractZenModeAutomaticRulePreferenceController implements
diff --git a/src/com/android/settings/notification/ZenModeButtonPreferenceController.java b/src/com/android/settings/notification/ZenModeButtonPreferenceController.java
index 3e45899..8ebc6b8 100644
--- a/src/com/android/settings/notification/ZenModeButtonPreferenceController.java
+++ b/src/com/android/settings/notification/ZenModeButtonPreferenceController.java
@@ -26,9 +26,9 @@
import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R;
-import com.android.settings.applications.LayoutPreference;
import com.android.settings.core.PreferenceControllerMixin;
import com.android.settingslib.core.lifecycle.Lifecycle;
+import com.android.settingslib.widget.LayoutPreference;
public class ZenModeButtonPreferenceController extends AbstractZenModePreferenceController
implements PreferenceControllerMixin {
diff --git a/src/com/android/settings/notification/ZenModeSettings.java b/src/com/android/settings/notification/ZenModeSettings.java
index 3a270d2..293c429 100644
--- a/src/com/android/settings/notification/ZenModeSettings.java
+++ b/src/com/android/settings/notification/ZenModeSettings.java
@@ -86,8 +86,6 @@
"zen_mode_behavior_calls"));
controllers.add(new ZenModeMessagesPreferenceController(context, lifecycle,
"zen_mode_behavior_messages"));
- controllers.add(new ZenModeAlarmsPreferenceController(context, lifecycle,
- "zen_mode_behavior_alarms"));
controllers.add(new ZenModeBlockedEffectsPreferenceController(context, lifecycle));
controllers.add(new ZenModeDurationPreferenceController(context, lifecycle));
controllers.add(new ZenModeAutomationPreferenceController(context));
diff --git a/src/com/android/settings/overlay/FeatureFactory.java b/src/com/android/settings/overlay/FeatureFactory.java
index 38d48c8..02468b8 100644
--- a/src/com/android/settings/overlay/FeatureFactory.java
+++ b/src/com/android/settings/overlay/FeatureFactory.java
@@ -29,6 +29,7 @@
import com.android.settings.fuelgauge.PowerUsageFeatureProvider;
import com.android.settings.gestures.AssistGestureFeatureProvider;
import com.android.settings.localepicker.LocaleFeatureProvider;
+import com.android.settings.panel.PanelFeatureProvider;
import com.android.settings.search.SearchFeatureProvider;
import com.android.settings.security.SecurityFeatureProvider;
import com.android.settings.slices.SlicesFeatureProvider;
@@ -105,6 +106,8 @@
public abstract AccountFeatureProvider getAccountFeatureProvider();
+ public abstract PanelFeatureProvider getPanelFeatureProvider();
+
public static final class FactoryNotFoundException extends RuntimeException {
public FactoryNotFoundException(Throwable throwable) {
super("Unable to create factory. Did you misconfigure Proguard?", throwable);
diff --git a/src/com/android/settings/overlay/FeatureFactoryImpl.java b/src/com/android/settings/overlay/FeatureFactoryImpl.java
index f74043f..8d6d4b6 100644
--- a/src/com/android/settings/overlay/FeatureFactoryImpl.java
+++ b/src/com/android/settings/overlay/FeatureFactoryImpl.java
@@ -42,6 +42,8 @@
import com.android.settings.gestures.AssistGestureFeatureProviderImpl;
import com.android.settings.localepicker.LocaleFeatureProvider;
import com.android.settings.localepicker.LocaleFeatureProviderImpl;
+import com.android.settings.panel.PanelFeatureProvider;
+import com.android.settings.panel.PanelFeatureProviderImpl;
import com.android.settings.search.SearchFeatureProvider;
import com.android.settings.search.SearchFeatureProviderImpl;
import com.android.settings.security.SecurityFeatureProvider;
@@ -72,6 +74,7 @@
private UserFeatureProvider mUserFeatureProvider;
private SlicesFeatureProvider mSlicesFeatureProvider;
private AccountFeatureProvider mAccountFeatureProvider;
+ private PanelFeatureProvider mPanelFeatureProvider;
@Override
public SupportFeatureProvider getSupportFeatureProvider(Context context) {
@@ -209,4 +212,12 @@
}
return mAccountFeatureProvider;
}
+
+ @Override
+ public PanelFeatureProvider getPanelFeatureProvider() {
+ if (mPanelFeatureProvider == null) {
+ mPanelFeatureProvider = new PanelFeatureProviderImpl();
+ }
+ return mPanelFeatureProvider;
+ }
}
diff --git a/src/com/android/settings/panel/InternetConnectivityPanel.java b/src/com/android/settings/panel/InternetConnectivityPanel.java
new file mode 100644
index 0000000..b6fe53b
--- /dev/null
+++ b/src/com/android/settings/panel/InternetConnectivityPanel.java
@@ -0,0 +1,77 @@
+/*
+ * 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.panel;
+
+import androidx.annotation.VisibleForTesting;
+
+import android.content.ContentResolver;
+import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
+import android.provider.SettingsSlicesContract;
+
+import com.android.settings.R;
+import com.android.settings.wifi.WifiSlice;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Represents the Internet Connectivity Panel.
+ *
+ * <p>
+ * Displays Wifi (full Slice) and Airplane mode.
+ * </p>
+ */
+public class InternetConnectivityPanel implements PanelContent {
+
+ @VisibleForTesting
+ static final Uri AIRPLANE_URI = new Uri.Builder()
+ .scheme(ContentResolver.SCHEME_CONTENT)
+ .authority(SettingsSlicesContract.AUTHORITY)
+ .appendPath(SettingsSlicesContract.PATH_SETTING_ACTION)
+ .appendPath(SettingsSlicesContract.KEY_AIRPLANE_MODE)
+ .build();
+
+ private final Context mContext;
+
+ public static InternetConnectivityPanel create(Context context) {
+ return new InternetConnectivityPanel(context);
+ }
+
+ private InternetConnectivityPanel(Context context) {
+ mContext = context.getApplicationContext();
+ }
+
+ @Override
+ public String getTitle() {
+ return (String) mContext.getText(R.string.internet_connectivity_panel_title);
+ }
+
+ @Override
+ public List<Uri> getSlices() {
+ final List<Uri> uris = new ArrayList<>();
+ uris.add(WifiSlice.WIFI_URI);
+ uris.add(AIRPLANE_URI);
+ return uris;
+ }
+
+ @Override
+ public Intent getSeeMoreIntent() {
+ return null;
+ }
+}
diff --git a/src/com/android/settings/panel/PanelContent.java b/src/com/android/settings/panel/PanelContent.java
new file mode 100644
index 0000000..bd84c2f
--- /dev/null
+++ b/src/com/android/settings/panel/PanelContent.java
@@ -0,0 +1,49 @@
+/*
+ * 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.panel;
+
+import android.content.Intent;
+import android.net.Uri;
+
+import java.util.List;
+
+/**
+ * Represents the data class needed to create a Settings Panel. See {@link PanelFragment}.
+ */
+public interface PanelContent {
+
+ /**
+ * @return a string for the title of the Panel.
+ */
+ CharSequence getTitle();
+
+ /**
+ * @return an ordered list of the Slices to be displayed in the Panel. The first item in the
+ * list is shown on top of the Panel.
+ */
+ List<Uri> getSlices();
+
+
+ /**
+ * @return an {@link Intent} to the full content in Settings that is summarized by the Panel.
+ *
+ * <p>
+ * For example, for the connectivity panel you would intent to the Network & Internet page.
+ * </p>
+ */
+ Intent getSeeMoreIntent();
+}
diff --git a/src/com/android/settings/panel/PanelFeatureProvider.java b/src/com/android/settings/panel/PanelFeatureProvider.java
new file mode 100644
index 0000000..7d6c558
--- /dev/null
+++ b/src/com/android/settings/panel/PanelFeatureProvider.java
@@ -0,0 +1,27 @@
+/*
+ * 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.panel;
+
+import android.content.Context;
+
+public interface PanelFeatureProvider {
+
+ /**
+ * Returns {@link PanelContent} as specified by the {@param panelType}.
+ */
+ PanelContent getPanel(Context context, String panelType);
+}
diff --git a/src/com/android/settings/panel/PanelFeatureProviderImpl.java b/src/com/android/settings/panel/PanelFeatureProviderImpl.java
new file mode 100644
index 0000000..2e84078
--- /dev/null
+++ b/src/com/android/settings/panel/PanelFeatureProviderImpl.java
@@ -0,0 +1,32 @@
+/*
+ * 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.panel;
+
+import android.content.Context;
+
+public class PanelFeatureProviderImpl implements PanelFeatureProvider {
+
+ @Override
+ public PanelContent getPanel(Context context, String panelType) {
+ switch (panelType) {
+ case SettingsPanelActivity.PANEL_TYPE_WIFI:
+ return InternetConnectivityPanel.create(context);
+ }
+
+ throw new IllegalStateException("No matching panel for: " + panelType);
+ }
+}
diff --git a/src/com/android/settings/panel/PanelFragment.java b/src/com/android/settings/panel/PanelFragment.java
new file mode 100644
index 0000000..bbdaec3
--- /dev/null
+++ b/src/com/android/settings/panel/PanelFragment.java
@@ -0,0 +1,88 @@
+/*
+ * 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.panel;
+
+import android.net.Uri;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import android.widget.LinearLayout;
+
+import androidx.lifecycle.LiveData;
+import androidx.slice.Slice;
+import androidx.slice.widget.SliceLiveData;
+import androidx.slice.widget.SliceView;
+
+import com.android.settings.R;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentActivity;
+
+import com.android.settings.overlay.FeatureFactory;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class PanelFragment extends Fragment {
+
+ private static final String TAG = "PanelFragment";
+
+ private List<SliceView> mSliceViewList;
+ private List<LiveData<Slice>> mSliceDataList;
+ private LinearLayout mPanelLayout;
+
+ public PanelFragment() {
+ mSliceViewList = new ArrayList<>();
+ mSliceDataList = new ArrayList<>();
+ }
+
+ @Nullable
+ @Override
+ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
+ @Nullable Bundle savedInstanceState) {
+ final FragmentActivity activity = getActivity();
+ final View view = inflater.inflate(R.layout.panel_layout, container, false);
+
+ mPanelLayout = view.findViewById(R.id.panel_parent_layout);
+ final Bundle arguments = getArguments();
+
+ final String panelType = arguments.getString(SettingsPanelActivity.KEY_PANEL_TYPE_ARGUMENT);
+
+ final PanelContent panel = FeatureFactory.getFactory(activity)
+ .getPanelFeatureProvider()
+ .getPanel(activity, panelType);
+
+ activity.setTitle(panel.getTitle());
+
+
+ for (Uri uri : panel.getSlices()) {
+ final SliceView sliceView = new SliceView(activity);
+ mPanelLayout.addView(sliceView);
+ final LiveData<Slice> liveData = SliceLiveData.fromUri(activity, uri);
+ liveData.observe(this /* lifecycleOwner */, sliceView);
+
+ mSliceDataList.add(liveData);
+ mSliceViewList.add(sliceView);
+ }
+
+ return view;
+ }
+}
diff --git a/src/com/android/settings/panel/SettingsPanelActivity.java b/src/com/android/settings/panel/SettingsPanelActivity.java
new file mode 100644
index 0000000..db1f60d
--- /dev/null
+++ b/src/com/android/settings/panel/SettingsPanelActivity.java
@@ -0,0 +1,103 @@
+/*
+ * 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.panel;
+
+import android.content.ComponentName;
+import android.content.Intent;
+import android.os.Bundle;
+
+import android.text.TextUtils;
+import android.util.Log;
+import android.view.Gravity;
+import android.view.Window;
+import android.view.WindowManager;
+
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentActivity;
+import androidx.fragment.app.FragmentManager;
+
+import com.android.settings.R;
+
+/**
+ * Dialog Activity to host Settings Slices.
+ *
+ * TODO link to action / framework API
+ */
+public class SettingsPanelActivity extends FragmentActivity {
+
+ private final String TAG = "panel_activity";
+
+ /**
+ * Key specifying which Panel the app is requesting.
+ */
+ public static final String KEY_PANEL_TYPE_ARGUMENT = "PANEL_TYPE_ARGUMENT";
+
+
+ // TODO (b/117804442) move to framework
+ public static final String EXTRA_PANEL_TYPE = "com.android.settings.panel.extra";
+
+ // TODO (b/117804442) move to framework
+ public static final String PANEL_TYPE_WIFI = "wifi_panel";
+
+ @Override
+ protected void onCreate(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ final ComponentName callingActivityName = getCallingActivity();
+
+ if (callingActivityName == null) {
+ Log.e(TAG, "Must start with startActivityForResult. Closing.");
+ finish();
+ return;
+ }
+
+ final Intent callingIntent = getIntent();
+ if (callingIntent == null) {
+ Log.e(TAG, "Null intent, closing Panel Activity");
+ finish();
+ return;
+ }
+
+ final String typeExtra = callingIntent.getStringExtra(EXTRA_PANEL_TYPE);
+ if (TextUtils.isEmpty(typeExtra)) {
+ Log.e(TAG, "No intent passed, closing Panel Activity");
+ return;
+ }
+
+ setContentView(R.layout.settings_panel);
+
+ // Move the window to the bottom of screen, and make it take up the entire screen width.
+ final Window window = getWindow();
+ window.setGravity(Gravity.BOTTOM);
+ window.setLayout(WindowManager.LayoutParams.MATCH_PARENT,
+ WindowManager.LayoutParams.WRAP_CONTENT);
+
+
+ final Bundle bundle = new Bundle();
+ bundle.putString(KEY_PANEL_TYPE_ARGUMENT, typeExtra);
+
+ final PanelFragment panelFragment = new PanelFragment();
+ panelFragment.setArguments(bundle);
+
+ final FragmentManager fragmentManager = getSupportFragmentManager();
+ final Fragment fragment = fragmentManager.findFragmentById(R.id.main_content);
+ if (fragment == null) {
+ fragmentManager.beginTransaction().add(R.id.main_content, panelFragment).commit();
+ }
+ }
+}
diff --git a/src/com/android/settings/privacy/PrivacyDashboardFragment.java b/src/com/android/settings/privacy/PrivacyDashboardFragment.java
index dd4c8fa..91e85b3 100644
--- a/src/com/android/settings/privacy/PrivacyDashboardFragment.java
+++ b/src/com/android/settings/privacy/PrivacyDashboardFragment.java
@@ -22,7 +22,10 @@
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.R;
import com.android.settings.dashboard.DashboardFragment;
+import com.android.settings.notification.LockScreenNotificationPreferenceController;
import com.android.settings.search.BaseSearchIndexProvider;
+import com.android.settingslib.core.AbstractPreferenceController;
+import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.search.SearchIndexable;
import java.util.ArrayList;
@@ -31,6 +34,11 @@
@SearchIndexable
public class PrivacyDashboardFragment extends DashboardFragment {
private static final String TAG = "PrivacyDashboardFragment";
+ private static final String KEY_LOCK_SCREEN_NOTIFICATIONS = "privacy_lock_screen_notifications";
+ private static final String KEY_WORK_PROFILE_CATEGORY =
+ "privacy_work_profile_notifications_category";
+ private static final String KEY_NOTIFICATION_WORK_PROFILE_NOTIFICATIONS =
+ "privacy_lock_screen_work_profile_notifications";
@Override
public int getMetricsCategory() {
@@ -52,6 +60,28 @@
return R.string.help_url_privacy_dashboard;
}
+ @Override
+ protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
+ return buildPreferenceControllers(context, getSettingsLifecycle());
+ }
+
+ private static List<AbstractPreferenceController> buildPreferenceControllers(
+ Context context, Lifecycle lifecycle) {
+ final List<AbstractPreferenceController> controllers = new ArrayList<>();
+ final LockScreenNotificationPreferenceController notificationController =
+ new LockScreenNotificationPreferenceController(context,
+ KEY_LOCK_SCREEN_NOTIFICATIONS,
+ KEY_WORK_PROFILE_CATEGORY,
+ KEY_NOTIFICATION_WORK_PROFILE_NOTIFICATIONS);
+ if (lifecycle != null) {
+ lifecycle.addObserver(notificationController);
+ }
+ controllers.add(notificationController);
+
+ return controllers;
+
+ }
+
public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
new BaseSearchIndexProvider() {
@Override
@@ -64,5 +94,11 @@
result.add(sir);
return result;
}
+
+ @Override
+ public List<AbstractPreferenceController> createPreferenceControllers(
+ Context context) {
+ return buildPreferenceControllers(context, null);
+ }
};
}
diff --git a/src/com/android/settings/slices/SettingsSliceProvider.java b/src/com/android/settings/slices/SettingsSliceProvider.java
index fa669bb..952fc8b 100644
--- a/src/com/android/settings/slices/SettingsSliceProvider.java
+++ b/src/com/android/settings/slices/SettingsSliceProvider.java
@@ -427,7 +427,7 @@
try {
sliceData = mSlicesDatabaseAccessor.getSliceDataFromUri(uri);
} catch (IllegalStateException e) {
- Log.d(TAG, "Could not create slicedata for uri: " + uri);
+ Log.d(TAG, "Could not create slicedata for uri: " + uri, e);
return;
}
diff --git a/src/com/android/settings/slices/SlicesFeatureProviderImpl.java b/src/com/android/settings/slices/SlicesFeatureProviderImpl.java
index 39d385e..508eb1c 100644
--- a/src/com/android/settings/slices/SlicesFeatureProviderImpl.java
+++ b/src/com/android/settings/slices/SlicesFeatureProviderImpl.java
@@ -1,3 +1,19 @@
+/*
+ * 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.slices;
import android.content.Context;
diff --git a/src/com/android/settings/widget/EntityHeaderController.java b/src/com/android/settings/widget/EntityHeaderController.java
index 853313f..056f6b4 100644
--- a/src/com/android/settings/widget/EntityHeaderController.java
+++ b/src/com/android/settings/widget/EntityHeaderController.java
@@ -16,8 +16,7 @@
package com.android.settings.widget;
-import static com.android.internal.logging.nano.MetricsProto.MetricsEvent
- .ACTION_OPEN_APP_NOTIFICATION_SETTING;
+import static com.android.internal.logging.nano.MetricsProto.MetricsEvent.ACTION_OPEN_APP_NOTIFICATION_SETTING;
import android.annotation.IdRes;
import android.annotation.UserIdInt;
@@ -48,11 +47,11 @@
import com.android.settings.R;
import com.android.settings.Utils;
import com.android.settings.applications.AppInfoBase;
-import com.android.settings.applications.LayoutPreference;
import com.android.settings.applications.appinfo.AppInfoDashboardFragment;
import com.android.settings.overlay.FeatureFactory;
import com.android.settingslib.applications.ApplicationsState;
import com.android.settingslib.core.lifecycle.Lifecycle;
+import com.android.settingslib.widget.LayoutPreference;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -321,7 +320,7 @@
}
actionBar.setBackgroundDrawable(
new ColorDrawable(
- Utils.getColorAttrDefaultColor(activity, android.R.attr.colorPrimary)));
+ Utils.getColorAttrDefaultColor(activity, android.R.attr.colorPrimaryDark)));
actionBar.setElevation(0);
if (mRecyclerView != null && mLifecycle != null) {
ActionBarShadowController.attachToRecyclerView(mActivity, mLifecycle, mRecyclerView);
diff --git a/src/com/android/settings/widget/TwoStateButtonPreference.java b/src/com/android/settings/widget/TwoStateButtonPreference.java
index b154fb4..eeee65d 100644
--- a/src/com/android/settings/widget/TwoStateButtonPreference.java
+++ b/src/com/android/settings/widget/TwoStateButtonPreference.java
@@ -26,7 +26,7 @@
import androidx.core.content.res.TypedArrayUtils;
import com.android.settings.R;
-import com.android.settings.applications.LayoutPreference;
+import com.android.settingslib.widget.LayoutPreference;
/**
* Preference that presents a button with two states(On vs Off)
diff --git a/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java b/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java
index 3bf38a7..9a3398a 100644
--- a/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java
+++ b/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java
@@ -54,7 +54,6 @@
import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R;
import com.android.settings.Utils;
-import com.android.settings.applications.LayoutPreference;
import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.widget.ActionButtonPreference;
import com.android.settings.widget.EntityHeaderController;
@@ -68,6 +67,7 @@
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnPause;
import com.android.settingslib.core.lifecycle.events.OnResume;
+import com.android.settingslib.widget.LayoutPreference;
import com.android.settingslib.wifi.AccessPoint;
import java.net.Inet4Address;
diff --git a/tests/robotests/assets/grandfather_not_implementing_instrumentable b/tests/robotests/assets/grandfather_not_implementing_instrumentable
index 625d9ff..04ef0ef 100644
--- a/tests/robotests/assets/grandfather_not_implementing_instrumentable
+++ b/tests/robotests/assets/grandfather_not_implementing_instrumentable
@@ -6,4 +6,5 @@
com.android.settings.RestrictedListPreference$RestrictedListPreferenceDialogFragment
com.android.settings.password.ConfirmDeviceCredentialBaseFragment$LastTryDialog
com.android.settings.password.CredentialCheckResultTracker
-com.android.settings.dashboard.profileselector.ProfileSelectDialog
\ No newline at end of file
+com.android.settings.dashboard.profileselector.ProfileSelectDialog
+com.android.settings.panel.PanelFragment
\ No newline at end of file
diff --git a/tests/robotests/src/com/android/settings/accounts/AccountHeaderPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accounts/AccountHeaderPreferenceControllerTest.java
index 19a140c..aeb5f54 100644
--- a/tests/robotests/src/com/android/settings/accounts/AccountHeaderPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/accounts/AccountHeaderPreferenceControllerTest.java
@@ -35,11 +35,11 @@
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
-import com.android.settings.applications.LayoutPreference;
import com.android.settings.testutils.FakeFeatureFactory;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settingslib.accounts.AuthenticatorHelper;
import com.android.settingslib.core.lifecycle.Lifecycle;
+import com.android.settingslib.widget.LayoutPreference;
import org.junit.Before;
import org.junit.Test;
diff --git a/tests/robotests/src/com/android/settings/accounts/RemoveAccountPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accounts/RemoveAccountPreferenceControllerTest.java
index 3bebd66..83ea218 100644
--- a/tests/robotests/src/com/android/settings/accounts/RemoveAccountPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/accounts/RemoveAccountPreferenceControllerTest.java
@@ -51,12 +51,12 @@
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
-import com.android.settings.applications.LayoutPreference;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.testutils.shadow.ShadowAccountManager;
import com.android.settings.testutils.shadow.ShadowContentResolver;
import com.android.settings.testutils.shadow.ShadowDevicePolicyManager;
import com.android.settings.testutils.shadow.ShadowUserManager;
+import com.android.settingslib.widget.LayoutPreference;
import org.junit.Before;
import org.junit.Test;
diff --git a/tests/robotests/src/com/android/settings/applications/AppInfoWithHeaderTest.java b/tests/robotests/src/com/android/settings/applications/AppInfoWithHeaderTest.java
index ddcbf85..3031f5b 100644
--- a/tests/robotests/src/com/android/settings/applications/AppInfoWithHeaderTest.java
+++ b/tests/robotests/src/com/android/settings/applications/AppInfoWithHeaderTest.java
@@ -44,6 +44,7 @@
import com.android.settingslib.applications.AppUtils;
import com.android.settingslib.applications.ApplicationsState;
import com.android.settingslib.applications.instantapps.InstantAppDataProvider;
+import com.android.settingslib.widget.LayoutPreference;
import org.junit.After;
import org.junit.Before;
diff --git a/tests/robotests/src/com/android/settings/applications/LayoutPreferenceTest.java b/tests/robotests/src/com/android/settings/applications/LayoutPreferenceTest.java
deleted file mode 100644
index 899d4cb..0000000
--- a/tests/robotests/src/com/android/settings/applications/LayoutPreferenceTest.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (C) 2017 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.applications;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-
-import android.content.Context;
-import android.view.LayoutInflater;
-
-import androidx.preference.Preference.OnPreferenceClickListener;
-import androidx.preference.PreferenceViewHolder;
-
-import com.android.settings.R;
-import com.android.settings.testutils.SettingsRobolectricTestRunner;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.robolectric.RuntimeEnvironment;
-
-@RunWith(SettingsRobolectricTestRunner.class)
-public class LayoutPreferenceTest {
-
- private Context mContext;
- private LayoutPreference mPreference;
- private PreferenceViewHolder mHolder;
-
- @Before
- public void setUp() {
- mContext = RuntimeEnvironment.application;
- mPreference = new LayoutPreference(mContext, R.layout.two_action_buttons);
- mHolder = PreferenceViewHolder.createInstanceForTests(LayoutInflater.from(mContext)
- .inflate(R.layout.layout_preference_frame, null, false));
- }
-
- @Test
- public void setOnClickListener_shouldAttachToRootView() {
- final OnPreferenceClickListener listener = mock(OnPreferenceClickListener.class);
-
- mPreference.setOnPreferenceClickListener(listener);
- mPreference.onBindViewHolder(mHolder);
-
- mHolder.itemView.callOnClick();
-
- verify(listener).onPreferenceClick(mPreference);
- assertThat(mHolder.itemView.isFocusable()).isTrue();
- assertThat(mHolder.itemView.isClickable()).isTrue();
- }
-
- @Test
- public void setNonSelectable_viewShouldNotBeSelectable() {
- mPreference.setSelectable(false);
- mPreference.onBindViewHolder(mHolder);
-
- assertThat(mHolder.itemView.isFocusable()).isFalse();
- assertThat(mHolder.itemView.isClickable()).isFalse();
- }
-
- @Test
- public void disableSomeView_shouldMaintainStateAfterBind() {
- mPreference.findViewById(R.id.button1).setEnabled(false);
- mPreference.findViewById(R.id.button2).setEnabled(true);
-
- mPreference.onBindViewHolder(mHolder);
-
- assertThat(mPreference.findViewById(R.id.button1).isEnabled()).isFalse();
- assertThat(mPreference.findViewById(R.id.button2).isEnabled()).isTrue();
- }
-
- @Test
- public void allowDividerBelow_shouldSaveCorrectDividerStatus() {
- mPreference.setAllowDividerBelow(true);
-
- assertThat(mPreference.isAllowDividerBelow()).isTrue();
- }
-}
diff --git a/tests/robotests/src/com/android/settings/applications/appinfo/AppHeaderViewPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/applications/appinfo/AppHeaderViewPreferenceControllerTest.java
index d3e00c3..67702f1 100644
--- a/tests/robotests/src/com/android/settings/applications/appinfo/AppHeaderViewPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/appinfo/AppHeaderViewPreferenceControllerTest.java
@@ -42,10 +42,10 @@
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
-import com.android.settings.applications.LayoutPreference;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settingslib.applications.ApplicationsState;
import com.android.settingslib.core.lifecycle.Lifecycle;
+import com.android.settingslib.widget.LayoutPreference;
import org.junit.Before;
import org.junit.Test;
diff --git a/tests/robotests/src/com/android/settings/applications/appinfo/InstantAppButtonsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/applications/appinfo/InstantAppButtonsPreferenceControllerTest.java
index 5d8c842..6879b7d 100644
--- a/tests/robotests/src/com/android/settings/applications/appinfo/InstantAppButtonsPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/appinfo/InstantAppButtonsPreferenceControllerTest.java
@@ -48,11 +48,11 @@
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
-import com.android.settings.applications.LayoutPreference;
import com.android.settings.core.BasePreferenceController;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settingslib.applications.AppUtils;
import com.android.settingslib.applications.instantapps.InstantAppDataProvider;
+import com.android.settingslib.widget.LayoutPreference;
import org.junit.Before;
import org.junit.Test;
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsHeaderControllerTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsHeaderControllerTest.java
index 0430e0f..e62e338 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsHeaderControllerTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsHeaderControllerTest.java
@@ -33,7 +33,6 @@
import androidx.fragment.app.FragmentTransaction;
import com.android.settings.R;
-import com.android.settings.applications.LayoutPreference;
import com.android.settings.testutils.FakeFeatureFactory;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.testutils.shadow.SettingsShadowBluetoothDevice;
@@ -41,6 +40,7 @@
import com.android.settings.widget.EntityHeaderController;
import com.android.settingslib.bluetooth.CachedBluetoothDeviceManager;
import com.android.settingslib.bluetooth.LocalBluetoothManager;
+import com.android.settingslib.widget.LayoutPreference;
import org.junit.After;
import org.junit.Test;
diff --git a/tests/robotests/src/com/android/settings/connecteddevice/usb/UsbDetailsHeaderControllerTest.java b/tests/robotests/src/com/android/settings/connecteddevice/usb/UsbDetailsHeaderControllerTest.java
index ec697ad..2aa38d7 100644
--- a/tests/robotests/src/com/android/settings/connecteddevice/usb/UsbDetailsHeaderControllerTest.java
+++ b/tests/robotests/src/com/android/settings/connecteddevice/usb/UsbDetailsHeaderControllerTest.java
@@ -31,12 +31,12 @@
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
-import com.android.settings.applications.LayoutPreference;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.testutils.shadow.ShadowEntityHeaderController;
import com.android.settings.widget.EntityHeaderController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.testutils.DrawableTestHelper;
+import com.android.settingslib.widget.LayoutPreference;
import org.junit.After;
import org.junit.Before;
diff --git a/tests/robotests/src/com/android/settings/display/ColorModePreferenceFragmentTest.java b/tests/robotests/src/com/android/settings/display/ColorModePreferenceFragmentTest.java
index 3aae145..859912a 100644
--- a/tests/robotests/src/com/android/settings/display/ColorModePreferenceFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/display/ColorModePreferenceFragmentTest.java
@@ -34,10 +34,10 @@
import com.android.internal.app.ColorDisplayController;
import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R;
-import com.android.settings.applications.LayoutPreference;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.testutils.shadow.SettingsShadowResources;
import com.android.settingslib.widget.CandidateInfo;
+import com.android.settingslib.widget.LayoutPreference;
import org.junit.Before;
import org.junit.Test;
diff --git a/tests/robotests/src/com/android/settings/display/NightDisplayActivationPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/display/NightDisplayActivationPreferenceControllerTest.java
index 30dedb6..84d184d 100644
--- a/tests/robotests/src/com/android/settings/display/NightDisplayActivationPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/display/NightDisplayActivationPreferenceControllerTest.java
@@ -26,9 +26,9 @@
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
-import com.android.settings.applications.LayoutPreference;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.testutils.shadow.SettingsShadowResources;
+import com.android.settingslib.widget.LayoutPreference;
import org.junit.Before;
import org.junit.Test;
diff --git a/tests/robotests/src/com/android/settings/dream/StartNowPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/dream/StartNowPreferenceControllerTest.java
index fc7edc2..21cb9f1 100644
--- a/tests/robotests/src/com/android/settings/dream/StartNowPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/dream/StartNowPreferenceControllerTest.java
@@ -28,9 +28,9 @@
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
-import com.android.settings.applications.LayoutPreference;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settingslib.dream.DreamBackend;
+import com.android.settingslib.widget.LayoutPreference;
import org.junit.Before;
import org.junit.Test;
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetailTest.java b/tests/robotests/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetailTest.java
index 1a8d58d..c9086ab 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetailTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetailTest.java
@@ -51,7 +51,6 @@
import com.android.internal.os.BatteryStatsHelper;
import com.android.settings.R;
import com.android.settings.SettingsActivity;
-import com.android.settings.applications.LayoutPreference;
import com.android.settings.testutils.FakeFeatureFactory;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.testutils.shadow.ShadowActivityManager;
@@ -61,6 +60,7 @@
import com.android.settingslib.applications.ApplicationsState;
import com.android.settingslib.applications.instantapps.InstantAppDataProvider;
import com.android.settingslib.core.lifecycle.Lifecycle;
+import com.android.settingslib.widget.LayoutPreference;
import org.junit.After;
import org.junit.Before;
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/BatteryHeaderPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/fuelgauge/BatteryHeaderPreferenceControllerTest.java
index 5541654..7797a78 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/BatteryHeaderPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/BatteryHeaderPreferenceControllerTest.java
@@ -42,7 +42,6 @@
import androidx.recyclerview.widget.RecyclerView;
import com.android.settings.R;
-import com.android.settings.applications.LayoutPreference;
import com.android.settings.core.BasePreferenceController;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.testutils.shadow.SettingsShadowResources;
@@ -50,6 +49,7 @@
import com.android.settings.testutils.shadow.ShadowEntityHeaderController;
import com.android.settings.widget.EntityHeaderController;
import com.android.settingslib.core.lifecycle.Lifecycle;
+import com.android.settingslib.widget.LayoutPreference;
import org.junit.After;
import org.junit.Before;
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/PowerUsageSummaryTest.java b/tests/robotests/src/com/android/settings/fuelgauge/PowerUsageSummaryTest.java
index cf1a5f3..14caf2c 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/PowerUsageSummaryTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/PowerUsageSummaryTest.java
@@ -48,12 +48,12 @@
import com.android.internal.os.BatteryStatsHelper;
import com.android.settings.R;
import com.android.settings.SettingsActivity;
-import com.android.settings.applications.LayoutPreference;
import com.android.settings.fuelgauge.batterytip.BatteryTipPreferenceController;
import com.android.settings.testutils.FakeFeatureFactory;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.testutils.XmlTestUtils;
import com.android.settings.testutils.shadow.SettingsShadowResources;
+import com.android.settingslib.widget.LayoutPreference;
import org.junit.Before;
import org.junit.BeforeClass;
diff --git a/tests/robotests/src/com/android/settings/homepage/contextualcards/ContextualCardLoaderTest.java b/tests/robotests/src/com/android/settings/homepage/contextualcards/ContextualCardLoaderTest.java
index f9eda49..e8cb674 100644
--- a/tests/robotests/src/com/android/settings/homepage/contextualcards/ContextualCardLoaderTest.java
+++ b/tests/robotests/src/com/android/settings/homepage/contextualcards/ContextualCardLoaderTest.java
@@ -40,7 +40,6 @@
import org.robolectric.shadows.ShadowContentResolver;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@@ -61,17 +60,6 @@
}
@Test
- public void createStaticCards_shouldContainCorrectCards() {
- final Uri batteryInfo = BatterySlice.BATTERY_CARD_URI;
- final List<Uri> expectedUris = Arrays.asList(batteryInfo);
-
- final List<Uri> actualCardUris = mContextualCardLoader.createStaticCards().stream().map(
- ContextualCard::getSliceUri).collect(Collectors.toList());
-
- assertThat(actualCardUris).containsExactlyElementsIn(expectedUris);
- }
-
- @Test
public void isCardEligibleToDisplay_customCard_returnTrue() {
final ContextualCard customCard = new ContextualCard.Builder()
.setName("custom_card")
@@ -224,4 +212,4 @@
.build());
return cards;
}
-}
+}
\ No newline at end of file
diff --git a/tests/robotests/src/com/android/settings/network/AirplaneModePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/network/AirplaneModePreferenceControllerTest.java
index 91a545c..46d177f 100644
--- a/tests/robotests/src/com/android/settings/network/AirplaneModePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/network/AirplaneModePreferenceControllerTest.java
@@ -187,11 +187,4 @@
new AirplaneModePreferenceController(mContext,"toggle_airplane");
assertThat(controller.isSliceable()).isTrue();
}
-
- @Test
- public void isSliceableIncorrectKey_returnsFalse() {
- final AirplaneModePreferenceController controller =
- new AirplaneModePreferenceController(mContext, "bad_key");
- assertThat(controller.isSliceable()).isFalse();
- }
}
diff --git a/tests/robotests/src/com/android/settings/notification/BlockPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/BlockPreferenceControllerTest.java
index 06ef601..0ebcaef 100644
--- a/tests/robotests/src/com/android/settings/notification/BlockPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/notification/BlockPreferenceControllerTest.java
@@ -45,9 +45,9 @@
import android.os.UserManager;
import com.android.settings.R;
-import com.android.settings.applications.LayoutPreference;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.widget.SwitchBar;
+import com.android.settingslib.widget.LayoutPreference;
import org.junit.Before;
import org.junit.Test;
diff --git a/tests/robotests/src/com/android/settings/notification/HeaderPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/HeaderPreferenceControllerTest.java
index 57c8712..04dac26 100644
--- a/tests/robotests/src/com/android/settings/notification/HeaderPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/notification/HeaderPreferenceControllerTest.java
@@ -37,7 +37,7 @@
import androidx.fragment.app.FragmentActivity;
import androidx.preference.PreferenceFragmentCompat;
-import com.android.settings.applications.LayoutPreference;
+import com.android.settingslib.widget.LayoutPreference;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import org.junit.Before;
diff --git a/tests/robotests/src/com/android/settings/panel/InternetConnectivityPanelTest.java b/tests/robotests/src/com/android/settings/panel/InternetConnectivityPanelTest.java
new file mode 100644
index 0000000..3e210f5
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/panel/InternetConnectivityPanelTest.java
@@ -0,0 +1,52 @@
+/*
+ * 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.panel;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.net.Uri;
+
+import com.android.settings.testutils.SettingsRobolectricTestRunner;
+import com.android.settings.wifi.WifiSlice;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.robolectric.RuntimeEnvironment;
+
+import java.util.List;
+
+@RunWith(SettingsRobolectricTestRunner.class)
+
+public class InternetConnectivityPanelTest {
+
+ private InternetConnectivityPanel mPanel;
+
+ @Before
+ public void setUp() {
+ mPanel = InternetConnectivityPanel.create(RuntimeEnvironment.application);
+ }
+
+ @Test
+ public void getSlices_containsNecessarySlices() {
+ final List<Uri> uris = mPanel.getSlices();
+
+ assertThat(uris).containsExactly(WifiSlice.WIFI_URI,
+ InternetConnectivityPanel.AIRPLANE_URI);
+ }
+}
diff --git a/tests/robotests/src/com/android/settings/panel/PanelFeatureProviderImplTest.java b/tests/robotests/src/com/android/settings/panel/PanelFeatureProviderImplTest.java
new file mode 100644
index 0000000..050fd0c
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/panel/PanelFeatureProviderImplTest.java
@@ -0,0 +1,52 @@
+/*
+ * 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.panel;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.content.Context;
+
+import com.android.settings.testutils.SettingsRobolectricTestRunner;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import org.robolectric.RuntimeEnvironment;
+
+@RunWith(SettingsRobolectricTestRunner.class)
+public class PanelFeatureProviderImplTest {
+
+ private Context mContext;
+ private PanelFeatureProviderImpl mProvider;
+
+ @Before
+ public void setUp() {
+ mContext = RuntimeEnvironment.application;
+ mProvider = new PanelFeatureProviderImpl();
+ }
+
+ @Test
+ public void getPanel_internetConnectivityKey_returnsCorrectPanel() {
+ final PanelContent panel = mProvider.getPanel(mContext,
+ SettingsPanelActivity.PANEL_TYPE_WIFI);
+
+ assertThat(panel).isInstanceOf(InternetConnectivityPanel.class);
+ }
+
+}
diff --git a/tests/robotests/src/com/android/settings/testutils/FakeFeatureFactory.java b/tests/robotests/src/com/android/settings/testutils/FakeFeatureFactory.java
index 24db829..e14ef1f 100644
--- a/tests/robotests/src/com/android/settings/testutils/FakeFeatureFactory.java
+++ b/tests/robotests/src/com/android/settings/testutils/FakeFeatureFactory.java
@@ -33,6 +33,7 @@
import com.android.settings.overlay.FeatureFactory;
import com.android.settings.overlay.SupportFeatureProvider;
import com.android.settings.overlay.SurveyFeatureProvider;
+import com.android.settings.panel.PanelFeatureProvider;
import com.android.settings.search.SearchFeatureProvider;
import com.android.settings.security.SecurityFeatureProvider;
import com.android.settings.slices.SlicesFeatureProvider;
@@ -61,6 +62,7 @@
public final UserFeatureProvider userFeatureProvider;
public final AssistGestureFeatureProvider assistGestureFeatureProvider;
public final AccountFeatureProvider mAccountFeatureProvider;
+ public final PanelFeatureProvider mPanelFeatureProvider;
public SlicesFeatureProvider slicesFeatureProvider;
public SearchFeatureProvider searchFeatureProvider;
@@ -102,6 +104,7 @@
assistGestureFeatureProvider = mock(AssistGestureFeatureProvider.class);
slicesFeatureProvider = mock(SlicesFeatureProvider.class);
mAccountFeatureProvider = mock(AccountFeatureProvider.class);
+ mPanelFeatureProvider = mock(PanelFeatureProvider.class);
}
@Override
@@ -183,4 +186,9 @@
public AccountFeatureProvider getAccountFeatureProvider() {
return mAccountFeatureProvider;
}
+
+ @Override
+ public PanelFeatureProvider getPanelFeatureProvider() {
+ return mPanelFeatureProvider;
+ }
}
diff --git a/tests/robotests/src/com/android/settings/testutils/SettingsRobolectricTestRunner.java b/tests/robotests/src/com/android/settings/testutils/SettingsRobolectricTestRunner.java
index 5e5410c..9417e9c 100644
--- a/tests/robotests/src/com/android/settings/testutils/SettingsRobolectricTestRunner.java
+++ b/tests/robotests/src/com/android/settings/testutils/SettingsRobolectricTestRunner.java
@@ -84,6 +84,8 @@
paths.add(new ResourcePath(null,
Fs.fromURL(new URL("file:frameworks/base/packages/SettingsLib/SearchWidget/res/")), null));
paths.add(new ResourcePath(null,
+ Fs.fromURL(new URL("file:frameworks/base/packages/SettingsLib/SettingsLayoutPreference/res")), null));
+ paths.add(new ResourcePath(null,
Fs.fromURL(new URL("file:frameworks/base/core/res/res")), null));
paths.add(new ResourcePath(null,
Fs.fromURL(new URL("file:frameworks/opt/setupwizard/library/main/res")), null));
diff --git a/tests/robotests/src/com/android/settings/widget/EntityHeaderControllerTest.java b/tests/robotests/src/com/android/settings/widget/EntityHeaderControllerTest.java
index 5d60810..5639549 100644
--- a/tests/robotests/src/com/android/settings/widget/EntityHeaderControllerTest.java
+++ b/tests/robotests/src/com/android/settings/widget/EntityHeaderControllerTest.java
@@ -46,10 +46,10 @@
import androidx.preference.Preference;
import com.android.settings.R;
-import com.android.settings.applications.LayoutPreference;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.testutils.ShadowIconDrawableFactory;
import com.android.settingslib.applications.ApplicationsState;
+import com.android.settingslib.widget.LayoutPreference;
import org.junit.Before;
import org.junit.Test;
diff --git a/tests/robotests/src/com/android/settings/wifi/details/WifiDetailPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/wifi/details/WifiDetailPreferenceControllerTest.java
index 59e6287..4a0988a 100644
--- a/tests/robotests/src/com/android/settings/wifi/details/WifiDetailPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/details/WifiDetailPreferenceControllerTest.java
@@ -62,7 +62,6 @@
import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R;
-import com.android.settings.applications.LayoutPreference;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.testutils.shadow.ShadowBidiFormatter;
import com.android.settings.testutils.shadow.ShadowDevicePolicyManager;
@@ -73,6 +72,7 @@
import com.android.settings.wifi.WifiDetailPreference;
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
import com.android.settingslib.core.lifecycle.Lifecycle;
+import com.android.settingslib.widget.LayoutPreference;
import com.android.settingslib.wifi.AccessPoint;
import org.junit.Before;