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

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

Remove dead code (3/n)

Bug: 183466803
Test: m
Change-Id: I5e7bae2819e1a7a56880427feb0ec7115a0ccf00
parent 888e9203
Loading
Loading
Loading
Loading
+0 −18
Original line number Diff line number Diff line
@@ -180,13 +180,6 @@ class Rollback {
     */
    private final int[] mPackageSessionIds;

    /**
     * The number of sessions in the install which are notified with success by
     * {@link PackageInstaller.SessionCallback#onFinished(int, boolean)}.
     * This rollback will be enabled only after all child sessions finished with success.
     */
    private int mNumPackageSessionsWithSuccess;

    /**
     * The extension versions supported at the time of rollback creation.
     */
@@ -831,17 +824,6 @@ class Rollback {
        return false;
    }

    /**
     * Called when a child session finished with success.
     * Returns true when all child sessions are notified with success. This rollback will be
     * enabled only after all child sessions finished with success.
     */
    @WorkerThread
    boolean notifySessionWithSuccess() {
        assertInWorkerThread();
        return ++mNumPackageSessionsWithSuccess == mPackageSessionIds.length;
    }

    /**
     * Returns true if all packages in this rollback are enabled. We won't enable this rollback
     * until all packages are enabled. Note we don't count apk-in-apex here since they are enabled
+0 −11
Original line number Diff line number Diff line
@@ -337,17 +337,6 @@ public class RollbackUnitTest {
        verify(mMockDataHelper).restoreAppData(123, pkgInfo1, 7, 333, "blah");
    }

    @Test
    public void notifySessionWithSuccess() {
        int[] sessionIds = new int[]{ 7777, 8888 };
        Rollback rollback = new Rollback(123, new File("/test/testing"), -1, false, USER, INSTALLER,
                sessionIds, new SparseIntArray(0));
        // The 1st invocation returns false because not all child sessions are notified.
        assertThat(rollback.notifySessionWithSuccess()).isFalse();
        // The 2nd invocation returns true because now all child sessions are notified.
        assertThat(rollback.notifySessionWithSuccess()).isTrue();
    }

    @Test
    public void allPackagesEnabled() {
        int[] sessionIds = new int[]{ 7777, 8888 };