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

Commit 91e98fcb authored by Wonyoung Kwak's avatar Wonyoung Kwak Committed by Android (Google) Code Review
Browse files

Revert "Modifying Backup code to support HSUM mode."

Revert submission 22327091-br-cts-hsum

Reason for revert: DroidMonitor-triggered revert due to breakage https://android-build.googleplex.com/builds/quarterdeck?branch=git_udc-dev&target=aosp_bramble-userdebug&lkgb=10098913&lkbb=10101009&fkbb=10098962, bug 281753581.

Bug: 281753581

Reverted changes: /q/submissionid:22327091-br-cts-hsum

Change-Id: I4de169440f587d5a458300a5f360ba974239e530
parent 6cf0c303
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -253,7 +253,7 @@ public class Bmgr {

        try {
            boolean enable = Boolean.parseBoolean(arg);
            mBmgr.setAutoRestoreForUser(userId, enable);
            mBmgr.setAutoRestore(enable);
            System.out.println(
                    "Auto restore is now "
                            + (enable ? "enabled" : "disabled")
+0 −3
Original line number Diff line number Diff line
@@ -56,7 +56,6 @@ public final class Backup {
    }

    public void run(String[] args) {
        Log.d(TAG, "Called run() with args: " + String.join(" ", args));
        if (mBackupManager == null) {
            Log.e(TAG, "Can't obtain Backup Manager binder");
            return;
@@ -71,8 +70,6 @@ public final class Backup {
            return;
        }

        Log.d(TAG, "UserId : " + userId);

        String arg = nextArg();
        if (arg.equals("backup")) {
            doBackup(OsConstants.STDOUT_FILENO, userId);
+1 −1
Original line number Diff line number Diff line
@@ -813,7 +813,7 @@ public class BackupManagerService extends IBackupManager.Stub {
        }
        UserBackupManagerService userBackupManagerService =
                getServiceForUserIfCallerHasPermission(
                        userId, "hasBackupPassword()");
                        UserHandle.USER_SYSTEM, "hasBackupPassword()");

        return userBackupManagerService != null && userBackupManagerService.hasBackupPassword();
    }
+11 −1
Original line number Diff line number Diff line
@@ -2797,6 +2797,11 @@ public class UserBackupManagerService {
            boolean includeSystem, boolean compress, boolean doKeyValue, String[] pkgList) {
        mContext.enforceCallingPermission(android.Manifest.permission.BACKUP, "adbBackup");

        final int callingUserHandle = UserHandle.getCallingUserId();
        if (callingUserHandle != UserHandle.USER_SYSTEM) {
            throw new IllegalStateException("Backup supported only for the device owner");
        }

        // Validate
        if (!doAllApps) {
            if (!includeShared) {
@@ -2967,6 +2972,11 @@ public class UserBackupManagerService {
    public void adbRestore(ParcelFileDescriptor fd) {
        mContext.enforceCallingPermission(android.Manifest.permission.BACKUP, "adbRestore");

        final int callingUserHandle = UserHandle.getCallingUserId();
        if (callingUserHandle != UserHandle.USER_SYSTEM) {
            throw new IllegalStateException("Restore supported only for the device owner");
        }

        final long oldId = Binder.clearCallingIdentity();

        try {
@@ -3075,7 +3085,7 @@ public class UserBackupManagerService {
                    "com.android.backupconfirm.BackupRestoreConfirmation");
            confIntent.putExtra(FullBackup.CONF_TOKEN_INTENT_EXTRA, token);
            confIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
            mContext.startActivityAsUser(confIntent, UserHandle.of(mUserId));
            mContext.startActivityAsUser(confIntent, UserHandle.SYSTEM);
        } catch (ActivityNotFoundException e) {
            return false;
        }
+2 −7
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.robolectric.Shadows.shadowOf;
import static org.testng.Assert.expectThrows;

@@ -119,10 +118,6 @@ public class BackupManagerServiceRoboTest {
        mShadowUserManager.addUser(mUserOneId, "mUserOneId", 0);
        mShadowUserManager.addUser(mUserTwoId, "mUserTwoId", 0);

        when(mUserSystemService.getUserId()).thenReturn(UserHandle.USER_SYSTEM);
        when(mUserOneService.getUserId()).thenReturn(mUserOneId);
        when(mUserTwoService.getUserId()).thenReturn(mUserTwoId);

        mShadowContext.grantPermissions(BACKUP);
        mShadowContext.grantPermissions(INTERACT_ACROSS_USERS_FULL);

@@ -1474,9 +1469,9 @@ public class BackupManagerServiceRoboTest {
        File testFile = createTestFile();
        FileDescriptor fileDescriptor = new FileDescriptor();
        PrintWriter printWriter = new PrintWriter(testFile);
        String[] args = {"1", "2"};
        ShadowBinder.setCallingUserHandle(UserHandle.of(UserHandle.USER_SYSTEM));

        String[] args = {"--user", "0"};
        backupManagerService.dump(fileDescriptor, printWriter, args);

        verify(mUserSystemService).dump(fileDescriptor, printWriter, args);
@@ -1490,8 +1485,8 @@ public class BackupManagerServiceRoboTest {
        File testFile = createTestFile();
        FileDescriptor fileDescriptor = new FileDescriptor();
        PrintWriter printWriter = new PrintWriter(testFile);
        String[] args = {"1", "2"};

        String[] args = {"--user", "10"};
        backupManagerService.dump(fileDescriptor, printWriter, args);

        verify(mUserOneService, never()).dump(fileDescriptor, printWriter, args);
Loading