Loading AconfigFlags.bp +14 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ aconfig_srcjars = [ ":android.app.usage.flags-aconfig-java{.generated_srcjars}", ":android.app.smartspace.flags-aconfig-java{.generated_srcjars}", ":android.companion.flags-aconfig-java{.generated_srcjars}", ":android.content.pm.flags-aconfig-java{.generated_srcjars}", ":android.content.res.flags-aconfig-java{.generated_srcjars}", Loading Loading @@ -599,3 +600,16 @@ java_aconfig_library { aconfig_declarations: "android.service.notification.flags-aconfig", defaults: ["framework-minus-apex-aconfig-java-defaults"], } // Smartspace aconfig_declarations { name: "android.app.smartspace.flags-aconfig", package: "android.app.smartspace.flags", srcs: ["core/java/android/app/smartspace/flags.aconfig"], } java_aconfig_library { name: "android.app.smartspace.flags-aconfig-java", aconfig_declarations: "android.app.smartspace.flags-aconfig", defaults: ["framework-minus-apex-aconfig-java-defaults"], } core/api/system-current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -2452,6 +2452,7 @@ package android.app.smartspace { method public int getFeatureType(); method @Nullable public android.app.smartspace.SmartspaceAction getHeaderAction(); method @NonNull public java.util.List<android.app.smartspace.SmartspaceAction> getIconGrid(); method @FlaggedApi("android.app.smartspace.flags.remote_views") @Nullable public android.widget.RemoteViews getRemoteViews(); method public float getScore(); method @Nullable public android.net.Uri getSliceUri(); method @NonNull public String getSmartspaceTargetId(); Loading Loading @@ -2526,6 +2527,7 @@ package android.app.smartspace { method @NonNull public android.app.smartspace.SmartspaceTarget.Builder setFeatureType(int); method @NonNull public android.app.smartspace.SmartspaceTarget.Builder setHeaderAction(@NonNull android.app.smartspace.SmartspaceAction); method @NonNull public android.app.smartspace.SmartspaceTarget.Builder setIconGrid(@NonNull java.util.List<android.app.smartspace.SmartspaceAction>); method @FlaggedApi("android.app.smartspace.flags.remote_views") @NonNull public android.app.smartspace.SmartspaceTarget.Builder setRemoteViews(@NonNull android.widget.RemoteViews); method @NonNull public android.app.smartspace.SmartspaceTarget.Builder setScore(float); method @NonNull public android.app.smartspace.SmartspaceTarget.Builder setSensitive(boolean); method @NonNull public android.app.smartspace.SmartspaceTarget.Builder setShouldShowExpanded(boolean); core/java/android/app/smartspace/SmartspaceTarget.java +53 −5 Original line number Diff line number Diff line Loading @@ -16,10 +16,12 @@ package android.app.smartspace; import android.annotation.CurrentTimeMillisLong; import android.annotation.FlaggedApi; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemApi; import android.app.smartspace.flags.Flags; import android.app.smartspace.uitemplatedata.BaseTemplateData; import android.appwidget.AppWidgetProviderInfo; import android.content.ComponentName; Loading @@ -27,6 +29,7 @@ import android.net.Uri; import android.os.Parcel; import android.os.Parcelable; import android.os.UserHandle; import android.widget.RemoteViews; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; Loading @@ -41,7 +44,8 @@ import java.util.Objects; * {@link SmartspaceAction} as their type because they can have associated actions. * * <p><b>NOTE: </b> * If {@link mWidget} is set, it should be preferred over all other properties. * If either {@link mRemoteViews} or {@link mWidget} is set, it should be preferred over all * other properties. (An exception is thrown if both are set.) * Else, if {@link mSliceUri} is set, it should be preferred over all other data properties. * Otherwise, the instance should be treated as a data object. * Loading Loading @@ -132,6 +136,9 @@ public final class SmartspaceTarget implements Parcelable { @Nullable private final AppWidgetProviderInfo mWidget; @Nullable private final RemoteViews mRemoteViews; @Nullable private final BaseTemplateData mTemplateData; Loading Loading @@ -288,6 +295,7 @@ public final class SmartspaceTarget implements Parcelable { this.mSliceUri = in.readTypedObject(Uri.CREATOR); this.mWidget = in.readTypedObject(AppWidgetProviderInfo.CREATOR); this.mTemplateData = in.readParcelable(/* loader= */null, BaseTemplateData.class); this.mRemoteViews = in.readTypedObject(RemoteViews.CREATOR); } private SmartspaceTarget(String smartspaceTargetId, Loading @@ -298,7 +306,7 @@ public final class SmartspaceTarget implements Parcelable { boolean shouldShowExpanded, String sourceNotificationKey, ComponentName componentName, UserHandle userHandle, String associatedSmartspaceTargetId, Uri sliceUri, AppWidgetProviderInfo widget, BaseTemplateData templateData) { AppWidgetProviderInfo widget, BaseTemplateData templateData, RemoteViews remoteViews) { mSmartspaceTargetId = smartspaceTargetId; mHeaderAction = headerAction; mBaseAction = baseAction; Loading @@ -317,6 +325,7 @@ public final class SmartspaceTarget implements Parcelable { mSliceUri = sliceUri; mWidget = widget; mTemplateData = templateData; mRemoteViews = remoteViews; } /** Loading Loading @@ -460,6 +469,15 @@ public final class SmartspaceTarget implements Parcelable { return mTemplateData; } /** * Returns the {@link RemoteViews} to show over the target. */ @FlaggedApi(Flags.FLAG_REMOTE_VIEWS) @Nullable public RemoteViews getRemoteViews() { return mRemoteViews; } /** * @see Parcelable.Creator */ Loading Loading @@ -496,6 +514,7 @@ public final class SmartspaceTarget implements Parcelable { dest.writeTypedObject(this.mSliceUri, flags); dest.writeTypedObject(this.mWidget, flags); dest.writeParcelable(this.mTemplateData, flags); dest.writeTypedObject(this.mRemoteViews, flags); } @Override Loading Loading @@ -524,6 +543,7 @@ public final class SmartspaceTarget implements Parcelable { + ", mSliceUri=" + mSliceUri + ", mWidget=" + mWidget + ", mTemplateData=" + mTemplateData + ", mRemoteViews=" + mRemoteViews + '}'; } Loading @@ -550,7 +570,8 @@ public final class SmartspaceTarget implements Parcelable { that.mAssociatedSmartspaceTargetId) && Objects.equals(mSliceUri, that.mSliceUri) && Objects.equals(mWidget, that.mWidget) && Objects.equals(mTemplateData, that.mTemplateData); && Objects.equals(mTemplateData, that.mTemplateData) && Objects.equals(mRemoteViews, that.mRemoteViews); } @Override Loading @@ -558,7 +579,7 @@ public final class SmartspaceTarget implements Parcelable { return Objects.hash(mSmartspaceTargetId, mHeaderAction, mBaseAction, mCreationTimeMillis, mExpiryTimeMillis, mScore, mActionChips, mIconGrid, mFeatureType, mSensitive, mShouldShowExpanded, mSourceNotificationKey, mComponentName, mUserHandle, mAssociatedSmartspaceTargetId, mSliceUri, mWidget, mTemplateData); mAssociatedSmartspaceTargetId, mSliceUri, mWidget, mTemplateData, mRemoteViews); } /** Loading Loading @@ -588,6 +609,8 @@ public final class SmartspaceTarget implements Parcelable { private AppWidgetProviderInfo mWidget; private BaseTemplateData mTemplateData; private RemoteViews mRemoteViews; /** * A builder for {@link SmartspaceTarget}. * Loading Loading @@ -727,9 +750,15 @@ public final class SmartspaceTarget implements Parcelable { * * <p><b>NOTE: </b> If {@link mWidget} is set, all other @Nullable params should be * ignored. * * @throws An {@link IllegalStateException} is thrown if {@link mRemoteViews} is set. */ @NonNull public Builder setWidget(@NonNull AppWidgetProviderInfo widget) { if (mRemoteViews != null) { throw new IllegalStateException( "Widget providers and RemoteViews cannot be used at the same time."); } this.mWidget = widget; return this; } Loading @@ -744,6 +773,25 @@ public final class SmartspaceTarget implements Parcelable { return this; } /** * Sets the {@link RemoteViews}. * * <p><b>NOTE: </b> If {@link RemoteViews} is set, all other @Nullable params should be * ignored. * * @throws An {@link IllegalStateException} is thrown if {@link mWidget} is set. */ @FlaggedApi(Flags.FLAG_REMOTE_VIEWS) @NonNull public Builder setRemoteViews(@NonNull RemoteViews remoteViews) { if (mWidget != null) { throw new IllegalStateException( "Widget providers and RemoteViews cannot be used at the same time."); } mRemoteViews = remoteViews; return this; } /** * Builds a new {@link SmartspaceTarget}. * Loading @@ -760,7 +808,7 @@ public final class SmartspaceTarget implements Parcelable { mHeaderAction, mBaseAction, mCreationTimeMillis, mExpiryTimeMillis, mScore, mActionChips, mIconGrid, mFeatureType, mSensitive, mShouldShowExpanded, mSourceNotificationKey, mComponentName, mUserHandle, mAssociatedSmartspaceTargetId, mSliceUri, mWidget, mTemplateData); mAssociatedSmartspaceTargetId, mSliceUri, mWidget, mTemplateData, mRemoteViews); } } } core/java/android/app/smartspace/flags.aconfig 0 → 100644 +8 −0 Original line number Diff line number Diff line package: "android.app.smartspace.flags" flag { name: "remote_views" namespace: "sysui_integrations" description: "Flag to enable the FlaggedApi to include RemoteViews in SmartspaceTarget" bug: "300157758" } Loading
AconfigFlags.bp +14 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ aconfig_srcjars = [ ":android.app.usage.flags-aconfig-java{.generated_srcjars}", ":android.app.smartspace.flags-aconfig-java{.generated_srcjars}", ":android.companion.flags-aconfig-java{.generated_srcjars}", ":android.content.pm.flags-aconfig-java{.generated_srcjars}", ":android.content.res.flags-aconfig-java{.generated_srcjars}", Loading Loading @@ -599,3 +600,16 @@ java_aconfig_library { aconfig_declarations: "android.service.notification.flags-aconfig", defaults: ["framework-minus-apex-aconfig-java-defaults"], } // Smartspace aconfig_declarations { name: "android.app.smartspace.flags-aconfig", package: "android.app.smartspace.flags", srcs: ["core/java/android/app/smartspace/flags.aconfig"], } java_aconfig_library { name: "android.app.smartspace.flags-aconfig-java", aconfig_declarations: "android.app.smartspace.flags-aconfig", defaults: ["framework-minus-apex-aconfig-java-defaults"], }
core/api/system-current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -2452,6 +2452,7 @@ package android.app.smartspace { method public int getFeatureType(); method @Nullable public android.app.smartspace.SmartspaceAction getHeaderAction(); method @NonNull public java.util.List<android.app.smartspace.SmartspaceAction> getIconGrid(); method @FlaggedApi("android.app.smartspace.flags.remote_views") @Nullable public android.widget.RemoteViews getRemoteViews(); method public float getScore(); method @Nullable public android.net.Uri getSliceUri(); method @NonNull public String getSmartspaceTargetId(); Loading Loading @@ -2526,6 +2527,7 @@ package android.app.smartspace { method @NonNull public android.app.smartspace.SmartspaceTarget.Builder setFeatureType(int); method @NonNull public android.app.smartspace.SmartspaceTarget.Builder setHeaderAction(@NonNull android.app.smartspace.SmartspaceAction); method @NonNull public android.app.smartspace.SmartspaceTarget.Builder setIconGrid(@NonNull java.util.List<android.app.smartspace.SmartspaceAction>); method @FlaggedApi("android.app.smartspace.flags.remote_views") @NonNull public android.app.smartspace.SmartspaceTarget.Builder setRemoteViews(@NonNull android.widget.RemoteViews); method @NonNull public android.app.smartspace.SmartspaceTarget.Builder setScore(float); method @NonNull public android.app.smartspace.SmartspaceTarget.Builder setSensitive(boolean); method @NonNull public android.app.smartspace.SmartspaceTarget.Builder setShouldShowExpanded(boolean);
core/java/android/app/smartspace/SmartspaceTarget.java +53 −5 Original line number Diff line number Diff line Loading @@ -16,10 +16,12 @@ package android.app.smartspace; import android.annotation.CurrentTimeMillisLong; import android.annotation.FlaggedApi; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemApi; import android.app.smartspace.flags.Flags; import android.app.smartspace.uitemplatedata.BaseTemplateData; import android.appwidget.AppWidgetProviderInfo; import android.content.ComponentName; Loading @@ -27,6 +29,7 @@ import android.net.Uri; import android.os.Parcel; import android.os.Parcelable; import android.os.UserHandle; import android.widget.RemoteViews; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; Loading @@ -41,7 +44,8 @@ import java.util.Objects; * {@link SmartspaceAction} as their type because they can have associated actions. * * <p><b>NOTE: </b> * If {@link mWidget} is set, it should be preferred over all other properties. * If either {@link mRemoteViews} or {@link mWidget} is set, it should be preferred over all * other properties. (An exception is thrown if both are set.) * Else, if {@link mSliceUri} is set, it should be preferred over all other data properties. * Otherwise, the instance should be treated as a data object. * Loading Loading @@ -132,6 +136,9 @@ public final class SmartspaceTarget implements Parcelable { @Nullable private final AppWidgetProviderInfo mWidget; @Nullable private final RemoteViews mRemoteViews; @Nullable private final BaseTemplateData mTemplateData; Loading Loading @@ -288,6 +295,7 @@ public final class SmartspaceTarget implements Parcelable { this.mSliceUri = in.readTypedObject(Uri.CREATOR); this.mWidget = in.readTypedObject(AppWidgetProviderInfo.CREATOR); this.mTemplateData = in.readParcelable(/* loader= */null, BaseTemplateData.class); this.mRemoteViews = in.readTypedObject(RemoteViews.CREATOR); } private SmartspaceTarget(String smartspaceTargetId, Loading @@ -298,7 +306,7 @@ public final class SmartspaceTarget implements Parcelable { boolean shouldShowExpanded, String sourceNotificationKey, ComponentName componentName, UserHandle userHandle, String associatedSmartspaceTargetId, Uri sliceUri, AppWidgetProviderInfo widget, BaseTemplateData templateData) { AppWidgetProviderInfo widget, BaseTemplateData templateData, RemoteViews remoteViews) { mSmartspaceTargetId = smartspaceTargetId; mHeaderAction = headerAction; mBaseAction = baseAction; Loading @@ -317,6 +325,7 @@ public final class SmartspaceTarget implements Parcelable { mSliceUri = sliceUri; mWidget = widget; mTemplateData = templateData; mRemoteViews = remoteViews; } /** Loading Loading @@ -460,6 +469,15 @@ public final class SmartspaceTarget implements Parcelable { return mTemplateData; } /** * Returns the {@link RemoteViews} to show over the target. */ @FlaggedApi(Flags.FLAG_REMOTE_VIEWS) @Nullable public RemoteViews getRemoteViews() { return mRemoteViews; } /** * @see Parcelable.Creator */ Loading Loading @@ -496,6 +514,7 @@ public final class SmartspaceTarget implements Parcelable { dest.writeTypedObject(this.mSliceUri, flags); dest.writeTypedObject(this.mWidget, flags); dest.writeParcelable(this.mTemplateData, flags); dest.writeTypedObject(this.mRemoteViews, flags); } @Override Loading Loading @@ -524,6 +543,7 @@ public final class SmartspaceTarget implements Parcelable { + ", mSliceUri=" + mSliceUri + ", mWidget=" + mWidget + ", mTemplateData=" + mTemplateData + ", mRemoteViews=" + mRemoteViews + '}'; } Loading @@ -550,7 +570,8 @@ public final class SmartspaceTarget implements Parcelable { that.mAssociatedSmartspaceTargetId) && Objects.equals(mSliceUri, that.mSliceUri) && Objects.equals(mWidget, that.mWidget) && Objects.equals(mTemplateData, that.mTemplateData); && Objects.equals(mTemplateData, that.mTemplateData) && Objects.equals(mRemoteViews, that.mRemoteViews); } @Override Loading @@ -558,7 +579,7 @@ public final class SmartspaceTarget implements Parcelable { return Objects.hash(mSmartspaceTargetId, mHeaderAction, mBaseAction, mCreationTimeMillis, mExpiryTimeMillis, mScore, mActionChips, mIconGrid, mFeatureType, mSensitive, mShouldShowExpanded, mSourceNotificationKey, mComponentName, mUserHandle, mAssociatedSmartspaceTargetId, mSliceUri, mWidget, mTemplateData); mAssociatedSmartspaceTargetId, mSliceUri, mWidget, mTemplateData, mRemoteViews); } /** Loading Loading @@ -588,6 +609,8 @@ public final class SmartspaceTarget implements Parcelable { private AppWidgetProviderInfo mWidget; private BaseTemplateData mTemplateData; private RemoteViews mRemoteViews; /** * A builder for {@link SmartspaceTarget}. * Loading Loading @@ -727,9 +750,15 @@ public final class SmartspaceTarget implements Parcelable { * * <p><b>NOTE: </b> If {@link mWidget} is set, all other @Nullable params should be * ignored. * * @throws An {@link IllegalStateException} is thrown if {@link mRemoteViews} is set. */ @NonNull public Builder setWidget(@NonNull AppWidgetProviderInfo widget) { if (mRemoteViews != null) { throw new IllegalStateException( "Widget providers and RemoteViews cannot be used at the same time."); } this.mWidget = widget; return this; } Loading @@ -744,6 +773,25 @@ public final class SmartspaceTarget implements Parcelable { return this; } /** * Sets the {@link RemoteViews}. * * <p><b>NOTE: </b> If {@link RemoteViews} is set, all other @Nullable params should be * ignored. * * @throws An {@link IllegalStateException} is thrown if {@link mWidget} is set. */ @FlaggedApi(Flags.FLAG_REMOTE_VIEWS) @NonNull public Builder setRemoteViews(@NonNull RemoteViews remoteViews) { if (mWidget != null) { throw new IllegalStateException( "Widget providers and RemoteViews cannot be used at the same time."); } mRemoteViews = remoteViews; return this; } /** * Builds a new {@link SmartspaceTarget}. * Loading @@ -760,7 +808,7 @@ public final class SmartspaceTarget implements Parcelable { mHeaderAction, mBaseAction, mCreationTimeMillis, mExpiryTimeMillis, mScore, mActionChips, mIconGrid, mFeatureType, mSensitive, mShouldShowExpanded, mSourceNotificationKey, mComponentName, mUserHandle, mAssociatedSmartspaceTargetId, mSliceUri, mWidget, mTemplateData); mAssociatedSmartspaceTargetId, mSliceUri, mWidget, mTemplateData, mRemoteViews); } } }
core/java/android/app/smartspace/flags.aconfig 0 → 100644 +8 −0 Original line number Diff line number Diff line package: "android.app.smartspace.flags" flag { name: "remote_views" namespace: "sysui_integrations" description: "Flag to enable the FlaggedApi to include RemoteViews in SmartspaceTarget" bug: "300157758" }