Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 096f36b8 authored by Winson Chung's avatar Winson Chung
Browse files

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
parent 87545c5a
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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>
+2 −2
Original line number Diff line number Diff line
@@ -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>
+1 −1
Original line number Diff line number Diff line
@@ -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);
+2 −2
Original line number Diff line number Diff line
@@ -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);
            }
        }
+17 −8
Original line number Diff line number Diff line
@@ -386,7 +386,12 @@ final class TaskRecord {
        setNextAffiliate(null);
    }

    void setLastThumbnail(Bitmap thumbnail) {
    /**
     * 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) {
@@ -395,6 +400,9 @@ final class TaskRecord {
            } 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);