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

Commit 66ffd5a2 authored by Joy Babafemi's avatar Joy Babafemi
Browse files

Fix NPE when second resource target is not available

Filed b/421546318 to address underlying issues. Also did some cleanup in preference_widget_edit.xml

Bug: 421340100
Test: Manual
Change-Id: I13b9a22858219426e267b8016975dfb561b54e7d
Flag: android.credentials.flags.is_credman_settings_expressive_design
parent f812fe10
Loading
Loading
Loading
Loading
+3 −10
Original line number Diff line number Diff line
@@ -16,20 +16,13 @@
  -->

<!-- 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
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/edit_button"
    android:layout_width="24dp"
    android:layout_height="24dp"
    android:gravity="center_vertical"
    android:background="?android:attr/selectableItemBackground"
    android:layout_gravity="center"
    android:src="@drawable/ic_edit_24dp"
    android:contentDescription="@string/edit" />
 No newline at end of file
</LinearLayout>
 No newline at end of file
+2 −5
Original line number Diff line number Diff line
@@ -30,12 +30,13 @@ import androidx.preference.PreferenceViewHolder;
import com.android.internal.annotations.VisibleForTesting;
import com.android.settings.R;
import com.android.settingslib.PrimarySwitchPreference;
import com.android.settingslib.RestrictedPreference;

/**
 * This preference is shown at the top of the "passwords & accounts" screen and allows the user to
 * pick their primary credential manager provider.
 */
public class PrimaryProviderPreference extends PrimarySwitchPreference {
public class PrimaryProviderPreference extends RestrictedPreference {

    public static boolean shouldUseNewSettingsUi() {
        return Flags.isCredmanSettingsExpressiveDesign();
@@ -44,7 +45,6 @@ public class PrimaryProviderPreference extends PrimarySwitchPreference {
    private @Nullable Button mChangeButton = null;
    private @Nullable Button mOpenButton = null;
    private @Nullable View mButtonFrameView = null;
    private @Nullable View mEditView = null;
    private @Nullable Delegate mDelegate = null;
    private boolean mButtonsCompactMode = false;
    private boolean mOpenButtonVisible = false;
@@ -103,10 +103,7 @@ public class PrimaryProviderPreference extends PrimarySwitchPreference {
                    }
                });

        // Set up the edit icon to handle opening the change provider scenario.
        mEditView = holder.findViewById(R.id.edit_button);
        View mWidgetFrame = holder.findViewById(android.R.id.widget_frame);
        mEditView.setVisibility(View.VISIBLE);
        mWidgetFrame.setOnClickListener(
                new View.OnClickListener() {
                    public void onClick(@NonNull View v) {