Loading services/core/java/com/android/server/pm/ShortcutPackage.java +3 −0 Original line number Diff line number Diff line Loading @@ -2048,6 +2048,9 @@ class ShortcutPackage extends ShortcutPackageItem { shortcutUser.getUserId(), fromBackup); // Don't use addShortcut(), we don't need to save the icon. ret.mShortcuts.put(si.getId(), si); } catch (IOException e) { // Don't ignore IO exceptions. throw e; } catch (Exception e) { // b/246540168 malformed shortcuts should be ignored Slog.e(TAG, "Failed parsing shortcut.", e); Loading services/tests/servicestests/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -115,6 +115,7 @@ android_test { ":StubTestApp", ":SuspendTestApp", ":MediaButtonReceiverHolderTestHelperApp", "data/broken_shortcut.xml", ], java_resources: [ Loading services/tests/servicestests/AndroidTest.xml +2 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ <option name="cleanup" value="true" /> <option name="push-file" key="SimpleServiceTestApp3.apk" value="/data/local/tmp/cts/content/SimpleServiceTestApp3.apk" /> <option name="push-file" key="broken_shortcut.xml" value="/data/local/tmp/cts/content/broken_shortcut.xml" /> </target_preparer> <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller"> Loading services/tests/servicestests/data/broken_shortcut.xml 0 → 100644 +851 B File added.No diff preview for this file type. View file services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java +12 −0 Original line number Diff line number Diff line Loading @@ -4007,6 +4007,18 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { // TODO Check all other fields } public void testLoadCorruptedShortcuts() throws Exception { initService(); addPackage("com.android.chrome", 0, 0); ShortcutUser user = new ShortcutUser(mService, 0); File corruptedShortcutPackage = new File("/data/local/tmp/cts/content/", "broken_shortcut.xml"); assertNull(ShortcutPackage.loadFromFile(mService, user, corruptedShortcutPackage, false)); } public void testSaveCorruptAndLoadUser() throws Exception { // First, create some shortcuts and save. runWithCaller(CALLING_PACKAGE_1, UserHandle.USER_SYSTEM, () -> { Loading Loading
services/core/java/com/android/server/pm/ShortcutPackage.java +3 −0 Original line number Diff line number Diff line Loading @@ -2048,6 +2048,9 @@ class ShortcutPackage extends ShortcutPackageItem { shortcutUser.getUserId(), fromBackup); // Don't use addShortcut(), we don't need to save the icon. ret.mShortcuts.put(si.getId(), si); } catch (IOException e) { // Don't ignore IO exceptions. throw e; } catch (Exception e) { // b/246540168 malformed shortcuts should be ignored Slog.e(TAG, "Failed parsing shortcut.", e); Loading
services/tests/servicestests/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -115,6 +115,7 @@ android_test { ":StubTestApp", ":SuspendTestApp", ":MediaButtonReceiverHolderTestHelperApp", "data/broken_shortcut.xml", ], java_resources: [ Loading
services/tests/servicestests/AndroidTest.xml +2 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ <option name="cleanup" value="true" /> <option name="push-file" key="SimpleServiceTestApp3.apk" value="/data/local/tmp/cts/content/SimpleServiceTestApp3.apk" /> <option name="push-file" key="broken_shortcut.xml" value="/data/local/tmp/cts/content/broken_shortcut.xml" /> </target_preparer> <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller"> Loading
services/tests/servicestests/data/broken_shortcut.xml 0 → 100644 +851 B File added.No diff preview for this file type. View file
services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java +12 −0 Original line number Diff line number Diff line Loading @@ -4007,6 +4007,18 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { // TODO Check all other fields } public void testLoadCorruptedShortcuts() throws Exception { initService(); addPackage("com.android.chrome", 0, 0); ShortcutUser user = new ShortcutUser(mService, 0); File corruptedShortcutPackage = new File("/data/local/tmp/cts/content/", "broken_shortcut.xml"); assertNull(ShortcutPackage.loadFromFile(mService, user, corruptedShortcutPackage, false)); } public void testSaveCorruptAndLoadUser() throws Exception { // First, create some shortcuts and save. runWithCaller(CALLING_PACKAGE_1, UserHandle.USER_SYSTEM, () -> { Loading