Apply top intro preference for face settings page

Do a few things in this cl
- Use correct way to work with controller.
- Refactor xml file.
- Separate content of footer to two parts.
  - First paragraph should become top intro.
  - Rest should keep in footer.

Test: Build apk and see the screen
Bug: 173087905
Change-Id: Icb16dedf6b36542b833527471579aaadb5407d87
Screenshot: https://screenshot.googleplex.com/92Jx6zKyTZU8LJa.png
This commit is contained in:
Tsung-Mao Fang
2020-11-16 18:34:21 +08:00
parent 564eaec283
commit ae7f264fa2
4 changed files with 22 additions and 21 deletions

View File

@@ -844,9 +844,11 @@
<!-- Button text in face settings which lets the user enroll their face [CHAR LIMIT=40] -->
<string name="security_settings_face_settings_enroll">Set up face unlock</string>
<!-- Text shown in face settings explaining what your face can be used for. [CHAR LIMIT=NONE] -->
<string name="security_settings_face_settings_footer">Use face unlock to unlock your device, sign in to apps, and confirm payments.\n\nKeep in mind:\nLooking at the phone can unlock it when you don\u2019t intend to.\n\nYour phone can be unlocked by someone else if it\u2019s held up to your face.\n\nYour phone can be unlocked by someone who looks a lot like you, say, an identical sibling.</string>
<string name="security_settings_face_settings_top_intro">Use face unlock to unlock your device, sign in to apps, and confirm payments.</string>
<!-- Text shown in face settings explaining what your face can be used for. [CHAR LIMIT=NONE] -->
<string name="security_settings_face_settings_footer">Keep in mind:\nLooking at the phone can unlock it when you don\u2019t intend to.\n\nYour phone can be unlocked by someone else if it\u2019s held up to your face.\n\nYour phone can be unlocked by someone who looks a lot like you, say, an identical sibling.</string>
<!-- Text shown in face settings explaining what your face can be used for. Used when attention checking is not supported. [CHAR LIMIT=NONE] -->
<string name="security_settings_face_settings_footer_attention_not_supported">Use face unlock to unlock your device, sign in to apps, and confirm payments.\n\nKeep in mind:\nLooking at the phone can unlock it when you don\u2019t intend to.\n\nYour phone can be unlocked by someone else if it\u2019s held up to your face, even if your eyes are closed.\n\nYour phone can be unlocked by someone who looks a lot like you, say, an identical sibling.</string>
<string name="security_settings_face_settings_footer_attention_not_supported">Keep in mind:\nLooking at the phone can unlock it when you don\u2019t intend to.\n\nYour phone can be unlocked by someone else if it\u2019s held up to your face, even if your eyes are closed.\n\nYour phone can be unlocked by someone who looks a lot like you, say, an identical sibling.</string>
<!-- Dialog title shown when the user removes an enrollment [CHAR LIMIT=35] -->
<string name="security_settings_face_settings_remove_dialog_title">Delete face data?</string>
<!-- Dialog contents shown when the user removes an enrollment [CHAR LIMIT=NONE] -->

View File

@@ -16,15 +16,18 @@
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:settings="http://schemas.android.com/apk/res-auto"
android:title="@string/security_settings_face_preference_title">
<com.android.settings.widget.VideoPreference
android:key="security_settings_face_video"
android:title="@string/summary_placeholder"
app:animation="@raw/face_settings"
app:controller="com.android.settings.widget.VideoPreferenceController"/>
settings:animation="@raw/face_settings"
settings:controller="com.android.settings.widget.VideoPreferenceController"/>
<com.android.settingslib.widget.TopIntroPreference
android:title="@string/security_settings_face_settings_top_intro"
settings:searchable="false"/>
<PreferenceCategory
android:key="security_settings_face_unlock_category"
@@ -32,13 +35,13 @@
<com.android.settingslib.RestrictedSwitchPreference
android:key="security_settings_face_keyguard"
android:title="@string/security_settings_face_settings_use_face_unlock_phone"
app:keywords="@string/keywords_face_unlock"
app:controller="com.android.settings.biometrics.face.FaceSettingsKeyguardPreferenceController"/>
settings:keywords="@string/keywords_face_unlock"
settings:controller="com.android.settings.biometrics.face.FaceSettingsKeyguardPreferenceController"/>
<SwitchPreference
android:key="security_settings_face_app"
android:title="@string/security_settings_face_settings_use_face_for_apps"
app:keywords="@string/keywords_face_unlock"
app:controller="com.android.settings.biometrics.face.FaceSettingsAppPreferenceController"/>
settings:keywords="@string/keywords_face_unlock"
settings:controller="com.android.settings.biometrics.face.FaceSettingsAppPreferenceController"/>
<com.android.settingslib.RestrictedSwitchPreference
android:key="security_lockscreen_bypass"
android:title="@string/lockscreen_bypass_title"
@@ -54,15 +57,15 @@
android:key="security_settings_face_require_attention"
android:title="@string/security_settings_face_settings_require_attention"
android:summary="@string/security_settings_face_settings_require_attention_details"
app:keywords="@string/keywords_face_unlock"
app:controller="com.android.settings.biometrics.face.FaceSettingsAttentionPreferenceController"/>
settings:keywords="@string/keywords_face_unlock"
settings:controller="com.android.settings.biometrics.face.FaceSettingsAttentionPreferenceController"/>
<SwitchPreference
android:key="security_settings_face_require_confirmation"
android:title="@string/security_settings_face_settings_require_confirmation"
android:summary="@string/security_settings_face_settings_require_confirmation_details"
app:keywords="@string/keywords_face_unlock"
app:controller="com.android.settings.biometrics.face.FaceSettingsConfirmPreferenceController"/>
settings:keywords="@string/keywords_face_unlock"
settings:controller="com.android.settings.biometrics.face.FaceSettingsConfirmPreferenceController"/>
</PreferenceCategory>
<PreferenceCategory
@@ -84,5 +87,7 @@
</PreferenceCategory>
<com.android.settingslib.widget.FooterPreference
settings:allowDividerAbove="true"/>
android:key="security_face_footer"
settings:allowDividerAbove="true"
settings:controller="com.android.settings.biometrics.face.FaceSettingsFooterPreferenceController" />
</PreferenceScreen>

View File

@@ -312,7 +312,6 @@ public class FaceSettings extends DashboardFragment {
controllers.add(new FaceSettingsAppPreferenceController(context));
controllers.add(new FaceSettingsAttentionPreferenceController(context));
controllers.add(new FaceSettingsRemoveButtonPreferenceController(context));
controllers.add(new FaceSettingsFooterPreferenceController(context));
controllers.add(new FaceSettingsConfirmPreferenceController(context));
controllers.add(new FaceSettingsEnrollButtonPreferenceController(context));
return controllers;

View File

@@ -26,7 +26,6 @@ import com.android.settings.core.BasePreferenceController;
import com.android.settings.overlay.FeatureFactory;
import com.android.settings.utils.AnnotationSpan;
import com.android.settingslib.HelpUtils;
import com.android.settingslib.widget.FooterPreference;
/**
* Footer for face settings showing the help text and help link.
@@ -42,13 +41,9 @@ public class FaceSettingsFooterPreferenceController extends BasePreferenceContro
mProvider = FeatureFactory.getFactory(context).getFaceFeatureProvider();
}
public FaceSettingsFooterPreferenceController(Context context) {
this(context, FooterPreference.KEY_FOOTER);
}
@Override
public int getAvailabilityStatus() {
return AVAILABLE;
return AVAILABLE_UNSEARCHABLE;
}
@Override