Some changes were needed to the original code:
- Guava's EqualsTester tests are replaced by regular equals tests.
- Guava's primitives.UnsignedBytes.LexicographicalComparator needed to
be copied over, as no corresponding comparator exists in the framework.
Bug: 111386661
Test: atest RunFrameworksServicesRoboTests
Change-Id: I24fef4b47f7777b9be0c2e51f0be48e45b323987
In full backup, we backup additional metadata about the app
(manifest, widget, apk, obb) not specified by the app's backup agent.
This CL extracts these methods out to their own helper (AppMetadataBackupWriter)
and adds unit tests for these methods.
** Note: The backup behavior is the same, only the structure has changed.
Behavioral changes will be done in future CLs. **
What this CL covers:
- Move the backup of this extra app data out of the FullBackupEngine to
separate agent data backup and non-agent data backup.
- Move logic of deciding what data to backup from FullBackupEngine to
FullBackupRunner (where the writer is used).
- Add unit tests for metadata backup.
- Some style fixes/clean up.
Not covered (future CLs):
- Refactoring FullBackupEngine/FullBackupRunner mechanism.
- Streaming backup data directly instead of writing to temporary files.
- Separating out and fixing apk and obb backup.
Bug: 110081582
Test: 1) atest AppDataBackupWriterTest
2) atest RunFrameworksServicesRoboTests
3) atest GtsBackupHostTestCases
4) Verify success for:
- adb shell bmgr backupnow <full backup package>; adb restore 1 <full
backup package>
- adb backup <full backup package>; adb restore
- cloud backup and restore
5) Use local transport and adb backup to inspect manifest and widget data
written and file metadata consistent between runs.
6) Verify compatibility with adb backup -keyvalue manifest
Change-Id: Icb43fd2e0505c2416738ee3ef370b206363fac68
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)
This change sets LOCAL_SDK_VERSION for all packages where
this is possible without breaking the build, and
LOCAL_PRIVATE_PLATFORM_APIS := true otherwise.
Setting one of these two will be made required soon, and this
is a change in preparation for that. Not setting LOCAL_SDK_VERSION
makes the app implicitly depend on the bootclasspath, which is
often not required. This change effectively makes depending on
private apis opt-in rather than opt-out.
Test: make relevant packages
Bug: 73535841
Exempt-From-Owner-Approval: Global cleanup
Change-Id: I26458e41ecb84de91ac9a356a5d4bafb44f463c1
for <include /> rules in <full-backup-content> specification
Give an app developer the option to include files based on the
transport flags exposed by the transport. This allows conditionally
including files as long as the transport identifies itself as
for instance encrypted or device-to-device.
Extend the parsing mechanism to read optional requiredFlags
attributes, and extend existing structures to encompass
that data for BackupAgent to retrieve and act on it
based on FullBackupDataOutput#getTransportFlags().
-- Changes in robotests/
The old version of this CL (that already got reverted) broke our Robolectric
suite because it added an inner class to FullBackup and a dependency on it from
BackupAgent. FullBackup wasn't being built from Android tree (instead it was in
a prebuilt Robolectric snapshot jar of the framework) but BackupAgent was,
which resulted in not finding the inner class.
So, also in this CL. Changing our tests to include everything under
platform/base/core/java/android/app/backup from Android tree.
`m -j RunFrameworksServicesRoboTests` is green now
Bug: 72484288
Test: m -j RunFrameworksServicesRoboTests
Test: runtest frameworks-core -c android.app.backup.FullBackupTest
Test: make cts -j40 && cts-tradefed run cts -m CtsBackupHostTestCases -t android.cts.backup.FullbackupRulesHostSideTest
Change-Id: Ideaed59f8337257aa6a882ff0ce80c170b17d55e
This allows a BackupAgent to check whether the transport has client-side
encryption enabled. It can then use this information to decide whether
to back up more sensitive data.
Bug: 72299360
Test: Manually verified full & kv backup agents receive transport flags
Test: m -j RunFrameworksServicesRoboTests
Change-Id: Ibd9b5f9479815e1721e9d6b7663d892b9ab3fcae
To be able to migrate Robolectric and bump SDK we have to load our classes from
the system class loader instead of the android jars. This wasn't a
problem before because the classes weren't in the jars correspondent to the old
SDK that the tests were using. To be able to do this I created a custom test
runner and a custom annotation to be used in tests to load the specified
classes from the system class loader. Check comments on file. Also, made changes
to be compatible with new Robolectric version and bumped SDK.
Bug: 69254249
Test: m -j RunFrameworksServicesRoboTests
Change-Id: I538ef70cfae8ebeea047f275b9920cb2e814f4da
The previous default version was 3.1.1, so specifying all existing
projects to that. Please migrate to new version (3.4.2 as of today)
at your convenience.
See robolectric.org/migrating for instructions on migrating.
Test: m RunFrameworksServicesRoboTests RunCarMessengerRoboTests \
RunStorageManagerRoboTests RunCarSettingsRoboTests \
RunEmergencyInfoRoboTests RunManagedProvisioningRoboTests \
RunTurboRoboTests RunStorageManagerGoogleRoboTests \
RunBluetoothRoboTests
Change-Id: Ife5a39b81206ec475bba5c4042258a37ad24707d
* Our test target uses default roboletric target
(platform-robolectric-prebuilt), which is 3.1.1.
* Runner was updated to 3.4.2 recently (ag/3181301).
* `make RunFrameworksServicesRoboTests` broke because
org.robolectric.res.builder.DefaultPackageManager doesn't exist in new
verion (http://robolectric.org/migrating/#packagemanager-1).
Hardcoded version in our target until we migrate to new version (I tried
but there were some other errors)
Test: make RunFrameworksServicesRoboTests
Change-Id: Ie934dedec3340620611f3d72b75e5eefba430f35
In preparation for transport-related tests needed to make those fixes so
that Mockito annotations would work.
1. Switched from mockito-target-minus-junit4 to
mockito-robolectric-prebuilt. Otherwise we would get dexcache == null
error (similar to
https://groups.google.com/a/google.com/forum/#!topic/robolectric-users/gV0_59Kj2ME/discussion)
2. Removed unused frameworks-base-testutils because it included the
ill-suited mockito dependency (as per 1).
3. Tidied up by moving test dependencies to actual test target.
Test: make RunFrameworksServicesRoboTests
Change-Id: Idd4f13a9aa0327d74b58361ad02aa3313d30ac99
Dependency on platform-system-robolectric is not needed when mockito
is not necessary.
If mockito is needed, add a static dependency on
mockito-robolectric-prebuilt.
Test: m RunFrameworksServicesRoboTests
Bug: 38456058
Change-Id: I60ac070125cf157225247561336288dfe97789c6
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