From d879ec9443a72fa93979da4544082074e5288468 Mon Sep 17 00:00:00 2001 From: Soonil Nagarkar Date: Wed, 8 Apr 2020 14:03:54 -0700 Subject: [PATCH] Rename ILocationProviderManager method Test: presubmit Change-Id: Ib2b0fd5c2065e85b390815fad6a2d7e04b81afb7 --- .../location/ILocationProviderManager.aidl | 2 +- .../provider/LocationProviderBase.java | 8 ++++---- .../fused/tests/FusedLocationServiceTest.java | 2 +- .../server/location/LocationProviderProxy.java | 18 ++++++++---------- 4 files changed, 14 insertions(+), 16 deletions(-) diff --git a/location/java/com/android/internal/location/ILocationProviderManager.aidl b/location/java/com/android/internal/location/ILocationProviderManager.aidl index 1bdedd57f3214..4036d63905ead 100644 --- a/location/java/com/android/internal/location/ILocationProviderManager.aidl +++ b/location/java/com/android/internal/location/ILocationProviderManager.aidl @@ -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); diff --git a/location/lib/java/com/android/location/provider/LocationProviderBase.java b/location/lib/java/com/android/location/provider/LocationProviderBase.java index 624e8d1b702b2..25b4090187a48 100644 --- a/location/lib/java/com/android/location/provider/LocationProviderBase.java +++ b/location/lib/java/com/android/location/provider/LocationProviderBase.java @@ -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); diff --git a/packages/FusedLocation/test/src/com/android/location/fused/tests/FusedLocationServiceTest.java b/packages/FusedLocation/test/src/com/android/location/fused/tests/FusedLocationServiceTest.java index 38f3bcdb62fe1..ed7f3df5222d0 100644 --- a/packages/FusedLocation/test/src/com/android/location/fused/tests/FusedLocationServiceTest.java +++ b/packages/FusedLocation/test/src/com/android/location/fused/tests/FusedLocationServiceTest.java @@ -199,7 +199,7 @@ public class FusedLocationServiceTest { } @Override - public void onSetFeatureId(String featureId) { + public void onSetAttributionTag(String attributionTag) { } diff --git a/services/core/java/com/android/server/location/LocationProviderProxy.java b/services/core/java/com/android/server/location/LocationProviderProxy.java index 696b571f419ac..7c114bd20c6d5 100644 --- a/services/core/java/com/android/server/location/LocationProviderProxy.java +++ b/services/core/java/com/android/server/location/LocationProviderProxy.java @@ -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)); } }