Merge "Workaround undocumented AppOps behavior" into sc-v2-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
ef968723a5
@@ -131,8 +131,8 @@ public class GeofenceManager extends
|
||||
return mPermitted;
|
||||
}
|
||||
|
||||
boolean onLocationPermissionsChanged(String packageName) {
|
||||
if (getIdentity().getPackageName().equals(packageName)) {
|
||||
boolean onLocationPermissionsChanged(@Nullable String packageName) {
|
||||
if (packageName == null || getIdentity().getPackageName().equals(packageName)) {
|
||||
return onLocationPermissionsChanged();
|
||||
}
|
||||
|
||||
@@ -242,7 +242,7 @@ public class GeofenceManager extends
|
||||
mLocationPermissionsListener =
|
||||
new LocationPermissionsHelper.LocationPermissionsListener() {
|
||||
@Override
|
||||
public void onLocationPermissionsChanged(String packageName) {
|
||||
public void onLocationPermissionsChanged(@Nullable String packageName) {
|
||||
GeofenceManager.this.onLocationPermissionsChanged(packageName);
|
||||
}
|
||||
|
||||
@@ -494,7 +494,7 @@ public class GeofenceManager extends
|
||||
updateRegistrations(registration -> registration.getIdentity().getUserId() == userId);
|
||||
}
|
||||
|
||||
void onLocationPermissionsChanged(String packageName) {
|
||||
void onLocationPermissionsChanged(@Nullable String packageName) {
|
||||
updateRegistrations(registration -> registration.onLocationPermissionsChanged(packageName));
|
||||
}
|
||||
|
||||
|
||||
@@ -119,8 +119,8 @@ public abstract class GnssListenerMultiplexer<TRequest, TListener extends IInter
|
||||
*/
|
||||
protected void onGnssListenerUnregister() {}
|
||||
|
||||
boolean onLocationPermissionsChanged(String packageName) {
|
||||
if (getIdentity().getPackageName().equals(packageName)) {
|
||||
boolean onLocationPermissionsChanged(@Nullable String packageName) {
|
||||
if (packageName == null || getIdentity().getPackageName().equals(packageName)) {
|
||||
return onLocationPermissionsChanged();
|
||||
}
|
||||
|
||||
@@ -197,7 +197,7 @@ public abstract class GnssListenerMultiplexer<TRequest, TListener extends IInter
|
||||
mLocationPermissionsListener =
|
||||
new LocationPermissionsHelper.LocationPermissionsListener() {
|
||||
@Override
|
||||
public void onLocationPermissionsChanged(String packageName) {
|
||||
public void onLocationPermissionsChanged(@Nullable String packageName) {
|
||||
GnssListenerMultiplexer.this.onLocationPermissionsChanged(packageName);
|
||||
}
|
||||
|
||||
@@ -390,7 +390,7 @@ public abstract class GnssListenerMultiplexer<TRequest, TListener extends IInter
|
||||
updateRegistrations(registration -> registration.getIdentity().getUserId() == userId);
|
||||
}
|
||||
|
||||
private void onLocationPermissionsChanged(String packageName) {
|
||||
private void onLocationPermissionsChanged(@Nullable String packageName) {
|
||||
updateRegistrations(registration -> registration.onLocationPermissionsChanged(packageName));
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.android.server.location.injector;
|
||||
|
||||
import static com.android.server.location.LocationPermissions.PERMISSION_NONE;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.location.util.identity.CallerIdentity;
|
||||
|
||||
import com.android.server.location.LocationPermissions;
|
||||
@@ -36,9 +37,10 @@ public abstract class LocationPermissionsHelper {
|
||||
public interface LocationPermissionsListener {
|
||||
|
||||
/**
|
||||
* Called when something has changed about location permissions for the given package.
|
||||
* Called when something has changed about location permissions for the given package. A
|
||||
* null package indicates this affects every package.
|
||||
*/
|
||||
void onLocationPermissionsChanged(String packageName);
|
||||
void onLocationPermissionsChanged(@Nullable String packageName);
|
||||
|
||||
/**
|
||||
* Called when something has changed about location permissions for the given uid.
|
||||
|
||||
@@ -528,8 +528,8 @@ public class LocationProviderManager extends
|
||||
}
|
||||
|
||||
@GuardedBy("mLock")
|
||||
final boolean onLocationPermissionsChanged(String packageName) {
|
||||
if (getIdentity().getPackageName().equals(packageName)) {
|
||||
final boolean onLocationPermissionsChanged(@Nullable String packageName) {
|
||||
if (packageName == null || getIdentity().getPackageName().equals(packageName)) {
|
||||
return onLocationPermissionsChanged();
|
||||
}
|
||||
|
||||
@@ -1373,7 +1373,7 @@ public class LocationProviderManager extends
|
||||
private final LocationPermissionsListener mLocationPermissionsListener =
|
||||
new LocationPermissionsListener() {
|
||||
@Override
|
||||
public void onLocationPermissionsChanged(String packageName) {
|
||||
public void onLocationPermissionsChanged(@Nullable String packageName) {
|
||||
LocationProviderManager.this.onLocationPermissionsChanged(packageName);
|
||||
}
|
||||
|
||||
@@ -2366,7 +2366,7 @@ public class LocationProviderManager extends
|
||||
}
|
||||
}
|
||||
|
||||
private void onLocationPermissionsChanged(String packageName) {
|
||||
private void onLocationPermissionsChanged(@Nullable String packageName) {
|
||||
synchronized (mLock) {
|
||||
updateRegistrations(
|
||||
registration -> registration.onLocationPermissionsChanged(packageName));
|
||||
|
||||
Reference in New Issue
Block a user