Files
Joël Stemmer 24fe7026f4 Create reader and writer of the cross-platform manifest file
The cross-platform manifest serves a similar purpose as the full backup
manifest (see the AppMetadataBackupWriter class). It will store some
additional metadata in the full backup TAR file that is meant to be used
for validation. On export, the target platform validates that the
specified bundle id and target id matches an installed app. On import,
we will validate that the data received matches the installed app and
its signature.

Since the metadata stored in the manifest is different than the existing
manifest we will store it in a separate file that's only present when
the transport indicates a cross-platform transfer is taking place. The
code writing the cross-platform manifest on backup and validating its
contents on restore will be added in the follow-up changes.

Bug: 432673356
Test: atest CrossPlatformManifestTest.java
Test: atest CrossPlatformManifestParserTest.java
Flag: com.android.server.backup.enable_cross_platform_transfer
Change-Id: I02019edcbebf49814f810e051211fe98fd47abb6
2025-09-11 23:09:16 +00:00
..
…

This folder is for Robolectric tests inside the platform.

To add a test class annotate it as follows:

@RunWith(FrameworkRobolectricTestRunner.class)
@Config(manifest = Config.NONE, sdk = 26)
@SystemLoaderClasses({ClassUnderTest.class, DependencyClasses.class})
@SystemLoaderPackages({"com.android.server.yourmodule"})

Robolectric loads some classes that it decides from versioned jars of the framework. Since we are
part of the framework some of our classes get loaded from these jars. This is NOT what we want, we
want to test against what we wrote in the tree. Because of this we use a custom test runner,
FrameworkRobolectricTestRunner, that bypasses these jars and loads certain classes from the system
class loader.

To specify which classes to load use either @SystemLoaderClasses or @SystemLoaderPackages. In
practice:
* You MUST put the class under test here.
* If you encounter any exceptions that might be caused by a different version of the class being
loaded, such as NoSuchMethodException, put the class involved in the exception in this annotation
and try again.

Check Android.mk file for more info.