summaryrefslogtreecommitdiffstats
path: root/core/java
diff options
context:
space:
mode:
authorJim Miller <jaggies@google.com>2010-07-14 17:21:00 -0700
committerJim Miller <jaggies@google.com>2010-07-14 17:21:00 -0700
commit839458d8d4dbf44cd1778a23471cf8f948a2012c (patch)
tree20ea9037fa1dfa14ad22b27182acbf63325a0732 /core/java
parent71ecab2d89122535a8bb1f589bc8d920aaedaa7c (diff)
parente03952c042c4ee72a96b485e445b944748aa2212 (diff)
downloadframeworks_base-839458d8d4dbf44cd1778a23471cf8f948a2012c.zip
frameworks_base-839458d8d4dbf44cd1778a23471cf8f948a2012c.tar.gz
frameworks_base-839458d8d4dbf44cd1778a23471cf8f948a2012c.tar.bz2
resolved conflicts for merge of e03952c0 to master
Change-Id: I414d934101d452a2c2500e539f0b0aff1e1b3ff0
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/app/Activity.java35
-rw-r--r--core/java/android/app/ActivityManager.java40
-rw-r--r--core/java/android/app/ActivityThread.java26
-rw-r--r--core/java/android/view/View.java10
4 files changed, 91 insertions, 20 deletions
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index a1cf233..91e4cd5 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -71,6 +71,7 @@ import android.view.View.OnCreateContextMenuListener;
import android.view.ViewGroup.LayoutParams;
import android.view.accessibility.AccessibilityEvent;
import android.widget.AdapterView;
+import android.widget.FrameLayout;
import android.widget.LinearLayout;
import com.android.internal.app.ActionBarImpl;
@@ -1270,19 +1271,37 @@ public class Activity extends ContextThemeWrapper
* @see #onPause
*/
public boolean onCreateThumbnail(Bitmap outBitmap, Canvas canvas) {
- final View view = mDecor;
- if (view == null) {
+ if (mDecor == null) {
return false;
}
- final int vw = view.getWidth();
- final int vh = view.getHeight();
- final int dw = outBitmap.getWidth();
- final int dh = outBitmap.getHeight();
+ int paddingLeft = 0;
+ int paddingRight = 0;
+ int paddingTop = 0;
+ int paddingBottom = 0;
+
+ // Find System window and use padding so we ignore space reserved for decorations
+ // like the status bar and such.
+ final FrameLayout top = (FrameLayout) mDecor;
+ for (int i = 0; i < top.getChildCount(); i++) {
+ View child = top.getChildAt(i);
+ if (child.isFitsSystemWindowsFlagSet()) {
+ paddingLeft = child.getPaddingLeft();
+ paddingRight = child.getPaddingRight();
+ paddingTop = child.getPaddingTop();
+ paddingBottom = child.getPaddingBottom();
+ break;
+ }
+ }
+
+ final int visibleWidth = mDecor.getWidth() - paddingLeft - paddingRight;
+ final int visibleHeight = mDecor.getHeight() - paddingTop - paddingBottom;
canvas.save();
- canvas.scale(((float)dw)/vw, ((float)dh)/vh);
- view.draw(canvas);
+ canvas.scale( (float) outBitmap.getWidth() / visibleWidth,
+ (float) outBitmap.getHeight() / visibleHeight);
+ canvas.translate(-paddingLeft, -paddingTop);
+ mDecor.draw(canvas);
canvas.restore();
return true;
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java
index eb7520f..d66e98b 100644
--- a/core/java/android/app/ActivityManager.java
+++ b/core/java/android/app/ActivityManager.java
@@ -285,24 +285,54 @@ public class ActivityManager {
* @param maxNum The maximum number of entries to return in the list. The
* actual number returned may be smaller, depending on how many tasks the
* user has started.
- *
+ *
+ * @param flags Optional flags
+ * @param receiver Optional receiver for delayed thumbnails
+ *
* @return Returns a list of RunningTaskInfo records describing each of
* the running tasks.
*
+ * Some thumbnails may not be available at the time of this call. The optional
+ * receiver may be used to receive those thumbnails.
+ *
* @throws SecurityException Throws SecurityException if the caller does
* not hold the {@link android.Manifest.permission#GET_TASKS} permission.
+ *
+ * @hide
*/
- public List<RunningTaskInfo> getRunningTasks(int maxNum)
+ public List<RunningTaskInfo> getRunningTasks(int maxNum, int flags, IThumbnailReceiver receiver)
throws SecurityException {
try {
- return (List<RunningTaskInfo>)ActivityManagerNative.getDefault()
- .getTasks(maxNum, 0, null);
+ return ActivityManagerNative.getDefault().getTasks(maxNum, flags, receiver);
} catch (RemoteException e) {
// System dead, we will be dead too soon!
return null;
}
}
-
+
+ /**
+ * Return a list of the tasks that are currently running, with
+ * the most recent being first and older ones after in order. Note that
+ * "running" does not mean any of the task's code is currently loaded or
+ * activity -- the task may have been frozen by the system, so that it
+ * can be restarted in its previous state when next brought to the
+ * foreground.
+ *
+ * @param maxNum The maximum number of entries to return in the list. The
+ * actual number returned may be smaller, depending on how many tasks the
+ * user has started.
+ *
+ * @return Returns a list of RunningTaskInfo records describing each of
+ * the running tasks.
+ *
+ * @throws SecurityException Throws SecurityException if the caller does
+ * not hold the {@link android.Manifest.permission#GET_TASKS} permission.
+ */
+ public List<RunningTaskInfo> getRunningTasks(int maxNum)
+ throws SecurityException {
+ return getRunningTasks(maxNum, 0, null);
+ }
+
/**
* Information you can retrieve about a particular Service that is
* currently running in the system.
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index aa207e8..c800fbe 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -116,6 +116,7 @@ final class RemoteServiceException extends AndroidRuntimeException {
*/
public final class ActivityThread {
static final String TAG = "ActivityThread";
+ private static final android.graphics.Bitmap.Config THUMBNAIL_FORMAT = Bitmap.Config.RGB_565;
private static final boolean DEBUG = false;
static final boolean localLOGV = DEBUG ? Config.LOGD : Config.LOGV;
static final boolean DEBUG_BROADCAST = false;
@@ -2245,13 +2246,24 @@ public final class ActivityThread {
h = mThumbnailHeight;
}
- // XXX Only set hasAlpha if needed?
- thumbnail = Bitmap.createBitmap(w, h, Bitmap.Config.RGB_565);
- thumbnail.eraseColor(0);
- Canvas cv = new Canvas(thumbnail);
- if (!r.activity.onCreateThumbnail(thumbnail, cv)) {
- thumbnail = null;
+ // On platforms where we don't want thumbnails, set dims to (0,0)
+ if ((w > 0) && (h > 0)) {
+ View topView = r.activity.getWindow().getDecorView();
+
+ // Maximize bitmap by capturing in native aspect.
+ if (topView.getWidth() >= topView.getHeight()) {
+ thumbnail = Bitmap.createBitmap(w, h, THUMBNAIL_FORMAT);
+ } else {
+ thumbnail = Bitmap.createBitmap(h, w, THUMBNAIL_FORMAT);
+ }
+
+ thumbnail.eraseColor(0);
+ Canvas cv = new Canvas(thumbnail);
+ if (!r.activity.onCreateThumbnail(thumbnail, cv)) {
+ thumbnail = null;
+ }
}
+
} catch (Exception e) {
if (!mInstrumentation.onException(r.activity, e)) {
throw new RuntimeException(
@@ -2382,7 +2394,7 @@ public final class ActivityThread {
if (info != null) {
try {
// First create a thumbnail for the activity...
- //info.thumbnail = createThumbnailBitmap(r);
+ info.thumbnail = createThumbnailBitmap(r);
info.description = r.activity.onCreateDescription();
} catch (Exception e) {
if (!mInstrumentation.onException(r.activity, e)) {
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 05d380e..0831fb1 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -3019,6 +3019,16 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
}
/**
+ * Determine if this view has the FITS_SYSTEM_WINDOWS flag set.
+ * @return True if window has FITS_SYSTEM_WINDOWS set
+ *
+ * @hide
+ */
+ public boolean isFitsSystemWindowsFlagSet() {
+ return (mViewFlags & FITS_SYSTEM_WINDOWS) == FITS_SYSTEM_WINDOWS;
+ }
+
+ /**
* Returns the visibility status for this view.
*
* @return One of {@link #VISIBLE}, {@link #INVISIBLE}, or {@link #GONE}.