From b4d1ca49021dc03f908ee5739bc0e410a4d986e7 Mon Sep 17 00:00:00 2001 From: Hyunyoung Song Date: Tue, 8 Jan 2019 17:15:16 -0800 Subject: [PATCH] Refresh icon cache for recents when rro overrides the adaptive icon path Bug: 122472687 Change-Id: I646c3918480740ea322e60252e3ceb006964567f --- .../android/quickstep/views/RecentsView.java | 20 ++++++++++++++++++- .../launcher3/InvariantDeviceProfile.java | 4 ++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index e2e02dda2c..4cfd8cb06d 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -17,6 +17,7 @@ package com.android.quickstep.views; import static com.android.launcher3.BaseActivity.STATE_HANDLER_INVISIBILITY_FLAGS; +import static com.android.launcher3.InvariantDeviceProfile.CHANGE_FLAG_ICON_PARAMS; import static com.android.launcher3.anim.Interpolators.ACCEL; import static com.android.launcher3.anim.Interpolators.ACCEL_2; import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN; @@ -69,6 +70,7 @@ import androidx.annotation.Nullable; import com.android.launcher3.BaseActivity; import com.android.launcher3.DeviceProfile; import com.android.launcher3.Insettable; +import com.android.launcher3.InvariantDeviceProfile; import com.android.launcher3.PagedView; import com.android.launcher3.R; import com.android.launcher3.Utilities; @@ -105,7 +107,8 @@ import java.util.function.Consumer; */ @TargetApi(Build.VERSION_CODES.P) public abstract class RecentsView extends PagedView implements Insettable, - TaskThumbnailCache.HighResLoadingState.HighResLoadingStateChangedCallback { + TaskThumbnailCache.HighResLoadingState.HighResLoadingStateChangedCallback, + InvariantDeviceProfile.OnIDPChangeListener { private static final String TAG = RecentsView.class.getSimpleName(); @@ -151,6 +154,8 @@ public abstract class RecentsView extends PagedView impl // Keeps track of the previously known visible tasks for purposes of loading/unloading task data private final SparseBooleanArray mHasVisibleTaskData = new SparseBooleanArray(); + private final InvariantDeviceProfile mIdp; + /** * TODO: Call reloadIdNeeded in onTaskStackChanged. */ @@ -293,6 +298,8 @@ public abstract class RecentsView extends PagedView impl mActivity = (T) BaseActivity.fromContext(context); mQuickScrubController = new QuickScrubController(mActivity, this); mModel = RecentsModel.INSTANCE.get(context); + mIdp = InvariantDeviceProfile.INSTANCE.get(context); + mClearAllButton = (ClearAllButton) LayoutInflater.from(context) .inflate(R.layout.overview_clear_all_button, this, false); mClearAllButton.setOnClickListener(this::dismissAllTasks); @@ -334,6 +341,15 @@ public abstract class RecentsView extends PagedView impl updateTaskStackListenerState(); } + @Override + public void onIdpChanged(int changeFlags, InvariantDeviceProfile idp) { + if ((changeFlags & CHANGE_FLAG_ICON_PARAMS) == 0) { + return; + } + mModel.getIconCache().clear(); + reset(); + } + @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); @@ -342,6 +358,7 @@ public abstract class RecentsView extends PagedView impl mActivity.addMultiWindowModeChangedListener(mMultiWindowModeChangedListener); ActivityManagerWrapper.getInstance().registerTaskStackListener(mTaskStackListener); mSyncTransactionApplier = new SyncRtSurfaceTransactionApplierCompat(this); + mIdp.addOnChangeListener(this); } @Override @@ -352,6 +369,7 @@ public abstract class RecentsView extends PagedView impl mActivity.removeMultiWindowModeChangedListener(mMultiWindowModeChangedListener); ActivityManagerWrapper.getInstance().unregisterTaskStackListener(mTaskStackListener); mSyncTransactionApplier = null; + mIdp.removeOnChangeListener(this); } @Override diff --git a/src/com/android/launcher3/InvariantDeviceProfile.java b/src/com/android/launcher3/InvariantDeviceProfile.java index 5c842a57dd..888ffd3567 100644 --- a/src/com/android/launcher3/InvariantDeviceProfile.java +++ b/src/com/android/launcher3/InvariantDeviceProfile.java @@ -214,6 +214,10 @@ public class InvariantDeviceProfile { mChangeListeners.add(listener); } + public void removeOnChangeListener(OnIDPChangeListener listener) { + mChangeListeners.remove(listener); + } + private void killProcess(Context context) { Log.e("ConfigMonitor", "restarting launcher"); android.os.Process.killProcess(android.os.Process.myPid());