Loading services/core/java/com/android/server/location/contexthub/ContextHubClientBroker.java +30 −5 Original line number Diff line number Diff line Loading @@ -39,6 +39,10 @@ import android.util.proto.ProtoOutputStream; import com.android.server.location.ClientBrokerProto; import java.util.Collections; import java.util.Iterator; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.Supplier; Loading Loading @@ -118,6 +122,13 @@ public class ContextHubClientBroker extends IContextHubClient.Stub */ private final boolean mHasAccessContextHubPermission; /* * The set of nanoapp IDs that represent the group of nanoapps this client has a messaging * channel with, i.e. has sent or received messages from this particular nanoapp. */ private final Set<Long> mMessageChannelNanoappIdSet = Collections.newSetFromMap(new ConcurrentHashMap<Long, Boolean>()); /* * Helper class to manage registered PendingIntent requests from the client. */ Loading @@ -134,7 +145,8 @@ public class ContextHubClientBroker extends IContextHubClient.Stub private boolean mValid = false; PendingIntentRequest() {} PendingIntentRequest() { } PendingIntentRequest(PendingIntent pendingIntent, long nanoAppId) { mPendingIntent = pendingIntent; Loading Loading @@ -209,6 +221,7 @@ public class ContextHubClientBroker extends IContextHubClient.Stub int result; if (isRegistered()) { mMessageChannelNanoappIdSet.add(message.getNanoAppId()); ContextHubMsg messageToNanoApp = ContextHubServiceUtil.createHidlContextHubMessage(mHostEndPointId, message); Loading Loading @@ -269,6 +282,7 @@ public class ContextHubClientBroker extends IContextHubClient.Stub * @param message the message that came from a nanoapp */ /* package */ void sendMessageToClient(NanoAppMessage message) { mMessageChannelNanoappIdSet.add(message.getNanoAppId()); invokeCallback(callback -> callback.onMessageFromNanoApp(message)); Supplier<Intent> supplier = Loading Loading @@ -500,6 +514,17 @@ public class ContextHubClientBroker extends IContextHubClient.Stub } else { out += "package: " + mPackage; } if (mMessageChannelNanoappIdSet.size() > 0) { out += " messageChannelNanoappSet: ("; Iterator<Long> it = mMessageChannelNanoappIdSet.iterator(); while (it.hasNext()) { out += "0x" + Long.toHexString(it.next()); if (it.hasNext()) { out += ","; } } out += ")"; } out += "]"; return out; Loading Loading
services/core/java/com/android/server/location/contexthub/ContextHubClientBroker.java +30 −5 Original line number Diff line number Diff line Loading @@ -39,6 +39,10 @@ import android.util.proto.ProtoOutputStream; import com.android.server.location.ClientBrokerProto; import java.util.Collections; import java.util.Iterator; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.Supplier; Loading Loading @@ -118,6 +122,13 @@ public class ContextHubClientBroker extends IContextHubClient.Stub */ private final boolean mHasAccessContextHubPermission; /* * The set of nanoapp IDs that represent the group of nanoapps this client has a messaging * channel with, i.e. has sent or received messages from this particular nanoapp. */ private final Set<Long> mMessageChannelNanoappIdSet = Collections.newSetFromMap(new ConcurrentHashMap<Long, Boolean>()); /* * Helper class to manage registered PendingIntent requests from the client. */ Loading @@ -134,7 +145,8 @@ public class ContextHubClientBroker extends IContextHubClient.Stub private boolean mValid = false; PendingIntentRequest() {} PendingIntentRequest() { } PendingIntentRequest(PendingIntent pendingIntent, long nanoAppId) { mPendingIntent = pendingIntent; Loading Loading @@ -209,6 +221,7 @@ public class ContextHubClientBroker extends IContextHubClient.Stub int result; if (isRegistered()) { mMessageChannelNanoappIdSet.add(message.getNanoAppId()); ContextHubMsg messageToNanoApp = ContextHubServiceUtil.createHidlContextHubMessage(mHostEndPointId, message); Loading Loading @@ -269,6 +282,7 @@ public class ContextHubClientBroker extends IContextHubClient.Stub * @param message the message that came from a nanoapp */ /* package */ void sendMessageToClient(NanoAppMessage message) { mMessageChannelNanoappIdSet.add(message.getNanoAppId()); invokeCallback(callback -> callback.onMessageFromNanoApp(message)); Supplier<Intent> supplier = Loading Loading @@ -500,6 +514,17 @@ public class ContextHubClientBroker extends IContextHubClient.Stub } else { out += "package: " + mPackage; } if (mMessageChannelNanoappIdSet.size() > 0) { out += " messageChannelNanoappSet: ("; Iterator<Long> it = mMessageChannelNanoappIdSet.iterator(); while (it.hasNext()) { out += "0x" + Long.toHexString(it.next()); if (it.hasNext()) { out += ","; } } out += ")"; } out += "]"; return out; Loading