add discoverability timoeut when set by 3rd party app

Change-Id: Ibfd358121f8f9fbbf3b9bc06c5be7b9300e0ba53
This commit is contained in:
Srikanth Uppala
2012-04-13 04:10:09 -07:00
committed by Matthew Xie
parent 0134761426
commit 4bb010a67f
3 changed files with 53 additions and 41 deletions

View File

@@ -228,8 +228,12 @@ public class RequestPermissionActivity extends Activity implements
} else if (mLocalAdapter.setScanMode(
BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE, mTimeout)) {
// If already in discoverable mode, this will extend the timeout.
long endTime = System.currentTimeMillis() + (long) mTimeout * 1000;
LocalBluetoothPreferences.persistDiscoverableEndTimestamp(
this, System.currentTimeMillis() + (long) mTimeout * 1000);
this, endTime);
if (0 < mTimeout) {
BluetoothDiscoverableTimeoutReceiver.setDiscoverableAlarm(this, endTime);
}
returnCode = mTimeout;
// Activity.RESULT_FIRST_USER should be 1
if (returnCode < RESULT_FIRST_USER) {