summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorWale Ogunwale <ogunwale@google.com>2017-09-28 17:37:57 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2017-09-28 17:37:57 +0000
commitd562d535af473378c6e0c477cb0515459158cde2 (patch)
treee60ca95724312c7c81a40e024a60a4128f9d4afa /core/java/android
parentf7873f4df4f4a836112e1374bb6ef90300f2a903 (diff)
parent68278568de7479f9fef31517d799c2c254dd1d37 (diff)
Merge changes from topic "stack-gone"
* changes: HOME_STACK_ID, ASSISTANT_STACK_ID, and RECENTS_STACK_ID be gone! Ability to getOrCreateStack by windowingMode/activityType in AM.
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/app/ActivityManager.java190
-rw-r--r--core/java/android/app/IActivityManager.aidl11
-rw-r--r--core/java/android/app/WindowConfiguration.java9
-rw-r--r--core/java/android/view/IWindowManager.aidl4
-rw-r--r--core/java/android/view/WindowManagerPolicy.java5
5 files changed, 81 insertions, 138 deletions
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java
index 5e2e333b4c9c..26f96fbeede1 100644
--- a/core/java/android/app/ActivityManager.java
+++ b/core/java/android/app/ActivityManager.java
@@ -16,10 +16,6 @@
package android.app;
-import static android.app.WindowConfiguration.ACTIVITY_TYPE_ASSISTANT;
-import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
-import static android.app.WindowConfiguration.ACTIVITY_TYPE_RECENTS;
-import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY;
import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
@@ -46,6 +42,7 @@ import android.content.pm.IPackageDataObserver;
import android.content.pm.PackageManager;
import android.content.pm.ParceledListSlice;
import android.content.pm.UserInfo;
+import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Canvas;
@@ -675,10 +672,7 @@ public class ActivityManager {
/** First static stack ID.
* @hide */
- public static final int FIRST_STATIC_STACK_ID = 0;
-
- /** Home activity stack ID. */
- public static final int HOME_STACK_ID = FIRST_STATIC_STACK_ID;
+ private static final int FIRST_STATIC_STACK_ID = 0;
/** ID of stack where fullscreen activities are normally launched into. */
public static final int FULLSCREEN_WORKSPACE_STACK_ID = 1;
@@ -692,15 +686,9 @@ public class ActivityManager {
/** ID of stack that always on top (always visible) when it exist. */
public static final int PINNED_STACK_ID = DOCKED_STACK_ID + 1;
- /** ID of stack that contains the Recents activity. */
- public static final int RECENTS_STACK_ID = PINNED_STACK_ID + 1;
-
- /** ID of stack that contains activities launched by the assistant. */
- public static final int ASSISTANT_STACK_ID = RECENTS_STACK_ID + 1;
-
/** Last static stack stack ID.
* @hide */
- public static final int LAST_STATIC_STACK_ID = ASSISTANT_STACK_ID;
+ private static final int LAST_STATIC_STACK_ID = PINNED_STACK_ID;
/** Start of ID range used by stacks that are created dynamically.
* @hide */
@@ -720,15 +708,6 @@ public class ActivityManager {
}
/**
- * Returns true if dynamic stacks are allowed to be visible behind the input stack.
- * @hide
- */
- // TODO: Figure-out a way to remove.
- public static boolean isDynamicStacksVisibleBehindAllowed(int stackId) {
- return stackId == PINNED_STACK_ID || stackId == ASSISTANT_STACK_ID;
- }
-
- /**
* Returns true if we try to maintain focus in the current stack when the top activity
* finishes.
* @hide
@@ -740,15 +719,6 @@ public class ActivityManager {
}
/**
- * Returns true if the input stack is affected by drag resizing.
- * @hide
- */
- public static boolean isStackAffectedByDragResizing(int stackId) {
- return isStaticStack(stackId) && stackId != PINNED_STACK_ID
- && stackId != ASSISTANT_STACK_ID;
- }
-
- /**
* Returns true if the windows of tasks being moved to the target stack from the source
* stack should be replaced, meaning that window manager will keep the old window around
* until the new is ready.
@@ -760,26 +730,6 @@ public class ActivityManager {
}
/**
- * Return whether a stackId is a stack that be a backdrop to a translucent activity. These
- * are generally fullscreen stacks.
- * @hide
- */
- public static boolean isBackdropToTranslucentActivity(int stackId) {
- return stackId == FULLSCREEN_WORKSPACE_STACK_ID
- || stackId == ASSISTANT_STACK_ID;
- }
-
- /**
- * Returns true if activities from stasks in the given {@param stackId} are allowed to
- * enter picture-in-picture.
- * @hide
- */
- public static boolean isAllowedToEnterPictureInPicture(int stackId) {
- return stackId != HOME_STACK_ID && stackId != ASSISTANT_STACK_ID &&
- stackId != RECENTS_STACK_ID;
- }
-
- /**
* Returns true if the top task in the task is allowed to return home when finished and
* there are other tasks in the stack.
* @hide
@@ -810,34 +760,18 @@ public class ActivityManager {
&& stackId != DOCKED_STACK_ID;
}
- /**
- * Returns true if the input stack id should only be present on a device that supports
- * multi-window mode.
- * @see android.app.ActivityManager#supportsMultiWindow
- * @hide
- */
- // TODO: What about the other side of docked stack if we move this to WindowConfiguration?
- public static boolean isMultiWindowStack(int stackId) {
- return stackId == PINNED_STACK_ID || stackId == FREEFORM_WORKSPACE_STACK_ID
- || stackId == DOCKED_STACK_ID;
- }
-
- /**
- * Returns true if the input {@param stackId} is HOME_STACK_ID or RECENTS_STACK_ID
- * @hide
- */
- public static boolean isHomeOrRecentsStack(int stackId) {
- return stackId == HOME_STACK_ID || stackId == RECENTS_STACK_ID;
- }
-
- /** Returns true if the input stack and its content can affect the device orientation.
+ /** Returns the stack id for the input windowing mode.
* @hide */
- public static boolean canSpecifyOrientation(int stackId) {
- return stackId == HOME_STACK_ID
- || stackId == RECENTS_STACK_ID
- || stackId == FULLSCREEN_WORKSPACE_STACK_ID
- || stackId == ASSISTANT_STACK_ID
- || isDynamicStack(stackId);
+ // TODO: To be removed once we are not using stack id for stuff...
+ public static int getStackIdForWindowingMode(int windowingMode) {
+ switch (windowingMode) {
+ case WINDOWING_MODE_PINNED: return PINNED_STACK_ID;
+ case WINDOWING_MODE_FREEFORM: return FREEFORM_WORKSPACE_STACK_ID;
+ case WINDOWING_MODE_SPLIT_SCREEN_PRIMARY: return DOCKED_STACK_ID;
+ case WINDOWING_MODE_SPLIT_SCREEN_SECONDARY: return FULLSCREEN_WORKSPACE_STACK_ID;
+ case WINDOWING_MODE_FULLSCREEN: return FULLSCREEN_WORKSPACE_STACK_ID;
+ default: return INVALID_STACK_ID;
+ }
}
/** Returns the windowing mode that should be used for this input stack id.
@@ -847,14 +781,9 @@ public class ActivityManager {
final int windowingMode;
switch (stackId) {
case FULLSCREEN_WORKSPACE_STACK_ID:
- case HOME_STACK_ID:
- case RECENTS_STACK_ID:
windowingMode = inSplitScreenMode
? WINDOWING_MODE_SPLIT_SCREEN_SECONDARY : WINDOWING_MODE_FULLSCREEN;
break;
- case ASSISTANT_STACK_ID:
- windowingMode = WINDOWING_MODE_FULLSCREEN;
- break;
case PINNED_STACK_ID:
windowingMode = WINDOWING_MODE_PINNED;
break;
@@ -869,51 +798,6 @@ public class ActivityManager {
}
return windowingMode;
}
-
- /** Returns the stack id for the input windowing mode.
- * @hide */
- // TODO: To be removed once we are not using stack id for stuff...
- public static int getStackIdForWindowingMode(int windowingMode) {
- switch (windowingMode) {
- case WINDOWING_MODE_PINNED: return PINNED_STACK_ID;
- case WINDOWING_MODE_FREEFORM: return FREEFORM_WORKSPACE_STACK_ID;
- case WINDOWING_MODE_SPLIT_SCREEN_PRIMARY: return DOCKED_STACK_ID;
- default: return INVALID_STACK_ID;
- }
- }
-
- /** Returns the activity type that should be used for this input stack id.
- * @hide */
- // TODO: To be removed once we are not using stack id for stuff...
- public static int getActivityTypeForStackId(int stackId) {
- final int activityType;
- switch (stackId) {
- case HOME_STACK_ID:
- activityType = ACTIVITY_TYPE_HOME;
- break;
- case RECENTS_STACK_ID:
- activityType = ACTIVITY_TYPE_RECENTS;
- break;
- case ASSISTANT_STACK_ID:
- activityType = ACTIVITY_TYPE_ASSISTANT;
- break;
- default :
- activityType = ACTIVITY_TYPE_STANDARD;
- }
- return activityType;
- }
-
- /** Returns the stack id for the input activity type.
- * @hide */
- // TODO: To be removed once we are not using stack id for stuff...
- public static int getStackIdForActivityType(int activityType) {
- switch (activityType) {
- case ACTIVITY_TYPE_HOME: return HOME_STACK_ID;
- case ACTIVITY_TYPE_RECENTS: return RECENTS_STACK_ID;
- case ACTIVITY_TYPE_ASSISTANT: return ASSISTANT_STACK_ID;
- default: return INVALID_STACK_ID;
- }
- }
}
/**
@@ -1910,6 +1794,12 @@ public class ActivityManager {
*/
public int resizeMode;
+ /**
+ * The full configuration the task is currently running in.
+ * @hide
+ */
+ public Configuration configuration = new Configuration();
+
public RunningTaskInfo() {
}
@@ -1934,6 +1824,7 @@ public class ActivityManager {
dest.writeInt(numRunning);
dest.writeInt(supportsSplitScreenMultiWindow ? 1 : 0);
dest.writeInt(resizeMode);
+ configuration.writeToParcel(dest, flags);
}
public void readFromParcel(Parcel source) {
@@ -1951,6 +1842,7 @@ public class ActivityManager {
numRunning = source.readInt();
supportsSplitScreenMultiWindow = source.readInt() != 0;
resizeMode = source.readInt();
+ configuration.readFromParcel(source);
}
public static final Creator<RunningTaskInfo> CREATOR = new Creator<RunningTaskInfo>() {
@@ -2133,6 +2025,35 @@ public class ActivityManager {
}
/**
+ * Removes stacks in the windowing modes from the system if they are of activity type
+ * ACTIVITY_TYPE_STANDARD or ACTIVITY_TYPE_UNDEFINED
+ *
+ * @hide
+ */
+ @TestApi
+ public void removeStacksInWindowingModes(int[] windowingModes) throws SecurityException {
+ try {
+ getService().removeStacksInWindowingModes(windowingModes);
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+ }
+
+ /**
+ * Removes stack of the activity types from the system.
+ *
+ * @hide
+ */
+ @TestApi
+ public void removeStacksWithActivityTypes(int[] activityTypes) throws SecurityException {
+ try {
+ getService().removeStacksWithActivityTypes(activityTypes);
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+ }
+
+ /**
* Represents a task snapshot.
* @hide
*/
@@ -2610,6 +2531,11 @@ public class ActivityManager {
public boolean visible;
// Index of the stack in the display's stack list, can be used for comparison of stack order
public int position;
+ /**
+ * The full configuration the stack is currently running in.
+ * @hide
+ */
+ public Configuration configuration = new Configuration();
@Override
public int describeContents() {
@@ -2644,6 +2570,7 @@ public class ActivityManager {
} else {
dest.writeInt(0);
}
+ configuration.writeToParcel(dest, flags);
}
public void readFromParcel(Parcel source) {
@@ -2671,6 +2598,7 @@ public class ActivityManager {
if (source.readInt() > 0) {
topActivity = ComponentName.readFromParcel(source);
}
+ configuration.readFromParcel(source);
}
public static final Creator<StackInfo> CREATOR = new Creator<StackInfo>() {
@@ -2698,6 +2626,8 @@ public class ActivityManager {
sb.append(" displayId="); sb.append(displayId);
sb.append(" userId="); sb.append(userId);
sb.append("\n");
+ sb.append(" configuration="); sb.append(configuration);
+ sb.append("\n");
prefix = prefix + " ";
for (int i = 0; i < taskIds.length; ++i) {
sb.append(prefix); sb.append("taskId="); sb.append(taskIds[i]);
diff --git a/core/java/android/app/IActivityManager.aidl b/core/java/android/app/IActivityManager.aidl
index eccb264796f8..955b46300ea0 100644
--- a/core/java/android/app/IActivityManager.aidl
+++ b/core/java/android/app/IActivityManager.aidl
@@ -380,7 +380,8 @@ interface IActivityManager {
boolean preserveWindows, boolean animate, int animationDuration);
List<ActivityManager.StackInfo> getAllStackInfos();
void setFocusedStack(int stackId);
- ActivityManager.StackInfo getStackInfo(int stackId);
+ ActivityManager.StackInfo getFocusedStackInfo();
+ ActivityManager.StackInfo getStackInfo(int windowingMode, int activityType);
boolean convertFromTranslucent(in IBinder token);
boolean convertToTranslucent(in IBinder token, in Bundle options);
void notifyActivityDrawn(in IBinder token);
@@ -440,7 +441,6 @@ interface IActivityManager {
// Start of M transactions
void notifyCleartextNetwork(int uid, in byte[] firstPacket);
int createStackOnDisplay(int displayId);
- int getFocusedStackId();
void setTaskResizeable(int taskId, int resizeableMode);
boolean requestAssistContextExtras(int requestType, in IResultReceiver receiver,
in Bundle receiverExtras, in IBinder activityToken,
@@ -540,6 +540,13 @@ interface IActivityManager {
void notifyPinnedStackAnimationStarted();
void notifyPinnedStackAnimationEnded();
void removeStack(int stackId);
+ /**
+ * Removes stacks in the input windowing modes from the system if they are of activity type
+ * ACTIVITY_TYPE_STANDARD or ACTIVITY_TYPE_UNDEFINED
+ */
+ void removeStacksInWindowingModes(in int[] windowingModes);
+ /** Removes stack of the activity types from the system. */
+ void removeStacksWithActivityTypes(in int[] activityTypes);
void makePackageIdle(String packageName, int userId);
int getMemoryTrimLevel();
/**
diff --git a/core/java/android/app/WindowConfiguration.java b/core/java/android/app/WindowConfiguration.java
index 0cb38046826f..6b4053842338 100644
--- a/core/java/android/app/WindowConfiguration.java
+++ b/core/java/android/app/WindowConfiguration.java
@@ -500,10 +500,15 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu
* @hide
*/
public boolean supportSplitScreenWindowingMode() {
- if (mActivityType == ACTIVITY_TYPE_ASSISTANT) {
+ return supportSplitScreenWindowingMode(mWindowingMode, mActivityType);
+ }
+
+ /** @hide */
+ public static boolean supportSplitScreenWindowingMode(int windowingMode, int activityType) {
+ if (activityType == ACTIVITY_TYPE_ASSISTANT) {
return false;
}
- return mWindowingMode != WINDOWING_MODE_FREEFORM && mWindowingMode != WINDOWING_MODE_PINNED;
+ return windowingMode != WINDOWING_MODE_FREEFORM && windowingMode != WINDOWING_MODE_PINNED;
}
private static String windowingModeToString(@WindowingMode int windowingMode) {
diff --git a/core/java/android/view/IWindowManager.aidl b/core/java/android/view/IWindowManager.aidl
index e576a0fbdb2b..6e49bac38116 100644
--- a/core/java/android/view/IWindowManager.aidl
+++ b/core/java/android/view/IWindowManager.aidl
@@ -358,10 +358,10 @@ interface IWindowManager
* Updates the dim layer used while resizing.
*
* @param visible Whether the dim layer should be visible.
- * @param targetStackId The id of the task stack the dim layer should be placed on.
+ * @param targetWindowingMode The windowing mode of the stack the dim layer should be placed on.
* @param alpha The translucency of the dim layer, between 0 and 1.
*/
- void setResizeDimLayer(boolean visible, int targetStackId, float alpha);
+ void setResizeDimLayer(boolean visible, int targetWindowingMode, float alpha);
/**
* Requests Keyboard Shortcuts from the displayed window.
diff --git a/core/java/android/view/WindowManagerPolicy.java b/core/java/android/view/WindowManagerPolicy.java
index 4131fd1ae9ff..da72535d54ec 100644
--- a/core/java/android/view/WindowManagerPolicy.java
+++ b/core/java/android/view/WindowManagerPolicy.java
@@ -592,9 +592,10 @@ public interface WindowManagerPolicy {
int getDockedDividerInsetsLw();
/**
- * Retrieves the {@param outBounds} from the stack with id {@param stackId}.
+ * Retrieves the {@param outBounds} from the stack matching the {@param windowingMode} and
+ * {@param activityType}.
*/
- void getStackBounds(int stackId, Rect outBounds);
+ void getStackBounds(int windowingMode, int activityType, Rect outBounds);
/**
* Notifies window manager that {@link #isShowingDreamLw} has changed.