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

Commit 52f5df34 authored by JW Wang's avatar JW Wang Committed by Automerger Merge Worker
Browse files

Merge "Do proper cleanup" into sc-dev am: ae91b315

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13636798

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I0dff7194d5d8348483219cbfd0b40cf89096ea08
parents 3e21741e ae91b315
Loading
Loading
Loading
Loading
+0 −8
Original line number Original line Diff line number Diff line
@@ -35,7 +35,6 @@ import androidx.test.platform.app.InstrumentationRegistry;
import com.android.cts.install.lib.Install;
import com.android.cts.install.lib.Install;
import com.android.cts.install.lib.InstallUtils;
import com.android.cts.install.lib.InstallUtils;
import com.android.cts.install.lib.TestApp;
import com.android.cts.install.lib.TestApp;
import com.android.cts.install.lib.Uninstall;
import com.android.cts.rollback.lib.Rollback;
import com.android.cts.rollback.lib.Rollback;
import com.android.cts.rollback.lib.RollbackUtils;
import com.android.cts.rollback.lib.RollbackUtils;
import com.android.internal.R;
import com.android.internal.R;
@@ -89,7 +88,6 @@ public class StagedRollbackTest {
     */
     */
    @Test
    @Test
    public void testBadApkOnly_Phase1_Install() throws Exception {
    public void testBadApkOnly_Phase1_Install() throws Exception {
        Uninstall.packages(TestApp.A);
        assertThat(InstallUtils.getInstalledVersion(TestApp.A)).isEqualTo(-1);
        assertThat(InstallUtils.getInstalledVersion(TestApp.A)).isEqualTo(-1);


        Install.single(TestApp.A1).commit();
        Install.single(TestApp.A1).commit();
@@ -149,7 +147,6 @@ public class StagedRollbackTest {
     */
     */
    @Test
    @Test
    public void testNativeWatchdogTriggersRollback_Phase1_Install() throws Exception {
    public void testNativeWatchdogTriggersRollback_Phase1_Install() throws Exception {
        Uninstall.packages(TestApp.A);
        Install.single(TestApp.A1).commit();
        Install.single(TestApp.A1).commit();
        assertThat(InstallUtils.getInstalledVersion(TestApp.A)).isEqualTo(1);
        assertThat(InstallUtils.getInstalledVersion(TestApp.A)).isEqualTo(1);


@@ -183,7 +180,6 @@ public class StagedRollbackTest {
     */
     */
    @Test
    @Test
    public void testNativeWatchdogTriggersRollbackForAll_Phase1_InstallA() throws Exception {
    public void testNativeWatchdogTriggersRollbackForAll_Phase1_InstallA() throws Exception {
        Uninstall.packages(TestApp.A);
        Install.single(TestApp.A1).commit();
        Install.single(TestApp.A1).commit();
        assertThat(InstallUtils.getInstalledVersion(TestApp.A)).isEqualTo(1);
        assertThat(InstallUtils.getInstalledVersion(TestApp.A)).isEqualTo(1);


@@ -201,7 +197,6 @@ public class StagedRollbackTest {
                TestApp.A)).isNotNull();
                TestApp.A)).isNotNull();


        // Install another package with rollback
        // Install another package with rollback
        Uninstall.packages(TestApp.B);
        Install.single(TestApp.B1).commit();
        Install.single(TestApp.B1).commit();
        assertThat(InstallUtils.getInstalledVersion(TestApp.B)).isEqualTo(1);
        assertThat(InstallUtils.getInstalledVersion(TestApp.B)).isEqualTo(1);


@@ -238,7 +233,6 @@ public class StagedRollbackTest {


    @Test
    @Test
    public void testPreviouslyAbandonedRollbacks_Phase1_InstallAndAbandon() throws Exception {
    public void testPreviouslyAbandonedRollbacks_Phase1_InstallAndAbandon() throws Exception {
        Uninstall.packages(TestApp.A);
        Install.single(TestApp.A1).commit();
        Install.single(TestApp.A1).commit();
        assertThat(InstallUtils.getInstalledVersion(TestApp.A)).isEqualTo(1);
        assertThat(InstallUtils.getInstalledVersion(TestApp.A)).isEqualTo(1);


@@ -265,7 +259,6 @@ public class StagedRollbackTest {
    public void testPreviouslyAbandonedRollbacks_Phase3_VerifyRollback() throws Exception {
    public void testPreviouslyAbandonedRollbacks_Phase3_VerifyRollback() throws Exception {
        assertThat(InstallUtils.getInstalledVersion(TestApp.A)).isEqualTo(1);
        assertThat(InstallUtils.getInstalledVersion(TestApp.A)).isEqualTo(1);
        InstallUtils.processUserData(TestApp.A);
        InstallUtils.processUserData(TestApp.A);
        Uninstall.packages(TestApp.A);
    }
    }


    private static String getModuleMetadataPackageName() {
    private static String getModuleMetadataPackageName() {
@@ -301,7 +294,6 @@ public class StagedRollbackTest {


    @Test
    @Test
    public void testRollbackDataPolicy_Phase1_Install() throws Exception {
    public void testRollbackDataPolicy_Phase1_Install() throws Exception {
        Uninstall.packages(TestApp.A, TestApp.B, TestApp.C);
        Install.multi(TestApp.A1, TestApp.B1, TestApp.C1).commit();
        Install.multi(TestApp.A1, TestApp.B1, TestApp.C1).commit();
        // Write user data version = 1
        // Write user data version = 1
        InstallUtils.processUserData(TestApp.A);
        InstallUtils.processUserData(TestApp.A);
+6 −2
Original line number Original line Diff line number Diff line
@@ -99,10 +99,16 @@ public class StagedRollbackTest extends BaseHostJUnit4Test {
                "/data/apex/active/" + APK_IN_APEX_TESTAPEX_NAME + "*.apex");
                "/data/apex/active/" + APK_IN_APEX_TESTAPEX_NAME + "*.apex");
        runPhase("expireRollbacks");
        runPhase("expireRollbacks");
        mLogger.start(getDevice());
        mLogger.start(getDevice());
        getDevice().uninstallPackage("com.android.cts.install.lib.testapp.A");
        getDevice().uninstallPackage("com.android.cts.install.lib.testapp.B");
        getDevice().uninstallPackage("com.android.cts.install.lib.testapp.C");
    }
    }


    @After
    @After
    public void tearDown() throws Exception {
    public void tearDown() throws Exception {
        getDevice().uninstallPackage("com.android.cts.install.lib.testapp.A");
        getDevice().uninstallPackage("com.android.cts.install.lib.testapp.B");
        getDevice().uninstallPackage("com.android.cts.install.lib.testapp.C");
        mLogger.stop();
        mLogger.stop();
        runPhase("expireRollbacks");
        runPhase("expireRollbacks");
        deleteFiles("/system/apex/" + APK_IN_APEX_TESTAPEX_NAME + "*.apex",
        deleteFiles("/system/apex/" + APK_IN_APEX_TESTAPEX_NAME + "*.apex",
@@ -283,7 +289,6 @@ public class StagedRollbackTest extends BaseHostJUnit4Test {
     */
     */
    @Test
    @Test
    public void testRollbackApexWithApk() throws Exception {
    public void testRollbackApexWithApk() throws Exception {
        getDevice().uninstallPackage("com.android.cts.install.lib.testapp.A");
        pushTestApex();
        pushTestApex();
        runPhase("testRollbackApexWithApk_Phase1_Install");
        runPhase("testRollbackApexWithApk_Phase1_Install");
        getDevice().reboot();
        getDevice().reboot();
@@ -297,7 +302,6 @@ public class StagedRollbackTest extends BaseHostJUnit4Test {
     */
     */
    @Test
    @Test
    public void testRollbackApexWithApkCrashing() throws Exception {
    public void testRollbackApexWithApkCrashing() throws Exception {
        getDevice().uninstallPackage("com.android.cts.install.lib.testapp.A");
        pushTestApex();
        pushTestApex();


        // Install an apex with apk that crashes
        // Install an apex with apk that crashes