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

Commit 72a7e8b3 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add NEW_TASK flag to intent if metadata matches"

parents e1cf0492 1b75bfcb
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -35,8 +35,7 @@ public class ActivityTile extends Tile {
    private static final String TAG = "ActivityTile";

    public ActivityTile(ActivityInfo info, String category) {
        super(info, category);
        setMetaData(info.metaData);
        super(info, category, info.metaData);
    }

    ActivityTile(Parcel in) {
+1 −2
Original line number Diff line number Diff line
@@ -43,8 +43,7 @@ public class ProviderTile extends Tile {
    private String mKey;

    public ProviderTile(ProviderInfo info, String category, Bundle metaData) {
        super(info, category);
        setMetaData(metaData);
        super(info, category, metaData);
        mAuthority = info.authority;
        mKey = metaData.getString(META_DATA_PREFERENCE_KEYHINT);
    }
+9 −4
Original line number Diff line number Diff line
@@ -71,16 +71,19 @@ public abstract class Tile implements Parcelable {
    private Bundle mMetaData;
    private String mCategory;

    public Tile(ComponentInfo info, String category) {
    public Tile(ComponentInfo info, String category, Bundle metaData) {
        mComponentInfo = info;
        mComponentPackage = mComponentInfo.packageName;
        mComponentName = mComponentInfo.name;
        mCategory = category;
        mMetaData = metaData;
        mIntent = new Intent().setClassName(mComponentPackage, mComponentName);
        if (isNewTask()) {
            mIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        }
    }

    Tile(Parcel in) {
        final boolean isProviderTile = in.readBoolean();
        mComponentPackage = in.readString();
        mComponentName = in.readString();
        mIntent = new Intent().setClassName(mComponentPackage, mComponentName);
@@ -90,6 +93,9 @@ public abstract class Tile implements Parcelable {
        }
        mCategory = in.readString();
        mMetaData = in.readBundle();
        if (isNewTask()) {
            mIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        }
    }

    @Override
@@ -332,8 +338,7 @@ public abstract class Tile implements Parcelable {
    /**
     * Whether the {@link Activity} should be launched in a separate task.
     */
    public boolean isNewTask(Context context) {
        ensureMetadataNotStale(context);
    public boolean isNewTask() {
        if (mMetaData != null
                && mMetaData.containsKey(META_DATA_NEW_TASK)) {
            return mMetaData.getBoolean(META_DATA_NEW_TASK);