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

Commit 87f1dcab authored by Salil Rajadhyaksha's avatar Salil Rajadhyaksha Committed by Android (Google) Code Review
Browse files

Merge "Add RangingParams builder constructor and backing type to enum." into main

parents f25c221d 80b03a95
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ interface IProximityProviderService {
    /**
     * Finds nearby watch paired to this phone. If the watch is not found within the
     * specified timeout, the callback is called with result set to NO_RANGING_RESULT.
     * If timeout is 0, it will use a default timeout of 5 seconds. Returns an integer
     * If timeout is <= 0, it will use a default timeout of 5 seconds. Returns an integer
     * handle identifying the ranging session.
     */
    ICancellationSignal anyWatchNearby(
+3 −2
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@
package android.proximity;

/** @hide */
@Backing(type="int")
enum ProximityResultCode {
    /** Indicates a successful operation. */
    SUCCESS = 0,
@@ -54,6 +55,6 @@ enum ProximityResultCode {
    ASSOCIATED_DEVICE_RANGING_ALREADY_RUNNING = 15,
    /** User turned off ranging method on associated device. */
    ASSOCIATED_DEVICE_RANGING_TURNED_OFF = 16,
    /** The primary device Bluetooth adapter is turned off by the user. */
    ASSOCIATED_DEVICE_BT_ADAPTER_OFF = 17,
    /** Request contains invalid parameters. */
    INVALID_PARAMETERS = 17,
}
+13 −0
Original line number Diff line number Diff line
@@ -77,16 +77,29 @@ public final class RangingParams implements Parcelable {
        private double mThresholdMeters = 0.0;
        private int mTimeoutMillis = 0;

        public Builder() {
            mThresholdMeters = 1.5;
            mTimeoutMillis = 5000;
        }

        public Builder(@NonNull RangingParams src) {
            mThresholdMeters = src.mThresholdMeters;
            mTimeoutMillis = src.mTimeoutMillis;
        }

        /**
         * Sets the threshold in meters for ranging. If not set or set to <= 0.0 , a default value
         * of 1.5 meters is used.
         */
        public @NonNull Builder setThresholdMeters(double thresholdMeters) {
            mThresholdMeters = thresholdMeters;
            return this;
        }

        /**
         * Sets the timeout in milliseconds for ranging request. If not set or set to <= 0, a
         * default value of 5000 milliseconds is used.
         */
        public @NonNull Builder setTimeoutMillis(int timeoutMillis) {
            mTimeoutMillis = timeoutMillis;
            return this;