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

Commit d1c18006 authored by JW Wang's avatar JW Wang
Browse files

Remove unused code (5/n)

Bug: 149069841
Test: atest RollbackTest StagedRollbackTest
Change-Id: Ib9f3db7863d10d46ee639b6dc4d0b9441755502f
parent 7e5eaadc
Loading
Loading
Loading
Loading
+0 −21
Original line number Diff line number Diff line
@@ -181,15 +181,6 @@ class Rollback {
    @GuardedBy("mLock")
    private int mNumPackageSessionsWithSuccess;

    /**
     * A temp flag to facilitate merging of the 2 rollback collections managed by
     * RollbackManagerServiceImpl. True if this rollback is in the process of enabling and was
     * originally managed by RollbackManagerServiceImpl#mNewRollbacks.
     * TODO: remove this flag when merge is completed.
     */
    @GuardedBy("mLock")
    private boolean mIsNewRollback = false;

    /**
     * Constructs a new, empty Rollback instance.
     *
@@ -838,18 +829,6 @@ class Rollback {
        }
    }

    void setIsNewRollback(boolean newRollback) {
        synchronized (mLock) {
            mIsNewRollback = newRollback;
        }
    }

    boolean isNewRollback() {
        synchronized (mLock) {
            return mIsNewRollback;
        }
    }

    static String rollbackStateToString(@RollbackState int state) {
        switch (state) {
            case Rollback.ROLLBACK_STATE_ENABLING: return "enabling";
+0 −20
Original line number Diff line number Diff line
@@ -795,7 +795,6 @@ class RollbackManagerServiceImpl extends IRollbackManager.Stub {
            if (newRollback == null) {
                newRollback = createNewRollbackLocked(parentSession);
                mRollbacks.add(newRollback);
                newRollback.setIsNewRollback(true);
            }
        }
        newRollback.addToken(token);
@@ -1159,7 +1158,6 @@ class RollbackManagerServiceImpl extends IRollbackManager.Stub {
                    // TODO: refactor #completeEnableRollback so we won't remove 'rollback' from
                    // mRollbacks here and add it back in #completeEnableRollback later.
                    mRollbacks.remove(rollback);
                    rollback.setIsNewRollback(false);
                }
                // TODO: Now #completeEnableRollback returns the same rollback object as the
                // parameter on success. It would be more readable to return a boolean to indicate
@@ -1354,22 +1352,4 @@ class RollbackManagerServiceImpl extends IRollbackManager.Stub {
        }
        return null;
    }

    /**
     * Returns the NewRollback associated with the given package session.
     * Returns null if no NewRollback is found for the given package
     * session.
     */
    @WorkerThread
    @GuardedBy("mLock")
    Rollback getNewRollbackForPackageSessionLocked(int packageSessionId) {
        // We expect mRollbacks to be a very small list; linear search
        // should be plenty fast.
        for (Rollback rollback: mRollbacks) {
            if (rollback.isNewRollback() && rollback.containsSessionId(packageSessionId)) {
                return rollback;
            }
        }
        return null;
    }
}