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

Commit 89109a24 authored by Wale Ogunwale's avatar Wale Ogunwale Committed by Android (Google) Code Review
Browse files

Merge "Added support for android.R.attr#alwaysFocusable"

parents e8ff81c1 6cae765b
Loading
Loading
Loading
Loading
+23 −21
Original line number Diff line number Diff line
@@ -281,6 +281,29 @@ public class ActivityInfo extends ComponentInfo
     * {@see android.app.Activity#setVrMode(boolean)}.
     */
    public static final int FLAG_ENABLE_VR_MODE = 0x8000;

    /**
     * Bit in {@link #flags} indicating if the activity is resizeable to any dimension.
     * See {@link android.R.attr#resizeableActivity}.
     * @hide
     */
    public static final int FLAG_RESIZEABLE = 0x10000;

    /**
     * Bit in {@link #flags} indicating if the activity is supports picture-in-picture form of
     * multi-window mode. See {@link android.R.attr#supportsPictureInPicture}.
     * @hide
     */
    public static final int FLAG_SUPPORTS_PICTURE_IN_PICTURE = 0x20000;

    /**
     * Bit in {@link #flags} indicating if the activity is always focusable regardless of if it is
     * in a task/stack whose activities are normally not focusable.
     * See android.R.attr#alwaysFocusable.
     * @hide
     */
    public static final int FLAG_ALWAYS_FOCUSABLE = 0x40000;

    /**
     * @hide Bit in {@link #flags}: If set, this component will only be seen
     * by the system user.  Only works with broadcast receivers.  Set from the
@@ -670,20 +693,6 @@ public class ActivityInfo extends ComponentInfo
     */
    public String parentActivityName;

    /**
     * Value indicating if the activity is resizeable to any dimension.
     * See {@link android.R.attr#resizeableActivity}.
     * @hide
     */
    public boolean resizeable;

    /**
     * Value indicating if the activity is supports picture-in-picture form of multi-window mode.
     * See {@link android.R.attr#supportsPictureInPicture}.
     * @hide
     */
    public boolean supportsPip;

    /** @hide */
    public static final int LOCK_TASK_LAUNCH_MODE_DEFAULT = 0;
    /** @hide */
@@ -735,8 +744,6 @@ public class ActivityInfo extends ComponentInfo
        uiOptions = orig.uiOptions;
        parentActivityName = orig.parentActivityName;
        maxRecents = orig.maxRecents;
        resizeable = orig.resizeable;
        supportsPip = orig.supportsPip;
        lockTaskLaunchMode = orig.lockTaskLaunchMode;
        layout = orig.layout;
    }
@@ -791,7 +798,6 @@ public class ActivityInfo extends ComponentInfo
            pw.println(prefix + " uiOptions=0x" + Integer.toHexString(uiOptions));
        }
        if ((flags&DUMP_FLAG_DETAILS) != 0) {
            pw.println(prefix + "resizeable=" + resizeable + " supportsPip=" + supportsPip);
            pw.println(prefix + "lockTaskLaunchMode="
                    + lockTaskLaunchModeToString(lockTaskLaunchMode));
        }
@@ -829,8 +835,6 @@ public class ActivityInfo extends ComponentInfo
        dest.writeString(parentActivityName);
        dest.writeInt(persistableMode);
        dest.writeInt(maxRecents);
        dest.writeInt(resizeable ? 1 : 0);
        dest.writeInt(supportsPip ? 1 : 0);
        dest.writeInt(lockTaskLaunchMode);
        if (layout != null) {
            dest.writeInt(1);
@@ -871,8 +875,6 @@ public class ActivityInfo extends ComponentInfo
        parentActivityName = source.readString();
        persistableMode = source.readInt();
        maxRecents = source.readInt();
        resizeable = (source.readInt() == 1);
        supportsPip = (source.readInt() == 1);
        lockTaskLaunchMode = source.readInt();
        if (source.readInt() == 1) {
            layout = new Layout(source);
+12 −5
Original line number Diff line number Diff line
@@ -3223,12 +3223,19 @@ public class PackageParser {
                a.info.flags |= ActivityInfo.FLAG_RESUME_WHILE_PAUSING;
            }

            a.info.resizeable = sa.getBoolean(
                    R.styleable.AndroidManifestActivity_resizeableActivity,
                    owner.applicationInfo.targetSdkVersion >= Build.VERSION_CODES.N);
            if (sa.getBoolean(R.styleable.AndroidManifestActivity_resizeableActivity,
                    owner.applicationInfo.targetSdkVersion >= Build.VERSION_CODES.N)) {
                a.info.flags |= ActivityInfo.FLAG_RESIZEABLE;

            a.info.supportsPip = a.info.resizeable ? sa.getBoolean(
                    R.styleable.AndroidManifestActivity_supportsPictureInPicture, false) : false;
                if (sa.getBoolean(R.styleable.AndroidManifestActivity_supportsPictureInPicture,
                        false)) {
                    a.info.flags |= ActivityInfo.FLAG_SUPPORTS_PICTURE_IN_PICTURE;
                }
            }

            if (sa.getBoolean(R.styleable.AndroidManifestActivity_alwaysFocusable, false)) {
                a.info.flags |= ActivityInfo.FLAG_ALWAYS_FOCUSABLE;
            }

            a.info.screenOrientation = sa.getInt(
                    R.styleable.AndroidManifestActivity_screenOrientation,
+4 −1
Original line number Diff line number Diff line
@@ -101,11 +101,14 @@ interface IWindowManager
     *                   the task doesn't exist yet.
     * @param configuration Configuration that is being used with this task.
     * @param cropWindowsToStack True if the app windows should be cropped to the stack bounds.
     * @param alwaysFocusable True if the app windows are always focusable regardless of the stack
     *                        they are in.
     */
    void addAppToken(int addPos, IApplicationToken token, int taskId, int stackId,
            int requestedOrientation, boolean fullscreen, boolean showWhenLocked, int userId,
            int configChanges, boolean voiceInteraction, boolean launchTaskBehind,
            in Rect taskBounds, in Configuration configuration, boolean cropWindowsToStack);
            in Rect taskBounds, in Configuration configuration, boolean cropWindowsToStack,
            boolean alwaysFocusable);
    /**
     *
     * @param token The token we are adding to the input task Id.
+5 −0
Original line number Diff line number Diff line
@@ -1857,6 +1857,11 @@
        <attr name="lockTaskMode" />
        <attr name="showForAllUsers" />
        <attr name="encryptionAware" />
        <!-- @hide This activity is always focusable regardless of if it is in a task/stack whose
             activities are normally not focusable.
             For example, {@link android.R.attr#supportsPictureInPicture} activities are placed
             in a task/stack that isn't focusable. This flag allows them to be focusable.-->
        <attr name="alwaysFocusable" format="boolean" />
    </declare-styleable>

    <!-- The <code>activity-alias</code> tag declares a new
+1 −1
Original line number Diff line number Diff line
@@ -7274,7 +7274,7 @@ public final class ActivityManagerService extends ActivityManagerNative
                            + "Can't find activity for token=" + token);
                }
                if (!r.info.supportsPip) {
                if (!r.supportsPictureInPicture()) {
                    throw new IllegalArgumentException("enterPictureInPictureMode: "
                            + "Picture-In-Picture not supported for r=" + r);
                }
Loading