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
Fix: 37304539
Test: runtest -x frameworks/base/services/tests/servicestests/src/com/android/server/backup/TrampolineTest.java
Test: setup device owner, then set up profile.
Ensure tapping Settings->Google->Work->Security -> Verify app
is working
Change-Id: I393308857ea6082dca167e3e417b946615a83c20
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
Moved more common classes and methods to utilities (automated).
Prepared for deduplication of restoreOneFile() method.
Bug: 37519282
Test: gts
Change-Id: Ibc3de8f7c6675f64c636aafe51a885cfbd162e3a
This was done for FullRestoreEngine but not for PerformAdbRestoreTask by
mistake.
Bug: 37519282
Test: it compiles
Change-Id: I17be3f07d3eed9113c36bbb47db6146fa7e76d64
This moves rest of common methods in FullRestoreEngine and
PerformAdbRestoreTask to TarBackupReader and FileMetadata.
Bug: 37519282
Test: gts
Change-Id: Iff1f95e87721e74c9c5764ab98c64026604eee9b
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
This moves part of the common code for reading tar files from
PerformAdbRestoreTask and FullRestoreEngine to it's own class.
Change is mostly automated, but with some manual intervention which
doesn't change behaviour.
Bug: 37519282
Test: cts,gts,pts
Change-Id: I669b848e16196ae76fb9e820b786bbe248985e47
This is an automated change which moves all public static methods
from RefactoredBackupManagerService to respective utility classes.
Bug: 37519282
Test: it compiles.
Change-Id: I2f5765e430da3bd9a05e255dbd2656d5e667bf4d
This encapsulates back the fields which were decapsulated when splitting
out internal classes.
Bug: 37520921
Test: adb shell settings put global backup_refactored_service_disabled 0
&& adb reboot && adb shell bmgr backupnow --all
Change-Id: I9caa75b2f688de96bd5b245f43e0ae66cd9d023c
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
Also a bit of refactoring on TrampolineTestable and enable it for
presubmits.
Bug: 37520021
Test: manually ran the unit test.
Change-Id: I20214b70d3eb35017d50983bd8bebef93b66e839
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
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
This adds the test to FrameworksServicesTests test suite, which can be
run with the following command:
make FrameworksServicesTests -j &&
adb install -r ${OUT}/data/app/FrameworksServicesTests/FrameworksServicesTests.apk &&
adb shell am instrument -w -e package com.android.server.backup \
com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner
Bug: 37520021
Test: manually ran the test
Change-Id: I3f0dc50b0eb2ff2bc9360c68714c27e82b820897
The move was done automatically separately for each class. For the
classes that are not static, instance of RBMS is passed in the
constructor.
To make this compilable all methods and fields of RBMS that are accessed
from the separated classes were made public. In later commits this will
be addressed.
Test: built, flashed, verified that bmgr backupnow works with RBMS
enabled.
Bug: 36850431
Change-Id: I2d9be8bb045d5c4d8106bc59630d3a278138b54f
The unused variables got left behind after changes in ag/1841867.
This replicates ag/2077691 in RefactoredBackupManagerService.
Bug: 35994670
Test: it builds
Change-Id: Ic28719dafb83542d7e4c73cb48508d6792d10174
This lowers visibility of all fields and some methods which are not used
outside of the class.
Also this cleans up explicit generic arguments.
Test: compiled it successfully.
Bug: 36850431
Change-Id: I491687dbb84c1d9773c73884b8884b2dd9016ae7
RefactoredBackupManagerService is an exact clone of
BackupManagerService. Trampoline chooses between these two based on
backup_refactored_service_disabled global setting, defaulting to true.
Test: manual: flashed the device, ran `settings put global
backup_refactored_service_disabled 1|0`, verified that correct class was
instantiated, ran bmgr backupnow command to make sure that it works.
Bug: 36850431
Change-Id: I8ef91b928a40aae022f88f07a4126a00b1d5e220
Use it in Trampoline, KeyValueAdbBackupEngine, KeyValueAdbRestoreEngine
where it wasn't used automatically, because of using package-private
methods and fields. To be able to do this, also make couple of methods
public and move them to the interface and add getBackupManagerBinder()
method to use instead of directly accessing the field.
Test: not required as behaviour is not modified.
Bug: 36850431
Change-Id: Ia7a26f93f8dba37ece87305979c922acb58a271f