Multi-Window and Permission Revocation

While helping somebody with questions about revoking Android 6.0+ runtime permissions, a thought popped into mind: what happens when you revoke permissions from an app that is still visible?

In Android 6.0, this wasn’t very practical. Most users would revoke permissions via the Settings app, which would take over the foreground. Any app whose permissions would be revoked would either be in the background or not running. The fact that the app’s process would be terminated due to the permission revocation would be indistinguishable from any other process termination (e.g., freeing system RAM). While there are device owner APIs for fussing with runtime permissions that could be called from the background, that’s not a common scenario, at least at the moment.

However, in Android 7.0, we have multi-window.

So, I fired up one of my sample apps in one side of the split-screen. In the other side, I ran the Settings app, and I used that to revoke a runtime permission from the app in the other split-screen pane.

The result: Android terminated the process of my app, closing its window and kicking the device out of split-screen mode, leaving me with just the Settings app.

The process termination is to be expected. This illustrates, though, that we can have our permission revoked while we are in the foreground, though this is still unlikely.

The collapsing of the split-screen mode is visually disturbing, but it is not show-stopping. It will be interesting to see what happens in a device with free-form multi-window mode, if and when such devices become available.

Learn second-generation Android app development — with Kotlin and the Android Jetpack — through CommonsWare’s Android app development training!