Snap for 7472272 from b41e6f1891 to sc-v2-release
Change-Id: I0fe3c5214ca9982fc460c31465a826fb267f8325
This commit is contained in:
@@ -1803,6 +1803,10 @@
|
||||
android:theme="@style/GlifV3Theme.Light"
|
||||
android:exported="false"/>
|
||||
|
||||
<activity android:name=".biometrics.face.FaceEnrollParentalConsent"
|
||||
android:exported="false"
|
||||
android:screenOrientation="portrait"/>
|
||||
|
||||
<activity android:name=".biometrics.face.FaceEnrollIntroduction"
|
||||
android:exported="false"
|
||||
android:screenOrientation="portrait"/>
|
||||
@@ -1837,6 +1841,7 @@
|
||||
<activity android:name=".biometrics.fingerprint.FingerprintEnrollFindSensor" android:exported="false"/>
|
||||
<activity android:name=".biometrics.fingerprint.FingerprintEnrollEnrolling" android:exported="false"/>
|
||||
<activity android:name=".biometrics.fingerprint.FingerprintEnrollFinish" android:exported="false"/>
|
||||
<activity android:name=".biometrics.fingerprint.FingerprintEnrollParentalConsent" android:exported="false"/>
|
||||
<activity android:name=".biometrics.fingerprint.FingerprintEnrollIntroduction"
|
||||
android:exported="true"
|
||||
android:theme="@style/GlifTheme.Light">
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 28 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 123 KiB |
@@ -1,45 +0,0 @@
|
||||
<!--
|
||||
~ Copyright (C) 2019 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>
|
||||
@@ -30,7 +30,9 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:layout_marginStart="?attr/sudMarginStart"
|
||||
android:layout_marginEnd="?attr/sudMarginEnd">
|
||||
|
||||
<com.google.android.setupdesign.view.RichTextView
|
||||
android:id="@+id/error_text"
|
||||
@@ -60,6 +62,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!-- Keep in mind -->
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -78,19 +81,15 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/ic_face_enroll_introduction_glasses"/>
|
||||
|
||||
<Space
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/info_message_glasses"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/security_settings_face_enroll_introduction_info_glasses"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="16sp"
|
||||
android:lineSpacingExtra="4sp"/>
|
||||
|
||||
android:textSize="16sp"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@@ -104,56 +103,28 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/ic_face_enroll_introduction_visibility"/>
|
||||
|
||||
<Space
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/info_message_looking"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/security_settings_face_enroll_introduction_info_looking"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="16sp"
|
||||
android:lineSpacingExtra="4sp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="24dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon_security"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/ic_face_enroll_introduction_shield"/>
|
||||
|
||||
<Space
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/security_settings_face_enroll_introduction_info_security"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="16sp"
|
||||
android:lineSpacingExtra="4sp"/>
|
||||
|
||||
android:textSize="16sp"/>
|
||||
</LinearLayout>
|
||||
|
||||
<Space
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"/>
|
||||
|
||||
<!-- How it works -->
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/security_settings_face_enroll_introduction_how_title"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textSize="20sp"/>
|
||||
|
||||
<Space
|
||||
@@ -161,21 +132,21 @@
|
||||
android:layout_height="24dp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/how_message"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/security_settings_face_enroll_introduction_how_message"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="14sp"
|
||||
android:lineSpacingExtra="2sp"/>
|
||||
android:textSize="16sp"/>
|
||||
|
||||
<Space
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="24dp"/>
|
||||
|
||||
<!-- You're in control -->
|
||||
<TextView
|
||||
android:id="@+id/title_in_control"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/security_settings_face_enroll_introduction_control_title"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="20sp"/>
|
||||
|
||||
@@ -184,12 +155,11 @@
|
||||
android:layout_height="24dp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/message_in_control"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/security_settings_face_enroll_introduction_control_message"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="14sp"
|
||||
android:lineSpacingExtra="2sp"/>
|
||||
android:textSize="16sp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
@@ -30,7 +30,9 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:layout_marginStart="?attr/sudMarginStart"
|
||||
android:layout_marginEnd="?attr/sudMarginEnd">
|
||||
|
||||
<com.google.android.setupdesign.view.RichTextView
|
||||
android:id="@+id/error_text"
|
||||
@@ -52,26 +54,25 @@
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<!-- Contains the extra information text at the bottom -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!-- How it works -->
|
||||
<com.google.android.setupdesign.view.RichTextView
|
||||
style="@style/SudDescription.Glif"
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAlignment="viewStart"
|
||||
android:paddingTop="12dp"
|
||||
android:text="@string/security_settings_fingerprint_v2_enroll_introduction_footer_title_2"
|
||||
android:textColor="?android:attr/textColorPrimary"/>
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="20sp"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="12dp">
|
||||
android:paddingTop="24dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon_fingerprint"
|
||||
@@ -80,125 +81,135 @@
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/ic_fingerprint_24dp"/>
|
||||
<Space
|
||||
android:layout_width="24dp"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="wrap_content"/>
|
||||
<TextView
|
||||
android:id="@+id/footer_message_2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/security_settings_fingerprint_v2_enroll_introduction_footer_message_2"
|
||||
android:textColor="?android:attr/textColorPrimary"/>
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="16sp"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="12dp">
|
||||
android:paddingTop="24dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon_locked"
|
||||
android:id="@+id/icon_fingerprint"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/ic_device_locked_24dp"/>
|
||||
<Space
|
||||
android:layout_width="24dp"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="wrap_content"/>
|
||||
<TextView
|
||||
android:id="@+id/footer_message_3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/security_settings_fingerprint_v2_enroll_introduction_footer_message_3"
|
||||
android:textColor="?android:attr/textColorPrimary"/>
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="16sp"/>
|
||||
</LinearLayout>
|
||||
|
||||
<Space
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="24dp"/>
|
||||
|
||||
<!-- You're in control -->
|
||||
<com.google.android.setupdesign.view.RichTextView
|
||||
style="@style/SudDescription.Glif"
|
||||
<TextView
|
||||
android:id="@+id/footer_title_1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAlignment="viewStart"
|
||||
android:paddingTop="12dp"
|
||||
android:text="@string/security_settings_fingerprint_enroll_introduction_footer_title_1"
|
||||
android:textColor="?android:attr/textColorPrimary"/>
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="20sp"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="12dp">
|
||||
android:paddingTop="24dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon_delete"
|
||||
android:id="@+id/icon_fingerprint"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/ic_trash_can"/>
|
||||
<Space
|
||||
android:layout_width="24dp"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="wrap_content"/>
|
||||
<TextView
|
||||
android:id="@+id/footer_message_4"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="16sp"/>
|
||||
</LinearLayout>
|
||||
|
||||
<Space
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="24dp"/>
|
||||
|
||||
<!-- Keep in mind -->
|
||||
<TextView
|
||||
android:id="@+id/footer_title_2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/security_settings_face_enroll_introduction_info_title"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="20sp"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="24dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon_info"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/ic_info_outline_24dp"/>
|
||||
<Space
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="wrap_content"/>
|
||||
<TextView
|
||||
android:id="@+id/footer_message_5"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="16sp"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="24dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon_link"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/ic_link_24dp"/>
|
||||
<Space
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="wrap_content"/>
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/security_settings_fingerprint_v2_enroll_introduction_footer_message_4"
|
||||
android:textColor="?android:attr/textColorPrimary"/>
|
||||
android:text="@string/security_settings_fingerprint_v2_enroll_introduction_message_learn_more"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="16sp"/>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Keep in mind -->
|
||||
<com.google.android.setupdesign.view.RichTextView
|
||||
style="@style/SudDescription.Glif"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAlignment="viewStart"
|
||||
android:paddingTop="12dp"
|
||||
android:text="@string/security_settings_fingerprint_enroll_introduction_footer_title_2"
|
||||
android:textColor="?android:attr/textColorPrimary"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="12dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon_info"
|
||||
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_v2_enroll_introduction_footer_message_5"
|
||||
android:textColor="?android:attr/textColorPrimary"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="12dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon_link"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/ic_link_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_v2_enroll_introduction_message_learn_more"
|
||||
android:textColor="?android:attr/textColorPrimary"/>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.google.android.setupdesign.GlifLayout>
|
||||
|
||||
Binary file not shown.
10617
res/raw/accessibility_timeout_banner.json
Normal file
10617
res/raw/accessibility_timeout_banner.json
Normal file
File diff suppressed because it is too large
Load Diff
2859
res/raw/extra_dim_banner.json
Normal file
2859
res/raw/extra_dim_banner.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -777,10 +777,14 @@
|
||||
<string name="security_settings_face_enroll_introduction_more">More</string>
|
||||
<!-- Introduction title shown in face enrollment to introduce the face unlock feature [CHAR LIMIT=40] -->
|
||||
<string name="security_settings_face_enroll_introduction_title">Unlock with your face</string>
|
||||
<!-- Introduction title shown in face enrollment when when asking for parental consent for the face unlock feature [CHAR LIMIT=40] -->
|
||||
<string name="security_settings_face_enroll_consent_introduction_title">Allow face unlock</string>
|
||||
<!-- Introduction title shown in face enrollment to introduce the face unlock feature, when face unlock is disabled by device admin [CHAR LIMIT=60] -->
|
||||
<string name="security_settings_face_enroll_introduction_title_unlock_disabled">Use your face to authenticate</string>
|
||||
<!-- Introduction detail message shown in face enrollment dialog [CHAR LIMIT=NONE]-->
|
||||
<string name="security_settings_face_enroll_introduction_message">Use your face to unlock your phone, authorize purchases, or sign in to apps.</string>
|
||||
<!-- Introduction detail message shown in face enrollment dialog when asking for parental consent [CHAR LIMIT=NONE]-->
|
||||
<string name="security_settings_face_enroll_introduction_consent_message">Allow your child to use their face to unlock their phone or verify it\u2019s them. This happens when they sign in to apps, approve a purchase, and more.</string>
|
||||
<!-- Introduction detail message shown in face enrollment dialog, when face unlock is disabled by device admin [CHAR LIMIT=NONE] -->
|
||||
<string name="security_settings_face_enroll_introduction_message_unlock_disabled">Use your face to unlock your phone or approve purchases.\n\nNote: You can\u2019t use your face to unlock this device. For more information, contact your organization\u2019s admin.</string>
|
||||
<!-- Introduction detail message shown in face enrollment screen in setup wizard. [CHAR LIMIT=NONE] -->
|
||||
@@ -789,18 +793,26 @@
|
||||
<string name="security_settings_face_enroll_introduction_info_title"></string>
|
||||
<!-- Message on the face enrollment introduction page that provides information about glasses. [CHAR LIMIT=NONE] -->
|
||||
<string name="security_settings_face_enroll_introduction_info_glasses"></string>
|
||||
<!-- Message on the face enrollment introduction page that provides information about glasses when asking for parental consent. [CHAR LIMIT=NONE] -->
|
||||
<string name="security_settings_face_enroll_introduction_info_consent_glasses"></string>
|
||||
<!-- Message on the face enrollment introduction page that provides information about what could cause the phone to unlock. [CHAR LIMIT=NONE] -->
|
||||
<string name="security_settings_face_enroll_introduction_info_looking"></string>
|
||||
<!-- Message on the face enrollment introduction page that provides information about the security of face unlock. [CHAR LIMIT=NONE] -->
|
||||
<string name="security_settings_face_enroll_introduction_info_security"></string>
|
||||
<!-- Message on the face enrollment introduction page that provides information about what could cause the phone to unlock when asking for parental consent. [CHAR LIMIT=NONE] -->
|
||||
<string name="security_settings_face_enroll_introduction_info_consent_looking"></string>
|
||||
<!-- Title of a section on the face enrollment introduction page that explains how face unlock works. [CHAR LIMIT=40] -->
|
||||
<string name="security_settings_face_enroll_introduction_how_title"></string>
|
||||
<!-- Message on the face enrollment introduction page that explains how face unlock works. [CHAR LIMIT=NONE] -->
|
||||
<string name="security_settings_face_enroll_introduction_how_message"></string>
|
||||
<!-- Message on the face enrollment introduction page that explains how Face Unlock works when asking for parental consent. [CHAR LIMIT=NONE] -->
|
||||
<string name="security_settings_face_enroll_introduction_how_consent_message"></string>
|
||||
<!-- Title of a section on the face enrollment introduction page that explains privacy controls for face unlock. [CHAR LIMIT=NONE] -->
|
||||
<string name="security_settings_face_enroll_introduction_control_title"></string>
|
||||
<!-- Title of a section on the face enrollment introduction page that explains privacy controls for face unlock when asking for parental consent. [CHAR LIMIT=NONE] -->
|
||||
<string name="security_settings_face_enroll_introduction_control_consent_title"></string>
|
||||
<!-- Message on the face enrollment introduction page that explains privacy controls for face unlock [CHAR LIMIT=NONE] -->
|
||||
<string name="security_settings_face_enroll_introduction_control_message"></string>
|
||||
<!-- Message on the face enrollment introduction page that explains privacy controls for face unlock when asking for parental consent. [CHAR LIMIT=NONE] -->
|
||||
<string name="security_settings_face_enroll_introduction_control_consent_message"></string>
|
||||
<!-- Title shown in face enrollment dialog [CHAR LIMIT=40] -->
|
||||
<string name="security_settings_face_enroll_repeat_title">Center your face in the circle</string>
|
||||
<!-- Button text to skip enrollment of face [CHAR LIMIT=40] -->
|
||||
@@ -888,15 +900,21 @@
|
||||
</plurals>
|
||||
<!-- 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] -->
|
||||
<!-- Introduction title shown in fingerprint enrollment to introduce the fingerprint feature [CHAR LIMIT=29] -->
|
||||
<string name="security_settings_fingerprint_enroll_introduction_title">Set up your fingerprint</string>
|
||||
<!-- Introduction title shown in fingerprint enrollment when asking for parental consent for fingerprint unlock [CHAR LIMIT=29] -->
|
||||
<string name="security_settings_fingerprint_enroll_consent_introduction_title">Allow fingerprint unlock</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>
|
||||
<string name="security_settings_fingerprint_enroll_introduction_message">Use your fingerprint to unlock your phone or verify it\u2019s you, like when you sign in to apps or approve a purchase.</string>
|
||||
<!-- Introduction detail message shown in fingerprint enrollment dialog when asking for parental consent [CHAR LIMIT=NONE]-->
|
||||
<string name="security_settings_fingerprint_enroll_introduction_consent_message">Allow your child to use their fingerprint to unlock their phone or verify it\u2019s them. This happens when they sign in to apps, approve a purchase, and more.</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_consent_1">You and your child are in control</string>
|
||||
<!-- Introduction title shown in the bottom of fingerprint enrollment dialog [CHAR LIMIT=NONE]-->
|
||||
<string name="security_settings_fingerprint_enroll_introduction_footer_title_2">Keep in mind</string>
|
||||
<!-- Introduction detail message shown in the bottom of fingerprint enrollment dialog [CHAR LIMIT=NONE]-->
|
||||
<string name="security_settings_fingerprint_enroll_introduction_footer_message_1">The data recorded by Fingerprint is stored securely and never leaves your phone. You can delete your data anytime in Settings.</string>
|
||||
@@ -935,13 +953,21 @@
|
||||
<!-- Introduction subtitle message shown in fingerprint enrollment introduction screen in setup wizard. [CHAR LIMIT=NONE]-->
|
||||
<string name="security_settings_fingerprint_v2_enroll_introduction_footer_title_2">How it works</string>
|
||||
<!-- Introduction description message shown in fingerprint enrollment introduction screen in setup wizard. [CHAR LIMIT=NONE]-->
|
||||
<string name="security_settings_fingerprint_v2_enroll_introduction_footer_message_2">Fingerprint Unlock creates a unique model of your fingerprint to recognize you during authentication. To create this fingerprint model during setup, you will take images of your fingerprint from different positions.</string>
|
||||
<string name="security_settings_fingerprint_v2_enroll_introduction_footer_message_2">Fingerprint Unlock creates a unique model of your fingerprint to verify it\u2019s you. To create this fingerprint model during setup, you will take images of your fingerprint from different positions.</string>
|
||||
<!-- Introduction description message shown in fingerprint enrollment introduction screen in setup wizard when asking for parental consent. [CHAR LIMIT=NONE]-->
|
||||
<string name="security_settings_fingerprint_v2_enroll_introduction_footer_message_consent_2">Fingerprint Unlock creates a unique model of your child\u2019s fingerprint to verify it\u2019s them. To create this fingerprint model during setup, they will take images of their fingerprint from different positions.</string>
|
||||
<!-- Introduction description message shown in fingerprint enrollment introduction screen in setup wizard. [CHAR LIMIT=NONE]-->
|
||||
<string name="security_settings_fingerprint_v2_enroll_introduction_footer_message_3">The phone will also use images from your interactions with Fingerprint Unlock to update your fingerprint model. Images used to create your fingerprint model are never stored, but the fingerprint model is stored securely on your phone and never leaves the phone. All processing occurs securely on your phone.</string>
|
||||
<!-- Introduction description message shown in fingerprint enrollment introduction screen in setup wizard. [CHAR LIMIT=NONE]-->
|
||||
<string name="security_settings_fingerprint_v2_enroll_introduction_footer_message_4">You can delete your fingerprint model, or turn off Fingerprint Unlock at any time in Settings. Fingerprint models are stored on the phone until you delete them.</string>
|
||||
<string name="security_settings_fingerprint_v2_enroll_introduction_footer_message_3">When you use Pixel Imprint, images are used to update your fingerprint model. Images used to create your fingerprint model are never stored, but the fingerprint model is stored securely on your phone and never leaves the phone. All processing occurs securely on your phone.</string>
|
||||
<!-- Introduction description message shown in fingerprint enrollment introduction screen in setup wizard when asking for parental consent. [CHAR LIMIT=NONE]-->
|
||||
<string name="security_settings_fingerprint_v2_enroll_introduction_footer_message_consent_3">When they use Pixel Imprint, images are used to update their fingerprint model. Images used to create your child\u2019s fingerprint model are never stored, but the fingerprint model is stored securely on the phone and never leaves the phone. All processing occurs securely on the phone.</string>
|
||||
<!-- Introduction description message shown in fingerprint enrollment introduction screen in setup wizard. [CHAR LIMIT=NONE] -->
|
||||
<string name="security_settings_fingerprint_v2_enroll_introduction_footer_message_4">You can delete your fingerprint images and model, or turn off Fingerprint Unlock at any time in Settings. Fingerprint images and models are stored on the phone until you delete them.</string>
|
||||
<!-- Introduction description message shown in fingerprint enrollment introduction screen in setup wizard when asking for parental consent. [CHAR LIMIT=NONE] -->
|
||||
<string name="security_settings_fingerprint_v2_enroll_introduction_footer_message_consent_4">You and your child can delete their fingerprint images and model, or turn off Fingerprint Unlock at any time in Settings. Fingerprint images and models are stored on the phone until they\u2019re deleted.</string>
|
||||
<!-- Introduction description message shown in fingerprint enrollment introduction screen in setup wizard. [CHAR LIMIT=NONE] -->
|
||||
<string name="security_settings_fingerprint_v2_enroll_introduction_footer_message_5">Your phone can be unlocked when you don\u2019t intend to, like if someone holds it up to your finger.</string>
|
||||
<!-- Introduction description message shown in fingerprint enrollment introduction screen in setup wizard when asking for parental consent. [CHAR LIMIT=NONE] -->
|
||||
<string name="security_settings_fingerprint_v2_enroll_introduction_footer_message_consent_5">Your child\u2019s phone can be unlocked when they don\u2019t intend to, like if someone holds it up to their finger.</string>
|
||||
<!-- Introduction detail message shown in fingerprint enrollment introduction to learn more about fingerprint [CHAR LIMIT=NONE]-->
|
||||
<string name="security_settings_fingerprint_v2_enroll_introduction_message_learn_more"></string>
|
||||
|
||||
@@ -961,7 +987,7 @@
|
||||
<string name="security_settings_fingerprint_v2_enroll_error_max_attempts">You\u2019ve reached the maximum number of attempts</string>
|
||||
|
||||
<!-- Message shown in fingerprint security settings home screen. [CHAR LIMIT=NONE]-->
|
||||
<string name="security_settings_fingerprint_v2_home_screen">Use your fingerprint to unlock your phone or for authentication, like when you sign in to apps or approve a purchase\n\n<annotation id="url">Learn more</annotation></string>
|
||||
<string name="security_settings_fingerprint_v2_home_screen">Use your fingerprint to unlock your phone or verify it\u2019s you, like when you sign in to apps or approve a purchase.\n\n<annotation id="url">Learn more</annotation></string>
|
||||
|
||||
<!-- Biometric settings --><skip />
|
||||
<!-- Title shown for menu item that launches biometric settings. [CHAR LIMIT=66] -->
|
||||
@@ -5334,10 +5360,8 @@
|
||||
<string name="accessibility_shortcut_edit_dialog_summary_software_gesture">Swipe up from the bottom of the screen with 2 fingers.\n\nTo switch between features, swipe up with 2 fingers and hold.</string>
|
||||
<!-- Summary for software shortcut in gesture mode in accessibility edit shortcut dialog while using gesture navigation and touch exploration are enabled [CHAR LIMIT=NONE] -->
|
||||
<string name="accessibility_shortcut_edit_dialog_summary_software_gesture_talkback">Swipe up from the bottom of the screen with 3 fingers.\n\nTo switch between features, swipe up with 3 fingers and hold.</string>
|
||||
<!-- Summary for software shortcut in accessibility edit shortcut dialog when user had enabled the accessibility gesture mode. [CHAR LIMIT=NONE] -->
|
||||
<string name="accessibility_shortcut_edit_dialog_customize_software_gesture"><annotation id="link">Customize accessibility gesture</annotation></string>
|
||||
<!-- Summary for software shortcut in accessibility edit shortcut dialog when user had enabled the accessibility floating button mode (Floating over other apps). [CHAR LIMIT=NONE] -->
|
||||
<string name="accessibility_shortcut_edit_dialog_summary_software_floating"><annotation id="link">Customize accessibility button</annotation></string>
|
||||
<string name="accessibility_shortcut_edit_dialog_summary_software_floating"><annotation id="link">More options</annotation></string>
|
||||
<!-- Footer to show help link content description. [CHAR LIMIT=NONE] -->
|
||||
<string name="footer_learn_more_content_description">Learn more about <xliff:g id="service" example="Select to Speak">%1$s</xliff:g></string>
|
||||
<!-- Title for hardware shortcut in accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
|
||||
@@ -5376,6 +5400,8 @@
|
||||
<string name="accessibility_button_intro">Using the accessibility button. The gesture isn\u2019t available with 3-button navigation.</string>
|
||||
<!-- Summary text for the accessibility button preference. [CHAR LIMIT=50] -->
|
||||
<string name="accessibility_button_summary">Quickly access accessibility features</string>
|
||||
<!-- Description for the accessibility button & gesture page. Explain how this page works. [CHAR LIMIT=NONE] -->
|
||||
<string name="accessibility_button_gesture_description">Quickly access accessibility features from any screen. \n\nTo get started, go to accessibility settings and select a feature. Tap on the shortcut and select the accessibility button or gesture.</string>
|
||||
<!-- Description for the accessibility button page. Explain how this page works. [CHAR LIMIT=NONE] -->
|
||||
<string name="accessibility_button_description">Quickly access accessibility features from any screen. \n\nTo get started, go to accessibility settings and select a feature. Tap on the shortcut and select the accessibility button.</string>
|
||||
<!-- Title for the button or gesture of the accessibility button. [CHAR LIMIT=35] -->
|
||||
@@ -12863,7 +12889,11 @@
|
||||
<!-- The title text of choose SIM activity. [CHAR LIMIT=NONE] -->
|
||||
<string name="choose_sim_title">Choose a number to use</string>
|
||||
<!-- The body text of choose SIM activity. [CHAR LIMIT=NONE] -->
|
||||
<string name="choose_sim_text"><xliff:g id="number" example="2">%1$d</xliff:g> numbers are available on this device, but only one can be used at a time</string>
|
||||
<string name="choose_sim_text">{count, plural,
|
||||
=1 {1 number is available on this device, but only one can be used at a time}
|
||||
=2 {2 numbers are available on this device, but only one can be used at a time}
|
||||
other {# numbers are available on this device, but only one can be used at a time}
|
||||
}</string>
|
||||
<!-- String indicating that we are activating the profile [CHAR LIMIT=NONE] -->
|
||||
<string name="choose_sim_activating">Activating<xliff:g id="ellipsis" example="...">…</xliff:g></string>
|
||||
<!-- String indicating that we failed to activate the selected profile [CHAR LIMIT=NONE] -->
|
||||
@@ -13322,6 +13352,12 @@
|
||||
<string name="non_carrier_network_unavailable">No other networks available</string>
|
||||
<!-- Provider Model: Summary indicating that no networks available [CHAR LIMIT=50] -->
|
||||
<string name="all_network_unavailable">No networks available</string>
|
||||
<!-- Title of the dialog to turn off data usage [CHAR LIMIT=NONE] -->
|
||||
<string name="mobile_data_disable_title">Turn off mobile data?</string>
|
||||
<!-- Message body of the dialog to turn off data usage [CHAR LIMIT=NONE] -->
|
||||
<string name="mobile_data_disable_message">You won\’t have access to data or the internet through <xliff:g id="carrier" example="T-Mobile">%s</xliff:g>. Internet will only be available via Wi\u2011Fi.</string>
|
||||
<!-- Text used to refer to the user's current carrier in mobile_data_disable_message if the users's mobile network carrier name is not available [CHAR LIMIT=NONE] -->
|
||||
<string name="mobile_data_disable_message_default_carrier">your carrier</string>
|
||||
|
||||
<!-- Summary for preference when Bedtime mode is on [CHAR LIMIT=NONE] -->
|
||||
<string name="aware_summary_when_bedtime_on">Unavailable because bedtime mode is on</string>
|
||||
|
||||
@@ -21,13 +21,9 @@
|
||||
android:title="@string/accessibility_control_timeout_preference_title"
|
||||
android:persistent="false" >
|
||||
|
||||
<com.android.settings.widget.VideoPreference
|
||||
android:key="accessibility_control_timeout_video"
|
||||
android:title="@string/summary_placeholder"
|
||||
settings:animation="@raw/accessibility_timeout"
|
||||
settings:preview="@drawable/accessibility_timeout"
|
||||
settings:controller="com.android.settings.widget.VideoPreferenceController"
|
||||
android:persistent="false" />
|
||||
<com.android.settingslib.widget.IllustrationPreference
|
||||
android:key="accessibility_control_timeout_banner"
|
||||
settings:lottie_rawRes="@raw/accessibility_timeout_banner"/>
|
||||
|
||||
<com.android.settingslib.widget.RadioButtonPreference
|
||||
android:key="accessibility_control_timeout_default"
|
||||
|
||||
@@ -36,10 +36,8 @@ import android.os.Bundle;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
import android.text.TextUtils;
|
||||
import android.util.FeatureFlagUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.widget.Button;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -55,7 +53,6 @@ import androidx.preference.PreferenceManager;
|
||||
import com.android.internal.util.ArrayUtils;
|
||||
import com.android.settings.Settings.WifiSettingsActivity;
|
||||
import com.android.settings.applications.manageapplications.ManageApplications;
|
||||
import com.android.settings.core.FeatureFlags;
|
||||
import com.android.settings.core.OnActivityResultListener;
|
||||
import com.android.settings.core.SettingsBaseActivity;
|
||||
import com.android.settings.core.SubSettingLauncher;
|
||||
@@ -70,7 +67,6 @@ import com.android.settingslib.core.instrumentation.SharedPreferencesLogger;
|
||||
import com.android.settingslib.development.DevelopmentSettingsEnabler;
|
||||
import com.android.settingslib.drawer.DashboardCategory;
|
||||
|
||||
import com.google.android.material.transition.platform.MaterialSharedAxis;
|
||||
import com.google.android.setupcompat.util.WizardManagerHelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -689,7 +685,7 @@ public class SettingsActivity extends SettingsBaseActivity
|
||||
if (somethingChanged) {
|
||||
Log.d(LOG_TAG, "Enabled state changed for some tiles, reloading all categories "
|
||||
+ changedList.toString());
|
||||
updateCategories();
|
||||
mCategoryMixin.updateCategories();
|
||||
} else {
|
||||
Log.d(LOG_TAG, "No enabled state changed, skipping updateCategory call");
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ public class ToggleReduceBrightColorsPreferenceFragment extends ToggleFeaturePre
|
||||
|
||||
mImageUri = new Uri.Builder().scheme(ContentResolver.SCHEME_ANDROID_RESOURCE)
|
||||
.authority(getPrefContext().getPackageName())
|
||||
.appendPath(String.valueOf(R.drawable.extra_dim_banner))
|
||||
.appendPath(String.valueOf(R.raw.extra_dim_banner))
|
||||
.build();
|
||||
mComponentName = AccessibilityShortcutController.REDUCE_BRIGHT_COLORS_COMPONENT_NAME;
|
||||
mPackageName = getText(R.string.reduce_bright_colors_preference_title);
|
||||
|
||||
@@ -73,6 +73,8 @@ import android.widget.Spinner;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.annotation.WorkerThread;
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
@@ -130,6 +132,8 @@ import com.android.settingslib.fuelgauge.PowerAllowlistBackend;
|
||||
import com.android.settingslib.utils.ThreadUtils;
|
||||
import com.android.settingslib.widget.settingsspinner.SettingsSpinnerAdapter;
|
||||
|
||||
import com.google.android.material.appbar.AppBarLayout;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
@@ -143,7 +147,8 @@ import java.util.Set;
|
||||
* intent.
|
||||
*/
|
||||
public class ManageApplications extends InstrumentedFragment
|
||||
implements View.OnClickListener, OnItemSelectedListener, SearchView.OnQueryTextListener {
|
||||
implements View.OnClickListener, OnItemSelectedListener, SearchView.OnQueryTextListener,
|
||||
MenuItem.OnActionExpandListener {
|
||||
|
||||
static final String TAG = "ManageApplications";
|
||||
static final boolean DEBUG = Build.IS_DEBUGGABLE;
|
||||
@@ -256,6 +261,7 @@ public class ManageApplications extends InstrumentedFragment
|
||||
private boolean mIsPersonalOnly;
|
||||
private View mEmptyView;
|
||||
private int mFilterType;
|
||||
private AppBarLayout mAppBarLayout;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
@@ -426,6 +432,9 @@ public class ManageApplications extends InstrumentedFragment
|
||||
|
||||
mResetAppsHelper.onRestoreInstanceState(savedInstanceState);
|
||||
|
||||
mAppBarLayout = getActivity().findViewById(R.id.app_bar);
|
||||
disableToolBarScrollableBehavior();
|
||||
|
||||
return mRootView;
|
||||
}
|
||||
|
||||
@@ -659,6 +668,7 @@ public class ManageApplications extends InstrumentedFragment
|
||||
|
||||
final MenuItem searchMenuItem = menu.findItem(R.id.search_app_list_menu);
|
||||
if (searchMenuItem != null) {
|
||||
searchMenuItem.setOnActionExpandListener(this);
|
||||
mSearchView = (SearchView) searchMenuItem.getActionView();
|
||||
mSearchView.setQueryHint(getText(R.string.search_settings));
|
||||
mSearchView.setOnQueryTextListener(this);
|
||||
@@ -670,6 +680,23 @@ public class ManageApplications extends InstrumentedFragment
|
||||
updateOptionsMenu();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMenuItemActionExpand(MenuItem item) {
|
||||
// To prevent a large space on tool bar.
|
||||
mAppBarLayout.setExpanded(false /*expanded*/, false /*animate*/);
|
||||
// To prevent user can expand the collapsing tool bar view.
|
||||
ViewCompat.setNestedScrollingEnabled(mRecyclerView, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMenuItemActionCollapse(MenuItem item) {
|
||||
// We keep the collapsed status after user cancel the search function.
|
||||
mAppBarLayout.setExpanded(false /*expanded*/, false /*animate*/);
|
||||
ViewCompat.setNestedScrollingEnabled(mRecyclerView, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPrepareOptionsMenu(Menu menu) {
|
||||
updateOptionsMenu();
|
||||
@@ -791,6 +818,9 @@ public class ManageApplications extends InstrumentedFragment
|
||||
mCurrentPkgName = entry.info.packageName;
|
||||
mCurrentUid = entry.info.uid;
|
||||
startApplicationDetailsActivity();
|
||||
// We disable the scrolling ability in onMenuItemActionCollapse, we should recover it
|
||||
// if user selects any app item.
|
||||
ViewCompat.setNestedScrollingEnabled(mRecyclerView, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -842,6 +872,20 @@ public class ManageApplications extends InstrumentedFragment
|
||||
}
|
||||
}
|
||||
|
||||
private void disableToolBarScrollableBehavior() {
|
||||
final CoordinatorLayout.LayoutParams params =
|
||||
(CoordinatorLayout.LayoutParams) mAppBarLayout.getLayoutParams();
|
||||
final AppBarLayout.Behavior behavior = new AppBarLayout.Behavior();
|
||||
behavior.setDragCallback(
|
||||
new AppBarLayout.Behavior.DragCallback() {
|
||||
@Override
|
||||
public boolean canDrag(@NonNull AppBarLayout appBarLayout) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
params.setBehavior(behavior);
|
||||
}
|
||||
|
||||
static class FilterSpinnerAdapter extends SettingsSpinnerAdapter<CharSequence> {
|
||||
|
||||
private final ManageApplications mManageApplications;
|
||||
|
||||
@@ -19,6 +19,9 @@ package com.android.settings.biometrics;
|
||||
import static android.provider.Settings.ACTION_BIOMETRIC_ENROLL;
|
||||
import static android.provider.Settings.EXTRA_BIOMETRIC_AUTHENTICATORS_ALLOWED;
|
||||
|
||||
import static com.android.settings.biometrics.BiometricEnrollBase.RESULT_CONSENT_DENIED;
|
||||
import static com.android.settings.biometrics.BiometricEnrollBase.RESULT_CONSENT_GRANTED;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.app.admin.DevicePolicyManager;
|
||||
import android.app.settings.SettingsEnums;
|
||||
@@ -64,6 +67,8 @@ public class BiometricEnrollActivity extends InstrumentedActivity {
|
||||
|
||||
private static final int REQUEST_CHOOSE_LOCK = 1;
|
||||
private static final int REQUEST_CONFIRM_LOCK = 2;
|
||||
// prompt for parental consent options
|
||||
private static final int REQUEST_CHOOSE_OPTIONS = 3;
|
||||
|
||||
public static final int RESULT_SKIP = BiometricEnrollBase.RESULT_SKIP;
|
||||
|
||||
@@ -71,8 +76,12 @@ public class BiometricEnrollActivity extends InstrumentedActivity {
|
||||
// this only applies to fingerprint.
|
||||
public static final String EXTRA_SKIP_INTRO = "skip_intro";
|
||||
|
||||
// TODO: temporary while waiting for team to add real flag
|
||||
public static final String EXTRA_TEMP_REQUIRE_PARENTAL_CONSENT = "require_consent";
|
||||
|
||||
private static final String SAVED_STATE_CONFIRMING_CREDENTIALS = "confirming_credentials";
|
||||
private static final String SAVED_STATE_ENROLL_ACTION_LOGGED = "enroll_action_logged";
|
||||
private static final String SAVED_STATE_PARENTAL_OPTIONS = "enroll_preferences";
|
||||
private static final String SAVED_STATE_GK_PW_HANDLE = "gk_pw_handle";
|
||||
|
||||
public static final class InternalActivity extends BiometricEnrollActivity {}
|
||||
@@ -80,9 +89,14 @@ public class BiometricEnrollActivity extends InstrumentedActivity {
|
||||
private int mUserId = UserHandle.myUserId();
|
||||
private boolean mConfirmingCredentials;
|
||||
private boolean mIsEnrollActionLogged;
|
||||
private boolean mIsFaceEnrollable;
|
||||
private boolean mIsFingerprintEnrollable;
|
||||
private boolean mHasFeatureFace = false;
|
||||
private boolean mHasFeatureFingerprint = false;
|
||||
private boolean mIsFaceEnrollable = false;
|
||||
private boolean mIsFingerprintEnrollable = false;
|
||||
private boolean mParentalOptionsRequired = false;
|
||||
private Bundle mParentalOptions;
|
||||
@Nullable private Long mGkPwHandle;
|
||||
@Nullable private ParentalConsentHelper mParentalConsentHelper;
|
||||
@Nullable private MultiBiometricEnrollHelper mMultiBiometricEnrollHelper;
|
||||
|
||||
@Override
|
||||
@@ -101,6 +115,7 @@ public class BiometricEnrollActivity extends InstrumentedActivity {
|
||||
SAVED_STATE_CONFIRMING_CREDENTIALS, false);
|
||||
mIsEnrollActionLogged = savedInstanceState.getBoolean(
|
||||
SAVED_STATE_ENROLL_ACTION_LOGGED, false);
|
||||
mParentalOptions = savedInstanceState.getBundle(SAVED_STATE_PARENTAL_OPTIONS);
|
||||
if (savedInstanceState.containsKey(SAVED_STATE_GK_PW_HANDLE)) {
|
||||
mGkPwHandle = savedInstanceState.getLong(SAVED_STATE_GK_PW_HANDLE);
|
||||
}
|
||||
@@ -141,52 +156,98 @@ public class BiometricEnrollActivity extends InstrumentedActivity {
|
||||
SetupWizardUtils.getThemeString(intent));
|
||||
}
|
||||
|
||||
// Default behavior is to enroll BIOMETRIC_WEAK or above. See ACTION_BIOMETRIC_ENROLL.
|
||||
final int authenticators = intent.getIntExtra(
|
||||
EXTRA_BIOMETRIC_AUTHENTICATORS_ALLOWED, Authenticators.BIOMETRIC_WEAK);
|
||||
final PackageManager pm = getApplicationContext().getPackageManager();
|
||||
mHasFeatureFingerprint = pm.hasSystemFeature(PackageManager.FEATURE_FINGERPRINT);
|
||||
mHasFeatureFace = pm.hasSystemFeature(PackageManager.FEATURE_FACE);
|
||||
|
||||
// determine what can be enrolled
|
||||
final boolean isSetupWizard = WizardManagerHelper.isAnySetupWizard(getIntent());
|
||||
if (mHasFeatureFace) {
|
||||
final FaceManager faceManager = getSystemService(FaceManager.class);
|
||||
final List<FaceSensorPropertiesInternal> faceProperties =
|
||||
faceManager.getSensorPropertiesInternal();
|
||||
if (!faceProperties.isEmpty()) {
|
||||
final int maxEnrolls =
|
||||
isSetupWizard ? 1 : faceProperties.get(0).maxEnrollmentsPerUser;
|
||||
mIsFaceEnrollable =
|
||||
faceManager.getEnrolledFaces(mUserId).size() < maxEnrolls;
|
||||
}
|
||||
}
|
||||
if (mHasFeatureFingerprint) {
|
||||
final FingerprintManager fpManager = getSystemService(FingerprintManager.class);
|
||||
final List<FingerprintSensorPropertiesInternal> fpProperties =
|
||||
fpManager.getSensorPropertiesInternal();
|
||||
if (!fpProperties.isEmpty()) {
|
||||
final int maxEnrolls =
|
||||
isSetupWizard ? 1 : fpProperties.get(0).maxEnrollmentsPerUser;
|
||||
mIsFingerprintEnrollable =
|
||||
fpManager.getEnrolledFingerprints(mUserId).size() < maxEnrolls;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(b/188847063): replace with real flag when ready
|
||||
mParentalOptionsRequired = intent.getBooleanExtra(
|
||||
BiometricEnrollActivity.EXTRA_TEMP_REQUIRE_PARENTAL_CONSENT, false);
|
||||
|
||||
if (mParentalOptionsRequired && mParentalOptions == null) {
|
||||
mParentalConsentHelper = new ParentalConsentHelper(
|
||||
mIsFaceEnrollable, mIsFingerprintEnrollable, mGkPwHandle);
|
||||
setOrConfirmCredentialsNow();
|
||||
} else {
|
||||
startEnroll();
|
||||
}
|
||||
}
|
||||
|
||||
private void startEnroll() {
|
||||
// TODO(b/188847063): This can be deleted, but log it now until it's wired up for real.
|
||||
if (mParentalOptionsRequired) {
|
||||
if (mParentalOptions == null) {
|
||||
throw new IllegalStateException("consent options required, but not set");
|
||||
}
|
||||
Log.d(TAG, "consent for face: "
|
||||
+ ParentalConsentHelper.hasFaceConsent(mParentalOptions));
|
||||
Log.d(TAG, "consent for fingerprint: "
|
||||
+ ParentalConsentHelper.hasFingerprintConsent(mParentalOptions));
|
||||
} else {
|
||||
Log.d(TAG, "startEnroll without requiring consent");
|
||||
}
|
||||
|
||||
// Default behavior is to enroll BIOMETRIC_WEAK or above. See ACTION_BIOMETRIC_ENROLL.
|
||||
final int authenticators = getIntent().getIntExtra(
|
||||
EXTRA_BIOMETRIC_AUTHENTICATORS_ALLOWED, Authenticators.BIOMETRIC_WEAK);
|
||||
Log.d(TAG, "Authenticators: " + authenticators);
|
||||
|
||||
final PackageManager pm = getApplicationContext().getPackageManager();
|
||||
final boolean hasFeatureFingerprint =
|
||||
pm.hasSystemFeature(PackageManager.FEATURE_FINGERPRINT);
|
||||
final boolean hasFeatureFace = pm.hasSystemFeature(PackageManager.FEATURE_FACE);
|
||||
final boolean isSetupWizard = WizardManagerHelper.isAnySetupWizard(getIntent());
|
||||
startEnrollWith(authenticators, WizardManagerHelper.isAnySetupWizard(getIntent()));
|
||||
}
|
||||
|
||||
if (isSetupWizard) {
|
||||
if (hasFeatureFace && hasFeatureFingerprint) {
|
||||
setupForMultiBiometricEnroll();
|
||||
} else if (hasFeatureFace) {
|
||||
launchFaceOnlyEnroll();
|
||||
} else if (hasFeatureFingerprint) {
|
||||
launchFingerprintOnlyEnroll();
|
||||
} else {
|
||||
Log.e(TAG, "No biometrics but started by SUW?");
|
||||
finish();
|
||||
}
|
||||
} else {
|
||||
// If the caller is not setup wizard, and the user has something enrolled, finish.
|
||||
private void startEnrollWith(@Authenticators.Types int authenticators, boolean setupWizard) {
|
||||
// If the caller is not setup wizard, and the user has something enrolled, finish.
|
||||
if (!setupWizard) {
|
||||
final BiometricManager bm = getSystemService(BiometricManager.class);
|
||||
final @BiometricError int result = bm.canAuthenticate(authenticators);
|
||||
if (result != BiometricManager.BIOMETRIC_ERROR_NONE_ENROLLED) {
|
||||
Log.e(TAG, "Unexpected result: " + result);
|
||||
Log.e(TAG, "Unexpected result (has enrollments): " + result);
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// This will need to be updated if the device has sensors other than BIOMETRIC_STRONG
|
||||
if (authenticators == BiometricManager.Authenticators.DEVICE_CREDENTIAL) {
|
||||
launchCredentialOnlyEnroll();
|
||||
} else if (hasFeatureFace && hasFeatureFingerprint) {
|
||||
setupForMultiBiometricEnroll();
|
||||
} else if (hasFeatureFingerprint) {
|
||||
launchFingerprintOnlyEnroll();
|
||||
} else if (hasFeatureFace) {
|
||||
launchFaceOnlyEnroll();
|
||||
// This will need to be updated if the device has sensors other than BIOMETRIC_STRONG
|
||||
if (!setupWizard && authenticators == BiometricManager.Authenticators.DEVICE_CREDENTIAL) {
|
||||
launchCredentialOnlyEnroll();
|
||||
} else if (mHasFeatureFace && mHasFeatureFingerprint) {
|
||||
if (mParentalOptionsRequired && mGkPwHandle != null) {
|
||||
launchFaceAndFingerprintEnroll();
|
||||
} else {
|
||||
Log.e(TAG, "Unknown state, finishing");
|
||||
finish();
|
||||
setOrConfirmCredentialsNow();
|
||||
}
|
||||
} else if (mHasFeatureFingerprint) {
|
||||
launchFingerprintOnlyEnroll();
|
||||
} else if (mHasFeatureFace) {
|
||||
launchFaceOnlyEnroll();
|
||||
} else {
|
||||
Log.e(TAG, "Unknown state, finishing (was SUW: " + setupWizard + ")");
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,6 +256,9 @@ public class BiometricEnrollActivity extends InstrumentedActivity {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putBoolean(SAVED_STATE_CONFIRMING_CREDENTIALS, mConfirmingCredentials);
|
||||
outState.putBoolean(SAVED_STATE_ENROLL_ACTION_LOGGED, mIsEnrollActionLogged);
|
||||
if (mParentalOptions != null) {
|
||||
outState.putBundle(SAVED_STATE_PARENTAL_OPTIONS, mParentalOptions);
|
||||
}
|
||||
if (mGkPwHandle != null) {
|
||||
outState.putLong(SAVED_STATE_GK_PW_HANDLE, mGkPwHandle);
|
||||
}
|
||||
@@ -204,31 +268,84 @@ public class BiometricEnrollActivity extends InstrumentedActivity {
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
|
||||
// single enrollment is handled entirely by the launched activity
|
||||
// this handles multi enroll or if parental consent is required
|
||||
if (mParentalConsentHelper != null) {
|
||||
handleOnActivityResultWhileConsenting(requestCode, resultCode, data);
|
||||
} else {
|
||||
handleOnActivityResultWhileEnrollingMultiple(requestCode, resultCode, data);
|
||||
}
|
||||
}
|
||||
|
||||
// handles responses while parental consent is pending
|
||||
private void handleOnActivityResultWhileConsenting(
|
||||
int requestCode, int resultCode, Intent data) {
|
||||
overridePendingTransition(R.anim.sud_slide_next_in, R.anim.sud_slide_next_out);
|
||||
|
||||
switch (requestCode) {
|
||||
case REQUEST_CHOOSE_LOCK:
|
||||
case REQUEST_CONFIRM_LOCK:
|
||||
mConfirmingCredentials = false;
|
||||
if (isSuccessfulConfirmOrChooseCredential(requestCode, resultCode)) {
|
||||
updateGatekeeperPasswordHandle(data);
|
||||
if (!mParentalConsentHelper.launchNext(this, REQUEST_CHOOSE_OPTIONS)) {
|
||||
Log.e(TAG, "Nothing to prompt for consent (no modalities enabled)!");
|
||||
finish();
|
||||
}
|
||||
} else {
|
||||
Log.d(TAG, "Unknown result for set/choose lock: " + resultCode);
|
||||
setResult(resultCode);
|
||||
finish();
|
||||
}
|
||||
break;
|
||||
case REQUEST_CHOOSE_OPTIONS:
|
||||
if (resultCode == RESULT_CONSENT_GRANTED || resultCode == RESULT_CONSENT_DENIED) {
|
||||
final boolean isStillPrompting = mParentalConsentHelper.launchNext(
|
||||
this, REQUEST_CHOOSE_OPTIONS, resultCode, data);
|
||||
if (!isStillPrompting) {
|
||||
Log.d(TAG, "Enrollment options set, starting enrollment now");
|
||||
|
||||
mParentalOptions = mParentalConsentHelper.getConsentResult();
|
||||
mParentalConsentHelper = null;
|
||||
startEnroll();
|
||||
}
|
||||
} else {
|
||||
Log.d(TAG, "Unknown or cancelled parental consent");
|
||||
setResult(RESULT_CANCELED);
|
||||
finish();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
Log.w(TAG, "Unknown consenting requestCode: " + requestCode + ", finishing");
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
// handles responses while multi biometric enrollment is pending
|
||||
private void handleOnActivityResultWhileEnrollingMultiple(
|
||||
int requestCode, int resultCode, Intent data) {
|
||||
if (mMultiBiometricEnrollHelper == null) {
|
||||
overridePendingTransition(R.anim.sud_slide_next_in, R.anim.sud_slide_next_out);
|
||||
|
||||
switch (requestCode) {
|
||||
case REQUEST_CHOOSE_LOCK:
|
||||
case REQUEST_CONFIRM_LOCK:
|
||||
mConfirmingCredentials = false;
|
||||
if (resultCode == ChooseLockPattern.RESULT_FINISHED) {
|
||||
startMultiBiometricEnroll(data);
|
||||
final boolean isOk =
|
||||
isSuccessfulConfirmOrChooseCredential(requestCode, resultCode);
|
||||
// single modality enrollment requests confirmation directly
|
||||
// via BiometricEnrollBase#onCreate and should never get here
|
||||
if (isOk && mHasFeatureFace && mHasFeatureFingerprint) {
|
||||
updateGatekeeperPasswordHandle(data);
|
||||
launchFaceAndFingerprintEnroll();
|
||||
} else {
|
||||
Log.d(TAG, "Unknown result for chooseLock: " + resultCode);
|
||||
Log.d(TAG, "Unknown result for set/choose lock: " + resultCode);
|
||||
setResult(resultCode);
|
||||
finish();
|
||||
}
|
||||
break;
|
||||
case REQUEST_CONFIRM_LOCK:
|
||||
mConfirmingCredentials = false;
|
||||
if (resultCode == RESULT_OK) {
|
||||
startMultiBiometricEnroll(data);
|
||||
} else {
|
||||
Log.d(TAG, "Unknown result for confirmLock: " + resultCode);
|
||||
finish();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
Log.d(TAG, "Unknown requestCode: " + requestCode + ", finishing");
|
||||
Log.w(TAG, "Unknown enrolling requestCode: " + requestCode + ", finishing");
|
||||
finish();
|
||||
}
|
||||
} else {
|
||||
@@ -236,18 +353,28 @@ public class BiometricEnrollActivity extends InstrumentedActivity {
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isSuccessfulConfirmOrChooseCredential(int requestCode, int resultCode) {
|
||||
final boolean okChoose = requestCode == REQUEST_CHOOSE_LOCK
|
||||
&& resultCode == ChooseLockPattern.RESULT_FINISHED;
|
||||
final boolean okConfirm = requestCode == REQUEST_CONFIRM_LOCK
|
||||
&& resultCode == RESULT_OK;
|
||||
return okChoose || okConfirm;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onApplyThemeResource(Resources.Theme theme, int resid, boolean first) {
|
||||
final int new_resid = SetupWizardUtils.getTheme(this, getIntent());
|
||||
final int newResid = SetupWizardUtils.getTheme(this, getIntent());
|
||||
theme.applyStyle(R.style.SetupWizardPartnerResource, true);
|
||||
super.onApplyThemeResource(theme, new_resid, first);
|
||||
super.onApplyThemeResource(theme, newResid, first);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
|
||||
if (mConfirmingCredentials || mMultiBiometricEnrollHelper != null) {
|
||||
if (mConfirmingCredentials
|
||||
|| mMultiBiometricEnrollHelper != null
|
||||
|| mParentalConsentHelper != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -257,7 +384,8 @@ public class BiometricEnrollActivity extends InstrumentedActivity {
|
||||
}
|
||||
}
|
||||
|
||||
private void setupForMultiBiometricEnroll() {
|
||||
|
||||
private void setOrConfirmCredentialsNow() {
|
||||
if (!mConfirmingCredentials) {
|
||||
mConfirmingCredentials = true;
|
||||
if (!userHasPassword(mUserId)) {
|
||||
@@ -268,37 +396,11 @@ public class BiometricEnrollActivity extends InstrumentedActivity {
|
||||
}
|
||||
}
|
||||
|
||||
private void startMultiBiometricEnroll(Intent data) {
|
||||
final boolean isSetupWizard = WizardManagerHelper.isAnySetupWizard(getIntent());
|
||||
final FingerprintManager fingerprintManager = getSystemService(FingerprintManager.class);
|
||||
final FaceManager faceManager = getSystemService(FaceManager.class);
|
||||
final List<FingerprintSensorPropertiesInternal> fpProperties =
|
||||
fingerprintManager.getSensorPropertiesInternal();
|
||||
final List<FaceSensorPropertiesInternal> faceProperties =
|
||||
faceManager.getSensorPropertiesInternal();
|
||||
|
||||
private void updateGatekeeperPasswordHandle(@NonNull Intent data) {
|
||||
mGkPwHandle = BiometricUtils.getGatekeeperPasswordHandle(data);
|
||||
|
||||
if (isSetupWizard) {
|
||||
// This would need to be updated for devices with multiple sensors of the same modality
|
||||
mIsFaceEnrollable = !faceProperties.isEmpty()
|
||||
&& faceManager.getEnrolledFaces(mUserId).size() == 0;
|
||||
mIsFingerprintEnrollable = !fpProperties.isEmpty()
|
||||
&& fingerprintManager.getEnrolledFingerprints(mUserId).size() == 0;
|
||||
} else {
|
||||
// This would need to be updated for devices with multiple sensors of the same modality
|
||||
mIsFaceEnrollable = !faceProperties.isEmpty()
|
||||
&& faceManager.getEnrolledFaces(mUserId).size()
|
||||
< faceProperties.get(0).maxEnrollmentsPerUser;
|
||||
mIsFingerprintEnrollable = !fpProperties.isEmpty()
|
||||
&& fingerprintManager.getEnrolledFingerprints(mUserId).size()
|
||||
< fpProperties.get(0).maxEnrollmentsPerUser;
|
||||
|
||||
if (mParentalConsentHelper != null) {
|
||||
mParentalConsentHelper.updateGatekeeperHandle(data);
|
||||
}
|
||||
|
||||
mMultiBiometricEnrollHelper = new MultiBiometricEnrollHelper(this, mUserId,
|
||||
mIsFaceEnrollable, mIsFingerprintEnrollable, mGkPwHandle);
|
||||
mMultiBiometricEnrollHelper.startNextStep();
|
||||
}
|
||||
|
||||
private boolean userHasPassword(int userId) {
|
||||
@@ -310,6 +412,7 @@ public class BiometricEnrollActivity extends InstrumentedActivity {
|
||||
|
||||
private void launchChooseLock() {
|
||||
Log.d(TAG, "launchChooseLock");
|
||||
|
||||
Intent intent = BiometricUtils.getChooseLockIntent(this, getIntent());
|
||||
intent.putExtra(ChooseLockGeneric.ChooseLockGenericFragment.HIDE_INSECURE_OPTIONS, true);
|
||||
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_REQUEST_GK_PW_HANDLE, true);
|
||||
@@ -323,6 +426,7 @@ public class BiometricEnrollActivity extends InstrumentedActivity {
|
||||
|
||||
private void launchConfirmLock() {
|
||||
Log.d(TAG, "launchConfirmLock");
|
||||
|
||||
final ChooseLockSettingsHelper.Builder builder = new ChooseLockSettingsHelper.Builder(this);
|
||||
builder.setRequestCode(REQUEST_CONFIRM_LOCK)
|
||||
.setRequestGatekeeperPasswordHandle(true)
|
||||
@@ -346,7 +450,7 @@ public class BiometricEnrollActivity extends InstrumentedActivity {
|
||||
* @param intent Enrollment activity that should be started (e.g. FaceEnrollIntroduction.class,
|
||||
* etc).
|
||||
*/
|
||||
private void launchEnrollActivity(@NonNull Intent intent) {
|
||||
private void launchSingleSensorEnrollActivity(@NonNull Intent intent) {
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
|
||||
byte[] hardwareAuthToken = null;
|
||||
if (this instanceof InternalActivity) {
|
||||
@@ -362,7 +466,7 @@ public class BiometricEnrollActivity extends InstrumentedActivity {
|
||||
// If only device credential was specified, ask the user to only set that up.
|
||||
intent = new Intent(this, ChooseLockGeneric.class);
|
||||
intent.putExtra(ChooseLockGeneric.ChooseLockGenericFragment.HIDE_INSECURE_OPTIONS, true);
|
||||
launchEnrollActivity(intent);
|
||||
launchSingleSensorEnrollActivity(intent);
|
||||
}
|
||||
|
||||
private void launchFingerprintOnlyEnroll() {
|
||||
@@ -374,12 +478,18 @@ public class BiometricEnrollActivity extends InstrumentedActivity {
|
||||
} else {
|
||||
intent = BiometricUtils.getFingerprintIntroIntent(this, getIntent());
|
||||
}
|
||||
launchEnrollActivity(intent);
|
||||
launchSingleSensorEnrollActivity(intent);
|
||||
}
|
||||
|
||||
private void launchFaceOnlyEnroll() {
|
||||
final Intent intent = BiometricUtils.getFaceIntroIntent(this, getIntent());
|
||||
launchEnrollActivity(intent);
|
||||
launchSingleSensorEnrollActivity(intent);
|
||||
}
|
||||
|
||||
private void launchFaceAndFingerprintEnroll() {
|
||||
mMultiBiometricEnrollHelper = new MultiBiometricEnrollHelper(this, mUserId,
|
||||
mIsFaceEnrollable, mIsFingerprintEnrollable, mGkPwHandle);
|
||||
mMultiBiometricEnrollHelper.startNextStep();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -26,6 +26,7 @@ import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.os.UserHandle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
@@ -50,12 +51,15 @@ import com.google.android.setupdesign.util.ThemeHelper;
|
||||
*/
|
||||
public abstract class BiometricEnrollBase extends InstrumentedActivity {
|
||||
|
||||
private static final String TAG = "BiometricEnrollBase";
|
||||
|
||||
public static final String EXTRA_FROM_SETTINGS_SUMMARY = "from_settings_summary";
|
||||
public static final String EXTRA_KEY_LAUNCHED_CONFIRM = "launched_confirm_lock";
|
||||
public static final String EXTRA_KEY_REQUIRE_VISION = "accessibility_vision";
|
||||
public static final String EXTRA_KEY_REQUIRE_DIVERSITY = "accessibility_diversity";
|
||||
public static final String EXTRA_KEY_SENSOR_ID = "sensor_id";
|
||||
public static final String EXTRA_KEY_CHALLENGE = "challenge";
|
||||
public static final String EXTRA_KEY_MODALITY = "sensor_modality";
|
||||
|
||||
/**
|
||||
* Used by the choose fingerprint wizard to indicate the wizard is
|
||||
@@ -84,11 +88,26 @@ public abstract class BiometricEnrollBase extends InstrumentedActivity {
|
||||
*/
|
||||
public static final int RESULT_TIMEOUT = RESULT_FIRST_USER + 2;
|
||||
|
||||
/**
|
||||
* Used by consent screens to indicate that consent was granted. Extras, such as
|
||||
* EXTRA_KEY_MODALITY, will be included in the result to provide details about the
|
||||
* consent that was granted.
|
||||
*/
|
||||
public static final int RESULT_CONSENT_GRANTED = RESULT_FIRST_USER + 3;
|
||||
|
||||
/**
|
||||
* Used by consent screens to indicate that consent was denied. Extras, such as
|
||||
* EXTRA_KEY_MODALITY, will be included in the result to provide details about the
|
||||
* consent that was not granted.
|
||||
*/
|
||||
public static final int RESULT_CONSENT_DENIED = RESULT_FIRST_USER + 4;
|
||||
|
||||
public static final int CHOOSE_LOCK_GENERIC_REQUEST = 1;
|
||||
public static final int BIOMETRIC_FIND_SENSOR_REQUEST = 2;
|
||||
public static final int LEARN_MORE_REQUEST = 3;
|
||||
public static final int CONFIRM_REQUEST = 4;
|
||||
public static final int ENROLL_REQUEST = 5;
|
||||
|
||||
/**
|
||||
* Request code when starting another biometric enrollment from within a biometric flow. For
|
||||
* example, when starting fingerprint enroll after face enroll.
|
||||
@@ -242,6 +261,8 @@ public abstract class BiometricEnrollBase extends InstrumentedActivity {
|
||||
}
|
||||
|
||||
protected void launchConfirmLock(int titleResId) {
|
||||
Log.d(TAG, "launchConfirmLock");
|
||||
|
||||
final ChooseLockSettingsHelper.Builder builder = new ChooseLockSettingsHelper.Builder(this);
|
||||
builder.setRequestCode(CONFIRM_REQUEST)
|
||||
.setTitle(getString(titleResId))
|
||||
|
||||
@@ -294,15 +294,19 @@ public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase
|
||||
mConfirmingCredentials = false;
|
||||
if (resultCode == RESULT_FINISHED) {
|
||||
updatePasswordQuality();
|
||||
overridePendingTransition(R.anim.sud_slide_next_in, R.anim.sud_slide_next_out);
|
||||
getNextButton().setEnabled(false);
|
||||
getChallenge(((sensorId, userId, challenge) -> {
|
||||
mSensorId = sensorId;
|
||||
mChallenge = challenge;
|
||||
mToken = BiometricUtils.requestGatekeeperHat(this, data, mUserId, challenge);
|
||||
BiometricUtils.removeGatekeeperPasswordHandle(this, data);
|
||||
getNextButton().setEnabled(true);
|
||||
}));
|
||||
final boolean handled = onSetOrConfirmCredentials(data);
|
||||
if (!handled) {
|
||||
overridePendingTransition(R.anim.sud_slide_next_in, R.anim.sud_slide_next_out);
|
||||
getNextButton().setEnabled(false);
|
||||
getChallenge(((sensorId, userId, challenge) -> {
|
||||
mSensorId = sensorId;
|
||||
mChallenge = challenge;
|
||||
mToken = BiometricUtils.requestGatekeeperHat(this, data, mUserId,
|
||||
challenge);
|
||||
BiometricUtils.removeGatekeeperPasswordHandle(this, data);
|
||||
getNextButton().setEnabled(true);
|
||||
}));
|
||||
}
|
||||
} else {
|
||||
setResult(resultCode, data);
|
||||
finish();
|
||||
@@ -310,15 +314,19 @@ public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase
|
||||
} else if (requestCode == CONFIRM_REQUEST) {
|
||||
mConfirmingCredentials = false;
|
||||
if (resultCode == RESULT_OK && data != null) {
|
||||
overridePendingTransition(R.anim.sud_slide_next_in, R.anim.sud_slide_next_out);
|
||||
getNextButton().setEnabled(false);
|
||||
getChallenge(((sensorId, userId, challenge) -> {
|
||||
mSensorId = sensorId;
|
||||
mChallenge = challenge;
|
||||
mToken = BiometricUtils.requestGatekeeperHat(this, data, mUserId, challenge);
|
||||
BiometricUtils.removeGatekeeperPasswordHandle(this, data);
|
||||
getNextButton().setEnabled(true);
|
||||
}));
|
||||
final boolean handled = onSetOrConfirmCredentials(data);
|
||||
if (!handled) {
|
||||
overridePendingTransition(R.anim.sud_slide_next_in, R.anim.sud_slide_next_out);
|
||||
getNextButton().setEnabled(false);
|
||||
getChallenge(((sensorId, userId, challenge) -> {
|
||||
mSensorId = sensorId;
|
||||
mChallenge = challenge;
|
||||
mToken = BiometricUtils.requestGatekeeperHat(this, data, mUserId,
|
||||
challenge);
|
||||
BiometricUtils.removeGatekeeperPasswordHandle(this, data);
|
||||
getNextButton().setEnabled(true);
|
||||
}));
|
||||
}
|
||||
} else {
|
||||
setResult(resultCode, data);
|
||||
finish();
|
||||
@@ -335,6 +343,18 @@ public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after confirming credentials. Can be used to prevent the default
|
||||
* behavior of immediately calling #getChallenge (useful to things like intro
|
||||
* consent screens that don't actually do enrollment and will later start an
|
||||
* activity that does).
|
||||
*
|
||||
* @return True if the default behavior should be skipped and handled by this method instead.
|
||||
*/
|
||||
protected boolean onSetOrConfirmCredentials(@Nullable Intent data) {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void onCancelButtonClick(View view) {
|
||||
finish();
|
||||
}
|
||||
|
||||
168
src/com/android/settings/biometrics/ParentalConsentHelper.java
Normal file
168
src/com/android/settings/biometrics/ParentalConsentHelper.java
Normal file
@@ -0,0 +1,168 @@
|
||||
/*
|
||||
* 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.biometrics;
|
||||
|
||||
import static android.hardware.biometrics.BiometricAuthenticator.TYPE_FACE;
|
||||
import static android.hardware.biometrics.BiometricAuthenticator.TYPE_FINGERPRINT;
|
||||
import static android.hardware.biometrics.BiometricAuthenticator.TYPE_NONE;
|
||||
|
||||
import static com.android.settings.biometrics.BiometricEnrollBase.EXTRA_KEY_MODALITY;
|
||||
import static com.android.settings.biometrics.BiometricEnrollBase.RESULT_CONSENT_DENIED;
|
||||
import static com.android.settings.biometrics.BiometricEnrollBase.RESULT_CONSENT_GRANTED;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.settings.biometrics.face.FaceEnrollParentalConsent;
|
||||
import com.android.settings.biometrics.fingerprint.FingerprintEnrollParentalConsent;
|
||||
import com.android.settings.password.ChooseLockSettingsHelper;
|
||||
|
||||
import com.google.android.setupcompat.util.WizardManagerHelper;
|
||||
|
||||
/**
|
||||
* Helper for {@link BiometricEnrollActivity} to ask for parental consent prior to actual user
|
||||
* enrollment.
|
||||
*/
|
||||
public class ParentalConsentHelper {
|
||||
|
||||
private static final String KEY_FACE_CONSENT = "face";
|
||||
private static final String KEY_FINGERPRINT_CONSENT = "fingerprint";
|
||||
|
||||
private final boolean mRequireFace;
|
||||
private final boolean mRequireFingerprint;
|
||||
|
||||
private long mGkPwHandle;
|
||||
@Nullable
|
||||
private Boolean mConsentFace;
|
||||
@Nullable
|
||||
private Boolean mConsentFingerprint;
|
||||
|
||||
/**
|
||||
* Helper for aggregating user consent.
|
||||
*
|
||||
* @param requireFace if face consent should be shown
|
||||
* @param requireFingerprint if fingerprint consent should be shown
|
||||
* @param gkPwHandle for launched intents
|
||||
*/
|
||||
public ParentalConsentHelper(boolean requireFace, boolean requireFingerprint,
|
||||
@Nullable Long gkPwHandle) {
|
||||
mRequireFace = requireFace;
|
||||
mRequireFingerprint = requireFingerprint;
|
||||
mGkPwHandle = gkPwHandle != null ? gkPwHandle : 0L;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updated the handle used for launching activities
|
||||
*
|
||||
* @param data result intent for credential verification
|
||||
*/
|
||||
public void updateGatekeeperHandle(Intent data) {
|
||||
mGkPwHandle = BiometricUtils.getGatekeeperPasswordHandle(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Launch the next consent screen.
|
||||
*
|
||||
* @param activity root activity
|
||||
* @param requestCode request code to launch new activity
|
||||
* @param resultCode result code of the last consent launch
|
||||
* @param data result data from the last consent launch
|
||||
* @return true if a consent activity was launched or false when complete
|
||||
*/
|
||||
public boolean launchNext(@NonNull Activity activity, int requestCode, int resultCode,
|
||||
@Nullable Intent data) {
|
||||
if (data != null) {
|
||||
switch (data.getIntExtra(EXTRA_KEY_MODALITY, TYPE_NONE)) {
|
||||
case TYPE_FACE:
|
||||
mConsentFace = isConsent(resultCode, mConsentFace);
|
||||
break;
|
||||
case TYPE_FINGERPRINT:
|
||||
mConsentFingerprint = isConsent(resultCode, mConsentFingerprint);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return launchNext(activity, requestCode);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static Boolean isConsent(int resultCode, @Nullable Boolean defaultValue) {
|
||||
switch (resultCode) {
|
||||
case RESULT_CONSENT_GRANTED:
|
||||
return true;
|
||||
case RESULT_CONSENT_DENIED:
|
||||
return false;
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
/** @see #launchNext(Activity, int, int, Intent) */
|
||||
public boolean launchNext(@NonNull Activity activity, int requestCode) {
|
||||
final Intent intent = getNextConsentIntent(activity);
|
||||
if (intent != null) {
|
||||
WizardManagerHelper.copyWizardManagerExtras(activity.getIntent(), intent);
|
||||
if (mGkPwHandle != 0) {
|
||||
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_GK_PW_HANDLE, mGkPwHandle);
|
||||
}
|
||||
activity.startActivityForResult(intent, requestCode);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private Intent getNextConsentIntent(@NonNull Context context) {
|
||||
if (mRequireFace && mConsentFace == null) {
|
||||
return new Intent(context, FaceEnrollParentalConsent.class);
|
||||
}
|
||||
if (mRequireFingerprint && mConsentFingerprint == null) {
|
||||
return new Intent(context, FingerprintEnrollParentalConsent.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the result of all consent requests.
|
||||
*
|
||||
* This should be called when {@link #launchNext(Activity, int, int, Intent)} returns false
|
||||
* to indicate that all responses have been recorded.
|
||||
*
|
||||
* @return The aggregate consent status.
|
||||
*/
|
||||
@NonNull
|
||||
public Bundle getConsentResult() {
|
||||
final Bundle result = new Bundle();
|
||||
result.putBoolean(KEY_FACE_CONSENT, mConsentFace != null ? mConsentFace : false);
|
||||
result.putBoolean(KEY_FINGERPRINT_CONSENT,
|
||||
mConsentFingerprint != null ? mConsentFingerprint : false);
|
||||
return result;
|
||||
}
|
||||
|
||||
/** @return If the result bundle contains consent for face authentication. */
|
||||
public static boolean hasFaceConsent(@NonNull Bundle bundle) {
|
||||
return bundle.getBoolean(KEY_FACE_CONSENT, false);
|
||||
}
|
||||
|
||||
/** @return If the result bundle contains consent for fingerprint authentication. */
|
||||
public static boolean hasFingerprintConsent(@NonNull Bundle bundle) {
|
||||
return bundle.getBoolean(KEY_FINGERPRINT_CONSENT, false);
|
||||
}
|
||||
}
|
||||
@@ -76,31 +76,71 @@ public class FaceEnrollIntroduction extends BiometricEnrollIntroduction {
|
||||
|
||||
final ImageView iconGlasses = findViewById(R.id.icon_glasses);
|
||||
final ImageView iconLooking = findViewById(R.id.icon_looking);
|
||||
final ImageView iconSecurity = findViewById(R.id.icon_security);
|
||||
iconGlasses.getBackground().setColorFilter(getIconColorFilter());
|
||||
iconLooking.getBackground().setColorFilter(getIconColorFilter());
|
||||
iconSecurity.getBackground().setColorFilter(getIconColorFilter());
|
||||
|
||||
final TextView infoMessageGlasses = findViewById(R.id.info_message_glasses);
|
||||
final TextView infoMessageLooking = findViewById(R.id.info_message_looking);
|
||||
final TextView howMessage = findViewById(R.id.how_message);
|
||||
final TextView inControlTitle = findViewById(R.id.title_in_control);
|
||||
final TextView inControlMessage = findViewById(R.id.message_in_control);
|
||||
infoMessageGlasses.setText(getInfoMessageGlasses());
|
||||
infoMessageLooking.setText(getInfoMessageLooking());
|
||||
howMessage.setText(getHowMessage());
|
||||
inControlTitle.setText(getInControlTitle());
|
||||
inControlMessage.setText(getInControlMessage());
|
||||
|
||||
mFaceManager = Utils.getFaceManagerOrNull(this);
|
||||
mFaceFeatureProvider = FeatureFactory.getFactory(getApplicationContext())
|
||||
.getFaceFeatureProvider();
|
||||
|
||||
|
||||
// This path is an entry point for SetNewPasswordController, e.g.
|
||||
// adb shell am start -a android.app.action.SET_NEW_PASSWORD
|
||||
if (mToken == null && BiometricUtils.containsGatekeeperPasswordHandle(getIntent())) {
|
||||
mFooterBarMixin.getPrimaryButton().setEnabled(false);
|
||||
// We either block on generateChallenge, or need to gray out the "next" button until
|
||||
// the challenge is ready. Let's just do this for now.
|
||||
mFaceManager.generateChallenge(mUserId, (sensorId, userId, challenge) -> {
|
||||
mToken = BiometricUtils.requestGatekeeperHat(this, getIntent(), mUserId, challenge);
|
||||
mSensorId = sensorId;
|
||||
mChallenge = challenge;
|
||||
mFooterBarMixin.getPrimaryButton().setEnabled(true);
|
||||
});
|
||||
if (generateChallengeOnCreate()) {
|
||||
mFooterBarMixin.getPrimaryButton().setEnabled(false);
|
||||
// We either block on generateChallenge, or need to gray out the "next" button until
|
||||
// the challenge is ready. Let's just do this for now.
|
||||
mFaceManager.generateChallenge(mUserId, (sensorId, userId, challenge) -> {
|
||||
mToken = BiometricUtils.requestGatekeeperHat(this, getIntent(), mUserId,
|
||||
challenge);
|
||||
mSensorId = sensorId;
|
||||
mChallenge = challenge;
|
||||
mFooterBarMixin.getPrimaryButton().setEnabled(true);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean generateChallengeOnCreate() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@StringRes
|
||||
protected int getInfoMessageGlasses() {
|
||||
return R.string.security_settings_face_enroll_introduction_info_glasses;
|
||||
}
|
||||
|
||||
@StringRes
|
||||
protected int getInfoMessageLooking() {
|
||||
return R.string.security_settings_face_enroll_introduction_info_looking;
|
||||
}
|
||||
|
||||
@StringRes
|
||||
protected int getHowMessage() {
|
||||
return R.string.security_settings_face_enroll_introduction_how_message;
|
||||
}
|
||||
|
||||
@StringRes
|
||||
protected int getInControlTitle() {
|
||||
return R.string.security_settings_face_enroll_introduction_control_title;
|
||||
}
|
||||
|
||||
@StringRes
|
||||
protected int getInControlMessage() {
|
||||
return R.string.security_settings_face_enroll_introduction_control_message;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isDisabledByAdmin() {
|
||||
return RestrictedLockUtilsInternal.checkIfKeyguardFeaturesDisabled(
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* 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.biometrics.face;
|
||||
|
||||
import static android.hardware.biometrics.BiometricAuthenticator.TYPE_FACE;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.StringRes;
|
||||
|
||||
import com.android.settings.R;
|
||||
|
||||
/**
|
||||
* Displays parental consent information for face authentication.
|
||||
*
|
||||
* TODO(b/188847063): swap strings for consent screen
|
||||
*/
|
||||
public class FaceEnrollParentalConsent extends FaceEnrollIntroduction {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setDescriptionText(R.string.security_settings_face_enroll_introduction_consent_message);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNextButtonClick(View view) {
|
||||
onConsentResult(true /* granted */);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSkipButtonClick(View view) {
|
||||
onConsentResult(false /* granted */);
|
||||
}
|
||||
|
||||
private void onConsentResult(boolean granted) {
|
||||
final Intent result = new Intent();
|
||||
result.putExtra(EXTRA_KEY_MODALITY, TYPE_FACE);
|
||||
setResult(granted ? RESULT_CONSENT_GRANTED : RESULT_CONSENT_DENIED, result);
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean onSetOrConfirmCredentials(@Nullable Intent data) {
|
||||
// prevent challenge from being generated by default
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean generateChallengeOnCreate() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@StringRes
|
||||
protected int getInfoMessageGlasses() {
|
||||
return R.string.security_settings_face_enroll_introduction_info_consent_glasses;
|
||||
}
|
||||
|
||||
@Override
|
||||
@StringRes
|
||||
protected int getInfoMessageLooking() {
|
||||
return R.string.security_settings_face_enroll_introduction_info_consent_looking;
|
||||
}
|
||||
|
||||
@Override
|
||||
@StringRes
|
||||
protected int getHowMessage() {
|
||||
return R.string.security_settings_face_enroll_introduction_how_consent_message;
|
||||
}
|
||||
|
||||
@Override
|
||||
@StringRes
|
||||
protected int getInControlTitle() {
|
||||
return R.string.security_settings_face_enroll_introduction_control_consent_title;
|
||||
}
|
||||
|
||||
@Override
|
||||
@StringRes
|
||||
protected int getInControlMessage() {
|
||||
return R.string.security_settings_face_enroll_introduction_control_consent_message;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getHeaderResDefault() {
|
||||
return R.string.security_settings_face_enroll_consent_introduction_title;
|
||||
}
|
||||
}
|
||||
@@ -64,21 +64,62 @@ public class FingerprintEnrollIntroduction extends BiometricEnrollIntroduction {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
final ImageView iconFingerprint = findViewById(R.id.icon_fingerprint);
|
||||
final ImageView iconLocked = findViewById(R.id.icon_locked);
|
||||
final ImageView iconDelete = findViewById(R.id.icon_delete);
|
||||
final ImageView iconInfo = findViewById(R.id.icon_info);
|
||||
final ImageView iconLink = findViewById(R.id.icon_link);
|
||||
iconFingerprint.getDrawable().setColorFilter(getIconColorFilter());
|
||||
iconLocked.getDrawable().setColorFilter(getIconColorFilter());
|
||||
iconDelete.getDrawable().setColorFilter(getIconColorFilter());
|
||||
iconInfo.getDrawable().setColorFilter(getIconColorFilter());
|
||||
iconLink.getDrawable().setColorFilter(getIconColorFilter());
|
||||
|
||||
final TextView footerMessage2 = findViewById(R.id.footer_message_2);
|
||||
final TextView footerMessage3 = findViewById(R.id.footer_message_3);
|
||||
final TextView footerMessage4 = findViewById(R.id.footer_message_4);
|
||||
final TextView footerMessage5 = findViewById(R.id.footer_message_5);
|
||||
footerMessage2.setText(getFooterMessage2());
|
||||
footerMessage3.setText(getFooterMessage3());
|
||||
footerMessage4.setText(getFooterMessage4());
|
||||
footerMessage5.setText(getFooterMessage5());
|
||||
|
||||
final TextView footerTitle1 = findViewById(R.id.footer_title_1);
|
||||
final TextView footerTitle2 = findViewById(R.id.footer_title_2);
|
||||
footerTitle1.setText(getFooterTitle1());
|
||||
footerTitle2.setText(getFooterTitle2());
|
||||
}
|
||||
|
||||
@StringRes
|
||||
int getNegativeButtonTextId() {
|
||||
return R.string.security_settings_fingerprint_enroll_introduction_skip;
|
||||
}
|
||||
|
||||
@StringRes
|
||||
protected int getFooterTitle1() {
|
||||
return R.string.security_settings_fingerprint_enroll_introduction_footer_title_1;
|
||||
}
|
||||
|
||||
@StringRes
|
||||
protected int getFooterTitle2() {
|
||||
return R.string.security_settings_fingerprint_enroll_introduction_footer_title_2;
|
||||
}
|
||||
|
||||
@StringRes
|
||||
protected int getFooterMessage2() {
|
||||
return R.string.security_settings_fingerprint_v2_enroll_introduction_footer_message_2;
|
||||
}
|
||||
|
||||
@StringRes
|
||||
protected int getFooterMessage3() {
|
||||
return R.string.security_settings_fingerprint_v2_enroll_introduction_footer_message_3;
|
||||
}
|
||||
|
||||
@StringRes
|
||||
protected int getFooterMessage4() {
|
||||
return R.string.security_settings_fingerprint_v2_enroll_introduction_footer_message_4;
|
||||
}
|
||||
|
||||
@StringRes
|
||||
protected int getFooterMessage5() {
|
||||
return R.string.security_settings_fingerprint_v2_enroll_introduction_footer_message_5;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isDisabledByAdmin() {
|
||||
return RestrictedLockUtilsInternal.checkIfKeyguardFeaturesDisabled(
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* 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.biometrics.fingerprint;
|
||||
|
||||
import static android.hardware.biometrics.BiometricAuthenticator.TYPE_FINGERPRINT;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.StringRes;
|
||||
|
||||
import com.android.settings.R;
|
||||
|
||||
/**
|
||||
* Displays parental consent information for fingerprint authentication.
|
||||
*
|
||||
* TODO(b/188847063): swap strings for consent screen
|
||||
*/
|
||||
public class FingerprintEnrollParentalConsent extends FingerprintEnrollIntroduction {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setDescriptionText(
|
||||
R.string.security_settings_fingerprint_enroll_introduction_consent_message);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNextButtonClick(View view) {
|
||||
onConsentResult(true /* granted */);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSkipButtonClick(View view) {
|
||||
onConsentResult(false /* granted */);
|
||||
}
|
||||
|
||||
private void onConsentResult(boolean granted) {
|
||||
final Intent result = new Intent();
|
||||
result.putExtra(EXTRA_KEY_MODALITY, TYPE_FINGERPRINT);
|
||||
setResult(granted ? RESULT_CONSENT_GRANTED : RESULT_CONSENT_DENIED, result);
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean onSetOrConfirmCredentials(@Nullable Intent data) {
|
||||
// prevent challenge from being generated by default
|
||||
return true;
|
||||
}
|
||||
|
||||
@StringRes
|
||||
@Override
|
||||
protected int getFooterTitle1() {
|
||||
return R.string.security_settings_fingerprint_enroll_introduction_footer_title_consent_1;
|
||||
}
|
||||
|
||||
@StringRes
|
||||
@Override
|
||||
protected int getFooterMessage2() {
|
||||
return R.string.security_settings_fingerprint_v2_enroll_introduction_footer_message_consent_2;
|
||||
}
|
||||
|
||||
@StringRes
|
||||
@Override
|
||||
protected int getFooterMessage3() {
|
||||
return R.string.security_settings_fingerprint_v2_enroll_introduction_footer_message_consent_3;
|
||||
}
|
||||
|
||||
@StringRes
|
||||
protected int getFooterMessage4() {
|
||||
return R.string.security_settings_fingerprint_v2_enroll_introduction_footer_message_consent_4;
|
||||
}
|
||||
|
||||
@StringRes
|
||||
protected int getFooterMessage5() {
|
||||
return R.string.security_settings_fingerprint_v2_enroll_introduction_footer_message_consent_5;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getHeaderResDefault() {
|
||||
return R.string.security_settings_fingerprint_enroll_consent_introduction_title;
|
||||
}
|
||||
}
|
||||
225
src/com/android/settings/core/CategoryMixin.java
Normal file
225
src/com/android/settings/core/CategoryMixin.java
Normal file
@@ -0,0 +1,225 @@
|
||||
/*
|
||||
* 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.core;
|
||||
|
||||
import static androidx.lifecycle.Lifecycle.Event.ON_PAUSE;
|
||||
import static androidx.lifecycle.Lifecycle.Event.ON_RESUME;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.os.AsyncTask;
|
||||
import android.text.TextUtils;
|
||||
import android.util.ArraySet;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.lifecycle.LifecycleObserver;
|
||||
import androidx.lifecycle.OnLifecycleEvent;
|
||||
|
||||
import com.android.settings.dashboard.CategoryManager;
|
||||
import com.android.settingslib.drawer.Tile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* A mixin that handles live categories for Injection
|
||||
*/
|
||||
public class CategoryMixin implements LifecycleObserver {
|
||||
|
||||
private static final String TAG = "CategoryMixin";
|
||||
private static final String DATA_SCHEME_PKG = "package";
|
||||
|
||||
// Serves as a temporary list of tiles to ignore until we heard back from the PM that they
|
||||
// are disabled.
|
||||
private static final ArraySet<ComponentName> sTileDenylist = new ArraySet<>();
|
||||
|
||||
private final Context mContext;
|
||||
private final PackageReceiver mPackageReceiver = new PackageReceiver();
|
||||
private final List<CategoryListener> mCategoryListeners = new ArrayList<>();
|
||||
private int mCategoriesUpdateTaskCount;
|
||||
|
||||
public CategoryMixin(Context context) {
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resume Lifecycle event
|
||||
*/
|
||||
@OnLifecycleEvent(ON_RESUME)
|
||||
public void onResume() {
|
||||
final IntentFilter filter = new IntentFilter(Intent.ACTION_PACKAGE_ADDED);
|
||||
filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
|
||||
filter.addAction(Intent.ACTION_PACKAGE_CHANGED);
|
||||
filter.addAction(Intent.ACTION_PACKAGE_REPLACED);
|
||||
filter.addDataScheme(DATA_SCHEME_PKG);
|
||||
mContext.registerReceiver(mPackageReceiver, filter);
|
||||
|
||||
updateCategories();
|
||||
}
|
||||
|
||||
/**
|
||||
* Pause Lifecycle event
|
||||
*/
|
||||
@OnLifecycleEvent(ON_PAUSE)
|
||||
public void onPause() {
|
||||
mContext.unregisterReceiver(mPackageReceiver);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a category listener
|
||||
*/
|
||||
public void addCategoryListener(CategoryListener listener) {
|
||||
mCategoryListeners.add(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a category listener
|
||||
*/
|
||||
public void removeCategoryListener(CategoryListener listener) {
|
||||
mCategoryListeners.remove(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates dashboard categories.
|
||||
*/
|
||||
public void updateCategories() {
|
||||
updateCategories(false /* fromBroadcast */);
|
||||
}
|
||||
|
||||
void addToDenylist(ComponentName component) {
|
||||
sTileDenylist.add(component);
|
||||
}
|
||||
|
||||
void removeFromDenylist(ComponentName component) {
|
||||
sTileDenylist.remove(component);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
void onCategoriesChanged(Set<String> categories) {
|
||||
mCategoryListeners.forEach(listener -> listener.onCategoriesChanged(categories));
|
||||
}
|
||||
|
||||
private void updateCategories(boolean fromBroadcast) {
|
||||
// Only allow at most 2 tasks existing at the same time since when the first one is
|
||||
// executing, there may be new data from the second update request.
|
||||
// Ignore the third update request because the second task is still waiting for the first
|
||||
// task to complete in a serial thread, which will get the latest data.
|
||||
if (mCategoriesUpdateTaskCount < 2) {
|
||||
new CategoriesUpdateTask().execute(fromBroadcast);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A handler implementing a {@link CategoryMixin}
|
||||
*/
|
||||
public interface CategoryHandler {
|
||||
/** returns a {@link CategoryMixin} */
|
||||
CategoryMixin getCategoryMixin();
|
||||
}
|
||||
|
||||
/**
|
||||
* A listener receiving category change events.
|
||||
*/
|
||||
public interface CategoryListener {
|
||||
/**
|
||||
* @param categories the changed categories that have to be refreshed, or null to force
|
||||
* refreshing all.
|
||||
*/
|
||||
void onCategoriesChanged(@Nullable Set<String> categories);
|
||||
}
|
||||
|
||||
private class CategoriesUpdateTask extends AsyncTask<Boolean, Void, Set<String>> {
|
||||
|
||||
private final CategoryManager mCategoryManager;
|
||||
private Map<ComponentName, Tile> mPreviousTileMap;
|
||||
|
||||
CategoriesUpdateTask() {
|
||||
mCategoriesUpdateTaskCount++;
|
||||
mCategoryManager = CategoryManager.get(mContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<String> doInBackground(Boolean... params) {
|
||||
mPreviousTileMap = mCategoryManager.getTileByComponentMap();
|
||||
mCategoryManager.reloadAllCategories(mContext);
|
||||
mCategoryManager.updateCategoryFromDenylist(sTileDenylist);
|
||||
return getChangedCategories(params[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Set<String> categories) {
|
||||
if (categories == null || !categories.isEmpty()) {
|
||||
onCategoriesChanged(categories);
|
||||
}
|
||||
mCategoriesUpdateTaskCount--;
|
||||
}
|
||||
|
||||
// Return the changed categories that have to be refreshed, or null to force refreshing all.
|
||||
private Set<String> getChangedCategories(boolean fromBroadcast) {
|
||||
if (!fromBroadcast) {
|
||||
// Always refresh for non-broadcast case.
|
||||
return null;
|
||||
}
|
||||
|
||||
final Set<String> changedCategories = new ArraySet<>();
|
||||
final Map<ComponentName, Tile> currentTileMap =
|
||||
mCategoryManager.getTileByComponentMap();
|
||||
currentTileMap.forEach((component, currentTile) -> {
|
||||
final Tile previousTile = mPreviousTileMap.get(component);
|
||||
// Check if the tile is newly added.
|
||||
if (previousTile == null) {
|
||||
Log.i(TAG, "Tile added: " + component.flattenToShortString());
|
||||
changedCategories.add(currentTile.getCategory());
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the title or summary has changed.
|
||||
if (!TextUtils.equals(currentTile.getTitle(mContext),
|
||||
previousTile.getTitle(mContext))
|
||||
|| !TextUtils.equals(currentTile.getSummary(mContext),
|
||||
previousTile.getSummary(mContext))) {
|
||||
Log.i(TAG, "Tile changed: " + component.flattenToShortString());
|
||||
changedCategories.add(currentTile.getCategory());
|
||||
}
|
||||
});
|
||||
|
||||
// Check if any previous tile is removed.
|
||||
final Set<ComponentName> removal = new ArraySet(mPreviousTileMap.keySet());
|
||||
removal.removeAll(currentTileMap.keySet());
|
||||
removal.forEach(component -> {
|
||||
Log.i(TAG, "Tile removed: " + component.flattenToShortString());
|
||||
changedCategories.add(mPreviousTileMap.get(component).getCategory());
|
||||
});
|
||||
|
||||
return changedCategories;
|
||||
}
|
||||
}
|
||||
|
||||
private class PackageReceiver extends BroadcastReceiver {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
updateCategories(true /* fromBroadcast */);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,21 +16,15 @@
|
||||
package com.android.settings.core;
|
||||
|
||||
import android.annotation.LayoutRes;
|
||||
import android.annotation.Nullable;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.ActivityOptions;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.TypedArray;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.os.UserHandle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.ArraySet;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
@@ -40,14 +34,14 @@ import android.view.Window;
|
||||
import android.widget.Toolbar;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SubSettings;
|
||||
import com.android.settings.Utils;
|
||||
import com.android.settings.dashboard.CategoryManager;
|
||||
import com.android.settings.core.CategoryMixin.CategoryHandler;
|
||||
import com.android.settingslib.core.lifecycle.HideNonSystemOverlayMixin;
|
||||
import com.android.settingslib.drawer.Tile;
|
||||
import com.android.settingslib.transition.SettingsTransitionHelper;
|
||||
import com.android.settingslib.transition.SettingsTransitionHelper.TransitionType;
|
||||
|
||||
@@ -56,12 +50,8 @@ import com.google.android.material.resources.TextAppearanceConfig;
|
||||
import com.google.android.setupcompat.util.WizardManagerHelper;
|
||||
import com.google.android.setupdesign.util.ThemeHelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class SettingsBaseActivity extends FragmentActivity {
|
||||
/** Base activity for Settings pages */
|
||||
public class SettingsBaseActivity extends FragmentActivity implements CategoryHandler {
|
||||
|
||||
/**
|
||||
* What type of page transition should be apply.
|
||||
@@ -70,20 +60,17 @@ public class SettingsBaseActivity extends FragmentActivity {
|
||||
|
||||
protected static final boolean DEBUG_TIMING = false;
|
||||
private static final String TAG = "SettingsBaseActivity";
|
||||
private static final String DATA_SCHEME_PKG = "package";
|
||||
private static final int DEFAULT_REQUEST = -1;
|
||||
|
||||
// Serves as a temporary list of tiles to ignore until we heard back from the PM that they
|
||||
// are disabled.
|
||||
private static ArraySet<ComponentName> sTileDenylist = new ArraySet<>();
|
||||
|
||||
private final PackageReceiver mPackageReceiver = new PackageReceiver();
|
||||
private final List<CategoryListener> mCategoryListeners = new ArrayList<>();
|
||||
|
||||
protected CategoryMixin mCategoryMixin;
|
||||
protected CollapsingToolbarLayout mCollapsingToolbarLayout;
|
||||
private int mCategoriesUpdateTaskCount;
|
||||
private Toolbar mToolbar;
|
||||
|
||||
@Override
|
||||
public CategoryMixin getCategoryMixin() {
|
||||
return mCategoryMixin;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
if (Utils.isPageTransitionEnabled(this)) {
|
||||
@@ -102,6 +89,9 @@ public class SettingsBaseActivity extends FragmentActivity {
|
||||
getLifecycle().addObserver(new HideNonSystemOverlayMixin(this));
|
||||
TextAppearanceConfig.setShouldLoadFontSynchronously(true);
|
||||
|
||||
mCategoryMixin = new CategoryMixin(this);
|
||||
getLifecycle().addObserver(mCategoryMixin);
|
||||
|
||||
final TypedArray theme = getTheme().obtainStyledAttributes(android.R.styleable.Theme);
|
||||
if (!theme.getBoolean(android.R.styleable.Theme_windowNoTitle, false)) {
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
@@ -192,37 +182,15 @@ public class SettingsBaseActivity extends FragmentActivity {
|
||||
userHandle);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
final IntentFilter filter = new IntentFilter(Intent.ACTION_PACKAGE_ADDED);
|
||||
filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
|
||||
filter.addAction(Intent.ACTION_PACKAGE_CHANGED);
|
||||
filter.addAction(Intent.ACTION_PACKAGE_REPLACED);
|
||||
filter.addDataScheme(DATA_SCHEME_PKG);
|
||||
registerReceiver(mPackageReceiver, filter);
|
||||
|
||||
updateCategories();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
// For accessibility activities launched from setup wizard.
|
||||
if (getTransitionType(getIntent()) == TransitionType.TRANSITION_FADE) {
|
||||
overridePendingTransition(R.anim.sud_stay, android.R.anim.fade_out);
|
||||
}
|
||||
unregisterReceiver(mPackageReceiver);
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
public void addCategoryListener(CategoryListener listener) {
|
||||
mCategoryListeners.add(listener);
|
||||
}
|
||||
|
||||
public void remCategoryListener(CategoryListener listener) {
|
||||
mCategoryListeners.remove(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContentView(@LayoutRes int layoutResID) {
|
||||
final ViewGroup parent = findViewById(R.id.content_frame);
|
||||
@@ -270,13 +238,6 @@ public class SettingsBaseActivity extends FragmentActivity {
|
||||
return true;
|
||||
}
|
||||
|
||||
private void onCategoriesChanged(Set<String> categories) {
|
||||
final int N = mCategoryListeners.size();
|
||||
for (int i = 0; i < N; i++) {
|
||||
mCategoryListeners.get(i).onCategoriesChanged(categories);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isLockTaskModePinned() {
|
||||
final ActivityManager activityManager =
|
||||
getApplicationContext().getSystemService(ActivityManager.class);
|
||||
@@ -300,9 +261,9 @@ public class SettingsBaseActivity extends FragmentActivity {
|
||||
boolean isEnabled = state == PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
|
||||
if (isEnabled != enabled || state == PackageManager.COMPONENT_ENABLED_STATE_DEFAULT) {
|
||||
if (enabled) {
|
||||
sTileDenylist.remove(component);
|
||||
mCategoryMixin.removeFromDenylist(component);
|
||||
} else {
|
||||
sTileDenylist.add(component);
|
||||
mCategoryMixin.addToDenylist(component);
|
||||
}
|
||||
pm.setComponentEnabledSetting(component, enabled
|
||||
? PackageManager.COMPONENT_ENABLED_STATE_ENABLED
|
||||
@@ -313,29 +274,12 @@ public class SettingsBaseActivity extends FragmentActivity {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates dashboard categories. Only necessary to call this after setTileEnabled
|
||||
*/
|
||||
public void updateCategories() {
|
||||
updateCategories(false /* fromBroadcast */);
|
||||
}
|
||||
|
||||
private void updateCategories(boolean fromBroadcast) {
|
||||
// Only allow at most 2 tasks existing at the same time since when the first one is
|
||||
// executing, there may be new data from the second update request.
|
||||
// Ignore the third update request because the second task is still waiting for the first
|
||||
// task to complete in a serial thread, which will get the latest data.
|
||||
if (mCategoriesUpdateTaskCount < 2) {
|
||||
new CategoriesUpdateTask().execute(fromBroadcast);
|
||||
}
|
||||
}
|
||||
|
||||
private int getTransitionType(Intent intent) {
|
||||
return intent.getIntExtra(EXTRA_PAGE_TRANSITION_TYPE,
|
||||
SettingsTransitionHelper.TransitionType.TRANSITION_SHARED_AXIS);
|
||||
}
|
||||
|
||||
@androidx.annotation.Nullable
|
||||
@Nullable
|
||||
private Bundle createActivityOptionsBundleForTransition(
|
||||
@androidx.annotation.Nullable Bundle options) {
|
||||
if (mToolbar == null) {
|
||||
@@ -352,87 +296,4 @@ public class SettingsBaseActivity extends FragmentActivity {
|
||||
return mergedOptions;
|
||||
}
|
||||
|
||||
public interface CategoryListener {
|
||||
/**
|
||||
* @param categories the changed categories that have to be refreshed, or null to force
|
||||
* refreshing all.
|
||||
*/
|
||||
void onCategoriesChanged(@Nullable Set<String> categories);
|
||||
}
|
||||
|
||||
private class CategoriesUpdateTask extends AsyncTask<Boolean, Void, Set<String>> {
|
||||
|
||||
private final Context mContext;
|
||||
private final CategoryManager mCategoryManager;
|
||||
private Map<ComponentName, Tile> mPreviousTileMap;
|
||||
|
||||
public CategoriesUpdateTask() {
|
||||
mCategoriesUpdateTaskCount++;
|
||||
mContext = SettingsBaseActivity.this;
|
||||
mCategoryManager = CategoryManager.get(mContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<String> doInBackground(Boolean... params) {
|
||||
mPreviousTileMap = mCategoryManager.getTileByComponentMap();
|
||||
mCategoryManager.reloadAllCategories(mContext);
|
||||
mCategoryManager.updateCategoryFromDenylist(sTileDenylist);
|
||||
return getChangedCategories(params[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Set<String> categories) {
|
||||
if (categories == null || !categories.isEmpty()) {
|
||||
onCategoriesChanged(categories);
|
||||
}
|
||||
mCategoriesUpdateTaskCount--;
|
||||
}
|
||||
|
||||
// Return the changed categories that have to be refreshed, or null to force refreshing all.
|
||||
private Set<String> getChangedCategories(boolean fromBroadcast) {
|
||||
if (!fromBroadcast) {
|
||||
// Always refresh for non-broadcast case.
|
||||
return null;
|
||||
}
|
||||
|
||||
final Set<String> changedCategories = new ArraySet<>();
|
||||
final Map<ComponentName, Tile> currentTileMap =
|
||||
mCategoryManager.getTileByComponentMap();
|
||||
currentTileMap.forEach((component, currentTile) -> {
|
||||
final Tile previousTile = mPreviousTileMap.get(component);
|
||||
// Check if the tile is newly added.
|
||||
if (previousTile == null) {
|
||||
Log.i(TAG, "Tile added: " + component.flattenToShortString());
|
||||
changedCategories.add(currentTile.getCategory());
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the title or summary has changed.
|
||||
if (!TextUtils.equals(currentTile.getTitle(mContext),
|
||||
previousTile.getTitle(mContext))
|
||||
|| !TextUtils.equals(currentTile.getSummary(mContext),
|
||||
previousTile.getSummary(mContext))) {
|
||||
Log.i(TAG, "Tile changed: " + component.flattenToShortString());
|
||||
changedCategories.add(currentTile.getCategory());
|
||||
}
|
||||
});
|
||||
|
||||
// Check if any previous tile is removed.
|
||||
final Set<ComponentName> removal = new ArraySet(mPreviousTileMap.keySet());
|
||||
removal.removeAll(currentTileMap.keySet());
|
||||
removal.forEach(component -> {
|
||||
Log.i(TAG, "Tile removed: " + component.flattenToShortString());
|
||||
changedCategories.add(mPreviousTileMap.get(component).getCategory());
|
||||
});
|
||||
|
||||
return changedCategories;
|
||||
}
|
||||
}
|
||||
|
||||
private class PackageReceiver extends BroadcastReceiver {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
updateCategories(true /* fromBroadcast */);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.android.settings.SettingsActivity;
|
||||
import com.android.settings.SubSettings;
|
||||
import com.android.settings.Utils;
|
||||
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
|
||||
import com.android.settingslib.transition.SettingsTransitionHelper.TransitionType;
|
||||
|
||||
@@ -182,10 +181,6 @@ public class SubSettingLauncher {
|
||||
|
||||
@VisibleForTesting
|
||||
void launchAsUser(Intent intent, UserHandle userHandle) {
|
||||
if (!Utils.isPageTransitionEnabled(mContext)) {
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
}
|
||||
mContext.startActivityAsUser(intent, userHandle);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,8 +35,9 @@ import androidx.preference.SwitchPreference;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SettingsPreferenceFragment;
|
||||
import com.android.settings.core.BasePreferenceController;
|
||||
import com.android.settings.core.CategoryMixin.CategoryHandler;
|
||||
import com.android.settings.core.CategoryMixin.CategoryListener;
|
||||
import com.android.settings.core.PreferenceControllerListHelper;
|
||||
import com.android.settings.core.SettingsBaseActivity;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
import com.android.settings.widget.PrimarySwitchPreference;
|
||||
import com.android.settingslib.core.AbstractPreferenceController;
|
||||
@@ -61,8 +62,7 @@ import java.util.concurrent.ExecutionException;
|
||||
* Base fragment for dashboard style UI containing a list of static and dynamic setting items.
|
||||
*/
|
||||
public abstract class DashboardFragment extends SettingsPreferenceFragment
|
||||
implements SettingsBaseActivity.CategoryListener, Indexable,
|
||||
PreferenceGroup.OnExpandButtonClickListener,
|
||||
implements CategoryListener, Indexable, PreferenceGroup.OnExpandButtonClickListener,
|
||||
BasePreferenceController.UiBlockListener {
|
||||
public static final String CATEGORY = "category";
|
||||
private static final String TAG = "DashboardFragment";
|
||||
@@ -198,9 +198,9 @@ public abstract class DashboardFragment extends SettingsPreferenceFragment
|
||||
return;
|
||||
}
|
||||
final Activity activity = getActivity();
|
||||
if (activity instanceof SettingsBaseActivity) {
|
||||
if (activity instanceof CategoryHandler) {
|
||||
mListeningToCategoryChange = true;
|
||||
((SettingsBaseActivity) activity).addCategoryListener(this);
|
||||
((CategoryHandler) activity).getCategoryMixin().addCategoryListener(this);
|
||||
}
|
||||
final ContentResolver resolver = getContentResolver();
|
||||
mDashboardTilePrefKeys.values().stream()
|
||||
@@ -243,8 +243,8 @@ public abstract class DashboardFragment extends SettingsPreferenceFragment
|
||||
unregisterDynamicDataObservers(new ArrayList<>(mRegisteredObservers));
|
||||
if (mListeningToCategoryChange) {
|
||||
final Activity activity = getActivity();
|
||||
if (activity instanceof SettingsBaseActivity) {
|
||||
((SettingsBaseActivity) activity).remCategoryListener(this);
|
||||
if (activity instanceof CategoryHandler) {
|
||||
((CategoryHandler) activity).getCategoryMixin().removeCategoryListener(this);
|
||||
}
|
||||
mListeningToCategoryChange = false;
|
||||
}
|
||||
|
||||
@@ -39,10 +39,8 @@ import androidx.loader.content.Loader;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.Preference.OnPreferenceChangeListener;
|
||||
import androidx.preference.PreferenceCategory;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.Utils;
|
||||
import com.android.settings.applications.AppInfoBase;
|
||||
import com.android.settings.widget.EntityHeaderController;
|
||||
import com.android.settingslib.AppItem;
|
||||
@@ -223,14 +221,6 @@ public class AppDataUsage extends DataUsageBaseFragment implements OnPreferenceC
|
||||
}
|
||||
LoaderManager.getInstance(this).restartLoader(LOADER_APP_USAGE_DATA, null /* args */,
|
||||
mUidDataCallbacks);
|
||||
|
||||
if (Utils.isPageTransitionEnabled(mContext)) {
|
||||
final RecyclerView recyclerView = getListView();
|
||||
if (recyclerView != null) {
|
||||
recyclerView.setItemAnimator(null);
|
||||
}
|
||||
}
|
||||
|
||||
updatePrefs();
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,8 @@ import android.widget.LinearLayout;
|
||||
import android.widget.SearchView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
@@ -95,6 +97,7 @@ public abstract class BaseTimeZonePicker extends InstrumentedFragment
|
||||
LinearLayoutManager.VERTICAL, /* reverseLayout */ false));
|
||||
mRecyclerView.setAdapter(mAdapter);
|
||||
mAppBarLayout = getActivity().findViewById(R.id.app_bar);
|
||||
disableToolBarScrollableBehavior();
|
||||
|
||||
// Initialize TimeZoneDataLoader only when mRecyclerView is ready to avoid race
|
||||
// during onDateLoaderReady callback.
|
||||
@@ -160,13 +163,15 @@ public abstract class BaseTimeZonePicker extends InstrumentedFragment
|
||||
public boolean onMenuItemActionExpand(MenuItem item) {
|
||||
// To prevent a large space on tool bar.
|
||||
mAppBarLayout.setExpanded(false /*expanded*/, false /*animate*/);
|
||||
// To prevent user can expand the collpasing tool bar view.
|
||||
// To prevent user can expand the collapsing tool bar view.
|
||||
ViewCompat.setNestedScrollingEnabled(mRecyclerView, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMenuItemActionCollapse(MenuItem item) {
|
||||
// We keep the collapsed status after user cancel the search function.
|
||||
mAppBarLayout.setExpanded(false /*expanded*/, false /*animate*/);
|
||||
ViewCompat.setNestedScrollingEnabled(mRecyclerView, true);
|
||||
return true;
|
||||
}
|
||||
@@ -188,4 +193,17 @@ public abstract class BaseTimeZonePicker extends InstrumentedFragment
|
||||
void onListItemClick(T item);
|
||||
}
|
||||
|
||||
private void disableToolBarScrollableBehavior() {
|
||||
CoordinatorLayout.LayoutParams params =
|
||||
(CoordinatorLayout.LayoutParams) mAppBarLayout.getLayoutParams();
|
||||
AppBarLayout.Behavior behavior = new AppBarLayout.Behavior();
|
||||
behavior.setDragCallback(
|
||||
new AppBarLayout.Behavior.DragCallback() {
|
||||
@Override
|
||||
public boolean canDrag(@NonNull AppBarLayout appBarLayout) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
params.setBehavior(behavior);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ public class StorageAsyncLoader
|
||||
UserHandle.of(userId));
|
||||
} catch (NameNotFoundException e) {
|
||||
Log.e(TAG, "Not able to get Context for user ID " + userId);
|
||||
return 0;
|
||||
return 0L;
|
||||
}
|
||||
|
||||
try (Cursor cursor = perUserContext.getContentResolver().query(
|
||||
@@ -131,9 +131,9 @@ public class StorageAsyncLoader
|
||||
queryArgs,
|
||||
null /* cancellationSignal */)) {
|
||||
if (cursor == null) {
|
||||
return 0;
|
||||
return 0L;
|
||||
}
|
||||
return cursor.moveToFirst() ? cursor.getInt(0) : 0;
|
||||
return cursor.moveToFirst() ? cursor.getLong(0) : 0L;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,12 +34,15 @@ import androidx.fragment.app.FragmentTransaction;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.accounts.AvatarViewMixin;
|
||||
import com.android.settings.core.CategoryMixin;
|
||||
import com.android.settings.core.FeatureFlags;
|
||||
import com.android.settings.homepage.contextualcards.ContextualCardsFragment;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
import com.android.settingslib.core.lifecycle.HideNonSystemOverlayMixin;
|
||||
|
||||
public class SettingsHomepageActivity extends FragmentActivity {
|
||||
/** Settings homepage activity */
|
||||
public class SettingsHomepageActivity extends FragmentActivity implements
|
||||
CategoryMixin.CategoryHandler {
|
||||
|
||||
private static final String TAG = "SettingsHomepageActivity";
|
||||
|
||||
@@ -47,6 +50,12 @@ public class SettingsHomepageActivity extends FragmentActivity {
|
||||
|
||||
private View mHomepageView;
|
||||
private View mSuggestionView;
|
||||
private CategoryMixin mCategoryMixin;
|
||||
|
||||
@Override
|
||||
public CategoryMixin getCategoryMixin() {
|
||||
return mCategoryMixin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the homepage and shows/hides the suggestion together. Only allows to be executed once
|
||||
@@ -76,6 +85,8 @@ public class SettingsHomepageActivity extends FragmentActivity {
|
||||
.initSearchToolbar(this /* activity */, toolbar, SettingsEnums.SETTINGS_HOMEPAGE);
|
||||
|
||||
getLifecycle().addObserver(new HideNonSystemOverlayMixin(this));
|
||||
mCategoryMixin = new CategoryMixin(this);
|
||||
getLifecycle().addObserver(mCategoryMixin);
|
||||
|
||||
if (!getSystemService(ActivityManager.class).isLowRamDevice()) {
|
||||
// Only allow features on high ram devices.
|
||||
|
||||
@@ -267,9 +267,8 @@ public class NetworkProviderSettings extends RestrictedSettingsFragment
|
||||
if (mWifiManager != null) {
|
||||
setLoading(true, false);
|
||||
mIsViewLoading = true;
|
||||
if (!mWifiManager.isWifiEnabled()) {
|
||||
getView().postDelayed(mRemoveLoadingRunnable, 100);
|
||||
}
|
||||
getView().postDelayed(mRemoveLoadingRunnable,
|
||||
mWifiManager.isWifiEnabled() ? 1000 : 100);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,16 +22,20 @@ import static android.app.slice.Slice.EXTRA_TOGGLE_STATE;
|
||||
import static com.android.settings.slices.CustomSliceRegistry.PROVIDER_MODEL_SLICE_URI;
|
||||
|
||||
import android.annotation.ColorInt;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.AlertDialog.Builder;
|
||||
import android.app.PendingIntent;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.telephony.SubscriptionManager;
|
||||
import android.util.Log;
|
||||
import android.view.WindowManager.LayoutParams;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.core.graphics.drawable.IconCompat;
|
||||
@@ -64,12 +68,16 @@ import java.util.stream.Collectors;
|
||||
public class ProviderModelSlice extends WifiSlice {
|
||||
|
||||
private static final String TAG = "ProviderModelSlice";
|
||||
protected static final String PREF_NAME = "ProviderModelSlice";
|
||||
protected static final String PREF_HAS_TURNED_OFF_MOBILE_DATA = "PrefHasTurnedOffMobileData";
|
||||
|
||||
private final ProviderModelSliceHelper mHelper;
|
||||
private final SharedPreferences mSharedPref;
|
||||
|
||||
public ProviderModelSlice(Context context) {
|
||||
super(context);
|
||||
mHelper = getHelper();
|
||||
mSharedPref = getSharedPreference();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -194,10 +202,21 @@ public class ProviderModelSlice extends WifiSlice {
|
||||
boolean isToggleAction = intent.hasExtra(EXTRA_TOGGLE_STATE);
|
||||
boolean newState = intent.getBooleanExtra(EXTRA_TOGGLE_STATE,
|
||||
mHelper.isMobileDataEnabled());
|
||||
|
||||
if (isToggleAction) {
|
||||
// The ToggleAction is used to set mobile data enabled.
|
||||
MobileNetworkUtils.setMobileDataEnabled(mContext, defaultSubId, newState,
|
||||
false /* disableOtherSubscriptions */);
|
||||
if (!newState && mSharedPref != null
|
||||
&& mSharedPref.getBoolean(PREF_HAS_TURNED_OFF_MOBILE_DATA, true)) {
|
||||
String carrierName = mHelper.getMobileTitle();
|
||||
if (carrierName.equals(mContext.getString(R.string.mobile_data_settings_title))) {
|
||||
carrierName = mContext.getString(
|
||||
R.string.mobile_data_disable_message_default_carrier);
|
||||
}
|
||||
showMobileDataDisableDialog(getMobileDataDisableDialog(defaultSubId, carrierName));
|
||||
} else {
|
||||
MobileNetworkUtils.setMobileDataEnabled(mContext, defaultSubId, newState,
|
||||
false /* disableOtherSubscriptions */);
|
||||
}
|
||||
}
|
||||
|
||||
final boolean isDataEnabled =
|
||||
@@ -205,6 +224,38 @@ public class ProviderModelSlice extends WifiSlice {
|
||||
doCarrierNetworkAction(isToggleAction, isDataEnabled, defaultSubId);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
AlertDialog getMobileDataDisableDialog(int defaultSubId, String carrierName) {
|
||||
return new Builder(mContext)
|
||||
.setTitle(R.string.mobile_data_disable_title)
|
||||
.setMessage(mContext.getString(R.string.mobile_data_disable_message,
|
||||
carrierName))
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.setPositiveButton(
|
||||
com.android.internal.R.string.alert_windows_notification_turn_off_action,
|
||||
(dialog, which) -> {
|
||||
MobileNetworkUtils.setMobileDataEnabled(mContext, defaultSubId,
|
||||
false /* enabled */,
|
||||
false /* disableOtherSubscriptions */);
|
||||
if (mSharedPref != null) {
|
||||
SharedPreferences.Editor editor = mSharedPref.edit();
|
||||
editor.putBoolean(PREF_HAS_TURNED_OFF_MOBILE_DATA, false);
|
||||
editor.apply();
|
||||
}
|
||||
})
|
||||
.create();
|
||||
}
|
||||
|
||||
private void showMobileDataDisableDialog(AlertDialog dialog) {
|
||||
if (dialog == null) {
|
||||
log("AlertDialog is null");
|
||||
return;
|
||||
}
|
||||
|
||||
dialog.getWindow().setType(LayoutParams.TYPE_KEYGUARD_DIALOG);
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
void doCarrierNetworkAction(boolean isToggleAction, boolean isDataEnabled, int subId) {
|
||||
final NetworkProviderWorker worker = getWorker();
|
||||
@@ -247,6 +298,11 @@ public class ProviderModelSlice extends WifiSlice {
|
||||
return SliceBackgroundWorker.getInstance(getUri());
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
SharedPreferences getSharedPreference() {
|
||||
return mContext.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);
|
||||
}
|
||||
|
||||
private @InternetUpdater.InternetType int getInternetType() {
|
||||
final NetworkProviderWorker worker = getWorker();
|
||||
if (worker == null) {
|
||||
|
||||
@@ -264,7 +264,7 @@ public class ProviderModelSliceHelper {
|
||||
return summary;
|
||||
}
|
||||
|
||||
private String getMobileTitle() {
|
||||
protected String getMobileTitle() {
|
||||
String title = mContext.getText(R.string.mobile_data_settings_title).toString();
|
||||
if (mSubscriptionManager == null) {
|
||||
return title;
|
||||
|
||||
@@ -25,11 +25,9 @@ import android.util.Log;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceGroup;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.android.internal.widget.LockPatternUtils;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.Utils;
|
||||
import com.android.settingslib.core.AbstractPreferenceController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -80,13 +78,6 @@ public class AppNotificationSettings extends NotificationSettings {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Utils.isPageTransitionEnabled(mContext)) {
|
||||
final RecyclerView recyclerView = getListView();
|
||||
if (recyclerView != null) {
|
||||
recyclerView.setItemAnimator(null);
|
||||
}
|
||||
}
|
||||
|
||||
for (NotificationPreferenceController controller : mControllers) {
|
||||
controller.onResume(mAppRow, mChannel, mChannelGroup, null, null, mSuspendedAppsAdmin,
|
||||
null);
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.android.settings.sim;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.icu.text.MessageFormat;
|
||||
import android.os.Bundle;
|
||||
import android.telephony.SubscriptionInfo;
|
||||
import android.telephony.SubscriptionManager;
|
||||
@@ -43,7 +44,10 @@ import com.google.android.setupdesign.items.ItemGroup;
|
||||
import com.google.android.setupdesign.items.RecyclerItemAdapter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
/** Activity to show a list of profiles for user to choose. */
|
||||
public class ChooseSimActivity extends Activity
|
||||
@@ -108,7 +112,12 @@ public class ChooseSimActivity extends Activity
|
||||
subscriptionCount++;
|
||||
}
|
||||
layout.setHeaderText(getString(R.string.choose_sim_title));
|
||||
layout.setDescriptionText(getString(R.string.choose_sim_text, subscriptionCount));
|
||||
MessageFormat msgFormat = new MessageFormat(
|
||||
getString(R.string.choose_sim_text),
|
||||
Locale.getDefault());
|
||||
Map<String, Object> arguments = new HashMap<>();
|
||||
arguments.put("count", subscriptionCount);
|
||||
layout.setDescriptionText(msgFormat.format(arguments));
|
||||
|
||||
displaySubscriptions();
|
||||
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
* 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.core;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.anySet;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.os.Bundle;
|
||||
import android.util.ArraySet;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.android.settings.core.CategoryMixin.CategoryListener;
|
||||
import com.android.settingslib.R;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.robolectric.Robolectric;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
import org.robolectric.android.controller.ActivityController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class CategoryMixinTest {
|
||||
private ActivityController<TestActivity> mActivityController;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
mActivityController = Robolectric.buildActivity(TestActivity.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resumeActivity_shouldRegisterReceiver() {
|
||||
mActivityController.setup();
|
||||
|
||||
final TestActivity activity = mActivityController.get();
|
||||
assertThat(activity.getRegisteredReceivers()).isNotEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void pauseActivity_shouldUnregisterReceiver() {
|
||||
mActivityController.setup().pause();
|
||||
|
||||
final TestActivity activity = mActivityController.get();
|
||||
assertThat(activity.getRegisteredReceivers()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onCategoriesChanged_listenerAdded_shouldNotifyChanged() {
|
||||
mActivityController.setup().pause();
|
||||
final CategoryMixin categoryMixin = mActivityController.get().getCategoryMixin();
|
||||
final CategoryListener listener = mock(CategoryListener.class);
|
||||
categoryMixin.addCategoryListener(listener);
|
||||
|
||||
categoryMixin.onCategoriesChanged(new ArraySet<>());
|
||||
|
||||
verify(listener).onCategoriesChanged(anySet());
|
||||
}
|
||||
|
||||
static class TestActivity extends AppCompatActivity implements CategoryMixin.CategoryHandler {
|
||||
|
||||
private CategoryMixin mCategoryMixin;
|
||||
private List<BroadcastReceiver> mRegisteredReceivers = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setTheme(R.style.Theme_AppCompat);
|
||||
mCategoryMixin = new CategoryMixin(this);
|
||||
getLifecycle().addObserver(mCategoryMixin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CategoryMixin getCategoryMixin() {
|
||||
return mCategoryMixin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Intent registerReceiver(BroadcastReceiver receiver, IntentFilter filter) {
|
||||
mRegisteredReceivers.add(receiver);
|
||||
return super.registerReceiver(receiver, filter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterReceiver(BroadcastReceiver receiver) {
|
||||
mRegisteredReceivers.remove(receiver);
|
||||
super.unregisterReceiver(receiver);
|
||||
}
|
||||
|
||||
List<BroadcastReceiver> getRegisteredReceivers() {
|
||||
return mRegisteredReceivers;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,224 @@
|
||||
/*
|
||||
* 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.biometrics;
|
||||
|
||||
import static android.hardware.biometrics.BiometricAuthenticator.TYPE_FACE;
|
||||
import static android.hardware.biometrics.BiometricAuthenticator.TYPE_FINGERPRINT;
|
||||
import static android.hardware.biometrics.BiometricAuthenticator.TYPE_NONE;
|
||||
|
||||
import static com.android.settings.biometrics.BiometricEnrollBase.EXTRA_KEY_MODALITY;
|
||||
import static com.android.settings.biometrics.BiometricEnrollBase.RESULT_CONSENT_DENIED;
|
||||
import static com.android.settings.biometrics.BiometricEnrollBase.RESULT_CONSENT_GRANTED;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyBoolean;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.hardware.biometrics.BiometricAuthenticator;
|
||||
import android.util.Pair;
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
|
||||
import com.android.settings.biometrics.face.FaceEnrollParentalConsent;
|
||||
import com.android.settings.biometrics.fingerprint.FingerprintEnrollParentalConsent;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Captor;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.MockitoJUnit;
|
||||
import org.mockito.junit.MockitoRule;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ParentalConsentHelperTest {
|
||||
|
||||
private static final int REQUEST_CODE = 12;
|
||||
|
||||
@Rule
|
||||
public final MockitoRule mMocks = MockitoJUnit.rule();
|
||||
|
||||
@Mock
|
||||
private Activity mRootActivity;
|
||||
@Mock
|
||||
private Intent mRootActivityIntent;
|
||||
@Captor
|
||||
ArgumentCaptor<Intent> mLastStarted;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
when(mRootActivity.getIntent()).thenAnswer(invocation -> mRootActivityIntent);
|
||||
when(mRootActivityIntent.getBundleExtra(any())).thenAnswer(invocation -> null);
|
||||
when(mRootActivityIntent.getStringExtra(any())).thenAnswer(invocation -> null);
|
||||
when(mRootActivityIntent.getBooleanExtra(any(), anyBoolean()))
|
||||
.thenAnswer(invocation -> invocation.getArguments()[1]);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLaunchNext_face_and_fingerprint_all_consent() {
|
||||
testLaunchNext(
|
||||
true /* requireFace */, true /* grantFace */,
|
||||
true /* requireFingerprint */, true /* grantFace */,
|
||||
90 /* gkpw */);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLaunchNext_nothing_to_consent() {
|
||||
testLaunchNext(
|
||||
false /* requireFace */, false /* grantFace */,
|
||||
false /* requireFingerprint */, false /* grantFace */,
|
||||
80 /* gkpw */);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLaunchNext_face_and_fingerprint_no_consent() {
|
||||
testLaunchNext(
|
||||
true /* requireFace */, false /* grantFace */,
|
||||
true /* requireFingerprint */, false /* grantFace */,
|
||||
70 /* gkpw */);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLaunchNext_face_and_fingerprint_only_face_consent() {
|
||||
testLaunchNext(
|
||||
true /* requireFace */, true /* grantFace */,
|
||||
true /* requireFingerprint */, false /* grantFace */,
|
||||
60 /* gkpw */);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLaunchNext_face_and_fingerprint_only_fingerprint_consent() {
|
||||
testLaunchNext(
|
||||
true /* requireFace */, false /* grantFace */,
|
||||
true /* requireFingerprint */, true /* grantFace */,
|
||||
50 /* gkpw */);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLaunchNext_face_with_consent() {
|
||||
testLaunchNext(
|
||||
true /* requireFace */, true /* grantFace */,
|
||||
false /* requireFingerprint */, false /* grantFace */,
|
||||
40 /* gkpw */);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLaunchNext_face_without_consent() {
|
||||
testLaunchNext(
|
||||
true /* requireFace */, false /* grantFace */,
|
||||
false /* requireFingerprint */, false /* grantFace */,
|
||||
30 /* gkpw */);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLaunchNext_fingerprint_with_consent() {
|
||||
testLaunchNext(
|
||||
false /* requireFace */, false /* grantFace */,
|
||||
true /* requireFingerprint */, true /* grantFace */,
|
||||
20 /* gkpw */);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLaunchNext_fingerprint_without_consent() {
|
||||
testLaunchNext(
|
||||
false /* requireFace */, false /* grantFace */,
|
||||
true /* requireFingerprint */, false /* grantFace */,
|
||||
10 /* gkpw */);
|
||||
}
|
||||
|
||||
private void testLaunchNext(
|
||||
boolean requireFace, boolean grantFace,
|
||||
boolean requireFingerprint, boolean grantFingerprint,
|
||||
long gkpw) {
|
||||
final List<Pair<String, Boolean>> expectedLaunches = new ArrayList<>();
|
||||
if (requireFace) {
|
||||
expectedLaunches.add(new Pair(FaceEnrollParentalConsent.class.getName(), grantFace));
|
||||
}
|
||||
if (requireFingerprint) {
|
||||
expectedLaunches.add(
|
||||
new Pair(FingerprintEnrollParentalConsent.class.getName(), grantFingerprint));
|
||||
}
|
||||
|
||||
// initial consent status
|
||||
final ParentalConsentHelper helper =
|
||||
new ParentalConsentHelper(requireFace, requireFingerprint, gkpw);
|
||||
assertThat(ParentalConsentHelper.hasFaceConsent(helper.getConsentResult()))
|
||||
.isFalse();
|
||||
assertThat(ParentalConsentHelper.hasFingerprintConsent(helper.getConsentResult()))
|
||||
.isFalse();
|
||||
|
||||
// check expected launches
|
||||
for (int i = 0; i <= expectedLaunches.size(); i++) {
|
||||
final Pair<String, Boolean> expected = i > 0 ? expectedLaunches.get(i - 1) : null;
|
||||
final boolean launchedNext = i == 0
|
||||
? helper.launchNext(mRootActivity, REQUEST_CODE)
|
||||
: helper.launchNext(mRootActivity, REQUEST_CODE,
|
||||
expected.second ? RESULT_CONSENT_GRANTED : RESULT_CONSENT_DENIED,
|
||||
getResultIntent(getStartedModality(expected.first)));
|
||||
assertThat(launchedNext).isEqualTo(i < expectedLaunches.size());
|
||||
}
|
||||
verify(mRootActivity, times(expectedLaunches.size()))
|
||||
.startActivityForResult(mLastStarted.capture(), eq(REQUEST_CODE));
|
||||
assertThat(mLastStarted.getAllValues()
|
||||
.stream().map(i -> i.getComponent().getClassName()).collect(Collectors.toList()))
|
||||
.containsExactlyElementsIn(
|
||||
expectedLaunches.stream().map(i -> i.first).collect(Collectors.toList()))
|
||||
.inOrder();
|
||||
if (!expectedLaunches.isEmpty()) {
|
||||
assertThat(mLastStarted.getAllValues()
|
||||
.stream().map(BiometricUtils::getGatekeeperPasswordHandle).distinct()
|
||||
.collect(Collectors.toList()))
|
||||
.containsExactly(gkpw);
|
||||
}
|
||||
|
||||
// final consent status
|
||||
assertThat(ParentalConsentHelper.hasFaceConsent(helper.getConsentResult()))
|
||||
.isEqualTo(requireFace && grantFace);
|
||||
assertThat(ParentalConsentHelper.hasFingerprintConsent(helper.getConsentResult()))
|
||||
.isEqualTo(requireFingerprint && grantFingerprint);
|
||||
}
|
||||
|
||||
private static Intent getResultIntent(@BiometricAuthenticator.Modality int modality) {
|
||||
final Intent intent = new Intent();
|
||||
intent.putExtra(EXTRA_KEY_MODALITY, modality);
|
||||
return intent;
|
||||
}
|
||||
|
||||
@BiometricAuthenticator.Modality
|
||||
private static int getStartedModality(String name) {
|
||||
if (name.equals(FaceEnrollParentalConsent.class.getName())) {
|
||||
return TYPE_FACE;
|
||||
}
|
||||
if (name.equals(FingerprintEnrollParentalConsent.class.getName())) {
|
||||
return TYPE_FINGERPRINT;
|
||||
}
|
||||
return TYPE_NONE;
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,10 @@
|
||||
|
||||
package com.android.settings.network;
|
||||
|
||||
import static android.app.slice.Slice.EXTRA_TOGGLE_STATE;
|
||||
|
||||
import static com.android.settings.network.ProviderModelSlice.PREF_HAS_TURNED_OFF_MOBILE_DATA;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
@@ -28,9 +32,11 @@ import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.net.ConnectivityManager;
|
||||
@@ -100,6 +106,7 @@ public class ProviderModelSliceTest {
|
||||
WifiPickerTracker mWifiPickerTracker;
|
||||
@Mock
|
||||
WifiSliceItem mWifiSliceItem;
|
||||
AlertDialog mMockAlertDialog;
|
||||
|
||||
private FakeFeatureFactory mFeatureFactory;
|
||||
|
||||
@@ -128,6 +135,11 @@ public class ProviderModelSliceTest {
|
||||
PROVIDER_MODEL_SLICE_URI));
|
||||
mMockProviderModelSlice = spy(new MockProviderModelSlice(
|
||||
mContext, mMockNetworkProviderWorker));
|
||||
mMockAlertDialog = new AlertDialog.Builder(mContext)
|
||||
.setTitle("")
|
||||
.create();
|
||||
mMockAlertDialog = spy(mMockAlertDialog);
|
||||
mMockProviderModelSlice.setMobileDataDisableDialog(mMockAlertDialog);
|
||||
mListBuilder = spy(new ListBuilder(mContext, PROVIDER_MODEL_SLICE_URI,
|
||||
ListBuilder.INFINITY).setAccentColor(-1));
|
||||
when(mProviderModelSliceHelper.createListBuilder(PROVIDER_MODEL_SLICE_URI)).thenReturn(
|
||||
@@ -350,6 +362,7 @@ public class ProviderModelSliceTest {
|
||||
private MockNetworkProviderWorker mNetworkProviderWorker;
|
||||
private boolean mHasCreateEthernetRow;
|
||||
private boolean mHasSeeAllRow;
|
||||
private AlertDialog mAlertDialog;
|
||||
|
||||
MockProviderModelSlice(Context context, MockNetworkProviderWorker networkProviderWorker) {
|
||||
super(context);
|
||||
@@ -366,6 +379,11 @@ public class ProviderModelSliceTest {
|
||||
return mNetworkProviderWorker;
|
||||
}
|
||||
|
||||
@Override
|
||||
AlertDialog getMobileDataDisableDialog(int defaultSubId, String carrierName) {
|
||||
return mAlertDialog;
|
||||
}
|
||||
|
||||
@Override
|
||||
ListBuilder.RowBuilder createEthernetRow() {
|
||||
mHasCreateEthernetRow = true;
|
||||
@@ -385,6 +403,64 @@ public class ProviderModelSliceTest {
|
||||
public boolean hasSeeAllRow() {
|
||||
return mHasSeeAllRow;
|
||||
}
|
||||
|
||||
public void setMobileDataDisableDialog(AlertDialog alertDialog) {
|
||||
mAlertDialog = alertDialog;
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThreadTest
|
||||
public void onNotifyChange_FirstTimeDisableToggleState_showDialog() {
|
||||
final Intent intent = new Intent();
|
||||
intent.putExtra(EXTRA_TOGGLE_STATE, false);
|
||||
SharedPreferences sharedPref = mMockProviderModelSlice.getSharedPreference();
|
||||
when(mProviderModelSliceHelper.getMobileTitle()).thenReturn("mockRow");
|
||||
if (sharedPref != null) {
|
||||
SharedPreferences.Editor editor = sharedPref.edit();
|
||||
editor.putBoolean(PREF_HAS_TURNED_OFF_MOBILE_DATA, true);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
mMockProviderModelSlice.onNotifyChange(intent);
|
||||
|
||||
verify(mMockAlertDialog).show();
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThreadTest
|
||||
public void onNotifyChange_EnableToggleState_doNotShowDialog() {
|
||||
final Intent intent = new Intent();
|
||||
intent.putExtra(EXTRA_TOGGLE_STATE, true);
|
||||
SharedPreferences sharedPref = mMockProviderModelSlice.getSharedPreference();
|
||||
when(mProviderModelSliceHelper.getMobileTitle()).thenReturn("mockRow");
|
||||
if (sharedPref != null) {
|
||||
SharedPreferences.Editor editor = sharedPref.edit();
|
||||
editor.putBoolean(PREF_HAS_TURNED_OFF_MOBILE_DATA, true);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
mMockProviderModelSlice.onNotifyChange(intent);
|
||||
|
||||
verify(mMockAlertDialog, never()).show();
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThreadTest
|
||||
public void onNotifyChange_notFirstTimeDisableToggleState_doNotShowDialog() {
|
||||
final Intent intent = new Intent();
|
||||
intent.putExtra(EXTRA_TOGGLE_STATE, false);
|
||||
SharedPreferences sharedPref = mMockProviderModelSlice.getSharedPreference();
|
||||
when(mProviderModelSliceHelper.getMobileTitle()).thenReturn("mockRow");
|
||||
if (sharedPref != null) {
|
||||
SharedPreferences.Editor editor = sharedPref.edit();
|
||||
editor.putBoolean(PREF_HAS_TURNED_OFF_MOBILE_DATA, false);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
mMockProviderModelSlice.onNotifyChange(intent);
|
||||
|
||||
verify(mMockAlertDialog, never()).show();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user