Merge "Fixes an issue in shortcut persistence." into sc-dev
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user