am 507e635d: am 5f698449: am 3270172f: am 7618a960: docs: Adding Android Build Tools Release Notes 19.0.1
* commit '507e635d950a6ca17ebe417b51bfc4ad987cf06b':
docs: Adding Android Build Tools Release Notes 19.0.1
diff --git a/cmds/am/src/com/android/commands/am/Am.java b/cmds/am/src/com/android/commands/am/Am.java
index 0344d26..f3432a0 100644
--- a/cmds/am/src/com/android/commands/am/Am.java
+++ b/cmds/am/src/com/android/commands/am/Am.java
@@ -19,7 +19,7 @@
package com.android.commands.am;
import android.app.ActivityManager;
-import android.app.ActivityManager.StackBoxInfo;
+import android.app.ActivityManager.StackInfo;
import android.app.ActivityManagerNative;
import android.app.IActivityController;
import android.app.IActivityManager;
@@ -31,6 +31,7 @@
import android.content.Intent;
import android.content.pm.IPackageManager;
import android.content.pm.ResolveInfo;
+import android.graphics.Rect;
import android.net.Uri;
import android.os.Binder;
import android.os.Bundle;
@@ -106,11 +107,11 @@
" am to-intent-uri [INTENT]\n" +
" am switch-user <USER_ID>\n" +
" am stop-user <USER_ID>\n" +
- " am stack create <TASK_ID> <RELATIVE_STACK_BOX_ID> <POSITION> <WEIGHT>\n" +
+ " am stack create <TASK_ID>\n" +
" am stack movetask <TASK_ID> <STACK_ID> [true|false]\n" +
- " am stack resize <STACK_ID> <WEIGHT>\n" +
- " am stack boxes\n" +
- " am stack box <STACK_BOX_ID>\n" +
+ " am stack resize <STACK_ID> <LEFT,TOP,RIGHT,BOTTOM>\n" +
+ " am stack list\n" +
+ " am stack info <STACK_ID>\n" +
"\n" +
"am start: start an Activity. Options are:\n" +
" -D: enable debugging\n" +
@@ -204,24 +205,16 @@
"am stop-user: stop execution of USER_ID, not allowing it to run any\n" +
" code until a later explicit switch to it.\n" +
"\n" +
- "am stack create: create a new stack relative to an existing one.\n" +
- " <TASK_ID>: the task to populate the new stack with. Must exist.\n" +
- " <RELATIVE_STACK_BOX_ID>: existing stack box's id.\n" +
- " <POSITION>: 0: before <RELATIVE_STACK_BOX_ID>, per RTL/LTR configuration,\n" +
- " 1: after <RELATIVE_STACK_BOX_ID>, per RTL/LTR configuration,\n" +
- " 2: to left of <RELATIVE_STACK_BOX_ID>,\n" +
- " 3: to right of <RELATIVE_STACK_BOX_ID>," +
- " 4: above <RELATIVE_STACK_BOX_ID>, 5: below <RELATIVE_STACK_BOX_ID>\n" +
- " <WEIGHT>: float between 0.2 and 0.8 inclusive.\n" +
+ "am stack create: create a new stack containing <TASK_ID> which must exist\n" +
"\n" +
"am stack movetask: move <TASK_ID> from its current stack to the top (true) or" +
" bottom (false) of <STACK_ID>.\n" +
"\n" +
- "am stack resize: change <STACK_ID> relative size to new <WEIGHT>.\n" +
+ "am stack resize: change <STACK_ID> size and position to <LEFT,TOP,RIGHT,BOTTOM>.\n" +
"\n" +
- "am stack boxes: list the hierarchy of stack boxes and their contents.\n" +
+ "am stack list: list all of the activity stacks and their sizes.\n" +
"\n" +
- "am stack box: list the hierarchy of stack boxes rooted at <STACK_BOX_ID>.\n" +
+ "am stack info: display the information about activity stack <STACK_ID>.\n" +
"\n" +
"<INTENT> specifications include these flags and arguments:\n" +
" [-a <ACTION>] [-d <DATA_URI>] [-t <MIME_TYPE>]\n" +
@@ -1551,11 +1544,11 @@
} else if (op.equals("movetask")) {
runStackMoveTask();
} else if (op.equals("resize")) {
- runStackBoxResize();
- } else if (op.equals("boxes")) {
- runStackBoxes();
- } else if (op.equals("box")) {
- runStackBoxInfo();
+ runStackResize();
+ } else if (op.equals("list")) {
+ runStackList();
+ } else if (op.equals("info")) {
+ runStackInfo();
} else {
showError("Error: unknown command '" + op + "'");
return;
@@ -1565,15 +1558,9 @@
private void runStackCreate() throws Exception {
String taskIdStr = nextArgRequired();
int taskId = Integer.valueOf(taskIdStr);
- String relativeToStr = nextArgRequired();
- int relativeTo = Integer.valueOf(relativeToStr);
- String positionStr = nextArgRequired();
- int position = Integer.valueOf(positionStr);
- String weightStr = nextArgRequired();
- float weight = Float.valueOf(weightStr);
try {
- int stackId = mAm.createStack(taskId, relativeTo, position, weight);
+ int stackId = mAm.createStack(taskId);
System.out.println("createStack returned new stackId=" + stackId + "\n\n");
} catch (RemoteException e) {
}
@@ -1601,34 +1588,40 @@
}
}
- private void runStackBoxResize() throws Exception {
- String stackBoxIdStr = nextArgRequired();
- int stackBoxId = Integer.valueOf(stackBoxIdStr);
- String weightStr = nextArgRequired();
- float weight = Float.valueOf(weightStr);
+ private void runStackResize() throws Exception {
+ String stackIdStr = nextArgRequired();
+ int stackId = Integer.valueOf(stackIdStr);
+ String leftStr = nextArgRequired();
+ int left = Integer.valueOf(leftStr);
+ String topStr = nextArgRequired();
+ int top = Integer.valueOf(topStr);
+ String rightStr = nextArgRequired();
+ int right = Integer.valueOf(rightStr);
+ String bottomStr = nextArgRequired();
+ int bottom = Integer.valueOf(bottomStr);
try {
- mAm.resizeStackBox(stackBoxId, weight);
+ mAm.resizeStack(stackId, new Rect(left, top, right, bottom));
} catch (RemoteException e) {
}
}
- private void runStackBoxes() throws Exception {
+ private void runStackList() throws Exception {
try {
- List<StackBoxInfo> stackBoxes = mAm.getStackBoxes();
- for (StackBoxInfo info : stackBoxes) {
+ List<StackInfo> stacks = mAm.getAllStackInfos();
+ for (StackInfo info : stacks) {
System.out.println(info);
}
} catch (RemoteException e) {
}
}
- private void runStackBoxInfo() throws Exception {
+ private void runStackInfo() throws Exception {
try {
- String stackBoxIdStr = nextArgRequired();
- int stackBoxId = Integer.valueOf(stackBoxIdStr);
- StackBoxInfo stackBoxInfo = mAm.getStackBoxInfo(stackBoxId);
- System.out.println(stackBoxInfo);
+ String stackIdStr = nextArgRequired();
+ int stackId = Integer.valueOf(stackIdStr);
+ StackInfo info = mAm.getStackInfo(stackId);
+ System.out.println(info);
} catch (RemoteException e) {
}
}
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java
index 7ca3459..c877cd3 100644
--- a/core/java/android/app/ActivityManager.java
+++ b/core/java/android/app/ActivityManager.java
@@ -1289,106 +1289,15 @@
}
/**
- * Information you can retrieve about the WindowManager StackBox hierarchy.
- * @hide
- */
- public static class StackBoxInfo implements Parcelable {
- public int stackBoxId;
- public float weight;
- public boolean vertical;
- public Rect bounds;
- public StackBoxInfo[] children;
- public int stackId;
- public StackInfo stack;
-
- @Override
- public int describeContents() {
- return 0;
- }
-
- @Override
- public void writeToParcel(Parcel dest, int flags) {
- dest.writeInt(stackBoxId);
- dest.writeFloat(weight);
- dest.writeInt(vertical ? 1 : 0);
- bounds.writeToParcel(dest, flags);
- dest.writeInt(stackId);
- if (children != null) {
- children[0].writeToParcel(dest, flags);
- children[1].writeToParcel(dest, flags);
- } else {
- stack.writeToParcel(dest, flags);
- }
- }
-
- public void readFromParcel(Parcel source) {
- stackBoxId = source.readInt();
- weight = source.readFloat();
- vertical = source.readInt() == 1;
- bounds = Rect.CREATOR.createFromParcel(source);
- stackId = source.readInt();
- if (stackId == -1) {
- children = new StackBoxInfo[2];
- children[0] = StackBoxInfo.CREATOR.createFromParcel(source);
- children[1] = StackBoxInfo.CREATOR.createFromParcel(source);
- } else {
- stack = StackInfo.CREATOR.createFromParcel(source);
- }
- }
-
- public static final Creator<StackBoxInfo> CREATOR =
- new Creator<ActivityManager.StackBoxInfo>() {
-
- @Override
- public StackBoxInfo createFromParcel(Parcel source) {
- return new StackBoxInfo(source);
- }
-
- @Override
- public StackBoxInfo[] newArray(int size) {
- return new StackBoxInfo[size];
- }
- };
-
- public StackBoxInfo() {
- }
-
- public StackBoxInfo(Parcel source) {
- readFromParcel(source);
- }
-
- public String toString(String prefix) {
- StringBuilder sb = new StringBuilder(256);
- sb.append(prefix); sb.append("Box id=" + stackBoxId); sb.append(" weight=" + weight);
- sb.append(" vertical=" + vertical); sb.append(" bounds=" + bounds.toShortString());
- sb.append("\n");
- if (children != null) {
- sb.append(prefix); sb.append("First child=\n");
- sb.append(children[0].toString(prefix + " "));
- sb.append(prefix); sb.append("Second child=\n");
- sb.append(children[1].toString(prefix + " "));
- } else {
- sb.append(prefix); sb.append("Stack=\n");
- sb.append(stack.toString(prefix + " "));
- }
- return sb.toString();
- }
-
- @Override
- public String toString() {
- return toString("");
- }
- }
-
- /**
* Information you can retrieve about an ActivityStack in the system.
* @hide
*/
public static class StackInfo implements Parcelable {
public int stackId;
- public Rect bounds;
+ public Rect bounds = new Rect();
public int[] taskIds;
public String[] taskNames;
+ public int displayId;
@Override
public int describeContents() {
@@ -1404,6 +1313,7 @@
dest.writeInt(bounds.bottom);
dest.writeIntArray(taskIds);
dest.writeStringArray(taskNames);
+ dest.writeInt(displayId);
}
public void readFromParcel(Parcel source) {
@@ -1412,6 +1322,7 @@
source.readInt(), source.readInt(), source.readInt(), source.readInt());
taskIds = source.createIntArray();
taskNames = source.createStringArray();
+ displayId = source.readInt();
}
public static final Creator<StackInfo> CREATOR = new Creator<StackInfo>() {
@@ -1435,7 +1346,9 @@
public String toString(String prefix) {
StringBuilder sb = new StringBuilder(256);
sb.append(prefix); sb.append("Stack id="); sb.append(stackId);
- sb.append(" bounds="); sb.append(bounds.toShortString()); sb.append("\n");
+ sb.append(" bounds="); sb.append(bounds.toShortString());
+ sb.append(" displayId="); sb.append(displayId);
+ 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/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java
index 74266cc..f0c4c93 100644
--- a/core/java/android/app/ActivityManagerNative.java
+++ b/core/java/android/app/ActivityManagerNative.java
@@ -16,7 +16,7 @@
package android.app;
-import android.app.ActivityManager.StackBoxInfo;
+import android.app.ActivityManager.StackInfo;
import android.content.ComponentName;
import android.content.IIntentReceiver;
import android.content.IIntentSender;
@@ -31,6 +31,7 @@
import android.content.pm.UserInfo;
import android.content.res.Configuration;
import android.graphics.Bitmap;
+import android.graphics.Rect;
import android.net.Uri;
import android.os.Binder;
import android.os.Bundle;
@@ -614,10 +615,7 @@
case CREATE_STACK_TRANSACTION: {
data.enforceInterface(IActivityManager.descriptor);
int taskId = data.readInt();
- int relativeStackId = data.readInt();
- int position = data.readInt();
- float weight = data.readFloat();
- int res = createStack(taskId, relativeStackId, position, weight);
+ int res = createStack(taskId);
reply.writeNoException();
reply.writeInt(res);
return true;
@@ -635,25 +633,26 @@
case RESIZE_STACK_TRANSACTION: {
data.enforceInterface(IActivityManager.descriptor);
- int stackBoxId = data.readInt();
+ int stackId = data.readInt();
float weight = data.readFloat();
- resizeStackBox(stackBoxId, weight);
+ Rect r = Rect.CREATOR.createFromParcel(data);
+ resizeStack(stackId, r);
reply.writeNoException();
return true;
}
- case GET_STACK_BOXES_TRANSACTION: {
+ case GET_ALL_STACK_INFOS_TRANSACTION: {
data.enforceInterface(IActivityManager.descriptor);
- List<StackBoxInfo> list = getStackBoxes();
+ List<StackInfo> list = getAllStackInfos();
reply.writeNoException();
reply.writeTypedList(list);
return true;
}
- case GET_STACK_BOX_INFO_TRANSACTION: {
+ case GET_STACK_INFO_TRANSACTION: {
data.enforceInterface(IActivityManager.descriptor);
- int stackBoxId = data.readInt();
- StackBoxInfo info = getStackBoxInfo(stackBoxId);
+ int stackId = data.readInt();
+ StackInfo info = getStackInfo(stackId);
reply.writeNoException();
if (info != null) {
reply.writeInt(1);
@@ -2715,16 +2714,12 @@
reply.recycle();
}
@Override
- public int createStack(int taskId, int relativeStackBoxId, int position, float weight)
- throws RemoteException
+ public int createStack(int taskId) throws RemoteException
{
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
data.writeInterfaceToken(IActivityManager.descriptor);
data.writeInt(taskId);
- data.writeInt(relativeStackBoxId);
- data.writeInt(position);
- data.writeFloat(weight);
mRemote.transact(CREATE_STACK_TRANSACTION, data, reply, 0);
reply.readException();
int res = reply.readInt();
@@ -2747,44 +2742,44 @@
reply.recycle();
}
@Override
- public void resizeStackBox(int stackBoxId, float weight) throws RemoteException
+ public void resizeStack(int stackBoxId, Rect r) throws RemoteException
{
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
data.writeInterfaceToken(IActivityManager.descriptor);
data.writeInt(stackBoxId);
- data.writeFloat(weight);
+ r.writeToParcel(data, 0);
mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
reply.readException();
data.recycle();
reply.recycle();
}
@Override
- public List<StackBoxInfo> getStackBoxes() throws RemoteException
+ public List<StackInfo> getAllStackInfos() throws RemoteException
{
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
data.writeInterfaceToken(IActivityManager.descriptor);
- mRemote.transact(GET_STACK_BOXES_TRANSACTION, data, reply, 0);
+ mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
reply.readException();
- ArrayList<StackBoxInfo> list = reply.createTypedArrayList(StackBoxInfo.CREATOR);
+ ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
data.recycle();
reply.recycle();
return list;
}
@Override
- public StackBoxInfo getStackBoxInfo(int stackBoxId) throws RemoteException
+ public StackInfo getStackInfo(int stackId) throws RemoteException
{
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
data.writeInterfaceToken(IActivityManager.descriptor);
- data.writeInt(stackBoxId);
- mRemote.transact(GET_STACK_BOX_INFO_TRANSACTION, data, reply, 0);
+ data.writeInt(stackId);
+ mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
reply.readException();
int res = reply.readInt();
- StackBoxInfo info = null;
+ StackInfo info = null;
if (res != 0) {
- info = StackBoxInfo.CREATOR.createFromParcel(reply);
+ info = StackInfo.CREATOR.createFromParcel(reply);
}
data.recycle();
reply.recycle();
diff --git a/core/java/android/app/IActivityManager.java b/core/java/android/app/IActivityManager.java
index 77c2ea0..631d9b1 100644
--- a/core/java/android/app/IActivityManager.java
+++ b/core/java/android/app/IActivityManager.java
@@ -18,7 +18,7 @@
import android.app.ActivityManager.RunningTaskInfo;
import android.app.ActivityManager.RunningServiceInfo;
-import android.app.ActivityManager.StackBoxInfo;
+import android.app.ActivityManager.StackInfo;
import android.content.ComponentName;
import android.content.ContentProviderNative;
import android.content.IContentProvider;
@@ -36,6 +36,7 @@
import android.content.pm.UserInfo;
import android.content.res.Configuration;
import android.graphics.Bitmap;
+import android.graphics.Rect;
import android.net.Uri;
import android.os.Bundle;
import android.os.Debug;
@@ -117,12 +118,11 @@
public void moveTaskToBack(int task) throws RemoteException;
public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot) throws RemoteException;
public void moveTaskBackwards(int task) throws RemoteException;
- public int createStack(int taskId, int relativeStackBoxId, int position, float weight)
- throws RemoteException;
+ public int createStack(int taskId) throws RemoteException;
public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException;
- public void resizeStackBox(int stackBoxId, float weight) throws RemoteException;
- public List<StackBoxInfo> getStackBoxes() throws RemoteException;
- public StackBoxInfo getStackBoxInfo(int stackBoxId) throws RemoteException;
+ public void resizeStack(int stackId, Rect bounds) throws RemoteException;
+ public List<StackInfo> getAllStackInfos() throws RemoteException;
+ public StackInfo getStackInfo(int stackId) throws RemoteException;
public void setFocusedStack(int stackId) throws RemoteException;
public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException;
/* oneway */
@@ -681,9 +681,9 @@
int CREATE_STACK_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+167;
int MOVE_TASK_TO_STACK_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+168;
int RESIZE_STACK_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+169;
- int GET_STACK_BOXES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+170;
+ int GET_ALL_STACK_INFOS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+170;
int SET_FOCUSED_STACK_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+171;
- int GET_STACK_BOX_INFO_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+172;
+ int GET_STACK_INFO_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+172;
int CONVERT_FROM_TRANSLUCENT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+173;
int CONVERT_TO_TRANSLUCENT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+174;
int NOTIFY_ACTIVITY_DRAWN_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+175;
diff --git a/core/java/android/app/IWallpaperManager.aidl b/core/java/android/app/IWallpaperManager.aidl
index 3efd3c0..181eb63 100644
--- a/core/java/android/app/IWallpaperManager.aidl
+++ b/core/java/android/app/IWallpaperManager.aidl
@@ -71,4 +71,14 @@
* Returns the desired minimum height for the wallpaper.
*/
int getHeightHint();
+
+ /**
+ * Returns the name of the wallpaper. Private API.
+ */
+ String getName();
+
+ /**
+ * Informs the service that wallpaper settings have been restored. Private API.
+ */
+ void settingsRestored();
}
diff --git a/core/java/android/view/SurfaceControl.java b/core/java/android/view/SurfaceControl.java
index b22d5cf..a06a20b 100644
--- a/core/java/android/view/SurfaceControl.java
+++ b/core/java/android/view/SurfaceControl.java
@@ -79,9 +79,6 @@
private final String mName;
int mNativeObject; // package visibility only for Surface.java access
- private static final boolean HEADLESS = "1".equals(
- SystemProperties.get("ro.config.headless", "0"));
-
/* flags used in constructor (keep in sync with ISurfaceComposerClient.h) */
/**
@@ -232,8 +229,6 @@
new Throwable());
}
- checkHeadless();
-
mName = name;
mNativeObject = nativeCreate(session, name, w, h, format, flags);
if (mNativeObject == 0) {
@@ -619,10 +614,4 @@
}
nativeScreenshot(display, consumer, width, height, minLayer, maxLayer, allLayers);
}
-
- private static void checkHeadless() {
- if (HEADLESS) {
- throw new UnsupportedOperationException("Device is headless");
- }
- }
}
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index b198937..e546117 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -2522,7 +2522,7 @@
android:hasCode="false"
android:label="@string/android_system_label"
android:allowClearUserData="false"
- android:backupAgent="com.android.server.SystemBackupAgent"
+ android:backupAgent="com.android.server.backup.SystemBackupAgent"
android:killAfterRestore="false"
android:icon="@drawable/ic_launcher_android"
android:supportsRtl="true">
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index c33bd35..f33ab40 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -231,7 +231,6 @@
/** If true, hitting shift & menu will broadcast Intent.ACTION_BUG_REPORT */
boolean mEnableShiftMenuBugReports = false;
- boolean mHeadless;
boolean mSafeMode;
WindowState mStatusBar = null;
int mStatusBarHeight;
@@ -855,7 +854,6 @@
mContext = context;
mWindowManager = windowManager;
mWindowManagerFuncs = windowManagerFuncs;
- mHeadless = "1".equals(SystemProperties.get("ro.config.headless", "0"));
mHandler = new PolicyHandler();
mOrientationListener = new MyOrientationListener(mContext, mHandler);
try {
@@ -3602,9 +3600,6 @@
/** {@inheritDoc} */
public void notifyLidSwitchChanged(long whenNanos, boolean lidOpen) {
- // do nothing if headless
- if (mHeadless) return;
-
// lid changed state
final int newLidState = lidOpen ? LID_OPEN : LID_CLOSED;
if (newLidState == mLidState) {
@@ -3837,7 +3832,7 @@
// the device some other way (which is why we have an exemption here for injected
// events).
int result;
- if ((isScreenOn && !mHeadless) || (isInjected && !isWakeKey)) {
+ if (isScreenOn || (isInjected && !isWakeKey)) {
// When the screen is on or if the key is injected pass the key to the application.
result = ACTION_PASS_TO_USER;
} else {
@@ -4663,10 +4658,9 @@
/** {@inheritDoc} */
@Override
public void systemReady() {
- if (!mHeadless) {
- mKeyguardDelegate = new KeyguardServiceDelegate(mContext, null);
- mKeyguardDelegate.onSystemReady();
- }
+ mKeyguardDelegate = new KeyguardServiceDelegate(mContext, null);
+ mKeyguardDelegate.onSystemReady();
+
synchronized (mLock) {
updateOrientationListenerLp();
mSystemReady = true;
@@ -4693,7 +4687,6 @@
/** {@inheritDoc} */
public void showBootMessage(final CharSequence msg, final boolean always) {
- if (mHeadless) return;
mHandler.post(new Runnable() {
@Override public void run() {
if (mBootMsgDialog == null) {
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index a42cbcf..3a1c747 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -51,7 +51,11 @@
import com.android.server.accounts.AccountManagerService;
import com.android.server.am.ActivityManagerService;
import com.android.server.am.BatteryStatsService;
+import com.android.server.appwidget.AppWidgetService;
+import com.android.server.backup.BackupManagerService;
+import com.android.server.clipboard.ClipboardService;
import com.android.server.content.ContentService;
+import com.android.server.devicepolicy.DevicePolicyManagerService;
import com.android.server.display.DisplayManagerService;
import com.android.server.dreams.DreamManagerService;
import com.android.server.input.InputManagerService;
@@ -67,6 +71,7 @@
import com.android.server.print.PrintManagerService;
import com.android.server.search.SearchManagerService;
import com.android.server.usb.UsbService;
+import com.android.server.wallpaper.WallpaperManagerService;
import com.android.server.wifi.WifiService;
import com.android.server.wm.WindowManagerService;
@@ -122,7 +127,6 @@
String factoryTestStr = SystemProperties.get("ro.factorytest");
int factoryTest = "".equals(factoryTestStr) ? SystemServer.FACTORY_TEST_OFF
: Integer.parseInt(factoryTestStr);
- final boolean headless = "1".equals(SystemProperties.get("ro.config.headless", "0"));
Installer installer = null;
AccountManagerService accountManager = null;
@@ -624,10 +628,8 @@
R.bool.config_enableWallpaperService)) {
try {
Slog.i(TAG, "Wallpaper Service");
- if (!headless) {
- wallpaper = new WallpaperManagerService(context);
- ServiceManager.addService(Context.WALLPAPER_SERVICE, wallpaper);
- }
+ wallpaper = new WallpaperManagerService(context);
+ ServiceManager.addService(Context.WALLPAPER_SERVICE, wallpaper);
} catch (Throwable e) {
reportWtf("starting Wallpaper Service", e);
}
@@ -944,8 +946,10 @@
} catch (Throwable e) {
reportWtf("observing native crashes", e);
}
- if (!headless) {
+ try {
startSystemUi(contextF);
+ } catch (Throwable e) {
+ reportWtf("starting System UI", e);
}
try {
if (mountServiceF != null) mountServiceF.systemReady();
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index fc66e45..05666b4 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -29,7 +29,9 @@
import android.app.AppOpsManager;
import android.appwidget.AppWidgetManager;
+import android.graphics.Rect;
import android.util.ArrayMap;
+import android.view.Display;
import com.android.internal.R;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.app.IAppOpsService;
@@ -52,7 +54,6 @@
import com.android.server.firewall.IntentFirewall;
import com.android.server.pm.UserManagerService;
import com.android.server.wm.AppTransition;
-import com.android.server.wm.StackBox;
import com.android.server.wm.WindowManagerService;
import com.google.android.collect.Lists;
import com.google.android.collect.Maps;
@@ -68,7 +69,6 @@
import android.app.Activity;
import android.app.ActivityManager;
import android.app.ActivityManager.RunningTaskInfo;
-import android.app.ActivityManager.StackBoxInfo;
import android.app.ActivityManager.StackInfo;
import android.app.ActivityManagerNative;
import android.app.ActivityOptions;
@@ -331,8 +331,6 @@
public IntentFirewall mIntentFirewall;
- private final boolean mHeadless;
-
// Whether we should show our dialogs (ANR, crash, etc) or just perform their
// default actuion automatically. Important for devices without direct input
// devices.
@@ -1772,7 +1770,7 @@
public void setWindowManager(WindowManagerService wm) {
mWindowManager = wm;
mStackSupervisor.setWindowManager(wm);
- wm.createStack(HOME_STACK_ID, -1, StackBox.TASK_STACK_GOES_OVER, 1.0f);
+ wm.createStack(HOME_STACK_ID, Display.DEFAULT_DISPLAY);
}
public void startObservingNativeCrashes() {
@@ -1984,8 +1982,6 @@
mGrantFile = new AtomicFile(new File(systemDir, "urigrants.xml"));
- mHeadless = "1".equals(SystemProperties.get("ro.config.headless", "0"));
-
// User 0 is the first and only user that runs at boot.
mStartedUsers.put(0, new UserStartedState(new UserHandle(0), true));
mUserLru.add(Integer.valueOf(0));
@@ -2853,13 +2849,6 @@
}
boolean startHomeActivityLocked(int userId) {
- if (mHeadless) {
- // Added because none of the other calls to ensureBootCompleted seem to fire
- // when running headless.
- ensureBootCompleted();
- return false;
- }
-
if (mFactoryTest == SystemServer.FACTORY_TEST_LOW_LEVEL
&& mTopAction == null) {
// We are running in factory test mode, but unable to find
@@ -5000,7 +4989,7 @@
// See if the top visible activity is waiting to run in this process...
if (normalMode) {
try {
- if (mStackSupervisor.attachApplicationLocked(app, mHeadless)) {
+ if (mStackSupervisor.attachApplicationLocked(app)) {
didSomething = true;
}
} catch (Exception e) {
@@ -7107,16 +7096,15 @@
}
@Override
- public int createStack(int taskId, int relativeStackBoxId, int position, float weight) {
+ public int createStack(int taskId) {
enforceCallingPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS,
"createStack()");
- if (DEBUG_STACK) Slog.d(TAG, "createStack: taskId=" + taskId + " relStackBoxId=" +
- relativeStackBoxId + " position=" + position + " weight=" + weight);
+ if (DEBUG_STACK) Slog.d(TAG, "createStack: taskId=" + taskId);
synchronized (this) {
long ident = Binder.clearCallingIdentity();
try {
int stackId = mStackSupervisor.createStack();
- mWindowManager.createStack(stackId, relativeStackBoxId, position, weight);
+ mWindowManager.createStack(stackId, Display.DEFAULT_DISPLAY);
if (taskId > 0) {
moveTaskToStack(taskId, stackId, true);
}
@@ -7148,99 +7136,40 @@
}
@Override
- public void resizeStackBox(int stackBoxId, float weight) {
+ public void resizeStack(int stackBoxId, Rect bounds) {
enforceCallingPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS,
"resizeStackBox()");
long ident = Binder.clearCallingIdentity();
try {
- mWindowManager.resizeStackBox(stackBoxId, weight);
+ mWindowManager.resizeStack(stackBoxId, bounds);
} finally {
Binder.restoreCallingIdentity(ident);
}
}
- private ArrayList<StackInfo> getStacks() {
- synchronized (this) {
- ArrayList<ActivityManager.StackInfo> list = new ArrayList<ActivityManager.StackInfo>();
- ArrayList<ActivityStack> stacks = mStackSupervisor.getStacks();
- for (ActivityStack stack : stacks) {
- ActivityManager.StackInfo stackInfo = new ActivityManager.StackInfo();
- int stackId = stack.mStackId;
- stackInfo.stackId = stackId;
- stackInfo.bounds = mWindowManager.getStackBounds(stackId);
- ArrayList<TaskRecord> tasks = stack.getAllTasks();
- final int numTasks = tasks.size();
- int[] taskIds = new int[numTasks];
- String[] taskNames = new String[numTasks];
- for (int i = 0; i < numTasks; ++i) {
- final TaskRecord task = tasks.get(i);
- taskIds[i] = task.taskId;
- taskNames[i] = task.origActivity != null ? task.origActivity.flattenToString()
- : task.realActivity != null ? task.realActivity.flattenToString()
- : task.getTopActivity() != null ? task.getTopActivity().packageName
- : "unknown";
- }
- stackInfo.taskIds = taskIds;
- stackInfo.taskNames = taskNames;
- list.add(stackInfo);
- }
- return list;
- }
- }
-
- private void addStackInfoToStackBoxInfo(StackBoxInfo stackBoxInfo, List<StackInfo> stackInfos) {
- final int stackId = stackBoxInfo.stackId;
- if (stackId >= 0) {
- for (StackInfo stackInfo : stackInfos) {
- if (stackId == stackInfo.stackId) {
- stackBoxInfo.stack = stackInfo;
- stackInfos.remove(stackInfo);
- return;
- }
- }
- } else {
- addStackInfoToStackBoxInfo(stackBoxInfo.children[0], stackInfos);
- addStackInfoToStackBoxInfo(stackBoxInfo.children[1], stackInfos);
- }
- }
-
@Override
- public List<StackBoxInfo> getStackBoxes() {
+ public List<StackInfo> getAllStackInfos() {
enforceCallingPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS,
"getStackBoxes()");
long ident = Binder.clearCallingIdentity();
try {
- List<StackBoxInfo> stackBoxInfos = mWindowManager.getStackBoxInfos();
synchronized (this) {
- List<StackInfo> stackInfos = getStacks();
- for (StackBoxInfo stackBoxInfo : stackBoxInfos) {
- addStackInfoToStackBoxInfo(stackBoxInfo, stackInfos);
- }
+ return mStackSupervisor.getAllStackInfos();
}
- return stackBoxInfos;
} finally {
Binder.restoreCallingIdentity(ident);
}
}
@Override
- public StackBoxInfo getStackBoxInfo(int stackBoxId) {
+ public StackInfo getStackInfo(int stackId) {
enforceCallingPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS,
- "getStackBoxInfo()");
+ "getStackInfo()");
long ident = Binder.clearCallingIdentity();
try {
- List<StackBoxInfo> stackBoxInfos = mWindowManager.getStackBoxInfos();
- StackBoxInfo info = null;
synchronized (this) {
- List<StackInfo> stackInfos = getStacks();
- for (StackBoxInfo stackBoxInfo : stackBoxInfos) {
- addStackInfoToStackBoxInfo(stackBoxInfo, stackInfos);
- if (stackBoxInfo.stackBoxId == stackBoxId) {
- info = stackBoxInfo;
- }
- }
+ return mStackSupervisor.getStackInfo(stackId);
}
- return info;
} finally {
Binder.restoreCallingIdentity(ident);
}
@@ -9496,10 +9425,6 @@
private boolean handleAppCrashLocked(ProcessRecord app, String shortMsg, String longMsg,
String stackTrace) {
- if (mHeadless) {
- Log.e(TAG, "handleAppCrashLocked: " + app.processName);
- return false;
- }
long now = SystemClock.uptimeMillis();
Long crashTime;
@@ -14042,9 +13967,6 @@
*/
boolean updateConfigurationLocked(Configuration values,
ActivityRecord starting, boolean persistent, boolean initLocale) {
- // do nothing if we are headless
- if (mHeadless) return true;
-
int changes = 0;
if (values != null) {
diff --git a/services/java/com/android/server/am/ActivityStackSupervisor.java b/services/java/com/android/server/am/ActivityStackSupervisor.java
index 483b4a0..4a46288 100644
--- a/services/java/com/android/server/am/ActivityStackSupervisor.java
+++ b/services/java/com/android/server/am/ActivityStackSupervisor.java
@@ -34,6 +34,7 @@
import android.app.Activity;
import android.app.ActivityManager;
+import android.app.ActivityManager.StackInfo;
import android.app.ActivityOptions;
import android.app.AppGlobals;
import android.app.IActivityManager;
@@ -70,11 +71,11 @@
import android.util.Slog;
import android.util.SparseIntArray;
+import android.view.Display;
import com.android.internal.app.HeavyWeightSwitcherActivity;
import com.android.internal.os.TransferPipe;
import com.android.server.am.ActivityManagerService.PendingActivityLaunch;
import com.android.server.am.ActivityStack.ActivityState;
-import com.android.server.wm.StackBox;
import com.android.server.wm.WindowManagerService;
import java.io.FileDescriptor;
@@ -366,7 +367,7 @@
return resumedActivity;
}
- boolean attachApplicationLocked(ProcessRecord app, boolean headless) throws Exception {
+ boolean attachApplicationLocked(ProcessRecord app) throws Exception {
boolean didSomething = false;
final String processName = app.processName;
for (int stackNdx = mStacks.size() - 1; stackNdx >= 0; --stackNdx) {
@@ -379,10 +380,7 @@
if (hr.app == null && app.uid == hr.info.applicationInfo.uid
&& processName.equals(hr.processName)) {
try {
- if (headless) {
- Slog.e(TAG, "Starting activities not supported on headless device: "
- + hr);
- } else if (realStartActivityLocked(hr, app, true, true)) {
+ if (realStartActivityLocked(hr, app, true, true)) {
didSomething = true;
}
} catch (Exception e) {
@@ -1291,8 +1289,7 @@
}
// Time to create the first app stack for this user.
- int stackId =
- mService.createStack(-1, HOME_STACK_ID, StackBox.TASK_STACK_GOES_OVER, 1.0f);
+ int stackId = mService.createStack(-1);
if (DEBUG_FOCUS || DEBUG_STACK) Slog.d(TAG, "adjustStackFocus: New stack r=" + r +
" stackId=" + stackId);
mFocusedStack = getStack(stackId);
@@ -2647,4 +2644,43 @@
}
}
}
+
+ StackInfo getStackInfo(ActivityStack stack) {
+ StackInfo info = new StackInfo();
+ mWindowManager.getStackBounds(stack.mStackId, info.bounds);
+ info.displayId = Display.DEFAULT_DISPLAY;
+ info.stackId = stack.mStackId;
+
+ ArrayList<TaskRecord> tasks = stack.getAllTasks();
+ final int numTasks = tasks.size();
+ int[] taskIds = new int[numTasks];
+ String[] taskNames = new String[numTasks];
+ for (int i = 0; i < numTasks; ++i) {
+ final TaskRecord task = tasks.get(i);
+ taskIds[i] = task.taskId;
+ taskNames[i] = task.origActivity != null ? task.origActivity.flattenToString()
+ : task.realActivity != null ? task.realActivity.flattenToString()
+ : task.getTopActivity() != null ? task.getTopActivity().packageName
+ : "unknown";
+ }
+ info.taskIds = taskIds;
+ info.taskNames = taskNames;
+ return info;
+ }
+
+ StackInfo getStackInfo(int stackId) {
+ ActivityStack stack = getStack(stackId);
+ if (stack != null) {
+ return getStackInfo(stack);
+ }
+ return null;
+ }
+
+ ArrayList<StackInfo> getAllStackInfos() {
+ ArrayList<StackInfo> list = new ArrayList<StackInfo>();
+ for (int ndx = mStacks.size() - 1; ndx >= 0; --ndx) {
+ list.add(getStackInfo(mStacks.get(ndx)));
+ }
+ return list;
+ }
}
diff --git a/services/java/com/android/server/AppWidgetService.java b/services/java/com/android/server/appwidget/AppWidgetService.java
similarity index 98%
rename from services/java/com/android/server/AppWidgetService.java
rename to services/java/com/android/server/appwidget/AppWidgetService.java
index 203cca6..6fd8871 100644
--- a/services/java/com/android/server/AppWidgetService.java
+++ b/services/java/com/android/server/appwidget/AppWidgetService.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.server;
+package com.android.server.appwidget;
import android.app.ActivityManager;
import android.appwidget.AppWidgetProviderInfo;
@@ -48,7 +48,7 @@
/**
* Redirects calls to this service to the instance of the service for the appropriate user.
*/
-class AppWidgetService extends IAppWidgetService.Stub
+public class AppWidgetService extends IAppWidgetService.Stub
{
private static final String TAG = "AppWidgetService";
@@ -60,7 +60,7 @@
private final SparseArray<AppWidgetServiceImpl> mAppWidgetServices;
- AppWidgetService(Context context) {
+ public AppWidgetService(Context context) {
mContext = context;
mSaveStateHandler = BackgroundThread.getHandler();
diff --git a/services/java/com/android/server/AppWidgetServiceImpl.java b/services/java/com/android/server/appwidget/AppWidgetServiceImpl.java
similarity index 99%
rename from services/java/com/android/server/AppWidgetServiceImpl.java
rename to services/java/com/android/server/appwidget/AppWidgetServiceImpl.java
index 69ae846..98dead3 100644
--- a/services/java/com/android/server/AppWidgetServiceImpl.java
+++ b/services/java/com/android/server/appwidget/AppWidgetServiceImpl.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.server;
+package com.android.server.appwidget;
import android.app.AlarmManager;
import android.app.AppGlobals;
diff --git a/services/java/com/android/server/BackupManagerService.java b/services/java/com/android/server/backup/BackupManagerService.java
similarity index 99%
rename from services/java/com/android/server/BackupManagerService.java
rename to services/java/com/android/server/backup/BackupManagerService.java
index 00bfee7..c2b0d10c 100644
--- a/services/java/com/android/server/BackupManagerService.java
+++ b/services/java/com/android/server/backup/BackupManagerService.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.server;
+package com.android.server.backup;
import android.app.ActivityManagerNative;
import android.app.AlarmManager;
@@ -83,7 +83,8 @@
import com.android.internal.backup.IBackupTransport;
import com.android.internal.backup.IObbBackupService;
import com.android.internal.backup.LocalTransport;
-import com.android.server.PackageManagerBackupAgent.Metadata;
+import com.android.server.EventLogTags;
+import com.android.server.backup.PackageManagerBackupAgent.Metadata;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
@@ -135,7 +136,7 @@
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.spec.SecretKeySpec;
-class BackupManagerService extends IBackupManager.Stub {
+public class BackupManagerService extends IBackupManager.Stub {
private static final String TAG = "BackupManagerService";
private static final boolean DEBUG = true;
private static final boolean MORE_DEBUG = false;
@@ -1178,7 +1179,8 @@
// First, on an encrypted device we require matching the device pw
final boolean isEncrypted;
try {
- isEncrypted = (mMountService.getEncryptionState() != MountService.ENCRYPTION_STATE_NONE);
+ isEncrypted = (mMountService.getEncryptionState() !=
+ IMountService.ENCRYPTION_STATE_NONE);
if (isEncrypted) {
if (DEBUG) {
Slog.i(TAG, "Device encrypted; verifying against device data pw");
@@ -5437,7 +5439,8 @@
boolean isEncrypted;
try {
- isEncrypted = (mMountService.getEncryptionState() != MountService.ENCRYPTION_STATE_NONE);
+ isEncrypted = (mMountService.getEncryptionState() !=
+ IMountService.ENCRYPTION_STATE_NONE);
if (isEncrypted) Slog.w(TAG, "Device is encrypted; forcing enc password");
} catch (RemoteException e) {
// couldn't contact the mount service; fail "safe" and assume encryption
diff --git a/services/java/com/android/server/PackageManagerBackupAgent.java b/services/java/com/android/server/backup/PackageManagerBackupAgent.java
similarity index 99%
rename from services/java/com/android/server/PackageManagerBackupAgent.java
rename to services/java/com/android/server/backup/PackageManagerBackupAgent.java
index 77bddb0..495da88 100644
--- a/services/java/com/android/server/PackageManagerBackupAgent.java
+++ b/services/java/com/android/server/backup/PackageManagerBackupAgent.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.server;
+package com.android.server.backup;
import android.app.backup.BackupAgent;
import android.app.backup.BackupDataInput;
diff --git a/services/java/com/android/server/SystemBackupAgent.java b/services/java/com/android/server/backup/SystemBackupAgent.java
similarity index 79%
rename from services/java/com/android/server/SystemBackupAgent.java
rename to services/java/com/android/server/backup/SystemBackupAgent.java
index 8cf273d..26e2e2a 100644
--- a/services/java/com/android/server/SystemBackupAgent.java
+++ b/services/java/com/android/server/backup/SystemBackupAgent.java
@@ -14,9 +14,10 @@
* limitations under the License.
*/
-package com.android.server;
+package com.android.server.backup;
+import android.app.IWallpaperManager;
import android.app.backup.BackupDataInput;
import android.app.backup.BackupDataOutput;
import android.app.backup.BackupAgentHelper;
@@ -26,11 +27,11 @@
import android.content.Context;
import android.os.Environment;
import android.os.ParcelFileDescriptor;
+import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.UserHandle;
import android.util.Slog;
-
import java.io.File;
import java.io.IOException;
@@ -63,16 +64,23 @@
public void onBackup(ParcelFileDescriptor oldState, BackupDataOutput data,
ParcelFileDescriptor newState) throws IOException {
// We only back up the data under the current "wallpaper" schema with metadata
- WallpaperManagerService wallpaper = (WallpaperManagerService)ServiceManager.getService(
+ IWallpaperManager wallpaper = (IWallpaperManager)ServiceManager.getService(
Context.WALLPAPER_SERVICE);
String[] files = new String[] { WALLPAPER_IMAGE, WALLPAPER_INFO };
String[] keys = new String[] { WALLPAPER_IMAGE_KEY, WALLPAPER_INFO_KEY };
- if (wallpaper != null && wallpaper.getName() != null && wallpaper.getName().length() > 0) {
- // When the wallpaper has a name, back up the info by itself.
- // TODO: Don't rely on the innards of the service object like this!
- // TODO: Send a delete for any stored wallpaper image in this case?
- files = new String[] { WALLPAPER_INFO };
- keys = new String[] { WALLPAPER_INFO_KEY };
+ if (wallpaper != null) {
+ try {
+ final String wallpaperName = wallpaper.getName();
+ if (wallpaperName != null && wallpaperName.length() > 0) {
+ // When the wallpaper has a name, back up the info by itself.
+ // TODO: Don't rely on the innards of the service object like this!
+ // TODO: Send a delete for any stored wallpaper image in this case?
+ files = new String[] { WALLPAPER_INFO };
+ keys = new String[] { WALLPAPER_INFO_KEY };
+ }
+ } catch (RemoteException re) {
+ Slog.e(TAG, "Couldn't get wallpaper name\n" + re);
+ }
}
addHelper("wallpaper", new WallpaperBackupHelper(SystemBackupAgent.this, files, keys));
super.onBackup(oldState, data, newState);
@@ -109,9 +117,15 @@
try {
super.onRestore(data, appVersionCode, newState);
- WallpaperManagerService wallpaper = (WallpaperManagerService)ServiceManager.getService(
+ IWallpaperManager wallpaper = (IWallpaperManager) ServiceManager.getService(
Context.WALLPAPER_SERVICE);
- wallpaper.settingsRestored();
+ if (wallpaper != null) {
+ try {
+ wallpaper.settingsRestored();
+ } catch (RemoteException re) {
+ Slog.e(TAG, "Couldn't restore settings\n" + re);
+ }
+ }
} catch (IOException ex) {
// If there was a failure, delete everything for the wallpaper, this is too aggressive,
// but this is hopefully a rare failure.
@@ -149,10 +163,16 @@
FullBackup.restoreFile(data, size, type, mode, mtime, outFile);
if (restoredWallpaper) {
- WallpaperManagerService wallpaper =
- (WallpaperManagerService)ServiceManager.getService(
+ IWallpaperManager wallpaper =
+ (IWallpaperManager)ServiceManager.getService(
Context.WALLPAPER_SERVICE);
- wallpaper.settingsRestored();
+ if (wallpaper != null) {
+ try {
+ wallpaper.settingsRestored();
+ } catch (RemoteException re) {
+ Slog.e(TAG, "Couldn't restore settings\n" + re);
+ }
+ }
}
} catch (IOException e) {
if (restoredWallpaper) {
diff --git a/services/java/com/android/server/ClipboardService.java b/services/java/com/android/server/clipboard/ClipboardService.java
similarity index 99%
rename from services/java/com/android/server/ClipboardService.java
rename to services/java/com/android/server/clipboard/ClipboardService.java
index 069ae23..6aa596d 100644
--- a/services/java/com/android/server/ClipboardService.java
+++ b/services/java/com/android/server/clipboard/ClipboardService.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.server;
+package com.android.server.clipboard;
import android.app.ActivityManagerNative;
import android.app.AppGlobals;
diff --git a/services/java/com/android/server/DevicePolicyManagerService.java b/services/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
similarity index 99%
rename from services/java/com/android/server/DevicePolicyManagerService.java
rename to services/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index 2bb99d6..53b8dc4 100644
--- a/services/java/com/android/server/DevicePolicyManagerService.java
+++ b/services/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.server;
+package com.android.server.devicepolicy;
import static android.Manifest.permission.MANAGE_CA_CERTIFICATES;
diff --git a/services/java/com/android/server/display/DisplayManagerService.java b/services/java/com/android/server/display/DisplayManagerService.java
index bcb677f..73040d5 100644
--- a/services/java/com/android/server/display/DisplayManagerService.java
+++ b/services/java/com/android/server/display/DisplayManagerService.java
@@ -102,7 +102,6 @@
// Otherwise WFD is enabled according to the value of config_enableWifiDisplay.
private static final String FORCE_WIFI_DISPLAY_ENABLE = "persist.debug.wfd.enable";
- private static final String SYSTEM_HEADLESS = "ro.config.headless";
private static final long WAIT_FOR_DEFAULT_DISPLAY_TIMEOUT = 10000;
private static final int MSG_REGISTER_DEFAULT_DISPLAY_ADAPTER = 1;
@@ -116,7 +115,6 @@
private static final int DISPLAY_BLANK_STATE_UNBLANKED = 2;
private final Context mContext;
- private final boolean mHeadless;
private final DisplayManagerHandler mHandler;
private final Handler mUiHandler;
private final DisplayAdapterListener mDisplayAdapterListener;
@@ -202,8 +200,6 @@
public DisplayManagerService(Context context, Handler mainHandler) {
mContext = context;
- mHeadless = SystemProperties.get(SYSTEM_HEADLESS).equals("1");
-
mHandler = new DisplayManagerHandler(mainHandler.getLooper());
mUiHandler = UiThread.getHandler();
mDisplayAdapterListener = new DisplayAdapterListener();
@@ -270,15 +266,6 @@
}
/**
- * Returns true if the device is headless.
- *
- * @return True if the device is headless.
- */
- public boolean isHeadless() {
- return mHeadless;
- }
-
- /**
* Registers a display transaction listener to provide the client a chance to
* update its surfaces within the same transaction as any display layout updates.
*
@@ -779,13 +766,8 @@
private void registerDefaultDisplayAdapter() {
// Register default display adapter.
synchronized (mSyncRoot) {
- if (mHeadless) {
- registerDisplayAdapterLocked(new HeadlessDisplayAdapter(
- mSyncRoot, mContext, mHandler, mDisplayAdapterListener));
- } else {
- registerDisplayAdapterLocked(new LocalDisplayAdapter(
- mSyncRoot, mContext, mHandler, mDisplayAdapterListener));
- }
+ registerDisplayAdapterLocked(new LocalDisplayAdapter(
+ mSyncRoot, mContext, mHandler, mDisplayAdapterListener));
}
}
@@ -1153,7 +1135,6 @@
pw.println("DISPLAY MANAGER (dumpsys display)");
synchronized (mSyncRoot) {
- pw.println(" mHeadless=" + mHeadless);
pw.println(" mOnlyCode=" + mOnlyCore);
pw.println(" mSafeMode=" + mSafeMode);
pw.println(" mPendingTraversal=" + mPendingTraversal);
diff --git a/services/java/com/android/server/display/HeadlessDisplayAdapter.java b/services/java/com/android/server/display/HeadlessDisplayAdapter.java
deleted file mode 100644
index 7a104d7..0000000
--- a/services/java/com/android/server/display/HeadlessDisplayAdapter.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.server.display;
-
-import android.content.Context;
-import android.os.Handler;
-import android.util.DisplayMetrics;
-import android.view.Display;
-
-/**
- * Provides a fake default display for headless systems.
- * <p>
- * Display adapters are guarded by the {@link DisplayManagerService.SyncRoot} lock.
- * </p>
- */
-final class HeadlessDisplayAdapter extends DisplayAdapter {
- private static final String TAG = "HeadlessDisplayAdapter";
-
- // Called with SyncRoot lock held.
- public HeadlessDisplayAdapter(DisplayManagerService.SyncRoot syncRoot,
- Context context, Handler handler, Listener listener) {
- super(syncRoot, context, handler, listener, TAG);
- }
-
- @Override
- public void registerLocked() {
- super.registerLocked();
- sendDisplayDeviceEventLocked(new HeadlessDisplayDevice(), DISPLAY_DEVICE_EVENT_ADDED);
- }
-
- private final class HeadlessDisplayDevice extends DisplayDevice {
- private DisplayDeviceInfo mInfo;
-
- public HeadlessDisplayDevice() {
- super(HeadlessDisplayAdapter.this, null);
- }
-
- @Override
- public DisplayDeviceInfo getDisplayDeviceInfoLocked() {
- if (mInfo == null) {
- mInfo = new DisplayDeviceInfo();
- mInfo.name = getContext().getResources().getString(
- com.android.internal.R.string.display_manager_built_in_display_name);
- mInfo.width = 640;
- mInfo.height = 480;
- mInfo.refreshRate = 60;
- mInfo.densityDpi = DisplayMetrics.DENSITY_DEFAULT;
- mInfo.xDpi = 160;
- mInfo.yDpi = 160;
- mInfo.flags = DisplayDeviceInfo.FLAG_DEFAULT_DISPLAY
- | DisplayDeviceInfo.FLAG_SECURE
- | DisplayDeviceInfo.FLAG_SUPPORTS_PROTECTED_BUFFERS;
- mInfo.type = Display.TYPE_BUILT_IN;
- mInfo.touch = DisplayDeviceInfo.TOUCH_NONE;
- }
- return mInfo;
- }
- }
-}
diff --git a/services/java/com/android/server/pm/PreferredActivity.java b/services/java/com/android/server/pm/PreferredActivity.java
index f93ba2f..8916926 100644
--- a/services/java/com/android/server/pm/PreferredActivity.java
+++ b/services/java/com/android/server/pm/PreferredActivity.java
@@ -17,7 +17,6 @@
package com.android.server.pm;
import com.android.internal.util.XmlUtils;
-import com.android.server.PreferredComponent;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
diff --git a/services/java/com/android/server/PreferredComponent.java b/services/java/com/android/server/pm/PreferredComponent.java
similarity index 99%
rename from services/java/com/android/server/PreferredComponent.java
rename to services/java/com/android/server/pm/PreferredComponent.java
index a7af252..f437372 100644
--- a/services/java/com/android/server/PreferredComponent.java
+++ b/services/java/com/android/server/pm/PreferredComponent.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.server;
+package com.android.server.pm;
import com.android.internal.util.XmlUtils;
diff --git a/services/java/com/android/server/WallpaperManagerService.java b/services/java/com/android/server/wallpaper/WallpaperManagerService.java
similarity index 98%
rename from services/java/com/android/server/WallpaperManagerService.java
rename to services/java/com/android/server/wallpaper/WallpaperManagerService.java
index e6b6b93..97ea52c 100644
--- a/services/java/com/android/server/WallpaperManagerService.java
+++ b/services/java/com/android/server/wallpaper/WallpaperManagerService.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.server;
+package com.android.server.wallpaper;
import static android.os.ParcelFileDescriptor.*;
@@ -85,8 +85,8 @@
import com.android.internal.util.FastXmlSerializer;
import com.android.internal.util.JournaledFile;
-class WallpaperManagerService extends IWallpaperManager.Stub {
- static final String TAG = "WallpaperService";
+public class WallpaperManagerService extends IWallpaperManager.Stub {
+ static final String TAG = "WallpaperManagerService";
static final boolean DEBUG = false;
final Object mLock = new Object[0];
@@ -98,7 +98,6 @@
static final long MIN_WALLPAPER_CRASH_TIME = 10000;
static final String WALLPAPER = "wallpaper";
static final String WALLPAPER_INFO = "wallpaper_info.xml";
-
/**
* Name of the component used to display bitmap wallpapers from either the gallery or
* built-in wallpapers.
@@ -505,7 +504,12 @@
}
}
- String getName() {
+ /** Called by SystemBackupAgent */
+ public String getName() {
+ // Verify caller is the system
+ if (Binder.getCallingUid() != android.os.Process.SYSTEM_UID) {
+ throw new RuntimeException("getName() can only be called from the system process");
+ }
synchronized (mLock) {
return mWallpaperMap.get(0).name;
}
@@ -1175,7 +1179,11 @@
}
// Called by SystemBackupAgent after files are restored to disk.
- void settingsRestored() {
+ public void settingsRestored() {
+ // Verify caller is the system
+ if (Binder.getCallingUid() != android.os.Process.SYSTEM_UID) {
+ throw new RuntimeException("settingsRestored() can only be called from the system process");
+ }
// TODO: If necessary, make it work for secondary users as well. This currently assumes
// restores only to the primary user
if (DEBUG) Slog.v(TAG, "settingsRestored");
diff --git a/services/java/com/android/server/wm/DimLayer.java b/services/java/com/android/server/wm/DimLayer.java
index c189ddd..978d5b7 100644
--- a/services/java/com/android/server/wm/DimLayer.java
+++ b/services/java/com/android/server/wm/DimLayer.java
@@ -166,7 +166,7 @@
final int dw, dh;
final float xPos, yPos;
- if (mStack.hasSibling()) {
+ if (!mStack.isFullscreen()) {
dw = mBounds.width();
dh = mBounds.height();
xPos = mBounds.left;
diff --git a/services/java/com/android/server/wm/DisplayContent.java b/services/java/com/android/server/wm/DisplayContent.java
index d358b4c..4352ece 100644
--- a/services/java/com/android/server/wm/DisplayContent.java
+++ b/services/java/com/android/server/wm/DisplayContent.java
@@ -21,10 +21,8 @@
import static com.android.server.wm.WindowManagerService.DEBUG_VISIBILITY;
import static com.android.server.wm.WindowManagerService.TAG;
-import android.app.ActivityManager.StackBoxInfo;
import android.graphics.Rect;
import android.graphics.Region;
-import android.os.Debug;
import android.util.EventLog;
import android.util.Slog;
import android.view.Display;
@@ -74,6 +72,7 @@
private final Display mDisplay;
Rect mBaseDisplayRect = new Rect();
+ Rect mContentRect = new Rect();
// Accessed directly by all users.
boolean layoutNeeded;
@@ -92,11 +91,12 @@
*/
final AppTokenList mExitingAppTokens = new AppTokenList();
- /** Array containing the home StackBox and possibly one more which would contain apps. Array
+ /** Array containing all TaskStacks on this display. Array
* is stored in display order with the current bottom stack at 0. */
- private ArrayList<StackBox> mStackBoxes = new ArrayList<StackBox>();
+ private ArrayList<TaskStack> mStacks = new ArrayList<TaskStack>();
- /** True when the home StackBox is at the top of mStackBoxes, false otherwise. */
+ /** A special TaskStack with id==HOME_STACK_ID that moves to the bottom whenever any TaskStack
+ * (except a future lockscreen TaskStack) moves to the top. */
private TaskStack mHomeStack = null;
/** Detect user tapping outside of current focused stack bounds .*/
@@ -123,13 +123,6 @@
display.getDisplayInfo(mDisplayInfo);
isDefaultDisplay = mDisplayId == Display.DEFAULT_DISPLAY;
mService = service;
-
- StackBox newBox = new StackBox(service, this, null);
- mStackBoxes.add(newBox);
- TaskStack newStack = new TaskStack(service, HOME_STACK_ID, this);
- newStack.mStackBox = newBox;
- newBox.mStack = newStack;
- mHomeStack = newStack;
}
int getDisplayId() {
@@ -155,10 +148,6 @@
return mDisplay.hasAccess(uid);
}
- boolean homeOnTop() {
- return mStackBoxes.get(0).mStack != mHomeStack;
- }
-
public boolean isPrivate() {
return (mDisplay.getFlags() & Display.FLAG_PRIVATE) != 0;
}
@@ -205,7 +194,18 @@
}
void updateDisplayInfo() {
+ // Save old size.
+ int oldWidth = mDisplayInfo.logicalWidth;
+ int oldHeight = mDisplayInfo.logicalHeight;
mDisplay.getDisplayInfo(mDisplayInfo);
+
+ for (int i = mStacks.size() - 1; i >= 0; --i) {
+ final TaskStack stack = mStacks.get(i);
+ if (!stack.isFullscreen()) {
+ stack.resizeBounds(oldWidth, oldHeight, mDisplayInfo.logicalWidth,
+ mDisplayInfo.logicalHeight);
+ }
+ }
}
void getLogicalDisplayRect(Rect out) {
@@ -227,159 +227,58 @@
return count;
}
- /** Refer to {@link WindowManagerService#createStack(int, int, int, float)} */
- TaskStack createStack(int stackId, int relativeStackBoxId, int position, float weight) {
- TaskStack newStack = null;
- if (DEBUG_STACK) Slog.d(TAG, "createStack: stackId=" + stackId + " relativeStackBoxId="
- + relativeStackBoxId + " position=" + position + " weight=" + weight);
+ /** Refer to {@link WindowManagerService#createStack(int, int)} */
+ TaskStack createStack(int stackId) {
+ if (DEBUG_STACK) Slog.d(TAG, "createStack: stackId=" + stackId);
+ TaskStack newStack = new TaskStack(mService, stackId, this);
if (stackId == HOME_STACK_ID) {
- if (mStackBoxes.size() != 1) {
+ if (mHomeStack != null) {
throw new IllegalArgumentException("createStack: HOME_STACK_ID (0) not first.");
}
- newStack = mHomeStack;
- } else {
- int stackBoxNdx;
- for (stackBoxNdx = mStackBoxes.size() - 1; stackBoxNdx >= 0; --stackBoxNdx) {
- final StackBox box = mStackBoxes.get(stackBoxNdx);
- if (position == StackBox.TASK_STACK_GOES_OVER
- || position == StackBox.TASK_STACK_GOES_UNDER) {
- // Position indicates a new box is added at top level only.
- if (box.contains(relativeStackBoxId)) {
- StackBox newBox = new StackBox(mService, this, null);
- newStack = new TaskStack(mService, stackId, this);
- newStack.mStackBox = newBox;
- newBox.mStack = newStack;
- final int offset = position == StackBox.TASK_STACK_GOES_OVER ? 1 : 0;
- if (DEBUG_STACK) Slog.d(TAG, "createStack: inserting stack at " +
- (stackBoxNdx + offset));
- mStackBoxes.add(stackBoxNdx + offset, newBox);
- break;
- }
- } else {
- // Remaining position values indicate a box must be split.
- newStack = box.split(stackId, relativeStackBoxId, position, weight);
- if (newStack != null) {
- break;
- }
- }
- }
- if (stackBoxNdx < 0) {
- throw new IllegalArgumentException("createStack: stackBoxId " + relativeStackBoxId
- + " not found.");
- }
+ mHomeStack = newStack;
}
- if (newStack != null) {
- layoutNeeded = true;
- }
- EventLog.writeEvent(EventLogTags.WM_STACK_CREATED, stackId, relativeStackBoxId, position,
- (int)(weight * 100 + 0.5));
+ mStacks.add(newStack);
+ layoutNeeded = true;
return newStack;
}
- /** Refer to {@link WindowManagerService#resizeStackBox(int, float)} */
- boolean resizeStack(int stackBoxId, float weight) {
- for (int stackBoxNdx = mStackBoxes.size() - 1; stackBoxNdx >= 0; --stackBoxNdx) {
- final StackBox box = mStackBoxes.get(stackBoxNdx);
- if (box.resize(stackBoxId, weight)) {
- layoutNeeded = true;
+ void moveStack(TaskStack stack, boolean toTop) {
+ mStacks.remove(stack);
+ mStacks.add(toTop ? mStacks.size() : 0, stack);
+ }
+
+ TaskStack topStack() {
+ return mStacks.get(mStacks.size() - 1);
+ }
+
+ /**
+ * Propagate the new bounds to all child stacks.
+ * @param contentRect The bounds to apply at the top level.
+ */
+ void resize(Rect contentRect) {
+ mContentRect.set(contentRect);
+ }
+
+ boolean getStackBounds(int stackId, Rect bounds) {
+ for (int stackNdx = mStacks.size() - 1; stackNdx >= 0; --stackNdx) {
+ final TaskStack stack = mStacks.get(stackNdx);
+ if (stackId == stack.mStackId) {
+ bounds.set(stack.mBounds);
return true;
}
}
return false;
}
- void addStackBox(StackBox box, boolean toTop) {
- if (mStackBoxes.size() >= 2) {
- throw new RuntimeException("addStackBox: Too many toplevel StackBoxes!");
- }
- mStackBoxes.add(toTop ? mStackBoxes.size() : 0, box);
- }
-
- void removeStackBox(StackBox box) {
- if (DEBUG_STACK) Slog.d(TAG, "removeStackBox: box=" + box);
- final TaskStack stack = box.mStack;
- if (stack != null && stack.mStackId == HOME_STACK_ID) {
- // Never delete the home stack, even if it is empty.
- if (DEBUG_STACK) Slog.d(TAG, "removeStackBox: Not deleting home stack.");
- return;
- }
- mStackBoxes.remove(box);
- }
-
- StackBoxInfo getStackBoxInfo(StackBox box) {
- StackBoxInfo info = new StackBoxInfo();
- info.stackBoxId = box.mStackBoxId;
- info.weight = box.mWeight;
- info.vertical = box.mVertical;
- info.bounds = new Rect(box.mBounds);
- if (box.mStack != null) {
- info.stackId = box.mStack.mStackId;
- // ActivityManagerService will fill in the StackInfo.
- } else {
- info.stackId = -1;
- info.children = new StackBoxInfo[2];
- info.children[0] = getStackBoxInfo(box.mFirst);
- info.children[1] = getStackBoxInfo(box.mSecond);
- }
- return info;
- }
-
- ArrayList<StackBoxInfo> getStackBoxInfos() {
- ArrayList<StackBoxInfo> list = new ArrayList<StackBoxInfo>();
- for (int stackBoxNdx = mStackBoxes.size() - 1; stackBoxNdx >= 0; --stackBoxNdx) {
- list.add(getStackBoxInfo(mStackBoxes.get(stackBoxNdx)));
- }
- return list;
- }
-
- /**
- * Move the home StackBox to the top or bottom of mStackBoxes. That is the only place
- * it is allowed to be. This is a nop if the home StackBox is already in the correct position.
- * @param toTop Move home to the top of mStackBoxes if true, to the bottom if false.
- * @return true if a change was made, false otherwise.
- */
- boolean moveHomeStackBox(boolean toTop) {
- if (DEBUG_STACK) Slog.d(TAG, "moveHomeStackBox: toTop=" + toTop + " Callers=" +
- Debug.getCallers(4));
- EventLog.writeEvent(EventLogTags.WM_HOME_STACK_MOVED, toTop ? 1 : 0);
- switch (mStackBoxes.size()) {
- case 0: throw new RuntimeException("moveHomeStackBox: No home StackBox!");
- case 1: return false; // Only the home StackBox exists.
- case 2:
- if (homeOnTop() ^ toTop) {
- mStackBoxes.add(mStackBoxes.remove(0));
- return true;
- }
- return false;
- default: throw new RuntimeException("moveHomeStackBox: Too many toplevel StackBoxes!");
- }
- }
-
- /**
- * Propagate the new bounds to all child stack boxes, applying weights as we move down.
- * @param contentRect The bounds to apply at the top level.
- */
- boolean setStackBoxSize(Rect contentRect) {
- boolean change = false;
- for (int stackBoxNdx = mStackBoxes.size() - 1; stackBoxNdx >= 0; --stackBoxNdx) {
- change |= mStackBoxes.get(stackBoxNdx).setStackBoxSizes(contentRect, true);
- }
- return change;
- }
-
- Rect getStackBounds(int stackId) {
- for (int stackBoxNdx = mStackBoxes.size() - 1; stackBoxNdx >= 0; --stackBoxNdx) {
- Rect bounds = mStackBoxes.get(stackBoxNdx).getStackBounds(stackId);
- if (bounds != null) {
- return bounds;
+ int stackIdFromPoint(int x, int y) {
+ for (int stackNdx = mStacks.size() - 1; stackNdx >= 0; --stackNdx) {
+ final TaskStack stack = mStacks.get(stackNdx);
+ stack.getBounds(mTmpRect);
+ if (mTmpRect.contains(x, y)) {
+ return stack.mStackId;
}
}
- return null;
- }
-
- int stackIdFromPoint(int x, int y) {
- StackBox topBox = mStackBoxes.get(mStackBoxes.size() - 1);
- return topBox.stackIdFromPoint(x, y);
+ return -1;
}
void setTouchExcludeRegion(TaskStack focusedStack) {
@@ -408,48 +307,48 @@
}
}
- for (int stackBoxNdx = mStackBoxes.size() - 1; stackBoxNdx >= 0; --stackBoxNdx) {
- mStackBoxes.get(stackBoxNdx).switchUserStacks(newUserId);
+ for (int stackNdx = mStacks.size() - 1; stackNdx >= 0; --stackNdx) {
+ mStacks.get(stackNdx).switchUser(newUserId);
}
}
void resetAnimationBackgroundAnimator() {
- for (int stackBoxNdx = mStackBoxes.size() - 1; stackBoxNdx >= 0; --stackBoxNdx) {
- mStackBoxes.get(stackBoxNdx).resetAnimationBackgroundAnimator();
+ for (int stackNdx = mStacks.size() - 1; stackNdx >= 0; --stackNdx) {
+ mStacks.get(stackNdx).resetAnimationBackgroundAnimator();
}
}
boolean animateDimLayers() {
boolean result = false;
- for (int stackBoxNdx = mStackBoxes.size() - 1; stackBoxNdx >= 0; --stackBoxNdx) {
- result |= mStackBoxes.get(stackBoxNdx).animateDimLayers();
+ for (int stackNdx = mStacks.size() - 1; stackNdx >= 0; --stackNdx) {
+ result |= mStacks.get(stackNdx).animateDimLayers();
}
return result;
}
void resetDimming() {
- for (int stackBoxNdx = mStackBoxes.size() - 1; stackBoxNdx >= 0; --stackBoxNdx) {
- mStackBoxes.get(stackBoxNdx).resetDimming();
+ for (int stackNdx = mStacks.size() - 1; stackNdx >= 0; --stackNdx) {
+ mStacks.get(stackNdx).resetDimmingTag();
}
}
boolean isDimming() {
boolean result = false;
- for (int stackBoxNdx = mStackBoxes.size() - 1; stackBoxNdx >= 0; --stackBoxNdx) {
- result |= mStackBoxes.get(stackBoxNdx).isDimming();
+ for (int stackNdx = mStacks.size() - 1; stackNdx >= 0; --stackNdx) {
+ result |= mStacks.get(stackNdx).isDimming();
}
return result;
}
void stopDimmingIfNeeded() {
- for (int stackBoxNdx = mStackBoxes.size() - 1; stackBoxNdx >= 0; --stackBoxNdx) {
- mStackBoxes.get(stackBoxNdx).stopDimmingIfNeeded();
+ for (int stackNdx = mStacks.size() - 1; stackNdx >= 0; --stackNdx) {
+ mStacks.get(stackNdx).stopDimmingIfNeeded();
}
}
void close() {
- for (int stackBoxNdx = mStackBoxes.size() - 1; stackBoxNdx >= 0; --stackBoxNdx) {
- mStackBoxes.get(stackBoxNdx).close();
+ for (int stackNdx = mStacks.size() - 1; stackNdx >= 0; --stackNdx) {
+ mStacks.get(stackNdx).close();
}
}
@@ -477,9 +376,10 @@
pw.print("-"); pw.print(mDisplayInfo.largestNominalAppWidth);
pw.print("x"); pw.println(mDisplayInfo.largestNominalAppHeight);
pw.print(subPrefix); pw.print("layoutNeeded="); pw.println(layoutNeeded);
- for (int boxNdx = 0; boxNdx < mStackBoxes.size(); ++boxNdx) {
- pw.print(prefix); pw.print("StackBox #"); pw.println(boxNdx);
- mStackBoxes.get(boxNdx).dump(prefix + " ", pw);
+ for (int stackNdx = mStacks.size() - 1; stackNdx >= 0; --stackNdx) {
+ final TaskStack stack = mStacks.get(stackNdx);
+ pw.print(prefix); pw.print("mStacks[" + stackNdx + "]"); pw.println(stack.mStackId);
+ stack.dump(prefix + " ", pw);
}
int ndx = numTokens();
if (ndx > 0) {
diff --git a/services/java/com/android/server/wm/FocusedStackFrame.java b/services/java/com/android/server/wm/FocusedStackFrame.java
index cc48b86..f1f5fe8 100644
--- a/services/java/com/android/server/wm/FocusedStackFrame.java
+++ b/services/java/com/android/server/wm/FocusedStackFrame.java
@@ -41,7 +41,7 @@
private final SurfaceControl mSurfaceControl;
private final Surface mSurface = new Surface();
private final Rect mLastBounds = new Rect();
- private final Rect mBounds = new Rect();
+ final Rect mBounds = new Rect();
private final Rect mTmpDrawRect = new Rect();
public FocusedStackFrame(Display display, SurfaceSession session) {
@@ -131,9 +131,9 @@
}
}
- public void setBounds(Rect bounds) {
- if (false && DEBUG_STACK) Slog.i(TAG, "setBounds: bounds=" + bounds);
- mBounds.set(bounds);
+ public void setBounds(TaskStack stack) {
+ stack.getBounds(mBounds);
+ if (false && DEBUG_STACK) Slog.i(TAG, "setBounds: bounds=" + mBounds);
}
public void setLayer(int layer) {
diff --git a/services/java/com/android/server/wm/InputMonitor.java b/services/java/com/android/server/wm/InputMonitor.java
index 3d2ec45..803b9ac 100644
--- a/services/java/com/android/server/wm/InputMonitor.java
+++ b/services/java/com/android/server/wm/InputMonitor.java
@@ -58,6 +58,8 @@
private final Object mInputDevicesReadyMonitor = new Object();
private boolean mInputDevicesReady;
+ Rect mTmpRect = new Rect();
+
public InputMonitor(WindowManagerService service) {
mService = service;
}
@@ -175,7 +177,8 @@
if (modal && child.mAppToken != null) {
// Limit the outer touch to the activity stack region.
flags |= WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
- inputWindowHandle.touchableRegion.set(child.getStackBounds());
+ child.getStackBounds(mTmpRect);
+ inputWindowHandle.touchableRegion.set(mTmpRect);
} else {
// Not modal or full screen modal
child.getTouchableRegion(inputWindowHandle.touchableRegion);
diff --git a/services/java/com/android/server/wm/StackBox.java b/services/java/com/android/server/wm/StackBox.java
deleted file mode 100644
index d351925..0000000
--- a/services/java/com/android/server/wm/StackBox.java
+++ /dev/null
@@ -1,414 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.server.wm;
-
-import android.graphics.Rect;
-import android.util.Slog;
-
-import static com.android.server.am.ActivityStackSupervisor.HOME_STACK_ID;
-import static com.android.server.wm.WindowManagerService.DEBUG_STACK;
-import static com.android.server.wm.WindowManagerService.TAG;
-
-import java.io.PrintWriter;
-
-public class StackBox {
- /** Used with {@link WindowManagerService#createStack}. Dependent on Configuration LTR/RTL. */
- public static final int TASK_STACK_GOES_BEFORE = 0;
- /** Used with {@link WindowManagerService#createStack}. Dependent on Configuration LTR/RTL. */
- public static final int TASK_STACK_GOES_AFTER = 1;
- /** Used with {@link WindowManagerService#createStack}. Horizontal to left of. */
- public static final int TASK_STACK_TO_LEFT_OF = 2;
- /** Used with {@link WindowManagerService#createStack}. Horizontal to right of. */
- public static final int TASK_STACK_TO_RIGHT_OF = 3;
- /** Used with {@link WindowManagerService#createStack}. Vertical: lower t/b Rect values. */
- public static final int TASK_STACK_GOES_ABOVE = 4;
- /** Used with {@link WindowManagerService#createStack}. Vertical: higher t/b Rect values. */
- public static final int TASK_STACK_GOES_BELOW = 5;
- /** Used with {@link WindowManagerService#createStack}. Put on a higher layer on display. */
- public static final int TASK_STACK_GOES_OVER = 6;
- /** Used with {@link WindowManagerService#createStack}. Put on a lower layer on display. */
- public static final int TASK_STACK_GOES_UNDER = 7;
-
- static int sCurrentBoxId = 0;
-
- /** Unique id for this box */
- final int mStackBoxId;
-
- /** The service */
- final WindowManagerService mService;
-
- /** The display this box sits in. */
- final DisplayContent mDisplayContent;
-
- /** Non-null indicates this is mFirst or mSecond of a parent StackBox. Null indicates this
- * is this entire size of mDisplayContent. */
- StackBox mParent;
-
- /** First child, this is null exactly when mStack is non-null. */
- StackBox mFirst;
-
- /** Second child, this is null exactly when mStack is non-null. */
- StackBox mSecond;
-
- /** Stack of Tasks, this is null exactly when mFirst and mSecond are non-null. */
- TaskStack mStack;
-
- /** Content limits relative to the DisplayContent this sits in. */
- Rect mBounds = new Rect();
-
- /** Relative orientation of mFirst and mSecond. */
- boolean mVertical;
-
- /** Fraction of mBounds to devote to mFirst, remainder goes to mSecond */
- float mWeight;
-
- /** Dirty flag. Something inside this or some descendant of this has changed. */
- boolean layoutNeeded;
-
- /** True if this StackBox sits below the Status Bar. */
- boolean mUnderStatusBar;
-
- /** Used to keep from reallocating a temporary Rect for propagating bounds to child boxes */
- Rect mTmpRect = new Rect();
-
- StackBox(WindowManagerService service, DisplayContent displayContent, StackBox parent) {
- synchronized (StackBox.class) {
- mStackBoxId = sCurrentBoxId++;
- }
-
- mService = service;
- mDisplayContent = displayContent;
- mParent = parent;
- }
-
- /** Propagate #layoutNeeded bottom up. */
- void makeDirty() {
- layoutNeeded = true;
- if (mParent != null) {
- mParent.makeDirty();
- }
- }
-
- /**
- * Determine if a particular StackBox is this one or a descendant of this one.
- * @param stackBoxId The StackBox being searched for.
- * @return true if the specified StackBox matches this or one of its descendants.
- */
- boolean contains(int stackBoxId) {
- return mStackBoxId == stackBoxId ||
- (mStack == null && (mFirst.contains(stackBoxId) || mSecond.contains(stackBoxId)));
- }
-
- /**
- * Return the stackId of the stack that intersects the passed point.
- * @param x coordinate of point.
- * @param y coordinate of point.
- * @return -1 if point is outside of mBounds, otherwise the stackId of the containing stack.
- */
- int stackIdFromPoint(int x, int y) {
- if (!mBounds.contains(x, y)) {
- return -1;
- }
- if (mStack != null) {
- return mStack.mStackId;
- }
- int stackId = mFirst.stackIdFromPoint(x, y);
- if (stackId >= 0) {
- return stackId;
- }
- return mSecond.stackIdFromPoint(x, y);
- }
-
- /** Determine if this StackBox is the first child or second child.
- * @return true if this is the first child.
- */
- boolean isFirstChild() {
- return mParent != null && mParent.mFirst == this;
- }
-
- /** Returns the bounds of the specified TaskStack if it is contained in this StackBox.
- * @param stackId the TaskStack to find the bounds of.
- * @return a new Rect with the bounds of stackId if it is within this StackBox, null otherwise.
- */
- Rect getStackBounds(int stackId) {
- if (mStack != null) {
- return mStack.mStackId == stackId ? new Rect(mBounds) : null;
- }
- Rect bounds = mFirst.getStackBounds(stackId);
- if (bounds != null) {
- return bounds;
- }
- return mSecond.getStackBounds(stackId);
- }
-
- /**
- * Create a new TaskStack relative to a specified one by splitting the StackBox containing
- * the specified TaskStack into two children. The size and position each of the new StackBoxes
- * is determined by the passed parameters.
- * @param stackId The id of the new TaskStack to create.
- * @param relativeStackBoxId The id of the StackBox to place the new TaskStack next to.
- * @param position One of the static TASK_STACK_GOES_xxx positions defined in this class.
- * @param weight The percentage size of the parent StackBox to devote to the new TaskStack.
- * @return The new TaskStack.
- */
- TaskStack split(int stackId, int relativeStackBoxId, int position, float weight) {
- if (mStackBoxId != relativeStackBoxId) {
- // This is not the targeted StackBox.
- if (mStack != null) {
- return null;
- }
- // Propagate the split to see if the targeted StackBox is in either sub box.
- TaskStack stack = mFirst.split(stackId, relativeStackBoxId, position, weight);
- if (stack != null) {
- return stack;
- }
- return mSecond.split(stackId, relativeStackBoxId, position, weight);
- }
-
- // Found it!
- TaskStack stack = new TaskStack(mService, stackId, mDisplayContent);
- TaskStack firstStack;
- TaskStack secondStack;
- if (position == TASK_STACK_GOES_BEFORE) {
- // TODO: Test Configuration here for LTR/RTL.
- position = TASK_STACK_TO_LEFT_OF;
- } else if (position == TASK_STACK_GOES_AFTER) {
- // TODO: Test Configuration here for LTR/RTL.
- position = TASK_STACK_TO_RIGHT_OF;
- }
- switch (position) {
- default:
- case TASK_STACK_TO_LEFT_OF:
- case TASK_STACK_TO_RIGHT_OF:
- mVertical = false;
- if (position == TASK_STACK_TO_LEFT_OF) {
- mWeight = weight;
- firstStack = stack;
- secondStack = mStack;
- } else {
- mWeight = 1.0f - weight;
- firstStack = mStack;
- secondStack = stack;
- }
- break;
- case TASK_STACK_GOES_ABOVE:
- case TASK_STACK_GOES_BELOW:
- mVertical = true;
- if (position == TASK_STACK_GOES_ABOVE) {
- mWeight = weight;
- firstStack = stack;
- secondStack = mStack;
- } else {
- mWeight = 1.0f - weight;
- firstStack = mStack;
- secondStack = stack;
- }
- break;
- }
-
- mFirst = new StackBox(mService, mDisplayContent, this);
- firstStack.mStackBox = mFirst;
- mFirst.mStack = firstStack;
-
- mSecond = new StackBox(mService, mDisplayContent, this);
- secondStack.mStackBox = mSecond;
- mSecond.mStack = secondStack;
-
- mStack = null;
- return stack;
- }
-
- /** Return the stackId of the first mFirst StackBox with a non-null mStack */
- int getStackId() {
- if (mStack != null) {
- return mStack.mStackId;
- }
- return mFirst.getStackId();
- }
-
- /** Remove this box and propagate its sibling's content up to their parent.
- * @return The first stackId of the resulting StackBox. */
- int remove() {
- mDisplayContent.layoutNeeded = true;
-
- if (mParent == null) {
- // This is the top-plane stack.
- if (DEBUG_STACK) Slog.i(TAG, "StackBox.remove: removing top plane.");
- mDisplayContent.removeStackBox(this);
- return HOME_STACK_ID;
- }
-
- StackBox sibling = isFirstChild() ? mParent.mSecond : mParent.mFirst;
- StackBox grandparent = mParent.mParent;
- sibling.mParent = grandparent;
- if (grandparent == null) {
- // mParent is a top-plane stack. Now sibling will be.
- if (DEBUG_STACK) Slog.i(TAG, "StackBox.remove: grandparent null");
- mDisplayContent.removeStackBox(mParent);
- mDisplayContent.addStackBox(sibling, true);
- } else {
- if (DEBUG_STACK) Slog.i(TAG, "StackBox.remove: grandparent getting sibling");
- if (mParent.isFirstChild()) {
- grandparent.mFirst = sibling;
- } else {
- grandparent.mSecond = sibling;
- }
- }
- return sibling.getStackId();
- }
-
- boolean resize(int stackBoxId, float weight) {
- if (mStackBoxId != stackBoxId) {
- return mStack == null &&
- (mFirst.resize(stackBoxId, weight) || mSecond.resize(stackBoxId, weight));
- }
- // Don't change weight on topmost stack.
- if (mParent != null) {
- mParent.mWeight = isFirstChild() ? weight : 1.0f - weight;
- }
- return true;
- }
-
- /** If this is a terminal StackBox (contains a TaskStack) set the bounds.
- * @param bounds The rectangle to set the bounds to.
- * @param underStatusBar True if the StackBox is directly below the Status Bar.
- * @return True if the bounds changed, false otherwise. */
- boolean setStackBoxSizes(Rect bounds, boolean underStatusBar) {
- boolean change = false;
- if (mUnderStatusBar != underStatusBar) {
- change = true;
- mUnderStatusBar = underStatusBar;
- }
- if (mStack != null) {
- change |= !mBounds.equals(bounds);
- if (change) {
- mBounds.set(bounds);
- mStack.setBounds(bounds, underStatusBar);
- }
- } else {
- mTmpRect.set(bounds);
- if (mVertical) {
- final int height = bounds.height();
- int firstHeight = (int)(height * mWeight);
- mTmpRect.bottom = bounds.top + firstHeight;
- change |= mFirst.setStackBoxSizes(mTmpRect, underStatusBar);
- mTmpRect.top = mTmpRect.bottom;
- mTmpRect.bottom = bounds.top + height;
- change |= mSecond.setStackBoxSizes(mTmpRect, false);
- } else {
- final int width = bounds.width();
- int firstWidth = (int)(width * mWeight);
- mTmpRect.right = bounds.left + firstWidth;
- change |= mFirst.setStackBoxSizes(mTmpRect, underStatusBar);
- mTmpRect.left = mTmpRect.right;
- mTmpRect.right = bounds.left + width;
- change |= mSecond.setStackBoxSizes(mTmpRect, underStatusBar);
- }
- }
- return change;
- }
-
- void resetAnimationBackgroundAnimator() {
- if (mStack != null) {
- mStack.resetAnimationBackgroundAnimator();
- return;
- }
- mFirst.resetAnimationBackgroundAnimator();
- mSecond.resetAnimationBackgroundAnimator();
- }
-
- boolean animateDimLayers() {
- if (mStack != null) {
- return mStack.animateDimLayers();
- }
- boolean result = mFirst.animateDimLayers();
- result |= mSecond.animateDimLayers();
- return result;
- }
-
- void resetDimming() {
- if (mStack != null) {
- mStack.resetDimmingTag();
- return;
- }
- mFirst.resetDimming();
- mSecond.resetDimming();
- }
-
- boolean isDimming() {
- if (mStack != null) {
- return mStack.isDimming();
- }
- boolean result = mFirst.isDimming();
- result |= mSecond.isDimming();
- return result;
- }
-
- void stopDimmingIfNeeded() {
- if (mStack != null) {
- mStack.stopDimmingIfNeeded();
- return;
- }
- mFirst.stopDimmingIfNeeded();
- mSecond.stopDimmingIfNeeded();
- }
-
- void switchUserStacks(int userId) {
- if (mStack != null) {
- mStack.switchUser(userId);
- return;
- }
- mFirst.switchUserStacks(userId);
- mSecond.switchUserStacks(userId);
- }
-
- void close() {
- if (mStack != null) {
- mStack.mDimLayer.mDimSurface.destroy();
- mStack.mAnimationBackgroundSurface.mDimSurface.destroy();
- return;
- }
- mFirst.close();
- mSecond.close();
- }
-
- public void dump(String prefix, PrintWriter pw) {
- pw.print(prefix); pw.print("mParent="); pw.println(mParent);
- pw.print(prefix); pw.print("mBounds="); pw.print(mBounds.toShortString());
- pw.print(" mVertical="); pw.print(mVertical);
- pw.print(" layoutNeeded="); pw.println(layoutNeeded);
- if (mFirst != null) {
- pw.print(prefix); pw.print("mFirst="); pw.println(System.identityHashCode(mFirst));
- mFirst.dump(prefix + " ", pw);
- pw.print(prefix); pw.print("mSecond="); pw.println(System.identityHashCode(mSecond));
- mSecond.dump(prefix + " ", pw);
- } else {
- pw.print(prefix); pw.print("mStack="); pw.println(mStack);
- mStack.dump(prefix + " ", pw);
- }
- }
-
- @Override
- public String toString() {
- if (mStack != null) {
- return "Box{" + hashCode() + " stack=" + mStack.mStackId + "}";
- }
- return "Box{" + hashCode() + " parent=" + System.identityHashCode(mParent)
- + " first=" + System.identityHashCode(mFirst)
- + " second=" + System.identityHashCode(mSecond) + "}";
- }
-}
diff --git a/services/java/com/android/server/wm/TaskStack.java b/services/java/com/android/server/wm/TaskStack.java
index cb29df4..df1d108 100644
--- a/services/java/com/android/server/wm/TaskStack.java
+++ b/services/java/com/android/server/wm/TaskStack.java
@@ -26,8 +26,6 @@
import android.util.TypedValue;
import com.android.server.EventLogTags;
-import static com.android.server.am.ActivityStackSupervisor.HOME_STACK_ID;
-
import java.io.PrintWriter;
import java.util.ArrayList;
@@ -49,8 +47,9 @@
* mTaskHistory in the ActivityStack with the same mStackId */
private final ArrayList<Task> mTasks = new ArrayList<Task>();
- /** The StackBox this sits in. */
- StackBox mStackBox;
+ /** Content limits relative to the DisplayContent this sits in. Empty indicates fullscreen,
+ * Nonempty is size of this TaskStack but is also used to scale if DisplayContent changes. */
+ Rect mBounds = new Rect();
/** Used to support {@link android.view.WindowManager.LayoutParams#FLAG_DIM_BEHIND} */
final DimLayer mDimLayer;
@@ -74,6 +73,9 @@
mDisplayContent = displayContent;
mDimLayer = new DimLayer(service, this);
mAnimationBackgroundSurface = new DimLayer(service, this);
+ // TODO: remove bounds from log, they are always 0.
+ EventLog.writeEvent(EventLogTags.WM_STACK_CREATED, stackId, mBounds.left, mBounds.top,
+ mBounds.right, mBounds.bottom);
}
DisplayContent getDisplayContent() {
@@ -84,12 +86,64 @@
return mTasks;
}
- boolean isHomeStack() {
- return mStackId == HOME_STACK_ID;
+ private void resizeWindows() {
+ final boolean underStatusBar = mBounds.top == 0;
+
+ final ArrayList<WindowState> resizingWindows = mService.mResizingWindows;
+ for (int taskNdx = mTasks.size() - 1; taskNdx >= 0; --taskNdx) {
+ final ArrayList<AppWindowToken> activities = mTasks.get(taskNdx).mAppTokens;
+ for (int activityNdx = activities.size() - 1; activityNdx >= 0; --activityNdx) {
+ final ArrayList<WindowState> windows = activities.get(activityNdx).allAppWindows;
+ for (int winNdx = windows.size() - 1; winNdx >= 0; --winNdx) {
+ final WindowState win = windows.get(winNdx);
+ if (!resizingWindows.contains(win)) {
+ if (WindowManagerService.DEBUG_RESIZE) Slog.d(TAG,
+ "setBounds: Resizing " + win);
+ resizingWindows.add(win);
+ }
+ win.mUnderStatusBar = underStatusBar;
+ }
+ }
+ }
}
- boolean hasSibling() {
- return mStackBox.mParent != null;
+ boolean setBounds(Rect bounds) {
+ if (mBounds.equals(bounds)) {
+ return false;
+ }
+
+ mDimLayer.setBounds(bounds);
+ mAnimationBackgroundSurface.setBounds(bounds);
+ mBounds.set(bounds);
+
+ resizeWindows();
+ return true;
+ }
+
+ void getBounds(Rect out) {
+ if (mBounds.isEmpty()) {
+ mDisplayContent.getLogicalDisplayRect(out);
+ } else {
+ out.set(mBounds);
+ }
+ out.intersect(mDisplayContent.mContentRect);
+ }
+
+ boolean isFullscreen() {
+ return mBounds.isEmpty();
+ }
+
+ void resizeBounds(float oldWidth, float oldHeight, float newWidth, float newHeight) {
+ if (oldWidth == newWidth && oldHeight == newHeight) {
+ return;
+ }
+ float widthScale = newWidth / oldWidth;
+ float heightScale = newHeight / oldHeight;
+ mBounds.left = (int)(mBounds.left * widthScale + 0.5);
+ mBounds.top = (int)(mBounds.top * heightScale + 0.5);
+ mBounds.right = (int)(mBounds.right * widthScale + 0.5);
+ mBounds.bottom = (int)(mBounds.bottom * heightScale + 0.5);
+ resizeWindows();
}
/**
@@ -97,9 +151,7 @@
* @param task The task to add.
* @param toTop Whether to add it to the top or bottom.
*/
- boolean addTask(Task task, boolean toTop) {
- mStackBox.makeDirty();
-
+ void addTask(Task task, boolean toTop) {
int stackNdx;
if (!toTop) {
stackNdx = 0;
@@ -122,20 +174,20 @@
task.mStack = this;
mDisplayContent.addTask(task, toTop);
- return mDisplayContent.moveHomeStackBox(mStackId == HOME_STACK_ID);
+ mDisplayContent.moveStack(this, true);
}
- boolean moveTaskToTop(Task task) {
+ void moveTaskToTop(Task task) {
if (DEBUG_TASK_MOVEMENT) Slog.d(TAG, "moveTaskToTop: task=" + task + " Callers="
+ Debug.getCallers(6));
mTasks.remove(task);
- return addTask(task, true);
+ addTask(task, true);
}
- boolean moveTaskToBottom(Task task) {
+ void moveTaskToBottom(Task task) {
if (DEBUG_TASK_MOVEMENT) Slog.d(TAG, "moveTaskToBottom: task=" + task);
mTasks.remove(task);
- return addTask(task, false);
+ addTask(task, false);
}
/**
@@ -145,7 +197,6 @@
*/
void removeTask(Task task) {
if (DEBUG_TASK_MOVEMENT) Slog.d(TAG, "removeTask: task=" + task);
- mStackBox.makeDirty();
mTasks.remove(task);
mDisplayContent.removeTask(task);
}
@@ -154,7 +205,7 @@
mAnimationBackgroundSurface.destroySurface();
mDimLayer.destroySurface();
EventLog.writeEvent(EventLogTags.WM_STACK_REMOVED, mStackId);
- return mStackBox.remove();
+ return mDisplayContent.topStack().mStackId;
}
void resetAnimationBackgroundAnimator() {
@@ -259,28 +310,6 @@
}
}
- void setBounds(Rect bounds, boolean underStatusBar) {
- mDimLayer.setBounds(bounds);
- mAnimationBackgroundSurface.setBounds(bounds);
-
- final ArrayList<WindowState> resizingWindows = mService.mResizingWindows;
- for (int taskNdx = mTasks.size() - 1; taskNdx >= 0; --taskNdx) {
- final ArrayList<AppWindowToken> activities = mTasks.get(taskNdx).mAppTokens;
- for (int activityNdx = activities.size() - 1; activityNdx >= 0; --activityNdx) {
- final ArrayList<WindowState> windows = activities.get(activityNdx).allAppWindows;
- for (int winNdx = windows.size() - 1; winNdx >= 0; --winNdx) {
- final WindowState win = windows.get(winNdx);
- if (!resizingWindows.contains(win)) {
- if (WindowManagerService.DEBUG_RESIZE) Slog.d(TAG,
- "setBounds: Resizing " + win);
- resizingWindows.add(win);
- }
- win.mUnderStatusBar = underStatusBar;
- }
- }
- }
- }
-
void switchUser(int userId) {
int top = mTasks.size();
for (int taskNdx = 0; taskNdx < top; ++taskNdx) {
@@ -293,6 +322,11 @@
}
}
+ void close() {
+ mDimLayer.mDimSurface.destroy();
+ mAnimationBackgroundSurface.mDimSurface.destroy();
+ }
+
public void dump(String prefix, PrintWriter pw) {
pw.print(prefix); pw.print("mStackId="); pw.println(mStackId);
for (int taskNdx = 0; taskNdx < mTasks.size(); ++taskNdx) {
diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java
index f9773a6..e50d61f 100644
--- a/services/java/com/android/server/wm/WindowManagerService.java
+++ b/services/java/com/android/server/wm/WindowManagerService.java
@@ -45,7 +45,6 @@
import com.android.server.power.ShutdownThread;
import android.Manifest;
-import android.app.ActivityManager.StackBoxInfo;
import android.app.ActivityManagerNative;
import android.app.IActivityManager;
import android.app.StatusBarManager;
@@ -293,8 +292,6 @@
final private KeyguardDisableHandler mKeyguardDisableHandler;
- private final boolean mHeadless;
-
final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
@@ -734,7 +731,6 @@
com.android.internal.R.bool.config_sf_limitedAlpha);
mInputManager = inputManager; // Must be before createDisplayContentLocked.
mDisplayManagerService = displayManager;
- mHeadless = displayManager.isHeadless();
mDisplaySettings = new DisplaySettings(context);
mDisplaySettings.readSettingsLocked();
@@ -3778,10 +3774,8 @@
if (stack == null) {
mFocusedStackFrame.setVisibility(false);
} else {
- final StackBox box = stack.mStackBox;
- final Rect bounds = box.mBounds;
- final boolean multipleStacks = box.mParent != null;
- mFocusedStackFrame.setBounds(bounds);
+ mFocusedStackFrame.setBounds(stack);
+ final boolean multipleStacks = !stack.isFullscreen();
mFocusedStackFrame.setVisibility(multipleStacks);
}
} finally {
@@ -4788,10 +4782,12 @@
}
final TaskStack stack = task.mStack;
final DisplayContent displayContent = task.getDisplayContent();
- final boolean isHomeStackTask = stack.isHomeStack();
- if (isHomeStackTask != displayContent.homeOnTop()) {
- // First move the stack itself.
- displayContent.moveHomeStackBox(isHomeStackTask);
+ displayContent.moveStack(stack, true);
+ final TaskStack homeStack = displayContent.getHomeStack();
+ if (homeStack != stack) {
+ // When a non-home stack moves to the top, the home stack moves to the
+ // bottom.
+ displayContent.moveStack(homeStack, false);
}
stack.moveTaskToTop(task);
}
@@ -4822,36 +4818,19 @@
/**
* Create a new TaskStack and place it next to an existing stack.
* @param stackId The unique identifier of the new stack.
- * @param relativeStackBoxId The existing stack that this stack goes before or after.
- * @param position One of:
- * {@link StackBox#TASK_STACK_GOES_BEFORE}
- * {@link StackBox#TASK_STACK_GOES_AFTER}
- * {@link StackBox#TASK_STACK_GOES_ABOVE}
- * {@link StackBox#TASK_STACK_GOES_BELOW}
- * {@link StackBox#TASK_STACK_GOES_UNDER}
- * {@link StackBox#TASK_STACK_GOES_OVER}
- * @param weight Relative weight for determining how big to make the new TaskStack.
*/
- public void createStack(int stackId, int relativeStackBoxId, int position, float weight) {
+ public void createStack(int stackId, int displayId) {
synchronized (mWindowMap) {
- if (position <= StackBox.TASK_STACK_GOES_BELOW &&
- (weight < STACK_WEIGHT_MIN || weight > STACK_WEIGHT_MAX)) {
- throw new IllegalArgumentException(
- "createStack: weight must be between " + STACK_WEIGHT_MIN + " and " +
- STACK_WEIGHT_MAX + ", weight=" + weight);
- }
final int numDisplays = mDisplayContents.size();
for (int displayNdx = 0; displayNdx < numDisplays; ++displayNdx) {
final DisplayContent displayContent = mDisplayContents.valueAt(displayNdx);
- TaskStack stack = displayContent.createStack(stackId, relativeStackBoxId, position,
- weight);
- if (stack != null) {
+ if (displayContent.getDisplayId() == displayId) {
+ TaskStack stack = displayContent.createStack(stackId);
mStackIdToStack.put(stackId, stack);
performLayoutAndPlaceSurfacesLocked();
return;
}
}
- Slog.e(TAG, "createStack: Unable to find relativeStackBoxId=" + relativeStackBoxId);
}
}
@@ -4898,40 +4877,27 @@
}
}
- public void resizeStackBox(int stackBoxId, float weight) {
- if (weight < STACK_WEIGHT_MIN || weight > STACK_WEIGHT_MAX) {
- throw new IllegalArgumentException(
- "resizeStack: weight must be between " + STACK_WEIGHT_MIN + " and " +
- STACK_WEIGHT_MAX + ", weight=" + weight);
- }
+ public void resizeStack(int stackId, Rect bounds) {
synchronized (mWindowMap) {
- final int numDisplays = mDisplayContents.size();
- for (int displayNdx = 0; displayNdx < numDisplays; ++displayNdx) {
- if (mDisplayContents.valueAt(displayNdx).resizeStack(stackBoxId, weight)) {
- performLayoutAndPlaceSurfacesLocked();
- return;
- }
+ final TaskStack stack = mStackIdToStack.get(stackId);
+ if (stack == null) {
+ throw new IllegalArgumentException("resizeStack: stackId " + stackId
+ + " not found.");
}
- }
- throw new IllegalArgumentException("resizeStack: stackBoxId " + stackBoxId
- + " not found.");
- }
-
- public ArrayList<StackBoxInfo> getStackBoxInfos() {
- synchronized(mWindowMap) {
- return getDefaultDisplayContentLocked().getStackBoxInfos();
+ if (stack.setBounds(bounds)) {
+ stack.getDisplayContent().layoutNeeded = true;
+ performLayoutAndPlaceSurfacesLocked();
+ }
}
}
- public Rect getStackBounds(int stackId) {
- final int numDisplays = mDisplayContents.size();
- for (int displayNdx = 0; displayNdx < numDisplays; ++displayNdx) {
- Rect bounds = mDisplayContents.valueAt(displayNdx).getStackBounds(stackId);
- if (bounds != null) {
- return bounds;
- }
+ public void getStackBounds(int stackId, Rect bounds) {
+ final TaskStack stack = mStackIdToStack.get(stackId);
+ if (stack != null) {
+ stack.getBounds(bounds);
+ return;
}
- return null;
+ bounds.setEmpty();
}
// -------------------------------------------------------------
@@ -5259,7 +5225,7 @@
public void performBootTimeout() {
synchronized(mWindowMap) {
- if (mDisplayEnabled || mHeadless) {
+ if (mDisplayEnabled) {
return;
}
Slog.w(TAG, "***** BOOT TIMEOUT: forcing display enabled");
@@ -5443,7 +5409,6 @@
// only allow disables from pids which have count on, etc.
@Override
public void showStrictModeViolation(boolean on) {
- if (mHeadless) return;
int pid = Binder.getCallingPid();
mH.sendMessage(mH.obtainMessage(H.SHOW_STRICT_MODE_VIOLATION, on ? 1 : 0, pid));
}
@@ -5589,7 +5554,7 @@
continue;
}
appWin = ws;
- stackBounds.set(ws.getStackBounds());
+ ws.getStackBounds(stackBounds);
}
}
@@ -8218,7 +8183,7 @@
}
mPolicy.getContentRectLw(mTmpContentRect);
- displayContent.setStackBoxSize(mTmpContentRect);
+ displayContent.resize(mTmpContentRect);
int seq = mLayoutSeq+1;
if (seq < 0) seq = 0;
diff --git a/services/java/com/android/server/wm/WindowState.java b/services/java/com/android/server/wm/WindowState.java
index 4d53cea..e6c1e98 100644
--- a/services/java/com/android/server/wm/WindowState.java
+++ b/services/java/com/android/server/wm/WindowState.java
@@ -463,8 +463,8 @@
mHaveFrame = true;
TaskStack stack = mAppToken != null ? getStack() : null;
- if (stack != null && stack.hasSibling()) {
- mContainingFrame.set(getStackBounds(stack));
+ if (stack != null && !stack.isFullscreen()) {
+ getStackBounds(stack, mContainingFrame);
if (mUnderStatusBar) {
mContainingFrame.top = pf.top;
}
@@ -723,15 +723,16 @@
return mDisplayContent.getHomeStack();
}
- Rect getStackBounds() {
- return getStackBounds(getStack());
+ void getStackBounds(Rect bounds) {
+ getStackBounds(getStack(), bounds);
}
- private Rect getStackBounds(TaskStack stack) {
+ private void getStackBounds(TaskStack stack, Rect bounds) {
if (stack != null) {
- return stack.mStackBox.mBounds;
+ stack.getBounds(bounds);
+ return;
}
- return mFrame;
+ bounds.set(mFrame);
}
public long getInputDispatchingTimeoutNanos() {