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

Commit 4c52d6b1 authored by Pinyao Ting's avatar Pinyao Ting Committed by Android (Google) Code Review
Browse files

Merge "Fixes an issue in shortcut persistence." into sc-dev

parents 8e60e725 4dedfc8b
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -2419,6 +2419,20 @@ class ShortcutPackage extends ShortcutPackageItem {
        }
    }

    void closeAppSearchSession() {
        synchronized (mLock) {
            if (mAppSearchSession != null) {
                final long callingIdentity = Binder.clearCallingIdentity();
                try {
                    mAppSearchSession.close();
                } finally {
                    Binder.restoreCallingIdentity(callingIdentity);
                }
            }
            mAppSearchSession = null;
        }
    }

    @NonNull
    private AndroidFuture<AppSearchSession> setupSchema(
            @NonNull final AppSearchSession session) {
+4 −1
Original line number Diff line number Diff line
@@ -1050,7 +1050,10 @@ public class ShortcutService extends IShortcutService.Stub {
            file.failWrite(os);
        }

        getUserShortcutsLocked(userId).logSharingShortcutStats(mMetricsLogger);
        final ShortcutUser user = getUserShortcutsLocked(userId);
        // Close AppSearchSession to flush pending changes.
        user.forAllPackages(ShortcutPackage::closeAppSearchSession);
        user.logSharingShortcutStats(mMetricsLogger);
    }

    @GuardedBy("mLock")