summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--services/core/java/com/android/server/location/contexthub/ContextHubClientBroker.java12
1 files changed, 10 insertions, 2 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 fc994719c85d..0ca48084f4e1 100644
--- a/services/core/java/com/android/server/location/contexthub/ContextHubClientBroker.java
+++ b/services/core/java/com/android/server/location/contexthub/ContextHubClientBroker.java
@@ -449,7 +449,7 @@ public class ContextHubClientBroker extends IContextHubClient.Stub
}
/**
- * Sends a reliable message rom this client to a nanoapp.
+ * Sends a reliable message from this client to a nanoapp.
*
* @param message the message to send
* @param transactionCallback The callback to use to confirm the delivery of the message for
@@ -473,6 +473,12 @@ public class ContextHubClientBroker extends IContextHubClient.Stub
@Nullable IContextHubTransactionCallback transactionCallback) {
ContextHubServiceUtil.checkPermissions(mContext);
+ // Clear the isReliable and messageSequenceNumber fields.
+ // These will be set to true and a real value if the message
+ // is reliable.
+ message.setIsReliable(false);
+ message.setMessageSequenceNumber(0);
+
@ContextHubTransaction.Result int result;
if (isRegistered()) {
int authState = mMessageChannelNanoappIdMap.getOrDefault(
@@ -485,7 +491,9 @@ public class ContextHubClientBroker extends IContextHubClient.Stub
// Return a bland error code for apps targeting old SDKs since they wouldn't be able
// to use an error code added in S.
return ContextHubTransaction.RESULT_FAILED_UNKNOWN;
- } else if (authState == AUTHORIZATION_UNKNOWN) {
+ }
+
+ if (authState == AUTHORIZATION_UNKNOWN) {
// Only check permissions the first time a nanoapp is queried since nanoapp
// permissions don't currently change at runtime. If the host permission changes
// later, that'll be checked by onOpChanged.