Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8339dab4 authored by Matthew Sedam's avatar Matthew Sedam Committed by Android (Google) Code Review
Browse files

Merge "Clear reliable message fields for public input NanoAppMessage" into main

parents c675a6c2 c0d1eec4
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -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.