Merge "Refresh icon cache for recents when rro overrides the adaptive icon path" into ub-launcher3-master

This commit is contained in:
Hyunyoung Song 2019-01-09 20:13:14 +00:00 committed by Android (Google) Code Review
commit 1d3e37ecf2
2 changed files with 23 additions and 1 deletions

View File

@ -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<T extends BaseActivity> 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<T extends BaseActivity> 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<T extends BaseActivity> 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<T extends BaseActivity> 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<T extends BaseActivity> 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<T extends BaseActivity> extends PagedView impl
mActivity.removeMultiWindowModeChangedListener(mMultiWindowModeChangedListener);
ActivityManagerWrapper.getInstance().unregisterTaskStackListener(mTaskStackListener);
mSyncTransactionApplier = null;
mIdp.removeOnChangeListener(this);
}
@Override

View File

@ -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());