Loading res/layout/preference_widget_edit.xml 0 → 100644 +35 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2025 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. --> <!-- Edit button --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/edit_button_layout" android:layout_width="52dp" android:layout_height="wrap_content" android:gravity="center" android:layout_gravity="end"> <ImageView android:id="@+id/edit_button" android:layout_width="24dp" android:layout_height="24dp" android:gravity="center_vertical" android:layout_gravity="center" android:src="@drawable/ic_edit_24dp" android:contentDescription="@string/edit" /> </LinearLayout> No newline at end of file res/values/strings.xml +8 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,8 @@ <string name="allow">Allow</string> <!-- Strings for Dialog deny button --> <string name="deny">Deny</string> <!-- Strings for edit button --> <string name="edit">Edit</string> <!-- Used in confirmation dialogs as the action that the user will tap to turn on the feature. [CHAR LIMIT=40]--> <string name="confirmation_turn_on">Turn on</string> Loading Loading @@ -12158,6 +12160,12 @@ Data usage charges may apply.</string> <!-- Title of the screen where the user picks a provider. [CHAR_LIMIT=NONE] --> <string name="credman_picker_title">Preferred service for passwords, passkeys & autofill</string> <!-- New title of the screen where the user picks a provider. [CHAR_LIMIT=NONE] --> <string name="credman_picker_title_new">Preferred service</string> <!-- New title of the screen where the user picks a provider. [CHAR_LIMIT=NONE] --> <string name="credman_picker_page_summary">Choose your preferred service to save data for sign-in and autofill suggestions</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> res/xml/default_credman_picker.xml +1 −1 Original line number Diff line number Diff line Loading @@ -17,4 +17,4 @@ <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" android:title="@string/credman_picker_title" /> android:title="@string/credman_picker_title_new"/> src/com/android/settings/applications/credentials/CredentialManagerPreferenceController.java +4 −8 Original line number Diff line number Diff line Loading @@ -69,9 +69,11 @@ import com.android.settings.R; import com.android.settings.Utils; import com.android.settings.core.BasePreferenceController; import com.android.settings.dashboard.DashboardFragment; import com.android.settingslib.PrimarySwitchPreference; import com.android.settingslib.RestrictedLockUtils; import com.android.settingslib.RestrictedPreference; import com.android.settingslib.utils.ThreadUtils; import com.android.settingslib.widget.TwoTargetPreference; import java.util.ArrayList; import java.util.HashMap; Loading Loading @@ -726,13 +728,12 @@ public class CredentialManagerPreferenceController extends BasePreferenceControl final CombiPreference pref = new CombiPreference(prefContext, mEnabledPackageNames.contains(packageName)); pref.setTitle(title); pref.setLayoutResource(R.layout.preference_icon_credman); if (Flags.newSettingsUi()) { pref.setIcon(processIcon(icon)); } else if (icon != null) { pref.setIcon(icon); } pref.setIconSize(TwoTargetPreference.ICON_SIZE_MEDIUM); if (subtitle != null) { pref.setSummary(subtitle); Loading Loading @@ -1071,7 +1072,7 @@ public class CredentialManagerPreferenceController extends BasePreferenceControl } /** CombiPreference is a combination of RestrictedPreference and SwitchPreference. */ public static class CombiPreference extends RestrictedPreference { public static class CombiPreference extends PrimarySwitchPreference { private final Listener mListener = new Listener(); Loading Loading @@ -1152,11 +1153,6 @@ public class CredentialManagerPreferenceController extends BasePreferenceControl mOnClickListener = onClickListener; } @Override protected int getSecondTargetResId() { return com.android.settingslib.R.layout.preference_widget_primary_switch; } @Override public void onBindViewHolder(PreferenceViewHolder view) { super.onBindViewHolder(view); Loading src/com/android/settings/applications/credentials/DefaultCombinedPicker.java +19 −7 Original line number Diff line number Diff line Loading @@ -54,11 +54,15 @@ import com.android.settings.applications.defaultapps.DefaultAppPickerFragment; import com.android.settingslib.RestrictedSelectorWithWidgetPreference; import com.android.settingslib.applications.DefaultAppInfo; import com.android.settingslib.widget.CandidateInfo; import com.android.settingslib.widget.SectionButtonPreference; import com.android.settingslib.widget.SelectorWithWidgetPreference; import com.android.settingslib.widget.TopIntroPreference; import java.util.ArrayList; import java.util.List; import kotlin.Unit; public class DefaultCombinedPicker extends DefaultAppPickerFragment { private boolean mIsWorkProfile; Loading Loading @@ -207,6 +211,7 @@ public class DefaultCombinedPicker extends DefaultAppPickerFragment { private void update() { updateCandidates(); addAddServicePreference(); addTopIntroPreference(); } @Override Loading @@ -232,13 +237,12 @@ public class DefaultCombinedPicker extends DefaultAppPickerFragment { final Intent addNewServiceIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(searchUri)); final Context context = getPrefContext(); final Preference preference = new Preference(context); preference.setOnPreferenceClickListener( p -> { final SectionButtonPreference preference = new SectionButtonPreference(context); preference.setOnClickListener(v -> { context.startActivityAsUser(addNewServiceIntent, UserHandle.of(getUser())); return true; return Unit.INSTANCE; }); preference.setTitle(R.string.print_menu_item_add_service); preference.setTitle(R.string.add); preference.setIcon(R.drawable.ic_add_24dp); preference.setOrder(Integer.MAX_VALUE - 1); preference.setPersistent(false); Loading @@ -256,6 +260,14 @@ public class DefaultCombinedPicker extends DefaultAppPickerFragment { } } /** Add a preference that holds the intro summary */ private void addTopIntroPreference() { final Preference topIntroPreference = new TopIntroPreference(getContext()); topIntroPreference.setTitle(R.string.credman_picker_page_summary); topIntroPreference.setOrder(0); getPreferenceScreen().addPreference(topIntroPreference); } /** * Get the Credential Manager service if we haven't already got it. We need to get the service * later because if we do it in onCreate it will fail. Loading Loading
res/layout/preference_widget_edit.xml 0 → 100644 +35 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2025 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. --> <!-- Edit button --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/edit_button_layout" android:layout_width="52dp" android:layout_height="wrap_content" android:gravity="center" android:layout_gravity="end"> <ImageView android:id="@+id/edit_button" android:layout_width="24dp" android:layout_height="24dp" android:gravity="center_vertical" android:layout_gravity="center" android:src="@drawable/ic_edit_24dp" android:contentDescription="@string/edit" /> </LinearLayout> No newline at end of file
res/values/strings.xml +8 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,8 @@ <string name="allow">Allow</string> <!-- Strings for Dialog deny button --> <string name="deny">Deny</string> <!-- Strings for edit button --> <string name="edit">Edit</string> <!-- Used in confirmation dialogs as the action that the user will tap to turn on the feature. [CHAR LIMIT=40]--> <string name="confirmation_turn_on">Turn on</string> Loading Loading @@ -12158,6 +12160,12 @@ Data usage charges may apply.</string> <!-- Title of the screen where the user picks a provider. [CHAR_LIMIT=NONE] --> <string name="credman_picker_title">Preferred service for passwords, passkeys & autofill</string> <!-- New title of the screen where the user picks a provider. [CHAR_LIMIT=NONE] --> <string name="credman_picker_title_new">Preferred service</string> <!-- New title of the screen where the user picks a provider. [CHAR_LIMIT=NONE] --> <string name="credman_picker_page_summary">Choose your preferred service to save data for sign-in and autofill suggestions</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>
res/xml/default_credman_picker.xml +1 −1 Original line number Diff line number Diff line Loading @@ -17,4 +17,4 @@ <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" android:title="@string/credman_picker_title" /> android:title="@string/credman_picker_title_new"/>
src/com/android/settings/applications/credentials/CredentialManagerPreferenceController.java +4 −8 Original line number Diff line number Diff line Loading @@ -69,9 +69,11 @@ import com.android.settings.R; import com.android.settings.Utils; import com.android.settings.core.BasePreferenceController; import com.android.settings.dashboard.DashboardFragment; import com.android.settingslib.PrimarySwitchPreference; import com.android.settingslib.RestrictedLockUtils; import com.android.settingslib.RestrictedPreference; import com.android.settingslib.utils.ThreadUtils; import com.android.settingslib.widget.TwoTargetPreference; import java.util.ArrayList; import java.util.HashMap; Loading Loading @@ -726,13 +728,12 @@ public class CredentialManagerPreferenceController extends BasePreferenceControl final CombiPreference pref = new CombiPreference(prefContext, mEnabledPackageNames.contains(packageName)); pref.setTitle(title); pref.setLayoutResource(R.layout.preference_icon_credman); if (Flags.newSettingsUi()) { pref.setIcon(processIcon(icon)); } else if (icon != null) { pref.setIcon(icon); } pref.setIconSize(TwoTargetPreference.ICON_SIZE_MEDIUM); if (subtitle != null) { pref.setSummary(subtitle); Loading Loading @@ -1071,7 +1072,7 @@ public class CredentialManagerPreferenceController extends BasePreferenceControl } /** CombiPreference is a combination of RestrictedPreference and SwitchPreference. */ public static class CombiPreference extends RestrictedPreference { public static class CombiPreference extends PrimarySwitchPreference { private final Listener mListener = new Listener(); Loading Loading @@ -1152,11 +1153,6 @@ public class CredentialManagerPreferenceController extends BasePreferenceControl mOnClickListener = onClickListener; } @Override protected int getSecondTargetResId() { return com.android.settingslib.R.layout.preference_widget_primary_switch; } @Override public void onBindViewHolder(PreferenceViewHolder view) { super.onBindViewHolder(view); Loading
src/com/android/settings/applications/credentials/DefaultCombinedPicker.java +19 −7 Original line number Diff line number Diff line Loading @@ -54,11 +54,15 @@ import com.android.settings.applications.defaultapps.DefaultAppPickerFragment; import com.android.settingslib.RestrictedSelectorWithWidgetPreference; import com.android.settingslib.applications.DefaultAppInfo; import com.android.settingslib.widget.CandidateInfo; import com.android.settingslib.widget.SectionButtonPreference; import com.android.settingslib.widget.SelectorWithWidgetPreference; import com.android.settingslib.widget.TopIntroPreference; import java.util.ArrayList; import java.util.List; import kotlin.Unit; public class DefaultCombinedPicker extends DefaultAppPickerFragment { private boolean mIsWorkProfile; Loading Loading @@ -207,6 +211,7 @@ public class DefaultCombinedPicker extends DefaultAppPickerFragment { private void update() { updateCandidates(); addAddServicePreference(); addTopIntroPreference(); } @Override Loading @@ -232,13 +237,12 @@ public class DefaultCombinedPicker extends DefaultAppPickerFragment { final Intent addNewServiceIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(searchUri)); final Context context = getPrefContext(); final Preference preference = new Preference(context); preference.setOnPreferenceClickListener( p -> { final SectionButtonPreference preference = new SectionButtonPreference(context); preference.setOnClickListener(v -> { context.startActivityAsUser(addNewServiceIntent, UserHandle.of(getUser())); return true; return Unit.INSTANCE; }); preference.setTitle(R.string.print_menu_item_add_service); preference.setTitle(R.string.add); preference.setIcon(R.drawable.ic_add_24dp); preference.setOrder(Integer.MAX_VALUE - 1); preference.setPersistent(false); Loading @@ -256,6 +260,14 @@ public class DefaultCombinedPicker extends DefaultAppPickerFragment { } } /** Add a preference that holds the intro summary */ private void addTopIntroPreference() { final Preference topIntroPreference = new TopIntroPreference(getContext()); topIntroPreference.setTitle(R.string.credman_picker_page_summary); topIntroPreference.setOrder(0); getPreferenceScreen().addPreference(topIntroPreference); } /** * Get the Credential Manager service if we haven't already got it. We need to get the service * later because if we do it in onCreate it will fail. Loading