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

Commit 7eed0fca authored by Chienyuan Huang's avatar Chienyuan Huang
Browse files

Add method ID for Channel Sounding

Bug: 319563845
Bug: 317683528
Test: atest DistanceMeasurementMethodTest
Change-Id: I935f212eed371e4259741255d8340d3485c88ba2
parent ad3c29e4
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1240,6 +1240,7 @@ package android.bluetooth.le {
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.bluetooth.le.DistanceMeasurementMethod> CREATOR;
    field public static final int DISTANCE_MEASUREMENT_METHOD_AUTO = 0; // 0x0
    field @FlaggedApi("com.android.bluetooth.flags.channel_sounding") public static final int DISTANCE_MEASUREMENT_METHOD_CHANNEL_SOUNDING = 2; // 0x2
    field public static final int DISTANCE_MEASUREMENT_METHOD_RSSI = 1; // 0x1
  }

+17 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.bluetooth.le;

import android.annotation.FlaggedApi;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.SystemApi;
@@ -42,7 +43,12 @@ public final class DistanceMeasurementMethod implements Parcelable {

    /** @hide */
    @Retention(RetentionPolicy.SOURCE)
    @IntDef(value = {DISTANCE_MEASUREMENT_METHOD_AUTO, DISTANCE_MEASUREMENT_METHOD_RSSI})
    @IntDef(
            value = {
                DISTANCE_MEASUREMENT_METHOD_AUTO,
                DISTANCE_MEASUREMENT_METHOD_RSSI,
                DISTANCE_MEASUREMENT_METHOD_CHANNEL_SOUNDING
            })
    @interface DistanceMeasurementMethodId {}

    /**
@@ -60,6 +66,15 @@ public final class DistanceMeasurementMethod implements Parcelable {
     */
    @SystemApi public static final int DISTANCE_MEASUREMENT_METHOD_RSSI = 1;

    /**
     * Use Channel Sounding to measure the distance.
     *
     * @hide
     */
    @FlaggedApi("com.android.bluetooth.flags.channel_sounding")
    @SystemApi
    public static final int DISTANCE_MEASUREMENT_METHOD_CHANNEL_SOUNDING = 2;

    private DistanceMeasurementMethod(
            int id, boolean isAzimuthAngleSupported, boolean isAltitudeAngleSupported) {
        mId = id;
@@ -194,6 +209,7 @@ public final class DistanceMeasurementMethod implements Parcelable {
            switch (id) {
                case DISTANCE_MEASUREMENT_METHOD_AUTO:
                case DISTANCE_MEASUREMENT_METHOD_RSSI:
                case DISTANCE_MEASUREMENT_METHOD_CHANNEL_SOUNDING:
                    mId = id;
                    break;
                default:
+1 −0
Original line number Diff line number Diff line
@@ -265,6 +265,7 @@ public final class DistanceMeasurementParams implements Parcelable {
            switch (methodId) {
                case DistanceMeasurementMethod.DISTANCE_MEASUREMENT_METHOD_AUTO:
                case DistanceMeasurementMethod.DISTANCE_MEASUREMENT_METHOD_RSSI:
                case DistanceMeasurementMethod.DISTANCE_MEASUREMENT_METHOD_CHANNEL_SOUNDING:
                    mMethodId = methodId;
                    break;
                default: