Create platform config parser and use it to check backup eligibility
When the transport is doing a cross-platform transfer, we only allow apps that have explicitly opted-in to cross-platform transfer via their data extraction rules to back up. The only exception is the `@pm@` key-value backup because that is required for all backups. While the data extraction rules are a good place to have cross-platform specific configuration, this was originally only used by the full backup implementation in the backup agent. Ideally we would re-use the existing parsing code in FullBackup.BackupScheme, however this class currently assumes it is running in the context of the application being backed up. The eligibility checks are done in the system server, so we can't directly use the existing BackupScheme class. This is why I've re-implemented part of the parsing in a separate class, which is isolated to the code that only runs as part of cross-platform transfer. Ideally we would remove the dependency on the application context from BackupScheme and combine the parsers in the future, I've filed b/439533655 to track this work. Note: the code in this change only triggers when the backup transport is doing a cross-platform transfer, this is a new API that is flagged. Existing transports do not yet set this transport flag, but this will be rolled out behind their own feature flags. Flag: com.android.server.backup.enable_cross_platform_transfer Bug: 432673356 Test: atest BackupEligibilityRulesTest Test: atest PlatformConfigParserTest Test: manual testing Change-Id: I419a492a677d3098d7704805a6e85550df140bb6
Loading
Please register or sign in to comment