Merge "Change how distance field paths are disabled"
diff --git a/api/current.txt b/api/current.txt
index d94614b..c83f098 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -1524,6 +1524,7 @@
field public static final int windowHideAnimation = 16842935; // 0x10100b7
field public static final int windowIsFloating = 16842839; // 0x1010057
field public static final int windowIsTranslucent = 16842840; // 0x1010058
+ field public static final int windowLightNavigationBar = 16844140; // 0x101056c
field public static final int windowLightStatusBar = 16844000; // 0x10104e0
field public static final int windowMinWidthMajor = 16843606; // 0x1010356
field public static final int windowMinWidthMinor = 16843607; // 0x1010357
diff --git a/api/system-current.txt b/api/system-current.txt
index a43fe2e..5911101 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -1661,6 +1661,7 @@
field public static final int windowHideAnimation = 16842935; // 0x10100b7
field public static final int windowIsFloating = 16842839; // 0x1010057
field public static final int windowIsTranslucent = 16842840; // 0x1010058
+ field public static final int windowLightNavigationBar = 16844140; // 0x101056c
field public static final int windowLightStatusBar = 16844000; // 0x10104e0
field public static final int windowMinWidthMajor = 16843606; // 0x1010356
field public static final int windowMinWidthMinor = 16843607; // 0x1010357
diff --git a/api/test-current.txt b/api/test-current.txt
index 87eb171..dde1dc8 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -1524,6 +1524,7 @@
field public static final int windowHideAnimation = 16842935; // 0x10100b7
field public static final int windowIsFloating = 16842839; // 0x1010057
field public static final int windowIsTranslucent = 16842840; // 0x1010058
+ field public static final int windowLightNavigationBar = 16844140; // 0x101056c
field public static final int windowLightStatusBar = 16844000; // 0x10104e0
field public static final int windowMinWidthMajor = 16843606; // 0x1010356
field public static final int windowMinWidthMinor = 16843607; // 0x1010357
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java
index b2f3add..bffde7e 100644
--- a/core/java/android/app/ActivityManager.java
+++ b/core/java/android/app/ActivityManager.java
@@ -141,16 +141,6 @@
private static final int FIRST_START_NON_FATAL_ERROR_CODE = 100;
private static final int LAST_START_NON_FATAL_ERROR_CODE = 199;
- /**
- * System property to enable task snapshots.
- * @hide
- */
- public final static boolean ENABLE_TASK_SNAPSHOTS;
-
- static {
- ENABLE_TASK_SNAPSHOTS = SystemProperties.getBoolean("persist.enable_task_snapshots", true);
- }
-
static final class UidObserver extends IUidObserver.Stub {
final OnUidImportanceListener mListener;
final Context mContext;
@@ -2101,165 +2091,6 @@
}
/**
- * Metadata related to the {@link TaskThumbnail}.
- *
- * @hide
- */
- public static class TaskThumbnailInfo implements Parcelable {
- /** @hide */
- public static final String ATTR_TASK_THUMBNAILINFO_PREFIX = "task_thumbnailinfo_";
- private static final String ATTR_TASK_WIDTH =
- ATTR_TASK_THUMBNAILINFO_PREFIX + "task_width";
- private static final String ATTR_TASK_HEIGHT =
- ATTR_TASK_THUMBNAILINFO_PREFIX + "task_height";
- private static final String ATTR_SCREEN_ORIENTATION =
- ATTR_TASK_THUMBNAILINFO_PREFIX + "screen_orientation";
-
- public int taskWidth;
- public int taskHeight;
- public int screenOrientation = Configuration.ORIENTATION_UNDEFINED;
-
- public TaskThumbnailInfo() {
- // Do nothing
- }
-
- private TaskThumbnailInfo(Parcel source) {
- readFromParcel(source);
- }
-
- /**
- * Resets this info state to the initial state.
- * @hide
- */
- public void reset() {
- taskWidth = 0;
- taskHeight = 0;
- screenOrientation = Configuration.ORIENTATION_UNDEFINED;
- }
-
- /**
- * Copies from another ThumbnailInfo.
- */
- public void copyFrom(TaskThumbnailInfo o) {
- taskWidth = o.taskWidth;
- taskHeight = o.taskHeight;
- screenOrientation = o.screenOrientation;
- }
-
- /** @hide */
- public void saveToXml(XmlSerializer out) throws IOException {
- out.attribute(null, ATTR_TASK_WIDTH, Integer.toString(taskWidth));
- out.attribute(null, ATTR_TASK_HEIGHT, Integer.toString(taskHeight));
- out.attribute(null, ATTR_SCREEN_ORIENTATION, Integer.toString(screenOrientation));
- }
-
- /** @hide */
- public void restoreFromXml(String attrName, String attrValue) {
- if (ATTR_TASK_WIDTH.equals(attrName)) {
- taskWidth = Integer.parseInt(attrValue);
- } else if (ATTR_TASK_HEIGHT.equals(attrName)) {
- taskHeight = Integer.parseInt(attrValue);
- } else if (ATTR_SCREEN_ORIENTATION.equals(attrName)) {
- screenOrientation = Integer.parseInt(attrValue);
- }
- }
-
- public int describeContents() {
- return 0;
- }
-
- public void writeToParcel(Parcel dest, int flags) {
- dest.writeInt(taskWidth);
- dest.writeInt(taskHeight);
- dest.writeInt(screenOrientation);
- }
-
- public void readFromParcel(Parcel source) {
- taskWidth = source.readInt();
- taskHeight = source.readInt();
- screenOrientation = source.readInt();
- }
-
- public static final Creator<TaskThumbnailInfo> CREATOR = new Creator<TaskThumbnailInfo>() {
- public TaskThumbnailInfo createFromParcel(Parcel source) {
- return new TaskThumbnailInfo(source);
- }
- public TaskThumbnailInfo[] newArray(int size) {
- return new TaskThumbnailInfo[size];
- }
- };
- }
-
- /** @hide */
- public static class TaskThumbnail implements Parcelable {
- public Bitmap mainThumbnail;
- public ParcelFileDescriptor thumbnailFileDescriptor;
- public TaskThumbnailInfo thumbnailInfo;
-
- public TaskThumbnail() {
- }
-
- private TaskThumbnail(Parcel source) {
- readFromParcel(source);
- }
-
- public int describeContents() {
- if (thumbnailFileDescriptor != null) {
- return thumbnailFileDescriptor.describeContents();
- }
- return 0;
- }
-
- public void writeToParcel(Parcel dest, int flags) {
- if (mainThumbnail != null) {
- dest.writeInt(1);
- mainThumbnail.writeToParcel(dest, flags);
- } else {
- dest.writeInt(0);
- }
- if (thumbnailFileDescriptor != null) {
- dest.writeInt(1);
- thumbnailFileDescriptor.writeToParcel(dest, flags);
- } else {
- dest.writeInt(0);
- }
- if (thumbnailInfo != null) {
- dest.writeInt(1);
- thumbnailInfo.writeToParcel(dest, flags);
- } else {
- dest.writeInt(0);
- }
- }
-
- public void readFromParcel(Parcel source) {
- if (source.readInt() != 0) {
- mainThumbnail = Bitmap.CREATOR.createFromParcel(source);
- } else {
- mainThumbnail = null;
- }
- if (source.readInt() != 0) {
- thumbnailFileDescriptor = ParcelFileDescriptor.CREATOR.createFromParcel(source);
- } else {
- thumbnailFileDescriptor = null;
- }
- if (source.readInt() != 0) {
- thumbnailInfo = TaskThumbnailInfo.CREATOR.createFromParcel(source);
- } else {
- thumbnailInfo = null;
- }
- }
-
- public static final Creator<TaskThumbnail> CREATOR = new Creator<TaskThumbnail>() {
- public TaskThumbnail createFromParcel(Parcel source) {
- return new TaskThumbnail(source);
- }
- public TaskThumbnail[] newArray(int size) {
- return new TaskThumbnail[size];
- }
- };
- }
-
- /**
* Represents a task snapshot.
* @hide
*/
@@ -2356,15 +2187,6 @@
}
/** @hide */
- public TaskThumbnail getTaskThumbnail(int id) throws SecurityException {
- try {
- return getService().getTaskThumbnail(id);
- } catch (RemoteException e) {
- throw e.rethrowFromSystemServer();
- }
- }
-
- /** @hide */
@IntDef(flag = true, prefix = { "MOVE_TASK_" }, value = {
MOVE_TASK_WITH_HOME,
MOVE_TASK_NO_USER_ACTION,
diff --git a/core/java/android/app/ActivityManagerInternal.java b/core/java/android/app/ActivityManagerInternal.java
index c8d9839..9d14f61 100644
--- a/core/java/android/app/ActivityManagerInternal.java
+++ b/core/java/android/app/ActivityManagerInternal.java
@@ -40,12 +40,6 @@
public abstract class ActivityManagerInternal {
/**
- * Type for {@link #notifyAppTransitionStarting}: The transition was started because we had
- * the surface saved.
- */
- public static final int APP_TRANSITION_SAVED_SURFACE = 0;
-
- /**
* Type for {@link #notifyAppTransitionStarting}: The transition was started because we drew
* the splash screen.
*/
diff --git a/core/java/android/app/IActivityManager.aidl b/core/java/android/app/IActivityManager.aidl
index ae821915..1e05ae2 100644
--- a/core/java/android/app/IActivityManager.aidl
+++ b/core/java/android/app/IActivityManager.aidl
@@ -209,7 +209,6 @@
void forceStopPackage(in String packageName, int userId);
boolean killPids(in int[] pids, in String reason, boolean secure);
List<ActivityManager.RunningServiceInfo> getServices(int maxNum, int flags);
- ActivityManager.TaskThumbnail getTaskThumbnail(int taskId);
ActivityManager.TaskDescription getTaskDescription(int taskId);
// Retrieve running application processes in the system
List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses();
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 2265b9c..ffb3203 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -3354,6 +3354,8 @@
* FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS} but not
* {@link android.view.WindowManager.LayoutParams#FLAG_TRANSLUCENT_NAVIGATION
* FLAG_TRANSLUCENT_NAVIGATION}.
+ *
+ * @see android.R.attr#windowLightNavigationBar
*/
public static final int SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR = 0x00000010;
diff --git a/core/java/com/android/internal/policy/PhoneWindow.java b/core/java/com/android/internal/policy/PhoneWindow.java
index 544afd9..0d66376 100644
--- a/core/java/com/android/internal/policy/PhoneWindow.java
+++ b/core/java/com/android/internal/policy/PhoneWindow.java
@@ -2453,6 +2453,10 @@
decor.setSystemUiVisibility(
decor.getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}
+ if (a.getBoolean(R.styleable.Window_windowLightNavigationBar, false)) {
+ decor.setSystemUiVisibility(
+ decor.getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
+ }
if (mAlwaysReadCloseOnTouchAttr || getContext().getApplicationInfo().targetSdkVersion
>= android.os.Build.VERSION_CODES.HONEYCOMB) {
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index 3143b03..598b586 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -2087,6 +2087,16 @@
{@link android.R.attr#windowBackground}.
-->
<attr name="windowSplashscreenContent" format="reference" />
+
+ <!-- If set, the navigation bar will be drawn such that it is compatible with a light
+ navigation bar background.
+ <p>For this to take effect, the window must be drawing the system bar backgrounds with
+ {@link android.R.attr#windowDrawsSystemBarBackgrounds} and the navigation bar must not
+ have been requested to be translucent with
+ {@link android.R.attr#windowTranslucentNavigation}.
+ Corresponds to setting {@link android.view.View#SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR} on
+ the decor view. -->
+ <attr name="windowLightNavigationBar" format="boolean" />
</declare-styleable>
<!-- The set of attributes that describe a AlertDialog's theme. -->
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index 634d79a..9b2f185 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -2858,6 +2858,27 @@
<public name="autofill"/>
</public-group>
+ <!-- ===============================================================
+ Resources added in version P of the platform
+
+ NOTE: add <public> elements within a <public-group> like so:
+
+ <public-group type="attr" first-id="0x01010531">
+ <public name="exampleAttr1" />
+ <public name="exampleAttr2" />
+ </public-group>
+
+ To add a new public-group block, choose an id value that is 1 greater
+ than the last of that item above. For example, the last "attr" id
+ value above is 0x01010530, so the public-group of attrs below has
+ the id value of 0x01010531.
+ =============================================================== -->
+ <eat-comment />
+
+ <public-group type="attr" first-id="0x0101056c">
+ <public name="windowLightNavigationBar" />
+ </public-group>
+
<!-- ===============================================================
DO NOT ADD UN-GROUPED ITEMS HERE
diff --git a/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java b/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java
index c66b2dd..7177782 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java
@@ -47,7 +47,6 @@
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
-import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Point;
import android.graphics.PorterDuff;
@@ -59,7 +58,6 @@
import android.os.Handler;
import android.os.IRemoteCallback;
import android.os.Message;
-import android.os.ParcelFileDescriptor;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemProperties;
@@ -95,9 +93,7 @@
import com.android.systemui.recents.model.Task;
import com.android.systemui.recents.model.ThumbnailData;
import com.android.systemui.statusbar.policy.UserInfoController;
-import com.android.systemui.statusbar.policy.UserInfoController.OnUserInfoChangedListener;
-import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
@@ -717,21 +713,7 @@
return thumbnailData;
}
- ThumbnailData thumbnailData = getThumbnail(taskId, reduced);
- if (thumbnailData.thumbnail != null && !ActivityManager.ENABLE_TASK_SNAPSHOTS) {
- thumbnailData.thumbnail.setHasAlpha(false);
- // We use a dumb heuristic for now, if the thumbnail is purely transparent in the top
- // left pixel, then assume the whole thumbnail is transparent. Generally, proper
- // screenshots are always composed onto a bitmap that has no alpha.
- if (Color.alpha(thumbnailData.thumbnail.getPixel(0, 0)) == 0) {
- mBgProtectionCanvas.setBitmap(thumbnailData.thumbnail);
- mBgProtectionCanvas.drawRect(0, 0, thumbnailData.thumbnail.getWidth(),
- thumbnailData.thumbnail.getHeight(), mBgProtectionPaint);
- mBgProtectionCanvas.setBitmap(null);
- Log.e(TAG, "Invalid screenshot detected from getTaskThumbnail()");
- }
- }
- return thumbnailData;
+ return getThumbnail(taskId, reduced);
}
/**
@@ -742,43 +724,17 @@
return new ThumbnailData();
}
- final ThumbnailData thumbnailData;
- if (ActivityManager.ENABLE_TASK_SNAPSHOTS) {
- ActivityManager.TaskSnapshot snapshot = null;
- try {
- snapshot = ActivityManager.getService().getTaskSnapshot(taskId, reducedResolution);
- } catch (RemoteException e) {
- Log.w(TAG, "Failed to retrieve snapshot", e);
- }
- if (snapshot != null) {
- thumbnailData = ThumbnailData.createFromTaskSnapshot(snapshot);
- } else {
- return new ThumbnailData();
- }
- } else {
- ActivityManager.TaskThumbnail taskThumbnail = mAm.getTaskThumbnail(taskId);
- if (taskThumbnail == null) {
- return new ThumbnailData();
- }
-
- Bitmap thumbnail = taskThumbnail.mainThumbnail;
- ParcelFileDescriptor descriptor = taskThumbnail.thumbnailFileDescriptor;
- if (thumbnail == null && descriptor != null) {
- thumbnail = BitmapFactory.decodeFileDescriptor(descriptor.getFileDescriptor(),
- null, sBitmapOptions);
- }
- if (descriptor != null) {
- try {
- descriptor.close();
- } catch (IOException e) {
- }
- }
- thumbnailData = new ThumbnailData();
- thumbnailData.thumbnail = thumbnail;
- thumbnailData.orientation = taskThumbnail.thumbnailInfo.screenOrientation;
- thumbnailData.insets.setEmpty();
+ ActivityManager.TaskSnapshot snapshot = null;
+ try {
+ snapshot = ActivityManager.getService().getTaskSnapshot(taskId, reducedResolution);
+ } catch (RemoteException e) {
+ Log.w(TAG, "Failed to retrieve snapshot", e);
}
- return thumbnailData;
+ if (snapshot != null) {
+ return ThumbnailData.createFromTaskSnapshot(snapshot);
+ } else {
+ return new ThumbnailData();
+ }
}
/**
diff --git a/packages/SystemUI/src/com/android/systemui/recents/model/Task.java b/packages/SystemUI/src/com/android/systemui/recents/model/Task.java
index 29d0a23..9e6bf85 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/model/Task.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/model/Task.java
@@ -17,11 +17,9 @@
package com.android.systemui.recents.model;
import android.app.ActivityManager;
-import android.app.ActivityManager.TaskThumbnail;
import android.content.ComponentName;
import android.content.Intent;
import android.content.pm.ActivityInfo;
-import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
@@ -35,7 +33,6 @@
import java.util.ArrayList;
import java.util.Objects;
-
/**
* A task represents the top most task in the system's task stack.
*/
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 132ce12..f89db86 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -197,7 +197,6 @@
import android.app.ActivityManager.StackId;
import android.app.ActivityManager.StackInfo;
import android.app.ActivityManager.TaskSnapshot;
-import android.app.ActivityManager.TaskThumbnailInfo;
import android.app.ActivityManagerInternal;
import android.app.ActivityManagerInternal.SleepToken;
import android.app.ActivityOptions;
@@ -9991,20 +9990,6 @@
}
@Override
- public ActivityManager.TaskThumbnail getTaskThumbnail(int id) {
- synchronized (this) {
- enforceCallingPermission(android.Manifest.permission.READ_FRAME_BUFFER,
- "getTaskThumbnail()");
- final TaskRecord tr = mStackSupervisor.anyTaskForIdLocked(
- id, MATCH_TASK_IN_STACKS_OR_RECENT_TASKS, INVALID_STACK_ID);
- if (tr != null) {
- return tr.getTaskThumbnailLocked();
- }
- }
- return null;
- }
-
- @Override
public ActivityManager.TaskDescription getTaskDescription(int id) {
synchronized (this) {
enforceCallingPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS,
@@ -10071,7 +10056,7 @@
TaskRecord task = new TaskRecord(this,
mStackSupervisor.getNextTaskIdForUserLocked(r.userId),
- ainfo, intent, description, new TaskThumbnailInfo());
+ ainfo, intent, description);
int trimIdx = mRecentTasks.trimForTaskLocked(task, false);
if (trimIdx >= 0) {
@@ -10090,8 +10075,8 @@
mRecentTasks.add(task);
r.getStack().addTask(task, false, "addAppTask");
- task.setLastThumbnailLocked(thumbnail);
- task.freeLastThumbnail();
+ // TODO: Send the thumbnail to WM to store it.
+
return task.taskId;
}
} finally {
diff --git a/services/core/java/com/android/server/am/ActivityRecord.java b/services/core/java/com/android/server/am/ActivityRecord.java
index 1921ada..4433b84 100644
--- a/services/core/java/com/android/server/am/ActivityRecord.java
+++ b/services/core/java/com/android/server/am/ActivityRecord.java
@@ -16,13 +16,10 @@
package com.android.server.am;
-import static android.app.ActivityManager.ENABLE_TASK_SNAPSHOTS;
import static android.app.ActivityManager.LOCK_TASK_MODE_NONE;
-import static android.app.ActivityManager.StackId;
import static android.app.ActivityManager.StackId.ASSISTANT_STACK_ID;
import static android.app.ActivityManager.StackId.DOCKED_STACK_ID;
import static android.app.ActivityManager.StackId.FREEFORM_WORKSPACE_STACK_ID;
-import static android.app.ActivityManager.StackId.HOME_STACK_ID;
import static android.app.ActivityManager.StackId.INVALID_STACK_ID;
import static android.app.ActivityManager.StackId.PINNED_STACK_ID;
import static android.app.ActivityManager.TaskDescription.ATTR_TASKDESCRIPTION_PREFIX;
@@ -48,11 +45,12 @@
import static android.content.pm.ActivityInfo.CONFIG_UI_MODE;
import static android.content.pm.ActivityInfo.CONFIG_WINDOW_CONFIGURATION;
import static android.content.pm.ActivityInfo.FLAG_ALWAYS_FOCUSABLE;
-import static android.content.pm.ActivityInfo.FLAG_SHOW_WHEN_LOCKED;
import static android.content.pm.ActivityInfo.FLAG_EXCLUDE_FROM_RECENTS;
import static android.content.pm.ActivityInfo.FLAG_IMMERSIVE;
import static android.content.pm.ActivityInfo.FLAG_MULTIPROCESS;
+import static android.content.pm.ActivityInfo.FLAG_NO_HISTORY;
import static android.content.pm.ActivityInfo.FLAG_SHOW_FOR_ALL_USERS;
+import static android.content.pm.ActivityInfo.FLAG_SHOW_WHEN_LOCKED;
import static android.content.pm.ActivityInfo.FLAG_STATE_NOT_NEEDED;
import static android.content.pm.ActivityInfo.FLAG_TURN_SCREEN_ON;
import static android.content.pm.ActivityInfo.LAUNCH_MULTIPLE;
@@ -65,7 +63,6 @@
import static android.content.pm.ActivityInfo.RESIZE_MODE_RESIZEABLE;
import static android.content.pm.ActivityInfo.RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION;
import static android.content.pm.ActivityInfo.RESIZE_MODE_UNRESIZEABLE;
-import static android.content.pm.ActivityInfo.FLAG_NO_HISTORY;
import static android.content.pm.ActivityInfo.isFixedOrientationLandscape;
import static android.content.pm.ActivityInfo.isFixedOrientationPortrait;
import static android.content.res.Configuration.EMPTY;
@@ -79,13 +76,10 @@
import static android.os.Process.SYSTEM_UID;
import static android.os.Trace.TRACE_TAG_ACTIVITY_MANAGER;
import static android.view.WindowManagerPolicy.NAV_BAR_LEFT;
-
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_CONFIGURATION;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_SAVED_STATE;
-import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_SCREENSHOTS;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_STATES;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_SWITCH;
-import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_THUMBNAILS;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_VISIBILITY;
import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_CONFIGURATION;
import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_SAVED_STATE;
@@ -96,7 +90,6 @@
import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_VISIBILITY;
import static com.android.server.am.ActivityManagerDebugConfig.TAG_AM;
import static com.android.server.am.ActivityManagerDebugConfig.TAG_WITH_CLASS_NAME;
-import static com.android.server.am.ActivityManagerService.TAKE_FULLSCREEN_SCREENSHOTS;
import static com.android.server.am.ActivityStack.ActivityState.DESTROYED;
import static com.android.server.am.ActivityStack.ActivityState.DESTROYING;
import static com.android.server.am.ActivityStack.ActivityState.INITIALIZING;
@@ -319,8 +312,6 @@
int mStartingWindowState = STARTING_WINDOW_NOT_SHOWN;
boolean mTaskOverlay = false; // Task is always on-top of other activities in the task.
- boolean mUpdateTaskThumbnailWhenHidden;
-
TaskDescription taskDescription; // the recents information for this activity
boolean mLaunchTaskBehind; // this activity is actively being launched with
// ActivityOptions.setLaunchTaskBehind, will be cleared once launch is completed.
@@ -1496,72 +1487,10 @@
}
}
- void updateThumbnailLocked(Bitmap newThumbnail, CharSequence description) {
- if (newThumbnail != null) {
- if (DEBUG_THUMBNAILS) Slog.i(TAG_THUMBNAILS,
- "Setting thumbnail of " + this + " to " + newThumbnail);
- boolean thumbnailUpdated = task.setLastThumbnailLocked(newThumbnail);
- if (thumbnailUpdated && isPersistable()) {
- service.notifyTaskPersisterLocked(task, false);
- }
- }
+ private void updateTaskDescription(CharSequence description) {
task.lastDescription = description;
}
- final Bitmap screenshotActivityLocked() {
- if (DEBUG_SCREENSHOTS) Slog.d(TAG_SCREENSHOTS, "screenshotActivityLocked: " + this);
-
- if (ENABLE_TASK_SNAPSHOTS) {
- // No need to screenshot if snapshots are enabled.
- if (DEBUG_SCREENSHOTS) Slog.d(TAG_SCREENSHOTS,
- "\tSnapshots are enabled, abort taking screenshot");
- return null;
- }
-
- if (noDisplay) {
- if (DEBUG_SCREENSHOTS) Slog.d(TAG_SCREENSHOTS, "\tNo display");
- return null;
- }
-
- final ActivityStack stack = getStack();
- if (stack.isHomeOrRecentsStack()) {
- // This is an optimization -- since we never show Home or Recents within Recents itself,
- // we can just go ahead and skip taking the screenshot if this is the home stack.
- if (DEBUG_SCREENSHOTS) Slog.d(TAG_SCREENSHOTS, stack.getStackId() == HOME_STACK_ID ?
- "\tHome stack" : "\tRecents stack");
- return null;
- }
-
- int w = service.mThumbnailWidth;
- int h = service.mThumbnailHeight;
-
- if (w <= 0) {
- Slog.e(TAG, "\tInvalid thumbnail dimensions: " + w + "x" + h);
- return null;
- }
-
- if (stack.mStackId == DOCKED_STACK_ID && mStackSupervisor.mIsDockMinimized) {
- // When the docked stack is minimized its app windows are cropped significantly so any
- // screenshot taken will not display the apps contain. So, we avoid taking a screenshot
- // in that case.
- if (DEBUG_SCREENSHOTS) Slog.e(TAG, "\tIn minimized docked stack");
- return null;
- }
-
- float scale = 0;
- if (DEBUG_SCREENSHOTS) Slog.d(TAG_SCREENSHOTS, "\tTaking screenshot");
-
- // When this flag is set, we currently take the fullscreen screenshot of the activity but
- // scaled to half the size. This gives us a "good-enough" fullscreen thumbnail to use within
- // SystemUI while keeping memory usage low.
- if (TAKE_FULLSCREEN_SCREENSHOTS) {
- w = h = -1;
- scale = service.mFullscreenThumbnailScale;
- }
-
- return mWindowContainerController.screenshotApplications(getDisplayId(), w, h, scale);
- }
-
void setDeferHidingClient(boolean deferHidingClient) {
if (mDeferHidingClient == deferHidingClient) {
return;
@@ -1583,10 +1512,6 @@
void setVisible(boolean newVisible) {
visible = newVisible;
mDeferHidingClient = !visible && mDeferHidingClient;
- if (!visible && mUpdateTaskThumbnailWhenHidden) {
- updateThumbnailLocked(screenshotActivityLocked(), null /* description */);
- mUpdateTaskThumbnailWhenHidden = false;
- }
setVisibility(visible);
mStackSupervisor.mAppVisibilitiesChangedSinceLastPause = true;
}
@@ -1752,7 +1677,7 @@
icicle = newIcicle;
haveState = true;
launchCount = 0;
- updateThumbnailLocked(null /* newThumbnail */, description);
+ updateTaskDescription(description);
}
if (!stopped) {
if (DEBUG_STATES) Slog.v(TAG_STATES, "Moving to STOPPED: " + this + " (stop complete)");
diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java
index 89d62d19..6a9a4fe 100644
--- a/services/core/java/com/android/server/am/ActivityStack.java
+++ b/services/core/java/com/android/server/am/ActivityStack.java
@@ -1341,11 +1341,7 @@
prev.getTask().touchActiveTime();
clearLaunchTime(prev);
final ActivityRecord next = mStackSupervisor.topRunningActivityLocked();
- if (mService.mHasRecents
- && (next == null || next.noDisplay || next.getTask() != prev.getTask()
- || uiSleeping)) {
- prev.mUpdateTaskThumbnailWhenHidden = true;
- }
+
stopFullyDrawnTraceIfNeeded();
mService.updateCpuStats();
@@ -1839,14 +1835,6 @@
for (int activityNdx = activities.size() - 1; activityNdx >= 0; --activityNdx) {
final ActivityRecord r = activities.get(activityNdx);
if (r.finishing) {
- // Normally the screenshot will be taken in makeInvisible(). When an activity
- // is finishing, we no longer change its visibility, but we still need to take
- // the screenshots if startPausingLocked decided it should be taken.
- if (r.mUpdateTaskThumbnailWhenHidden) {
- r.updateThumbnailLocked(r.screenshotActivityLocked(),
- null /* description */);
- r.mUpdateTaskThumbnailWhenHidden = false;
- }
continue;
}
final boolean isTop = r == top;
diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
index 35cd5ad..1107390 100644
--- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java
+++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
@@ -20,7 +20,6 @@
import static android.Manifest.permission.INTERNAL_SYSTEM_WINDOW;
import static android.Manifest.permission.START_ANY_ACTIVITY;
import static android.Manifest.permission.START_TASKS_FROM_RECENTS;
-import static android.app.ActivityManager.LOCK_TASK_MODE_LOCKED;
import static android.app.ActivityManager.START_TASK_TO_FRONT;
import static android.app.ActivityManager.StackId.DOCKED_STACK_ID;
import static android.app.ActivityManager.StackId.FIRST_DYNAMIC_STACK_ID;
@@ -3266,7 +3265,6 @@
final ActivityStack stack = task.getStack();
r.mLaunchTaskBehind = false;
- task.setLastThumbnailLocked(r.screenshotActivityLocked());
mRecentTasks.addLocked(task);
mService.mTaskChangeNotificationController.notifyTaskStackChanged();
r.setVisibility(false);
diff --git a/services/core/java/com/android/server/am/RecentTasks.java b/services/core/java/com/android/server/am/RecentTasks.java
index a6ebac4..365c5b1 100644
--- a/services/core/java/com/android/server/am/RecentTasks.java
+++ b/services/core/java/com/android/server/am/RecentTasks.java
@@ -193,10 +193,6 @@
return mTaskPersister.getTaskDescriptionIcon(path);
}
- Bitmap getImageFromWriteQueue(String path) {
- return mTaskPersister.getImageFromWriteQueue(path);
- }
-
void saveImage(Bitmap image, String path) {
mTaskPersister.saveImage(image, path);
}
@@ -651,9 +647,6 @@
if (task.userId != tr.userId) {
continue;
}
- if (i > MAX_RECENT_BITMAPS) {
- tr.freeLastThumbnail();
- }
final Intent trIntent = tr.intent;
final boolean sameAffinity =
task.affinity != null && task.affinity.equals(tr.affinity);
@@ -706,7 +699,6 @@
// Either task and tr are the same or, their affinities match or their intents match
// and neither of them is a document, or they are documents using the same activity
// and their maxRecents has been reached.
- tr.disposeThumbnail();
remove(i);
if (task != tr) {
tr.removedFromRecents();
diff --git a/services/core/java/com/android/server/am/TaskRecord.java b/services/core/java/com/android/server/am/TaskRecord.java
index c7e6001..1578930 100644
--- a/services/core/java/com/android/server/am/TaskRecord.java
+++ b/services/core/java/com/android/server/am/TaskRecord.java
@@ -16,61 +16,6 @@
package com.android.server.am;
-import android.annotation.IntDef;
-import android.annotation.Nullable;
-import android.app.Activity;
-import android.app.ActivityManager;
-import android.app.ActivityManager.StackId;
-import android.app.ActivityManager.TaskDescription;
-import android.app.ActivityManager.TaskSnapshot;
-import android.app.ActivityManager.TaskThumbnail;
-import android.app.ActivityManager.TaskThumbnailInfo;
-import android.app.ActivityOptions;
-import android.app.AppGlobals;
-import android.app.IActivityManager;
-import android.content.ComponentName;
-import android.content.Intent;
-import android.content.pm.ActivityInfo;
-import android.content.pm.ApplicationInfo;
-import android.content.pm.IPackageManager;
-import android.content.pm.PackageManager;
-import android.content.res.Configuration;
-import android.graphics.Bitmap;
-import android.graphics.Point;
-import android.graphics.Rect;
-import android.os.Debug;
-import android.os.ParcelFileDescriptor;
-import android.os.RemoteException;
-import android.os.Trace;
-import android.os.UserHandle;
-import android.provider.Settings;
-import android.service.voice.IVoiceInteractionSession;
-import android.util.DisplayMetrics;
-import android.util.Slog;
-
-import com.android.internal.annotations.VisibleForTesting;
-import com.android.internal.app.IVoiceInteractor;
-import com.android.internal.util.XmlUtils;
-
-import com.android.server.wm.AppWindowContainerController;
-import com.android.server.wm.ConfigurationContainer;
-import com.android.server.wm.StackWindowController;
-import com.android.server.wm.TaskWindowContainerController;
-import com.android.server.wm.TaskWindowContainerListener;
-import com.android.server.wm.WindowManagerService;
-
-import org.xmlpull.v1.XmlPullParser;
-import org.xmlpull.v1.XmlPullParserException;
-import org.xmlpull.v1.XmlSerializer;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.util.ArrayList;
-import java.util.Objects;
-
import static android.app.ActivityManager.RESIZE_MODE_FORCED;
import static android.app.ActivityManager.RESIZE_MODE_SYSTEM;
import static android.app.ActivityManager.StackId.ASSISTANT_STACK_ID;
@@ -97,10 +42,8 @@
import static android.content.pm.ActivityInfo.RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION;
import static android.content.pm.ApplicationInfo.PRIVATE_FLAG_PRIVILEGED;
import static android.os.Trace.TRACE_TAG_ACTIVITY_MANAGER;
-import static android.provider.Settings.Global.DEVELOPMENT_FORCE_RESIZABLE_ACTIVITIES;
import static android.provider.Settings.Secure.USER_SETUP_COMPLETE;
import static android.view.Display.DEFAULT_DISPLAY;
-
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_ADD_REMOVE;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_LOCKTASK;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_RECENTS;
@@ -120,9 +63,56 @@
import static com.android.server.am.ActivityStack.REMOVE_TASK_MODE_MOVING_TO_TOP;
import static com.android.server.am.ActivityStackSupervisor.PAUSE_IMMEDIATELY;
import static com.android.server.am.ActivityStackSupervisor.PRESERVE_WINDOWS;
-
import static java.lang.Integer.MAX_VALUE;
+import android.annotation.IntDef;
+import android.annotation.Nullable;
+import android.app.Activity;
+import android.app.ActivityManager;
+import android.app.ActivityManager.StackId;
+import android.app.ActivityManager.TaskDescription;
+import android.app.ActivityManager.TaskSnapshot;
+import android.app.ActivityOptions;
+import android.app.AppGlobals;
+import android.app.IActivityManager;
+import android.content.ComponentName;
+import android.content.Intent;
+import android.content.pm.ActivityInfo;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.IPackageManager;
+import android.content.pm.PackageManager;
+import android.content.res.Configuration;
+import android.graphics.Rect;
+import android.os.Debug;
+import android.os.RemoteException;
+import android.os.Trace;
+import android.os.UserHandle;
+import android.provider.Settings;
+import android.service.voice.IVoiceInteractionSession;
+import android.util.DisplayMetrics;
+import android.util.Slog;
+
+import com.android.internal.annotations.VisibleForTesting;
+import com.android.internal.app.IVoiceInteractor;
+import com.android.internal.util.XmlUtils;
+import com.android.server.wm.AppWindowContainerController;
+import com.android.server.wm.ConfigurationContainer;
+import com.android.server.wm.StackWindowController;
+import com.android.server.wm.TaskWindowContainerController;
+import com.android.server.wm.TaskWindowContainerListener;
+import com.android.server.wm.WindowManagerService;
+
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+import org.xmlpull.v1.XmlSerializer;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.util.ArrayList;
+import java.util.Objects;
+
class TaskRecord extends ConfigurationContainer implements TaskWindowContainerListener {
private static final String TAG = TAG_WITH_CLASS_NAME ? "TaskRecord" : TAG_AM;
private static final String TAG_ADD_REMOVE = TAG + POSTFIX_ADD_REMOVE;
@@ -282,10 +272,7 @@
// do not want to delete the stack when the task goes empty.
private boolean mReuseTask = false;
- private Bitmap mLastThumbnail; // Last thumbnail captured for this item.
- private final File mLastThumbnailFile; // File containing last thumbnail.
private final String mFilename;
- private TaskThumbnailInfo mLastThumbnailInfo;
CharSequence lastDescription; // Last description captured for this item.
int mAffiliatedTaskId; // taskId of parent affiliation or self if no parent.
@@ -334,8 +321,6 @@
mFilename = String.valueOf(_taskId) + TASK_THUMBNAIL_SUFFIX +
TaskPersister.IMAGE_EXTENSION;
userId = UserHandle.getUserId(info.applicationInfo.uid);
- mLastThumbnailFile = new File(TaskPersister.getUserImagesDir(userId), mFilename);
- mLastThumbnailInfo = new TaskThumbnailInfo();
taskId = _taskId;
mAffiliatedTaskId = _taskId;
voiceSession = _voiceSession;
@@ -352,13 +337,11 @@
}
TaskRecord(ActivityManagerService service, int _taskId, ActivityInfo info, Intent _intent,
- TaskDescription _taskDescription, TaskThumbnailInfo thumbnailInfo) {
+ TaskDescription _taskDescription) {
mService = service;
mFilename = String.valueOf(_taskId) + TASK_THUMBNAIL_SUFFIX +
TaskPersister.IMAGE_EXTENSION;
userId = UserHandle.getUserId(info.applicationInfo.uid);
- mLastThumbnailFile = new File(TaskPersister.getUserImagesDir(userId), mFilename);
- mLastThumbnailInfo = thumbnailInfo;
taskId = _taskId;
mAffiliatedTaskId = _taskId;
voiceSession = null;
@@ -389,16 +372,13 @@
int _effectiveUid, String _lastDescription, ArrayList<ActivityRecord> activities,
long _firstActiveTime, long _lastActiveTime, long lastTimeMoved,
boolean neverRelinquishIdentity, TaskDescription _lastTaskDescription,
- TaskThumbnailInfo lastThumbnailInfo, int taskAffiliation, int prevTaskId,
- int nextTaskId, int taskAffiliationColor, int callingUid, String callingPackage,
- int resizeMode, boolean supportsPictureInPicture, boolean privileged,
- boolean _realActivitySuspended, boolean userSetupComplete, int minWidth,
- int minHeight) {
+ int taskAffiliation, int prevTaskId, int nextTaskId, int taskAffiliationColor,
+ int callingUid, String callingPackage, int resizeMode, boolean supportsPictureInPicture,
+ boolean privileged, boolean _realActivitySuspended, boolean userSetupComplete,
+ int minWidth, int minHeight) {
mService = service;
mFilename = String.valueOf(_taskId) + TASK_THUMBNAIL_SUFFIX +
TaskPersister.IMAGE_EXTENSION;
- mLastThumbnailFile = new File(TaskPersister.getUserImagesDir(_userId), mFilename);
- mLastThumbnailInfo = lastThumbnailInfo;
taskId = _taskId;
intent = _intent;
affinityIntent = _affinityIntent;
@@ -991,7 +971,6 @@
}
void removedFromRecents() {
- disposeThumbnail();
closeRecentsChain();
if (inRecents) {
inRecents = false;
@@ -1025,89 +1004,6 @@
setNextAffiliate(null);
}
- /**
- * Sets the last thumbnail with the current task bounds and the system orientation.
- * @return whether the thumbnail was set
- */
- boolean setLastThumbnailLocked(Bitmap thumbnail) {
- int taskWidth = 0;
- int taskHeight = 0;
- if (mBounds != null) {
- // Non-fullscreen tasks
- taskWidth = mBounds.width();
- taskHeight = mBounds.height();
- } else if (mStack != null) {
- // Fullscreen tasks
- final Point displaySize = new Point();
- mStack.getDisplaySize(displaySize);
- taskWidth = displaySize.x;
- taskHeight = displaySize.y;
- } else {
- Slog.e(TAG, "setLastThumbnailLocked() called on Task without stack");
- }
- // We need to provide the current orientation of the display on which this task resides,
- // not the orientation of the task.
- final int orientation = getStack().getDisplay().getConfiguration().orientation;
- return setLastThumbnailLocked(thumbnail, taskWidth, taskHeight, orientation);
- }
-
- /**
- * Sets the last thumbnail with the current task bounds.
- * @return whether the thumbnail was set
- */
- private boolean setLastThumbnailLocked(Bitmap thumbnail, int taskWidth, int taskHeight,
- int screenOrientation) {
- if (mLastThumbnail != thumbnail) {
- mLastThumbnail = thumbnail;
- mLastThumbnailInfo.taskWidth = taskWidth;
- mLastThumbnailInfo.taskHeight = taskHeight;
- mLastThumbnailInfo.screenOrientation = screenOrientation;
- if (thumbnail == null) {
- if (mLastThumbnailFile != null) {
- mLastThumbnailFile.delete();
- }
- } else {
- mService.mRecentTasks.saveImage(thumbnail, mLastThumbnailFile.getAbsolutePath());
- }
- return true;
- }
- return false;
- }
-
- void getLastThumbnail(TaskThumbnail thumbs) {
- thumbs.mainThumbnail = mLastThumbnail;
- thumbs.thumbnailInfo = mLastThumbnailInfo;
- thumbs.thumbnailFileDescriptor = null;
- if (mLastThumbnail == null) {
- thumbs.mainThumbnail = mService.mRecentTasks.getImageFromWriteQueue(
- mLastThumbnailFile.getAbsolutePath());
- }
- // Only load the thumbnail file if we don't have a thumbnail
- if (thumbs.mainThumbnail == null && mLastThumbnailFile.exists()) {
- try {
- thumbs.thumbnailFileDescriptor = ParcelFileDescriptor.open(mLastThumbnailFile,
- ParcelFileDescriptor.MODE_READ_ONLY);
- } catch (IOException e) {
- }
- }
- }
-
- /**
- * Removes in-memory thumbnail data when the max number of in-memory task thumbnails is reached.
- */
- void freeLastThumbnail() {
- mLastThumbnail = null;
- }
-
- /**
- * Removes all associated thumbnail data when a task is removed or pruned from recents.
- */
- void disposeThumbnail() {
- mLastThumbnailInfo.reset();
- mLastThumbnail = null;
- lastDescription = null;
- }
-
/** Returns the intent for the root activity for this task */
Intent getBaseIntent() {
return intent != null ? intent : affinityIntent;
@@ -1468,19 +1364,6 @@
return null;
}
- TaskThumbnail getTaskThumbnailLocked() {
- if (mStack != null) {
- final ActivityRecord resumedActivity = mStack.mResumedActivity;
- if (resumedActivity != null && resumedActivity.getTask() == this) {
- final Bitmap thumbnail = resumedActivity.screenshotActivityLocked();
- setLastThumbnailLocked(thumbnail);
- }
- }
- final TaskThumbnail taskThumbnail = new TaskThumbnail();
- getLastThumbnail(taskThumbnail);
- return taskThumbnail;
- }
-
void removeTaskActivitiesLocked(boolean pauseImmediately) {
// Just remove the entire task.
performClearTaskAtIndexLocked(0, pauseImmediately);
@@ -1770,7 +1653,6 @@
if (lastTaskDescription != null) {
lastTaskDescription.saveToXml(out);
}
- mLastThumbnailInfo.saveToXml(out);
out.attribute(null, ATTR_TASK_AFFILIATION_COLOR, String.valueOf(mAffiliatedTaskColor));
out.attribute(null, ATTR_TASK_AFFILIATION, String.valueOf(mAffiliatedTaskId));
out.attribute(null, ATTR_PREV_AFFILIATION, String.valueOf(mPrevAffiliateTaskId));
@@ -1842,7 +1724,6 @@
int taskId = INVALID_TASK_ID;
final int outerDepth = in.getDepth();
TaskDescription taskDescription = new TaskDescription();
- TaskThumbnailInfo thumbnailInfo = new TaskThumbnailInfo();
int taskAffiliation = INVALID_TASK_ID;
int taskAffiliationColor = 0;
int prevTaskId = INVALID_TASK_ID;
@@ -1899,8 +1780,6 @@
lastTimeOnTop = Long.parseLong(attrValue);
} else if (ATTR_NEVERRELINQUISH.equals(attrName)) {
neverRelinquishIdentity = Boolean.parseBoolean(attrValue);
- } else if (attrName.startsWith(TaskThumbnailInfo.ATTR_TASK_THUMBNAILINFO_PREFIX)) {
- thumbnailInfo.restoreFromXml(attrName, attrValue);
} else if (attrName.startsWith(TaskDescription.ATTR_TASKDESCRIPTION_PREFIX)) {
taskDescription.restoreFromXml(attrName, attrValue);
} else if (ATTR_TASK_AFFILIATION.equals(attrName)) {
@@ -2006,10 +1885,9 @@
affinityIntent, affinity, rootAffinity, realActivity, origActivity, rootHasReset,
autoRemoveRecents, askedCompatMode, taskType, userId, effectiveUid, lastDescription,
activities, firstActiveTime, lastActiveTime, lastTimeOnTop, neverRelinquishIdentity,
- taskDescription, thumbnailInfo, taskAffiliation, prevTaskId, nextTaskId,
- taskAffiliationColor, callingUid, callingPackage, resizeMode,
- supportsPictureInPicture, privileged, realActivitySuspended, userSetupComplete,
- minWidth, minHeight);
+ taskDescription, taskAffiliation, prevTaskId, nextTaskId, taskAffiliationColor,
+ callingUid, callingPackage, resizeMode, supportsPictureInPicture, privileged,
+ realActivitySuspended, userSetupComplete, minWidth, minHeight);
task.updateOverrideConfiguration(bounds);
for (int activityNdx = activities.size() - 1; activityNdx >=0; --activityNdx) {
@@ -2353,8 +2231,6 @@
pw.print(" inRecents="); pw.print(inRecents);
pw.print(" isAvailable="); pw.println(isAvailable);
}
- pw.print(prefix); pw.print("lastThumbnail="); pw.print(mLastThumbnail);
- pw.print(" lastThumbnailFile="); pw.println(mLastThumbnailFile);
if (lastDescription != null) {
pw.print(prefix); pw.print("lastDescription="); pw.println(lastDescription);
}
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index 7032d64..1db99a54 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -9433,6 +9433,15 @@
// throw an exception if we have an update to a system application, but, it's not more
// recent than the package we've already scanned
if (isUpdatedSystemPkg && !isUpdatedPkgBetter) {
+ // Set CPU Abis to application info.
+ if ((scanFlags & SCAN_FIRST_BOOT_OR_UPGRADE) != 0) {
+ final String cpuAbiOverride = deriveAbiOverride(pkg.cpuAbiOverride, updatedPkg);
+ derivePackageAbi(pkg, scanFile, cpuAbiOverride, false, mAppLib32InstallDir);
+ } else {
+ pkg.applicationInfo.primaryCpuAbi = updatedPkg.primaryCpuAbiString;
+ pkg.applicationInfo.secondaryCpuAbi = updatedPkg.secondaryCpuAbiString;
+ }
+
throw new PackageManagerException(Log.WARN, "Package " + ps.name + " at "
+ scanFile + " ignored: updated version " + ps.versionCode
+ " better than this " + pkg.mVersionCode);
diff --git a/services/core/java/com/android/server/wm/AppWindowContainerController.java b/services/core/java/com/android/server/wm/AppWindowContainerController.java
index f142ff6..f628d5e 100644
--- a/services/core/java/com/android/server/wm/AppWindowContainerController.java
+++ b/services/core/java/com/android/server/wm/AppWindowContainerController.java
@@ -365,7 +365,6 @@
// Now that the app is going invisible, we can remove it. It will be restarted
// if made visible again.
wtoken.removeDeadWindows();
- wtoken.setVisibleBeforeClientHidden();
mService.mUnknownAppVisibilityController.appRemovedOrHidden(wtoken);
} else {
if (!mService.mAppTransition.isTransitionSet()
@@ -729,35 +728,6 @@
}
}
- /**
- * Takes a snapshot of the screen. In landscape mode this grabs the whole screen.
- * In portrait mode, it grabs the full screenshot.
- *
- * @param displayId the Display to take a screenshot of.
- * @param width the width of the target bitmap
- * @param height the height of the target bitmap
- * @param frameScale the scale to apply to the frame, only used when width = -1 and height = -1
- */
- public Bitmap screenshotApplications(int displayId, int width, int height, float frameScale) {
- try {
- Trace.traceBegin(Trace.TRACE_TAG_WINDOW_MANAGER, "screenshotApplications");
- final DisplayContent dc;
- synchronized(mWindowMap) {
- dc = mRoot.getDisplayContentOrCreate(displayId);
- if (dc == null) {
- if (DEBUG_SCREENSHOT) Slog.i(TAG_WM, "Screenshot of " + mToken
- + ": returning null. No Display for displayId=" + displayId);
- return null;
- }
- }
- return dc.screenshotApplications(mToken.asBinder(), width, height,
- false /* includeFullDisplay */, frameScale, Bitmap.Config.RGB_565,
- false /* wallpaperOnly */, false /* includeDecor */);
- } finally {
- Trace.traceEnd(Trace.TRACE_TAG_WINDOW_MANAGER);
- }
- }
-
void reportStartingWindowDrawn() {
mHandler.sendMessage(mHandler.obtainMessage(H.NOTIFY_STARTING_WINDOW_DRAWN));
}
diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java
index 7545a10..d625003 100644
--- a/services/core/java/com/android/server/wm/AppWindowToken.java
+++ b/services/core/java/com/android/server/wm/AppWindowToken.java
@@ -78,8 +78,6 @@
import java.util.ArrayDeque;
import java.util.ArrayList;
-import static android.os.Build.VERSION_CODES.O;
-
class AppTokenList extends ArrayList<AppWindowToken> {
}
@@ -126,14 +124,6 @@
// case do not clear allDrawn until the animation completes.
boolean deferClearAllDrawn;
- /**
- * These are to track the app's real drawing status if there were no saved surfaces.
- * @see #updateDrawnWindowStates
- */
- boolean allDrawnExcludingSaved;
- private int mNumInterestingWindowsExcludingSaved;
- private int mNumDrawnWindowsExcludingSaved;
-
// Is this window's surface needed? This is almost like hidden, except
// it will sometimes be true a little earlier: when the token has
// been shown, but is still waiting for its app transition to execute
@@ -690,107 +680,9 @@
}
}
- /**
- * Checks whether we should save surfaces for this app.
- *
- * @return true if the surfaces should be saved, false otherwise.
- */
- boolean shouldSaveSurface() {
- // We want to save surface if the app's windows are "allDrawn".
- // (If we started entering animation early with saved surfaces, allDrawn
- // should have been restored to true. So we'll save again in that case
- // even if app didn't actually finish drawing.)
- return allDrawn;
- }
-
- private boolean canRestoreSurfaces() {
- for (int i = mChildren.size() -1; i >= 0; i--) {
- final WindowState w = mChildren.get(i);
- if (w.canRestoreSurface()) {
- return true;
- }
- }
- return false;
- }
-
- private void clearWasVisibleBeforeClientHidden() {
- for (int i = mChildren.size() - 1; i >= 0; i--) {
- final WindowState w = mChildren.get(i);
- w.clearWasVisibleBeforeClientHidden();
- }
- }
-
- /**
- * Whether the app has some window that is invisible in layout, but
- * animating with saved surface.
- */
- boolean isAnimatingInvisibleWithSavedSurface() {
- for (int i = mChildren.size() - 1; i >= 0; i--) {
- final WindowState w = mChildren.get(i);
- if (w.isAnimatingInvisibleWithSavedSurface()) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Hide all window surfaces that's still invisible in layout but animating
- * with a saved surface, and mark them destroying.
- */
- void stopUsingSavedSurfaceLocked() {
- for (int i = mChildren.size() - 1; i >= 0; i--) {
- final WindowState w = mChildren.get(i);
- w.stopUsingSavedSurface();
- }
- destroySurfaces();
- }
-
- void markSavedSurfaceExiting() {
- for (int i = mChildren.size() - 1; i >= 0; i--) {
- final WindowState w = mChildren.get(i);
- w.markSavedSurfaceExiting();
- }
- }
-
- void restoreSavedSurfaceForInterestingWindows() {
- if (!canRestoreSurfaces()) {
- clearWasVisibleBeforeClientHidden();
- return;
- }
-
- // Check if all interesting windows are drawn and we can mark allDrawn=true.
- int interestingNotDrawn = -1;
-
- for (int i = mChildren.size() - 1; i >= 0; i--) {
- final WindowState w = mChildren.get(i);
- interestingNotDrawn = w.restoreSavedSurfaceForInterestingWindow();
- }
-
- if (!allDrawn) {
- allDrawn = (interestingNotDrawn == 0);
- if (allDrawn) {
- mService.mH.obtainMessage(NOTIFY_ACTIVITY_DRAWN, token).sendToTarget();
- }
- }
- clearWasVisibleBeforeClientHidden();
-
- if (DEBUG_APP_TRANSITIONS || DEBUG_ANIM) Slog.d(TAG,
- "restoreSavedSurfaceForInterestingWindows: " + this + " allDrawn=" + allDrawn
- + " interestingNotDrawn=" + interestingNotDrawn);
- }
-
- void destroySavedSurfaces() {
- for (int i = mChildren.size() - 1; i >= 0; i--) {
- final WindowState win = mChildren.get(i);
- win.destroySavedSurface();
- }
- }
-
void clearAllDrawn() {
allDrawn = false;
deferClearAllDrawn = false;
- allDrawnExcludingSaved = false;
}
Task getTask() {
@@ -1388,8 +1280,7 @@
private boolean allDrawnStatesConsidered() {
for (int i = mChildren.size() - 1; i >= 0; --i) {
final WindowState child = mChildren.get(i);
- if (child.mightAffectAllDrawn(false /*visibleOnly*/ )
- && !child.getDrawnStateEvaluated()) {
+ if (child.mightAffectAllDrawn() && !child.getDrawnStateEvaluated()) {
return false;
}
}
@@ -1429,23 +1320,6 @@
}
}
}
-
- if (!allDrawnExcludingSaved) {
- int numInteresting = mNumInterestingWindowsExcludingSaved;
- if (numInteresting > 0 && mNumDrawnWindowsExcludingSaved >= numInteresting) {
- if (DEBUG_VISIBILITY) Slog.v(TAG, "allDrawnExcludingSaved: " + this
- + " interesting=" + numInteresting
- + " drawn=" + mNumDrawnWindowsExcludingSaved);
- allDrawnExcludingSaved = true;
- if (mDisplayContent != null) {
- mDisplayContent.setLayoutNeeded();
- }
- if (isAnimatingInvisibleWithSavedSurface()
- && !mService.mFinishedEarlyAnim.contains(this)) {
- mService.mFinishedEarlyAnim.add(this);
- }
- }
- }
}
/**
@@ -1462,15 +1336,13 @@
+ " allDrawn=" + allDrawn + " freezingScreen=" + mAppAnimator.freezingScreen);
}
- if (allDrawn && allDrawnExcludingSaved && !mAppAnimator.freezingScreen) {
+ if (allDrawn && !mAppAnimator.freezingScreen) {
return false;
}
if (mLastTransactionSequence != mService.mTransactionSequence) {
mLastTransactionSequence = mService.mTransactionSequence;
mNumInterestingWindows = mNumDrawnWindows = 0;
- mNumInterestingWindowsExcludingSaved = 0;
- mNumDrawnWindowsExcludingSaved = 0;
startingDisplayed = false;
}
@@ -1478,7 +1350,7 @@
boolean isInterestingAndDrawn = false;
- if (!allDrawn && w.mightAffectAllDrawn(false /* visibleOnly */)) {
+ if (!allDrawn && w.mightAffectAllDrawn()) {
if (DEBUG_VISIBILITY || DEBUG_ORIENTATION) {
Slog.v(TAG, "Eval win " + w + ": isDrawn=" + w.isDrawnLw()
+ ", isAnimationSet=" + winAnimator.isAnimationSet());
@@ -1513,23 +1385,6 @@
}
}
- if (!allDrawnExcludingSaved && w.mightAffectAllDrawn(true /* visibleOnly */)) {
- if (w != startingWindow && w.isInteresting()) {
- mNumInterestingWindowsExcludingSaved++;
- if (w.isDrawnLw() && !w.isAnimatingWithSavedSurface()) {
- mNumDrawnWindowsExcludingSaved++;
-
- if (DEBUG_VISIBILITY || DEBUG_ORIENTATION) Slog.v(TAG,
- "tokenMayBeDrawnExcludingSaved: " + this + " w=" + w
- + " numInteresting=" + mNumInterestingWindowsExcludingSaved
- + " freezingScreen=" + mAppAnimator.freezingScreen
- + " mAppFreezing=" + w.mAppFreezing);
-
- isInterestingAndDrawn = true;
- }
- }
- }
-
return isInterestingAndDrawn;
}
diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java
index af86202..bd4aa97 100644
--- a/services/core/java/com/android/server/wm/DisplayContent.java
+++ b/services/core/java/com/android/server/wm/DisplayContent.java
@@ -1084,10 +1084,6 @@
}
forAllWindows(w -> {
- // Discard surface after orientation change, these can't be reused.
- if (w.mAppToken != null) {
- w.mAppToken.destroySavedSurfaces();
- }
if (w.mHasSurface && !rotateSeamlessly) {
if (DEBUG_ORIENTATION) Slog.v(TAG_WM, "Set mOrientationChanging of " + w);
w.setOrientationChanging(true);
@@ -2354,8 +2350,7 @@
} else if (w.mAppToken != null && w.mAppToken.isClientHidden()) {
Slog.w(TAG_WM, "LEAKED SURFACE (app token hidden): "
+ w + " surface=" + wsa.mSurfaceController
- + " token=" + w.mAppToken
- + " saved=" + w.hasSavedSurface());
+ + " token=" + w.mAppToken);
if (SHOW_TRANSACTIONS) logSurface(w, "LEAK DESTROY", false);
wsa.destroySurface();
mTmpWindow = w;
diff --git a/services/core/java/com/android/server/wm/RootWindowContainer.java b/services/core/java/com/android/server/wm/RootWindowContainer.java
index 05ef1a5..b364fb9 100644
--- a/services/core/java/com/android/server/wm/RootWindowContainer.java
+++ b/services/core/java/com/android/server/wm/RootWindowContainer.java
@@ -18,7 +18,6 @@
import android.content.res.Configuration;
import android.graphics.Rect;
-import android.hardware.display.DisplayManager;
import android.hardware.power.V1_0.PowerHint;
import android.os.Binder;
import android.os.Debug;
@@ -671,10 +670,6 @@
// Don't remove this window until rotation has completed.
continue;
}
- // Discard the saved surface if window size is changed, it can't be reused.
- if (win.mAppToken != null) {
- win.mAppToken.destroySavedSurfaces();
- }
win.reportResized();
mService.mResizingWindows.remove(i);
}
@@ -704,7 +699,7 @@
if (win.getDisplayContent().mWallpaperController.isWallpaperTarget(win)) {
wallpaperDestroyed = true;
}
- win.destroyOrSaveSurfaceUnchecked();
+ win.destroySurfaceUnchecked();
} while (i > 0);
mService.mDestroySurface.clear();
}
diff --git a/services/core/java/com/android/server/wm/TaskSnapshotController.java b/services/core/java/com/android/server/wm/TaskSnapshotController.java
index ecf9067..4632402 100644
--- a/services/core/java/com/android/server/wm/TaskSnapshotController.java
+++ b/services/core/java/com/android/server/wm/TaskSnapshotController.java
@@ -16,8 +16,6 @@
package com.android.server.wm;
-import static android.app.ActivityManager.ENABLE_TASK_SNAPSHOTS;
-
import static com.android.server.wm.TaskSnapshotPersister.DISABLE_FULL_SIZED_BITMAPS;
import static com.android.server.wm.TaskSnapshotPersister.REDUCED_SCALE;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME;
@@ -225,7 +223,7 @@
}
private boolean shouldDisableSnapshots() {
- return !ENABLE_TASK_SNAPSHOTS || mIsRunningOnWear || mIsRunningOnTv || mIsRunningOnIoT;
+ return mIsRunningOnWear || mIsRunningOnTv || mIsRunningOnIoT;
}
private Rect minRect(Rect rect1, Rect rect2) {
diff --git a/services/core/java/com/android/server/wm/WindowAnimator.java b/services/core/java/com/android/server/wm/WindowAnimator.java
index 079ae40..c01ee31 100644
--- a/services/core/java/com/android/server/wm/WindowAnimator.java
+++ b/services/core/java/com/android/server/wm/WindowAnimator.java
@@ -272,7 +272,6 @@
mRemoveReplacedWindows = false;
}
- mService.stopUsingSavedSurfaceLocked();
mService.destroyPreservedSurfaceLocked();
mService.mWindowPlacerLocked.destroyPendingSurfaces();
diff --git a/services/core/java/com/android/server/wm/WindowContainer.java b/services/core/java/com/android/server/wm/WindowContainer.java
index bf79dfa..926719d 100644
--- a/services/core/java/com/android/server/wm/WindowContainer.java
+++ b/services/core/java/com/android/server/wm/WindowContainer.java
@@ -363,13 +363,6 @@
}
}
- void setVisibleBeforeClientHidden() {
- for (int i = mChildren.size() - 1; i >= 0; --i) {
- final WindowContainer wc = mChildren.get(i);
- wc.setVisibleBeforeClientHidden();
- }
- }
-
/**
* Returns true if the container or one of its children as some content it can display or wants
* to display (e.g. app views or saved surface).
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index 8e741c5..32ee51c 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -445,13 +445,6 @@
final ArrayList<AppWindowToken> mFinishedStarting = new ArrayList<>();
/**
- * List of window tokens that have finished drawing their own windows and
- * no longer need to show any saved surfaces. Windows that's still showing
- * saved surfaces will be cleaned up after next animation pass.
- */
- final ArrayList<AppWindowToken> mFinishedEarlyAnim = new ArrayList<>();
-
- /**
* List of app window tokens that are waiting for replacing windows. If the
* replacement doesn't come in time the stale windows needs to be disposed of.
*/
@@ -2078,17 +2071,8 @@
winAnimator.mEnterAnimationPending = false;
winAnimator.mEnteringAnimation = false;
- final boolean usingSavedSurfaceBeforeVisible =
- oldVisibility != View.VISIBLE && win.isAnimatingWithSavedSurface();
- if (DEBUG_APP_TRANSITIONS || DEBUG_ANIM) {
- if (winAnimator.hasSurface() && !win.mAnimatingExit
- && usingSavedSurfaceBeforeVisible) {
- Slog.d(TAG, "Ignoring layout to invisible when using saved surface " + win);
- }
- }
- if (winAnimator.hasSurface() && !win.mAnimatingExit
- && !usingSavedSurfaceBeforeVisible) {
+ if (winAnimator.hasSurface() && !win.mAnimatingExit) {
if (DEBUG_VISIBILITY) Slog.i(TAG_WM, "Relayout invis " + win
+ ": mAnimatingExit=" + win.mAnimatingExit);
// If we are not currently running the exit animation, we
@@ -5374,14 +5358,6 @@
mDestroyPreservedSurface.clear();
}
- void stopUsingSavedSurfaceLocked() {
- for (int i = mFinishedEarlyAnim.size() - 1; i >= 0 ; i--) {
- final AppWindowToken wtoken = mFinishedEarlyAnim.get(i);
- wtoken.stopUsingSavedSurfaceLocked();
- }
- mFinishedEarlyAnim.clear();
- }
-
// -------------------------------------------------------------
// IWindowManager API
// -------------------------------------------------------------
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index f7ab534..e8e40a7 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -16,12 +16,10 @@
package com.android.server.wm;
-import static android.app.ActivityManager.ENABLE_TASK_SNAPSHOTS;
import static android.app.ActivityManager.StackId;
import static android.app.ActivityManager.StackId.FREEFORM_WORKSPACE_STACK_ID;
import static android.app.ActivityManager.StackId.INVALID_STACK_ID;
import static android.app.ActivityManager.StackId.PINNED_STACK_ID;
-import static android.app.ActivityManager.isLowRamDeviceStatic;
import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER;
import static android.view.Display.DEFAULT_DISPLAY;
import static android.view.ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_CONTENT;
@@ -38,7 +36,6 @@
import static android.view.WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
import static android.view.WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
import static android.view.WindowManager.LayoutParams.FLAG_SCALED;
-import static android.view.WindowManager.LayoutParams.FLAG_SECURE;
import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED;
import static android.view.WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON;
@@ -138,8 +135,8 @@
import android.os.Trace;
import android.os.UserHandle;
import android.os.WorkSource;
-import android.util.MergedConfiguration;
import android.util.DisplayMetrics;
+import android.util.MergedConfiguration;
import android.util.Slog;
import android.util.TimeUtils;
import android.util.proto.ProtoOutputStream;
@@ -182,9 +179,6 @@
// to capture touch events in that area.
static final int RESIZE_HANDLE_WIDTH_IN_DP = 30;
- private static final boolean DEBUG_DISABLE_SAVING_SURFACES = false ||
- ENABLE_TASK_SNAPSHOTS;
-
final WindowManagerService mService;
final WindowManagerPolicy mPolicy;
final Context mContext;
@@ -521,15 +515,6 @@
/** When true this window can be displayed on screens owther than mOwnerUid's */
private boolean mShowToOwnerOnly;
- // Whether the window has a saved surface from last pause, which can be
- // used to start an entering animation earlier.
- private boolean mSurfaceSaved = false;
-
- // Whether we're performing an entering animation with a saved surface. This flag is
- // true during the time we're showing a window with a previously saved surface. It's
- // cleared when surface is destroyed, saved, or re-drawn by the app.
- private boolean mAnimatingWithSavedSurface;
-
// Whether the window was visible when we set the app to invisible last time. WM uses
// this as a hint to restore the surface (if available) for early animation next time
// the app is brought visible.
@@ -585,8 +570,6 @@
*/
boolean mSeamlesslyRotated = false;
- private static final Region sEmptyRegion = new Region();
-
/**
* Surface insets from the previous call to relayout(), used to track
* if we are changing the Surface insets.
@@ -1370,10 +1353,7 @@
@Override
boolean hasContentToDisplay() {
- // If we're animating with a saved surface, we're already visible.
- // Return true so that the alpha doesn't get cleared.
- if (!mAppFreezing && isDrawnLw()
- && (mViewVisibility == View.VISIBLE || isAnimatingWithSavedSurface()
+ if (!mAppFreezing && isDrawnLw() && (mViewVisibility == View.VISIBLE
|| (mWinAnimator.isAnimationSet() && !mService.mAppTransition.isTransitionSet()))) {
return true;
}
@@ -1461,19 +1441,12 @@
/**
* Whether this window's drawn state might affect the drawn states of the app token.
*
- * @param visibleOnly Whether we should consider only the windows that's currently
- * visible in layout. If true, windows that has not relayout to VISIBLE
- * would always return false.
- *
* @return true if the window should be considered while evaluating allDrawn flags.
*/
- boolean mightAffectAllDrawn(boolean visibleOnly) {
- final boolean isViewVisible = (mAppToken == null || !mAppToken.isClientHidden())
- && (mViewVisibility == View.VISIBLE) && !mWindowRemovalAllowed;
- return (isOnScreen() && (!visibleOnly || isViewVisible)
- || mWinAnimator.mAttrType == TYPE_BASE_APPLICATION
- || mWinAnimator.mAttrType == TYPE_DRAWN_APPLICATION)
- && !mAnimatingExit && !mDestroying;
+ boolean mightAffectAllDrawn() {
+ final boolean isAppType = mWinAnimator.mAttrType == TYPE_BASE_APPLICATION
+ || mWinAnimator.mAttrType == TYPE_DRAWN_APPLICATION;
+ return (isOnScreen() || isAppType) && !mAnimatingExit && !mDestroying;
}
/**
@@ -1667,10 +1640,6 @@
@Override
void onResize() {
- // Some windows won't go through the resizing process, if they don't have a surface, so
- // destroy all saved surfaces here.
- destroySavedSurface();
-
final ArrayList<WindowState> resizingWindows = mService.mResizingWindows;
if (mHasSurface && !resizingWindows.contains(this)) {
if (DEBUG_RESIZE) Slog.d(TAG, "onResize: Resizing " + this);
@@ -1919,19 +1888,6 @@
return;
}
- if (isAnimatingWithSavedSurface() && !mAppToken.allDrawnExcludingSaved) {
- // We started enter animation early with a saved surface, now the app asks to remove
- // this window. If we remove it now and the app is not yet drawn, we'll show a
- // flicker. Delay the removal now until it's really drawn.
- if (DEBUG_ADD_REMOVE) Slog.d(TAG_WM,
- "removeWindowLocked: delay removal of " + this + " due to early animation");
- // Do not set mAnimatingExit to true here, it will cause the surface to be hidden
- // immediately after the enter animation is done. If the app is not yet drawn then
- // it will show up as a flicker.
- setupWindowForRemoveOnExit();
- Binder.restoreCallingIdentity(origId);
- return;
- }
// If we are not currently running the exit animation, we need to see about starting one
wasVisible = isWinVisibleLw();
@@ -2634,10 +2590,6 @@
return mAnimatingExit || (mService.mClosingApps.contains(mAppToken));
}
- boolean isAnimatingWithSavedSurface() {
- return mAnimatingWithSavedSurface;
- }
-
@Override
boolean isAnimating() {
if (mWinAnimator.isAnimationSet() || mAnimatingExit) {
@@ -2646,48 +2598,6 @@
return super.isAnimating();
}
- boolean isAnimatingInvisibleWithSavedSurface() {
- if (mAnimatingWithSavedSurface
- && (mViewVisibility != View.VISIBLE || mWindowRemovalAllowed)) {
- return true;
- }
- for (int i = mChildren.size() - 1; i >= 0; --i) {
- final WindowState c = mChildren.get(i);
- if (c.isAnimatingInvisibleWithSavedSurface()) {
- return true;
- }
- }
- return false;
- }
-
- void stopUsingSavedSurface() {
- for (int i = mChildren.size() - 1; i >= 0; --i) {
- final WindowState c = mChildren.get(i);
- c.stopUsingSavedSurface();
- }
-
- if (!isAnimatingInvisibleWithSavedSurface()) {
- return;
- }
-
- if (DEBUG_APP_TRANSITIONS || DEBUG_ANIM) Slog.d(TAG, "stopUsingSavedSurface: " + this);
- clearAnimatingWithSavedSurface();
- mDestroying = true;
- mWinAnimator.hide("stopUsingSavedSurface");
- getDisplayContent().mWallpaperController.hideWallpapers(this);
- }
-
- void markSavedSurfaceExiting() {
- if (isAnimatingInvisibleWithSavedSurface()) {
- mAnimatingExit = true;
- mWinAnimator.mAnimating = true;
- }
- for (int i = mChildren.size() - 1; i >= 0; --i) {
- final WindowState c = mChildren.get(i);
- c.markSavedSurfaceExiting();
- }
- }
-
void addWinAnimatorToList(ArrayList<WindowStateAnimator> animators) {
animators.add(mWinAnimator);
@@ -2726,25 +2636,6 @@
}
}
- public void setVisibleBeforeClientHidden() {
- mWasVisibleBeforeClientHidden |=
- (mViewVisibility == View.VISIBLE || mAnimatingWithSavedSurface);
-
- super.setVisibleBeforeClientHidden();
- }
-
- public void clearWasVisibleBeforeClientHidden() {
- mWasVisibleBeforeClientHidden = false;
- for (int i = mChildren.size() - 1; i >= 0; --i) {
- final WindowState c = mChildren.get(i);
- c.clearWasVisibleBeforeClientHidden();
- }
- }
-
- public boolean wasVisibleBeforeClientHidden() {
- return mWasVisibleBeforeClientHidden;
- }
-
void onStartFreezingScreen() {
mAppFreezing = true;
for (int i = mChildren.size() - 1; i >= 0; --i) {
@@ -2777,48 +2668,6 @@
return true;
}
- private boolean shouldSaveSurface() {
- if (mWinAnimator.mSurfaceController == null) {
- // Don't bother if the surface controller is gone for any reason.
- return false;
- }
-
- if (!mWasVisibleBeforeClientHidden) {
- return false;
- }
-
- if ((mAttrs.flags & FLAG_SECURE) != 0) {
- // We don't save secure surfaces since their content shouldn't be shown while the app
- // isn't on screen and content might leak through during the transition animation with
- // saved surface.
- return false;
- }
-
- if (isLowRamDeviceStatic()) {
- // Don't save surfaces on Svelte devices.
- return false;
- }
-
- final Task task = getTask();
- final AppWindowToken taskTop = task.getTopVisibleAppToken();
- if (taskTop != null && taskTop != mAppToken) {
- // Don't save if the window is not the topmost window.
- return false;
- }
-
- if (mResizedWhileGone) {
- // Somebody resized our window while we were gone for layout, which means that the
- // client got an old size, so we have an outdated surface here.
- return false;
- }
-
- if (DEBUG_DISABLE_SAVING_SURFACES) {
- return false;
- }
-
- return mAppToken.shouldSaveSurface();
- }
-
boolean destroySurface(boolean cleanupOnResume, boolean appStopped) {
boolean destroyedSomething = false;
for (int i = mChildren.size() - 1; i >= 0; --i) {
@@ -2840,7 +2689,7 @@
+ " win.mWindowRemovalAllowed=" + mWindowRemovalAllowed
+ " win.mRemoveOnExit=" + mRemoveOnExit);
if (!cleanupOnResume || mRemoveOnExit) {
- destroyOrSaveSurfaceUnchecked();
+ destroySurfaceUnchecked();
}
if (mRemoveOnExit) {
removeImmediately();
@@ -2858,156 +2707,14 @@
// Destroy or save the application surface without checking
// various indicators of whether the client has released the surface.
// This is in general unsafe, and most callers should use {@link #destroySurface}
- void destroyOrSaveSurfaceUnchecked() {
- mSurfaceSaved = shouldSaveSurface();
- if (mSurfaceSaved) {
- if (DEBUG_APP_TRANSITIONS || DEBUG_ANIM) {
- Slog.v(TAG, "Saving surface: " + this);
- }
- // Previous user of the surface may have set a transparent region signaling a portion
- // doesn't need to be composited, so reset to default empty state.
- mSession.setTransparentRegion(mClient, sEmptyRegion);
+ void destroySurfaceUnchecked() {
+ mWinAnimator.destroySurfaceLocked();
- mWinAnimator.hide("saved surface");
- mWinAnimator.mDrawState = WindowStateAnimator.NO_SURFACE;
- setHasSurface(false);
- // The client should have disconnected at this point, but if it doesn't,
- // we need to make sure it's disconnected. Otherwise when we reuse the surface
- // the client can't reconnect to the buffer queue, and rendering will fail.
- if (mWinAnimator.mSurfaceController != null) {
- mWinAnimator.mSurfaceController.disconnectInTransaction();
- }
- mAnimatingWithSavedSurface = false;
- } else {
- mWinAnimator.destroySurfaceLocked();
- }
// Clear animating flags now, since the surface is now gone. (Note this is true even
// if the surface is saved, to outside world the surface is still NO_SURFACE.)
mAnimatingExit = false;
}
- void destroySavedSurface() {
- for (int i = mChildren.size() - 1; i >= 0; --i) {
- final WindowState c = mChildren.get(i);
- c.destroySavedSurface();
- }
-
- if (mSurfaceSaved) {
- if (DEBUG_APP_TRANSITIONS || DEBUG_ANIM) Slog.v(TAG, "Destroying saved surface: " + this);
- mWinAnimator.destroySurfaceLocked();
- mSurfaceSaved = false;
- }
- mWasVisibleBeforeClientHidden = false;
- }
-
- /** Returns -1 if there are no interesting windows or number of interesting windows not drawn.*/
- int restoreSavedSurfaceForInterestingWindow() {
- int interestingNotDrawn = -1;
- for (int i = mChildren.size() - 1; i >= 0; --i) {
- final WindowState c = mChildren.get(i);
- final int childInterestingNotDrawn = c.restoreSavedSurfaceForInterestingWindow();
- if (childInterestingNotDrawn != -1) {
- if (interestingNotDrawn == -1) {
- interestingNotDrawn = childInterestingNotDrawn;
- } else {
- interestingNotDrawn += childInterestingNotDrawn;
- }
- }
- }
-
- if (mAttrs.type == TYPE_APPLICATION_STARTING
- || mAppDied || !wasVisibleBeforeClientHidden()
- || (mAppToken.mAppAnimator.freezingScreen && mAppFreezing)) {
- // Window isn't interesting...
- return interestingNotDrawn;
- }
-
- restoreSavedSurface();
-
- if (!isDrawnLw()) {
- if (interestingNotDrawn == -1) {
- interestingNotDrawn = 1;
- } else {
- interestingNotDrawn++;
- }
- }
- return interestingNotDrawn;
- }
-
- /** Returns true if the saved surface was restored. */
- boolean restoreSavedSurface() {
- if (!mSurfaceSaved) {
- return false;
- }
-
- // Sometimes we save surfaces due to layout invisible directly after rotation occurs.
- // However this means the surface was never laid out in the new orientation.
- // We can only restore to the last rotation we were laid out as visible in.
- if (mLastVisibleLayoutRotation != getDisplayContent().getRotation()) {
- destroySavedSurface();
- return false;
- }
- mSurfaceSaved = false;
-
- if (mWinAnimator.mSurfaceController != null) {
- setHasSurface(true);
- mWinAnimator.mDrawState = READY_TO_SHOW;
- mAnimatingWithSavedSurface = true;
-
- requestUpdateWallpaperIfNeeded();
-
- if (DEBUG_APP_TRANSITIONS || DEBUG_ANIM) {
- Slog.v(TAG, "Restoring saved surface: " + this);
- }
- } else {
- // mSurfaceController shouldn't be null if mSurfaceSaved was still true at
- // this point. Even if we destroyed the saved surface because of rotation
- // or resize, mSurfaceSaved flag should have been cleared. So this is a wtf.
- Slog.wtf(TAG, "Failed to restore saved surface: surface gone! " + this);
- }
-
- return true;
- }
-
- boolean canRestoreSurface() {
- if (mWasVisibleBeforeClientHidden && mSurfaceSaved) {
- return true;
- }
-
- for (int i = mChildren.size() - 1; i >= 0; --i) {
- final WindowState c = mChildren.get(i);
- if (c.canRestoreSurface()) {
- return true;
- }
- }
-
- return false;
- }
-
- boolean hasSavedSurface() {
- return mSurfaceSaved;
- }
-
- void clearHasSavedSurface() {
- mSurfaceSaved = false;
- mAnimatingWithSavedSurface = false;
- if (mWasVisibleBeforeClientHidden) {
- mAppToken.destroySavedSurfaces();
- }
- }
-
- boolean clearAnimatingWithSavedSurface() {
- if (mAnimatingWithSavedSurface) {
- // App has drawn something to its windows, we're no longer animating with
- // the saved surfaces.
- if (DEBUG_ANIM) Slog.d(TAG,
- "clearAnimatingWithSavedSurface(): win=" + this);
- mAnimatingWithSavedSurface = false;
- return true;
- }
- return false;
- }
-
@Override
public boolean isDefaultDisplay() {
final DisplayContent displayContent = getDisplayContent();
@@ -3487,12 +3194,11 @@
if (mAppToken != null) {
pw.print(prefix); pw.print("mAppToken="); pw.println(mAppToken);
pw.print(prefix); pw.print(" isAnimatingWithSavedSurface()=");
- pw.print(isAnimatingWithSavedSurface());
pw.print(" mAppDied=");pw.print(mAppDied);
pw.print(prefix); pw.print("drawnStateEvaluated=");
pw.print(getDrawnStateEvaluated());
pw.print(prefix); pw.print("mightAffectAllDrawn=");
- pw.println(mightAffectAllDrawn(false /*visibleOnly*/));
+ pw.println(mightAffectAllDrawn());
}
pw.print(prefix); pw.print("mViewVisibility=0x");
pw.print(Integer.toHexString(mViewVisibility));
@@ -3543,7 +3249,6 @@
pw.print(prefix); pw.print("mHasSurface="); pw.print(mHasSurface);
pw.print(" mShownPosition="); mShownPosition.printShortString(pw);
pw.print(" isReadyForDisplay()="); pw.print(isReadyForDisplay());
- pw.print(" hasSavedSurface()="); pw.print(hasSavedSurface());
pw.print(" mWindowRemovalAllowed="); pw.println(mWindowRemovalAllowed);
if (dumpAll) {
pw.print(prefix); pw.print("mFrame="); mFrame.printShortString(pw);
@@ -4601,11 +4306,6 @@
&& getResizeMode() == DRAG_RESIZE_MODE_DOCKED_DIVIDER;
result |= freeformResizing ? RELAYOUT_RES_DRAG_RESIZING_FREEFORM : 0;
result |= dockedResizing ? RELAYOUT_RES_DRAG_RESIZING_DOCKED : 0;
- if (isAnimatingWithSavedSurface()) {
- // If we're animating with a saved surface now, request client to report draw.
- // We still need to know when the real thing is drawn.
- result |= RELAYOUT_RES_FIRST_TIME;
- }
return result;
}
diff --git a/services/core/java/com/android/server/wm/WindowStateAnimator.java b/services/core/java/com/android/server/wm/WindowStateAnimator.java
index 5f1e42c..ddb8df2 100644
--- a/services/core/java/com/android/server/wm/WindowStateAnimator.java
+++ b/services/core/java/com/android/server/wm/WindowStateAnimator.java
@@ -16,7 +16,6 @@
package com.android.server.wm;
-import static android.app.ActivityManager.StackId;
import static android.view.Display.DEFAULT_DISPLAY;
import static android.view.WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED;
import static android.view.WindowManager.LayoutParams.FLAG_SCALED;
@@ -347,7 +346,7 @@
mAnimation.cancel();
mAnimation = null;
mLocalAnimating = false;
- mWin.destroyOrSaveSurfaceUnchecked();
+ mWin.destroySurfaceUnchecked();
}
}
@@ -507,7 +506,7 @@
+ drawStateToString());
}
- boolean layoutNeeded = mWin.clearAnimatingWithSavedSurface();
+ boolean layoutNeeded = false;
if (mDrawState == DRAW_PENDING) {
if (DEBUG_SURFACE_TRACE || DEBUG_ANIM || SHOW_TRANSACTIONS || DEBUG_ORIENTATION)
@@ -626,11 +625,6 @@
WindowSurfaceController createSurfaceLocked(int windowType, int ownerUid) {
final WindowState w = mWin;
- if (w.restoreSavedSurface()) {
- if (DEBUG_ANIM) Slog.i(TAG,
- "createSurface: " + this + ": called when we had a saved surface");
- return mSurfaceController;
- }
if (mSurfaceController != null) {
return mSurfaceController;
@@ -789,8 +783,7 @@
}
boolean hasSurface() {
- return !mWin.hasSavedSurface()
- && mSurfaceController != null && mSurfaceController.hasSurface();
+ return mSurfaceController != null && mSurfaceController.hasSurface();
}
void destroySurfaceLocked() {
@@ -801,8 +794,6 @@
}
}
- mWin.clearHasSavedSurface();
-
if (mSurfaceController == null) {
return;
}
diff --git a/services/core/java/com/android/server/wm/WindowSurfacePlacer.java b/services/core/java/com/android/server/wm/WindowSurfacePlacer.java
index 581b044..88625d3 100644
--- a/services/core/java/com/android/server/wm/WindowSurfacePlacer.java
+++ b/services/core/java/com/android/server/wm/WindowSurfacePlacer.java
@@ -2,7 +2,6 @@
package com.android.server.wm;
import static android.app.ActivityManager.StackId.INVALID_STACK_ID;
-import static android.app.ActivityManagerInternal.APP_TRANSITION_SAVED_SURFACE;
import static android.app.ActivityManagerInternal.APP_TRANSITION_SNAPSHOT;
import static android.app.ActivityManagerInternal.APP_TRANSITION_SPLASH_SCREEN;
import static android.app.ActivityManagerInternal.APP_TRANSITION_WINDOWS_DRAWN;
@@ -445,13 +444,6 @@
for (int i = 0; i < appsCount; i++) {
AppWindowToken wtoken = mService.mClosingApps.valueAt(i);
- // If we still have some windows animating with saved surfaces that's
- // either invisible or already removed, mark them exiting so that they
- // are disposed of after the exit animation. These are not supposed to
- // be shown, or are delayed removal until app is actually drawn (in which
- // case the window will be removed after the animation).
- wtoken.markSavedSurfaceExiting();
-
final AppWindowAnimator appAnimator = wtoken.mAppAnimator;
if (DEBUG_APP_TRANSITIONS) Slog.v(TAG, "Now closing app " + wtoken);
appAnimator.clearThumbnail();
@@ -539,8 +531,6 @@
+ wtoken.startingMoved + " isRelaunching()="
+ wtoken.isRelaunching());
- final boolean drawnBeforeRestoring = wtoken.allDrawn;
- wtoken.restoreSavedSurfaceForInterestingWindows();
final boolean allDrawn = wtoken.allDrawn && !wtoken.isRelaunching();
if (!allDrawn && !wtoken.startingDisplayed && !wtoken.startingMoved) {
@@ -549,8 +539,7 @@
final TaskStack stack = wtoken.getStack();
final int stackId = stack != null ? stack.mStackId : INVALID_STACK_ID;
if (allDrawn) {
- outReasons.put(stackId, drawnBeforeRestoring ? APP_TRANSITION_WINDOWS_DRAWN
- : APP_TRANSITION_SAVED_SURFACE);
+ outReasons.put(stackId, APP_TRANSITION_WINDOWS_DRAWN);
} else {
outReasons.put(stackId, wtoken.startingData instanceof SplashScreenStartingData
? APP_TRANSITION_SPLASH_SCREEN
diff --git a/services/tests/servicestests/src/com/android/server/am/ActivityTestsBase.java b/services/tests/servicestests/src/com/android/server/am/ActivityTestsBase.java
index 55ecd7a..f3c00b1 100644
--- a/services/tests/servicestests/src/com/android/server/am/ActivityTestsBase.java
+++ b/services/tests/servicestests/src/com/android/server/am/ActivityTestsBase.java
@@ -117,7 +117,7 @@
intent.setComponent(component);
final TaskRecord task = new TaskRecord(service, 0, aInfo, intent /*intent*/,
- null /*_taskDescription*/, new ActivityManager.TaskThumbnailInfo());
+ null /*_taskDescription*/);
final ActivityStack stack = service.mStackSupervisor.getStack(stackId,
true /*createStaticStackIfNeeded*/, true /*onTop*/);
service.mStackSupervisor.setFocusStackUnchecked("test", stack);
diff --git a/tests/ActivityTests/src/com/google/android/test/activity/ActivityTestMain.java b/tests/ActivityTests/src/com/google/android/test/activity/ActivityTestMain.java
index ceb3993e..0f49608 100644
--- a/tests/ActivityTests/src/com/google/android/test/activity/ActivityTestMain.java
+++ b/tests/ActivityTests/src/com/google/android/test/activity/ActivityTestMain.java
@@ -117,46 +117,6 @@
}
}
- private void addThumbnail(LinearLayout container, Bitmap bm,
- final ActivityManager.RecentTaskInfo task,
- final ActivityManager.TaskThumbnail thumbs) {
- ImageView iv = new ImageView(this);
- if (bm != null) {
- iv.setImageBitmap(bm);
- }
- iv.setBackgroundResource(android.R.drawable.gallery_thumb);
- int w = getResources().getDimensionPixelSize(android.R.dimen.thumbnail_width);
- int h = getResources().getDimensionPixelSize(android.R.dimen.thumbnail_height);
- container.addView(iv, new LinearLayout.LayoutParams(w, h));
-
- iv.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (task.id >= 0 && thumbs != null) {
- mAm.moveTaskToFront(task.id, ActivityManager.MOVE_TASK_WITH_HOME);
- } else {
- try {
- startActivity(task.baseIntent);
- } catch (ActivityNotFoundException e) {
- Log.w("foo", "Unable to start task: " + e);
- }
- }
- buildUi();
- }
- });
- iv.setOnLongClickListener(new View.OnLongClickListener() {
- @Override
- public boolean onLongClick(View v) {
- if (task.id >= 0 && thumbs != null) {
- mAm.removeTask(task.id);
- buildUi();
- return true;
- }
- return false;
- }
- });
- }
-
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -600,7 +560,6 @@
if (recents != null) {
for (int i=0; i<recents.size(); i++) {
ActivityManager.RecentTaskInfo r = recents.get(i);
- ActivityManager.TaskThumbnail tt = mAm.getTaskThumbnail(r.persistentId);
TextView tv = new TextView(this);
tv.setText(r.baseIntent.getComponent().flattenToShortString());
top.addView(tv, new LinearLayout.LayoutParams(
@@ -608,7 +567,6 @@
LinearLayout.LayoutParams.WRAP_CONTENT));
LinearLayout item = new LinearLayout(this);
item.setOrientation(LinearLayout.HORIZONTAL);
- addThumbnail(item, tt != null ? tt.mainThumbnail : null, r, tt);
top.addView(item, new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT));