Android R One-Time Permission Problem Really an Android Studio Problem

Last month, I wrote about an apparent bug in Android R, where one-time permission expiration sometimes kills alarms and jobs.

Google investigated and concluded that it is really an Android Studio problem. I can confirm their basic findings — the problem does not show up if you install and run the sample app from the command line, for example.

What is supposed to happen when a one-time permission is revoked is that the app’s process is terminated. This is in line with how other permission revocations are handled. Other than the process termination happening relatively rapidly after the app leaves the foreground, there is nothing unusual here.

Android Studio, though, does not feel that this is punitive enough. Studio wants to teach that app who is in charge. So, Studio uses adb to force-stop the app (somehow…) when it detects that a process that Studio started was terminated.

I do not know why Android Studio feels that it needs to be so mean.

Regardless, this means that the original problem should only happen during development, not in production. This may complicate app development work, but it should not harm users. While this is not ideal, it is much better than what I was fearing.

Many thanks to Nicole Borelli and the rest of the Google team that investigated the problem!