Currently backup dumpsys in bugreport only contains information
for system user making it hard to debug backup bugs in non-system
users. Therefore, add dumpsys information for all users running backup.
For system user, keep the dumpsys format the same for compatibility with
cts and gts tests. For non-system users, add a prefix "User <userid>:"
to all dumpsys headers.
The changes in Android.bp and AndroidManifest.xml are to support mocking
of the static method DumpUtils.checkDumpAndUsageStatsPermission in the
test testDump_systemUserFirst
Bug: 143867387
Test: atest com.android.server.backup.BackupManagerServiceTest
Test: atest com.android.server.backup.UserBackupManagerServiceTest
Test: adb shell pm create-user test1 -> say this gives 11
adb shell am start-user 11
adb shell bmgr --user 11 activate true
adb shell dumpsys backup users -> "Backup Manager is running for users: 0 11"
adb shell dumpsys backup -> contains both
"Backup Manager is enabled / setup complete / not pending init" and
"User 11:Backup Manager is disabled / not setup complete / not pending init"
adb shell pm remove-user 11
Test: "adb bugreport" on device with secondary user as created above and check that result
contains dumpsys for both system and secondary users.
Test: atest -v CtsBackupTestCases
Test: atest -v CtsBackupHostTestCases
Change-Id: Ib94c168f8e89b0ba8f398152ea744fe3d626efc4
Bug: 141716920
Test: m -j ROBOTEST_FILTER=LocationRequestStatisticsTest RunFrameworksServicesRoboTests
Test: On device verified history
Change-Id: Ia862e64415ef6132422ea3b2f1a22197e9b44c44
Add the method as a hidden API for now. Move to System API later.
Bug: 145126096
Test: 1. Call BM#excludeKeyFromRestore for a test package
2. Reboot the device
3. Run restore for the test package
4. Verify excluded keys are not restored
Change-Id: Ice57299eaf54cee8428b86e2d4f78de12b8db4fc
Users of these APIs are planning to move to apex.
Test: atest FrameworksCoreTests:android.os.WorkSourceTest
atest CtsOsTestCases:android.os.cts.WorkSourceTest
Bug: 143551137
Change-Id: I2e97a8b469254ea92e3ee21571ee8ae3cbb9abbe
Perform the merge by:
1. Moving lifecycle inside Trampoline without IDE support
(since we'll rename Trampoline in this CL as well, making the published binder
the same).
2. Move constants to Trampoline without IDE support as well (again, we'll
rename Trampoline).
3. Change the last usages of BMS constructor to use
Trampoline's. Now BMS is effectively empty.
4. Delete BMS.
5. Rename Trampoline to BMS with IDE support (renaming related classes
and variables that the IDE could find).
6. \o/
Split CL into Path Sets to ease review:
Base > PS2: Steps 1..4 (+121 -333)
PS2 > PS4: Step 5 (+214 -204)
Test: m -j
Test: adb shell dumpsys backup
Test: atest BackupManagerServiceTest BackupManagerServiceRoboTest
Bug: 135661048
Change-Id: Ia6cd340d3c5fcdb9c8f409035d032efeb090cd20
From BMS. Moved mUserServices list creation from BMS to Trampoline.
BMS still uses it but the plan is to move gradually in multiple
CLs to eventually delete it. Both are dealing with the same instance
because of this. Start and stop of sub-system (uBMS) is now handled in
Trampoline. getUserServices() was also moved. BMS robolectric tests were moved
to Trampoline *robolectric* tests to simplify this CL. After we merge BMS and
Trampoline, we can look into moving tests away from Robolectric.
Test: atest BackupManagerServiceTest TrampolineRoboTest TrampolineTest
Bug: 135661048
Change-Id: I4e612d06fe006c12f215a94f210450a5e6316b75
In ag/8881405 registering JobScheduler with SystemRegistryService has moved int JobSchedulerFrameworkInitializer. Make sure that class is loaded before the tests are run.
Bug: 138840929
Test: atest RunBackupFrameworksServicesRoboTest
Change-Id: Idacab9f8597b57df5b61a5c6619090a242a76264
This manually cherry picks ag/8713360 into master. I had to do a manual
cherry pick as the cherry pick from gerrit fails with:
"Could not perform action: Cannot create new patch set of change 8677635
because it is abandoned"
Currently we call .quit() on the underlying thread which will cause all
messages to stop being processed. This has the side effect that, because
the backup system is a state machine where the state transitions are
messages, the message to transition into a state where the WakeLock is
released may not occur when a user is torn down.
This change adds a stop method we can call instead of .quit() on the
thread which drops any remaining messages and then releases the
WakeLock.
We also wrap the wakelock acquire/release calls to prevent any acquire/release on
the underlying wakelock after a quit. For the acquire, this avoids a non-released
wakelock and for the release, this avoids a runtime exception which can happen
when we release a released wakelock
Test: atest CtsBackupTestCases CtsBackupHostTestCases
Test: m RunBackupFrameworksServicesRoboTests && atest RunBackupFrameworksServicesRoboTests
Bug: 136264323
Change-Id: Ic8742bf01a0ff71bd57dd73b01a423d3432bf7b2
After multi-user BMS became a lightweight class as well, so no need to
lazily initialize it. This lays the ground for unifying Trampoline and
BMS.
Test: atest TrampolineTest
Test: adb shell bmgr backupnow <package>
Bug: 135247112
Bug: 135661048
Change-Id: Ia7f69d2ed282c6dfe6443a601f27229d43802fe6
See build/soong/README.md for more information.
Bug: 122332340
Test: m RunFrameworksServicesRoboTests RunBackupFrameworksServicesRoboTests
Change-Id: I3c768074c181a6072c7c1fee4a66faa8b4f5c2f4
Currently we call .quit() on the underlying thread which will cause all
messages to stop being processed. This has the side effect that, because
the backup system is a state machine where the state transitions are
messages, the message to transition into a state where the WakeLock is
released may not occur when a user is torn down.
This change adds a stop method we can call instead of .quit() on the
thread which drops any remaining messages and then releases the
WakeLock.
We also wrap the wakelock acquire/release calls to prevent any acquire/release on
the underlying wakelock after a quit. For the acquire, this avoids a non-released
wakelock and for the release, this avoids a runtime exception which can happen
when we release a released wakelock
Test: atest CtsBackupTestCases CtsBackupHostTestCases
Test: m RunBackupFrameworksServicesRoboTests && atest RunBackupFrameworksServicesRoboTests
Test: blaze run -- //experimental/users/nathch/py/bug_repros:repro 136264323 -m acquire_quit -log DEBUG
Test: blaze run -- //experimental/users/nathch/py/bug_repros:repro 136264323 -m quit_acquire -log DEBUG
Test: blaze run -- //experimental/users/nathch/py/bug_repros:repro 136264323 -m acquire_quit_release -log DEBUG
Bug: 136264323
Change-Id: I42dcf997fc44cde05695a563aa19c8e47f6f9f26
Unsubscribe listeners as otherwise they schedule work on a stopped handler thread
after the user backup manager service is stopped
Also cleanup by removing unused code:
a) mBackupThread from BackupManagerService
b) TAG from BackupAgentTimeoutParameters
c) getRunningFullBackupTask from UserBackupManagerService
Bug: 135261178
Bug: 135180752
Test: 1. atest -v RunBackupFrameworksServicesRoboTests
2. atest -v $(find frameworks/base/services/tests/servicestests/src/com/android/server/backup -name '\''*Test.java'\'')
3. atest -v CtsBackupTestCases
4. atest -v CtsBackupHostTestCases
Change-Id: Ie199dd49c336a2519c0f8e6c8dda12d8cba8350a
Make sure mBroadcastReceiver is initialized after its dependencies,
i.e. mTransportManager.
Bug: 130408863
Test: 1) atest RunBackupFrameworksServicesRoboTests
2) atest CtsBackupTestCases
3) atest CtsBackupHostTestCases
4) atest GtsBackupTestCases
5) atest GtsBackupHostTestCases
Manual test:
1) Before fix: Add Thread.sleep() before mTransportManager is
initialized in constructor and tirgger PACKAGE_CHANGED event. Verify
broadcast receiver callback is triggered and systen_process crashes.
2) After fix: Add Thread.sleep() before mTransportManager is
initialized in constructor and tirgger PACKAGE_CHANGED event. Verify
broadcast receiver callback is not triggered.
Change-Id: If1628628176a08a2d33d020ce270de92b606d6df
See build/soong/README.md for more information.
Bug: 122332340
Test: m media
Test: m RunBackupFrameworksServicesRoboTests
Change-Id: Ieb54feb3902bddfd5a571369fbf50161ae646647
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
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
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
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