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
This involves some refactoring, so that TransportManager doesn't use API
not available in pre-O.
Bug: 37616038
Test: make RunFrameworksServicesRoboTests
Change-Id: I6a79bdbbee2a37a9fecff7865bdec37be2c7e59a
This applies changes that disappeared for some reason from ag/2314382
Bug: 37616038
Test: make RunFrameworksServicesRoboTests
Change-Id: Iabfafd8c6afaac7304194f7645d08ef9e6f3b3aa
Also set up robolectric tests for framework services.
Bug: 37616038
Test: make RunFrameworksServicesRoboTests
Change-Id: Ia27a58365a0826ec5bc9f8a7544024b52cfbb3ec
Now we reject unsigned apps, either source or target. Also
added javadoc.
Bug: 37977154
Test: runtest -p com.android.server.backup frameworks-services
Change-Id: I44df43d5322ae64d97f8b19c20db508033301f91
A follow-up CL to apply the code feedback from the first one.
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: I8785eb358658757b329ac871194243c47e6d87a9
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