• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

packages/apps/Settings


Commit MetaInfo

Revisão32c7a774f505be6aae23984ee341bede59395d68 (tree)
Hora2011-05-28 02:32:18
AutorJaikumar Ganesh <jaikumar@goog...>
CommiterJaikumar Ganesh

Mensagem de Log

Changes for API of Bluetooth Discoverability. DO NOT MERGE

1. Apps can ask for any time between 0 and 3600 secs
2. O implies always discoverable
3. Any invalid values will default to the default - 120 secs.
A dialog is shown by the system to the users to accept the change
in discoverability values.

Change-Id: I34ebd907656a87508b0f0b1a4bce78134edcaebf

Mudança Sumário

Diff

--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -249,7 +249,7 @@
249249 <string name="bluetooth_ask_discovery">"An application on your phone is requesting permission to make your phone discoverable by other Bluetooth devices for <xliff:g id="timeout">%1$d</xliff:g> seconds. Do you want to do this?"</string>
250250
251251 <!-- Strings for asking to the user whether to allow an app to enable lasting discovery mode -->
252- <string name="bluetooth_ask_lasting_discovery">"An application on your phone is requesting permission to make your phone always discoverable by other Bluetooth devices. Do you want to do this?"</string>
252+ <string name="bluetooth_ask_lasting_discovery">"An application on your phone is requesting permission to make your phone \u201calways discoverable\u201d by other Bluetooth devices. Do you want to do this?"</string>
253253
254254 <!-- Strings for asking to the user whether to allow an app to enable bluetooth and discovery mode -->
255255 <string name="bluetooth_ask_enablement_and_discovery">"An application on your phone is requesting permission to turn on Bluetooth and to make your phone discoverable by other devices for <xliff:g id="timeout">%1$d</xliff:g> seconds. Do you want to do this?"</string>
--- 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
5656 private static final String VALUE_DISCOVERABLE_TIMEOUT_ONE_HOUR = "onehour";
5757 private static final String VALUE_DISCOVERABLE_TIMEOUT_NEVER = "never";
5858
59- // no need for this timeout anymore since we have the listPreference default value
60- // leaving now temporary until requestpermissionactivity is modified..
6159 static final int DEFAULT_DISCOVERABLE_TIMEOUT = DISCOVERABLE_TIMEOUT_TWO_MINUTES;
6260
6361 private final Context mContext;
--- 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
4343
4444 private static final String TAG = "RequestPermissionActivity";
4545
46- private static final int MAX_DISCOVERABLE_TIMEOUT = 300;
46+ private static final int MAX_DISCOVERABLE_TIMEOUT = 3600; // 1 hr
4747
4848 // Non-error return code: BT is starting or has started successfully. Used
4949 // by this Activity and RequestPermissionHelperActivity
@@ -158,13 +158,12 @@ public class RequestPermissionActivity extends Activity implements
158158 } else {
159159 // Ask the user whether to turn on discovery mode or not
160160 // For lasting discoverable mode there is a different message
161- // TODO(): Revisit this when public APIs for discoverable timeout are introduced.
162161 if (mTimeout == BluetoothDiscoverableEnabler.DISCOVERABLE_TIMEOUT_NEVER) {
163162 builder.setMessage(
164- getString(R.string.bluetooth_ask_enablement_and_lasting_discovery));
163+ getString(R.string.bluetooth_ask_lasting_discovery));
165164 } else {
166165 builder.setMessage(
167- getString(R.string.bluetooth_ask_enablement_and_discovery, mTimeout));
166+ getString(R.string.bluetooth_ask_discovery, mTimeout));
168167 }
169168 builder.setPositiveButton(getString(R.string.yes), this);
170169 builder.setNegativeButton(getString(R.string.no), this);
@@ -249,16 +248,9 @@ public class RequestPermissionActivity extends Activity implements
249248 mTimeout = intent.getIntExtra(BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION,
250249 BluetoothDiscoverableEnabler.DEFAULT_DISCOVERABLE_TIMEOUT);
251250
252- Log.e(TAG, "Timeout = " + mTimeout);
251+ Log.d(TAG, "Setting Bluetooth Discoverable Timeout = " + mTimeout);
253252
254- // Right now assuming for simplicity that an app can pick any int value,
255- // and if equal to BluetoothDiscoverableEnabler.DISCOVERABLE_TIMEOUT_NEVER
256- // it will be treated as a request for lasting discoverability.
257- // Alternatively, a check can be added here for enforcing the specific allowed values
258- // as listed in BluetoothDiscoverableEnabler.
259- // We need to make all these value public.
260-
261- if (mTimeout <= 0) {
253+ if (mTimeout < 0 || mTimeout > MAX_DISCOVERABLE_TIMEOUT) {
262254 mTimeout = BluetoothDiscoverableEnabler.DEFAULT_DISCOVERABLE_TIMEOUT;
263255 }
264256 } else {