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

Commit e692bd35 authored by Marie Janssen's avatar Marie Janssen
Browse files

Bluetooth: add getDiscoveryEndMillis() call

Method to tell when the adapter finished (or will finish) being in
discovery mode.

Test: compiles and still can scan
Bug: 34395439
Change-Id: I41b48c2b934c0a1d5e1727cec08f3f762e3cb309
parent 8e79aa72
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -1183,6 +1183,25 @@ public final class BluetoothAdapter {
        }
    }

    /**
     * Get the end time of the latest remote device discovery process.
     * @return the latest time that the bluetooth adapter was/will be in discovery mode,
     * in milliseconds since the epoch.
     * This time can be in the future if {@link #startDiscovery()} has been called recently.
     * @hide
     */
    public long getDiscoveryEndMillis() {
        try {
            mServiceLock.readLock().lock();
            if (mService != null) return mService.getDiscoveryEndMillis();
        } catch (RemoteException e) {
            Log.e(TAG, "", e);
        } finally {
            mServiceLock.readLock().unlock();
        }
        return -1;
    }

    /**
     * Start the remote device discovery process.
     * <p>The discovery process usually involves an inquiry scan of about 12
+1 −0
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@ interface IBluetooth
    boolean startDiscovery();
    boolean cancelDiscovery();
    boolean isDiscovering();
    long getDiscoveryEndMillis();

    int getAdapterConnectionState();
    int getProfileConnectionState(int profile);