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
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
This is part of (mostly) automated refactoring of BackupManagerService, see go/br-bm-automated-refactor.
All done automatically with https://www.jetbrains.com/help/idea/2016.3/extract-interface.html
Test: not required, as this doesn't change any behaviour.
Bug: 36850431
Change-Id: I1efa15b0f600536a9fd555bed18f2e86c3bcfecb
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