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

Commit d222a617 authored by Al Sutton's avatar Al Sutton
Browse files

Infer the activation state from the presence of a BackupManagerService.

The filesystem is checked when the BMS is created for a user so we
don't need to recheck it every time we perform a backup related
operation because wihout the BMS we shouldn't say the system is
read for the user to back up their data.

Change-Id: Iaaa7d7381182ba7e05173cc4f5d25ce61054e210
Test: atest CtsBackupTestCases CtsBackupHostTestCases TrampolineTest BackupManagerServiceTest
Fixes: 133584471
parent 40a41861
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -194,6 +194,11 @@ public class BackupManagerService {
        }
    }

    boolean isAbleToServeUser(int userId) {
        return getServiceUsers().get(UserHandle.USER_SYSTEM) != null
                && getServiceUsers().get(userId) != null;
    }

    /**
     *  Returns a lst of users currently unlocked that have a
     *  {@link UserBackupManagerService} registered.
+3 −4
Original line number Diff line number Diff line
@@ -202,11 +202,10 @@ public class Trampoline extends IBackupManager.Stub {
        }
    }

    // A user is ready for a backup if it's unlocked and is not suppressed by a device
    // admin (device owner or profile owner).
    // This method should not perform any I/O (e.g. do not call isBackupActivatedForUser),
    // it's used in multiple places where I/O waits would cause system lock-ups.
    private boolean isUserReadyForBackup(int userId) {
        return mService != null && mService.getServiceUsers().get(userId) != null
                && isBackupActivatedForUser(userId);
        return mService != null && mService.isAbleToServeUser(userId);
    }

    /**