We will route backup through the BackupEncryption APK which will
implement an intermediate transport which will encrypt (or decrypt) the data when
sending it (receiving it) from the real transport.
Since both backup services and IntermediateTransport need to bind to
IBackupTransport, they both need the transport client code so we move that
into its own lib.
Bug: 139269919
Test: atest -v RunBackupFrameworksServicesRoboTests
Test: atest -v $(find frameworks/base/services/tests/servicestests/src/com/android/server/backup -name '\''*Test.java'\'')'
Test: atest -v CtsBackupTestCases CtsBackupHostTestCases
Change-Id: Id986162ac71adf8638e5797169ef70e0d3d58b0c
If an exception which isn't in the IOException hierarchy gets
thrown within this code it can bring down the system_server, so
we should capture and log any exception rather than letting it
propagate out and bring down system_server.
I decided not to capture all Throwables because they represent
more serious runtime errors that probably should bring down
system_server.
Fixes: 140472631
Test: m -j (compilation means we're OK).
Change-Id: Ibbd9612d1e9b42c100ce7fda0b7463ac3f10704e
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
From BMS.
Test: Inflate user 11 then remove it, make sure directory /data/backup/11 is
removed
Bug: 135661048
Change-Id: I482e7fb4c8ccd630ab812a396d3570be996c2a62
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
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
1) FullRestoreEngine: mAllowObbs, mBytes are not used
2) PerformUnifiedRestoreTask: mSavedStateName is not used
also, use final,private where possible
Bug: 136738613
Test: atest -v CtsBackupTestCases CtsBackupHostTestCases
Change-Id: Ic65bbefdd47ba6f0c8ba9d117256972e15af2f8e
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
Increasing timeout should help as in the only recent instance where we
saw this bug, it just exceeded the timeout by a second. Mostly the clear
operation happens very fast. Plus no obvious other solution to this
without major changes to BMS.
Fixes: 130347754
Test: 1) atest CtsBackupTestCases
2) atest CtsBackupHostTestCases
3) atest GtsBackupTestCases
4) atest GtsBackupHostTestCases
Change-Id: I462724f2ea9a9bddd3a876e7f69302c35d69a0cb