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
Previously, one could poison the current-dataset tracking by
inopportunely-timed use of the local (aka development) transport.
Now you can't: we reset the 'current dataset token?' tracking
whenever the user changes the active transport.
Also don't double-allocate return values sometimes.
Bug 37694618
Test: manual
Change-Id: I2cf5d42774522af830aecb99e65f43c4d0b5ce76
thread to another thread
The system_server process was being killed by Watchdog, as the main
thread was waiting for the mCancelLock for over a minute.
Bug: 35968123
Test: make gts -j40 && gts-tradefed run gts -m GtsGmscoreHostTestCases -t com.google.android.gts.backup.BackupManagerHostTest
Change-Id: Ia146569d2c741b35a6f6c9bfc4c5ddf8539b6242
Only remove messages of types OP_TYPE_BACKUP_WAIT and OP_TYPE_RESTORE_WAIT, since OP_TYPE_BACKUP cannot time out and doesn't require cancellation.
This will prevent some unncecessary (false) warnings in logcat.
Bug: 36570881
Test: manual
Change-Id: I72ecf98438fff18616354b04638b7db5c943aa61
This is added because only logging before doRestore was previously
shown, which meant that if the doRestoreFinished timed out, it would
in the logs look like it was the doRestore timing out.
Test: adb shell bmgr restore com.android.calllogbackup
Bug: 36507762
Change-Id: I2bd6e59ed0c5b0128eaca41b627356d459000065
Before it was returning null in case the service was not initialized,
but as the method signature has int as the return type, this was boxed
and unboxed which would cause NPE.
Now it will return BackupManager.ERROR_BACKUP_NOT_ALLOWED instead.
This doesn't include fix for the test, because it's going to be
cherry-picked into oc-dev, which doesn't have the tests.
Test: manually ran unit tests
Bug: 37535747
Change-Id: I186cf812a4ec67be943b5c4334c82e9af5320b7a
Some system services are offering package usage data through both
public/system APIs and through dump() calls. In principle, usage
data hould always be protected with PACKAGE_USAGE_STATS, so start
enforcing that. (Otherwise if a user blocked PACKAGE_USAGE_STATS
access to an app, that app could still obtain the data via dump()
if they held the DUMP permission.)
Bottom line, let's respect the user's wishes.
Protecting the entire output like this is pretty blunt, but future
CLs can add more nuance to the output if desired.
Test: cts-tradefed run commandAndExit cts-dev -m CtsSecurityTestCases -t android.security.cts.ServicePermissionsTest
Bug: 32806790
Change-Id: I46173562713bea7d89e12a4313c78eb52ea8d77d
This change introduces new methods on DumpUtils that can check if the
caller has DUMP and/or PACKAGE_USAGE_STATS access. It then moves all
existing dump() methods to use these checks so that we emit
consistent error messages.
Test: cts-tradefed run commandAndExit cts-dev -m CtsSecurityTestCases -t android.security.cts.ServicePermissionsTest
Bug: 32806790
Change-Id: Iaff6b9506818ee082b1e169c89ebe1001b3bfeca
handleCancel() can be called before we start backing up any particular
package, therefore we need to properly handle log messages in that case.
Bug: 36638539
Test: manual
Change-Id: Ic96e2fbad5c0a79640a3419d187e8b5e4d265de3
(cherry picked from commit 519a87db8f)
For adding CTS tests for packages having key-value backup agents, we add
support for key-value backups to the adb backup/restore command.
Previously, packages not supporting fullbackup would just be skipped on
this command. Now, by adding the -keyvalue flag to the adb backup command,
packages supporting key-value will also be added to the resulting
tarball. Similarly, if the tarball being supplied to adb restore
contains data from key-value packages, it will be restored.
This will later be utilized for writing CTS tests for such packages.
Test: adb backup -includekeyvalue -all && adb restore backup.ab
Change-Id: I7b4ccfb7072d01d29a888952145d7cce90a4f59e
When a TransportConnection received onServiceDisconnected() we give automatic rebinding
a chance, but if it doesn't happen within a few minutes we take matters into our hands
and attempt to rebind explicitly.
The timeout is significantly lower if the device is still unprovisioned - this is to increase
chances of proper transport binding during the setup process.
Bug: 34464359
Bug: 30964151
Test: manual, by crashing gms and gms.persistent process with "adb shell cmd activity crash #pid"
and waiting for timeout to kick in
Change-Id: Ia7e5b0e54faf48ba8566f50057a3cae8bb3ab137
The BatterySaverPolicy is designed to consolidate all battery saver
knobs into a central location. Usually it is consistent to
mLowPowerModeEnabled unless it gets different data for specific
service. By adding these knobs, we can effectively tune the battery
saver.
This cl sets up the framework for BatterySaverPolicy and updates
following service to get battery saver data from BatterySaverPolicy
1. GnssLocationProvider
2. VibratorService
3. WindowManagerService
4. BackupManagerService
5. SoundTriggerService
6. NetworkPolicyManagerService
Screen brightness will come in a following cl.
Bug: 34693888
Test: FrameworksServicesTests
Change-Id: I6b040e93391614b44d136a485faa4a332c396e51
Incoming operations don't have to block until all backup ops to be
cancelled are handled.
Test: make gts -j40 && gts-tradefed run gts -m GtsGmscoreHostTestCases -t com.google.android.gts.backup.BackupManagerHostTest
Bug: 35767318
Change-Id: I1c6f7a1cfbfc18483311044a75e46cd4e8f9f4f3
Recent changes to PerformBackupTask made it expect empty list rather
than null for the ArrayList<String> pendingFullBackups argument.
Bug: 35420596
Test: manual
Change-Id: I8e1f69e78856b9bb8fc8aa9ab1adcac634314a36
Per Java documentation "Iterator.remove is the only safe way to
modify a collection during iteration; the behavior is unspecified
if the underlying collection is modified in any other way while
the iteration is in progress."
Test: updated gmscore to check that onPackageRemoved() works correctly
Bug: 35846264
Change-Id: I878e581db3bf60b9c6b2cf861f66d8b427202b02
This cl introduces logic to serialize restore
operations. An incoming restore operation will
wait for the currently running restore to
complete.
Bug: 29010684
Test: Tested manually by installing an app while a restore was in
progress.
Change-Id: Ic88fdf2a6dcfab64853fe460c649380eea644774
If a backup operation is in progress
when another backup operation is requested,
the new one is skipped. We have to skip the
second one because the current BackupTransport
interface cannot support parallel backups.
Bug: 29010684
Test: Tested manually. Work on GTS test in progress.
Change-Id: I6d8f49897bb42781bafed584a4b75b3b971f75eb
This cl is part of a group of CLs to support
some parallelism in BackupManager's operations.
Separate message ids are used for handler messages
for backup and restore operations so that both
operations can run parallely.
Bug: 29010684
Test: Manually tested by installing a test backup agent that times out.
Change-Id: I57a5d063fb4446e610af81ac6f039d3fc8414a46
If none of the requested packages are valid packages,
we'd run into this issue where PerformBackupTask#mQueue
is null but we try to iterate over it in finalizeBackup()
Fix is to use an empty queue as the default value instead
of null.
Bug: 35380067
Test: Manually tested by trying to backup a non-existent package.
Change-Id: Ibb2d03d5f8270bcb448ee083ee02964236aca92b
handleCancel was being called on an operation
while we are iterating over all operations.
This can cause issues if handleCancel modifies
the array containing all operations.
Test: Run cancelBackup GTS tests.
Change-Id: If3fbe7b5d9e61aa870f8f6e0dd1654e735c0c5b8
This CL adds more instumentation to
backup/restore operation in the BackupManager. For more details please
point to:
https://docs.google.com/document/d/1sUboR28LjkT1wRXOwVOV3tLo0qisiCvzxIGmzCVEjbI/edit#
This first Cl introduces 3 events that we sent to the monitor.
The base cl is ag/1835775
Test: TODO
BUG: 34873525
Change-Id: I127fe739a7522078eecce2ae689a4607203a98da
This is the first CL of many that will add instumentation to
backup/restore operation in the BackupManager. For more details please
point to:
https://docs.google.com/document/d/1sUboR28LjkT1wRXOwVOV3tLo0qisiCvzxIGmzCVEjbI/edit#
This first Cl introduces 3 events that we sent to the monitor.
Test: ag/1858962 (same topic)
BUG: 34873525
Change-Id: I6c338b6fd9f4d7c8670dac201897250b6b170677
The bmgr whitelist command was broken
after the selectTransport api cl. This
cl fixes it.
Bug: 34953486
Test: Verify that adb shell bmgr whitelist prints all whitelisted
transports
Change-Id: I3c3275258a45a035a0ca9404d1016ca5663cceaf
This cl adds an API to select a backup
transport by its component name and
receive a callback when BackupManager
is bound to the transport. Calling this API
will make BackupManager bind to the transport
if it isn't already bound to it.
Also fixes the issue where BackupManager would
detect only one transport per package.
Ref: go/backup-transport-switching
Bug: 33616220
Test: Manually tested. GTS tests will be put up shortly.
Change-Id: I8c23bdbb84ceb05eb1fad9b3a8b9c4441cb06c74
This cl adds a new requestBackup API to
BackupManager that takes in an int flag
to indicate whether the caller wants the
entire key value set to be passed to the
transport and not just a diff.
Change-Id: Ia225797a58c4431fe742f2f116b257d006b30cd1
Bug: 33749084
Ref: go/request-backup-api-changes
Test: GTS Test at ag/1774002
com.android.server.backup.BackupManagerService#parseLeftoverJournals
uses input stream to read UTF. The method used RandomAccessFile to
perform the operation. The change replace the RandomAccessFile with
a Buffered InputStream.
Bug: 32866032
Test: `make`
Change-Id: I6594cecc49cb6efcfdf73beb5e425688cf890722