Merge "Fix issue 3225810."
diff --git a/core/java/android/bluetooth/BluetoothAdapter.java b/core/java/android/bluetooth/BluetoothAdapter.java
index 556fb10..32df4e8 100644
--- a/core/java/android/bluetooth/BluetoothAdapter.java
+++ b/core/java/android/bluetooth/BluetoothAdapter.java
@@ -521,6 +521,21 @@
}
/**
+ * Get the UUIDs supported by the local Bluetooth adapter.
+ *
+ * <p>Requires {@link android.Manifest.permission#BLUETOOTH}
+ *
+ * @return the UUIDs supported by the local Bluetooth Adapter.
+ * @hide
+ */
+ public ParcelUuid[] getUuids() {
+ try {
+ return mService.getUuids();
+ } catch (RemoteException e) {Log.e(TAG, "", e);}
+ return null;
+ }
+
+ /**
* Set the friendly Bluetooth name of the local Bluetooth adapter.
* <p>This name is visible to remote Bluetooth devices.
* <p>Valid Bluetooth names are a maximum of 248 bytes using UTF-8
diff --git a/core/java/android/bluetooth/BluetoothDeviceProfileState.java b/core/java/android/bluetooth/BluetoothDeviceProfileState.java
index 138e7f2..d1a6ed5 100644
--- a/core/java/android/bluetooth/BluetoothDeviceProfileState.java
+++ b/core/java/android/bluetooth/BluetoothDeviceProfileState.java
@@ -301,10 +301,9 @@
if (isPhoneDocked(mDevice)) {
// Don't auto connect to docks.
break;
- } else if (mHeadsetService == null) {
- deferMessage(message);
} else {
- if (mHeadsetService.getPriority(mDevice) ==
+ if (mHeadsetService != null &&
+ mHeadsetService.getPriority(mDevice) ==
BluetoothHeadset.PRIORITY_AUTO_CONNECT &&
mHeadsetService.getDevicesMatchingConnectionStates(
new int[] {BluetoothProfile.STATE_CONNECTED,
@@ -1027,7 +1026,8 @@
// This is again against spec. HFP incoming connections should be made
// before A2DP, so we should not hit this case. But many devices
// don't follow this.
- if (mHeadsetService.getPriority(mDevice) == BluetoothProfile.PRIORITY_ON) {
+ if (mHeadsetService != null &&
+ mHeadsetService.getPriority(mDevice) == BluetoothProfile.PRIORITY_ON) {
Message msg = new Message();
msg.what = CONNECT_OTHER_PROFILES;
msg.arg1 = CONNECT_HFP_OUTGOING;
diff --git a/core/java/android/bluetooth/IBluetooth.aidl b/core/java/android/bluetooth/IBluetooth.aidl
index aefb3f2..f3e73cf 100644
--- a/core/java/android/bluetooth/IBluetooth.aidl
+++ b/core/java/android/bluetooth/IBluetooth.aidl
@@ -35,6 +35,7 @@
String getAddress();
String getName();
boolean setName(in String name);
+ ParcelUuid[] getUuids();
int getScanMode();
boolean setScanMode(int mode, int duration);
diff --git a/core/java/android/server/BluetoothService.java b/core/java/android/server/BluetoothService.java
index 01a6b94..398b5ae 100644
--- a/core/java/android/server/BluetoothService.java
+++ b/core/java/android/server/BluetoothService.java
@@ -541,14 +541,15 @@
mHandler.obtainMessage(MESSAGE_REGISTER_SDP_RECORDS, 3, -1), 500);
break;
case 3:
- Log.d(TAG, "Registering opush record");
- SystemService.start("opush");
- mHandler.sendMessageDelayed(
- mHandler.obtainMessage(MESSAGE_REGISTER_SDP_RECORDS, 4, -1), 500);
- break;
- case 4:
Log.d(TAG, "Registering pbap record");
SystemService.start("pbap");
+ mHandler.sendMessageDelayed(
+ mHandler.obtainMessage(MESSAGE_REGISTER_SDP_RECORDS, 4, -1), 500);
+
+ break;
+ case 4:
+ Log.d(TAG, "Registering opush record");
+ SystemService.start("opush");
break;
}
break;
@@ -630,8 +631,15 @@
initProfileState();
//Register SDP records.
- mHandler.sendMessageDelayed(
+ if (mContext.getResources().
+ getBoolean(com.android.internal.R.bool.config_voice_capable)) {
+ mHandler.sendMessageDelayed(
mHandler.obtainMessage(MESSAGE_REGISTER_SDP_RECORDS, 1, -1), 3000);
+ } else {
+ // Register only OPP.
+ mHandler.sendMessageDelayed(
+ mHandler.obtainMessage(MESSAGE_REGISTER_SDP_RECORDS, 4, -1), 3000);
+ }
setBluetoothTetheringNative(true, BluetoothPan.NAP_ROLE, BluetoothPan.NAP_BRIDGE);
@@ -1196,6 +1204,24 @@
return getProperty("Name");
}
+ public synchronized ParcelUuid[] getUuids() {
+ mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
+ String value = getProperty("UUIDs");
+ if (value == null) return null;
+
+ String[] uuidStrings = null;
+ // The UUIDs are stored as a "," separated string.
+ uuidStrings = value.split(",");
+ ParcelUuid[] uuids = new ParcelUuid[uuidStrings.length];
+
+ for (int i = 0; i < uuidStrings.length; i++) {
+ uuids[i] = ParcelUuid.fromString(uuidStrings[i]);
+ }
+ return uuids;
+
+ }
+
+
/**
* Returns the user-friendly name of a remote device. This value is
* returned from our local cache, which is updated when onPropertyChange
diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java
index e658df4..51016f5 100644
--- a/core/java/android/view/WindowManager.java
+++ b/core/java/android/view/WindowManager.java
@@ -377,6 +377,7 @@
/**
* Window type: panel that slides out from under the status bar
+ * @hide
*/
public static final int TYPE_STATUS_BAR_SUB_PANEL = FIRST_SYSTEM_WINDOW+17;
diff --git a/libs/rs/java/Balls/src/com/android/balls/BallsRS.java b/libs/rs/java/Balls/src/com/android/balls/BallsRS.java
index 76c23b7..42eaede 100644
--- a/libs/rs/java/Balls/src/com/android/balls/BallsRS.java
+++ b/libs/rs/java/Balls/src/com/android/balls/BallsRS.java
@@ -21,7 +21,7 @@
import android.util.Log;
public class BallsRS {
- public static final int PART_COUNT = 800;
+ public static final int PART_COUNT = 1000;
public BallsRS() {
}
diff --git a/libs/rs/java/Balls/src/com/android/balls/ball_physics.rs b/libs/rs/java/Balls/src/com/android/balls/ball_physics.rs
index 96c39b1..47eaf1b 100644
--- a/libs/rs/java/Balls/src/com/android/balls/ball_physics.rs
+++ b/libs/rs/java/Balls/src/com/android/balls/ball_physics.rs
@@ -41,7 +41,20 @@
fv -= (vec / (len * len * len)) * 20000.f;
} else {
if (len2 < 0.1) {
- continue;
+ if (xin == x) {
+ continue;
+ }
+ ballOut->delta = 0.f;
+ ballOut->position = ballIn->position;
+ if (xin > x) {
+ ballOut->position.x += 1.f;
+ } else {
+ ballOut->position.x -= 1.f;
+ }
+ ballOut->color.rgb = 1.f;
+ ballOut->arcID = -1;
+ ballOut->arcStr = 0;
+ return;
}
// Collision
float2 axis = normalize(vec);
diff --git a/packages/SystemUI/res/layout-xlarge/sysbar_panel_notifications.xml b/packages/SystemUI/res/layout-xlarge/sysbar_panel_notifications.xml
index e9e23a5..fb4cf3f 100644
--- a/packages/SystemUI/res/layout-xlarge/sysbar_panel_notifications.xml
+++ b/packages/SystemUI/res/layout-xlarge/sysbar_panel_notifications.xml
@@ -65,6 +65,7 @@
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_below="@id/clock"
+ android:layout_marginTop="4dp"
android:layout_marginRight="48dp"
android:gravity="right"
/>
@@ -75,9 +76,10 @@
android:layout_width="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@id/date"
- android:layout_marginTop="16dp"
android:layout_marginLeft="48dp"
- android:baseline="17dp"
+ android:layout_marginTop="18dp"
+ android:layout_marginRight="8dp"
+ android:baseline="15dp"
/>
<TextView
@@ -96,7 +98,8 @@
android:layout_width="wrap_content"
android:layout_toRightOf="@id/battery_text"
android:layout_alignBaseline="@id/battery"
- android:baseline="21dp"
+ android:layout_marginRight="8dp"
+ android:baseline="15dp"
/>
<TextView
@@ -113,11 +116,11 @@
android:id="@+id/settings_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_alignParentRight="true"
android:layout_alignBaseline="@id/battery"
+ android:layout_alignParentRight="true"
android:paddingRight="16dp"
android:src="@drawable/ic_notification_open"
- android:baseline="17dp"
+ android:baseline="21dp"
/>
<ImageView
@@ -129,7 +132,7 @@
android:paddingRight="16dp"
android:visibility="invisible"
android:src="@drawable/status_bar_veto"
- android:baseline="17dp"
+ android:baseline="21dp"
/>
</com.android.systemui.statusbar.tablet.NotificationTitleArea>
diff --git a/telephony/java/com/android/internal/telephony/DataConnectionTracker.java b/telephony/java/com/android/internal/telephony/DataConnectionTracker.java
index 9c738ec..8f3fa1b 100644
--- a/telephony/java/com/android/internal/telephony/DataConnectionTracker.java
+++ b/telephony/java/com/android/internal/telephony/DataConnectionTracker.java
@@ -16,8 +16,6 @@
package com.android.internal.telephony;
-import com.android.internal.telephony.cdma.CDMAPhone;
-
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
@@ -231,6 +229,9 @@
protected HashMap<Integer, DataConnection> mDataConnections =
new HashMap<Integer, DataConnection>();
+ /* Currently active APN */
+ protected ApnSetting mActiveApn;
+
protected BroadcastReceiver mIntentReceiver = new BroadcastReceiver ()
{
@Override
@@ -343,6 +344,40 @@
return new ArrayList<DataConnection>(mDataConnections.values());
}
+ protected boolean isApnTypeActive(String type) {
+ // TODO: support simultaneous with List instead
+ return mActiveApn != null && mActiveApn.canHandleType(type);
+ }
+
+ public String[] getActiveApnTypes() {
+ String[] result;
+ if (mActiveApn != null) {
+ result = mActiveApn.types;
+ } else {
+ result = new String[1];
+ result[0] = Phone.APN_TYPE_DEFAULT;
+ }
+ return result;
+ }
+
+ public String getActiveApnType() {
+ String result;
+ if (mActiveApn != null) {
+ result = apnIdToType(mActiveApn.id);
+ } else {
+ result = null;
+ }
+ return result;
+ }
+
+ protected String getActiveApnString() {
+ String result = null;
+ if (mActiveApn != null) {
+ result = mActiveApn.apn;
+ }
+ return result;
+ }
+
/**
* The data connection is expected to be setup while device
* 1. has Icc card
@@ -533,14 +568,8 @@
}
}
- protected abstract boolean isApnTypeActive(String type);
-
protected abstract boolean isApnTypeAvailable(String type);
- protected abstract String[] getActiveApnTypes();
-
- protected abstract String getActiveApnString();
-
protected abstract void setState(State s);
protected LinkProperties getLinkProperties(String apnType) {
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java
index e003a73..024ef33 100644
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java
@@ -89,9 +89,6 @@
Phone.APN_TYPE_MMS,
Phone.APN_TYPE_HIPRI };
- // if we have no active Apn this is null
- protected ApnSetting mActiveApn;
-
/* Constructor */
CdmaDataConnectionTracker(CDMAPhone p) {
@@ -158,11 +155,6 @@
}
@Override
- protected boolean isApnTypeActive(String type) {
- return mActiveApn != null && mActiveApn.canHandleType(type);
- }
-
- @Override
protected boolean isApnTypeAvailable(String type) {
for (String s : mSupportedApnTypes) {
if (TextUtils.equals(type, s)) {
@@ -172,23 +164,6 @@
return false;
}
- @Override
- protected String[] getActiveApnTypes() {
- String[] result;
- if (mActiveApn != null) {
- result = mActiveApn.types;
- } else {
- result = new String[1];
- result[0] = Phone.APN_TYPE_DEFAULT;
- }
- return result;
- }
-
- @Override
- protected String getActiveApnString() {
- return null;
- }
-
/**
* The data connection is expected to be setup while device
* 1. has ruim card or non-volatile data store
diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java
index 5c229b6..b41402c 100644
--- a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java
+++ b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java
@@ -109,9 +109,6 @@
private int mWaitingApnsPermanentFailureCountDown = 0;
private ApnSetting mPreferredApn = null;
- /* Currently active APN */
- protected ApnSetting mActiveApn;
-
/** The DataConnection being setup */
private GsmDataConnection mPendingDataConnection;
@@ -212,27 +209,6 @@
}
}
- @Override
- public String[] getActiveApnTypes() {
- String[] result;
- if (mActiveApn != null) {
- result = mActiveApn.types;
- } else {
- result = new String[1];
- result[0] = Phone.APN_TYPE_DEFAULT;
- }
- return result;
- }
-
- @Override
- protected String getActiveApnString() {
- String result = null;
- if (mActiveApn != null) {
- result = mActiveApn.apn;
- }
- return result;
- }
-
/**
* The data connection is expected to be setup while device
* 1. has sim card
@@ -257,12 +233,6 @@
}
@Override
- protected boolean isApnTypeActive(String type) {
- // TODO: support simultaneous with List instead
- return mActiveApn != null && mActiveApn.canHandleType(type);
- }
-
- @Override
protected boolean isApnTypeAvailable(String type) {
if (type.equals(Phone.APN_TYPE_DUN)) {
return (fetchDunApn() != null);