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

Commit a76f2fd6 authored by Yi-Ling Chuang's avatar Yi-Ling Chuang
Browse files

Support launching activities in a new task for Injection.

Create a new meta data for clients to determine if an injected item
should be launched in a separate task.

Bug: 197702494
Bug: 197700978
Bug: 197702789
Test: Set this metadata to true and make sure this page is launched in
another task.

Change-Id: Iae6b1e8645aea9e6dc4c89684c12c40b67c852d1
parent ce87ba4e
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.settingslib.drawer;

import static com.android.settingslib.drawer.TileUtils.META_DATA_KEY_ORDER;
import static com.android.settingslib.drawer.TileUtils.META_DATA_KEY_PROFILE;
import static com.android.settingslib.drawer.TileUtils.META_DATA_NEW_TASK;
import static com.android.settingslib.drawer.TileUtils.META_DATA_PREFERENCE_ICON;
import static com.android.settingslib.drawer.TileUtils.META_DATA_PREFERENCE_KEYHINT;
import static com.android.settingslib.drawer.TileUtils.META_DATA_PREFERENCE_SUMMARY;
@@ -328,6 +329,18 @@ public abstract class Tile implements Parcelable {
        return false;
    }

    /**
     * Whether the {@link Activity} should be launched in a separate task.
     */
    public boolean isNewTask(Context context) {
        ensureMetadataNotStale(context);
        if (mMetaData != null
                && mMetaData.containsKey(META_DATA_NEW_TASK)) {
            return mMetaData.getBoolean(META_DATA_NEW_TASK);
        }
        return false;
    }

    /**
     * Ensures metadata is not stale for this tile.
     */
+7 −0
Original line number Diff line number Diff line
@@ -229,6 +229,13 @@ public class TileUtils {
     */
    public static final String META_DATA_KEY_PROFILE = "com.android.settings.profile";

    /**
     * Name of the meta-data item that should be set in the AndroidManifest.xml
     * to specify whether the {@link android.app.Activity} should be launched in a separate task.
     * This should be a boolean value {@code true} or {@code false}, set using {@code android:value}
     */
    public static final String META_DATA_NEW_TASK = "com.android.settings.new_task";

    /**
     * Build a list of DashboardCategory.
     */