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 committed 2022-04-14 01:34:44 -07:00
1 parent d34d3b4834
commit da8759ae29
5 files changed
+84 -10

No files matched your search

@@ -180,12 +180,25 @@ public class WorkspaceItemInfo extends ItemInfoWithIcon {
runtimeStatusFlags |= FLAG_DISABLED_BY_PUBLISHER;
}
disabledMessage = shortcutInfo.getDisabledMessage();
if (Utilities.ATLEAST_P
&& shortcutInfo.getDisabledReason() == ShortcutInfo.DISABLED_REASON_VERSION_LOWER) {
runtimeStatusFlags |= FLAG_DISABLED_VERSION_LOWER;
} else {
runtimeStatusFlags &= ~FLAG_DISABLED_VERSION_LOWER;
}
Person[] persons = ApiWrapper.getPersons(shortcutInfo);
personKeys = persons.length == 0 ? Utilities.EMPTY_STRING_ARRAY
: Arrays.stream(persons).map(Person::getKey).sorted().toArray(String[]::new);
}
/**
* {@code true} if the shortcut is disabled due to its app being a lower version.
*/
public boolean isDisabledVersionLower() {
return (runtimeStatusFlags & FLAG_DISABLED_VERSION_LOWER) != 0;
}
/** Returns the WorkspaceItemInfo id associated with the deep shortcut. */
public String getDeepShortcutId() {
return itemType == Favorites.ITEM_TYPE_DEEP_SHORTCUT