Merge "Bluetooth: add getDiscoveryEndMillis() call" am: 1785fc4eea

am: 7f8d8638eb

Change-Id: I6f02c4ddc0fe56cda5af2dcf2f5193ba13522792
This commit is contained in:
Marie Janssen
2017-01-30 17:57:02 +00:00
committed by android-build-merger
3 changed files with 24 additions and 0 deletions

View File

@@ -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

View File

@@ -52,6 +52,7 @@ interface IBluetooth
boolean startDiscovery();
boolean cancelDiscovery();
boolean isDiscovering();
long getDiscoveryEndMillis();
int getAdapterConnectionState();
int getProfileConnectionState(int profile);

View File

@@ -135,6 +135,10 @@ public final class LocalBluetoothAdapter {
mAdapter.setDiscoverableTimeout(timeout);
}
public long getDiscoveryEndMillis() {
return mAdapter.getDiscoveryEndMillis();
}
public void setName(String name) {
mAdapter.setName(name);
}