Merge "Merge Android 12 QPR1"

This commit is contained in:
Xin Li
2021-12-14 20:26:01 +00:00
committed by Gerrit Code Review
156 changed files with 14923 additions and 21249 deletions

View File

@@ -274,10 +274,6 @@
<action android:name="android.settings.WIFI_SETTINGS" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter android:priority="1">
<action android:name="android.intent.action.MAIN" />
<category android:name="com.android.settings.SHORTCUT" />
</intent-filter>
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
android:value="com.android.settings.wifi.WifiSettings" />
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
@@ -297,7 +293,7 @@
<activity
android:name="Settings$NetworkProviderSettingsActivity"
android:label="@string/network_dashboard_title"
android:label="@string/provider_internet_settings"
android:icon="@drawable/ic_homepage_network"
android:exported="true"
android:configChanges="orientation|keyboardHidden|screenSize">
@@ -315,6 +311,26 @@
android:value="true" />
</activity>
<activity
android:name="Settings$WifiDetailsSettingsActivity"
android:label="@string/wifi_details_title"
android:icon="@drawable/ic_homepage_network"
android:exported="true"
android:permission="android.permission.CHANGE_WIFI_STATE"
android:configChanges="orientation|keyboardHidden|screenSize">
<!-- The intent action is only public to OEM, because a special library is required. -->
<intent-filter android:priority="1">
<action android:name="android.settings.WIFI_DETAILS_SETTINGS" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<meta-data
android:name="com.android.settings.FRAGMENT_CLASS"
android:value="com.android.settings.wifi.details.WifiNetworkDetailsFragment" />
<meta-data
android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
android:value="true" />
</activity>
<activity
android:name=".wifi.WifiPickerActivity"
android:exported="true">
@@ -2195,6 +2211,8 @@
<activity android:name=".development.AppPicker"
android:label="@string/select_application" />
<activity android:name=".development.AdbQrCodeActivity" />
<activity android:name=".development.DSULoader"
android:label="Select DSU Package"
android:theme="@android:style/Theme.DeviceDefault.Light.Dialog" />
@@ -2225,6 +2243,7 @@
</activity>
<activity android:name=".bluetooth.BluetoothPairingDialog"
android:permission="android.permission.BLUETOOTH_PRIVILEGED"
android:excludeFromRecents="true"
android:windowSoftInputMode="stateVisible|adjustResize"
android:theme="@style/Theme.AlertDialog"
@@ -2988,10 +3007,6 @@
</intent-filter>
</activity>
<!--
The Wi-Fi result data will only be returned from WifiDialogActivity if the calling
package has ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION permission. (see b/185126813)
-->
<activity
android:name=".wifi.WifiDialogActivity"
android:label=""

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 240 KiB

View File

@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2021 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M0,0h24v24h-24z"/>
<path
android:pathData="M16.41,18.59L15,20L7,12L15,4L16.41,5.41L9.83,12"
android:fillColor="?android:attr/colorAccent"
android:fillType="evenOdd"/>
</vector>

View File

@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2021 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M0,0h24v24h-24z"/>
<path
android:pathData="M7.59,5.41L9,4L17,12L9,20L7.59,18.59L14.17,12"
android:fillColor="?android:attr/colorAccent"
android:fillType="evenOdd"/>
</vector>

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2021 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="6dp"
android:height="6dp"
android:viewportWidth="6"
android:viewportHeight="6">
<path
android:pathData="M3,0C4.65686,0 6,1.34315 6,3C6,4.65686 4.65685,6 3,6C1.34315,6 0,4.65685 0,3C0,1.34315 1.34315,0 3,0Z"
android:fillColor="?android:attr/colorAccent"
android:fillType="evenOdd"/>
</vector>

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2021 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="6dp"
android:height="6dp"
android:viewportWidth="6"
android:viewportHeight="6">
<path
android:pathData="M3,0C4.65686,0 6,1.34315 6,3C6,4.65686 4.65685,6 3,6C1.34315,6 0,4.65685 0,3C0,1.34315 1.34315,0 3,0Z"
android:fillColor="?android:attr/colorAccent"
android:fillAlpha="0.24"
android:fillType="evenOdd"/>
</vector>

View File

@@ -16,10 +16,11 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?android:attr/colorControlNormal">
<path
android:pathData="M17.81,4.47c-0.08,0 -0.16,-0.02 -0.23,-0.06C15.66,3.42 14,3 12.01,3c-1.98,0 -3.86,0.47 -5.57,1.41 -0.24,0.13 -0.54,0.04 -0.68,-0.2 -0.13,-0.24 -0.04,-0.55 0.2,-0.68C7.82,2.52 9.86,2 12.01,2c2.13,0 3.99,0.47 6.03,1.52 0.25,0.13 0.34,0.43 0.21,0.67 -0.09,0.18 -0.26,0.28 -0.44,0.28zM3.5,9.72c-0.1,0 -0.2,-0.03 -0.29,-0.09 -0.23,-0.16 -0.28,-0.47 -0.12,-0.7 0.99,-1.4 2.25,-2.5 3.75,-3.27C9.98,4.04 14,4.03 17.15,5.65c1.5,0.77 2.76,1.86 3.75,3.25 0.16,0.22 0.11,0.54 -0.12,0.7 -0.23,0.16 -0.54,0.11 -0.7,-0.12 -0.9,-1.26 -2.04,-2.25 -3.39,-2.94 -2.87,-1.47 -6.54,-1.47 -9.4,0.01 -1.36,0.7 -2.5,1.7 -3.4,2.96 -0.08,0.14 -0.23,0.21 -0.39,0.21zM9.75,21.79c-0.13,0 -0.26,-0.05 -0.35,-0.15 -0.87,-0.87 -1.34,-1.43 -2.01,-2.64 -0.69,-1.23 -1.05,-2.73 -1.05,-4.34 0,-2.97 2.54,-5.39 5.66,-5.39s5.66,2.42 5.66,5.39c0,0.28 -0.22,0.5 -0.5,0.5s-0.5,-0.22 -0.5,-0.5c0,-2.42 -2.09,-4.39 -4.66,-4.39 -2.57,0 -4.66,1.97 -4.66,4.39 0,1.44 0.32,2.77 0.93,3.85 0.64,1.15 1.08,1.64 1.85,2.42 0.19,0.2 0.19,0.51 0,0.71 -0.11,0.1 -0.24,0.15 -0.37,0.15zM16.92,19.94c-1.19,0 -2.24,-0.3 -3.1,-0.89 -1.49,-1.01 -2.38,-2.65 -2.38,-4.39 0,-0.28 0.22,-0.5 0.5,-0.5s0.5,0.22 0.5,0.5c0,1.41 0.72,2.74 1.94,3.56 0.71,0.48 1.54,0.71 2.54,0.71 0.24,0 0.64,-0.03 1.04,-0.1 0.27,-0.05 0.53,0.13 0.58,0.41 0.05,0.27 -0.13,0.53 -0.41,0.58 -0.57,0.11 -1.07,0.12 -1.21,0.12zM14.91,22c-0.04,0 -0.09,-0.01 -0.13,-0.02 -1.59,-0.44 -2.63,-1.03 -3.72,-2.1 -1.4,-1.39 -2.17,-3.24 -2.17,-5.22 0,-1.62 1.38,-2.94 3.08,-2.94 1.7,0 3.08,1.32 3.08,2.94 0,1.07 0.93,1.94 2.08,1.94s2.08,-0.87 2.08,-1.94c0,-3.77 -3.25,-6.83 -7.25,-6.83 -2.84,0 -5.44,1.58 -6.61,4.03 -0.39,0.81 -0.59,1.76 -0.59,2.8 0,0.78 0.07,2.01 0.67,3.61 0.1,0.26 -0.03,0.55 -0.29,0.64 -0.26,0.1 -0.55,-0.04 -0.64,-0.29 -0.49,-1.31 -0.73,-2.61 -0.73,-3.96 0,-1.2 0.23,-2.29 0.68,-3.24 1.33,-2.79 4.28,-4.6 7.51,-4.6 4.55,0 8.25,3.51 8.25,7.83 0,1.62 -1.38,2.94 -3.08,2.94s-3.08,-1.32 -3.08,-2.94c0,-1.07 -0.93,-1.94 -2.08,-1.94s-2.08,0.87 -2.08,1.94c0,1.71 0.66,3.31 1.87,4.51 0.95,0.94 1.86,1.46 3.27,1.85 0.27,0.07 0.42,0.35 0.35,0.61 -0.05,0.23 -0.26,0.38 -0.47,0.38z"
android:fillColor="#000000"/>
android:pathData="M7.3122,4.6691C8.6549,3.9318 10.2631,3.5 11.9979,3.5C13.7326,3.5 15.3409,3.9318 16.6835,4.6691C17.0466,4.8684 17.5026,4.7357 17.7019,4.3727C17.9013,4.0096 17.7686,3.5536 17.4055,3.3543C15.838,2.4935 13.9808,2 11.9979,2C10.0149,2 8.1578,2.4935 6.5902,3.3543C6.2271,3.5536 6.0944,4.0096 6.2938,4.3727C6.4932,4.7357 6.9491,4.8684 7.3122,4.6691ZM6.8614,14.8781C6.862,12.3662 9.0049,10.2292 11.9992,10.2292C14.9939,10.2292 17.137,12.3668 17.137,14.8791V15.0389C17.137,15.735 16.5727,16.2992 15.8767,16.2992C15.3591,16.2992 14.9045,15.9899 14.7153,15.5116L14.7142,15.509L14.0424,13.8294L14.0418,13.828C13.6244,12.7746 12.6064,12.0936 11.4861,12.0936C9.9616,12.0936 8.7258,13.3294 8.7258,14.8539C8.7258,16.4681 9.4592,18.005 10.7237,19.0147L10.7237,19.0147L10.7295,19.0192L11.1164,19.322C11.4426,19.5773 11.914,19.5198 12.1692,19.1936C12.4245,18.8674 12.367,18.396 12.0409,18.1408L11.657,17.8403C10.7531,17.1173 10.2258,16.0141 10.2258,14.8539C10.2258,14.1578 10.79,13.5936 11.4861,13.5936C11.9971,13.5936 12.459,13.9045 12.6475,14.3812L12.6486,14.3838L13.3204,16.0634L13.321,16.0649C13.7377,17.1165 14.7462,17.7992 15.8767,17.7992C17.4012,17.7992 18.637,16.5634 18.637,15.0389V14.8791C18.637,11.4364 15.7165,8.7292 11.9992,8.7292C8.2818,8.7292 5.3614,11.4364 5.3614,14.8791H6.1114C5.3614,14.8791 5.3614,14.8792 5.3614,14.8794L5.3614,14.8797L5.3614,14.8803L5.3614,14.882L5.3614,14.8865L5.3615,14.9002C5.3617,14.9114 5.3619,14.9268 5.3624,14.9459C5.3633,14.9842 5.365,15.0379 5.3684,15.1047C5.3752,15.2382 5.3885,15.4256 5.415,15.6487C5.4674,16.0908 5.5735,16.6934 5.7925,17.3028C5.9326,17.6926 6.3622,17.8951 6.752,17.755C7.1418,17.6149 7.3442,17.1853 7.2041,16.7955C7.0362,16.3283 6.9489,15.8459 6.9046,15.4721C6.8826,15.2873 6.8718,15.134 6.8665,15.0288C6.8638,14.9764 6.8625,14.9362 6.8619,14.9105L6.8615,14.8831L6.8614,14.8791H6.1114C6.8614,14.8791 6.8614,14.879 6.8614,14.8789V14.8781ZM11.9985,6.8631C9.2417,6.8631 6.9467,8.145 5.9123,9.8642C5.6987,10.2192 5.2379,10.3338 4.883,10.1202C4.528,9.9067 4.4134,9.4458 4.627,9.0909C5.9813,6.8401 8.8171,5.3631 11.9985,5.3631C15.18,5.3631 18.0157,6.8401 19.3701,9.0909C19.5836,9.4458 19.469,9.9067 19.1141,10.1202C18.7592,10.3338 18.2983,10.2192 18.0848,9.8642C17.0503,8.145 14.7553,6.8631 11.9985,6.8631ZM8.3064,19.0229C8.0034,18.7404 7.5288,18.7571 7.2463,19.06C6.9639,19.363 6.9805,19.8376 7.2835,20.12C8.5306,21.2828 10.182,22.0037 12.0005,22.0037C13.8189,22.0037 15.4703,21.2828 16.7175,20.12C17.0204,19.8376 17.037,19.363 16.7546,19.06C16.4721,18.7571 15.9975,18.7404 15.6946,19.0229C14.7044,19.9461 13.4119,20.5037 12.0005,20.5037C10.5891,20.5037 9.2965,19.9461 8.3064,19.0229Z"
android:fillColor="#000000"
android:fillType="evenOdd"/>
</vector>

View File

@@ -0,0 +1,97 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2018 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<com.google.android.setupdesign.GlifLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:icon="@drawable/ic_scan_32dp"
app:sudDescriptionText="@string/adb_wireless_qrcode_pairing_description">
<LinearLayout
style="@style/SudContentFrame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
android:id="@+id/camera_layout">
<FrameLayout
android:layout_width="@dimen/qrcode_preview_size"
android:layout_height="@dimen/qrcode_preview_size"
android:clipChildren="true">
<TextureView
android:id="@+id/preview_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"/>
<com.android.settings.wifi.qrcode.QrDecorateView
android:id="@+id/decorate_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"/>
</FrameLayout>
<TextView
android:id="@+id/error_message"
style="@style/TextAppearance.ErrorText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginStart="?attr/sudMarginStart"
android:layout_marginEnd="?attr/sudMarginEnd"
android:textAlignment="center"
android:visibility="invisible"/>
</LinearLayout>
<!--
The spinner indicating that the device is waiting for pairing
after getting valid QR code
-->
<LinearLayout
android:id="@+id/verifying_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
android:visibility="gone">
<ProgressBar
android:id="@+id/verifying_progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/verifying_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/adb_wireless_item_progress_text"
android:text="@string/adb_wireless_verifying_qrcode_text"
android:accessibilityLiveRegion="polite"/>
</LinearLayout>
</LinearLayout>
</com.google.android.setupdesign.GlifLayout>

View File

@@ -17,10 +17,11 @@
<com.google.android.setupdesign.GlifLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:theme="@style/GlifV3Theme"
android:icon="@drawable/ic_scan_32dp">
android:icon="@drawable/ic_scan_32dp"
app:sudDescriptionText="@string/adb_wireless_qrcode_pairing_description">
<LinearLayout
style="@style/SudContentFrame"
@@ -29,28 +30,12 @@
android:orientation="vertical"
android:gravity="center_horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center_horizontal"
android:id="@+id/camera_layout">
<TextView
android:id="@android:id/summary"
style="@style/TextAppearance.SudGlifBody"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="?attr/sudMarginStart"
android:layout_marginEnd="?attr/sudMarginEnd"
android:textAlignment="center"
android:accessibilityLiveRegion="polite"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
android:orientation="vertical"
android:id="@+id/camera_layout">
<FrameLayout
android:layout_width="wrap_content"
@@ -79,8 +64,6 @@
</LinearLayout>
</LinearLayout>
<!--
The spinner indicating that the device is waiting for pairing
after getting valid QR code
@@ -109,4 +92,5 @@
</LinearLayout>
</LinearLayout>
</com.google.android.setupdesign.GlifLayout>

View File

@@ -40,12 +40,14 @@
android:contentDescription="@string/battery_usage_chart"
android:textAppearance="?android:attr/textAppearanceSmall"
settings:textColor="?android:attr/textColorSecondary" />
<!-- Use non-scalable text size from text_size_small_material -->
<TextView
android:id="@+id/companion_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"/>
android:textColor="?android:attr/textColorSecondary"
android:textSize="14dp" />
</LinearLayout>

View File

@@ -14,16 +14,55 @@
limitations under the License.
-->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
<androidx.viewpager.widget.ViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="@dimen/color_mode_preview_height"
android:scaleType="centerCrop"
android:cropToPadding="true"
android:src="@drawable/color_mode_preview"
android:contentDescription="@null" />
android:layout_height="@dimen/color_mode_preview_height"/>
</FrameLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="48dp">
<FrameLayout
android:id="@+id/arrow_previous"
android:layout_width="wrap_content"
android:layout_height="48dp"
android:paddingLeft="24dp"
android:layout_gravity="center_vertical|left"
android:contentDescription="@string/previous_page_content_description">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center"
android:src="@drawable/ic_color_arrow_left_lt"/>
</FrameLayout>
<LinearLayout
android:id="@+id/viewGroup"
android:layout_width="fill_parent"
android:layout_height="48dp"
android:gravity="center"/>
<FrameLayout
android:id="@+id/arrow_next"
android:layout_width="wrap_content"
android:layout_height="48dp"
android:paddingRight="24dp"
android:layout_gravity="center_vertical|right"
android:contentDescription="@string/next_page_content_description">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center"
android:src="@drawable/ic_color_arrow_right_lt"/>
</FrameLayout>
</FrameLayout>
</LinearLayout>

View File

@@ -0,0 +1,39 @@
<?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.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:foregroundGravity="center_horizontal">
<ImageView
android:id="@+id/image1"
android:layout_width="match_parent"
android:layout_height="@dimen/color_mode_preview_height"
android:scaleType="centerCrop"
android:cropToPadding="true"
android:src="@drawable/color_mode_preview1"
android:contentDescription="@null" />
</FrameLayout>
</LinearLayout>

View File

@@ -0,0 +1,39 @@
<?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.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:foregroundGravity="center_horizontal">
<ImageView
android:id="@+id/image2"
android:layout_width="match_parent"
android:layout_height="@dimen/color_mode_preview_height"
android:scaleType="centerCrop"
android:cropToPadding="true"
android:src="@drawable/color_mode_preview2"
android:contentDescription="@null" />
</FrameLayout>
</LinearLayout>

View File

@@ -0,0 +1,39 @@
<?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.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:foregroundGravity="center_horizontal">
<ImageView
android:id="@+id/image3"
android:layout_width="match_parent"
android:layout_height="@dimen/color_mode_preview_height"
android:scaleType="centerCrop"
android:cropToPadding="true"
android:src="@drawable/color_mode_preview3"
android:contentDescription="@null" />
</FrameLayout>
</LinearLayout>

View File

@@ -16,6 +16,7 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
@@ -78,13 +79,27 @@
android:layout_height="1dp"
android:background="?android:attr/listDivider"/>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/notification_list_wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.android.settings.notification.history.NotificationHistoryRecyclerView
android:id="@+id/notification_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/notification_list"
android:clipChildren="true"
android:clipToPadding="true"
android:clipToOutline="true"
android:importantForAccessibility="yes"
android:scrollbars="none"/>
app:layout_constrainedHeight="true"
app:layout_constraintHeight_min="48dp"
app:layout_constraintHeight_max="500dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>

View File

@@ -37,9 +37,18 @@
android:textAppearance="?android:attr/textAppearanceListItem"
android:textColor="?android:attr/textColorPrimary" />
<TextView
android:id="@android:id/summary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@android:id/title"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textAlignment="viewStart"
android:textColor="?android:attr/textColorSecondary" />
<SeekBar
android:id="@*android:id/seekbar"
android:layout_below="@android:id/title"
android:layout_below="@android:id/summary"
android:layout_gravity="center_vertical"
android:layout_width="match_parent"
android:layout_height="48dp"

View File

@@ -26,7 +26,7 @@
android:id="@+id/illustration_lottie"
android:layout_width="match_parent"
android:layout_height="400dp"
android:scaleType="centerInside"
android:scaleType="fitCenter"
app:lottie_imageAssetsFolder="images"
app:lottie_autoPlay="true"
app:lottie_loop="true"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1179,14 +1179,24 @@
<item>Cached (empty)</item>
</string-array>
<!-- Array of color for sim color for multi-sim in light mode -->
<string-array name="sim_color_light">
<item>@color/SIM_color_cyan</item>
<item>@color/SIM_color_blue800</item>
<item>@color/SIM_color_green800</item>
<item>@color/SIM_color_purple800</item>
<item>@color/SIM_color_pink800</item>
<item>@color/SIM_color_orange</item>
</string-array>
<!-- Array of titles for sim color for multi-sim -->
<string-array name="color_picker">
<item>Teal</item>
<item>Cyan</item>
<item>Blue</item>
<item>Indigo</item>
<item>Green</item>
<item>Purple</item>
<item>Pink</item>
<item>Red</item>
<item>Orange</item>
</string-array>
<!-- Automatic storage management settings. The amount of days for the automatic storage manager

View File

