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

Commit 49f2c671 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix StorageController bugs."

parents 15fb571f b0488cc8
Loading
Loading
Loading
Loading
+8 −11
Original line number Diff line number Diff line
@@ -81,21 +81,17 @@ public final class StorageController extends StateController {
        synchronized (mLock) {
            for (int i = mTrackedTasks.size() - 1; i >= 0; i--) {
                final JobStatus ts = mTrackedTasks.valueAt(i);
                boolean previous = ts.setStorageNotLowConstraintSatisfied(storageNotLow);
                if (previous != storageNotLow) {
                    reportChange = true;
                }
                reportChange |= ts.setStorageNotLowConstraintSatisfied(storageNotLow);
            }
        }
        if (storageNotLow) {
            // Tell the scheduler that any ready jobs should be flushed.
            mStateChangedListener.onRunJobNow(null);
        } else if (reportChange) {
            // Let the scheduler know that state has changed. This may or may not result in an
            // execution.
        if (reportChange) {
            mStateChangedListener.onControllerStateChanged();
        }
        // Also tell the scheduler that any ready jobs should be flushed.
        if (storageNotLow) {
            mStateChangedListener.onRunJobNow(null);
        }
    }

    public final class StorageTracker extends BroadcastReceiver {
@@ -143,9 +139,10 @@ public final class StorageController extends StateController {
                            + sElapsedRealtimeClock.millis());
                }
                mStorageLow = true;
                maybeReportNewStorageState();
            } else if (Intent.ACTION_DEVICE_STORAGE_OK.equals(action)) {
                if (DEBUG) {
                    Slog.d(TAG, "Available stoage high enough to do work. @ "
                    Slog.d(TAG, "Available storage high enough to do work. @ "
                            + sElapsedRealtimeClock.millis());
                }
                mStorageLow = false;