Merge "Fix block mode numbering (CTR got added as 4 rather than 3)" into mnc-dev
diff --git a/include/hardware/bt_sdp.h b/include/hardware/bt_sdp.h
index d298ad6..8f39bc5 100644
--- a/include/hardware/bt_sdp.h
+++ b/include/hardware/bt_sdp.h
@@ -26,12 +26,13 @@
  * These events are handled by the state machine
  */
 typedef enum {
-    SDP_TYPE_RAW, // Used to carry raw SDP search data for unknown UUID's 
-    SDP_TYPE_MAP_MAS,
-    SDP_TYPE_MAP_MNS,
-    SDP_TYPE_PBAP_PSE,
-    SDP_TYPE_PBAP_PCE,
-    SDP_TYPE_OPP_SERVER
+    SDP_TYPE_RAW,        // Used to carry raw SDP search data for unknown UUIDs
+    SDP_TYPE_MAP_MAS,    // Message Access Profile - Server
+    SDP_TYPE_MAP_MNS,    // Message Access Profile - Client (Notification Server)
+    SDP_TYPE_PBAP_PSE,   // Phone Book Profile - Server
+    SDP_TYPE_PBAP_PCE,   // Phone Book Profile - Client
+    SDP_TYPE_OPP_SERVER, // Object Push Profile
+    SDP_TYPE_SAP_SERVER  // SIM Access Profile
 } bluetooth_sdp_types;
 
 typedef struct _bluetooth_sdp_hdr {
@@ -92,6 +93,10 @@
     uint8_t     supported_formats_list[SDP_OPP_SUPPORTED_FORMATS_MAX_LENGTH];
 } bluetooth_sdp_ops_record;
 
+typedef struct _bluetooth_sdp_sap_record {
+    bluetooth_sdp_hdr_overlay hdr;
+} bluetooth_sdp_sap_record;
+
 typedef union {
     bluetooth_sdp_hdr_overlay   hdr;
     bluetooth_sdp_mas_record    mas;
@@ -99,6 +104,7 @@
     bluetooth_sdp_pse_record    pse;
     bluetooth_sdp_pce_record    pce;
     bluetooth_sdp_ops_record    ops;
+    bluetooth_sdp_sap_record    sap;
 } bluetooth_sdp_record;
 
 
diff --git a/include/hardware/bt_sock.h b/include/hardware/bt_sock.h
index 1c937d8..69775e0 100644
--- a/include/hardware/bt_sock.h
+++ b/include/hardware/bt_sock.h
@@ -21,6 +21,7 @@
 #define BTSOCK_FLAG_ENCRYPT 1
 #define BTSOCK_FLAG_AUTH (1 << 1)
 #define BTSOCK_FLAG_NO_SDP (1 << 2)
+#define BTSOCK_FLAG_AUTH_MITM (1 << 3)
 
 typedef enum {
     BTSOCK_RFCOMM = 1,
@@ -34,11 +35,11 @@
     bt_bdaddr_t bd_addr;
     int channel;
     int status;
-    
+
     // The writer must make writes using a buffer of this maximum size
     // to avoid loosing data. (L2CAP only)
     unsigned short max_tx_packet_size;
- 
+
     // The reader must read using a buffer of at least this size to avoid
     // loosing data. (L2CAP only)
     unsigned short max_rx_packet_size;
diff --git a/include/hardware/gps.h b/include/hardware/gps.h
index 38353f2..76b6cb7 100644
--- a/include/hardware/gps.h
+++ b/include/hardware/gps.h
@@ -673,6 +673,12 @@
     size_t (*get_internal_state)(char* buffer, size_t bufferSize);
 } GpsDebugInterface;
 
+#pragma pack(push,4)
+// We need to keep the alignment of this data structure to 4-bytes, to ensure that in 64-bit
+// environments the size of this legacy definition does not collide with _v2. Implementations should
+// be using _v2 and _v3, so it's OK to pay the 'unaligned' penalty in 64-bit if an old
+// implementation is still in use.
+
 /** Represents the status of AGPS. */
 typedef struct {
     /** set to sizeof(AGpsStatus_v1) */
@@ -682,6 +688,8 @@
     AGpsStatusValue status;
 } AGpsStatus_v1;
 
+#pragma pack(pop)
+
 /** Represents the status of AGPS augmented with a IPv4 address field. */
 typedef struct {
     /** set to sizeof(AGpsStatus_v2) */
diff --git a/include/hardware/gralloc.h b/include/hardware/gralloc.h
index 7aeb84e..93172cd 100644
--- a/include/hardware/gralloc.h
+++ b/include/hardware/gralloc.h
@@ -131,7 +131,7 @@
      * buffer that they did not detach from the BufferQueue. Will be filtered
      * out by GRALLOC_USAGE_ALLOC_MASK, so gralloc modules will not need to
      * handle this flag. */
-    GRALLOC_USAGE_FOREIGN_BUFFERS       = 0x00010000,
+    GRALLOC_USAGE_FOREIGN_BUFFERS       = 0x00200000,
 
     /* Mask of all flags which could be passed to a gralloc module for buffer
      * allocation. Any flags not in this mask do not need to be handled by