@@ -184,13 +184,21 @@
<color name="SIM_color_pink">#ffc2185b</color> <!-- Material Pink 700 -->
<color name="SIM_color_red">#ffd32f2f</color> <!-- Material Red 700 -->
<!-- SIM colors updated for GAR -->
<color name="SIM_color_cyan">#ff006D74</color> <!-- Material Custom Cyan -->
<color name="SIM_color_blue800">#ff185ABC</color> <!-- Material Blue 800 -->
<color name="SIM_color_green800">#ff137333</color> <!-- Material Green 800 -->
<color name="SIM_color_purple800">#ff7627bb</color> <!-- Material Purple 800 -->
<color name="SIM_color_pink800">#ffb80672</color> <!-- Material Pink 800 -->
<color name="SIM_color_orange">#ff995400</color> <!-- Material Custom Orange -->
<!-- Dark mode SIM colors -->
<color name="SIM_dark_mode_color_teal">#ff80cbc4</color> <!-- Material Teal 200 -->
<color name="SIM_dark_mode_color_blue">#ff90caf9</color> <!-- Material Blue 200 -->
<color name="SIM_dark_mode_color_indigo">#ffc5cae9</color> <!-- Material Indigo 100 -->
<color name="SIM_dark_mode_color_purple">#ffe1bee7</color> <!-- Material Purple 100 -->
<color name="SIM_dark_mode_color_pink">#fff48fb1</color> <!-- Material Pink 200 -->
<color name="SIM_dark_mode_color_red">#ffef9a9a</color> <!-- Material Red 200 -->
<color name="SIM_dark_mode_color_cyan">#ff4DD0E1</color> <!-- Material Cyan 300 -->
<color name="SIM_dark_mode_color_blue">#ff8AB4F8</color> <!-- Material Blue 300 -->
<color name="SIM_dark_mode_color_green">#ff81C995</color> <!-- Material Green 300 -->
<color name="SIM_dark_mode_color_purple">#ffC58AF9</color> <!-- Material Purple 300 -->
<color name="SIM_dark_mode_color_pink">#ffff8bcb</color> <!-- Material Pink 300 -->
<color name="SIM_dark_mode_color_orange">#fffcad70</color> <!-- Material Orange 300 -->
<!-- Top app bar colors -->
<color name="color_surface_header">@*android:color/surface_header_light</color>

View File

@@ -437,7 +437,7 @@
<dimen name="chartview_text_padding">6dp</dimen>
<dimen name="chartview_divider_width">1dp</dimen>
<dimen name="chartview_divider_height">4dp</dimen>
<dimen name="chartview_trapezoid_radius">3dp</dimen>
<dimen name="chartview_trapezoid_radius">5dp</dimen>
<dimen name="chartview_trapezoid_margin_start">1dp</dimen>
<dimen name="chartview_trapezoid_margin_bottom">2dp</dimen>
</resources>

View File

@@ -726,6 +726,7 @@
<string name="security_dashboard_summary">Screen lock, Find My Device, app security</string>
<!-- Face enrollment and settings --><skip />
<!-- Note: Update FaceEnrollParentalConsent.CONSENT_STRING_RESOURCES when any _consent_ strings are added or removed. -->
<!-- Message shown in summary field when face unlock is set up. [CHAR LIMIT=40] -->
<string name="security_settings_face_preference_summary">Face added</string>
<!-- Message shown in summary field when Face Unlock is not set up. [CHAR LIMIT=54] -->
@@ -879,8 +880,12 @@
<string name="security_settings_face_settings_context_subtitle">Use Face Unlock to unlock your phone</string>
<!-- Fingerprint enrollment and settings --><skip />
<!-- Note: Update FingerprintEnrollParentalConsent.CONSENT_STRING_RESOURCES when any _consent_ strings are added or removed. -->
<!-- Title shown for menu item that launches fingerprint settings or enrollment [CHAR LIMIT=22] -->
<string name="security_settings_fingerprint_preference_title">Fingerprint</string>
<!-- Fingerprint enrollment and settings --><skip />
<!-- Title shown for work menu item that launches fingerprint settings or enrollment [CHAR LIMIT=22] -->
<string name="security_settings_work_fingerprint_preference_title">Fingerprint for work</string>
<!-- Fingerprint managment category title - configuration options for managing enrolled fingerprints [CHAR LIMIT=22] -->
<string name="fingerprint_manage_category_title">Manage fingerprints</string>
<!-- Fingerprint category title - configuration options for managing fingerprint enrollment [CHAR LIMIT=22] -->
@@ -1059,10 +1064,16 @@
<string name="security_settings_udfps_enroll_repeat_title_touch_icon">Follow the fingerprint icon</string>
<!-- Message shown in fingerprint enrollment dialog to repeat touching the fingerprint sensor [CHAR LIMIT=NONE] -->
<string name="security_settings_fingerprint_enroll_repeat_message">Keep lifting your finger to add the different parts of your fingerprint</string>
<!-- Message shown in fingerprint enrollment dialog to repeat touching the fingerprint sensor [CHAR LIMIT=NONE] -->
<string name="security_settings_udfps_enroll_repeat_message">Touch &amp; hold each time the fingerprint icon moves. This helps capture your full fingerprint.</string>
<!-- Message shown in fingerprint enrollment asking users to repeat touching the fingerprint sensor.-->
<string name="security_settings_udfps_enroll_repeat_a11y_message">This helps capture your full fingerprint</string>
<!-- Message shown in fingerprint enrollment dialog to repeat touching the fingerprint sensor [CHAR LIMIT=160] -->
<string name="security_settings_udfps_enroll_repeat_message">Touch &amp; hold each time the fingerprint icon moves. This helps capture more of your fingerprint.</string>
<!-- Title shown during fingerprint enrollment that instructs the user to enroll their fingertip [CHAR LIMIT=80] -->
<string name="security_settings_udfps_enroll_fingertip_title">Place the tip of your finger on the sensor</string>
<!-- Title shown during fingerprint enrollment that instructs the user to enroll the edges of their finger [CHAR LIMIT=80] -->
<string name="security_settings_udfps_enroll_edge_title">Finally, place the edges of your finger</string>
<!-- Message shown during fingerprint enrollment that instructs the user to enroll the edges of their finger [CHAR LIMIT=160] -->
<string name="security_settings_udfps_enroll_edge_message">Place the side of your fingerprint on the sensor and hold, then switch to the other side</string>
<!-- Message shown in fingerprint enrollment asking users to repeat touching the fingerprint sensor. [CHAR LIMIT=160] -->
<string name="security_settings_udfps_enroll_repeat_a11y_message">This helps capture more of your fingerprint</string>
<!-- Message read to a11y users when enrollment progress is made. The number is from 0 to 100. [CHAR LIMIT=NONE]-->
<string name="security_settings_udfps_enroll_progress_a11y_message">Enrolling fingerprint <xliff:g id="percentage" example="10">%d</xliff:g> percent</string>
<!-- Title shown in fingerprint enrollment dialog once enrollment is completed [CHAR LIMIT=29] -->
@@ -5196,7 +5207,7 @@
<string name="allow_bind_app_widget_activity_allow_bind_title">Create widget and allow access?</string>
<!-- Message in dialog that pops up when an app requests permission to bind a widget [CHAR LIMIT=NONE] -->
<string name="allow_bind_app_widget_activity_allow_bind">After you create the widget, <xliff:g id="widget_host_name">%1$s</xliff:g> can access all data it displays.</string>
<string name="allow_bind_app_widget_activity_allow_bind">After you create the widget, the application can access everything displayed.\n\nApplication: <xliff:g id="widget_host_name">%1$s</xliff:g>\nWidget: <xliff:g id="widget_label">%2$s</xliff:g>\n</string>
<!-- Text for checkbox that pops up when an app requests permission to bind a widget [CHAR LIMIT=NONE] -->
<string name="allow_bind_app_widget_activity_always_allow_bind">Always allow <xliff:g id="widget_host_name">%1$s</xliff:g> to create widgets and access their data</string>
@@ -6162,6 +6173,12 @@
<string name="battery_tip_limited_temporarily_title">Charging temporarily limited</string>
<!-- Summary for the battery limited temporarily tip [CHAR LIMIT=NONE] -->
<string name="battery_tip_limited_temporarily_summary">To preserve your battery. Learn more.</string>
<!-- Text of battery limited temporarily tip resume charge button. [CHAR LIMIT=NONE] -->
<string name="battery_tip_limited_temporarily_dialog_resume_charge">Resume charging</string>
<!-- Message of battery limited temporarily tip. [CHAR LIMIT=NONE] -->
<string name="battery_tip_limited_temporarily_dialog_msg" product="default">In certain conditions, like high temperatures and long charging periods, charging may be limited to <xliff:g id="percent" example="50%">%1$s</xliff:g> to help preserve battery health.\n\nWhen those conditions end, your phone will automatically charge normally.</string>
<!-- Message of battery limited temporarily tip. [CHAR LIMIT=NONE] -->
<string name="battery_tip_limited_temporarily_dialog_msg" product="tablet">In certain conditions, like high temperatures and long charging periods, charging may be limited to <xliff:g id="percent" example="50%">%1$s</xliff:g> to help preserve battery health.\n\nWhen those conditions end, your tablet will automatically charge normally.</string>
<!-- Message for battery tip dialog to show the status about the battery [CHAR LIMIT=NONE] -->
<string name="battery_tip_dialog_message" product="default">Because youve used your phone more than usual, your battery may run out sooner than it normally would.\n\nApps using most battery:</string>
<!-- Message for battery tip dialog to show the status about the battery [CHAR LIMIT=NONE] -->
@@ -6624,10 +6641,6 @@
<string name="battery_system_usage_for">System usage for <xliff:g id="slot">%s</xliff:g></string>
<!-- [CHAR_LIMIT=NONE] Battery app usage section header -->
<string name="battery_app_usage_for">App usage for <xliff:g id="slot">%s</xliff:g></string>
<!-- [CHAR_LIMIT=NONE] Battery usage section header for a specific time slot -->
<string name="battery_usage_time_am">am</string>
<!-- [CHAR_LIMIT=NONE] Battery usage section header for a specific time slot -->
<string name="battery_usage_time_pm">pm</string>
<!-- [CHAR_LIMIT=NONE] Battery usage item for total usage time less than a minute -->
<string name="battery_usage_total_less_than_one_minute">Total: less than a min</string>
<!-- [CHAR_LIMIT=NONE] Battery usage item for total background time less than a minute -->
@@ -7960,9 +7973,13 @@
<!-- Enhaced 4G LTE Mode title for carriers who want to show 4G Calling. [CHAR LIMIT=50] -->
<string name="enhanced_4g_lte_mode_title_4g_calling">4G Calling</string>
<!-- Enhaced 4G LTE Mode summary. [CHAR LIMIT=100] -->
<string name="enhanced_4g_lte_mode_summary">Use LTE services to improve voice and other communications (recommended)</string>
<string name="enhanced_4g_lte_mode_summary">Use LTE services to improve voice calls (recommended)</string>
<!-- Enhaced 4G LTE Mode summary for 4g calling. [CHAR LIMIT=100] -->
<string name="enhanced_4g_lte_mode_summary_4g_calling">Use 4G services to improve voice and other communications (recommended)</string>
<string name="enhanced_4g_lte_mode_summary_4g_calling">Use 4G services to improve voice calls (recommended)</string>
<!-- NR advanced calling(VoNR or Vo5G) title. [CHAR LIMIT=50] -->
<string name="nr_advanced_calling_title">Vo5G</string>
<!-- NR advanced calling(VoNR or Vo5G) summary. [CHAR LIMIT=NONE] -->
<string name="nr_advanced_calling_summary">Use 5G for voice calls</string>
<!-- Title of a preference determining whether or not the user has allowed the device to share
their contacts' phone numbers with their carrier in order to implement contact discovery,
which is a service that exchanges contacts with the carrier to determine if your
@@ -8357,6 +8374,9 @@
<!-- List of synonyms for the enhance 4G LTE titles, used to match in settings search [CHAR LIMIT=NONE] -->
<string name="keywords_enhance_4g_lte">volte, advanced calling, 4g calling</string>
<!-- List of synonyms for the NR advanced calling(VoNR or Vo5G) titles, used to match in settings search [CHAR LIMIT=NONE] -->
<string name="keywords_nr_advanced_calling">vo5g, vonr, advanced calling, 5g calling</string>
<!-- List of synonyms for add language, used to match in settings search [CHAR LIMIT=NONE] -->
<string name="keywords_add_language">add language, add a language</string>
@@ -9335,7 +9355,7 @@
<string name="notification_listener_security_warning_summary">
<xliff:g id="notification_listener_name">%1$s</xliff:g> will be able to read all notifications,
including personal information such as contact names and the text of messages you receive.
This app will also be able to dismiss notifications or take action on buttons in notifications, including answering phone calls.
This app will also be able to snooze or dismiss notifications or take action on buttons in notifications, including answering phone calls.
\n\nThis will also give the app the ability to turn Do Not Disturb on or off and change related settings.
</string>
<string name="notification_listener_disable_warning_summary">
@@ -13230,6 +13250,15 @@
<!-- Power menu explanation where to find prevent ringing option. [CHAR LIMIT=NONE] -->
<string name="power_menu_power_prevent_ringing_hint">Prevent ringing:\nShortcut available in the volume menu.</string>
<!-- Power menu title of the seekbar setting controlling duration of how long the power button must be held to invoke assistant. [CHAR LIMIT=NONE]-->
<string name="power_menu_long_press_for_assist_sensitivity_title">Press &amp; hold duration</string>
<!-- Power menu summary of the seekbar setting controlling duration of how long the power button must be held to invoke assistant. [CHAR LIMIT=NONE]-->
<string name="power_menu_long_press_for_assist_sensitivity_summary">Adjust sensitivity by choosing how long to press &amp; hold the power button</string>
<!-- Label at the lowest end of duration slider for long press power invocation of assistant. [CHAR LIMIT=30] -->
<string name="power_menu_long_press_for_assist_sensitivity_low_label">Short</string>
<!-- Label at the highest end of duration slider for long press power invocation of assistant. [CHAR LIMIT=30] -->
<string name="power_menu_long_press_for_assist_sensitivity_high_label">Long</string>
<!-- Wallet (formerly Cards and passes) toggle name [CHAR LIMIT=60] -->
<string name="lockscreen_privacy_wallet_setting_toggle">Show wallet</string>
<!-- Wallet (formerly Cards and passes) summary [CHAR LIMIT=NONE] -->
@@ -13333,8 +13362,6 @@
<string name="calls_sms_no_sim">No SIM</string>
<!-- Network & internet preferences title [CHAR LIMIT=NONE] -->
<string name="network_and_internet_preferences_title">Network preferences</string>
<!-- Network & internet preferences summary [CHAR LIMIT=NONE] -->
<string name="network_and_internet_preferences_summary">Connect to public networks</string>
<!-- Search keywords for "Internet" settings [CHAR_LIMIT=NONE] -->
<string name="keywords_internet">network connection, internet, wireless, data, wifi, wi-fi, wi fi, cellular, mobile, cell carrier, 4g, 3g, 2g, lte</string>
<!-- Slice title text for turning on the Wi-Fi networks. [CHAR LIMIT=40] -->
@@ -13367,8 +13394,10 @@
<string name="carrier_wifi_network_title">W+ network</string>
<!-- Provider Model: title of SIM category -->
<string name="sim_category_title">SIM</string>
<!-- Provider Model: title of Downloaded category. [CHAR LIMIT=50] -->
<!-- Provider Model: title of Downloaded SIM category. [CHAR LIMIT=50] -->
<string name="downloaded_sim_category_title">DOWNLOADED SIM</string>
<!-- Provider Model: title of Downloaded SIMs category. [CHAR LIMIT=50] -->
<string name="downloaded_sims_category_title">DOWNLOADED SIMS</string>
<!-- Provider Model: summary of Active in SIM category. [CHAR LIMIT=50] -->
<string name="sim_category_active_sim">Active</string>
<!-- Provider Model: summary of Inactive in SIM category. [CHAR LIMIT=50] -->
@@ -13552,6 +13581,15 @@
<!-- Summary for Game settings entry. [CHAR_LIMIT=NONE] -->
<string name="game_settings_summary">Turn on Game Dashboard shortcut, etc</string>
<!-- Content description of the previous button to bring user to the previous preview page. -->
<string name="previous_page_content_description">Previous</string>
<!-- Content description of the next button to bring user to the next preview page. -->
<string name="next_page_content_description">Next</string>
<!-- Content description of preview pager in colors preview -->
<string name="colors_viewpager_content_description">Color preview</string>
<!-- Bluetooth sim card permission alert for notification title [CHAR LIMIT=none] -->
<string name="bluetooth_sim_card_access_notification_title">SIM card access request</string>
<!-- Bluetooth sim card permission alert for notification content [CHAR LIMIT=none] -->

View File

@@ -42,7 +42,8 @@
<!-- Pairing methods category -->
<PreferenceCategory
android:key="adb_pairing_methods_category"
android:layout="@layout/preference_category_no_label">
android:layout="@layout/preference_category_no_label"
settings:allowDividerAbove="true">
<!-- qrcode scanner -->
<Preference
android:key="adb_pair_method_qrcode_pref"
@@ -52,6 +53,7 @@
settings:controller="com.android.settings.development.AdbQrCodePreferenceController"/>
<Preference
android:key="adb_pair_method_code_pref"
android:icon="@drawable/ic_password"
android:title="@string/adb_pair_method_code_title"
android:summary="@string/adb_pair_method_code_summary"/>
</PreferenceCategory>
@@ -59,7 +61,8 @@
<!-- Paired devices list -->
<PreferenceCategory
android:key="adb_paired_devices_category"
android:title="@string/adb_paired_devices_title"/>
android:title="@string/adb_paired_devices_title"
settings:allowDividerAbove="true"/>
<!-- Off message: Shown only in the off state -->
<PreferenceCategory

View File

@@ -65,6 +65,13 @@
android:icon="@drawable/ic_folder_vd_theme_24"
android:title="@string/bluetooth_show_files_received_via_bluetooth"/>
<SwitchPreference
android:key="uwb_settings"
android:title="@string/uwb_settings_title"
android:order="100"
android:summary="@string/summary_placeholder"
settings:controller="com.android.settings.uwb.UwbPreferenceController"/>
<PreferenceCategory
android:key="dashboard_tile_placeholder"
android:order="-8"/>

View File

@@ -241,6 +241,19 @@
settings:controller="com.android.settings.network.telephony.CarrierPreferenceController">
</Preference>
<SwitchPreference
android:key="enable_2g"
android:title="@string/enable_2g_title"
android:summary="@string/enable_2g_summary"
settings:controller="com.android.settings.network.telephony.Enable2gPreferenceController" />
<SwitchPreference
android:key="nr_advanced_calling"
android:title="@string/nr_advanced_calling_title"
android:persistent="false"
android:summary="@string/nr_advanced_calling_summary"
settings:keywords="@string/keywords_nr_advanced_calling"
settings:controller="com.android.settings.network.telephony.NrAdvancedCallingPreferenceController"/>
</PreferenceCategory>
<Preference
@@ -265,10 +278,4 @@
settings:allowDividerAbove="true"
settings:searchable="false"
settings:controller="com.android.settings.network.telephony.NrDisabledInDsdsFooterPreferenceController"/>
<SwitchPreference
android:key="enable_2g"
android:title="@string/enable_2g_title"
android:summary="@string/enable_2g_summary"
settings:controller="com.android.settings.network.telephony.Enable2gPreferenceController" />
</PreferenceScreen>

View File

@@ -70,7 +70,6 @@
<Preference
android:key="configure_wifi_settings"
android:title="@string/network_and_internet_preferences_title"
android:summary="@string/network_and_internet_preferences_summary"
settings:allowDividerAbove="true"
android:fragment="com.android.settings.wifi.ConfigureWifiSettings"/>

View File

@@ -24,9 +24,19 @@
settings:controller="com.android.settings.gestures.LongPressPowerButtonPreferenceController"
/>
<com.android.settings.widget.LabeledSeekBarPreference
android:key="gesture_power_menu_long_press_for_assist_sensitivity"
android:title="@string/power_menu_long_press_for_assist_sensitivity_title"
android:summary="@string/power_menu_long_press_for_assist_sensitivity_summary"
android:selectable="true"
settings:textStart="@string/power_menu_long_press_for_assist_sensitivity_low_label"
settings:textEnd="@string/power_menu_long_press_for_assist_sensitivity_high_label"
settings:controller="com.android.settings.gestures.LongPressPowerSensitivityPreferenceController"
/>
<com.android.settingslib.widget.FooterPreference
android:key="power_menu_power_volume_up_hint"
android:title="@string/power_menu_power_volume_up_hint"
android:selectable="false"
settings:searchable="false" />
settings:searchable="false"/>
</PreferenceScreen>

View File

@@ -155,7 +155,7 @@
<com.android.settingslib.RestrictedPreference
android:key="fingerprint_settings_profile"
android:title="@string/security_settings_fingerprint_preference_title"
android:title="@string/security_settings_work_fingerprint_preference_title"
android:summary="@string/summary_placeholder" />
<com.android.settingslib.RestrictedPreference

