summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--services/core/java/com/android/server/location/contexthub/ContextHubClientBroker.java11
-rw-r--r--services/core/java/com/android/server/location/contexthub/ContextHubService.java3
2 files changed, 14 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/location/contexthub/ContextHubClientBroker.java b/services/core/java/com/android/server/location/contexthub/ContextHubClientBroker.java
index 9fb1d8e744fb..c04768651c08 100644
--- a/services/core/java/com/android/server/location/contexthub/ContextHubClientBroker.java
+++ b/services/core/java/com/android/server/location/contexthub/ContextHubClientBroker.java
@@ -322,6 +322,17 @@ public class ContextHubClientBroker extends IContextHubClient.Stub
} else {
mPendingIntentRequest = new PendingIntentRequest(pendingIntent, nanoAppId);
}
+
+ if (packageName == null) {
+ String[] packages = mContext.getPackageManager().getPackagesForUid(
+ Binder.getCallingUid());
+ if (packages != null && packages.length > 0) {
+ packageName = packages[0];
+ }
+ Log.e(TAG, "createClient: Provided package name null. Using first package name "
+ + packageName);
+ }
+
mPackage = packageName;
mAttributionTag = attributionTag;
mTransactionManager = transactionManager;
diff --git a/services/core/java/com/android/server/location/contexthub/ContextHubService.java b/services/core/java/com/android/server/location/contexthub/ContextHubService.java
index 95178f4c7883..524b22ba29c4 100644
--- a/services/core/java/com/android/server/location/contexthub/ContextHubService.java
+++ b/services/core/java/com/android/server/location/contexthub/ContextHubService.java
@@ -1042,6 +1042,9 @@ public class ContextHubService extends IContextHubService.Stub {
}
/* package */ void denyClientAuthState(int contextHubId, String packageName, long nanoAppId) {
+ Log.i(TAG, "Denying " + packageName + " access to " + Long.toHexString(nanoAppId)
+ + " on context hub # " + contextHubId);
+
mClientManager.forEachClientOfHub(contextHubId, client -> {
if (client.getPackageName().equals(packageName)) {
client.updateNanoAppAuthState(