Loading services/people/java/com/android/server/people/data/AbstractProtoDiskReadWriter.java +13 −12 Original line number Diff line number Diff line Loading @@ -185,23 +185,24 @@ abstract class AbstractProtoDiskReadWriter<T> { * is useful for when device is powering off. */ @MainThread synchronized void saveImmediately(@NonNull String fileName, @NonNull T data) { void saveImmediately(@NonNull String fileName, @NonNull T data) { synchronized (this) { mScheduledFileDataMap.put(fileName, data); } triggerScheduledFlushEarly(); } @MainThread private synchronized void triggerScheduledFlushEarly() { private void triggerScheduledFlushEarly() { synchronized (this) { if (mScheduledFileDataMap.isEmpty() || mScheduledExecutorService.isShutdown()) { return; } // Cancel existing future. if (mScheduledFuture != null) { // We shouldn't need to interrupt as this method and threaded task // #flushScheduledData are both synchronized. mScheduledFuture.cancel(true); } } // Submit flush and blocks until it completes. Blocking will prevent the device from // shutting down before flushing completes. Loading Loading
services/people/java/com/android/server/people/data/AbstractProtoDiskReadWriter.java +13 −12 Original line number Diff line number Diff line Loading @@ -185,23 +185,24 @@ abstract class AbstractProtoDiskReadWriter<T> { * is useful for when device is powering off. */ @MainThread synchronized void saveImmediately(@NonNull String fileName, @NonNull T data) { void saveImmediately(@NonNull String fileName, @NonNull T data) { synchronized (this) { mScheduledFileDataMap.put(fileName, data); } triggerScheduledFlushEarly(); } @MainThread private synchronized void triggerScheduledFlushEarly() { private void triggerScheduledFlushEarly() { synchronized (this) { if (mScheduledFileDataMap.isEmpty() || mScheduledExecutorService.isShutdown()) { return; } // Cancel existing future. if (mScheduledFuture != null) { // We shouldn't need to interrupt as this method and threaded task // #flushScheduledData are both synchronized. mScheduledFuture.cancel(true); } } // Submit flush and blocks until it completes. Blocking will prevent the device from // shutting down before flushing completes. Loading