summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJaikumar Ganesh <jaikumar@google.com>2011-05-27 13:28:49 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-05-27 13:28:49 -0700
commiteddb21a2ebd39900893da63749a00570f37e5038 (patch)
tree77b5cc54c65e87709b26845f9d2dfb5cba3f071f /src
parentc955d8ee1d2b134f8c41989b545b7b3ed830d058 (diff)
parent32c7a774f505be6aae23984ee341bede59395d68 (diff)
downloadpackages_apps_settings-eddb21a2ebd39900893da63749a00570f37e5038.zip
packages_apps_settings-eddb21a2ebd39900893da63749a00570f37e5038.tar.gz
packages_apps_settings-eddb21a2ebd39900893da63749a00570f37e5038.tar.bz2
Merge "Changes for API of Bluetooth Discoverability. DO NOT MERGE" into gingerbread
Diffstat (limited to 'src')
-rw-r--r--src/com/android/settings/bluetooth/BluetoothDiscoverableEnabler.java2
-rw-r--r--src/com/android/settings/bluetooth/RequestPermissionActivity.java18
2 files changed, 5 insertions, 15 deletions
diff --git a/src/com/android/settings/bluetooth/BluetoothDiscoverableEnabler.java b/src/com/android/settings/bluetooth/BluetoothDiscoverableEnabler.java
index 7a4a1ff..166e4ae 100644
--- a/src/com/android/settings/bluetooth/BluetoothDiscoverableEnabler.java
+++ b/src/com/android/settings/bluetooth/BluetoothDiscoverableEnabler.java
@@ -56,8 +56,6 @@ public class BluetoothDiscoverableEnabler implements Preference.OnPreferenceChan
private static final String VALUE_DISCOVERABLE_TIMEOUT_ONE_HOUR = "onehour";
private static final String VALUE_DISCOVERABLE_TIMEOUT_NEVER = "never";
- // no need for this timeout anymore since we have the listPreference default value
- // leaving now temporary until requestpermissionactivity is modified..
static final int DEFAULT_DISCOVERABLE_TIMEOUT = DISCOVERABLE_TIMEOUT_TWO_MINUTES;
private final Context mContext;
diff --git a/src/com/android/settings/bluetooth/RequestPermissionActivity.java b/src/com/android/settings/bluetooth/RequestPermissionActivity.java
index 52cd439..34ecca0 100644
--- a/src/com/android/settings/bluetooth/RequestPermissionActivity.java
+++ b/src/com/android/settings/bluetooth/RequestPermissionActivity.java
@@ -43,7 +43,7 @@ public class RequestPermissionActivity extends Activity implements
private static final String TAG = "RequestPermissionActivity";
- private static final int MAX_DISCOVERABLE_TIMEOUT = 300;
+ private static final int MAX_DISCOVERABLE_TIMEOUT = 3600; // 1 hr
// Non-error return code: BT is starting or has started successfully. Used
// by this Activity and RequestPermissionHelperActivity
@@ -158,13 +158,12 @@ public class RequestPermissionActivity extends Activity implements
} else {
// Ask the user whether to turn on discovery mode or not
// For lasting discoverable mode there is a different message
- // TODO(): Revisit this when public APIs for discoverable timeout are introduced.
if (mTimeout == BluetoothDiscoverableEnabler.DISCOVERABLE_TIMEOUT_NEVER) {
builder.setMessage(
- getString(R.string.bluetooth_ask_enablement_and_lasting_discovery));
+ getString(R.string.bluetooth_ask_lasting_discovery));
} else {
builder.setMessage(
- getString(R.string.bluetooth_ask_enablement_and_discovery, mTimeout));
+ getString(R.string.bluetooth_ask_discovery, mTimeout));
}
builder.setPositiveButton(getString(R.string.yes), this);
builder.setNegativeButton(getString(R.string.no), this);
@@ -249,16 +248,9 @@ public class RequestPermissionActivity extends Activity implements
mTimeout = intent.getIntExtra(BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION,
BluetoothDiscoverableEnabler.DEFAULT_DISCOVERABLE_TIMEOUT);
- Log.e(TAG, "Timeout = " + mTimeout);
+ Log.d(TAG, "Setting Bluetooth Discoverable Timeout = " + mTimeout);
- // Right now assuming for simplicity that an app can pick any int value,
- // and if equal to BluetoothDiscoverableEnabler.DISCOVERABLE_TIMEOUT_NEVER
- // it will be treated as a request for lasting discoverability.
- // Alternatively, a check can be added here for enforcing the specific allowed values
- // as listed in BluetoothDiscoverableEnabler.
- // We need to make all these value public.
-
- if (mTimeout <= 0) {
+ if (mTimeout < 0 || mTimeout > MAX_DISCOVERABLE_TIMEOUT) {
mTimeout = BluetoothDiscoverableEnabler.DEFAULT_DISCOVERABLE_TIMEOUT;
}
} else {