mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-27 15:26:58 +00:00
Add logging to help debug invalid icon state and UI.
PackageInstallStateChangedTask had some redundant state handling that could lead to invalid states. Removed state handling (potential fix to b/198924992) along with logging to help debug b/198924992. Test: Started and canceled an app download Bug: 198924992 Change-Id: I8b8202ceb62a3265186d8d46a0e1be6afc83c080
This commit is contained in:
@@ -21,7 +21,6 @@ import android.content.pm.PackageManager;
|
||||
import com.android.launcher3.LauncherAppState;
|
||||
import com.android.launcher3.model.data.AppInfo;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.model.data.ItemInfoWithIcon;
|
||||
import com.android.launcher3.model.data.LauncherAppWidgetInfo;
|
||||
import com.android.launcher3.pm.PackageInstallInfo;
|
||||
import com.android.launcher3.util.InstantAppResolver;
|
||||
@@ -73,13 +72,7 @@ public class PackageInstallStateChangedTask extends BaseModelUpdateTask {
|
||||
dataModel.forAllWorkspaceItemInfos(mInstallInfo.user, si -> {
|
||||
if (si.hasPromiseIconUi()
|
||||
&& mInstallInfo.packageName.equals(si.getTargetPackage())) {
|
||||
int installProgress = mInstallInfo.progress;
|
||||
|
||||
si.setProgressLevel(installProgress, PackageInstallInfo.STATUS_INSTALLING);
|
||||
if (mInstallInfo.state == PackageInstallInfo.STATUS_FAILED) {
|
||||
// Mark this info as broken.
|
||||
si.runtimeStatusFlags &= ~ItemInfoWithIcon.FLAG_INSTALL_SESSION_ACTIVE;
|
||||
}
|
||||
si.setProgressLevel(mInstallInfo);
|
||||
updates.add(si);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -24,6 +24,7 @@ import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.launcher3.icons.BitmapInfo;
|
||||
import com.android.launcher3.icons.FastBitmapDrawable;
|
||||
import com.android.launcher3.logging.FileLog;
|
||||
import com.android.launcher3.pm.PackageInstallInfo;
|
||||
import com.android.launcher3.util.PackageManagerHelper;
|
||||
|
||||
@@ -179,6 +180,12 @@ public abstract class ItemInfoWithIcon extends ItemInfo {
|
||||
*/
|
||||
public void setProgressLevel(PackageInstallInfo installInfo) {
|
||||
setProgressLevel(installInfo.progress, installInfo.state);
|
||||
|
||||
if (installInfo.state == PackageInstallInfo.STATUS_FAILED) {
|
||||
FileLog.d(TAG,
|
||||
"Icon info: " + this + " marked broken with install info: " + installInfo,
|
||||
new Exception());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -57,4 +57,28 @@ public final class PackageInstallInfo {
|
||||
public static PackageInstallInfo fromState(int state, String packageName, UserHandle user) {
|
||||
return new PackageInstallInfo(packageName, state, 0 /* progress */, user);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass().getSimpleName() + "(" + dumpProperties() + ")";
|
||||
}
|
||||
|
||||
private String dumpProperties() {
|
||||
return "componentName=" + componentName
|
||||
+ "packageName=" + packageName
|
||||
+ " state=" + stateToString()
|
||||
+ " progress=" + progress
|
||||
+ " user=" + user;
|
||||
}
|
||||
|
||||
private String stateToString() {
|
||||
switch (state) {
|
||||
case STATUS_INSTALLED : return "STATUS_INSTALLED";
|
||||
case STATUS_INSTALLING : return "STATUS_INSTALLING";
|
||||
case STATUS_INSTALLED_DOWNLOADING : return "STATUS_INSTALLED_DOWNLOADING";
|
||||
case STATUS_FAILED : return "STATUS_FAILED";
|
||||
default : return "INVALID STATE";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user