summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPinyao Ting <pinyaoting@google.com>2022-09-21 23:40:21 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-10-18 18:55:51 +0000
commit531a1147c6d24e03a868eda3de6ff00bfcdb5231 (patch)
tree7377b8db9eb7f4bf4cc65f4dd3840df70be4e599
parent2f63eac7f994c627b9dbb76c85c6efe6968323ff (diff)
downloadbase-531a1147c6d24e03a868eda3de6ff00bfcdb5231.tar.gz
[Do Not Merge] 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 Change-Id: Ibbfd0891eabdce72f76571798382fe949d8f453d Test: manual (cherry picked from commit 36338a315218221e51c24a42e44c4f743d416f82) Merged-In: Ibbfd0891eabdce72f76571798382fe949d8f453d
-rw-r--r--services/core/java/com/android/server/pm/ShortcutPackage.java13
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 b4bd086af272..3506fd9be15d 100644
--- a/services/core/java/com/android/server/pm/ShortcutPackage.java
+++ b/services/core/java/com/android/server/pm/ShortcutPackage.java
@@ -1967,10 +1967,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));