Loading services/core/java/com/android/server/power/stats/BatteryExternalStatsWorker.java +27 −15 Original line number Diff line number Diff line Loading @@ -342,6 +342,7 @@ public class BatteryExternalStatsWorker implements BatteryStatsImpl.ExternalStat @Override public Future<?> scheduleCleanupDueToRemovedUser(int userId) { synchronized (BatteryExternalStatsWorker.this) { try { // Initial quick clean-up after a user removal mExecutorService.schedule(() -> { synchronized (mStats) { Loading @@ -349,13 +350,16 @@ public class BatteryExternalStatsWorker implements BatteryStatsImpl.ExternalStat } }, UID_QUICK_REMOVAL_AFTER_USER_REMOVAL_DELAY_MILLIS, TimeUnit.MILLISECONDS); // Final clean-up after a user removal, to take care of UIDs that were running longer // than expected // Final clean-up after a user removal, to take care of UIDs that were running // longer than expected return mExecutorService.schedule(() -> { synchronized (mStats) { mStats.clearRemovedUserUidsLocked(userId); } }, UID_FINAL_REMOVAL_AFTER_USER_REMOVAL_DELAY_MILLIS, TimeUnit.MILLISECONDS); } catch (RejectedExecutionException e) { return CompletableFuture.failedFuture(e); } } } Loading Loading @@ -401,7 +405,11 @@ public class BatteryExternalStatsWorker implements BatteryStatsImpl.ExternalStat scheduleSyncLocked("write", UPDATE_ALL); // Since we use a single threaded executor, we can assume the next scheduled task's // Future finishes after the sync. try { return mExecutorService.submit(mWriteTask); } catch (RejectedExecutionException e) { return CompletableFuture.failedFuture(e); } } /** Loading Loading @@ -429,7 +437,11 @@ public class BatteryExternalStatsWorker implements BatteryStatsImpl.ExternalStat if (mCurrentFuture == null) { mUpdateFlags = flags; mCurrentReason = reason; try { mCurrentFuture = mExecutorService.submit(mSyncTask); } catch (RejectedExecutionException e) { return CompletableFuture.failedFuture(e); } } mUpdateFlags |= flags; return mCurrentFuture; Loading Loading
services/core/java/com/android/server/power/stats/BatteryExternalStatsWorker.java +27 −15 Original line number Diff line number Diff line Loading @@ -342,6 +342,7 @@ public class BatteryExternalStatsWorker implements BatteryStatsImpl.ExternalStat @Override public Future<?> scheduleCleanupDueToRemovedUser(int userId) { synchronized (BatteryExternalStatsWorker.this) { try { // Initial quick clean-up after a user removal mExecutorService.schedule(() -> { synchronized (mStats) { Loading @@ -349,13 +350,16 @@ public class BatteryExternalStatsWorker implements BatteryStatsImpl.ExternalStat } }, UID_QUICK_REMOVAL_AFTER_USER_REMOVAL_DELAY_MILLIS, TimeUnit.MILLISECONDS); // Final clean-up after a user removal, to take care of UIDs that were running longer // than expected // Final clean-up after a user removal, to take care of UIDs that were running // longer than expected return mExecutorService.schedule(() -> { synchronized (mStats) { mStats.clearRemovedUserUidsLocked(userId); } }, UID_FINAL_REMOVAL_AFTER_USER_REMOVAL_DELAY_MILLIS, TimeUnit.MILLISECONDS); } catch (RejectedExecutionException e) { return CompletableFuture.failedFuture(e); } } } Loading Loading @@ -401,7 +405,11 @@ public class BatteryExternalStatsWorker implements BatteryStatsImpl.ExternalStat scheduleSyncLocked("write", UPDATE_ALL); // Since we use a single threaded executor, we can assume the next scheduled task's // Future finishes after the sync. try { return mExecutorService.submit(mWriteTask); } catch (RejectedExecutionException e) { return CompletableFuture.failedFuture(e); } } /** Loading Loading @@ -429,7 +437,11 @@ public class BatteryExternalStatsWorker implements BatteryStatsImpl.ExternalStat if (mCurrentFuture == null) { mUpdateFlags = flags; mCurrentReason = reason; try { mCurrentFuture = mExecutorService.submit(mSyncTask); } catch (RejectedExecutionException e) { return CompletableFuture.failedFuture(e); } } mUpdateFlags |= flags; return mCurrentFuture; Loading