Snap for 7188367 from b6042cec85 to sc-v2-release
Change-Id: Id86cc9e102dea910b5c62c19bc5663d6f9b1c1c0
This commit is contained in:
45
res/drawable/ic_fingerprint_introduction_shield_24dp.xml
Normal file
45
res/drawable/ic_fingerprint_introduction_shield_24dp.xml
Normal file
@@ -0,0 +1,45 @@
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
|
||||
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt">
|
||||
<aapt:attr name="android:drawable">
|
||||
<vector android:height="24dp" android:width="24dp" android:viewportHeight="24"
|
||||
android:viewportWidth="24"
|
||||
android:tint="?android:attr/colorControlNormal">
|
||||
<group android:name="_R_G">
|
||||
<group android:name="_R_G_L_0_G">
|
||||
<path android:name="_R_G_L_0_G_D_0_P_0" android:fillColor="#000000"
|
||||
android:fillAlpha="1" android:fillType="nonZero"
|
||||
android:pathData=" M12 2 C12,2 3.82,5.64 3.82,5.64 C3.82,5.64 3.82,11.09 3.82,11.09 C3.82,16.14 7.31,20.85 12,22 C16.69,20.85 20.18,16.14 20.18,11.09 C20.18,11.09 20.18,5.64 20.18,5.64 C20.18,5.64 12,2 12,2c M18.18 11.09 C18.18,12.64 17.77,14.14 17.08,15.47 C15.77,14.5 13.4,14 12,14 C10.6,14 8.23,14.5 6.92,15.47 C6.23,14.14 5.82,12.64 5.82,11.09 C5.82,11.09 5.82,6.94 5.82,6.94 C5.82,6.94 12,4.19 12,4.19 C12,4.19 18.18,6.94 18.18,6.94 C18.18,6.94 18.18,11.09 18.18,11.09c "/>
|
||||
<path android:name="_R_G_L_0_G_D_1_P_0" android:fillColor="#000000"
|
||||
android:fillAlpha="1" android:fillType="nonZero"
|
||||
android:pathData=" M12 7.5 C13.66,7.5 15,8.84 15,10.5 C15,12.16 13.66,13.5 12,13.5 C10.34,13.5 9,12.16 9,10.5 C9,8.84 10.34,7.5 12,7.5c "/>
|
||||
</group>
|
||||
</group>
|
||||
<group android:name="time_group"/>
|
||||
</vector>
|
||||
</aapt:attr>
|
||||
<target android:name="time_group">
|
||||
<aapt:attr name="android:animation">
|
||||
<set android:ordering="together">
|
||||
<objectAnimator android:propertyName="translateX" android:duration="2000"
|
||||
android:startOffset="0" android:valueFrom="0" android:valueTo="1"
|
||||
android:valueType="floatType"/>
|
||||
</set>
|
||||
</aapt:attr>
|
||||
</target>
|
||||
</animated-vector>
|
||||
@@ -14,28 +14,13 @@ Copyright (C) 2019 The Android Open Source Project
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:id="@+id/back">
|
||||
<shape android:shape="oval">
|
||||
<solid
|
||||
android:color="@color/notification_silence_color" />
|
||||
<size
|
||||
android:height="24dp"
|
||||
android:width="24dp"/>
|
||||
</shape>
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/fore"
|
||||
android:gravity="center">
|
||||
<vector
|
||||
android:width="13dp"
|
||||
android:height="13dp"
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M15,14.5c-1.38,0 -2.5,-1.12 -2.5,-2.5c0,-0.28 -0.22,-0.5 -0.5,-0.5s-0.5,0.22 -0.5,0.5c0,1.38 -1.12,2.5 -2.5,2.5S6.5,13.38 6.5,12c0,-0.28 -0.22,-0.5 -0.5,-0.5c-0.24,0 -0.46,0.18 -0.49,0.42C5.41,12.55 4.89,13 4.27,13H2v-2h1.71C4.1,10.11 5,9.5 6,9.5c1.38,0 2.5,1.12 2.5,2.5c0,0.28 0.22,0.5 0.5,0.5s0.5,-0.22 0.5,-0.5c0,-1.38 1.12,-2.5 2.5,-2.5s2.5,1.12 2.5,2.5c0,0.28 0.22,0.5 0.5,0.5s0.5,-0.22 0.5,-0.5c0,-1.38 1.12,-2.5 2.5,-2.5c1.02,0 1.91,0.6 2.29,1.5H22v2h-2.27c-0.62,0 -1.14,-0.45 -1.23,-1.08c-0.04,-0.24 -0.25,-0.42 -0.49,-0.42c-0.28,0 -0.5,0.22 -0.5,0.5C17.5,13.38 16.38,14.5 15,14.5z"/>
|
||||
</vector>
|
||||
</item>
|
||||
</layer-list>
|
||||
android:viewportHeight="24"
|
||||
android:tint="?android:attr/colorControlNormal">
|
||||
<path
|
||||
android:pathData="M12,22c1.1,0 2,-0.9 2,-2h-4c0,1.1 0.9,2 2,2zM16,16L2.81,2.81 1.39,4.22l4.85,4.85C6.09,9.68 6,10.33 6,11v6L4,17v2h12.17l3.61,3.61 1.41,-1.41L16,16zM8,17l0.01,-6.16L14.17,17L8,17zM12,6.5c2.49,0 4,2.02 4,4.5v2.17l2,2L18,11c0,-3.07 -1.63,-5.64 -4.5,-6.32L13.5,4c0,-0.83 -0.67,-1.5 -1.5,-1.5s-1.5,0.67 -1.5,1.5v0.68c-0.78,0.18 -1.45,0.52 -2.04,0.95L9.93,7.1c0.58,-0.37 1.27,-0.6 2.07,-0.6z"
|
||||
android:fillColor="@android:color/white"/>
|
||||
</vector>
|
||||
|
||||
25
res/drawable/ic_ongoing_notification.xml
Normal file
25
res/drawable/ic_ongoing_notification.xml
Normal file
@@ -0,0 +1,25 @@
|
||||
<!--
|
||||
Copyright (C) 2021 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0"
|
||||
android:tint="?android:attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M12,18h0.17l-1.09,-1.09 1.41,-1.41L16,19l-3.5,3.5 -1.41,-1.41L12.17,20L12,20c-2.05,0 -4.09,-0.78 -5.66,-2.34 -3.12,-3.12 -3.12,-8.19 0,-11.31l1.41,1.41c-2.34,2.34 -2.34,6.15 0,8.49C8.89,17.38 10.4,18 12,18zM17.66,6.34c3.12,3.12 3.12,8.19 0,11.31l-1.41,-1.41c2.34,-2.34 2.34,-6.15 0,-8.49C15.11,6.62 13.6,6 12,6h-0.17l1.09,1.09L11.5,8.5 8,5l3.5,-3.5 1.41,1.41L11.83,4L12,4c2.05,0 4.09,0.78 5.66,2.34z"/>
|
||||
</vector>
|
||||
@@ -30,23 +30,16 @@
|
||||
android:clipToPadding="false"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.google.android.setupdesign.view.RichTextView
|
||||
android:id="@+id/sud_layout_description"
|
||||
style="@style/SudDescription.Glif"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/security_settings_fingerprint_enroll_introduction_message" />
|
||||
|
||||
<com.google.android.setupdesign.view.RichTextView
|
||||
android:id="@+id/error_text"
|
||||
style="@style/SudDescription.Glif"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<com.google.android.setupdesign.view.FillContentLayout
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1">
|
||||
android:layout_marginVertical="12dp">
|
||||
|
||||
<ImageView
|
||||
style="@style/SudContentIllustration"
|
||||
@@ -55,25 +48,89 @@
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/fingerprint_enroll_introduction" />
|
||||
|
||||
</com.google.android.setupdesign.view.FillContentLayout>
|
||||
</FrameLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/ic_info_outline_24dp"/>
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.google.android.setupdesign.view.RichTextView
|
||||
android:id="@+id/sud_layout_info"
|
||||
style="@style/SudDescription.Glif"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/security_settings_fingerprint_enroll_introduction_bottom_message" />
|
||||
android:textAlignment="viewStart"
|
||||
android:paddingTop="12dp"
|
||||
android:text="@string/security_settings_fingerprint_enroll_introduction_footer_title_1" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="12dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/ic_fingerprint_introduction_shield_24dp"/>
|
||||
<Space
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="wrap_content"/>
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/security_settings_fingerprint_enroll_introduction_footer_message_1" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
style="@style/SudDescription.Glif"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAlignment="viewStart"
|
||||
android:paddingTop="24dp"
|
||||
android:text="@string/security_settings_fingerprint_enroll_introduction_footer_title_2" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="12dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/ic_info_outline_24dp"/>
|
||||
<Space
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="wrap_content"/>
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/security_settings_fingerprint_enroll_introduction_footer_message_2" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="24dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/ic_fingerprint_24dp"/>
|
||||
<Space
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="wrap_content"/>
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/security_settings_fingerprint_enroll_introduction_footer_message_3" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -884,13 +884,21 @@
|
||||
<!-- message shown in summary field when no fingerprints are registered -->
|
||||
<string name="security_settings_fingerprint_preference_summary_none"></string>
|
||||
<!-- Introduction title shown in fingerprint enrollment to introduce the fingerprint feature[CHAR LIMIT=29] -->
|
||||
<string name="security_settings_fingerprint_enroll_introduction_title">Unlock with fingerprint</string>
|
||||
<!-- Introduction title shown in fingerprint enrollment to introduce the fingerprint feature, when fingerprint unlock is disabed by device admin [CHAR LIMIT=40] -->
|
||||
<string name="security_settings_fingerprint_enroll_introduction_title">Set up your fingerprint</string>
|
||||
<!-- Introduction title shown in fingerprint enrollment to introduce the fingerprint feature, when fingerprint unlock is disabled by device admin [CHAR LIMIT=40] -->
|
||||
<string name="security_settings_fingerprint_enroll_introduction_title_unlock_disabled">Use your fingerprint</string>
|
||||
<!-- Introduction detail message shown in fingerprint enrollment dialog [CHAR LIMIT=NONE]-->
|
||||
<string name="security_settings_fingerprint_enroll_introduction_message">Just touch the fingerprint sensor to unlock your phone, authorize purchases, or sign in to apps. Be careful whose fingerprints you add. Even one added print can do any of these things.</string>
|
||||
<!-- Introduction title shown in the bottom of fingerprint enrollment dialog [CHAR LIMIT=NONE]-->
|
||||
<string name="security_settings_fingerprint_enroll_introduction_footer_title_1">You\u2019re 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_bottom_message">Your fingerprint may be less secure than a strong pattern or PIN.</string>
|
||||
<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>
|
||||
<!-- Introduction detail message shown in fingerprint enrollment screen in setup wizard. [CHAR LIMIT=NONE]-->
|
||||
@@ -899,8 +907,12 @@
|
||||
<string name="security_settings_fingerprint_enroll_introduction_cancel">Cancel</string>
|
||||
<!-- Button text to cancel enrollment [CHAR LIMIT=30] -->
|
||||
<string name="security_settings_fingerprint_enroll_introduction_no_thanks">No thanks</string>
|
||||
<!-- Button text to skip enrollment [CHAR LIMIT=30] -->
|
||||
<string name="security_settings_fingerprint_enroll_introduction_skip">Skip</string>
|
||||
<!-- Button text to continue to the next screen from the introduction [CHAR LIMIT=22] -->
|
||||
<string name="security_settings_fingerprint_enroll_introduction_continue">Continue</string>
|
||||
<!-- Button text to agree the consent and continue to the next screen from the introduction [CHAR LIMIT=22] -->
|
||||
<string name="security_settings_fingerprint_enroll_introduction_agree">Agree</string>
|
||||
<!-- Button text to cancel enrollment from the introduction (this string variant is used while in setup wizard) [CHAR LIMIT=22] -->
|
||||
<string name="security_settings_fingerprint_enroll_introduction_cancel_setup">Skip</string>
|
||||
<!-- Button text to continue to the next screen from the introduction (this string variant is used while in setup wizard) [CHAR LIMIT=22] -->
|
||||
@@ -4482,13 +4494,13 @@
|
||||
<!-- Manage applications, restore updated system application to factory version -->
|
||||
<string name="app_factory_reset">Uninstall updates</string>
|
||||
<!-- Manage applications, individual application info screen, screen, message text under Launch by default heading. This is present if the app is set as a default for some actions. -->
|
||||
<string name="auto_launch_enable_text">You\u2019ve chosen to launch this app by default for some actions.</string>
|
||||
<string name="auto_launch_enable_text">Some activities you\u2019ve selected open in this app by default.</string>
|
||||
<!-- Manage applications, individual application info screen, screen, message text under Launch by default heading. This is present if the app was given user permission to create widgets. -->
|
||||
<string name="always_allow_bind_appwidgets_text">You\u2019ve chosen to allow this app to create widgets and access their data.</string>
|
||||
<!-- Manage applications, individual application screen, text under Launch by default heading if the app is NOT a default for actions -->
|
||||
<string name="auto_launch_disable_text">No defaults set.</string>
|
||||
<!-- Manage applications, individual application screen, button label under Launch by default heading. This is used to clear any default actions that may be assigned to this app. -->
|
||||
<string name="clear_activities">Clear defaults</string>
|
||||
<string name="clear_activities">Clear default preferences</string>
|
||||
<!-- Manage applications, individual application info screen, screen, message text under screen compatibility heading -->
|
||||
<string name="screen_compatibility_text">This app may not be designed for your screen. You can control how it
|
||||
adjusts to your screen here.</string>
|
||||
@@ -8773,8 +8785,10 @@
|
||||
<!-- app summary of notification app list screen [CHAR LIMIT=100] -->
|
||||
<string name="notifications_sent_never">Never</string>
|
||||
|
||||
<!-- Sound & notification > Advanced section: Title for managing notification listeners option. [CHAR LIMIT=30] -->
|
||||
<string name="manage_notification_access_title">Notification access</string>
|
||||
<!-- Sound & notification > Advanced section: Title for managing notification listeners option. [CHAR LIMIT=60] -->
|
||||
<string name="manage_notification_access_title">Device & app notifications</string>
|
||||
|
||||
<string name="manage_notification_access_summary">Control which notifications show on your apps and devices</string>
|
||||
|
||||
<!-- Notification Access section: Indicates that the work profile admin doesn't allow this
|
||||
notification listener to access work profile notifications [CHAR LIMIT=100] -->
|
||||
@@ -8833,26 +8847,19 @@
|
||||
<string name="notification_listener_disable_warning_confirm">Turn off</string>
|
||||
<string name="notification_listener_disable_warning_cancel">Cancel</string>
|
||||
<string name="notification_listener_type_title">Allowed notification types</string>
|
||||
<string name="notif_type_ongoing">Important ongoing notifications</string>
|
||||
<string name="notif_type_conversation">Conversation notifications</string>
|
||||
<string name="notif_type_alerting">Alerting notifications</string>
|
||||
<string name="notif_type_silent">Silent notifications</string>
|
||||
|
||||
<!-- Per notification listener, launches a list of apps whose notifications this listener cannot see -->
|
||||
<string name="notif_listener_excluded_title">Apps that are not bridged to this listener</string>
|
||||
|
||||
<!-- Per notification listener, when the listener can see notifications from all apps -->
|
||||
<string name="notif_listener_excluded_summary_zero">All apps are bridged</string>
|
||||
|
||||
<!-- Per notification listener, a summary of how many apps this listener cannot see
|
||||
notifications from -->
|
||||
<plurals name="notif_listener_excluded_summary_nonzero">
|
||||
<item quantity="one">%d app is not bridged</item>
|
||||
<item quantity="other">%d apps are not bridged</item>
|
||||
</plurals>
|
||||
<string name="notif_type_ongoing">Real-time</string>
|
||||
<string name="notif_type_ongoing_summary">Real-time communication from apps in use, navigation, phone calls, and more</string>
|
||||
<string name="notif_type_conversation">Conversations</string>
|
||||
<string name="notif_type_conversation_summary">SMS and other communications</string>
|
||||
<string name="notif_type_alerting">Default</string>
|
||||
<string name="notif_type_alerting_summary">Notifications that may ring or vibrate based on settings</string>
|
||||
<string name="notif_type_silent">Silent</string>
|
||||
<string name="notif_type_silent_summary">Notifications that never make sound or vibrations</string>
|
||||
|
||||
<!-- Per notification listener, a list of apps whose notifications this listener cannot see -->
|
||||
<string name="notif_listener_excluded_app_title">Bridged apps</string>
|
||||
<string name="notif_listener_excluded_app_title">See all apps</string>
|
||||
<string name="notif_listener_excluded_app_summary">Change notification settings for each app that can send notifications</string>
|
||||
<string name="notif_listener_excluded_app_screen_title">Apps shown on device</string>
|
||||
|
||||
<!-- Title for managing VR (virtual reality) helper services. [CHAR LIMIT=50] -->
|
||||
<string name="vr_listeners_title">VR helper services</string>
|
||||
@@ -9668,9 +9675,44 @@
|
||||
<!-- Category name for App Launch -->
|
||||
<string name="app_launch_domain_links_title">Opening links</string>
|
||||
<string name="app_launch_open_domain_urls_title">Open supported links</string>
|
||||
<!-- Preference title for Supported links open in this app. [CHAR LIMIT=60] -->
|
||||
<string name="app_launch_top_intro_message">Supported links open in this app</string>
|
||||
<!-- Preference title for Links to open in this app. [CHAR LIMIT=60] -->
|
||||
<string name="app_launch_links_category">Links to open in this app</string>
|
||||
|
||||
<string name="app_launch_open_domain_urls_summary">Open without asking</string>
|
||||
<string name="app_launch_supported_domain_urls_title">Supported links</string>
|
||||
<string name="app_launch_other_defaults_title">Other defaults</string>
|
||||
|
||||
<string name="app_launch_other_defaults_title">Other default preferences</string>
|
||||
<!-- Preference title for Add link [CHAR LIMIT=60] -->
|
||||
<string name="app_launch_add_link">Add link</string>
|
||||
<!-- Footer for Open by default. [CHAR LIMIT=NONE] -->
|
||||
<string name="app_launch_footer">An app can verify links to automatically open in the app. <annotation id="url">Learn more</annotation></string>
|
||||
|
||||
<!-- Title, message and button for verified links dialog. -->
|
||||
<plurals name="app_launch_verified_links_title">
|
||||
<item quantity="one"><xliff:g id="count">%d</xliff:g> verified link</item>
|
||||
<item quantity="other"><xliff:g id="count">%d</xliff:g> verified links</item>
|
||||
</plurals>
|
||||
<plurals name="app_launch_verified_links_message">
|
||||
<item quantity="one">This link is verified and automatically opens in this app.</item>
|
||||
<item quantity="other">These links are verified and automatically open in this app.</item>
|
||||
</plurals>
|
||||
<!-- OK button for verified links dialog. [CHAR LIMIT=20] -->
|
||||
<string name="app_launch_dialog_ok">OK</string>
|
||||
|
||||
<!-- Title for Checking other supported links dialog. [CHAR LIMIT=50] -->
|
||||
<string name="app_launch_checking_links_title">Checking for other supported links\u2026</string>
|
||||
<!-- Cancel button for Checking other supported links dialog. [CHAR LIMIT=20] -->
|
||||
<string name="app_launch_dialog_cancel">Cancel</string>
|
||||
|
||||
<!-- Title and button for links found dialog. -->
|
||||
<plurals name="app_launch_supported_links_title">
|
||||
<item quantity="one"><xliff:g id="count">%d</xliff:g> supported link</item>
|
||||
<item quantity="other"><xliff:g id="count">%d</xliff:g> supported links</item>
|
||||
</plurals>
|
||||
<!-- Add button for links found dialog. [CHAR LIMIT=20] -->
|
||||
<string name="app_launch_supported_links_add">Add</string>
|
||||
|
||||
<!-- Summary for app storage preference -->
|
||||
<string name="storage_summary_format"><xliff:g id="size" example="30.00MB">%1$s</xliff:g> used in <xliff:g id="storage_type" example="internal memory">%2$s</xliff:g></string>
|
||||
@@ -11481,8 +11523,10 @@
|
||||
<!-- AutoFill strings -->
|
||||
<!-- Preference label for choosing auto-fill service. [CHAR LIMIT=60] -->
|
||||
<string name="autofill_app">Autofill service</string>
|
||||
<!-- Preference category for showing auto-fill services with saved passwords. [CHAR LIMIT=60] -->
|
||||
<string name="autofill_passwords">Passwords</string>
|
||||
<!-- Keywords for the auto-fill feature. [CHAR LIMIT=NONE] -->
|
||||
<string name="autofill_keywords">auto, fill, autofill</string>
|
||||
<string name="autofill_keywords">auto, fill, autofill, password</string>
|
||||
|
||||
<!-- Message of the warning dialog for setting the auto-fill app. [CHAR_LIMIT=NONE] -->
|
||||
<string name="autofill_confirmation_message">
|
||||
|
||||
@@ -23,12 +23,14 @@
|
||||
android:title="@string/conversation_notifs_category">
|
||||
<Preference
|
||||
android:key="conversations"
|
||||
android:order="1"
|
||||
android:title="@string/conversations_category_title"
|
||||
settings:controller="com.android.settings.notification.ConversationListSummaryPreferenceController"
|
||||
android:fragment="com.android.settings.notification.app.ConversationListSettings"
|
||||
/>
|
||||
<Preference
|
||||
android:key="notification_bubbles"
|
||||
android:order="2"
|
||||
android:title="@string/notification_bubbles_title"
|
||||
android:summary="@string/notifications_bubble_setting_on_summary"
|
||||
settings:controller="com.android.settings.notification.BubbleSummaryNotificationPreferenceController"
|
||||
@@ -44,6 +46,7 @@
|
||||
<!-- See all apps button -->
|
||||
<Preference
|
||||
android:key="all_notifications"
|
||||
android:order="10"
|
||||
android:title="@string/notifications_title"
|
||||
android:fragment="com.android.settings.applications.manageapplications.ManageApplications"
|
||||
settings:searchable="false">
|
||||
@@ -58,6 +61,7 @@
|
||||
android:title="@string/lock_screen_notifications_title">
|
||||
<Preference
|
||||
android:key="notification_history"
|
||||
android:order="11"
|
||||
android:title="@string/notification_history"
|
||||
android:summary="@string/notification_history_summary">
|
||||
<intent
|
||||
@@ -65,27 +69,38 @@
|
||||
android:targetPackage="com.android.settings"
|
||||
android:targetClass="com.android.settings.notification.history.NotificationHistoryActivity" />
|
||||
</Preference>
|
||||
<Preference
|
||||
android:key="notification_access"
|
||||
android:order="12"
|
||||
android:title="@string/manage_notification_access_title"
|
||||
android:summary="@string/manage_notification_access_summary"
|
||||
android:fragment="com.android.settings.notification.NotificationAccessSettings"
|
||||
settings:controller="com.android.settings.applications.specialaccess.notificationaccess.NotificationAccessController" />
|
||||
<!-- When device is locked -->
|
||||
<com.android.settings.RestrictedListPreference
|
||||
android:key="lock_screen_notifications"
|
||||
android:order="13"
|
||||
android:title="@string/lock_screen_notifs_title"
|
||||
android:singleLineTitle="false"
|
||||
android:summary="@string/summary_placeholder" />
|
||||
|
||||
<SwitchPreference
|
||||
android:key="lock_screen_redact"
|
||||
android:order="14"
|
||||
android:title="@string/lock_screen_notifs_redact"
|
||||
android:summary="@string/lock_screen_notifs_redact_summary"
|
||||
settings:controller="com.android.settings.notification.RedactNotificationPreferenceController" />
|
||||
|
||||
<SwitchPreference
|
||||
android:key="lock_screen_work_redact"
|
||||
android:order="15"
|
||||
android:title="@string/lock_screen_notifs_redact_work"
|
||||
android:summary="@string/lock_screen_notifs_redact_work_summary"
|
||||
settings:controller="com.android.settings.notification.RedactNotificationPreferenceController" />
|
||||
|
||||
<SwitchPreference
|
||||
android:key="notification_lockscreen_bypass"
|
||||
android:order="16"
|
||||
android:title="@string/lockscreen_bypass_title"
|
||||
android:summary="@string/lockscreen_bypass_summary"
|
||||
settings:searchable="false"
|
||||
@@ -98,6 +113,7 @@
|
||||
android:title="@string/advanced_section_header">
|
||||
<com.android.settingslib.RestrictedPreference
|
||||
android:key="zen_mode_notifications"
|
||||
android:order="17"
|
||||
android:title="@string/zen_mode_settings_title"
|
||||
settings:useAdminDisabledSummary="true"
|
||||
android:fragment="com.android.settings.notification.zen.ZenModeSettings"
|
||||
@@ -105,6 +121,7 @@
|
||||
/>
|
||||
<com.android.settingslib.RestrictedPreference
|
||||
android:key="app_and_notif_cell_broadcast_settings"
|
||||
android:order="18"
|
||||
android:title="@string/cell_broadcast_settings"
|
||||
settings:useAdminDisabledSummary="true">
|
||||
<intent
|
||||
@@ -115,23 +132,27 @@
|
||||
|
||||
<SwitchPreference
|
||||
android:key="silent_icons"
|
||||
android:order="19"
|
||||
android:title="@string/silent_notifications_status_bar"
|
||||
settings:controller="com.android.settings.notification.SilentStatusBarPreferenceController"/>
|
||||
|
||||
<SwitchPreference
|
||||
android:key="show_snooze_options"
|
||||
android:order="20"
|
||||
android:title="@string/snooze_options_title"
|
||||
settings:controller="com.android.settings.notification.SnoozeNotificationPreferenceController" />
|
||||
|
||||
<!-- Notification badging -->
|
||||
<SwitchPreference
|
||||
android:key="notification_badging"
|
||||
android:order="21"
|
||||
android:title="@string/notification_badging_title"
|
||||
settings:controller="com.android.settings.notification.BadgingNotificationPreferenceController"/>
|
||||
|
||||
<!-- Pulse notification light, on devices that support it -->
|
||||
<SwitchPreference
|
||||
android:key="notification_pulse"
|
||||
android:order="22"
|
||||
android:title="@string/notification_pulse_title"
|
||||
settings:controller="com.android.settings.notification.PulseNotificationPreferenceController"/>
|
||||
</PreferenceCategory>
|
||||
|
||||
@@ -22,14 +22,27 @@
|
||||
android:title="@string/autofill_app"
|
||||
settings:keywords="@string/autofill_keywords">
|
||||
|
||||
<com.android.settings.widget.GearPreference
|
||||
android:key="default_autofill_main"
|
||||
android:title="@string/autofill_app"
|
||||
android:fragment="com.android.settings.applications.defaultapps.DefaultAutofillPicker"
|
||||
settings:searchable="false"
|
||||
settings:keywords="@string/autofill_keywords">
|
||||
<extra android:name="for_work" android:value="false" />
|
||||
</com.android.settings.widget.GearPreference>
|
||||
<PreferenceCategory
|
||||
android:key="passwords_category"
|
||||
android:persistent="false"
|
||||
android:title="@string/autofill_passwords"
|
||||
settings:controller="com.android.settings.applications.autofill.PasswordsPreferenceController" >
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="default_service_category"
|
||||
android:title="@string/autofill_app">
|
||||
|
||||
<!-- TODO(b/169455298): Fix the redundant title. -->
|
||||
<com.android.settings.widget.GearPreference
|
||||
android:key="default_autofill_main"
|
||||
android:title="@string/autofill_app"
|
||||
android:fragment="com.android.settings.applications.defaultapps.DefaultAutofillPicker"
|
||||
settings:searchable="false"
|
||||
settings:keywords="@string/autofill_keywords">
|
||||
<extra android:name="for_work" android:value="false" />
|
||||
</com.android.settings.widget.GearPreference>
|
||||
</PreferenceCategory>
|
||||
|
||||
|
||||
<com.android.settings.widget.WorkOnlyCategory
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
||||
android:key="nonbridged_apps"
|
||||
android:title="@string/notif_listener_excluded_app_title"
|
||||
android:title="@string/notif_listener_excluded_app_screen_title"
|
||||
settings:controller="com.android.settings.applications.specialaccess.notificationaccess.BridgedAppsPreferenceController"
|
||||
settings:searchable="false">
|
||||
</PreferenceScreen>
|
||||
|
||||
@@ -34,23 +34,32 @@
|
||||
<CheckBoxPreference
|
||||
android:key="type_filter_ongoing"
|
||||
android:title="@string/notif_type_ongoing"
|
||||
settings:controller="com.android.settings.applications.specialaccess.notificationaccess.OngoingTypeFilterPreferenceController"/>/>
|
||||
android:summary="@string/notif_type_ongoing_summary"
|
||||
android:icon="@drawable/ic_ongoing_notification"
|
||||
settings:controller="com.android.settings.applications.specialaccess.notificationaccess.OngoingTypeFilterPreferenceController"/>
|
||||
<CheckBoxPreference
|
||||
android:key="type_filter_conversation"
|
||||
android:title="@string/notif_type_conversation"
|
||||
settings:controller="com.android.settings.applications.specialaccess.notificationaccess.ConversationTypeFilterPreferenceController"/>/>
|
||||
android:summary="@string/notif_type_conversation_summary"
|
||||
android:icon="@drawable/ic_promote_conversation"
|
||||
settings:controller="com.android.settings.applications.specialaccess.notificationaccess.ConversationTypeFilterPreferenceController"/>
|
||||
<CheckBoxPreference
|
||||
android:key="type_filter_alerting"
|
||||
android:title="@string/notif_type_alerting"
|
||||
settings:controller="com.android.settings.applications.specialaccess.notificationaccess.AlertingTypeFilterPreferenceController"/>/>
|
||||
android:summary="@string/notif_type_alerting_summary"
|
||||
android:icon="@drawable/ic_notification_alert"
|
||||
settings:controller="com.android.settings.applications.specialaccess.notificationaccess.AlertingTypeFilterPreferenceController"/>
|
||||
<CheckBoxPreference
|
||||
android:key="type_filter_silent"
|
||||
android:title="@string/notif_type_silent"
|
||||
settings:controller="com.android.settings.applications.specialaccess.notificationaccess.SilentTypeFilterPreferenceController"/>/>
|
||||
android:summary="@string/notif_type_silent_summary"
|
||||
android:icon="@drawable/ic_notification_silence"
|
||||
settings:controller="com.android.settings.applications.specialaccess.notificationaccess.SilentTypeFilterPreferenceController"/>
|
||||
|
||||
<Preference
|
||||
android:key="bridged_apps"
|
||||
android:title="@string/notif_listener_excluded_app_title"
|
||||
android:summary="@string/notif_listener_excluded_app_summary"
|
||||
android:fragment="com.android.settings.applications.specialaccess.notificationaccess.BridgedAppsSettings"
|
||||
settings:searchable="false"
|
||||
settings:controller="com.android.settings.applications.specialaccess.notificationaccess.BridgedAppsPreferenceController" />
|
||||
|
||||
@@ -21,4 +21,13 @@
|
||||
android:key="notification_access_screen"
|
||||
android:title="@string/manage_notification_access_title"
|
||||
settings:searchable="false"
|
||||
settings:controller="com.android.settings.applications.specialaccess.notificationaccess.NotificationAccessScreenPreferenceController" />
|
||||
settings:controller="com.android.settings.applications.specialaccess.notificationaccess.NotificationAccessScreenPreferenceController">
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="allowed"
|
||||
android:title="@string/app_permission_summary_allowed"/>
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="not_allowed"
|
||||
android:title="@string/app_permission_summary_not_allowed"/>
|
||||
</PreferenceScreen>
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
<PreferenceScreen
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:key="power_usage_summary_screen"
|
||||
android:title="@string/power_usage_summary_title"
|
||||
settings:keywords="@string/keywords_battery">
|
||||
@@ -31,6 +32,7 @@
|
||||
android:fragment="com.android.settings.fuelgauge.PowerUsageAdvanced"
|
||||
android:key="battery_usage_summary"
|
||||
android:title="@string/advanced_battery_preference_title"
|
||||
app:iconSpaceReserved="false"
|
||||
settings:searchable="false" />
|
||||
|
||||
<com.android.settings.widget.CardPreference
|
||||
@@ -38,23 +40,27 @@
|
||||
android:title="@string/summary_placeholder"
|
||||
settings:controller="com.android.settings.fuelgauge.batterytip.BatteryTipPreferenceController" />
|
||||
|
||||
<com.android.settings.widget.PrimarySwitchPreference
|
||||
android:fragment="com.android.settings.fuelgauge.batterysaver.BatterySaverSettings"
|
||||
android:key="battery_saver_summary"
|
||||
android:title="@string/battery_saver"
|
||||
settings:controller="com.android.settings.fuelgauge.BatterySaverController" />
|
||||
<PreferenceCategory>
|
||||
<SwitchPreference
|
||||
android:key="battery_percentage"
|
||||
android:title="@string/battery_percentage"
|
||||
android:summary="@string/battery_percentage_description"
|
||||
settings:controller="com.android.settings.display.BatteryPercentagePreferenceController" />
|
||||
</PreferenceCategory>
|
||||
|
||||
<SwitchPreference
|
||||
android:key="battery_percentage"
|
||||
android:title="@string/battery_percentage"
|
||||
android:summary="@string/battery_percentage_description"
|
||||
settings:controller="com.android.settings.display.BatteryPercentagePreferenceController" />
|
||||
<PreferenceCategory>
|
||||
<Preference
|
||||
android:fragment="com.android.settings.fuelgauge.batterysaver.BatterySaverSettings"
|
||||
android:key="battery_saver_summary"
|
||||
android:title="@string/battery_saver"
|
||||
settings:controller="com.android.settings.fuelgauge.BatterySaverController" />
|
||||
|
||||
<Preference
|
||||
android:fragment="com.android.settings.fuelgauge.SmartBatterySettings"
|
||||
android:key="smart_battery_manager"
|
||||
android:title="@string/smart_battery_manager_title"
|
||||
settings:controller="com.android.settings.fuelgauge.batterytip.BatteryManagerPreferenceController" />
|
||||
<Preference
|
||||
android:fragment="com.android.settings.fuelgauge.SmartBatterySettings"
|
||||
android:key="smart_battery_manager"
|
||||
android:title="@string/smart_battery_manager_title"
|
||||
settings:controller="com.android.settings.fuelgauge.batterytip.BatteryManagerPreferenceController" />
|
||||
</PreferenceCategory>
|
||||
|
||||
<com.android.settingslib.widget.FooterPreference
|
||||
android:key="power_usage_footer"
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* 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.applications.autofill;
|
||||
|
||||
import android.annotation.UserIdInt;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ServiceInfo;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.UserHandle;
|
||||
import android.service.autofill.AutofillServiceInfo;
|
||||
import android.text.TextUtils;
|
||||
import android.util.IconDrawableFactory;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceGroup;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.settings.Utils;
|
||||
import com.android.settings.core.BasePreferenceController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Queries available autofill services and adds preferences for those that declare passwords
|
||||
* settings.
|
||||
*/
|
||||
public class PasswordsPreferenceController extends BasePreferenceController {
|
||||
|
||||
private final PackageManager mPm;
|
||||
private final IconDrawableFactory mIconFactory;
|
||||
private final List<AutofillServiceInfo> mServices;
|
||||
|
||||
public PasswordsPreferenceController(Context context, String preferenceKey) {
|
||||
super(context, preferenceKey);
|
||||
mPm = context.getPackageManager();
|
||||
mIconFactory = IconDrawableFactory.newInstance(mContext);
|
||||
mServices = AutofillServiceInfo.getAvailableServices(mContext, UserHandle.myUserId());
|
||||
for (int i = mServices.size() - 1; i >= 0; i--) {
|
||||
final String passwordsActivity = mServices.get(i).getPasswordsActivity();
|
||||
if (TextUtils.isEmpty(passwordsActivity)) {
|
||||
mServices.remove(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAvailabilityStatus() {
|
||||
return mServices.isEmpty() ? CONDITIONALLY_UNAVAILABLE : AVAILABLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayPreference(PreferenceScreen screen) {
|
||||
super.displayPreference(screen);
|
||||
final PreferenceGroup group = screen.findPreference(getPreferenceKey());
|
||||
// TODO(b/169455298): Show work profile passwords too.
|
||||
addPasswordPreferences(screen.getContext(), UserHandle.myUserId(), group);
|
||||
}
|
||||
|
||||
private void addPasswordPreferences(
|
||||
Context prefContext, @UserIdInt int user, PreferenceGroup group) {
|
||||
for (int i = 0; i < mServices.size(); i++) {
|
||||
final AutofillServiceInfo service = mServices.get(i);
|
||||
final Preference pref = new Preference(prefContext);
|
||||
final ServiceInfo serviceInfo = service.getServiceInfo();
|
||||
pref.setTitle(serviceInfo.loadLabel(mPm));
|
||||
final Drawable icon =
|
||||
mIconFactory.getBadgedIcon(
|
||||
serviceInfo,
|
||||
serviceInfo.applicationInfo,
|
||||
user);
|
||||
Utils.setSafeIcon(pref, icon);
|
||||
pref.setIntent(
|
||||
new Intent(Intent.ACTION_MAIN)
|
||||
.setClassName(serviceInfo.packageName, service.getPasswordsActivity()));
|
||||
group.addPreference(pref);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.settings.applications.specialaccess.notificationaccess;
|
||||
|
||||
import android.companion.ICompanionDeviceManager;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
@@ -30,8 +32,10 @@ import com.android.settings.R;
|
||||
import com.android.settings.core.BasePreferenceController;
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settings.dashboard.DashboardFragment;
|
||||
import com.android.settings.notification.NotificationBackend;
|
||||
import com.android.settings.widget.EntityHeaderController;
|
||||
import com.android.settingslib.applications.AppUtils;
|
||||
import com.android.settingslib.bluetooth.LocalBluetoothManager;
|
||||
import com.android.settingslib.core.lifecycle.Lifecycle;
|
||||
import com.android.settingslib.widget.LayoutPreference;
|
||||
|
||||
@@ -43,6 +47,10 @@ public class HeaderPreferenceController extends BasePreferenceController
|
||||
private PackageInfo mPackageInfo;
|
||||
private PackageManager mPm;
|
||||
private CharSequence mServiceName;
|
||||
private ICompanionDeviceManager mCdm;
|
||||
private LocalBluetoothManager mBm;
|
||||
private ComponentName mCn;
|
||||
private int mUserId;
|
||||
|
||||
public HeaderPreferenceController(Context context, String key) {
|
||||
super(context, key);
|
||||
@@ -68,6 +76,26 @@ public class HeaderPreferenceController extends BasePreferenceController
|
||||
return this;
|
||||
}
|
||||
|
||||
public HeaderPreferenceController setCdm(ICompanionDeviceManager cdm) {
|
||||
mCdm = cdm;
|
||||
return this;
|
||||
}
|
||||
|
||||
public HeaderPreferenceController setBluetoothManager(LocalBluetoothManager bm) {
|
||||
mBm = bm;
|
||||
return this;
|
||||
}
|
||||
|
||||
public HeaderPreferenceController setCn(ComponentName cn) {
|
||||
mCn = cn;
|
||||
return this;
|
||||
}
|
||||
|
||||
public HeaderPreferenceController setUserId(int userId) {
|
||||
mUserId = userId;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAvailabilityStatus() {
|
||||
return AVAILABLE;
|
||||
@@ -88,6 +116,8 @@ public class HeaderPreferenceController extends BasePreferenceController
|
||||
.getBadgedIcon(mPackageInfo.applicationInfo))
|
||||
.setLabel(mPackageInfo.applicationInfo.loadLabel(mPm))
|
||||
.setSummary(mServiceName)
|
||||
.setSecondSummary(new NotificationBackend().getDeviceList(
|
||||
mCdm, mBm, mCn.getPackageName(), mUserId))
|
||||
.setIsInstantApp(AppUtils.isInstant(mPackageInfo.applicationInfo))
|
||||
.setPackageName(mPackageInfo.packageName)
|
||||
.setUid(mPackageInfo.applicationInfo.uid)
|
||||
|
||||
@@ -21,7 +21,7 @@ import static com.android.settings.applications.AppInfoBase.ARG_PACKAGE_NAME;
|
||||
import android.app.Activity;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
import android.companion.ICompanionDeviceManager;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -30,6 +30,7 @@ import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.content.pm.ServiceInfo;
|
||||
import android.os.Bundle;
|
||||
import android.os.ServiceManager;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
import android.provider.Settings;
|
||||
@@ -45,14 +46,13 @@ import com.android.settings.R;
|
||||
import com.android.settings.SettingsActivity;
|
||||
import com.android.settings.applications.AppInfoBase;
|
||||
import com.android.settings.applications.manageapplications.ManageApplications;
|
||||
import com.android.settings.bluetooth.Utils;
|
||||
import com.android.settings.core.SubSettingLauncher;
|
||||
import com.android.settings.dashboard.DashboardFragment;
|
||||
import com.android.settings.notification.NotificationBackend;
|
||||
import com.android.settingslib.RestrictedLockUtils;
|
||||
import com.android.settingslib.RestrictedLockUtilsInternal;
|
||||
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -60,7 +60,6 @@ public class NotificationAccessDetails extends DashboardFragment {
|
||||
private static final String TAG = "NotifAccessDetails";
|
||||
|
||||
private NotificationBackend mNm = new NotificationBackend();
|
||||
private NotificationListenerFilter mNlf;
|
||||
private ComponentName mComponentName;
|
||||
private CharSequence mServiceName;
|
||||
protected ServiceInfo mServiceInfo;
|
||||
@@ -99,7 +98,12 @@ public class NotificationAccessDetails extends DashboardFragment {
|
||||
.setFragment(this)
|
||||
.setPackageInfo(mPackageInfo)
|
||||
.setPm(context.getPackageManager())
|
||||
.setServiceName(mServiceName);
|
||||
.setServiceName(mServiceName)
|
||||
.setBluetoothManager(Utils.getLocalBtManager(context))
|
||||
.setCdm(ICompanionDeviceManager.Stub.asInterface(
|
||||
ServiceManager.getService(Context.COMPANION_DEVICE_SERVICE)))
|
||||
.setCn(mComponentName)
|
||||
.setUserId(mUserId);
|
||||
getPreferenceControllers().forEach(controllers -> {
|
||||
controllers.forEach(controller -> {
|
||||
if (controller instanceof TypeFilterPreferenceController) {
|
||||
@@ -152,13 +156,6 @@ public class NotificationAccessDetails extends DashboardFragment {
|
||||
Preference apps = getPreferenceScreen().findPreference(
|
||||
use(BridgedAppsPreferenceController.class).getPreferenceKey());
|
||||
if (apps != null) {
|
||||
mNlf = mNm.getListenerFilter(mComponentName, mUserId);
|
||||
int nonBridgedCount = mNlf.getDisallowedPackages().size();
|
||||
apps.setSummary(nonBridgedCount == 0 ?
|
||||
getString(R.string.notif_listener_excluded_summary_zero)
|
||||
: getResources().getQuantityString(
|
||||
R.plurals.notif_listener_excluded_summary_nonzero,
|
||||
nonBridgedCount, nonBridgedCount));
|
||||
|
||||
apps.setOnPreferenceClickListener(preference -> {
|
||||
final Bundle args = new Bundle();
|
||||
@@ -169,7 +166,7 @@ public class NotificationAccessDetails extends DashboardFragment {
|
||||
new SubSettingLauncher(getContext())
|
||||
.setDestination(BridgedAppsSettings.class.getName())
|
||||
.setSourceMetricsCategory(getMetricsCategory())
|
||||
.setTitleRes(R.string.notif_listener_excluded_app_title)
|
||||
.setTitleRes(R.string.notif_listener_excluded_app_screen_title)
|
||||
.setArguments(args)
|
||||
.setUserHandle(UserHandle.of(mUserId))
|
||||
.launch();
|
||||
|
||||
@@ -173,6 +173,10 @@ public abstract class BiometricEnrollBase extends InstrumentedActivity {
|
||||
setHeaderText(resId, false /* force */);
|
||||
}
|
||||
|
||||
protected void setDescriptionText(int resId) {
|
||||
getLayout().setDescriptionText(resId);
|
||||
}
|
||||
|
||||
protected FooterButton getNextButton() {
|
||||
if (mFooterBarMixin != null) {
|
||||
return mFooterBarMixin.getPrimaryButton();
|
||||
|
||||
@@ -309,9 +309,8 @@ public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase
|
||||
protected void initViews() {
|
||||
super.initViews();
|
||||
|
||||
TextView description = (TextView) findViewById(R.id.sud_layout_description);
|
||||
if (mBiometricUnlockDisabledByAdmin) {
|
||||
description.setText(getDescriptionResDisabledByAdmin());
|
||||
setDescriptionText(getDescriptionResDisabledByAdmin());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,6 +57,8 @@ public class FingerprintEnrollIntroduction extends BiometricEnrollIntroduction {
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setDescriptionText(R.string.security_settings_fingerprint_enroll_introduction_message);
|
||||
|
||||
mFooterBarMixin = getLayout().getMixin(FooterBarMixin.class);
|
||||
mFooterBarMixin.setSecondaryButton(
|
||||
new FooterButton.Builder(this)
|
||||
@@ -69,7 +71,7 @@ public class FingerprintEnrollIntroduction extends BiometricEnrollIntroduction {
|
||||
|
||||
mFooterBarMixin.setPrimaryButton(
|
||||
new FooterButton.Builder(this)
|
||||
.setText(R.string.wizard_next)
|
||||
.setText(R.string.security_settings_fingerprint_enroll_introduction_agree)
|
||||
.setListener(this::onNextButtonClick)
|
||||
.setButtonType(FooterButton.ButtonType.NEXT)
|
||||
.setTheme(R.style.SudGlifButton_Primary)
|
||||
@@ -78,7 +80,7 @@ public class FingerprintEnrollIntroduction extends BiometricEnrollIntroduction {
|
||||
}
|
||||
|
||||
int getNegativeButtonTextId() {
|
||||
return R.string.security_settings_fingerprint_enroll_introduction_no_thanks;
|
||||
return R.string.security_settings_fingerprint_enroll_introduction_skip;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -64,14 +64,24 @@ public class UsbDefaultFragment extends RadioButtonPickerFragment {
|
||||
|
||||
private UsbConnectionBroadcastReceiver mUsbReceiver;
|
||||
private Handler mHandler = new Handler();
|
||||
private boolean mIsConnected = false;
|
||||
|
||||
@VisibleForTesting
|
||||
UsbConnectionBroadcastReceiver.UsbConnectionListener mUsbConnectionListener =
|
||||
(connected, functions, powerRole, dataRole) -> {
|
||||
final long defaultFunctions = mUsbBackend.getDefaultUsbFunctions();
|
||||
Log.d(TAG, "UsbConnectionListener() connected : " + connected + ", functions : "
|
||||
+ functions + ", defaultFunctions : " + defaultFunctions);
|
||||
if (connected && !mIsConnected && defaultFunctions == UsbManager.FUNCTION_RNDIS) {
|
||||
startTethering();
|
||||
}
|
||||
|
||||
if (mIsStartTethering) {
|
||||
mCurrentFunctions = functions;
|
||||
refresh(functions);
|
||||
mIsStartTethering = false;
|
||||
}
|
||||
mIsConnected = connected;
|
||||
};
|
||||
|
||||
@Override
|
||||
@@ -146,9 +156,7 @@ public class UsbDefaultFragment extends RadioButtonPickerFragment {
|
||||
if (functions == UsbManager.FUNCTION_RNDIS) {
|
||||
// We need to have entitlement check for usb tethering, so use API in
|
||||
// TetheringManager.
|
||||
mIsStartTethering = true;
|
||||
mTetheringManager.startTethering(TETHERING_USB, new HandlerExecutor(mHandler),
|
||||
mOnStartTetheringCallback);
|
||||
startTethering();
|
||||
} else {
|
||||
mIsStartTethering = false;
|
||||
mCurrentFunctions = functions;
|
||||
@@ -159,6 +167,13 @@ public class UsbDefaultFragment extends RadioButtonPickerFragment {
|
||||
return true;
|
||||
}
|
||||
|
||||
private void startTethering() {
|
||||
Log.d(TAG, "startTethering()");
|
||||
mIsStartTethering = true;
|
||||
mTetheringManager.startTethering(TETHERING_USB, new HandlerExecutor(mHandler),
|
||||
mOnStartTetheringCallback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
@@ -171,6 +186,7 @@ public class UsbDefaultFragment extends RadioButtonPickerFragment {
|
||||
|
||||
@Override
|
||||
public void onTetheringStarted() {
|
||||
Log.d(TAG, "onTetheringStarted()");
|
||||
// Set default usb functions again to make internal data persistent
|
||||
mCurrentFunctions = UsbManager.FUNCTION_RNDIS;
|
||||
mUsbBackend.setDefaultUsbFunctions(UsbManager.FUNCTION_RNDIS);
|
||||
|
||||
@@ -20,6 +20,7 @@ import static com.android.settings.core.BasePreferenceController.AVAILABLE_UNSEA
|
||||
import static com.android.settings.core.BasePreferenceController.UNSUPPORTED_ON_DEVICE;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
@@ -33,8 +34,10 @@ import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.bluetooth.RestrictionUtils;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
import com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
|
||||
import com.android.settingslib.RestrictedSwitchPreference;
|
||||
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
|
||||
@@ -45,6 +48,7 @@ public class AdaptiveSleepPreferenceController {
|
||||
private RestrictionUtils mRestrictionUtils;
|
||||
private PackageManager mPackageManager;
|
||||
private Context mContext;
|
||||
private MetricsFeatureProvider mMetricsFeatureProvider;
|
||||
|
||||
@VisibleForTesting
|
||||
RestrictedSwitchPreference mPreference;
|
||||
@@ -52,6 +56,7 @@ public class AdaptiveSleepPreferenceController {
|
||||
public AdaptiveSleepPreferenceController(Context context, RestrictionUtils restrictionUtils) {
|
||||
mContext = context;
|
||||
mRestrictionUtils = restrictionUtils;
|
||||
mMetricsFeatureProvider = FeatureFactory.getFactory(context).getMetricsFeatureProvider();
|
||||
mPreference = new RestrictedSwitchPreference(context);
|
||||
mPreference.setTitle(R.string.adaptive_sleep_title);
|
||||
mPreference.setSummary(R.string.adaptive_sleep_description);
|
||||
@@ -60,6 +65,8 @@ public class AdaptiveSleepPreferenceController {
|
||||
mPreference.setKey(PREFERENCE_KEY);
|
||||
mPreference.setOnPreferenceClickListener(preference -> {
|
||||
final boolean isChecked = ((RestrictedSwitchPreference) preference).isChecked();
|
||||
mMetricsFeatureProvider.action(context, SettingsEnums.ACTION_SCREEN_ATTENTION_CHANGED,
|
||||
isChecked);
|
||||
Settings.Secure.putInt(context.getContentResolver(),
|
||||
Settings.Secure.ADAPTIVE_SLEEP, isChecked ? 1 : DEFAULT_VALUE);
|
||||
return true;
|
||||
|
||||
@@ -93,7 +93,8 @@ public class AutoRotateSwitchBarController implements OnMainSwitchChangeListener
|
||||
|
||||
private boolean setRotationLock(boolean isChecked) {
|
||||
final boolean isLocked = !isChecked;
|
||||
mMetricsFeatureProvider.action(mContext, SettingsEnums.ACTION_ROTATION_LOCK, isLocked);
|
||||
mMetricsFeatureProvider.action(mContext, SettingsEnums.ACTION_ROTATE_ROTATE_MASTER_TOGGLE,
|
||||
isChecked);
|
||||
RotationPolicy.setRotationLock(mContext, isLocked);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
import com.android.settings.search.BaseSearchIndexProvider;
|
||||
import com.android.settings.search.actionbar.SearchMenuController;
|
||||
import com.android.settings.support.actionbar.HelpMenuController;
|
||||
@@ -44,6 +45,7 @@ import com.android.settings.support.actionbar.HelpResourceProvider;
|
||||
import com.android.settings.widget.RadioButtonPickerFragment;
|
||||
import com.android.settingslib.RestrictedLockUtils;
|
||||
import com.android.settingslib.RestrictedLockUtilsInternal;
|
||||
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
|
||||
import com.android.settingslib.search.SearchIndexable;
|
||||
import com.android.settingslib.search.SearchIndexableRaw;
|
||||
import com.android.settingslib.widget.CandidateInfo;
|
||||
@@ -70,6 +72,7 @@ public class ScreenTimeoutSettings extends RadioButtonPickerFragment implements
|
||||
private CharSequence[] mInitialEntries;
|
||||
private CharSequence[] mInitialValues;
|
||||
private FooterPreference mPrivacyPreference;
|
||||
private MetricsFeatureProvider mMetricsFeatureProvider;
|
||||
|
||||
@VisibleForTesting
|
||||
RestrictedLockUtils.EnforcedAdmin mAdmin;
|
||||
@@ -102,6 +105,7 @@ public class ScreenTimeoutSettings extends RadioButtonPickerFragment implements
|
||||
mPrivacyPreference.setTitle(R.string.adaptive_sleep_privacy);
|
||||
mPrivacyPreference.setSelectable(false);
|
||||
mPrivacyPreference.setLayoutResource(R.layout.preference_footer);
|
||||
mMetricsFeatureProvider = FeatureFactory.getFactory(context).getMetricsFeatureProvider();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -244,6 +248,8 @@ public class ScreenTimeoutSettings extends RadioButtonPickerFragment implements
|
||||
try {
|
||||
if (context != null) {
|
||||
final long value = Long.parseLong(key);
|
||||
mMetricsFeatureProvider.action(context, SettingsEnums.ACTION_SCREEN_TIMEOUT_CHANGED,
|
||||
(int) value);
|
||||
Settings.System.putLong(context.getContentResolver(), SCREEN_OFF_TIMEOUT, value);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
|
||||
@@ -15,14 +15,21 @@
|
||||
*/
|
||||
package com.android.settings.fuelgauge;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.database.ContentObserver;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.PowerManager;
|
||||
import android.provider.Settings;
|
||||
import android.provider.Settings.Global;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.settings.core.TogglePreferenceController;
|
||||
import com.android.settings.widget.PrimarySwitchPreference;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.Utils;
|
||||
import com.android.settings.core.BasePreferenceController;
|
||||
import com.android.settingslib.core.lifecycle.LifecycleObserver;
|
||||
import com.android.settingslib.core.lifecycle.events.OnStart;
|
||||
import com.android.settingslib.core.lifecycle.events.OnStop;
|
||||
@@ -31,14 +38,19 @@ import com.android.settingslib.fuelgauge.BatterySaverUtils;
|
||||
/**
|
||||
* Controller to update the battery saver entry preference.
|
||||
*/
|
||||
public class BatterySaverController extends TogglePreferenceController
|
||||
public class BatterySaverController extends BasePreferenceController
|
||||
implements LifecycleObserver, OnStart, OnStop, BatterySaverReceiver.BatterySaverListener {
|
||||
private static final String KEY_BATTERY_SAVER = "battery_saver_summary";
|
||||
private final BatterySaverReceiver mBatteryStateChangeReceiver;
|
||||
private final PowerManager mPowerManager;
|
||||
|
||||
@VisibleForTesting
|
||||
PrimarySwitchPreference mBatterySaverPref;
|
||||
private Preference mBatterySaverPref;
|
||||
private final ContentObserver mObserver = new ContentObserver(
|
||||
new Handler(Looper.getMainLooper())) {
|
||||
@Override
|
||||
public void onChange(boolean selfChange) {
|
||||
updateSummary();
|
||||
}
|
||||
};
|
||||
|
||||
public BatterySaverController(Context context) {
|
||||
super(context, KEY_BATTERY_SAVER);
|
||||
@@ -67,38 +79,54 @@ public class BatterySaverController extends TogglePreferenceController
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
mContext.getContentResolver().registerContentObserver(
|
||||
Settings.Global.getUriFor(Settings.Global.LOW_POWER_MODE_TRIGGER_LEVEL),
|
||||
true /* notifyForDescendants */, mObserver);
|
||||
|
||||
mBatteryStateChangeReceiver.setListening(true);
|
||||
updateSummary();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop() {
|
||||
mContext.getContentResolver().unregisterContentObserver(mObserver);
|
||||
mBatteryStateChangeReceiver.setListening(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPowerSaveModeChanged() {
|
||||
final boolean isChecked = isChecked();
|
||||
if (mBatterySaverPref != null && mBatterySaverPref.isChecked() != isChecked) {
|
||||
mBatterySaverPref.setChecked(isChecked);
|
||||
public CharSequence getSummary() {
|
||||
final boolean isPowerSaveOn = mPowerManager.isPowerSaveMode();
|
||||
if (isPowerSaveOn) {
|
||||
return mContext.getString(R.string.battery_saver_on_summary);
|
||||
}
|
||||
|
||||
final ContentResolver resolver = mContext.getContentResolver();
|
||||
final int mode = Settings.Global.getInt(resolver,
|
||||
Global.AUTOMATIC_POWER_SAVE_MODE, PowerManager.POWER_SAVE_MODE_TRIGGER_PERCENTAGE);
|
||||
if (mode == PowerManager.POWER_SAVE_MODE_TRIGGER_PERCENTAGE) {
|
||||
final int percent = Settings.Global.getInt(resolver,
|
||||
Settings.Global.LOW_POWER_MODE_TRIGGER_LEVEL, 0);
|
||||
return percent != 0 ?
|
||||
mContext.getString(R.string.battery_saver_off_scheduled_summary,
|
||||
Utils.formatPercentage(percent)) :
|
||||
mContext.getString(R.string.battery_saver_off_summary);
|
||||
} else {
|
||||
return mContext.getString(R.string.battery_saver_auto_routine);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateSummary() {
|
||||
if (mBatterySaverPref != null) {
|
||||
mBatterySaverPref.setSummary(getSummary());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPowerSaveModeChanged() {
|
||||
updateSummary();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBatteryChanged(boolean pluggedIn) {
|
||||
if (mBatterySaverPref != null) {
|
||||
mBatterySaverPref.setSwitchEnabled(!pluggedIn);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isChecked() {
|
||||
return mPowerManager.isPowerSaveMode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setChecked(boolean stateOn) {
|
||||
return BatterySaverUtils.setPowerSaveMode(mContext, stateOn,
|
||||
false /* needFirstTimeWarning */);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.android.settings.network;
|
||||
|
||||
import android.content.Context;
|
||||
import android.telephony.PhoneStateListener;
|
||||
import android.telephony.TelephonyCallback;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.util.Log;
|
||||
|
||||
@@ -28,14 +29,14 @@ import java.util.concurrent.Executor;
|
||||
|
||||
|
||||
/**
|
||||
* {@link PhoneStateListener} to listen to Allowed Network Types changed
|
||||
* {@link TelephonyCallback} to listen to Allowed Network Types changed
|
||||
*/
|
||||
public class AllowedNetworkTypesListener extends PhoneStateListener implements
|
||||
PhoneStateListener.AllowedNetworkTypesChangedListener {
|
||||
public class AllowedNetworkTypesListener extends TelephonyCallback implements
|
||||
TelephonyCallback.AllowedNetworkTypesListener {
|
||||
private static final String LOG_TAG = "NetworkModeListener";
|
||||
|
||||
@VisibleForTesting
|
||||
AllowedNetworkTypesListener.OnAllowedNetworkTypesChangedListener mListener;
|
||||
OnAllowedNetworkTypesListener mListener;
|
||||
private long mAllowedNetworkType = -1;
|
||||
private Executor mExecutor;
|
||||
|
||||
@@ -44,7 +45,7 @@ public class AllowedNetworkTypesListener extends PhoneStateListener implements
|
||||
mExecutor = executor;
|
||||
}
|
||||
|
||||
public void setAllowedNetworkTypesChangedListener(OnAllowedNetworkTypesChangedListener lsn) {
|
||||
public void setAllowedNetworkTypesListener(OnAllowedNetworkTypesListener lsn) {
|
||||
mListener = lsn;
|
||||
}
|
||||
|
||||
@@ -56,7 +57,7 @@ public class AllowedNetworkTypesListener extends PhoneStateListener implements
|
||||
public void register(Context context, int subId) {
|
||||
TelephonyManager telephonyManager = context.getSystemService(
|
||||
TelephonyManager.class).createForSubscriptionId(subId);
|
||||
telephonyManager.registerPhoneStateListener(mExecutor, this);
|
||||
telephonyManager.registerTelephonyCallback(mExecutor, this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -67,7 +68,7 @@ public class AllowedNetworkTypesListener extends PhoneStateListener implements
|
||||
public void unregister(Context context, int subId) {
|
||||
TelephonyManager telephonyManager = context.getSystemService(
|
||||
TelephonyManager.class).createForSubscriptionId(subId);
|
||||
telephonyManager.unregisterPhoneStateListener(this);
|
||||
telephonyManager.unregisterTelephonyCallback(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -84,7 +85,7 @@ public class AllowedNetworkTypesListener extends PhoneStateListener implements
|
||||
/**
|
||||
* Listener for update of Preferred Network Mode change
|
||||
*/
|
||||
public interface OnAllowedNetworkTypesChangedListener {
|
||||
public interface OnAllowedNetworkTypesListener {
|
||||
/**
|
||||
* Notify the allowed network type changed.
|
||||
*/
|
||||
|
||||
@@ -83,8 +83,9 @@ public class ProviderModelSlice extends WifiSlice {
|
||||
// Second section: Add a carrier item.
|
||||
// Third section: Add the Wi-Fi items which are not connected.
|
||||
// Fourth section: If device has connection problem, this row show the message for user.
|
||||
boolean hasEthernet = isEthernetConnected();
|
||||
final ListBuilder listBuilder = mHelper.createListBuilder(getUri());
|
||||
if (mHelper.isAirplaneModeEnabled() && !mWifiManager.isWifiEnabled()) {
|
||||
if (mHelper.isAirplaneModeEnabled() && !mWifiManager.isWifiEnabled() && !hasEthernet) {
|
||||
log("Airplane mode is enabled.");
|
||||
return listBuilder.build();
|
||||
}
|
||||
@@ -104,12 +105,12 @@ public class ProviderModelSlice extends WifiSlice {
|
||||
log("hasCarrier: " + hasCarrier);
|
||||
|
||||
// First section: Add a Ethernet or Wi-Fi item which state is connected.
|
||||
if (isEthernetConnected()) {
|
||||
final WifiSliceItem connectedWifiItem = mHelper.getConnectedWifiItem(wifiList);
|
||||
if (hasEthernet) {
|
||||
log("get Ethernet item which is connected");
|
||||
listBuilder.addRow(createEthernetRow());
|
||||
maxListSize--;
|
||||
} else {
|
||||
final WifiSliceItem connectedWifiItem = mHelper.getConnectedWifiItem(wifiList);
|
||||
if (connectedWifiItem != null) {
|
||||
log("get Wi-Fi item which is connected");
|
||||
listBuilder.addRow(getWifiSliceItemRow(connectedWifiItem));
|
||||
@@ -126,7 +127,14 @@ public class ProviderModelSlice extends WifiSlice {
|
||||
maxListSize--;
|
||||
}
|
||||
|
||||
// Third section: Add the Wi-Fi items which are not connected.
|
||||
// Third section: Add the connected Wi-Fi item to Wi-Fi list if the Ethernet is connected.
|
||||
if (connectedWifiItem != null && hasEthernet) {
|
||||
log("get Wi-Fi item which is connected");
|
||||
listBuilder.addRow(getWifiSliceItemRow(connectedWifiItem));
|
||||
maxListSize--;
|
||||
}
|
||||
|
||||
// Fourth section: Add the Wi-Fi items which are not connected.
|
||||
if (wifiList != null && wifiList.size() > 0) {
|
||||
log("get Wi-Fi items which are not connected. Wi-Fi items : " + wifiList.size());
|
||||
|
||||
@@ -140,7 +148,7 @@ public class ProviderModelSlice extends WifiSlice {
|
||||
}
|
||||
}
|
||||
|
||||
// Fourth section: If device has connection problem, this row show the message for user.
|
||||
// Fifth section: If device has connection problem, this row show the message for user.
|
||||
// 1) show non_carrier_network_unavailable:
|
||||
// - while no wifi item
|
||||
// 2) show all_network_unavailable:
|
||||
@@ -154,7 +162,7 @@ public class ProviderModelSlice extends WifiSlice {
|
||||
resId = R.string.all_network_unavailable;
|
||||
}
|
||||
|
||||
if (!hasCarrier) {
|
||||
if (!hasCarrier && !hasEthernet) {
|
||||
// If there is no item in ProviderModelItem, slice needs a header.
|
||||
listBuilder.setHeader(mHelper.createHeader(
|
||||
NetworkProviderSettings.ACTION_NETWORK_PROVIDER_SETTINGS));
|
||||
|
||||
@@ -257,9 +257,10 @@ public class SubscriptionsPreferenceController extends AbstractPreferenceControl
|
||||
}
|
||||
|
||||
private CharSequence getMobilePreferenceSummary(int subId) {
|
||||
TelephonyManager tm = mTelephonyManager.createForSubscriptionId(subId);
|
||||
String result = mSubsPrefCtrlInjector.getNetworkType(
|
||||
mContext, mConfig, mTelephonyDisplayInfo, subId);
|
||||
if (!mTelephonyManager.isDataEnabled()) {
|
||||
if (!tm.isDataEnabled()) {
|
||||
return mContext.getString(R.string.mobile_data_off_summary);
|
||||
}
|
||||
if (!result.isEmpty() && mSubsPrefCtrlInjector.isActiveCellularNetwork(mContext)) {
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.android.settings.network.telephony;
|
||||
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
import android.os.PersistableBundle;
|
||||
import android.telephony.CarrierConfigManager;
|
||||
@@ -22,6 +23,9 @@ import android.telephony.SubscriptionManager;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
|
||||
|
||||
/**
|
||||
* Preference controller for "Enable 2G"
|
||||
*/
|
||||
@@ -34,6 +38,8 @@ public class Enable2gPreferenceController extends TelephonyTogglePreferenceContr
|
||||
| TelephonyManager.NETWORK_TYPE_BITMASK_CDMA
|
||||
| TelephonyManager.NETWORK_TYPE_BITMASK_1xRTT;
|
||||
|
||||
private final MetricsFeatureProvider mMetricsFeatureProvider;
|
||||
|
||||
private CarrierConfigManager mCarrierConfigManager;
|
||||
private TelephonyManager mTelephonyManager;
|
||||
|
||||
@@ -46,6 +52,7 @@ public class Enable2gPreferenceController extends TelephonyTogglePreferenceContr
|
||||
public Enable2gPreferenceController(Context context, String key) {
|
||||
super(context, key);
|
||||
mCarrierConfigManager = context.getSystemService(CarrierConfigManager.class);
|
||||
mMetricsFeatureProvider = FeatureFactory.getFactory(context).getMetricsFeatureProvider();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -98,6 +105,8 @@ public class Enable2gPreferenceController extends TelephonyTogglePreferenceContr
|
||||
}
|
||||
mTelephonyManager.setAllowedNetworkTypesForReason(
|
||||
mTelephonyManager.ALLOWED_NETWORK_TYPES_REASON_ENABLE_2G, newAllowedNetworkTypes);
|
||||
mMetricsFeatureProvider.action(
|
||||
mContext, SettingsEnums.ACTION_2G_ENABLED, isChecked);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ public class EnabledNetworkModePreferenceController extends
|
||||
if (mAllowedNetworkTypesListener == null) {
|
||||
mAllowedNetworkTypesListener = new AllowedNetworkTypesListener(
|
||||
mContext.getMainExecutor());
|
||||
mAllowedNetworkTypesListener.setAllowedNetworkTypesChangedListener(
|
||||
mAllowedNetworkTypesListener.setAllowedNetworkTypesListener(
|
||||
() -> updatePreference());
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public class NetworkPreferenceCategoryController extends PreferenceCategoryContr
|
||||
mSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
|
||||
mAllowedNetworkTypesListener = new AllowedNetworkTypesListener(
|
||||
context.getMainExecutor());
|
||||
mAllowedNetworkTypesListener.setAllowedNetworkTypesChangedListener(
|
||||
mAllowedNetworkTypesListener.setAllowedNetworkTypesListener(
|
||||
() -> updatePreference());
|
||||
}
|
||||
|
||||
|
||||
@@ -25,9 +25,9 @@ import android.database.ContentObserver;
|
||||
import android.net.Uri;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.telephony.PhoneStateListener;
|
||||
import android.telephony.ServiceState;
|
||||
import android.telephony.SubscriptionManager;
|
||||
import android.telephony.TelephonyCallback;
|
||||
import android.telephony.TelephonyDisplayInfo;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.util.Log;
|
||||
@@ -62,7 +62,7 @@ public class NetworkProviderWorker extends WifiScanWorker implements
|
||||
private final Context mContext;
|
||||
final Handler mHandler;
|
||||
@VisibleForTesting
|
||||
final PhoneStateListener mPhoneStateListener;
|
||||
final NetworkProviderTelephonyCallback mTelephonyCallback;
|
||||
private TelephonyManager mTelephonyManager;
|
||||
private Config mConfig = null;
|
||||
private TelephonyDisplayInfo mTelephonyDisplayInfo =
|
||||
@@ -82,7 +82,7 @@ public class NetworkProviderWorker extends WifiScanWorker implements
|
||||
|
||||
mTelephonyManager = mContext.getSystemService(
|
||||
TelephonyManager.class).createForSubscriptionId(mDefaultDataSubid);
|
||||
mPhoneStateListener = new NetworkProviderPhoneStateListener();
|
||||
mTelephonyCallback = new NetworkProviderTelephonyCallback();
|
||||
mSubscriptionsListener = new SubscriptionsChangeListener(context, this);
|
||||
mDataEnabledListener = new MobileDataEnabledListener(context, this);
|
||||
mConnectivityListener = new DataConnectivityListener(context, this);
|
||||
@@ -100,7 +100,7 @@ public class NetworkProviderWorker extends WifiScanWorker implements
|
||||
mDataEnabledListener.start(mDefaultDataSubid);
|
||||
mConnectivityListener.start();
|
||||
mSignalStrengthListener.resume();
|
||||
mTelephonyManager.registerPhoneStateListener(mHandler::post, mPhoneStateListener);
|
||||
mTelephonyManager.registerTelephonyCallback(mHandler::post, mTelephonyCallback);
|
||||
super.onSlicePinned();
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ public class NetworkProviderWorker extends WifiScanWorker implements
|
||||
mDataEnabledListener.stop();
|
||||
mConnectivityListener.stop();
|
||||
mSignalStrengthListener.pause();
|
||||
mTelephonyManager.unregisterPhoneStateListener(mPhoneStateListener);
|
||||
mTelephonyManager.unregisterTelephonyCallback(mTelephonyCallback);
|
||||
super.onSliceUnpinned();
|
||||
}
|
||||
|
||||
@@ -141,12 +141,12 @@ public class NetworkProviderWorker extends WifiScanWorker implements
|
||||
return;
|
||||
}
|
||||
if (SubscriptionManager.isUsableSubscriptionId(defaultDataSubId)) {
|
||||
mTelephonyManager.unregisterPhoneStateListener(mPhoneStateListener);
|
||||
mTelephonyManager.unregisterTelephonyCallback(mTelephonyCallback);
|
||||
mMobileDataObserver.unregister(mContext);
|
||||
|
||||
mSignalStrengthListener.updateSubscriptionIds(Collections.singleton(defaultDataSubId));
|
||||
mTelephonyManager = mTelephonyManager.createForSubscriptionId(defaultDataSubId);
|
||||
mTelephonyManager.registerPhoneStateListener(mHandler::post, mPhoneStateListener);
|
||||
mTelephonyManager.registerTelephonyCallback(mHandler::post, mTelephonyCallback);
|
||||
mMobileDataObserver.register(mContext, mDefaultDataSubid);
|
||||
mConfig = getConfig(mContext);
|
||||
} else {
|
||||
@@ -216,10 +216,10 @@ public class NetworkProviderWorker extends WifiScanWorker implements
|
||||
}
|
||||
}
|
||||
|
||||
class NetworkProviderPhoneStateListener extends PhoneStateListener implements
|
||||
PhoneStateListener.DataConnectionStateChangedListener,
|
||||
PhoneStateListener.DisplayInfoChangedListener,
|
||||
PhoneStateListener.ServiceStateChangedListener {
|
||||
class NetworkProviderTelephonyCallback extends TelephonyCallback implements
|
||||
TelephonyCallback.DataConnectionStateListener,
|
||||
TelephonyCallback.DisplayInfoListener,
|
||||
TelephonyCallback.ServiceStateListener {
|
||||
@Override
|
||||
public void onServiceStateChanged(ServiceState state) {
|
||||
Log.d(TAG, "onServiceStateChanged voiceState=" + state.getState()
|
||||
|
||||
@@ -77,7 +77,7 @@ public abstract class CdmaBasePreferenceController extends TelephonyBasePreferen
|
||||
if (mAllowedNetworkTypesListener == null) {
|
||||
mAllowedNetworkTypesListener = new AllowedNetworkTypesListener(
|
||||
mContext.getMainExecutor());
|
||||
mAllowedNetworkTypesListener.setAllowedNetworkTypesChangedListener(
|
||||
mAllowedNetworkTypesListener.setAllowedNetworkTypesListener(
|
||||
() -> updatePreference());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ public class AutoSelectPreferenceController extends TelephonyTogglePreferenceCon
|
||||
mUiHandler = new Handler(Looper.getMainLooper());
|
||||
mAllowedNetworkTypesListener = new AllowedNetworkTypesListener(
|
||||
new HandlerExecutor(mUiHandler));
|
||||
mAllowedNetworkTypesListener.setAllowedNetworkTypesChangedListener(
|
||||
mAllowedNetworkTypesListener.setAllowedNetworkTypesListener(
|
||||
() -> updatePreference());
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ public class OpenNetworkSelectPagePreferenceController extends
|
||||
mSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
|
||||
mAllowedNetworkTypesListener = new AllowedNetworkTypesListener(
|
||||
context.getMainExecutor());
|
||||
mAllowedNetworkTypesListener.setAllowedNetworkTypesChangedListener(
|
||||
mAllowedNetworkTypesListener.setAllowedNetworkTypesListener(
|
||||
() -> updatePreference());
|
||||
|
||||
}
|
||||
|
||||
@@ -20,12 +20,14 @@ import android.annotation.Nullable;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.admin.DevicePolicyManager;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.companion.ICompanionDeviceManager;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageItemInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ServiceInfo;
|
||||
import android.os.Bundle;
|
||||
import android.os.ServiceManager;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
import android.provider.Settings;
|
||||
@@ -35,6 +37,7 @@ import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.preference.PreferenceCategory;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.settings.R;
|
||||
@@ -57,6 +60,9 @@ import java.util.List;
|
||||
@SearchIndexable
|
||||
public class NotificationAccessSettings extends EmptyTextSettings {
|
||||
private static final String TAG = "NotifAccessSettings";
|
||||
private static final String ALLOWED_KEY = "allowed";
|
||||
private static final String NOT_ALLOWED_KEY = "not_allowed";
|
||||
|
||||
private static final ManagedServiceSettings.Config CONFIG =
|
||||
new ManagedServiceSettings.Config.Builder()
|
||||
.setTag(TAG)
|
||||
@@ -76,6 +82,7 @@ public class NotificationAccessSettings extends EmptyTextSettings {
|
||||
private DevicePolicyManager mDpm;
|
||||
private ServiceListing mServiceListing;
|
||||
private IconDrawableFactory mIconDrawableFactory;
|
||||
private NotificationBackend mBackend = new NotificationBackend();
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
@@ -93,7 +100,6 @@ public class NotificationAccessSettings extends EmptyTextSettings {
|
||||
.setTag(CONFIG.tag)
|
||||
.build();
|
||||
mServiceListing.addCallback(this::updateList);
|
||||
setPreferenceScreen(getPreferenceManager().createPreferenceScreen(mContext));
|
||||
|
||||
if (UserManager.get(mContext).isManagedProfile()) {
|
||||
// Apps in the work profile do not support notification listeners.
|
||||
@@ -127,7 +133,11 @@ public class NotificationAccessSettings extends EmptyTextSettings {
|
||||
final int managedProfileId = Utils.getManagedProfileId(um, UserHandle.myUserId());
|
||||
|
||||
final PreferenceScreen screen = getPreferenceScreen();
|
||||
screen.removeAll();
|
||||
final PreferenceCategory allowedCategory = screen.findPreference(ALLOWED_KEY);
|
||||
allowedCategory.removeAll();
|
||||
final PreferenceCategory notAllowedCategory = screen.findPreference(NOT_ALLOWED_KEY);
|
||||
notAllowedCategory.removeAll();
|
||||
|
||||
services.sort(new PackageItemInfo.DisplayNameComparator(mPm));
|
||||
for (ServiceInfo service : services) {
|
||||
final ComponentName cn = new ComponentName(service.packageName, service.name);
|
||||
@@ -145,9 +155,11 @@ public class NotificationAccessSettings extends EmptyTextSettings {
|
||||
pref.setIcon(mIconDrawableFactory.getBadgedIcon(service, service.applicationInfo,
|
||||
UserHandle.getUserId(service.applicationInfo.uid)));
|
||||
pref.setKey(cn.flattenToString());
|
||||
pref.setSummary(mNm.isNotificationListenerAccessGranted(cn)
|
||||
? R.string.app_permission_summary_allowed
|
||||
: R.string.app_permission_summary_not_allowed);
|
||||
pref.setSummary(mBackend.getDeviceList(ICompanionDeviceManager.Stub.asInterface(
|
||||
ServiceManager.getService(Context.COMPANION_DEVICE_SERVICE)),
|
||||
com.android.settings.bluetooth.Utils.getLocalBtManager(mContext),
|
||||
service.packageName,
|
||||
UserHandle.myUserId()));
|
||||
if (managedProfileId != UserHandle.USER_NULL
|
||||
&& !mDpm.isNotificationListenerServicePermitted(
|
||||
service.packageName, managedProfileId)) {
|
||||
@@ -173,7 +185,11 @@ public class NotificationAccessSettings extends EmptyTextSettings {
|
||||
return true;
|
||||
});
|
||||
pref.setKey(cn.flattenToString());
|
||||
screen.addPreference(pref);
|
||||
if (mNm.isNotificationListenerAccessGranted(cn)) {
|
||||
allowedCategory.addPreference(pref);
|
||||
} else {
|
||||
notAllowedCategory.addPreference(pref);
|
||||
}
|
||||
}
|
||||
highlightPreferenceIfNeeded();
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ import android.app.NotificationManager;
|
||||
import android.app.role.RoleManager;
|
||||
import android.app.usage.IUsageStatsManager;
|
||||
import android.app.usage.UsageEvents;
|
||||
import android.companion.ICompanionDeviceManager;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -55,14 +56,18 @@ import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.settingslib.R;
|
||||
import com.android.settingslib.Utils;
|
||||
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
|
||||
import com.android.settingslib.bluetooth.LocalBluetoothManager;
|
||||
import com.android.settingslib.notification.ConversationIconFactory;
|
||||
import com.android.settingslib.utils.StringUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
public class NotificationBackend {
|
||||
private static final String TAG = "NotificationBackend";
|
||||
@@ -138,6 +143,35 @@ public class NotificationBackend {
|
||||
}
|
||||
}
|
||||
|
||||
static public CharSequence getDeviceList(ICompanionDeviceManager cdm, LocalBluetoothManager lbm,
|
||||
String pkg, int userId) {
|
||||
boolean multiple = false;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
try {
|
||||
List<String> associatedMacAddrs = cdm.getAssociations(pkg, userId);
|
||||
if (associatedMacAddrs != null) {
|
||||
for (String assocMac : associatedMacAddrs) {
|
||||
final Collection<CachedBluetoothDevice> cachedDevices =
|
||||
lbm.getCachedDeviceManager().getCachedDevicesCopy();
|
||||
for (CachedBluetoothDevice cachedBluetoothDevice : cachedDevices) {
|
||||
if (Objects.equals(assocMac, cachedBluetoothDevice.getAddress())) {
|
||||
if (multiple) {
|
||||
sb.append(", ");
|
||||
} else {
|
||||
multiple = true;
|
||||
}
|
||||
sb.append(cachedBluetoothDevice.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
Log.w(TAG, "Error calling CDM", e);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public boolean isSystemApp(Context context, ApplicationInfo app) {
|
||||
try {
|
||||
PackageInfo info = context.getPackageManager().getPackageInfo(
|
||||
|
||||
@@ -536,8 +536,9 @@ public class WifiConfigController implements TextWatcher,
|
||||
} else {
|
||||
enabled = ipAndProxyFieldsAreValid();
|
||||
}
|
||||
if ((mAccessPointSecurity == AccessPoint.SECURITY_EAP ||
|
||||
mAccessPointSecurity == AccessPoint.SECURITY_EAP_SUITE_B)
|
||||
if ((mAccessPointSecurity == AccessPoint.SECURITY_EAP
|
||||
|| mAccessPointSecurity == AccessPoint.SECURITY_EAP_WPA3_ENTERPRISE
|
||||
|| mAccessPointSecurity == AccessPoint.SECURITY_EAP_SUITE_B)
|
||||
&& mEapCaCertSpinner != null
|
||||
&& mView.findViewById(R.id.l_ca_cert).getVisibility() != View.GONE) {
|
||||
String caCertSelection = (String) mEapCaCertSpinner.getSelectedItem();
|
||||
@@ -553,8 +554,9 @@ public class WifiConfigController implements TextWatcher,
|
||||
enabled = false;
|
||||
}
|
||||
}
|
||||
if ((mAccessPointSecurity == AccessPoint.SECURITY_EAP ||
|
||||
mAccessPointSecurity == AccessPoint.SECURITY_EAP_SUITE_B)
|
||||
if ((mAccessPointSecurity == AccessPoint.SECURITY_EAP
|
||||
|| mAccessPointSecurity == AccessPoint.SECURITY_EAP_WPA3_ENTERPRISE
|
||||
|| mAccessPointSecurity == AccessPoint.SECURITY_EAP_SUITE_B)
|
||||
&& mEapUserCertSpinner != null
|
||||
&& mView.findViewById(R.id.l_user_cert).getVisibility() != View.GONE
|
||||
&& mEapUserCertSpinner.getSelectedItem().equals(mUnspecifiedCertString)) {
|
||||
@@ -651,10 +653,13 @@ public class WifiConfigController implements TextWatcher,
|
||||
break;
|
||||
|
||||
case AccessPoint.SECURITY_EAP:
|
||||
case AccessPoint.SECURITY_EAP_WPA3_ENTERPRISE:
|
||||
case AccessPoint.SECURITY_EAP_SUITE_B:
|
||||
if (mAccessPointSecurity == AccessPoint.SECURITY_EAP_SUITE_B) {
|
||||
// allowedSuiteBCiphers will be set according to certificate type
|
||||
config.setSecurityParams(WifiConfiguration.SECURITY_TYPE_EAP_SUITE_B);
|
||||
} else if (mAccessPointSecurity == AccessPoint.SECURITY_EAP_WPA3_ENTERPRISE) {
|
||||
config.setSecurityParams(WifiConfiguration.SECURITY_TYPE_EAP_WPA3_ENTERPRISE);
|
||||
} else {
|
||||
config.setSecurityParams(WifiConfiguration.SECURITY_TYPE_EAP);
|
||||
}
|
||||
@@ -1693,9 +1698,14 @@ public class WifiConfigController implements TextWatcher,
|
||||
if (mWifiManager.isWpa3SaeSupported()) {
|
||||
spinnerAdapter.add(mContext.getString(R.string.wifi_security_sae));
|
||||
mSecurityInPosition[idx++] = AccessPoint.SECURITY_SAE;
|
||||
spinnerAdapter.add(mContext.getString(R.string.wifi_security_eap_wpa_wpa2));
|
||||
mSecurityInPosition[idx++] = AccessPoint.SECURITY_EAP;
|
||||
spinnerAdapter.add(mContext.getString(R.string.wifi_security_eap_wpa3));
|
||||
mSecurityInPosition[idx++] = AccessPoint.SECURITY_EAP_WPA3_ENTERPRISE;
|
||||
} else {
|
||||
spinnerAdapter.add(mContext.getString(R.string.wifi_security_eap));
|
||||
mSecurityInPosition[idx++] = AccessPoint.SECURITY_EAP;
|
||||
}
|
||||
spinnerAdapter.add(mContext.getString(R.string.wifi_security_eap));
|
||||
mSecurityInPosition[idx++] = AccessPoint.SECURITY_EAP;
|
||||
if (mWifiManager.isWpa3SuiteBSupported()) {
|
||||
spinnerAdapter.add(mContext.getString(R.string.wifi_security_eap_suiteb));
|
||||
mSecurityInPosition[idx++] = AccessPoint.SECURITY_EAP_SUITE_B;
|
||||
|
||||
@@ -500,6 +500,7 @@ public class WifiConfigController2 implements TextWatcher,
|
||||
enabled = ipAndProxyFieldsAreValid();
|
||||
}
|
||||
if ((mWifiEntrySecurity == WifiEntry.SECURITY_EAP
|
||||
|| mWifiEntrySecurity == WifiEntry.SECURITY_EAP_WPA3_ENTERPRISE
|
||||
|| mWifiEntrySecurity == WifiEntry.SECURITY_EAP_SUITE_B)
|
||||
&& mEapCaCertSpinner != null
|
||||
&& mView.findViewById(R.id.l_ca_cert).getVisibility() != View.GONE) {
|
||||
@@ -517,6 +518,7 @@ public class WifiConfigController2 implements TextWatcher,
|
||||
}
|
||||
}
|
||||
if ((mWifiEntrySecurity == WifiEntry.SECURITY_EAP
|
||||
|| mWifiEntrySecurity == WifiEntry.SECURITY_EAP_WPA3_ENTERPRISE
|
||||
|| mWifiEntrySecurity == WifiEntry.SECURITY_EAP_SUITE_B)
|
||||
&& mEapUserCertSpinner != null
|
||||
&& mView.findViewById(R.id.l_user_cert).getVisibility() != View.GONE
|
||||
@@ -615,10 +617,13 @@ public class WifiConfigController2 implements TextWatcher,
|
||||
break;
|
||||
|
||||
case WifiEntry.SECURITY_EAP:
|
||||
case WifiEntry.SECURITY_EAP_WPA3_ENTERPRISE:
|
||||
case WifiEntry.SECURITY_EAP_SUITE_B:
|
||||
if (mWifiEntrySecurity == WifiEntry.SECURITY_EAP_SUITE_B) {
|
||||
// allowedSuiteBCiphers will be set according to certificate type
|
||||
config.setSecurityParams(WifiConfiguration.SECURITY_TYPE_EAP_SUITE_B);
|
||||
} else if (mWifiEntrySecurity == WifiEntry.SECURITY_EAP_WPA3_ENTERPRISE) {
|
||||
config.setSecurityParams(WifiConfiguration.SECURITY_TYPE_EAP_WPA3_ENTERPRISE);
|
||||
} else {
|
||||
config.setSecurityParams(WifiConfiguration.SECURITY_TYPE_EAP);
|
||||
}
|
||||
@@ -942,6 +947,7 @@ public class WifiConfigController2 implements TextWatcher,
|
||||
}
|
||||
|
||||
if (mWifiEntrySecurity != WifiEntry.SECURITY_EAP
|
||||
&& mWifiEntrySecurity != WifiEntry.SECURITY_EAP_WPA3_ENTERPRISE
|
||||
&& mWifiEntrySecurity != WifiEntry.SECURITY_EAP_SUITE_B) {
|
||||
mView.findViewById(R.id.eap).setVisibility(View.GONE);
|
||||
return;
|
||||
@@ -1660,9 +1666,14 @@ public class WifiConfigController2 implements TextWatcher,
|
||||
if (mWifiManager.isWpa3SaeSupported()) {
|
||||
spinnerAdapter.add(mContext.getString(R.string.wifi_security_sae));
|
||||
mSecurityInPosition[idx++] = WifiEntry.SECURITY_SAE;
|
||||
spinnerAdapter.add(mContext.getString(R.string.wifi_security_eap_wpa_wpa2));
|
||||
mSecurityInPosition[idx++] = WifiEntry.SECURITY_EAP;
|
||||
spinnerAdapter.add(mContext.getString(R.string.wifi_security_eap_wpa3));
|
||||
mSecurityInPosition[idx++] = WifiEntry.SECURITY_EAP_WPA3_ENTERPRISE;
|
||||
} else {
|
||||
spinnerAdapter.add(mContext.getString(R.string.wifi_security_eap));
|
||||
mSecurityInPosition[idx++] = WifiEntry.SECURITY_EAP;
|
||||
}
|
||||
spinnerAdapter.add(mContext.getString(R.string.wifi_security_eap));
|
||||
mSecurityInPosition[idx++] = WifiEntry.SECURITY_EAP;
|
||||
if (mWifiManager.isWpa3SuiteBSupported()) {
|
||||
spinnerAdapter.add(mContext.getString(R.string.wifi_security_eap_suiteb));
|
||||
mSecurityInPosition[idx++] = WifiEntry.SECURITY_EAP_SUITE_B;
|
||||
|
||||
@@ -224,6 +224,32 @@ public class UsbDefaultFragmentTest {
|
||||
assertThat(mFragment.mCurrentFunctions).isEqualTo(UsbManager.FUNCTION_MIDI);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void usbIsPluginAndUsbTetheringIsOn_startTetheringIsInvoked() {
|
||||
when(mUsbBackend.getDefaultUsbFunctions()).thenReturn(UsbManager.FUNCTION_RNDIS);
|
||||
|
||||
mFragment.mUsbConnectionListener.onUsbConnectionChanged(false /* connected */,
|
||||
UsbManager.FUNCTION_RNDIS, POWER_ROLE_SINK, DATA_ROLE_DEVICE);
|
||||
mFragment.mUsbConnectionListener.onUsbConnectionChanged(true /* connected */,
|
||||
UsbManager.FUNCTION_RNDIS, POWER_ROLE_SINK, DATA_ROLE_DEVICE);
|
||||
|
||||
verify(mTetheringManager).startTethering(eq(TetheringManager.TETHERING_USB),
|
||||
any(),
|
||||
eq(mFragment.mOnStartTetheringCallback));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void usbIsNotPluginAndUsbTetheringIsOn_startTetheringIsNotInvoked() {
|
||||
when(mUsbBackend.getDefaultUsbFunctions()).thenReturn(UsbManager.FUNCTION_RNDIS);
|
||||
|
||||
mFragment.mUsbConnectionListener.onUsbConnectionChanged(false /* connected */,
|
||||
UsbManager.FUNCTION_RNDIS, POWER_ROLE_SINK, DATA_ROLE_DEVICE);
|
||||
|
||||
verify(mTetheringManager, never()).startTethering(eq(TetheringManager.TETHERING_USB),
|
||||
any(),
|
||||
eq(mFragment.mOnStartTetheringCallback));
|
||||
}
|
||||
|
||||
public static class TestFragment extends UsbDefaultFragment {
|
||||
public final PreferenceScreen mScreen;
|
||||
|
||||
|
||||
@@ -17,20 +17,15 @@ package com.android.settings.fuelgauge;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.PowerManager;
|
||||
import android.view.LayoutInflater;
|
||||
import android.widget.LinearLayout;
|
||||
import android.provider.Settings;
|
||||
|
||||
import androidx.preference.PreferenceViewHolder;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.widget.PrimarySwitchPreference;
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
@@ -39,108 +34,84 @@ import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
import org.robolectric.util.ReflectionHelpers;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class BatterySaverControllerTest {
|
||||
|
||||
@Mock
|
||||
private Preference mBatterySaverPref;
|
||||
@Mock
|
||||
private PowerManager mPowerManager;
|
||||
|
||||
private BatterySaverController mBatterySaverController;
|
||||
private PrimarySwitchPreference mBatterySaverPref;
|
||||
private Context mContext;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
final Context mContext = spy(RuntimeEnvironment.application);
|
||||
|
||||
mBatterySaverPref = new PrimarySwitchPreference(mContext);
|
||||
final LayoutInflater inflater = LayoutInflater.from(mContext);
|
||||
final PreferenceViewHolder mHolder =
|
||||
PreferenceViewHolder.createInstanceForTests(inflater.inflate(
|
||||
com.android.settingslib.R.layout.preference_two_target, null));
|
||||
final LinearLayout mWidgetView = mHolder.itemView.findViewById(android.R.id.widget_frame);
|
||||
inflater.inflate(R.layout.restricted_preference_widget_primary_switch, mWidgetView, true);
|
||||
mBatterySaverPref.onBindViewHolder(mHolder);
|
||||
mContext = RuntimeEnvironment.application;
|
||||
mBatterySaverController = spy(new BatterySaverController(mContext));
|
||||
ReflectionHelpers.setField(mBatterySaverController, "mPowerManager", mPowerManager);
|
||||
ReflectionHelpers.setField(mBatterySaverController, "mBatterySaverPref", mBatterySaverPref);
|
||||
|
||||
doReturn(mPowerManager).when(mContext).getSystemService(Context.POWER_SERVICE);
|
||||
|
||||
mBatterySaverController = new BatterySaverController(mContext);
|
||||
mBatterySaverController.mBatterySaverPref = mBatterySaverPref;
|
||||
Settings.Global.putInt(mContext.getContentResolver(),
|
||||
Settings.Global.LOW_POWER_MODE_TRIGGER_LEVEL, 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onBatteryChanged_true_switchEnabled() {
|
||||
mBatterySaverController.onBatteryChanged(true);
|
||||
|
||||
assertThat(mBatterySaverPref.getSwitch().isEnabled()).isFalse();
|
||||
public void onPreferenceChange_onStart() {
|
||||
mBatterySaverController.onStart();
|
||||
verify(mBatterySaverPref).setSummary("Off");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onBatteryChanged_false_switchDisabled() {
|
||||
mBatterySaverController.onBatteryChanged(false);
|
||||
|
||||
assertThat(mBatterySaverPref.getSwitch().isEnabled()).isTrue();
|
||||
public void onPreferenceChange_onPowerSaveModeChanged() {
|
||||
mBatterySaverController.onPowerSaveModeChanged();
|
||||
verify(mBatterySaverPref).setSummary("Off");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onPowerSaveModeChanged_differentState_updateToIsChecked() {
|
||||
public void getSummary_batterySaverOn_showSummaryOn() {
|
||||
when(mPowerManager.isPowerSaveMode()).thenReturn(true);
|
||||
|
||||
assertThat(mBatterySaverPref.isChecked()).isFalse();
|
||||
|
||||
mBatterySaverController.onPowerSaveModeChanged();
|
||||
|
||||
assertThat(mBatterySaverPref.isChecked()).isTrue();
|
||||
assertThat(mBatterySaverController.getSummary()).isEqualTo("On");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onPowerSaveModeChanged_differentState_updateToUnChecked() {
|
||||
mBatterySaverPref.setChecked(true);
|
||||
|
||||
public void getSummary_batterySaverOffButScheduled_showSummaryScheduled() {
|
||||
when(mPowerManager.isPowerSaveMode()).thenReturn(false);
|
||||
assertThat(mBatterySaverPref.isChecked()).isTrue();
|
||||
Settings.Global.putInt(mContext.getContentResolver(),
|
||||
Settings.Global.LOW_POWER_MODE_TRIGGER_LEVEL, 15);
|
||||
|
||||
mBatterySaverController.onPowerSaveModeChanged();
|
||||
|
||||
assertThat(mBatterySaverPref.isChecked()).isFalse();
|
||||
assertThat(mBatterySaverController.getSummary()).isEqualTo("Will turn on at 15%");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onPowerSaveModeChanged_sameState_noUpdate() {
|
||||
public void getSummary_batterySaverOffButScheduledZeroPercent_showSummaryOff() {
|
||||
when(mPowerManager.isPowerSaveMode()).thenReturn(false);
|
||||
assertThat(mBatterySaverPref.isChecked()).isFalse();
|
||||
Settings.Global.putInt(mContext.getContentResolver(),
|
||||
Settings.Global.LOW_POWER_MODE_TRIGGER_LEVEL, 0);
|
||||
|
||||
mBatterySaverController.onPowerSaveModeChanged();
|
||||
|
||||
assertThat(mBatterySaverPref.isChecked()).isFalse();
|
||||
assertThat(mBatterySaverController.getSummary()).isEqualTo("Off");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setChecked_on_setPowerSaveMode() {
|
||||
mBatterySaverController.setChecked(true);
|
||||
public void getSummary_batterySaverOffButScheduledBasedOnRoutine_showSummaryBasedOnRoutine() {
|
||||
when(mPowerManager.isPowerSaveMode()).thenReturn(false);
|
||||
Settings.Global.putInt(
|
||||
mContext.getContentResolver(),
|
||||
Settings.Global.AUTOMATIC_POWER_SAVE_MODE,
|
||||
PowerManager.POWER_SAVE_MODE_TRIGGER_DYNAMIC);
|
||||
|
||||
verify(mPowerManager).setPowerSaveModeEnabled(true);
|
||||
assertThat(mBatterySaverController.getSummary()).isEqualTo("Based on your routine");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setChecked_off_unsetPowerSaveMode() {
|
||||
mBatterySaverController.setChecked(false);
|
||||
|
||||
verify(mPowerManager).setPowerSaveModeEnabled(false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isChecked_on_powerSaveModeOn() {
|
||||
when(mPowerManager.isPowerSaveMode()).thenReturn(true);
|
||||
|
||||
assertThat(mBatterySaverController.isChecked()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isChecked_off_powerSaveModeOff() {
|
||||
public void getSummary_batterySaverOff_showSummaryOff() {
|
||||
when(mPowerManager.isPowerSaveMode()).thenReturn(false);
|
||||
|
||||
assertThat(mBatterySaverController.isChecked()).isFalse();
|
||||
assertThat(mBatterySaverController.getSummary()).isEqualTo("Off");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,24 +26,50 @@ import static org.mockito.Mockito.when;
|
||||
|
||||
import android.app.role.RoleManager;
|
||||
import android.app.usage.UsageEvents;
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
import android.companion.ICompanionDeviceManager;
|
||||
import android.content.ComponentName;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Parcel;
|
||||
|
||||
import com.android.settings.notification.NotificationBackend.AppRow;
|
||||
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
|
||||
import com.android.settingslib.bluetooth.CachedBluetoothDeviceManager;
|
||||
import com.android.settingslib.bluetooth.LocalBluetoothManager;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class NotificationBackendTest {
|
||||
|
||||
@Mock
|
||||
LocalBluetoothManager mBm;
|
||||
@Mock
|
||||
ICompanionDeviceManager mCdm;
|
||||
@Mock
|
||||
CachedBluetoothDeviceManager mCbm;
|
||||
ComponentName mCn = new ComponentName("a", "b");
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
when(mBm.getCachedDeviceManager()).thenReturn(mCbm);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMarkAppRow_unblockablePackage() {
|
||||
AppRow appRow = new AppRow();
|
||||
@@ -138,4 +164,69 @@ public class NotificationBackendTest {
|
||||
parcel.setDataPosition(0);
|
||||
return UsageEvents.CREATOR.createFromParcel(parcel);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getDeviceList_noAssociations() throws Exception {
|
||||
when(mCdm.getAssociations(mCn.getPackageName(), 0)).thenReturn(null);
|
||||
|
||||
Collection<CachedBluetoothDevice> cachedDevices = new ArrayList<>();
|
||||
CachedBluetoothDevice cbd1 = mock(CachedBluetoothDevice.class);
|
||||
when(cbd1.getAddress()).thenReturn("00:00:00:00:00:10");
|
||||
when(cbd1.getName()).thenReturn("Device 1");
|
||||
cachedDevices.add(cbd1);
|
||||
when(mCbm.getCachedDevicesCopy()).thenReturn(cachedDevices);
|
||||
|
||||
BluetoothAdapter.getDefaultAdapter().enable();
|
||||
|
||||
assertThat(new NotificationBackend().getDeviceList(
|
||||
mCdm, mBm, mCn.getPackageName(), 0).toString()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getDeviceList_associationsButNoDevice() throws Exception {
|
||||
List<String> macs = ImmutableList.of("00:00:00:00:00:10", "00:00:00:00:00:20");
|
||||
when(mCdm.getAssociations(mCn.getPackageName(), 0)).thenReturn(macs);
|
||||
|
||||
when(mCbm.getCachedDevicesCopy()).thenReturn(new ArrayList<>());
|
||||
|
||||
assertThat(new NotificationBackend().getDeviceList(
|
||||
mCdm, mBm, mCn.getPackageName(), 0).toString()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getDeviceList_singleDevice() throws Exception {
|
||||
List<String> macs = ImmutableList.of("00:00:00:00:00:10", "00:00:00:00:00:20");
|
||||
when(mCdm.getAssociations(mCn.getPackageName(), 0)).thenReturn(macs);
|
||||
|
||||
Collection<CachedBluetoothDevice> cachedDevices = new ArrayList<>();
|
||||
CachedBluetoothDevice cbd1 = mock(CachedBluetoothDevice.class);
|
||||
when(cbd1.getAddress()).thenReturn(macs.get(0));
|
||||
when(cbd1.getName()).thenReturn("Device 1");
|
||||
cachedDevices.add(cbd1);
|
||||
when(mCbm.getCachedDevicesCopy()).thenReturn(cachedDevices);
|
||||
|
||||
assertThat(new NotificationBackend().getDeviceList(
|
||||
mCdm, mBm, mCn.getPackageName(), 0).toString()).isEqualTo("Device 1");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getDeviceList_multipleDevices() throws Exception {
|
||||
List<String> macs = ImmutableList.of("00:00:00:00:00:10", "00:00:00:00:00:20");
|
||||
when(mCdm.getAssociations(mCn.getPackageName(), 0)).thenReturn(macs);
|
||||
|
||||
Collection<CachedBluetoothDevice> cachedDevices = new ArrayList<>();
|
||||
CachedBluetoothDevice cbd1 = mock(CachedBluetoothDevice.class);
|
||||
when(cbd1.getAddress()).thenReturn(macs.get(0));
|
||||
when(cbd1.getName()).thenReturn("Device 1");
|
||||
cachedDevices.add(cbd1);
|
||||
|
||||
CachedBluetoothDevice cbd2 = mock(CachedBluetoothDevice.class);
|
||||
when(cbd2.getAddress()).thenReturn(macs.get(1));
|
||||
when(cbd2.getName()).thenReturn("Device 2");
|
||||
cachedDevices.add(cbd2);
|
||||
when(mCbm.getCachedDevicesCopy()).thenReturn(cachedDevices);
|
||||
|
||||
assertThat(new NotificationBackend().getDeviceList(
|
||||
mCdm, mBm, mCn.getPackageName(), 0).toString()).isEqualTo("Device 1, Device 2");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,8 +25,8 @@ import static org.mockito.Mockito.when;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.HandlerExecutor;
|
||||
import android.telephony.PhoneStateListener;
|
||||
import android.telephony.RadioAccessFamily;
|
||||
import android.telephony.TelephonyCallback;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.test.mock.MockContentResolver;
|
||||
|
||||
@@ -53,7 +53,7 @@ public class AllowedNetworkTypesListenerTest {
|
||||
private AllowedNetworkTypesListener mAllowedNetworkTypesListener;
|
||||
|
||||
@Mock
|
||||
private AllowedNetworkTypesListener.OnAllowedNetworkTypesChangedListener mListener;
|
||||
private AllowedNetworkTypesListener.OnAllowedNetworkTypesListener mListener;
|
||||
@Mock
|
||||
private TelephonyManager mTelephonyManager;
|
||||
|
||||
@@ -87,15 +87,15 @@ public class AllowedNetworkTypesListenerTest {
|
||||
public void register_shouldRegisterContentObserver() {
|
||||
mAllowedNetworkTypesListener.register(mContext, SUB_ID);
|
||||
|
||||
verify(mTelephonyManager, times(1)).registerPhoneStateListener(any(HandlerExecutor.class),
|
||||
any(PhoneStateListener.class));
|
||||
verify(mTelephonyManager, times(1)).registerTelephonyCallback(any(HandlerExecutor.class),
|
||||
any(TelephonyCallback.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void unregister_shouldUnregisterContentObserver() {
|
||||
mAllowedNetworkTypesListener.unregister(mContext, SUB_ID);
|
||||
|
||||
verify(mTelephonyManager).unregisterPhoneStateListener(
|
||||
verify(mTelephonyManager).unregisterTelephonyCallback(
|
||||
mAllowedNetworkTypesListener);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -264,7 +264,7 @@ public class ProviderModelSliceTest {
|
||||
|
||||
@Test
|
||||
@UiThreadTest
|
||||
public void getSlice_connectedEthernet_getOneEthernetAndOneCarrierAndTwoWiFi() {
|
||||
public void getSlice_haveEthernetAndCarrierAndTwoDisconnectedWifi_getFourRow() {
|
||||
mWifiList.clear();
|
||||
mockWifiItemCondition(mMockWifiSliceItem1, "wifi1", "wifi1",
|
||||
WifiEntry.CONNECTED_STATE_DISCONNECTED, "wifi1_key", true);
|
||||
@@ -273,9 +273,29 @@ public class ProviderModelSliceTest {
|
||||
WifiEntry.CONNECTED_STATE_DISCONNECTED, "wifi2_key", true);
|
||||
mWifiList.add(mMockWifiSliceItem2);
|
||||
mMockNetworkProviderWorker.updateSelfResults(mWifiList);
|
||||
when(mProviderModelSliceHelper.isAirplaneModeEnabled()).thenReturn(false);
|
||||
when(mProviderModelSliceHelper.hasCarrier()).thenReturn(true);
|
||||
when(mProviderModelSliceHelper.isDataSimActive()).thenReturn(true);
|
||||
mockHelperCondition(false, true, true, null);
|
||||
when(mMockNetworkProviderWorker.isEthernetConnected()).thenReturn(true);
|
||||
|
||||
final Slice slice = mMockProviderModelSlice.getSlice();
|
||||
|
||||
assertThat(slice).isNotNull();
|
||||
assertThat(mMockProviderModelSlice.hasCreateEthernetRow()).isTrue();
|
||||
verify(mListBuilder, times(1)).addRow(mMockCarrierRowBuild);
|
||||
verify(mListBuilder, times(4)).addRow(any(ListBuilder.RowBuilder.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThreadTest
|
||||
public void getSlice_haveEthernetAndCarrierAndConnectedWifiAndDisconnectedWifi_getFourRow() {
|
||||
mWifiList.clear();
|
||||
mockWifiItemCondition(mMockWifiSliceItem1, "wifi1", "wifi1",
|
||||
WifiEntry.CONNECTED_STATE_CONNECTED, "wifi1_key", true);
|
||||
mWifiList.add(mMockWifiSliceItem1);
|
||||
mockWifiItemCondition(mMockWifiSliceItem2, "wifi2", "wifi2",
|
||||
WifiEntry.CONNECTED_STATE_DISCONNECTED, "wifi2_key", true);
|
||||
mWifiList.add(mMockWifiSliceItem2);
|
||||
mMockNetworkProviderWorker.updateSelfResults(mWifiList);
|
||||
mockHelperCondition(false, true, true, mWifiList.get(0));
|
||||
when(mMockNetworkProviderWorker.isEthernetConnected()).thenReturn(true);
|
||||
|
||||
final Slice slice = mMockProviderModelSlice.getSlice();
|
||||
|
||||
@@ -97,6 +97,7 @@ public class SubscriptionsPreferenceControllerTest {
|
||||
private LifecycleOwner mLifecycleOwner;
|
||||
@Mock
|
||||
private WifiPickerTrackerHelper mWifiPickerTrackerHelper;
|
||||
|
||||
private LifecycleRegistry mLifecycleRegistry;
|
||||
private int mOnChildUpdatedCount;
|
||||
private Context mContext;
|
||||
@@ -428,7 +429,6 @@ public class SubscriptionsPreferenceControllerTest {
|
||||
doReturn(mock(MobileMappings.Config.class)).when(sInjector).getConfig(mContext);
|
||||
doReturn(networkType)
|
||||
.when(sInjector).getNetworkType(any(), any(), any(), anyInt());
|
||||
when(mTelephonyManager.isDataEnabled()).thenReturn(true);
|
||||
|
||||
mController.onResume();
|
||||
mController.displayPreference(mPreferenceScreen);
|
||||
@@ -447,7 +447,7 @@ public class SubscriptionsPreferenceControllerTest {
|
||||
final List<SubscriptionInfo> sub = setupMockSubscriptions(2);
|
||||
doReturn(true).when(sInjector).isProviderModelEnabled(mContext);
|
||||
doReturn(sub.get(0)).when(mSubscriptionManager).getDefaultDataSubscriptionInfo();
|
||||
setupGetIconConditions(sub.get(0).getSubscriptionId(), false, true,
|
||||
setupGetIconConditions(sub.get(0).getSubscriptionId(), false, false,
|
||||
TelephonyManager.DATA_CONNECTED, ServiceState.STATE_IN_SERVICE);
|
||||
doReturn(networkType)
|
||||
.when(sInjector).getNetworkType(any(), any(), any(), anyInt());
|
||||
@@ -534,7 +534,6 @@ public class SubscriptionsPreferenceControllerTest {
|
||||
doReturn(mock(MobileMappings.Config.class)).when(sInjector).getConfig(mContext);
|
||||
doReturn(networkType)
|
||||
.when(sInjector).getNetworkType(any(), any(), any(), anyInt());
|
||||
when(mTelephonyManager.isDataEnabled()).thenReturn(true);
|
||||
|
||||
mController.onResume();
|
||||
mController.displayPreference(mPreferenceScreen);
|
||||
|
||||
@@ -207,22 +207,22 @@ public class NetworkProviderWorkerTest {
|
||||
|
||||
@Test
|
||||
@UiThreadTest
|
||||
public void onServiceStateChanged_notifyPhoneStateListener_callUpdateSlice() {
|
||||
public void onServiceStateChanged_notifyTelephonyCallback_callUpdateSlice() {
|
||||
mMockNetworkProviderWorker.onSlicePinned();
|
||||
mMockNetworkProviderWorker.receiveNotification(false);
|
||||
|
||||
mMockNetworkProviderWorker.mPhoneStateListener.onServiceStateChanged(new ServiceState());
|
||||
mMockNetworkProviderWorker.mTelephonyCallback.onServiceStateChanged(new ServiceState());
|
||||
|
||||
assertThat(mMockNetworkProviderWorker.hasNotification()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThreadTest
|
||||
public void onDisplayInfoChanged_notifyPhoneStateListener_callUpdateSlice() {
|
||||
public void onDisplayInfoChanged_notifyTelephonyCallback_callUpdateSlice() {
|
||||
mMockNetworkProviderWorker.onSlicePinned();
|
||||
mMockNetworkProviderWorker.receiveNotification(false);
|
||||
|
||||
mMockNetworkProviderWorker.mPhoneStateListener.onDisplayInfoChanged(
|
||||
mMockNetworkProviderWorker.mTelephonyCallback.onDisplayInfoChanged(
|
||||
new TelephonyDisplayInfo(14, 0));
|
||||
|
||||
assertThat(mMockNetworkProviderWorker.hasNotification()).isTrue();
|
||||
@@ -230,11 +230,11 @@ public class NetworkProviderWorkerTest {
|
||||
|
||||
@Test
|
||||
@UiThreadTest
|
||||
public void onDataConnectionStateChanged_notifyPhoneStateListener_callUpdateSlice() {
|
||||
public void onDataConnectionStateChanged_notifyTelephonyCallback_callUpdateSlice() {
|
||||
mMockNetworkProviderWorker.onSlicePinned();
|
||||
mMockNetworkProviderWorker.receiveNotification(false);
|
||||
|
||||
mMockNetworkProviderWorker.mPhoneStateListener.onDataConnectionStateChanged(
|
||||
mMockNetworkProviderWorker.mTelephonyCallback.onDataConnectionStateChanged(
|
||||
TelephonyManager.DATA_DISCONNECTED, TelephonyManager.NETWORK_TYPE_LTE);
|
||||
|
||||
assertThat(mMockNetworkProviderWorker.hasNotification()).isTrue();
|
||||
|
||||
Reference in New Issue
Block a user