AdevintaSpain/Barista

Plugin Update Recommended: Android Gradle Plugin is ready to update.

alorma opened this issue · 3 comments

Android Studio complains about android gradle plugin update...

We should update AGP without braking anything

I have an issue that's related, thought I'd add here rather than open a new one. I'm not 100% sure this is a barista issue or not, need to do some more testing.

With AGP4.1.0, activities are now apparently started in espresso tests with required permissions already granted.

I have a test that launches a "welcome" activity, one step of which is to ask for ACCESS_FINE_LOCATION. If that permission is not present, the user can click a 'fix' button to request, and I test this flow using barista's PermissionGranter.

Up to 4.0.2, this test works because the activity is started with no permissions. The app detects this, enables the fix button, so the test can press it and all goes well. However, updating to 4.1.0, the permission already seems to be granted. Specifically, the output of ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) is 0 (granted) rather than -1 (denied). So now my test to check the flow of asking for and granting permissions doesn't work.

I'm using barista in a pretty standard way, with BaristaRule.create(), baristaRule.launchActivity() at the top of the test and AndroidJUnit4 as a runner. I'm going to try and set up a simple project that tests this without barista to see if this is a barista-specific behaviour, but I wonder if you'd also be able to reproduce or had already noticed this?

Sloy commented

Hi @growse! I saw that same behavior as you did. I opened an issue for Google, since this change doesn't seem to be documented and I can't see any way around it. But I got no response :(

I'm going to ping them again.
https://issuetracker.google.com/issues/168642903

Amazing - I was just about to do the same thing, but will +1 yours rather than duplicate. I'll stick to 4.0.2 for the moment until... something happens?