Showing alert dialog when shortcut version higher than the App

Creating an AlertDialog when the disabled reason of the shortcut is DISABLED_REASON_VERSION_LOWER, which happens when the backed-up shortcut was created from an application that has a version higher than the one installed on the device. The AlertDialog will direct the user to the play store and update the application.

Test: Manual
Fix: 224796975
Change-Id: I0125fada60b48176775de6782ba03ee6790904aa
This commit is contained in:
Sihua Ma
2022-04-01 03:03:12 -07:00
parent d34d3b4834
commit da8759ae29
5 changed files with 84 additions and 10 deletions

View File

@@ -50,7 +50,6 @@ import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.os.Message;
import android.os.Parcelable;
import android.os.UserHandle;
import android.util.AttributeSet;
import android.util.Log;
import android.util.SparseArray;
@@ -123,7 +122,6 @@ import com.android.launcher3.widget.util.WidgetSizes;
import com.android.systemui.plugins.shared.LauncherOverlayManager.LauncherOverlay;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.function.Consumer;
@@ -3297,9 +3295,12 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
}
}
public void removeAbandonedPromise(String packageName, UserHandle user) {
ItemInfoMatcher matcher = ItemInfoMatcher.ofPackages(
Collections.singleton(packageName), user);
/**
* Remove workspace icons & widget information related to items in matcher.
*
* @param matcher the matcher generated by the caller.
*/
public void persistRemoveItemsByMatcher(ItemInfoMatcher matcher) {
mLauncher.getModelWriter().deleteItemsFromDatabase(matcher);
removeItemsByMatcher(matcher);
}