Migrate selectBackupTransport()/selectBackupTransportAsync() to binding
on-demand. To mimic the bind-if-needed behavior that existed before for
selectBackupTransportAsync we now register-if-needed in the selection.
This means a new registerTransport() method was created in the
TransportManager. I intend to use this method with only few
modifications for the first-binding code.
Change-Id: I39661cff0f7b2f8a27da37905dcd93e0aa9b1178
Ref: http://go/br-binding-on-demand
Bug: 17140907
Test: m -j RunFrameworksServicesRoboTest
Test: adb shell bmgr transport <transport>, observe logs
Test: Robolectric tests for TransportManager will go in registration CL
BackupManagerConstants has a content observer that is meant to be
notified whenever backup settings change. However, that observer is
never registered.
Bug: 71622864
Test: cts-tradefed run cts-dev --module CtsBackupHostTestCase
Change-Id: Icbd90ef3af83dd2f29e26a5d787505bcf5681154
To be able to re-use the TransportClient infra for transport
registration, I need to remove transport dir name property from
TransportClient because it's not available before registration
itself. As a result callsites that used getTransportDirName()
from TransportClient will have to go through the
TransportManager for that. Bryan suggested that the
TransportClient wasn't the best place for the property before.
Ref: http://go/br-binding-on-demand
Bug: 17140907
Test: m -j RunFrameworksServicesTests
Change-Id: I3fa335faf97d63adfad1a929336073a70fc8bc02
Migrate usages of the transport binder to binding on-demand:
* getDestinationString()
* isAppEligibleForBackup()
* dump()
For getDestinationString() we'll be introducing an invisible bug for
people that haven't updated GMSCore to include the usage of
updateTransportAttributes() API introduced in earlier CL. The bug is
that that text won't change, it'll remain constant. It's invisible
because currently only place that uses that method is Settings in some
circumstances that depend on the transport, and those circunstances
don't happen with our transports. Check http://ag/1831025.
For isAppEligibleForBackup(), a new filterAppsEligibleForBackup() is
created and there we bind on-demand.
Change-Id: Idc9e31f0e8eda8531e204c05a84fafdaf0247d08
Ref: http://go/br-binding-on-demand
Bug: 17140907
Test: adb shell dumpsys backup, observe destination of transports
Test: adb shell bmgr backupnow --all, observe only eligible apps got backed-up
Test: Force-loaded settings screen and observed destination string
Test: m -j RunFrameworksServicesRoboTests
Introduced usage of ANCESTRAL_RECORD_KEY, based on which value
the restore set can be parsed in multiple ways by different
RestoreDataConsumers.
Test: manual - D2D and cloud for different scenarios (O->P, P->P, Q->P)
Test: O->P and P->P will be covered by our automatic e2e tests
Test: a CTS test will be added to verify that backups of PMBA
generated on Android P+ always contain the ANCESTRAL_RECORD_KEY,
and it's always the first key
Bug: 64988620
Change-Id: I4634f403da4aefdeb09dc5ca621c4ac349583251
This CL addresses a few remaining review comments from 02a1c08,
"Add notification on succesful backups"
Bug: 63885845
Test: make RunFrameworksServicesRoboTests
Change-Id: Id42777a213c37400f24f6ecb11ecacbd55a2e123
When the backup manager is configured to notify one or more apps of
successful backups, the notifications should be sent to apps that are
currently stopped as well.
Bug: 63885845
Test: cts-tradefed run cts-dev --module CtsBackupHostTestCase
Change-Id: I7086aee105229e0f8db4b1ec26639d53a4e0af37
Migrate transport initialization task to binding on-demand. Added
Robolectric tests for the task as well.
Bug: 17140907
Test: m -j RunFrameworksServicesRoboTest
Test: adb shell bmgr init <transport>, observed logs & transport dir
Change-Id: I2d6c1acd31741169080edef2f938fabf43b0649a
Migrate the attribute queries from the Transport to the
TransportManager. Migrate all calls except currentDestinationString
because that's the one that changes and we should only migrate
after we have GMSCore that implements the push-from-transport
model.
Looking at method recordInitPendingLocked(), we only sent
MSG_RETRY_INIT if the transport threw while calling transportDirName
or the binder was null. With binding on-demand both of these cases
can't happen - i.e. we can't fail anymore. So, I removed the
message entirely.
Change-Id: I45a305704274c8b0c88637e3ccafc658639b2dfa
Ref: http://go/br-binding-on-demand
Bug: 17140907
Test: m -j RunFrameworksServicesRoboTests
Test: gts-tradefed run commandAndExit gts-dev -m GtsBackupTestCases
Test: gts-tradefed run commandAndExit gts-dev -m GtsBackupHostTestCases
Test: cts-tradefed run commandAndExit cts-dev -m CtsBackupTestCases
Test: runtest -p com.android.server.backup frameworks-services
Test: adb shell bmgr backupnow <packages>
Test: adb shell bmgr fullbackup <packages>
Test: adb shell cmd jobscheduler run -f android <job_id>
Test: adb shell bmgr enable false (being enabled before)
Test: adb shell dumpsys backup
Test: adb shell bmgr init <transport>
Test: Observed logs and used debugger to check proper code was being
Test: called in above commands
In the same bit of code, fix a system restore issue: in the
course of setup + restore, we reestablish permission grants and
notification state up front for the to-be-restored app, and
then bring in its data. However, a data wipe is part of the
prologue for that data delivery -- so we were inadvertently
unwinding the permission grants and notification state restore
that we'd just performed. Now, we distinguish the restore flow
from other clear-data operations so we don't unwind that operation.
Finally take the opportunity to elide a lot of copypasta code into
a single predicate-driven implementation.
Bug: 67508896
Bug: 69538432
Test: atest android.app.cts.AlarmManagerTest
Change-Id: I15c912c3c99645599ae9bd6fb7337fa86b4e5757
It turns the version code into almost a 64-bit integer, with the
new major part being the upper 32 bits.
The only tricky part about this is the backup manager, since it
stored 32-bit version codes in its backup data sets. This is dealt
with by, when the major version code is not 0, writing MIN_INT as
the version code and following that by the full long version code,
which we can detect when reading. Note that this makes backup sets
containing apps with major version codes incompatible with older
versions of the platform.
Bug: 64459786
Test: Added in Change-Id: Iab8a682b62103babd6c16a56b8dc1e97d7078658
Change-Id: Ibfffe235bbfcf358b3741abd3f7197fdb063d3f3
As discussed, only removed the class, local interface and trampoline
still exist. That will go into a next CL.
Bug: 65823538
Test: make RunFrameworksServicesRoboTests
Test: runtest -p com.android.server.backup frameworks-services
Test: gts-tradefed run commandAndExit gts-dev -m GtsBackupTestCases
Test: gts-tradefed run commandAndExit gts-dev -m GtsBackupHostTestCases
Test: cts-tradefed run commandAndExit cts-dev -m CtsBackupTestCases
Test: adb shell bmgr backupnow <kv and full-backup packages>
Test: adb backup & adb restore
Change-Id: Ifcb4c02e364b8c4899ff376ff20cd8c89fc1af28
This CL introduces the updateTransportAttributes() API to be used by the
transport hosts. It doesn't actually use the description attributes yet,
this will go in another CL. This is because I want to test that CL
together with transport usage. Tests are lacking for TransportManager
and BMS, I'll still add them, but I'm trying to migrate Robolectric
first.
Ref: http://go/br-binding-on-demand
Bug: 17140907
Test: make RunFrameworksServicesRoboTests
Test: runtest -p com.android.server.backup frameworks-services
Test: gts-tradefed run commandAndExit gts-dev -m GtsBackupTestCases
Test: gts-tradefed run commandAndExit gts-dev -m GtsBackupHostTestCases
Test: cts-tradefed run commandAndExit cts-dev -m CtsBackupTestCases
Change-Id: I56f7b5a5026d21d8f11afb371d5560d4913c5f2a
Migrate the full-backup task to use binding on-demand
Ref: http://go/br-binding-on-demand
Bug: 17140907
Test: make RunFrameworksServicesRoboTests
Test: runtest -p com.android.server.backup frameworks-services
Test: adb shell bmgr backupnow <packages>
With transports manually unbound and also canceled the operation a
few times. Then inspected TransportClient logcat
Test: gts-tradefed run commandAndExit gts-dev -m GtsBackupTestCases
Test: gts-tradefed run commandAndExit gts-dev -m GtsBackupHostTestCases
Test: cts-tradefed run commandAndExit cts-dev -m CtsBackupTestCases
Test: Manually unbound before GTS/CTS above.
Change-Id: I15abe970db0b9858e0e2e4eb666358db3a9d50ad
This CL introduces TransportClient infra-structure and integration in
TransportManager, plus a few unit tests. Also start using binding
on-demand for PerformBackupTask.
Ref: http://go/br-binding-on-demand
Bug: 17140907
Test: make RunFrameworksServicesRoboTests
Test: runtest -p com.android.server.backup frameworks-services
Test: adb shell bmgr backupnow <packages>
With transports manually unbound and also canceled the operation a
few times. Then inspected TransportClient logcat
Test: gts-tradefed run commandAndExit gts-dev -m GtsBackupTestCases
Test: gts-tradefed run commandAndExit gts-dev -m GtsBackupHostTestCases
Test: cts-tradefed run commandAndExit cts-dev -m CtsBackupTestCases
Test: Manually unbound before GTS/CTS above.
Change-Id: I63cbde27131205787d90663603a4f8f61d187607
so other components (system UI, settings, etc) can use them.
Bug: 68769804
Test: Build & presubmit
Change-Id: I30fe78e49d2187bee7c7aeba735cd9c26fc332a5
Mea culpa. Properly do the trampoline indirection dance so
that we can asynchronously bring up the service components.
We'd previously accidentally introduced an ordering problem such
that the init process... didn't.
Bug: 67676879
Test: 'adb shell dumpsys backup' and 'adb shell bmgr list transports' after boot
Change-Id: I3e9a904a009f4745727e5eb13f7307c6deda1e4f
We now perform the slow work of unlocking the primary user on the
background handler thread rather than on the main thread. This
is expected to shave 150ms+ off of our total unlock latency on
some products.
Bug: 63389800
Test: manual
Change-Id: I70be032a64de3270476615fd9dde1b427e19aa91
1. process package update broadcasts on our background thread rather
than on the main looper thread
2. don't synchronize unnecessarily around access to simple
transport metadata
We mustn't block the main looper thread for anything that might wind
up interlocked with calls to the transport, because those might take
arbitrary amounts of time. We were previously entering such an
implicitly interlocked code path during package-changed broadcast
handling, and in pathological cases were causing the watchdog to
restart the system. This situation is addressed in a couple of ways:
first, by no longer performing package-update work on the main looper
thread at all; and second, by eliminating lock reliance entirely from
data-access paths that don't actually need it.
Bug: 65438129
Bug: 64133971
Test: manual + CTS
Change-Id: I361ad4a0729f319db7339bd341a6d33aa3b64fed
Keeping the legacy BackupManagerService for now, but we'll remove
it in a few weeks if there's no issues noticed.
In case of any problems, this CL can be cleanly reverted as a fallback.
Test: pretty much all we got in store
1) runtest -p com.android.server.backup frameworks-services
2) make gts -j40 && gts-tradefed run gts -m GtsBackupHostTestCases
3) make cts -j40 && cts-tradefed run cts -m CtsBackupTestCases
4) make pts -j40 && pts-tradefed run pts -m PtsBackupHostSideTestCases
5) manual: "adb shell bmgr backupnow --all" and then cloud restore,
D2D scenarios (both as source and target)
Bug: 65823538
Change-Id: I701764995c4fe2611a4941aecb45315aa457658e
This CL replicates ag/2284557 in RefactoredBMS (only the BMS part, the
rest is already live code).
Test: runtest -p com.android.server.backup frameworks-services
Bug: 37973765
Change-Id: I4f6cb85b879e0ee7b2b20ac998977f8c6d8fdfe0
This CL replicates ag/2204901 in RefactoredBMS.
Also adjusts tests and adds new ones for appIsDisabled method.
Test: runtest -p com.android.server.backup frameworks-services
Bug: 37973765
Change-Id: Ibaa15ba935ca1ada657e912b18a5a0b3bcffd00f
This CL replicates both ag/2551800 and ag/2613950 in RefactoredBMS.
Test: runtest -p com.android.server.backup frameworks-services
Bug: 37973765
Change-Id: I5e42dee67d587adabbfb81de03f3205d92a46add
call from the main thread to another thread
This CL replicates both ag/2135862 and ag/2465381 in RefactoredBMS.
Test: runtest -p com.android.server.backup frameworks-services
Bug: 37973765
Change-Id: I895cb27bc910d9970ab1c33cd54a773b8f9b6cf6
This change update the backup manager service to use newly created
BackupManagerConstants for some configuration parameters.
This is part 2 of the change.
Test: Used 'adb logcat -b system' to verify the settings worked.
Bug: 63351792
Change-Id: Ia6c9a2afbbaf3481a742a67c48ce9995c1ce6483
This change add one secure settings which is a key value list consisting
of 7 individual settings; it also provides a class to get these settings
and use the default values specified in default.xml file when the settings
are missing.
This is the first part of a 2 part change. A subsequent change will use
these settings in backup service manger for setting up backup frequency.
Test: This change builds. Manual tests will be included in part 2 of the
change.
Bug: 63351792
Change-Id: I62baddbf3e0b96af6b7de3dfdeac3479e5b3ded8