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

Commit f62d690b authored by Craig Mautner's avatar Craig Mautner Committed by Android (Google) Code Review
Browse files

Merge "Fix persistent tasks and expand scope"

parents c287e271 43e52ed3
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -894,7 +894,7 @@ package android {
    field public static final int permissionFlags = 16843719; // 0x10103c7
    field public static final int permissionGroup = 16842762; // 0x101000a
    field public static final int permissionGroupFlags = 16843717; // 0x10103c5
    field public static final int persistable = 16843823; // 0x101042f
    field public static final int persistableMode = 16843823; // 0x101042f
    field public static final int persistent = 16842765; // 0x101000d
    field public static final int persistentDrawingCache = 16842990; // 0x10100ee
    field public static final deprecated int phoneNumber = 16843111; // 0x1010167
@@ -8062,6 +8062,7 @@ package android.content.pm {
    field public static final int DOCUMENT_LAUNCH_INTO_EXISTING = 1; // 0x1
    field public static final int DOCUMENT_LAUNCH_NEVER = 3; // 0x3
    field public static final int DOCUMENT_LAUNCH_NONE = 0; // 0x0
    field public static final int DO_NOT_PERSIST = 1; // 0x1
    field public static final int FLAG_ALLOW_TASK_REPARENTING = 64; // 0x40
    field public static final int FLAG_ALWAYS_RETAIN_TASK_STATE = 8; // 0x8
    field public static final int FLAG_AUTO_REMOVE_FROM_RECENTS = 8192; // 0x2000
@@ -8073,13 +8074,14 @@ package android.content.pm {
    field public static final int FLAG_IMMERSIVE = 2048; // 0x800
    field public static final int FLAG_MULTIPROCESS = 1; // 0x1
    field public static final int FLAG_NO_HISTORY = 128; // 0x80
    field public static final int FLAG_PERSISTABLE = 4096; // 0x1000
    field public static final int FLAG_SINGLE_USER = 1073741824; // 0x40000000
    field public static final int FLAG_STATE_NOT_NEEDED = 16; // 0x10
    field public static final int LAUNCH_MULTIPLE = 0; // 0x0
    field public static final int LAUNCH_SINGLE_INSTANCE = 3; // 0x3
    field public static final int LAUNCH_SINGLE_TASK = 2; // 0x2
    field public static final int LAUNCH_SINGLE_TOP = 1; // 0x1
    field public static final int PERSIST_ACROSS_REBOOTS = 2; // 0x2
    field public static final int PERSIST_ROOT_ONLY = 0; // 0x0
    field public static final int SCREEN_ORIENTATION_BEHIND = 3; // 0x3
    field public static final int SCREEN_ORIENTATION_FULL_SENSOR = 10; // 0xa
    field public static final int SCREEN_ORIENTATION_FULL_USER = 13; // 0xd
@@ -8104,6 +8106,7 @@ package android.content.pm {
    field public int maxRecents;
    field public java.lang.String parentActivityName;
    field public java.lang.String permission;
    field public int persistableMode;
    field public int screenOrientation;
    field public int softInputMode;
    field public java.lang.String targetActivity;
+11 −8
Original line number Diff line number Diff line
@@ -929,7 +929,8 @@ public class Activity extends ContextThemeWrapper

    /**
     * Same as {@link #onCreate(android.os.Bundle)} but called for those activities created with
     * the attribute {@link android.R.attr#persistable} set true.
     * the attribute {@link android.R.attr#persistableMode} set to
     * <code>persistAcrossReboots</code>.
     *
     * @param savedInstanceState if the activity is being re-initialized after
     *     previously being shut down then this Bundle contains the data it most
@@ -1012,8 +1013,9 @@ public class Activity extends ContextThemeWrapper

    /**
     * This is the same as {@link #onRestoreInstanceState(Bundle)} but is called for activities
     * created with the attribute {@link android.R.attr#persistable}. The {@link
     * android.os.PersistableBundle} passed came from the restored PersistableBundle first
     * created with the attribute {@link android.R.attr#persistableMode} set to
     * <code>persistAcrossReboots</code>. The {@link android.os.PersistableBundle} passed
     * came from the restored PersistableBundle first
     * saved in {@link #onSaveInstanceState(Bundle, PersistableBundle)}.
     *
     * <p>This method is called between {@link #onStart} and
@@ -1111,7 +1113,8 @@ public class Activity extends ContextThemeWrapper

    /**
     * This is the same as {@link #onPostCreate(Bundle)} but is called for activities
     * created with the attribute {@link android.R.attr#persistable}.
     * created with the attribute {@link android.R.attr#persistableMode} set to
     * <code>persistAcrossReboots</code>.
     *
     * @param savedInstanceState The data most recently supplied in {@link #onSaveInstanceState}
     * @param persistentState The data caming from the PersistableBundle first
@@ -1352,10 +1355,10 @@ public class Activity extends ContextThemeWrapper

    /**
     * This is the same as {@link #onSaveInstanceState} but is called for activities
     * created with the attribute {@link android.R.attr#persistable}. The {@link
     * android.os.PersistableBundle} passed in will be saved and presented in
     * {@link #onCreate(Bundle, PersistableBundle)} the first time that this activity
     * is restarted following the next device reboot.
     * created with the attribute {@link android.R.attr#persistableMode} set to
     * <code>persistAcrossReboots</code>. The {@link android.os.PersistableBundle} passed
     * in will be saved and presented in {@link #onCreate(Bundle, PersistableBundle)}
     * the first time that this activity is restarted following the next device reboot.
     *
     * @param outState Bundle in which to place your saved state.
     * @param outPersistentState State which will be saved across reboots.
+1 −1
Original line number Diff line number Diff line
@@ -319,7 +319,7 @@ public final class ActivityThread {
        }

        public boolean isPersistable() {
            return (activityInfo.flags & ActivityInfo.FLAG_PERSISTABLE) != 0;
            return activityInfo.persistableMode == ActivityInfo.PERSIST_ACROSS_REBOOTS;
        }

        public String toString() {
+1 −0
Original line number Diff line number Diff line
@@ -7375,6 +7375,7 @@ public class Intent implements Parcelable, Cloneable {
            for (int categoryNdx = mCategories.size() - 1; categoryNdx >= 0; --categoryNdx) {
                out.attribute(null, ATTR_CATEGORY, mCategories.valueAt(categoryNdx));
            }
            out.endTag(null, TAG_CATEGORIES);
        }
    }

+35 −7
Original line number Diff line number Diff line
@@ -103,6 +103,28 @@ public class ActivityInfo extends ComponentInfo
     */
    public int documentLaunchMode;

    /**
     * Constant corresponding to <code>persistRootOnly</code> in
     * the {@link android.R.attr#persistableMode} attribute.
     */
    public static final int PERSIST_ROOT_ONLY = 0;
    /**
     * Constant corresponding to <code>doNotPersist</code> in
     * the {@link android.R.attr#persistableMode} attribute.
     */
    public static final int DO_NOT_PERSIST = 1;
    /**
     * Constant corresponding to <code>persistAcrossReboots</code> in
     * the {@link android.R.attr#persistableMode} attribute.
     */
    public static final int PERSIST_ACROSS_REBOOTS = 2;
    /**
     * Value indicating how this activity is to be persisted across
     * reboots for restoring in the Recents list.
     * {@link android.R.attr#persistableMode}
     */
    public int persistableMode;

    /**
     * The maximum number of tasks rooted at this activity that can be in the recent task list.
     * Refer to {@link android.R.attr#maxRecents}.
@@ -229,12 +251,6 @@ public class ActivityInfo extends ComponentInfo
     * @see android.app.Activity#setImmersive(boolean)
     */
    public static final int FLAG_IMMERSIVE = 0x0800;
    /**
     * Bit in {@link #flags} indicating that this activity is to be persisted across
     * reboots for display in the Recents list.
     * {@link android.R.attr#persistable}
     */
    public static final int FLAG_PERSISTABLE = 0x1000;
    /**
     * Bit in {@link #flags} indicating that tasks started with this activity are to be
     * removed from the recent list of tasks when the last activity in the task is finished.
@@ -641,13 +657,23 @@ public class ActivityInfo extends ComponentInfo
        return theme != 0 ? theme : applicationInfo.theme;
    }

    private String persistableModeToString() {
        switch(persistableMode) {
            case PERSIST_ROOT_ONLY: return "PERSIST_ROOT_ONLY";
            case DO_NOT_PERSIST: return "DO_NOT_PERSIST";
            case PERSIST_ACROSS_REBOOTS: return "PERSIST_ACROSS_REBOOTS";
            default: return "UNKNOWN=" + persistableMode;
        }
    }

    public void dump(Printer pw, String prefix) {
        super.dumpFront(pw, prefix);
        if (permission != null) {
            pw.println(prefix + "permission=" + permission);
        }
        pw.println(prefix + "taskAffinity=" + taskAffinity
                + " targetActivity=" + targetActivity);
                + " targetActivity=" + targetActivity
                + " persistableMode=" + persistableModeToString());
        if (launchMode != 0 || flags != 0 || theme != 0) {
            pw.println(prefix + "launchMode=" + launchMode
                    + " flags=0x" + Integer.toHexString(flags)
@@ -688,6 +714,7 @@ public class ActivityInfo extends ComponentInfo
        dest.writeInt(softInputMode);
        dest.writeInt(uiOptions);
        dest.writeString(parentActivityName);
        dest.writeInt(persistableMode);
    }

    public static final Parcelable.Creator<ActivityInfo> CREATOR
@@ -713,5 +740,6 @@ public class ActivityInfo extends ComponentInfo
        softInputMode = source.readInt();
        uiOptions = source.readInt();
        parentActivityName = source.readString();
        persistableMode = source.readInt();
    }
}
Loading