Merge "Dump location noteOp with location off" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
6ad1b191f7
@@ -70,6 +70,7 @@ import android.location.provider.IProviderRequestListener;
|
|||||||
import android.location.provider.ProviderProperties;
|
import android.location.provider.ProviderProperties;
|
||||||
import android.location.util.identity.CallerIdentity;
|
import android.location.util.identity.CallerIdentity;
|
||||||
import android.os.Binder;
|
import android.os.Binder;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.ICancellationSignal;
|
import android.os.ICancellationSignal;
|
||||||
import android.os.ParcelFileDescriptor;
|
import android.os.ParcelFileDescriptor;
|
||||||
@@ -350,6 +351,22 @@ public class LocationManagerService extends ILocationManager.Stub {
|
|||||||
void onSystemReady() {
|
void onSystemReady() {
|
||||||
mInjector.getSettingsHelper().addOnLocationEnabledChangedListener(
|
mInjector.getSettingsHelper().addOnLocationEnabledChangedListener(
|
||||||
this::onLocationModeChanged);
|
this::onLocationModeChanged);
|
||||||
|
|
||||||
|
if (Build.IS_DEBUGGABLE) {
|
||||||
|
// on debug builds, watch for location noteOps while location is off. there are some
|
||||||
|
// scenarios (emergency location) where this is expected, but generally this should
|
||||||
|
// rarely occur, and may indicate bugs. dump occurrences to logs for further evaluation
|
||||||
|
AppOpsManager appOps = Objects.requireNonNull(
|
||||||
|
mContext.getSystemService(AppOpsManager.class));
|
||||||
|
appOps.startWatchingNoted(
|
||||||
|
new int[]{AppOpsManager.OP_FINE_LOCATION, AppOpsManager.OP_COARSE_LOCATION},
|
||||||
|
(code, uid, packageName, attributionTag, flags, result) -> {
|
||||||
|
if (!isLocationEnabledForUser(UserHandle.getUserId(uid))) {
|
||||||
|
Log.w(TAG, "location noteOp with location off - "
|
||||||
|
+ CallerIdentity.forTest(uid, 0, packageName, attributionTag));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void onSystemThirdPartyAppsCanStart() {
|
void onSystemThirdPartyAppsCanStart() {
|
||||||
|
|||||||
Reference in New Issue
Block a user