How does Android restrict the permissions of dependent packages?

I have only a few permissions on my own app, now, because I don"t need it.
but depends on a third-party package that opens permissions that I don"t need, such as geolocation permissions.
can I make changes in my code without touching the code of the third-party package to disable geolocation permissions?

the AndroidManifest.xml section of my App about permissions:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.CAMERA"/>

you can see that only 3 permissions are opened, but when you open app, you always have to ask whether to grant geolocation permissions. I was puzzled, so I checked the code and found that AndroidManifest.xml in a dependent package has:

.
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.GET_TASKS" />

so can I just change my own code to disable some unnecessary permissions?
does not change the code of the third-party package because the third-party package is not under the management of git, and the dependency will have to be changed manually when it is reinstalled.

Mar.02,2021

declare the permissions you want to revoke, and add tools:node= "remove" try

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" tools:node="remove"/>

reference: https://developer.android.com.


the list file does not give location permission.


Please try this https://github.com/oasisfeng/.

.
Menu