Loading services/core/java/com/android/server/location/provider/AbstractLocationProvider.java +4 −0 Original line number Diff line number Diff line Loading @@ -305,6 +305,10 @@ public abstract class AbstractLocationProvider { setState(state -> state.withIdentity(identity)); } public final Set<String> getExtraAttributionTags() { return mInternalState.get().state.extraAttributionTags; } /** * Call this method to report a change in the provider's extra attribution tags. */ Loading services/core/java/com/android/server/location/provider/MockableLocationProvider.java +5 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import com.android.internal.util.Preconditions; import java.io.FileDescriptor; import java.io.PrintWriter; import java.util.Collections; import java.util.Set; /** * Represents a location provider that may switch between a mock implementation and a real Loading Loading @@ -296,6 +297,10 @@ public class MockableLocationProvider extends AbstractLocationProvider { if (identity != null) { pw.println("identity=" + identity); } Set<String> extraAttributionTags = getExtraAttributionTags(); if (!extraAttributionTags.isEmpty()) { pw.println("extra attribution tags=" + extraAttributionTags); } ProviderProperties properties = getProperties(); if (properties != null) { pw.println("properties=" + properties); Loading services/core/java/com/android/server/location/provider/proxy/ProxyLocationProvider.java +7 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.server.location.provider.proxy; import static com.android.internal.util.ConcurrentUtils.DIRECT_EXECUTOR; import static com.android.server.location.LocationManagerService.TAG; import android.annotation.Nullable; import android.content.Context; Loading @@ -32,6 +33,7 @@ import android.os.IBinder; import android.os.RemoteException; import android.text.TextUtils; import android.util.ArraySet; import android.util.Log; import com.android.internal.annotations.GuardedBy; import com.android.server.FgThread; Loading @@ -44,6 +46,7 @@ import com.android.server.servicewatcher.ServiceWatcher.ServiceListener; import java.io.FileDescriptor; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; Loading Loading @@ -78,6 +81,7 @@ public class ProxyLocationProvider extends AbstractLocationProvider implements final Context mContext; final ServiceWatcher mServiceWatcher; final String mName; @GuardedBy("mLock") final ArrayList<Runnable> mFlushListeners = new ArrayList<>(0); Loading @@ -101,6 +105,7 @@ public class ProxyLocationProvider extends AbstractLocationProvider implements mServiceWatcher = ServiceWatcher.create(context, provider, new CurrentUserServiceSupplier(context, action, enableOverlayResId, nonOverlayPackageResId), this); mName = provider; mProxy = null; mRequest = ProviderRequest.EMPTY_REQUEST; Loading Loading @@ -249,6 +254,8 @@ public class ProxyLocationProvider extends AbstractLocationProvider implements String tagsStr = mBoundServiceInfo.getMetadata().getString(EXTRA_LOCATION_TAGS); if (!TextUtils.isEmpty(tagsStr)) { attributionTags = tagsStr.split(LOCATION_TAGS_SEPARATOR); Log.i(TAG, mName + " provider loaded extra attribution tags: " + Arrays.toString(attributionTags)); } } ArraySet<String> extraAttributionTags = new ArraySet<>(attributionTags); Loading services/core/java/com/android/server/servicewatcher/ServiceWatcherImpl.java +10 −9 Original line number Diff line number Diff line Loading @@ -135,6 +135,7 @@ class ServiceWatcherImpl<TBoundServiceInfo extends BoundServiceInfo> implements if (forceRebind || !Objects.equals(mServiceConnection.getBoundServiceInfo(), newBoundServiceInfo)) { Log.i(TAG, "[" + mTag + "] chose new implementation " + newBoundServiceInfo); MyServiceConnection oldServiceConnection = mServiceConnection; MyServiceConnection newServiceConnection = new MyServiceConnection(newBoundServiceInfo); mServiceConnection = newServiceConnection; Loading Loading @@ -196,7 +197,9 @@ class ServiceWatcherImpl<TBoundServiceInfo extends BoundServiceInfo> implements return; } Log.i(TAG, "[" + mTag + "] binding to " + mBoundServiceInfo); if (D) { Log.d(TAG, "[" + mTag + "] binding to " + mBoundServiceInfo); } Intent bindIntent = new Intent(mBoundServiceInfo.getAction()).setComponent( mBoundServiceInfo.getComponentName()); Loading Loading @@ -255,9 +258,7 @@ class ServiceWatcherImpl<TBoundServiceInfo extends BoundServiceInfo> implements Preconditions.checkState(Looper.myLooper() == mHandler.getLooper()); Preconditions.checkState(mBinder == null); if (D) { Log.d(TAG, "[" + mTag + "] connected to " + component.toShortString()); } Log.i(TAG, "[" + mTag + "] connected to " + component.toShortString()); mBinder = binder; Loading @@ -280,9 +281,7 @@ class ServiceWatcherImpl<TBoundServiceInfo extends BoundServiceInfo> implements return; } if (D) { Log.d(TAG, "[" + mTag + "] disconnected from " + mBoundServiceInfo); } Log.i(TAG, "[" + mTag + "] disconnected from " + mBoundServiceInfo); mBinder = null; if (mServiceListener != null) { Loading @@ -294,9 +293,11 @@ class ServiceWatcherImpl<TBoundServiceInfo extends BoundServiceInfo> implements public final void onBindingDied(ComponentName component) { Preconditions.checkState(Looper.myLooper() == mHandler.getLooper()); Log.i(TAG, "[" + mTag + "] " + mBoundServiceInfo + " died"); Log.w(TAG, "[" + mTag + "] " + mBoundServiceInfo + " died"); onServiceChanged(true); // introduce a small delay to prevent spamming binding over and over, since the likely // cause of a binding dying is some package event that may take time to recover from mHandler.postDelayed(() -> onServiceChanged(true), 500); } @Override Loading Loading
services/core/java/com/android/server/location/provider/AbstractLocationProvider.java +4 −0 Original line number Diff line number Diff line Loading @@ -305,6 +305,10 @@ public abstract class AbstractLocationProvider { setState(state -> state.withIdentity(identity)); } public final Set<String> getExtraAttributionTags() { return mInternalState.get().state.extraAttributionTags; } /** * Call this method to report a change in the provider's extra attribution tags. */ Loading
services/core/java/com/android/server/location/provider/MockableLocationProvider.java +5 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import com.android.internal.util.Preconditions; import java.io.FileDescriptor; import java.io.PrintWriter; import java.util.Collections; import java.util.Set; /** * Represents a location provider that may switch between a mock implementation and a real Loading Loading @@ -296,6 +297,10 @@ public class MockableLocationProvider extends AbstractLocationProvider { if (identity != null) { pw.println("identity=" + identity); } Set<String> extraAttributionTags = getExtraAttributionTags(); if (!extraAttributionTags.isEmpty()) { pw.println("extra attribution tags=" + extraAttributionTags); } ProviderProperties properties = getProperties(); if (properties != null) { pw.println("properties=" + properties); Loading
services/core/java/com/android/server/location/provider/proxy/ProxyLocationProvider.java +7 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.server.location.provider.proxy; import static com.android.internal.util.ConcurrentUtils.DIRECT_EXECUTOR; import static com.android.server.location.LocationManagerService.TAG; import android.annotation.Nullable; import android.content.Context; Loading @@ -32,6 +33,7 @@ import android.os.IBinder; import android.os.RemoteException; import android.text.TextUtils; import android.util.ArraySet; import android.util.Log; import com.android.internal.annotations.GuardedBy; import com.android.server.FgThread; Loading @@ -44,6 +46,7 @@ import com.android.server.servicewatcher.ServiceWatcher.ServiceListener; import java.io.FileDescriptor; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; Loading Loading @@ -78,6 +81,7 @@ public class ProxyLocationProvider extends AbstractLocationProvider implements final Context mContext; final ServiceWatcher mServiceWatcher; final String mName; @GuardedBy("mLock") final ArrayList<Runnable> mFlushListeners = new ArrayList<>(0); Loading @@ -101,6 +105,7 @@ public class ProxyLocationProvider extends AbstractLocationProvider implements mServiceWatcher = ServiceWatcher.create(context, provider, new CurrentUserServiceSupplier(context, action, enableOverlayResId, nonOverlayPackageResId), this); mName = provider; mProxy = null; mRequest = ProviderRequest.EMPTY_REQUEST; Loading Loading @@ -249,6 +254,8 @@ public class ProxyLocationProvider extends AbstractLocationProvider implements String tagsStr = mBoundServiceInfo.getMetadata().getString(EXTRA_LOCATION_TAGS); if (!TextUtils.isEmpty(tagsStr)) { attributionTags = tagsStr.split(LOCATION_TAGS_SEPARATOR); Log.i(TAG, mName + " provider loaded extra attribution tags: " + Arrays.toString(attributionTags)); } } ArraySet<String> extraAttributionTags = new ArraySet<>(attributionTags); Loading
services/core/java/com/android/server/servicewatcher/ServiceWatcherImpl.java +10 −9 Original line number Diff line number Diff line Loading @@ -135,6 +135,7 @@ class ServiceWatcherImpl<TBoundServiceInfo extends BoundServiceInfo> implements if (forceRebind || !Objects.equals(mServiceConnection.getBoundServiceInfo(), newBoundServiceInfo)) { Log.i(TAG, "[" + mTag + "] chose new implementation " + newBoundServiceInfo); MyServiceConnection oldServiceConnection = mServiceConnection; MyServiceConnection newServiceConnection = new MyServiceConnection(newBoundServiceInfo); mServiceConnection = newServiceConnection; Loading Loading @@ -196,7 +197,9 @@ class ServiceWatcherImpl<TBoundServiceInfo extends BoundServiceInfo> implements return; } Log.i(TAG, "[" + mTag + "] binding to " + mBoundServiceInfo); if (D) { Log.d(TAG, "[" + mTag + "] binding to " + mBoundServiceInfo); } Intent bindIntent = new Intent(mBoundServiceInfo.getAction()).setComponent( mBoundServiceInfo.getComponentName()); Loading Loading @@ -255,9 +258,7 @@ class ServiceWatcherImpl<TBoundServiceInfo extends BoundServiceInfo> implements Preconditions.checkState(Looper.myLooper() == mHandler.getLooper()); Preconditions.checkState(mBinder == null); if (D) { Log.d(TAG, "[" + mTag + "] connected to " + component.toShortString()); } Log.i(TAG, "[" + mTag + "] connected to " + component.toShortString()); mBinder = binder; Loading @@ -280,9 +281,7 @@ class ServiceWatcherImpl<TBoundServiceInfo extends BoundServiceInfo> implements return; } if (D) { Log.d(TAG, "[" + mTag + "] disconnected from " + mBoundServiceInfo); } Log.i(TAG, "[" + mTag + "] disconnected from " + mBoundServiceInfo); mBinder = null; if (mServiceListener != null) { Loading @@ -294,9 +293,11 @@ class ServiceWatcherImpl<TBoundServiceInfo extends BoundServiceInfo> implements public final void onBindingDied(ComponentName component) { Preconditions.checkState(Looper.myLooper() == mHandler.getLooper()); Log.i(TAG, "[" + mTag + "] " + mBoundServiceInfo + " died"); Log.w(TAG, "[" + mTag + "] " + mBoundServiceInfo + " died"); onServiceChanged(true); // introduce a small delay to prevent spamming binding over and over, since the likely // cause of a binding dying is some package event that may take time to recover from mHandler.postDelayed(() -> onServiceChanged(true), 500); } @Override Loading