Puts all the logic for remembering what apps have been backed up on
the current device into own class. Also fixes bug where if an app was
uninstalled, it was removed from the journal. As the journal is used
to decide what restore set to use after a fresh install of an app (as
at this point we do try to restore previous state if it's available)
it doesn't make sense to forget apps that were uninstalled.
Bug: 36850431
Test: adb shell am instrument -w -e package com.android.server.backup com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner
Change-Id: I9300883e139ee0773acbf4a09b08c7f5955c66e5
The point of this journal is to remember whether a package was ever
backed up on the device, so as to know, when re-installing a package,
which restore set to restore from (i.e., the restore set of the
current device - if the package has been backed up on the current
device - or the restore set of the ancestral device).
Bug: 63794452
Test: Manual
Change-Id: I6519ed625124487ffb09b7c3899550e4d791e0df
We've seen at least one incident in the field that suggests we
used the same identifying token in back to back operations, which
breaks certain invariants in the asynchronous-completion bookkeeping.
Harden against this by making sure that we don't reuse tokens in
nearby proximity. This is done by making the low 8 bits a sequence
count, i.e. guaranteed unique within the last 256 operations, while
keeping the upper bits random so that apps can't guess at correct
tokens.
Fix 63691912
Fix 63553575
Test: CTS backup pass to completion plus manual inspection
Change-Id: I321c3a2b3f4203836800bb72db7332bd82e54aaf
Resources are not handled in a consistent manner, or even consistently
closed.
Bug: 36850431
Test: adb shell am instrument -w -e package com.android.server.backup com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner
Change-Id: I9ca2bd8d532af385174a107ee7fbe113575c5bbb
This makes it easier to follow what's going on. Also makes it easy for us to
add unit tests for this component.
Bug: 36850431
Test: adb shell am instrument -w -e package com.android.server.backup com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner
Change-Id: Ifb85f1573bcfb7da26febed35d49454614b5d975
Refactor to further simplify BackupManagerService, which currently has too
many responsibilities. Also adds unit tests.
Bug: 36850431
Test: adb shell am instrument -w -e package com.android.server.backup com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner
Change-Id: Id433d7604c22c8b6f0d524a9bf9e83053facc0ca
We were failing to tear down a full-backup target process in several
error situations (preflight, quota exceeded, unforeseen), leaving the
app in an incoherent execution state for general operation. Now we
properly tear down the target in all full-backup early exits.
Fix#63540605
Test: run cts -m CtsBackupTestCases -t android.backup.cts.BackupQuotaTest
Change-Id: Id8f6fe0381e85a8d8e4015fc6fd34bb840859e7a
Calling finalizeBackup() the second time will most probably lead to underholding
the wakelock and system crash.
Bug: 63156509
Test: manual
Change-Id: Ic995ba4a65d749b80bf1f1d226d35a279a0d1b25
Both BackupManager and AppWidgetManager internals are taking a long
time to process user unlock events, so add tracing details. Also add
general tracing to show all UserState changes.
Bug: 32859180
Test: builds, boots
Change-Id: I82f4f7220ccb695941acd6bc45cd67a5fae8a4d2
bmgr init TRANSPORT [...]
will run an init operation on each named transport, blocking
until the operations have all completed.
Bug 62253989
Test: manual
Change-Id: I7dbd94293738d5ecf195764f5b28905253819791
Also tweaked the logging to make sure to capture "not provisioned"
whenever it's the case.
Test: manual
Change-Id: Iee909b8336af776bad0fa46f036d6cf32ef9c3e7
Previously we always started the agent in "dolly" mode, which meant that
the application context might not be what the agent was expecting.
Bug: 62524964
Test: Manual
Change-Id: I6cd2fafcac97f7ca01a6e172325968d79cc01194
Existing instances don't know that the file has changed out from
under them, so they continue to return stale values from reads, and
risk overwriting restored data with stale content if writes are
performed. We now tell the backing cache system to induce a
reload after restore (i.e. after we might have written a relevant
file out from under it).
Along the way we shook out an irregularity in the way we were
setting up the context topology of non-lifecycle instances of
the metadata-handling BackupAgent subclass, so that's fixed
now too.
Bug 12061817
Test: cts-tradefed run cts -m CtsBackupHostTestCases
Change-Id: I401fe9297235b55d8a8f041e430d122dc6e24129
Also fixes the problem where it could through IndexOutOfBoundsException
instead of more natuarl EOFExcpetion in case there is not enough data in
the chunk.
Bug: 38081946
Bug: 37983441
Test: runtest -p com.android.server.backup frameworks-services
Change-Id: Icac575a76b752922b9c2d9cc0b3cad50f4273241
This keeps the install flow fast, and also happens to mean that
there is feature parity in this regard between pre-O and O+
instant app handling.
Fix#38263351
Test: manual
Change-Id: I8eb08c12d800f5288583e792621920c9876efdfc
Switching to buffered streams saved up to 50% of
BackupManagerService.onUnlockUser time:
Before:
SystemServiceManager: Service com.android.server.backup.BackupManagerService$Lifecycle took 389 ms in onUnlockUser
SystemServiceManager: Service com.android.server.backup.BackupManagerService$Lifecycle took 380 ms in onUnlockUser
After:
SystemServiceManager: Service com.android.server.backup.BackupManagerService$Lifecycle took 178 ms in onUnlockUser
SystemServiceManager: Service com.android.server.backup.BackupManagerService$Lifecycle took 155 ms in onUnlockUser
Test: manual
Bug: 37686433
Change-Id: I41185a88e8377b434fab6a3bf1fd7086758127cd
... and PerformAdbRestoreTask.
Involves some refactoring, splitting readAppManifest() into two methods.
Also a bit of cleanup: make private field actually private and use
static imports for some constants.
Bug: 38090803
Bug: 37619463
Test: runtest -p com.android.server.backup frameworks-services
Change-Id: Ic30a6c5a515da1efb67caaae6eb75f4313797d5c
Also add missing javadocs to some new classes.
Bug: 37939902
Test: runtest -p com.android.server.backup frameworks-services
Change-Id: I7c24cec754af9ea6caee7791a11085b8c174c427
It previously used a backup timeout of 5 min, and restore timeout of 1
min, that would always timeout if the files on shared storage were big.
Now increase both to 60 minutes.
Bug: 37201952
Test: adb backup -shared && adb restore backup.ab
Merged-In: Ice6648554933baf76e96fd151b506564487c91c6
Change-Id: I99095249e960fd47fc742154bc513347bf506548