Merge "isCarrierNetworkActive() should check if the carrier network is default" into sc-dev
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 0c65f01..627421d 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -17,8 +17,7 @@
<uses-permission android:name="android.permission.CHANGE_CONFIGURATION" />
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
<uses-permission android:name="android.permission.VIBRATE" />
- <uses-permission android:name="android.permission.BLUETOOTH" />
- <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
+ <uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
<uses-permission android:name="android.permission.BLUETOOTH_PRIVILEGED" />
@@ -2226,7 +2225,7 @@
<activity android:name=".bluetooth.RequestPermissionActivity"
android:excludeFromRecents="true"
- android:permission="android.permission.BLUETOOTH"
+ android:permission="android.permission.BLUETOOTH_CONNECT"
android:exported="true"
android:theme="@style/Theme.BluetoothPermission">
<intent-filter android:priority="1">
@@ -2269,7 +2268,7 @@
<activity android:name=".bluetooth.RequestPermissionHelperActivity"
android:label="@string/bluetooth_pairing_request"
android:excludeFromRecents="true"
- android:permission="android.permission.BLUETOOTH"
+ android:permission="android.permission.BLUETOOTH_CONNECT"
android:theme="@*android:style/Theme.DeviceDefault.Dialog.Alert.DayNight">
</activity>
@@ -2284,7 +2283,7 @@
<receiver android:name=".bluetooth.BluetoothPermissionRequest"
android:exported="true"
- android:permission="android.permission.BLUETOOTH_ADMIN">
+ android:permission="android.permission.BLUETOOTH_CONNECT">
<intent-filter>
<action android:name="android.bluetooth.device.action.CONNECTION_ACCESS_REQUEST" />
<action android:name="android.bluetooth.device.action.CONNECTION_ACCESS_CANCEL" />
@@ -2294,7 +2293,7 @@
<activity android:name=".bluetooth.BluetoothPermissionActivity"
android:label="@string/bluetooth_connection_permission_request"
android:excludeFromRecents="true"
- android:permission="android.permission.BLUETOOTH_ADMIN"
+ android:permission="android.permission.BLUETOOTH_CONNECT"
android:exported="true"
android:theme="@android:style/Theme.DeviceDefault.Light.Dialog.Alert">
<intent-filter android:priority="1">
@@ -3549,7 +3548,7 @@
<activity android:name="Settings$BluetoothDeviceDetailActivity"
android:label="@string/device_details_title"
android:exported="true"
- android:permission="android.permission.BLUETOOTH_ADMIN">
+ android:permission="android.permission.BLUETOOTH_CONNECT">
<intent-filter android:priority="1">
<action android:name="com.android.settings.BLUETOOTH_DEVICE_DETAIL_SETTINGS" />
<category android:name="android.intent.category.DEFAULT" />
@@ -3754,7 +3753,7 @@
<receiver
android:name=".media.BluetoothPairingReceiver"
android:exported="true"
- android:permission="android.permission.BLUETOOTH_ADMIN">
+ android:permission="android.permission.BLUETOOTH_CONNECT">
<intent-filter>
<action android:name="com.android.settings.action.LAUNCH_BLUETOOTH_PAIRING"/>
</intent-filter>/>
diff --git a/res/drawable-hdpi/ic_warning_googred_48dp.png b/res/drawable-hdpi/ic_warning_googred_48dp.png
deleted file mode 100644
index 70381dd..0000000
--- a/res/drawable-hdpi/ic_warning_googred_48dp.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable/ic_alert_red.xml b/res/drawable/ic_alert_red.xml
new file mode 100644
index 0000000..7b991fb
--- /dev/null
+++ b/res/drawable/ic_alert_red.xml
@@ -0,0 +1,31 @@
+<!--
+ ~ Copyright (C) 2021 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:tint="?android:attr/colorError"
+ android:viewportHeight="24.0"
+ android:viewportWidth="24.0">
+ <path
+ android:fillColor="@android:color/white"
+ android:pathData="M21.26,18L13.73,4.99c-0.77,-1.33 -2.69,-1.33 -3.46,0L2.74,18c-0.77,1.33 0.19,3 1.73,3h15.06C21.07,21 22.03,19.33 21.26,18zM4.47,19L12,5.99L19.53,19H4.47z" />
+ <path
+ android:fillColor="@android:color/white"
+ android:pathData="M11,11v2c0,0.55 0.45,1 1,1c0.55,0 1,-0.45 1,-1v-2c0,-0.55 -0.45,-1 -1,-1C11.45,10 11,10.45 11,11z" />
+ <path
+ android:fillColor="@android:color/white"
+ android:pathData="M12,17m-1,0a1,1 0,1 1,2 0a1,1 0,1 1,-2 0" />
+</vector>
diff --git a/res/drawable/ic_lock_pin.xml b/res/drawable/ic_lock_pin.xml
index e1821f6..587f49c 100644
--- a/res/drawable/ic_lock_pin.xml
+++ b/res/drawable/ic_lock_pin.xml
@@ -21,5 +21,5 @@
android:viewportHeight="24">
<path
android:pathData="M6,8c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM12,20c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM6,20c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM6,14c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM12,14c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM16,6c0,1.1 0.9,2 2,2s2,-0.9 2,-2 -0.9,-2 -2,-2 -2,0.9 -2,2zM12,8c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM18,14c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM18,20c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2z"
- android:fillColor="?attr/sudListItemIconColor"/>
+ android:fillColor="?android:attr/colorAccent"/>
</vector>
diff --git a/res/drawable/settings_panel_rounded_top_corner_background.xml b/res/drawable/settings_panel_rounded_top_corner_background.xml
new file mode 100644
index 0000000..1c234cc
--- /dev/null
+++ b/res/drawable/settings_panel_rounded_top_corner_background.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2021 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<inset xmlns:android="http://schemas.android.com/apk/res/android">
+ <shape android:shape="rectangle">
+ <corners
+ android:topLeftRadius="@dimen/settings_panel_corner_radius"
+ android:topRightRadius="@dimen/settings_panel_corner_radius"
+ android:bottomLeftRadius="0dp"
+ android:bottomRightRadius="0dp"/>
+ <solid android:color="?android:attr/colorBackground" />
+ </shape>
+</inset>
\ No newline at end of file
diff --git a/res/drawable/tabs_indicator_background.xml b/res/drawable/tabs_indicator_background.xml
new file mode 100644
index 0000000..d326e65
--- /dev/null
+++ b/res/drawable/tabs_indicator_background.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2021 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<shape
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="rectangle">
+
+ <solid android:color="?android:attr/textColorSecondaryInverse"/>
+ <corners android:radius="8dp"/>
+ <size android:height="4dp"/>
+</shape>
diff --git a/res/layout/ca_certificate_warning_dialog.xml b/res/layout/ca_certificate_warning_dialog.xml
index d863b08..2bb2b70 100644
--- a/res/layout/ca_certificate_warning_dialog.xml
+++ b/res/layout/ca_certificate_warning_dialog.xml
@@ -18,37 +18,24 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/setup_wizard_layout"
android:layout_width="match_parent"
- android:layout_height="match_parent">
+ android:layout_height="match_parent"
+ android:icon="@drawable/ic_alert_red">
<LinearLayout
style="@style/SudContentFrame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:orientation="vertical"
- android:gravity="center_horizontal">
-
- <ImageView
- android:id="@+id/sud_layout_icon"
- style="@style/SudGlifIcon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:src="@drawable/ic_warning_googred_48dp"/>
-
- <TextView
- android:id="@+id/sud_layout_title"
- style="@style/SudGlifHeaderTitle"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:text="@string/ca_certificate_warning_title"/>
+ android:orientation="vertical">
<TextView
android:id="@+id/sud_layout_description"
style="@style/SudDescription.Glif"
- android:layout_marginTop="16dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:layout_marginStart="16dp"
+ android:layout_marginEnd="16dp"
+ android:textSize="18sp"
+ android:alpha="0.7"
android:text="@string/ca_certificate_warning_description"/>
</LinearLayout>
diff --git a/res/layout/face_enroll_accessibility_toggle.xml b/res/layout/face_enroll_accessibility_toggle.xml
index bb3a7ff..a56655d 100644
--- a/res/layout/face_enroll_accessibility_toggle.xml
+++ b/res/layout/face_enroll_accessibility_toggle.xml
@@ -30,15 +30,18 @@
<!-- Title -->
<com.google.android.setupdesign.view.RichTextView
- style="@style/SudDescription.Glif"
android:id="@+id/title"
android:paddingHorizontal="8dp"
android:paddingTop="8dp"
+ android:paddingBottom="4dp"
android:gravity="start"
android:layout_alignParentStart="true"
android:layout_toStartOf="@+id/toggle"
android:layout_width="wrap_content"
- android:layout_height="wrap_content" />
+ android:layout_height="wrap_content"
+ android:textColor="?android:attr/textColorPrimary"
+ android:textSize="@dimen/sud_description_text_size"
+ />
<!-- Subtitle -->
<TextView
@@ -50,7 +53,8 @@
android:layout_below="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="@string/security_settings_face_enroll_introduction_accessibility_expanded"/>
+ android:text="@string/security_settings_face_enroll_introduction_accessibility_expanded"
+ android:textColor="?android:attr/textColorSecondary"/>
<!-- Vertical divider -->
<View
diff --git a/res/layout/face_enroll_education.xml b/res/layout/face_enroll_education.xml
index 53a584e..f98380d 100644
--- a/res/layout/face_enroll_education.xml
+++ b/res/layout/face_enroll_education.xml
@@ -21,7 +21,8 @@
style="?attr/face_layout_theme"
android:id="@+id/setup_wizard_layout"
android:layout_width="match_parent"
- android:layout_height="match_parent">
+ android:layout_height="match_parent"
+ app:sucHeaderText="@string/security_settings_face_enroll_education_title">
<LinearLayout
style="@style/SudContentFrame"
@@ -38,7 +39,7 @@
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="-32dp">
+ android:layout_marginTop="-24dp">
<com.google.android.setupdesign.view.IllustrationVideoView
android:id="@+id/illustration_default"
@@ -97,7 +98,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
- app:messageText="@string/security_settings_face_enroll_introduction_accessibility_diversity"/>
+ app:messageText="@string/security_settings_face_enroll_introduction_accessibility"/>
</FrameLayout>
diff --git a/res/layout/manage_applications_apps.xml b/res/layout/manage_applications_apps.xml
index 055e4b4..d814164 100644
--- a/res/layout/manage_applications_apps.xml
+++ b/res/layout/manage_applications_apps.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
-<androidx.constraintlayout.widget.ConstraintLayout
+<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
@@ -24,39 +24,40 @@
android:id="@+id/pinned_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:elevation="2dp"
- settings:layout_constraintTop_toTopOf="parent"/>
+ android:elevation="2dp"/>
- <androidx.recyclerview.widget.RecyclerView
- android:id="@+id/apps_list"
+ <FrameLayout
+ android:id="@+id/list_container"
android:layout_width="match_parent"
- android:layout_height="0dp"
- android:clipToPadding="false"
- android:scrollbars="none"
- android:visibility="invisible"
- settings:fastScrollEnabled="true"
- settings:fastScrollHorizontalThumbDrawable="@drawable/thumb_drawable"
- settings:fastScrollHorizontalTrackDrawable="@drawable/line_drawable"
- settings:fastScrollVerticalThumbDrawable="@drawable/thumb_drawable"
- settings:fastScrollVerticalTrackDrawable="@drawable/line_drawable"
- settings:layout_constraintTop_toBottomOf="@id/pinned_header"
- settings:layout_constraintBottom_toBottomOf="parent"/>
+ android:layout_height="match_parent"
+ android:visibility="gone">
- <TextView
- android:id="@android:id/empty"
- android:layout_width="match_parent"
- android:layout_height="0dp"
- android:gravity="center"
- android:text="@string/no_applications"
- android:textAppearance="?android:attr/textAppearanceLarge"
- android:visibility="invisible"
- settings:layout_constraintTop_toTopOf="parent"
- settings:layout_constraintBottom_toBottomOf="parent"/>
+ <androidx.recyclerview.widget.RecyclerView
+ android:id="@+id/apps_list"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:clipToPadding="false"
+ android:scrollbars="none"
+ settings:fastScrollEnabled="true"
+ settings:fastScrollHorizontalThumbDrawable="@drawable/thumb_drawable"
+ settings:fastScrollHorizontalTrackDrawable="@drawable/line_drawable"
+ settings:fastScrollVerticalThumbDrawable="@drawable/thumb_drawable"
+ settings:fastScrollVerticalTrackDrawable="@drawable/line_drawable"/>
- <include layout="@layout/loading_container"
- settings:layout_constraintTop_toBottomOf="@id/pinned_header"
- settings:layout_constraintBottom_toBottomOf="parent"/>
+ <TextView
+ android:id="@android:id/empty"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:gravity="bottom|center_horizontal"
+ android:layout_gravity="center"
+ android:text="@string/no_applications"
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ android:visibility="invisible"/>
-</androidx.constraintlayout.widget.ConstraintLayout>
+ </FrameLayout>
+
+ <include layout="@layout/loading_container"/>
+
+</FrameLayout>
diff --git a/res/layout/panel_layout.xml b/res/layout/panel_layout.xml
index 674e20e..9e15f15 100644
--- a/res/layout/panel_layout.xml
+++ b/res/layout/panel_layout.xml
@@ -20,7 +20,7 @@
android:id="@+id/panel_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:background="@drawable/settings_panel_background" >
+ android:background="@drawable/settings_panel_rounded_top_corner_background" >
<LinearLayout
android:layout_width="match_parent"
@@ -30,7 +30,11 @@
<LinearLayout
android:id="@+id/panel_header"
android:layout_width="match_parent"
- android:layout_height="94dp"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="@dimen/settings_panel_title_margin"
+ android:layout_marginEnd="@dimen/settings_panel_title_margin"
+ android:layout_marginTop="@dimen/settings_panel_title_margin"
+ android:layout_marginBottom="@dimen/settings_panel_title_margin"
android:gravity="start|center_vertical"
android:orientation="horizontal"
android:visibility="gone">
@@ -51,14 +55,13 @@
android:id="@+id/header_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginStart="16dp"
- android:layout_marginEnd="16dp"
android:orientation="vertical">
<TextView
android:id="@+id/header_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:layout_marginBottom="8dp"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?android:attr/textColorPrimary"
@@ -81,11 +84,12 @@
android:id="@+id/panel_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:layout_marginTop="@dimen/settings_panel_title_margin"
+ android:layout_marginBottom="@dimen/settings_panel_title_margin"
android:gravity="center"
- android:paddingBottom="24dp"
- android:paddingTop="18dp"
android:textColor="?android:attr/textColorPrimary"
- android:textSize="20sp"/>
+ android:textSize="24sp"
+ android:fontFamily="sans-serif-reqular"/>
<ProgressBar
android:id="@+id/progress_bar"
diff --git a/res/layout/preference_list_fragment.xml b/res/layout/preference_list_fragment.xml
index f8ffa8f..03ba735 100644
--- a/res/layout/preference_list_fragment.xml
+++ b/res/layout/preference_list_fragment.xml
@@ -19,6 +19,7 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/container_material"
android:orientation="vertical"
@@ -66,19 +67,20 @@
android:background="@android:color/transparent"
android:id="@+id/tabs"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
+ android:layout_height="48dp"
+ android:layout_marginStart="24dp"
+ android:layout_marginEnd="24dp"
+ android:layout_marginTop="8dp"
+ android:layout_marginBottom="8dp"
android:layoutDirection="ltr"
app:tabMaxWidth="0dp"
app:tabGravity="fill"
app:tabMode="fixed"
- app:tabIndicatorColor="@*android:color/accent_device_default"
+ app:tabIndicator="@drawable/tabs_indicator_background"
+ app:tabIndicatorColor="?androidprv:attr/colorAccentPrimaryVariant"
app:tabSelectedTextColor="@*android:color/accent_device_default"
app:tabTextAppearance="@style/TextAppearance.Tab"
app:tabTextColor="?android:attr/textColorSecondary"/>
- <View
- android:layout_width="match_parent"
- android:layout_height="1dp"
- android:background="?android:attr/listDivider"/>
<androidx.viewpager.widget.ViewPager
android:id="@+id/view_pager"
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index f3b8a91..908b640 100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -149,6 +149,8 @@
<dimen name="wifi_assistant_height">182dp</dimen>
<dimen name="wifi_assistant_image_top">32dp</dimen>
<dimen name="wifi_assistant_image_start">24dp</dimen>
+ <!-- appbar height is equal search bar height (48dp) plus search bar top and bottom margin -->
+ <dimen name="app_bar_height">80dp</dimen>
<!-- CryptKeeper top margin for password/pin screen -->
<dimen name="crypt_keeper_password_top_margin">88dip</dimen>
@@ -425,6 +427,10 @@
<dimen name="output_switcher_panel_icon_size">52dp</dimen>
<dimen name="output_switcher_panel_icon_corner_radius">16dp</dimen>
+ <!-- Settings panel related dimensions -->
+ <dimen name="settings_panel_corner_radius">28dp</dimen>
+ <dimen name="settings_panel_title_margin">24dp</dimen>
+
<!-- Text padding for EmptyTextSettings -->
<dimen name="empty_text_padding">24dp</dimen>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index c19c8dc..3166f2c 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1088,77 +1088,77 @@
<!-- Content of the dialog shown when the user tries to skip fingerprint setup, asking them to confirm the action [CHAR LIMIT=NONE] -->
<string name="setup_fingerprint_enroll_enrolling_skip_message">You\u2019ve chosen to use your fingerprint as one way to unlock your phone. If you skip now, you\u2019ll need to set this up later. Setup takes only a minute or so.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up fingerprint. (tablet) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_pin_skip_message" product="tablet">A PIN protects your tablet if it\u2019s lost or stolen</string>
+ <string name="lock_screen_pin_skip_message" product="tablet">A PIN protects the tablet if it\u2019s lost or stolen</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up fingerprint. (tablet) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_pattern_skip_message" product="tablet">A pattern protects your tablet if it\u2019s lost or stolen</string>
+ <string name="lock_screen_pattern_skip_message" product="tablet">A pattern protects the tablet if it\u2019s lost or stolen</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up fingerprint. (tablet) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_password_skip_message" product="tablet">A password protects your tablet if it\u2019s lost or stolen</string>
+ <string name="lock_screen_password_skip_message" product="tablet">A password protects the tablet if it\u2019s lost or stolen</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up fingerprint. (device) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_pin_skip_message" product="device">A PIN protects your device if it\u2019s lost or stolen</string>
+ <string name="lock_screen_pin_skip_message" product="device">A PIN protects the device if it\u2019s lost or stolen</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up fingerprint. (device) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_pattern_skip_message" product="device">A pattern protects your device if it\u2019s lost or stolen</string>
+ <string name="lock_screen_pattern_skip_message" product="device">A pattern protects the device if it\u2019s lost or stolen</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up fingerprint. (device) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_password_skip_message" product="device">A password protects your device if it\u2019s lost or stolen</string>
+ <string name="lock_screen_password_skip_message" product="device">A password protects the device if it\u2019s lost or stolen</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up fingerprint. (default) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_pin_skip_message" product="default">A PIN protects your phone if it\u2019s lost or stolen</string>
+ <string name="lock_screen_pin_skip_message" product="default">A PIN protects the phone if it\u2019s lost or stolen</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up fingerprint. (default) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_pattern_skip_message" product="default">A pattern protects your phone if it\u2019s lost or stolen</string>
+ <string name="lock_screen_pattern_skip_message" product="default">A pattern protects the phone if it\u2019s lost or stolen</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up fingerprint. (default) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_password_skip_message" product="default">A password protects your phone if it\u2019s lost or stolen</string>
+ <string name="lock_screen_password_skip_message" product="default">A password protects the phone if it\u2019s lost or stolen</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up fingerprint. (tablet) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_pin_skip_fingerprint_message" product="tablet">A PIN is required to set up Fingerprint Unlock.\n\nA PIN protects your tablet if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_pin_skip_fingerprint_message" product="tablet">A PIN is required to set up Fingerprint Unlock.\n\nA PIN protects the tablet if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up fingerprint. (tablet) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_pattern_skip_fingerprint_message" product="tablet">A pattern is required to set up Fingerprint Unlock.\n\nA pattern protects your tablet if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_pattern_skip_fingerprint_message" product="tablet">A pattern is required to set up Fingerprint Unlock.\n\nA pattern protects the tablet if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up fingerprint. (tablet) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_password_skip_fingerprint_message" product="tablet">A password is required to set up Fingerprint Unlock.\n\nA password protects your tablet if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_password_skip_fingerprint_message" product="tablet">A password is required to set up Fingerprint Unlock.\n\nA password protects the tablet if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up fingerprint. (device) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_pin_skip_fingerprint_message" product="device">A PIN is required to set up Fingerprint Unlock.\n\nA PIN protects your device if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_pin_skip_fingerprint_message" product="device">A PIN is required to set up Fingerprint Unlock.\n\nA PIN protects the device if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up fingerprint. (device) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_pattern_skip_fingerprint_message" product="device">A pattern is required to set up Fingerprint Unlock.\n\nA pattern protects your device if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_pattern_skip_fingerprint_message" product="device">A pattern is required to set up Fingerprint Unlock.\n\nA pattern protects the device if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up fingerprint. (device) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_password_skip_fingerprint_message" product="device">A password is required to set up Fingerprint Unlock.\n\nA password protects your device if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_password_skip_fingerprint_message" product="device">A password is required to set up Fingerprint Unlock.\n\nA password protects the device if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up fingerprint. (default) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_pin_skip_fingerprint_message" product="default">A PIN is required to set up Fingerprint Unlock.\n\nA PIN protects your phone if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_pin_skip_fingerprint_message" product="default">A PIN is required to set up Fingerprint Unlock.\n\nA PIN protects the phone if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up fingerprint. (default) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_pattern_skip_fingerprint_message" product="default">A pattern is required to set up Fingerprint Unlock.\n\nA pattern protects your phone if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_pattern_skip_fingerprint_message" product="default">A pattern is required to set up Fingerprint Unlock.\n\nA pattern protects the phone if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up fingerprint. (default) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_password_skip_fingerprint_message" product="default">A password is required to set up Fingerprint Unlock.\n\nA password protects your phone if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_password_skip_fingerprint_message" product="default">A password is required to set up Fingerprint Unlock.\n\nA password protects the phone if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up face. (tablet) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_pin_skip_face_message" product="tablet">A PIN is required to set up Face Unlock.\n\nA PIN protects your tablet if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_pin_skip_face_message" product="tablet">A PIN is required to set up Face Unlock.\n\nA PIN protects the tablet if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up face. (tablet) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_pattern_skip_face_message" product="tablet">A pattern is required to set up Face Unlock.\n\nA pattern protects your tablet if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_pattern_skip_face_message" product="tablet">A pattern is required to set up Face Unlock.\n\nA pattern protects the tablet if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up face. (tablet) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_password_skip_face_message" product="tablet">A password is required to set up Face Unlock.\n\nA password protects your tablet if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_password_skip_face_message" product="tablet">A password is required to set up Face Unlock.\n\nA password protects the tablet if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up face. (device) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_pin_skip_face_message" product="device">A PIN is required to set up Face Unlock.\n\nA PIN protects your device if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_pin_skip_face_message" product="device">A PIN is required to set up Face Unlock.\n\nA PIN protects the device if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up face. (device) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_pattern_skip_face_message" product="device">A pattern is required to set up Face Unlock.\n\nA pattern protects your device if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_pattern_skip_face_message" product="device">A pattern is required to set up Face Unlock.\n\nA pattern protects the device if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up face. (device) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_password_skip_face_message" product="device">A password is required to set up Face Unlock.\n\nA password protects your device if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_password_skip_face_message" product="device">A password is required to set up Face Unlock.\n\nA password protects the device if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up face. (default) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_pin_skip_face_message" product="default">A PIN is required to set up Face Unlock.\n\nA PIN protects your phone if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_pin_skip_face_message" product="default">A PIN is required to set up Face Unlock.\n\nA PIN protects the phone if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up face. (default) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_pattern_skip_face_message" product="default">A pattern is required to set up Face Unlock.\n\nA pattern protects your phone if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_pattern_skip_face_message" product="default">A pattern is required to set up Face Unlock.\n\nA pattern protects the phone if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up face. (default) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_password_skip_face_message" product="default">A password is required to set up Face Unlock.\n\nA password protects your phone if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_password_skip_face_message" product="default">A password is required to set up Face Unlock.\n\nA password protects the phone if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up face or fingerprint. (tablet) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_pin_skip_biometrics_message" product="tablet">A PIN is required to set up Face Unlock and Fingerprint Unlock.\n\nA PIN protects your tablet if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_pin_skip_biometrics_message" product="tablet">A PIN is required to set up Face Unlock and Fingerprint Unlock.\n\nA PIN protects the tablet if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up face or fingerprint. (tablet) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_pattern_skip_biometrics_message" product="tablet">A pattern is required to set up Face Unlock and Fingerprint Unlock.\n\nA pattern protects your tablet if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_pattern_skip_biometrics_message" product="tablet">A pattern is required to set up Face Unlock and Fingerprint Unlock.\n\nA pattern protects the tablet if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up face or fingerprint. (tablet) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_password_skip_biometrics_message" product="tablet">A password is required to set up Face Unlock and Fingerprint Unlock.\n\nA password protects your tablet if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_password_skip_biometrics_message" product="tablet">A password is required to set up Face Unlock and Fingerprint Unlock.\n\nA password protects the tablet if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up face or fingerprint. (device) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_pin_skip_biometrics_message" product="device">A PIN is required to set up Face Unlock and Fingerprint Unlock.\n\nA PIN protects your device if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_pin_skip_biometrics_message" product="device">A PIN is required to set up Face Unlock and Fingerprint Unlock.\n\nA PIN protects the device if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up face or fingerprint. (device) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_pattern_skip_biometrics_message" product="device">A pattern is required to set up Face Unlock and Fingerprint Unlock.\n\nA pattern protects your device if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_pattern_skip_biometrics_message" product="device">A pattern is required to set up Face Unlock and Fingerprint Unlock.\n\nA pattern protects the device if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up face or fingerprint. (device) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_password_skip_biometrics_message" product="device">A password is required to set up Face Unlock and Fingerprint Unlock.\n\nA password protects your device if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_password_skip_biometrics_message" product="device">A password is required to set up Face Unlock and Fingerprint Unlock.\n\nA password protects the device if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up face or fingerprint. (default) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_pin_skip_biometrics_message" product="default">A PIN is required to set up Face Unlock and Fingerprint Unlock.\n\nA PIN protects your phone if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_pin_skip_biometrics_message" product="default">A PIN is required to set up Face Unlock and Fingerprint Unlock.\n\nA PIN protects the phone if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up face or fingerprint. (default) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_pattern_skip_biometrics_message" product="default">A pattern is required to set up Face Unlock and Fingerprint Unlock.\n\nA pattern protects your phone if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_pattern_skip_biometrics_message" product="default">A pattern is required to set up Face Unlock and Fingerprint Unlock.\n\nA pattern protects the phone if it\u2019s lost or stolen.</string>
<!-- Dialog text shown when the user tries to skip setting up a screen lock, warning that they can't continue to set up face or fingerprint. (default) [CHAR LIMIT=NONE] -->
- <string name="lock_screen_password_skip_biometrics_message" product="default">A password is required to set up Face Unlock and Fingerprint Unlock.\n\nA password protects your phone if it\u2019s lost or stolen.</string>
+ <string name="lock_screen_password_skip_biometrics_message" product="default">A password is required to set up Face Unlock and Fingerprint Unlock.\n\nA password protects the phone if it\u2019s lost or stolen.</string>
<!-- Title of dialog shown when the user tries to skip setting up a PIN, warning them of potential consequences of not doing so [CHAR LIMIT=48]-->
<string name="lock_screen_pin_skip_title">Skip PIN setup?</string>
<!-- Title of dialog shown when the user tries to skip setting up a PIN, warning them of potential consequences of not doing so [CHAR LIMIT=90]-->
@@ -5403,8 +5403,8 @@
<string name="accessibility_button_intro">Using the accessibility button. The gesture isn\u2019t available with 3-button navigation.</string>
<!-- Summary text for the accessibility button preference. [CHAR LIMIT=50] -->
<string name="accessibility_button_summary">Quickly access accessibility features</string>
- <!-- Description for the accessibility button & gesture page. Explain how this page works. [CHAR LIMIT=NONE] -->
- <string name="accessibility_button_gesture_description">Quickly access accessibility features from any screen. \n\nTo get started, go to accessibility settings and select a feature. Tap on the shortcut and select the accessibility button or gesture.</string>
+ <!-- Description for the accessibility button in gesture navigation. Explain how this page works. [CHAR LIMIT=NONE] -->
+ <string name="accessibility_button_gesture_description">Quickly access accessibility features from any screen.\n\nTo get started, go to accessibility settings and select a feature. Tap on the shortcut and select the accessibility button.\n\nTo use the accessibility button in the navigation bar instead, switch to 2-button navigation or 3-button navigation.</string>
<!-- Description for the accessibility button page. Explain how this page works. [CHAR LIMIT=NONE] -->
<string name="accessibility_button_description">Quickly access accessibility features from any screen. \n\nTo get started, go to accessibility settings and select a feature. Tap on the shortcut and select the accessibility button.</string>
<!-- Title for the button or gesture of the accessibility button. [CHAR LIMIT=35] -->
@@ -6825,7 +6825,7 @@
<!-- Title of warning shown to the user before they can install a CA certificate [CHAR LIMIT=NONE] -->
<string name="ca_certificate_warning_title">Your data won\u2019t be private</string>
<!-- Description of warning shown to the user before they can install a CA certificate [CHAR LIMIT=NONE] -->
- <string name="ca_certificate_warning_description">CA certificates are used by websites, apps, and VPNs for encryption. Only install CA certificates from organizations you trust. \n\n If you install a CA certificate, the certificate owner could access your data, such as passwords or credit card details, from websites you visit or apps you use – even if your data is encrypted.</string>
+ <string name="ca_certificate_warning_description">CA certificates are used by websites, apps, and VPNs for encryption. Only install CA certificates from organizations you trust. \n\nIf you install a CA certificate, the certificate owner could access your data, such as passwords or credit card details, from websites you visit or apps you use – even if your data is encrypted.</string>
<!-- Label for button to not install a certificate [CHAR_LIMIT=50] -->
<string name="certificate_warning_dont_install">Don\u2019t install</string>
<!-- Label for button to continue installing a certificate [CHAR_LIMIT=50] -->
@@ -8204,7 +8204,7 @@
<string name="keywords_wifi_calling">wifi, wi-fi, call, calling</string>
<string name="keywords_display">screen, touchscreen</string>
<string name="keywords_display_brightness_level">dim screen, touchscreen, battery, bright</string>
- <string name="keywords_display_night_display">dim screen, night, tint, night shift, brightness, screen color, colour, color, light sensitivity, photophobia, make darker, darken, dark mode, migraine</string>
+ <string name="keywords_display_night_display">dim screen, night, tint, night shift, brightness, screen color, colour, color</string>
<string name="keywords_display_wallpaper">background, personalize, customize display</string>
<string name="keywords_display_font_size">text size</string>
<!-- Search keyword for "Cast" settings [CHAR_LIMIT=NONE]-->
@@ -8252,7 +8252,7 @@
<string name="keywords_model_and_hardware">serial number, hardware version</string>
<string name="keywords_android_version">android security patch level, baseband version, kernel version</string>
<!-- Search keywords for dark mode settings [CHAR LIMIT=NONE] -->
- <string name="keywords_dark_ui_mode">theme, light, dark, mode</string>
+ <string name="keywords_dark_ui_mode">theme, light, dark, mode, light sensitivity, photophobia, make darker, darken, dark mode, migraine</string>
<!-- Search keyword for Device Theme Settings [CHAR LIMIT=NONE] -->
<string name="keywords_systemui_theme">dark theme</string>
@@ -12353,6 +12353,15 @@
<!-- Title for preference showing the name of the device. [CHAR LIMIT=60]-->
<string name="my_device_info_device_name_preference_title">Device name</string>
+ <!-- Title for preference category showing the name of basic info. [CHAR LIMIT=60]-->
+ <string name="my_device_info_basic_info_category_title">Basic info</string>
+ <!-- Title for preference category showing the name of legal & regulatory. [CHAR LIMIT=60]-->
+ <string name="my_device_info_legal_category_title">Legal & regulatory</string>
+ <!-- Title for preference category showing the name of device details. [CHAR LIMIT=60]-->
+ <string name="my_device_info_device_details_category_title">Device details</string>
+ <!-- Title for preference category showing the name of device identifiers. [CHAR LIMIT=60]-->
+ <string name="my_device_info_device_identifiers_category_title">Device identifiers</string>
+
<!-- Title for Wifi Access settings [CHAR LIMIT=35] -->
<string name="change_wifi_state_title">Wi-Fi control</string>
diff --git a/res/xml/accessibility_button_settings.xml b/res/xml/accessibility_button_settings.xml
index 02b1c7d..78d13ab 100644
--- a/res/xml/accessibility_button_settings.xml
+++ b/res/xml/accessibility_button_settings.xml
@@ -61,7 +61,6 @@
<com.android.settings.accessibility.AccessibilityFooterPreference
android:key="accessibility_button_footer"
- android:title="@string/accessibility_button_description"
android:persistent="false"
android:selectable="false"
settings:searchable="false"
diff --git a/res/xml/my_device_info.xml b/res/xml/my_device_info.xml
index 5077f77..a415abf 100644
--- a/res/xml/my_device_info.xml
+++ b/res/xml/my_device_info.xml
@@ -28,173 +28,185 @@
android:selectable="false"
settings:isPreferenceVisible="false"/>
- <!-- Device name -->
- <com.android.settings.widget.ValidatedEditTextPreference
- android:key="device_name"
- android:order="1"
- android:title="@string/my_device_info_device_name_preference_title"
- android:summary="@string/summary_placeholder"
- settings:controller="com.android.settings.deviceinfo.DeviceNamePreferenceController"
- settings:enableCopying="true"/>
+ <PreferenceCategory
+ android:title="@string/my_device_info_basic_info_category_title">
- <!-- Account name -->
- <Preference
- android:key="branded_account"
- android:order="2"
- android:title="@string/my_device_info_account_preference_title"
- android:summary="@string/summary_placeholder"
- settings:enableCopying="true"
- settings:controller="com.android.settings.deviceinfo.BrandedAccountPreferenceController"/>
+ <!-- Device name -->
+ <com.android.settings.widget.ValidatedEditTextPreference
+ android:key="device_name"
+ android:order="1"
+ android:title="@string/my_device_info_device_name_preference_title"
+ android:summary="@string/summary_placeholder"
+ settings:controller="com.android.settings.deviceinfo.DeviceNamePreferenceController"
+ settings:enableCopying="true"/>
- <!-- Phone number -->
- <Preference
- android:key="phone_number"
- android:order="3"
- android:title="@string/status_number"
- android:summary="@string/summary_placeholder"
- android:selectable="false"
- settings:controller="com.android.settings.deviceinfo.PhoneNumberPreferenceController"
- settings:enableCopying="true"/>
+ <!-- Account name -->
+ <Preference
+ android:key="branded_account"
+ android:order="2"
+ android:title="@string/my_device_info_account_preference_title"
+ android:summary="@string/summary_placeholder"
+ settings:enableCopying="true"
+ settings:controller="com.android.settings.deviceinfo.BrandedAccountPreferenceController"/>
- <!-- Legal information -->
- <Preference
- android:key="legal_container"
- android:order="15"
- android:title="@string/legal_information"
- android:fragment="com.android.settings.LegalSettings"
- settings:allowDividerAbove="true"/>
+ <!-- Phone number -->
+ <Preference
+ android:key="phone_number"
+ android:order="3"
+ android:title="@string/status_number"
+ android:summary="@string/summary_placeholder"
+ android:selectable="false"
+ settings:controller="com.android.settings.deviceinfo.PhoneNumberPreferenceController"
+ settings:enableCopying="true"/>
+ </PreferenceCategory>
- <!-- Regulatory labels -->
- <Preference
- android:key="regulatory_info"
- android:order="16"
- android:title="@string/regulatory_labels">
- <intent android:action="android.settings.SHOW_REGULATORY_INFO"/>
- </Preference>
+ <PreferenceCategory
+ android:title="@string/my_device_info_legal_category_title">
- <!-- Safety & regulatory manual -->
- <Preference
- android:key="safety_info"
- android:order="17"
- android:title="@string/safety_and_regulatory_info">
- <intent android:action="android.settings.SHOW_SAFETY_AND_REGULATORY_INFO"/>
- </Preference>
+ <!-- Legal information -->
+ <Preference
+ android:key="legal_container"
+ android:order="15"
+ android:title="@string/legal_information"
+ android:fragment="com.android.settings.LegalSettings"/>
- <!-- SIM status -->
- <Preference
- android:key="sim_status"
- android:order="18"
- android:title="@string/sim_status_title"
- settings:keywords="@string/keywords_sim_status"
- android:summary="@string/summary_placeholder"
- settings:enableCopying="true"
- settings:allowDividerAbove="true"/>
+ <!-- Regulatory labels -->
+ <Preference
+ android:key="regulatory_info"
+ android:order="16"
+ android:title="@string/regulatory_labels">
+ <intent android:action="android.settings.SHOW_REGULATORY_INFO"/>
+ </Preference>
- <!-- Model & hardware -->
- <Preference
- android:key="device_model"
- android:order="31"
- android:title="@string/model_info"
- android:summary="@string/summary_placeholder"
- android:fragment="com.android.settings.deviceinfo.hardwareinfo.HardwareInfoFragment"
- settings:enableCopying="true"
- settings:keywords="@string/keywords_model_and_hardware"
- settings:controller="com.android.settings.deviceinfo.HardwareInfoPreferenceController"/>
+ <!-- Safety & regulatory manual -->
+ <Preference
+ android:key="safety_info"
+ android:order="17"
+ android:title="@string/safety_and_regulatory_info">
+ <intent android:action="android.settings.SHOW_SAFETY_AND_REGULATORY_INFO"/>
+ </Preference>
+ </PreferenceCategory>
- <!-- IMEI -->
- <Preference
- android:key="imei_info"
- android:order="32"
- android:title="@string/status_imei"
- android:summary="@string/summary_placeholder"
- settings:keywords="@string/keywords_imei_info"
- settings:enableCopying="true"
- settings:controller="com.android.settings.deviceinfo.imei.ImeiInfoPreferenceController"/>
+ <PreferenceCategory
+ android:title="@string/my_device_info_device_details_category_title">
- <!-- Android version -->
- <Preference
- android:key="firmware_version"
- android:order="42"
- android:title="@string/firmware_version"
- android:summary="@string/summary_placeholder"
- android:fragment="com.android.settings.deviceinfo.firmwareversion.FirmwareVersionSettings"
- settings:controller="com.android.settings.deviceinfo.firmwareversion.FirmwareVersionPreferenceController"/>
+ <!-- SIM status -->
+ <Preference
+ android:key="sim_status"
+ android:order="18"
+ android:title="@string/sim_status_title"
+ settings:keywords="@string/keywords_sim_status"
+ android:summary="@string/summary_placeholder"
+ settings:enableCopying="true"/>
- <!--IP address -->
- <Preference
- android:key="wifi_ip_address"
- android:order="44"
- android:title="@string/wifi_ip_address"
- android:summary="@string/summary_placeholder"
- android:selectable="false"
- settings:allowDividerAbove="true"
- settings:enableCopying="true"/>
+ <!-- Model & hardware -->
+ <Preference
+ android:key="device_model"
+ android:order="31"
+ android:title="@string/model_info"
+ android:summary="@string/summary_placeholder"
+ android:fragment="com.android.settings.deviceinfo.hardwareinfo.HardwareInfoFragment"
+ settings:enableCopying="true"
+ settings:keywords="@string/keywords_model_and_hardware"
+ settings:controller="com.android.settings.deviceinfo.HardwareInfoPreferenceController"/>
- <!-- Wi-Fi MAC address -->
- <Preference
- android:key="saved_accesspoints_wifi_mac_address"
- android:order="45"
- android:title="@string/status_wifi_mac_address"
- android:summary="@string/view_saved_network"
- android:fragment="com.android.settings.wifi.savedaccesspoints2.SavedAccessPointsWifiSettings2"
- settings:enableCopying="false"/>
+ <!-- IMEI -->
+ <Preference
+ android:key="imei_info"
+ android:order="32"
+ android:title="@string/status_imei"
+ android:summary="@string/summary_placeholder"
+ settings:keywords="@string/keywords_imei_info"
+ settings:enableCopying="true"
+ settings:controller="com.android.settings.deviceinfo.imei.ImeiInfoPreferenceController"/>
- <!-- Factory Wi-Fi MAC address -->
- <Preference
- android:key="wifi_mac_address"
- android:order="46"
- android:title="@string/status_device_wifi_mac_address"
- android:summary="@string/summary_placeholder"
- android:selectable="false"
- settings:enableCopying="true"/>
+ <!-- Android version -->
+ <Preference
+ android:key="firmware_version"
+ android:order="42"
+ android:title="@string/firmware_version"
+ android:summary="@string/summary_placeholder"
+ android:fragment="com.android.settings.deviceinfo.firmwareversion.FirmwareVersionSettings"
+ settings:controller="com.android.settings.deviceinfo.firmwareversion.FirmwareVersionPreferenceController"/>
+ </PreferenceCategory>
- <!-- Bluetooth address -->
- <Preference
- android:key="bt_address"
- android:order="47"
- android:title="@string/status_bt_address"
- android:summary="@string/summary_placeholder"
- android:selectable="false"
- settings:enableCopying="true"/>
+ <PreferenceCategory
+ android:title="@string/my_device_info_device_identifiers_category_title">
- <!-- Device up time -->
- <Preference
- android:key="up_time"
- android:order="48"
- android:title="@string/status_up_time"
- android:summary="@string/summary_placeholder"
- android:selectable="false"/>
+ <!--IP address -->
+ <Preference
+ android:key="wifi_ip_address"
+ android:order="44"
+ android:title="@string/wifi_ip_address"
+ android:summary="@string/summary_placeholder"
+ android:selectable="false"
+ settings:enableCopying="true"/>
- <!-- Manual -->
- <Preference
- android:key="manual"
- android:order="50"
- android:title="@string/manual">
- <intent android:action="android.settings.SHOW_MANUAL"/>
- </Preference>
+ <!-- Wi-Fi MAC address -->
+ <Preference
+ android:key="saved_accesspoints_wifi_mac_address"
+ android:order="45"
+ android:title="@string/status_wifi_mac_address"
+ android:summary="@string/view_saved_network"
+ android:fragment="com.android.settings.wifi.savedaccesspoints2.SavedAccessPointsWifiSettings2"
+ settings:enableCopying="false"/>
- <!-- Feedback on the device -->
- <Preference
- android:key="device_feedback"
- android:order="51"
- android:title="@string/device_feedback"
- settings:keywords="@string/keywords_device_feedback"/>
+ <!-- Factory Wi-Fi MAC address -->
+ <Preference
+ android:key="wifi_mac_address"
+ android:order="46"
+ android:title="@string/status_device_wifi_mac_address"
+ android:summary="@string/summary_placeholder"
+ android:selectable="false"
+ settings:enableCopying="true"/>
- <!-- Device FCC equipment id -->
- <Preference
- android:key="fcc_equipment_id"
- android:order="52"
- android:title="@string/fcc_equipment_id"
- android:summary="@string/summary_placeholder"/>
+ <!-- Bluetooth address -->
+ <Preference
+ android:key="bt_address"
+ android:order="47"
+ android:title="@string/status_bt_address"
+ android:summary="@string/summary_placeholder"
+ android:selectable="false"
+ settings:enableCopying="true"/>
- <!-- Build number -->
- <Preference
- android:key="build_number"
- android:order="53"
- android:title="@string/build_number"
- android:summary="@string/summary_placeholder"
- settings:allowDividerAbove="true"
- settings:enableCopying="true"
- settings:controller="com.android.settings.deviceinfo.BuildNumberPreferenceController"/>
+ <!-- Device up time -->
+ <Preference
+ android:key="up_time"
+ android:order="48"
+ android:title="@string/status_up_time"
+ android:summary="@string/summary_placeholder"
+ android:selectable="false"/>
+
+ <!-- Manual -->
+ <Preference
+ android:key="manual"
+ android:order="50"
+ android:title="@string/manual">
+ <intent android:action="android.settings.SHOW_MANUAL"/>
+ </Preference>
+
+ <!-- Feedback on the device -->
+ <Preference
+ android:key="device_feedback"
+ android:order="51"
+ android:title="@string/device_feedback"
+ settings:keywords="@string/keywords_device_feedback"/>
+
+ <!-- Device FCC equipment id -->
+ <Preference
+ android:key="fcc_equipment_id"
+ android:order="52"
+ android:title="@string/fcc_equipment_id"
+ android:summary="@string/summary_placeholder"/>
+
+ <!-- Build number -->
+ <Preference
+ android:key="build_number"
+ android:order="53"
+ android:title="@string/build_number"
+ android:summary="@string/summary_placeholder"
+ settings:enableCopying="true"
+ settings:controller="com.android.settings.deviceinfo.BuildNumberPreferenceController"/>
+ </PreferenceCategory>
</PreferenceScreen>
diff --git a/src/com/android/settings/accessibility/AccessibilityButtonFooterPreferenceController.java b/src/com/android/settings/accessibility/AccessibilityButtonFooterPreferenceController.java
index 744a292..8b4a364 100644
--- a/src/com/android/settings/accessibility/AccessibilityButtonFooterPreferenceController.java
+++ b/src/com/android/settings/accessibility/AccessibilityButtonFooterPreferenceController.java
@@ -34,4 +34,11 @@
protected String getLabelName() {
return mContext.getString(R.string.accessibility_button_title);
}
+
+ @Override
+ public CharSequence getSummary() {
+ return AccessibilityUtil.isGestureNavigateEnabled(mContext)
+ ? mContext.getString(R.string.accessibility_button_gesture_description)
+ : mContext.getString(R.string.accessibility_button_description);
+ }
}
diff --git a/src/com/android/settings/applications/AppStorageSettings.java b/src/com/android/settings/applications/AppStorageSettings.java
index d095e37..91eeace 100644
--- a/src/com/android/settings/applications/AppStorageSettings.java
+++ b/src/com/android/settings/applications/AppStorageSettings.java
@@ -368,7 +368,12 @@
}
ActivityManager am = (ActivityManager)
getActivity().getSystemService(Context.ACTIVITY_SERVICE);
- boolean res = am.clearApplicationUserData(packageName, mClearDataObserver);
+ boolean res = false;
+ try {
+ res = am.clearApplicationUserData(packageName, mClearDataObserver);
+ } catch (SecurityException e) {
+ Log.i(TAG, "Failed to clear application user data: " + e);
+ }
if (!res) {
// Clearing data failed for some obscure reason. Just log error for now
Log.i(TAG, "Couldn't clear application user data for package:" + packageName);
diff --git a/src/com/android/settings/applications/RunningServices.java b/src/com/android/settings/applications/RunningServices.java
index b1689d5..4d13241 100644
--- a/src/com/android/settings/applications/RunningServices.java
+++ b/src/com/android/settings/applications/RunningServices.java
@@ -72,11 +72,7 @@
public void onResume() {
super.onResume();
boolean haveData = mRunningProcessesView.doResume(this, mRunningProcessesAvail);
- if (haveData) {
- mLoadingViewController.showContent(false /* animate */);
- } else {
- mLoadingViewController.showLoadingView();
- }
+ mLoadingViewController.handleLoadingContainer(haveData /* done */, false /* animate */);
}
@Override
diff --git a/src/com/android/settings/applications/manageapplications/ManageApplications.java b/src/com/android/settings/applications/manageapplications/ManageApplications.java
index 43e929b..6d67524 100644
--- a/src/com/android/settings/applications/manageapplications/ManageApplications.java
+++ b/src/com/android/settings/applications/manageapplications/ManageApplications.java
@@ -208,6 +208,7 @@
private ApplicationsAdapter mApplications;
private View mLoadingContainer;
+ private View mListContainer;
private SearchView mSearchView;
// Size resource used for packages whose size computation failed for some reason
@@ -401,21 +402,25 @@
mRootView = inflater.inflate(R.layout.manage_applications_apps, null);
mLoadingContainer = mRootView.findViewById(R.id.loading_container);
- mEmptyView = mRootView.findViewById(android.R.id.empty);
- mRecyclerView = mRootView.findViewById(R.id.apps_list);
+ mListContainer = mRootView.findViewById(R.id.list_container);
+ if (mListContainer != null) {
+ // Create adapter and list view here
+ mEmptyView = mListContainer.findViewById(android.R.id.empty);
- mApplications = new ApplicationsAdapter(mApplicationsState, this, mFilter,
- savedInstanceState);
- if (savedInstanceState != null) {
- mApplications.mHasReceivedLoadEntries =
- savedInstanceState.getBoolean(EXTRA_HAS_ENTRIES, false);
- mApplications.mHasReceivedBridgeCallback =
- savedInstanceState.getBoolean(EXTRA_HAS_BRIDGE, false);
+ mApplications = new ApplicationsAdapter(mApplicationsState, this, mFilter,
+ savedInstanceState);
+ if (savedInstanceState != null) {
+ mApplications.mHasReceivedLoadEntries =
+ savedInstanceState.getBoolean(EXTRA_HAS_ENTRIES, false);
+ mApplications.mHasReceivedBridgeCallback =
+ savedInstanceState.getBoolean(EXTRA_HAS_BRIDGE, false);
+ }
+ mRecyclerView = mListContainer.findViewById(R.id.apps_list);
+ mRecyclerView.setItemAnimator(null);
+ mRecyclerView.setLayoutManager(new LinearLayoutManager(
+ getContext(), RecyclerView.VERTICAL, false /* reverseLayout */));
+ mRecyclerView.setAdapter(mApplications);
}
- mRecyclerView.setItemAnimator(null);
- mRecyclerView.setLayoutManager(new LinearLayoutManager(
- getContext(), RecyclerView.VERTICAL, false /* reverseLayout */));
- mRecyclerView.setAdapter(mApplications);
// We have to do this now because PreferenceFrameLayout looks at it
// only when the view is added.
@@ -980,8 +985,16 @@
// overlapped by floating filter.
if (hasFilter) {
mManageApplications.mSpinnerHeader.setVisibility(View.VISIBLE);
+ mManageApplications.mRecyclerView.setPadding(0 /* left */,
+ mContext.getResources().getDimensionPixelSize(
+ R.dimen.app_bar_height) /* top */,
+ 0 /* right */,
+ 0 /* bottom */);
} else {
mManageApplications.mSpinnerHeader.setVisibility(View.GONE);
+ mManageApplications.mRecyclerView.setPadding(0 /* left */, 0 /* top */,
+ 0 /* right */,
+ 0 /* bottom */);
}
}
}
@@ -1031,8 +1044,7 @@
mManageApplications = manageApplications;
mLoadingViewController = new LoadingViewController(
mManageApplications.mLoadingContainer,
- mManageApplications.mRecyclerView,
- mManageApplications.mEmptyView
+ mManageApplications.mListContainer
);
mContext = manageApplications.getActivity();
mIconDrawableFactory = IconDrawableFactory.newInstance(mContext);
@@ -1291,9 +1303,11 @@
mOriginalEntries = entries;
notifyDataSetChanged();
if (getItemCount() == 0) {
- mLoadingViewController.showEmpty(false /* animate */);
+ mManageApplications.mRecyclerView.setVisibility(View.GONE);
+ mManageApplications.mEmptyView.setVisibility(View.VISIBLE);
} else {
- mLoadingViewController.showContent(false /* animate */);
+ mManageApplications.mEmptyView.setVisibility(View.GONE);
+ mManageApplications.mRecyclerView.setVisibility(View.VISIBLE);
if (mManageApplications.mSearchView != null
&& mManageApplications.mSearchView.isVisibleToUser()) {
@@ -1310,6 +1324,10 @@
mLastIndex = -1;
}
+ if (mSession.getAllApps().size() != 0
+ && mManageApplications.mListContainer.getVisibility() != View.VISIBLE) {
+ mLoadingViewController.showContent(true /* animate */);
+ }
if (mManageApplications.mListType == LIST_TYPE_USAGE_ACCESS) {
// No enabled or disabled filters for usage access.
return;
diff --git a/src/com/android/settings/biometrics/face/FaceEnrollEducation.java b/src/com/android/settings/biometrics/face/FaceEnrollEducation.java
index 8e2d3f4..65ab2e7 100644
--- a/src/com/android/settings/biometrics/face/FaceEnrollEducation.java
+++ b/src/com/android/settings/biometrics/face/FaceEnrollEducation.java
@@ -16,20 +16,17 @@
package com.android.settings.biometrics.face;
-import android.annotation.StringRes;
import android.app.settings.SettingsEnums;
import android.content.ComponentName;
import android.content.Intent;
import android.hardware.face.FaceManager;
import android.os.Bundle;
-import android.os.Handler;
import android.os.UserHandle;
import android.text.TextUtils;
import android.view.View;
import android.view.accessibility.AccessibilityManager;
import android.widget.Button;
import android.widget.CompoundButton;
-import android.widget.TextView;
import com.android.settings.R;
import com.android.settings.Utils;
@@ -41,14 +38,10 @@
import com.google.android.setupcompat.template.FooterBarMixin;
import com.google.android.setupcompat.template.FooterButton;
import com.google.android.setupcompat.util.WizardManagerHelper;
-import com.google.android.setupdesign.GlifLayout;
import com.google.android.setupdesign.view.IllustrationVideoView;
public class FaceEnrollEducation extends BiometricEnrollBase {
-
private static final String TAG = "FaceEducation";
- private static final int ON = 1;
- private static final int OFF = 0;
private FaceManager mFaceManager;
private FaceEnrollAccessibilityToggle mSwitchDiversity;
@@ -57,28 +50,18 @@
private IllustrationVideoView mIllustrationDefault;
private LottieAnimationView mIllustrationLottie;
private View mIllustrationAccessibility;
- private Handler mHandler;
private Intent mResultIntent;
- private TextView mDescriptionText;
private boolean mNextClicked;
private boolean mAccessibilityEnabled;
- private CompoundButton.OnCheckedChangeListener mSwitchDiversityListener =
+ private final CompoundButton.OnCheckedChangeListener mSwitchDiversityListener =
new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
- final int headerRes;
- final int descriptionRes;
- if (isChecked) {
- headerRes = R.string
- .security_settings_face_enroll_education_title_accessibility;
- descriptionRes = R.string
- .security_settings_face_enroll_education_message_accessibility;
- } else {
- headerRes = R.string.security_settings_face_enroll_education_title;
- descriptionRes = R.string.security_settings_face_enroll_education_message;
- }
- updateHeaders(headerRes, descriptionRes);
+ final int descriptionRes = isChecked
+ ? R.string.security_settings_face_enroll_education_message_accessibility
+ : R.string.security_settings_face_enroll_education_message;
+ setDescriptionText(descriptionRes);
if (isChecked) {
hideDefaultIllustration();
@@ -95,18 +78,14 @@
super.onCreate(savedInstanceState);
setContentView(R.layout.face_enroll_education);
- final int headerRes = R.string.security_settings_face_enroll_education_title;
- final int descriptionRes = R.string.security_settings_face_enroll_education_message;
- updateHeaders(headerRes, descriptionRes);
-
- mHandler = new Handler();
+ setTitle(R.string.security_settings_face_enroll_education_title);
+ setDescriptionText(R.string.security_settings_face_enroll_education_message);
mFaceManager = Utils.getFaceManagerOrNull(this);
mIllustrationDefault = findViewById(R.id.illustration_default);
mIllustrationLottie = findViewById(R.id.illustration_lottie);
mIllustrationAccessibility = findViewById(R.id.illustration_accessibility);
- mDescriptionText = findViewById(R.id.sud_layout_description);
mIsUsingLottie = getResources().getBoolean(R.bool.config_face_education_use_lottie);
if (mIsUsingLottie) {
@@ -259,15 +238,6 @@
return SettingsEnums.FACE_ENROLL_INTRO;
}
- private void updateHeaders(@StringRes int headerRes, @StringRes int descriptionRes) {
- final CharSequence headerText = getText(headerRes);
- setTitle(headerText);
-
- final GlifLayout layout = getLayout();
- layout.setHeaderText(headerText);
- layout.setDescriptionText(descriptionRes);
- }
-
private void hideDefaultIllustration() {
if (mIsUsingLottie) {
mIllustrationLottie.cancelAnimation();
diff --git a/src/com/android/settings/bluetooth/BluetoothPermissionActivity.java b/src/com/android/settings/bluetooth/BluetoothPermissionActivity.java
index 211bcc6..c8f71c4 100644
--- a/src/com/android/settings/bluetooth/BluetoothPermissionActivity.java
+++ b/src/com/android/settings/bluetooth/BluetoothPermissionActivity.java
@@ -221,7 +221,7 @@
intent.putExtra(BluetoothDevice.EXTRA_ALWAYS_ALLOWED, always);
intent.putExtra(BluetoothDevice.EXTRA_DEVICE, mDevice);
intent.putExtra(BluetoothDevice.EXTRA_ACCESS_REQUEST_TYPE, mRequestType);
- sendBroadcast(intent, android.Manifest.permission.BLUETOOTH_ADMIN);
+ sendBroadcast(intent, android.Manifest.permission.BLUETOOTH_CONNECT);
}
public void onClick(DialogInterface dialog, int which) {
diff --git a/src/com/android/settings/bluetooth/BluetoothPermissionRequest.java b/src/com/android/settings/bluetooth/BluetoothPermissionRequest.java
index ff1c147..bd33261 100644
--- a/src/com/android/settings/bluetooth/BluetoothPermissionRequest.java
+++ b/src/com/android/settings/bluetooth/BluetoothPermissionRequest.java
@@ -293,6 +293,6 @@
: BluetoothDevice.CONNECTION_ACCESS_NO);
intent.putExtra(BluetoothDevice.EXTRA_DEVICE, mDevice);
intent.putExtra(BluetoothDevice.EXTRA_ACCESS_REQUEST_TYPE, mRequestType);
- mContext.sendBroadcast(intent, android.Manifest.permission.BLUETOOTH_ADMIN);
+ mContext.sendBroadcast(intent, android.Manifest.permission.BLUETOOTH_CONNECT);
}
}
diff --git a/src/com/android/settings/bluetooth/DevicePickerFragment.java b/src/com/android/settings/bluetooth/DevicePickerFragment.java
index 02b5d5c..602b79b 100644
--- a/src/com/android/settings/bluetooth/DevicePickerFragment.java
+++ b/src/com/android/settings/bluetooth/DevicePickerFragment.java
@@ -212,6 +212,6 @@
}
}
- mContext.sendBroadcast(intent, Manifest.permission.BLUETOOTH_ADMIN);
+ mContext.sendBroadcast(intent, Manifest.permission.BLUETOOTH_CONNECT);
}
}
diff --git a/src/com/android/settings/core/SettingsBaseActivity.java b/src/com/android/settings/core/SettingsBaseActivity.java
index fb6b49f..fd6ca50 100644
--- a/src/com/android/settings/core/SettingsBaseActivity.java
+++ b/src/com/android/settings/core/SettingsBaseActivity.java
@@ -48,7 +48,8 @@
import com.google.android.setupdesign.util.ThemeHelper;
/** Base activity for Settings pages */
-public class SettingsBaseActivity extends FragmentActivity implements CategoryHandler {
+public class SettingsBaseActivity extends FragmentActivity implements CategoryHandler,
+ AppBarLayout.OnOffsetChangedListener {
/**
* What type of page transition should be apply.
@@ -58,11 +59,15 @@
protected static final boolean DEBUG_TIMING = false;
private static final String TAG = "SettingsBaseActivity";
private static final int DEFAULT_REQUEST = -1;
+ private static final int FULLY_EXPANDED_OFFSET = 0;
+ private static final int TOOLBAR_MAX_LINE_NUMBER = 2;
+ private static final String KEY_IS_TOOLBAR_COLLAPSED = "is_toolbar_collapsed";
protected CategoryMixin mCategoryMixin;
protected CollapsingToolbarLayout mCollapsingToolbarLayout;
protected AppBarLayout mAppBarLayout;
private Toolbar mToolbar;
+ private boolean mIsToolbarCollapsed;
@Override
public CategoryMixin getCategoryMixin() {
@@ -100,6 +105,11 @@
super.setContentView(R.layout.collapsing_toolbar_base_layout);
mCollapsingToolbarLayout = findViewById(R.id.collapsing_toolbar);
mAppBarLayout = findViewById(R.id.app_bar);
+ mAppBarLayout.addOnOffsetChangedListener(this);
+ if (savedInstanceState != null) {
+ mIsToolbarCollapsed = savedInstanceState.getBoolean(KEY_IS_TOOLBAR_COLLAPSED);
+ }
+ initCollapsingToolbar();
disableCollapsingToolbarLayoutScrollingBehavior();
} else {
super.setContentView(R.layout.settings_base_layout);
@@ -191,6 +201,23 @@
}
}
+ @Override
+ public void onOffsetChanged(AppBarLayout appBarLayout, int offset) {
+ if (offset == FULLY_EXPANDED_OFFSET) {
+ mIsToolbarCollapsed = false;
+ } else {
+ mIsToolbarCollapsed = true;
+ }
+ }
+
+ @Override
+ protected void onSaveInstanceState(@NonNull Bundle outState) {
+ super.onSaveInstanceState(outState);
+ if (isChangingConfigurations()) {
+ outState.putBoolean(KEY_IS_TOOLBAR_COLLAPSED, mIsToolbarCollapsed);
+ }
+ }
+
/**
* SubSetting page should show a toolbar by default. If the page wouldn't show a toolbar,
* override this method and return false value.
@@ -238,6 +265,9 @@
}
private void disableCollapsingToolbarLayoutScrollingBehavior() {
+ if (mAppBarLayout == null) {
+ return;
+ }
final CoordinatorLayout.LayoutParams params =
(CoordinatorLayout.LayoutParams) mAppBarLayout.getLayoutParams();
final AppBarLayout.Behavior behavior = new AppBarLayout.Behavior();
@@ -254,4 +284,39 @@
private int getTransitionType(Intent intent) {
return intent.getIntExtra(EXTRA_PAGE_TRANSITION_TYPE, TransitionType.TRANSITION_NONE);
}
+
+ @SuppressWarnings("RestrictTo")
+ private void initCollapsingToolbar() {
+ if (mCollapsingToolbarLayout == null || mAppBarLayout == null) {
+ return;
+ }
+ mCollapsingToolbarLayout.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
+ @Override
+ public void onLayoutChange(View v, int left, int top, int right, int bottom,
+ int oldLeft, int oldTop, int oldRight, int oldBottom) {
+ v.removeOnLayoutChangeListener(this);
+ if (mIsToolbarCollapsed) {
+ return;
+ }
+ final int count = mCollapsingToolbarLayout.getLineCount();
+ if (count > TOOLBAR_MAX_LINE_NUMBER) {
+ final ViewGroup.LayoutParams lp = mCollapsingToolbarLayout.getLayoutParams();
+ lp.height = getResources()
+ .getDimensionPixelSize(R.dimen.toolbar_three_lines_height);
+ mCollapsingToolbarLayout.setScrimVisibleHeightTrigger(
+ getResources().getDimensionPixelSize(
+ R.dimen.scrim_visible_height_trigger_three_lines));
+ mCollapsingToolbarLayout.setLayoutParams(lp);
+ } else if (count == TOOLBAR_MAX_LINE_NUMBER) {
+ final ViewGroup.LayoutParams lp = mCollapsingToolbarLayout.getLayoutParams();
+ lp.height = getResources()
+ .getDimensionPixelSize(R.dimen.toolbar_two_lines_height);
+ mCollapsingToolbarLayout.setScrimVisibleHeightTrigger(
+ getResources().getDimensionPixelSize(
+ R.dimen.scrim_visible_height_trigger_two_lines));
+ mCollapsingToolbarLayout.setLayoutParams(lp);
+ }
+ }
+ });
+ }
}
diff --git a/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogController.java b/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogController.java
index 1e25179..95f74fa 100644
--- a/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogController.java
+++ b/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogController.java
@@ -38,7 +38,6 @@
import android.telephony.CellBroadcastService;
import android.telephony.CellSignalStrength;
import android.telephony.ICellBroadcastService;
-import android.telephony.PhoneStateListener;
import android.telephony.ServiceState;
import android.telephony.SignalStrength;
import android.telephony.SubscriptionInfo;
@@ -245,6 +244,8 @@
private void updateSubscriptionStatus() {
updateNetworkProvider();
+ // getServiceState() may return null when the subscription is inactive
+ // or when there was an error communicating with the phone process.
final ServiceState serviceState = mTelephonyManager.getServiceState();
final SignalStrength signalStrength = mTelephonyManager.getSignalStrength();
@@ -577,7 +578,10 @@
}
private void updateRoamingStatus(ServiceState serviceState) {
- if (serviceState.getRoaming()) {
+ // If the serviceState is null, we assume that roaming is disabled.
+ if (serviceState == null) {
+ mDialog.setText(ROAMING_INFO_VALUE_ID, mRes.getString(R.string.radioInfo_unknown));
+ } else if (serviceState.getRoaming()) {
mDialog.setText(ROAMING_INFO_VALUE_ID, mRes.getString(R.string.radioInfo_roaming_in));
} else {
mDialog.setText(ROAMING_INFO_VALUE_ID, mRes.getString(R.string.radioInfo_roaming_not));
diff --git a/src/com/android/settings/fuelgauge/BatteryInfo.java b/src/com/android/settings/fuelgauge/BatteryInfo.java
index f1b1932..92151c0 100644
--- a/src/com/android/settings/fuelgauge/BatteryInfo.java
+++ b/src/com/android/settings/fuelgauge/BatteryInfo.java
@@ -204,7 +204,7 @@
}
final long prediction = discharging ? batteryUsageStats.getBatteryTimeRemainingMs() : 0;
final Estimate estimate = new Estimate(
- PowerUtil.convertUsToMs(prediction),
+ prediction,
false, /* isBasedOnUsage */
EstimateKt.AVERAGE_TIME_TO_DISCHARGE_UNKNOWN);
BatteryUtils.logRuntime(LOG_TAG, "time for regular BatteryInfo", startTime);
diff --git a/src/com/android/settings/network/AirplaneModePreferenceController.java b/src/com/android/settings/network/AirplaneModePreferenceController.java
index 122b975..6839037 100644
--- a/src/com/android/settings/network/AirplaneModePreferenceController.java
+++ b/src/com/android/settings/network/AirplaneModePreferenceController.java
@@ -35,11 +35,12 @@
import com.android.settings.R;
import com.android.settings.core.TogglePreferenceController;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
+import com.android.settingslib.core.lifecycle.events.OnDestroy;
import com.android.settingslib.core.lifecycle.events.OnStart;
import com.android.settingslib.core.lifecycle.events.OnStop;
public class AirplaneModePreferenceController extends TogglePreferenceController
- implements LifecycleObserver, OnStart, OnStop,
+ implements LifecycleObserver, OnStart, OnStop, OnDestroy,
AirplaneModeEnabler.OnAirplaneModeChangedListener {
public static final int REQUEST_CODE_EXIT_ECM = 1;
@@ -133,6 +134,12 @@
}
}
+ @Override
+ public void onDestroy() {
+ mAirplaneModeEnabler.close();
+ }
+
+
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_CODE_EXIT_ECM) {
final boolean isChoiceYes = data.getBooleanExtra(EXIT_ECM_RESULT, false);
diff --git a/src/com/android/settings/network/InternetUpdater.java b/src/com/android/settings/network/InternetUpdater.java
index cb8d32c..3d97e95 100644
--- a/src/com/android/settings/network/InternetUpdater.java
+++ b/src/com/android/settings/network/InternetUpdater.java
@@ -33,6 +33,7 @@
import android.net.ConnectivityManager.NetworkCallback;
import android.net.Network;
import android.net.NetworkCapabilities;
+import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.util.Log;
@@ -249,6 +250,9 @@
@InternetType int internetType = INTERNET_NETWORKS_AVAILABLE;
if (mInternetAvailable) {
internetType = sTransportMap.get(mTransport);
+ if (internetType == INTERNET_WIFI && isCarrierWifiActive()) {
+ internetType = INTERNET_CELLULAR;
+ }
} else if (mAirplaneModeEnabler.isAirplaneModeOn()
&& mWifiManager.getWifiState() != WifiManager.WIFI_STATE_ENABLED) {
internetType = INTERNET_OFF;
@@ -260,6 +264,15 @@
}
}
+ protected boolean isCarrierWifiActive() {
+ final WifiInfo wifiInfo = mWifiManager.getConnectionInfo();
+ if (wifiInfo == null || !wifiInfo.isCarrierMerged()) {
+ return false;
+ }
+ Log.i(TAG, "Detect a merged carrier Wi-Fi connected.");
+ return true;
+ }
+
/**
* Get the internet type.
*/
diff --git a/src/com/android/settings/network/NetworkProviderSettings.java b/src/com/android/settings/network/NetworkProviderSettings.java
index 25cf4ce..88e732a 100644
--- a/src/com/android/settings/network/NetworkProviderSettings.java
+++ b/src/com/android/settings/network/NetworkProviderSettings.java
@@ -116,6 +116,7 @@
static final int MENU_ID_FORGET = Menu.FIRST + 3;
static final int MENU_ID_MODIFY = Menu.FIRST + 4;
static final int MENU_FIX_CONNECTIVITY = Menu.FIRST + 5;
+ static final int MENU_ID_SHARE = Menu.FIRST + 6;
@VisibleForTesting
static final int ADD_NETWORK_REQUEST = 2;
@@ -200,7 +201,7 @@
* ensure that behavior is consistent if {@link #isUiRestricted()} changes. It could be changed
* by the Test DPC tool in AFW mode.
*/
- private boolean mIsRestricted;
+ protected boolean mIsRestricted;
@VisibleForTesting
AirplaneModeEnabler mAirplaneModeEnabler;
@@ -218,7 +219,8 @@
PreferenceCategory mConnectedWifiEntryPreferenceCategory;
@VisibleForTesting
PreferenceCategory mFirstWifiEntryPreferenceCategory;
- private PreferenceCategory mWifiEntryPreferenceCategory;
+ @VisibleForTesting
+ PreferenceCategory mWifiEntryPreferenceCategory;
@VisibleForTesting
AddWifiNetworkPreference mAddWifiNetworkPreference;
private WifiSwitchPreferenceController mWifiSwitchPreferenceController;
@@ -459,6 +461,12 @@
}
@Override
+ public void onDestroy() {
+ mAirplaneModeEnabler.close();
+ super.onDestroy();
+ }
+
+ @Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
@@ -535,7 +543,8 @@
}
if (mSelectedWifiEntry.canDisconnect()) {
- menu.add(Menu.NONE, MENU_ID_DISCONNECT, 0 /* order */,
+ menu.add(Menu.NONE, MENU_ID_SHARE, 0 /* order */, R.string.share);
+ menu.add(Menu.NONE, MENU_ID_DISCONNECT, 1 /* order */,
R.string.wifi_disconnect_button_text);
}
@@ -574,6 +583,10 @@
case MENU_ID_FORGET:
forget(mSelectedWifiEntry);
return true;
+ case MENU_ID_SHARE:
+ WifiDppUtils.showLockScreen(getContext(),
+ () -> launchWifiDppConfiguratorActivity(mSelectedWifiEntry));
+ return true;
case MENU_ID_MODIFY:
showDialog(mSelectedWifiEntry, WifiConfigUiBase2.MODE_MODIFY);
return true;
@@ -608,6 +621,23 @@
return true;
}
+ private void launchWifiDppConfiguratorActivity(WifiEntry wifiEntry) {
+ final Intent intent = WifiDppUtils.getConfiguratorQrCodeGeneratorIntentOrNull(getContext(),
+ mWifiManager, wifiEntry);
+
+ if (intent == null) {
+ Log.e(TAG, "Launch Wi-Fi DPP QR code generator with a wrong Wi-Fi network!");
+ } else {
+ mMetricsFeatureProvider.action(SettingsEnums.PAGE_UNKNOWN,
+ SettingsEnums.ACTION_SETTINGS_SHARE_WIFI_QR_CODE,
+ SettingsEnums.SETTINGS_WIFI_DPP_CONFIGURATOR,
+ /* key */ null,
+ /* value */ Integer.MIN_VALUE);
+
+ startActivity(intent);
+ }
+ }
+
private void showDialog(WifiEntry wifiEntry, int dialogMode) {
if (WifiUtils.isNetworkLockedDown(getActivity(), wifiEntry.getWifiConfiguration())
&& wifiEntry.getConnectedState() == WifiEntry.CONNECTED_STATE_CONNECTED) {
@@ -771,7 +801,11 @@
}
}
- private void updateWifiEntryPreferences() {
+ protected void updateWifiEntryPreferences() {
+ // bypass the update if the activity and the view are not ready, or it's restricted UI.
+ if (getActivity() == null || getView() == null || mIsRestricted) {
+ return;
+ }
// in case state has changed
if (mWifiPickerTracker.getWifiState() != WifiManager.WIFI_STATE_ENABLED) {
return;
diff --git a/src/com/android/settings/network/ProviderModelSlice.java b/src/com/android/settings/network/ProviderModelSlice.java
index aafe715..df705cd 100644
--- a/src/com/android/settings/network/ProviderModelSlice.java
+++ b/src/com/android/settings/network/ProviderModelSlice.java
@@ -16,10 +16,10 @@
package com.android.settings.network;
-
import static android.app.slice.Slice.EXTRA_TOGGLE_STATE;
import static com.android.settings.slices.CustomSliceRegistry.PROVIDER_MODEL_SLICE_URI;
+import static com.android.settings.slices.CustomSliceRegistry.WIFI_SLICE_URI;
import android.annotation.ColorInt;
import android.app.AlertDialog;
@@ -96,78 +96,77 @@
@Override
public Slice getSlice() {
// The provider model slice step:
- // First section: Add a Wi-Fi item which state is connected.
- // Second section: Add a carrier item.
- // Third section: Add the Wi-Fi items which are not connected.
- // Fourth section: If device has connection problem, this row show the message for user.
- @InternetUpdater.InternetType int internetType = getInternetType();
+ // First section: Add the Ethernet item.
+ // Second section: Add the carrier item.
+ // Third section: Add the Wi-Fi toggle item.
+ // Fourth section: Add the connected Wi-Fi item.
+ // Fifth section: Add the Wi-Fi items which are not connected.
+ // Sixth section: Add the See All item.
final ListBuilder listBuilder = mHelper.createListBuilder(getUri());
- if (mHelper.isAirplaneModeEnabled() && !mWifiManager.isWifiEnabled()
- && internetType != InternetUpdater.INTERNET_ETHERNET) {
- log("Airplane mode is enabled.");
- return listBuilder.build();
- }
-
int maxListSize = 0;
- List<WifiSliceItem> wifiList = null;
final NetworkProviderWorker worker = getWorker();
if (worker != null) {
- // get Wi-Fi list.
- wifiList = worker.getResults();
maxListSize = worker.getApRowCount();
} else {
log("network provider worker is null.");
}
- final boolean hasCarrier = mHelper.hasCarrier();
- log("hasCarrier: " + hasCarrier);
-
- // First section: Add a Ethernet or Wi-Fi item which state is connected.
- boolean isConnectedWifiAddedTop = false;
- final WifiSliceItem connectedWifiItem = mHelper.getConnectedWifiItem(wifiList);
- if (internetType == InternetUpdater.INTERNET_ETHERNET) {
+ // First section: Add the Ethernet item.
+ if (getInternetType() == InternetUpdater.INTERNET_ETHERNET) {
log("get Ethernet item which is connected");
listBuilder.addRow(createEthernetRow());
maxListSize--;
- } else {
- if (connectedWifiItem != null && internetType == InternetUpdater.INTERNET_WIFI) {
- log("get Wi-Fi item which is connected to internet");
- listBuilder.addRow(getWifiSliceItemRow(connectedWifiItem));
- isConnectedWifiAddedTop = true;
+ }
+
+ // Second section: Add the carrier item.
+ if (!mHelper.isAirplaneModeEnabled()) {
+ final boolean hasCarrier = mHelper.hasCarrier();
+ log("hasCarrier: " + hasCarrier);
+ if (hasCarrier) {
+ mHelper.updateTelephony();
+ listBuilder.addRow(
+ mHelper.createCarrierRow(
+ worker != null ? worker.getNetworkTypeDescription() : ""));
maxListSize--;
}
}
- // Second section: Add a carrier item.
- if (hasCarrier) {
- mHelper.updateTelephony();
- listBuilder.addRow(
- mHelper.createCarrierRow(
- worker != null ? worker.getNetworkTypeDescription() : ""));
- maxListSize--;
+ // Third section: Add the Wi-Fi toggle item.
+ final boolean isWifiEnabled = mWifiManager.isWifiEnabled();
+ listBuilder.addRow(createWifiToggleRow(mContext, isWifiEnabled));
+ maxListSize--;
+ if (!isWifiEnabled) {
+ log("Wi-Fi is disabled");
+ return listBuilder.build();
+ }
+ List<WifiSliceItem> wifiList = (worker != null) ? worker.getResults() : null;
+ if (wifiList == null || wifiList.size() <= 0) {
+ log("Wi-Fi list is empty");
+ return listBuilder.build();
}
- // Third section: Add the connected Wi-Fi item to Wi-Fi list if the Ethernet is connected.
- if (connectedWifiItem != null && !isConnectedWifiAddedTop) {
+ // Fourth section: Add the connected Wi-Fi item.
+ final WifiSliceItem connectedWifiItem = mHelper.getConnectedWifiItem(wifiList);
+ if (connectedWifiItem != null) {
log("get Wi-Fi item which is connected");
listBuilder.addRow(getWifiSliceItemRow(connectedWifiItem));
maxListSize--;
}
- // Fourth section: Add the Wi-Fi items which are not connected.
- if (wifiList != null && wifiList.size() > 0) {
- log("get Wi-Fi items which are not connected. Wi-Fi items : " + wifiList.size());
-
- final List<WifiSliceItem> disconnectedWifiList = wifiList.stream()
- .filter(wifiSliceItem -> wifiSliceItem.getConnectedState()
- != WifiEntry.CONNECTED_STATE_CONNECTED)
- .limit(maxListSize - 1)
- .collect(Collectors.toList());
- for (WifiSliceItem item : disconnectedWifiList) {
- listBuilder.addRow(getWifiSliceItemRow(item));
- }
- listBuilder.addRow(getSeeAllRow());
+ // Fifth section: Add the Wi-Fi items which are not connected.
+ log("get Wi-Fi items which are not connected. Wi-Fi items : " + wifiList.size());
+ final List<WifiSliceItem> disconnectedWifiList = wifiList.stream()
+ .filter(item -> item.getConnectedState() != WifiEntry.CONNECTED_STATE_CONNECTED)
+ .limit(maxListSize - 1)
+ .collect(Collectors.toList());
+ for (WifiSliceItem item : disconnectedWifiList) {
+ listBuilder.addRow(getWifiSliceItemRow(item));
}
+
+ // Sixth section: Add the See All item.
+ log("add See-All");
+ listBuilder.addRow(getSeeAllRow());
+
return listBuilder.build();
}
@@ -324,6 +323,26 @@
.setSubtitle(mContext.getText(R.string.to_switch_networks_disconnect_ethernet));
}
+ /**
+ * @return a {@link ListBuilder.RowBuilder} of the Wi-Fi toggle.
+ */
+ protected ListBuilder.RowBuilder createWifiToggleRow(Context context, boolean isWifiEnabled) {
+ final Intent intent = new Intent(WIFI_SLICE_URI.toString())
+ .setData(WIFI_SLICE_URI)
+ .setClass(context, SliceBroadcastReceiver.class)
+ .putExtra(EXTRA_TOGGLE_STATE, !isWifiEnabled)
+ // The FLAG_RECEIVER_FOREGROUND flag is necessary to avoid the intent delay of
+ // the first sending after the device restarts
+ .addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
+ final PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, intent,
+ PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
+ final SliceAction toggleSliceAction = SliceAction.createToggle(pendingIntent,
+ null /* actionTitle */, isWifiEnabled);
+ return new ListBuilder.RowBuilder()
+ .setTitle(context.getString(R.string.wifi_settings))
+ .setPrimaryAction(toggleSliceAction);
+ }
+
protected ListBuilder.RowBuilder getSeeAllRow() {
final CharSequence title = mContext.getText(R.string.previous_connected_see_all);
final IconCompat icon = getSeeAllIcon();
diff --git a/src/com/android/settings/network/telephony/NetworkProviderWorker.java b/src/com/android/settings/network/telephony/NetworkProviderWorker.java
index 675d60f..a6b438a 100644
--- a/src/com/android/settings/network/telephony/NetworkProviderWorker.java
+++ b/src/com/android/settings/network/telephony/NetworkProviderWorker.java
@@ -54,7 +54,7 @@
DataConnectivityListener.Client, InternetUpdater.InternetChangeListener,
SubscriptionsChangeListener.SubscriptionsChangeListenerClient {
private static final String TAG = "NetworkProviderWorker";
- private static final int PROVIDER_MODEL_DEFAULT_EXPANDED_ROW_COUNT = 5;
+ private static final int PROVIDER_MODEL_DEFAULT_EXPANDED_ROW_COUNT = 6;
private DataContentObserver mMobileDataObserver;
private SignalStrengthListener mSignalStrengthListener;
private SubscriptionsChangeListener mSubscriptionsListener;
diff --git a/src/com/android/settings/panel/InternetConnectivityPanel.java b/src/com/android/settings/panel/InternetConnectivityPanel.java
index 53c0f20..ae6f2e0 100644
--- a/src/com/android/settings/panel/InternetConnectivityPanel.java
+++ b/src/com/android/settings/panel/InternetConnectivityPanel.java
@@ -39,7 +39,6 @@
import android.util.Log;
import androidx.annotation.VisibleForTesting;
-import androidx.fragment.app.FragmentActivity;
import androidx.lifecycle.LifecycleObserver;
import androidx.lifecycle.OnLifecycleEvent;
@@ -236,6 +235,11 @@
@Override
public Intent getSeeMoreIntent() {
+ // Disable the see more button for provider model design.
+ if (mIsProviderModelEnabled) {
+ return null;
+ }
+
// Don't remove the see more intent for non-provider model design. This intent will be
// used when isCustomizedButtonUsed() returns false.
return new Intent(Settings.ACTION_WIRELESS_SETTINGS)
@@ -243,23 +247,6 @@
}
@Override
- public boolean isCustomizedButtonUsed() {
- return mIsProviderModelEnabled;
- }
-
- @Override
- public CharSequence getCustomizedButtonTitle() {
- return mContext.getText(
- mInternetUpdater.isWifiEnabled() ? R.string.turn_off_wifi : R.string.turn_on_wifi);
- }
-
- @Override
- public void onClickCustomizedButton(FragmentActivity panelActivity) {
- // Don't finish the panel activity
- mWifiManager.setWifiEnabled(!mInternetUpdater.isWifiEnabled());
- }
-
- @Override
public boolean isProgressBarVisible() {
return mIsProgressBarVisible;
}
@@ -320,7 +307,6 @@
}
updateSubtitleText();
mCallback.onHeaderChanged();
- mCallback.onCustomizedButtonStateChanged();
}
@VisibleForTesting
diff --git a/src/com/android/settings/password/SetupChooseLockGeneric.java b/src/com/android/settings/password/SetupChooseLockGeneric.java
index 15a90e3..3261b81 100644
--- a/src/com/android/settings/password/SetupChooseLockGeneric.java
+++ b/src/com/android/settings/password/SetupChooseLockGeneric.java
@@ -23,7 +23,6 @@
import android.content.Context;
import android.content.Intent;
-import android.content.res.Resources;
import android.os.Bundle;
import android.os.IBinder;
import android.os.UserHandle;
@@ -43,6 +42,7 @@
import com.android.settings.utils.SettingsDividerItemDecoration;
import com.google.android.setupdesign.GlifPreferenceLayout;
+import com.google.android.setupdesign.util.ThemeHelper;
/**
* Setup Wizard's version of ChooseLockGeneric screen. It inherits the logic and basic structure
@@ -67,13 +67,9 @@
}
@Override
- protected void onApplyThemeResource(Resources.Theme theme, int resid, boolean first) {
- final int new_resid = SetupWizardUtils.getTheme(this, getIntent());
- super.onApplyThemeResource(theme, new_resid, first);
- }
-
- @Override
protected void onCreate(Bundle savedInstance) {
+ setTheme(SetupWizardUtils.getTheme(this, getIntent()));
+ ThemeHelper.trySetDynamicColor(this);
super.onCreate(savedInstance);
if(getIntent().hasExtra(EXTRA_KEY_REQUESTED_MIN_COMPLEXITY)) {
@@ -92,6 +88,12 @@
findViewById(R.id.content_parent).setFitsSystemWindows(false);
}
+ @Override
+ protected boolean isToolbarEnabled() {
+ // Hide the action bar from this page.
+ return false;
+ }
+
public static class SetupChooseLockGenericFragment extends ChooseLockGenericFragment {
public static final String EXTRA_PASSWORD_QUALITY = ":settings:password_quality";
diff --git a/src/com/android/settings/password/SetupChooseLockPassword.java b/src/com/android/settings/password/SetupChooseLockPassword.java
index 7cf90c0..cca50e0 100644
--- a/src/com/android/settings/password/SetupChooseLockPassword.java
+++ b/src/com/android/settings/password/SetupChooseLockPassword.java
@@ -22,6 +22,7 @@
import android.os.Bundle;
import android.util.Log;
import android.view.View;
+import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import androidx.annotation.Nullable;
@@ -112,7 +113,6 @@
.getBooleanExtra(ChooseLockSettingsHelper.EXTRA_KEY_FOR_FACE, false);
final boolean forBiometrics = intent
.getBooleanExtra(ChooseLockSettingsHelper.EXTRA_KEY_FOR_BIOMETRICS, false);
-
final SetupSkipDialog dialog = SetupSkipDialog.newInstance(
frpSupported,
/* isPatternMode= */ false,
@@ -120,6 +120,11 @@
forFingerprint,
forFace,
forBiometrics);
+
+ InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(
+ Context.INPUT_METHOD_SERVICE);
+ imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
+
dialog.show(getFragmentManager());
return;
}
diff --git a/src/com/android/settings/password/SetupSkipDialog.java b/src/com/android/settings/password/SetupSkipDialog.java
index dc4516a..a0fe961 100644
--- a/src/com/android/settings/password/SetupSkipDialog.java
+++ b/src/com/android/settings/password/SetupSkipDialog.java
@@ -21,6 +21,8 @@
import android.app.settings.SettingsEnums;
import android.content.DialogInterface;
import android.os.Bundle;
+import android.view.View;
+import android.view.inputmethod.InputMethodManager;
import androidx.annotation.NonNull;
import androidx.annotation.StringRes;
@@ -190,12 +192,21 @@
@Override
public void onClick(DialogInterface dialog, int button) {
+ Activity activity = getActivity();
switch (button) {
case DialogInterface.BUTTON_POSITIVE:
- Activity activity = getActivity();
activity.setResult(RESULT_SKIP);
activity.finish();
break;
+ case DialogInterface.BUTTON_NEGATIVE:
+ View view = activity.getCurrentFocus();
+ if(view != null) {
+ view.requestFocus();
+ InputMethodManager imm = (InputMethodManager) activity
+ .getSystemService(Activity.INPUT_METHOD_SERVICE);
+ imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
+ }
+ break;
}
}
diff --git a/src/com/android/settings/security/InstallCaCertificateWarning.java b/src/com/android/settings/security/InstallCaCertificateWarning.java
index 91faae1..3854875 100644
--- a/src/com/android/settings/security/InstallCaCertificateWarning.java
+++ b/src/com/android/settings/security/InstallCaCertificateWarning.java
@@ -25,10 +25,12 @@
import android.widget.Toast;
import com.android.settings.R;
+import com.android.settings.SetupWizardUtils;
import com.google.android.setupcompat.template.FooterBarMixin;
import com.google.android.setupcompat.template.FooterButton;
import com.google.android.setupdesign.GlifLayout;
+import com.google.android.setupdesign.util.ThemeHelper;
/**
* Creates a warning dialog explaining the consequences of installing a CA certificate
@@ -40,8 +42,11 @@
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ setTheme(SetupWizardUtils.getTheme(this, getIntent()));
+ ThemeHelper.trySetDynamicColor(this);
setContentView(R.layout.ca_certificate_warning_dialog);
final GlifLayout layout = findViewById(R.id.setup_wizard_layout);
+ layout.setHeaderText(R.string.ca_certificate_warning_title);
final FooterBarMixin mixin = layout.getMixin(FooterBarMixin.class);
mixin.setSecondaryButton(
diff --git a/src/com/android/settings/widget/LoadingViewController.java b/src/com/android/settings/widget/LoadingViewController.java
index 66eebf3..294e55e 100644
--- a/src/com/android/settings/widget/LoadingViewController.java
+++ b/src/com/android/settings/widget/LoadingViewController.java
@@ -22,66 +22,34 @@
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
-import androidx.annotation.Nullable;
-
/**
- * A helper class that manages show/hide loading spinner, content view and empty view (optional).
+ * A helper class that manages show/hide loading spinner.
*/
public class LoadingViewController {
private static final long DELAY_SHOW_LOADING_CONTAINER_THRESHOLD_MS = 100L;
- private final Handler mFgHandler;
- private final View mLoadingView;
- private final View mContentView;
- private final View mEmptyView;
+ public final Handler mFgHandler;
+ public final View mLoadingView;
+ public final View mContentView;
public LoadingViewController(View loadingView, View contentView) {
- this(loadingView, contentView, null /* emptyView*/);
- }
-
- public LoadingViewController(View loadingView, View contentView, @Nullable View emptyView) {
mLoadingView = loadingView;
mContentView = contentView;
- mEmptyView = emptyView;
mFgHandler = new Handler(Looper.getMainLooper());
}
private Runnable mShowLoadingContainerRunnable = new Runnable() {
public void run() {
- showLoadingView();
+ handleLoadingContainer(false /* done */, false /* animate */);
}
};
- /**
- * Shows content view and hides loading view & empty view.
- */
public void showContent(boolean animate) {
// Cancel any pending task to show the loading animation and show the list of
// apps directly.
mFgHandler.removeCallbacks(mShowLoadingContainerRunnable);
- handleLoadingContainer(true /* showContent */, false /* showEmpty*/, animate);
- }
-
- /**
- * Shows empty view and hides loading view & content view.
- */
- public void showEmpty(boolean animate) {
- if (mEmptyView == null) {
- return;
- }
-
- // Cancel any pending task to show the loading animation and show the list of
- // apps directly.
- mFgHandler.removeCallbacks(mShowLoadingContainerRunnable);
- handleLoadingContainer(false /* showContent */, true /* showEmpty */, animate);
- }
-
- /**
- * Shows loading view and hides content view & empty view.
- */
- public void showLoadingView() {
- handleLoadingContainer(false /* showContent */, false /* showEmpty */, false /* animate */);
+ handleLoadingContainer(true /* show */, animate);
}
public void showLoadingViewDelayed() {
@@ -89,9 +57,8 @@
mShowLoadingContainerRunnable, DELAY_SHOW_LOADING_CONTAINER_THRESHOLD_MS);
}
- private void handleLoadingContainer(boolean showContent, boolean showEmpty, boolean animate) {
- handleLoadingContainer(mLoadingView, mContentView, mEmptyView,
- showContent, showEmpty, animate);
+ public void handleLoadingContainer(boolean done, boolean animate) {
+ handleLoadingContainer(mLoadingView, mContentView, done, animate);
}
/**
@@ -108,25 +75,6 @@
setViewShown(content, done, animate);
}
- /**
- * Show/hide loading view and content view and empty view.
- *
- * @param loading The loading spinner view
- * @param content The content view
- * @param empty The empty view shows no item summary to users.
- * @param showContent If true, content is set visible and loading is set invisible.
- * @param showEmpty If true, empty is set visible and loading is set invisible.
- * @param animate Whether or not content/loading views should animate in/out.
- */
- public static void handleLoadingContainer(View loading, View content, View empty,
- boolean showContent, boolean showEmpty, boolean animate) {
- if (empty != null) {
- setViewShown(empty, showEmpty, animate);
- }
- setViewShown(content, showContent, animate);
- setViewShown(loading, !showContent && !showEmpty, animate);
- }
-
private static void setViewShown(final View view, boolean shown, boolean animate) {
if (animate) {
Animation animation = AnimationUtils.loadAnimation(view.getContext(),
diff --git a/tests/robotests/src/com/android/settings/accessibility/AccessibilityButtonFooterPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/AccessibilityButtonFooterPreferenceControllerTest.java
new file mode 100644
index 0000000..33c5762
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/accessibility/AccessibilityButtonFooterPreferenceControllerTest.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.accessibility;
+
+import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_2BUTTON;
+import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Mockito.when;
+
+import android.content.Context;
+import android.content.res.Resources;
+
+import androidx.test.core.app.ApplicationProvider;
+
+import com.android.settings.R;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnit;
+import org.mockito.junit.MockitoRule;
+import org.robolectric.RobolectricTestRunner;
+
+/** Tests for {@link AccessibilityButtonFooterPreferenceController}. */
+@RunWith(RobolectricTestRunner.class)
+public class AccessibilityButtonFooterPreferenceControllerTest {
+
+ @Rule
+ public final MockitoRule mockito = MockitoJUnit.rule();
+
+ @Spy
+ private final Context mContext = ApplicationProvider.getApplicationContext();
+ @Spy
+ private final Resources mResources = mContext.getResources();
+ private AccessibilityButtonFooterPreferenceController mController;
+
+ @Before
+ public void setUp() {
+ mController = new AccessibilityButtonFooterPreferenceController(mContext,
+ "test_key");
+ when(mContext.getResources()).thenReturn(mResources);
+ }
+
+ @Test
+ public void getSummary_navigationGestureEnabled_shouldReturnButtonAndGestureSummary() {
+ when(mResources.getInteger(com.android.internal.R.integer.config_navBarInteractionMode))
+ .thenReturn(NAV_BAR_MODE_GESTURAL);
+
+ assertThat(mController.getSummary()).isEqualTo(
+ mContext.getText(R.string.accessibility_button_gesture_description));
+ }
+
+ @Test
+ public void getSummary_navigationGestureDisabled_shouldReturnButtonSummary() {
+ when(mResources.getInteger(com.android.internal.R.integer.config_navBarInteractionMode))
+ .thenReturn(NAV_BAR_MODE_2BUTTON);
+
+ assertThat(mController.getSummary()).isEqualTo(
+ mContext.getText(R.string.accessibility_button_description));
+ }
+}
diff --git a/tests/robotests/src/com/android/settings/accessibility/AnimatedImagePreferenceTest.java b/tests/robotests/src/com/android/settings/accessibility/AnimatedImagePreferenceTest.java
index 4bce0bb..c7e5b13 100644
--- a/tests/robotests/src/com/android/settings/accessibility/AnimatedImagePreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/AnimatedImagePreferenceTest.java
@@ -32,8 +32,7 @@
import android.graphics.drawable.AnimatedVectorDrawable;
import android.graphics.drawable.AnimationDrawable;
import android.net.Uri;
-import android.view.LayoutInflater;
-import android.view.View;
+import android.view.ViewGroup;
import android.widget.ImageView;
import androidx.preference.PreferenceViewHolder;
@@ -45,6 +44,7 @@
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.Spy;
import org.robolectric.RobolectricTestRunner;
@@ -57,10 +57,12 @@
public class AnimatedImagePreferenceTest {
private final Context mContext = RuntimeEnvironment.application;
private Uri mImageUri;
- private View mRootView;
private PreferenceViewHolder mViewHolder;
private AnimatedImagePreference mAnimatedImagePreference;
+ @Mock
+ private ViewGroup mRootView;
+
@Spy
private ImageView mImageView;
@@ -68,9 +70,8 @@
public void init() {
MockitoAnnotations.initMocks(this);
- final LayoutInflater inflater = LayoutInflater.from(mContext);
- mRootView = spy(inflater.inflate(R.layout.preference_animated_image, /* root= */ null));
mViewHolder = spy(PreferenceViewHolder.createInstanceForTests(mRootView));
+ doReturn(new LottieAnimationView(mContext)).when(mRootView).findViewById(R.id.lottie_view);
mImageView = spy(new ImageView(mContext));
mAnimatedImagePreference = new AnimatedImagePreference(mContext);
diff --git a/tests/robotests/src/com/android/settings/applications/manageapplications/ManageApplicationsTest.java b/tests/robotests/src/com/android/settings/applications/manageapplications/ManageApplicationsTest.java
index 25eca7a..86f5fe8 100644
--- a/tests/robotests/src/com/android/settings/applications/manageapplications/ManageApplicationsTest.java
+++ b/tests/robotests/src/com/android/settings/applications/manageapplications/ManageApplicationsTest.java
@@ -28,6 +28,7 @@
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyInt;
+import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
@@ -48,6 +49,7 @@
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
+import android.view.ViewGroup;
import android.widget.SearchView;
import androidx.fragment.app.FragmentActivity;
@@ -154,6 +156,22 @@
}
@Test
+ public void onCreateView_shouldNotShowLoadingContainer() {
+ ReflectionHelpers.setField(mFragment, "mResetAppsHelper", mock(ResetAppsHelper.class));
+ doNothing().when(mFragment).createHeader();
+
+ final LayoutInflater layoutInflater = mock(LayoutInflater.class);
+ final View view = mock(View.class);
+ final View loadingContainer = mock(View.class);
+ when(layoutInflater.inflate(anyInt(), eq(null))).thenReturn(view);
+ when(view.findViewById(R.id.loading_container)).thenReturn(loadingContainer);
+
+ mFragment.onCreateView(layoutInflater, mock(ViewGroup.class), null);
+
+ verify(loadingContainer, never()).setVisibility(View.VISIBLE);
+ }
+
+ @Test
public void onCreateOptionsMenu_shouldSetSearchQueryListener() {
final SearchView searchView = mock(SearchView.class);
final MenuItem searchMenu = mock(MenuItem.class);
@@ -203,6 +221,7 @@
@Test
public void updateLoading_appLoaded_shouldNotDelayCallToHandleLoadingContainer() {
ReflectionHelpers.setField(mFragment, "mLoadingContainer", mock(View.class));
+ ReflectionHelpers.setField(mFragment, "mListContainer", mock(View.class));
final ManageApplications.ApplicationsAdapter adapter =
spy(new ManageApplications.ApplicationsAdapter(mState, mFragment,
AppFilterRegistry.getInstance().get(FILTER_APPS_ALL), new Bundle()));
@@ -224,6 +243,7 @@
@Test
public void updateLoading_appNotLoaded_shouldDelayCallToHandleLoadingContainer() {
ReflectionHelpers.setField(mFragment, "mLoadingContainer", mock(View.class));
+ ReflectionHelpers.setField(mFragment, "mListContainer", mock(View.class));
final ManageApplications.ApplicationsAdapter adapter =
spy(new ManageApplications.ApplicationsAdapter(mState, mFragment,
AppFilterRegistry.getInstance().get(FILTER_APPS_ALL), new Bundle()));
@@ -252,6 +272,7 @@
when(listContainer.getVisibility()).thenReturn(View.INVISIBLE);
when(listContainer.getContext()).thenReturn(context);
ReflectionHelpers.setField(mFragment, "mLoadingContainer", loadingContainer);
+ ReflectionHelpers.setField(mFragment, "mListContainer", listContainer);
final ManageApplications.ApplicationsAdapter adapter =
spy(new ManageApplications.ApplicationsAdapter(mState, mFragment,
AppFilterRegistry.getInstance().get(FILTER_APPS_ALL), new Bundle()));
@@ -275,7 +296,7 @@
adapter.onRebuildComplete(null);
- verify(loadingViewController).showEmpty(false /* animate */);
+ verify(loadingViewController).showContent(true /* animate */);
}
@Test
@@ -283,16 +304,15 @@
final String query = "Test";
final RecyclerView recyclerView = mock(RecyclerView.class);
final View emptyView = mock(View.class);
- final View loadingContainer = mock(View.class);
ReflectionHelpers.setField(mFragment, "mRecyclerView", recyclerView);
ReflectionHelpers.setField(mFragment, "mEmptyView", emptyView);
- ReflectionHelpers.setField(mFragment, "mLoadingContainer", loadingContainer);
final SearchView searchView = mock(SearchView.class);
ReflectionHelpers.setField(mFragment, "mSearchView", searchView);
when(searchView.isVisibleToUser()).thenReturn(true);
when(searchView.getQuery()).thenReturn(query);
final View listContainer = mock(View.class);
when(listContainer.getVisibility()).thenReturn(View.VISIBLE);
+ ReflectionHelpers.setField(mFragment, "mListContainer", listContainer);
ReflectionHelpers.setField(
mFragment, "mFilterAdapter", mock(ManageApplications.FilterSpinnerAdapter.class));
final ArrayList<ApplicationsState.AppEntry> appList = new ArrayList<>();
@@ -471,6 +491,8 @@
mFragment.mFilterAdapter.updateFilterView(true);
assertThat(mFragment.mSpinnerHeader.getVisibility()).isEqualTo(View.VISIBLE);
+ assertThat(mFragment.mRecyclerView.getPaddingTop()).isEqualTo(
+ mContext.getResources().getDimensionPixelSize(R.dimen.app_bar_height));
}
@Test
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothPermissionActivityTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothPermissionActivityTest.java
index 35b8f1f..6f02753 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothPermissionActivityTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothPermissionActivityTest.java
@@ -53,6 +53,6 @@
mActivity.sendReplyIntentToReceiver(true, true);
verify(mContext).sendBroadcast(intentCaptor.capture(),
- eq("android.permission.BLUETOOTH_ADMIN"));
+ eq("android.permission.BLUETOOTH_CONNECT"));
}
}
diff --git a/tests/robotests/src/com/android/settings/bluetooth/DevicePickerFragmentTest.java b/tests/robotests/src/com/android/settings/bluetooth/DevicePickerFragmentTest.java
index a05ec87..8cd465c 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/DevicePickerFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/DevicePickerFragmentTest.java
@@ -82,7 +82,7 @@
mFragment.onDeviceBondStateChanged(cachedDevice, BluetoothDevice.BOND_BONDED);
verify(mContext).sendBroadcast(intentCaptor.capture(),
- eq("android.permission.BLUETOOTH_ADMIN"));
+ eq("android.permission.BLUETOOTH_CONNECT"));
assertThat(intentCaptor.getValue().getComponent().getPackageName())
.isEqualTo(mFragment.mLaunchPackage);
}
diff --git a/tests/robotests/src/com/android/settings/network/NetworkProviderSettingsTest.java b/tests/robotests/src/com/android/settings/network/NetworkProviderSettingsTest.java
index 7affe68..9951449 100644
--- a/tests/robotests/src/com/android/settings/network/NetworkProviderSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/network/NetworkProviderSettingsTest.java
@@ -535,4 +535,32 @@
assertThat(p instanceof NetworkProviderSettings.FirstWifiEntryPreference).isTrue();
}
+
+ @Test
+ public void updateWifiEntryPreferences_activityIsNull_ShouldNotCrash() {
+ when(mNetworkProviderSettings.getActivity()).thenReturn(null);
+
+ // should not crash
+ mNetworkProviderSettings.updateWifiEntryPreferences();
+ }
+
+ @Test
+ public void updateWifiEntryPreferences_viewIsNull_ShouldNotCrash() {
+ final FragmentActivity activity = mock(FragmentActivity.class);
+ when(mNetworkProviderSettings.getActivity()).thenReturn(activity);
+ when(mNetworkProviderSettings.getView()).thenReturn(null);
+
+ // should not crash
+ mNetworkProviderSettings.updateWifiEntryPreferences();
+ }
+
+ @Test
+ public void updateWifiEntryPreferences_isRestricted_bypassUpdate() {
+ mNetworkProviderSettings.mIsRestricted = true;
+ mNetworkProviderSettings.mWifiEntryPreferenceCategory = mock(PreferenceCategory.class);
+
+ mNetworkProviderSettings.updateWifiEntryPreferences();
+
+ verify(mNetworkProviderSettings.mWifiEntryPreferenceCategory, never()).setVisible(true);
+ }
}
diff --git a/tests/robotests/src/com/android/settings/password/SetupChooseLockPasswordTest.java b/tests/robotests/src/com/android/settings/password/SetupChooseLockPasswordTest.java
index af4ae0b..29ec998 100644
--- a/tests/robotests/src/com/android/settings/password/SetupChooseLockPasswordTest.java
+++ b/tests/robotests/src/com/android/settings/password/SetupChooseLockPasswordTest.java
@@ -24,6 +24,7 @@
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
+import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import androidx.appcompat.app.AlertDialog;
@@ -55,6 +56,7 @@
import org.robolectric.annotation.Implements;
import org.robolectric.shadows.ShadowActivity;
import org.robolectric.shadows.ShadowDialog;
+import org.robolectric.shadows.ShadowInputMethodManager;
import java.util.Collections;
import java.util.List;
@@ -149,6 +151,9 @@
@Test
public void createActivity_skipButtonInIntroductionStage_shouldBeVisible() {
SetupChooseLockPassword activity = createSetupChooseLockPassword();
+ final InputMethodManager inputMethodManager = activity
+ .getSystemService(InputMethodManager.class);
+ final ShadowInputMethodManager shadowImm = Shadows.shadowOf(inputMethodManager);
final PartnerCustomizationLayout layout = activity.findViewById(R.id.setup_wizard_layout);
final Button skipOrClearButton =
@@ -159,6 +164,7 @@
skipOrClearButton.performClick();
final AlertDialog chooserDialog = ShadowAlertDialogCompat.getLatestAlertDialog();
assertThat(chooserDialog).isNotNull();
+ assertThat(shadowImm.isSoftInputVisible()).isFalse();
}
@Test
diff --git a/tests/unit/src/com/android/settings/network/InternetUpdaterTest.java b/tests/unit/src/com/android/settings/network/InternetUpdaterTest.java
index 5ab2ce0..c54c3ee 100644
--- a/tests/unit/src/com/android/settings/network/InternetUpdaterTest.java
+++ b/tests/unit/src/com/android/settings/network/InternetUpdaterTest.java
@@ -39,6 +39,7 @@
import android.content.IntentFilter;
import android.net.ConnectivityManager;
import android.net.NetworkCapabilities;
+import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import androidx.lifecycle.Lifecycle;
@@ -194,4 +195,17 @@
assertThat(mInternetUpdater.getInternetType()).isEqualTo(INTERNET_ETHERNET);
}
+
+ @Test
+ public void updateInternetType_carrierWifiConnected_getInternetCellular() {
+ final WifiInfo wifiInfo = mock(WifiInfo.class);
+ doReturn(wifiInfo).when(mWifiManager).getConnectionInfo();
+ doReturn(true).when(wifiInfo).isCarrierMerged();
+ mInternetUpdater.mInternetAvailable = true;
+ mInternetUpdater.mTransport = TRANSPORT_WIFI;
+
+ mInternetUpdater.updateInternetType();
+
+ assertThat(mInternetUpdater.getInternetType()).isEqualTo(INTERNET_CELLULAR);
+ }
}
diff --git a/tests/unit/src/com/android/settings/network/ProviderModelSliceTest.java b/tests/unit/src/com/android/settings/network/ProviderModelSliceTest.java
index 722e305..66247d3 100644
--- a/tests/unit/src/com/android/settings/network/ProviderModelSliceTest.java
+++ b/tests/unit/src/com/android/settings/network/ProviderModelSliceTest.java
@@ -46,6 +46,8 @@
import android.telephony.TelephonyManager;
import androidx.slice.Slice;
+import androidx.slice.SliceItem;
+import androidx.slice.SliceMetadata;
import androidx.slice.SliceProvider;
import androidx.slice.builders.ListBuilder;
import androidx.slice.builders.SliceAction;
@@ -104,8 +106,6 @@
ListBuilder.RowBuilder mMockCarrierRowBuild;
@Mock
WifiPickerTracker mWifiPickerTracker;
- @Mock
- WifiSliceItem mWifiSliceItem;
AlertDialog mMockAlertDialog;
private FakeFeatureFactory mFeatureFactory;
@@ -127,7 +127,7 @@
when(mContext.getSystemService(TelephonyManager.class)).thenReturn(mTelephonyManager);
when(mTelephonyManager.createForSubscriptionId(anyInt())).thenReturn(mTelephonyManager);
when(mContext.getSystemService(WifiManager.class)).thenReturn(mWifiManager);
-
+ when(mWifiManager.isWifiEnabled()).thenReturn(true);
// Set-up specs for SliceMetadata.
SliceProvider.setSpecs(SliceLiveData.SUPPORTED_SPECS);
@@ -192,7 +192,24 @@
@Test
@UiThreadTest
- public void getSlice_haveTwoWifiAndOneCarrier_getCarrierAndTwoWiFiAndSeeAll() {
+ public void getSlice_airplaneModeIsOn_oneWifiToggle() {
+ mWifiList.clear();
+ mMockNetworkProviderWorker.updateSelfResults(null);
+ mockHelperCondition(true, false, false, null);
+
+ final Slice slice = mMockProviderModelSlice.getSlice();
+
+ assertThat(slice).isNotNull();
+ verify(mListBuilder, times(1)).addRow(any(ListBuilder.RowBuilder.class));
+ final SliceItem sliceTitle =
+ SliceMetadata.from(mContext, slice).getListContent().getHeader().getTitleItem();
+ assertThat(sliceTitle.getText()).isEqualTo(
+ ResourcesUtils.getResourcesString(mContext, "wifi_settings"));
+ }
+
+ @Test
+ @UiThreadTest
+ public void getSlice_haveTwoWifiAndOneCarrier_getFiveRow() {
mWifiList.clear();
mockWifiItemCondition(mMockWifiSliceItem1, "wifi1", "wifi1",
WifiEntry.CONNECTED_STATE_CONNECTED, "wifi1_key", true);
@@ -207,13 +224,13 @@
assertThat(slice).isNotNull();
verify(mListBuilder, times(1)).addRow(mMockCarrierRowBuild);
- verify(mListBuilder, times(4)).addRow(any(ListBuilder.RowBuilder.class));
+ verify(mListBuilder, times(5)).addRow(any(ListBuilder.RowBuilder.class));
assertThat(mMockProviderModelSlice.hasSeeAllRow()).isTrue();
}
@Test
@UiThreadTest
- public void getSlice_haveOneConnectedWifiAndTwoDisconnectedWifiAndNoCarrier_getFourRow() {
+ public void getSlice_haveOneConnectedWifiAndTwoDisconnectedWifiAndNoCarrier_getFiveRow() {
mWifiList.clear();
mockWifiItemCondition(mMockWifiSliceItem1, "wifi1", "wifi1",
WifiEntry.CONNECTED_STATE_CONNECTED, "wifi1_key", true);
@@ -230,13 +247,13 @@
final Slice slice = mMockProviderModelSlice.getSlice();
assertThat(slice).isNotNull();
- verify(mListBuilder, times(4)).addRow(any(ListBuilder.RowBuilder.class));
+ verify(mListBuilder, times(5)).addRow(any(ListBuilder.RowBuilder.class));
assertThat(mMockProviderModelSlice.hasSeeAllRow()).isTrue();
}
@Test
@UiThreadTest
- public void getSlice_haveTwoDisconnectedWifiAndNoCarrier_getThreeRow() {
+ public void getSlice_haveTwoDisconnectedWifiAndNoCarrier_getFourRow() {
mWifiList.clear();
mockWifiItemCondition(mMockWifiSliceItem1, "wifi1", "wifi1",
WifiEntry.CONNECTED_STATE_DISCONNECTED, "wifi1_key", true);
@@ -250,13 +267,13 @@
final Slice slice = mMockProviderModelSlice.getSlice();
assertThat(slice).isNotNull();
- verify(mListBuilder, times(3)).addRow(any(ListBuilder.RowBuilder.class));
+ verify(mListBuilder, times(4)).addRow(any(ListBuilder.RowBuilder.class));
assertThat(mMockProviderModelSlice.hasSeeAllRow()).isTrue();
}
@Test
@UiThreadTest
- public void getSlice_haveEthernetAndCarrierAndTwoDisconnectedWifi_getFiveRow() {
+ public void getSlice_haveEthernetAndCarrierAndTwoDisconnectedWifi_getSixRow() {
mWifiList.clear();
mockWifiItemCondition(mMockWifiSliceItem1, "wifi1", "wifi1",
WifiEntry.CONNECTED_STATE_DISCONNECTED, "wifi1_key", true);
@@ -274,13 +291,13 @@
assertThat(slice).isNotNull();
assertThat(mMockProviderModelSlice.hasCreateEthernetRow()).isTrue();
verify(mListBuilder, times(1)).addRow(mMockCarrierRowBuild);
- verify(mListBuilder, times(5)).addRow(any(ListBuilder.RowBuilder.class));
+ verify(mListBuilder, times(6)).addRow(any(ListBuilder.RowBuilder.class));
assertThat(mMockProviderModelSlice.hasSeeAllRow()).isTrue();
}
@Test
@UiThreadTest
- public void getSlice_haveEthernetAndCarrierAndConnectedWifiAndDisconnectedWifi_getFiveRow() {
+ public void getSlice_haveEthernetAndCarrierAndConnectedWifiAndDisconnectedWifi_getSixRow() {
mWifiList.clear();
mockWifiItemCondition(mMockWifiSliceItem1, "wifi1", "wifi1",
WifiEntry.CONNECTED_STATE_CONNECTED, "wifi1_key", true);
@@ -298,7 +315,7 @@
assertThat(slice).isNotNull();
assertThat(mMockProviderModelSlice.hasCreateEthernetRow()).isTrue();
verify(mListBuilder, times(1)).addRow(mMockCarrierRowBuild);
- verify(mListBuilder, times(5)).addRow(any(ListBuilder.RowBuilder.class));
+ verify(mListBuilder, times(6)).addRow(any(ListBuilder.RowBuilder.class));
assertThat(mMockProviderModelSlice.hasSeeAllRow()).isTrue();
}
@@ -396,6 +413,11 @@
return super.getSeeAllRow();
}
+ @Override
+ public ListBuilder.RowBuilder getWifiSliceItemRow(WifiSliceItem wifiSliceItem) {
+ return super.getWifiSliceItemRow(wifiSliceItem);
+ }
+
public boolean hasCreateEthernetRow() {
return mHasCreateEthernetRow;
}
diff --git a/tests/unit/src/com/android/settings/panel/InternetConnectivityPanelTest.java b/tests/unit/src/com/android/settings/panel/InternetConnectivityPanelTest.java
index c13d368..30a2729 100644
--- a/tests/unit/src/com/android/settings/panel/InternetConnectivityPanelTest.java
+++ b/tests/unit/src/com/android/settings/panel/InternetConnectivityPanelTest.java
@@ -21,7 +21,6 @@
import static org.mockito.Mockito.clearInvocations;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.never;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -32,7 +31,6 @@
import android.net.wifi.WifiManager;
import android.os.Handler;
-import androidx.fragment.app.FragmentActivity;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
@@ -89,8 +87,6 @@
private WifiManager mWifiManager;
@Mock
private ProviderModelSliceHelper mProviderModelSliceHelper;
- @Mock
- private FragmentActivity mPanelActivity;
private Context mContext;
private FakeHandlerInjector mFakeHandlerInjector;
@@ -223,20 +219,6 @@
}
@Test
- public void getCustomizedButtonTitle_wifiOff_turnOnWifi() {
- doReturn(false).when(mInternetUpdater).isWifiEnabled();
-
- assertThat(mPanel.getCustomizedButtonTitle()).isEqualTo(BUTTON_TURN_ON_WIFI);
- }
-
- @Test
- public void getCustomizedButtonTitle_wifiOn_turnOffWifi() {
- doReturn(true).when(mInternetUpdater).isWifiEnabled();
-
- assertThat(mPanel.getCustomizedButtonTitle()).isEqualTo(BUTTON_TURN_OFF_WIFI);
- }
-
- @Test
public void getSlices_providerModelDisabled_containsNecessarySlices() {
mPanel.mIsProviderModelEnabled = false;
List<Uri> uris = mPanel.getSlices();
@@ -255,33 +237,17 @@
}
@Test
- public void getSeeMoreIntent_shouldNotNull() {
+ public void getSeeMoreIntent_providerModelDisabled_shouldNotNull() {
+ mPanel.mIsProviderModelEnabled = false;
+
assertThat(mPanel.getSeeMoreIntent()).isNotNull();
}
@Test
- public void onClickCustomizedButton_wifiOn_setWifiOff() {
- doReturn(true).when(mInternetUpdater).isWifiEnabled();
+ public void getSeeMoreIntent_providerModelEnabled_shouldBeNull() {
+ mPanel.mIsProviderModelEnabled = true;
- mPanel.onClickCustomizedButton(mPanelActivity);
-
- verify(mWifiManager).setWifiEnabled(false);
- }
-
- @Test
- public void onClickCustomizedButton_wifiOff_setWifiOn() {
- doReturn(false).when(mInternetUpdater).isWifiEnabled();
-
- mPanel.onClickCustomizedButton(mPanelActivity);
-
- verify(mWifiManager).setWifiEnabled(true);
- }
-
- @Test
- public void onClickCustomizedButton_shouldNotFinishActivity() {
- mPanel.onClickCustomizedButton(mPanelActivity);
-
- verify(mPanelActivity, never()).finish();
+ assertThat(mPanel.getSeeMoreIntent()).isNull();
}
@Test
@@ -294,26 +260,6 @@
}
@Test
- public void onWifiEnabledChanged_wifiOff_onCustomizedButtonStateChanged() {
- doReturn(false).when(mInternetUpdater).isWifiEnabled();
- clearInvocations(mPanelContentCallback);
-
- mPanel.onWifiEnabledChanged(false);
-
- verify(mPanelContentCallback).onCustomizedButtonStateChanged();
- }
-
- @Test
- public void onWifiEnabledChanged_wifiOn_onCustomizedButtonStateChanged() {
- doReturn(true).when(mInternetUpdater).isWifiEnabled();
- clearInvocations(mPanelContentCallback);
-
- mPanel.onWifiEnabledChanged(true);
-
- verify(mPanelContentCallback).onCustomizedButtonStateChanged();
- }
-
- @Test
public void updateProgressBar_wifiDisabled_hideProgress() {
mPanel.mIsProgressBarVisible = true;
doReturn(false).when(mInternetUpdater).isWifiEnabled();