Don't use cached app icon in app info page.

The cache in ApplicationsState is causing a lot of damage because AS
object is not smart enough to invalidate the cache in all conditions. So
we end up having bugs like stale app label or icon in weird cases.

This change stops using the cache when loading app icon in entity
headres. This is only a stop gap solution to fix most visible (and most
frequently complained) parts of the page. We still need to address the
cache in ApplicationsState eventually.

Change-Id: Iea88ad99d4069d678d09943cfb0b0e5c94eb3326
Fixes: 79881693
Test: robotests
This commit is contained in:
Fan Zhang
2018-05-18 10:31:32 -07:00
parent 76a0ef6adb
commit fcbf155b47
3 changed files with 59 additions and 6 deletions

View File

@@ -35,6 +35,7 @@ import android.support.annotation.IntDef;
import android.support.annotation.VisibleForTesting;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.util.IconDrawableFactory;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
@@ -146,9 +147,7 @@ public class EntityHeaderController {
* accessibility purposes.
*/
public EntityHeaderController setIcon(ApplicationsState.AppEntry appEntry) {
if (appEntry.icon != null) {
mIcon = appEntry.icon.getConstantState().newDrawable(mAppContext.getResources());
}
mIcon = IconDrawableFactory.newInstance(mAppContext).getBadgedIcon(appEntry.info);
return this;
}