Rename ILocationProviderManager method

Test: presubmit
Change-Id: Ib2b0fd5c2065e85b390815fad6a2d7e04b81afb7
This commit is contained in:
Soonil Nagarkar
2020-04-08 14:03:54 -07:00
parent 92684eb633
commit d879ec9443
4 changed files with 14 additions and 16 deletions

View File

@@ -26,7 +26,7 @@ import com.android.internal.location.ProviderProperties;
*/
interface ILocationProviderManager {
void onSetFeatureId(String featureId);
void onSetAttributionTag(String attributionTag);
@UnsupportedAppUsage
void onSetAllowed(boolean allowed);

View File

@@ -79,7 +79,7 @@ public abstract class LocationProviderBase {
public static final String FUSED_PROVIDER = LocationManager.FUSED_PROVIDER;
final String mTag;
final String mFeatureId;
final String mAttributionTag;
final IBinder mBinder;
/**
@@ -116,7 +116,7 @@ public abstract class LocationProviderBase {
public LocationProviderBase(Context context, String tag,
ProviderPropertiesUnbundled properties) {
mTag = tag;
mFeatureId = context != null ? context.getFeatureId() : null;
mAttributionTag = context != null ? context.getAttributionTag() : null;
mBinder = new Service();
mLocationManager = ILocationManager.Stub.asInterface(
@@ -332,8 +332,8 @@ public abstract class LocationProviderBase {
public void setLocationProviderManager(ILocationProviderManager manager) {
synchronized (mBinder) {
try {
if (mFeatureId != null) {
manager.onSetFeatureId(mFeatureId);
if (mAttributionTag != null) {
manager.onSetAttributionTag(mAttributionTag);
}
manager.onSetProperties(mProperties);
manager.onSetAllowed(mAllowed);

View File

@@ -199,7 +199,7 @@ public class FusedLocationServiceTest {
}
@Override
public void onSetFeatureId(String featureId) {
public void onSetAttributionTag(String attributionTag) {
}

View File

@@ -19,7 +19,6 @@ package com.android.server.location;
import static com.android.internal.util.ConcurrentUtils.DIRECT_EXECUTOR;
import android.annotation.Nullable;
import android.content.ComponentName;
import android.content.Context;
import android.location.Location;
import android.location.util.identity.CallerIdentity;
@@ -136,21 +135,21 @@ public class LocationProviderProxy extends AbstractLocationProvider {
// executed on binder thread
@Override
public void onSetFeatureId(String featureId) {
public void onSetAttributionTag(String attributionTag) {
synchronized (mLock) {
if (mProxy != this) {
return;
}
ComponentName service = mServiceWatcher.getBoundService().component;
if (service == null) {
String packageName = mServiceWatcher.getBoundService().getPackageName();
if (packageName == null) {
return;
}
// we don't need to verify the package name because we're getting it straight from
// the service watcher
CallerIdentity identity = CallerIdentity.fromBinderUnsafe(mContext,
service.getPackageName(), featureId);
CallerIdentity identity = CallerIdentity.fromBinderUnsafe(mContext, packageName,
attributionTag);
setIdentity(identity);
}
}
@@ -165,12 +164,11 @@ public class LocationProviderProxy extends AbstractLocationProvider {
// if no identity is set yet, set it now
if (getIdentity() == null) {
ComponentName service = mServiceWatcher.getBoundService().component;
if (service != null) {
String packageName = mServiceWatcher.getBoundService().getPackageName();
if (packageName != null) {
// we don't need to verify the package name because we're getting it
// straight from the service watcher
setIdentity(CallerIdentity.fromBinderUnsafe(mContext,
service.getPackageName(), null));
setIdentity(CallerIdentity.fromBinderUnsafe(mContext, packageName, null));
}
}