Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8c6f627a authored by Becca Hughes's avatar Becca Hughes
Browse files

Add Credential Manager settings

Autofill is evolving into CredMan which means we need
to update the settings to have CredMan providers.

This CL adds CredMan equivalent classes to list the
Credential Manager providers and allow the user
to select a number of providers.

Test: Manual & atest SettingsUnitTests & make RunSettingsRoboTests -j
Bug: 253157366

Change-Id: Ice76187cfee91d844d211205b44b661acf2f6a44
parent cae18346
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -126,6 +126,7 @@
    <uses-permission android:name="android.permission.SEND_SAFETY_CENTER_UPDATE" />
    <uses-permission android:name="android.permission.START_VIEW_APP_FEATURES" />
    <uses-permission android:name="android.permission.ACCESS_KEYGUARD_QUICK_AFFORDANCES" />
    <uses-permission android:name="android.permission.LIST_ENABLED_CREDENTIAL_PROVIDERS" />

    <application
            android:name=".SettingsApplication"
+21 −0
Original line number Diff line number Diff line
@@ -9728,8 +9728,12 @@
    <!-- AutoFill strings -->
    <!-- Preference label for choosing auto-fill service. [CHAR LIMIT=60] -->
    <string name="autofill_app">Autofill service</string>
    <!-- Preference label for choosing auto-fill service. [CHAR LIMIT=60] -->
    <string name="default_autofill_app">Default autofill service</string>
    <!-- Preference category for showing auto-fill services with saved passwords. [CHAR LIMIT=60] -->
    <string name="autofill_passwords">Passwords</string>
    <!-- Preference category for showing credman services with saved credentials. [CHAR LIMIT=60] -->
    <string name="credman_credentials">Password and identity services</string>
    <!-- Summary for passwords settings that shows how many passwords are saved for each autofill
         service. [CHAR LIMIT=NONE] -->
    <plurals name="autofill_passwords_count">
@@ -9741,6 +9745,8 @@
    <string name="autofill_passwords_count_placeholder" translatable="false">\u2014</string>
    <!-- Keywords for the auto-fill feature. [CHAR LIMIT=NONE] -->
    <string name="autofill_keywords">auto, fill, autofill, password</string>
    <!-- Keywords for the credman feature. [CHAR LIMIT=NONE] -->
    <string name="credman_keywords">credentials, passkey, password</string>
    <!-- Message of the warning dialog for setting the auto-fill app. [CHAR_LIMIT=NONE] -->
    <string name="autofill_confirmation_message">
@@ -9753,6 +9759,21 @@
        ]]>
    </string>
    <!-- Title of the warning dialog for disabling the credential provider. [CHAR_LIMIT=NONE] -->
    <string name="credman_confirmation_message_title">Turn off %1$s\?</string>
    <!-- Message of the warning dialog for disabling the credential provider. [CHAR_LIMIT=NONE] -->
    <string name="credman_confirmation_message">Saved info like addresses or payment methods won\'t be filled in when you sign in. To keep your saved info filled in, set a default autofill service.</string>
    <!-- Title of the error dialog when too many credential providers are selected. [CHAR_LIMIT=NONE] -->
    <string name="credman_error_message_title">Password and identity services limit</string>
    <!-- Message of the error dialog when too many credential providers are selected. [CHAR_LIMIT=NONE] -->
    <string name="credman_error_message">You can have up to 5 autofill and password services active at the same time. Turn off a service to add more.</string>
    <!-- Positive button to turn off credential manager provider (confirmation). [CHAR LIMIT=60] -->
    <string name="credman_confirmation_message_positive_button">Turn off</string>
    <!-- Preference category for autofill debugging development settings. [CHAR LIMIT=25] -->
    <string name="debug_autofill_category">Autofill</string>
+79 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2022 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<PreferenceScreen
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:settings="http://schemas.android.com/apk/res-auto"
    android:key="user_and_account_settings_screen"
    android:title="@string/account_dashboard_title"
    settings:keywords="@string/keywords_accounts">

    <PreferenceCategory
        android:key="default_service_category"
        android:order="10"
        android:title="@string/default_autofill_app">

        <com.android.settings.widget.GearPreference
            android:fragment="com.android.settings.applications.defaultapps.DefaultAutofillPicker"
            android:key="default_autofill_main"
            android:title="@string/default_autofill_app"
            settings:keywords="@string/autofill_keywords">
            <extra
                android:name="for_work"
                android:value="false" />
        </com.android.settings.widget.GearPreference>
    </PreferenceCategory>

    <PreferenceCategory
        android:key="credman_category"
        android:order="20"
        android:persistent="false"
        android:title="@string/credman_credentials"
        settings:controller="com.android.settings.applications.credentials.CredentialManagerPreferenceController"
        settings:keywords="@string/credman_keywords" />

    <PreferenceCategory
        android:key="passwords_category"
        android:order="30"
        android:persistent="false"
        settings:controller="com.android.settings.applications.autofill.PasswordsPreferenceController"
        settings:keywords="@string/autofill_keywords" />

    <PreferenceCategory
        android:key="dashboard_tile_placeholder"
        android:order="130"/>

    <SwitchPreference
        android:key="auto_sync_account_data"
        android:title="@string/auto_sync_account_title"
        android:summary="@string/auto_sync_account_summary"
        android:order="202"
        settings:allowDividerAbove="true"/>

    <SwitchPreference
        android:key="auto_sync_work_account_data"
        android:title="@string/account_settings_menu_auto_sync_work"
        android:summary="@string/auto_sync_account_summary"
        settings:forWork="true"
        android:order="203"/>

    <SwitchPreference
        android:key="auto_sync_personal_account_data"
        android:title="@string/account_settings_menu_auto_sync_personal"
        android:summary="@string/auto_sync_account_summary"
        android:order="204"/>

