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

Commit c92bcdab authored by Salil Rajadhyaksha's avatar Salil Rajadhyaksha
Browse files

Define ProximityProviderService AIDL interface

This service will be responsible for finding paired device within a certain distance.

Bug: 409851233
Bug: 403351601
Change-Id: Id296ca257d3d646daa7743612155eed20f83915d
Flag: EXEMPT AIDL changes
parent 182c34af
Loading
Loading
Loading
Loading
+47 −0
Original line number Original line Diff line number Diff line
/*
 * Copyright (C) 2025 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package android.proximity;

import android.os.ICancellationSignal;
import android.proximity.IProximityResultCallback;
import android.proximity.IProximityResultCallback.Result;
import android.proximity.ProximityResultCode;
import android.proximity.RangingParams;

/**
 * @hide
 * Interface for proximity provider service.
 */
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
     * handle identifying the ranging session.
     */
    ICancellationSignal anyWatchNearby(
            in RangingParams params, in IProximityResultCallback callback);

    /**
     * Returns true if this device and the paired watch supports proximity checking.
     */
    boolean isProximityCheckingSupported();

    /**
     * Returns whether proximity checking is available on both primary and associated devices.
     */
    ProximityResultCode isProximityCheckingAvailable();
}
+26 −0
Original line number Original line Diff line number Diff line
/*
 * Copyright (C) 2025 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package android.proximity;

import android.proximity.ProximityResultCode;

/** @hide */
oneway interface IProximityResultCallback {
    /** Callback indicating an error. */
    void onError(ProximityResultCode error);
    /** Callback indicating ranging successfully finished with indicated result. */
    void onSuccess(ProximityResultCode result);
}
+2 −0
Original line number Original line Diff line number Diff line
salilr@google.com
igorzas@google.com
 No newline at end of file
+59 −0
Original line number Original line Diff line number Diff line
/*
 * Copyright (C) 2025 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package android.proximity;

/** @hide */
enum ProximityResultCode {
    /** Indicates a successful operation. */
    SUCCESS = 0,
    /** The device is seen in the discovery process. */
    OUT_OF_RANGE = 1,
    /** The device has no associated devices. */
    NO_ASSOCIATED_DEVICE = 2,
    /** The primary device Bluetooth adapter is turned off by the user. */
    PRIMARY_DEVICE_BT_ADAPTER_OFF = 3,
    /** The device has no connected associated device. */
    NO_CONNECTED_ASSOCIATED_DEVICE = 4,
    /** Ranging timed out with no associated device found. */
    NO_RANGING_RESULT = 5,
    /** Indicates that the associated device did not respond. */
    REQUEST_TIMED_OUT = 6,
    /** An associated device was found but is not on-wrist and unlocked. */
    ASSOCIATED_DEVICE_NOT_ELIGIBLE = 7,
    /**
       Indicates that there is no matching ranging method between primary device and associated
       device.
     */
    INVALID_RANGING_METHODS = 8,
    /** Selected ranging method is not available in the country code. */
    RANGING_RESTRICTED_AVAILABILITY = 9,
    /** Some ranging methods may be disabled due to airplane mode. */
    RANGING_RESTRICTED_AIRPLANE_MODE = 10,
    /** User turned off ranging method on primary device. */
    PRIMARY_DEVICE_RANGING_TURNED_OFF = 11,
    /** Ranging could not start on primary device. May succeed on a retry. */
    PRIMARY_DEVICE_RANGING_FAILED_TO_START = 12,
    /** Ranging already running on primary device. */
    PRIMARY_DEVICE_RANGING_ALREADY_RUNNING = 13,
    /** Ranging could not start on associated device. May succeed on a retry. */
    ASSOCIATED_DEVICE_RANGING_FAILED_TO_START = 14,
    /** Ranging already running on associated device. */
    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,
}
+20 −0
Original line number Original line Diff line number Diff line
/*
 * Copyright (C) 2025 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.proximity;

/** @hide */
parcelable RangingParams;
Loading