diff options
| author | Wale Ogunwale <ogunwale@google.com> | 2015-12-26 07:36:26 -0800 |
|---|---|---|
| committer | Wale Ogunwale <ogunwale@google.com> | 2016-01-04 22:23:56 +0000 |
| commit | 6cae765b67d3a3b37e2cacbc9816665b5bc080b9 (patch) | |
| tree | 33f08d077dd23e35c92dba6cb8233c6a255e515d /core/java/android | |
| parent | 46ca282851ef12755a64810658a6043e70d6db5d (diff) | |
Added support for android.R.attr#alwaysFocusable
Allows an activity to always be focusable regardless of if it is in a
stack whose activities are normally not focusable. For example, activities
in pinned stack aren't focusable. This flag allows them to be focusable.
Also, changed ActivityInfo.#{resizeable, supportsPip} to use flags.
Bug: 26273032
Bug: 26034613
Change-Id: I8c63e6d3256757e2e6931e08b8a65269f5169d35
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/content/pm/ActivityInfo.java | 44 | ||||
| -rw-r--r-- | core/java/android/content/pm/PackageParser.java | 17 | ||||
| -rw-r--r-- | core/java/android/view/IWindowManager.aidl | 5 |
3 files changed, 39 insertions, 27 deletions
diff --git a/core/java/android/content/pm/ActivityInfo.java b/core/java/android/content/pm/ActivityInfo.java index 326735ec4f36..dedf07f5dcff 100644 --- a/core/java/android/content/pm/ActivityInfo.java +++ b/core/java/android/content/pm/ActivityInfo.java @@ -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); diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java index f445cf8208b6..a14523174b35 100644 --- a/core/java/android/content/pm/PackageParser.java +++ b/core/java/android/content/pm/PackageParser.java @@ -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, diff --git a/core/java/android/view/IWindowManager.aidl b/core/java/android/view/IWindowManager.aidl index 7a379d50ba05..2ef082cbd3dd 100644 --- a/core/java/android/view/IWindowManager.aidl +++ b/core/java/android/view/IWindowManager.aidl @@ -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. |
