Which permissions do not stay upon upgrade to targetSdk 23 or Android 6?
Asked Answered
Q

0

13

Background

I remember that it was told (on one of Google's videos) that if the previous version of the app was updated to have targetSdk 23 on the new version, ALL permissions that were granted before - will stay granted now.

So, for example, if you installed an app with targetSdk 22, that required a permission to read from the contacts, then even after an upgrade of the app, to one with targetSdk 23, it will stay this way.

The reason is simple: the user already granted the permissions upon install.

The problem

According to what I've found, there is an exception to this rule:

If your app had the permission SYSTEM_ALERT_WINDOW , and now you upgrade to targetSdk 23, it gets revoked (reset), and you need to request it from the the user.

This behavior isn't mentioned anywhere in the docs:

And also not in any video I've watched.

The only thing that's mentioned about SYSTEM_ALERT_WINDOW permission, is that you need to handle them differently, using ACTION_MANAGE_OVERLAY_PERMISSION to request the permission, and Settings.canDrawOverlays(...) to check if the permission is granted

What I've tried

I tried to contact Google about this issue, and they said it's intentional:

I spoke with the development team and the behavior you're seeing is working as intended. This is documented here: http://developer.android.com/reference/android/Manifest.permission.html#SYSTEM_ALERT_WINDOW

The protection level of SYSTEM_ALERT_WINDOW was raised in Android M.

The questions

  1. Are there other permissions that have this behavior?

  2. What would happen, if the app had targetSdk 22/23, and there was an upgrade of the OS to Android 6 ? Will the SYSTEM_ALERT_WINDOW (or any other permission) get revoked?

  3. Pretty sure other stuff will stay granted, but I'd like to ask anyway: What about other special permissions-like features, such as : SAF, admin, usage-access, accessibility access, notification access, ... ?


EDIT: about #2, here's the answer from Google (link here):

On OS upgrade the app should keep SYSTEM_ALERT_WINDOW. Pre-API 23 apps have the permission by default, as opposed to API 23 Apps that are off by default. However, there is a known bug that for API 23 Apps they were losing SYSTEM_ALERT_WINDOW on upgrade. The recommendation for a developer is to always check the status of SYSTEM_ALERT_WINDOW at start and if not granted, direct the user to Settings. We will be fixing the issue in a future release.

Quadrille answered 26/11, 2015 at 12:9 Comment(8)
"Are there other permissions that have this behavior?" -- as you note, this stuff is undocumented. I would expect that WRITE_SETTINGS has the same behavior as you describe, as it changed in the same way. "Will the SYSTEM_ALERT_WINDOW (or any other permission) get revoked?" -- I have no idea. I avoid those permissions like the plague. "What about other special permissions-like features" -- I wouldn't expect explicit opt-ins to be lost (accessibility service activation, notification service activation, device admin activation, etc.). Beyond that, I have no idea.Thresher
@Thresher So the only special permission that you think would behave the same way is "WRITE_SETTINGS" ? Is it because it has the same level?Quadrille
@MsYvette Please read the question I wrote. I've already mentioned what I've found .Quadrille
My theory on WRITE_SETTINGS is that they made the same change as they did with SYSTEM_ALERT_WINDOW -- users have to opt in manually through Settings > App > (Advanced gear icon). It stands to reason that it would behave the same in other respects. That being said, it is an educated guess, nothing more.Thresher
@MsYvette: "I mean explicit permissions" -- sorry, but I am uncertain what you mean here. if you have additional concerns, you are probably better off asking a separate Stack Overflow question.Thresher
@Thresher About "WRITE_SETTINGS", if it is this way, then it's even less documented. But it actually does make sense.Quadrille
@Thresher Actually, I've found now that you yourself has written about it: https://mcmap.net/q/223936/-can-39-t-get-write_settings-permissionQuadrille
@Thresher And, this is what the docs say about this: developer.android.com/reference/android/… . So I think you are correct.Quadrille

© 2022 - 2024 — McMap. All rights reserved.