永远不会再授予Android权限保护级别“正常”

时间:2019-03-21 13:28:31

标签: android android-permissions

在测试Android API 28时,我遇到了一个错误,每当定义保护级别为normal的自定义权限的应用程序被卸载时,所有未定义此权限但在清单中请求此权限的其他应用程序都不会重新-即使在系统重启后也授予了此权限(令人惊讶的是,即使该应用程序重新定义了这种权限!)。可以通过用户提示来重新授予危险权限,并且像往常一样自动重新授予签名权限。这种行为是预期的还是异常的?

EVENT: Applications installed (in-order) : App1, App2, App3

App1's Manifest: <permission android:name="X"
    android:protectionLevel="signature"/>
<permission android:name="Y/>
<permission android:name="Z"
    android:protectionLevel="dangerous"/>

<uses-permission android:name="X"/>
<uses-permission android:name="Y"/>
<uses-permission android:name="Z"/>

App1's request: requestPermissions(new String[] "Z"},1);

App1's permissions granted : X,Y & Z are granted (Z after user-prompt)

////////////////////////////////////////////////

App2's Manifest: <permission android:name="X"
    android:protectionLevel="signature"/>
<permission android:name="Y/>
<permission android:name="Z"
    android:protectionLevel="dangerous"/>

<uses-permission android:name="X"/>
<uses-permission android:name="Y"/>
<uses-permission android:name="Z"/>

App2's request: requestPermissions(new String[]{"Z"},1);

App2's permissions granted: X, Y & Z (Z after user-prompt)
////////////////////////////////////////////////
App3's manifest:
<uses-permission android:name="X"/>
<uses-permission android:name="Y"/>
<uses-permission android:name="Z"/>

App3's request: requestPermissions(new String[]{"Z"},1);

App3's permissions granted: X, Y & Z (Z after user-prompt)
////////////////////////////////////////////////
EVENT: Uninstalled App1
////////////////////////////////////////////////
App2 Permissions Granted: X & Z (Z after user-prompt; permission Y not 
granted even if this application re-defines it, and the permission Y exists 
on device - checked via "pm list permissions")
////////////////////////////////////////////////
App3 Permissions Granted: X & Z (Z after user-prompt; permission Y not 
granted even if the permission Y exists on device - checked via 
"pm list permissions")
////////////////////////////////////////////////

这是Android OS的预期行为吗?

0 个答案:

没有答案