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

Commit cd1e4f16 authored by Hao Dong's avatar Hao Dong
Browse files

Use String for custom bp and flag showing custom view.

Test: atest PromptViewModelTest
Bug: 320461893
Flag: ACONFIG android.hardware.biometrics.custom_biometric_prompt DEVELOPMENT
Change-Id: I91b4a24a3b598a8b711b86a8edd7b0bd9c794703
parent 2ba54b52
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -18800,14 +18800,14 @@ package android.hardware.biometrics {
  }
  @FlaggedApi("android.hardware.biometrics.custom_biometric_prompt") public final class PromptContentItemBulletedText implements android.os.Parcelable android.hardware.biometrics.PromptContentItem {
    ctor public PromptContentItemBulletedText(@NonNull CharSequence);
    ctor public PromptContentItemBulletedText(@NonNull String);
    method public int describeContents();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.biometrics.PromptContentItemBulletedText> CREATOR;
  }
  @FlaggedApi("android.hardware.biometrics.custom_biometric_prompt") public final class PromptContentItemPlainText implements android.os.Parcelable android.hardware.biometrics.PromptContentItem {
    ctor public PromptContentItemPlainText(@NonNull CharSequence);
    ctor public PromptContentItemPlainText(@NonNull String);
    method public int describeContents();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.biometrics.PromptContentItemPlainText> CREATOR;
@@ -18818,7 +18818,7 @@ package android.hardware.biometrics {
  @FlaggedApi("android.hardware.biometrics.custom_biometric_prompt") public final class PromptVerticalListContentView implements android.os.Parcelable android.hardware.biometrics.PromptContentView {
    method public int describeContents();
    method @Nullable public CharSequence getDescription();
    method @Nullable public String getDescription();
    method @NonNull public java.util.List<android.hardware.biometrics.PromptContentItem> getListItems();
    method public static int getMaxEachItemCharacterNumber();
    method public static int getMaxItemCount();
@@ -18831,7 +18831,7 @@ package android.hardware.biometrics {
    method @NonNull public android.hardware.biometrics.PromptVerticalListContentView.Builder addListItem(@NonNull android.hardware.biometrics.PromptContentItem);
    method @NonNull public android.hardware.biometrics.PromptVerticalListContentView.Builder addListItem(@NonNull android.hardware.biometrics.PromptContentItem, int);
    method @NonNull public android.hardware.biometrics.PromptVerticalListContentView build();
    method @NonNull public android.hardware.biometrics.PromptVerticalListContentView.Builder setDescription(@NonNull CharSequence);
    method @NonNull public android.hardware.biometrics.PromptVerticalListContentView.Builder setDescription(@NonNull String);
  }
}
+5 −5
Original line number Diff line number Diff line
@@ -28,14 +28,14 @@ import android.os.Parcelable;
 */
@FlaggedApi(FLAG_CUSTOM_BIOMETRIC_PROMPT)
public final class PromptContentItemBulletedText implements PromptContentItemParcelable {
    private final CharSequence mText;
    private final String mText;

    /**
     * A list item with bulleted text shown on {@link PromptVerticalListContentView}.
     *
     * @param text The text of this list item.
     */
    public PromptContentItemBulletedText(@NonNull CharSequence text) {
    public PromptContentItemBulletedText(@NonNull String text) {
        mText = text;
    }

@@ -43,7 +43,7 @@ public final class PromptContentItemBulletedText implements PromptContentItemPar
     * @hide
     */
    @NonNull
    public CharSequence getText() {
    public String getText() {
        return mText;
    }

@@ -60,7 +60,7 @@ public final class PromptContentItemBulletedText implements PromptContentItemPar
     */
    @Override
    public void writeToParcel(@NonNull Parcel dest, int flags) {
        dest.writeCharSequence(mText);
        dest.writeString(mText);
    }

    /**
@@ -70,7 +70,7 @@ public final class PromptContentItemBulletedText implements PromptContentItemPar
    public static final Creator<PromptContentItemBulletedText> CREATOR = new Creator<>() {
        @Override
        public PromptContentItemBulletedText createFromParcel(Parcel in) {
            return new PromptContentItemBulletedText(in.readCharSequence());
            return new PromptContentItemBulletedText(in.readString());
        }

        @Override
+5 −5
Original line number Diff line number Diff line
@@ -28,14 +28,14 @@ import android.os.Parcelable;
 */
@FlaggedApi(FLAG_CUSTOM_BIOMETRIC_PROMPT)
public final class PromptContentItemPlainText implements PromptContentItemParcelable {
    private final CharSequence mText;
    private final String mText;

    /**
     * A list item with plain text shown on {@link PromptVerticalListContentView}.
     *
     * @param text The text of this list item.
     */
    public PromptContentItemPlainText(@NonNull CharSequence text) {
    public PromptContentItemPlainText(@NonNull String text) {
        mText = text;
    }

@@ -43,7 +43,7 @@ public final class PromptContentItemPlainText implements PromptContentItemParcel
     * @hide
     */
    @NonNull
    public CharSequence getText() {
    public String getText() {
        return mText;
    }

@@ -60,7 +60,7 @@ public final class PromptContentItemPlainText implements PromptContentItemParcel
     */
    @Override
    public void writeToParcel(@NonNull Parcel dest, int flags) {
        dest.writeCharSequence(mText);
        dest.writeString(mText);
    }

    /**
@@ -70,7 +70,7 @@ public final class PromptContentItemPlainText implements PromptContentItemParcel
    public static final Creator<PromptContentItemPlainText> CREATOR = new Creator<>() {
        @Override
        public PromptContentItemPlainText createFromParcel(Parcel in) {
            return new PromptContentItemPlainText(in.readCharSequence());
            return new PromptContentItemPlainText(in.readString());
        }

        @Override
+8 −8
Original line number Diff line number Diff line
@@ -52,11 +52,11 @@ public final class PromptVerticalListContentView implements PromptContentViewPar
    private static final int MAX_ITEM_NUMBER = 20;
    private static final int MAX_EACH_ITEM_CHARACTER_NUMBER = 640;
    private final List<PromptContentItemParcelable> mContentList;
    private final CharSequence mDescription;
    private final String mDescription;

    private PromptVerticalListContentView(
            @NonNull List<PromptContentItemParcelable> contentList,
            @NonNull CharSequence description) {
            @NonNull String description) {
        mContentList = contentList;
        mDescription = description;
    }
@@ -65,7 +65,7 @@ public final class PromptVerticalListContentView implements PromptContentViewPar
        mContentList = in.readArrayList(
                PromptContentItemParcelable.class.getClassLoader(),
                PromptContentItemParcelable.class);
        mDescription = in.readCharSequence();
        mDescription = in.readString();
    }

    /**
@@ -84,12 +84,12 @@ public final class PromptVerticalListContentView implements PromptContentViewPar

    /**
     * Gets the description for the content view, as set by
     * {@link PromptVerticalListContentView.Builder#setDescription(CharSequence)}.
     * {@link PromptVerticalListContentView.Builder#setDescription(String)}.
     *
     * @return The description for the content view, or null if the content view has no description.
     */
    @Nullable
    public CharSequence getDescription() {
    public String getDescription() {
        return mDescription;
    }

@@ -118,7 +118,7 @@ public final class PromptVerticalListContentView implements PromptContentViewPar
    @Override
    public void writeToParcel(@androidx.annotation.NonNull Parcel dest, int flags) {
        dest.writeList(mContentList);
        dest.writeCharSequence(mDescription);
        dest.writeString(mDescription);
    }

    /**
@@ -143,7 +143,7 @@ public final class PromptVerticalListContentView implements PromptContentViewPar
     */
    public static final class Builder {
        private final List<PromptContentItemParcelable> mContentList = new ArrayList<>();
        private CharSequence mDescription;
        private String mDescription;

        /**
         * Optional: Sets a description that will be shown on the content view.
@@ -152,7 +152,7 @@ public final class PromptVerticalListContentView implements PromptContentViewPar
         * @return This builder.
         */
        @NonNull
        public Builder setDescription(@NonNull CharSequence description) {
        public Builder setDescription(@NonNull String description) {
            mDescription = description;
            return this;
        }
+1 −1
Original line number Diff line number Diff line
@@ -114,7 +114,7 @@ private fun createNewRowLayout(inflater: LayoutInflater): LinearLayout {
private fun PromptContentItem.doesExceedMaxLinesIfTwoColumn(
    resources: Resources,
): Boolean {
    val passedInText: CharSequence =
    val passedInText: String =
        when (this) {
            is PromptContentItemPlainText -> text
            is PromptContentItemBulletedText -> text
Loading