summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2014-08-20 15:39:01 -0700
committerWinson Chung <winsonc@google.com>2014-08-22 01:03:21 +0000
commit096f36b8db3e513687b78da3e1dd0197fce148a3 (patch)
treee9a8403bf95bf0b30f2c263395f8152ad153d049 /services
parent87545c5a24836717585508a743ad206b03665c85 (diff)
downloadframeworks_base-096f36b8db3e513687b78da3e1dd0197fce148a3.zip
frameworks_base-096f36b8db3e513687b78da3e1dd0197fce148a3.tar.gz
frameworks_base-096f36b8db3e513687b78da3e1dd0197fce148a3.tar.bz2
Minor tweaks to recents thumbnails.
- Reducing the size of the recents thumbnails - Skip persisting if we never update the last thumbnail - Don't bother loading the last thumbnail file descriptor if we have it in memory - Fixing warning in getting drawable from resource Change-Id: Ieddaeac75a5e5d80876a9b6b1d50f7cc84c7d6fd
Diffstat (limited to 'services')
-rwxr-xr-xservices/core/java/com/android/server/am/ActivityRecord.java4
-rw-r--r--services/core/java/com/android/server/am/TaskRecord.java25
2 files changed, 19 insertions, 10 deletions
diff --git a/services/core/java/com/android/server/am/ActivityRecord.java b/services/core/java/com/android/server/am/ActivityRecord.java
index 24b7cb3..fcbe71e 100755
--- a/services/core/java/com/android/server/am/ActivityRecord.java
+++ b/services/core/java/com/android/server/am/ActivityRecord.java
@@ -773,8 +773,8 @@ final class ActivityRecord {
if (newThumbnail != null) {
if (ActivityManagerService.DEBUG_THUMBNAILS) Slog.i(ActivityManagerService.TAG,
"Setting thumbnail of " + this + " to " + newThumbnail);
- task.setLastThumbnail(newThumbnail);
- if (isPersistable()) {
+ boolean thumbnailUpdated = task.setLastThumbnail(newThumbnail);
+ if (thumbnailUpdated && isPersistable()) {
mStackSupervisor.mService.notifyTaskPersisterLocked(task, false);
}
}
diff --git a/services/core/java/com/android/server/am/TaskRecord.java b/services/core/java/com/android/server/am/TaskRecord.java
index 2a8c6fb..d35e09f 100644
--- a/services/core/java/com/android/server/am/TaskRecord.java
+++ b/services/core/java/com/android/server/am/TaskRecord.java
@@ -386,15 +386,23 @@ final class TaskRecord {
setNextAffiliate(null);
}
- void setLastThumbnail(Bitmap thumbnail) {
- mLastThumbnail = thumbnail;
- if (thumbnail == null) {
- if (mLastThumbnailFile != null) {
- mLastThumbnailFile.delete();
+ /**
+ * Sets the last thumbnail.
+ * @return whether the thumbnail was set
+ */
+ boolean setLastThumbnail(Bitmap thumbnail) {
+ if (mLastThumbnail != thumbnail) {
+ mLastThumbnail = thumbnail;
+ if (thumbnail == null) {
+ if (mLastThumbnailFile != null) {
+ mLastThumbnailFile.delete();
+ }
+ } else {
+ mService.mTaskPersister.saveImage(thumbnail, mFilename);
}
- } else {
- mService.mTaskPersister.saveImage(thumbnail, mFilename);
+ return true;
}
+ return false;
}
void getLastThumbnail(TaskThumbnail thumbs) {
@@ -403,7 +411,8 @@ final class TaskRecord {
if (mLastThumbnail == null) {
thumbs.mainThumbnail = mService.mTaskPersister.getThumbnail(mFilename);
}
- if (mLastThumbnailFile.exists()) {
+ // 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);