Merge "Fix native crash when typeface is missing"
diff --git a/api/current.txt b/api/current.txt
index 0b53039..f9eebfe 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -22895,8 +22895,6 @@
   public static class CallLog.Calls implements android.provider.BaseColumns {
     ctor public CallLog.Calls();
     method public static java.lang.String getLastOutgoingCall(android.content.Context);
-    field public static final java.lang.String ACCOUNT_COMPONENT_NAME = "subscription_component_name";
-    field public static final java.lang.String ACCOUNT_ID = "subscription_id";
     field public static final java.lang.String CACHED_FORMATTED_NUMBER = "formatted_number";
     field public static final java.lang.String CACHED_LOOKUP_URI = "lookup_uri";
     field public static final java.lang.String CACHED_MATCHED_NUMBER = "matched_number";
@@ -22924,6 +22922,8 @@
     field public static final java.lang.String NUMBER_PRESENTATION = "presentation";
     field public static final java.lang.String OFFSET_PARAM_KEY = "offset";
     field public static final int OUTGOING_TYPE = 2; // 0x2
+    field public static final java.lang.String PHONE_ACCOUNT_COMPONENT_NAME = "subscription_component_name";
+    field public static final java.lang.String PHONE_ACCOUNT_ID = "subscription_id";
     field public static final int PRESENTATION_ALLOWED = 1; // 0x1
     field public static final int PRESENTATION_PAYPHONE = 4; // 0x4
     field public static final int PRESENTATION_RESTRICTED = 2; // 0x2
diff --git a/core/java/android/bluetooth/BluetoothAdapter.java b/core/java/android/bluetooth/BluetoothAdapter.java
index 2287246..d75304f 100644
--- a/core/java/android/bluetooth/BluetoothAdapter.java
+++ b/core/java/android/bluetooth/BluetoothAdapter.java
@@ -1039,6 +1039,54 @@
     }
 
     /**
+     * Return true if the multi advertisement is supported by the chipset
+     *
+     * @hide
+     * @return true if Multiple Advertisement feature is supported
+     */
+    public boolean isMultipleAdvertisementSupported() {
+        if (getState() != STATE_ON) return false;
+        try {
+            return mService.isMultiAdvertisementSupported();
+        } catch (RemoteException e) {
+            Log.e(TAG, "failed to get isMultipleAdvertisementSupported, error: ", e);
+        }
+        return false;
+    }
+
+    /**
+     * Return true if offloaded filters are supported
+     *
+     * @hide
+     * @return true if chipset supports on-chip filtering
+     */
+    public boolean isOffloadedFilteringSupported() {
+        if (getState() != STATE_ON) return false;
+        try {
+            return mService.isOffloadedFilteringSupported();
+        } catch (RemoteException e) {
+            Log.e(TAG, "failed to get isOffloadedFilteringSupported, error: ", e);
+        }
+        return false;
+    }
+
+    /**
+     * Return true if offloaded scan batching is supported
+     *
+     * @hide
+     * @return true if chipset supports on-chip scan batching
+     */
+    public boolean isOffloadedScanBatchingSupported() {
+        if (getState() != STATE_ON) return false;
+        try {
+            return mService.isOffloadedScanBatchingSupported();
+        } catch (RemoteException e) {
+            Log.e(TAG, "failed to get isOffloadedScanBatchingSupported, error: ", e);
+        }
+        return false;
+    }
+
+    /**
      * Returns whether BLE is currently advertising.
      * <p>Requires {@link android.Manifest.permission#BLUETOOTH_PRIVILEGED}.
      *
diff --git a/core/java/android/bluetooth/IBluetooth.aidl b/core/java/android/bluetooth/IBluetooth.aidl
index df6037e..d334b91 100644
--- a/core/java/android/bluetooth/IBluetooth.aidl
+++ b/core/java/android/bluetooth/IBluetooth.aidl
@@ -84,4 +84,8 @@
     ParcelFileDescriptor createSocketChannel(int type, in String serviceName, in ParcelUuid uuid, int port, int flag);
 
     boolean configHciSnoopLog(boolean enable);
+
+    boolean isMultiAdvertisementSupported();
+    boolean isOffloadedFilteringSupported();
+    boolean isOffloadedScanBatchingSupported();
 }
diff --git a/core/java/android/nfc/cardemulation/AidGroup.java b/core/java/android/nfc/cardemulation/AidGroup.java
index 54b517a..6af7b7e 100644
--- a/core/java/android/nfc/cardemulation/AidGroup.java
+++ b/core/java/android/nfc/cardemulation/AidGroup.java
@@ -130,38 +130,55 @@
     };
 
     static public AidGroup createFromXml(XmlPullParser parser) throws XmlPullParserException, IOException {
-        String category = parser.getAttributeValue(null, "category");
+        String category = null;
         ArrayList<String> aids = new ArrayList<String>();
+        AidGroup group = null;
+        boolean inGroup = false;
+
         int eventType = parser.getEventType();
         int minDepth = parser.getDepth();
         while (eventType != XmlPullParser.END_DOCUMENT && parser.getDepth() >= minDepth) {
+            String tagName = parser.getName();
             if (eventType == XmlPullParser.START_TAG) {
-                String tagName = parser.getName();
                 if (tagName.equals("aid")) {
-                    String aid = parser.getAttributeValue(null, "value");
-                    if (aid != null) {
-                        aids.add(aid);
+                    if (inGroup) {
+                        String aid = parser.getAttributeValue(null, "value");
+                        if (aid != null) {
+                            aids.add(aid);
+                        }
+                    } else {
+                        Log.d(TAG, "Ignoring <aid> tag while not in group");
                     }
+                } else if (tagName.equals("aid-group")) {
+                    category = parser.getAttributeValue(null, "category");
+                    if (category == null) {
+                        Log.e(TAG, "<aid-group> tag without valid category");
+                        return null;
+                    }
+                    inGroup = true;
                 } else {
-                    Log.d(TAG, "Ignorning unexpected tag: " + tagName);
+                    Log.d(TAG, "Ignoring unexpected tag: " + tagName);
+                }
+            } else if (eventType == XmlPullParser.END_TAG) {
+                if (tagName.equals("aid-group") && inGroup && aids.size() > 0) {
+                    group = new AidGroup(aids, category);
+                    break;
                 }
             }
             eventType = parser.next();
         }
-        if (category != null && aids.size() > 0) {
-            return new AidGroup(aids, category);
-        } else {
-            return null;
-        }
+        return group;
     }
 
     public void writeAsXml(XmlSerializer out) throws IOException {
+        out.startTag(null, "aid-group");
         out.attribute(null, "category", category);
         for (String aid : aids) {
             out.startTag(null, "aid");
             out.attribute(null, "value", aid);
             out.endTag(null, "aid");
         }
+        out.endTag(null, "aid-group");
     }
 
     static boolean isValidCategory(String category) {
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index a71ed47..236f99f 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -3828,9 +3828,10 @@
     <string name="permlab_provide_trust_agent">Provide a trust agent.</string>
     <!-- Description of an application permission that lets it provide a trust agent. -->
     <string name="permdesc_provide_trust_agent">Allows an application to provide a trust agent.</string>
-    <string name="permlab_launch_trust_agent_settings">Lunch trust agent settings menu.</string>
-    <string name="permdesc_launch_trust_agent_settings">Allows an application to lunch an activity that changes the trust agent behavior.</string>
-
+    <!-- Title of an application permission that lets it launch the trust agent settings menu -->
+    <string name="permlab_launch_trust_agent_settings">Launch trust agent settings menu.</string>
+    <!-- Description of an application permission that lets it launch the trust agent settings menu -->
+    <string name="permdesc_launch_trust_agent_settings">Allows an application to launch an activity that changes the trust agent behavior.</string>
     <!-- Title of an application permission that lets it bind to a trust agent service. -->
     <string name="permlab_bind_trust_agent_service">Bind to a trust agent service</string>
     <!-- Description of an application permission that lets it bind to a trust agent service. -->