</PreferenceScreen>
 No newline at end of file
+73 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright (C) 2022 The Android Open Source Project

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
  -->

<PreferenceScreen
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:settings="http://schemas.android.com/apk/res-auto"
    android:key="user_and_account_settings_screen"
    android:title="@string/account_dashboard_title"
    settings:keywords="@string/keywords_accounts">

    <PreferenceCategory
        android:key="default_service_category"
        android:order="10"
        android:title="@string/default_autofill_app">

        <com.android.settings.widget.GearPreference
            android:fragment="com.android.settings.applications.defaultapps.DefaultAutofillPicker"
            android:key="default_autofill_main"
            android:title="@string/default_autofill_app"
            settings:keywords="@string/autofill_keywords">
            <extra
                android:name="for_work"
                android:value="false" />
        </com.android.settings.widget.GearPreference>
    </PreferenceCategory>

    <PreferenceCategory
        android:key="credman_category"
        android:order="20"
        android:persistent="false"
        android:title="@string/credman_credentials"
        settings:controller="com.android.settings.applications.credentials.CredentialManagerPreferenceController"
        settings:keywords="@string/credman_keywords" />

    <PreferenceCategory
        android:key="passwords_category"
        android:order="30"
        android:persistent="false"
        settings:controller="com.android.settings.applications.autofill.PasswordsPreferenceController"
        settings:keywords="@string/autofill_keywords" />

    <PreferenceCategory
        android:key="dashboard_tile_placeholder"
        android:order="130"/>

    <SwitchPreference
        android:key="auto_sync_account_data"
        android:title="@string/auto_sync_account_title"
        android:summary="@string/auto_sync_account_summary"
        android:order="200"
        settings:allowDividerAbove="true"/>

    <SwitchPreference
        android:key="auto_sync_personal_account_data"
        android:title="@string/account_settings_menu_auto_sync_personal"
        android:summary="@string/auto_sync_account_summary"
        android:order="210"/>

</PreferenceScreen>
+73 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright (C) 2022 The Android Open Source Project

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
  -->

<PreferenceScreen
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:settings="http://schemas.android.com/apk/res-auto"
    android:key="user_and_account_settings_screen"
    android:title="@string/account_dashboard_title"
    settings:keywords="@string/keywords_accounts">

    <com.android.settings.widget.WorkOnlyCategory
        android:key="autofill_work_app_defaults"
        android:order="30"
        android:title="@string/default_autofill_app">

        <com.android.settings.widget.GearPreference
            android:fragment="com.android.settings.applications.defaultapps.DefaultAutofillPicker"
            android:key="default_autofill_work"
            android:title="@string/default_autofill_app"
            settings:searchable="false">
            <extra
                android:name="for_work"
                android:value="true" />
        </com.android.settings.widget.GearPreference>
    </com.android.settings.widget.WorkOnlyCategory>

    <PreferenceCategory
        android:key="credman_category"
        android:order="20"
        android:persistent="false"
        android:title="@string/credman_credentials"
        settings:controller="com.android.settings.applications.credentials.CredentialManagerPreferenceController"
        settings:keywords="@string/credman_keywords" />

    <PreferenceCategory
        android:key="passwords_category"
        android:order="30"
        android:persistent="false"
        settings:controller="com.android.settings.applications.autofill.PasswordsPreferenceController"
        settings:keywords="@string/autofill_keywords" />

    <PreferenceCategory
        android:key="dashboard_tile_placeholder"
        android:order="130"/>

    <SwitchPreference
        android:key="auto_sync_account_data"
        android:title="@string/auto_sync_account_title"
        android:summary="@string/auto_sync_account_summary"
        android:order="200"
        settings:allowDividerAbove="true"/>

    <SwitchPreference
        android:key="auto_sync_work_account_data"
        android:title="@string/account_settings_menu_auto_sync_work"
        android:summary="@string/auto_sync_account_summary"
        android:order="210"/>

</PreferenceScreen>
Loading