Snap for 8909447 from ddfb5f5cb4 to udc-release
Change-Id: Ibcd23301747e6d073ce386fb83c2b5528283f9db
This commit is contained in:
36
res/drawable/ic_fast_pair_24dp.xml
Normal file
36
res/drawable/ic_fast_pair_24dp.xml
Normal file
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2022 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"
|
||||
android:tint="?android:attr/colorControlNormal">
|
||||
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M20.65,19.27c-0.35,0-0.69-0.13-0.96-0.4l-8.66-8.66c-0.53-0.53-0.53-1.38,0-1.91 c0.53-0.53,1.38-0.53,1.91,0l8.66,8.66c0.53,0.53,0.53,1.38,0,1.91C21.34,19.14,20.99,19.27,20.65,19.27z" />
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M12.01,16.09c-0.35,0-0.69-0.13-0.96-0.4L2.4,7.04c-0.53-0.53-0.53-1.38,0-1.91s1.38-0.53,1.91,0l8.66,8.66 c0.53,0.53,0.53,1.38,0,1.91C12.7,15.96,12.36,16.09,12.01,16.09z" />
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M6.32,19.06c0-0.34,0.13-0.69,0.4-0.95l1.85-1.85c0.53-0.53,1.38-0.53,1.91,0c0.53,0.53,0.53,1.38,0,1.91 l-1.85,1.85c-0.53,0.53-1.38,0.53-1.91,0C6.45,19.75,6.32,19.4,6.32,19.06z" />
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M13.13,6.79c0-0.34,0.13-0.69,0.4-0.95l1.85-1.85c0.53-0.53,1.38-0.53,1.91,0c0.53,0.53,0.53,1.38,0,1.91 l-1.85,1.85c-0.53,0.53-1.38,0.53-1.91,0C13.27,7.48,13.13,7.13,13.13,6.79z" />
|
||||
</vector>
|
||||
@@ -34,5 +34,6 @@
|
||||
android:ellipsize="end"
|
||||
android:textAppearance="?android:attr/textAppearanceListItem"
|
||||
android:hyphenationFrequency="normalFast"
|
||||
android:lineBreakWordStyle="phrase"
|
||||
style="@style/MainSwitchText.Settingslib" />
|
||||
</LinearLayout>
|
||||
|
||||
@@ -60,6 +60,7 @@
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceListItem"
|
||||
android:hyphenationFrequency="normalFast"
|
||||
android:lineBreakWordStyle="phrase"
|
||||
android:ellipsize="marquee" />
|
||||
|
||||
<TextView
|
||||
@@ -71,6 +72,7 @@
|
||||
android:textAppearance="?android:attr/textAppearanceListItemSecondary"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:hyphenationFrequency="normalFast"
|
||||
android:lineBreakWordStyle="phrase"
|
||||
android:maxLines="10" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingVertical="@dimen/settingslib_illustration_padding"
|
||||
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
|
||||
android:paddingStart="?android:attr/listPreferredItemPaddingStart">
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:focusable="false"
|
||||
android:hyphenationFrequency="normalFast"
|
||||
android:lineBreakWordStyle="phrase"
|
||||
android:maxLines="2" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
@@ -57,6 +57,7 @@
|
||||
android:ellipsize="marquee"
|
||||
android:duplicateParentState="true"
|
||||
android:hyphenationFrequency="normalFast"
|
||||
android:lineBreakWordStyle="phrase"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@android:id/summary"
|
||||
@@ -69,6 +70,7 @@
|
||||
android:visibility="gone"
|
||||
android:duplicateParentState="true"
|
||||
android:hyphenationFrequency="normalFast"
|
||||
android:lineBreakWordStyle="phrase"
|
||||
/>
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
android:textAlignment="viewStart"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:hyphenationFrequency="normalFast"
|
||||
android:lineBreakWordStyle="phrase"
|
||||
android:textColor="?android:attr/textColorSecondary" />
|
||||
|
||||
<com.android.settings.fuelgauge.BatteryActiveView
|
||||
|
||||
@@ -54,6 +54,15 @@
|
||||
<include
|
||||
android:id="@+id/bluetooth_audio_codec_ldac"
|
||||
layout="@layout/preference_widget_dialog_radiobutton"/>
|
||||
|
||||
<include
|
||||
android:id="@+id/bluetooth_audio_codec_lc3"
|
||||
layout="@layout/preference_widget_dialog_radiobutton"/>
|
||||
|
||||
<include
|
||||
android:id="@+id/bluetooth_audio_codec_opus"
|
||||
layout="@layout/preference_widget_dialog_radiobutton"/>
|
||||
|
||||
</RadioGroup>
|
||||
|
||||
<include
|
||||
|
||||
@@ -59,7 +59,8 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
android:text="@string/customize_button_title"
|
||||
android:hyphenationFrequency="full"
|
||||
android:hyphenationFrequency="normalFast"
|
||||
android:lineBreakWordStyle="phrase"
|
||||
app:layout_constraintTop_toTopOf="@+id/preview"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/preview"
|
||||
app:layout_constraintStart_toStartOf="@+id/preview"
|
||||
|
||||
@@ -63,6 +63,7 @@
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceListItem"
|
||||
android:hyphenationFrequency="normalFast"
|
||||
android:lineBreakWordStyle="phrase"
|
||||
android:ellipsize="marquee"/>
|
||||
|
||||
<TextView
|
||||
@@ -77,6 +78,7 @@
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:maxLines="4"
|
||||
android:hyphenationFrequency="normalFast"
|
||||
android:lineBreakWordStyle="phrase"
|
||||
style="@style/PreferenceSummaryTextStyle"/>
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:hyphenationFrequency="normalFast"
|
||||
android:lineBreakWordStyle="phrase"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<TextView
|
||||
@@ -41,6 +42,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:hyphenationFrequency="normalFast"
|
||||
android:lineBreakWordStyle="phrase"
|
||||
android:gravity="end|bottom" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
android:singleLine="true"
|
||||
android:textAlignment="viewStart"
|
||||
android:hyphenationFrequency="normalFast"
|
||||
android:lineBreakWordStyle="phrase"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<TextView
|
||||
@@ -52,6 +53,7 @@
|
||||
android:textAlignment="viewStart"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:hyphenationFrequency="normalFast"
|
||||
android:lineBreakWordStyle="phrase"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
|
||||
<View
|
||||
|
||||
@@ -62,6 +62,7 @@
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:ellipsize="marquee"
|
||||
android:hyphenationFrequency="normalFast"
|
||||
android:lineBreakWordStyle="phrase"
|
||||
android:fadingEdge="horizontal"/>
|
||||
<TextView
|
||||
android:id="@android:id/summary"
|
||||
@@ -76,6 +77,7 @@
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:focusable="false"
|
||||
android:hyphenationFrequency="normalFast"
|
||||
android:lineBreakWordStyle="phrase"
|
||||
android:maxLines="4" />
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:ellipsize="marquee"
|
||||
android:hyphenationFrequency="normalFast"
|
||||
android:lineBreakWordStyle="phrase"
|
||||
android:fadingEdge="horizontal"/>
|
||||
<LinearLayout
|
||||
android:id="@android:id/widget_frame"
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
android:layout_alignStart="@android:id/title"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:hyphenationFrequency="normalFast"
|
||||
android:lineBreakWordStyle="phrase"
|
||||
android:maxLines="2" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceListItem"
|
||||
android:hyphenationFrequency="normalFast"
|
||||
android:lineBreakWordStyle="phrase"
|
||||
android:textColor="?android:attr/textColorPrimary" />
|
||||
|
||||
<TextView
|
||||
@@ -46,6 +47,7 @@
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textAlignment="viewStart"
|
||||
android:hyphenationFrequency="normalFast"
|
||||
android:lineBreakWordStyle="phrase"
|
||||
android:textColor="?android:attr/textColorSecondary" />
|
||||
|
||||
<include
|
||||
@@ -67,6 +69,8 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start|top"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:gravity="start"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
@@ -75,6 +79,8 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|top"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:gravity="end"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
android:textAlignment="center"
|
||||
android:ellipsize="marquee"
|
||||
android:hyphenationFrequency="normalFast"
|
||||
android:lineBreakWordStyle="phrase"
|
||||
android:fadingEdge="horizontal" />
|
||||
|
||||
<TextView
|
||||
@@ -52,6 +53,7 @@
|
||||
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:hyphenationFrequency="normalFast"
|
||||
android:lineBreakWordStyle="phrase"
|
||||
android:maxLines="10" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
android:layout_gravity="start|center"
|
||||
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body2"
|
||||
android:hyphenationFrequency="normalFast"
|
||||
android:lineBreakWordStyle="phrase"
|
||||
android:textColor="?android:attr/colorAccent"/>
|
||||
|
||||
<ProgressBar
|
||||
|
||||
@@ -76,6 +76,7 @@
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textAlignment="viewStart"
|
||||
android:hyphenationFrequency="normalFast"
|
||||
android:lineBreakWordStyle="phrase"
|
||||
android:textColor="?android:attr/textColorSecondary" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
|
||||
@@ -77,6 +77,7 @@
|
||||
android:textAppearance="?android:attr/textAppearanceListItemSecondary"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:hyphenationFrequency="normalFast"
|
||||
android:lineBreakWordStyle="phrase"
|
||||
android:maxLines="10" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
@@ -74,6 +74,7 @@
|
||||
android:textAppearance="?android:attr/textAppearanceListItemSecondary"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:hyphenationFrequency="normalFast"
|
||||
android:lineBreakWordStyle="phrase"
|
||||
android:maxLines="10" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
android:paddingStart="20dp"
|
||||
android:drawableStart="?android:attr/listChoiceIndicatorSingle"
|
||||
android:hyphenationFrequency="normalFast"
|
||||
android:lineBreakWordStyle="phrase"
|
||||
android:ellipsize="marquee" />
|
||||
|
||||
|
||||
@@ -45,6 +46,7 @@
|
||||
android:textAppearance="?android:attr/textAppearanceListItemSecondary"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:hyphenationFrequency="normalFast"
|
||||
android:lineBreakWordStyle="phrase"
|
||||
android:maxLines="10" />
|
||||
|
||||
</com.android.settings.CheckableLinearLayout>
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
android:fadingEdge="horizontal"
|
||||
android:maxLines="2"
|
||||
android:hyphenationFrequency="normalFast"
|
||||
android:lineBreakWordStyle="phrase"
|
||||
android:textAppearance="?android:attr/textAppearanceListItem"/>
|
||||
|
||||
<TextView
|
||||
@@ -65,6 +66,7 @@
|
||||
android:textDirection="locale"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:hyphenationFrequency="normalFast"
|
||||
android:lineBreakWordStyle="phrase"
|
||||
android:textColor="?android:attr/textColorSecondary"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -33,7 +33,8 @@
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Display1"
|
||||
android:hyphenationFrequency="normalFast"
|
||||
/>
|
||||
android:lineBreakWordStyle="phrase"
|
||||
/>
|
||||
|
||||
<TextView android:id="@android:id/summary"
|
||||
android:layout_width="match_parent"
|
||||
@@ -42,6 +43,7 @@
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:paddingBottom="5dp"
|
||||
android:hyphenationFrequency="normalFast"
|
||||
android:lineBreakWordStyle="phrase"
|
||||
android:maxLines="10" />
|
||||
|
||||
<ProgressBar
|
||||
|
||||
@@ -17,5 +17,6 @@
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:hyphenationFrequency="normal"
|
||||
android:hyphenationFrequency="normalFast"
|
||||
android:lineBreakWordStyle="phrase"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
|
||||
@@ -869,17 +869,10 @@
|
||||
<!-- 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] -->
|
||||
<string name="fingerprint_usage_category_title">Use fingerprint for</string>
|
||||
<!-- Preference to add another fingerprint -->
|
||||
<string name="fingerprint_add_title">Add fingerprint</string>
|
||||
<!-- switch for allowing fingerprint to be used for keyguard -->
|
||||
<string name="fingerprint_enable_keyguard_toggle_title">screen lock</string>
|
||||
<!-- Message showing the current number of fingerprints set up. Shown for a menu item that launches fingerprint settings or enrollment. -->
|
||||
<plurals name="security_settings_fingerprint_preference_summary">
|
||||
<item quantity="one">Fingerprint added</item>
|
||||
@@ -907,12 +900,6 @@
|
||||
<string name="security_settings_fingerprint_enroll_introduction_footer_title_consent_1">You and your child are in control</string>
|
||||
<!-- Introduction title shown in the bottom of fingerprint enrollment dialog [CHAR LIMIT=NONE]-->
|
||||
<string name="security_settings_fingerprint_enroll_introduction_footer_title_2">Keep in mind</string>
|
||||
<!-- Introduction detail message shown in the bottom of fingerprint enrollment dialog [CHAR LIMIT=NONE]-->
|
||||
<string name="security_settings_fingerprint_enroll_introduction_footer_message_1">The data recorded by Fingerprint is stored securely and never leaves your phone. You can delete your data anytime in Settings.</string>
|
||||
<!-- Introduction detail message shown in the bottom of fingerprint enrollment dialog [CHAR LIMIT=NONE]-->
|
||||
<string name="security_settings_fingerprint_enroll_introduction_footer_message_2">Your fingerprint may be less secure than a strong pattern or PIN.</string>
|
||||
<!-- Introduction detail message shown in the bottom of fingerprint enrollment dialog [CHAR LIMIT=NONE]-->
|
||||
<string name="security_settings_fingerprint_enroll_introduction_footer_message_3" product="default">Your phone will occasionally use your recent fingerprint images to create improved fingerprint models.</string>
|
||||
<!-- Introduction detail message shown in fingerprint enrollment dialog, when fingerprint unlock is disabled by device admin [CHAR LIMIT=NONE]-->
|
||||
<string name="security_settings_fingerprint_enroll_introduction_message_unlock_disabled">Use your fingerprint to unlock your phone or approve purchases.\n\nNote: You can\u2019t use your fingerprint to unlock this device. For more information, contact your organization\u2019s admin.</string>
|
||||
<!-- Button text to cancel enrollment from the introduction [CHAR LIMIT=22] -->
|
||||
@@ -927,12 +914,6 @@
|
||||
<string name="setup_fingerprint_enroll_skip_after_adding_lock_text">Fingerprint setup only takes a minute or two. If you skip this, you can add your fingerprint later in settings.</string>
|
||||
<!-- Title of dialog shown when the user tries to skip setting up a screen lock, warning them of potential consequences of not doing so [CHAR LIMIT=30]-->
|
||||
|
||||
<!-- Introduction detail message shown in fingerprint enrollment introduction screen in setup wizard. [CHAR LIMIT=NONE]-->
|
||||
<string name="security_settings_fingerprint_v2_enroll_introduction_message_setup">When you see this icon, use your fingerprint for authentication, like when you sign in to apps or approve a purchase</string>
|
||||
<!-- Introduction subtitle message shown in fingerprint enrollment introduction screen in setup wizard. [CHAR LIMIT=NONE]-->
|
||||
<string name="security_settings_fingerprint_v2_enroll_introduction_footer_title_1">Keep in mind</string>
|
||||
<!-- Introduction description message shown in fingerprint enrollment introduction screen in setup wizard. [CHAR LIMIT=NONE]-->
|
||||
<string name="security_settings_fingerprint_v2_enroll_introduction_footer_message_1">Using your fingerprint to unlock your phone may be less secure than a strong pattern or PIN</string>
|
||||
<!-- Introduction subtitle message shown in fingerprint enrollment introduction screen in setup wizard. [CHAR LIMIT=NONE]-->
|
||||
<string name="security_settings_fingerprint_v2_enroll_introduction_footer_title_2">How it works</string>
|
||||
<!-- Introduction description message shown in fingerprint enrollment introduction screen in setup wizard. [CHAR LIMIT=NONE]-->
|
||||
@@ -962,21 +943,6 @@
|
||||
<!-- Introduction detail message shown in fingerprint enrollment introduction to learn more about fingerprint [CHAR LIMIT=NONE]-->
|
||||
<string name="security_settings_fingerprint_v2_enroll_introduction_message_learn_more"></string>
|
||||
|
||||
<!-- Acquire message received during fingerprint enrollment to inform the user to change the position of their finger. [CHAR LIMIT=NONE]-->
|
||||
<string name="security_settings_fingerprint_v2_enroll_acquire_try_adjusting">Change the position of your finger slightly each time</string>
|
||||
<!-- Acquire message received during fingerprint enrollment to inform the user to cover the fingerprint sensor. [CHAR LIMIT=NONE]-->
|
||||
<string name="security_settings_fingerprint_v2_enroll_acquire_partially_detected">Cover the icon with the center of your fingerprint</string>
|
||||
<!-- Acquire message received during fingerprint enrollment to inform the user this fingerprint has already been added. [CHAR LIMIT=NONE]-->
|
||||
<string name="security_settings_fingerprint_v2_enroll_acquire_already_enrolled">This fingerprint has already been added</string>
|
||||
<!-- Acquire message received during fingerprint enrollment to inform the user to clean the screen near the fingerprint sensor. [CHAR LIMIT=NONE]-->
|
||||
<string name="security_settings_fingerprint_v2_enroll_acquire_clean_sensor">Clean your screen near the sensor and try again</string>
|
||||
<!-- Acquire message received during fingerprint enrollment to inform the user to lift their finger. [CHAR LIMIT=NONE]-->
|
||||
<string name="security_settings_fingerprint_v2_enroll_acquire_too_fast">Lift your finger after you feel a vibration</string>
|
||||
<!-- Acquire message received during fingerprint enrollment to inform the user to try better lighting. [CHAR LIMIT=NONE]-->
|
||||
<string name="security_settings_fingerprint_v2_enroll_acquire_too_bright">Move somewhere with gentler lighting and try again</string>
|
||||
<!-- Acquire message received during fingerprint enrollment to inform the user they've reached the maximum number of enrollments. [CHAR LIMIT=NONE]-->
|
||||
<string name="security_settings_fingerprint_v2_enroll_error_max_attempts">You\u2019ve reached the maximum number of attempts</string>
|
||||
|
||||
<!-- Message text only shown in fingerprint security settings home screen. (tablet) [CHAR LIMIT=NONE]-->
|
||||
<string name="security_settings_fingerprint_v2_home_screen_text" product="tablet">Use your fingerprint to unlock your tablet or verify it\u2019s you, like when you sign in to apps</string>
|
||||
<!-- Message text only shown in fingerprint security settings home screen. (device) [CHAR LIMIT=NONE]-->
|
||||
@@ -1223,8 +1189,6 @@
|
||||
<string name="fingerprint_enroll_button_add">Add another</string>
|
||||
<!-- Button text shown at the end of enrollment that allows the user to move to the next step -->
|
||||
<string name="fingerprint_enroll_button_next">Next</string>
|
||||
<!-- Text shown in fingerprint settings explaining what the fingerprint can be used for. [CHAR LIMIT=NONE] -->
|
||||
<string name="security_settings_fingerprint_enroll_disclaimer">In addition to unlocking your phone, you can also use your fingerprint to authorize purchases and app access. <annotation id="url">Learn more</annotation></string>
|
||||
<!-- Text shown in fingerprint settings explaining what the fingerprint can be used for in the case unlocking is disabled [CHAR LIMIT=NONE] -->
|
||||
<string name="security_fingerprint_disclaimer_lockscreen_disabled_1">The screen lock option is disabled. To learn more, contact your organization\u2019s admin.</string>
|
||||
<!-- Text shown in fingerprint settings explaining what the fingerprint can be used for in the case unlocking is disabled [CHAR LIMIT=NONE] -->
|
||||
@@ -5938,6 +5902,19 @@
|
||||
<!-- List of synonyms used in the settings search bar to find the “Voice Access”. [CHAR LIMIT=NONE] -->
|
||||
<string name="keywords_voice_access"></string>
|
||||
|
||||
<!-- Fast Pair settings -->
|
||||
<skip />
|
||||
|
||||
<!-- Title in main settings screen for Fast Pair settings [CHAR LIMIT=15] -->
|
||||
<string name="fast_pair_settings">Fast Pair</string>
|
||||
|
||||
<!-- Fast Pair setting summary in settings screen [CHAR LIMIT=50] -->
|
||||
<string name="fast_pair_settings_summary">Nearby detection of Fast Pair bluetooth devices.</string>
|
||||
<!-- Title for Fast Pair main switch preferences. [CHAR LIMIT=50] -->
|
||||
<string name="fast_pair_main_switch_title">Scan for nearby devices</string>
|
||||
<!-- Title for Fast Pair saved devices preferences. [CHAR LIMIT=50] -->
|
||||
<string name="fast_pair_saved_devices_title">Saved devices</string>
|
||||
<!-- Printing settings -->
|
||||
<skip />
|
||||
|
||||
<!-- Title in main settings screen for printing settings [CHAR LIMIT=15] -->
|
||||
@@ -6438,8 +6415,12 @@
|
||||
|
||||
<!-- [CHAR_LIMIT=NONE] Battery usage main screen chart graph hint -->
|
||||
<string name="battery_usage_chart_graph_hint">Battery level for past 24 hr</string>
|
||||
<!-- [CHAR_LIMIT=NONE] Battery app usage section header since last full charge -->
|
||||
<string name="battery_app_usage">App usage since last full charge</string>
|
||||
<!-- [CHAR_LIMIT=NONE] Battery app usage section header for past 24 hour -->
|
||||
<string name="battery_app_usage_for_past_24">App usage for past 24 hr</string>
|
||||
<!-- [CHAR_LIMIT=NONE] Battery system usage section header since last full charge -->
|
||||
<string name="battery_system_usage">System usage since last full charge</string>
|
||||
<!-- [CHAR_LIMIT=NONE] Battery system usage section header for past 24 hour -->
|
||||
<string name="battery_system_usage_for_past_24">System usage for past 24 hr</string>
|
||||
<!-- [CHAR_LIMIT=NONE] Battery system usage section header -->
|
||||
@@ -8124,6 +8105,9 @@
|
||||
<!-- List of synonyms for the Bluetooth setting, used to match in settings search [CHAR LIMIT=NONE] -->
|
||||
<string name="keywords_bluetooth_settings">connected, device, headphones, headset, speaker, wireless, pair, earbuds, music, media </string>
|
||||
|
||||
<!-- List of synonyms for the Fast Pair setting, used to match in settings search [CHAR LIMIT=NONE] -->
|
||||
<string name="keywords_fast_pair">pair, earbuds, bluetooth</string>
|
||||
|
||||
<!-- List of synonyms for the Wallpaper picker setting, used to match in settings search [CHAR LIMIT=NONE] -->
|
||||
<string name="keywords_wallpaper">background, theme, grid, customize, personalize</string>
|
||||
|
||||
|
||||
@@ -67,6 +67,15 @@
|
||||
android:summary="@string/summary_placeholder"
|
||||
settings:controller="com.android.settings.uwb.UwbPreferenceController"/>
|
||||
|
||||
<Preference
|
||||
android:key="connected_device_fast_pair"
|
||||
android:title="@string/fast_pair_settings"
|
||||
android:summary="@string/fast_pair_settings_summary"
|
||||
android:icon="@drawable/ic_fast_pair_24dp"
|
||||
android:fragment="com.android.settings.nearby.FastPairSettingsFragment"
|
||||
settings:controller="com.android.settings.nearby.FastPairPreferenceController"
|
||||
android:order="-2"/>
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="dashboard_tile_placeholder"
|
||||
android:order="-8"/>
|
||||
|
||||
32
res/xml/fast_pair_settings.xml
Normal file
32
res/xml/fast_pair_settings.xml
Normal file
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2022 The Android Open Source Project
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<PreferenceScreen
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
||||
android:title="@string/fast_pair_settings"
|
||||
settings:keywords="@string/keywords_fast_pair">
|
||||
|
||||
<com.android.settingslib.widget.MainSwitchPreference
|
||||
android:key="fast_pair_scan_switch"
|
||||
android:title="@string/fast_pair_main_switch_title" />
|
||||
|
||||
<Preference
|
||||
android:key="saved_devices"
|
||||
android:title="@string/fast_pair_saved_devices_title" />
|
||||
|
||||
</PreferenceScreen>
|
||||
@@ -181,6 +181,16 @@ public abstract class BiometricEnrollBase extends InstrumentedActivity {
|
||||
getWindow().setStatusBarColor(getBackgroundColor());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
if (!isChangingConfigurations() && shouldFinishWhenBackgrounded()
|
||||
&& !BiometricUtils.isAnyMultiBiometricFlow(this)) {
|
||||
setResult(RESULT_TIMEOUT);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean shouldFinishWhenBackgrounded() {
|
||||
return !WizardManagerHelper.isAnySetupWizard(getIntent());
|
||||
}
|
||||
|
||||
@@ -241,16 +241,6 @@ public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
if (!isChangingConfigurations() && shouldFinishWhenBackgrounded()
|
||||
&& !BiometricUtils.isAnyMultiBiometricFlow(this)) {
|
||||
setResult(RESULT_TIMEOUT);
|
||||
finish();
|
||||
}
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
|
||||
@@ -49,16 +49,6 @@ public class BiometricHandoffActivity extends BiometricEnrollBase {
|
||||
mFooterBarMixin.setPrimaryButton(getPrimaryFooterButton());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
if (!isChangingConfigurations() && shouldFinishWhenBackgrounded()
|
||||
&& !BiometricUtils.isAnyMultiBiometricFlow(this)) {
|
||||
setResult(RESULT_TIMEOUT);
|
||||
finish();
|
||||
}
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
protected FooterButton getPrimaryFooterButton() {
|
||||
if (mPrimaryFooterButton == null) {
|
||||
|
||||
@@ -62,11 +62,7 @@ public abstract class BiometricsEnrollEnrolling extends BiometricEnrollBase
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
if (!isChangingConfigurations() && shouldFinishWhenBackgrounded()
|
||||
&& !BiometricUtils.isAnyMultiBiometricFlow(this)) {
|
||||
setResult(RESULT_TIMEOUT);
|
||||
finish();
|
||||
}
|
||||
super.onStop();
|
||||
|
||||
if (mSidecar != null) {
|
||||
mSidecar.setListener(null);
|
||||
@@ -84,7 +80,6 @@ public abstract class BiometricsEnrollEnrolling extends BiometricEnrollBase
|
||||
}
|
||||
finish();
|
||||
}
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -170,16 +170,6 @@ public class FaceEnrollEducation extends BiometricEnrollBase {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
if (!isChangingConfigurations() && shouldFinishWhenBackgrounded()
|
||||
&& !BiometricUtils.isAnyMultiBiometricFlow(this)) {
|
||||
setResult(RESULT_TIMEOUT);
|
||||
finish();
|
||||
}
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean shouldFinishWhenBackgrounded() {
|
||||
return super.shouldFinishWhenBackgrounded() && !mNextClicked;
|
||||
|
||||
@@ -22,7 +22,6 @@ import android.view.View;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.biometrics.BiometricEnrollBase;
|
||||
import com.android.settings.biometrics.BiometricUtils;
|
||||
|
||||
import com.google.android.setupcompat.template.FooterBarMixin;
|
||||
import com.google.android.setupcompat.template.FooterButton;
|
||||
@@ -49,16 +48,6 @@ public class FaceEnrollFinish extends BiometricEnrollBase {
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
if (!isChangingConfigurations() && shouldFinishWhenBackgrounded()
|
||||
&& !BiometricUtils.isAnyMultiBiometricFlow(this)) {
|
||||
setResult(RESULT_TIMEOUT);
|
||||
finish();
|
||||
}
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return SettingsEnums.FACE_ENROLL_FINISHED;
|
||||
|
||||
@@ -249,15 +249,10 @@ public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
if (mAnimation != null) {
|
||||
mAnimation.pauseAnimation();
|
||||
}
|
||||
if (!isChangingConfigurations() && shouldFinishWhenBackgrounded()
|
||||
&& !BiometricUtils.isAnyMultiBiometricFlow(this)) {
|
||||
setResult(RESULT_TIMEOUT);
|
||||
finish();
|
||||
}
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -108,16 +108,6 @@ public class FingerprintEnrollFinish extends BiometricEnrollBase {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
if (!isChangingConfigurations() && shouldFinishWhenBackgrounded()
|
||||
&& !BiometricUtils.isAnyMultiBiometricFlow(this)) {
|
||||
setResult(RESULT_TIMEOUT);
|
||||
finish();
|
||||
}
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNextButtonClick(View view) {
|
||||
updateFingerprintSuggestionEnableState();
|
||||
|
||||
@@ -23,6 +23,7 @@ import android.content.ComponentName;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.text.LineBreakConfig;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
@@ -109,6 +110,12 @@ public class SettingsBaseActivity extends FragmentActivity implements CategoryHa
|
||||
if (mCollapsingToolbarLayout != null) {
|
||||
mCollapsingToolbarLayout.setLineSpacingMultiplier(TOOLBAR_LINE_SPACING_MULTIPLIER);
|
||||
mCollapsingToolbarLayout.setHyphenationFrequency(HYPHENATION_FREQUENCY_NORMAL_FAST);
|
||||
mCollapsingToolbarLayout.setStaticLayoutBuilderConfigurer(builder ->
|
||||
builder.setLineBreakConfig(
|
||||
new LineBreakConfig.Builder()
|
||||
.setLineBreakWordStyle(
|
||||
LineBreakConfig.LINE_BREAK_WORD_STYLE_PHRASE)
|
||||
.build()));
|
||||
}
|
||||
disableCollapsingToolbarLayoutScrollingBehavior();
|
||||
} else {
|
||||
|
||||
@@ -40,7 +40,11 @@ public abstract class AbstractBluetoothDialogPreferenceController extends
|
||||
|
||||
private static final String TAG = "AbstractBtDlgCtr";
|
||||
|
||||
protected static final int[] CODEC_TYPES = {BluetoothCodecConfig.SOURCE_CODEC_TYPE_LDAC,
|
||||
private static final int SOURCE_CODEC_TYPE_OPUS = 6; // TODO(b/240635097): remove in U
|
||||
|
||||
protected static final int[] CODEC_TYPES = {SOURCE_CODEC_TYPE_OPUS,
|
||||
BluetoothCodecConfig.SOURCE_CODEC_TYPE_LC3,
|
||||
BluetoothCodecConfig.SOURCE_CODEC_TYPE_LDAC,
|
||||
BluetoothCodecConfig.SOURCE_CODEC_TYPE_APTX_HD,
|
||||
BluetoothCodecConfig.SOURCE_CODEC_TYPE_APTX,
|
||||
BluetoothCodecConfig.SOURCE_CODEC_TYPE_AAC,
|
||||
|
||||
@@ -61,6 +61,8 @@ public class BluetoothCodecDialogPreference extends BaseBluetoothDialogPreferenc
|
||||
mRadioButtonIds.add(R.id.bluetooth_audio_codec_aptx);
|
||||
mRadioButtonIds.add(R.id.bluetooth_audio_codec_aptx_hd);
|
||||
mRadioButtonIds.add(R.id.bluetooth_audio_codec_ldac);
|
||||
mRadioButtonIds.add(R.id.bluetooth_audio_codec_lc3);
|
||||
mRadioButtonIds.add(R.id.bluetooth_audio_codec_opus);
|
||||
String[] stringArray = context.getResources().getStringArray(
|
||||
R.array.bluetooth_a2dp_codec_titles);
|
||||
for (int i = 0; i < stringArray.length; i++) {
|
||||
|
||||
@@ -40,6 +40,8 @@ public class BluetoothCodecDialogPreferenceController extends
|
||||
private static final String KEY = "bluetooth_audio_codec_settings";
|
||||
private static final String TAG = "BtCodecCtr";
|
||||
|
||||
private static final int SOURCE_CODEC_TYPE_OPUS = 6; // TODO remove in U
|
||||
|
||||
private final Callback mCallback;
|
||||
|
||||
public BluetoothCodecDialogPreferenceController(Context context, Lifecycle lifecycle,
|
||||
@@ -118,6 +120,14 @@ public class BluetoothCodecDialogPreferenceController extends
|
||||
codecTypeValue = BluetoothCodecConfig.SOURCE_CODEC_TYPE_LDAC;
|
||||
codecPriorityValue = BluetoothCodecConfig.CODEC_PRIORITY_HIGHEST;
|
||||
break;
|
||||
case 6:
|
||||
codecTypeValue = BluetoothCodecConfig.SOURCE_CODEC_TYPE_LC3;
|
||||
codecPriorityValue = BluetoothCodecConfig.CODEC_PRIORITY_HIGHEST;
|
||||
break;
|
||||
case 7:
|
||||
codecTypeValue = SOURCE_CODEC_TYPE_OPUS; // TODO update in U
|
||||
codecPriorityValue = BluetoothCodecConfig.CODEC_PRIORITY_HIGHEST;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -180,6 +190,9 @@ public class BluetoothCodecDialogPreferenceController extends
|
||||
case BluetoothCodecConfig.SOURCE_CODEC_TYPE_LDAC:
|
||||
index = 5;
|
||||
break;
|
||||
case SOURCE_CODEC_TYPE_OPUS: // TODO update in U
|
||||
index = 7;
|
||||
break;
|
||||
default:
|
||||
Log.e(TAG, "Unsupported config:" + config);
|
||||
break;
|
||||
|
||||
@@ -76,36 +76,28 @@ public class StorageWizardInit extends StorageWizardBase {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if (mPortable) {
|
||||
super.onBackPressed();
|
||||
} else {
|
||||
mFlipper.showPrevious();
|
||||
setBackButtonText(R.string.wizard_back_adoptable);
|
||||
setHeaderText(R.string.storage_wizard_init_v2_external_title,
|
||||
getDiskShortDescription());
|
||||
setNextButtonText(R.string.storage_wizard_init_v2_external_action);
|
||||
mPortable = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNavigateBack(View v) {
|
||||
if (mPortable == false) {
|
||||
return;
|
||||
}
|
||||
if (!mIsPermittedToAdopt) {
|
||||
// TODO: Show a message about why this is disabled for guest and
|
||||
// that only an admin user can adopt an sd card.
|
||||
|
||||
v.setEnabled(false);
|
||||
} else if (mPortable == false) {
|
||||
mFlipper.showNext();
|
||||
setHeaderText(R.string.storage_wizard_init_v2_external_title,
|
||||
getDiskShortDescription());
|
||||
setNextButtonText(R.string.storage_wizard_init_v2_external_action);
|
||||
setBackButtonText(R.string.wizard_back_adoptable);
|
||||
setBackButtonVisibility(View.VISIBLE);
|
||||
mPortable = true;
|
||||
} else {
|
||||
mFlipper.showNext();
|
||||
setHeaderText(R.string.storage_wizard_init_v2_internal_title,
|
||||
getDiskShortDescription());
|
||||
setNextButtonText(R.string.storage_wizard_init_v2_internal_action);
|
||||
setBackButtonVisibility(View.INVISIBLE);
|
||||
setBackButtonText(R.string.wizard_back_adoptable);
|
||||
setBackButtonVisibility(View.VISIBLE);
|
||||
mPortable = false;
|
||||
}
|
||||
}
|
||||
@@ -162,4 +154,4 @@ public class StorageWizardInit extends StorageWizardBase {
|
||||
}
|
||||
return s;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -106,6 +106,10 @@ public class BatteryChartPreferenceControllerV2 extends AbstractPreferenceContro
|
||||
private boolean mIsFooterPrefAdded = false;
|
||||
private PreferenceScreen mPreferenceScreen;
|
||||
private FooterPreference mFooterPreference;
|
||||
// Daily view model only saves abbreviated day of week texts (e.g. MON). This field saves the
|
||||
// full day of week texts (e.g. Monday), which is used in category title and battery detail
|
||||
// page.
|
||||
private List<String> mDailyTimestampFullTexts;
|
||||
private BatteryChartViewModel mDailyViewModel;
|
||||
private List<BatteryChartViewModel> mHourlyViewModels;
|
||||
|
||||
@@ -200,8 +204,7 @@ public class BatteryChartPreferenceControllerV2 extends AbstractPreferenceContro
|
||||
mPrefContext = screen.getContext();
|
||||
mAppListPrefGroup = screen.findPreference(mPreferenceKey);
|
||||
mAppListPrefGroup.setOrderingAsAdded(false);
|
||||
mAppListPrefGroup.setTitle(
|
||||
mPrefContext.getString(R.string.battery_app_usage_for_past_24));
|
||||
mAppListPrefGroup.setTitle(mPrefContext.getString(R.string.battery_app_usage));
|
||||
mFooterPreference = screen.findPreference(KEY_FOOTER_PREF);
|
||||
// Removes footer first until usage data is loaded to avoid flashing.
|
||||
if (mFooterPreference != null) {
|
||||
@@ -267,15 +270,20 @@ public class BatteryChartPreferenceControllerV2 extends AbstractPreferenceContro
|
||||
});
|
||||
Log.d(TAG, "getBatteryLevelData: " + batteryLevelData);
|
||||
if (batteryLevelData == null) {
|
||||
mDailyTimestampFullTexts = null;
|
||||
mDailyViewModel = null;
|
||||
mHourlyViewModels = null;
|
||||
addFooterPreferenceIfNeeded(false);
|
||||
return;
|
||||
}
|
||||
mDailyTimestampFullTexts = generateTimestampDayOfWeekTexts(
|
||||
mContext, batteryLevelData.getDailyBatteryLevels().getTimestamps(),
|
||||
/* isAbbreviation= */ false);
|
||||
mDailyViewModel = new BatteryChartViewModel(
|
||||
batteryLevelData.getDailyBatteryLevels().getLevels(),
|
||||
generateTimestampDayOfWeekTexts(
|
||||
mContext, batteryLevelData.getDailyBatteryLevels().getTimestamps()),
|
||||
mContext, batteryLevelData.getDailyBatteryLevels().getTimestamps(),
|
||||
/* isAbbreviation= */ true),
|
||||
mDailyChartIndex,
|
||||
BatteryChartViewModel.AxisLabelPosition.CENTER_OF_TRAPEZOIDS);
|
||||
mHourlyViewModels = new ArrayList<>();
|
||||
@@ -498,8 +506,8 @@ public class BatteryChartPreferenceControllerV2 extends AbstractPreferenceContro
|
||||
// Null means we show all information without a specific time slot.
|
||||
if (slotInformation == null) {
|
||||
return isApp
|
||||
? mPrefContext.getString(R.string.battery_app_usage_for_past_24)
|
||||
: mPrefContext.getString(R.string.battery_system_usage_for_past_24);
|
||||
? mPrefContext.getString(R.string.battery_app_usage)
|
||||
: mPrefContext.getString(R.string.battery_system_usage);
|
||||
} else {
|
||||
return isApp
|
||||
? mPrefContext.getString(R.string.battery_app_usage_for, slotInformation)
|
||||
@@ -507,9 +515,33 @@ public class BatteryChartPreferenceControllerV2 extends AbstractPreferenceContro
|
||||
}
|
||||
}
|
||||
|
||||
private String getSlotInformation() {
|
||||
// TODO: Generate the right slot information from daily and hourly chart selection.
|
||||
return null;
|
||||
@VisibleForTesting
|
||||
String getSlotInformation() {
|
||||
if (mDailyTimestampFullTexts == null || mDailyViewModel == null
|
||||
|| mHourlyViewModels == null) {
|
||||
// No data
|
||||
return null;
|
||||
}
|
||||
if (isAllSelected()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
final String selectedDayText = mDailyTimestampFullTexts.get(mDailyChartIndex);
|
||||
if (mHourlyChartIndex == BatteryChartViewModel.SELECTED_INDEX_ALL) {
|
||||
return selectedDayText;
|
||||
}
|
||||
|
||||
final String fromHourText = mHourlyViewModels.get(mDailyChartIndex).texts().get(
|
||||
mHourlyChartIndex);
|
||||
final String toHourText = mHourlyViewModels.get(mDailyChartIndex).texts().get(
|
||||
mHourlyChartIndex + 1);
|
||||
final String selectedHourText =
|
||||
String.format("%s%s%s", fromHourText, mIs24HourFormat ? "-" : " - ", toHourText);
|
||||
if (isBatteryLevelDataInOneDay()) {
|
||||
return selectedHourText;
|
||||
}
|
||||
|
||||
return String.format("%s %s", selectedDayText, selectedHourText);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
@@ -579,14 +611,20 @@ public class BatteryChartPreferenceControllerV2 extends AbstractPreferenceContro
|
||||
}
|
||||
|
||||
private boolean isBatteryLevelDataInOneDay() {
|
||||
return mHourlyViewModels.size() == 1;
|
||||
return mHourlyViewModels != null && mHourlyViewModels.size() == 1;
|
||||
}
|
||||
|
||||
private static List<String> generateTimestampDayOfWeekTexts(
|
||||
@NonNull final Context context, @NonNull final List<Long> timestamps) {
|
||||
private boolean isAllSelected() {
|
||||
return (isBatteryLevelDataInOneDay()
|
||||
|| mDailyChartIndex == BatteryChartViewModel.SELECTED_INDEX_ALL)
|
||||
&& mHourlyChartIndex == BatteryChartViewModel.SELECTED_INDEX_ALL;
|
||||
}
|
||||
|
||||
private static List<String> generateTimestampDayOfWeekTexts(@NonNull final Context context,
|
||||
@NonNull final List<Long> timestamps, final boolean isAbbreviation) {
|
||||
final ArrayList<String> texts = new ArrayList<>();
|
||||
for (Long timestamp : timestamps) {
|
||||
texts.add(ConvertUtils.utcToLocalTimeDayOfWeek(context, timestamp));
|
||||
texts.add(ConvertUtils.utcToLocalTimeDayOfWeek(context, timestamp, isAbbreviation));
|
||||
}
|
||||
return texts;
|
||||
}
|
||||
|
||||
@@ -150,10 +150,12 @@ public final class ConvertUtils {
|
||||
}
|
||||
|
||||
/** Converts UTC timestamp to local time day of week data. */
|
||||
public static String utcToLocalTimeDayOfWeek(final Context context, final long timestamp) {
|
||||
public static String utcToLocalTimeDayOfWeek(
|
||||
final Context context, final long timestamp, final boolean isAbbreviation) {
|
||||
final Locale locale = getLocale(context);
|
||||
final String pattern = DateFormat.getBestDateTimePattern(locale, "E");
|
||||
return DateFormat.format(pattern, timestamp).toString().toUpperCase(locale);
|
||||
final String pattern = DateFormat.getBestDateTimePattern(locale,
|
||||
isAbbreviation ? "E" : "EEEE");
|
||||
return DateFormat.format(pattern, timestamp).toString();
|
||||
}
|
||||
|
||||
/** Gets indexed battery usage data for each corresponding time slot. */
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (C) 2022 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.nearby;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.lifecycle.LifecycleObserver;
|
||||
|
||||
import com.android.settings.core.BasePreferenceController;
|
||||
|
||||
/**
|
||||
* {@link BasePreferenceController} for Fast Pair settings.
|
||||
*/
|
||||
public class FastPairPreferenceController extends BasePreferenceController implements
|
||||
LifecycleObserver {
|
||||
public static final String TAG = "FastPairPrefController";
|
||||
public static final String KEY_FAST_PAIR_SETTINGS = "connected_device_fast_pair";
|
||||
|
||||
public FastPairPreferenceController(Context context) {
|
||||
super(context, KEY_FAST_PAIR_SETTINGS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAvailabilityStatus() {
|
||||
return AVAILABLE;
|
||||
}
|
||||
}
|
||||
125
src/com/android/settings/nearby/FastPairSettingsFragment.java
Normal file
125
src/com/android/settings/nearby/FastPairSettingsFragment.java
Normal file
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
* Copyright (C) 2022 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.nearby;
|
||||
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SettingsPreferenceFragment;
|
||||
import com.android.settings.search.BaseSearchIndexProvider;
|
||||
import com.android.settingslib.search.SearchIndexable;
|
||||
import com.android.settingslib.widget.MainSwitchPreference;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Fragment with the top level fast pair settings.
|
||||
*/
|
||||
@SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC)
|
||||
public class FastPairSettingsFragment extends SettingsPreferenceFragment {
|
||||
|
||||
private static final String TAG = "FastPairSettingsFrag";
|
||||
|
||||
private static final String SCAN_SWITCH_KEY = "fast_pair_scan_switch";
|
||||
private static final String SAVED_DEVICES_PREF_KEY = "saved_devices";
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
|
||||
MainSwitchPreference mainSwitchPreference = Objects.requireNonNull(
|
||||
findPreference(SCAN_SWITCH_KEY));
|
||||
mainSwitchPreference.setChecked(false);
|
||||
|
||||
Preference savedDevicePref = Objects.requireNonNull(
|
||||
findPreference(SAVED_DEVICES_PREF_KEY));
|
||||
savedDevicePref.setOnPreferenceClickListener(preference -> {
|
||||
Intent savedDevicesIntent = getSavedDevicesIntent();
|
||||
if (savedDevicesIntent != null && getActivity() != null) {
|
||||
getActivity().startActivity(savedDevicesIntent);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return SettingsEnums.CONNECTION_DEVICE_ADVANCED_FAST_PAIR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHelpResource() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getPreferenceScreenResId() {
|
||||
return R.xml.fast_pair_settings;
|
||||
}
|
||||
|
||||
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
new BaseSearchIndexProvider(R.xml.fast_pair_settings);
|
||||
|
||||
@Nullable
|
||||
private ComponentName getSavedDevicesComponent() {
|
||||
String savedDevicesComponent = Settings.Secure.getString(
|
||||
getContentResolver(),
|
||||
Settings.Secure.NEARBY_FAST_PAIR_SETTINGS_DEVICES_COMPONENT);
|
||||
if (TextUtils.isEmpty(savedDevicesComponent)) {
|
||||
savedDevicesComponent = getString(
|
||||
com.android.internal.R.string.config_defaultNearbyFastPairSettingsDevicesComponent);
|
||||
}
|
||||
|
||||
if (TextUtils.isEmpty(savedDevicesComponent)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return ComponentName.unflattenFromString(savedDevicesComponent);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private Intent getSavedDevicesIntent() {
|
||||
ComponentName componentName = getSavedDevicesComponent();
|
||||
if (componentName == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
PackageManager pm = getPackageManager();
|
||||
Intent intent = getIntent();
|
||||
intent.setAction(Intent.ACTION_VIEW);
|
||||
intent.setComponent(componentName);
|
||||
|
||||
final ResolveInfo resolveInfo = pm.resolveActivity(intent, PackageManager.GET_META_DATA);
|
||||
if (resolveInfo == null || resolveInfo.activityInfo == null) {
|
||||
Log.e(TAG, "Device-specified fast pair component (" + componentName
|
||||
+ ") not available");
|
||||
return null;
|
||||
}
|
||||
return intent;
|
||||
}
|
||||
}
|
||||
@@ -42,6 +42,7 @@ import android.text.InputType;
|
||||
import android.text.SpannableString;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.ArrayMap;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
@@ -1495,13 +1496,20 @@ public class WifiConfigController2 implements TextWatcher,
|
||||
}
|
||||
|
||||
// Shows display name of each active subscription.
|
||||
final ArrayList<CharSequence> displayNames = new ArrayList<>();
|
||||
ArrayMap<Integer, CharSequence> displayNames = new ArrayMap<>();
|
||||
int defaultDataSubscriptionId = SubscriptionManager.getDefaultDataSubscriptionId();
|
||||
for (SubscriptionInfo activeSubInfo : mActiveSubscriptionInfos) {
|
||||
displayNames.add(
|
||||
// If multiple SIMs have the same carrier id, only the first or default data SIM is
|
||||
// displayed.
|
||||
if (displayNames.containsKey(activeSubInfo.getCarrierId())
|
||||
&& defaultDataSubscriptionId != activeSubInfo.getSubscriptionId()) {
|
||||
continue;
|
||||
}
|
||||
displayNames.put(activeSubInfo.getCarrierId(),
|
||||
SubscriptionUtil.getUniqueSubscriptionDisplayName(activeSubInfo, mContext));
|
||||
}
|
||||
mEapSimSpinner.setAdapter(
|
||||
getSpinnerAdapter(displayNames.toArray(new String[displayNames.size()])));
|
||||
getSpinnerAdapter(displayNames.values().toArray(new String[displayNames.size()])));
|
||||
mEapSimSpinner.setSelection(0 /* position */);
|
||||
if (displayNames.size() == 1) {
|
||||
mEapSimSpinner.setEnabled(false);
|
||||
|
||||
@@ -52,6 +52,8 @@ import java.util.List;
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class BluetoothCodecDialogPreferenceControllerTest {
|
||||
|
||||
private static final int SOURCE_CODEC_TYPE_OPUS = 6; // TODO(b/240635097): remove in U
|
||||
|
||||
private static final String DEVICE_ADDRESS = "00:11:22:33:44:55";
|
||||
|
||||
@Mock
|
||||
@@ -72,6 +74,7 @@ public class BluetoothCodecDialogPreferenceControllerTest {
|
||||
private BluetoothCodecConfig mCodecConfigAPTX;
|
||||
private BluetoothCodecConfig mCodecConfigAPTXHD;
|
||||
private BluetoothCodecConfig mCodecConfigLDAC;
|
||||
private BluetoothCodecConfig mCodecConfigOPUS;
|
||||
private BluetoothDevice mActiveDevice;
|
||||
private Context mContext;
|
||||
private LifecycleOwner mLifecycleOwner;
|
||||
@@ -119,13 +122,17 @@ public class BluetoothCodecDialogPreferenceControllerTest {
|
||||
mCodecConfigLDAC = new BluetoothCodecConfig.Builder()
|
||||
.setCodecType(BluetoothCodecConfig.SOURCE_CODEC_TYPE_LDAC)
|
||||
.build();
|
||||
mCodecConfigOPUS = new BluetoothCodecConfig.Builder()
|
||||
.setCodecType(SOURCE_CODEC_TYPE_OPUS)
|
||||
.build();
|
||||
when(mBluetoothAdapter.getActiveDevices(eq(BluetoothProfile.A2DP)))
|
||||
.thenReturn(Arrays.asList(mActiveDevice));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void writeConfigurationValues_selectDefault_setHighest() {
|
||||
BluetoothCodecConfig[] mCodecConfigs = {mCodecConfigAAC, mCodecConfigSBC};
|
||||
BluetoothCodecConfig[] mCodecConfigs = {mCodecConfigOPUS, mCodecConfigAAC,
|
||||
mCodecConfigSBC};
|
||||
mCodecStatus = new BluetoothCodecStatus.Builder()
|
||||
.setCodecConfig(mCodecConfigSBC)
|
||||
.setCodecsSelectableCapabilities(Arrays.asList(mCodecConfigs))
|
||||
@@ -136,13 +143,14 @@ public class BluetoothCodecDialogPreferenceControllerTest {
|
||||
mController.onBluetoothServiceConnected(mBluetoothA2dp);
|
||||
|
||||
mController.writeConfigurationValues(0);
|
||||
verify(mBluetoothA2dpConfigStore).setCodecType(BluetoothCodecConfig.SOURCE_CODEC_TYPE_AAC);
|
||||
// TODO(b/240635097): update in U
|
||||
verify(mBluetoothA2dpConfigStore).setCodecType(SOURCE_CODEC_TYPE_OPUS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void writeConfigurationValues_checkCodec() {
|
||||
BluetoothCodecConfig[] mCodecConfigs = {mCodecConfigAAC, mCodecConfigSBC, mCodecConfigAPTX,
|
||||
mCodecConfigAPTXHD, mCodecConfigLDAC, mCodecConfigAAC, mCodecConfigSBC};
|
||||
BluetoothCodecConfig[] mCodecConfigs = {mCodecConfigOPUS, mCodecConfigAAC,
|
||||
mCodecConfigSBC, mCodecConfigAPTX, mCodecConfigAPTXHD, mCodecConfigLDAC};
|
||||
mCodecStatus = new BluetoothCodecStatus.Builder()
|
||||
.setCodecConfig(mCodecConfigSBC)
|
||||
.setCodecsSelectableCapabilities(Arrays.asList(mCodecConfigs))
|
||||
@@ -167,12 +175,15 @@ public class BluetoothCodecDialogPreferenceControllerTest {
|
||||
mController.writeConfigurationValues(5);
|
||||
verify(mBluetoothA2dpConfigStore).setCodecType(BluetoothCodecConfig.SOURCE_CODEC_TYPE_LDAC);
|
||||
|
||||
mController.writeConfigurationValues(7);
|
||||
// TODO(b/240635097): update in U
|
||||
verify(mBluetoothA2dpConfigStore).setCodecType(SOURCE_CODEC_TYPE_OPUS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void writeConfigurationValues_resetHighestConfig() {
|
||||
BluetoothCodecConfig[] mCodecConfigs = {mCodecConfigAAC, mCodecConfigSBC, mCodecConfigAPTX,
|
||||
mCodecConfigAPTXHD, mCodecConfigLDAC, mCodecConfigAAC, mCodecConfigSBC};
|
||||
mCodecConfigAPTXHD, mCodecConfigLDAC, mCodecConfigOPUS};
|
||||
mCodecStatus = new BluetoothCodecStatus.Builder()
|
||||
.setCodecConfig(mCodecConfigAAC)
|
||||
.setCodecsSelectableCapabilities(Arrays.asList(mCodecConfigs))
|
||||
@@ -197,6 +208,14 @@ public class BluetoothCodecDialogPreferenceControllerTest {
|
||||
mController.convertCfgToBtnIndex(BluetoothCodecConfig.SOURCE_CODEC_TYPE_AAC));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getCurrentIndexByConfig_verifyOpusIndex() {
|
||||
assertThat(mController.getCurrentIndexByConfig(mCodecConfigOPUS)).isEqualTo(
|
||||
mController.convertCfgToBtnIndex(SOURCE_CODEC_TYPE_OPUS));
|
||||
// TODO(b/240635097): update in U
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void onIndexUpdated_notifyPreference() {
|
||||
mController.onIndexUpdated(0);
|
||||
@@ -204,9 +223,29 @@ public class BluetoothCodecDialogPreferenceControllerTest {
|
||||
verify(mCallback).onBluetoothCodecChanged();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onHDAudioEnabled_optionalCodecEnabled_setsCodecTypeAsOpus() {
|
||||
List<BluetoothCodecConfig> mCodecConfigs = Arrays.asList(mCodecConfigOPUS,
|
||||
mCodecConfigAAC, mCodecConfigSBC);
|
||||
mCodecStatus = new BluetoothCodecStatus.Builder()
|
||||
.setCodecConfig(mCodecConfigOPUS)
|
||||
.setCodecsSelectableCapabilities(mCodecConfigs)
|
||||
.build();
|
||||
when(mBluetoothA2dp.getCodecStatus(mActiveDevice)).thenReturn(mCodecStatus);
|
||||
when(mBluetoothA2dp.isOptionalCodecsEnabled(mActiveDevice)).thenReturn(
|
||||
BluetoothA2dp.OPTIONAL_CODECS_PREF_ENABLED);
|
||||
mController.onBluetoothServiceConnected(mBluetoothA2dp);
|
||||
|
||||
mController.onHDAudioEnabled(/* enabled= */ true);
|
||||
|
||||
verify(mBluetoothA2dpConfigStore, atLeastOnce()).setCodecType(
|
||||
eq(SOURCE_CODEC_TYPE_OPUS)); // TODO(b/240635097): update in U
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onHDAudioEnabled_optionalCodecEnabled_setsCodecTypeAsAAC() {
|
||||
List<BluetoothCodecConfig> mCodecConfigs = Arrays.asList(mCodecConfigAAC, mCodecConfigSBC);
|
||||
List<BluetoothCodecConfig> mCodecConfigs = Arrays.asList(mCodecConfigOPUS,
|
||||
mCodecConfigAAC, mCodecConfigSBC);
|
||||
mCodecStatus = new BluetoothCodecStatus.Builder()
|
||||
.setCodecConfig(mCodecConfigAAC)
|
||||
.setCodecsSelectableCapabilities(mCodecConfigs)
|
||||
@@ -223,7 +262,8 @@ public class BluetoothCodecDialogPreferenceControllerTest {
|
||||
}
|
||||
@Test
|
||||
public void onHDAudioEnabled_optionalCodecDisabled_setsCodecTypeAsSBC() {
|
||||
List<BluetoothCodecConfig> mCodecConfigs = Arrays.asList(mCodecConfigAAC, mCodecConfigSBC);
|
||||
List<BluetoothCodecConfig> mCodecConfigs = Arrays.asList(mCodecConfigOPUS,
|
||||
mCodecConfigAAC, mCodecConfigSBC);
|
||||
mCodecStatus = new BluetoothCodecStatus.Builder()
|
||||
.setCodecConfig(mCodecConfigAAC)
|
||||
.setCodecsSelectableCapabilities(mCodecConfigs)
|
||||
|
||||
@@ -188,7 +188,7 @@ public final class BatteryChartPreferenceControllerV2Test {
|
||||
verify(mHourlyChartView, atLeastOnce()).setVisibility(View.GONE);
|
||||
verify(mDailyChartView).setViewModel(new BatteryChartViewModel(
|
||||
List.of(100, 83, 59, 41),
|
||||
List.of("SAT", "SUN", "MON", "MON"),
|
||||
List.of("Sat", "Sun", "Mon", "Mon"),
|
||||
BatteryChartViewModel.SELECTED_INDEX_ALL,
|
||||
BatteryChartViewModel.AxisLabelPosition.CENTER_OF_TRAPEZOIDS));
|
||||
|
||||
@@ -200,7 +200,7 @@ public final class BatteryChartPreferenceControllerV2Test {
|
||||
verify(mHourlyChartView).setVisibility(View.VISIBLE);
|
||||
verify(mDailyChartView).setViewModel(new BatteryChartViewModel(
|
||||
List.of(100, 83, 59, 41),
|
||||
List.of("SAT", "SUN", "MON", "MON"),
|
||||
List.of("Sat", "Sun", "Mon", "Mon"),
|
||||
0,
|
||||
BatteryChartViewModel.AxisLabelPosition.CENTER_OF_TRAPEZOIDS));
|
||||
verify(mHourlyChartView).setViewModel(new BatteryChartViewModel(
|
||||
@@ -219,7 +219,7 @@ public final class BatteryChartPreferenceControllerV2Test {
|
||||
verify(mHourlyChartView).setVisibility(View.VISIBLE);
|
||||
verify(mDailyChartView).setViewModel(new BatteryChartViewModel(
|
||||
List.of(100, 83, 59, 41),
|
||||
List.of("SAT", "SUN", "MON", "MON"),
|
||||
List.of("Sat", "Sun", "Mon", "Mon"),
|
||||
1,
|
||||
BatteryChartViewModel.AxisLabelPosition.CENTER_OF_TRAPEZOIDS));
|
||||
verify(mHourlyChartView).setViewModel(new BatteryChartViewModel(
|
||||
@@ -239,7 +239,7 @@ public final class BatteryChartPreferenceControllerV2Test {
|
||||
verify(mHourlyChartView).setVisibility(View.VISIBLE);
|
||||
verify(mDailyChartView).setViewModel(new BatteryChartViewModel(
|
||||
List.of(100, 83, 59, 41),
|
||||
List.of("SAT", "SUN", "MON", "MON"),
|
||||
List.of("Sat", "Sun", "Mon", "Mon"),
|
||||
2,
|
||||
BatteryChartViewModel.AxisLabelPosition.CENTER_OF_TRAPEZOIDS));
|
||||
verify(mHourlyChartView).setViewModel(new BatteryChartViewModel(
|
||||
@@ -355,7 +355,7 @@ public final class BatteryChartPreferenceControllerV2Test {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void handlePreferenceTreeiClick_notPowerGaugePreference_returnFalse() {
|
||||
public void handlePreferenceTreeClick_notPowerGaugePreference_returnFalse() {
|
||||
assertThat(mBatteryChartPreferenceController.handlePreferenceTreeClick(mAppListGroup))
|
||||
.isFalse();
|
||||
|
||||
@@ -523,6 +523,8 @@ public final class BatteryChartPreferenceControllerV2Test {
|
||||
mBatteryChartPreferenceController.mExpandDividerPreference =
|
||||
spy(new ExpandDividerPreference(mContext));
|
||||
// Simulates select all condition.
|
||||
mBatteryChartPreferenceController.mDailyChartIndex =
|
||||
BatteryChartViewModel.SELECTED_INDEX_ALL;
|
||||
mBatteryChartPreferenceController.mHourlyChartIndex =
|
||||
BatteryChartViewModel.SELECTED_INDEX_ALL;
|
||||
|
||||
@@ -533,32 +535,88 @@ public final class BatteryChartPreferenceControllerV2Test {
|
||||
verify(mBatteryChartPreferenceController.mAppListPrefGroup)
|
||||
.setTitle(captor.capture());
|
||||
assertThat(captor.getValue())
|
||||
.isEqualTo("App usage for past 24 hr");
|
||||
.isEqualTo("App usage since last full charge");
|
||||
// Verifies the title in the expandable divider.
|
||||
captor = ArgumentCaptor.forClass(String.class);
|
||||
verify(mBatteryChartPreferenceController.mExpandDividerPreference)
|
||||
.setTitle(captor.capture());
|
||||
assertThat(captor.getValue())
|
||||
.isEqualTo("System usage for past 24 hr");
|
||||
.isEqualTo("System usage since last full charge");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void selectedSlotText_selectAllDaysAllHours_returnNull() {
|
||||
mBatteryChartPreferenceController.setBatteryHistoryMap(createBatteryHistoryMap(60));
|
||||
mBatteryChartPreferenceController.mDailyChartIndex =
|
||||
BatteryChartViewModel.SELECTED_INDEX_ALL;
|
||||
mBatteryChartPreferenceController.mHourlyChartIndex =
|
||||
BatteryChartViewModel.SELECTED_INDEX_ALL;
|
||||
|
||||
assertThat(mBatteryChartPreferenceController.getSlotInformation()).isEqualTo(null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void selectedSlotText_onlyOneDayDataSelectAllHours_returnNull() {
|
||||
mBatteryChartPreferenceController.setBatteryHistoryMap(createBatteryHistoryMap(6));
|
||||
mBatteryChartPreferenceController.mDailyChartIndex = 0;
|
||||
mBatteryChartPreferenceController.mHourlyChartIndex =
|
||||
BatteryChartViewModel.SELECTED_INDEX_ALL;
|
||||
|
||||
assertThat(mBatteryChartPreferenceController.getSlotInformation()).isEqualTo(null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void selectedSlotText_selectADayAllHours_onlyDayText() {
|
||||
mBatteryChartPreferenceController.setBatteryHistoryMap(createBatteryHistoryMap(60));
|
||||
mBatteryChartPreferenceController.mDailyChartIndex = 1;
|
||||
mBatteryChartPreferenceController.mHourlyChartIndex =
|
||||
BatteryChartViewModel.SELECTED_INDEX_ALL;
|
||||
|
||||
assertThat(mBatteryChartPreferenceController.getSlotInformation()).isEqualTo("Sunday");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void selectedSlotText_onlyOneDayDataSelectAnHour_onlyHourText() {
|
||||
mBatteryChartPreferenceController.setBatteryHistoryMap(createBatteryHistoryMap(6));
|
||||
mBatteryChartPreferenceController.mDailyChartIndex = 0;
|
||||
mBatteryChartPreferenceController.mHourlyChartIndex = 1;
|
||||
|
||||
assertThat(mBatteryChartPreferenceController.getSlotInformation()).isEqualTo(
|
||||
"10 am - 12 pm");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void selectedSlotText_SelectADayAnHour_dayAndHourText() {
|
||||
mBatteryChartPreferenceController.setBatteryHistoryMap(createBatteryHistoryMap(60));
|
||||
mBatteryChartPreferenceController.mDailyChartIndex = 1;
|
||||
mBatteryChartPreferenceController.mHourlyChartIndex = 8;
|
||||
|
||||
assertThat(mBatteryChartPreferenceController.getSlotInformation()).isEqualTo(
|
||||
"Sunday 4 pm - 6 pm");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onSaveInstanceState_restoreSelectedIndexAndExpandState() {
|
||||
final int expectedIndex = 1;
|
||||
final int expectedDailyIndex = 1;
|
||||
final int expectedHourlyIndex = 2;
|
||||
final boolean isExpanded = true;
|
||||
final Bundle bundle = new Bundle();
|
||||
mBatteryChartPreferenceController.mHourlyChartIndex = expectedIndex;
|
||||
mBatteryChartPreferenceController.mDailyChartIndex = expectedDailyIndex;
|
||||
mBatteryChartPreferenceController.mHourlyChartIndex = expectedHourlyIndex;
|
||||
mBatteryChartPreferenceController.mIsExpanded = isExpanded;
|
||||
mBatteryChartPreferenceController.onSaveInstanceState(bundle);
|
||||
// Replaces the original controller with other values.
|
||||
mBatteryChartPreferenceController.mDailyChartIndex = -1;
|
||||
mBatteryChartPreferenceController.mHourlyChartIndex = -1;
|
||||
mBatteryChartPreferenceController.mIsExpanded = false;
|
||||
|
||||
mBatteryChartPreferenceController.onCreate(bundle);
|
||||
mBatteryChartPreferenceController.setBatteryHistoryMap(createBatteryHistoryMap(25));
|
||||
|
||||
assertThat(mBatteryChartPreferenceController.mDailyChartIndex)
|
||||
.isEqualTo(expectedDailyIndex);
|
||||
assertThat(mBatteryChartPreferenceController.mHourlyChartIndex)
|
||||
.isEqualTo(expectedIndex);
|
||||
.isEqualTo(expectedHourlyIndex);
|
||||
assertThat(mBatteryChartPreferenceController.mIsExpanded).isTrue();
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.settings.wifi;
|
||||
|
||||
import static com.android.settings.wifi.WifiConfigController2.WIFI_EAP_METHOD_SIM;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
@@ -86,6 +88,8 @@ public class WifiConfigController2Test {
|
||||
private AndroidKeystoreAliasLoader mAndroidKeystoreAliasLoader;
|
||||
@Mock
|
||||
private WifiManager mWifiManager;
|
||||
@Mock
|
||||
Spinner mEapMethodSimSpinner;
|
||||
private View mView;
|
||||
private Spinner mHiddenSettingsSpinner;
|
||||
private Spinner mEapCaCertSpinner;
|
||||
@@ -141,6 +145,7 @@ public class WifiConfigController2Test {
|
||||
mContext.getString(R.string.wifi_do_not_provide_eap_user_cert);
|
||||
ipSettingsSpinner.setSelection(DHCP);
|
||||
mShadowSubscriptionManager = shadowOf(mContext.getSystemService(SubscriptionManager.class));
|
||||
when(mEapMethodSimSpinner.getSelectedItemPosition()).thenReturn(WIFI_EAP_METHOD_SIM);
|
||||
|
||||
mController = new TestWifiConfigController2(mConfigUiBase, mView, mWifiEntry,
|
||||
WifiConfigUiBase2.MODE_CONNECT);
|
||||
@@ -813,10 +818,7 @@ public class WifiConfigController2Test {
|
||||
when(mWifiEntry.getSecurity()).thenReturn(WifiEntry.SECURITY_EAP);
|
||||
mController = new TestWifiConfigController2(mConfigUiBase, mView, mWifiEntry,
|
||||
WifiConfigUiBase2.MODE_CONNECT);
|
||||
final Spinner eapMethodSpinner = mock(Spinner.class);
|
||||
when(eapMethodSpinner.getSelectedItemPosition()).thenReturn(
|
||||
WifiConfigController2.WIFI_EAP_METHOD_SIM);
|
||||
mController.mEapMethodSpinner = eapMethodSpinner;
|
||||
mController.mEapMethodSpinner = mEapMethodSimSpinner;
|
||||
|
||||
mController.loadSims();
|
||||
|
||||
@@ -837,10 +839,7 @@ public class WifiConfigController2Test {
|
||||
mShadowSubscriptionManager.setActiveSubscriptionInfoList(Arrays.asList(subscriptionInfo));
|
||||
mController = new TestWifiConfigController2(mConfigUiBase, mView, mWifiEntry,
|
||||
WifiConfigUiBase2.MODE_CONNECT);
|
||||
final Spinner eapMethodSpinner = mock(Spinner.class);
|
||||
when(eapMethodSpinner.getSelectedItemPosition()).thenReturn(
|
||||
WifiConfigController2.WIFI_EAP_METHOD_SIM);
|
||||
mController.mEapMethodSpinner = eapMethodSpinner;
|
||||
mController.mEapMethodSpinner = mEapMethodSimSpinner;
|
||||
|
||||
mController.loadSims();
|
||||
|
||||
@@ -848,6 +847,48 @@ public class WifiConfigController2Test {
|
||||
assertThat(wifiConfiguration.carrierId).isEqualTo(carrierId);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void loadSims_twoSimsWithDifferentCarrierId_showTwoSims() {
|
||||
SubscriptionInfo sub1 = createMockSubscription(1, "sub1", 8888);
|
||||
SubscriptionInfo sub2 = createMockSubscription(2, "sub2", 9999);
|
||||
SubscriptionUtil.setAvailableSubscriptionsForTesting(Arrays.asList(sub1, sub2));
|
||||
mShadowSubscriptionManager.setActiveSubscriptionInfoList(Arrays.asList(sub1, sub2));
|
||||
when(mWifiEntry.getSecurity()).thenReturn(WifiEntry.SECURITY_EAP);
|
||||
mController = new TestWifiConfigController2(mConfigUiBase, mView, mWifiEntry,
|
||||
WifiConfigUiBase2.MODE_CONNECT);
|
||||
mController.mEapMethodSpinner = mEapMethodSimSpinner;
|
||||
ShadowSubscriptionManager.setDefaultDataSubscriptionId(1);
|
||||
|
||||
mController.loadSims();
|
||||
|
||||
assertThat(mController.mEapSimSpinner.getAdapter().getCount()).isEqualTo(2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void loadSims_twoSimsWithSameCarrierId_showOneDefaultDataSim() {
|
||||
SubscriptionInfo sub1 = createMockSubscription(1, "sub1", 9999);
|
||||
SubscriptionInfo sub2 = createMockSubscription(2, "sub2", 9999);
|
||||
SubscriptionUtil.setAvailableSubscriptionsForTesting(Arrays.asList(sub1, sub2));
|
||||
mShadowSubscriptionManager.setActiveSubscriptionInfoList(Arrays.asList(sub1, sub2));
|
||||
when(mWifiEntry.getSecurity()).thenReturn(WifiEntry.SECURITY_EAP);
|
||||
mController = new TestWifiConfigController2(mConfigUiBase, mView, mWifiEntry,
|
||||
WifiConfigUiBase2.MODE_CONNECT);
|
||||
mController.mEapMethodSpinner = mEapMethodSimSpinner;
|
||||
ShadowSubscriptionManager.setDefaultDataSubscriptionId(1);
|
||||
|
||||
mController.loadSims();
|
||||
|
||||
assertThat(mController.mEapSimSpinner.getAdapter().getCount()).isEqualTo(1);
|
||||
assertThat(mController.mEapSimSpinner.getSelectedItem().toString()).isEqualTo("sub1");
|
||||
|
||||
ShadowSubscriptionManager.setDefaultDataSubscriptionId(2);
|
||||
|
||||
mController.loadSims();
|
||||
|
||||
assertThat(mController.mEapSimSpinner.getAdapter().getCount()).isEqualTo(1);
|
||||
assertThat(mController.mEapSimSpinner.getSelectedItem().toString()).isEqualTo("sub2");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void loadCaCertificateValue_shouldPersistentAsDefault() {
|
||||
setUpModifyingSavedCertificateConfigController(null, null);
|
||||
@@ -940,4 +981,12 @@ public class WifiConfigController2Test {
|
||||
// certificates are covered by mController.onItemSelected after showSecurityFields end.
|
||||
mController.mEapMethodSpinner.setSelection(Eap.TLS);
|
||||
}
|
||||
|
||||
private SubscriptionInfo createMockSubscription(int subId, String displayName, int carrierId) {
|
||||
SubscriptionInfo sub = mock(SubscriptionInfo.class);
|
||||
when(sub.getSubscriptionId()).thenReturn(subId);
|
||||
when(sub.getDisplayName()).thenReturn(displayName);
|
||||
when(sub.getCarrierId()).thenReturn(carrierId);
|
||||
return sub;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (C) 2022 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.nearby;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.Mockito.spy;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Looper;
|
||||
|
||||
import androidx.test.core.app.ApplicationProvider;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class FastPairPreferenceControllerTest {
|
||||
|
||||
private Context mContext;
|
||||
private FastPairPreferenceController mController;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
mContext = spy(ApplicationProvider.getApplicationContext());
|
||||
mController = new FastPairPreferenceController(mContext);
|
||||
if (Looper.myLooper() == null) {
|
||||
Looper.prepare();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isAvailable_shouldBeTrue() {
|
||||
assertThat(mController.isAvailable()).isTrue();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (C) 2022 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.nearby;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import android.app.Instrumentation;
|
||||
import android.app.settings.SettingsEnums;
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class FastPairSettingsFragmentTest {
|
||||
|
||||
private FastPairSettingsFragment mFragment;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
final Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation();
|
||||
instrumentation.runOnMainSync(() -> mFragment = new FastPairSettingsFragment());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getCategoryKey_isNetwork() {
|
||||
assertThat(mFragment.getMetricsCategory())
|
||||
.isEqualTo(SettingsEnums.CONNECTION_DEVICE_ADVANCED_FAST_PAIR);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user