Coordinates from 'dumpsys location' are censored on Huawei devices I'd like to read coordinates from my Huawei P30 Pro via ADB by calling adb shell dumpsys location. However, the output is like:

Last Known Locations:
   gps: Location[gps 11******,14****** ...


They are censored with stars even though the GPS is already turned on.

Any idea?
It looks like this is a modification that Huawei did by themselves (factual reasons not yet found). In short, the method to print the location's detail was overwritten.

dumpsys command calls the system services' dump method (more detail on this answer on Stack Overflow), and for dumpsys location, the respective service is LocationManagerService.

The dump() method for LocationManagerService (in Android 10, but also no major differences on previous versions) contains code like this:

...

pw.println("  Last Known Locations:");
for (Map.Entry&lt;String, Location&gt; entry : mLastLocation.entrySet()) {
    String provider = entry.getKey();
    Location location = entry.getValue();
    pw.println("    " + provider + ": " + location);
}

...


where it will iterate the last known locations from all location providers and print the name of the provider and its location. Note that the location is an instance of Location objects.

By default, the method to print the detail of the Location object (toString()) contains code like this:

@Override
public String toString() {
    StringBuilder s = new StringBuilder();
    s.append("Location[");
    s.append(mProvider);
    s.append(String.format(" %.6f,%.6f", mLatitude, mLongitude));
    ...


where it will print the latitude and longitude in 6 decimal digits.

For many devices, this is the standard behavior, as shown on Nexus 5 with LineageOS 14.1 (Android 7.1):

 Last Known Locations:
    ...
    fused: Location[fused 1.234567,101.010101 acc=500 et=+12h00m00s000ms]
    ...


The numbers are changed due to privacy reason

By overriding the method, OEMs can customize how dumpsys will display the content. (Note: while Android requires some services not to be modified, location is not one of them)