View File

@@ -22,7 +22,7 @@
android:title="@string/smart_battery_manager_title"
settings:keywords="@string/keywords_battery_adaptive_preferences">
<com.android.settingslib.widget.IllustrationPreferencee
<com.android.settingslib.widget.IllustrationPreference
android:key="auto_awesome_battery"
settings:lottie_rawRes="@raw/auto_awesome_battery_lottie" />

View File

@@ -19,6 +19,7 @@ package com.android.settings;
import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProviderInfo;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
@@ -122,9 +123,12 @@ public class AllowBindAppWidgetActivity extends AlertActivity implements
return;
}
}
mAppWidgetManager = AppWidgetManager.getInstance(this);
final String widgetLabel = getWidgetLabel();
AlertController.AlertParams ap = mAlertParams;
ap.mTitle = getString(R.string.allow_bind_app_widget_activity_allow_bind_title);
ap.mMessage = getString(R.string.allow_bind_app_widget_activity_allow_bind, label);
ap.mMessage = getString(R.string.allow_bind_app_widget_activity_allow_bind, label,
widgetLabel);
ap.mPositiveButtonText = getString(R.string.create);
ap.mNegativeButtonText = getString(android.R.string.cancel);
ap.mPositiveButtonListener = this;
@@ -133,18 +137,30 @@ public class AllowBindAppWidgetActivity extends AlertActivity implements
(LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
ap.mView = inflater.inflate(com.android.internal.R.layout.always_use_checkbox, null);
mAlwaysUse = (CheckBox) ap.mView.findViewById(com.android.internal.R.id.alwaysUse);
mAlwaysUse.setText(getString(R.string.allow_bind_app_widget_activity_always_allow_bind, label));
mAlwaysUse.setText(
getString(R.string.allow_bind_app_widget_activity_always_allow_bind, label));
mAlwaysUse.setPadding(mAlwaysUse.getPaddingLeft(),
mAlwaysUse.getPaddingTop(),
mAlwaysUse.getPaddingRight(),
(int) (mAlwaysUse.getPaddingBottom() +
getResources().getDimension(R.dimen.bind_app_widget_dialog_checkbox_bottom_padding)));
getResources().getDimension(
R.dimen.bind_app_widget_dialog_checkbox_bottom_padding)));
mAppWidgetManager = AppWidgetManager.getInstance(this);
mAlwaysUse.setChecked(mAppWidgetManager.hasBindAppWidgetPermission(mCallingPackage,
mProfile.getIdentifier()));
setupAlert();
}
private String getWidgetLabel() {
String label = "";
for (AppWidgetProviderInfo providerInfo : mAppWidgetManager.getInstalledProviders()) {
if (providerInfo.provider.equals(mComponentName)) {
label = providerInfo.loadLabel(getPackageManager());
break;
}
}
return label;
}
}

View File

@@ -90,6 +90,8 @@ public class Settings extends SettingsActivity {
public static class WifiSettingsActivity extends SettingsActivity { /* empty */ }
public static class WifiSettings2Activity extends SettingsActivity { /* empty */ }
public static class NetworkProviderSettingsActivity extends SettingsActivity { /* empty */ }
/** Activity for the Wi-Fi network details settings. */
public static class WifiDetailsSettingsActivity extends SettingsActivity { /* empty */ }
public static class WifiP2pSettingsActivity extends SettingsActivity { /* empty */ }
public static class AvailableVirtualKeyboardActivity extends SettingsActivity { /* empty */ }
public static class KeyboardLayoutPickerActivity extends SettingsActivity { /* empty */ }

View File

@@ -55,6 +55,7 @@ import com.android.settings.core.FeatureFlags;
import com.android.settings.datausage.DataSaverBackend;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.wifi.tether.WifiTetherPreferenceController;
import com.android.settingslib.RestrictedLockUtils;
import com.android.settingslib.RestrictedSwitchPreference;
import com.android.settingslib.TetherUtil;
import com.android.settingslib.search.SearchIndexable;
@@ -425,14 +426,16 @@ public class TetherSettings extends RestrictedSettingsFragment
private void updateUsbPreference() {
boolean usbAvailable = mUsbConnected && !mMassStorageActive;
final RestrictedLockUtils.EnforcedAdmin enforcedAdmin =
checkIfUsbDataSignalingIsDisabled(mContext, UserHandle.myUserId());
if (usbAvailable) {
if (enforcedAdmin != null) {
mUsbTether.setDisabledByAdmin(enforcedAdmin);
} else if (usbAvailable) {
mUsbTether.setEnabled(!mDataSaverEnabled);
} else {
mUsbTether.setEnabled(false);
}
mUsbTether.setDisabledByAdmin(
checkIfUsbDataSignalingIsDisabled(mContext, UserHandle.myUserId()));
}
@VisibleForTesting

View File

@@ -226,7 +226,8 @@ public class AppButtonsPreferenceController extends BasePreferenceController imp
uninstallDaIntent.putExtra(DeviceAdminAdd.EXTRA_DEVICE_ADMIN_PACKAGE_NAME,
packageName);
mMetricsFeatureProvider.action(mActivity,
SettingsEnums.ACTION_SETTINGS_UNINSTALL_DEVICE_ADMIN);
SettingsEnums.ACTION_SETTINGS_UNINSTALL_DEVICE_ADMIN,
getPackageNameForMetric());
mFragment.startActivityForResult(uninstallDaIntent, mRequestRemoveDeviceAdmin);
return;
}
@@ -253,7 +254,8 @@ public class AppButtonsPreferenceController extends BasePreferenceController imp
mActivity,
mAppEntry.info.enabled
? SettingsEnums.ACTION_SETTINGS_DISABLE_APP
: SettingsEnums.ACTION_SETTINGS_ENABLE_APP);
: SettingsEnums.ACTION_SETTINGS_ENABLE_APP,
getPackageNameForMetric());
AsyncTask.execute(new DisableChangerRunnable(mPm, mAppEntry.info.packageName,
PackageManager.COMPONENT_ENABLED_STATE_DEFAULT));
}
@@ -270,7 +272,9 @@ public class AppButtonsPreferenceController extends BasePreferenceController imp
@Override
public void onClick(View v) {
mMetricsFeatureProvider.action(
mActivity, SettingsEnums.ACTION_APP_INFO_FORCE_STOP);
mActivity,
SettingsEnums.ACTION_APP_INFO_FORCE_STOP,
getPackageNameForMetric());
// force stop
if (mPm.isPackageStateProtected(mAppEntry.info.packageName, mUserId)) {
RestrictedLockUtils.sendShowAdminSupportDetailsIntent(mActivity,
@@ -757,6 +761,14 @@ public class AppButtonsPreferenceController extends BasePreferenceController imp
|| AppUtils.isMainlineModule(mPm, mAppEntry.info.packageName));
}
private String getPackageNameForMetric() {
final String packageName =
mAppEntry != null && mAppEntry.info != null
? mAppEntry.info.packageName
: null;
return packageName != null ? packageName : "";
}
/**
* Changes the status of disable/enable for a package
*/

View File

@@ -173,7 +173,7 @@ public class NotificationAccessDetails extends DashboardFragment {
getActivity(), UserManager.DISALLOW_APPS_CONTROL, mUserId);
if (!refreshUi()) {
setIntentAndFinish(true /* appChanged */);
finish();
}
Preference apps = getPreferenceScreen().findPreference(
use(BridgedAppsLinkPreferenceController.class).getPreferenceKey());
@@ -197,14 +197,6 @@ public class NotificationAccessDetails extends DashboardFragment {
}
}
protected void setIntentAndFinish(boolean appChanged) {
Log.i(TAG, "appChanged=" + appChanged);
Intent intent = new Intent();
intent.putExtra(ManageApplications.APP_CHG, appChanged);
SettingsActivity sa = (SettingsActivity) getActivity();
sa.finishPreferencePanel(Activity.RESULT_OK, intent);
}
protected void retrieveAppEntry() {
final Bundle args = getArguments();
mPackageName = (args != null) ? args.getString(ARG_PACKAGE_NAME) : null;
@@ -228,7 +220,7 @@ public class NotificationAccessDetails extends DashboardFragment {
PackageManager.GET_SIGNING_CERTIFICATES |
PackageManager.GET_PERMISSIONS, mUserId);
} catch (PackageManager.NameNotFoundException e) {
Log.e(TAG, "Exception when retrieving package:" + mPackageName, e);
// oh well
}
}

View File

@@ -53,10 +53,11 @@ public class ZenAccessDetails extends AppInfoWithHeader implements
// If this app didn't declare this permission in their manifest, don't bother showing UI.
final Set<String> needAccessApps =
ZenAccessController.getPackagesRequestingNotificationPolicyAccess();
if (!needAccessApps.contains(mPackageName)) {
return false;
}
if (needAccessApps.contains(mPackageName)) {
updatePreference(context, findPreference(SWITCH_PREF_KEY));
} else {
finish();
}
return true;
}

View File

@@ -48,6 +48,10 @@ public class ParentalConsentHelper {
private static final String KEY_FINGERPRINT_CONSENT = "fingerprint";
private static final String KEY_IRIS_CONSENT = "iris";
private static final String KEY_FACE_CONSENT_STRINGS = "face_strings";
private static final String KEY_FINGERPRINT_CONSENT_STRINGS = "fingerprint_strings";
private static final String KEY_IRIS_CONSENT_STRINGS = "iris_strings";
private final boolean mRequireFace;
private final boolean mRequireFingerprint;
@@ -152,9 +156,14 @@ public class ParentalConsentHelper {
public Bundle getConsentResult() {
final Bundle result = new Bundle();
result.putBoolean(KEY_FACE_CONSENT, mConsentFace != null ? mConsentFace : false);
result.putIntArray(KEY_FACE_CONSENT_STRINGS,
FaceEnrollParentalConsent.CONSENT_STRING_RESOURCES);
result.putBoolean(KEY_FINGERPRINT_CONSENT,
mConsentFingerprint != null ? mConsentFingerprint : false);
result.putIntArray(KEY_FINGERPRINT_CONSENT_STRINGS,
FingerprintEnrollParentalConsent.CONSENT_STRING_RESOURCES);
result.putBoolean(KEY_IRIS_CONSENT, false);
result.putIntArray(KEY_IRIS_CONSENT_STRINGS, new int[0]);
return result;
}

View File

@@ -86,4 +86,9 @@ public class BiometricSettingsAppPreferenceController extends TogglePreferenceCo
return AVAILABLE_UNSEARCHABLE;
}
}
@Override
public final boolean isSliceable() {
return false;
}
}

View File

@@ -68,4 +68,9 @@ public class BiometricSettingsKeyguardPreferenceController extends TogglePrefere
}
return getRestrictingAdmin() != null ? DISABLED_FOR_USER : AVAILABLE;
}
@Override
public final boolean isSliceable() {
return false;
}
}

View File

