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

Commit 26633b81 authored by Pinyao Ting's avatar Pinyao Ting
Browse files

Minimize amount of time blocking inbound shortcut binder call during I/O

Since shortcuts for each individual packages are persisted in separate
files, we can postpone the I/O of these files to avoid holding the
synchronization lock for the entire duration of persisting these files.

Bug: 287558960
Test: atest CtsShortcutTestCases
Change-Id: I2e940d28a4dfcc74ff2b64a9e6b75b9e7766acf4
parent a0752490
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -363,14 +363,14 @@ class ShortcutUser {

    private void saveShortcutPackageItem(TypedXmlSerializer out, ShortcutPackageItem spi,
            boolean forBackup) throws IOException, XmlPullParserException {
        spi.waitForBitmapSaves();
        if (forBackup) {
            if (spi.getPackageUserId() != spi.getOwnerUserId()) {
                return; // Don't save cross-user information.
            }
            spi.waitForBitmapSaves();
            spi.saveToXml(out, forBackup);
        } else {
            spi.saveShortcutPackageItem();
            spi.scheduleSave();
        }
    }