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

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

Merge "[Service] Cleanup CHRE 24Q3 flags" into main

parents 8c389114 1d3827d2
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -6054,7 +6054,7 @@ package android.hardware.location {
    method @NonNull public android.hardware.location.ContextHubInfo getAttachedHub();
    method @IntRange(from=0, to=65535) public int getId();
    method @RequiresPermission(android.Manifest.permission.ACCESS_CONTEXT_HUB) public int sendMessageToNanoApp(@NonNull android.hardware.location.NanoAppMessage);
    method @FlaggedApi("android.chre.flags.reliable_message") @NonNull @RequiresPermission(android.Manifest.permission.ACCESS_CONTEXT_HUB) public android.hardware.location.ContextHubTransaction<java.lang.Void> sendReliableMessageToNanoApp(@NonNull android.hardware.location.NanoAppMessage);
    method @NonNull @RequiresPermission(android.Manifest.permission.ACCESS_CONTEXT_HUB) public android.hardware.location.ContextHubTransaction<java.lang.Void> sendReliableMessageToNanoApp(@NonNull android.hardware.location.NanoAppMessage);
  }
  public class ContextHubClientCallback {
@@ -6090,7 +6090,7 @@ package android.hardware.location {
    method public String getToolchain();
    method public int getToolchainVersion();
    method public String getVendor();
    method @FlaggedApi("android.chre.flags.reliable_message") public boolean supportsReliableMessages();
    method public boolean supportsReliableMessages();
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.location.ContextHubInfo> CREATOR;
  }
@@ -6174,7 +6174,7 @@ package android.hardware.location {
    field public static final int RESULT_FAILED_BAD_PARAMS = 2; // 0x2
    field public static final int RESULT_FAILED_BUSY = 4; // 0x4
    field public static final int RESULT_FAILED_HAL_UNAVAILABLE = 8; // 0x8
    field @FlaggedApi("android.chre.flags.reliable_message") public static final int RESULT_FAILED_NOT_SUPPORTED = 9; // 0x9
    field public static final int RESULT_FAILED_NOT_SUPPORTED = 9; // 0x9
    field public static final int RESULT_FAILED_SERVICE_INTERNAL_FAILURE = 7; // 0x7
    field public static final int RESULT_FAILED_TIMEOUT = 6; // 0x6
    field public static final int RESULT_FAILED_UNINITIALIZED = 3; // 0x3
@@ -6184,7 +6184,7 @@ package android.hardware.location {
    field public static final int TYPE_ENABLE_NANOAPP = 2; // 0x2
    field public static final int TYPE_LOAD_NANOAPP = 0; // 0x0
    field public static final int TYPE_QUERY_NANOAPPS = 4; // 0x4
    field @FlaggedApi("android.chre.flags.reliable_message") public static final int TYPE_RELIABLE_MESSAGE = 5; // 0x5
    field public static final int TYPE_RELIABLE_MESSAGE = 5; // 0x5
    field public static final int TYPE_UNLOAD_NANOAPP = 1; // 0x1
  }
@@ -6367,15 +6367,15 @@ package android.hardware.location {
  public final class NanoAppMessage implements android.os.Parcelable {
    method public static android.hardware.location.NanoAppMessage createMessageFromNanoApp(long, int, byte[], boolean);
    method @FlaggedApi("android.chre.flags.reliable_message") @NonNull public static android.hardware.location.NanoAppMessage createMessageFromNanoApp(long, int, @NonNull byte[], boolean, boolean, int);
    method @NonNull public static android.hardware.location.NanoAppMessage createMessageFromNanoApp(long, int, @NonNull byte[], boolean, boolean, int);
    method public static android.hardware.location.NanoAppMessage createMessageToNanoApp(long, int, byte[]);
    method public int describeContents();
    method public byte[] getMessageBody();
    method @FlaggedApi("android.chre.flags.reliable_message") public int getMessageSequenceNumber();
    method public int getMessageSequenceNumber();
    method public int getMessageType();
    method public long getNanoAppId();
    method public boolean isBroadcastMessage();
    method @FlaggedApi("android.chre.flags.reliable_message") public boolean isReliable();
    method public boolean isReliable();
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.location.NanoAppMessage> CREATOR;
  }
+4 −7
Original line number Diff line number Diff line
@@ -194,23 +194,20 @@ public class ContextHubClient implements Closeable {
    /**
     * Sends a reliable message to a nanoapp.
     *
     * This method is similar to {@link ContextHubClient#sendMessageToNanoApp} with the
     * <p>This method is similar to {@link ContextHubClient#sendMessageToNanoApp} with the
     * difference that it expects the message to be acknowledged by CHRE.
     *
     * The transaction succeeds after we received an ACK from CHRE without error.
     * In all other cases the transaction will fail.
     * <p>The transaction succeeds after we received an ACK from CHRE without error. In all other
     * cases the transaction will fail.
     */
    @RequiresPermission(android.Manifest.permission.ACCESS_CONTEXT_HUB)
    @NonNull
    @FlaggedApi(Flags.FLAG_RELIABLE_MESSAGE)
    public ContextHubTransaction<Void> sendReliableMessageToNanoApp(
            @NonNull NanoAppMessage message) {
        ContextHubTransaction<Void> transaction =
                new ContextHubTransaction<>(ContextHubTransaction.TYPE_RELIABLE_MESSAGE);

        if (!Flags.reliableMessageImplementation() ||
            !mAttachedHub.supportsReliableMessages() ||
            message.isBroadcastMessage()) {
        if (!mAttachedHub.supportsReliableMessages() || message.isBroadcastMessage()) {
            transaction.setResponse(new ContextHubTransaction.Response<Void>(
                    ContextHubTransaction.RESULT_FAILED_NOT_SUPPORTED, null));
            return transaction;
+17 −19
Original line number Diff line number Diff line
@@ -99,8 +99,7 @@ public class ContextHubInfo implements Parcelable {
        mSleepPowerDrawMw = 0;
        mPeakPowerDrawMw = 0;
        mMaxPacketLengthBytes = contextHub.maxSupportedMessageLengthBytes;
        mSupportsReliableMessages = Flags.reliableMessageImplementation()
                && contextHub.supportsReliableMessages;
        mSupportsReliableMessages = contextHub.supportsReliableMessages;
        mChrePlatformId = contextHub.chrePlatformId;
        mChreApiMajorVersion = contextHub.chreApiMajorVersion;
        mChreApiMinorVersion = contextHub.chreApiMinorVersion;
@@ -124,7 +123,6 @@ public class ContextHubInfo implements Parcelable {
     *
     * @return whether reliable messages are supported.
     */
    @FlaggedApi(Flags.FLAG_RELIABLE_MESSAGE)
    public boolean supportsReliableMessages() {
        return mSupportsReliableMessages;
    }
@@ -364,7 +362,8 @@ public class ContextHubInfo implements Parcelable {
        boolean isEqual = false;
        if (object instanceof ContextHubInfo) {
            ContextHubInfo other = (ContextHubInfo) object;
            isEqual = (other.getId() == mId)
            isEqual =
                    (other.getId() == mId)
                            && other.getName().equals(mName)
                            && other.getVendor().equals(mVendor)
                            && other.getToolchain().equals(mToolchain)
@@ -376,8 +375,7 @@ public class ContextHubInfo implements Parcelable {
                            && (other.getSleepPowerDrawMw() == mSleepPowerDrawMw)
                            && (other.getPeakPowerDrawMw() == mPeakPowerDrawMw)
                            && (other.getMaxPacketLengthBytes() == mMaxPacketLengthBytes)
                    && (!Flags.reliableMessage()
                            || (other.supportsReliableMessages() == mSupportsReliableMessages))
                            && (other.supportsReliableMessages() == mSupportsReliableMessages)
                            && Arrays.equals(other.getSupportedSensors(), mSupportedSensors)
                            && Arrays.equals(other.getMemoryRegions(), mMemoryRegions);
        }
+1 −3
Original line number Diff line number Diff line
@@ -750,9 +750,7 @@ public final class ContextHubManager {
                executor.execute(
                        () -> {
                            callback.onMessageFromNanoApp(client, message);
                            if (Flags.reliableMessage()
                                        && Flags.reliableMessageImplementation()
                                        && message.isReliable()) {
                            if (message.isReliable()) {
                                client.reliableMessageCallbackFinished(
                                        message.getMessageSequenceNumber(), ErrorCode.OK);
                            } else {
+4 −10
Original line number Diff line number Diff line
@@ -69,7 +69,6 @@ public class ContextHubTransaction<T> {
    public static final int TYPE_ENABLE_NANOAPP = 2;
    public static final int TYPE_DISABLE_NANOAPP = 3;
    public static final int TYPE_QUERY_NANOAPPS = 4;
    @FlaggedApi(Flags.FLAG_RELIABLE_MESSAGE)
    public static final int TYPE_RELIABLE_MESSAGE = 5;

    /**
@@ -123,10 +122,8 @@ public class ContextHubTransaction<T> {
     * Failure mode when the Context Hub HAL was not available.
     */
    public static final int RESULT_FAILED_HAL_UNAVAILABLE = 8;
    /**
     * Failure mode when the operation is not supported.
     */
    @FlaggedApi(Flags.FLAG_RELIABLE_MESSAGE)

    /** Failure mode when the operation is not supported. */
    public static final int RESULT_FAILED_NOT_SUPPORTED = 9;

    /**
@@ -232,11 +229,8 @@ public class ContextHubTransaction<T> {
                return upperCase ? "Disable" : "disable";
            case ContextHubTransaction.TYPE_QUERY_NANOAPPS:
                return upperCase ? "Query" : "query";
            case ContextHubTransaction.TYPE_RELIABLE_MESSAGE: {
                if (Flags.reliableMessage()) {
            case ContextHubTransaction.TYPE_RELIABLE_MESSAGE:
                return upperCase ? "Reliable Message" : "reliable message";
                }
            }
            default:
                return upperCase ? "Unknown" : "unknown";
        }
Loading