Jake
Jake

Reputation: 16847

Android ACCESS_LOCATION_EXTRA_COMMANDS permission uses

Android contains a permission called 'ACCESS_LOCATION_EXTRA_COMMANDS'. Normal location commands would involve accessing coarse/fine location. Does anyone know what kind of extra commands this permission allows the app to access ?

Thanks.

Upvotes: 26

Views: 18672

Answers (3)

Solomon Ucko
Solomon Ucko

Reputation: 6109

Go to https://cs.android.com/android/platform/superproject/+/master:frameworks/base/services/core/java/com/android/server/location/provider/AbstractLocationProvider.java;drc=master;bpv=1;bpt=1;l=353, click on onExtraCommand if you don't see the "References" panel at the bottom, scroll down to "Overriden By", and click on each implementation to see what commands it supports.

Here's a list of commands supported by GnssLocationProvider (since all of the other implementations seem to do nothing or delegate to another one):

  • delete_aiding_data: calls deleteAidingData
  • force_time_injection: calls requestUtcTime
  • force_psds_injection: sends a DOWNLOAD_PSDS_DATA message if mSupportsPsds is true
  • request_power_stats: calls requestPowerStats

Upvotes: 1

Oasis Feng
Oasis Feng

Reputation: 7520

According to a rough search in Android source code, it indicate that LocationManager.sendExtraCommand() need this permission exactly.

Documentation: sendExtraCommand(java.lang.String, java.lang.String, android.os.Bundle)

Upvotes: 17

Zekitez
Zekitez

Reputation: 411

I only know of 1 command which can be uses when you have a slow GPS fix:

((LocationManager)YourActivity.this.getSystemService("location")).sendExtraCommand("gps", "delete_aiding_data", null);

and in the Manifest:

<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />

Upvotes: 22

Related Questions