With KV Refactor in mind.
* Added tests around empty queue and single package backups.
* Refactored a bit some of the existing tests.
* Moved from mocking BMS to using a real instance and had to adjust a
few things for this.
Test: atest PerformBackupTaskTest
Change-Id: I0ee3be32c7cbac5ed2cdc2717408749907c15ade
PerformAdbRestoreTask and FullRestoreEngine has shared a lot of code,
remove the copy that was in PerformAdbRestoreTask.
Test: adb restore
Change-Id: Ib4ce8b50eff8aed4a2c0660808c05b80f378ea98
Before we were considering that the app was enabled in this case, which
might not be always true.
Bug: 80227098
Test: atest AppBackupUtilsTest
Test: Check app w/ manifest enabled="true" is backed-up, but
enabled="false" is not.
Change-Id: I4625aa39ba0de45ce6689f2375245081a5d4d722
BMS.backupNow is called from GMSCore, which has a different calling
identity than the framework. This causes an IllegalArgumentException due
to uid mismatch when backupNow tries to schedule a job.
This occurs when the following conditions are combined:
1) Battery saver mode enabled
2) Network change detected
3) Backup pass is scheduled for now
Bug: 79441902
Test: 1) m -j RunFrameworksServicesRoboTests
2) Manual: Enabled battery saver, modified code to run backupNow with
each network change and overwrite previously scheduled KeyValueJob.
Then, change wifi to trigger scheduling the KeyValueJob.
Verified:
- IllegalStateException b/c of uid mismatch without change
- No exception and correct calling uid with change
Change-Id: Iac90cd435e3fc32ff5428236aa15507b36aa833d
When the agent provides a prohibited key, the code flow will directly be returned
without excuting next backup state. The next state should be execute instantly to
make sure the backup mechanism can be executed properly.
Bug: 77272601
Test: 1.m -j RunFrameworksServicesRoboTests
2.Manual testing by test package with prohibited key.
- adb backup -all
- adb backup -shared
- adb backup -obb -all
- adb shell bmgr backupnow --all
- adb shell bmgr backupnow [test key value package]
- adb backup -keyvalue [test key value package]
Change-Id: I46e1aa8dd0f75cf54087b43cee50ee952d85abc1
This fixes an issue when adb backup would hang (and hold wakelock)
forever when run with '-obb' and '-shared'.
Bug: 75997810
Test: 'adb backup -obb -shared' finishes successfully
Change-Id: I015add6dc525984592e733266b3e046f41d2cb93
We only report failure to IBackupObserver.backupFinished() when we meet
transport failure, but now it will report failure when the last package
meet TRANSPORT_PACKAGE_REJECTED or TRANSPORT_QUOTA_EXCEEDED, add above
two states in FINAL to prevent the situation, and update related
test, also javadoc of IBackupObserver.
Bug: 77271953
Test: make -j RunFrameworksServicesRoboTests ROBOTEST_FILTER=PerformBackupTaskTest
Change-Id: Ic2bfdf9f50d700f8ccb509e081ae8e0afb186020
Remove IBackupObserver.backupFinished() before
executeNextState(BackupState.FINAL), add test cases to verify it and
format PerformBackupTaskTest.java
Bug: 77272662
Test: make RunFrameworksServicesRoboTests
Change-Id: Ia464d0326437fb8680ab88619829c483e2c1164d
mCurrentPackage is null when package doesn't exist, which lead test
failed with NPE
Use request.packageName for case BackupTransport.AGENT_UNKNOWN instead
Bug: 77272500
Test: m -j RunFrameworksServicesRoboTests ROBOTEST_FILTER=PerformBackupTaskTest
Change-Id: I27be85f0c3f95e36edd92d0d552189fbcf6952dd
(cherry picked from commit 87f1209ac6)
mCurrentPackage is null when package doesn't exist, which lead test
failed with NPE
Use request.packageName for case BackupTransport.AGENT_UNKNOWN instead
Bug: 77272500
Test: m -j RunFrameworksServicesRoboTests ROBOTEST_FILTER=PerformBackupTaskTest
Change-Id: I27be85f0c3f95e36edd92d0d552189fbcf6952dd
This is a temporary solution for P to unblock GTS tests.
Bug: 77852250
Test: manual:
1. adb backup -f saved-wifi-api100.ab -keyvalue com.android.providers.settings
2. adb restore saved-wifi-api100.ab
3. See that SettingsBackupAgent receives appVersionCode in onRestore()
Change-Id: I6092bea570e7e27cb5b72165e9284ad2befc21b6
Attempt to simplify the exposure of package signing information via
PackageInfo by creating a new class and corresponding methods for
querying a package's signing information.
Bug: 74831530
Test: PkgInstallSignatureVerificationTest
Change-Id: Idbc008b41a921f89cefb224b26f910da4d238dea
We still don't know the underlying cause of this, but we shouldn't crash
the system_server. Catching for now.
Bug: 74940472
Bug: 77574274
Test: m -j RunFrameworksServicesRoboTests
Change-Id: I36fc2e65f8766f6b8fd68104d8830b72668d84eb
In some cases (deferred restore) the app data needs to be cleared even
if the app has implemented backup agent. As a quick fix introduce
PACKAGES_TO_CLEAR_DATA_BEFORE_FULL_RESTORE secure setting, which
transport can fill prior to restore.
Bug: 69069240
Test: adb shell settings put secure packages_to_clear_data_before_full_restore com.google.android.apps.nexuslauncher && adb shell bmgr restore com.google.android.apps.nexuslauncher
Change-Id: I2a4651365d9cf4747f32d2ba69312f54cd03d118
With the newly created Global setting for backup/restore agent timeouts
(backup_agent_timeout_parameters introduced in ag/3731401), update
references in backup and restore code to get the timeout values from
the setting instead of referencing constants in BMS.
This makes these timeouts configurable outside of the framework.
The default value of the setting is the same as the constants in BMS so
this should have no change on the timeout values used in the backup and
restore flow.
Bug: 70276070
Test: 1) m -j RunFrameworksServicesRoboTests
Change-Id: I0259bba76d0fed48158b8316f430b315ea98086e
With the newly created Global setting for backup/restore agent timeouts
(backup_agent_timeout_parameters introduced in ag/3731401), update
references in backup and restore code to get the timeout values from
the setting instead of referencing constants in BMS.
This makes these timeouts configurable outside of the framework.
The default value of the setting is the same as the constants in BMS so
this should have no change on the timeout values used in the backup and
restore flow.
Bug: 70276070
Test: 1) m -j RunFrameworksServicesRoboTests
Change-Id: I0259bba76d0fed48158b8316f430b315ea98086e
Part of push to make backup and restore agent timeouts configurable. Creates
a Global setting for the current static BackupManagerService timeouts so
that they can be overriden with P/H. We keep the current default values,
which will be updated once we investigate what more appropriate values are.
Remame the constants to better reflect what they're used
for. Next, we will update the framework to use these constants.
This depends on the refactor of how we observe changes to key value
backup settings (ag/3709997).
Bug: 70276070
Test: m -j RunFrameworksServicesRoboTests ROBOTEST_FILTER=BackupAgentTimeoutParametersTest
Change-Id: Id506314ce0c8bd5e4d1d8b4001b26cbad0056c99
Part of push to make backup and restore agent timeouts configurable. Creates
a Global setting for the current static BackupManagerService timeouts so
that they can be overriden with P/H. We keep the current default values,
which will be updated once we investigate what more appropriate values are.
Remame the constants to better reflect what they're used
for. Next, we will update the framework to use these constants.
This depends on the refactor of how we observe changes to key value
backup settings (ag/3709997).
Bug: 70276070
Test: m -j RunFrameworksServicesRoboTests ROBOTEST_FILTER=BackupAgentTimeoutParametersTest
Change-Id: Id506314ce0c8bd5e4d1d8b4001b26cbad0056c99
Extracts an abstract class to observe changes in backup parameter settings that
are stored as a comma-separated key value list. This class is
responsible for registering and unregistering a content observer on the
setting and updating local references to the parameters.
Refactor BackupManagerConstants and LocalTransportParameters to use this
implementation. This will also be used for the new backup timeout
setting.
Bug: 74346317
Test: 1) m -j RunFrameworksServicesRoboTests ROBOTEST_FILTER=BackupManagerConstantsTest
2) gts-tradefed run commandAndExit gts-dev -m GtsBackupHostTestCases -t com.google.android.gts.backup.TransportFlagsHostSideTest
Change-Id: Id4c50fbcf7479c925515887e3fa70e166dd9955c
Extracts an abstract class to observe changes in backup parameter settings that
are stored as a comma-separated key value list. This class is
responsible for registering and unregistering a content observer on the
setting and updating local references to the parameters.
Refactor BackupManagerConstants and LocalTransportParameters to use this
implementation. This will also be used for the new backup timeout
setting.
Bug: 74346317
Test: 1) m -j RunFrameworksServicesRoboTests ROBOTEST_FILTER=BackupManagerConstantsTest
2) gts-tradefed run commandAndExit gts-dev -m GtsBackupHostTestCases -t com.google.android.gts.backup.TransportFlagsHostSideTest
Change-Id: Id4c50fbcf7479c925515887e3fa70e166dd9955c
(cherry picked from commit 16ef6ffb3cbea77637ad99c2b0c79cbfd8f03c9a)
Added units for http://ag/3709565. Some refactoring.
Test: m -j RunFrameworksServicesRoboTests
Bug: 72485465
Change-Id: Id75a4e0b96936580fd677041e091340b0fff8c1e
(cherry picked from commit cac3a74059)
Retrievable via 'adb shell dumpsys backup transportstats'.
Sample output:
Average connection time: 36.00 ms
Max connection time: 181 ms
Min connection time: 7 ms
Number of connections: 16
Per transport:
com.google.android.gms/.backup.BackupTransportService
Average connection time: 27.71 ms
Max connection time: 139 ms
Min connection time: 13 ms
Number of connections: 14
com.google.android.gms/.backup.component.D2dTransportService
Average connection time: 181.00 ms
Max connection time: 181 ms
Min connection time: 181 ms
Number of connections: 1
android/com.android.internal.backup.LocalTransportService
Average connection time: 7.00 ms
Max connection time: 7 ms
Min connection time: 7 ms
Number of connections: 1
Bug: 72485465
Test: Will follow in another CL if reviewers OK w/ approach.
Change-Id: I133ed423d0b8471d69e3c3631aadee7d42d0ec0e
(cherry picked from commit e5a976404c)
Added units for http://ag/3709565. Some refactoring.
Test: m -j RunFrameworksServicesRoboTests
Bug: 72485465
Change-Id: Id75a4e0b96936580fd677041e091340b0fff8c1e
Retrievable via 'adb shell dumpsys backup transportstats'.
Sample output:
Average connection time: 36.00 ms
Max connection time: 181 ms
Min connection time: 7 ms
Number of connections: 16
Per transport:
com.google.android.gms/.backup.BackupTransportService
Average connection time: 27.71 ms
Max connection time: 139 ms
Min connection time: 13 ms
Number of connections: 14
com.google.android.gms/.backup.component.D2dTransportService
Average connection time: 181.00 ms
Max connection time: 181 ms
Min connection time: 181 ms
Number of connections: 1
android/com.android.internal.backup.LocalTransportService
Average connection time: 7.00 ms
Max connection time: 7 ms
Min connection time: 7 ms
Number of connections: 1
Bug: 72485465
Test: Will follow in another CL if reviewers OK w/ approach.
Change-Id: I133ed423d0b8471d69e3c3631aadee7d42d0ec0e