Merge change 24440 into eclair
* changes:
Fix bug 2078454 where clicking on Settings in the Home menu would take the user to Market after clicking on "Install Voice Data" in the TTS Settings page. Launching the Activity for the installation of the TTS data should be a distinct task, dissociated from the one associated with the Settings app. Also the intent ACTION_INSTALL_TTS_DATA doesn't return a result, so the activity should be started with startActivity() rather than startActivityForResult().
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 9043dba..06057e7 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -513,9 +513,9 @@
<!-- Title for the bluetooth device info screen. -->
<string name="bluetooth_device_info">Bluetooth device info</string>
<!-- Message when bluetooth dialog for pin entry is showing -->
- <string name="bluetooth_enter_pin_msg"><xliff:g id="device_name">%1$s</xliff:g>\nType PIN to pair.\n(Try 0000 or 1234.)</string>
+ <string name="bluetooth_enter_pin_msg">\nType PIN to pair with \u0022<xliff:g id="device_name">%1$s</xliff:g>\u0022. (Try 0000 or 1234.)</string>
<!-- Message when bluetooth dialog for passkey entry is showing -->
- <string name="bluetooth_enter_passkey_msg"><xliff:g id="device_name">%1$s</xliff:g>\nType passkey to pair.\n</string>
+ <string name="bluetooth_enter_passkey_msg">\nType passkey to pair with \u0022<xliff:g id="device_name">%1$s</xliff:g>\u0022.</string>
<!-- Message when bluetooth dialog for confirmation of passkey is showing -->
<string name="bluetooth_confirm_passkey_msg">To pair with \u0022<xliff:g id="device_name">%1$s</xliff:g>\u0022, confirm that it is showing the passkey: <xliff:g id="passkey">%2$s</xliff:g>.</string>
<!-- Button text for accepting an incoming pairing request -->
diff --git a/src/com/android/settings/SoundAndDisplaySettings.java b/src/com/android/settings/SoundAndDisplaySettings.java
index 5f4f358..75090ee 100644
--- a/src/com/android/settings/SoundAndDisplaySettings.java
+++ b/src/com/android/settings/SoundAndDisplaySettings.java
@@ -221,8 +221,8 @@
CharSequence[] summaries = getResources().getTextArray(R.array.animations_summaries);
CharSequence[] values = mAnimations.getEntryValues();
for (int i=0; i<values.length; i++) {
- Log.i("foo", "Comparing entry "+ values[i] + " to current "
- + mAnimations.getValue());
+ //Log.i("foo", "Comparing entry "+ values[i] + " to current "
+ // + mAnimations.getValue());
if (values[i].equals(value)) {
mAnimations.setSummary(summaries[i]);
break;
diff --git a/src/com/android/settings/bluetooth/BluetoothDiscoverableEnabler.java b/src/com/android/settings/bluetooth/BluetoothDiscoverableEnabler.java
index 17e5105..98d387c 100644
--- a/src/com/android/settings/bluetooth/BluetoothDiscoverableEnabler.java
+++ b/src/com/android/settings/bluetooth/BluetoothDiscoverableEnabler.java
@@ -19,7 +19,6 @@
import com.android.settings.R;
import android.bluetooth.BluetoothAdapter;
-import android.bluetooth.BluetoothError;
import android.bluetooth.BluetoothIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
@@ -55,9 +54,10 @@
private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
- if (BluetoothIntent.SCAN_MODE_CHANGED_ACTION.equals(intent.getAction())) {
- int mode = intent.getIntExtra(BluetoothIntent.SCAN_MODE, BluetoothError.ERROR);
- if (mode != BluetoothError.ERROR) {
+ if (BluetoothAdapter.ACTION_SCAN_MODE_CHANGED.equals(intent.getAction())) {
+ int mode = intent.getIntExtra(BluetoothAdapter.EXTRA_SCAN_MODE,
+ BluetoothAdapter.ERROR);
+ if (mode != BluetoothAdapter.ERROR) {
handleModeChanged(mode);
}
}
@@ -89,7 +89,7 @@
return;
}
- IntentFilter filter = new IntentFilter(BluetoothIntent.SCAN_MODE_CHANGED_ACTION);
+ IntentFilter filter = new IntentFilter(BluetoothAdapter.ACTION_SCAN_MODE_CHANGED);
mContext.registerReceiver(mReceiver, filter);
mCheckBoxPreference.setOnPreferenceChangeListener(this);
diff --git a/src/com/android/settings/bluetooth/BluetoothEnabler.java b/src/com/android/settings/bluetooth/BluetoothEnabler.java
index 2808ce3..c1b6de3 100644
--- a/src/com/android/settings/bluetooth/BluetoothEnabler.java
+++ b/src/com/android/settings/bluetooth/BluetoothEnabler.java
@@ -19,7 +19,6 @@
import com.android.settings.R;
import android.bluetooth.BluetoothAdapter;
-import android.bluetooth.BluetoothError;
import android.bluetooth.BluetoothIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
@@ -49,8 +48,7 @@
private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
- int state = intent.getIntExtra(BluetoothIntent.BLUETOOTH_STATE,
- BluetoothError.ERROR);
+ int state = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, BluetoothAdapter.ERROR);
handleStateChanged(state);
}
};
@@ -76,13 +74,13 @@
int state = mLocalManager.getBluetoothState();
// This is the widget enabled state, not the preference toggled state
- mCheckBoxPreference.setEnabled(state == BluetoothAdapter.BLUETOOTH_STATE_ON ||
- state == BluetoothAdapter.BLUETOOTH_STATE_OFF);
+ mCheckBoxPreference.setEnabled(state == BluetoothAdapter.STATE_ON ||
+ state == BluetoothAdapter.STATE_OFF);
// BT state is not a sticky broadcast, so set it manually
handleStateChanged(state);
mContext.registerReceiver(mReceiver,
- new IntentFilter(BluetoothIntent.BLUETOOTH_STATE_CHANGED_ACTION));
+ new IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED));
mCheckBoxPreference.setOnPreferenceChangeListener(this);
}
@@ -112,18 +110,18 @@
private void handleStateChanged(int state) {
- if (state == BluetoothAdapter.BLUETOOTH_STATE_OFF ||
- state == BluetoothAdapter.BLUETOOTH_STATE_ON) {
- mCheckBoxPreference.setChecked(state == BluetoothAdapter.BLUETOOTH_STATE_ON);
- mCheckBoxPreference.setSummary(state == BluetoothAdapter.BLUETOOTH_STATE_OFF ?
+ if (state == BluetoothAdapter.STATE_OFF ||
+ state == BluetoothAdapter.STATE_ON) {
+ mCheckBoxPreference.setChecked(state == BluetoothAdapter.STATE_ON);
+ mCheckBoxPreference.setSummary(state == BluetoothAdapter.STATE_OFF ?
mOriginalSummary :
null);
mCheckBoxPreference.setEnabled(isEnabledByDependency());
- } else if (state == BluetoothAdapter.BLUETOOTH_STATE_TURNING_ON ||
- state == BluetoothAdapter.BLUETOOTH_STATE_TURNING_OFF) {
- mCheckBoxPreference.setSummary(state == BluetoothAdapter.BLUETOOTH_STATE_TURNING_ON
+ } else if (state == BluetoothAdapter.STATE_TURNING_ON ||
+ state == BluetoothAdapter.STATE_TURNING_OFF) {
+ mCheckBoxPreference.setSummary(state == BluetoothAdapter.STATE_TURNING_ON
? R.string.wifi_starting
: R.string.wifi_stopping);
diff --git a/src/com/android/settings/bluetooth/BluetoothEventRedirector.java b/src/com/android/settings/bluetooth/BluetoothEventRedirector.java
index fdc217a..6459950 100644
--- a/src/com/android/settings/bluetooth/BluetoothEventRedirector.java
+++ b/src/com/android/settings/bluetooth/BluetoothEventRedirector.java
@@ -17,9 +17,9 @@
package com.android.settings.bluetooth;
import android.bluetooth.BluetoothA2dp;
+import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothClass;
import android.bluetooth.BluetoothDevice;
-import android.bluetooth.BluetoothError;
import android.bluetooth.BluetoothHeadset;
import android.bluetooth.BluetoothIntent;
import android.content.BroadcastReceiver;
@@ -51,9 +51,9 @@
String action = intent.getAction();
BluetoothDevice device = intent.getParcelableExtra(BluetoothIntent.DEVICE);
- if (action.equals(BluetoothIntent.BLUETOOTH_STATE_CHANGED_ACTION)) {
- int state = intent.getIntExtra(BluetoothIntent.BLUETOOTH_STATE,
- BluetoothError.ERROR);
+ if (action.equals(BluetoothAdapter.ACTION_STATE_CHANGED)) {
+ int state = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE,
+ BluetoothAdapter.ERROR);
mManager.setBluetoothStateInt(state);
} else if (action.equals(BluetoothIntent.DISCOVERY_STARTED_ACTION)) {
mManager.onScanningStateChanged(true);
@@ -75,10 +75,10 @@
} else if (action.equals(BluetoothIntent.BOND_STATE_CHANGED_ACTION)) {
int bondState = intent.getIntExtra(BluetoothIntent.BOND_STATE,
- BluetoothError.ERROR);
+ BluetoothDevice.ERROR);
mManager.getCachedDeviceManager().onBondingStateChanged(device, bondState);
if (bondState == BluetoothDevice.BOND_NOT_BONDED) {
- int reason = intent.getIntExtra(BluetoothIntent.REASON, BluetoothError.ERROR);
+ int reason = intent.getIntExtra(BluetoothIntent.REASON, BluetoothDevice.ERROR);
if (reason == BluetoothDevice.UNBOND_REASON_AUTH_REJECTED ||
reason == BluetoothDevice.UNBOND_REASON_AUTH_FAILED ||
reason == BluetoothDevice.UNBOND_REASON_REMOTE_DEVICE_DOWN) {
@@ -123,7 +123,7 @@
IntentFilter filter = new IntentFilter();
// Bluetooth on/off broadcasts
- filter.addAction(BluetoothIntent.BLUETOOTH_STATE_CHANGED_ACTION);
+ filter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
// Discovery broadcasts
filter.addAction(BluetoothIntent.DISCOVERY_STARTED_ACTION);
diff --git a/src/com/android/settings/bluetooth/BluetoothNamePreference.java b/src/com/android/settings/bluetooth/BluetoothNamePreference.java
index 1e79704..4a2358f 100644
--- a/src/com/android/settings/bluetooth/BluetoothNamePreference.java
+++ b/src/com/android/settings/bluetooth/BluetoothNamePreference.java
@@ -20,7 +20,6 @@
import android.app.Dialog;
import android.bluetooth.BluetoothAdapter;
-import android.bluetooth.BluetoothError;
import android.bluetooth.BluetoothIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
@@ -49,9 +48,9 @@
String action = intent.getAction();
if (action.equals(BluetoothIntent.NAME_CHANGED_ACTION)) {
setSummaryToName();
- } else if (action.equals(BluetoothIntent.BLUETOOTH_STATE_CHANGED_ACTION) &&
- (intent.getIntExtra(BluetoothIntent.BLUETOOTH_STATE,
- BluetoothError.ERROR) == BluetoothAdapter.BLUETOOTH_STATE_ON)) {
+ } else if (action.equals(BluetoothAdapter.ACTION_STATE_CHANGED) &&
+ (intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, BluetoothAdapter.ERROR) ==
+ BluetoothAdapter.STATE_ON)) {
setSummaryToName();
}
}
@@ -67,7 +66,7 @@
public void resume() {
IntentFilter filter = new IntentFilter();
- filter.addAction(BluetoothIntent.BLUETOOTH_STATE_CHANGED_ACTION);
+ filter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
filter.addAction(BluetoothIntent.NAME_CHANGED_ACTION);
getContext().registerReceiver(mReceiver, filter);
diff --git a/src/com/android/settings/bluetooth/BluetoothPairingDialog.java b/src/com/android/settings/bluetooth/BluetoothPairingDialog.java
index ac5dfba..091ad27 100644
--- a/src/com/android/settings/bluetooth/BluetoothPairingDialog.java
+++ b/src/com/android/settings/bluetooth/BluetoothPairingDialog.java
@@ -223,7 +223,7 @@
}
mDevice.setPin(pinBytes);
} else if (mType == BluetoothDevice.PAIRING_VARIANT_PASSKEY) {
- int passkey = Integer.getInteger(value);
+ int passkey = Integer.parseInt(value);
mDevice.setPasskey(passkey);
} else {
mDevice.setPairingConfirmation(true);
diff --git a/src/com/android/settings/bluetooth/BluetoothSettings.java b/src/com/android/settings/bluetooth/BluetoothSettings.java
index 0525ec7..0d2ebd7 100644
--- a/src/com/android/settings/bluetooth/BluetoothSettings.java
+++ b/src/com/android/settings/bluetooth/BluetoothSettings.java
@@ -26,7 +26,6 @@
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothIntent;
-import android.bluetooth.BluetoothError;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@@ -87,12 +86,12 @@
public void onReceive(Context context, Intent intent) {
// TODO: put this in callback instead of receiving
- if (intent.getAction().equals(BluetoothIntent.BLUETOOTH_STATE_CHANGED_ACTION)) {
+ if (intent.getAction().equals(BluetoothAdapter.ACTION_STATE_CHANGED)) {
onBluetoothStateChanged(mLocalManager.getBluetoothState());
} else if (intent.getAction().equals(BluetoothIntent.BOND_STATE_CHANGED_ACTION)
&& mScreenType == SCREEN_TYPE_DEVICEPICKER) {
int bondState = intent
- .getIntExtra(BluetoothIntent.BOND_STATE, BluetoothError.ERROR);
+ .getIntExtra(BluetoothIntent.BOND_STATE, BluetoothDevice.ERROR);
if (bondState == BluetoothDevice.BOND_BONDED) {
BluetoothDevice device = intent.getParcelableExtra(BluetoothIntent.DEVICE);
sendDevicePickedIntent(device);
@@ -175,7 +174,7 @@
mLocalManager.startScanning(false);
IntentFilter intentFilter = new IntentFilter();
- intentFilter.addAction(BluetoothIntent.BLUETOOTH_STATE_CHANGED_ACTION);
+ intentFilter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
intentFilter.addAction(BluetoothIntent.BOND_STATE_CHANGED_ACTION);
registerReceiver(mReceiver, intentFilter);
mLocalManager.setForegroundActivity(this);
@@ -339,9 +338,9 @@
private void onBluetoothStateChanged(int bluetoothState) {
// When bluetooth is enabled (and we are in the activity, which we are),
// we should start a scan
- if (bluetoothState == BluetoothAdapter.BLUETOOTH_STATE_ON) {
+ if (bluetoothState == BluetoothAdapter.STATE_ON) {
mLocalManager.startScanning(false);
- } else if (bluetoothState == BluetoothAdapter.BLUETOOTH_STATE_OFF) {
+ } else if (bluetoothState == BluetoothAdapter.STATE_OFF) {
mDeviceList.setProgress(false);
}
}
diff --git a/src/com/android/settings/bluetooth/CachedBluetoothDevice.java b/src/com/android/settings/bluetooth/CachedBluetoothDevice.java
index d13f77c..9ee2f36 100644
--- a/src/com/android/settings/bluetooth/CachedBluetoothDevice.java
+++ b/src/com/android/settings/bluetooth/CachedBluetoothDevice.java
@@ -321,8 +321,7 @@
LocalBluetoothProfileManager.getProfileManager(mLocalManager, profile);
int status = profileManager.getConnectionStatus(cachedDevice.mDevice);
if (SettingsBtStatus.isConnectionStatusConnected(status)) {
- if (profileManager.disconnect(cachedDevice.mDevice) ==
- BluetoothAdapter.RESULT_SUCCESS) {
+ if (profileManager.disconnect(cachedDevice.mDevice)) {
return true;
}
}
@@ -407,7 +406,7 @@
LocalBluetoothProfileManager.getProfileManager(mLocalManager, profile);
int status = profileManager.getConnectionStatus(cachedDevice.mDevice);
if (!SettingsBtStatus.isConnectionStatusConnected(status)) {
- if (profileManager.connect(cachedDevice.mDevice) == BluetoothAdapter.RESULT_SUCCESS) {
+ if (profileManager.connect(cachedDevice.mDevice)) {
return true;
}
Log.i(TAG, "Failed to connect " + profile.toString() + " to " + cachedDevice.mName);
@@ -690,7 +689,7 @@
public void onCreateContextMenu(ContextMenu menu) {
// No context menu if it is busy (none of these items are applicable if busy)
- if (mLocalManager.getBluetoothState() != BluetoothAdapter.BLUETOOTH_STATE_ON || isBusy()) {
+ if (mLocalManager.getBluetoothState() != BluetoothAdapter.STATE_ON || isBusy()) {
return;
}
diff --git a/src/com/android/settings/bluetooth/LocalBluetoothManager.java b/src/com/android/settings/bluetooth/LocalBluetoothManager.java
index d4b55c1..a5a0140 100644
--- a/src/com/android/settings/bluetooth/LocalBluetoothManager.java
+++ b/src/com/android/settings/bluetooth/LocalBluetoothManager.java
@@ -27,7 +27,6 @@
import android.bluetooth.BluetoothA2dp;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
-import android.bluetooth.BluetoothError;
import android.bluetooth.BluetoothIntent;
import android.content.Context;
import android.content.Intent;
@@ -64,7 +63,7 @@
private BluetoothEventRedirector mEventRedirector;
private BluetoothA2dp mBluetoothA2dp;
- private int mState = BluetoothError.ERROR;
+ private int mState = BluetoothAdapter.ERROR;
private List<Callback> mCallbacks = new ArrayList<Callback>();
@@ -187,7 +186,7 @@
public int getBluetoothState() {
- if (mState == BluetoothError.ERROR) {
+ if (mState == BluetoothAdapter.ERROR) {
syncBluetoothState();
}
@@ -196,10 +195,10 @@
void setBluetoothStateInt(int state) {
mState = state;
- if (state == BluetoothAdapter.BLUETOOTH_STATE_ON ||
- state == BluetoothAdapter.BLUETOOTH_STATE_OFF) {
+ if (state == BluetoothAdapter.STATE_ON ||
+ state == BluetoothAdapter.STATE_OFF) {
mCachedDeviceManager.onBluetoothStateChanged(state ==
- BluetoothAdapter.BLUETOOTH_STATE_ON);
+ BluetoothAdapter.STATE_ON);
}
}
@@ -208,10 +207,10 @@
if (mAdapter != null) {
bluetoothState = mAdapter.isEnabled()
- ? BluetoothAdapter.BLUETOOTH_STATE_ON
- : BluetoothAdapter.BLUETOOTH_STATE_OFF;
+ ? BluetoothAdapter.STATE_ON
+ : BluetoothAdapter.STATE_OFF;
} else {
- bluetoothState = BluetoothError.ERROR;
+ bluetoothState = BluetoothAdapter.ERROR;
}
setBluetoothStateInt(bluetoothState);
@@ -224,8 +223,8 @@
if (wasSetStateSuccessful) {
setBluetoothStateInt(enabled
- ? BluetoothAdapter.BLUETOOTH_STATE_TURNING_ON
- : BluetoothAdapter.BLUETOOTH_STATE_TURNING_OFF);
+ ? BluetoothAdapter.STATE_TURNING_ON
+ : BluetoothAdapter.STATE_TURNING_OFF);
} else {
if (V) {
Log.v(TAG,
diff --git a/src/com/android/settings/bluetooth/LocalBluetoothProfileManager.java b/src/com/android/settings/bluetooth/LocalBluetoothProfileManager.java
index 2a52a8b..6f343c1 100644
--- a/src/com/android/settings/bluetooth/LocalBluetoothProfileManager.java
+++ b/src/com/android/settings/bluetooth/LocalBluetoothProfileManager.java
@@ -19,7 +19,6 @@
import android.bluetooth.BluetoothA2dp;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothClass;
-import android.bluetooth.BluetoothError;
import android.bluetooth.BluetoothHeadset;
import android.os.Handler;
import android.text.TextUtils;
@@ -102,9 +101,9 @@
mLocalManager = localManager;
}
- public abstract int connect(BluetoothDevice device);
+ public abstract boolean connect(BluetoothDevice device);
- public abstract int disconnect(BluetoothDevice device);
+ public abstract boolean disconnect(BluetoothDevice device);
public abstract int getConnectionStatus(BluetoothDevice device);
@@ -145,7 +144,7 @@
}
@Override
- public int connect(BluetoothDevice device) {
+ public boolean connect(BluetoothDevice device) {
Set<BluetoothDevice> sinks = mService.getConnectedSinks();
if (sinks != null) {
for (BluetoothDevice sink : sinks) {
@@ -156,7 +155,7 @@
}
@Override
- public int disconnect(BluetoothDevice device) {
+ public boolean disconnect(BluetoothDevice device) {
return mService.disconnectSink(device);
}
@@ -240,20 +239,19 @@
}
@Override
- public int connect(BluetoothDevice device) {
+ public boolean connect(BluetoothDevice device) {
// Since connectHeadset fails if already connected to a headset, we
// disconnect from any headset first
mService.disconnectHeadset();
- return mService.connectHeadset(device)
- ? BluetoothError.SUCCESS : BluetoothError.ERROR;
+ return mService.connectHeadset(device);
}
@Override
- public int disconnect(BluetoothDevice device) {
+ public boolean disconnect(BluetoothDevice device) {
if (mService.getCurrentHeadset().equals(device)) {
- return mService.disconnectHeadset() ? BluetoothError.SUCCESS : BluetoothError.ERROR;
+ return mService.disconnectHeadset();
} else {
- return BluetoothError.SUCCESS;
+ return false;
}
}
@@ -312,13 +310,13 @@
}
@Override
- public int connect(BluetoothDevice device) {
- return -1;
+ public boolean connect(BluetoothDevice device) {
+ return false;
}
@Override
- public int disconnect(BluetoothDevice device) {
- return -1;
+ public boolean disconnect(BluetoothDevice device) {
+ return false;
}
@Override
diff --git a/src/com/android/settings/widget/SettingsAppWidgetProvider.java b/src/com/android/settings/widget/SettingsAppWidgetProvider.java
index 2e3f305..eddeb63 100644
--- a/src/com/android/settings/widget/SettingsAppWidgetProvider.java
+++ b/src/com/android/settings/widget/SettingsAppWidgetProvider.java
@@ -379,9 +379,9 @@
}
}
int state = mLocalBluetoothManager.getBluetoothState();
- if (state == BluetoothAdapter.BLUETOOTH_STATE_OFF) {
+ if (state == BluetoothAdapter.STATE_OFF) {
return STATE_DISABLED;
- } else if (state == BluetoothAdapter.BLUETOOTH_STATE_ON) {
+ } else if (state == BluetoothAdapter.STATE_ON) {
return STATE_ENABLED;
} else {
return STATE_INTERMEDIATE;