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

Commit 2c5f04bf authored by William Hester's avatar William Hester
Browse files

Check if Test Harness Mode is enabling on boot

There's currently a bug where the Test Harness Mode service will
*always* disable auto sync for accounts on boot. This CL adds a variable
that will tell its methods that have to be performed after boot is
completed whether or not they should set anything up.

Test: make && fastboot flashall -w, check if Auto Sync is enabled
Bug: 80137798
Change-Id: I73f853cbcccd259f278dcbf81f39a8c120f12972
parent 5818b8bd
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -66,6 +66,7 @@ public class TestHarnessModeService extends SystemService {
    private static final String TEST_HARNESS_MODE_PROPERTY = "persist.sys.test_harness";

    private PersistentDataBlockManagerInternal mPersistentDataBlockManagerInternal;
    private boolean mShouldSetUpTestHarnessMode;

    public TestHarnessModeService(Context context) {
        super(context);
@@ -96,6 +97,7 @@ public class TestHarnessModeService extends SystemService {
            // There's no data to apply, so leave it as-is.
            return;
        }
        mShouldSetUpTestHarnessMode = true;
        PersistentData persistentData = PersistentData.fromBytes(testHarnessModeData);

        SystemProperties.set(TEST_HARNESS_MODE_PROPERTY, persistentData.mEnabled ? "1" : "0");
@@ -124,6 +126,9 @@ public class TestHarnessModeService extends SystemService {
    }

    private void disableAutoSync() {
        if (!mShouldSetUpTestHarnessMode) {
            return;
        }
        UserInfo primaryUser = UserManager.get(getContext()).getPrimaryUser();
        ContentResolver
            .setMasterSyncAutomaticallyAsUser(false, primaryUser.getUserHandle().getIdentifier());