seedvault icon indicating copy to clipboard operation
seedvault copied to clipboard

GTS: contactsbackup: test failure caused by pre-granting contacts permissions

Open amartinz opened this issue 2 years ago • 4 comments

GTS tests verify pre-granted and default permissions.

It does not like contactsbackup to obtain the following permissions by default:

  • android.permission.READ_CONTACTS
  • android.permission.WRITE_CONTACTS

To pass GTS these permissions would need to be converted into runtime permissions.


Test

  • run gts-dev -m GtsPermissionTestCases --test com.google.android.permission.gts.DefaultPermissionGrantPolicyTest#testDefaultGrantsWithRemoteExceptions
  • run gts-dev -m GtsPermissionTestCases --test com.google.android.permission.gts.DefaultPermissionGrantPolicyTest#testPreGrantsWithRemoteExceptions
10-06 10:17:48.638 11845 11864 E TestRunner: failed: testDefaultGrantsWithRemoteExceptions(com.google.android.permission.gts.DefaultPermissionGrantPolicyTest)
10-06 10:17:48.638 11845 11864 E TestRunner: ----- begin exception -----
10-06 10:17:48.639 11845 11864 E TestRunner: java.lang.AssertionError: packageName: org.calyxos.backup.contacts {
10-06 10:17:48.639 11845 11864 E TestRunner:   priv app: false
10-06 10:17:48.639 11845 11864 E TestRunner:   targetSDK: 32
10-06 10:17:48.639 11845 11864 E TestRunner:   uid: 10113
10-06 10:17:48.639 11845 11864 E TestRunner:   persistent: false
10-06 10:17:48.639 11845 11864 E TestRunner:   signature: 4A765E535EFC55FF7C01964F6304BAE0FA5EE111F6E7A34DB3E071AAFE5D53C6
10-06 10:17:48.639 11845 11864 E TestRunner:   on system image: true
10-06 10:17:48.639 11845 11864 E TestRunner:   has platform signature: false
10-06 10:17:48.639 11845 11864 E TestRunner:   message: cannot be granted by default to package {
10-06 10:17:48.639 11845 11864 E TestRunner:     permission: android.permission.WRITE_CONTACTS
10-06 10:17:48.639 11845 11864 E TestRunner:     permission: android.permission.READ_CONTACTS
10-06 10:17:48.639 11845 11864 E TestRunner:   }
10-06 10:17:48.639 11845 11864 E TestRunner: }

amartinz avatar Oct 06 '22 08:10 amartinz

Did not see that coming.

This app is only used for local contact backup.

I'm not sure if we have a good way to have it ask for perms, but it could be done when setting up backup for the first time if not granted. Then you can simply exclude the default permissions grant file for GMS builds.

chirayudesai avatar Oct 06 '22 13:10 chirayudesai

I thought about a trampoline activity that can get launched by Seedvault when configuring contact backups, does that sound sane?

amartinz avatar Oct 06 '22 13:10 amartinz

I'll defer to @grote - but I'd like to add that Contact backups are enabled by default.

So when you first setup SeedVault, and turn on backups - it'll backup local contacts by default as well, don't need to turn on anything additional.

chirayudesai avatar Oct 06 '22 13:10 chirayudesai

Wow, The GTS test suite is rather strict. They want to keep all the good things for GMS, heh?

An activity to be launched from an error notification could work.

For now, maybe just don't include contactsbackup in your ROM, until the issue is resolved.

grote avatar Oct 06 '22 16:10 grote