问题
I have a requirement to parse the AndroidManifest.xml of an app to find out what permissions a client app need to possess in order to communicate with this app. As per android developer guidelines the permission mentioned in the android:permission attribute of application tag and component (Activity, Service, Provider, Receiver) tag is supposed to be possessed by the client app. An example (AndroidManifest.xml excerpt) of this usage is
<application android:permission="android.permission.INTERNET">
...
</application>
In the aforementioned example, the client app should possess android.permission.INTERNET in order to communicate with this app.
My question is, this permission information is mentioned in the attribute of a tag. Hence I understand (I might be wrong) it is not possible to have more than one permission to be mentioned here. But it is quite possible that an app/ component could expect the client app/ component to possess more than one such a permission. For example, in the aforementioned case, the app could expect both android.permission.INTERNET and android.permission.ACCESS_WIFI_STATE permissions to be possessed by the client app. But there seems to be no room to specify this in the AndroidManifest.xml.
Please let me know whether it is possible to mandate the possession of more than one permission by a client app.
回答1:
Hence I understand (I might be wrong) it is not possible to have more than one permission to be mentioned here
Correct.
But there seems to be no room to specify this in the AndroidManifest.xml.
Correct.
I have a requirement to parse the AndroidManifest.xml of an app to find out what permissions a client app need to possess in order to communicate with this app
Technically, this is not possible, as apps can check for permissions at runtime (e.g., by calling checkCallingPermission()).
来源:https://stackoverflow.com/questions/18420994/multiple-permissions-in-androidpermisson