diff options
author | Pinyao Ting <pinyaoting@google.com> | 2022-09-20 15:47:09 -0700 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-10-08 00:10:13 +0000 |
commit | d5122bfaf18f1503e73c1a3a177a56d0f604a008 (patch) | |
tree | 063762ccae6d4a4f2ae611ce20d239b0db13e00e | |
parent | 9acc4b7bad79a307fdf4183cf50a236d5e7f1759 (diff) | |
download | base-d5122bfaf18f1503e73c1a3a177a56d0f604a008.tar.gz |
Ignore malformed shortcuts
After an app publishes a shortcut that contains malformed intent, the
system can be stuck in boot-loop due to uncaught exception caused by
parsing the malformed intent.
This CL ignores that particular malformed entry. Since shortcuts are
constantly writes back into the xml from system memory, the malformed
entry will be removed from the xml the next time system persists
shortcuts from memory to file system.
Bug: 246540168
Test: manual
Change-Id: I9492fcbd499ab2792c1d08884e3af394c5a4c79f
(cherry picked from commit 5238a70be8c3348f9592de5e625f6311e4d51032)
Merged-In: I9492fcbd499ab2792c1d08884e3af394c5a4c79f
-rw-r--r-- | services/core/java/com/android/server/pm/ShortcutPackage.java | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/pm/ShortcutPackage.java b/services/core/java/com/android/server/pm/ShortcutPackage.java index 0c601bfde05a..890c89152a7c 100644 --- a/services/core/java/com/android/server/pm/ShortcutPackage.java +++ b/services/core/java/com/android/server/pm/ShortcutPackage.java @@ -1962,10 +1962,15 @@ class ShortcutPackage extends ShortcutPackageItem { continue; case TAG_SHORTCUT: - final ShortcutInfo si = parseShortcut(parser, packageName, - shortcutUser.getUserId(), fromBackup); - // Don't use addShortcut(), we don't need to save the icon. - ret.mShortcuts.put(si.getId(), si); + try { + final ShortcutInfo si = parseShortcut(parser, packageName, + shortcutUser.getUserId(), fromBackup); + // Don't use addShortcut(), we don't need to save the icon. + ret.mShortcuts.put(si.getId(), si); + } catch (Exception e) { + // b/246540168 malformed shortcuts should be ignored + Slog.e(TAG, "Failed parsing shortcut.", e); + } continue; case TAG_SHARE_TARGET: ret.mShareTargets.add(ShareTargetInfo.loadFromXml(parser)); |