diff options
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/hardware/location/ContextHubManager.java | 12 | ||||
| -rw-r--r-- | core/java/android/hardware/location/IContextHubService.aidl | 3 |
2 files changed, 13 insertions, 2 deletions
diff --git a/core/java/android/hardware/location/ContextHubManager.java b/core/java/android/hardware/location/ContextHubManager.java index ebb3021bf083..a65f36b14f13 100644 --- a/core/java/android/hardware/location/ContextHubManager.java +++ b/core/java/android/hardware/location/ContextHubManager.java @@ -24,6 +24,7 @@ import android.annotation.RequiresPermission; import android.annotation.SuppressLint; import android.annotation.SystemApi; import android.annotation.SystemService; +import android.app.ActivityThread; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; @@ -849,9 +850,18 @@ public final class ContextHubManager { attributionTag = context.getAttributionTag(); } + // Workaround for old APIs not providing a context + String packageName; + if (context != null) { + packageName = context.getPackageName(); + } else { + packageName = ActivityThread.currentPackageName(); + } + IContextHubClient clientProxy; try { - clientProxy = mService.createClient(hubInfo.getId(), clientInterface, attributionTag); + clientProxy = mService.createClient( + hubInfo.getId(), clientInterface, attributionTag, packageName); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } diff --git a/core/java/android/hardware/location/IContextHubService.aidl b/core/java/android/hardware/location/IContextHubService.aidl index 4961195a3017..92882c4f93bb 100644 --- a/core/java/android/hardware/location/IContextHubService.aidl +++ b/core/java/android/hardware/location/IContextHubService.aidl @@ -60,7 +60,8 @@ interface IContextHubService { // Creates a client to send and receive messages IContextHubClient createClient( - int contextHubId, in IContextHubClientCallback client, in String attributionTag); + int contextHubId, in IContextHubClientCallback client, in String attributionTag, + in String packageName); // Creates a PendingIntent-based client to send and receive messages IContextHubClient createPendingIntentClient( |
