Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d470717b authored by Alex Buynytskyy's avatar Alex Buynytskyy Committed by Android (Google) Code Review
Browse files

Merge "Stop processing on IOException." into udc-dev

parents 1bcc280a 5112cfef
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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);
+1 −0
Original line number Diff line number Diff line
@@ -115,6 +115,7 @@ android_test {
        ":StubTestApp",
        ":SuspendTestApp",
        ":MediaButtonReceiverHolderTestHelperApp",
        "data/broken_shortcut.xml",
    ],

    java_resources: [
+2 −0
Original line number Diff line number Diff line
@@ -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">
+851 B

File added.

No diff preview for this file type.

+12 −0
Original line number Diff line number Diff line
@@ -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, () -> {