From 5a863fb700c0f005f1043ee00e8e56dbb8766d6d Mon Sep 17 00:00:00 2001 From: Pun Butrach Date: Mon, 10 Nov 2025 04:37:13 +0700 Subject: [PATCH] fix: Shortcut get disabled reason crashes on Android 8.1 (#6061) Signed-off-by: Pun Butrach --- .../launcher3/model/data/WorkspaceItemInfo.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/com/android/launcher3/model/data/WorkspaceItemInfo.java b/src/com/android/launcher3/model/data/WorkspaceItemInfo.java index a741bb8c42..c6dde71640 100644 --- a/src/com/android/launcher3/model/data/WorkspaceItemInfo.java +++ b/src/com/android/launcher3/model/data/WorkspaceItemInfo.java @@ -193,14 +193,20 @@ public class WorkspaceItemInfo extends ItemInfoWithIcon { if (shortcutInfo.isEnabled()) { runtimeStatusFlags &= ~FLAG_DISABLED_BY_PUBLISHER; } else { - Log.w(TAG, "updateFromDeepShortcutInfo: Updated shortcut has been disabled. " - + " package=" + shortcutInfo.getPackage() - + " disabledReason=" + shortcutInfo.getDisabledReason()); + if (Utilities.ATLEAST_P) { + Log.w(TAG, "updateFromDeepShortcutInfo: Updated shortcut has been disabled. " + + " package=" + shortcutInfo.getPackage() + + " disabledReason=" + shortcutInfo.getDisabledReason()); + } runtimeStatusFlags |= FLAG_DISABLED_BY_PUBLISHER; } - if (shortcutInfo.getDisabledReason() == ShortcutInfo.DISABLED_REASON_VERSION_LOWER) { - runtimeStatusFlags |= FLAG_DISABLED_VERSION_LOWER; + if (Utilities.ATLEAST_P) { + if (shortcutInfo.getDisabledReason() == ShortcutInfo.DISABLED_REASON_VERSION_LOWER) { + runtimeStatusFlags |= FLAG_DISABLED_VERSION_LOWER; + } else { + runtimeStatusFlags &= ~FLAG_DISABLED_VERSION_LOWER; + } } else { runtimeStatusFlags &= ~FLAG_DISABLED_VERSION_LOWER; }