summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/current.txt3
-rw-r--r--core/java/android/app/ActivityManager.java24
-rw-r--r--packages/SystemUI/res/values-sw720dp/dimens.xml3
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java50
-rwxr-xr-xservices/core/java/com/android/server/am/ActivityManagerService.java23
-rwxr-xr-xservices/core/java/com/android/server/am/ActivityStack.java11
6 files changed, 47 insertions, 67 deletions
diff --git a/api/current.txt b/api/current.txt
index 480ab9b..d6f91f2 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -3607,8 +3607,7 @@ package android.app {
method public int addAppTask(android.app.Activity, android.content.Intent, android.app.ActivityManager.TaskDescription, android.graphics.Bitmap);
method public boolean clearApplicationUserData();
method public void dumpPackageState(java.io.FileDescriptor, java.lang.String);
- method public int getAppTaskThumbnailHeight();
- method public int getAppTaskThumbnailWidth();
+ method public android.util.Size getAppTaskThumbnailSize();
method public java.util.List<android.app.ActivityManager.AppTask> getAppTasks();
method public android.content.pm.ConfigurationInfo getDeviceConfigurationInfo();
method public int getLargeMemoryClass();
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java
index ffb9c95..bc54055 100644
--- a/core/java/android/app/ActivityManager.java
+++ b/core/java/android/app/ActivityManager.java
@@ -52,6 +52,7 @@ import android.os.SystemProperties;
import android.os.UserHandle;
import android.text.TextUtils;
import android.util.DisplayMetrics;
+import android.util.Size;
import android.util.Slog;
import java.io.FileDescriptor;
@@ -1026,24 +1027,13 @@ public class ActivityManager {
}
/**
- * Return the current design width for {@link AppTask} thumbnails, for use
+ * Return the current design dimensions for {@link AppTask} thumbnails, for use
* with {@link #addAppTask}.
*/
- public int getAppTaskThumbnailWidth() {
+ public Size getAppTaskThumbnailSize() {
synchronized (this) {
ensureAppTaskThumbnailSizeLocked();
- return mAppTaskThumbnailSize.x;
- }
- }
-
- /**
- * Return the current design height for {@link AppTask} thumbnails, for use
- * with {@link #addAppTask}.
- */
- public int getAppTaskThumbnailHeight() {
- synchronized (this) {
- ensureAppTaskThumbnailSizeLocked();
- return mAppTaskThumbnailSize.y;
+ return new Size(mAppTaskThumbnailSize.x, mAppTaskThumbnailSize.y);
}
}
@@ -1072,9 +1062,9 @@ public class ActivityManager {
* set on it.
* @param description Optional additional description information.
* @param thumbnail Thumbnail to use for the recents entry. Should be the size given by
- * {@link #getAppTaskThumbnailWidth()} and {@link #getAppTaskThumbnailHeight()}. If the
- * bitmap is not that exact size, it will be recreated in your process, probably in a way
- * you don't like, before the recents entry is added.
+ * {@link #getAppTaskThumbnailSize()}. If the bitmap is not that exact size, it will be
+ * recreated in your process, probably in a way you don't like, before the recents entry
+ * is added.
*
* @return Returns the task id of the newly added app task, or -1 if the add failed. The
* most likely cause of failure is that there is no more room for more tasks for your app.
diff --git a/packages/SystemUI/res/values-sw720dp/dimens.xml b/packages/SystemUI/res/values-sw720dp/dimens.xml
index 3cd5f67..dd158c2 100644
--- a/packages/SystemUI/res/values-sw720dp/dimens.xml
+++ b/packages/SystemUI/res/values-sw720dp/dimens.xml
@@ -58,6 +58,9 @@
<!-- Size of fading edge for scrolling -->
<dimen name="status_bar_recents_scroll_fading_edge_length">10dip</dimen>
+ <!-- The radius of the rounded corners on a task view. -->
+ <dimen name="recents_task_view_rounded_corners_radius">3dp</dimen>
+
<!-- Where to place the app icon over the thumbnail -->
<dimen name="status_bar_recents_app_icon_left_margin">0dp</dimen>
<dimen name="status_bar_recents_app_icon_top_margin">8dp</dimen>
diff --git a/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java b/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java
index d328660..ec39d77 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java
@@ -72,6 +72,7 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
static RecentsComponent.Callbacks sRecentsComponentCallbacks;
Context mContext;
+ LayoutInflater mInflater;
SystemServicesProxy mSystemServicesProxy;
Handler mHandler;
boolean mBootCompleted;
@@ -98,32 +99,20 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
public AlternateRecentsComponent(Context context) {
RecentsTaskLoader.initialize(context);
- Resources res = context.getResources();
+ mInflater = LayoutInflater.from(context);
mContext = context;
mSystemServicesProxy = new SystemServicesProxy(context);
mHandler = new Handler();
- mConfig = RecentsConfiguration.reinitialize(context, mSystemServicesProxy);
- mWindowRect = mSystemServicesProxy.getWindowRect();
mTaskStackBounds = new Rect();
- mStatusBarHeight = res.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_height);
- mNavBarHeight = res.getDimensionPixelSize(com.android.internal.R.dimen.navigation_bar_height);
- mNavBarWidth = res.getDimensionPixelSize(com.android.internal.R.dimen.navigation_bar_width);
- mConfig.getTaskStackBounds(mWindowRect.width(), mWindowRect.height(), mStatusBarHeight,
- mNavBarWidth, mTaskStackBounds);
- if (mConfig.isLandscape && mConfig.transposeRecentsLayoutWithOrientation) {
- mSystemInsets.set(0, mStatusBarHeight, mNavBarWidth, 0);
- } else {
- mSystemInsets.set(0, mStatusBarHeight, 0, mNavBarHeight);
- }
}
- public void onStart() {
+ public void onStart() {}
+
+ public void onBootCompleted() {
// Initialize some static datastructures
TaskStackViewLayoutAlgorithm.initializeCurve();
+ // Load the header bar layout
reloadHeaderBarLayout();
- }
-
- public void onBootCompleted() {
mBootCompleted = true;
}
@@ -235,9 +224,19 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
}
public void onConfigurationChanged(Configuration newConfig) {
+ reloadHeaderBarLayout();
+ sLastScreenshot = null;
+ }
+
+ /** Prepares the header bar layout. */
+ void reloadHeaderBarLayout() {
+ Resources res = mContext.getResources();
+ mWindowRect = mSystemServicesProxy.getWindowRect();
+ mStatusBarHeight = res.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_height);
+ mNavBarHeight = res.getDimensionPixelSize(com.android.internal.R.dimen.navigation_bar_height);
+ mNavBarWidth = res.getDimensionPixelSize(com.android.internal.R.dimen.navigation_bar_width);
mConfig = RecentsConfiguration.reinitialize(mContext, mSystemServicesProxy);
mConfig.updateOnConfigurationChange();
- mWindowRect = mSystemServicesProxy.getWindowRect();
mConfig.getTaskStackBounds(mWindowRect.width(), mWindowRect.height(), mStatusBarHeight,
mNavBarWidth, mTaskStackBounds);
if (mConfig.isLandscape && mConfig.transposeRecentsLayoutWithOrientation) {
@@ -245,14 +244,8 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
} else {
mSystemInsets.set(0, mStatusBarHeight, 0, mNavBarHeight);
}
- sLastScreenshot = null;
- reloadHeaderBarLayout();
- }
- /** Prepares the header bar layout. */
- void reloadHeaderBarLayout() {
// Inflate the header bar layout so that we can rebind and draw it for the transition
- Resources res = mContext.getResources();
TaskStack stack = new TaskStack();
mDummyStackView = new TaskStackView(mContext, stack);
TaskStackViewLayoutAlgorithm algo = mDummyStackView.getStackAlgorithm();
@@ -261,8 +254,7 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
algo.computeRects(mWindowRect.width(), mWindowRect.height(), taskStackBounds);
Rect taskViewSize = algo.getUntransformedTaskViewSize();
int taskBarHeight = res.getDimensionPixelSize(R.dimen.recents_task_bar_height);
- LayoutInflater inflater = LayoutInflater.from(mContext);
- mHeaderBar = (TaskViewHeader) inflater.inflate(R.layout.recents_task_view_header, null,
+ mHeaderBar = (TaskViewHeader) mInflater.inflate(R.layout.recents_task_view_header, null,
false);
mHeaderBar.measure(
View.MeasureSpec.makeMeasureSpec(taskViewSize.width(), View.MeasureSpec.EXACTLY),
@@ -419,10 +411,6 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
return null;
}
- // Get the stack
- mDummyStackView.updateMinMaxScrollForStack(stack, mTriggeredFromAltTab, isTopTaskHome);
- mDummyStackView.getScroller().setStackScrollToInitialState();
-
// Find the running task in the TaskStack
Task task = null;
ArrayList<Task> tasks = stack.getTasks();
@@ -444,6 +432,8 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
}
// Get the transform for the running task
+ mDummyStackView.updateMinMaxScrollForStack(stack, mTriggeredFromAltTab, isTopTaskHome);
+ mDummyStackView.getScroller().setStackScrollToInitialState();
mTmpTransform = mDummyStackView.getStackAlgorithm().getStackTransform(task,
mDummyStackView.getScroller().getStackScroll(), mTmpTransform, null);
return mTmpTransform;
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 469eb18..1367761 100755
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -1198,11 +1198,12 @@ public final class ActivityManagerService extends ActivityManagerNative
*/
private boolean mUserIsMonkey;
- /** Flag whether the device has a recents UI */
- final boolean mHasRecents;
+ /** Flag whether the device has a Recents UI */
+ boolean mHasRecents;
- final int mThumbnailWidth;
- final int mThumbnailHeight;
+ /** The dimensions of the thumbnails in the Recents UI. */
+ int mThumbnailWidth;
+ int mThumbnailHeight;
final ServiceThread mHandlerThread;
final MainHandler mHandler;
@@ -2257,11 +2258,6 @@ public final class ActivityManagerService extends ActivityManagerNative
mConfigurationSeq = mConfiguration.seq = 1;
mProcessCpuTracker.init();
- final Resources res = mContext.getResources();
- mHasRecents = res.getBoolean(com.android.internal.R.bool.config_hasRecents);
- mThumbnailWidth = res.getDimensionPixelSize(com.android.internal.R.dimen.thumbnail_width);
- mThumbnailHeight = res.getDimensionPixelSize(com.android.internal.R.dimen.thumbnail_height);
-
mCompatModePackages = new CompatModePackages(this, systemDir, mHandler);
mIntentFirewall = new IntentFirewall(new IntentFirewallInterface(), mHandler);
mStackSupervisor = new ActivityStackSupervisor(this);
@@ -10680,6 +10676,14 @@ public final class ActivityManagerService extends ActivityManagerNative
}
}
+ /** Loads resources after the current configuration has been set. */
+ private void loadResourcesOnSystemReady() {
+ final Resources res = mContext.getResources();
+ mHasRecents = res.getBoolean(com.android.internal.R.bool.config_hasRecents);
+ mThumbnailWidth = res.getDimensionPixelSize(com.android.internal.R.dimen.thumbnail_width);
+ mThumbnailHeight = res.getDimensionPixelSize(com.android.internal.R.dimen.thumbnail_height);
+ }
+
public boolean testIsSystemReady() {
// no need to synchronize(this) just to read & return the value
return mSystemReady;
@@ -10961,6 +10965,7 @@ public final class ActivityManagerService extends ActivityManagerNative
}
retrieveSettings();
+ loadResourcesOnSystemReady();
synchronized (this) {
readGrantedUriPermissionsLocked();
diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java
index d066940..3efd049 100755
--- a/services/core/java/com/android/server/am/ActivityStack.java
+++ b/services/core/java/com/android/server/am/ActivityStack.java
@@ -229,9 +229,6 @@ final class ActivityStack {
private ActivityRecord mLastScreenshotActivity = null;
private Bitmap mLastScreenshotBitmap = null;
- int mThumbnailWidth = -1;
- int mThumbnailHeight = -1;
-
int mCurrentUser;
final int mStackId;
@@ -355,10 +352,6 @@ final class ActivityStack {
mWindowManager = mService.mWindowManager;
mStackId = activityContainer.mStackId;
mCurrentUser = mService.mCurrentUserId;
- // Get the activity screenshot thumbnail dimensions
- Resources res = mService.mContext.getResources();
- mThumbnailWidth = mService.mThumbnailWidth;
- mThumbnailHeight = mService.mThumbnailHeight;
}
/**
@@ -773,8 +766,8 @@ final class ActivityStack {
return null;
}
- int w = mThumbnailWidth;
- int h = mThumbnailHeight;
+ int w = mService.mThumbnailWidth;
+ int h = mService.mThumbnailHeight;
if (w > 0) {
if (who != mLastScreenshotActivity || mLastScreenshotBitmap == null
|| mLastScreenshotActivity.state == ActivityState.RESUMED