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

Commit e6a676af authored by Cecilia's avatar Cecilia
Browse files

Update the Smartspace UI templates APIs.

- Add the 3rd-line data in BaseTemplateData to support new Android T
  use case;
- Remove the optional constructor from Text for API review comments in
  b/218860086;
- Add SubItemLoggingInfo to support the sub-card logging on the base
  card.

Fixes: 218860086
Test: atest CtsSmartspaceServiceTestCases
Change-Id: I39d7014f4f5b36719f54e191ed5af1fa45429a53
parent 99deef06
Loading
Loading
Loading
Loading
+29 −1
Original line number Diff line number Diff line
@@ -2254,13 +2254,20 @@ package android.app.smartspace.uitemplatedata {
  public class BaseTemplateData implements android.os.Parcelable {
    method public int describeContents();
    method public int getLayoutWeight();
    method @Nullable public android.app.smartspace.uitemplatedata.BaseTemplateData.SubItemLoggingInfo getPrimaryLoggingInfo();
    method @Nullable public android.app.smartspace.uitemplatedata.TapAction getPrimaryTapAction();
    method @Nullable public android.app.smartspace.uitemplatedata.Icon getSubtitleIcon();
    method @Nullable public android.app.smartspace.uitemplatedata.Text getSubtitleText();
    method @Nullable public android.app.smartspace.uitemplatedata.Text getSupplementalAlarmText();
    method @Nullable public android.app.smartspace.uitemplatedata.Icon getSupplementalIcon();
    method @Nullable public android.app.smartspace.uitemplatedata.BaseTemplateData.SubItemLoggingInfo getSupplementalLoggingInfo();
    method @Nullable public android.app.smartspace.uitemplatedata.Icon getSupplementalSubtitleIcon();
    method @Nullable public android.app.smartspace.uitemplatedata.BaseTemplateData.SubItemLoggingInfo getSupplementalSubtitleLoggingInfo();
    method @Nullable public android.app.smartspace.uitemplatedata.TapAction getSupplementalSubtitleTapAction();
    method @Nullable public android.app.smartspace.uitemplatedata.Text getSupplementalSubtitleText();
    method @Nullable public android.app.smartspace.uitemplatedata.TapAction getSupplementalTapAction();
    method @Nullable public android.app.smartspace.uitemplatedata.Text getSupplementalText();
    method public int getTemplateType();
    method @Nullable public android.app.smartspace.uitemplatedata.Icon getTitleIcon();
    method @Nullable public android.app.smartspace.uitemplatedata.Text getTitleText();
@@ -2271,17 +2278,37 @@ package android.app.smartspace.uitemplatedata {
  public static class BaseTemplateData.Builder {
    ctor public BaseTemplateData.Builder(int);
    method @NonNull public android.app.smartspace.uitemplatedata.BaseTemplateData build();
    method @NonNull public android.app.smartspace.uitemplatedata.BaseTemplateData.Builder setLayoutWeight(int);
    method @NonNull public android.app.smartspace.uitemplatedata.BaseTemplateData.Builder setPrimaryLoggingInfo(@NonNull android.app.smartspace.uitemplatedata.BaseTemplateData.SubItemLoggingInfo);
    method @NonNull public android.app.smartspace.uitemplatedata.BaseTemplateData.Builder setPrimaryTapAction(@NonNull android.app.smartspace.uitemplatedata.TapAction);
    method @NonNull public android.app.smartspace.uitemplatedata.BaseTemplateData.Builder setSubtitleIcon(@NonNull android.app.smartspace.uitemplatedata.Icon);
    method @NonNull public android.app.smartspace.uitemplatedata.BaseTemplateData.Builder setSubtitleText(@NonNull android.app.smartspace.uitemplatedata.Text);
    method @NonNull public android.app.smartspace.uitemplatedata.BaseTemplateData.Builder setSupplementalAlarmText(@NonNull android.app.smartspace.uitemplatedata.Text);
    method @NonNull public android.app.smartspace.uitemplatedata.BaseTemplateData.Builder setSupplementalIcon(@NonNull android.app.smartspace.uitemplatedata.Icon);
    method @NonNull public android.app.smartspace.uitemplatedata.BaseTemplateData.Builder setSupplementalLoggingInfo(@NonNull android.app.smartspace.uitemplatedata.BaseTemplateData.SubItemLoggingInfo);
    method @NonNull public android.app.smartspace.uitemplatedata.BaseTemplateData.Builder setSupplementalSubtitleIcon(@NonNull android.app.smartspace.uitemplatedata.Icon);
    method @NonNull public android.app.smartspace.uitemplatedata.BaseTemplateData.Builder setSupplementalSubtitleLoggingInfo(@NonNull android.app.smartspace.uitemplatedata.BaseTemplateData.SubItemLoggingInfo);
    method @NonNull public android.app.smartspace.uitemplatedata.BaseTemplateData.Builder setSupplementalSubtitleTapAction(@NonNull android.app.smartspace.uitemplatedata.TapAction);
    method @NonNull public android.app.smartspace.uitemplatedata.BaseTemplateData.Builder setSupplementalSubtitleText(@NonNull android.app.smartspace.uitemplatedata.Text);
    method @NonNull public android.app.smartspace.uitemplatedata.BaseTemplateData.Builder setSupplementalTapAction(@NonNull android.app.smartspace.uitemplatedata.TapAction);
    method @NonNull public android.app.smartspace.uitemplatedata.BaseTemplateData.Builder setSupplementalText(@NonNull android.app.smartspace.uitemplatedata.Text);
    method @NonNull public android.app.smartspace.uitemplatedata.BaseTemplateData.Builder setTitleIcon(@NonNull android.app.smartspace.uitemplatedata.Icon);
    method @NonNull public android.app.smartspace.uitemplatedata.BaseTemplateData.Builder setTitleText(@NonNull android.app.smartspace.uitemplatedata.Text);
  }
  public static final class BaseTemplateData.SubItemLoggingInfo implements android.os.Parcelable {
    method public int describeContents();
    method public int getFeatureType();
    method public int getInstanceId();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.app.smartspace.uitemplatedata.BaseTemplateData.SubItemLoggingInfo> CREATOR;
  }
  public static final class BaseTemplateData.SubItemLoggingInfo.Builder {
    ctor public BaseTemplateData.SubItemLoggingInfo.Builder(int, int);
    method @NonNull public android.app.smartspace.uitemplatedata.BaseTemplateData.SubItemLoggingInfo build();
  }
  public final class CarouselTemplateData extends android.app.smartspace.uitemplatedata.BaseTemplateData {
    method @Nullable public android.app.smartspace.uitemplatedata.TapAction getCarouselAction();
    method @NonNull public java.util.List<android.app.smartspace.uitemplatedata.CarouselTemplateData.CarouselItem> getCarouselItems();
@@ -2408,6 +2435,7 @@ package android.app.smartspace.uitemplatedata {
    method @Nullable public android.content.Intent getIntent();
    method @Nullable public android.app.PendingIntent getPendingIntent();
    method @Nullable public android.os.UserHandle getUserHandle();
    method public boolean shouldShowOnLockscreen();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.app.smartspace.uitemplatedata.TapAction> CREATOR;
  }
@@ -2418,6 +2446,7 @@ package android.app.smartspace.uitemplatedata {
    method @NonNull public android.app.smartspace.uitemplatedata.TapAction.Builder setExtras(@NonNull android.os.Bundle);
    method @NonNull public android.app.smartspace.uitemplatedata.TapAction.Builder setIntent(@NonNull android.content.Intent);
    method @NonNull public android.app.smartspace.uitemplatedata.TapAction.Builder setPendingIntent(@NonNull android.app.PendingIntent);
    method @NonNull public android.app.smartspace.uitemplatedata.TapAction.Builder setShouldShowOnLockscreen(@NonNull boolean);
    method @NonNull public android.app.smartspace.uitemplatedata.TapAction.Builder setUserHandle(@Nullable android.os.UserHandle);
  }
@@ -2432,7 +2461,6 @@ package android.app.smartspace.uitemplatedata {
  public static final class Text.Builder {
    ctor public Text.Builder(@NonNull CharSequence);
    ctor public Text.Builder(@NonNull CharSequence, @NonNull android.text.TextUtils.TruncateAt);
    method @NonNull public android.app.smartspace.uitemplatedata.Text build();
    method @NonNull public android.app.smartspace.uitemplatedata.Text.Builder setMaxLines(int);
    method @NonNull public android.app.smartspace.uitemplatedata.Text.Builder setTruncateAtType(@NonNull android.text.TextUtils.TruncateAt);
+372 −11

File changed.

Preview size limit exceeded, changes collapsed.

+23 −7
Original line number Diff line number Diff line
@@ -59,17 +59,29 @@ public final class CarouselTemplateData extends BaseTemplateData {
            @Nullable Text titleText,
            @Nullable Icon titleIcon,
            @Nullable Text subtitleText,
            @Nullable Icon subTitleIcon,
            @Nullable Icon subtitleIcon,
            @Nullable TapAction primaryTapAction,
            @Nullable SubItemLoggingInfo primaryLoggingInfo,
            @Nullable Text supplementalSubtitleText,
            @Nullable Icon supplementalSubtitleIcon,
            @Nullable TapAction supplementalSubtitleTapAction,
            @Nullable SubItemLoggingInfo supplementalSubtitleLoggingInfo,
            @Nullable Text supplementalText,
            @Nullable Icon supplementalIcon,
            @Nullable TapAction supplementalTapAction,
            @Nullable SubItemLoggingInfo supplementalLoggingInfo,
            @Nullable Text supplementalAlarmText,
            int layoutWeight,
            @NonNull List<CarouselItem> carouselItems,
            @Nullable TapAction carouselAction) {
        super(templateType, titleText, titleIcon, subtitleText, subTitleIcon, primaryTapAction,
                supplementalSubtitleText, supplementalSubtitleIcon, supplementalSubtitleTapAction,
                supplementalAlarmText);
        super(templateType, titleText, titleIcon, subtitleText, subtitleIcon,
                primaryTapAction, primaryLoggingInfo,
                supplementalSubtitleText, supplementalSubtitleIcon,
                supplementalSubtitleTapAction, supplementalSubtitleLoggingInfo,
                supplementalText, supplementalIcon,
                supplementalTapAction, supplementalLoggingInfo,
                supplementalAlarmText, layoutWeight);

        mCarouselItems = carouselItems;
        mCarouselAction = carouselAction;
    }
@@ -179,10 +191,14 @@ public final class CarouselTemplateData extends BaseTemplateData {
            }

            return new CarouselTemplateData(getTemplateType(), getTitleText(),
                    getTitleIcon(), getSubtitleText(), getSubtitleIcon(), getPrimaryTapAction(),
                    getTitleIcon(), getSubtitleText(), getSubtitleIcon(),
                    getPrimaryTapAction(), getPrimaryLoggingInfo(),
                    getSupplementalSubtitleText(), getSupplementalSubtitleIcon(),
                    getSupplementalSubtitleTapAction(), getSupplementalAlarmText(), mCarouselItems,
                    mCarouselAction);
                    getSupplementalSubtitleTapAction(), getSupplementalSubtitleLoggingInfo(),
                    getSupplementalText(), getSupplementalIcon(),
                    getSupplementalTapAction(), getSupplementalLoggingInfo(),
                    getSupplementalAlarmText(), getLayoutWeight(),
                    mCarouselItems, mCarouselAction);
        }
    }

+21 −6
Original line number Diff line number Diff line
@@ -54,16 +54,27 @@ public final class CombinedCardsTemplateData extends BaseTemplateData {
            @Nullable Text titleText,
            @Nullable Icon titleIcon,
            @Nullable Text subtitleText,
            @Nullable Icon subTitleIcon,
            @Nullable Icon subtitleIcon,
            @Nullable TapAction primaryTapAction,
            @Nullable SubItemLoggingInfo primaryLoggingInfo,
            @Nullable Text supplementalSubtitleText,
            @Nullable Icon supplementalSubtitleIcon,
            @Nullable TapAction supplementalSubtitleTapAction,
            @Nullable SubItemLoggingInfo supplementalSubtitleLoggingInfo,
            @Nullable Text supplementalText,
            @Nullable Icon supplementalIcon,
            @Nullable TapAction supplementalTapAction,
            @Nullable SubItemLoggingInfo supplementalLoggingInfo,
            @Nullable Text supplementalAlarmText,
            int layoutWeight,
            @NonNull List<BaseTemplateData> combinedCardDataList) {
        super(templateType, titleText, titleIcon, subtitleText, subTitleIcon, primaryTapAction,
                supplementalSubtitleText, supplementalSubtitleIcon, supplementalSubtitleTapAction,
                supplementalAlarmText);
        super(templateType, titleText, titleIcon, subtitleText, subtitleIcon,
                primaryTapAction, primaryLoggingInfo,
                supplementalSubtitleText, supplementalSubtitleIcon,
                supplementalSubtitleTapAction, supplementalSubtitleLoggingInfo,
                supplementalText, supplementalIcon,
                supplementalTapAction, supplementalLoggingInfo,
                supplementalAlarmText, layoutWeight);
        mCombinedCardDataList = combinedCardDataList;
    }

@@ -151,9 +162,13 @@ public final class CombinedCardsTemplateData extends BaseTemplateData {
                throw new IllegalStateException("Please assign a value to all @NonNull args.");
            }
            return new CombinedCardsTemplateData(getTemplateType(), getTitleText(),
                    getTitleIcon(), getSubtitleText(), getSubtitleIcon(), getPrimaryTapAction(),
                    getTitleIcon(), getSubtitleText(), getSubtitleIcon(),
                    getPrimaryTapAction(), getPrimaryLoggingInfo(),
                    getSupplementalSubtitleText(), getSupplementalSubtitleIcon(),
                    getSupplementalSubtitleTapAction(), getSupplementalAlarmText(),
                    getSupplementalSubtitleTapAction(), getSupplementalSubtitleLoggingInfo(),
                    getSupplementalText(), getSupplementalIcon(),
                    getSupplementalTapAction(), getSupplementalLoggingInfo(),
                    getSupplementalAlarmText(), getLayoutWeight(),
                    mCombinedCardDataList);
        }
    }
+22 −6
Original line number Diff line number Diff line
@@ -69,21 +69,33 @@ public final class HeadToHeadTemplateData extends BaseTemplateData {
            @Nullable Text titleText,
            @Nullable Icon titleIcon,
            @Nullable Text subtitleText,
            @Nullable Icon subTitleIcon,
            @Nullable Icon subtitleIcon,
            @Nullable TapAction primaryTapAction,
            @Nullable SubItemLoggingInfo primaryLoggingInfo,
            @Nullable Text supplementalSubtitleText,
            @Nullable Icon supplementalSubtitleIcon,
            @Nullable TapAction supplementalSubtitleTapAction,
            @Nullable SubItemLoggingInfo supplementalSubtitleLoggingInfo,
            @Nullable Text supplementalText,
            @Nullable Icon supplementalIcon,
            @Nullable TapAction supplementalTapAction,
            @Nullable SubItemLoggingInfo supplementalLoggingInfo,
            @Nullable Text supplementalAlarmText,
            int layoutWeight,
            @Nullable Text headToHeadTitle,
            @Nullable Icon headToHeadFirstCompetitorIcon,
            @Nullable Icon headToHeadSecondCompetitorIcon,
            @Nullable Text headToHeadFirstCompetitorText,
            @Nullable Text headToHeadSecondCompetitorText,
            @Nullable TapAction headToHeadAction) {
        super(templateType, titleText, titleIcon, subtitleText, subTitleIcon, primaryTapAction,
                supplementalSubtitleText, supplementalSubtitleIcon, supplementalSubtitleTapAction,
                supplementalAlarmText);
        super(templateType, titleText, titleIcon, subtitleText, subtitleIcon,
                primaryTapAction, primaryLoggingInfo,
                supplementalSubtitleText, supplementalSubtitleIcon,
                supplementalSubtitleTapAction, supplementalSubtitleLoggingInfo,
                supplementalText, supplementalIcon,
                supplementalTapAction, supplementalLoggingInfo,
                supplementalAlarmText, layoutWeight);

        mHeadToHeadTitle = headToHeadTitle;
        mHeadToHeadFirstCompetitorIcon = headToHeadFirstCompetitorIcon;
        mHeadToHeadSecondCompetitorIcon = headToHeadSecondCompetitorIcon;
@@ -285,9 +297,13 @@ public final class HeadToHeadTemplateData extends BaseTemplateData {
        @NonNull
        public HeadToHeadTemplateData build() {
            return new HeadToHeadTemplateData(getTemplateType(), getTitleText(),
                    getTitleIcon(), getSubtitleText(), getSubtitleIcon(), getPrimaryTapAction(),
                    getTitleIcon(), getSubtitleText(), getSubtitleIcon(),
                    getPrimaryTapAction(), getPrimaryLoggingInfo(),
                    getSupplementalSubtitleText(), getSupplementalSubtitleIcon(),
                    getSupplementalSubtitleTapAction(), getSupplementalAlarmText(),
                    getSupplementalSubtitleTapAction(), getSupplementalSubtitleLoggingInfo(),
                    getSupplementalText(), getSupplementalIcon(),
                    getSupplementalTapAction(), getSupplementalLoggingInfo(),
                    getSupplementalAlarmText(), getLayoutWeight(),
                    mHeadToHeadTitle,
                    mHeadToHeadFirstCompetitorIcon,
                    mHeadToHeadSecondCompetitorIcon, mHeadToHeadFirstCompetitorText,
Loading