@@ -33,6 +33,21 @@ import com.android.settings.R;
*/
public class FaceEnrollParentalConsent extends FaceEnrollIntroduction {
/**
* List of string resources to log when recording the result of this activity in gms.
* This must be updated when any strings are added/removed.
*/
public static final int[] CONSENT_STRING_RESOURCES = new int[] {
R.string.security_settings_face_enroll_consent_introduction_title,
R.string.security_settings_face_enroll_introduction_consent_message,
R.string.security_settings_face_enroll_introduction_info_consent_glasses,
R.string.security_settings_face_enroll_introduction_info_consent_looking,
R.string.security_settings_face_enroll_introduction_info_consent_gaze,
R.string.security_settings_face_enroll_introduction_how_consent_message,
R.string.security_settings_face_enroll_introduction_control_consent_title,
R.string.security_settings_face_enroll_introduction_control_consent_message
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

View File

@@ -44,7 +44,6 @@ import com.android.settings.overlay.FeatureFactory;
import com.android.settings.password.ChooseLockSettingsHelper;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.search.SearchIndexable;
import java.util.ArrayList;
@@ -290,7 +289,7 @@ public class FaceSettings extends DashboardFragment {
if (!isFaceHardwareDetected(context)) {
return null;
}
mControllers = buildPreferenceControllers(context, getSettingsLifecycle());
mControllers = buildPreferenceControllers(context);
// There's no great way of doing this right now :/
for (AbstractPreferenceController controller : mControllers) {
if (controller instanceof FaceSettingsAttentionPreferenceController) {
@@ -309,8 +308,7 @@ public class FaceSettings extends DashboardFragment {
return mControllers;
}
private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,
Lifecycle lifecycle) {
private static List<AbstractPreferenceController> buildPreferenceControllers(Context context) {
final List<AbstractPreferenceController> controllers = new ArrayList<>();
controllers.add(new FaceSettingsKeyguardPreferenceController(context));
controllers.add(new FaceSettingsAppPreferenceController(context));
@@ -328,7 +326,7 @@ public class FaceSettings extends DashboardFragment {
public List<AbstractPreferenceController> createPreferenceControllers(
Context context) {
if (isFaceHardwareDetected(context)) {
return buildPreferenceControllers(context, null /* lifecycle */);
return buildPreferenceControllers(context);
} else {
return null;
}

View File

@@ -116,11 +116,6 @@ public class FaceSettingsAttentionPreferenceController extends FaceSettingsPrefe
return true;
}
@Override
public boolean isSliceable() {
return false;
}
@Override
public int getAvailabilityStatus() {
return AVAILABLE;

View File

@@ -46,4 +46,9 @@ public abstract class FaceSettingsPreferenceController extends TogglePreferenceC
return RestrictedLockUtilsInternal.checkIfKeyguardFeaturesDisabled(
mContext, DevicePolicyManager.KEYGUARD_DISABLE_FACE, mUserId);
}
@Override
public final boolean isSliceable() {
return false;
}
}

View File

@@ -46,6 +46,7 @@ import android.view.animation.Interpolator;
import android.widget.ProgressBar;
import android.widget.TextView;
import androidx.annotation.IntDef;
import androidx.appcompat.app.AlertDialog;
import com.android.settings.R;
@@ -58,6 +59,8 @@ import com.google.android.setupcompat.template.FooterBarMixin;
import com.google.android.setupcompat.template.FooterButton;
import com.google.android.setupcompat.util.WizardManagerHelper;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.List;
/**
@@ -69,11 +72,16 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
static final String TAG_SIDECAR = "sidecar";
private static final int PROGRESS_BAR_MAX = 10000;
private static final int FINISH_DELAY = 250;
/**
* Enroll with two center touches before going to guided enrollment.
*/
private static final int NUM_CENTER_TOUCHES = 2;
private static final int STAGE_UNKNOWN = -1;
private static final int STAGE_CENTER = 0;
private static final int STAGE_GUIDED = 1;
private static final int STAGE_FINGERTIP = 2;
private static final int STAGE_EDGES = 3;
@IntDef({STAGE_UNKNOWN, STAGE_CENTER, STAGE_GUIDED, STAGE_FINGERTIP, STAGE_EDGES})
@Retention(RetentionPolicy.SOURCE)
private @interface EnrollStage {}
/**
* If we don't see progress during this time, we show an error message to remind the users that
@@ -100,6 +108,7 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
.setUsage(AudioAttributes.USAGE_ASSISTANCE_SONIFICATION)
.build();
private FingerprintManager mFingerprintManager;
private boolean mCanAssumeUdfps;
@Nullable private ProgressBar mProgressBar;
private ObjectAnimator mProgressAnim;
@@ -125,9 +134,9 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final FingerprintManager fingerprintManager = getSystemService(FingerprintManager.class);
mFingerprintManager = getSystemService(FingerprintManager.class);
final List<FingerprintSensorPropertiesInternal> props =
fingerprintManager.getSensorPropertiesInternal();
mFingerprintManager.getSensorPropertiesInternal();
mCanAssumeUdfps = props.size() == 1 && props.get(0).isAnyUdfpsType();
mAccessibilityManager = getSystemService(AccessibilityManager.class);
@@ -149,7 +158,7 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
mIsSetupWizard = WizardManagerHelper.isAnySetupWizard(getIntent());
if (mCanAssumeUdfps) {
updateTitleAndDescription();
updateTitleAndDescriptionForUdfps();
} else {
setHeaderText(R.string.security_settings_fingerprint_enroll_repeat_title);
}
@@ -273,7 +282,7 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
// UDFPS animations are owned by SystemUI
if (progress >= PROGRESS_BAR_MAX) {
// Wait for any animations in SysUI to finish, then proceed to next page
getMainThreadHandler().postDelayed(mDelayedFinishRunnable, FINISH_DELAY);
getMainThreadHandler().postDelayed(mDelayedFinishRunnable, getFinishDelay());
}
return;
}
@@ -300,8 +309,55 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
}
private void updateTitleAndDescription() {
if (mSidecar == null || mSidecar.getEnrollmentSteps() == -1) {
if (mCanAssumeUdfps) {
updateTitleAndDescriptionForUdfps();
return;
}
if (mSidecar == null || mSidecar.getEnrollmentSteps() == -1) {
setDescriptionText(R.string.security_settings_fingerprint_enroll_start_message);
} else {
setDescriptionText(R.string.security_settings_fingerprint_enroll_repeat_message);
}
}
private void updateTitleAndDescriptionForUdfps() {
switch (getCurrentStage()) {
case STAGE_CENTER:
setHeaderText(R.string.security_settings_fingerprint_enroll_repeat_title);
setDescriptionText(R.string.security_settings_udfps_enroll_start_message);
break;
case STAGE_GUIDED:
setHeaderText(R.string.security_settings_fingerprint_enroll_repeat_title);
if (mIsAccessibilityEnabled) {
setDescriptionText(R.string.security_settings_udfps_enroll_repeat_a11y_message);
} else {
setDescriptionText(R.string.security_settings_udfps_enroll_repeat_message);
}
break;
case STAGE_FINGERTIP:
setHeaderText(R.string.security_settings_udfps_enroll_fingertip_title);
if (isStageHalfCompleted()) {
setDescriptionText(R.string.security_settings_fingerprint_enroll_repeat_title);
} else {
setDescriptionText("");
}
break;
case STAGE_EDGES:
setHeaderText(R.string.security_settings_udfps_enroll_edge_title);
if (isStageHalfCompleted()) {
setDescriptionText(
R.string.security_settings_fingerprint_enroll_repeat_message);
} else {
setDescriptionText(R.string.security_settings_udfps_enroll_edge_message);
}
break;
case STAGE_UNKNOWN:
default:
// setHeaderText(R.string.security_settings_fingerprint_enroll_udfps_title);
// Don't use BiometricEnrollBase#setHeaderText, since that invokes setTitle,
// which gets announced for a11y upon entering the page. For UDFPS, we want to
@@ -309,41 +365,61 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
getLayout().setHeaderText(
R.string.security_settings_fingerprint_enroll_udfps_title);
setDescriptionText(R.string.security_settings_udfps_enroll_start_message);
final CharSequence description = getString(
R.string.security_settings_udfps_enroll_a11y);
getLayout().getHeaderTextView().setContentDescription(description);
setTitle(description);
} else {
setDescriptionText(R.string.security_settings_fingerprint_enroll_start_message);
}
} else if (mCanAssumeUdfps && !isCenterEnrollmentComplete()) {
if (mIsSetupWizard) {
setHeaderText(R.string.security_settings_udfps_enroll_title_one_more_time);
} else {
setHeaderText(R.string.security_settings_fingerprint_enroll_repeat_title);
}
setDescriptionText(R.string.security_settings_udfps_enroll_start_message);
} else {
if (mCanAssumeUdfps) {
setHeaderText(R.string.security_settings_fingerprint_enroll_repeat_title);
if (mIsAccessibilityEnabled) {
setDescriptionText(R.string.security_settings_udfps_enroll_repeat_a11y_message);
} else {
setDescriptionText(R.string.security_settings_udfps_enroll_repeat_message);
}
} else {
setDescriptionText(R.string.security_settings_fingerprint_enroll_repeat_message);
}
break;
}
}
private boolean isCenterEnrollmentComplete() {
@EnrollStage
private int getCurrentStage() {
if (mSidecar == null || mSidecar.getEnrollmentSteps() == -1) {
return STAGE_UNKNOWN;
}
final int progressSteps = mSidecar.getEnrollmentSteps() - mSidecar.getEnrollmentRemaining();
if (progressSteps < getStageThresholdSteps(0)) {
return STAGE_CENTER;
} else if (progressSteps < getStageThresholdSteps(1)) {
return STAGE_GUIDED;
} else if (progressSteps < getStageThresholdSteps(2)) {
return STAGE_FINGERTIP;
} else {
return STAGE_EDGES;
}
}
private boolean isStageHalfCompleted() {
// Prior to first enrollment step.
if (mSidecar == null || mSidecar.getEnrollmentSteps() == -1) {
return false;
}
final int stepsEnrolled = mSidecar.getEnrollmentSteps() - mSidecar.getEnrollmentRemaining();
return stepsEnrolled >= NUM_CENTER_TOUCHES;
final int progressSteps = mSidecar.getEnrollmentSteps() - mSidecar.getEnrollmentRemaining();
int prevThresholdSteps = 0;
for (int i = 0; i < mFingerprintManager.getEnrollStageCount(); i++) {
final int thresholdSteps = getStageThresholdSteps(i);
if (progressSteps >= prevThresholdSteps && progressSteps < thresholdSteps) {
final int adjustedProgress = progressSteps - prevThresholdSteps;
final int adjustedThreshold = thresholdSteps - prevThresholdSteps;
return adjustedProgress >= adjustedThreshold / 2;
}
prevThresholdSteps = thresholdSteps;
}
// After last enrollment step.
return true;
}
private int getStageThresholdSteps(int index) {
if (mSidecar == null || mSidecar.getEnrollmentSteps() == -1) {
Log.w(TAG, "getStageThresholdSteps: Enrollment not started yet");
return 1;
}
return Math.round(mSidecar.getEnrollmentSteps()
* mFingerprintManager.getEnrollStageThreshold(index));
}
@Override
@@ -489,9 +565,8 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
mOrientationEventListener = null;
}
private final Animator.AnimatorListener mProgressAnimationListener
= new Animator.AnimatorListener() {
private final Animator.AnimatorListener mProgressAnimationListener =
new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) { }
@@ -501,7 +576,7 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
@Override
public void onAnimationEnd(Animator animation) {
if (mProgressBar.getProgress() >= PROGRESS_BAR_MAX) {
mProgressBar.postDelayed(mDelayedFinishRunnable, FINISH_DELAY);
mProgressBar.postDelayed(mDelayedFinishRunnable, getFinishDelay());
}
}
@@ -509,6 +584,10 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
public void onAnimationCancel(Animator animation) { }
};
private long getFinishDelay() {
return mCanAssumeUdfps ? 400L : 250L;
}
// Give the user a chance to see progress completed before jumping to the next stage.
private final Runnable mDelayedFinishRunnable = new Runnable() {
@Override

View File

@@ -22,11 +22,9 @@ import android.hardware.fingerprint.FingerprintManager;
import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
import android.os.Bundle;
import android.view.View;
import android.view.accessibility.AccessibilityManager;
import androidx.annotation.Nullable;
import com.airbnb.lottie.LottieAnimationView;
import com.android.settings.R;
import com.android.settings.Utils;
import com.android.settings.biometrics.BiometricEnrollBase;
@@ -82,13 +80,6 @@ public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements
.setTheme(R.style.SudGlifButton_Primary)
.build()
);
LottieAnimationView lottieAnimationView = findViewById(R.id.illustration_lottie);
AccessibilityManager am = getSystemService(AccessibilityManager.class);
if (am.isEnabled()) {
lottieAnimationView.setAnimation(R.raw.udfps_edu_a11y_lottie);
}
} else {
setHeaderText(R.string.security_settings_fingerprint_enroll_find_sensor_title);
setDescriptionText(R.string.security_settings_fingerprint_enroll_find_sensor_message);

View File

@@ -33,6 +33,20 @@ import com.android.settings.R;
*/
public class FingerprintEnrollParentalConsent extends FingerprintEnrollIntroduction {
/**
* List of string resources to log when recording the result of this activity in gms.
* This must be updated when any strings are added/removed.
*/
public static final int[] CONSENT_STRING_RESOURCES = new int[] {
R.string.security_settings_fingerprint_enroll_consent_introduction_title,
R.string.security_settings_fingerprint_enroll_introduction_consent_message,
R.string.security_settings_fingerprint_enroll_introduction_footer_title_consent_1,
R.string.security_settings_fingerprint_v2_enroll_introduction_footer_message_consent_2,
R.string.security_settings_fingerprint_v2_enroll_introduction_footer_message_consent_3,
R.string.security_settings_fingerprint_v2_enroll_introduction_footer_message_consent_4,
R.string.security_settings_fingerprint_v2_enroll_introduction_footer_message_consent_5
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

View File

@@ -103,8 +103,10 @@ public class AdvancedBluetoothDetailsHeaderController extends BasePreferenceCont
new BluetoothAdapter.OnMetadataChangedListener() {
@Override
public void onMetadataChanged(BluetoothDevice device, int key, byte[] value) {
Log.i(TAG, String.format("Metadata updated in Device %s: %d = %s.", device, key,
value == null ? null : new String(value)));
if (DEBUG) {
Log.d(TAG, String.format("Metadata updated in Device %s: %d = %s.", device,
key, value == null ? null : new String(value)));
}
refresh();
}
};

View File

@@ -198,8 +198,9 @@ public class UsbDefaultFragment extends RadioButtonPickerFragment {
@Override
public void onTetheringStarted() {
Log.d(TAG, "onTetheringStarted()");
// Set default usb functions again to make internal data persistent
mCurrentFunctions = mUsbBackend.getCurrentFunctions();
Log.d(TAG, "onTetheringStarted() : mCurrentFunctions " + mCurrentFunctions);
mUsbBackend.setDefaultUsbFunctions(mCurrentFunctions);
}

View File

@@ -160,6 +160,7 @@ import com.android.settings.wifi.WifiInfo;
import com.android.settings.wifi.WifiSettings;
import com.android.settings.wifi.calling.WifiCallingDisclaimerFragment;
import com.android.settings.wifi.calling.WifiCallingSettings;
import com.android.settings.wifi.details.WifiNetworkDetailsFragment;
import com.android.settings.wifi.p2p.WifiP2pSettings;
import com.android.settings.wifi.savedaccesspoints2.SavedAccessPointsWifiSettings2;
import com.android.settings.wifi.tether.WifiTetherSettings;
@@ -174,6 +175,7 @@ public class SettingsGateway {
AdvancedConnectedDeviceDashboardFragment.class.getName(),
CreateShortcut.class.getName(),
WifiSettings.class.getName(),
WifiNetworkDetailsFragment.class.getName(),
ConfigureWifiSettings.class.getName(),
SavedAccessPointsWifiSettings2.class.getName(),
AllInOneTetherSettings.class.getName(),

View File

@@ -0,0 +1,75 @@
/*
* 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.development;
import android.app.settings.SettingsEnums;
import android.content.Intent;
import android.os.Bundle;
import androidx.fragment.app.FragmentTransaction;
import com.android.settings.R;
import com.android.settings.wifi.dpp.WifiDppBaseActivity;
/**
* To scan an ADB QR code to pair a device.
*
* To use intent action {@code ACTION_ADB_QR_CODE_SCANNER}.
*/
public class AdbQrCodeActivity extends WifiDppBaseActivity {
private static final String TAG = "AdbQrCodeActivity";
static final String TAG_FRAGMENT_ADB_QR_CODE_SCANNER = "adb_qr_code_scanner_fragment";
public static final String ACTION_ADB_QR_CODE_SCANNER =
"android.settings.ADB_QR_CODE_SCANNER";
@Override
public int getMetricsCategory() {
return SettingsEnums.SETTINGS_ADB_WIRELESS;
}
@Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
AdbQrcodeScannerFragment fragment =
(AdbQrcodeScannerFragment) mFragmentManager.findFragmentByTag(
TAG_FRAGMENT_ADB_QR_CODE_SCANNER);
if (fragment == null) {
fragment = new AdbQrcodeScannerFragment();
} else {
if (fragment.isVisible()) {
return;
}
// When the fragment in back stack but not on top of the stack, we can simply pop
// stack because current fragment transactions are arranged in an order
mFragmentManager.popBackStackImmediate();
return;
}
final FragmentTransaction fragmentTransaction = mFragmentManager.beginTransaction();
fragmentTransaction.replace(R.id.fragment_container, fragment,
TAG_FRAGMENT_ADB_QR_CODE_SCANNER);
fragmentTransaction.commit();
}
@Override
protected void handleIntent(Intent intent) {
}
}

View File

@@ -16,8 +16,8 @@
package com.android.settings.development;
import android.app.settings.SettingsEnums;
import android.content.Context;
import android.content.Intent;
import android.debug.IAdbManager;
import android.os.RemoteException;
import android.os.ServiceManager;
@@ -28,7 +28,6 @@ import androidx.fragment.app.Fragment;
import androidx.preference.Preference;
import com.android.settings.core.BasePreferenceController;
import com.android.settings.core.SubSettingLauncher;
/**
* Controller for the "Pair device with QR code" preference in the Wireless debugging
@@ -68,12 +67,9 @@ public class AdbQrCodePreferenceController extends BasePreferenceController {
return false;
}
new SubSettingLauncher(preference.getContext())
.setDestination(AdbQrcodeScannerFragment.class.getName())
.setSourceMetricsCategory(SettingsEnums.SETTINGS_ADB_WIRELESS)
.setResultListener(mParentFragment,
WirelessDebuggingFragment.PAIRING_DEVICE_REQUEST)
.launch();
final Intent intent = new Intent(mContext, AdbQrCodeActivity.class);
mParentFragment.startActivityForResult(intent,
WirelessDebuggingFragment.PAIRING_DEVICE_REQUEST);
return true;
}
}

View File

@@ -44,12 +44,15 @@ import android.widget.TextView;
import androidx.annotation.StringRes;
import com.android.settings.R;
import com.android.settings.SetupWizardUtils;
import com.android.settings.wifi.dpp.AdbQrCode;
import com.android.settings.wifi.dpp.WifiDppQrCodeBaseFragment;
import com.android.settings.wifi.dpp.WifiNetworkConfig;
import com.android.settings.wifi.qrcode.QrCamera;
import com.android.settings.wifi.qrcode.QrDecorateView;
import com.google.android.setupdesign.util.ThemeHelper;
/**
* Fragment shown when clicking on the "Pair by QR code" preference in
* the Wireless Debugging fragment.
@@ -144,6 +147,9 @@ public class AdbQrcodeScannerFragment extends WifiDppQrCodeBaseFragment implemen
@Override
public void onCreate(Bundle savedInstanceState) {
Context context = getContext();
context.setTheme(SetupWizardUtils.getTheme(context, getActivity().getIntent()));
ThemeHelper.trySetDynamicColor(getContext());
super.onCreate(savedInstanceState);
mIntentFilter = new IntentFilter(AdbManager.WIRELESS_DEBUG_PAIRING_RESULT_ACTION);
@@ -158,6 +164,7 @@ public class AdbQrcodeScannerFragment extends WifiDppQrCodeBaseFragment implemen
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mSummary = view.findViewById(R.id.sud_layout_subtitle);
mTextureView = (TextureView) view.findViewById(R.id.preview_view);
mTextureView.setSurfaceTextureListener(this);
@@ -165,8 +172,6 @@ public class AdbQrcodeScannerFragment extends WifiDppQrCodeBaseFragment implemen
mDecorateView = view.findViewById(R.id.decorate_view);
setProgressBarShown(false);
setHeaderIconImageResource(R.drawable.ic_scan_24dp);
mQrCameraView = view.findViewById(R.id.camera_layout);
mVerifyingView = view.findViewById(R.id.verifying_layout);
mVerifyingTextView = view.findViewById(R.id.verifying_textview);
@@ -181,12 +186,18 @@ public class AdbQrcodeScannerFragment extends WifiDppQrCodeBaseFragment implemen
public void onResume() {
super.onResume();
restartCamera();
mAdbManager = IAdbManager.Stub.asInterface(ServiceManager.getService(Context.ADB_SERVICE));
getActivity().registerReceiver(mReceiver, mIntentFilter);
}
@Override
public void onPause() {
if (mCamera != null) {
mCamera.stop();
}
super.onPause();
getActivity().unregisterReceiver(mReceiver);
@@ -195,8 +206,6 @@ public class AdbQrcodeScannerFragment extends WifiDppQrCodeBaseFragment implemen
} catch (RemoteException e) {
Log.e(TAG, "Unable to cancel pairing");
}
getActivity().setResult(Activity.RESULT_CANCELED);
getActivity().finish();
}
@Override
@@ -213,7 +222,6 @@ public class AdbQrcodeScannerFragment extends WifiDppQrCodeBaseFragment implemen
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
getActivity().getActionBar().hide();
// setTitle for TalkBack
getActivity().setTitle(R.string.wifi_dpp_scan_qr_code);
}

View File

@@ -28,12 +28,18 @@ import android.database.ContentObserver;
import android.graphics.drawable.Drawable;
import android.hardware.display.ColorDisplayManager;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.provider.Settings.Secure;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import androidx.annotation.VisibleForTesting;
import androidx.preference.PreferenceScreen;
import androidx.viewpager.widget.PagerAdapter;
import androidx.viewpager.widget.ViewPager;
import com.android.settings.R;
import com.android.settings.search.BaseSearchIndexProvider;
@@ -43,6 +49,7 @@ import com.android.settingslib.widget.CandidateInfo;
import com.android.settingslib.widget.LayoutPreference;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@@ -54,10 +61,25 @@ public class ColorModePreferenceFragment extends RadioButtonPickerFragment {
private static final int COLOR_MODE_FALLBACK = COLOR_MODE_NATURAL;
static final String PAGE_VIEWER_SELECTION_INDEX = "page_viewer_selection_index";
private static final int DOT_INDICATOR_SIZE = 12;
private static final int DOT_INDICATOR_LEFT_PADDING = 6;
private static final int DOT_INDICATOR_RIGHT_PADDING = 6;
private ContentObserver mContentObserver;
private ColorDisplayManager mColorDisplayManager;
private Resources mResources;
private View mViewArrowPrevious;
private View mViewArrowNext;
private ViewPager mViewPager;
private ArrayList<View> mPageList;
private ImageView[] mDotIndicators;
private View[] mViewPagerImages;
@Override
public void onAttach(Context context) {
super.onAttach(context);
@@ -85,6 +107,16 @@ public class ColorModePreferenceFragment extends RadioButtonPickerFragment {
false /* notifyForDescendants */, mContentObserver, mUserId);
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (savedInstanceState != null) {
final int selectedPosition = savedInstanceState.getInt(PAGE_VIEWER_SELECTION_INDEX);
mViewPager.setCurrentItem(selectedPosition);
updateIndicator(selectedPosition);
}
}
@Override
public void onDetach() {
if (mContentObserver != null) {
@@ -94,6 +126,12 @@ public class ColorModePreferenceFragment extends RadioButtonPickerFragment {
super.onDetach();
}
@Override
public void onSaveInstanceState(Bundle outState){
super.onSaveInstanceState(outState);
outState.putInt(PAGE_VIEWER_SELECTION_INDEX, mViewPager.getCurrentItem());
}
@Override
protected int getPreferenceScreenResId() {
return R.xml.color_mode_settings;
@@ -105,11 +143,69 @@ public class ColorModePreferenceFragment extends RadioButtonPickerFragment {
screen.addPreference(preview);
}
@VisibleForTesting
public ArrayList<Integer> getViewPagerResource() {
return new ArrayList<Integer>(
Arrays.asList(
R.layout.color_mode_view1,
R.layout.color_mode_view2,
R.layout.color_mode_view3));
}
void addViewPager(LayoutPreference preview) {
final ArrayList<Integer> tmpviewPagerList = getViewPagerResource();
mViewPager = preview.findViewById(R.id.viewpager);
mViewPagerImages = new View[3];
for (int idx = 0; idx < tmpviewPagerList.size(); idx++) {
mViewPagerImages[idx] =
getLayoutInflater().inflate(tmpviewPagerList.get(idx), null /* root */);
}
mPageList = new ArrayList<View>();
mPageList.add(mViewPagerImages[0]);
mPageList.add(mViewPagerImages[1]);
mPageList.add(mViewPagerImages[2]);
mViewPager.setAdapter(new ColorPagerAdapter(mPageList));
mViewArrowPrevious = preview.findViewById(R.id.arrow_previous);
mViewArrowPrevious.setOnClickListener(v -> {
final int previousPos = mViewPager.getCurrentItem() - 1;
mViewPager.setCurrentItem(previousPos, true);
});
mViewArrowNext = preview.findViewById(R.id.arrow_next);
mViewArrowNext.setOnClickListener(v -> {
final int nextPos = mViewPager.getCurrentItem() + 1;
mViewPager.setCurrentItem(nextPos, true);
});
mViewPager.addOnPageChangeListener(createPageListener());
final ViewGroup viewGroup = (ViewGroup) preview.findViewById(R.id.viewGroup);
mDotIndicators = new ImageView[mPageList.size()];
for (int i = 0; i < mPageList.size(); i++) {
final ImageView imageView = new ImageView(getContext());
final ViewGroup.MarginLayoutParams lp =
new ViewGroup.MarginLayoutParams(DOT_INDICATOR_SIZE, DOT_INDICATOR_SIZE);
lp.setMargins(DOT_INDICATOR_LEFT_PADDING, 0, DOT_INDICATOR_RIGHT_PADDING, 0);
imageView.setLayoutParams(lp);
mDotIndicators[i] = imageView;
viewGroup.addView(mDotIndicators[i]);
}
updateIndicator(mViewPager.getCurrentItem());
}
@Override
protected void addStaticPreferences(PreferenceScreen screen) {
final LayoutPreference preview = new LayoutPreference(screen.getContext(),
R.layout.color_mode_preview);
configureAndInstallPreview(preview, screen);
addViewPager(preview);
}
@Override
@@ -207,6 +303,88 @@ public class ColorModePreferenceFragment extends RadioButtonPickerFragment {
}
}
private ViewPager.OnPageChangeListener createPageListener() {
return new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(
int position, float positionOffset, int positionOffsetPixels) {
if (positionOffset != 0) {
for (int idx = 0; idx < mPageList.size(); idx++) {
mViewPagerImages[idx].setVisibility(View.VISIBLE);
}
} else {
mViewPagerImages[position].setContentDescription(
getContext().getString(R.string.colors_viewpager_content_description));
updateIndicator(position);
}
}
@Override
public void onPageSelected(int position) {}
@Override
public void onPageScrollStateChanged(int state) {}
};
}
private void updateIndicator(int position) {
for (int i = 0; i < mPageList.size(); i++) {
if (position == i) {
mDotIndicators[i].setBackgroundResource(
R.drawable.ic_color_page_indicator_focused);
mViewPagerImages[i].setVisibility(View.VISIBLE);
} else {
mDotIndicators[i].setBackgroundResource(
R.drawable.ic_color_page_indicator_unfocused);
mViewPagerImages[i].setVisibility(View.INVISIBLE);
}
}
if (position == 0) {
mViewArrowPrevious.setVisibility(View.INVISIBLE);
mViewArrowNext.setVisibility(View.VISIBLE);
} else if (position == (mPageList.size() - 1)) {
mViewArrowPrevious.setVisibility(View.VISIBLE);
mViewArrowNext.setVisibility(View.INVISIBLE);
} else {
mViewArrowPrevious.setVisibility(View.VISIBLE);
mViewArrowNext.setVisibility(View.VISIBLE);
}
}
static class ColorPagerAdapter extends PagerAdapter {
private final ArrayList<View> mPageViewList;
ColorPagerAdapter(ArrayList<View> pageViewList) {
mPageViewList = pageViewList;
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
if (mPageViewList.get(position) != null) {
container.removeView(mPageViewList.get(position));
}
}
@Override
public Object instantiateItem(ViewGroup container, int position) {
container.addView(mPageViewList.get(position));
return mPageViewList.get(position);
}
@Override
public int getCount() {
return mPageViewList.size();
}
@Override
public boolean isViewFromObject(View view, Object object) {
return object == view;
}
}
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
new BaseSearchIndexProvider(R.xml.color_mode_settings) {

View File

@@ -22,6 +22,8 @@ import static android.provider.Settings.Secure.CAMERA_AUTOROTATE;
import static com.android.settings.display.SmartAutoRotateController.hasSufficientPermission;
import static com.android.settings.display.SmartAutoRotateController.isRotationResolverServiceAvailable;
import android.text.TextUtils;
import android.app.settings.SettingsEnums;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@@ -37,7 +39,9 @@ import androidx.preference.PreferenceScreen;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.view.RotationPolicy;
import com.android.settings.R;
import com.android.settings.core.BasePreferenceController;
import com.android.settings.core.TogglePreferenceController;
import com.android.settings.overlay.FeatureFactory;
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnStart;
import com.android.settingslib.core.lifecycle.events.OnStop;
@@ -45,12 +49,10 @@ import com.android.settingslib.core.lifecycle.events.OnStop;
/**
* SmartAutoRotatePreferenceController provides auto rotate summary in display settings
*/
public class SmartAutoRotatePreferenceController extends BasePreferenceController
public class SmartAutoRotatePreferenceController extends TogglePreferenceController
implements LifecycleObserver, OnStart, OnStop {
private RotationPolicy.RotationPolicyListener mRotationPolicyListener;
private Preference mPreference;
private final MetricsFeatureProvider mMetricsFeatureProvider;
private final SensorPrivacyManager mPrivacyManager;
private final PowerManager mPowerManager;
private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
@@ -60,12 +62,16 @@ public class SmartAutoRotatePreferenceController extends BasePreferenceControlle
}
};
private RotationPolicy.RotationPolicyListener mRotationPolicyListener;
private Preference mPreference;
public SmartAutoRotatePreferenceController(Context context, String preferenceKey) {
super(context, preferenceKey);
mPrivacyManager = SensorPrivacyManager.getInstance(context);
mPrivacyManager
.addSensorPrivacyListener(CAMERA, (sensor, enabled) -> refreshSummary(mPreference));
mPowerManager = context.getSystemService(PowerManager.class);
mMetricsFeatureProvider = FeatureFactory.getFactory(context).getMetricsFeatureProvider();
}
@Override
@@ -74,12 +80,28 @@ public class SmartAutoRotatePreferenceController extends BasePreferenceControlle
? AVAILABLE : UNSUPPORTED_ON_DEVICE;
}
@Override
public boolean isSliceable() {
return TextUtils.equals(getPreferenceKey(), "auto_rotate");
}
@Override
public boolean isPublicSlice() {
return true;
}
@Override
public void displayPreference(PreferenceScreen screen) {
super.displayPreference(screen);
mPreference = screen.findPreference(getPreferenceKey());
}
@Override
public void updateState(Preference preference) {
super.updateState(preference);
refreshSummary(mPreference);
}
@Override
public void onStart() {
mContext.registerReceiver(mReceiver,
@@ -89,7 +111,7 @@ public class SmartAutoRotatePreferenceController extends BasePreferenceControlle
@Override
public void onChange() {
if (mPreference != null) {
refreshSummary(mPreference);
updateState(mPreference);
}
}
};
@@ -121,6 +143,20 @@ public class SmartAutoRotatePreferenceController extends BasePreferenceControlle
return mPowerManager.isPowerSaveMode();
}
@Override
public boolean isChecked() {
return !RotationPolicy.isRotationLocked(mContext);
}
@Override
public boolean setChecked(boolean isChecked) {
final boolean isLocked = !isChecked;
mMetricsFeatureProvider.action(mContext, SettingsEnums.ACTION_ROTATION_LOCK,
isLocked);
RotationPolicy.setRotationLock(mContext, isLocked);
return true;
}
@Override
public CharSequence getSummary() {
int activeStringId = R.string.auto_rotate_option_off;

View File

@@ -58,11 +58,25 @@ public class ActionDisabledByAdminDialog extends Activity
return admin;
}
admin.component = intent.getParcelableExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN);
int userId = intent.getIntExtra(Intent.EXTRA_USER_ID, UserHandle.myUserId());
Bundle adminDetails = null;
if (admin.component == null) {
DevicePolicyManager devicePolicyManager = getSystemService(DevicePolicyManager.class);
adminDetails = devicePolicyManager.getEnforcingAdminAndUserDetails(userId,
getRestrictionFromIntent(intent));
if (adminDetails != null) {
admin.component = adminDetails.getParcelable(
DevicePolicyManager.EXTRA_DEVICE_ADMIN);
}
}
if (intent.hasExtra(Intent.EXTRA_USER)) {
admin.user = intent.getParcelableExtra(Intent.EXTRA_USER);
} else {
int userId = intent.getIntExtra(Intent.EXTRA_USER_ID, UserHandle.myUserId());
if (adminDetails != null) {
userId = adminDetails.getInt(Intent.EXTRA_USER_ID, UserHandle.myUserId());
}
if (userId == UserHandle.USER_NULL) {
admin.user = null;
} else {

View File

@@ -57,7 +57,8 @@ public class BatteryChartView extends AppCompatImageView implements View.OnClick
Arrays.asList("SwitchAccessService", "TalkBackService", "JustSpeakService");
private static final int DEFAULT_TRAPEZOID_COUNT = 12;
private static final int DEFAULT_TIMESTAMP_COUNT = 5;
private static final int DEFAULT_TIMESTAMP_COUNT = 4;
private static final int TIMESTAMP_GAPS_COUNT = DEFAULT_TIMESTAMP_COUNT - 1;
private static final int DIVIDER_COLOR = Color.parseColor("#CDCCC5");
private static final long UPDATE_STATE_DELAYED_TIME = 500L;
@@ -91,7 +92,7 @@ public class BatteryChartView extends AppCompatImageView implements View.OnClick
new Rect[] {new Rect(), new Rect(), new Rect()};
// For drawing the timestamp information.
private final Rect[] mTimestampsBounds =
new Rect[] {new Rect(), new Rect(), new Rect(), new Rect(), new Rect()};
new Rect[] {new Rect(), new Rect(), new Rect(), new Rect()};
@VisibleForTesting
Handler mHandler = new Handler();
@@ -198,13 +199,14 @@ public class BatteryChartView extends AppCompatImageView implements View.OnClick
if (mTimestamps == null) {
mTimestamps = new String[DEFAULT_TIMESTAMP_COUNT];
}
final long timeSlotOffset = DateUtils.HOUR_IN_MILLIS * 6;
final long timeSlotOffset =
DateUtils.HOUR_IN_MILLIS * (/*total 24 hours*/ 24 / TIMESTAMP_GAPS_COUNT);
final boolean is24HourFormat = DateFormat.is24HourFormat(getContext());
for (int index = 0; index < DEFAULT_TIMESTAMP_COUNT; index++) {
mTimestamps[index] =
ConvertUtils.utcToLocalTimeHour(
getContext(),
latestTimestamp - (4 - index) * timeSlotOffset,
latestTimestamp - (TIMESTAMP_GAPS_COUNT - index) * timeSlotOffset,
is24HourFormat);
}
requestLayout();
@@ -426,8 +428,9 @@ public class BatteryChartView extends AppCompatImageView implements View.OnClick
final float[] xOffsets = new float[DEFAULT_TIMESTAMP_COUNT];
final float baselineX = mDividerWidth * .5f;
final float offsetX = mDividerWidth + unitWidth;
final int slotBarOffset = (/*total 12 bars*/ 12) / TIMESTAMP_GAPS_COUNT;
for (int index = 0; index < DEFAULT_TIMESTAMP_COUNT; index++) {
xOffsets[index] = baselineX + index * offsetX * 3;
xOffsets[index] = baselineX + index * offsetX * slotBarOffset;
}
drawTimestamp(canvas, xOffsets);
}
@@ -439,13 +442,15 @@ public class BatteryChartView extends AppCompatImageView implements View.OnClick
mTimestamps[0],
xOffsets[0] - mTimestampsBounds[0].left,
getTimestampY(0), mTextPaint);
final int latestIndex = DEFAULT_TIMESTAMP_COUNT - 1;
// Draws the last timestamp info.
canvas.drawText(
mTimestamps[4],
xOffsets[4] - mTimestampsBounds[4].width() - mTimestampsBounds[4].left,
getTimestampY(4), mTextPaint);
mTimestamps[latestIndex],
xOffsets[latestIndex] - mTimestampsBounds[latestIndex].width()
- mTimestampsBounds[latestIndex].left,
getTimestampY(latestIndex), mTextPaint);
// Draws the rest of timestamp info since it is located in the center.
for (int index = 1; index <= 3; index++) {
for (int index = 1; index <= DEFAULT_TIMESTAMP_COUNT - 2; index++) {
canvas.drawText(
mTimestamps[index],
xOffsets[index] -

View File

@@ -25,6 +25,7 @@ import android.os.BatteryStatsManager;
import android.os.BatteryUsageStats;
import android.os.SystemClock;
import android.text.format.Formatter;
import android.util.Log;
import android.util.SparseIntArray;
import androidx.annotation.NonNull;
@@ -42,6 +43,7 @@ import com.android.settingslib.utils.PowerUtil;
import com.android.settingslib.utils.StringUtil;
public class BatteryInfo {
private static final String TAG = "BatteryInfo";
public CharSequence chargeLabel;
public CharSequence remainingLabel;
@@ -155,8 +157,15 @@ public class BatteryInfo {
if (batteryUsageStats != null) {
stats = batteryUsageStats;
} else {
try {
stats = context.getSystemService(BatteryStatsManager.class)
.getBatteryUsageStats();
} catch (RuntimeException e) {
Log.e(TAG, "getBatteryInfo() from getBatteryUsageStats()", e);
// Use default BatteryUsageStats.
stats = new BatteryUsageStats.Builder(
new String[0], /* includePowerModels */ false).build();
}
}
return getBatteryInfo(context, stats, shortString);
}

View File

@@ -74,6 +74,14 @@ public class BatteryOptimizeUtils {
}
public void setAppUsageState(AppUsageState state) {
try {
setAppUsageStateInternal(state);
} catch (Exception e) {
Log.e(TAG, "setAppUsageState() is failed for " + mPackageName, e);
}
}
private void setAppUsageStateInternal(AppUsageState state) {
switch (state) {
case RESTRICTED:
mBatteryUtils.setForceAppStandby(mUid, mPackageName, AppOpsManager.MODE_IGNORED);

View File

@@ -20,6 +20,7 @@ import android.content.Context;
import android.os.BatteryStatsManager;
import android.os.BatteryUsageStats;
import android.os.BatteryUsageStatsQuery;
import android.util.Log;
import com.android.settingslib.utils.AsyncLoaderCompat;
@@ -27,6 +28,7 @@ import com.android.settingslib.utils.AsyncLoaderCompat;
* Loader to get new {@link BatteryUsageStats} in the background
*/
public class BatteryUsageStatsLoader extends AsyncLoaderCompat<BatteryUsageStats> {
private static final String TAG = "BatteryUsageStatsLoader";
private final BatteryStatsManager mBatteryStatsManager;
private final boolean mIncludeBatteryHistory;
@@ -42,7 +44,14 @@ public class BatteryUsageStatsLoader extends AsyncLoaderCompat<BatteryUsageStats
if (mIncludeBatteryHistory) {
builder.includeBatteryHistory();
}
try {
return mBatteryStatsManager.getBatteryUsageStats(builder.build());
} catch (RuntimeException e) {
Log.e(TAG, "loadInBackground() for getBatteryUsageStats()", e);
// Use default BatteryUsageStats.
return new BatteryUsageStats.Builder(
new String[0], /* includePowerModels */ false).build();
}
}
@Override

View File

@@ -368,8 +368,17 @@ public class BatteryUtils {
public BatteryInfo getBatteryInfo(final String tag) {
final BatteryStatsManager systemService = mContext.getSystemService(
BatteryStatsManager.class);
final BatteryUsageStats batteryUsageStats = systemService.getBatteryUsageStats(
BatteryUsageStats batteryUsageStats;
try {
batteryUsageStats = systemService.getBatteryUsageStats(
new BatteryUsageStatsQuery.Builder().includeBatteryHistory().build());
} catch (RuntimeException e) {
Log.e(TAG, "getBatteryInfo() error for getBatteryUsageStats()", e);
// Use default BatteryUsageStats.
batteryUsageStats =
new BatteryUsageStats.Builder(new String[0], /* includePowerModels */ false)
.build();
}
final long startTime = System.currentTimeMillis();

View File

@@ -19,6 +19,7 @@ import android.content.Context;
import android.os.BatteryUsageStats;
import android.os.LocaleList;
import android.os.UserHandle;
import android.text.format.DateFormat;
import android.text.format.DateUtils;
import android.util.Log;
@@ -28,10 +29,8 @@ import com.android.settings.overlay.FeatureFactory;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.text.SimpleDateFormat;
import java.time.Duration;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -78,19 +77,6 @@ public final class ConvertUtils {
public static final int CONSUMER_TYPE_USER_BATTERY = 2;
public static final int CONSUMER_TYPE_SYSTEM_BATTERY = 3;
// For language is changed.
@VisibleForTesting static Locale sLocale;
@VisibleForTesting static Locale sLocaleForHour;
// For time zone is changed.
@VisibleForTesting static String sZoneId;
@VisibleForTesting static String sZoneIdForHour;
private static boolean sIs24HourFormat;
@VisibleForTesting
static SimpleDateFormat sSimpleDateFormat;
@VisibleForTesting
static SimpleDateFormat sSimpleDateFormatForHour;
private ConvertUtils() {}
public static ContentValues convert(
@@ -138,36 +124,21 @@ public final class ConvertUtils {
/** Converts UTC timestamp to human readable local time string. */
public static String utcToLocalTime(Context context, long timestamp) {
final Locale currentLocale = getLocale(context);
final String currentZoneId = TimeZone.getDefault().getID();
if (!currentZoneId.equals(sZoneId)
|| !currentLocale.equals(sLocale)
|| sSimpleDateFormat == null) {
sLocale = currentLocale;
sZoneId = currentZoneId;
sSimpleDateFormat =
new SimpleDateFormat("MMM dd,yyyy HH:mm:ss", currentLocale);
}
return sSimpleDateFormat.format(new Date(timestamp));
final Locale locale = getLocale(context);
final String pattern =
DateFormat.getBestDateTimePattern(locale, "MMM dd,yyyy HH:mm:ss");
return DateFormat.format(pattern, timestamp).toString();
}
/** Converts UTC timestamp to local time hour data. */
public static String utcToLocalTimeHour(
Context context, long timestamp, boolean is24HourFormat) {
final Locale currentLocale = getLocale(context);
final String currentZoneId = TimeZone.getDefault().getID();
if (!currentZoneId.equals(sZoneIdForHour)
|| !currentLocale.equals(sLocaleForHour)
|| sIs24HourFormat != is24HourFormat
|| sSimpleDateFormatForHour == null) {
sLocaleForHour = currentLocale;
sZoneIdForHour = currentZoneId;
sIs24HourFormat = is24HourFormat;
sSimpleDateFormatForHour = new SimpleDateFormat(
sIs24HourFormat ? "HH" : "h", currentLocale);
}
return sSimpleDateFormatForHour.format(new Date(timestamp))
.toLowerCase(currentLocale);
final Locale locale = getLocale(context);
// e.g. for 12-hour format: 9 pm
// e.g. for 24-hour format: 09:00
final String skeleton = is24HourFormat ? "HHm" : "ha";
final String pattern = DateFormat.getBestDateTimePattern(locale, skeleton);
return DateFormat.format(pattern, timestamp).toString().toLowerCase(locale);
}
/** Gets indexed battery usage data for each corresponding time slot. */

View File

@@ -138,6 +138,11 @@ public interface PowerUsageFeatureProvider {
*/
boolean isChartGraphSlotsEnabled(Context context);
/**
* Gets a intent for one time bypass charge limited to resume charging.
*/
Intent getResumeChargeIntent();
/**
* Returns battery history data with corresponding timestamp key.
*/

View File

@@ -165,6 +165,11 @@ public class PowerUsageFeatureProviderImpl implements PowerUsageFeatureProvider
return false;
}
@Override
public Intent getResumeChargeIntent() {
return null;
}
@Override
public Map<Long, Map<String, BatteryHistEntry>> getBatteryHistory(Context context) {
return null;

View File

@@ -32,10 +32,11 @@ import com.android.settings.R;
public class RequestIgnoreBatteryOptimizations extends AlertActivity implements
DialogInterface.OnClickListener {
static final String TAG = "RequestIgnoreBatteryOptimizations";
private static final String TAG = "RequestIgnoreBatteryOptimizations";
private static final boolean DEBUG = false;
private PowerWhitelistManager mPowerWhitelistManager;
String mPackageName;
private String mPackageName;
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -45,14 +46,14 @@ public class RequestIgnoreBatteryOptimizations extends AlertActivity implements
Uri data = getIntent().getData();
if (data == null) {
Log.w(TAG, "No data supplied for IGNORE_BATTERY_OPTIMIZATION_SETTINGS in: "
debugLog("No data supplied for IGNORE_BATTERY_OPTIMIZATION_SETTINGS in: "
+ getIntent());
finish();
return;
}
mPackageName = data.getSchemeSpecificPart();
if (mPackageName == null) {
Log.w(TAG, "No data supplied for IGNORE_BATTERY_OPTIMIZATION_SETTINGS in: "
debugLog("No data supplied for IGNORE_BATTERY_OPTIMIZATION_SETTINGS in: "
+ getIntent());
finish();
return;
@@ -60,7 +61,7 @@ public class RequestIgnoreBatteryOptimizations extends AlertActivity implements
PowerManager power = getSystemService(PowerManager.class);
if (power.isIgnoringBatteryOptimizations(mPackageName)) {
Log.i(TAG, "Not should prompt, already ignoring optimizations: " + mPackageName);
debugLog("Not should prompt, already ignoring optimizations: " + mPackageName);
finish();
return;
}
@@ -69,7 +70,7 @@ public class RequestIgnoreBatteryOptimizations extends AlertActivity implements
try {
ai = getPackageManager().getApplicationInfo(mPackageName, 0);
} catch (PackageManager.NameNotFoundException e) {
Log.w(TAG, "Requested package doesn't exist: " + mPackageName);
debugLog("Requested package doesn't exist: " + mPackageName);
finish();
return;
}
@@ -77,7 +78,7 @@ public class RequestIgnoreBatteryOptimizations extends AlertActivity implements
if (getPackageManager().checkPermission(
Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS, mPackageName)
!= PackageManager.PERMISSION_GRANTED) {
Log.w(TAG, "Requested package " + mPackageName + " does not hold permission "
debugLog("Requested package " + mPackageName + " does not hold permission "
+ Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);
finish();
return;
@@ -105,10 +106,13 @@ public class RequestIgnoreBatteryOptimizations extends AlertActivity implements
switch (which) {
case BUTTON_POSITIVE:
mPowerWhitelistManager.addToWhitelist(mPackageName);
setResult(RESULT_OK);
break;
case BUTTON_NEGATIVE:
break;
}
}
private static void debugLog(String debugContent) {
if (DEBUG) Log.w(TAG, debugContent);
}
}

View File

@@ -20,6 +20,9 @@ import android.app.Dialog;
import android.app.settings.SettingsEnums;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.BatteryManager;
import android.os.Bundle;
import android.view.LayoutInflater;
@@ -40,6 +43,7 @@ import com.android.settings.fuelgauge.batterytip.tips.HighUsageTip;
import com.android.settings.fuelgauge.batterytip.tips.RestrictAppTip;
import com.android.settings.fuelgauge.batterytip.tips.UnrestrictAppTip;
import java.text.NumberFormat;
import java.util.List;
/**
@@ -50,6 +54,7 @@ public class BatteryTipDialogFragment extends InstrumentedDialogFragment impleme
private static final String ARG_BATTERY_TIP = "battery_tip";
private static final String ARG_METRICS_KEY = "metrics_key";
private static final double CHARGE_LIMIT_LEVEL = 0.8f;
@VisibleForTesting
BatteryTip mBatteryTip;
@@ -138,6 +143,28 @@ public class BatteryTipDialogFragment extends InstrumentedDialogFragment impleme
.setPositiveButton(R.string.battery_tip_unrestrict_app_dialog_ok, this)
.setNegativeButton(R.string.battery_tip_unrestrict_app_dialog_cancel, null)
.create();
case BatteryTip.TipType.BATTERY_DEFENDER:
mMetricsFeatureProvider.action(context,
SettingsEnums.ACTION_TIP_BATTERY_DEFENDER, mMetricsKey);
final String percentage =
NumberFormat.getPercentInstance().format(CHARGE_LIMIT_LEVEL);
final String message = context.getString(
R.string.battery_tip_limited_temporarily_dialog_msg, percentage);
final boolean isPluggedIn = isPluggedIn();
final AlertDialog.Builder dialogBuilder =
new AlertDialog.Builder(context)
.setTitle(R.string.battery_tip_limited_temporarily_title)
.setMessage(message);
if (isPluggedIn) {
dialogBuilder
.setPositiveButton(
R.string.battery_tip_limited_temporarily_dialog_resume_charge,
this)
.setNegativeButton(R.string.okay, null);
} else {
dialogBuilder.setPositiveButton(R.string.okay, null);
}
return dialogBuilder.create();
default:
throw new IllegalArgumentException("unknown type " + mBatteryTip.getType());
}
@@ -163,4 +190,11 @@ public class BatteryTipDialogFragment extends InstrumentedDialogFragment impleme
lsn.onBatteryTipHandled(mBatteryTip);
}
private boolean isPluggedIn() {
final Intent batteryIntent = getContext().registerReceiver(null /* receiver */,
new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
return batteryIntent != null && batteryIntent.getIntExtra(
BatteryManager.EXTRA_PLUGGED, 0) != 0;
}
}

View File

@@ -16,12 +16,11 @@
package com.android.settings.fuelgauge.batterytip.actions;
import android.app.settings.SettingsEnums;
import android.content.Intent;
import com.android.settings.R;
import com.android.settings.SettingsActivity;
import com.android.settingslib.HelpUtils;
import com.android.settings.overlay.FeatureFactory;
import android.os.AsyncTask;
/**
* Action to open the Support Center article
@@ -34,19 +33,13 @@ public class BatteryDefenderAction extends BatteryTipAction {
mSettingsActivity = settingsActivity;
}
/**
* Handle the action when user clicks positive button
*/
@Override
public void handlePositiveAction(int metricsKey) {
mMetricsFeatureProvider.action(mContext,
SettingsEnums.ACTION_TIP_BATTERY_DEFENDER, metricsKey);
final Intent intent = HelpUtils.getHelpIntent(
mContext,
mContext.getString(R.string.help_url_battery_defender),
getClass().getName());
final Intent intent = FeatureFactory.getFactory(mContext)
.getPowerUsageFeatureProvider(mContext).getResumeChargeIntent();
if (intent != null) {
mSettingsActivity.startActivityForResult(intent, 0);
// Post intent to background thread to avoid UI flaky
AsyncTask.execute(() -> mContext.sendBroadcast(intent));
}
}
}

View File

@@ -17,7 +17,6 @@
package com.android.settings.fuelgauge.batterytip.detectors;
import com.android.settings.fuelgauge.BatteryInfo;
import com.android.settings.fuelgauge.BatteryUtils;
import com.android.settings.fuelgauge.batterytip.tips.BatteryDefenderTip;
import com.android.settings.fuelgauge.batterytip.tips.BatteryTip;
@@ -34,7 +33,7 @@ public class BatteryDefenderDetector implements BatteryTipDetector {
@Override
public BatteryTip detect() {
final int state =
BatteryUtils.isBatteryDefenderOn(mBatteryInfo)
mBatteryInfo.isOverheated
? BatteryTip.StateType.NEW
: BatteryTip.StateType.INVISIBLE;
return new BatteryDefenderTip(state);

View File

@@ -29,7 +29,7 @@ import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
public class BatteryDefenderTip extends BatteryTip {
public BatteryDefenderTip(@StateType int state) {
super(TipType.BATTERY_DEFENDER, state, false /* showDialog */);
super(TipType.BATTERY_DEFENDER, state, true /* showDialog */);
}
private BatteryDefenderTip(Parcel in) {

View File

@@ -16,6 +16,11 @@
package com.android.settings.gestures;
import static com.android.settings.gestures.PowerMenuSettingsUtils.LONG_PRESS_POWER_ASSISTANT_VALUE;
import static com.android.settings.gestures.PowerMenuSettingsUtils.LONG_PRESS_POWER_GLOBAL_ACTIONS;
import static com.android.settings.gestures.PowerMenuSettingsUtils.POWER_BUTTON_LONG_PRESS_DEFAULT_VALUE_RESOURCE;
import static com.android.settings.gestures.PowerMenuSettingsUtils.POWER_BUTTON_LONG_PRESS_SETTING;
import android.content.Context;
import android.provider.Settings;
@@ -33,27 +38,12 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
*/
public class LongPressPowerButtonPreferenceController extends TogglePreferenceController {
private static final String POWER_BUTTON_LONG_PRESS_SETTING =
Settings.Global.POWER_BUTTON_LONG_PRESS;
private static final String KEY_CHORD_POWER_VOLUME_UP_SETTING =
Settings.Global.KEY_CHORD_POWER_VOLUME_UP;
private static final String FOOTER_HINT_KEY = "power_menu_power_volume_up_hint";
private static final String ASSIST_SWITCH_KEY = "gesture_power_menu_long_press_for_assist";
/**
* Values used for long press power button behaviour when Assist setting is enabled.
*
* {@link com.android.server.policy.PhoneWindowManager#LONG_PRESS_POWER_GLOBAL_ACTIONS} for
* source of the value.
*/
@VisibleForTesting
static final int LONG_PRESS_POWER_NO_ACTION = 0;
@VisibleForTesting
static final int LONG_PRESS_POWER_GLOBAL_ACTIONS = 1;
@VisibleForTesting
static final int LONG_PRESS_POWER_ASSISTANT_VALUE = 5; // Settings.Secure.ASSISTANT
/**
* Values used for volume key chord behaviour when Assist setting is enabled.
*
@@ -67,15 +57,6 @@ public class LongPressPowerButtonPreferenceController extends TogglePreferenceCo
@VisibleForTesting
static final int KEY_CHORD_POWER_VOLUME_UP_GLOBAL_ACTIONS = 2;
/**
* Value used for long press power button behaviour when the Assist setting is disabled.
*
* If this value matches Assist setting, then it falls back to Global Actions panel or
* power menu, depending on their respective settings.
*/
private static final int POWER_BUTTON_LONG_PRESS_DEFAULT_VALUE_RESOURCE =
com.android.internal.R.integer.config_longPressOnPowerBehavior;
private static final int KEY_CHORD_POWER_VOLUME_UP_DEFAULT_VALUE_RESOURCE =
com.android.internal.R.integer.config_keyChordPowerVolumeUp;
@@ -101,7 +82,7 @@ public class LongPressPowerButtonPreferenceController extends TogglePreferenceCo
@Override
public CharSequence getSummary() {
final int powerButtonValue = getPowerButtonValue();
final int powerButtonValue = PowerMenuSettingsUtils.getPowerButtonSettingValue(mContext);
if (powerButtonValue == LONG_PRESS_POWER_ASSISTANT_VALUE) {
return mContext.getString(R.string.power_menu_summary_long_press_for_assist_enabled);
} else if (powerButtonValue == LONG_PRESS_POWER_GLOBAL_ACTIONS) {
@@ -122,7 +103,7 @@ public class LongPressPowerButtonPreferenceController extends TogglePreferenceCo
@Override
public boolean isChecked() {
return getPowerButtonValue() == LONG_PRESS_POWER_ASSISTANT_VALUE;
return PowerMenuSettingsUtils.isLongPressPowerForAssistEnabled(mContext);
}
@Override
@@ -159,12 +140,6 @@ public class LongPressPowerButtonPreferenceController extends TogglePreferenceCo
}
}
private int getPowerButtonValue() {
return Settings.Global.getInt(mContext.getContentResolver(),
POWER_BUTTON_LONG_PRESS_SETTING,
mContext.getResources().getInteger(POWER_BUTTON_LONG_PRESS_DEFAULT_VALUE_RESOURCE));
}
private static boolean isPowerMenuKeyChordEnabled(Context context) {
return Settings.Global.getInt(context.getContentResolver(),
KEY_CHORD_POWER_VOLUME_UP_SETTING,
@@ -179,16 +154,18 @@ public class LongPressPowerButtonPreferenceController extends TogglePreferenceCo
POWER_BUTTON_LONG_PRESS_SETTING, LONG_PRESS_POWER_ASSISTANT_VALUE);
}
// We need to determine the right disabled value - we set it to device default
// if it's different than Assist, otherwise we fallback to either global actions or power
// menu.
// We need to determine the right disabled value based on the device default
// for long-press power.
// If the default is to start the assistant, then the fallback is GlobalActions.
final int defaultPowerButtonValue = mContext.getResources().getInteger(
POWER_BUTTON_LONG_PRESS_DEFAULT_VALUE_RESOURCE);
if (defaultPowerButtonValue == LONG_PRESS_POWER_ASSISTANT_VALUE) {
return Settings.Global.putInt(mContext.getContentResolver(),
POWER_BUTTON_LONG_PRESS_SETTING, LONG_PRESS_POWER_NO_ACTION);
POWER_BUTTON_LONG_PRESS_SETTING, LONG_PRESS_POWER_GLOBAL_ACTIONS);
}
// If the default is something different than Assist, we use that default.
return Settings.Global.putInt(mContext.getContentResolver(),
POWER_BUTTON_LONG_PRESS_SETTING, defaultPowerButtonValue);
}

View File

@@ -0,0 +1,155 @@
/*
* 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.gestures;
import android.content.Context;
import android.database.ContentObserver;
import android.os.Handler;
import android.provider.Settings;
import androidx.annotation.Nullable;
import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
import com.android.settings.core.SliderPreferenceController;
import com.android.settings.widget.LabeledSeekBarPreference;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnStart;
import com.android.settingslib.core.lifecycle.events.OnStop;
/** Handles changes to the long press power button sensitivity slider. */
public class LongPressPowerSensitivityPreferenceController extends
SliderPreferenceController implements
LifecycleObserver, OnStart, OnStop {
private final ContentObserver mPowerButtonObserver = new ContentObserver(Handler.getMain()) {
@Override
public void onChange(boolean selfChange) {
if (mPreference != null) {
updateState(mPreference);
}
}
};
@Nullable
private final int[] mSensitivityValues;
@Nullable
private LabeledSeekBarPreference mPreference;
public LongPressPowerSensitivityPreferenceController(Context context, String preferenceKey) {
super(context, preferenceKey);
mSensitivityValues = context.getResources().getIntArray(
com.android.internal.R.array.config_longPressOnPowerDurationSettings);
}
@Override
public void onStart() {
mContext.getContentResolver().registerContentObserver(
Settings.Global.getUriFor(PowerMenuSettingsUtils.POWER_BUTTON_LONG_PRESS_SETTING),
false, mPowerButtonObserver);
}
@Override
public void onStop() {
mContext.getContentResolver().unregisterContentObserver(mPowerButtonObserver);
}
@Override
public void displayPreference(PreferenceScreen screen) {
super.displayPreference(screen);
mPreference = screen.findPreference(getPreferenceKey());
if (mPreference != null) {
mPreference.setContinuousUpdates(false);
mPreference.setHapticFeedbackMode(
LabeledSeekBarPreference.HAPTIC_FEEDBACK_MODE_ON_TICKS);
mPreference.setMin(getMin());
mPreference.setMax(getMax());
}
}
@Override
public void updateState(Preference preference) {
super.updateState(preference);
final LabeledSeekBarPreference pref = (LabeledSeekBarPreference) preference;
pref.setEnabled(
isAvailable() && PowerMenuSettingsUtils.isLongPressPowerForAssistEnabled(mContext));
pref.setProgress(getSliderPosition());
}
@Override
public int getAvailabilityStatus() {
if (mSensitivityValues == null || mSensitivityValues.length < 2) {
return UNSUPPORTED_ON_DEVICE;
}
if (!PowerMenuSettingsUtils.isLongPressPowerForAssistEnabled(mContext)) {
return DISABLED_DEPENDENT_SETTING;
}
return AVAILABLE;
}
@Override
public int getSliderPosition() {
return mSensitivityValues == null ? 0 : closestValueIndex(mSensitivityValues,
getCurrentSensitivityValue());
}
@Override
public boolean setSliderPosition(int position) {
if (mSensitivityValues == null || position < 0 || position >= mSensitivityValues.length) {
return false;
}
return Settings.Global.putInt(mContext.getContentResolver(),
Settings.Global.POWER_BUTTON_LONG_PRESS_DURATION_MS,
mSensitivityValues[position]);
}
@Override
public int getMax() {
if (mSensitivityValues == null || mSensitivityValues.length == 0) {
return 0;
}
return mSensitivityValues.length - 1;
}
@Override
public int getMin() {
return 0;
}
private int getCurrentSensitivityValue() {
return Settings.Global.getInt(mContext.getContentResolver(),
Settings.Global.POWER_BUTTON_LONG_PRESS_DURATION_MS,
mContext.getResources().getInteger(
com.android.internal.R.integer.config_longPressOnPowerDurationMs));
}
private static int closestValueIndex(int[] values, int needle) {
int minDistance = Integer.MAX_VALUE;
int valueIndex = 0;
for (int i = 0; i < values.length; i++) {
int diff = Math.abs(values[i] - needle);
if (diff < minDistance) {
minDistance = diff;
valueIndex = i;
}
}
return valueIndex;
}
}

View File

@@ -93,7 +93,8 @@ public class OneHandedActionPullDownPrefController extends BasePreferenceControl
return;
}
if (uri.equals(OneHandedSettingsUtils.ONE_HANDED_MODE_ENABLED_URI)
|| uri.equals(OneHandedSettingsUtils.SHORTCUT_ENABLED_URI)) {
|| uri.equals(OneHandedSettingsUtils.SOFTWARE_SHORTCUT_ENABLED_URI)
|| uri.equals(OneHandedSettingsUtils.HARDWARE_SHORTCUT_ENABLED_URI)) {
mPreference.setEnabled(OneHandedSettingsUtils.canEnableController(mContext));
} else if (uri.equals(OneHandedSettingsUtils.SHOW_NOTIFICATION_ENABLED_URI)) {
updateState(mPreference);

View File

@@ -93,7 +93,8 @@ public class OneHandedActionShowNotificationPrefController extends BasePreferenc
return;
}
if (uri.equals(OneHandedSettingsUtils.ONE_HANDED_MODE_ENABLED_URI)
|| uri.equals(OneHandedSettingsUtils.SHORTCUT_ENABLED_URI)) {
|| uri.equals(OneHandedSettingsUtils.SOFTWARE_SHORTCUT_ENABLED_URI)
|| uri.equals(OneHandedSettingsUtils.HARDWARE_SHORTCUT_ENABLED_URI)) {
mPreference.setEnabled(OneHandedSettingsUtils.canEnableController(mContext));
} else if (uri.equals(OneHandedSettingsUtils.SHOW_NOTIFICATION_ENABLED_URI)) {
updateState(mPreference);

View File

@@ -27,6 +27,7 @@ import android.os.Looper;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.provider.Settings;
import android.text.TextUtils;
import androidx.annotation.VisibleForTesting;
@@ -45,8 +46,10 @@ public class OneHandedSettingsUtils {
Settings.Secure.getUriFor(Settings.Secure.ONE_HANDED_MODE_ENABLED);
static final Uri SHOW_NOTIFICATION_ENABLED_URI =
Settings.Secure.getUriFor(Settings.Secure.SWIPE_BOTTOM_TO_NOTIFICATION_ENABLED);
static final Uri SHORTCUT_ENABLED_URI =
static final Uri SOFTWARE_SHORTCUT_ENABLED_URI =
Settings.Secure.getUriFor(Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS);
static final Uri HARDWARE_SHORTCUT_ENABLED_URI =
Settings.Secure.getUriFor(Settings.Secure.ACCESSIBILITY_SHORTCUT_TARGET_SERVICE);
public enum OneHandedTimeout {
NEVER(0), SHORT(4), MEDIUM(8), LONG(12);
@@ -238,9 +241,20 @@ public class OneHandedSettingsUtils {
* @return true if user enabled one-handed shortcut in settings, false otherwise.
*/
public static boolean getShortcutEnabled(Context context) {
final String targets = Settings.Secure.getStringForUser(context.getContentResolver(),
// Checks SOFTWARE_SHORTCUT_KEY
final String targetsSW = Settings.Secure.getStringForUser(context.getContentResolver(),
Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS, sCurrentUserId);
return targets != null ? targets.contains(ONE_HANDED_MODE_TARGET_NAME) : false;
if (!TextUtils.isEmpty(targetsSW) && targetsSW.contains(ONE_HANDED_MODE_TARGET_NAME)) {
return true;
}
// Checks HARDWARE_SHORTCUT_KEY
final String targetsHW = Settings.Secure.getStringForUser(context.getContentResolver(),
Settings.Secure.ACCESSIBILITY_SHORTCUT_TARGET_SERVICE, sCurrentUserId);
if (!TextUtils.isEmpty(targetsHW) && targetsHW.contains(ONE_HANDED_MODE_TARGET_NAME)) {
return true;
}
return false;
}
/**
@@ -285,7 +299,8 @@ public class OneHandedSettingsUtils {
final ContentResolver resolver = mContext.getContentResolver();
resolver.registerContentObserver(ONE_HANDED_MODE_ENABLED_URI, true, this);
resolver.registerContentObserver(SHOW_NOTIFICATION_ENABLED_URI, true, this);
resolver.registerContentObserver(SHORTCUT_ENABLED_URI, true, this);
resolver.registerContentObserver(SOFTWARE_SHORTCUT_ENABLED_URI, true, this);
resolver.registerContentObserver(HARDWARE_SHORTCUT_ENABLED_URI, true, this);
}
@Override

View File

@@ -16,30 +16,23 @@
package com.android.settings.gestures;
import android.content.Context;
import android.provider.Settings;
import static com.android.settings.gestures.PowerMenuSettingsUtils.LONG_PRESS_POWER_ASSISTANT_VALUE;
import static com.android.settings.gestures.PowerMenuSettingsUtils.LONG_PRESS_POWER_GLOBAL_ACTIONS;
import android.content.Context;
import com.android.internal.annotations.VisibleForTesting;
import com.android.settings.R;
import com.android.settings.core.BasePreferenceController;
public class PowerMenuPreferenceController extends BasePreferenceController {
private static final String POWER_BUTTON_LONG_PRESS_SETTING =
Settings.Global.POWER_BUTTON_LONG_PRESS;
@VisibleForTesting
static final int LONG_PRESS_POWER_GLOBAL_ACTIONS = 1;
@VisibleForTesting
static final int LONG_PRESS_POWER_ASSISTANT_VALUE = 5;
public PowerMenuPreferenceController(Context context, String key) {
super(context, key);
}
@Override
public CharSequence getSummary() {
final int powerButtonValue = getPowerButtonLongPressValue(mContext);
final int powerButtonValue = PowerMenuSettingsUtils.getPowerButtonSettingValue(mContext);
if (powerButtonValue == LONG_PRESS_POWER_ASSISTANT_VALUE) {
return mContext.getText(R.string.power_menu_summary_long_press_for_assist_enabled);
} else if (powerButtonValue == LONG_PRESS_POWER_GLOBAL_ACTIONS) {
@@ -60,11 +53,4 @@ public class PowerMenuPreferenceController extends BasePreferenceController {
return mContext.getResources().getBoolean(
com.android.internal.R.bool.config_longPressOnPowerForAssistantSettingAvailable);
}
private static int getPowerButtonLongPressValue(Context context) {
return Settings.Global.getInt(context.getContentResolver(),
POWER_BUTTON_LONG_PRESS_SETTING,
context.getResources().getInteger(
com.android.internal.R.integer.config_longPressOnPowerBehavior));
}
}

View File

@@ -0,0 +1,68 @@
/*
* 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.gestures;
import android.content.Context;
import android.provider.Settings;
/** Common code for long press power settings shared between controllers. */
final class PowerMenuSettingsUtils {
/**
* Setting storing the current behaviour of long press power.
*/
public static final String POWER_BUTTON_LONG_PRESS_SETTING =
Settings.Global.POWER_BUTTON_LONG_PRESS;
/**
* Value used for long press power button behaviour when the Assist setting is disabled.
*
* If this value matches Assist setting, then it falls back to Global Actions panel or
* power menu, depending on their respective settings.
*/
public static final int POWER_BUTTON_LONG_PRESS_DEFAULT_VALUE_RESOURCE =
com.android.internal.R.integer.config_longPressOnPowerBehavior;
/**
* Values used for long press power button behaviour when Assist setting is enabled.
*
* {@link com.android.server.policy.PhoneWindowManager#LONG_PRESS_POWER_GLOBAL_ACTIONS} for
* source of the value.
*/
static final int LONG_PRESS_POWER_NO_ACTION = 0;
static final int LONG_PRESS_POWER_GLOBAL_ACTIONS = 1;
static final int LONG_PRESS_POWER_ASSISTANT_VALUE = 5; // Settings.Secure.ASSISTANT
/**
* @return current value of power button behaviour.
*/
public static int getPowerButtonSettingValue(Context context) {
return Settings.Global.getInt(context.getContentResolver(),
POWER_BUTTON_LONG_PRESS_SETTING,
context.getResources().getInteger(POWER_BUTTON_LONG_PRESS_DEFAULT_VALUE_RESOURCE));
}
/**
* @return true if long press power for assist is currently enabled.
*/
public static boolean isLongPressPowerForAssistEnabled(Context context) {
return getPowerButtonSettingValue(context) == LONG_PRESS_POWER_ASSISTANT_VALUE;
}
private PowerMenuSettingsUtils() {
}
}

View File

@@ -32,7 +32,9 @@ import androidx.fragment.app.FragmentManager;
import com.android.settings.R;
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
import com.android.settings.network.helper.ConfirmationSimDeletionPredicate;
import com.android.settings.system.ResetDashboardFragment;
import com.android.settings.wifi.dpp.WifiDppUtils;
public class EraseEuiccDataDialogFragment extends InstrumentedDialogFragment implements
DialogInterface.OnClickListener {
@@ -73,6 +75,18 @@ public class EraseEuiccDataDialogFragment extends InstrumentedDialogFragment imp
}
if (which == DialogInterface.BUTTON_POSITIVE) {
if (ConfirmationSimDeletionPredicate.getSingleton().test(getContext())) {
// Create a "verify it's you" verification over keyguard
// when "erase" button been pressed.
// This might protect from erasing by some automation process.
WifiDppUtils.showLockScreen(getContext(), () -> runAsyncWipe());
} else {
runAsyncWipe();
}
}
}
private void runAsyncWipe() {
AsyncTask.execute(new Runnable() {
@Override
public void run() {
@@ -81,5 +95,4 @@ public class EraseEuiccDataDialogFragment extends InstrumentedDialogFragment imp
}
});
}
}
}

View File

@@ -65,14 +65,12 @@ public class MobileNetworkListFragment extends DashboardFragment {
if (Utils.isProviderModelEnabled(getContext())) {
NetworkProviderSimsCategoryController simCategoryPrefCtrl =
new NetworkProviderSimsCategoryController(context, KEY_PREFERENCE_CATEGORY_SIM);
simCategoryPrefCtrl.init(getSettingsLifecycle());
new NetworkProviderSimsCategoryController(context, KEY_PREFERENCE_CATEGORY_SIM,
getSettingsLifecycle());
controllers.add(simCategoryPrefCtrl);
NetworkProviderDownloadedSimsCategoryController downloadedSimsCategoryCtrl =
new NetworkProviderDownloadedSimsCategoryController(context,
KEY_PREFERENCE_CATEGORY_DOWNLOADED_SIM);
downloadedSimsCategoryCtrl.init(getSettingsLifecycle());
KEY_PREFERENCE_CATEGORY_DOWNLOADED_SIM, getSettingsLifecycle());
controllers.add(downloadedSimsCategoryCtrl);
} else {
controllers.add(new MobileNetworkListController(getContext(), getLifecycle()));

View File

@@ -24,6 +24,7 @@ import android.telephony.ServiceState;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.view.View;
import androidx.annotation.VisibleForTesting;
import androidx.lifecycle.LifecycleObserver;
@@ -44,12 +45,14 @@ public class NetworkProviderCallsSmsController extends AbstractPreferenceControl
private static final String TAG = "NetworkProviderCallsSmsController";
private static final String KEY = "calls_and_sms";
private static final String RTL_MARK = "\u200F";
private UserManager mUserManager;
private SubscriptionManager mSubscriptionManager;
private SubscriptionsChangeListener mSubscriptionsChangeListener;
private TelephonyManager mTelephonyManager;
private RestrictedPreference mPreference;
private boolean mIsRtlMode;
/**
* The summary text and click behavior of the "Calls & SMS" item on the
@@ -61,6 +64,8 @@ public class NetworkProviderCallsSmsController extends AbstractPreferenceControl
mUserManager = context.getSystemService(UserManager.class);
mSubscriptionManager = context.getSystemService(SubscriptionManager.class);
mTelephonyManager = mContext.getSystemService(TelephonyManager.class);
mIsRtlMode = context.getResources().getConfiguration().getLayoutDirection()
== View.LAYOUT_DIRECTION_RTL;
if (lifecycle != null) {
mSubscriptionsChangeListener = new SubscriptionsChangeListener(context, this);
lifecycle.addObserver(this);
@@ -121,6 +126,10 @@ public class NetworkProviderCallsSmsController extends AbstractPreferenceControl
if (subInfo != subs.get(subs.size() - 1)) {
summary.append(", ");
}
if (mIsRtlMode) {
summary.insert(0, RTL_MARK).insert(summary.length(), RTL_MARK);
}
}
return summary;
}
@@ -152,12 +161,12 @@ public class NetworkProviderCallsSmsController extends AbstractPreferenceControl
}
@VisibleForTesting
protected int getDefaultVoiceSubscriptionId(){
protected int getDefaultVoiceSubscriptionId() {
return SubscriptionManager.getDefaultVoiceSubscriptionId();
}
@VisibleForTesting
protected int getDefaultSmsSubscriptionId(){
protected int getDefaultSmsSubscriptionId() {
return SubscriptionManager.getDefaultSmsSubscriptionId();
}

View File

@@ -1,11 +1,13 @@
package com.android.settings.network;
import android.content.Context;
import android.util.Log;
import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference;
import androidx.preference.PreferenceCategory;
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import com.android.settings.widget.PreferenceCategoryController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
@@ -13,22 +15,17 @@ import com.android.settingslib.core.lifecycle.LifecycleObserver;
public class NetworkProviderDownloadedSimsCategoryController extends
PreferenceCategoryController implements LifecycleObserver {
private static final String LOG_TAG = "NetworkProviderDownloadedSimsCategoryController";
private static final String KEY_PREFERENCE_CATEGORY_DOWNLOADED_SIM =
"provider_model_downloaded_sim_category";
private PreferenceCategory mPreferenceCategory;
private NetworkProviderDownloadedSimListController mNetworkProviderDownloadedSimListController;
public NetworkProviderDownloadedSimsCategoryController(Context context, String key) {
super(context, key);
}
public void init(Lifecycle lifecycle) {
mNetworkProviderDownloadedSimListController = createDownloadedSimListController(lifecycle);
}
@VisibleForTesting
protected NetworkProviderDownloadedSimListController createDownloadedSimListController(
public NetworkProviderDownloadedSimsCategoryController(Context context, String key,
Lifecycle lifecycle) {
return new NetworkProviderDownloadedSimListController(mContext, lifecycle);
super(context, key);
mNetworkProviderDownloadedSimListController =
new NetworkProviderDownloadedSimListController(mContext, lifecycle);
}
@Override
@@ -44,9 +41,27 @@ public class NetworkProviderDownloadedSimsCategoryController extends
@Override
public void displayPreference(PreferenceScreen screen) {
super.displayPreference(screen);
PreferenceCategory preferenceCategory = screen.findPreference(
KEY_PREFERENCE_CATEGORY_DOWNLOADED_SIM);
preferenceCategory.setVisible(isAvailable());
mNetworkProviderDownloadedSimListController.displayPreference(screen);
mPreferenceCategory = screen.findPreference(
KEY_PREFERENCE_CATEGORY_DOWNLOADED_SIM);
if (mPreferenceCategory == null) {
Log.d(LOG_TAG, "displayPreference(), Can not find the category.");
return;
}
mPreferenceCategory.setVisible(isAvailable());
}
@Override
public void updateState(Preference preference) {
super.updateState(preference);
if (mPreferenceCategory == null) {
Log.d(LOG_TAG, "updateState(), Can not find the category.");
return;
}
int count = mPreferenceCategory.getPreferenceCount();
String title = mContext.getString(count > 1
? R.string.downloaded_sims_category_title
: R.string.downloaded_sim_category_title);
mPreferenceCategory.setTitle(title);
}
}

View File

@@ -71,7 +71,7 @@ import com.android.settings.wifi.WifiConnectListener;
import com.android.settings.wifi.WifiDialog2;
import com.android.settings.wifi.WifiPickerTrackerHelper;
import com.android.settings.wifi.WifiUtils;
import com.android.settings.wifi.details2.WifiNetworkDetailsFragment2;
import com.android.settings.wifi.details.WifiNetworkDetailsFragment;
import com.android.settings.wifi.dpp.WifiDppUtils;
import com.android.settingslib.HelpUtils;
import com.android.settingslib.RestrictedLockUtils;
@@ -710,6 +710,11 @@ public class NetworkProviderSettings extends RestrictedSettingsFragment
Log.i(TAG, "onWifiStateChanged called with wifi state: " + wifiState);
}
if (isFinishingOrDestroyed()) {
Log.w(TAG, "onWifiStateChanged shouldn't run when fragment is finishing or destroyed");
return;
}
switch (wifiState) {
case WifiManager.WIFI_STATE_ENABLED:
updateWifiEntryPreferences();
@@ -924,11 +929,11 @@ public class NetworkProviderSettings extends RestrictedSettingsFragment
: context.getText(R.string.pref_title_network_details);
final Bundle bundle = new Bundle();
bundle.putString(WifiNetworkDetailsFragment2.KEY_CHOSEN_WIFIENTRY_KEY, wifiEntry.getKey());
bundle.putString(WifiNetworkDetailsFragment.KEY_CHOSEN_WIFIENTRY_KEY, wifiEntry.getKey());
new SubSettingLauncher(context)
.setTitleText(title)
.setDestination(WifiNetworkDetailsFragment2.class.getName())
.setDestination(WifiNetworkDetailsFragment.class.getName())
.setArguments(bundle)
.setSourceMetricsCategory(getMetricsCategory())
.launch();
@@ -961,12 +966,10 @@ public class NetworkProviderSettings extends RestrictedSettingsFragment
@VisibleForTesting
void setAdditionalSettingsSummaries() {
if (!FeatureFlagUtils.isEnabled(getContext(), FeatureFlagUtils.SETTINGS_PROVIDER_MODEL)) {
mConfigureWifiSettingsPreference.setSummary(getString(
isWifiWakeupEnabled()
? R.string.wifi_configure_settings_preference_summary_wakeup_on
: R.string.wifi_configure_settings_preference_summary_wakeup_off));
}
final int numSavedNetworks = mWifiPickerTracker.getNumSavedNetworks();
final int numSavedSubscriptions = mWifiPickerTracker.getNumSavedSubscriptions();
@@ -981,6 +984,11 @@ public class NetworkProviderSettings extends RestrictedSettingsFragment
private String getSavedNetworkSettingsSummaryText(
int numSavedNetworks, int numSavedSubscriptions) {
if (getResources() == null) {
Log.w(TAG, "getSavedNetworkSettingsSummaryText shouldn't run if resource is not ready");
return null;
}
if (numSavedSubscriptions == 0) {
return getResources().getQuantityString(R.plurals.wifi_saved_access_points_summary,
numSavedNetworks, numSavedNetworks);
@@ -1174,7 +1182,7 @@ public class NetworkProviderSettings extends RestrictedSettingsFragment
private void launchConfigNewNetworkFragment(WifiEntry wifiEntry) {
final Bundle bundle = new Bundle();
bundle.putString(WifiNetworkDetailsFragment2.KEY_CHOSEN_WIFIENTRY_KEY,
bundle.putString(WifiNetworkDetailsFragment.KEY_CHOSEN_WIFIENTRY_KEY,
wifiEntry.getKey());
new SubSettingLauncher(getContext())
.setTitleText(wifiEntry.getTitle())

View File

@@ -172,7 +172,6 @@ public class NetworkProviderSimListController extends AbstractPreferenceControll
for (SubscriptionInfo info : SubscriptionUtil.getAvailableSubscriptions(mContext)) {
if (!info.isEmbedded()) {
subList.add(info);
break;
}
}
return subList;

View File

@@ -17,33 +17,28 @@
package com.android.settings.network;
import android.content.Context;
import android.util.Log;
import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference;
import androidx.preference.PreferenceCategory;
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import com.android.settings.widget.PreferenceCategoryController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
public class NetworkProviderSimsCategoryController extends PreferenceCategoryController implements
LifecycleObserver {
private static final String LOG_TAG = "NetworkProviderSimsCategoryController";
private static final String KEY_PREFERENCE_CATEGORY_SIM = "provider_model_sim_category";
private NetworkProviderSimListController mNetworkProviderSimListController;
private PreferenceCategory mPreferenceCategory;
public NetworkProviderSimsCategoryController(Context context, String key) {
public NetworkProviderSimsCategoryController(Context context, String key, Lifecycle lifecycle) {
super(context, key);
}
public void init(Lifecycle lifecycle) {
mNetworkProviderSimListController = createSimListController(lifecycle);
}
@VisibleForTesting
protected NetworkProviderSimListController createSimListController(
Lifecycle lifecycle) {
return new NetworkProviderSimListController(mContext, lifecycle);
mNetworkProviderSimListController =
new NetworkProviderSimListController(mContext, lifecycle);
}
@Override
@@ -59,8 +54,26 @@ public class NetworkProviderSimsCategoryController extends PreferenceCategoryCon
@Override
public void displayPreference(PreferenceScreen screen) {
super.displayPreference(screen);
PreferenceCategory preferenceCategory = screen.findPreference(KEY_PREFERENCE_CATEGORY_SIM);
preferenceCategory.setVisible(isAvailable());
mNetworkProviderSimListController.displayPreference(screen);
mPreferenceCategory = screen.findPreference(KEY_PREFERENCE_CATEGORY_SIM);
if (mPreferenceCategory == null) {
Log.d(LOG_TAG, "displayPreference(), Can not find the category.");
return;
}
mPreferenceCategory.setVisible(isAvailable());
}
@Override
public void updateState(Preference preference) {
super.updateState(preference);
if (mPreferenceCategory == null) {
Log.d(LOG_TAG, "updateState(), Can not find the category.");
return;
}
int count = mPreferenceCategory.getPreferenceCount();
String title = mContext.getString(count > 1
? R.string.provider_network_settings_title
: R.string.sim_category_title);
mPreferenceCategory.setTitle(title);
}
}

View File

@@ -311,7 +311,8 @@ public class SubscriptionsPreferenceController extends AbstractPreferenceControl
numLevels += 1;
}
Drawable icon = mSubsPrefCtrlInjector.getIcon(mContext, level, numLevels, false);
Drawable icon = mSubsPrefCtrlInjector.getIcon(mContext, level, numLevels,
!mTelephonyManager.isDataEnabled());
final boolean isActiveCellularNetwork =
mSubsPrefCtrlInjector.isActiveCellularNetwork(mContext);
if (isActiveCellularNetwork || (mWifiPickerTrackerHelper != null)

View File

@@ -0,0 +1,66 @@
/*
* 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.network.helper;
import android.app.KeyguardManager;
import android.content.Context;
import android.provider.Settings;
import com.android.settings.R;
import java.util.function.Predicate;
/**
* {@link Predicate} for detecting the configuration of confirm SIM deletion.
*/
public class ConfirmationSimDeletionPredicate implements Predicate<Context> {
public static final String KEY_CONFIRM_SIM_DELETION = "confirm_sim_deletion";
private static final ConfirmationSimDeletionPredicate sSingleton =
new ConfirmationSimDeletionPredicate();
// Get singleton of this predicate
public static final ConfirmationSimDeletionPredicate getSingleton() {
return sSingleton;
}
/**
* Get default configuration of confirm SIM deletion.
*
* @param Context context
* @return the configuration of confirm SIM deletion
*/
private static boolean getDefaultValue(Context context) {
return context.getResources()
.getBoolean(R.bool.config_sim_deletion_confirmation_default_on);
}
/**
* Get the configuration of confirm SIM deletion.
*
* @param Context context
* @return the configuration of confirm SIM deletion
*/
public boolean test(Context context) {
final KeyguardManager keyguardManager = context.getSystemService(KeyguardManager.class);
if ((keyguardManager != null) && !keyguardManager.isKeyguardSecure()) {
return false;
}
return Settings.Global.getInt(context.getContentResolver(), KEY_CONFIRM_SIM_DELETION,
getDefaultValue(context) ? 1 : 0) == 1;
}
}

View File

@@ -46,7 +46,7 @@ public class CallsDefaultSubscriptionController extends DefaultSubscriptionContr
@Override
public CharSequence getSummary() {
if (Utils.isProviderModelEnabled(mContext)) {
return MobileNetworkUtils.getPreferredStatus(mContext, mManager, true);
return MobileNetworkUtils.getPreferredStatus(isRtlMode(), mContext, mManager, true);
} else {
return super.getSummary();
}

View File

@@ -26,6 +26,7 @@ import android.telecom.PhoneAccountHandle;
import android.telecom.TelecomManager;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.view.View;
import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleObserver;
@@ -62,11 +63,14 @@ public abstract class DefaultSubscriptionController extends TelephonyBasePrefere
private static final ComponentName PSTN_CONNECTION_SERVICE_COMPONENT =
new ComponentName("com.android.phone",
"com.android.services.telephony.TelephonyConnectionService");
private boolean mIsRtlMode;
public DefaultSubscriptionController(Context context, String preferenceKey) {
super(context, preferenceKey);
mManager = context.getSystemService(SubscriptionManager.class);
mChangeListener = new SubscriptionsChangeListener(context, this);
mIsRtlMode = context.getResources().getConfiguration().getLayoutDirection()
== View.LAYOUT_DIRECTION_RTL;
}
public void init(Lifecycle lifecycle) {
@@ -285,4 +289,8 @@ public abstract class DefaultSubscriptionController extends TelephonyBasePrefere
refreshSummary(mPreference);
}
}
boolean isRtlMode() {
return mIsRtlMode;
}
}

View File

@@ -39,7 +39,6 @@ import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import androidx.lifecycle.Lifecycle;
import com.android.internal.util.CollectionUtils;
import com.android.settings.R;
import com.android.settings.core.SettingsBaseActivity;
import com.android.settings.network.ProxySubscriptionManager;
@@ -48,6 +47,7 @@ import com.android.settings.network.helper.SelectableSubscriptions;
import com.android.settings.network.helper.SubscriptionAnnotation;
import java.util.List;
import java.util.function.Function;
/**
* Activity for displaying MobileNetworkSettings
@@ -64,15 +64,14 @@ public class MobileNetworkActivity extends SettingsBaseActivity
@VisibleForTesting
ProxySubscriptionManager mProxySubscriptionMgr;
private int mCurSubscriptionId;
private int mCurSubscriptionId = SUB_ID_NULL;
// This flag forces subscription information fragment to be re-created.
// Otherwise, fragment will be kept when subscription id has not been changed.
//
// Set initial value to true allows subscription information fragment to be re-created when
// Activity re-create occur.
private boolean mFragmentForceReload = true;
private boolean mPendingSubscriptionChange = false;
private boolean mPendingSubscriptionChange = true;
@Override
protected void onNewIntent(Intent intent) {
@@ -80,21 +79,25 @@ public class MobileNetworkActivity extends SettingsBaseActivity
validate(intent);
setIntent(intent);
int updateSubscriptionIndex = SUB_ID_NULL;
int updateSubscriptionIndex = mCurSubscriptionId;
if (intent != null) {
updateSubscriptionIndex = intent.getIntExtra(Settings.EXTRA_SUB_ID, SUB_ID_NULL);
}
SubscriptionInfo info = getSubscriptionOrDefault(updateSubscriptionIndex);
if (info == null) {
Log.d(TAG, "Invalid subId request " + mCurSubscriptionId
+ " -> " + updateSubscriptionIndex);
return;
}
int oldSubId = mCurSubscriptionId;
mCurSubscriptionId = updateSubscriptionIndex;
mFragmentForceReload = (mCurSubscriptionId == oldSubId);
final SubscriptionInfo info = getSubscription();
updateSubscriptions(info, null);
// If the subscription has changed or the new intent doesnt contain the opt in action,
// remove the old discovery dialog. If the activity is being recreated, we will see
// onCreate -> onNewIntent, so the dialog will first be recreated for the old subscription
// and then removed.
if (updateSubscriptionIndex != oldSubId || !doesIntentContainOptInAction(intent)) {
if (mCurSubscriptionId != oldSubId || !doesIntentContainOptInAction(intent)) {
removeContactDiscoveryDialog(oldSubId);
}
// evaluate showing the new discovery dialog if this intent contains an action to show the
@@ -135,7 +138,13 @@ public class MobileNetworkActivity extends SettingsBaseActivity
// perform registration after mCurSubscriptionId been configured.
registerActiveSubscriptionsListener();
final SubscriptionInfo subscription = getSubscription();
SubscriptionInfo subscription = getSubscriptionOrDefault(mCurSubscriptionId);
if (subscription == null) {
Log.d(TAG, "Invalid subId request " + mCurSubscriptionId);
tryToFinishActivity();
return;
}
maybeShowContactDiscoveryDialog(subscription);
updateSubscriptions(subscription, null);
@@ -158,39 +167,81 @@ public class MobileNetworkActivity extends SettingsBaseActivity
* Implementation of ProxySubscriptionManager.OnActiveSubscriptionChangedListener
*/
public void onChanged() {
mPendingSubscriptionChange = false;
if (mCurSubscriptionId == SUB_ID_NULL) {
return;
}
if (!getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED)) {
mPendingSubscriptionChange = true;
return;
}
SubscriptionInfo info = getSubscription();
int oldSubIndex = mCurSubscriptionId;
updateSubscriptions(info, null);
// Remove the dialog if the subscription associated with this activity changes.
if (info == null) {
// Close the activity when subscription removed
if ((oldSubIndex != SUB_ID_NULL)
&& (!isFinishing()) && (!isDestroyed())) {
finish();
SubscriptionInfo subInfo = getSubscription(mCurSubscriptionId, null);
if (subInfo != null) {
if (mCurSubscriptionId != subInfo.getSubscriptionId()) {
// update based on subscription status change
removeContactDiscoveryDialog(mCurSubscriptionId);
updateSubscriptions(subInfo, null);
}
return;
}
int subIndex = info.getSubscriptionId();
if (subIndex != oldSubIndex) {
removeContactDiscoveryDialog(oldSubIndex);
Log.w(TAG, "subId missing: " + mCurSubscriptionId);
// When UI is not the active one, avoid from destroy it immediately
// but wait until onResume() to see if subscription back online again.
// This is to avoid from glitch behavior of subscription which changes
// the UI when UI is considered as in the background or only partly
// visible.
if (!getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.RESUMED)) {
mPendingSubscriptionChange = true;
return;
}
// Subscription could be missing
tryToFinishActivity();
}
protected void runSubscriptionUpdate(Runnable onUpdateRemaining) {
SubscriptionInfo subInfo = getSubscription(mCurSubscriptionId, null);
if (subInfo == null) {
tryToFinishActivity();
return;
}
if (mCurSubscriptionId != subInfo.getSubscriptionId()) {
removeContactDiscoveryDialog(mCurSubscriptionId);
updateSubscriptions(subInfo, null);
}
onUpdateRemaining.run();
}
protected void tryToFinishActivity() {
if ((!isFinishing()) && (!isDestroyed())) {
finish();
}
}
@Override
protected void onStart() {
getProxySubscriptionManager().setLifecycle(getLifecycle());
super.onStart();
// updateSubscriptions doesn't need to be called, onChanged will always be called after we
// register a listener.
if (mPendingSubscriptionChange) {
mPendingSubscriptionChange = false;
onChanged();
runSubscriptionUpdate(() -> super.onStart());
return;
}
super.onStart();
}
@Override
protected void onResume() {
if (mPendingSubscriptionChange) {
mPendingSubscriptionChange = false;
runSubscriptionUpdate(() -> super.onResume());
return;
}
super.onResume();
}
@Override
@@ -235,30 +286,49 @@ public class MobileNetworkActivity extends SettingsBaseActivity
}
mCurSubscriptionId = subscriptionIndex;
mFragmentForceReload = false;
}
/**
* Select one of the subscription as the default subscription.
* @param subAnnoList a list of {@link SubscriptionAnnotation}
* @return ideally the {@link SubscriptionAnnotation} as expected
*/
protected SubscriptionAnnotation defaultSubscriptionSelection(
List<SubscriptionAnnotation> subAnnoList) {
return (subAnnoList == null) ? null :
subAnnoList.stream()
.filter(SubscriptionAnnotation::isDisplayAllowed)
.filter(SubscriptionAnnotation::isActive)
.findFirst().orElse(null);
}
protected SubscriptionInfo getSubscriptionOrDefault(int subscriptionId) {
return getSubscription(subscriptionId,
(subscriptionId != SUB_ID_NULL) ? null : (
subAnnoList -> defaultSubscriptionSelection(subAnnoList)
));
}
/**
* Get the current subscription to display. First check whether intent has {@link
* Settings#EXTRA_SUB_ID} and if so find the subscription with that id. If not, just return the
* first one in the mSubscriptionInfos list since it is already sorted by sim slot.
* Settings#EXTRA_SUB_ID} and if so find the subscription with that id.
* If not, select default one based on {@link Function} provided.
*
* @param preferredSubscriptionId preferred subscription id
* @param selectionOfDefault when true current subscription is absent
*/
@VisibleForTesting
SubscriptionInfo getSubscription() {
protected SubscriptionInfo getSubscription(int preferredSubscriptionId,
Function<List<SubscriptionAnnotation>, SubscriptionAnnotation> selectionOfDefault) {
List<SubscriptionAnnotation> subList =
(new SelectableSubscriptions(this, true)).call();
SubscriptionAnnotation currentSubInfo = null;
if (mCurSubscriptionId != SUB_ID_NULL) {
currentSubInfo = subList.stream()
Log.d(TAG, "get subId=" + preferredSubscriptionId + " from " + subList);
SubscriptionAnnotation currentSubInfo = subList.stream()
.filter(SubscriptionAnnotation::isDisplayAllowed)
.filter(subAnno -> (subAnno.getSubscriptionId() == mCurSubscriptionId))
.findFirst().orElse(null);
}
if (currentSubInfo == null) {
currentSubInfo = subList.stream()
.filter(SubscriptionAnnotation::isDisplayAllowed)
.filter(SubscriptionAnnotation::isActive)
.filter(subAnno -> (subAnno.getSubscriptionId() == preferredSubscriptionId))
.findFirst().orElse(null);
if ((currentSubInfo == null) && (selectionOfDefault != null)) {
currentSubInfo = selectionOfDefault.apply(subList);
}
return (currentSubInfo == null) ? null : currentSubInfo.getSubInfo();
}
@@ -285,10 +355,6 @@ public class MobileNetworkActivity extends SettingsBaseActivity
final String fragmentTag = buildFragmentTag(subId);
if (fragmentManager.findFragmentByTag(fragmentTag) != null) {
if (!mFragmentForceReload) {
Log.d(TAG, "Keep current fragment: " + fragmentTag);
return;
}
Log.d(TAG, "Construct fragment: " + fragmentTag);
}

View File

@@ -193,6 +193,7 @@ public class MobileNetworkSettings extends AbstractMobileNetworkSettings {
.addListener(videoCallingPreferenceController);
use(ContactDiscoveryPreferenceController.class).init(getParentFragmentManager(), mSubId,
getLifecycle());
use(NrAdvancedCallingPreferenceController.class).init(mSubId);
}
@Override

View File

@@ -84,6 +84,8 @@ import java.util.Arrays;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
public class MobileNetworkUtils {
@@ -99,6 +101,7 @@ public class MobileNetworkUtils {
"esim.enable_esim_system_ui_by_default";
private static final String LEGACY_ACTION_CONFIGURE_PHONE_ACCOUNT =
"android.telecom.action.CONNECTION_SERVICE_CONFIGURE";
private static final String RTL_MARK = "\u200F";
// The following constants are used to draw signal icon.
public static final int NO_CELL_DATA_TYPE_ICON = 0;
@@ -257,9 +260,16 @@ public class MobileNetworkUtils {
public static boolean showEuiccSettings(Context context) {
long timeForAccess = SystemClock.elapsedRealtime();
try {
return ((Future<Boolean>) ThreadUtils.postOnBackgroundThread(()
-> showEuiccSettingsDetecting(context))).get();
} catch (ExecutionException | InterruptedException exception) {
Boolean isShow = ((Future<Boolean>) ThreadUtils.postOnBackgroundThread(() -> {
try {
return showEuiccSettingsDetecting(context);
} catch (Exception threadException) {
Log.w(TAG, "Accessing Euicc failure", threadException);
}
return Boolean.FALSE;
})).get(3, TimeUnit.SECONDS);
return ((isShow != null) && isShow.booleanValue());
} catch (ExecutionException | InterruptedException | TimeoutException exception) {
timeForAccess = SystemClock.elapsedRealtime() - timeForAccess;
Log.w(TAG, "Accessing Euicc takes too long: +" + timeForAccess + "ms");
}
@@ -278,7 +288,7 @@ public class MobileNetworkUtils {
final ContentResolver cr = context.getContentResolver();
final boolean esimIgnoredDevice =
Arrays.asList(TextUtils.split(SystemProperties.get(KEY_ESIM_CID_IGNORE, ""), ","))
.contains(SystemProperties.get(KEY_CID, null));
.contains(SystemProperties.get(KEY_CID));
final boolean enabledEsimUiByDefault =
SystemProperties.getBoolean(KEY_ENABLE_ESIM_UI_BY_DEFAULT, true);
final boolean euiccProvisioned =
@@ -922,7 +932,7 @@ public class MobileNetworkUtils {
/**
* Returns preferred status of Calls & SMS separately when Provider Model is enabled.
*/
public static CharSequence getPreferredStatus(Context context,
public static CharSequence getPreferredStatus(boolean isRtlMode, Context context,
SubscriptionManager subscriptionManager, boolean isPreferredCallStatus) {
final List<SubscriptionInfo> subs = SubscriptionUtil.getActiveSubscriptions(
subscriptionManager);
@@ -956,6 +966,10 @@ public class MobileNetworkUtils {
if (subInfo != subs.get(subs.size() - 1)) {
summary.append(", ");
}
if (isRtlMode) {
summary.insert(0, RTL_MARK).insert(summary.length(), RTL_MARK);
}
}
return summary;
} else {

View File

@@ -0,0 +1,197 @@
/*
* 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.network.telephony;
import android.content.Context;
import android.os.PersistableBundle;
import android.telephony.CarrierConfigManager;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyCallback;
import android.telephony.TelephonyManager;
import android.util.Log;
import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
import androidx.preference.SwitchPreference;
import com.android.internal.telephony.util.ArrayUtils;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnStart;
import com.android.settingslib.core.lifecycle.events.OnStop;
/**
* Preference controller for "Enhanced 4G LTE"
*/
public class NrAdvancedCallingPreferenceController extends TelephonyTogglePreferenceController
implements LifecycleObserver, OnStart, OnStop {
private static final String TAG = "VoNrSettings";
@VisibleForTesting
Preference mPreference;
private TelephonyManager mTelephonyManager;
private PhoneCallStateTelephonyCallback mTelephonyCallback;
private boolean mIsVonrVisibleFromCarrierConfig = false;
private boolean mIsNrEnableFromCarrierConfig = false;
private boolean mHas5gCapability = false;
private Integer mCallState;
public NrAdvancedCallingPreferenceController(Context context, String key) {
super(context, key);
mTelephonyManager = context.getSystemService(TelephonyManager.class);
}
/**
* Initial this PreferenceController.
* @param subId The subscription Id.
* @return This PreferenceController.
*/
public NrAdvancedCallingPreferenceController init(int subId) {
Log.d(TAG, "init: ");
if (mTelephonyCallback == null) {
mTelephonyCallback = new PhoneCallStateTelephonyCallback();
}
mSubId = subId;
if (mTelephonyManager == null) {
mTelephonyManager = mContext.getSystemService(TelephonyManager.class);
}
if (SubscriptionManager.isValidSubscriptionId(subId)) {
mTelephonyManager = mTelephonyManager.createForSubscriptionId(subId);
}
long supportedRadioBitmask = mTelephonyManager.getSupportedRadioAccessFamily();
mHas5gCapability =
(supportedRadioBitmask & TelephonyManager.NETWORK_TYPE_BITMASK_NR) > 0;
PersistableBundle carrierConfig = getCarrierConfigForSubId(subId);
if (carrierConfig == null) {
return this;
}
mIsVonrVisibleFromCarrierConfig = carrierConfig.getBoolean(
CarrierConfigManager.KEY_VONR_SETTING_VISIBILITY_BOOL);
int[] nrAvailabilities = carrierConfig.getIntArray(
CarrierConfigManager.KEY_CARRIER_NR_AVAILABILITIES_INT_ARRAY);
mIsNrEnableFromCarrierConfig = !ArrayUtils.isEmpty(nrAvailabilities);
Log.d(TAG, "mHas5gCapability: " + mHas5gCapability
+ ",mIsNrEnabledFromCarrierConfig: " + mIsNrEnableFromCarrierConfig
+ ",mIsVonrVisibleFromCarrierConfig: " + mIsVonrVisibleFromCarrierConfig);
return this;
}
@Override
public int getAvailabilityStatus(int subId) {
init(subId);
if (mHas5gCapability && mIsNrEnableFromCarrierConfig && mIsVonrVisibleFromCarrierConfig) {
return AVAILABLE;
}
return CONDITIONALLY_UNAVAILABLE;
}
@Override
public void displayPreference(PreferenceScreen screen) {
super.displayPreference(screen);
mPreference = screen.findPreference(getPreferenceKey());
}
@Override
public void onStart() {
if (mTelephonyCallback == null) {
return;
}
mTelephonyCallback.register(mTelephonyManager);
}
@Override
public void onStop() {
if (mTelephonyCallback == null) {
return;
}
mTelephonyCallback.unregister();
}
@Override
public void updateState(Preference preference) {
super.updateState(preference);
if (preference == null) {
return;
}
final SwitchPreference switchPreference = (SwitchPreference) preference;
switchPreference.setEnabled(isUserControlAllowed());
}
@Override
public boolean setChecked(boolean isChecked) {
if (!SubscriptionManager.isValidSubscriptionId(mSubId)) {
return false;
}
Log.d(TAG, "setChecked: " + isChecked);
int result = mTelephonyManager.setVoNrEnabled(isChecked);
if (result == TelephonyManager.ENABLE_VONR_SUCCESS) {
return true;
}
Log.d(TAG, "Fail to set VoNR result= " + result + ". subId=" + mSubId);
return false;
}
@Override
public boolean isChecked() {
return mTelephonyManager.isVoNrEnabled();
}
@VisibleForTesting
protected boolean isCallStateIdle() {
return (mCallState != null) && (mCallState == TelephonyManager.CALL_STATE_IDLE);
}
private boolean isUserControlAllowed() {
return isCallStateIdle();
}
private class PhoneCallStateTelephonyCallback extends TelephonyCallback implements
TelephonyCallback.CallStateListener {
private TelephonyManager mLocalTelephonyManager;
@Override
public void onCallStateChanged(int state) {
mCallState = state;
updateState(mPreference);
}
public void register(TelephonyManager telephonyManager) {
mLocalTelephonyManager = telephonyManager;
// assign current call state so that it helps to show correct preference state even
// before first onCallStateChanged() by initial registration.
mCallState = mLocalTelephonyManager.getCallState();
mLocalTelephonyManager.registerTelephonyCallback(
mContext.getMainExecutor(), mTelephonyCallback);
}
public void unregister() {
mCallState = null;
if (mLocalTelephonyManager != null) {
mLocalTelephonyManager.unregisterTelephonyCallback(this);
}
}
}
}

View File

@@ -52,6 +52,7 @@ import com.android.settingslib.DeviceInfoUtils;
import com.google.common.collect.ImmutableMap;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@@ -108,18 +109,18 @@ public class RenameMobileNetworkDialogFragment extends InstrumentedDialogFragmen
mSubId = getArguments().getInt(KEY_SUBSCRIPTION_ID);
Resources res = context.getResources();
mLightDarkMap = ImmutableMap.<Integer, Integer>builder()
.put(res.getInteger(R.color.SIM_color_teal),
res.getInteger(R.color.SIM_dark_mode_color_teal))
.put(res.getInteger(R.color.SIM_color_blue),
.put(res.getInteger(R.color.SIM_color_cyan),
res.getInteger(R.color.SIM_dark_mode_color_cyan))
.put(res.getInteger(R.color.SIM_color_blue800),
res.getInteger(R.color.SIM_dark_mode_color_blue))
.put(res.getInteger(R.color.SIM_color_indigo),
res.getInteger(R.color.SIM_dark_mode_color_indigo))
.put(res.getInteger(R.color.SIM_color_purple),
.put(res.getInteger(R.color.SIM_color_green800),
res.getInteger(R.color.SIM_dark_mode_color_green))
.put(res.getInteger(R.color.SIM_color_purple800),
res.getInteger(R.color.SIM_dark_mode_color_purple))
.put(res.getInteger(R.color.SIM_color_pink),
.put(res.getInteger(R.color.SIM_color_pink800),
res.getInteger(R.color.SIM_dark_mode_color_pink))
.put(res.getInteger(R.color.SIM_color_red),
res.getInteger(R.color.SIM_dark_mode_color_red))
.put(res.getInteger(R.color.SIM_color_orange),
res.getInteger(R.color.SIM_dark_mode_color_orange))
.build();
}
@@ -175,12 +176,7 @@ public class RenameMobileNetworkDialogFragment extends InstrumentedDialogFragmen
final ColorAdapter adapter = new ColorAdapter(getContext(),
R.layout.dialog_mobile_network_color_picker_item, mColors);
mColorSpinner.setAdapter(adapter);
for (int i = 0; i < mColors.length; i++) {
if (mColors[i].getColor() == info.getIconTint()) {
mColorSpinner.setSelection(i);
break;
}
}
mColorSpinner.setSelection(getSimColorIndex(info.getIconTint()));
final TextView operatorName = view.findViewById(R.id.operator_name_value);
mTelephonyManager = mTelephonyManager.createForSubscriptionId(mSubId);
@@ -239,7 +235,7 @@ public class RenameMobileNetworkDialogFragment extends InstrumentedDialogFragmen
private Color[] getColors() {
final Resources res = getContext().getResources();
final int[] colorInts = res.getIntArray(com.android.internal.R.array.sim_colors);
final int[] colorInts = res.getIntArray(R.array.sim_color_light);
final String[] colorStrings = res.getStringArray(R.array.color_picker);
final int iconSize = res.getDimensionPixelSize(R.dimen.color_swatch_size);
final int strokeWidth = res.getDimensionPixelSize(R.dimen.color_swatch_stroke_width);
@@ -286,4 +282,31 @@ public class RenameMobileNetworkDialogFragment extends InstrumentedDialogFragmen
private int getDarkColor(int lightColor) {
return mLightDarkMap.getOrDefault(lightColor, lightColor);
}
/*
* Get the color index from previous color that defined in Android OS
* (frameworks/base/core/res/res/values/arrays.xml). If can't find the color, continue to look
* for it in the new color plattee. If not, give it the first index.
*/
private int getSimColorIndex(int color) {
int index = -1;
final int[] previousSimColorInts =
getContext().getResources().getIntArray(com.android.internal.R.array.sim_colors);
for (int i = 0; i < previousSimColorInts.length; i++) {
if (previousSimColorInts[i] == color) {
index = i;
}
}
if (index == -1) {
for (int i = 0; i < mColors.length; i++) {
if (mColors[i].getColor() == color) {
index = i;
}
}
}
return index == -1 ? 0 : index;
}
}

View File

@@ -62,7 +62,7 @@ public class SmsDefaultSubscriptionController extends DefaultSubscriptionControl
@Override
public CharSequence getSummary() {
if (Utils.isProviderModelEnabled(mContext)) {
return MobileNetworkUtils.getPreferredStatus(mContext, mManager, false);
return MobileNetworkUtils.getPreferredStatus(isRtlMode(), mContext, mManager, false);
} else {
return super.getSummary();
}

View File

@@ -32,6 +32,8 @@ import com.android.settings.nfc.PaymentBackend.PaymentInfo;
import java.util.List;
import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
public final class PaymentDefaultDialog extends AlertActivity implements
DialogInterface.OnClickListener {
@@ -44,6 +46,9 @@ public final class PaymentDefaultDialog extends AlertActivity implements
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().addPrivateFlags(SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
try {
mBackend = new PaymentBackend(this);
} catch (NullPointerException e) {

View File

@@ -233,8 +233,13 @@ public class RecentConversationsPreferenceController extends AbstractPreferenceC
private final Collator sCollator = Collator.getInstance();
@Override
public int compare(ConversationChannel o1, ConversationChannel o2) {
int labelComparison = sCollator.compare(o1.getShortcutInfo().getLabel(),
o2.getShortcutInfo().getLabel());
int labelComparison = 0;
if (o1.getShortcutInfo().getLabel() != null
&& o2.getShortcutInfo().getLabel() != null) {
labelComparison = sCollator.compare(
o1.getShortcutInfo().getLabel().toString(),
o2.getShortcutInfo().getLabel().toString());
}
if (labelComparison == 0) {
return o1.getNotificationChannel().getId().compareTo(

View File

@@ -163,7 +163,7 @@ public class NotificationHistoryActivity extends CollapsingToolbarBaseActivity {
View viewForPackage = LayoutInflater.from(this)
.inflate(R.layout.notification_history_app_layout, null);
final View container = viewForPackage.findViewById(R.id.notification_list);
final View container = viewForPackage.findViewById(R.id.notification_list_wrapper);
container.setVisibility(View.GONE);
View header = viewForPackage.findViewById(R.id.app_header);
NotificationExpandButton expand = viewForPackage.findViewById(

View File

@@ -71,6 +71,11 @@ public class NotificationHistoryAdapter extends
return new NotificationHistoryViewHolder(view);
}
@Override
public long getItemId(int position) {
return mValues.get(position).hashCode();
}
@Override
public void onBindViewHolder(final @NonNull NotificationHistoryViewHolder holder,
int position) {
@@ -85,7 +90,6 @@ public class NotificationHistoryAdapter extends
.putExtra(EXTRA_APP_PACKAGE, hn.getPackage())
.putExtra(EXTRA_CHANNEL_ID, hn.getChannelId())
.putExtra(EXTRA_CONVERSATION_ID, hn.getConversationId());
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
holder.itemView.getContext().startActivityAsUser(intent, UserHandle.of(hn.getUserId()));
};
holder.itemView.setOnClickListener(onClick);

View File

@@ -40,7 +40,6 @@ public class NotificationHistoryRecyclerView extends RecyclerView {
ItemTouchHelper touchHelper = new ItemTouchHelper(
new DismissTouchHelper(0, ItemTouchHelper.START | ItemTouchHelper.END));
touchHelper.attachToRecyclerView(this);
setNestedScrollingEnabled(false);
}
public void setOnItemSwipeDeleteListener(OnItemSwipeDeleteListener listener) {

Some files were not shown because too many files have changed in this diff Show More