Make the data management label a CharSequence for the system APIs:
- BackupManager#updateTransportAttributes
- BackupManager#getDataManagementLabel
- BackupTransport#dataManagementLabel
Renames dataManagementLabel -> dataManagementIntentLabel to change
return type
Removes getDataManagementLabel AIDL method as usages converted to use
"forUser" version in topic CL.
Bug: 113856654
Test: 1) atest RunBackupFrameworksServicesRoboTests
2) atest BackupManagerTransportAttributesHostSideTest
3) atest $(find \
frameworks/base/services/tests/servicestests/src/com/android/server/backup \
-name '*Test.java')
4) Manual: boot and verify transports registered properly using old API;
Modify LocalTransport to use new API, verify success
Change-Id: Ia48017156debe0a29684909f58927fa1fbf972f9
When a full backup operation times out, resources are cleaned up
including closing and nullifying pipes. However FullRestoreEngine.restoreOneFile()
doesn't stop execution and can access the pipes causing RuntimeException.
This CL adds a flag to show whether the operation has timed out and
checks it before accessing the pipes.
Bug: 126244736
Test: 1) atest RunBackupFrameworksServicesRoboTests
2) atest CtsBackupTestCases
3) atest CtsBackupHostTestCases
4) atest GtsBackupTestCases
5) atest GtsBackupHostTestCases
6) Manual: Test full backup/restore flow using Flipboard app
Change-Id: If400142a6fceaa4065409774bbff1cad8b4c6163
Test: atest ProfileSerialNumberHostSideTest
Currently BackupManager#getUserForSerialNumber goes through users
associated with the calling user (inluding the calling user itself) and
looks for the given serial number. However, to get the list of users it calls
UserManager#getUserProfiles that operates for the users associated with
the calling process (in our case - system user since the call is made
from BMS). While this works for our current use case (only support
backup for system user and their work profile, meaning
BackupManager#getUserForSerialNumber will only be called for system
user), it won't work for a full multi-user case.
Change-Id: Ia42a69a1216ed9a5dae596e44336290d2718de7a
Use the new manifest flag introduced in ag/5762489 to gate clearing data
during restore.
Bug: 120267643
Test: 1) atest RunBackupFrameworksServicesRoboTests
2) atest CtsBackupTestCases
3) atest CtsBackupHostTestCases
4) atest GtsBackupTestCases
5) atest GtsBackupHostTestCases
Change-Id: Ida4a9e96f44d1c740d217faed2b9f928e02865ec
Bug: 123347794
In Q, backup is OFF by default for non-system users. In R, we will change that to ON
unless backup was explicitly deactivated with a (permissioned) call to
setBackupServiceActive.
Therefore, remember this for use in R. Basically the default in R will be
rememberFile.exists() ? rememberFile.value() : ON
Note that this has to be done right after the permission checks and before any other
action since we need to remember that a permissioned call was made irrespective of
whether the call changes the state or not.
Test: 1. atest $(find frameworks/base/services/tests/servicestests/src/com/android/server/backup -name '\''*Test.java'\'')'
2. atest RunBackupFrameworksServicesRoboTests
3. atest CtsBackupTestCases CtsBackupHostTestCases GtsBackupTestCases GtsBackupHostTestCases
Change-Id: I0897d6f9f8d8d8a9fc3c0faabfc9045b416dd25f
A few additional changes (apart from style and usual dependencies) were
needed:
- Additional dependencies (not part of Backup & Restore code) were
ported over:
- ByteRange
- DiffScriptWriter
- OutputStreamWrapper
- SingleStreamDiffScriptWriter
- DiffScripBackupWriter.ENCRYPTION_DIFF_SCRIPT_MAX_CHUNK_SIZE_BYTES is
now a constant rather than a flag.
- Additional tests were added for SingleStreamDiffScriptWriter.
Bug: 111386661
Test: atest RunBackupFrameworksServicesRoboTests
Change-Id: Ia3234bb8d665211e6fa91d6a92d190171b0d2dc1
The launcher needs to know the serial id of the ancenstral device's work
profile and the serial id of the current device's work profile in order
to properly perform a restore.
Test: atest BackupManagerService
Bug: 111301511
Change-Id: Ia929dcc2cb599f935183be1820b1c45f2d6e1de7
Move to a whitelist of system apps that are eligible for backup in
non-system users.
Bug: 123349308
Test: "adb shell bmgr backupnow android" succeeds for system
and non-system users.
Change-Id: I7bc4982a6e105c2343636532dd2010aa43132d23
As part of bmgr activate, if the user is unlocked then we attempt to
start the backup service for them. However, as part of initialization,
AMS enforces the system uid so clear calling identity before starting
the service (as we have the shell uid).
Bug: 123572171
Test: 1) atest RunBackupFrameworksServicesRoboTests
2) atest TrampolineTest
3) Manual: Unlock secondary user -> bmgr activate -> no exception thrown
and service started
Change-Id: I441491e19d9f3c9b49b5778d51ae5331230b129b
The previous check compared app uid directly to FIRST_APPLICATION_UID
which doesn't work for non-system users as uid incorporates the user id
(so system apps in non-system users would always be categorized as
non-system apps).
Bug: 122309666
Test: 1) atest RunBackupFrameworksServicesRoboTests
2) Manual: verify system packages backed up for system user, not backed
up for non-system user.
Change-Id: I5e11b4b7c41d74d43d545e4831d09a9a3a59e5cf
All other schedule call sites for full backup and key value schedule
inline. The operation should be quick and scheduling on a separate
handler makes testing flaky.
Test: 1) atest RunBackupFrameworksServicesRoboTests
2) atest ScheduledBackupHostSideTest
3) atest ProfileScheduledJobHostSideTest
Change-Id: Id6ae557080da5a98c2ac572ca6b4b7973b7a9c29
Key changes in this CL:
- Backup is now disabled by default in non-system users unless DPM
activates backup for this user AND the system user is activated. This
provides gating for the multi-user B&R feature.
- Activation is done via an 'activate' file that is per-user (but lives
in the system user directory to account for locked users).
- isBackupServiceActive() handles both locked and unlocked users.
- Added a bmgr command to expose isBackupServiceActive() for testing
purposes and enforce appropriate permissions.
Future CLs:
- Handle future migration to backup on by default for non-system users
- Change CTS tests to use the new bmgr command
Bug: 121306407
Test: 1) atest TrampolineTest
2) Start system user -> service started; run backup and restore
successfully
3) Start non-system user -> ignored;
4) adb shell bmgr --user 0 activate true -> security exception;
adb shell bmgr --user 10 activate true -> security exception (work
profile);
adb shell bmgr --user 11 activate true/false -> creates/deletes activate
file and starts/stops the service
Change-Id: Ic77db9b8b2e5170dcf89bef863dac4713730797a
Bug: 121198030
Test: 1) atest RunBackupFrameworksServicesRoboTests
2) atest $(find \
frameworks/base/services/tests/servicestests/src/com/android/server/backup \
-name '*Test.java')
3) atest CtsBackupTestCases
4) atest CtsBackupHostTestCases
5) atest GtsBackupTestCases
6) atest GtsBackupHostTestCases
Manual testing:
1. Start secondary user -> verify fb-schedule file is created, full backup queue initialised
2. Verify fullbackup of 1 package for system/secondary users, [package] only exists for current user:
* bmgr --user [user-id] fullbackup [package]
* Verify in logs that backup is successful
* Uninstall/install [package]
* Verify data is restored
3. Verify fullbackup of 1 package for secondary user, [package] eixtst for user 0:
* bmgr fullbackup [package]
* bmgr --user [user-id] fullbackup [package]
* Verify in logs that backup is successful
* Uninstall/install [package] for secondary user
* bmgr --user [user-id] restore [token] [package]
* Verify the data restored is different from system user data and belongs to [user-id]
3. Verify backup of all packages for system/secondary users:
* bmgr --user [user-id] backupnow --all
* Verify system packages (android, settings, wallpaper) are skipped for secondary user
* Verify in logs that backup is successful
* Uninstall/install [package]
* Verify data is restored
Base -> Patchset 2: Update method calls to use asUser versions
Patchset 2 -> Patchset 3: Update opComplete callback to accept userId
Patchset 3 -> Patchset 4: Gate system packages from backup/restore for non-system users
Change-Id: Ic3986709ba4d46c0af9da45bb4dd682ee2aef3ce
We create a differnte suppressBackup file for each user, and gate
operations on that.
Backup still can't be toggled for other users that is not SYSTEM.
Test: atest TrampolineTest
Test: Verify backup works and restore works, just for user 0 for now.
BUG: 121198006
Change-Id: Ib4ecf48d248319e9d890515937fc087ef8f46039
Per-user CE directories are managed by vold so we don't need to
initialize or apply restorecon on them in our service.
Once the system user is migrated to the its CE directory, we can remove
the remaining restorecon and mkdirs logic.
Accompanies aosp/875352 and aosp/873133
Bug: 121197420
Test: 1) Boot device; check directories exist and labelled properly
for system user; perform backup successfully
2) Add secondary user; check directories exist and labelled properly;
perform backup succesfully
Change-Id: If848da4c9254db87b393fce6cfc4169785bfac51
1. The book-keeping needs to be per user.
2. The calls into IBackupManager need to pass in the userId.
3. convert clearPendingBackup to an internal service call.
Bug: 121197004
Test: 1) atest RunBackupFrameworksServicesRoboTests
2) atest $(find \
frameworks/base/services/tests/servicestests/src/com/android/server/backup \
-name '*Test.java')
3) atest CtsBackupTestCases
4) atest CtsBackupHostTestCases
5) 'adb shell bmgr' enabled/backupnow flow
Change-Id: If49e00fc1d6aa770815c454f01b53865f6a68db4
Patchset 1: Introduce BackupJobIdManager to allocate/recycle IDs for KeyValueBackupJob and
FullBackupJob
Patchset 2: Update KeyValueBackupJob and FullBackupJob to work for multiple users — take in
userId as a parameter and use BackupJobIdManager to assign job IDs
Patchset 3: Update robo tests
The corresponding GTS ScheduledBackupHostSideTest will be updated in a separate CL with the same
topic.
Bug: 121198009
Test: 1) atest KeyValueBackupJobTest
2) atest KeyValueBackupTaskTest
Change-Id: Ifdba254b7084b3d0a1507cc6512e98399c1aad8f
Certain services were removed from being final fields in ag/5932642.
This change essentially reverts the deletions of those final fields.
Bug: 122591875
Test: atest cts.tests.app.src.android.app.cts.ActivityManagerTest#testIsAppForegroundRemoved
Change-Id: I403d214b31c964ee5587c35260138e0af12fd11e
Makes the BroadcastReceiver that receives changes to installed packages
and sdcards tied to a specific user.
Bug: 121198607
Test: 1) atest RunBackupFrameworksServicesRoboTests
2) Manual testing with user 0 and 11:
- User started -> receiver registered for correct user;
- Package changed -> correct receiver;
- Package added -> correct receiver, updates bookkeeping for correct user;
- Package removed -> correct receiver, updates bookkeeping for correct user;
Change-Id: I68c034da6ec775a4d0489a2d09fc32854dcf11dc
Removed isAppForeground from the ActivityManager aidl and added it to
ActivityManagerInternal. Updated all of its references as well.
Bug: 119327603
Test: atest cts.tests.app.src.android.app.cts.ActivityManagerTest#testIsAppForegroundRemoved
Test: atest WifiServiceImplTest
Test: atest WifiLockManagerTest
Change-Id: I5c0fbe41df3cd00e02f8c0e1005fc9cf5832df77
Remove indirection in setting backup enabled state to call directly into
the UserBMS instance.
Bug: 121305979
Test: 1) atest RunBackupFrameworksServicesRoboTests
2) During SUW -> backup initializes off;
Turn backup on in SUW -> backup enabled;
Subsequent boots -> backup initializes on
Change-Id: Ief688c4e1c14b443db87eda43ec0ee398282662f
1. For system user, functionality remains almost (see 2) exactly the
same.
2. Change the full backup dir which is used only to write temporary
manifest and meta dirs by the system process when doing full backup.
This is so that we dont have to worry unnecessarily about yet another dir.
Bug: 120424138
Test: 1) atest RunBackupFrameworksServicesRoboTests
2) atest $(find \
frameworks/base/services/tests/servicestests/src/com/android/server/backup \
-name '*Test.java')
3) atest CtsBackupTestCases
4) atest CtsBackupHostTestCases
5) atest GtsBackupTestCases
6) atest GtsBackupHostTestCases
7) 'adb shell bmgr' enabled/backupnow flow
Change-Id: I9a33547c9595a86b62869ee731d4c75a029922e8
Use the "forUser" variation of getting/putting settings for the
following backup settings:
- backup_auto_restore
- backup_transport
- packages_to_clear_data_before_full_restore
Bug: 121305979
Test: 1) atest RunBackupFrameworksServicesRoboTests
2) Verify default auto restore is true;
Toggle auto restore in UI -> changes UserBMS state;
Change current transport via bmgr -> changes UserBMS state;
Check settings for user 0 different from user 10;
3) Run backup pass, restore pass
Change-Id: I69e2a4f9c870dd7b5661dfa17f891384825926f5
Migrate from the global setting DEVICE_PROVISIONED to the per-user
setting USER_SETUP_COMPLETE. The logic for how the service handles
provisioned state is the same, only the setting we use to determine the
state is changed, as well as a rename to reflect this ("provisioned" ->
"setup complete").
ProvisionedObserver is now SetupObserver (move didn't persist b/c of
amount of changes to the file)
The BackupManagerMonitor log event id referencing provisioned will be
changed in a future CL as it requires an API change.
Bug: 121305979
Test: 1) atest RunBackupFrameworksServicesRoboTests
2) Reset device, go through SUW -> not setupComplete;
Finish SUW -> setupComplete (verify logging + dumpsys) and jobs
scheduled;
Perform backup (not blocked by setupComplete);
Add new user -> setupComplete only after finishing SUW
Change-Id: Iddf9ce7853a13b2d51135047de1b270af7034c06
The original backup thread is now only used by Trampoline and BMS for
general non-user specific operations. Each UserBMS instance has its own
'backup-[user id]' thread to allow for parallelism between users. When a
user is stopped, we quit this thread.
Bug: 121305979
Test: 1) atest RunBackupFrameworksServicesRoboTests
2) Start system user -> verify backup-0 thread created;
Start secondary user -> verify backup-10 thread created;
Stop secondary user -> verify backup-10 thread stopped;
Verify work posted to the thread is executed (register transports, bmgr
backupnow, etc.)
Change-Id: Iaa37fb3e2eb442653e27565ca13a88a0582efa9d