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

Commit a823af7c authored by Kuan Wang's avatar Kuan Wang
Browse files

Fix failed test CommandContentProviderTest.

Tests failed when running atest
SettingsGoogleRoboTests:com.google.android.settings.fuelgauge because
instance of PowerAllowlistBackend has been initialized by other unit
tests.
Reset it before the unit tests to avoid the issue.

Flag: TEST_ONLY
Test: atest SettingsGoogleRoboTests:com.google.android.settings.fuelgauge
Bug: 349693853
Change-Id: Ia9dd4739665fa1ac0d48ba36a9417d249157cde6
parent 7c3c1a32
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -327,4 +327,12 @@ public class PowerAllowlistBackend {
            return sInstance;
        }
    }

    /** Testing only. Reset the instance to avoid tests affecting each other. */
    @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
    public static void resetInstance() {
        synchronized (PowerAllowlistBackend.class) {
            sInstance = null;
        }
    }
}