diff options
author | Winson Chung <winsonc@google.com> | 2014-08-20 15:39:01 -0700 |
---|---|---|
committer | Winson Chung <winsonc@google.com> | 2014-08-22 01:03:21 +0000 |
commit | 096f36b8db3e513687b78da3e1dd0197fce148a3 (patch) | |
tree | e9a8403bf95bf0b30f2c263395f8152ad153d049 | |
parent | 87545c5a24836717585508a743ad206b03665c85 (diff) | |
download | frameworks_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
5 files changed, 24 insertions, 15 deletions
diff --git a/core/res/res/values-sw720dp/dimens.xml b/core/res/res/values-sw720dp/dimens.xml index 21235ec..2317d1f 100644 --- a/core/res/res/values-sw720dp/dimens.xml +++ b/core/res/res/values-sw720dp/dimens.xml @@ -35,9 +35,9 @@ <item type="dimen" name="dialog_fixed_height_minor">90%</item> <!-- The width that is used when creating thumbnails of applications. --> - <dimen name="thumbnail_width">640dp</dimen> + <dimen name="thumbnail_width">420dp</dimen> <!-- The height that is used when creating thumbnails of applications. --> - <dimen name="thumbnail_height">640dp</dimen> + <dimen name="thumbnail_height">420dp</dimen> <!-- Preference activity, vertical padding for the header list --> <dimen name="preference_screen_header_vertical_padding">32dp</dimen> diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml index 6022bdc..6fd2bb1 100644 --- a/core/res/res/values/dimens.xml +++ b/core/res/res/values/dimens.xml @@ -19,9 +19,9 @@ --> <resources> <!-- The width that is used when creating thumbnails of applications. --> - <dimen name="thumbnail_width">256dp</dimen> + <dimen name="thumbnail_width">192dp</dimen> <!-- The height that is used when creating thumbnails of applications. --> - <dimen name="thumbnail_height">256dp</dimen> + <dimen name="thumbnail_height">192dp</dimen> <!-- The standard size (both width and height) of an application icon that will be displayed in the app launcher and elsewhere. --> <dimen name="app_icon_size">48dip</dimen> diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewHeader.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewHeader.java index c7198fe..d39f64e 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewHeader.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewHeader.java @@ -143,7 +143,7 @@ class TaskViewHeader extends FrameLayout { mBackgroundColor = new ColorDrawable(0); // Copy the ripple drawable since we are going to be manipulating it mBackground = (RippleDrawable) - getResources().getDrawable(R.drawable.recents_task_view_header_bg); + getContext().getDrawable(R.drawable.recents_task_view_header_bg); mBackground = (RippleDrawable) mBackground.mutate().getConstantState().newDrawable(); mBackground.setColor(ColorStateList.valueOf(0)); mBackground.setDrawableByLayerId(mBackground.getId(0), mBackgroundColor); 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); |