Merge "TIF: Add COLUMN_SEARCHABLE to TvContract.Programs" into mnc-dev
diff --git a/api/current.txt b/api/current.txt
index b8a8dfe..3a50ed7 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -18167,6 +18167,7 @@
     method public boolean isDefaultNetworkActive();
     method public static deprecated boolean isNetworkTypeValid(int);
     method public void registerNetworkCallback(android.net.NetworkRequest, android.net.ConnectivityManager.NetworkCallback);
+    method public void registerNetworkCallback(android.net.NetworkRequest, android.app.PendingIntent);
     method public void releaseNetworkRequest(android.app.PendingIntent);
     method public void removeDefaultNetworkActiveListener(android.net.ConnectivityManager.OnNetworkActiveListener);
     method public deprecated void reportBadNetwork(android.net.Network);
@@ -28075,18 +28076,6 @@
     field public static final int UPPER = 121; // 0x79
   }
 
-  public static abstract class ScriptIntrinsicBLAS.Diag implements java.lang.annotation.Annotation {
-  }
-
-  public static abstract class ScriptIntrinsicBLAS.Side implements java.lang.annotation.Annotation {
-  }
-
-  public static abstract class ScriptIntrinsicBLAS.Transpose implements java.lang.annotation.Annotation {
-  }
-
-  public static abstract class ScriptIntrinsicBLAS.Uplo implements java.lang.annotation.Annotation {
-  }
-
   public class ScriptIntrinsicBlend extends android.renderscript.ScriptIntrinsic {
     method public static android.renderscript.ScriptIntrinsicBlend create(android.renderscript.RenderScript, android.renderscript.Element);
     method public void forEachAdd(android.renderscript.Allocation, android.renderscript.Allocation);
@@ -30629,10 +30618,11 @@
     field public static final java.lang.String KEY_CARRIER_WFC_IMS_AVAILABLE_BOOL = "carrier_wfc_ims_available_bool";
     field public static final java.lang.String KEY_CDMA_NONROAMING_NETWORKS_STRING_ARRAY = "cdma_nonroaming_networks_string_array";
     field public static final java.lang.String KEY_CDMA_ROAMING_NETWORKS_STRING_ARRAY = "cdma_roaming_networks_string_array";
+    field public static final java.lang.String KEY_CSP_ENABLED_BOOL = "csp_enabled_bool";
     field public static final java.lang.String KEY_DEFAULT_SIM_CALL_MANAGER_STRING = "default_sim_call_manager_string";
     field public static final java.lang.String KEY_DISABLE_CDMA_ACTIVATION_CODE_BOOL = "disable_cdma_activation_code_bool";
     field public static final java.lang.String KEY_DTMF_TYPE_ENABLED_BOOL = "dtmf_type_enabled_bool";
-    field public static final java.lang.String KEY_ENABLE_DIALER_KEY_VIBRATION_BOOL = "enable_dialer_vibration_bool";
+    field public static final java.lang.String KEY_ENABLE_DIALER_KEY_VIBRATION_BOOL = "enable_dialer_key_vibration_bool";
     field public static final java.lang.String KEY_GSM_NONROAMING_NETWORKS_STRING_ARRAY = "gsm_nonroaming_networks_string_array";
     field public static final java.lang.String KEY_GSM_ROAMING_NETWORKS_STRING_ARRAY = "gsm_roaming_networks_string_array";
     field public static final java.lang.String KEY_HAS_IN_CALL_NOISE_SUPPRESSION_BOOL = "has_in_call_noise_suppression_bool";
diff --git a/api/system-current.txt b/api/system-current.txt
index 34a86cf..3f33f71 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -19668,6 +19668,7 @@
     method public boolean isDefaultNetworkActive();
     method public static deprecated boolean isNetworkTypeValid(int);
     method public void registerNetworkCallback(android.net.NetworkRequest, android.net.ConnectivityManager.NetworkCallback);
+    method public void registerNetworkCallback(android.net.NetworkRequest, android.app.PendingIntent);
     method public void releaseNetworkRequest(android.app.PendingIntent);
     method public void removeDefaultNetworkActiveListener(android.net.ConnectivityManager.OnNetworkActiveListener);
     method public deprecated void reportBadNetwork(android.net.Network);
@@ -30123,18 +30124,6 @@
     field public static final int UPPER = 121; // 0x79
   }
 
-  public static abstract class ScriptIntrinsicBLAS.Diag implements java.lang.annotation.Annotation {
-  }
-
-  public static abstract class ScriptIntrinsicBLAS.Side implements java.lang.annotation.Annotation {
-  }
-
-  public static abstract class ScriptIntrinsicBLAS.Transpose implements java.lang.annotation.Annotation {
-  }
-
-  public static abstract class ScriptIntrinsicBLAS.Uplo implements java.lang.annotation.Annotation {
-  }
-
   public class ScriptIntrinsicBlend extends android.renderscript.ScriptIntrinsic {
     method public static android.renderscript.ScriptIntrinsicBlend create(android.renderscript.RenderScript, android.renderscript.Element);
     method public void forEachAdd(android.renderscript.Allocation, android.renderscript.Allocation);
@@ -32852,10 +32841,11 @@
     field public static final java.lang.String KEY_CARRIER_WFC_IMS_AVAILABLE_BOOL = "carrier_wfc_ims_available_bool";
     field public static final java.lang.String KEY_CDMA_NONROAMING_NETWORKS_STRING_ARRAY = "cdma_nonroaming_networks_string_array";
     field public static final java.lang.String KEY_CDMA_ROAMING_NETWORKS_STRING_ARRAY = "cdma_roaming_networks_string_array";
+    field public static final java.lang.String KEY_CSP_ENABLED_BOOL = "csp_enabled_bool";
     field public static final java.lang.String KEY_DEFAULT_SIM_CALL_MANAGER_STRING = "default_sim_call_manager_string";
     field public static final java.lang.String KEY_DISABLE_CDMA_ACTIVATION_CODE_BOOL = "disable_cdma_activation_code_bool";
     field public static final java.lang.String KEY_DTMF_TYPE_ENABLED_BOOL = "dtmf_type_enabled_bool";
-    field public static final java.lang.String KEY_ENABLE_DIALER_KEY_VIBRATION_BOOL = "enable_dialer_vibration_bool";
+    field public static final java.lang.String KEY_ENABLE_DIALER_KEY_VIBRATION_BOOL = "enable_dialer_key_vibration_bool";
     field public static final java.lang.String KEY_GSM_NONROAMING_NETWORKS_STRING_ARRAY = "gsm_nonroaming_networks_string_array";
     field public static final java.lang.String KEY_GSM_ROAMING_NETWORKS_STRING_ARRAY = "gsm_roaming_networks_string_array";
     field public static final java.lang.String KEY_HAS_IN_CALL_NOISE_SUPPRESSION_BOOL = "has_in_call_noise_suppression_bool";
diff --git a/cmds/app_process/Android.mk b/cmds/app_process/Android.mk
index 3599695..7ce0846 100644
--- a/cmds/app_process/Android.mk
+++ b/cmds/app_process/Android.mk
@@ -1,5 +1,12 @@
 LOCAL_PATH:= $(call my-dir)
 
+# This is a list of libraries that need to be included in order to avoid
+# bad apps. This prevents a library from having a mismatch when resolving
+# new/delete from an app shared library.
+# See b/21032018 for more details.
+app_process_common_shared_libs := \
+    libwilhelm \
+
 include $(CLEAR_VARS)
 
 LOCAL_SRC_FILES:= \
@@ -13,7 +20,8 @@
     libutils \
     liblog \
     libbinder \
-    libandroid_runtime
+    libandroid_runtime \
+    $(app_process_common_shared_libs) \
 
 LOCAL_WHOLE_STATIC_LIBRARIES := libsigchain
 
@@ -44,7 +52,8 @@
     libutils \
     liblog \
     libbinder \
-    libandroid_runtime
+    libandroid_runtime \
+    $(app_process_common_shared_libs) \
 
 LOCAL_WHOLE_STATIC_LIBRARIES := libsigchain
 
diff --git a/core/java/android/app/ApplicationThreadNative.java b/core/java/android/app/ApplicationThreadNative.java
index 1461380..e178087 100644
--- a/core/java/android/app/ApplicationThreadNative.java
+++ b/core/java/android/app/ApplicationThreadNative.java
@@ -35,6 +35,9 @@
 import android.os.IBinder;
 import android.os.Parcel;
 import android.os.ParcelFileDescriptor;
+import android.os.TransactionTooLargeException;
+import android.util.Log;
+
 import com.android.internal.app.IVoiceInteractor;
 import com.android.internal.content.ReferrerIntent;
 
@@ -921,8 +924,13 @@
         info.writeToParcel(data, 0);
         compatInfo.writeToParcel(data, 0);
         data.writeInt(processState);
-        mRemote.transact(SCHEDULE_CREATE_SERVICE_TRANSACTION, data, null,
-                IBinder.FLAG_ONEWAY);
+        try {
+            mRemote.transact(SCHEDULE_CREATE_SERVICE_TRANSACTION, data, null,
+                    IBinder.FLAG_ONEWAY);
+        } catch (TransactionTooLargeException e) {
+            Log.e("CREATE_SERVICE", "Binder failure starting service; service=" + info);
+            throw e;
+        }
         data.recycle();
     }
 
diff --git a/core/java/android/app/usage/UsageStatsManagerInternal.java b/core/java/android/app/usage/UsageStatsManagerInternal.java
index 7bcc038..8a31390 100644
--- a/core/java/android/app/usage/UsageStatsManagerInternal.java
+++ b/core/java/android/app/usage/UsageStatsManagerInternal.java
@@ -54,6 +54,14 @@
     public abstract void reportConfigurationChange(Configuration config, int userId);
 
     /**
+     * Reports that a content provider has been accessed by a foreground app.
+     * @param name The authority of the content provider
+     * @param pkgName The package name of the content provider
+     * @param userId The user in which the content provider was accessed.
+     */
+    public abstract void reportContentProviderUsage(String name, String pkgName, int userId);
+
+    /**
      * Prepares the UsageStatsService for shutdown.
      */
     public abstract void prepareShutdown();
diff --git a/core/java/android/content/ContentResolver.java b/core/java/android/content/ContentResolver.java
index 057001c..d37dda0 100644
--- a/core/java/android/content/ContentResolver.java
+++ b/core/java/android/content/ContentResolver.java
@@ -48,6 +48,7 @@
 
 import dalvik.system.CloseGuard;
 
+import com.android.internal.util.ArrayUtils;
 import com.android.internal.util.Preconditions;
 
 import java.io.File;
@@ -57,6 +58,7 @@
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 import java.util.Random;
 
@@ -1936,6 +1938,19 @@
     }
 
     /**
+     * @hide
+     * Returns the package names of syncadapters that match a given user and authority.
+     */
+    public static String[] getSyncAdapterPackagesForAuthorityAsUser(String authority,
+            int userId) {
+        try {
+            return getContentService().getSyncAdapterPackagesForAuthorityAsUser(authority, userId);
+        } catch (RemoteException e) {
+        }
+        return ArrayUtils.emptyArray(String.class);
+    }
+
+    /**
      * Check if the provider should be synced when a network tickle is received
      * <p>This method requires the caller to hold the permission
      * {@link android.Manifest.permission#READ_SYNC_SETTINGS}.
diff --git a/core/java/android/content/IContentService.aidl b/core/java/android/content/IContentService.aidl
index 9998f08..8b471a0 100644
--- a/core/java/android/content/IContentService.aidl
+++ b/core/java/android/content/IContentService.aidl
@@ -143,6 +143,8 @@
     SyncAdapterType[] getSyncAdapterTypes();
     SyncAdapterType[] getSyncAdapterTypesAsUser(int userId);
 
+    String[] getSyncAdapterPackagesForAuthorityAsUser(String authority, int userId);
+
     /**
      * Returns true if there is currently a operation for the given account/authority or service
      * actively being processed.
diff --git a/core/java/android/content/SyncAdaptersCache.java b/core/java/android/content/SyncAdaptersCache.java
index 8bb3ee7..6704b75 100644
--- a/core/java/android/content/SyncAdaptersCache.java
+++ b/core/java/android/content/SyncAdaptersCache.java
@@ -20,12 +20,19 @@
 import android.content.pm.XmlSerializerAndParser;
 import android.content.res.Resources;
 import android.content.res.TypedArray;
+import android.util.ArrayMap;
 import android.util.AttributeSet;
+import android.util.SparseArray;
+
+import com.android.internal.annotations.GuardedBy;
+
 import org.xmlpull.v1.XmlPullParser;
 import org.xmlpull.v1.XmlSerializer;
 import org.xmlpull.v1.XmlPullParserException;
 
 import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
 
 /**
  * A cache of services that export the {@link android.content.ISyncAdapter} interface.
@@ -39,6 +46,10 @@
     private static final String ATTRIBUTES_NAME = "sync-adapter";
     private static final MySerializer sSerializer = new MySerializer();
 
+    @GuardedBy("mServicesLock")
+    private SparseArray<ArrayMap<String,String[]>> mAuthorityToSyncAdapters
+            = new SparseArray<>();
+
     public SyncAdaptersCache(Context context) {
         super(context, SERVICE_INTERFACE, SERVICE_META_DATA, ATTRIBUTES_NAME, sSerializer);
     }
@@ -76,6 +87,57 @@
         }
     }
 
+    @Override
+    protected void onServicesChangedLocked(int userId) {
+        synchronized (mServicesLock) {
+            ArrayMap<String,String[]> adapterMap = mAuthorityToSyncAdapters.get(userId);
+            if (adapterMap != null) {
+                adapterMap.clear();
+            }
+        }
+
+        super.onServicesChangedLocked(userId);
+    }
+
+    public String[] getSyncAdapterPackagesForAuthority(String authority, int userId) {
+        synchronized (mServicesLock) {
+            ArrayMap<String,String[]> adapterMap = mAuthorityToSyncAdapters.get(userId);
+            if (adapterMap == null) {
+                adapterMap = new ArrayMap<>();
+                mAuthorityToSyncAdapters.put(userId, adapterMap);
+            }
+            // If the mapping exists, return it
+            if (adapterMap.containsKey(authority)) {
+                return adapterMap.get(authority);
+            }
+            // Create the mapping and cache it
+            String[] syncAdapterPackages;
+            final Collection<RegisteredServicesCache.ServiceInfo<SyncAdapterType>> serviceInfos;
+            serviceInfos = getAllServices(userId);
+            ArrayList<String> packages = new ArrayList<>();
+            for (RegisteredServicesCache.ServiceInfo<SyncAdapterType> serviceInfo : serviceInfos) {
+                if (authority.equals(serviceInfo.type.authority)
+                        && serviceInfo.componentName != null) {
+                    packages.add(serviceInfo.componentName.getPackageName());
+                }
+            }
+            syncAdapterPackages = new String[packages.size()];
+            packages.toArray(syncAdapterPackages);
+            adapterMap.put(authority, syncAdapterPackages);
+
+            return syncAdapterPackages;
+        }
+    }
+
+    @Override
+    protected void onUserRemoved(int userId) {
+        synchronized (mServicesLock) {
+            mAuthorityToSyncAdapters.remove(userId);
+        }
+
+        super.onUserRemoved(userId);
+    }
+
     static class MySerializer implements XmlSerializerAndParser<SyncAdapterType> {
         public void writeAsXml(SyncAdapterType item, XmlSerializer out) throws IOException {
             out.attribute(null, "authority", item.authority);
diff --git a/core/java/android/content/pm/ApplicationInfo.java b/core/java/android/content/pm/ApplicationInfo.java
index 9fb6f4d..6feb860 100644
--- a/core/java/android/content/pm/ApplicationInfo.java
+++ b/core/java/android/content/pm/ApplicationInfo.java
@@ -962,6 +962,13 @@
     /**
      * @hide
      */
+    public boolean isPrivilegedApp() {
+        return (privateFlags & ApplicationInfo.PRIVATE_FLAG_PRIVILEGED) != 0;
+    }
+
+    /**
+     * @hide
+     */
     public boolean isUpdatedSystemApp() {
         return (flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0;
     }
diff --git a/core/java/android/content/pm/PackageManagerInternal.java b/core/java/android/content/pm/PackageManagerInternal.java
new file mode 100644
index 0000000..7599bd6
--- /dev/null
+++ b/core/java/android/content/pm/PackageManagerInternal.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.content.pm;
+
+import android.annotation.NonNull;
+
+/**
+ * Package manager local system service interface.
+ *
+ * @hide Only for use within the system server.
+ */
+public abstract class PackageManagerInternal {
+
+    /**
+     * Provider for package names.
+     */
+    public interface PackagesProvider {
+
+        /**
+         * Gets the packages for a given user.
+         * @param userId The user id.
+         * @return The package names.
+         */
+        public String[] getPackages(int userId);
+    }
+
+    /**
+     * Sets the location provider packages provider.
+     * @param provider The packages provider.
+     */
+    public abstract void setLocationPackagesProvider(PackagesProvider provider);
+
+    /**
+     * Sets the input method packages provider.
+     * @param provider The packages provider.
+     */
+    public abstract void setImePackagesProvider(PackagesProvider provider);
+
+    /**
+     * Sets the voice interaction packages provider.
+     * @param provider The packages provider.
+     */
+    public abstract void setVoiceInteractionPackagesProvider(PackagesProvider provider);
+}
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index 287e0c5..faf71ee 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -4508,6 +4508,13 @@
         /**
          * @hide
          */
+        public boolean isPrivilegedApp() {
+            return applicationInfo.isPrivilegedApp();
+        }
+
+        /**
+         * @hide
+         */
         public boolean isUpdatedSystemApp() {
             return applicationInfo.isUpdatedSystemApp();
         }
diff --git a/core/java/android/content/pm/RegisteredServicesCache.java b/core/java/android/content/pm/RegisteredServicesCache.java
index 0bd2a3b..b293e2a 100644
--- a/core/java/android/content/pm/RegisteredServicesCache.java
+++ b/core/java/android/content/pm/RegisteredServicesCache.java
@@ -84,7 +84,7 @@
     private final String mAttributesName;
     private final XmlSerializerAndParser<V> mSerializerAndParser;
 
-    private final Object mServicesLock = new Object();
+    protected final Object mServicesLock = new Object();
 
     @GuardedBy("mServicesLock")
     private final SparseArray<UserServices<V>> mUserServices = new SparseArray<UserServices<V>>(2);
@@ -232,6 +232,7 @@
         synchronized (mServicesLock) {
             final UserServices<V> user = findOrCreateUserLocked(userId);
             user.services = null;
+            onServicesChangedLocked(userId);
         }
     }
 
@@ -489,11 +490,16 @@
                 }
             }
             if (changed) {
+                onServicesChangedLocked(userId);
                 writePersistentServicesLocked(user, userId);
             }
         }
     }
 
+    protected void onServicesChangedLocked(int userId) {
+        // Feel free to override
+    }
+
     /**
      * Returns true if the list of changed uids is null (wildcard) or the specified uid
      * is contained in the list of changed uids.
@@ -687,7 +693,9 @@
 
     @VisibleForTesting
     protected void onUserRemoved(int userId) {
-        mUserServices.remove(userId);
+        synchronized (mServicesLock) {
+            mUserServices.remove(userId);
+        }
     }
 
     @VisibleForTesting
diff --git a/core/java/android/hardware/camera2/legacy/SurfaceTextureRenderer.java b/core/java/android/hardware/camera2/legacy/SurfaceTextureRenderer.java
index f928a55..bc80fc1 100644
--- a/core/java/android/hardware/camera2/legacy/SurfaceTextureRenderer.java
+++ b/core/java/android/hardware/camera2/legacy/SurfaceTextureRenderer.java
@@ -630,8 +630,6 @@
                 holder.width = surfaceSize.getWidth();
                 holder.height = surfaceSize.getHeight();
                 if (LegacyCameraDevice.needsConversion(s)) {
-                    // Always override to YV12 output for YUV surface formats.
-                    LegacyCameraDevice.setSurfaceFormat(s, ImageFormat.YV12);
                     mConversionSurfaces.add(holder);
                 } else {
                     mSurfaces.add(holder);
diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java
index a2ca41c..b9f7365 100644
--- a/core/java/android/net/ConnectivityManager.java
+++ b/core/java/android/net/ConnectivityManager.java
@@ -2461,7 +2461,7 @@
      * Intent to reserve the network or it will be released shortly after the Intent
      * is processed.
      * <p>
-     * If there is already an request for this Intent registered (with the equality of
+     * If there is already a request for this Intent registered (with the equality of
      * two Intents defined by {@link Intent#filterEquals}), then it will be removed and
      * replaced by this one, effectively releasing the previous {@link NetworkRequest}.
      * <p>
@@ -2521,6 +2521,44 @@
     }
 
     /**
+     * Registers a PendingIntent to be sent when a network is available which satisfies the given
+     * {@link NetworkRequest}.
+     *
+     * This function behaves identically to the version that takes a NetworkCallback, but instead
+     * of {@link NetworkCallback} a {@link PendingIntent} is used.  This means
+     * the request may outlive the calling application and get called back when a suitable
+     * network is found.
+     * <p>
+     * The operation is an Intent broadcast that goes to a broadcast receiver that
+     * you registered with {@link Context#registerReceiver} or through the
+     * &lt;receiver&gt; tag in an AndroidManifest.xml file
+     * <p>
+     * The operation Intent is delivered with two extras, a {@link Network} typed
+     * extra called {@link #EXTRA_NETWORK} and a {@link NetworkRequest}
+     * typed extra called {@link #EXTRA_NETWORK_REQUEST} containing
+     * the original requests parameters.
+     * <p>
+     * If there is already a request for this Intent registered (with the equality of
+     * two Intents defined by {@link Intent#filterEquals}), then it will be removed and
+     * replaced by this one, effectively releasing the previous {@link NetworkRequest}.
+     * <p>
+     * The request may be released normally by calling
+     * {@link #releaseNetworkRequest(android.app.PendingIntent)}.
+     * <p>This method requires the caller to hold the permission
+     * {@link android.Manifest.permission#ACCESS_NETWORK_STATE}.
+     * @param request {@link NetworkRequest} describing this request.
+     * @param operation Action to perform when the network is available (corresponds
+     *                  to the {@link NetworkCallback#onAvailable} call.  Typically
+     *                  comes from {@link PendingIntent#getBroadcast}. Cannot be null.
+     */
+    public void registerNetworkCallback(NetworkRequest request, PendingIntent operation) {
+        checkPendingIntent(operation);
+        try {
+            mService.pendingListenForNetwork(request.networkCapabilities, operation);
+        } catch (RemoteException e) {}
+    }
+
+    /**
      * Requests bandwidth update for a given {@link Network} and returns whether the update request
      * is accepted by ConnectivityService. Once accepted, ConnectivityService will poll underlying
      * network connection for updated bandwidth information. The caller will be notified via
diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java
index eb6e1c2..593f804 100644
--- a/core/java/android/os/BatteryStats.java
+++ b/core/java/android/os/BatteryStats.java
@@ -65,7 +65,7 @@
      * A constant indicating a window wake lock timer.
      */
     public static final int WAKE_TYPE_WINDOW = 2;
-    
+
     /**
      * A constant indicating a sensor timer.
      */
@@ -142,6 +142,11 @@
     public static final int CAMERA_TURNED_ON = 17;
 
     /**
+     * A constant indicating a doze wake lock timer.
+     */
+    public static final int WAKE_TYPE_DOZE = 18;
+
+    /**
      * Include all of the data in the stats, including previously saved data.
      */
     public static final int STATS_SINCE_CHARGED = 0;
@@ -3834,6 +3839,7 @@
             final ArrayMap<String, ? extends BatteryStats.Uid.Wakelock> wakelocks
                     = u.getWakelockStats();
             long totalFullWakelock = 0, totalPartialWakelock = 0, totalWindowWakelock = 0;
+            long totalDozeWakelock = 0;
             int countWakelock = 0;
             for (int iw=wakelocks.size()-1; iw>=0; iw--) {
                 final Uid.Wakelock wl = wakelocks.valueAt(iw);
@@ -3848,19 +3854,21 @@
                         "partial", which, linePrefix);
                 linePrefix = printWakeLock(sb, wl.getWakeTime(WAKE_TYPE_WINDOW), rawRealtime,
                         "window", which, linePrefix);
-                if (true || !linePrefix.equals(": ")) {
-                    sb.append(" realtime");
-                    // Only print out wake locks that were held
-                    pw.println(sb.toString());
-                    uidActivity = true;
-                    countWakelock++;
-                }
+                linePrefix = printWakeLock(sb, wl.getWakeTime(WAKE_TYPE_DOZE), rawRealtime,
+                        "doze", which, linePrefix);
+                sb.append(" realtime");
+                pw.println(sb.toString());
+                uidActivity = true;
+                countWakelock++;
+
                 totalFullWakelock += computeWakeLock(wl.getWakeTime(WAKE_TYPE_FULL),
                         rawRealtime, which);
                 totalPartialWakelock += computeWakeLock(wl.getWakeTime(WAKE_TYPE_PARTIAL),
                         rawRealtime, which);
                 totalWindowWakelock += computeWakeLock(wl.getWakeTime(WAKE_TYPE_WINDOW),
                         rawRealtime, which);
+                totalDozeWakelock += computeWakeLock(wl.getWakeTime(WAKE_TYPE_DOZE),
+                        rawRealtime, which);
             }
             if (countWakelock > 1) {
                 if (totalFullWakelock != 0 || totalPartialWakelock != 0
@@ -3890,6 +3898,14 @@
                         formatTimeMs(sb, totalWindowWakelock);
                         sb.append("window");
                     }
+                    if (totalDozeWakelock != 0) {
+                        if (needComma) {
+                            sb.append(",");
+                        }
+                        needComma = true;
+                        formatTimeMs(sb, totalDozeWakelock);
+                        sb.append("doze");
+                    }
                     sb.append(" realtime");
                     pw.println(sb.toString());
                 }
diff --git a/core/java/android/os/Process.java b/core/java/android/os/Process.java
index dbb5146..f9c50f3 100644
--- a/core/java/android/os/Process.java
+++ b/core/java/android/os/Process.java
@@ -635,8 +635,8 @@
             if ((debugFlags & Zygote.DEBUG_ENABLE_JIT) != 0) {
                 argsForZygote.add("--enable-jit");
             }
-            if ((debugFlags & Zygote.DEBUG_GENERATE_CFI) != 0) {
-                argsForZygote.add("--generate-cfi");
+            if ((debugFlags & Zygote.DEBUG_GENERATE_DEBUG_INFO) != 0) {
+                argsForZygote.add("--generate-debug-info");
             }
             if ((debugFlags & Zygote.DEBUG_ENABLE_ASSERT) != 0) {
                 argsForZygote.add("--enable-assert");
diff --git a/core/java/android/provider/CallLog.java b/core/java/android/provider/CallLog.java
index 7d57233..23555d6 100644
--- a/core/java/android/provider/CallLog.java
+++ b/core/java/android/provider/CallLog.java
@@ -518,11 +518,6 @@
             if (callType == MISSED_TYPE) {
                 values.put(IS_READ, Integer.valueOf(0));
             }
-            if (ci != null) {
-                values.put(CACHED_NAME, ci.name);
-                values.put(CACHED_NUMBER_TYPE, ci.numberType);
-                values.put(CACHED_NUMBER_LABEL, ci.numberLabel);
-            }
 
             if ((ci != null) && (ci.contactIdOrZero > 0)) {
                 // Update usage information for the number associated with the contact ID.
diff --git a/core/java/android/widget/ListPopupWindow.java b/core/java/android/widget/ListPopupWindow.java
index afc683a..534bfad 100644
--- a/core/java/android/widget/ListPopupWindow.java
+++ b/core/java/android/widget/ListPopupWindow.java
@@ -105,7 +105,7 @@
     private final ListSelectorHider mHideSelector = new ListSelectorHider();
     private Runnable mShowDropDownRunnable;
 
-    private Handler mHandler = new Handler();
+    private final Handler mHandler;
 
     private Rect mTempRect = new Rect();
 
@@ -212,6 +212,7 @@
      */
     public ListPopupWindow(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
         mContext = context;
+        mHandler = new Handler(context.getMainLooper());
 
         final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ListPopupWindow,
                 defStyleAttr, defStyleRes);
diff --git a/core/java/android/widget/NumberPicker.java b/core/java/android/widget/NumberPicker.java
index e7d9226..b5fae4e 100644
--- a/core/java/android/widget/NumberPicker.java
+++ b/core/java/android/widget/NumberPicker.java
@@ -149,6 +149,11 @@
     private static final int SIZE_UNSPECIFIED = -1;
 
     /**
+     * User choice on whether the selector wheel should be wrapped.
+     */
+    private boolean mWrapSelectorWheelPreferred = true;
+
+    /**
      * Use a custom NumberPicker formatting callback to use two-digit minutes
      * strings like "01". Keeping a static formatter etc. is the most efficient
      * way to do this; it avoids creating temporary objects on every call to
@@ -1353,10 +1358,21 @@
      * @param wrapSelectorWheel Whether to wrap.
      */
     public void setWrapSelectorWheel(boolean wrapSelectorWheel) {
+        mWrapSelectorWheelPreferred = wrapSelectorWheel;
+        updateWrapSelectorWheel();
+
+    }
+
+    /**
+     * Whether or not the selector wheel should be wrapped is determined by user choice and whether
+     * the choice is allowed. The former comes from {@link #setWrapSelectorWheel(boolean)}, the
+     * latter is calculated based on min & max value set vs selector's visual length. Therefore,
+     * this method should be called any time any of the 3 values (i.e. user choice, min and max
+     * value) gets updated.
+     */
+    private void updateWrapSelectorWheel() {
         final boolean wrappingAllowed = (mMaxValue - mMinValue) >= mSelectorIndices.length;
-        if ((!wrapSelectorWheel || wrappingAllowed) && wrapSelectorWheel != mWrapSelectorWheel) {
-            mWrapSelectorWheel = wrapSelectorWheel;
-        }
+        mWrapSelectorWheel = wrappingAllowed && mWrapSelectorWheelPreferred;
     }
 
     /**
@@ -1412,8 +1428,7 @@
         if (mMinValue > mValue) {
             mValue = mMinValue;
         }
-        boolean wrapSelectorWheel = mMaxValue - mMinValue > mSelectorIndices.length;
-        setWrapSelectorWheel(wrapSelectorWheel);
+        updateWrapSelectorWheel();
         initializeSelectorWheelIndices();
         updateInputTextView();
         tryComputeMaxWidth();
@@ -1450,8 +1465,7 @@
         if (mMaxValue < mValue) {
             mValue = mMaxValue;
         }
-        boolean wrapSelectorWheel = mMaxValue - mMinValue > mSelectorIndices.length;
-        setWrapSelectorWheel(wrapSelectorWheel);
+        updateWrapSelectorWheel();
         initializeSelectorWheelIndices();
         updateInputTextView();
         tryComputeMaxWidth();
diff --git a/core/java/android/widget/RelativeLayout.java b/core/java/android/widget/RelativeLayout.java
index 339038e..affc5da 100644
--- a/core/java/android/widget/RelativeLayout.java
+++ b/core/java/android/widget/RelativeLayout.java
@@ -522,7 +522,7 @@
         View baselineView = null;
         LayoutParams baselineParams = null;
         for (int i = 0; i < count; i++) {
-            final View child = views[i];
+            final View child = getChildAt(i);
             if (child.getVisibility() != GONE) {
                 final LayoutParams childParams = (LayoutParams) child.getLayoutParams();
                 if (baselineView == null || baselineParams == null
@@ -548,9 +548,9 @@
 
             if (offsetHorizontalAxis) {
                 for (int i = 0; i < count; i++) {
-                    final View child = views[i];
+                    View child = getChildAt(i);
                     if (child.getVisibility() != GONE) {
-                        final LayoutParams params = (LayoutParams) child.getLayoutParams();
+                        LayoutParams params = (LayoutParams) child.getLayoutParams();
                         final int[] rules = params.getRules(layoutDirection);
                         if (rules[CENTER_IN_PARENT] != 0 || rules[CENTER_HORIZONTAL] != 0) {
                             centerHorizontal(child, params, width);
@@ -578,9 +578,9 @@
 
             if (offsetVerticalAxis) {
                 for (int i = 0; i < count; i++) {
-                    final View child = views[i];
+                    View child = getChildAt(i);
                     if (child.getVisibility() != GONE) {
-                        final LayoutParams params = (LayoutParams) child.getLayoutParams();
+                        LayoutParams params = (LayoutParams) child.getLayoutParams();
                         final int[] rules = params.getRules(layoutDirection);
                         if (rules[CENTER_IN_PARENT] != 0 || rules[CENTER_VERTICAL] != 0) {
                             centerVertical(child, params, height);
@@ -607,9 +607,9 @@
             final int verticalOffset = contentBounds.top - top;
             if (horizontalOffset != 0 || verticalOffset != 0) {
                 for (int i = 0; i < count; i++) {
-                    final View child = views[i];
+                    View child = getChildAt(i);
                     if (child.getVisibility() != GONE && child != ignore) {
-                        final LayoutParams params = (LayoutParams) child.getLayoutParams();
+                        LayoutParams params = (LayoutParams) child.getLayoutParams();
                         if (horizontalGravity) {
                             params.mLeft += horizontalOffset;
                             params.mRight += horizontalOffset;
@@ -626,9 +626,9 @@
         if (isLayoutRtl()) {
             final int offsetWidth = myWidth - width;
             for (int i = 0; i < count; i++) {
-                final View child = views[i];
+                View child = getChildAt(i);
                 if (child.getVisibility() != GONE) {
-                    final LayoutParams params = (LayoutParams) child.getLayoutParams();
+                    LayoutParams params = (LayoutParams) child.getLayoutParams();
                     params.mLeft -= offsetWidth;
                     params.mRight -= offsetWidth;
                 }
diff --git a/core/java/com/android/internal/app/ChooserActivity.java b/core/java/com/android/internal/app/ChooserActivity.java
index 2a13c76..678e92b 100644
--- a/core/java/com/android/internal/app/ChooserActivity.java
+++ b/core/java/com/android/internal/app/ChooserActivity.java
@@ -50,11 +50,13 @@
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.View.OnClickListener;
+import android.view.View.OnLongClickListener;
 import android.view.ViewGroup;
 import android.widget.AbsListView;
 import android.widget.BaseAdapter;
 import android.widget.ListView;
 import com.android.internal.R;
+import com.android.internal.logging.MetricsLogger;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -185,6 +187,8 @@
         setSafeForwardingMode(true);
         super.onCreate(savedInstanceState, target, title, defaultTitleRes, initialIntents,
                 null, false);
+
+        MetricsLogger.action(this, MetricsLogger.ACTION_ACTIVITY_CHOOSER_SHOWN);
     }
 
     @Override
@@ -291,6 +295,36 @@
         return super.onTargetSelected(target, alwaysCheck);
     }
 
+    @Override
+    void startSelected(int which, boolean always, boolean filtered) {
+        super.startSelected(which, always, filtered);
+
+        if (mChooserListAdapter != null) {
+            // Log the index of which type of target the user picked.
+            // Lower values mean the ranking was better.
+            int cat = 0;
+            int value = which;
+            switch (mChooserListAdapter.getPositionTargetType(which)) {
+                case ChooserListAdapter.TARGET_CALLER:
+                    cat = MetricsLogger.ACTION_ACTIVITY_CHOOSER_PICKED_APP_TARGET;
+                    break;
+                case ChooserListAdapter.TARGET_SERVICE:
+                    cat = MetricsLogger.ACTION_ACTIVITY_CHOOSER_PICKED_SERVICE_TARGET;
+                    value -= mChooserListAdapter.getCallerTargetCount();
+                    break;
+                case ChooserListAdapter.TARGET_STANDARD:
+                    cat = MetricsLogger.ACTION_ACTIVITY_CHOOSER_PICKED_STANDARD_TARGET;
+                    value -= mChooserListAdapter.getCallerTargetCount()
+                            + mChooserListAdapter.getServiceTargetCount();
+                    break;
+            }
+
+            if (cat != 0) {
+                MetricsLogger.action(this, cat, value);
+            }
+        }
+    }
+
     void queryTargetServices(ChooserListAdapter adapter) {
         final PackageManager pm = getPackageManager();
         int targetsToQuery = 0;
@@ -851,6 +885,14 @@
                             startSelected(itemIndex, false, true);
                         }
                     });
+                    v.setOnLongClickListener(new OnLongClickListener() {
+                        @Override
+                        public boolean onLongClick(View v) {
+                            showAppDetails(
+                                    mChooserListAdapter.resolveInfoForPosition(itemIndex, true));
+                            return true;
+                        }
+                    });
                 } else {
                     v.setVisibility(View.GONE);
                 }
diff --git a/core/java/com/android/internal/logging/MetricsLogger.java b/core/java/com/android/internal/logging/MetricsLogger.java
index 03f2e3a..e4ccb4b 100644
--- a/core/java/com/android/internal/logging/MetricsLogger.java
+++ b/core/java/com/android/internal/logging/MetricsLogger.java
@@ -33,6 +33,10 @@
     public static final int ACTION_VOLUME_KEY = 211;
     public static final int ACTION_VOLUME_ICON = 212;
     public static final int ACTION_RINGER_MODE = 213;
+    public static final int ACTION_ACTIVITY_CHOOSER_SHOWN = 214;
+    public static final int ACTION_ACTIVITY_CHOOSER_PICKED_APP_TARGET = 215;
+    public static final int ACTION_ACTIVITY_CHOOSER_PICKED_SERVICE_TARGET = 216;
+    public static final int ACTION_ACTIVITY_CHOOSER_PICKED_STANDARD_TARGET = 217;
     // Temporary constants go here, to await migration to MetricsConstants.
 
     public static void visible(Context context, int category) throws IllegalArgumentException {
diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java
index 229079f..83ce5f6 100644
--- a/core/java/com/android/internal/os/BatteryStatsImpl.java
+++ b/core/java/com/android/internal/os/BatteryStatsImpl.java
@@ -106,7 +106,7 @@
     private static final int MAGIC = 0xBA757475; // 'BATSTATS'
 
     // Current on-disk Parcel version
-    private static final int VERSION = 128 + (USE_OLD_HISTORY ? 1000 : 0);
+    private static final int VERSION = 129 + (USE_OLD_HISTORY ? 1000 : 0);
 
     // Maximum number of items we will record in the history.
     private static final int MAX_HISTORY_ITEMS = 2000;
@@ -208,6 +208,7 @@
     final ArrayList<StopwatchTimer> mPartialTimers = new ArrayList<>();
     final ArrayList<StopwatchTimer> mFullTimers = new ArrayList<>();
     final ArrayList<StopwatchTimer> mWindowTimers = new ArrayList<>();
+    final ArrayList<StopwatchTimer> mDozeTimers = new ArrayList<>();
     final SparseArray<ArrayList<StopwatchTimer>> mSensorTimers = new SparseArray<>();
     final ArrayList<StopwatchTimer> mWifiRunningTimers = new ArrayList<>();
     final ArrayList<StopwatchTimer> mFullWifiLockTimers = new ArrayList<>();
@@ -5648,6 +5649,11 @@
             StopwatchTimer mTimerWindow;
 
             /**
+             * How long (in ms) this uid has had a doze wake lock.
+             */
+            StopwatchTimer mTimerDoze;
+
+            /**
              * Reads a possibly null Timer from a Parcel.  The timer is associated with the
              * proper timer pool from the given BatteryStatsImpl object.
              *
@@ -5674,6 +5680,9 @@
                 if (mTimerWindow != null) {
                     wlactive |= !mTimerWindow.reset(false);
                 }
+                if (mTimerDoze != null) {
+                    wlactive |= !mTimerDoze.reset(false);
+                }
                 if (!wlactive) {
                     if (mTimerFull != null) {
                         mTimerFull.detach();
@@ -5687,6 +5696,10 @@
                         mTimerWindow.detach();
                         mTimerWindow = null;
                     }
+                    if (mTimerDoze != null) {
+                        mTimerDoze.detach();
+                        mTimerDoze = null;
+                    }
                 }
                 return !wlactive;
             }
@@ -5694,16 +5707,16 @@
             void readFromParcelLocked(TimeBase timeBase, TimeBase screenOffTimeBase, Parcel in) {
                 mTimerPartial = readTimerFromParcel(WAKE_TYPE_PARTIAL,
                         mPartialTimers, screenOffTimeBase, in);
-                mTimerFull = readTimerFromParcel(WAKE_TYPE_FULL,
-                        mFullTimers, timeBase, in);
-                mTimerWindow = readTimerFromParcel(WAKE_TYPE_WINDOW,
-                        mWindowTimers, timeBase, in);
+                mTimerFull = readTimerFromParcel(WAKE_TYPE_FULL, mFullTimers, timeBase, in);
+                mTimerWindow = readTimerFromParcel(WAKE_TYPE_WINDOW, mWindowTimers, timeBase, in);
+                mTimerDoze = readTimerFromParcel(WAKE_TYPE_DOZE, mDozeTimers, timeBase, in);
             }
 
             void writeToParcelLocked(Parcel out, long elapsedRealtimeUs) {
                 Timer.writeTimerToParcel(out, mTimerPartial, elapsedRealtimeUs);
                 Timer.writeTimerToParcel(out, mTimerFull, elapsedRealtimeUs);
                 Timer.writeTimerToParcel(out, mTimerWindow, elapsedRealtimeUs);
+                Timer.writeTimerToParcel(out, mTimerDoze, elapsedRealtimeUs);
             }
 
             @Override
@@ -5712,6 +5725,7 @@
                 case WAKE_TYPE_FULL: return mTimerFull;
                 case WAKE_TYPE_PARTIAL: return mTimerPartial;
                 case WAKE_TYPE_WINDOW: return mTimerWindow;
+                case WAKE_TYPE_DOZE: return mTimerDoze;
                 default: throw new IllegalArgumentException("type = " + type);
                 }
             }
@@ -5743,6 +5757,13 @@
                             mTimerWindow = t;
                         }
                         return t;
+                    case WAKE_TYPE_DOZE:
+                        t = mTimerDoze;
+                        if (t == null) {
+                            t = new StopwatchTimer(Uid.this, WAKE_TYPE_DOZE,
+                                    mDozeTimers, mOnBatteryTimeBase);
+                            mTimerDoze = t;
+                        }
                     default:
                         throw new IllegalArgumentException("type=" + type);
                 }
@@ -6599,6 +6620,9 @@
             if (in.readInt() != 0) {
                 wl.getStopwatchTimer(WAKE_TYPE_WINDOW).readSummaryFromParcelLocked(in);
             }
+            if (in.readInt() != 0) {
+                wl.getStopwatchTimer(WAKE_TYPE_DOZE).readSummaryFromParcelLocked(in);
+            }
         }
 
         public StopwatchTimer getSensorTimerLocked(int sensor, boolean create) {
@@ -9586,6 +9610,12 @@
                 } else {
                     out.writeInt(0);
                 }
+                if (wl.mTimerDoze != null) {
+                    out.writeInt(1);
+                    wl.mTimerDoze.writeSummaryFromParcelLocked(out, NOWREAL_SYS);
+                } else {
+                    out.writeInt(0);
+                }
             }
 
             final ArrayMap<String, StopwatchTimer> syncStats = u.mSyncStats.getMap();
diff --git a/core/java/com/android/internal/os/Zygote.java b/core/java/com/android/internal/os/Zygote.java
index 4f6d781..c97fdf4 100644
--- a/core/java/com/android/internal/os/Zygote.java
+++ b/core/java/com/android/internal/os/Zygote.java
@@ -41,8 +41,8 @@
     public static final int DEBUG_ENABLE_JNI_LOGGING = 1 << 4;
     /** enable the JIT compiler */
     public static final int DEBUG_ENABLE_JIT         = 1 << 5;
-    /** Force generation of CFI code */
-    public static final int DEBUG_GENERATE_CFI       = 1 << 6;
+    /** Force generation of native debugging information. */
+    public static final int DEBUG_GENERATE_DEBUG_INFO = 1 << 6;
 
     /** No external storage should be mounted. */
     public static final int MOUNT_EXTERNAL_NONE = 0;
diff --git a/core/java/com/android/internal/os/ZygoteConnection.java b/core/java/com/android/internal/os/ZygoteConnection.java
index 1a0345b..fa870b9 100644
--- a/core/java/com/android/internal/os/ZygoteConnection.java
+++ b/core/java/com/android/internal/os/ZygoteConnection.java
@@ -322,7 +322,7 @@
 
         /**
          * From --enable-debugger, --enable-checkjni, --enable-assert,
-         * --enable-safemode, --enable-jit, --generate-cfi and --enable-jni-logging.
+         * --enable-safemode, --enable-jit, --generate-debug-info and --enable-jni-logging.
          */
         int debugFlags;
 
@@ -434,8 +434,8 @@
                     debugFlags |= Zygote.DEBUG_ENABLE_CHECKJNI;
                 } else if (arg.equals("--enable-jit")) {
                     debugFlags |= Zygote.DEBUG_ENABLE_JIT;
-                } else if (arg.equals("--generate-cfi")) {
-                    debugFlags |= Zygote.DEBUG_GENERATE_CFI;
+                } else if (arg.equals("--generate-debug-info")) {
+                    debugFlags |= Zygote.DEBUG_GENERATE_DEBUG_INFO;
                 } else if (arg.equals("--enable-jni-logging")) {
                     debugFlags |= Zygote.DEBUG_ENABLE_JNI_LOGGING;
                 } else if (arg.equals("--enable-assert")) {
diff --git a/core/java/com/android/internal/statusbar/IStatusBar.aidl b/core/java/com/android/internal/statusbar/IStatusBar.aidl
index 9f99f62..0732add 100644
--- a/core/java/com/android/internal/statusbar/IStatusBar.aidl
+++ b/core/java/com/android/internal/statusbar/IStatusBar.aidl
@@ -64,5 +64,7 @@
      *        bar caused by this app transition in millis
      */
     void appTransitionStarting(long statusBarAnimationsStartTime, long statusBarAnimationsDuration);
+
+    void showAssistDisclosure();
 }
 
diff --git a/core/java/com/android/internal/widget/FloatingToolbar.java b/core/java/com/android/internal/widget/FloatingToolbar.java
index 65f2f53f..523663c 100644
--- a/core/java/com/android/internal/widget/FloatingToolbar.java
+++ b/core/java/com/android/internal/widget/FloatingToolbar.java
@@ -546,25 +546,25 @@
         private void refreshCoordinatesAndOverflowDirection(Rect contentRect) {
             refreshViewPort();
 
-            int availableHeightAboveContent =
-                    contentRect.top - mViewPort.top - 2 * mMarginVertical;
-            int availableHeightBelowContent =
-                    mViewPort.bottom - contentRect.bottom - 2 * mMarginVertical;
-            int availableHeightThroughContent =
-                    mViewPort.bottom - contentRect.top + getToolbarHeightWithVerticalMargin();
-
             int x = contentRect.centerX() - getWidth() / 2;
             // Update x so that the toolbar isn't rendered behind the nav bar in landscape.
             x = Math.max(0, Math.min(x, mViewPort.right - getWidth()));
 
             int y;
+
+            int availableHeightAboveContent = contentRect.top - mViewPort.top;
+            int availableHeightBelowContent = mViewPort.bottom - contentRect.bottom;
+
             if (mOverflowPanel == null) {  // There is no overflow.
-                if (availableHeightAboveContent > getToolbarHeightWithVerticalMargin()) {
+                if (availableHeightAboveContent >= getToolbarHeightWithVerticalMargin()) {
                     // There is enough space at the top of the content.
                     y = contentRect.top - getToolbarHeightWithVerticalMargin();
-                } else if (availableHeightBelowContent > getToolbarHeightWithVerticalMargin()) {
+                } else if (availableHeightBelowContent >= getToolbarHeightWithVerticalMargin()) {
                     // There is enough space at the bottom of the content.
                     y = contentRect.bottom;
+                } else if (availableHeightBelowContent >= getEstimatedToolbarHeight(getContext())) {
+                    // Just enough space to fit the toolbar with no vertical margins.
+                    y = contentRect.bottom - mMarginVertical;
                 } else {
                     // Not enough space. Prefer to position as high as possible.
                     y = Math.max(
@@ -572,32 +572,47 @@
                             contentRect.top - getToolbarHeightWithVerticalMargin());
                 }
             } else {  // There is an overflow.
-                if (availableHeightAboveContent > mOverflowPanel.getMinimumHeight()) {
+                int margin = 2 * mMarginVertical;
+                int minimumOverflowHeightWithMargin = mOverflowPanel.getMinimumHeight() + margin;
+                int availableHeightThroughContentDown =
+                        mViewPort.bottom - contentRect.top + getToolbarHeightWithVerticalMargin();
+                int availableHeightThroughContentUp =
+                        contentRect.bottom - mViewPort.top + getToolbarHeightWithVerticalMargin();
+
+                if (availableHeightAboveContent >= minimumOverflowHeightWithMargin) {
                     // There is enough space at the top of the content rect for the overflow.
                     // Position above and open upwards.
-                    updateOverflowHeight(availableHeightAboveContent);
+                    updateOverflowHeight(availableHeightAboveContent - margin);
                     y = contentRect.top - getHeight();
                     mOverflowDirection = OVERFLOW_DIRECTION_UP;
-                } else if (availableHeightAboveContent > getToolbarHeightWithVerticalMargin()
-                        && availableHeightThroughContent > mOverflowPanel.getMinimumHeight()) {
+                } else if (availableHeightAboveContent >= getToolbarHeightWithVerticalMargin()
+                        && availableHeightThroughContentDown >= minimumOverflowHeightWithMargin) {
                     // There is enough space at the top of the content rect for the main panel
                     // but not the overflow.
                     // Position above but open downwards.
-                    updateOverflowHeight(availableHeightThroughContent);
+                    updateOverflowHeight(availableHeightThroughContentDown - margin);
                     y = contentRect.top - getToolbarHeightWithVerticalMargin();
                     mOverflowDirection = OVERFLOW_DIRECTION_DOWN;
-                } else if (availableHeightBelowContent > mOverflowPanel.getMinimumHeight()) {
+                } else if (availableHeightBelowContent >= minimumOverflowHeightWithMargin) {
                     // There is enough space at the bottom of the content rect for the overflow.
                     // Position below and open downwards.
-                    updateOverflowHeight(availableHeightBelowContent);
+                    updateOverflowHeight(availableHeightBelowContent - margin);
                     y = contentRect.bottom;
                     mOverflowDirection = OVERFLOW_DIRECTION_DOWN;
+                } else if (availableHeightBelowContent >= getToolbarHeightWithVerticalMargin()
+                        && mViewPort.height() >= minimumOverflowHeightWithMargin) {
+                    // There is enough space at the bottom of the content rect for the main panel
+                    // but not the overflow.
+                    // Position below but open upwards.
+                    updateOverflowHeight(availableHeightThroughContentUp - margin);
+                    y = contentRect.bottom + getToolbarHeightWithVerticalMargin() - getHeight();
+                    mOverflowDirection = OVERFLOW_DIRECTION_UP;
                 } else {
                     // Not enough space.
-                    // Position at the bottom of the view port and open upwards.
-                    updateOverflowHeight(mViewPort.height());
-                    y = mViewPort.bottom - getHeight();
-                    mOverflowDirection = OVERFLOW_DIRECTION_UP;
+                    // Position at the top of the view port and open downwards.
+                    updateOverflowHeight(mViewPort.height() - margin);
+                    y = mViewPort.top;
+                    mOverflowDirection = OVERFLOW_DIRECTION_DOWN;
                 }
                 mOverflowPanel.setOverflowDirection(mOverflowDirection);
             }
@@ -1422,7 +1437,6 @@
         PopupWindow popupWindow = new PopupWindow(popupContentHolder);
         popupWindow.setWindowLayoutType(
                 WindowManager.LayoutParams.TYPE_APPLICATION_ABOVE_SUB_PANEL);
-        popupWindow.setInputMethodMode(PopupWindow.INPUT_METHOD_NEEDED);
         popupWindow.setAnimationStyle(0);
         popupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
         content.setLayoutParams(new ViewGroup.LayoutParams(
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp
index 7c2b28d..2c35a8b 100644
--- a/core/jni/AndroidRuntime.cpp
+++ b/core/jni/AndroidRuntime.cpp
@@ -876,16 +876,16 @@
                        "-Xzygote-max-boot-retry=");
 
     /*
-     * When running with debug.gencfi, add --include-cfi to the compiler options so that the boot
-     * image, if it is compiled on device, will include CFI info, as well as other compilations
-     * started by the runtime.
+     * When running with debug.generate-debug-info, add --generate-debug-info to
+     * the compiler options so that the boot image, if it is compiled on device,
+     * will include native debugging information.
      */
-    property_get("debug.gencfi", propBuf, "");
+    property_get("debug.generate-debug-info", propBuf, "");
     if (strcmp(propBuf, "true") == 0) {
         addOption("-Xcompiler-option");
-        addOption("--include-cfi");
+        addOption("--generate-debug-info");
         addOption("-Ximage-compiler-option");
-        addOption("--include-cfi");
+        addOption("--generate-debug-info");
     }
 
     initArgs.version = JNI_VERSION_1_4;
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index c2e8c8b..5b40d30 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -490,7 +490,7 @@
         android:permissionGroup="android.permission-group.STORAGE"
         android:label="@string/permlab_sdcardRead"
         android:description="@string/permdesc_sdcardRead"
-        android:protectionLevel="normal" />
+        android:protectionLevel="dangerous" />
 
     <!-- Allows an application to write to external storage.
          <p class="note"><strong>Note:</strong> If <em>both</em> your <a
@@ -1414,13 +1414,13 @@
     <permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"
         android:label="@string/permlab_install_shortcut"
         android:description="@string/permdesc_install_shortcut"
-        android:protectionLevel="dangerous"/>
+        android:protectionLevel="normal"/>
 
     <!-- Allows an application to uninstall a shortcut in Launcher -->
     <permission android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT"
         android:label="@string/permlab_uninstall_shortcut"
         android:description="@string/permdesc_uninstall_shortcut"
-        android:protectionLevel="dangerous"/>
+        android:protectionLevel="normal"/>
 
     <!-- ==================================================== -->
     <!-- Permissions related to accessing sync settings   -->
diff --git a/docs/html/design/tv/index.jd b/docs/html/design/tv/index.jd
index def1286..38e5b79 100644
--- a/docs/html/design/tv/index.jd
+++ b/docs/html/design/tv/index.jd
@@ -4,6 +4,12 @@
 page.image=design/tv/images/apps-games-rows.jpg
 @jd:body
 
+<a class="notice-designers" style="clear:none" href="http://www.google.com/design/spec-tv">
+  <div>
+    <h3>Material Design</h3>
+    <p>Android TV Design Guidelines</p>
+  </div>
+</a>
 
 <p>The Android TV platform user interface provides the launch pad for your app's big screen
   experience. It's important to understand how your app is presented in the main user interface and
diff --git a/docs/html/design/wear/context.jd b/docs/html/design/wear/context.jd
index 688806f..7a0baf8 100644
--- a/docs/html/design/wear/context.jd
+++ b/docs/html/design/wear/context.jd
@@ -2,19 +2,19 @@
 @jd:body
 
 <style>
-div.slide-wrapper {
+.slide-wrapper {
   width:780px;
   overflow:visible;
 }
-div.slide {
+.slide {
   width:370px;
   float:left;
   margin:0 20px 0 0;
 }
-div.slide p {
+.slide p {
   height:40px;
 }
-div.slide img {
+.slide img {
   height: 208px;
 }
 </style>
@@ -140,8 +140,8 @@
 
 <div class="slide">
 <h2>Location-based Query</h2>
-<p>Ask things like, "Are there any picnic tables free at the park?" and get answers from 
-people who are there.</p>
+<p>Ask questions like, "Are there any picnic tables free at the park?" and get answers in real-time
+from people in the area.</p>
 <img src="{@docRoot}design/media/wear/ContextualExample.015.png" alt=""
      srcset="{@docRoot}design/media/wear/ContextualExample.015.png 1x,
              {@docRoot}design/media/wear/ContextualExample.015_2x.png 2x" />
@@ -149,4 +149,6 @@
 
 
 
-</div>
\ No newline at end of file
+</div>
+
+<p style="clear:both;height:0">&nbsp;</p>
\ No newline at end of file
diff --git a/docs/html/design/wear/creative-vision.jd b/docs/html/design/wear/creative-vision.jd
index 0955240..36a87eb 100644
--- a/docs/html/design/wear/creative-vision.jd
+++ b/docs/html/design/wear/creative-vision.jd
@@ -25,34 +25,29 @@
 
 
   <div class="page-vision">
-    <img src="{@docRoot}design/media/wear/vision_traffic.png" width="147" height="147" />
-
     <h2 id="Launched">Launched automatically</h2>
+    <img src="{@docRoot}design/media/wear/vision_traffic.png" width="147" height="147" />
     <p>Most people are used to launching apps by clicking an icon. Android Wear is different. Wearable apps are aware of the user’s context - time, location, physical activity, and so on. The apps use this information to insert cards into the stream when they become relevant. This makes Android Wear timely, relevant and very specific.</p>
   </div>
 
   <div class="page-vision">
-    <img src="{@docRoot}design/media/wear/vision_navigation.png" width="147" height="147" />
-
     <h2 id="Glanceable">Glanceable</h2>
+    <img src="{@docRoot}design/media/wear/vision_navigation.png" width="147" height="147" />
     <p>A classic wrist watch is designed to let you see the time in a split second and get on with what you were doing. Designing for Android Wear is no different. The less time it takes to use your software, the more time the user can be present in whatever they are doing. Android wear is fast, sharp, and immediate.</p>
   </div>
 
   <div class="page-vision">
-    <img src="{@docRoot}design/media/wear/vision_voice.png" width="147" height="147" style="border: 1px solid #ddd;" />
-
     <h2 id="SuggestDemand">All about suggest and demand</h2>
+    <img src="{@docRoot}design/media/wear/vision_voice.png" width="147" height="147" style="border: 1px solid #ddd;" />
     <p>Android Wear is like a great personal assistant: it knows you and your preferences, it only interrupts you when absolutely necessary, and it’s always on hand to provide a ready answer. Android Wear is helpful, respectful, and responsive.</p>
   </div>
 
   <div class="page-vision">
-    <img src="{@docRoot}design/media/wear/vision_music.png" width="147" height="147" />
-
     <h2 id="Interaction">Zero or low interaction</h2>
+    <img src="{@docRoot}design/media/wear/vision_music.png" width="147" height="147" />
     <p>Staying true to the strengths afforded by a smaller form factor, Android Wear focuses on simple interactions, only requiring input by the user when absolutely necessary. Most inputs are based around touch swipes or voice, and inputs requiring fine-grained finger movements are avoided. Android Wear is gestural, simple, and fast.</p>
   </div>
 
 <p>By providing a smart connection to the rest of the world while respecting the user’s attention, Android Wear feels personal and global, simple and smart, unobtrusive and ever-ready. Applications that represent these principles will feel most at home in the overall Android Wear experience.</p>
 
 <p>Third party apps extend Android Wear to be more specialized and helpful throughout the day. Installing apps are a way for the user to tell the Android Wear how to do that.</p>
-
diff --git a/docs/html/design/wear/patterns.jd b/docs/html/design/wear/patterns.jd
index e56ac2d..0436cf5 100644
--- a/docs/html/design/wear/patterns.jd
+++ b/docs/html/design/wear/patterns.jd
@@ -46,11 +46,9 @@
 
 <h2 id="Dismissing" style="clear:both">Dismissing cards</h2>
 
-  <img src="{@docRoot}design/media/wear/dismiss_cards.png" height="147">
-
 <p>Swiping from left to right on a card causes it to be dismissed from the stream. Dismissed cards may return when they next have relevant information. State is synced between the Android Wear context stream and the notifications on the Android handheld device, so dismissing from one causes an automatic dismissal from the other.</p>
 
-
+<img src="{@docRoot}design/media/wear/dismiss_cards.png" height="147">
 
 <h2 id="Actions" style="clear:both">Action buttons</h2>
 
@@ -162,12 +160,11 @@
 
 <h2 id="Selection" style="clear:both">Selection List</h2>
 
-  <img src="{@docRoot}design/media/wear/selection_list.png" width="147" height="147" style="float:right;margin:0 0 20px 40px;border:1px solid #ddd">
+  <img src="{@docRoot}design/media/wear/selection_list.png" width="147" height="147" style="float:left;margin:0 0 20px 40px;border:1px solid #ddd">
 
 <p>Choosing an item from a list is a common interaction. The Selection List pattern (available as the <a
 href="{@docRoot}training/wearables/apps/layouts.html#UiLibrary"><code>WearableListView</code></a> component) creates a simple list optimized for ease of use on a small screen where the focused item snaps to the center of the screen and a single tap selects. This widget is recommended as a common pattern for selecting items. It is used throughout the system UI, including in the list that can be accessed by swiping up on the cue card.</p>
 
-
 <p>Of course, it is possible for Android Wear apps to extend themselves beyond the familiarities of these patterns. For a deeper look at the options available, see the <a href="{@docRoot}design/wear/structure.html">App Structure</a> guide.</p>
 
 <a class="notice-developers left" href="{@docRoot}training/wearables/ui/lists.html">
@@ -176,3 +173,5 @@
     <p>Creating Lists</p>
   </div>
 </a>
+
+<p style="clear:both;height:0">&nbsp;</p>
diff --git a/docs/html/design/wear/style.jd b/docs/html/design/wear/style.jd
index bb559fe..75bd65f 100644
--- a/docs/html/design/wear/style.jd
+++ b/docs/html/design/wear/style.jd
@@ -48,19 +48,18 @@
 </div>
 
 
-
-  <img src="{@docRoot}design/media/wear/low_info_card.png" width="147" height="147"
-  style="float:right;margin:29px 0 20px 40px">
-
 <h2 id="InfoDensity" style="margin-top:0" >Low Information Density</h2>
 
+<img src="{@docRoot}design/media/wear/low_info_card.png" width="147" height="147"
+style="float:left;margin:5px 20px 20px 0">
+
 <p>Cards should be designed to be glanceable in a split second, just like reading the time on a traditional watch. In most cases a pairing of an icon and value, or a title and short caption should be enough to convey a meaningful message. Note that the background photo should also be used to convey information; backgrounds that change to reflect and support the primary message in the card work great. For example, in the case illustrated to the right, a suitable background image is chosen to reflect the severity of current traffic conditions. This is not just a nice piece of attention to detail; the background actually reinforces the message and makes the content more glanceable.</p>
 
 
-<img src="{@docRoot}design/media/wear/separate_info_cards.jpg" height="147"
-  style="float:right;margin:29px 0 20px 40px">
 
 <h2 id="Chunks">Separate Information into Chunks</h2>
+<img src="{@docRoot}design/media/wear/separate_info_cards.jpg" height="147"
+  style="float:right;margin:5px 0 20px 20px">
 
 <p>In cases where additional information is absolutely necessary, don’t crowd out a card layout to the point where glanceability is affected. Instead, add an additional <a href="{@docRoot}design/wear/patterns.html#Pages">page</a> (or multiple pages, if needed) to the right of the main card in the stream to which the user can swipe for more information. See also <a
 href="{@docRoot}design/wear/patterns.html#Continuing">Continuing activities on phone</a>.</p>
@@ -73,21 +72,19 @@
 
 
 
-<img src="{@docRoot}design/media/wear/clear_bold_type.jpg" height="147"
-  style="float:left;margin:19px 40px 20px 0">
-
 <h2 id="Typography" >Use Clear, Bold Typography</h2>
+<img src="{@docRoot}design/media/wear/clear_bold_type.jpg" height="147"
+  style="float:left;margin:5px 20px 20px 0">
 
 <p>The system font is Roboto Condensed, with Regular and Light variants. Text should adhere to the size and color recommendations (see the UI Toolkit in the <a href="{@docRoot}design/downloads/index.html#Wear">Downloads</a> page). In general, text should be displayed as large as possible. Your goal should be to convey maximum information with minimum fuss.</p>
 
 
 <h2 id="Branding" style="clear:both" >Use Consistent Branding and Color</h2>
 
-<p>The app icon is used to identify and brand your application. The icon is optional but when present always appears in the same location, overhanging the top right edge of the card. Note that app icons or branding should not be displayed in the background photo, which is reserved to display an image relevant to the information on the card.</p>
-
-
 <img src="{@docRoot}design/media/wear/copywrite.png" height="147"
-  style="float:left;margin:19px 40px 20px 0">
+  style="float:right;margin:0 20px 0 20px">
+
+<p style="margin-bottom: 60px">The app icon is used to identify and brand your application. The icon is optional but when present always appears in the same location, overhanging the top right edge of the card. Note that app icons or branding should not be displayed in the background photo, which is reserved to display an image relevant to the information on the card.</p>
 
 <h2 id="Copywrite" >Copywrite Sparingly</h2>
 
@@ -98,18 +95,11 @@
 
 <p>Wearables are personal devices by nature, but they are not completely private. If your notification serves content that may be particularly sensitive or embarrassing (such as notifications from a dating app or a medical status report), consider not displaying all of the information in a peek card. A notification could place the sensitive information on a second page that must be swiped to, or an application could show different amounts of detail in peek and focused card positions.</p>
 
-
-  <img src="{@docRoot}design/media/wear/confirmation.png" height="147"
-  style="float:left;margin:29px 40px 20px 0">
-
-
 <h2 id="ConfirmAnim">Confirmation Animations</h2>
 
+<img src="{@docRoot}design/media/wear/confirmation.png" height="147"
+  style="float:left;margin:5px 20px 20px 0">
+
 <p>If your app allows the user to perform an action, it is necessary to provide positive feedback. Show a generic confirmation animation or create your own. A confirmation animation is an opportunity to express your app’s character and insert a moment of delight for your user. Keep animations short (less than 1000ms) and simple. Animating the confirmation icon is an effective way of transitioning the user to a new state after completing an action.</p>
 
-
-
-
-
-
-
+<p style="clear:both;height:0">&nbsp;</p>
\ No newline at end of file
diff --git a/docs/html/design/wear/watchfaces.jd b/docs/html/design/wear/watchfaces.jd
index 2def05b..e018523 100644
--- a/docs/html/design/wear/watchfaces.jd
+++ b/docs/html/design/wear/watchfaces.jd
@@ -4,7 +4,7 @@
 
 <!-- developer docs box -->
 <a class="notice-developers right" href="{@docRoot}training/wearables/watch-faces/index.html"
-   style="clear:left;margin-bottom:90px">
+   style="clear:left">
   <div>
     <h3>Developer Docs</h3>
     <p>Creating Watch Faces</p>
@@ -22,7 +22,7 @@
 <p>Follow the guidelines in this page to design your custom watch faces.</p>
 
 <!-- H2 creative vision -->
-<div style="float:right;margin-top:-100px;margin-bottom:20px;margin-left:20px">
+<div style="float:right;margin-bottom:20px;margin-left:20px">
   <img src="{@docRoot}design/media/wear/Render_Next.png"
        width="200" height="195" alt="" style="margin-right:5px"/><br/>
   <img src="{@docRoot}design/media/wear/Render_Interactive.png"
@@ -137,44 +137,39 @@
 of screen available on the device. Consider the best design for your watch faces on all
 screens.</p>
 
-<div class="cols" style="margin-top:20px">
-<div class="col-9">
-  <h3>Reduced color space</h3>
-  <p>Some displays use a reduced color space in ambient mode to save power.</p>
-  <p>One reduced color space power saving method is to use a "low-bit" mode. In low-bit mode,
-  the available colors are limited to black, white, blue, red, magenta, green, cyan, and yellow.
-  When designing for low-bit ambient mode, use a black or a white background. For OLED screens,
-  you must use a black background. Non-background pixels must be less than 10 percent of total
-  pixels. You can use low-bit color for up to 5 percent of pixels on screens that support it.
-  You should also disable antialiasing in your paint styles for this mode. Make sure to test
-  your design on devices with low-bit ambient mode.</p>
-  <p>Other displays save power in ambient mode by not producing any color. When designing for
-  displays which do not use color in ambient mode, the background may be either black or
-  white.</p>
-</div>
-<div class="col-4">
+<div style="float:right;margin-bottom:20px;margin-left:20px">
   <img src="{@docRoot}design/media/wear/Render_LowBit.png" width="200"
        height="" alt="" style="margin-top:45px;margin-left:13px">
 </div>
-</div>
+<h3>Reduced color space</h3>
 
-<div class="cols" style="margin-top:20px">
-<div class="col-9">
-  <h3>Burn protection techniques</h3>
-  <p>When designing for OLED screens, you should consider power efficiency and the screen
-  burn-in effect. When these screens are in ambient mode, the system shifts the contents of
-  the screen periodically by a few pixels to avoid pixel burn-in. Do not use large blocks of
-  pixels in your ambient mode designs and keep 95% of the pixels black. Replace solid shapes in
-  your regular ambient mode designs with outlined shapes in burn-protected ambient mode. Also
-  replace filled images with pixel patterns. For analog watch face designs, hollow out the center
-  where the hands meet to avoid pixel burn-in in this mode.</p>
-</div>
-<div class="col-4">
+<p>Some displays use a reduced color space in ambient mode to save power.</p>
+<p>One reduced color space power saving method is to use a "low-bit" mode. In low-bit mode,
+the available colors are limited to black, white, blue, red, magenta, green, cyan, and yellow.
+When designing for low-bit ambient mode, use a black or a white background. For OLED screens,
+you must use a black background. Non-background pixels must be less than 10 percent of total
+pixels. You can use low-bit color for up to 5 percent of pixels on screens that support it.
+You should also disable antialiasing in your paint styles for this mode. Make sure to test
+your design on devices with low-bit ambient mode.</p>
+<p>Other displays save power in ambient mode by not producing any color. When designing for
+displays which do not use color in ambient mode, the background may be either black or
+white.</p>
+
+
+<h3>Burn protection techniques</h3>
+
+<div style="float:right;margin-bottom:20px;margin-left:20px">
   <img src="{@docRoot}design/media/wear/Render_1Bit.png" width="200"
        height="" alt="" style="margin-top:-10px;margin-left:13px">
 </div>
-</div>
 
+<p>When designing for OLED screens, you should consider power efficiency and the screen
+burn-in effect. When these screens are in ambient mode, the system shifts the contents of
+the screen periodically by a few pixels to avoid pixel burn-in. Do not use large blocks of
+pixels in your ambient mode designs and keep 95% of the pixels black. Replace solid shapes in
+your regular ambient mode designs with outlined shapes in burn-protected ambient mode. Also
+replace filled images with pixel patterns. For analog watch face designs, hollow out the center
+where the hands meet to avoid pixel burn-in in this mode.</p>
 
 
 <h2 id="SystemUI">Accomodate System UI Elements</h2>
@@ -183,9 +178,11 @@
 user the status of the wearable and show notifications from services on the user's phone. Try
 to keep critical elements in your watch face designs from being obscured by the UI elements.</p>
 
-<div class="cols" style="margin-top:20px">
-<div class="col-9">
-  <h3>Cards</h3>
+<div style="float:right;margin-bottom:20px;margin-left:20px">
+  <img src="{@docRoot}design/media/wear/CardsRender_Build.png" width="200"
+        height="" alt="" style="margin-top:20px;margin-left:13px">
+</div>
+<h3>Cards</h3>
 <p>Cards are the notification system that bridges information between the wearable and a
 mobile device. Cards are also how most applications communicate with users. The user will be
 notified on the wearable about items such as emails and messages. As a watch face developer,
@@ -201,16 +198,13 @@
 the bottom half of the face should leverage the small peek card instead.</p>
 <p>The system notifies your watch face when the bounds of a peek card change, so you can
 rearrange the elements in your design if necessary.</p>
-</div>
-<div class="col-4">
-  <img src="{@docRoot}design/media/wear/CardsRender_Build.png" width="200"
-       height="" alt="" style="margin-top:20px;margin-left:13px">
-</div>
-</div>
 
-<div class="cols" style="margin-top:20px">
-<div class="col-9">
-  <h3>Indicators</h3>
+
+<div style="float:right;margin-bottom:20px;margin-left:20px">
+  <img src="{@docRoot}design/media/wear/Indicators_Cropped.png" width="200"
+       height="" alt="" style="margin-top:0px;margin-left:13px">
+</div>
+<h3>Indicators</h3>
 <p>Indicators tell the user the status of the wearable, such as charging and airplane mode.
 When designing a watch face, consider how the indicator will fall over the watch face.</p>
 <p>The indicators can be placed in several fixed locations on the wearable. If you have a
@@ -218,16 +212,12 @@
 position the status icons or the hotword on the bottom of the screen, the system forces small
 peek cards. If the edge of the watch face contains strong visual elements, such as
 ticks or numbers, place the indicators on the center of the screen.</p>
-</div>
-<div class="col-4">
-  <img src="{@docRoot}design/media/wear/Indicators_Cropped.png" width="200"
+
+<div style="float:right;margin-bottom:20px;margin-left:20px">
+  <img src="{@docRoot}design/media/wear/Hotword_Cropped.png" width="200"
        height="" alt="" style="margin-top:0px;margin-left:13px">
 </div>
-</div>
-
-<div class="cols" style="margin-top:20px">
-<div class="col-9">
-  <h3>The hotword</h3>
+<h3>The hotword</h3>
 <p>The hotword is the phrase "OK Google", which tells the user that they can interact with
 the watch using voice commands. When a user turns on the wearable, the hotword appears on
 the screen for a few seconds.</p>
@@ -236,12 +226,6 @@
 watch face. Finally, background protection for the hotword and the indicators should be
 turned on unless your design is tailored to have these elements appear on top of them, for example
 using dark solid colors with no patterns.</p>
-</div>
-<div class="col-4">
-  <img src="{@docRoot}design/media/wear/Hotword_Cropped.png" width="200"
-       height="" alt="" style="margin-top:0px;margin-left:13px">
-</div>
-</div>
 
 <p>For more information about measurements and positioning of system UI elements, see
 <a href="#SpecsAssets">Specifications and Assets</a>.</p>
@@ -253,24 +237,27 @@
 <p>Your watch face can show users contextually relevant data and react to it by changing styles
 and colors in your design.</p>
 
-<div class="cols" style="margin-top:20px">
-<div class="col-9">
-  <h3>What do you want your user to know?</h3>
+<h3>What do you want your user to know?</h3>
+
+<div style="float:right;margin-bottom:20px;margin-left:20px">
+  <img src="{@docRoot}design/media/wear/Render_Saturn.png" width="200"
+       height="" alt="" style="margin-top:-10px;margin-left:13px">
+</div>
+
 <p>The first step in designing a data-integrated watch face is to define a conceptual user
 outcome based on available data. First, generate a strong concept or outcome you believe is
 supported by real user needs. What do you want your users to know after they have glanced
 at your design? Once you have identified your outcome, you need to determine how to obtain
 the required data.</p>
-</div>
-<div class="col-4">
-  <img src="{@docRoot}design/media/wear/Render_Saturn.png" width="200"
+
+<div style="clear:both;"/>
+
+<div style="float:right;margin-bottom:20px;margin-left:20px">
+  <img src="{@docRoot}design/media/wear/Render_Episode.png" width="200"
        height="" alt="" style="margin-top:-10px;margin-left:13px">
 </div>
-</div>
 
-<div class="cols" style="margin-top:20px">
-<div class="col-9">
-  <h3>A watch dial is a timeline; add data to it</h3>
+<h3>A watch dial is a timeline; add data to it</h3>
 <p>Your watch face concept may include use of data beyond time, such as weather, calendar
 and fitness data. Consider the inclusion of data integration creatively. Avoid simply
 overlaying a time-based watch face with extra data. Rather, think about how the data can
@@ -278,16 +265,13 @@
 watch face as a clock with an indication of the current temperature in degrees overlayed,
 you might design a watch face that describes how the temperature will change over the
 course of the day.</p>
-</div>
-<div class="col-4">
-  <img src="{@docRoot}design/media/wear/Render_Episode.png" width="200"
+
+<div style="float:right;margin-bottom:20px;margin-left:20px">
+  <img src="{@docRoot}design/media/wear/Render_Albumem.png" width="200"
        height="" alt="" style="margin-top:-10px;margin-left:13px">
 </div>
-</div>
 
-<div class="cols" style="margin-top:20px">
-<div class="col-9">
-  <h3>Stick to one message</h3>
+<h3>Stick to one message</h3>
 <p>Once you have solidified your conceptual direction or desired outcome, you will need to
 begin visualizing your watch face. The strongest watch face designs are highly glanceable
 and deliver a singular expression of data. In order to identify your singular message, you
@@ -295,12 +279,6 @@
 an entire month of calendar events,  you might decide to display only the next
 upcoming event. By a process of reduction, you should arrive at a powerful singular
 expression of data to include in your design.</p>
-</div>
-<div class="col-4">
-  <img src="{@docRoot}design/media/wear/Render_Albumem.png" width="200"
-       height="" alt="" style="margin-top:-10px;margin-left:13px">
-</div>
-</div>
 
 <h3>Begin with some insight and test as you go</h3>
 <p>Make sure your approach begins with insight into the needs and expectations of your users.
diff --git a/docs/html/guide/topics/ui/controls/text.jd b/docs/html/guide/topics/ui/controls/text.jd
index 9474dee..c11dc32 100644
--- a/docs/html/guide/topics/ui/controls/text.jd
+++ b/docs/html/guide/topics/ui/controls/text.jd
@@ -172,7 +172,7 @@
 are any subsequent <a
 href="{@docRoot}reference/android/view/View.html#attr_android:focusable">{@code
 android:focusable}</a> fields. If any focusable fields are found following this one, the system
-applies the (@code actionNext} action to the current {@link android.widget.EditText} so the user can
+applies the {@code "actionNext"} action to the current {@link android.widget.EditText} so the user can
 select Next to move to the next field. If there's no subsequent focusable field, the system applies
 the {@code "actionDone"} action. You can override this by setting the <a
 href="{@docRoot}reference/android/widget/TextView.html#attr_android:imeOptions">{@code
@@ -263,7 +263,7 @@
 
 <p>If you want to provide suggestions to users as they type, you can use a subclass of {@link
 android.widget.EditText} called {@link android.widget.AutoCompleteTextView}. To implement
-auto-complete, you must specify an (@link android.widget.Adapter) that provides the text
+auto-complete, you must specify an {@link android.widget.Adapter} that provides the text
 suggestions. There are several kinds of adapters available, depending on where the data is coming
 from, such as from a database or an array.</p>
 
diff --git a/docs/html/tools/building/building-cmdline.jd b/docs/html/tools/building/building-cmdline.jd
index 0e4c8b2..bf3e873 100644
--- a/docs/html/tools/building/building-cmdline.jd
+++ b/docs/html/tools/building/building-cmdline.jd
@@ -353,13 +353,6 @@
   to publish your application, you <strong>must</strong> sign the application with your own private
   key, rather than the debug key generated by the SDK tools.</p>
 
-  <p>Android Studio helps you get started quickly by signing your .apk files with a debug key,
-  prior to installing them on an emulator or development device. This means that you can quickly
-  run your application from Android Studio without having to generate your own private key. No
-  specific action on your part is needed, provided ADT has access to Keytool. However, please note
-  that if you intend to publish your application, you <strong>must</strong> sign the application
-  with your own private key, rather than the debug key generated by the SDK tools.</p>
-
   <p>Please read <a href="{@docRoot}tools/publishing/app-signing.html">Signing Your
   Applications</a>, which provides a thorough guide to application signing on Android and what it
   means to you as an Android application developer. The document also includes a guide to publishing
diff --git a/docs/html/training/tv/discovery/recommendations.jd b/docs/html/training/tv/discovery/recommendations.jd
index a74ee56..ffe33f2 100644
--- a/docs/html/training/tv/discovery/recommendations.jd
+++ b/docs/html/training/tv/discovery/recommendations.jd
@@ -10,6 +10,7 @@
 <div id="tb">
   <h2>This lesson teaches you to</h2>
   <ol>
+    <li><a href="#best-practices">Best Practices for Recommendations</a></li>
     <li><a href="#service">Create a Recommendations Service</a></li>
     <li><a href="#build">Build Recommendations</a></li>
     <li><a href="#run-service">Run Recommendations Service</a></li>
@@ -47,6 +48,46 @@
   Leanback sample app</a>.
 </p>
 
+<h2 id="best-practices">Best Practices for Recommendations</h2>
+
+<p>Recommendations help users quickly find the content and apps they enjoy. Creating
+recommendations that are high-quality and relevant to users is an important factor in creating a
+great user experience with your TV app. For this reason, you should carefully consider what
+recommendations you present to the user and manage them closely.</p>
+
+<h3 id="types">Types of Recommendations</h3>
+
+<p>When you create recommendations, you should link users back to incomplete viewing activities or
+suggest activities that extend that to related content. Here are some specific type of
+recommendations you should consider:</p>
+
+<ul>
+<li><strong>Continuation content</strong> recommendations for the next episode for users to resume
+watching a series.</li>
+<li><strong>New content</strong> recommendations, such as for a new first-run episode, if the user
+finished watching another series.
+<li><strong>Related content</strong> recommendations based on the users historic viewing behavior.
+</ul>
+
+<p>For more information on how to design recommendation cards for the best user experience, see
+<a href="https://www.google.com/design/spec-tv/system-overview/recommendation-row.html#recommendation-row-types-of-recommendations"
+class="external-link">Recommendation Row</a> in the Android TV Design Spec.</p>
+
+<h3 id="refreshing">Refreshing Recommendations</h3>
+
+<p>When refreshing recommendations, don't just remove and repost them, because doing so causes
+the recommendations to appear at the end of the recommendations row. Once a content item, such as a
+movie, has been played, <a href="{@docRoot}guide/topics/ui/notifiers/notifications.html#Removing">
+remove it</a> from the recommendations.</p>
+
+<h3 id="customization">Customizing Recommendations</h3>
+
+<p>You can customize recommendation cards to convey branding information, by setting user interface
+elements such as the card's foreground and background image, color, app icon, title, and subtitle.
+To learn more, see
+<a href="https://www.google.com/design/spec-tv/system-overview/recommendation-row.html#recommendation-row-card-customization"
+class="external-link">Recommendation Row</a> in the Android TV Design Spec.</p>
+
 
 <h2 id="service">Create a Recommendations Service</h2>
 
@@ -116,8 +157,8 @@
         TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
         stackBuilder.addParentStack(DetailsActivity.class);
         stackBuilder.addNextIntent(detailsIntent);
-        // Ensure a unique PendingIntents, otherwise all recommendations end up with the same
-        // PendingIntent
+        // Ensure a unique PendingIntents, otherwise all
+        // recommendations end up with the same PendingIntent
         detailsIntent.setAction(Long.toString(movie.getId()));
 
         PendingIntent intent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);
@@ -143,19 +184,6 @@
 &lt;/manifest&gt;
 </pre>
 
-<h3 id="refreshing">Refreshing Recommendations</h3>
-
-<p>Base your recommendations on user behavior and data such as play lists, wish lists, and associated
-content. When refreshing recommendations, don't just remove and repost them, because doing so causes
-the recommendations to appear at the end of the recommendations row. Once a content item, such as a
-movie, has been played, <a href="{@docRoot}guide/topics/ui/notifiers/notifications.html#Removing">
-remove it</a> from the recommendations.</p>
-
-<p>The order of an app's recommendations is preserved according to the order in which the app
-provides them. The framework interleaves app recommendations based on recommendation quality,
-as measured by user behavior. Better recommendations make an app's recommendations more likely
-to appear near the front of the list.</p>
-
 <h2 id="build">Build Recommendations</h2>
 
 <p>
diff --git a/graphics/java/android/graphics/drawable/RippleDrawable.java b/graphics/java/android/graphics/drawable/RippleDrawable.java
index 134451b..63698337 100644
--- a/graphics/java/android/graphics/drawable/RippleDrawable.java
+++ b/graphics/java/android/graphics/drawable/RippleDrawable.java
@@ -423,6 +423,7 @@
         if (super.setDrawableByLayerId(id, drawable)) {
             if (id == R.id.mask) {
                 mMask = drawable;
+                mHasValidMask = false;
             }
 
             return true;
diff --git a/keystore/java/android/security/keystore/AndroidKeyStoreCipherSpiBase.java b/keystore/java/android/security/keystore/AndroidKeyStoreCipherSpiBase.java
index fc53451..83131ed 100644
--- a/keystore/java/android/security/keystore/AndroidKeyStoreCipherSpiBase.java
+++ b/keystore/java/android/security/keystore/AndroidKeyStoreCipherSpiBase.java
@@ -446,7 +446,7 @@
             inputLen = input.length;
             src.get(input);
         }
-        super.engineUpdateAAD(input, inputOffset, inputLen);
+        engineUpdateAAD(input, inputOffset, inputLen);
     }
 
     @Override
diff --git a/keystore/java/android/security/keystore/AndroidKeyStoreKeyFactorySpi.java b/keystore/java/android/security/keystore/AndroidKeyStoreKeyFactorySpi.java
index 20db41b..250bad7 100644
--- a/keystore/java/android/security/keystore/AndroidKeyStoreKeyFactorySpi.java
+++ b/keystore/java/android/security/keystore/AndroidKeyStoreKeyFactorySpi.java
@@ -24,9 +24,12 @@
 import java.security.KeyFactorySpi;
 import java.security.PrivateKey;
 import java.security.PublicKey;
+import java.security.spec.ECPublicKeySpec;
 import java.security.spec.InvalidKeySpecException;
 import java.security.spec.KeySpec;
 import java.security.spec.PKCS8EncodedKeySpec;
+import java.security.spec.RSAPublicKeySpec;
+import java.security.spec.X509EncodedKeySpec;
 
 /**
  * {@link KeyFactorySpi} backed by Android KeyStore.
@@ -40,32 +43,83 @@
     @Override
     protected <T extends KeySpec> T engineGetKeySpec(Key key, Class<T> keySpecClass)
             throws InvalidKeySpecException {
-        if (keySpecClass == null) {
-            throw new InvalidKeySpecException("keySpecClass == null");
-        }
-        if (!(key instanceof AndroidKeyStorePrivateKey)) {
-            throw new InvalidKeySpecException("Only Android KeyStore private keys supported: " +
-                    ((key != null) ? key.getClass().getName() : "null"));
-        }
-        if (PKCS8EncodedKeySpec.class.isAssignableFrom(keySpecClass)) {
+        if (key == null) {
+            throw new InvalidKeySpecException("key == null");
+        } else if ((!(key instanceof AndroidKeyStorePrivateKey))
+            && (!(key instanceof AndroidKeyStorePublicKey))) {
             throw new InvalidKeySpecException(
-                    "Key material export of Android KeyStore keys is not supported");
-        }
-        if (!KeyInfo.class.equals(keySpecClass)) {
-            throw new InvalidKeySpecException("Unsupported key spec: " + keySpecClass.getName());
-        }
-        String keyAliasInKeystore = ((AndroidKeyStoreKey) key).getAlias();
-        String entryAlias;
-        if (keyAliasInKeystore.startsWith(Credentials.USER_PRIVATE_KEY)) {
-            entryAlias = keyAliasInKeystore.substring(Credentials.USER_PRIVATE_KEY.length());
-        } else {
-            throw new InvalidKeySpecException("Invalid key alias: " + keyAliasInKeystore);
+                    "Unsupported key type: " + key.getClass().getName()
+                    + ". This KeyFactory supports only Android Keystore asymmetric keys");
         }
 
-        @SuppressWarnings("unchecked")
-        T result = (T) AndroidKeyStoreSecretKeyFactorySpi.getKeyInfo(
-                mKeyStore, entryAlias, keyAliasInKeystore);
-        return result;
+        // key is an Android Keystore private or public key
+
+        if (keySpecClass == null) {
+            throw new InvalidKeySpecException("keySpecClass == null");
+        } else if (KeyInfo.class.equals(keySpecClass)) {
+            if (!(key instanceof AndroidKeyStorePrivateKey)) {
+                throw new InvalidKeySpecException(
+                        "Unsupported key type: " + key.getClass().getName()
+                        + ". KeyInfo can be obtained only for Android Keystore private keys");
+            }
+            String keyAliasInKeystore = ((AndroidKeyStorePrivateKey) key).getAlias();
+            String entryAlias;
+            if (keyAliasInKeystore.startsWith(Credentials.USER_PRIVATE_KEY)) {
+                entryAlias = keyAliasInKeystore.substring(Credentials.USER_PRIVATE_KEY.length());
+            } else {
+                throw new InvalidKeySpecException("Invalid key alias: " + keyAliasInKeystore);
+            }
+            @SuppressWarnings("unchecked")
+            T result = (T) AndroidKeyStoreSecretKeyFactorySpi.getKeyInfo(
+                    mKeyStore, entryAlias, keyAliasInKeystore);
+            return result;
+        } else if (X509EncodedKeySpec.class.equals(keySpecClass)) {
+            if (!(key instanceof AndroidKeyStorePublicKey)) {
+                throw new InvalidKeySpecException(
+                        "Unsupported key type: " + key.getClass().getName()
+                        + ". X509EncodedKeySpec can be obtained only for Android Keystore public"
+                        + " keys");
+            }
+            @SuppressWarnings("unchecked")
+            T result = (T) new X509EncodedKeySpec(((AndroidKeyStorePublicKey) key).getEncoded());
+            return result;
+        } else if (PKCS8EncodedKeySpec.class.equals(keySpecClass)) {
+            if (key instanceof AndroidKeyStorePrivateKey) {
+                throw new InvalidKeySpecException(
+                        "Key material export of Android Keystore private keys is not supported");
+            } else {
+                throw new InvalidKeySpecException(
+                        "Cannot export key material of public key in PKCS#8 format."
+                        + " Only X.509 format (X509EncodedKeySpec) supported for public keys.");
+            }
+        } else if (RSAPublicKeySpec.class.equals(keySpecClass)) {
+            if (key instanceof AndroidKeyStoreRSAPublicKey) {
+                AndroidKeyStoreRSAPublicKey rsaKey = (AndroidKeyStoreRSAPublicKey) key;
+                @SuppressWarnings("unchecked")
+                T result =
+                        (T) new RSAPublicKeySpec(rsaKey.getModulus(), rsaKey.getPublicExponent());
+                return result;
+            } else {
+                throw new InvalidKeySpecException(
+                        "Obtaining RSAPublicKeySpec not supported for " + key.getAlgorithm() + " "
+                        + ((key instanceof AndroidKeyStorePrivateKey) ? "private" : "public")
+                        + " key");
+            }
+        } else if (ECPublicKeySpec.class.equals(keySpecClass)) {
+            if (key instanceof AndroidKeyStoreECPublicKey) {
+                AndroidKeyStoreECPublicKey ecKey = (AndroidKeyStoreECPublicKey) key;
+                @SuppressWarnings("unchecked")
+                T result = (T) new ECPublicKeySpec(ecKey.getW(), ecKey.getParams());
+                return result;
+            } else {
+                throw new InvalidKeySpecException(
+                        "Obtaining RSAPublicKeySpec not supported for " + key.getAlgorithm() + " "
+                        + ((key instanceof AndroidKeyStorePrivateKey) ? "private" : "public")
+                        + " key");
+            }
+        } else {
+            throw new InvalidKeySpecException("Unsupported key spec: " + keySpecClass.getName());
+        }
     }
 
     @Override
diff --git a/media/java/android/media/MediaPlayer.java b/media/java/android/media/MediaPlayer.java
index 13714d3..6dd855d 100644
--- a/media/java/android/media/MediaPlayer.java
+++ b/media/java/android/media/MediaPlayer.java
@@ -3264,6 +3264,13 @@
     /** Some operation takes too long to complete, usually more than 3-5 seconds. */
     public static final int MEDIA_ERROR_TIMED_OUT = -110;
 
+    /** Unspecified low-level system error. This value originated from UNKNOWN_ERROR in
+     * system/core/include/utils/Errors.h
+     * @see android.media.MediaPlayer.OnErrorListener
+     * @hide
+     */
+    public static final int MEDIA_ERROR_SYSTEM = -2147483648;
+
     /**
      * Interface definition of a callback to be invoked when there
      * has been an error during an asynchronous operation (other errors
@@ -3287,6 +3294,7 @@
          * <li>{@link #MEDIA_ERROR_MALFORMED}
          * <li>{@link #MEDIA_ERROR_UNSUPPORTED}
          * <li>{@link #MEDIA_ERROR_TIMED_OUT}
+         * <li><code>MEDIA_ERROR_SYSTEM (-2147483648)</code> - low-level system error.
          * </ul>
          * @return True if the method handled the error, false if it didn't.
          * Returning false, or not having an OnErrorListener at all, will
@@ -3346,6 +3354,14 @@
      */
     public static final int MEDIA_INFO_BUFFERING_END = 702;
 
+    /** Estimated network bandwidth information (kbps) is available; currently this event fires
+     * simultaneously as {@link #MEDIA_INFO_BUFFERING_START} and {@link #MEDIA_INFO_BUFFERING_END}
+     * when playing network files.
+     * @see android.media.MediaPlayer.OnInfoListener
+     * @hide
+     */
+    public static final int MEDIA_INFO_NETWORK_BANDWIDTH = 703;
+
     /** Bad interleaving means that a media has been improperly interleaved or
      * not interleaved at all, e.g has all the video samples first then all the
      * audio ones. Video is playing but a lot of disk seeks may be happening.
@@ -3403,6 +3419,8 @@
          * <li>{@link #MEDIA_INFO_VIDEO_RENDERING_START}
          * <li>{@link #MEDIA_INFO_BUFFERING_START}
          * <li>{@link #MEDIA_INFO_BUFFERING_END}
+         * <li><code>MEDIA_INFO_NETWORK_BANDWIDTH (703)</code> -
+         *     bandwidth information is available (as <code>extra</code> kbps)
          * <li>{@link #MEDIA_INFO_BAD_INTERLEAVING}
          * <li>{@link #MEDIA_INFO_NOT_SEEKABLE}
          * <li>{@link #MEDIA_INFO_METADATA_UPDATE}
diff --git a/media/java/android/media/tv/TvContract.java b/media/java/android/media/tv/TvContract.java
index 975645d..5bd7908 100644
--- a/media/java/android/media/tv/TvContract.java
+++ b/media/java/android/media/tv/TvContract.java
@@ -340,7 +340,7 @@
          *
          * <p>Type: TEXT
          */
-        public static final String COLUMN_PACKAGE_NAME = "package_name";
+        String COLUMN_PACKAGE_NAME = "package_name";
     }
 
     /** Column definitions for the TV channels table. */
diff --git a/media/java/android/media/tv/TvInputManager.java b/media/java/android/media/tv/TvInputManager.java
index 01de898..38f2d04 100644
--- a/media/java/android/media/tv/TvInputManager.java
+++ b/media/java/android/media/tv/TvInputManager.java
@@ -1978,7 +1978,7 @@
                 mPendingEvents.removeAt(index);
 
                 if (timeout) {
-                    Log.w(TAG, "Timeout waiting for seesion to handle input event after "
+                    Log.w(TAG, "Timeout waiting for session to handle input event after "
                             + INPUT_SESSION_NOT_RESPONDING_TIMEOUT + " ms: " + mToken);
                 } else {
                     mHandler.removeMessages(InputEventHandler.MSG_TIMEOUT_INPUT_EVENT, p);
diff --git a/media/java/android/media/tv/TvStreamConfig.java b/media/java/android/media/tv/TvStreamConfig.java
index 1bdc63e..0c2f3fe 100644
--- a/media/java/android/media/tv/TvStreamConfig.java
+++ b/media/java/android/media/tv/TvStreamConfig.java
@@ -89,12 +89,8 @@
 
     @Override
     public String toString() {
-        StringBuilder b = new StringBuilder(128);
-        b.append("TvStreamConfig {");
-        b.append("mStreamId=").append(mStreamId).append(";");
-        b.append("mType=").append(mType).append(";");
-        b.append("mGeneration=").append(mGeneration).append("}");
-        return b.toString();
+        return "TvStreamConfig {mStreamId=" + mStreamId + ";" + "mType=" + mType + ";mGeneration="
+                + mGeneration + "}";
     }
 
     // Parcelable
diff --git a/media/java/android/media/tv/TvView.java b/media/java/android/media/tv/TvView.java
index e7ce1dd..d8d0bdc 100644
--- a/media/java/android/media/tv/TvView.java
+++ b/media/java/android/media/tv/TvView.java
@@ -337,8 +337,14 @@
     }
 
     private void resetInternal() {
+        mPendingAppPrivateCommands.clear();
         if (mSession != null) {
-            release();
+            setSessionSurface(null);
+            removeSessionOverlayView();
+            mUseRequestedSurfaceLayout = false;
+            mSession.release();
+            mSession = null;
+            mSessionCallback = null;
             resetSurfaceView();
         }
     }
@@ -738,17 +744,6 @@
         addView(mSurfaceView);
     }
 
-    private void release() {
-        mPendingAppPrivateCommands.clear();
-
-        setSessionSurface(null);
-        removeSessionOverlayView();
-        mUseRequestedSurfaceLayout = false;
-        mSession.release();
-        mSession = null;
-        mSessionCallback = null;
-    }
-
     private void setSessionSurface(Surface surface) {
         if (mSession == null) {
             return;
diff --git a/media/jni/android_media_ImageReader.cpp b/media/jni/android_media_ImageReader.cpp
index 635fa11..0034b07 100644
--- a/media/jni/android_media_ImageReader.cpp
+++ b/media/jni/android_media_ImageReader.cpp
@@ -1240,8 +1240,11 @@
         return static_cast<jint>(PublicFormat::PRIVATE);
     } else {
         CpuConsumer::LockedBuffer* buffer = Image_getLockedBuffer(env, thiz);
+        int readerHalFormat = android_view_Surface_mapPublicFormatToHalFormat(
+                static_cast<PublicFormat>(readerFormat));
+        int32_t fmt = applyFormatOverrides(buffer->flexFormat, readerHalFormat);
         PublicFormat publicFmt = android_view_Surface_mapHalFormatDataspaceToPublicFormat(
-                buffer->flexFormat, buffer->dataSpace);
+                fmt, buffer->dataSpace);
         return static_cast<jint>(publicFmt);
     }
 }
diff --git a/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java b/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java
index 4cef286..0180a30 100644
--- a/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java
+++ b/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java
@@ -46,6 +46,7 @@
 
 import com.android.settingslib.R;
 
+import java.util.ArrayList;
 import java.util.Map;
 
 
@@ -79,10 +80,15 @@
      *  For now this data is used only with Verbose Logging so as to show the band and number
      *  of BSSIDs on which that network is seen.
      */
-    public LruCache<String, ScanResult> mScanResultCache;
+    public LruCache<String, ScanResult> mScanResultCache = new LruCache<String, ScanResult>(32);
+
     private static final String KEY_NETWORKINFO = "key_networkinfo";
     private static final String KEY_WIFIINFO = "key_wifiinfo";
     private static final String KEY_SCANRESULT = "key_scanresult";
+    private static final String KEY_SSID = "key_ssid";
+    private static final String KEY_SECURITY = "key_security";
+    private static final String KEY_PSKTYPE = "key_psktype";
+    private static final String KEY_SCANRESULTCACHE = "key_scanresultcache";
     private static final String KEY_CONFIG = "key_config";
 
     /**
@@ -108,7 +114,6 @@
     private int pskType = PSK_UNKNOWN;
 
     private WifiConfiguration mConfig;
-    private ScanResult mScanResult;
 
     private int mRssi = Integer.MAX_VALUE;
     private long mSeen = 0;
@@ -125,20 +130,35 @@
         if (mConfig != null) {
             loadConfig(mConfig);
         }
-        mScanResult = (ScanResult) savedState.getParcelable(KEY_SCANRESULT);
-        if (mScanResult != null) {
-            loadResult(mScanResult);
+        if (savedState.containsKey(KEY_SSID)) {
+            ssid = savedState.getString(KEY_SSID);
+        }
+        if (savedState.containsKey(KEY_SECURITY)) {
+            security = savedState.getInt(KEY_SECURITY);
+        }
+        if (savedState.containsKey(KEY_PSKTYPE)) {
+            pskType = savedState.getInt(KEY_PSKTYPE);
         }
         mInfo = (WifiInfo) savedState.getParcelable(KEY_WIFIINFO);
         if (savedState.containsKey(KEY_NETWORKINFO)) {
             mNetworkInfo = savedState.getParcelable(KEY_NETWORKINFO);
         }
+        if (savedState.containsKey(KEY_SCANRESULTCACHE)) {
+            ArrayList<ScanResult> scanResultArrayList =
+                    savedState.getParcelableArrayList(KEY_SCANRESULTCACHE);
+            mScanResultCache.evictAll();
+            for (ScanResult result : scanResultArrayList) {
+                mScanResultCache.put(result.BSSID, result);
+            }
+        }
         update(mInfo, mNetworkInfo);
+        mRssi = getRssi();
+        mSeen = getSeen();
     }
 
     AccessPoint(Context context, ScanResult result) {
         mContext = context;
-        loadResult(result);
+        initWithScanResult(result);
     }
 
     AccessPoint(Context context, WifiConfiguration config) {
@@ -240,6 +260,28 @@
         return WifiManager.calculateSignalLevel(mRssi, 4);
     }
 
+    public int getRssi() {
+        int rssi = Integer.MIN_VALUE;
+        for (ScanResult result : mScanResultCache.snapshot().values()) {
+            if (result.level > rssi) {
+                rssi = result.level;
+            }
+        }
+
+        return rssi;
+    }
+
+    public long getSeen() {
+        long seen = 0;
+        for (ScanResult result : mScanResultCache.snapshot().values()) {
+            if (result.timestamp > seen) {
+                seen = result.timestamp;
+            }
+        }
+
+        return seen;
+    }
+
     public NetworkInfo getNetworkInfo() {
         return mNetworkInfo;
     }
@@ -455,120 +497,109 @@
             visibility.append(String.format("rx=%.1f", mInfo.rxSuccessRate));
         }
 
-        if (mScanResultCache != null) {
-            int rssi5 = WifiConfiguration.INVALID_RSSI;
-            int rssi24 = WifiConfiguration.INVALID_RSSI;
-            int num5 = 0;
-            int num24 = 0;
-            int numBlackListed = 0;
-            int n24 = 0; // Number scan results we included in the string
-            int n5 = 0; // Number scan results we included in the string
-            Map<String, ScanResult> list = mScanResultCache.snapshot();
-            // TODO: sort list by RSSI or age
-            for (ScanResult result : list.values()) {
-                if (result.seen == 0)
-                    continue;
+        int rssi5 = WifiConfiguration.INVALID_RSSI;
+        int rssi24 = WifiConfiguration.INVALID_RSSI;
+        int num5 = 0;
+        int num24 = 0;
+        int numBlackListed = 0;
+        int n24 = 0; // Number scan results we included in the string
+        int n5 = 0; // Number scan results we included in the string
+        Map<String, ScanResult> list = mScanResultCache.snapshot();
+        // TODO: sort list by RSSI or age
+        for (ScanResult result : list.values()) {
+            if (result.seen == 0)
+                continue;
 
-                if (result.autoJoinStatus != ScanResult.ENABLED) numBlackListed++;
+            if (result.autoJoinStatus != ScanResult.ENABLED) numBlackListed++;
 
-                if (result.frequency >= LOWER_FREQ_5GHZ
-                        && result.frequency <= HIGHER_FREQ_5GHZ) {
-                    // Strictly speaking: [4915, 5825]
-                    // number of known BSSID on 5GHz band
-                    num5 = num5 + 1;
-                } else if (result.frequency >= LOWER_FREQ_24GHZ
-                        && result.frequency <= HIGHER_FREQ_24GHZ) {
-                    // Strictly speaking: [2412, 2482]
-                    // number of known BSSID on 2.4Ghz band
-                    num24 = num24 + 1;
-                }
-
-                // Ignore results seen, older than 20 seconds
-                if (now - result.seen > VISIBILITY_OUTDATED_AGE_IN_MILLI) continue;
-
-                if (result.frequency >= LOWER_FREQ_5GHZ
-                        && result.frequency <= HIGHER_FREQ_5GHZ) {
-                    if (result.level > rssi5) {
-                        rssi5 = result.level;
-                    }
-                    if (n5 < 4) {
-                        if (scans5GHz == null) scans5GHz = new StringBuilder();
-                        scans5GHz.append(" \n{").append(result.BSSID);
-                        if (bssid != null && result.BSSID.equals(bssid)) scans5GHz.append("*");
-                        scans5GHz.append("=").append(result.frequency);
-                        scans5GHz.append(",").append(result.level);
-                        if (result.autoJoinStatus != 0) {
-                            scans5GHz.append(",st=").append(result.autoJoinStatus);
-                        }
-                        if (result.numIpConfigFailures != 0) {
-                            scans5GHz.append(",ipf=").append(result.numIpConfigFailures);
-                        }
-                        scans5GHz.append("}");
-                        n5++;
-                    }
-                } else if (result.frequency >= LOWER_FREQ_24GHZ
-                        && result.frequency <= HIGHER_FREQ_24GHZ) {
-                    if (result.level > rssi24) {
-                        rssi24 = result.level;
-                    }
-                    if (n24 < 4) {
-                        if (scans24GHz == null) scans24GHz = new StringBuilder();
-                        scans24GHz.append(" \n{").append(result.BSSID);
-                        if (bssid != null && result.BSSID.equals(bssid)) scans24GHz.append("*");
-                        scans24GHz.append("=").append(result.frequency);
-                        scans24GHz.append(",").append(result.level);
-                        if (result.autoJoinStatus != 0) {
-                            scans24GHz.append(",st=").append(result.autoJoinStatus);
-                        }
-                        if (result.numIpConfigFailures != 0) {
-                            scans24GHz.append(",ipf=").append(result.numIpConfigFailures);
-                        }
-                        scans24GHz.append("}");
-                        n24++;
-                    }
-                }
+            if (result.frequency >= LOWER_FREQ_5GHZ
+                    && result.frequency <= HIGHER_FREQ_5GHZ) {
+                // Strictly speaking: [4915, 5825]
+                // number of known BSSID on 5GHz band
+                num5 = num5 + 1;
+            } else if (result.frequency >= LOWER_FREQ_24GHZ
+                    && result.frequency <= HIGHER_FREQ_24GHZ) {
+                // Strictly speaking: [2412, 2482]
+                // number of known BSSID on 2.4Ghz band
+                num24 = num24 + 1;
             }
-            visibility.append(" [");
-            if (num24 > 0) {
-                visibility.append("(").append(num24).append(")");
-                if (n24 <= 4) {
-                    if (scans24GHz != null) {
-                        visibility.append(scans24GHz.toString());
-                    }
-                } else {
-                    visibility.append("max=").append(rssi24);
-                    if (scans24GHz != null) {
-                        visibility.append(",").append(scans24GHz.toString());
-                    }
+
+            // Ignore results seen, older than 20 seconds
+            if (now - result.seen > VISIBILITY_OUTDATED_AGE_IN_MILLI) continue;
+
+            if (result.frequency >= LOWER_FREQ_5GHZ
+                    && result.frequency <= HIGHER_FREQ_5GHZ) {
+                if (result.level > rssi5) {
+                    rssi5 = result.level;
                 }
-            }
-            visibility.append(";");
-            if (num5 > 0) {
-                visibility.append("(").append(num5).append(")");
-                if (n5 <= 4) {
-                    if (scans5GHz != null) {
-                        visibility.append(scans5GHz.toString());
+                if (n5 < 4) {
+                    if (scans5GHz == null) scans5GHz = new StringBuilder();
+                    scans5GHz.append(" \n{").append(result.BSSID);
+                    if (bssid != null && result.BSSID.equals(bssid)) scans5GHz.append("*");
+                    scans5GHz.append("=").append(result.frequency);
+                    scans5GHz.append(",").append(result.level);
+                    if (result.autoJoinStatus != 0) {
+                        scans5GHz.append(",st=").append(result.autoJoinStatus);
                     }
-                } else {
-                    visibility.append("max=").append(rssi5);
-                    if (scans5GHz != null) {
-                        visibility.append(",").append(scans5GHz.toString());
+                    if (result.numIpConfigFailures != 0) {
+                        scans5GHz.append(",ipf=").append(result.numIpConfigFailures);
                     }
+                    scans5GHz.append("}");
+                    n5++;
                 }
-            }
-            if (numBlackListed > 0)
-                visibility.append("!").append(numBlackListed);
-            visibility.append("]");
-        } else {
-            if (mRssi != Integer.MAX_VALUE) {
-                visibility.append(" rssi=");
-                visibility.append(mRssi);
-                if (mScanResult != null) {
-                    visibility.append(", f=");
-                    visibility.append(mScanResult.frequency);
+            } else if (result.frequency >= LOWER_FREQ_24GHZ
+                    && result.frequency <= HIGHER_FREQ_24GHZ) {
+                if (result.level > rssi24) {
+                    rssi24 = result.level;
+                }
+                if (n24 < 4) {
+                    if (scans24GHz == null) scans24GHz = new StringBuilder();
+                    scans24GHz.append(" \n{").append(result.BSSID);
+                    if (bssid != null && result.BSSID.equals(bssid)) scans24GHz.append("*");
+                    scans24GHz.append("=").append(result.frequency);
+                    scans24GHz.append(",").append(result.level);
+                    if (result.autoJoinStatus != 0) {
+                        scans24GHz.append(",st=").append(result.autoJoinStatus);
+                    }
+                    if (result.numIpConfigFailures != 0) {
+                        scans24GHz.append(",ipf=").append(result.numIpConfigFailures);
+                    }
+                    scans24GHz.append("}");
+                    n24++;
                 }
             }
         }
+        visibility.append(" [");
+        if (num24 > 0) {
+            visibility.append("(").append(num24).append(")");
+            if (n24 <= 4) {
+                if (scans24GHz != null) {
+                    visibility.append(scans24GHz.toString());
+                }
+            } else {
+                visibility.append("max=").append(rssi24);
+                if (scans24GHz != null) {
+                    visibility.append(",").append(scans24GHz.toString());
+                }
+            }
+        }
+        visibility.append(";");
+        if (num5 > 0) {
+            visibility.append("(").append(num5).append(")");
+            if (n5 <= 4) {
+                if (scans5GHz != null) {
+                    visibility.append(scans5GHz.toString());
+                }
+            } else {
+                visibility.append("max=").append(rssi5);
+                if (scans5GHz != null) {
+                    visibility.append(",").append(scans5GHz.toString());
+                }
+            }
+        }
+        if (numBlackListed > 0)
+            visibility.append("!").append(numBlackListed);
+        visibility.append("]");
 
         return visibility.toString();
     }
@@ -635,28 +666,29 @@
             ssid = config.providerFriendlyName;
         else
             ssid = (config.SSID == null ? "" : removeDoubleQuotes(config.SSID));
-            
+
         security = getSecurity(config);
         networkId = config.networkId;
         mConfig = config;
     }
 
-    private void loadResult(ScanResult result) {
+    private void initWithScanResult(ScanResult result) {
         ssid = result.SSID;
         security = getSecurity(result);
         if (security == SECURITY_PSK)
             pskType = getPskType(result);
         mRssi = result.level;
-        mScanResult = result;
-        if (result.seen > mSeen) {
-            mSeen = result.seen;
-        }
+        mSeen = result.timestamp;
     }
 
     public void saveWifiState(Bundle savedState) {
-        savedState.putParcelable(KEY_CONFIG, mConfig);
-        savedState.putParcelable(KEY_SCANRESULT, mScanResult);
+        if (ssid != null) savedState.putString(KEY_SSID, getSsidStr());
+        savedState.putInt(KEY_SECURITY, security);
+        savedState.putInt(KEY_PSKTYPE, pskType);
+        if (mConfig != null) savedState.putParcelable(KEY_CONFIG, mConfig);
         savedState.putParcelable(KEY_WIFIINFO, mInfo);
+        savedState.putParcelableArrayList(KEY_SCANRESULTCACHE,
+                new ArrayList<ScanResult>(mScanResultCache.snapshot().values()));
         if (mNetworkInfo != null) {
             savedState.putParcelable(KEY_NETWORKINFO, mNetworkInfo);
         }
@@ -667,32 +699,31 @@
     }
 
     boolean update(ScanResult result) {
-        if (result.seen > mSeen) {
-            mSeen = result.seen;
-        }
-        if (WifiTracker.sVerboseLogging > 0) {
-            if (mScanResultCache == null) {
-                mScanResultCache = new LruCache<String, ScanResult>(32);
-            }
-            mScanResultCache.put(result.BSSID, result);
-        }
-
         if (ssid.equals(result.SSID) && security == getSecurity(result)) {
-            if (WifiManager.compareSignalLevel(result.level, mRssi) > 0) {
-                int oldLevel = getLevel();
-                mRssi = result.level;
-                if (getLevel() != oldLevel && mAccessPointListener != null) {
-                    mAccessPointListener.onLevelChanged(this);
-                }
+            /* Update the LRU timestamp, if BSSID exists */
+            mScanResultCache.get(result.BSSID);
+
+            /* Add or update the scan result for the BSSID */
+            mScanResultCache.put(result.BSSID, result);
+
+            int oldLevel = getLevel();
+            int oldRssi = getRssi();
+            mSeen = getSeen();
+            mRssi = (getRssi() + oldRssi)/2;
+            int newLevel = getLevel();
+
+            if (newLevel > 0 && newLevel != oldLevel && mAccessPointListener != null) {
+                mAccessPointListener.onLevelChanged(this);
             }
             // This flag only comes from scans, is not easily saved in config
             if (security == SECURITY_PSK) {
                 pskType = getPskType(result);
             }
-            mScanResult = result;
+
             if (mAccessPointListener != null) {
                 mAccessPointListener.onAccessPointChanged(this);
             }
+
             return true;
         }
         return false;
diff --git a/packages/SettingsLib/src/com/android/settingslib/wifi/WifiTracker.java b/packages/SettingsLib/src/com/android/settingslib/wifi/WifiTracker.java
index 19be4a5..f4e4ea1 100644
--- a/packages/SettingsLib/src/com/android/settingslib/wifi/WifiTracker.java
+++ b/packages/SettingsLib/src/com/android/settingslib/wifi/WifiTracker.java
@@ -28,6 +28,7 @@
 import android.os.Handler;
 import android.os.Looper;
 import android.os.Message;
+import android.util.Log;
 import android.widget.Toast;
 
 import com.android.internal.annotations.VisibleForTesting;
@@ -35,9 +36,12 @@
 
 import java.io.PrintWriter;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 import java.util.concurrent.atomic.AtomicBoolean;
 
 /**
@@ -45,6 +49,7 @@
  */
 public class WifiTracker {
     private static final String TAG = "WifiTracker";
+    private static final boolean DBG = false;
 
     /** verbose logging flag. this flag is set thru developer debugging options
      * and used so as to assist with in-the-field WiFi connectivity debugging  */
@@ -70,6 +75,10 @@
     private boolean mSavedNetworksExist;
     private boolean mRegistered;
     private ArrayList<AccessPoint> mAccessPoints = new ArrayList<>();
+    private HashMap<String, Integer> mSeenBssids = new HashMap<>();
+    private HashMap<String, ScanResult> mScanResultCache = new HashMap<>();
+    private Integer mScanId = 0;
+    private static final int NUM_SCANS_TO_CONFIRM_AP_LOSS = 3;
 
     private NetworkInfo mLastNetworkInfo;
     private WifiInfo mLastInfo;
@@ -166,6 +175,11 @@
         if (mScanner == null) {
             mScanner = new Scanner();
         }
+
+        mScanResultCache.clear();
+        mSeenBssids.clear();
+        mScanId = 0;
+
         if (mWifiManager.isWifiEnabled()) {
             mScanner.resume();
         }
@@ -237,6 +251,33 @@
         }
     }
 
+    private Collection<ScanResult> fetchScanResults() {
+        mScanId++;
+        final List<ScanResult> newResults = mWifiManager.getScanResults();
+        for (ScanResult newResult : newResults) {
+            mScanResultCache.put(newResult.BSSID, newResult);
+            mSeenBssids.put(newResult.BSSID, mScanId);
+        }
+
+        if (mScanId > NUM_SCANS_TO_CONFIRM_AP_LOSS) {
+            if (DBG) Log.d(TAG, "------ Dumping SSIDs that were expired on this scan ------");
+            Integer threshold = mScanId - NUM_SCANS_TO_CONFIRM_AP_LOSS;
+            for (Iterator<Map.Entry<String, Integer>> it = mSeenBssids.entrySet().iterator();
+                    it.hasNext(); /* nothing */) {
+                Map.Entry<String, Integer> e = it.next();
+                if (e.getValue() < threshold) {
+                    ScanResult result = mScanResultCache.get(e.getKey());
+                    if (DBG) Log.d(TAG, "Removing " + e.getKey() + ":(" + result.SSID + ")");
+                    mScanResultCache.remove(e.getKey());
+                    it.remove();
+                }
+            }
+            if (DBG) Log.d(TAG, "---- Done Dumping SSIDs that were expired on this scan ----");
+        }
+
+        return mScanResultCache.values();
+    }
+
     private void updateAccessPoints() {
         // Swap the current access points into a cached list.
         List<AccessPoint> cachedAccessPoints = getAccessPoints();
@@ -283,7 +324,7 @@
             }
         }
 
-        final List<ScanResult> results = mWifiManager.getScanResults();
+        final Collection<ScanResult> results = fetchScanResults();
         if (results != null) {
             for (ScanResult result : results) {
                 // Ignore hidden and ad-hoc networks.
@@ -328,6 +369,24 @@
 
         // Pre-sort accessPoints to speed preference insertion
         Collections.sort(accessPoints);
+
+        // Log accesspoints that were deleted
+        if (DBG) Log.d(TAG, "------ Dumping SSIDs that were not seen on this scan ------");
+        for (AccessPoint prevAccessPoint : mAccessPoints) {
+            if (prevAccessPoint.getSsid() == null) continue;
+            String prevSsid = prevAccessPoint.getSsidStr();
+            boolean found = false;
+            for (AccessPoint newAccessPoint : accessPoints) {
+                if (newAccessPoint.getSsid() != null && newAccessPoint.getSsid().equals(prevSsid)) {
+                    found = true;
+                    break;
+                }
+            }
+            if (!found)
+                if (DBG) Log.d(TAG, "Did not find " + prevSsid + " in this scan");
+        }
+        if (DBG)  Log.d(TAG, "---- Done dumping SSIDs that were not seen on this scan ----");
+
         mAccessPoints = accessPoints;
         mMainHandler.sendEmptyMessage(MainHandler.MSG_ACCESS_POINT_CHANGED);
     }
diff --git a/packages/SystemUI/res/interpolator/assist_disclosure_trace.xml b/packages/SystemUI/res/interpolator/assist_disclosure_trace.xml
new file mode 100644
index 0000000..6b5cd37
--- /dev/null
+++ b/packages/SystemUI/res/interpolator/assist_disclosure_trace.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Copyright (C) 2015 The Android Open Source Project
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License
+  -->
+
+<pathInterpolator xmlns:android="http://schemas.android.com/apk/res/android"
+        android:controlX1="0.6"
+        android:controlY1="0"
+        android:controlX2="0.7"
+        android:controlY2="1"/>
\ No newline at end of file
diff --git a/packages/SystemUI/res/layout/keyguard_bottom_area.xml b/packages/SystemUI/res/layout/keyguard_bottom_area.xml
index 48af565..1488ad6 100644
--- a/packages/SystemUI/res/layout/keyguard_bottom_area.xml
+++ b/packages/SystemUI/res/layout/keyguard_bottom_area.xml
@@ -68,7 +68,6 @@
         android:layout_height="@dimen/keyguard_affordance_height"
         android:layout_gravity="bottom|center_horizontal"
         android:src="@drawable/ic_lock_24dp"
-        android:scaleType="center"
-        android:contentDescription="@string/accessibility_unlock_button" />
+        android:scaleType="center" />
 
 </com.android.systemui.statusbar.phone.KeyguardBottomAreaView>
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index 7af8b80..869b03a 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -578,4 +578,10 @@
 
     <!-- Padding between icon and text for managed profile toast -->
     <dimen name="managed_profile_toast_padding">4dp</dimen>
+
+    <!-- Thickness of the assist disclosure beams -->
+    <dimen name="assist_disclosure_thickness">4dp</dimen>
+
+    <!-- Thickness of the shadows of the assist disclosure beams -->
+    <dimen name="assist_disclosure_shadow_thickness">1.5dp</dimen>
 </resources>
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index 47c642d..d32ce55 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -215,6 +215,10 @@
     <string name="accessibility_voice_assist_button">Voice Assist</string>
     <!-- Content description of the unlock button for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
     <string name="accessibility_unlock_button">Unlock</string>
+    <!-- Content description of the unlock button when fingerpint is on (not shown on the screen). [CHAR LIMIT=NONE] -->
+    <string name="accessibility_unlock_button_fingerprint">Unlock button, waiting for fingerprint</string>
+    <!-- Accessibility action of the unlock button when fingerpint is on (not shown on the screen). [CHAR LIMIT=NONE] -->
+    <string name="accessibility_unlock_without_fingerprint">Unlock without using your fingerprint</string>
     <!-- Click action label for accessibility for the unlock button. [CHAR LIMIT=NONE] -->
     <string name="unlock_label">unlock</string>
     <!-- Click action label for accessibility for the phone button. [CHAR LIMIT=NONE] -->
@@ -751,8 +755,11 @@
     <!-- Zen mode: Priority only customization button label -->
     <string name="zen_priority_customize_button">Customize</string>
 
-    <!-- Zen mode: Total silence introduction message on first use -->
-    <string name="zen_silence_introduction">This blocks ALL sounds and vibrations, including from alarms, music, videos, and games. You’ll still be able to make phone calls.</string>
+    <!-- Zen mode: Total silence introduction message on first use (voice capable devices) -->
+    <string name="zen_silence_introduction_voice">This blocks ALL sounds and vibrations, including from alarms, music, videos, and games. You’ll still be able to make phone calls.</string>
+
+    <!-- Zen mode: Total silence introduction message on first use (non-voice capable devices) -->
+    <string name="zen_silence_introduction">This blocks ALL sounds and vibrations, including from alarms, music, videos, and games.</string>
 
     <!-- Text for overflow card on Keyguard when there is not enough space for all notifications on Keyguard. [CHAR LIMIT=1] -->
     <string name="keyguard_more_overflow_text">+<xliff:g id="number_of_notifications" example="5">%d</xliff:g></string>
diff --git a/packages/SystemUI/src/com/android/systemui/assist/AssistDisclosure.java b/packages/SystemUI/src/com/android/systemui/assist/AssistDisclosure.java
new file mode 100644
index 0000000..585f9ba
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/assist/AssistDisclosure.java
@@ -0,0 +1,261 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package com.android.systemui.assist;
+
+import com.android.systemui.R;
+
+import android.animation.Animator;
+import android.animation.AnimatorListenerAdapter;
+import android.animation.AnimatorSet;
+import android.animation.ValueAnimator;
+import android.content.Context;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.Paint;
+import android.graphics.PixelFormat;
+import android.graphics.PorterDuff;
+import android.graphics.PorterDuffXfermode;
+import android.os.Handler;
+import android.view.View;
+import android.view.WindowManager;
+import android.view.animation.AnimationUtils;
+
+/**
+ * Visually discloses that contextual data was provided to an assistant.
+ */
+public class AssistDisclosure {
+    private final Context mContext;
+    private final WindowManager mWm;
+    private final Handler mHandler;
+
+    private AssistDisclosureView mView;
+    private boolean mViewAdded;
+
+    public AssistDisclosure(Context context, Handler handler) {
+        mContext = context;
+        mHandler = handler;
+        mWm = mContext.getSystemService(WindowManager.class);
+    }
+
+    public void postShow() {
+        mHandler.removeCallbacks(mShowRunnable);
+        mHandler.post(mShowRunnable);
+    }
+
+    private void show() {
+        if (mView == null) {
+            mView = new AssistDisclosureView(mContext);
+        }
+        if (!mViewAdded) {
+            WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
+                    WindowManager.LayoutParams.TYPE_SECURE_SYSTEM_OVERLAY,
+                    WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
+                            | WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED
+                            | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
+                            | WindowManager.LayoutParams.FLAG_FULLSCREEN
+                            | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED,
+                    PixelFormat.TRANSLUCENT);
+            lp.setTitle("AssistDisclosure");
+
+            mWm.addView(mView, lp);
+            mViewAdded = true;
+        }
+    }
+
+    private void hide() {
+        if (mViewAdded) {
+            mWm.removeView(mView);
+            mViewAdded = false;
+        }
+    }
+
+    private Runnable mShowRunnable = new Runnable() {
+        @Override
+        public void run() {
+            show();
+        }
+    };
+
+    private class AssistDisclosureView extends View
+            implements ValueAnimator.AnimatorUpdateListener {
+
+        public static final int TRACING_ANIMATION_DURATION = 600;
+        public static final int ALPHA_IN_ANIMATION_DURATION = 450;
+        public static final int ALPHA_OUT_ANIMATION_DURATION = 400;
+
+        private float mThickness;
+        private float mShadowThickness;
+        private final Paint mPaint = new Paint();
+        private final Paint mShadowPaint = new Paint();
+
+        private final ValueAnimator mTracingAnimator;
+        private final ValueAnimator mAlphaOutAnimator;
+        private final ValueAnimator mAlphaInAnimator;
+        private final AnimatorSet mAnimator;
+
+        private float mTracingProgress = 0;
+        private int mAlpha = 0;
+
+        public AssistDisclosureView(Context context) {
+            super(context);
+
+            mTracingAnimator = ValueAnimator.ofFloat(0, 1).setDuration(TRACING_ANIMATION_DURATION);
+            mTracingAnimator.addUpdateListener(this);
+            mTracingAnimator.setInterpolator(AnimationUtils.loadInterpolator(mContext,
+                    R.interpolator.assist_disclosure_trace));
+            mAlphaInAnimator = ValueAnimator.ofInt(0, 255).setDuration(ALPHA_IN_ANIMATION_DURATION);
+            mAlphaInAnimator.addUpdateListener(this);
+            mAlphaInAnimator.setInterpolator(AnimationUtils.loadInterpolator(mContext,
+                    android.R.interpolator.fast_out_slow_in));
+            mAlphaOutAnimator = ValueAnimator.ofInt(255, 0).setDuration(
+                    ALPHA_OUT_ANIMATION_DURATION);
+            mAlphaOutAnimator.addUpdateListener(this);
+            mAlphaOutAnimator.setInterpolator(AnimationUtils.loadInterpolator(mContext,
+                    android.R.interpolator.fast_out_linear_in));
+            mAnimator = new AnimatorSet();
+            mAnimator.play(mAlphaInAnimator).with(mTracingAnimator);
+            mAnimator.play(mAlphaInAnimator).before(mAlphaOutAnimator);
+            mAnimator.addListener(new AnimatorListenerAdapter() {
+                boolean mCancelled;
+
+                @Override
+                public void onAnimationStart(Animator animation) {
+                    mCancelled = false;
+                }
+
+                @Override
+                public void onAnimationCancel(Animator animation) {
+                    mCancelled = true;
+                }
+
+                @Override
+                public void onAnimationEnd(Animator animation) {
+                    if (!mCancelled) {
+                        hide();
+                    }
+                }
+            });
+
+            PorterDuffXfermode srcMode = new PorterDuffXfermode(PorterDuff.Mode.SRC);
+            mPaint.setColor(Color.WHITE);
+            mPaint.setXfermode(srcMode);
+            mShadowPaint.setColor(Color.DKGRAY);
+            mShadowPaint.setXfermode(srcMode);
+
+            mThickness = getResources().getDimension(R.dimen.assist_disclosure_thickness);
+            mShadowThickness = getResources().getDimension(
+                    R.dimen.assist_disclosure_shadow_thickness);
+        }
+
+        @Override
+        protected void onAttachedToWindow() {
+            super.onAttachedToWindow();
+
+            startAnimation();
+        }
+
+        @Override
+        protected void onDetachedFromWindow() {
+            super.onDetachedFromWindow();
+
+            mAnimator.cancel();
+
+            mTracingProgress = 0;
+            mAlpha = 0;
+        }
+
+        private void startAnimation() {
+            mAnimator.cancel();
+            mAnimator.start();
+        }
+
+        @Override
+        protected void onDraw(Canvas canvas) {
+            mPaint.setAlpha(mAlpha);
+            mShadowPaint.setAlpha(mAlpha / 4);
+
+            drawGeometry(canvas, mShadowPaint, mShadowThickness);
+            drawGeometry(canvas, mPaint, 0);
+        }
+
+        private void drawGeometry(Canvas canvas, Paint paint, float padding) {
+            final int width = getWidth();
+            final int height = getHeight();
+            float thickness = mThickness;
+            final float pixelProgress = mTracingProgress * (width + height - 2 * thickness);
+
+            float bottomProgress = Math.min(pixelProgress, width / 2f);
+            if (bottomProgress > 0) {
+                drawBeam(canvas,
+                        width / 2f - bottomProgress,
+                        height - thickness,
+                        width / 2f + bottomProgress,
+                        height, paint, padding);
+            }
+
+            float sideProgress = Math.min(pixelProgress - bottomProgress, height - thickness);
+            if (sideProgress > 0) {
+                drawBeam(canvas,
+                        0,
+                        (height - thickness) - sideProgress,
+                        thickness,
+                        height - thickness, paint, padding);
+                drawBeam(canvas,
+                        width - thickness,
+                        (height - thickness) - sideProgress,
+                        width,
+                        height - thickness, paint, padding);
+            }
+
+            float topProgress = Math.min(pixelProgress - bottomProgress - sideProgress,
+                    width / 2 - thickness);
+            if (sideProgress > 0 && topProgress > 0) {
+                drawBeam(canvas,
+                        thickness,
+                        0,
+                        thickness + topProgress,
+                        thickness, paint, padding);
+                drawBeam(canvas,
+                        (width - thickness) - topProgress,
+                        0,
+                        width - thickness,
+                        thickness, paint, padding);
+            }
+        }
+
+        private void drawBeam(Canvas canvas, float left, float top, float right, float bottom,
+                Paint paint, float padding) {
+            canvas.drawRect(left - padding,
+                    top - padding,
+                    right + padding,
+                    bottom + padding,
+                    paint);
+        }
+
+        @Override
+        public void onAnimationUpdate(ValueAnimator animation) {
+            if (animation == mAlphaOutAnimator) {
+                mAlpha = (int) mAlphaOutAnimator.getAnimatedValue();
+            } else if (animation == mAlphaInAnimator) {
+                mAlpha = (int) mAlphaInAnimator.getAnimatedValue();
+            } else if (animation == mTracingAnimator) {
+                mTracingProgress = (float) mTracingAnimator.getAnimatedValue();
+            }
+            invalidate();
+        }
+    }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
index 445ecb6..674356b 100644
--- a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
+++ b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
@@ -55,6 +55,8 @@
 
     private final Context mContext;
     private final WindowManager mWindowManager;
+    private final AssistDisclosure mAssistDisclosure;
+
     private AssistOrbContainer mView;
     private final PhoneStatusBar mBar;
     private final AssistUtils mAssistUtils;
@@ -100,6 +102,7 @@
                 Settings.Secure.getUriFor(Settings.Secure.ASSISTANT), false,
                 mAssistSettingsObserver);
         mAssistSettingsObserver.onChange(false);
+        mAssistDisclosure = new AssistDisclosure(context, new Handler());
     }
 
     public void onConfigurationChanged() {
@@ -187,8 +190,11 @@
         mBar.animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_SEARCH_PANEL |
                 CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL);
 
+        boolean structureEnabled = Settings.Secure.getIntForUser(mContext.getContentResolver(),
+                Settings.Secure.ASSIST_STRUCTURE_ENABLED, 1, UserHandle.USER_CURRENT) != 0;
+
         final Intent intent = ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE))
-                .getAssistIntent(mContext, true, UserHandle.USER_CURRENT);
+                .getAssistIntent(mContext, structureEnabled, UserHandle.USER_CURRENT);
         if (intent == null) {
             return;
         }
@@ -196,6 +202,10 @@
             intent.setComponent(mAssistComponent);
         }
 
+        if (structureEnabled) {
+            showDisclosure();
+        }
+
         try {
             final ActivityOptions opts = ActivityOptions.makeCustomAnimation(mContext,
                     R.anim.search_launch_enter, R.anim.search_launch_exit);
@@ -297,4 +307,8 @@
         pw.println("AssistManager state:");
         pw.print("  mAssistComponent="); pw.println(mAssistComponent);
     }
+
+    public void showDisclosure() {
+        mAssistDisclosure.postShow();
+    }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
index 9761cd1..4b1453d 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
@@ -390,7 +390,7 @@
             mDetailSettingsButton.setOnClickListener(new OnClickListener() {
                 @Override
                 public void onClick(View v) {
-                    mHost.startSettingsActivity(settingsIntent);
+                    mHost.startActivityDismissingKeyguard(settingsIntent);
                 }
             });
 
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSTile.java b/packages/SystemUI/src/com/android/systemui/qs/QSTile.java
index 72bb136..38fade2 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSTile.java
@@ -306,7 +306,7 @@
     }
 
     public interface Host {
-        void startSettingsActivity(Intent intent);
+        void startActivityDismissingKeyguard(Intent intent);
         void warn(String message, Throwable t);
         void collapsePanels();
         Looper getLooper();
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java
index a9e8b38..07406b9 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java
@@ -82,7 +82,7 @@
         if (mDataController.isMobileDataSupported()) {
             showDetail(true);
         } else {
-            mHost.startSettingsActivity(CELLULAR_SETTINGS);
+            mHost.startActivityDismissingKeyguard(CELLULAR_SETTINGS);
         }
     }
 
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java
index f97f519..1b74eb6 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java
@@ -263,7 +263,7 @@
     private final ZenModePanel.Callback mZenModePanelCallback = new ZenModePanel.Callback() {
         @Override
         public void onPrioritySettings() {
-            mHost.startSettingsActivity(ZEN_PRIORITY_SETTINGS);
+            mHost.startActivityDismissingKeyguard(ZEN_PRIORITY_SETTINGS);
         }
 
         @Override
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/IntentTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/IntentTile.java
index 19f4df6..f7f7acb 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/IntentTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/IntentTile.java
@@ -96,7 +96,11 @@
     private void sendIntent(String type, PendingIntent pi, String uri) {
         try {
             if (pi != null) {
-                pi.send();
+                if (pi.isActivity()) {
+                    getHost().startActivityDismissingKeyguard(pi.getIntent());
+                } else {
+                    pi.send();
+                }
             } else if (uri != null) {
                 final Intent intent = Intent.parseUri(uri, Intent.URI_INTENT_SCHEME);
                 mContext.sendBroadcastAsUser(intent, new UserHandle(mCurrentUserId));
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java
index 9bc5b75..c33ef7c 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java
@@ -104,7 +104,7 @@
     @Override
     protected void handleSecondaryClick() {
         if (!mWifiController.canConfigWifi()) {
-            mHost.startSettingsActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));
+            mHost.startActivityDismissingKeyguard(new Intent(Settings.ACTION_WIFI_SETTINGS));
             return;
         }
         if (!mState.enabled) {
@@ -290,7 +290,7 @@
 
         @Override
         public void onSettingsActivityTriggered(Intent settingsIntent) {
-            mHost.startSettingsActivity(settingsIntent);
+            mHost.startActivityDismissingKeyguard(settingsIntent);
         }
 
         @Override
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index f8a1385..295fdc8 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -2101,4 +2101,11 @@
         }
         return mStatusBarKeyguardViewManager.isSecure();
     }
+
+    @Override
+    public void showAssistDisclosure() {
+        if (mAssistManager != null) {
+            mAssistManager.showDisclosure();
+        }
+    }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java
index 80fdd28..0deff08 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java
@@ -61,6 +61,7 @@
     private static final int MSG_APP_TRANSITION_PENDING     = 19 << MSG_SHIFT;
     private static final int MSG_APP_TRANSITION_CANCELLED   = 20 << MSG_SHIFT;
     private static final int MSG_APP_TRANSITION_STARTING    = 21 << MSG_SHIFT;
+    private static final int MSG_ASSIST_DISCLOSURE          = 22 << MSG_SHIFT;
 
     public static final int FLAG_EXCLUDE_NONE = 0;
     public static final int FLAG_EXCLUDE_SEARCH_PANEL = 1 << 0;
@@ -104,6 +105,7 @@
         public void appTransitionPending();
         public void appTransitionCancelled();
         public void appTransitionStarting(long startTime, long duration);
+        public void showAssistDisclosure();
     }
 
     public CommandQueue(Callbacks callbacks, StatusBarIconList list) {
@@ -274,6 +276,13 @@
         }
     }
 
+    public void showAssistDisclosure() {
+        synchronized (mList) {
+            mHandler.removeMessages(MSG_ASSIST_DISCLOSURE);
+            mHandler.obtainMessage(MSG_ASSIST_DISCLOSURE).sendToTarget();
+        }
+    }
+
     private final class H extends Handler {
         public void handleMessage(Message msg) {
             final int what = msg.what & MSG_MASK;
@@ -366,6 +375,9 @@
                     Pair<Long, Long> data = (Pair<Long, Long>) msg.obj;
                     mCallbacks.appTransitionStarting(data.first, data.second);
                     break;
+                case MSG_ASSIST_DISCLOSURE:
+                    mCallbacks.showAssistDisclosure();
+                    break;
             }
         }
     }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java
index 3258a9f..815e123 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java
@@ -614,6 +614,13 @@
         }
     };
 
+    private final Runnable mHideTransientIndicationRunnable = new Runnable() {
+        @Override
+        public void run() {
+            mIndicationController.hideTransientIndication();
+        }
+    };
+
     private final KeyguardUpdateMonitorCallback mUpdateMonitorCallback =
             new KeyguardUpdateMonitorCallback() {
         @Override
@@ -657,6 +664,10 @@
         @Override
         public void onFingerprintError(int msgId, String errString) {
             // TODO: Go to bouncer if this is "too many attempts" (lockout) error.
+            mIndicationController.showTransientIndication(errString,
+                    getResources().getColor(R.color.system_warning_color, null));
+            removeCallbacks(mHideTransientIndicationRunnable);
+            postDelayed(mHideTransientIndicationRunnable, 5000);
         }
     };
 
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java
index 2063b26..f5fdf48 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java
@@ -16,14 +16,13 @@
 
 package com.android.systemui.statusbar.phone;
 
-import android.annotation.NonNull;
-import android.annotation.Nullable;
 import android.content.Context;
 import android.graphics.drawable.AnimatedVectorDrawable;
 import android.graphics.drawable.Drawable;
 import android.graphics.drawable.InsetDrawable;
 import android.util.AttributeSet;
 import android.view.View;
+import android.view.accessibility.AccessibilityNodeInfo;
 
 import com.android.keyguard.KeyguardUpdateMonitor;
 import com.android.systemui.R;
@@ -54,6 +53,7 @@
     private final TrustDrawable mTrustDrawable;
     private final UnlockMethodCache mUnlockMethodCache;
     private AccessibilityController mAccessibilityController;
+    private boolean mHasFingerPrintIcon;
 
     public LockIcon(Context context, AttributeSet attrs) {
         super(context, attrs);
@@ -128,6 +128,11 @@
             setRestingAlpha(
                     anyFingerprintIcon ? 1f : KeyguardAffordanceHelper.SWIPE_RESTING_ALPHA_AMOUNT);
             setImageDrawable(icon);
+            String contentDescription = getResources().getString(anyFingerprintIcon
+                    ? R.string.accessibility_unlock_button_fingerprint
+                    : R.string.accessibility_unlock_button);
+            setContentDescription(contentDescription);
+            mHasFingerPrintIcon = anyFingerprintIcon;
             if (animation != null) {
 
                 // If we play the draw on animation, delay it by one frame when the screen is
@@ -167,6 +172,20 @@
         setFocusable(mAccessibilityController.isAccessibilityEnabled());
     }
 
+    @Override
+    public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
+        super.onInitializeAccessibilityNodeInfo(info);
+        if (mHasFingerPrintIcon) {
+            // Avoid that the button description is also spoken
+            info.setClassName(LockIcon.class.getName());
+            AccessibilityNodeInfo.AccessibilityAction unlock
+                    = new AccessibilityNodeInfo.AccessibilityAction(
+                    AccessibilityNodeInfo.ACTION_CLICK,
+                    getContext().getString(R.string.accessibility_unlock_without_fingerprint));
+            info.addAction(unlock);
+        }
+    }
+
     public void setAccessibilityController(AccessibilityController accessibilityController) {
         mAccessibilityController = accessibilityController;
     }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index cd90d27..ade40e5 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -3101,16 +3101,16 @@
                 || (mDisabled1 & StatusBarManager.DISABLE_SEARCH) != 0;
     }
 
-    public void postStartSettingsActivity(final Intent intent, int delay) {
+    public void postStartActivityDismissingKeyguard(final Intent intent, int delay) {
         mHandler.postDelayed(new Runnable() {
             @Override
             public void run() {
-                handleStartSettingsActivity(intent, true /*onlyProvisioned*/);
+                handleStartActivityDismissingKeyguard(intent, true /*onlyProvisioned*/);
             }
         }, delay);
     }
 
-    private void handleStartSettingsActivity(Intent intent, boolean onlyProvisioned) {
+    private void handleStartActivityDismissingKeyguard(Intent intent, boolean onlyProvisioned) {
         startActivityDismissingKeyguard(intent, onlyProvisioned, true /* dismissShade */);
     }
 
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java
index 25a93dd..12434ac 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java
@@ -129,8 +129,8 @@
     }
 
     @Override
-    public void startSettingsActivity(final Intent intent) {
-        mStatusBar.postStartSettingsActivity(intent, 0);
+    public void startActivityDismissingKeyguard(final Intent intent) {
+        mStatusBar.postStartActivityDismissingKeyguard(intent, 0);
     }
 
     @Override
diff --git a/packages/SystemUI/src/com/android/systemui/volume/Util.java b/packages/SystemUI/src/com/android/systemui/volume/Util.java
index 4214091..a46a44d 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/Util.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/Util.java
@@ -16,11 +16,13 @@
 
 package com.android.systemui.volume;
 
+import android.content.Context;
 import android.media.AudioManager;
 import android.media.MediaMetadata;
 import android.media.VolumeProvider;
 import android.media.session.MediaController.PlaybackInfo;
 import android.media.session.PlaybackState;
+import android.telephony.TelephonyManager;
 import android.view.View;
 import android.widget.TextView;
 
@@ -164,4 +166,9 @@
         v.setVisibility(vis ? View.VISIBLE : View.INVISIBLE);
     }
 
+    public static boolean isVoiceCapable(Context context) {
+        final TelephonyManager telephony =
+                (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
+        return telephony != null && telephony.isVoiceCapable();
+    }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java b/packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java
index a0eb61f..8035cd3 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java
@@ -118,6 +118,7 @@
     private Condition mSessionExitCondition;
     private Condition[] mConditions;
     private Condition mTimeCondition;
+    private boolean mVoiceCapable;
 
     public ZenModePanel(Context context, AttributeSet attrs) {
         super(context, attrs);
@@ -127,6 +128,7 @@
         mIconPulser = new IconPulser(mContext);
         mForeverId = Condition.newId(mContext).appendPath("forever").build();
         mSpTexts = new SpTexts(mContext);
+        mVoiceCapable = Util.isVoiceCapable(mContext);
         if (DEBUG) Log.d(mTag, "new ZenModePanel");
     }
 
@@ -144,6 +146,7 @@
         pw.println(mPrefs.mConfirmedPriorityIntroduction);
         pw.print("  mConfirmedSilenceIntroduction=");
         pw.println(mPrefs.mConfirmedSilenceIntroduction);
+        pw.print("  mVoiceCapable="); pw.println(mVoiceCapable);
         mTransitionHelper.dump(fd, pw, args);
     }
 
@@ -444,6 +447,7 @@
         mZenIntroduction.setVisibility(introduction ? VISIBLE : GONE);
         if (introduction) {
             mZenIntroductionMessage.setText(zenImportant ? R.string.zen_priority_introduction
+                    : mVoiceCapable ? R.string.zen_silence_introduction_voice
                     : R.string.zen_silence_introduction);
             mZenIntroductionCustomize.setVisibility(zenImportant ? VISIBLE : GONE);
         }
diff --git a/preloaded-classes b/preloaded-classes
index 41a8857..4d7a6e1 100644
--- a/preloaded-classes
+++ b/preloaded-classes
@@ -1,7 +1,4 @@
 # Classes which are preloaded by com.android.internal.os.ZygoteInit.
-# Automatically generated by frameworks/base/tools/preload/WritePreloadedClassFile.java.
-# MIN_LOAD_TIME_MICROS=1250
-# MIN_PROCESSES=10
 [B
 [C
 [D
@@ -12,12 +9,13 @@
 [Landroid.animation.Animator;
 [Landroid.animation.Keyframe$FloatKeyframe;
 [Landroid.animation.Keyframe$IntKeyframe;
+[Landroid.animation.Keyframe$ObjectKeyframe;
 [Landroid.animation.PropertyValuesHolder;
-[Landroid.app.FragmentState;
 [Landroid.app.LoaderManagerImpl;
 [Landroid.content.ContentProviderResult;
 [Landroid.content.ContentValues;
 [Landroid.content.Intent;
+[Landroid.content.UndoOwner;
 [Landroid.content.pm.ActivityInfo;
 [Landroid.content.pm.ConfigurationInfo;
 [Landroid.content.pm.FeatureGroupInfo;
@@ -30,9 +28,9 @@
 [Landroid.content.pm.Signature;
 [Landroid.content.res.StringBlock;
 [Landroid.content.res.XmlBlock;
+[Landroid.database.CursorWindow;
 [Landroid.database.sqlite.SQLiteConnection$Operation;
 [Landroid.database.sqlite.SQLiteConnectionPool$AcquiredConnectionStatus;
-[Landroid.graphics.Bitmap$CompressFormat;
 [Landroid.graphics.Bitmap$Config;
 [Landroid.graphics.Canvas$EdgeType;
 [Landroid.graphics.FontFamily;
@@ -51,13 +49,39 @@
 [Landroid.graphics.drawable.Drawable;
 [Landroid.graphics.drawable.GradientDrawable$Orientation;
 [Landroid.graphics.drawable.LayerDrawable$ChildDrawable;
-[Landroid.graphics.drawable.Ripple;
+[Landroid.graphics.drawable.RippleForeground;
 [Landroid.hardware.soundtrigger.SoundTrigger$ConfidenceLevel;
 [Landroid.hardware.soundtrigger.SoundTrigger$Keyphrase;
 [Landroid.hardware.soundtrigger.SoundTrigger$KeyphraseRecognitionExtra;
+[Landroid.icu.impl.ICUResourceBundle$OpenType;
+[Landroid.icu.impl.Trie2$ValueWidth;
+[Landroid.icu.impl.UCharacterProperty$BinaryProperty;
+[Landroid.icu.impl.UCharacterProperty$IntProperty;
+[Landroid.icu.lang.UScript$ScriptUsage;
+[Landroid.icu.text.DateFormat$BooleanAttribute;
+[Landroid.icu.text.DateFormat$Field;
+[Landroid.icu.text.DateFormatSymbols$CapitalizationContextUsage;
+[Landroid.icu.text.DateTimePatternGenerator$DTPGflags;
+[Landroid.icu.text.DisplayContext$Type;
+[Landroid.icu.text.DisplayContext;
+[Landroid.icu.text.MessagePattern$ApostropheMode;
+[Landroid.icu.text.MessagePattern$ArgType;
+[Landroid.icu.text.MessagePattern$Part$Type;
+[Landroid.icu.text.UnicodeSet;
+[Landroid.icu.util.BytesTrie$Result;
+[Landroid.icu.util.Calendar$CalType;
+[Landroid.icu.util.ULocale$Category;
+[Landroid.icu.util.ULocale;
+[Landroid.media.AudioDeviceInfo;
 [Landroid.media.AudioGain;
+[Landroid.media.AudioPatch;
+[Landroid.media.AudioPort;
+[Landroid.media.AudioPortConfig;
+[Landroid.media.MediaTimeProvider$OnMediaTimeListener;
 [Landroid.net.NetworkInfo$DetailedState;
 [Landroid.net.NetworkInfo$State;
+[Landroid.net.Uri;
+[Landroid.net.wifi.SupplicantState;
 [Landroid.os.AsyncTask$Status;
 [Landroid.os.MessageQueue$IdleHandler;
 [Landroid.os.Parcel;
@@ -86,51 +110,92 @@
 [Landroid.text.style.ReplacementSpan;
 [Landroid.text.style.SpellCheckSpan;
 [Landroid.text.style.SuggestionSpan;
+[Landroid.text.style.TabStopSpan;
+[Landroid.text.style.URLSpan;
 [Landroid.text.style.WrapTogetherSpan;
 [Landroid.util.LongSparseArray;
 [Landroid.util.PathParser$PathDataNode;
 [Landroid.view.Choreographer$CallbackQueue;
+[Landroid.view.Display$Mode;
+[Landroid.view.MenuItem;
 [Landroid.view.View;
-[Landroid.widget.Editor$TextDisplayList;
+[Landroid.widget.Editor$TextRenderNode;
 [Landroid.widget.Editor$TextViewPositionListener;
 [Landroid.widget.ImageView$ScaleType;
+[Landroid.widget.SpellChecker$SpellParser;
 [Landroid.widget.TextView$BufferType;
 [Landroid.widget.TextView$ChangeWatcher;
 [Lcom.android.dex.TableOfContents$Section;
-[Lcom.android.internal.policy.impl.PhoneWindow$PanelFeatureState;
+[Lcom.android.internal.policy.PhoneWindow$PanelFeatureState;
 [Lcom.android.internal.telephony.PhoneConstants$State;
+[Lcom.android.okhttp.CipherSuite;
+[Lcom.android.okhttp.ConnectionSpec;
 [Lcom.android.okhttp.Protocol;
-[Lcom.android.okhttp.ResponseSource;
-[Lcom.android.okhttp.internal.http.HttpURLConnectionImpl$Retry;
+[Lcom.android.okhttp.TlsVersion;
 [Lcom.android.org.bouncycastle.asn1.ASN1ObjectIdentifier;
+[Lcom.android.org.bouncycastle.asn1.x500.RDN;
 [Lcom.android.org.bouncycastle.asn1.x509.GeneralName;
 [Lcom.android.org.conscrypt.OpenSSLX509CertPath$Encoding;
 [Lcom.android.org.conscrypt.OpenSSLX509Certificate;
+[Ldalvik.system.DexPathList$Element;
+[Ljava.io.File;
 [Ljava.io.FileDescriptor;
+[Ljava.io.IOException;
+[Ljava.io.ObjectStreamField;
+[Ljava.lang.Byte;
 [Ljava.lang.CharSequence;
+[Ljava.lang.Character$UnicodeBlock;
+[Ljava.lang.Character;
 [Ljava.lang.Class;
+[Ljava.lang.Enum;
 [Ljava.lang.Integer;
+[Ljava.lang.Long;
 [Ljava.lang.Object;
+[Ljava.lang.Package;
 [Ljava.lang.Runnable;
+[Ljava.lang.Short;
+[Ljava.lang.StackTraceElement;
 [Ljava.lang.String;
+[Ljava.lang.Thread$State;
+[Ljava.lang.Thread;
+[Ljava.lang.ThreadGroup;
+[Ljava.lang.Throwable;
 [Ljava.lang.Void;
+[Ljava.lang.annotation.Annotation;
+[Ljava.lang.reflect.AccessibleObject;
+[Ljava.lang.reflect.Constructor;
+[Ljava.lang.reflect.Field;
+[Ljava.lang.reflect.Method;
+[Ljava.lang.reflect.Type;
+[Ljava.lang.reflect.TypeVariable;
 [Ljava.math.BigDecimal;
 [Ljava.math.BigInteger;
 [Ljava.math.RoundingMode;
 [Ljava.net.InetAddress;
 [Ljava.net.Proxy$Type;
+[Ljava.security.Provider;
+[Ljava.security.cert.Certificate;
 [Ljava.security.cert.X509Certificate;
 [Ljava.text.Format$Field;
 [Ljava.util.ArrayList;
+[Ljava.util.HashMap$HashMapEntry;
+[Ljava.util.Hashtable$HashtableEntry;
+[Ljava.util.Locale;
 [Ljava.util.Map$Entry;
 [Ljava.util.TimerTask;
+[Ljava.util.TreeMap$Bound;
 [Ljava.util.TreeMap$Relation;
+[Ljava.util.WeakHashMap$Entry;
 [Ljava.util.concurrent.ConcurrentHashMap$Node;
 [Ljava.util.concurrent.ConcurrentHashMap$Segment;
+[Ljava.util.concurrent.RunnableScheduledFuture;
 [Ljava.util.concurrent.TimeUnit;
 [Ljava.util.logging.Handler;
+[Ljava.util.regex.Pattern;
+[Ljavax.crypto.Cipher$NeedToSet;
 [Ljavax.net.ssl.KeyManager;
 [Ljavax.net.ssl.TrustManager;
+[Ljavax.security.cert.X509Certificate;
 [Llibcore.reflect.AnnotationMember$DefaultValues;
 [Llibcore.reflect.AnnotationMember;
 [Lorg.apache.harmony.security.asn1.ASN1Type;
@@ -142,20 +207,25 @@
 [Lorg.apache.http.conn.routing.RouteInfo$TunnelType;
 [Lorg.json.JSONStringer$Scope;
 [Lorg.kxml2.io.KXmlParser$ValueContext;
+[S
 [Z
 [[B
+[[C
 [[I
 [[Lcom.android.org.bouncycastle.asn1.ASN1ObjectIdentifier;
+[[Ljava.lang.Class;
 [[Ljava.lang.Object;
 [[Ljava.lang.String;
+[[Ljava.lang.annotation.Annotation;
 [[Lorg.apache.harmony.security.utils.ObjectIdentifier;
-[[[B
+[[S
+[[[I
 android.R$styleable
 android.accounts.Account
 android.accounts.Account$1
 android.accounts.AccountManager
-android.accounts.AccountManager$16
-android.accounts.AccountManager$8
+android.accounts.AccountManager$1
+android.accounts.AccountManager$11
 android.accounts.AccountManager$AmsTask
 android.accounts.AccountManager$AmsTask$1
 android.accounts.AccountManager$AmsTask$Response
@@ -171,6 +241,7 @@
 android.accounts.OnAccountsUpdateListener
 android.accounts.OperationCanceledException
 android.animation.Animator
+android.animation.Animator$AnimatorConstantState
 android.animation.Animator$AnimatorListener
 android.animation.Animator$AnimatorPauseListener
 android.animation.AnimatorInflater
@@ -181,6 +252,7 @@
 android.animation.AnimatorSet$Dependency
 android.animation.AnimatorSet$DependencyListener
 android.animation.AnimatorSet$Node
+android.animation.ArgbEvaluator
 android.animation.FloatEvaluator
 android.animation.FloatKeyframeSet
 android.animation.IntEvaluator
@@ -188,6 +260,7 @@
 android.animation.Keyframe
 android.animation.Keyframe$FloatKeyframe
 android.animation.Keyframe$IntKeyframe
+android.animation.Keyframe$ObjectKeyframe
 android.animation.KeyframeSet
 android.animation.Keyframes
 android.animation.Keyframes$FloatKeyframes
@@ -195,22 +268,30 @@
 android.animation.LayoutTransition
 android.animation.LayoutTransition$TransitionListener
 android.animation.ObjectAnimator
+android.animation.PathKeyframes
+android.animation.PathKeyframes$1
+android.animation.PathKeyframes$2
+android.animation.PathKeyframes$FloatKeyframesBase
+android.animation.PathKeyframes$SimpleKeyframes
 android.animation.PropertyValuesHolder
 android.animation.PropertyValuesHolder$FloatPropertyValuesHolder
 android.animation.PropertyValuesHolder$IntPropertyValuesHolder
 android.animation.RectEvaluator
 android.animation.StateListAnimator
 android.animation.StateListAnimator$1
+android.animation.StateListAnimator$StateListAnimatorConstantState
 android.animation.StateListAnimator$Tuple
 android.animation.TimeInterpolator
 android.animation.TypeEvaluator
 android.animation.ValueAnimator
 android.animation.ValueAnimator$AnimationHandler
+android.animation.ValueAnimator$AnimationHandler$1
+android.animation.ValueAnimator$AnimationHandler$2
 android.animation.ValueAnimator$AnimatorUpdateListener
 android.app.ActionBar
 android.app.ActionBar$LayoutParams
 android.app.Activity
-android.app.Activity$1
+android.app.Activity$HostCallbacks
 android.app.ActivityManager
 android.app.ActivityManager$RunningAppProcessInfo
 android.app.ActivityManager$RunningAppProcessInfo$1
@@ -244,6 +325,7 @@
 android.app.ActivityThread$StopInfo
 android.app.ActivityTransitionState
 android.app.AlertDialog
+android.app.AlertDialog$Builder
 android.app.AppGlobals
 android.app.AppOpsManager
 android.app.Application
@@ -257,91 +339,21 @@
 android.app.BackStackRecord$Op
 android.app.BackStackRecord$TransitionState
 android.app.ContextImpl
-android.app.ContextImpl$1
-android.app.ContextImpl$10
-android.app.ContextImpl$11
-android.app.ContextImpl$12
-android.app.ContextImpl$13
-android.app.ContextImpl$14
-android.app.ContextImpl$15
-android.app.ContextImpl$16
-android.app.ContextImpl$17
-android.app.ContextImpl$18
-android.app.ContextImpl$19
-android.app.ContextImpl$2
-android.app.ContextImpl$20
-android.app.ContextImpl$21
-android.app.ContextImpl$22
-android.app.ContextImpl$23
-android.app.ContextImpl$24
-android.app.ContextImpl$25
-android.app.ContextImpl$26
-android.app.ContextImpl$27
-android.app.ContextImpl$28
-android.app.ContextImpl$29
-android.app.ContextImpl$3
-android.app.ContextImpl$30
-android.app.ContextImpl$31
-android.app.ContextImpl$32
-android.app.ContextImpl$33
-android.app.ContextImpl$34
-android.app.ContextImpl$35
-android.app.ContextImpl$36
-android.app.ContextImpl$37
-android.app.ContextImpl$38
-android.app.ContextImpl$39
-android.app.ContextImpl$4
-android.app.ContextImpl$40
-android.app.ContextImpl$41
-android.app.ContextImpl$42
-android.app.ContextImpl$43
-android.app.ContextImpl$44
-android.app.ContextImpl$45
-android.app.ContextImpl$46
-android.app.ContextImpl$47
-android.app.ContextImpl$48
-android.app.ContextImpl$49
-android.app.ContextImpl$5
-android.app.ContextImpl$50
-android.app.ContextImpl$51
-android.app.ContextImpl$52
-android.app.ContextImpl$53
-android.app.ContextImpl$54
-android.app.ContextImpl$55
-android.app.ContextImpl$56
-android.app.ContextImpl$57
-android.app.ContextImpl$58
-android.app.ContextImpl$59
-android.app.ContextImpl$6
-android.app.ContextImpl$60
-android.app.ContextImpl$61
-android.app.ContextImpl$62
-android.app.ContextImpl$7
-android.app.ContextImpl$8
-android.app.ContextImpl$9
 android.app.ContextImpl$ApplicationContentResolver
-android.app.ContextImpl$ServiceFetcher
-android.app.ContextImpl$StaticServiceFetcher
 android.app.Dialog
 android.app.Dialog$1
 android.app.Dialog$ListenersHandler
-android.app.DialogFragment
+android.app.DownloadManager
 android.app.Fragment
 android.app.Fragment$1
-android.app.FragmentBreadCrumbs
 android.app.FragmentContainer
+android.app.FragmentController
+android.app.FragmentHostCallback
 android.app.FragmentManager
 android.app.FragmentManager$BackStackEntry
 android.app.FragmentManagerImpl
 android.app.FragmentManagerImpl$1
-android.app.FragmentManagerState
-android.app.FragmentManagerState$1
-android.app.FragmentState
-android.app.FragmentState$1
 android.app.FragmentTransaction
-android.app.IActivityContainer
-android.app.IActivityContainer$Stub
-android.app.IActivityContainer$Stub$Proxy
 android.app.IActivityManager
 android.app.IActivityManager$ContentProviderHolder
 android.app.IActivityManager$ContentProviderHolder$1
@@ -362,6 +374,7 @@
 android.app.IntentReceiverLeaked
 android.app.IntentService
 android.app.IntentService$ServiceHandler
+android.app.KeyguardManager
 android.app.ListActivity
 android.app.LoadedApk
 android.app.LoadedApk$ReceiverDispatcher
@@ -385,7 +398,6 @@
 android.app.PendingIntent
 android.app.PendingIntent$1
 android.app.PendingIntent$CanceledException
-android.app.ProgressDialog
 android.app.QueuedWork
 android.app.ReceiverRestrictedContext
 android.app.ResourcesManager
@@ -402,8 +414,83 @@
 android.app.SharedPreferencesImpl$EditorImpl$1
 android.app.SharedPreferencesImpl$EditorImpl$2
 android.app.SharedPreferencesImpl$MemoryCommitResult
+android.app.StatusBarManager
 android.app.SystemServiceRegistry
+android.app.SystemServiceRegistry$1
+android.app.SystemServiceRegistry$10
+android.app.SystemServiceRegistry$11
+android.app.SystemServiceRegistry$12
+android.app.SystemServiceRegistry$13
+android.app.SystemServiceRegistry$14
+android.app.SystemServiceRegistry$15
+android.app.SystemServiceRegistry$16
+android.app.SystemServiceRegistry$17
+android.app.SystemServiceRegistry$18
+android.app.SystemServiceRegistry$19
+android.app.SystemServiceRegistry$2
+android.app.SystemServiceRegistry$20
+android.app.SystemServiceRegistry$21
+android.app.SystemServiceRegistry$22
+android.app.SystemServiceRegistry$23
+android.app.SystemServiceRegistry$24
+android.app.SystemServiceRegistry$25
+android.app.SystemServiceRegistry$26
+android.app.SystemServiceRegistry$27
+android.app.SystemServiceRegistry$28
+android.app.SystemServiceRegistry$29
+android.app.SystemServiceRegistry$3
+android.app.SystemServiceRegistry$30
+android.app.SystemServiceRegistry$31
+android.app.SystemServiceRegistry$32
+android.app.SystemServiceRegistry$33
+android.app.SystemServiceRegistry$34
+android.app.SystemServiceRegistry$35
+android.app.SystemServiceRegistry$36
+android.app.SystemServiceRegistry$37
+android.app.SystemServiceRegistry$38
+android.app.SystemServiceRegistry$39
+android.app.SystemServiceRegistry$4
+android.app.SystemServiceRegistry$40
+android.app.SystemServiceRegistry$41
+android.app.SystemServiceRegistry$42
+android.app.SystemServiceRegistry$43
+android.app.SystemServiceRegistry$44
+android.app.SystemServiceRegistry$45
+android.app.SystemServiceRegistry$46
+android.app.SystemServiceRegistry$47
+android.app.SystemServiceRegistry$48
+android.app.SystemServiceRegistry$49
+android.app.SystemServiceRegistry$5
+android.app.SystemServiceRegistry$50
+android.app.SystemServiceRegistry$51
+android.app.SystemServiceRegistry$52
+android.app.SystemServiceRegistry$53
+android.app.SystemServiceRegistry$54
+android.app.SystemServiceRegistry$55
+android.app.SystemServiceRegistry$56
+android.app.SystemServiceRegistry$57
+android.app.SystemServiceRegistry$58
+android.app.SystemServiceRegistry$59
+android.app.SystemServiceRegistry$6
+android.app.SystemServiceRegistry$60
+android.app.SystemServiceRegistry$61
+android.app.SystemServiceRegistry$62
+android.app.SystemServiceRegistry$63
+android.app.SystemServiceRegistry$64
+android.app.SystemServiceRegistry$65
+android.app.SystemServiceRegistry$66
+android.app.SystemServiceRegistry$67
+android.app.SystemServiceRegistry$68
+android.app.SystemServiceRegistry$7
+android.app.SystemServiceRegistry$8
+android.app.SystemServiceRegistry$9
+android.app.SystemServiceRegistry$CachedServiceFetcher
+android.app.SystemServiceRegistry$ServiceFetcher
+android.app.SystemServiceRegistry$StaticServiceFetcher
+android.app.UiModeManager
+android.app.WallpaperManager
 android.app.admin.DevicePolicyManager
+android.app.admin.IDevicePolicyManager
 android.app.admin.IDevicePolicyManager$Stub
 android.app.admin.IDevicePolicyManager$Stub$Proxy
 android.app.backup.BackupDataInput
@@ -411,19 +498,44 @@
 android.app.backup.BackupDataOutput
 android.app.backup.BackupHelperDispatcher
 android.app.backup.BackupHelperDispatcher$Header
+android.app.backup.BackupManager
 android.app.backup.FileBackupHelperBase
 android.app.backup.FullBackup
-android.appwidget.AppWidgetHostView
+android.app.backup.FullBackupDataOutput
+android.app.backup.IBackupManager
+android.app.backup.IBackupManager$Stub
+android.app.backup.IBackupManager$Stub$Proxy
+android.app.job.JobScheduler
+android.app.trust.ITrustManager
+android.app.trust.ITrustManager$Stub
+android.app.trust.ITrustManager$Stub$Proxy
+android.app.trust.TrustManager
+android.app.usage.NetworkStatsManager
+android.app.usage.UsageStatsManager
 android.appwidget.AppWidgetManager
 android.appwidget.AppWidgetProvider
-android.bluetooth.BluetoothDevice
-android.bluetooth.BluetoothUuid
+android.bluetooth.BluetoothAdapter
+android.bluetooth.BluetoothAdapter$1
+android.bluetooth.BluetoothManager
+android.bluetooth.IBluetooth
+android.bluetooth.IBluetooth$Stub
+android.bluetooth.IBluetooth$Stub$Proxy
+android.bluetooth.IBluetoothManager
+android.bluetooth.IBluetoothManager$Stub
+android.bluetooth.IBluetoothManager$Stub$Proxy
+android.bluetooth.IBluetoothManagerCallback
+android.bluetooth.IBluetoothManagerCallback$Stub
 android.content.AbstractThreadedSyncAdapter
 android.content.AbstractThreadedSyncAdapter$ISyncAdapterImpl
 android.content.AbstractThreadedSyncAdapter$SyncThread
 android.content.ActivityNotFoundException
 android.content.BroadcastReceiver
 android.content.BroadcastReceiver$PendingResult
+android.content.BroadcastReceiver$PendingResult$1
+android.content.ClipData
+android.content.ClipDescription
+android.content.ClipDescription$1
+android.content.ClipboardManager
 android.content.ComponentCallbacks
 android.content.ComponentCallbacks2
 android.content.ComponentName
@@ -468,8 +580,10 @@
 android.content.IntentFilter
 android.content.IntentFilter$1
 android.content.IntentFilter$MalformedMimeTypeException
+android.content.IntentSender
 android.content.IntentSender$SendIntentException
 android.content.OperationApplicationException
+android.content.RestrictionsManager
 android.content.ServiceConnection
 android.content.SharedPreferences
 android.content.SharedPreferences$Editor
@@ -482,6 +596,10 @@
 android.content.SyncResult$1
 android.content.SyncStats
 android.content.SyncStats$1
+android.content.UndoManager
+android.content.UndoManager$UndoState
+android.content.UndoOperation
+android.content.UndoOwner
 android.content.UriMatcher
 android.content.pm.ActivityInfo
 android.content.pm.ActivityInfo$1
@@ -499,12 +617,15 @@
 android.content.pm.IPackageManager$Stub$Proxy
 android.content.pm.InstrumentationInfo
 android.content.pm.InstrumentationInfo$1
+android.content.pm.LauncherApps
 android.content.pm.PackageInfo
 android.content.pm.PackageInfo$1
 android.content.pm.PackageItemInfo
 android.content.pm.PackageManager
 android.content.pm.PackageManager$NameNotFoundException
 android.content.pm.PackageParser$PackageParserException
+android.content.pm.ParceledListSlice
+android.content.pm.ParceledListSlice$1
 android.content.pm.PathPermission
 android.content.pm.PathPermission$1
 android.content.pm.PermissionInfo
@@ -530,14 +651,20 @@
 android.content.res.CompatibilityInfo$2
 android.content.res.Configuration
 android.content.res.Configuration$1
+android.content.res.ConfigurationBoundResourceCache
+android.content.res.ConstantState
+android.content.res.DrawableCache
 android.content.res.ObbInfo
 android.content.res.ObbInfo$1
 android.content.res.ObbScanner
 android.content.res.Resources
 android.content.res.Resources$NotFoundException
 android.content.res.Resources$Theme
+android.content.res.Resources$ThemeKey
 android.content.res.ResourcesKey
 android.content.res.StringBlock
+android.content.res.StringBlock$StyleIDs
+android.content.res.ThemedResourceCache
 android.content.res.TypedArray
 android.content.res.XmlBlock
 android.content.res.XmlBlock$Parser
@@ -619,9 +746,7 @@
 android.graphics.AvoidXfermode
 android.graphics.Bitmap
 android.graphics.Bitmap$1
-android.graphics.Bitmap$2
 android.graphics.Bitmap$BitmapFinalizer
-android.graphics.Bitmap$CompressFormat
 android.graphics.Bitmap$Config
 android.graphics.BitmapFactory
 android.graphics.BitmapFactory$Options
@@ -709,13 +834,14 @@
 android.graphics.Xfermode
 android.graphics.YuvImage
 android.graphics.drawable.Animatable
+android.graphics.drawable.Animatable2
 android.graphics.drawable.AnimatedStateListDrawable
 android.graphics.drawable.AnimatedStateListDrawable$AnimatedStateListState
-android.graphics.drawable.AnimatedStateListDrawable$AnimationDrawableTransition
-android.graphics.drawable.AnimatedStateListDrawable$FrameInterpolator
 android.graphics.drawable.AnimatedStateListDrawable$Transition
 android.graphics.drawable.AnimatedVectorDrawable
+android.graphics.drawable.AnimatedVectorDrawable$1
 android.graphics.drawable.AnimatedVectorDrawable$AnimatedVectorDrawableState
+android.graphics.drawable.AnimatedVectorDrawable$AnimatedVectorDrawableState$PendingAnimator
 android.graphics.drawable.AnimationDrawable
 android.graphics.drawable.AnimationDrawable$AnimationState
 android.graphics.drawable.BitmapDrawable
@@ -728,10 +854,13 @@
 android.graphics.drawable.DrawableContainer
 android.graphics.drawable.DrawableContainer$DrawableContainerState
 android.graphics.drawable.DrawableContainer$DrawableContainerState$ConstantStateFuture
+android.graphics.drawable.DrawableWrapper
+android.graphics.drawable.DrawableWrapper$DrawableWrapperState
 android.graphics.drawable.GradientDrawable
-android.graphics.drawable.GradientDrawable$1
 android.graphics.drawable.GradientDrawable$GradientState
 android.graphics.drawable.GradientDrawable$Orientation
+android.graphics.drawable.Icon
+android.graphics.drawable.Icon$1
 android.graphics.drawable.InsetDrawable
 android.graphics.drawable.InsetDrawable$InsetState
 android.graphics.drawable.LayerDrawable
@@ -739,14 +868,19 @@
 android.graphics.drawable.LayerDrawable$LayerState
 android.graphics.drawable.NinePatchDrawable
 android.graphics.drawable.NinePatchDrawable$NinePatchState
-android.graphics.drawable.Ripple
-android.graphics.drawable.Ripple$1
-android.graphics.drawable.Ripple$LogInterpolator
 android.graphics.drawable.RippleBackground
 android.graphics.drawable.RippleBackground$1
-android.graphics.drawable.RippleBackground$2
+android.graphics.drawable.RippleBackground$BackgroundProperty
+android.graphics.drawable.RippleComponent
+android.graphics.drawable.RippleComponent$RenderNodeAnimatorSet
 android.graphics.drawable.RippleDrawable
 android.graphics.drawable.RippleDrawable$RippleState
+android.graphics.drawable.RippleForeground
+android.graphics.drawable.RippleForeground$1
+android.graphics.drawable.RippleForeground$2
+android.graphics.drawable.RippleForeground$3
+android.graphics.drawable.RippleForeground$4
+android.graphics.drawable.RippleForeground$LogDecelerateInterpolator
 android.graphics.drawable.RotateDrawable
 android.graphics.drawable.RotateDrawable$RotateState
 android.graphics.drawable.ScaleDrawable
@@ -763,6 +897,7 @@
 android.graphics.drawable.VectorDrawable$VPath
 android.graphics.drawable.VectorDrawable$VPathRenderer
 android.graphics.drawable.VectorDrawable$VectorDrawableState
+android.graphics.drawable.shapes.OvalShape
 android.graphics.drawable.shapes.RectShape
 android.graphics.drawable.shapes.Shape
 android.graphics.pdf.PdfDocument
@@ -771,17 +906,15 @@
 android.hardware.Camera
 android.hardware.Camera$CameraInfo
 android.hardware.Camera$Face
-android.hardware.Camera$Parameters
-android.hardware.Camera$PreviewCallback
+android.hardware.ConsumerIrManager
 android.hardware.Sensor
 android.hardware.SensorEventListener
 android.hardware.SensorManager
+android.hardware.SerialManager
 android.hardware.SerialPort
 android.hardware.SystemSensorManager
 android.hardware.SystemSensorManager$BaseEventQueue
-android.hardware.camera2.CameraCharacteristics
-android.hardware.camera2.CaptureRequest
-android.hardware.camera2.CaptureResult
+android.hardware.camera2.CameraManager
 android.hardware.camera2.DngCreator
 android.hardware.camera2.impl.CameraMetadataNative
 android.hardware.camera2.legacy.LegacyCameraDevice
@@ -796,6 +929,8 @@
 android.hardware.display.IDisplayManager$Stub$Proxy
 android.hardware.display.IDisplayManagerCallback
 android.hardware.display.IDisplayManagerCallback$Stub
+android.hardware.fingerprint.FingerprintManager
+android.hardware.hdmi.HdmiControlManager
 android.hardware.input.IInputDevicesChangedListener
 android.hardware.input.IInputDevicesChangedListener$Stub
 android.hardware.input.IInputManager
@@ -805,6 +940,27 @@
 android.hardware.input.InputDeviceIdentifier$1
 android.hardware.input.InputManager
 android.hardware.input.InputManager$InputDevicesChangedListener
+android.hardware.radio.RadioManager
+android.hardware.radio.RadioManager$AmBandConfig
+android.hardware.radio.RadioManager$AmBandConfig$1
+android.hardware.radio.RadioManager$AmBandDescriptor
+android.hardware.radio.RadioManager$AmBandDescriptor$1
+android.hardware.radio.RadioManager$BandConfig
+android.hardware.radio.RadioManager$BandConfig$1
+android.hardware.radio.RadioManager$BandDescriptor
+android.hardware.radio.RadioManager$BandDescriptor$1
+android.hardware.radio.RadioManager$FmBandConfig
+android.hardware.radio.RadioManager$FmBandConfig$1
+android.hardware.radio.RadioManager$FmBandDescriptor
+android.hardware.radio.RadioManager$FmBandDescriptor$1
+android.hardware.radio.RadioManager$ModuleProperties
+android.hardware.radio.RadioManager$ModuleProperties$1
+android.hardware.radio.RadioManager$ProgramInfo
+android.hardware.radio.RadioManager$ProgramInfo$1
+android.hardware.radio.RadioMetadata
+android.hardware.radio.RadioMetadata$1
+android.hardware.radio.RadioModule
+android.hardware.radio.RadioTuner
 android.hardware.soundtrigger.SoundTrigger
 android.hardware.soundtrigger.SoundTrigger$ConfidenceLevel
 android.hardware.soundtrigger.SoundTrigger$ConfidenceLevel$1
@@ -828,19 +984,220 @@
 android.hardware.soundtrigger.SoundTriggerModule
 android.hardware.usb.UsbDevice
 android.hardware.usb.UsbDeviceConnection
+android.hardware.usb.UsbManager
 android.hardware.usb.UsbRequest
-# Initializing android.icu.impl.ICUBinary loads the ICU data.
-# Opening the files in the Zygote avoids StrictMode violations.
-# It also ensures the ICU data files are mapped on boot and all
-# apps will be consistent (even if files are added to /data).
+android.icu.impl.BMPSet
+android.icu.impl.CacheBase
+android.icu.impl.CalendarData
+android.icu.impl.CalendarUtil
+android.icu.impl.ClassLoaderUtil
+android.icu.impl.CurrencyData
+android.icu.impl.CurrencyData$CurrencyDisplayInfo
+android.icu.impl.CurrencyData$CurrencyDisplayInfoProvider
+android.icu.impl.CurrencyData$CurrencySpacingInfo
+android.icu.impl.DateNumberFormat
+android.icu.impl.Grego
 android.icu.impl.ICUBinary
+android.icu.impl.ICUBinary$Authenticate
+android.icu.impl.ICUBinary$DatPackageReader
+android.icu.impl.ICUBinary$DatPackageReader$IsAcceptable
+android.icu.impl.ICUBinary$DataFile
+android.icu.impl.ICUBinary$PackageDataFile
+android.icu.impl.ICUCache
+android.icu.impl.ICUConfig
+android.icu.impl.ICUCurrencyDisplayInfoProvider
+android.icu.impl.ICUCurrencyDisplayInfoProvider$ICUCurrencyDisplayInfo
+android.icu.impl.ICUCurrencyMetaInfo
+android.icu.impl.ICUCurrencyMetaInfo$Collector
+android.icu.impl.ICUCurrencyMetaInfo$CurrencyCollector
+android.icu.impl.ICUCurrencyMetaInfo$UniqueList
+android.icu.impl.ICUData
+android.icu.impl.ICUDebug
+android.icu.impl.ICUResourceBundle
+android.icu.impl.ICUResourceBundle$1
+android.icu.impl.ICUResourceBundle$OpenType
+android.icu.impl.ICUResourceBundle$WholeBundle
+android.icu.impl.ICUResourceBundleImpl
+android.icu.impl.ICUResourceBundleImpl$ResourceArray
+android.icu.impl.ICUResourceBundleImpl$ResourceBinary
+android.icu.impl.ICUResourceBundleImpl$ResourceContainer
+android.icu.impl.ICUResourceBundleImpl$ResourceInt
+android.icu.impl.ICUResourceBundleImpl$ResourceIntVector
+android.icu.impl.ICUResourceBundleImpl$ResourceString
+android.icu.impl.ICUResourceBundleImpl$ResourceTable
+android.icu.impl.ICUResourceBundleReader
+android.icu.impl.ICUResourceBundleReader$Array
+android.icu.impl.ICUResourceBundleReader$Array16
+android.icu.impl.ICUResourceBundleReader$Container
+android.icu.impl.ICUResourceBundleReader$IsAcceptable
+android.icu.impl.ICUResourceBundleReader$ReaderCache
+android.icu.impl.ICUResourceBundleReader$ReaderInfo
+android.icu.impl.ICUResourceBundleReader$ResourceCache
+android.icu.impl.ICUResourceBundleReader$ResourceCache$Level
+android.icu.impl.ICUResourceBundleReader$Table
+android.icu.impl.ICUResourceBundleReader$Table16
+android.icu.impl.ICUResourceBundleReader$Table1632
+android.icu.impl.JavaTimeZone
+android.icu.impl.LocaleIDParser
+android.icu.impl.LocaleIDs
+android.icu.impl.OlsonTimeZone
+android.icu.impl.Pair
+android.icu.impl.PatternProps
+android.icu.impl.PatternTokenizer
+android.icu.impl.ReplaceableUCharacterIterator
+android.icu.impl.RuleCharacterIterator
+android.icu.impl.SimpleCache
+android.icu.impl.SoftCache
+android.icu.impl.SoftCache$SettableSoftReference
+android.icu.impl.Trie2
+android.icu.impl.Trie2$1
+android.icu.impl.Trie2$Range
+android.icu.impl.Trie2$Trie2Iterator
+android.icu.impl.Trie2$UTrie2Header
+android.icu.impl.Trie2$ValueMapper
+android.icu.impl.Trie2$ValueWidth
+android.icu.impl.Trie2_16
+android.icu.impl.UCharacterProperty
+android.icu.impl.UCharacterProperty$1
+android.icu.impl.UCharacterProperty$10
+android.icu.impl.UCharacterProperty$11
+android.icu.impl.UCharacterProperty$12
+android.icu.impl.UCharacterProperty$13
+android.icu.impl.UCharacterProperty$14
+android.icu.impl.UCharacterProperty$15
+android.icu.impl.UCharacterProperty$16
+android.icu.impl.UCharacterProperty$17
+android.icu.impl.UCharacterProperty$18
+android.icu.impl.UCharacterProperty$19
+android.icu.impl.UCharacterProperty$2
+android.icu.impl.UCharacterProperty$20
+android.icu.impl.UCharacterProperty$21
+android.icu.impl.UCharacterProperty$22
+android.icu.impl.UCharacterProperty$23
+android.icu.impl.UCharacterProperty$3
+android.icu.impl.UCharacterProperty$4
+android.icu.impl.UCharacterProperty$5
+android.icu.impl.UCharacterProperty$6
+android.icu.impl.UCharacterProperty$7
+android.icu.impl.UCharacterProperty$8
+android.icu.impl.UCharacterProperty$9
+android.icu.impl.UCharacterProperty$BiDiIntProperty
+android.icu.impl.UCharacterProperty$BinaryProperty
+android.icu.impl.UCharacterProperty$CaseBinaryProperty
+android.icu.impl.UCharacterProperty$CombiningClassIntProperty
+android.icu.impl.UCharacterProperty$IntProperty
+android.icu.impl.UCharacterProperty$IsAcceptable
+android.icu.impl.UCharacterProperty$NormInertBinaryProperty
+android.icu.impl.UCharacterProperty$NormQuickCheckIntProperty
+android.icu.impl.UPropertyAliases
+android.icu.impl.UPropertyAliases$IsAcceptable
+android.icu.impl.Utility
+android.icu.impl.ZoneMeta
+android.icu.impl.ZoneMeta$CustomTimeZoneCache
+android.icu.impl.ZoneMeta$SystemTimeZoneCache
+android.icu.impl.locale.AsciiUtil
+android.icu.impl.locale.BaseLocale
+android.icu.impl.locale.BaseLocale$Cache
+android.icu.impl.locale.BaseLocale$Key
+android.icu.impl.locale.LocaleObjectCache
+android.icu.impl.locale.LocaleObjectCache$CacheEntry
+android.icu.impl.locale.LocaleSyntaxException
+android.icu.lang.UCharacter
+android.icu.lang.UCharacterEnums$ECharacterCategory
+android.icu.lang.UCharacterEnums$ECharacterDirection
+android.icu.lang.UScript
+android.icu.lang.UScript$ScriptUsage
+android.icu.text.CurrencyDisplayNames
+android.icu.text.CurrencyMetaInfo
+android.icu.text.CurrencyMetaInfo$CurrencyDigits
+android.icu.text.CurrencyMetaInfo$CurrencyFilter
+android.icu.text.DateFormat
+android.icu.text.DateFormat$BooleanAttribute
+android.icu.text.DateFormat$Field
+android.icu.text.DateFormatSymbols
+android.icu.text.DateFormatSymbols$CapitalizationContextUsage
+android.icu.text.DateIntervalFormat
+android.icu.text.DateIntervalFormat$BestMatchInfo
+android.icu.text.DateIntervalInfo
+android.icu.text.DateIntervalInfo$PatternInfo
+android.icu.text.DateTimePatternGenerator
+android.icu.text.DateTimePatternGenerator$DTPGflags
+android.icu.text.DateTimePatternGenerator$DateTimeMatcher
+android.icu.text.DateTimePatternGenerator$DistanceInfo
+android.icu.text.DateTimePatternGenerator$FormatParser
+android.icu.text.DateTimePatternGenerator$PatternInfo
+android.icu.text.DateTimePatternGenerator$PatternWithMatcher
+android.icu.text.DateTimePatternGenerator$PatternWithSkeletonFlag
+android.icu.text.DateTimePatternGenerator$VariableField
+android.icu.text.DecimalFormat
+android.icu.text.DecimalFormatSymbols
+android.icu.text.DisplayContext
+android.icu.text.DisplayContext$Type
+android.icu.text.MessageFormat
+android.icu.text.MessageFormat$AppendableWrapper
+android.icu.text.MessageFormat$Field
+android.icu.text.MessagePattern
+android.icu.text.MessagePattern$ApostropheMode
+android.icu.text.MessagePattern$ArgType
+android.icu.text.MessagePattern$Part
+android.icu.text.MessagePattern$Part$Type
+android.icu.text.NumberFormat
+android.icu.text.NumberingSystem
+android.icu.text.Replaceable
+android.icu.text.ReplaceableString
+android.icu.text.SimpleDateFormat
+android.icu.text.SimpleDateFormat$PatternItem
+android.icu.text.UCharacterIterator
+android.icu.text.UFormat
+android.icu.text.UForwardCharacterIterator
+android.icu.text.UTF16
+android.icu.text.UnicodeFilter
+android.icu.text.UnicodeMatcher
+android.icu.text.UnicodeSet
+android.icu.text.UnicodeSet$Filter
+android.icu.text.UnicodeSet$GeneralCategoryMaskFilter
+android.icu.text.UnicodeSet$IntPropertyFilter
+android.icu.util.BasicTimeZone
+android.icu.util.BytesTrie
+android.icu.util.BytesTrie$Result
+android.icu.util.Calendar
+android.icu.util.Calendar$CalType
+android.icu.util.Calendar$FormatConfiguration
+android.icu.util.Calendar$PatternData
+android.icu.util.Calendar$WeekData
+android.icu.util.Calendar$WeekDataCache
+android.icu.util.Currency
+android.icu.util.Currency$EquivalenceRelation
+android.icu.util.Freezable
+android.icu.util.GregorianCalendar
+android.icu.util.MeasureUnit
+android.icu.util.MeasureUnit$1
+android.icu.util.MeasureUnit$2
+android.icu.util.MeasureUnit$3
+android.icu.util.MeasureUnit$Factory
+android.icu.util.SimpleTimeZone
+android.icu.util.TimeUnit
+android.icu.util.TimeZone
+android.icu.util.TimeZone$ConstantZone
+android.icu.util.ULocale
+android.icu.util.ULocale$Category
+android.icu.util.ULocale$JDKLocaleHelper
+android.icu.util.ULocale$Type
+android.icu.util.UResourceBundle
+android.icu.util.UResourceBundle$ResourceCacheKey
+android.icu.util.UResourceBundleIterator
+android.icu.util.UResourceTypeMismatchException
+android.icu.util.VersionInfo
 android.inputmethodservice.ExtractEditText
+android.location.CountryDetector
 android.location.Location
 android.location.Location$1
+android.location.LocationManager
 android.media.AmrInputStream
 android.media.AudioAttributes
 android.media.AudioAttributes$1
 android.media.AudioAttributes$Builder
+android.media.AudioDeviceInfo
 android.media.AudioDevicePort
 android.media.AudioDevicePortConfig
 android.media.AudioFormat
@@ -851,7 +1208,8 @@
 android.media.AudioManager$1
 android.media.AudioManager$FocusEventHandlerDelegate
 android.media.AudioManager$FocusEventHandlerDelegate$1
-android.media.AudioManager$OnAudioFocusChangeListener
+android.media.AudioManager$OnAmPortUpdateListener
+android.media.AudioManager$OnAudioPortUpdateListener
 android.media.AudioMixPort
 android.media.AudioMixPortConfig
 android.media.AudioPatch
@@ -876,33 +1234,46 @@
 android.media.Image
 android.media.ImageReader
 android.media.ImageReader$SurfaceImage
+android.media.ImageWriter
+android.media.ImageWriter$WriterSurfaceImage
 android.media.JetPlayer
 android.media.MediaCodec
 android.media.MediaCodecList
 android.media.MediaCrypto
 android.media.MediaDrm
 android.media.MediaExtractor
-android.media.MediaFormat
 android.media.MediaHTTPConnection
-android.media.MediaMetadata
 android.media.MediaMetadataRetriever
 android.media.MediaMuxer
 android.media.MediaPlayer
-android.media.MediaPlayer$OnBufferingUpdateListener
+android.media.MediaPlayer$1
+android.media.MediaPlayer$EventHandler
 android.media.MediaPlayer$OnCompletionListener
 android.media.MediaPlayer$OnErrorListener
-android.media.MediaPlayer$OnPreparedListener
 android.media.MediaPlayer$OnSeekCompleteListener
-android.media.MediaPlayer$OnVideoSizeChangedListener
+android.media.MediaPlayer$OnSubtitleDataListener
+android.media.MediaPlayer$TimeProvider
+android.media.MediaPlayer$TimeProvider$EventHandler
 android.media.MediaRecorder
+android.media.MediaRouter
 android.media.MediaScanner
+android.media.MediaSync
+android.media.MediaTimeProvider
+android.media.MediaTimeProvider$OnMediaTimeListener
+android.media.PlaybackParams
+android.media.PlaybackParams$1
 android.media.RemoteDisplay
 android.media.ResampleInputStream
-android.media.SoundPool$SoundPoolImpl
 android.media.SubtitleController$Listener
+android.media.SyncParams
 android.media.ToneGenerator
-android.media.audiofx.AudioEffect
-android.media.audiofx.LoudnessEnhancer
+android.media.audiopolicy.AudioMix
+android.media.audiopolicy.AudioMixingRule
+android.media.audiopolicy.AudioMixingRule$AttributeMatchCriterion
+android.media.midi.MidiManager
+android.media.projection.MediaProjectionManager
+android.media.session.MediaSessionManager
+android.media.tv.TvInputManager
 android.mtp.MtpDatabase
 android.mtp.MtpDevice
 android.mtp.MtpDeviceInfo
@@ -916,9 +1287,16 @@
 android.net.Credentials
 android.net.DhcpResults
 android.net.DhcpResults$1
+android.net.EthernetManager
 android.net.IConnectivityManager
 android.net.IConnectivityManager$Stub
 android.net.IConnectivityManager$Stub$Proxy
+android.net.IpPrefix
+android.net.IpPrefix$1
+android.net.LinkAddress
+android.net.LinkAddress$1
+android.net.LinkProperties
+android.net.LinkProperties$1
 android.net.LocalServerSocket
 android.net.LocalSocket
 android.net.LocalSocketImpl
@@ -928,11 +1306,16 @@
 android.net.NetworkInfo$1
 android.net.NetworkInfo$DetailedState
 android.net.NetworkInfo$State
+android.net.NetworkPolicyManager
+android.net.NetworkScoreManager
 android.net.NetworkStats
 android.net.NetworkStats$1
 android.net.NetworkUtils
 android.net.Proxy
 android.net.ProxyInfo
+android.net.ProxyInfo$1
+android.net.RouteInfo
+android.net.RouteInfo$1
 android.net.SSLCertificateSocketFactory
 android.net.SSLCertificateSocketFactory$1
 android.net.SSLSessionCache
@@ -952,16 +1335,25 @@
 android.net.Uri$PathSegments
 android.net.Uri$PathSegmentsBuilder
 android.net.Uri$StringUri
-android.net.WebAddress
 android.net.http.AndroidHttpClient
 android.net.http.AndroidHttpClient$1
-android.net.http.AndroidHttpClient$2
+android.net.nsd.NsdManager
 android.net.wifi.IWifiManager
 android.net.wifi.IWifiManager$Stub
 android.net.wifi.IWifiManager$Stub$Proxy
+android.net.wifi.RttManager
+android.net.wifi.SupplicantState
+android.net.wifi.SupplicantState$1
 android.net.wifi.WifiInfo
+android.net.wifi.WifiInfo$1
 android.net.wifi.WifiManager
+android.net.wifi.WifiManager$ServiceHandler
 android.net.wifi.WifiManager$WifiLock
+android.net.wifi.WifiScanner
+android.net.wifi.WifiSsid
+android.net.wifi.WifiSsid$1
+android.net.wifi.p2p.WifiP2pManager
+android.net.wifi.passpoint.WifiPasspointManager
 android.nfc.IAppCallback
 android.nfc.IAppCallback$Stub
 android.nfc.INfcAdapter
@@ -973,11 +1365,9 @@
 android.nfc.INfcTag
 android.nfc.INfcTag$Stub
 android.nfc.INfcTag$Stub$Proxy
-android.nfc.NdefRecord
 android.nfc.NfcActivityManager
 android.nfc.NfcAdapter
 android.nfc.NfcAdapter$1
-android.nfc.NfcEvent
 android.nfc.NfcManager
 android.opengl.EGL14
 android.opengl.EGLConfig
@@ -995,7 +1385,7 @@
 android.opengl.GLES30
 android.opengl.GLES31
 android.opengl.GLES31Ext
-android.opengl.GLSurfaceView
+android.opengl.GLUtils
 android.opengl.Matrix
 android.opengl.Visibility
 android.os.AsyncTask$1
@@ -1009,7 +1399,7 @@
 android.os.AsyncTask$WorkerRunnable
 android.os.BadParcelableException
 android.os.BaseBundle
-android.os.BatteryStats
+android.os.BatteryManager
 android.os.Binder
 android.os.BinderProxy
 android.os.Build
@@ -1019,7 +1409,6 @@
 android.os.CancellationSignal
 android.os.CancellationSignal$OnCancelListener
 android.os.CancellationSignal$Transport
-android.os.ConditionVariable
 android.os.DeadObjectException
 android.os.Debug
 android.os.Debug$MemoryInfo
@@ -1040,6 +1429,8 @@
 android.os.IInterface
 android.os.IMessenger
 android.os.IMessenger$Stub
+android.os.IMessenger$Stub$Proxy
+android.os.INetworkManagementService
 android.os.INetworkManagementService$Stub
 android.os.INetworkManagementService$Stub$Proxy
 android.os.IPowerManager
@@ -1065,8 +1456,12 @@
 android.os.Parcelable
 android.os.Parcelable$ClassLoaderCreator
 android.os.Parcelable$Creator
+android.os.ParcelableParcel
+android.os.ParcelableParcel$1
 android.os.PatternMatcher
 android.os.PatternMatcher$1
+android.os.PersistableBundle
+android.os.PersistableBundle$1
 android.os.PowerManager
 android.os.PowerManager$WakeLock
 android.os.PowerManager$WakeLock$1
@@ -1110,59 +1505,75 @@
 android.os.UserHandle
 android.os.UserHandle$1
 android.os.UserManager
+android.os.Vibrator
 android.os.ZygoteStartFailedEx
 android.os.storage.IMountService
 android.os.storage.IMountService$Stub
 android.os.storage.IMountService$Stub$Proxy
+android.os.storage.StorageManager
 android.os.storage.StorageVolume
 android.os.storage.StorageVolume$1
-android.preference.ListPreference
 android.preference.PreferenceActivity
 android.preference.PreferenceFragment$OnPreferenceStartFragmentCallback
-android.preference.PreferenceFrameLayout
-android.preference.PreferenceGroup
 android.preference.PreferenceManager
 android.preference.PreferenceManager$OnPreferenceTreeClickListener
-android.preference.PreferenceScreen
+android.print.PrintManager
 android.provider.BaseColumns
-android.provider.CallLog$Calls
 android.provider.ContactsContract
+android.provider.ContactsContract$CommonDataKinds$BaseTypes
+android.provider.ContactsContract$CommonDataKinds$CommonColumns
+android.provider.ContactsContract$CommonDataKinds$Email
 android.provider.ContactsContract$CommonDataKinds$Phone
 android.provider.ContactsContract$ContactCounts
 android.provider.ContactsContract$ContactNameColumns
 android.provider.ContactsContract$ContactOptionsColumns
 android.provider.ContactsContract$ContactStatusColumns
+android.provider.ContactsContract$Contacts
 android.provider.ContactsContract$ContactsColumns
 android.provider.ContactsContract$Data
 android.provider.ContactsContract$DataColumns
 android.provider.ContactsContract$DataColumnsWithJoins
 android.provider.ContactsContract$DataUsageStatColumns
-android.provider.ContactsContract$PhoneLookup
 android.provider.ContactsContract$RawContactsColumns
 android.provider.ContactsContract$StatusColumns
-android.provider.DocumentsProvider
-android.provider.Downloads$Impl
-android.provider.SearchIndexablesContract
-android.provider.Settings
+android.provider.MediaStore$MediaColumns
 android.provider.Settings$Global
 android.provider.Settings$NameValueCache
 android.provider.Settings$NameValueTable
 android.provider.Settings$Secure
 android.provider.Settings$SettingNotFoundException
 android.provider.Settings$System
-android.provider.Telephony$Mms
-android.renderscript.RenderScript
+android.provider.Settings$System$1
+android.provider.Settings$System$2
+android.provider.Settings$System$3
+android.provider.Settings$System$4
+android.provider.Settings$System$5
+android.provider.Settings$System$6
+android.provider.Settings$System$7
+android.provider.Settings$System$8
+android.provider.Settings$System$9
+android.provider.Settings$System$DiscreteValueValidator
+android.provider.Settings$System$InclusiveFloatRangeValidator
+android.provider.Settings$System$InclusiveIntegerRangeValidator
+android.provider.Settings$System$Validator
+android.renderscript.RenderScriptCacheDir
+android.security.IKeystoreService
+android.security.IKeystoreService$Stub
+android.security.IKeystoreService$Stub$Proxy
+android.security.KeyStore
+android.security.KeyStoreException
+android.security.NetworkSecurityPolicy
 android.security.keystore.AndroidKeyStoreBCWorkaroundProvider
+android.security.keystore.AndroidKeyStoreKey
 android.security.keystore.AndroidKeyStoreProvider
-android.speech.tts.TextToSpeechService
-android.speech.tts.TextToSpeechService$SpeechItemV1
-android.speech.tts.TextToSpeechService$SynthesisSpeechItemV1
-android.speech.tts.TextToSpeechService$SynthesisToFileOutputStreamSpeechItemV1
-android.speech.tts.TextToSpeechService$UtteranceSpeechItem
-android.speech.tts.TtsEngines
+android.security.keystore.KeyStoreCryptoOperation
+android.service.persistentdata.PersistentDataBlockManager
+android.system.ErrnoException
 android.system.GaiException
+android.system.NetlinkSocketAddress
 android.system.Os
 android.system.OsConstants
+android.system.PacketSocketAddress
 android.system.StructAddrinfo
 android.system.StructFlock
 android.system.StructGroupReq
@@ -1170,28 +1581,32 @@
 android.system.StructLinger
 android.system.StructPasswd
 android.system.StructPollfd
+android.system.StructStat
 android.system.StructStatVfs
 android.system.StructTimeval
 android.system.StructUcred
 android.system.StructUtsname
-android.telecom.InCallService
+android.telecom.TelecomManager
+android.telephony.CarrierConfigManager
 android.telephony.PhoneNumberUtils
 android.telephony.Rlog
-android.telephony.SignalStrength
 android.telephony.SubscriptionManager
 android.telephony.TelephonyManager
 android.text.AndroidBidi
 android.text.AndroidCharacter
-android.text.BidiFormatter$DirectionalityEstimator
 android.text.BoringLayout
 android.text.BoringLayout$Metrics
+android.text.ClipboardManager
 android.text.DynamicLayout
 android.text.DynamicLayout$ChangeWatcher
 android.text.Editable
 android.text.Editable$Factory
 android.text.GetChars
 android.text.GraphicsOperations
+android.text.Html
 android.text.Html$HtmlParser
+android.text.HtmlToSpannedConverter
+android.text.Hyphenator
 android.text.InputFilter
 android.text.InputType
 android.text.Layout
@@ -1217,6 +1632,8 @@
 android.text.Spanned
 android.text.SpannedString
 android.text.StaticLayout
+android.text.StaticLayout$Builder
+android.text.StaticLayout$LineBreaks
 android.text.TextDirectionHeuristic
 android.text.TextDirectionHeuristics
 android.text.TextDirectionHeuristics$AnyStrong
@@ -1233,6 +1650,7 @@
 android.text.TextUtils$TruncateAt
 android.text.TextWatcher
 android.text.format.DateFormat
+android.text.format.DateUtils
 android.text.format.Time
 android.text.format.Time$TimeCalculator
 android.text.method.AllCapsTransformationMethod
@@ -1240,13 +1658,14 @@
 android.text.method.BaseKeyListener
 android.text.method.BaseMovementMethod
 android.text.method.KeyListener
+android.text.method.LinkMovementMethod
 android.text.method.MetaKeyKeyListener
 android.text.method.MovementMethod
 android.text.method.PasswordTransformationMethod
-android.text.method.QwertyKeyListener
 android.text.method.ReplacementTransformationMethod
 android.text.method.ReplacementTransformationMethod$ReplacementCharSequence
 android.text.method.ReplacementTransformationMethod$SpannedReplacementCharSequence
+android.text.method.ScrollingMovementMethod
 android.text.method.SingleLineTransformationMethod
 android.text.method.TextKeyListener
 android.text.method.TextKeyListener$Capitalize
@@ -1256,6 +1675,7 @@
 android.text.style.CharacterStyle
 android.text.style.ClickableSpan
 android.text.style.EasyEditSpan
+android.text.style.ForegroundColorSpan
 android.text.style.LeadingMarginSpan
 android.text.style.LineBackgroundSpan
 android.text.style.LineHeightSpan
@@ -1265,6 +1685,7 @@
 android.text.style.SpellCheckSpan
 android.text.style.StyleSpan
 android.text.style.SuggestionSpan
+android.text.style.TabStopSpan
 android.text.style.URLSpan
 android.text.style.UpdateAppearance
 android.text.style.UpdateLayout
@@ -1272,14 +1693,21 @@
 android.transition.AutoTransition
 android.transition.ChangeBounds
 android.transition.ChangeBounds$1
+android.transition.ChangeBounds$2
+android.transition.ChangeBounds$3
+android.transition.ChangeBounds$4
+android.transition.ChangeBounds$5
+android.transition.ChangeBounds$6
 android.transition.ChangeClipBounds
 android.transition.ChangeImageTransform
 android.transition.ChangeImageTransform$1
 android.transition.ChangeImageTransform$2
 android.transition.ChangeTransform
 android.transition.ChangeTransform$1
+android.transition.ChangeTransform$2
 android.transition.Fade
 android.transition.PathMotion
+android.transition.Scene
 android.transition.Transition
 android.transition.Transition$1
 android.transition.TransitionInflater
@@ -1301,7 +1729,6 @@
 android.util.DisplayMetrics
 android.util.EventLog
 android.util.EventLog$Event
-android.util.FloatMath
 android.util.FloatProperty
 android.util.IntProperty
 android.util.Log
@@ -1313,6 +1740,7 @@
 android.util.MapCollections
 android.util.MapCollections$ArrayIterator
 android.util.MapCollections$KeySet
+android.util.MapCollections$ValuesCollection
 android.util.MathUtils
 android.util.MutableInt
 android.util.MutableLong
@@ -1324,8 +1752,11 @@
 android.util.Pools$Pool
 android.util.Pools$SimplePool
 android.util.Pools$SynchronizedPool
+android.util.Printer
 android.util.Property
 android.util.Singleton
+android.util.Size
+android.util.SizeF
 android.util.Slog
 android.util.SparseArray
 android.util.SparseBooleanArray
@@ -1339,45 +1770,51 @@
 android.view.AbsSavedState$2
 android.view.ActionMode
 android.view.ActionMode$Callback
+android.view.ActionProvider
 android.view.ActionProvider$SubUiVisibilityListener
 android.view.Choreographer
 android.view.Choreographer$1
 android.view.Choreographer$2
 android.view.Choreographer$CallbackQueue
 android.view.Choreographer$CallbackRecord
+android.view.Choreographer$FrameCallback
 android.view.Choreographer$FrameDisplayEventReceiver
 android.view.Choreographer$FrameHandler
 android.view.ContextMenu
 android.view.ContextMenu$ContextMenuInfo
 android.view.ContextThemeWrapper
 android.view.Display
+android.view.Display$Mode
+android.view.Display$Mode$1
 android.view.DisplayAdjustments
 android.view.DisplayEventReceiver
 android.view.DisplayInfo
 android.view.DisplayInfo$1
+android.view.DisplayListCanvas
 android.view.FallbackEventHandler
 android.view.FocusFinder
 android.view.FocusFinder$1
 android.view.FocusFinder$SequentialFocusComparator
+android.view.FrameInfo
 android.view.FrameStats
-android.view.GLES20Canvas
-android.view.GLES20Canvas$CanvasFinalizer
-android.view.GLES20RecordingCanvas
 android.view.GestureDetector
 android.view.GestureDetector$GestureHandler
+android.view.GestureDetector$OnContextClickListener
 android.view.GestureDetector$OnDoubleTapListener
 android.view.GestureDetector$OnGestureListener
 android.view.GestureDetector$SimpleOnGestureListener
 android.view.GraphicBuffer
 android.view.GraphicBuffer$1
 android.view.Gravity
-android.view.HardwareCanvas
 android.view.HardwareLayer
 android.view.HardwareRenderer
 android.view.HardwareRenderer$HardwareDrawCallbacks
 android.view.IAssetAtlas
 android.view.IAssetAtlas$Stub
 android.view.IAssetAtlas$Stub$Proxy
+android.view.IGraphicsStats
+android.view.IGraphicsStats$Stub
+android.view.IGraphicsStats$Stub$Proxy
 android.view.IRotationWatcher
 android.view.IRotationWatcher$Stub
 android.view.IWindow
@@ -1420,6 +1857,7 @@
 android.view.MenuInflater$MenuState
 android.view.MenuItem
 android.view.MenuItem$OnActionExpandListener
+android.view.MenuItem$OnMenuItemClickListener
 android.view.MotionEvent
 android.view.MotionEvent$1
 android.view.MotionEvent$PointerCoords
@@ -1429,6 +1867,7 @@
 android.view.RenderNode
 android.view.RenderNodeAnimator
 android.view.RenderNodeAnimator$1
+android.view.SearchEvent
 android.view.SubMenu
 android.view.Surface
 android.view.Surface$1
@@ -1439,18 +1878,17 @@
 android.view.SurfaceHolder$Callback
 android.view.SurfaceHolder$Callback2
 android.view.SurfaceSession
-android.view.SurfaceView
 android.view.TextureView
 android.view.ThreadedRenderer
-android.view.ThreadedRenderer$AtlasInitializer
+android.view.ThreadedRenderer$ProcessInitializer
 android.view.VelocityTracker
 android.view.VelocityTracker$Estimator
 android.view.View
+android.view.View$1
 android.view.View$10
 android.view.View$11
 android.view.View$12
-android.view.View$13
-android.view.View$14
+android.view.View$2
 android.view.View$3
 android.view.View$4
 android.view.View$5
@@ -1464,8 +1902,10 @@
 android.view.View$BaseSavedState
 android.view.View$BaseSavedState$1
 android.view.View$CheckForTap
+android.view.View$ForegroundInfo
 android.view.View$ListenerInfo
 android.view.View$MeasureSpec
+android.view.View$OnApplyWindowInsetsListener
 android.view.View$OnAttachStateChangeListener
 android.view.View$OnClickListener
 android.view.View$OnCreateContextMenuListener
@@ -1479,8 +1919,10 @@
 android.view.View$TransformationInfo
 android.view.View$UnsetPressedState
 android.view.ViewConfiguration
+android.view.ViewDebug$HierarchyHandler
 android.view.ViewGroup
-android.view.ViewGroup$3
+android.view.ViewGroup$1
+android.view.ViewGroup$2
 android.view.ViewGroup$LayoutParams
 android.view.ViewGroup$MarginLayoutParams
 android.view.ViewGroup$OnHierarchyChangeListener
@@ -1490,8 +1932,12 @@
 android.view.ViewOutlineProvider$1
 android.view.ViewOutlineProvider$2
 android.view.ViewOutlineProvider$3
-android.view.ViewOverlay$OverlayViewGroup
 android.view.ViewParent
+android.view.ViewPropertyAnimator
+android.view.ViewPropertyAnimator$1
+android.view.ViewPropertyAnimator$AnimatorEventListener
+android.view.ViewPropertyAnimator$NameValuesHolder
+android.view.ViewPropertyAnimator$PropertyBundle
 android.view.ViewRootImpl
 android.view.ViewRootImpl$1
 android.view.ViewRootImpl$4
@@ -1527,6 +1973,7 @@
 android.view.ViewTreeObserver$CopyOnWriteArray
 android.view.ViewTreeObserver$CopyOnWriteArray$Access
 android.view.ViewTreeObserver$InternalInsetsInfo
+android.view.ViewTreeObserver$OnGlobalFocusChangeListener
 android.view.ViewTreeObserver$OnGlobalLayoutListener
 android.view.ViewTreeObserver$OnPreDrawListener
 android.view.ViewTreeObserver$OnScrollChangedListener
@@ -1535,6 +1982,8 @@
 android.view.Window$Callback
 android.view.Window$OnWindowDismissedCallback
 android.view.WindowAnimationFrameStats
+android.view.WindowAnimationFrameStats$1
+android.view.WindowContentFrameStats
 android.view.WindowContentFrameStats$1
 android.view.WindowInsets
 android.view.WindowLeaked
@@ -1546,6 +1995,7 @@
 android.view.WindowManagerGlobal$2
 android.view.WindowManagerImpl
 android.view.accessibility.AccessibilityEvent
+android.view.accessibility.AccessibilityEventSource
 android.view.accessibility.AccessibilityManager
 android.view.accessibility.AccessibilityManager$1
 android.view.accessibility.AccessibilityManager$AccessibilityStateChangeListener
@@ -1554,6 +2004,7 @@
 android.view.accessibility.AccessibilityNodeInfo
 android.view.accessibility.AccessibilityNodeProvider
 android.view.accessibility.AccessibilityRecord
+android.view.accessibility.CaptioningManager
 android.view.accessibility.IAccessibilityManager
 android.view.accessibility.IAccessibilityManager$Stub
 android.view.accessibility.IAccessibilityManager$Stub$Proxy
@@ -1561,14 +2012,20 @@
 android.view.accessibility.IAccessibilityManagerClient$Stub
 android.view.animation.AccelerateDecelerateInterpolator
 android.view.animation.AccelerateInterpolator
+android.view.animation.AlphaAnimation
 android.view.animation.Animation
+android.view.animation.Animation$1
+android.view.animation.Animation$2
+android.view.animation.Animation$3
 android.view.animation.Animation$AnimationListener
 android.view.animation.AnimationUtils
+android.view.animation.BaseInterpolator
 android.view.animation.DecelerateInterpolator
 android.view.animation.Interpolator
 android.view.animation.LinearInterpolator
 android.view.animation.PathInterpolator
 android.view.animation.Transformation
+android.view.animation.TranslateAnimation
 android.view.inputmethod.BaseInputConnection
 android.view.inputmethod.ComposingText
 android.view.inputmethod.CursorAnchorInfo
@@ -1586,24 +2043,39 @@
 android.view.inputmethod.InputMethodManager$H
 android.view.inputmethod.InputMethodManager$ImeInputEventSender
 android.view.inputmethod.InputMethodManager$PendingEvent
+android.view.textservice.SpellCheckerSession$SpellCheckerSessionListener
+android.view.textservice.SpellCheckerSubtype
+android.view.textservice.SpellCheckerSubtype$1
+android.view.textservice.TextServicesManager
+android.webkit.IWebViewUpdateService
+android.webkit.IWebViewUpdateService$Stub
+android.webkit.WebView
 android.webkit.WebViewFactory
+android.webkit.WebViewFactory$MissingWebViewPackageException
 android.widget.AbsListView
+android.widget.AbsListView$3
 android.widget.AbsListView$AdapterDataSetObserver
 android.widget.AbsListView$CheckForTap
 android.widget.AbsListView$LayoutParams
 android.widget.AbsListView$OnScrollListener
+android.widget.AbsListView$PerformClick
 android.widget.AbsListView$RecycleBin
 android.widget.AbsListView$SavedState
 android.widget.AbsListView$SavedState$1
-android.widget.AbsSeekBar
+android.widget.AbsListView$SelectionBoundsAdjuster
+android.widget.AbsListView$WindowRunnnable
 android.widget.AbsSpinner
+android.widget.AbsSpinner$RecycleBin
 android.widget.AbsoluteLayout
 android.widget.ActionMenuPresenter
+android.widget.ActionMenuPresenter$1
+android.widget.ActionMenuPresenter$2
 android.widget.ActionMenuPresenter$OverflowMenuButton
 android.widget.ActionMenuPresenter$OverflowMenuButton$1
 android.widget.ActionMenuPresenter$PopupPresenterCallback
 android.widget.ActionMenuView
 android.widget.ActionMenuView$ActionMenuChildView
+android.widget.ActionMenuView$LayoutParams
 android.widget.ActionMenuView$OnMenuItemClickListener
 android.widget.Adapter
 android.widget.AdapterView
@@ -1611,46 +2083,41 @@
 android.widget.AdapterView$OnItemClickListener
 android.widget.AdapterView$OnItemSelectedListener
 android.widget.ArrayAdapter
-android.widget.AutoCompleteTextView
 android.widget.BaseAdapter
 android.widget.Button
-android.widget.CheckBox
 android.widget.Checkable
-android.widget.CheckedTextView
 android.widget.CompoundButton
 android.widget.CompoundButton$OnCheckedChangeListener
-android.widget.DatePicker
 android.widget.EdgeEffect
 android.widget.EditText
 android.widget.Editor
+android.widget.Editor$1
+android.widget.Editor$2
+android.widget.Editor$Blink
 android.widget.Editor$CursorAnchorInfoNotifier
-android.widget.Editor$HandleView
+android.widget.Editor$EditOperation
+android.widget.Editor$EditOperation$1
 android.widget.Editor$InputContentType
 android.widget.Editor$InputMethodState
-android.widget.Editor$InsertionHandleView
 android.widget.Editor$PositionListener
 android.widget.Editor$SpanController
-android.widget.Editor$TextDisplayList
+android.widget.Editor$TextRenderNode
 android.widget.Editor$TextViewPositionListener
-android.widget.FastScroller
+android.widget.Editor$UndoInputFilter
 android.widget.Filter
 android.widget.Filter$FilterListener
 android.widget.Filterable
 android.widget.FrameLayout
 android.widget.FrameLayout$LayoutParams
-android.widget.GridLayout
-android.widget.GridView
 android.widget.HeaderViewListAdapter
 android.widget.HorizontalScrollView
 android.widget.ImageButton
-android.widget.ImageSwitcher
 android.widget.ImageView
 android.widget.ImageView$ScaleType
 android.widget.LinearLayout
 android.widget.LinearLayout$LayoutParams
 android.widget.ListAdapter
 android.widget.ListPopupWindow
-android.widget.ListPopupWindow$DropDownListView
 android.widget.ListPopupWindow$ForwardingListener
 android.widget.ListPopupWindow$ListSelectorHider
 android.widget.ListPopupWindow$PopupDataSetObserver
@@ -1659,25 +2126,22 @@
 android.widget.ListPopupWindow$ResizePopupRunnable
 android.widget.ListView
 android.widget.ListView$ArrowScrollFocusResult
-android.widget.MediaController
-android.widget.MultiAutoCompleteTextView
+android.widget.ListView$FixedViewInfo
 android.widget.OverScroller
 android.widget.OverScroller$SplineOverScroller
 android.widget.PopupWindow
 android.widget.PopupWindow$1
-android.widget.PopupWindow$PopupViewContainer
+android.widget.PopupWindow$OnDismissListener
 android.widget.ProgressBar
 android.widget.ProgressBar$SavedState
 android.widget.ProgressBar$SavedState$1
-android.widget.QuickContactBadge
-android.widget.RatingBar
 android.widget.RelativeLayout
 android.widget.RelativeLayout$DependencyGraph
 android.widget.RelativeLayout$DependencyGraph$Node
 android.widget.RelativeLayout$LayoutParams
 android.widget.RemoteViews
 android.widget.RemoteViews$1
-android.widget.RemoteViews$3
+android.widget.RemoteViews$2
 android.widget.RemoteViews$Action
 android.widget.RemoteViews$ActionException
 android.widget.RemoteViews$BitmapCache
@@ -1687,20 +2151,25 @@
 android.widget.RemoteViews$ReflectionAction
 android.widget.RemoteViews$SetDrawableParameters
 android.widget.RemoteViews$TextViewSizeAction
+android.widget.RemoteViews$ViewPaddingAction
 android.widget.RemoteViewsAdapter$RemoteAdapterConnectionCallback
 android.widget.RtlSpacingHelper
 android.widget.ScrollBarDrawable
 android.widget.ScrollView
+android.widget.ScrollView$SavedState
+android.widget.ScrollView$SavedState$1
 android.widget.Scroller
 android.widget.Scroller$ViscousFluidInterpolator
 android.widget.SectionIndexer
-android.widget.SeekBar
-android.widget.SimpleCursorAdapter
+android.widget.Space
+android.widget.SpellChecker
+android.widget.SpellChecker$SpellParser
+android.widget.Spinner
+android.widget.Spinner$SpinnerPopup
 android.widget.SpinnerAdapter
-android.widget.Switch
-android.widget.TableLayout
 android.widget.TextView
-android.widget.TextView$4
+android.widget.TextView$2
+android.widget.TextView$3
 android.widget.TextView$BufferType
 android.widget.TextView$ChangeWatcher
 android.widget.TextView$CharWrapper
@@ -1708,37 +2177,63 @@
 android.widget.TextView$OnEditorActionListener
 android.widget.TextView$SavedState
 android.widget.TextView$SavedState$1
-android.widget.TimePicker
-android.widget.ToggleButton
+android.widget.ThemedSpinnerAdapter
 android.widget.Toolbar
 android.widget.Toolbar$1
 android.widget.Toolbar$2
 android.widget.Toolbar$ExpandedActionViewMenuPresenter
 android.widget.Toolbar$LayoutParams
-android.widget.ViewAnimator
-android.widget.ViewFlipper
-android.widget.ViewSwitcher
 android.widget.WrapperListAdapter
 com.android.dex.Annotation
+com.android.dex.ClassData
+com.android.dex.ClassData$Method
+com.android.dex.ClassDef
+com.android.dex.Code
+com.android.dex.Dex
+com.android.dex.Dex$ClassDefIterable
+com.android.dex.Dex$FieldIdTable
+com.android.dex.Dex$MethodIdTable
+com.android.dex.Dex$ProtoIdTable
+com.android.dex.Dex$Section
+com.android.dex.Dex$StringTable
+com.android.dex.Dex$TypeIndexToDescriptorIndexTable
+com.android.dex.Dex$TypeIndexToDescriptorTable
+com.android.dex.DexException
 com.android.dex.DexFormat
 com.android.dex.EncodedValue
 com.android.dex.EncodedValueCodec
 com.android.dex.EncodedValueReader
+com.android.dex.FieldId
 com.android.dex.Leb128
+com.android.dex.MethodId
 com.android.dex.Mutf8
+com.android.dex.TableOfContents
+com.android.dex.TableOfContents$Section
+com.android.dex.TypeList
 com.android.dex.util.ByteArrayByteInput
-com.android.i18n.phonenumbers.AsYouTypeFormatter
-com.android.i18n.phonenumbers.PhoneNumberMatcher
+com.android.dex.util.ByteInput
+com.android.dex.util.ByteOutput
+com.android.dex.util.ExceptionWithContext
+com.android.dex.util.FileUtils
+com.android.i18n.phonenumbers.CountryCodeToRegionCodeMap
+com.android.i18n.phonenumbers.MetadataLoader
+com.android.i18n.phonenumbers.NumberParseException
 com.android.i18n.phonenumbers.PhoneNumberUtil
-com.android.i18n.phonenumbers.Phonemetadata$PhoneMetadata
+com.android.i18n.phonenumbers.PhoneNumberUtil$1
+com.android.i18n.phonenumbers.RegexCache
+com.android.i18n.phonenumbers.RegexCache$LRUCache
+com.android.i18n.phonenumbers.RegexCache$LRUCache$1
 com.android.internal.R$styleable
+com.android.internal.app.AlertController
+com.android.internal.app.AlertController$1
+com.android.internal.app.AlertController$2
+com.android.internal.app.AlertController$AlertParams
+com.android.internal.app.AlertController$ButtonHandler
 com.android.internal.app.IAppOpsService
 com.android.internal.app.IAppOpsService$Stub
 com.android.internal.app.IAppOpsService$Stub$Proxy
-com.android.internal.app.IBatteryStats$Stub
 com.android.internal.app.IVoiceInteractor
 com.android.internal.app.IVoiceInteractor$Stub
-com.android.internal.app.ResolverActivity$ResolveListAdapter
 com.android.internal.app.WindowDecorActionBar
 com.android.internal.app.WindowDecorActionBar$1
 com.android.internal.app.WindowDecorActionBar$2
@@ -1747,18 +2242,15 @@
 com.android.internal.appwidget.IAppWidgetService$Stub
 com.android.internal.appwidget.IAppWidgetService$Stub$Proxy
 com.android.internal.content.NativeLibraryHelper
+com.android.internal.content.ReferrerIntent
+com.android.internal.content.ReferrerIntent$1
 com.android.internal.logging.AndroidConfig
 com.android.internal.logging.AndroidHandler
 com.android.internal.logging.AndroidHandler$1
 com.android.internal.net.NetworkStatsFactory
 com.android.internal.os.AndroidPrintStream
-com.android.internal.os.BatteryStatsImpl
-com.android.internal.os.BatteryStatsImpl$Uid
 com.android.internal.os.BinderInternal
 com.android.internal.os.BinderInternal$GcWatcher
-com.android.internal.os.IDropBoxManagerService
-com.android.internal.os.IDropBoxManagerService$Stub
-com.android.internal.os.IDropBoxManagerService$Stub$Proxy
 com.android.internal.os.LoggingPrintStream
 com.android.internal.os.LoggingPrintStream$1
 com.android.internal.os.RuntimeInit
@@ -1773,21 +2265,19 @@
 com.android.internal.os.ZygoteInit
 com.android.internal.os.ZygoteInit$MethodAndArgsCaller
 com.android.internal.os.ZygoteSecurityException
-com.android.internal.policy.IPolicy
-com.android.internal.policy.PolicyManager
-com.android.internal.policy.impl.PhoneFallbackEventHandler
-com.android.internal.policy.impl.PhoneLayoutInflater
-com.android.internal.policy.impl.PhoneWindow
-com.android.internal.policy.impl.PhoneWindow$1
-com.android.internal.policy.impl.PhoneWindow$ActionMenuPresenterCallback
-com.android.internal.policy.impl.PhoneWindow$DecorView
-com.android.internal.policy.impl.PhoneWindow$DialogMenuCallback
-com.android.internal.policy.impl.PhoneWindow$PanelFeatureState
-com.android.internal.policy.impl.PhoneWindow$PanelFeatureState$SavedState
-com.android.internal.policy.impl.PhoneWindow$PanelFeatureState$SavedState$1
-com.android.internal.policy.impl.PhoneWindow$RotationWatcher
-com.android.internal.policy.impl.PhoneWindow$RotationWatcher$1
-com.android.internal.policy.impl.Policy
+com.android.internal.policy.PhoneFallbackEventHandler
+com.android.internal.policy.PhoneLayoutInflater
+com.android.internal.policy.PhoneWindow
+com.android.internal.policy.PhoneWindow$1
+com.android.internal.policy.PhoneWindow$ActionMenuPresenterCallback
+com.android.internal.policy.PhoneWindow$ColorViewState
+com.android.internal.policy.PhoneWindow$DecorView
+com.android.internal.policy.PhoneWindow$DialogMenuCallback
+com.android.internal.policy.PhoneWindow$PanelFeatureState
+com.android.internal.policy.PhoneWindow$PanelFeatureState$SavedState
+com.android.internal.policy.PhoneWindow$PanelFeatureState$SavedState$1
+com.android.internal.policy.PhoneWindow$RotationWatcher
+com.android.internal.policy.PhoneWindow$RotationWatcher$1
 com.android.internal.telephony.ISub
 com.android.internal.telephony.ISub$Stub
 com.android.internal.telephony.ISub$Stub$Proxy
@@ -1798,14 +2288,23 @@
 com.android.internal.telephony.ITelephonyRegistry$Stub
 com.android.internal.telephony.ITelephonyRegistry$Stub$Proxy
 com.android.internal.telephony.PhoneConstants$State
+com.android.internal.textservice.ITextServicesManager
+com.android.internal.textservice.ITextServicesManager$Stub
+com.android.internal.textservice.ITextServicesManager$Stub$Proxy
+com.android.internal.transition.EpicenterTranslateClipReveal
+com.android.internal.transition.TransitionConstants
 com.android.internal.util.ArrayUtils
+com.android.internal.util.AsyncChannel
+com.android.internal.util.AsyncChannel$DeathMonitor
+com.android.internal.util.FastMath
 com.android.internal.util.FastPrintWriter
-com.android.internal.util.FastPrintWriter$1
+com.android.internal.util.FastPrintWriter$DummyWriter
 com.android.internal.util.FastXmlSerializer
 com.android.internal.util.GrowingArrayUtils
 com.android.internal.util.Preconditions
 com.android.internal.util.VirtualRefBasePtr
 com.android.internal.util.XmlUtils
+com.android.internal.util.XmlUtils$WriteMapCallback
 com.android.internal.view.ActionBarPolicy
 com.android.internal.view.IInputConnectionWrapper
 com.android.internal.view.IInputConnectionWrapper$MyHandler
@@ -1853,88 +2352,104 @@
 com.android.internal.widget.ActionBarOverlayLayout$ActionBarVisibilityCallback
 com.android.internal.widget.ActionBarOverlayLayout$LayoutParams
 com.android.internal.widget.BackgroundFallback
+com.android.internal.widget.ButtonBarLayout
 com.android.internal.widget.DecorContentParent
 com.android.internal.widget.DecorToolbar
+com.android.internal.widget.DialogTitle
 com.android.internal.widget.EditableInputConnection
-com.android.internal.widget.LockPatternUtils
-com.android.internal.widget.ScrollingTabContainerView
-com.android.internal.widget.ScrollingTabContainerView$TabView
 com.android.internal.widget.ToolbarWidgetWrapper
 com.android.internal.widget.ToolbarWidgetWrapper$1
 com.android.okhttp.Address
+com.android.okhttp.Authenticator
 com.android.okhttp.CacheControl
+com.android.okhttp.CacheControl$Builder
+com.android.okhttp.CertificatePinner
+com.android.okhttp.CertificatePinner$Builder
+com.android.okhttp.CipherSuite
 com.android.okhttp.ConfigAwareConnectionPool
 com.android.okhttp.ConfigAwareConnectionPool$1
 com.android.okhttp.Connection
 com.android.okhttp.ConnectionPool
 com.android.okhttp.ConnectionPool$1
+com.android.okhttp.ConnectionSpec
+com.android.okhttp.ConnectionSpec$Builder
 com.android.okhttp.Dispatcher
 com.android.okhttp.Handshake
 com.android.okhttp.Headers
 com.android.okhttp.Headers$Builder
-com.android.okhttp.HostResolver
-com.android.okhttp.HostResolver$1
 com.android.okhttp.HttpHandler
 com.android.okhttp.HttpsHandler
-com.android.okhttp.OkAuthenticator
 com.android.okhttp.OkHttpClient
-com.android.okhttp.OkResponseCache
+com.android.okhttp.OkHttpClient$1
+com.android.okhttp.OkUrlFactory
 com.android.okhttp.Protocol
 com.android.okhttp.Request
 com.android.okhttp.Request$Builder
-com.android.okhttp.Request$ParsedHeaders
+com.android.okhttp.RequestBody
+com.android.okhttp.RequestBody$2
 com.android.okhttp.Response
-com.android.okhttp.Response$Body
 com.android.okhttp.Response$Builder
-com.android.okhttp.ResponseSource
+com.android.okhttp.ResponseBody
 com.android.okhttp.Route
-com.android.okhttp.RouteDatabase
-com.android.okhttp.TunnelRequest
+com.android.okhttp.TlsVersion
+com.android.okhttp.internal.ConnectionSpecSelector
+com.android.okhttp.internal.Internal
+com.android.okhttp.internal.Network
+com.android.okhttp.internal.Network$1
+com.android.okhttp.internal.OptionalMethod
 com.android.okhttp.internal.Platform
+com.android.okhttp.internal.RouteDatabase
 com.android.okhttp.internal.Util
 com.android.okhttp.internal.Util$1
+com.android.okhttp.internal.http.AuthenticatorAdapter
 com.android.okhttp.internal.http.CacheStrategy
-com.android.okhttp.internal.http.CacheStrategy$1
 com.android.okhttp.internal.http.CacheStrategy$Factory
-com.android.okhttp.internal.http.DelegatingHttpsURLConnection
-com.android.okhttp.internal.http.HttpAuthenticator
-com.android.okhttp.internal.http.HttpAuthenticator$1
 com.android.okhttp.internal.http.HttpConnection
 com.android.okhttp.internal.http.HttpConnection$AbstractSource
 com.android.okhttp.internal.http.HttpConnection$ChunkedSource
 com.android.okhttp.internal.http.HttpConnection$FixedLengthSource
 com.android.okhttp.internal.http.HttpEngine
+com.android.okhttp.internal.http.HttpEngine$1
 com.android.okhttp.internal.http.HttpMethod
 com.android.okhttp.internal.http.HttpTransport
-com.android.okhttp.internal.http.HttpURLConnectionImpl
-com.android.okhttp.internal.http.HttpURLConnectionImpl$Retry
-com.android.okhttp.internal.http.HttpsURLConnectionImpl
 com.android.okhttp.internal.http.OkHeaders
 com.android.okhttp.internal.http.OkHeaders$1
+com.android.okhttp.internal.http.RealResponseBody
+com.android.okhttp.internal.http.RequestException
 com.android.okhttp.internal.http.RequestLine
 com.android.okhttp.internal.http.RetryableSink
+com.android.okhttp.internal.http.RouteException
 com.android.okhttp.internal.http.RouteSelector
+com.android.okhttp.internal.http.SocketConnector
+com.android.okhttp.internal.http.SocketConnector$ConnectedSocket
 com.android.okhttp.internal.http.StatusLine
 com.android.okhttp.internal.http.Transport
+com.android.okhttp.internal.huc.DelegatingHttpsURLConnection
+com.android.okhttp.internal.huc.HttpURLConnectionImpl
+com.android.okhttp.internal.huc.HttpsURLConnectionImpl
 com.android.okhttp.internal.tls.OkHostnameVerifier
-com.android.okio.BufferedSink
-com.android.okio.BufferedSource
-com.android.okio.ByteString
-com.android.okio.Deadline
-com.android.okio.Deadline$1
-com.android.okio.OkBuffer
-com.android.okio.Okio
-com.android.okio.Okio$1
-com.android.okio.Okio$2
-com.android.okio.RealBufferedSink
-com.android.okio.RealBufferedSink$1
-com.android.okio.RealBufferedSource
-com.android.okio.RealBufferedSource$1
-com.android.okio.Segment
-com.android.okio.SegmentPool
-com.android.okio.Sink
-com.android.okio.Source
-com.android.okio.Util
+com.android.okhttp.okio.AsyncTimeout
+com.android.okhttp.okio.AsyncTimeout$1
+com.android.okhttp.okio.AsyncTimeout$2
+com.android.okhttp.okio.AsyncTimeout$Watchdog
+com.android.okhttp.okio.Buffer
+com.android.okhttp.okio.BufferedSink
+com.android.okhttp.okio.BufferedSource
+com.android.okhttp.okio.Okio
+com.android.okhttp.okio.Okio$1
+com.android.okhttp.okio.Okio$2
+com.android.okhttp.okio.Okio$3
+com.android.okhttp.okio.RealBufferedSink
+com.android.okhttp.okio.RealBufferedSink$1
+com.android.okhttp.okio.RealBufferedSource
+com.android.okhttp.okio.RealBufferedSource$1
+com.android.okhttp.okio.Segment
+com.android.okhttp.okio.SegmentPool
+com.android.okhttp.okio.Sink
+com.android.okhttp.okio.Source
+com.android.okhttp.okio.Timeout
+com.android.okhttp.okio.Timeout$1
+com.android.okhttp.okio.Util
 com.android.org.bouncycastle.asn1.ASN1Boolean
 com.android.org.bouncycastle.asn1.ASN1Choice
 com.android.org.bouncycastle.asn1.ASN1Encodable
@@ -1946,8 +2461,10 @@
 com.android.org.bouncycastle.asn1.ASN1ObjectIdentifier
 com.android.org.bouncycastle.asn1.ASN1OctetString
 com.android.org.bouncycastle.asn1.ASN1OctetStringParser
+com.android.org.bouncycastle.asn1.ASN1OutputStream
 com.android.org.bouncycastle.asn1.ASN1Primitive
 com.android.org.bouncycastle.asn1.ASN1Sequence
+com.android.org.bouncycastle.asn1.ASN1SequenceParser
 com.android.org.bouncycastle.asn1.ASN1Set
 com.android.org.bouncycastle.asn1.ASN1StreamParser
 com.android.org.bouncycastle.asn1.ASN1String
@@ -1955,19 +2472,16 @@
 com.android.org.bouncycastle.asn1.ASN1TaggedObjectParser
 com.android.org.bouncycastle.asn1.BERTags
 com.android.org.bouncycastle.asn1.DERBitString
-com.android.org.bouncycastle.asn1.DERBoolean
 com.android.org.bouncycastle.asn1.DERFactory
 com.android.org.bouncycastle.asn1.DERIA5String
-com.android.org.bouncycastle.asn1.DERInteger
 com.android.org.bouncycastle.asn1.DERNull
-com.android.org.bouncycastle.asn1.DERObjectIdentifier
 com.android.org.bouncycastle.asn1.DEROctetString
+com.android.org.bouncycastle.asn1.DEROutputStream
 com.android.org.bouncycastle.asn1.DERPrintableString
 com.android.org.bouncycastle.asn1.DERSequence
 com.android.org.bouncycastle.asn1.DERSet
 com.android.org.bouncycastle.asn1.DERTaggedObject
 com.android.org.bouncycastle.asn1.DERUTF8String
-com.android.org.bouncycastle.asn1.DERUniversalString
 com.android.org.bouncycastle.asn1.DLSequence
 com.android.org.bouncycastle.asn1.DLSet
 com.android.org.bouncycastle.asn1.DefiniteLengthInputStream
@@ -1980,6 +2494,12 @@
 com.android.org.bouncycastle.asn1.nist.NISTObjectIdentifiers
 com.android.org.bouncycastle.asn1.oiw.OIWObjectIdentifiers
 com.android.org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers
+com.android.org.bouncycastle.asn1.x500.AttributeTypeAndValue
+com.android.org.bouncycastle.asn1.x500.RDN
+com.android.org.bouncycastle.asn1.x500.X500Name
+com.android.org.bouncycastle.asn1.x500.X500NameStyle
+com.android.org.bouncycastle.asn1.x500.style.AbstractX500NameStyle
+com.android.org.bouncycastle.asn1.x500.style.BCStyle
 com.android.org.bouncycastle.asn1.x509.AlgorithmIdentifier
 com.android.org.bouncycastle.asn1.x509.BasicConstraints
 com.android.org.bouncycastle.asn1.x509.Extension
@@ -1988,8 +2508,6 @@
 com.android.org.bouncycastle.asn1.x509.PolicyInformation
 com.android.org.bouncycastle.asn1.x509.SubjectPublicKeyInfo
 com.android.org.bouncycastle.asn1.x509.X509Extension
-com.android.org.bouncycastle.asn1.x509.X509Extensions
-com.android.org.bouncycastle.asn1.x509.X509Name
 com.android.org.bouncycastle.asn1.x509.X509ObjectIdentifiers
 com.android.org.bouncycastle.asn1.x9.X9ObjectIdentifiers
 com.android.org.bouncycastle.crypto.Digest
@@ -1999,6 +2517,8 @@
 com.android.org.bouncycastle.crypto.digests.AndroidDigestFactoryOpenSSL
 com.android.org.bouncycastle.crypto.digests.OpenSSLDigest
 com.android.org.bouncycastle.crypto.digests.OpenSSLDigest$SHA1
+com.android.org.bouncycastle.jcajce.PKIXExtendedParameters
+com.android.org.bouncycastle.jcajce.PKIXExtendedParameters$Builder
 com.android.org.bouncycastle.jcajce.provider.asymmetric.DH$Mappings
 com.android.org.bouncycastle.jcajce.provider.asymmetric.DSA$Mappings
 com.android.org.bouncycastle.jcajce.provider.asymmetric.EC$Mappings
@@ -2032,7 +2552,6 @@
 com.android.org.bouncycastle.jcajce.provider.keystore.bc.BcKeyStoreSpi
 com.android.org.bouncycastle.jcajce.provider.keystore.bc.BcKeyStoreSpi$Std
 com.android.org.bouncycastle.jcajce.provider.symmetric.AES
-com.android.org.bouncycastle.jcajce.provider.symmetric.AES$ECB
 com.android.org.bouncycastle.jcajce.provider.symmetric.AES$Mappings
 com.android.org.bouncycastle.jcajce.provider.symmetric.ARC4
 com.android.org.bouncycastle.jcajce.provider.symmetric.ARC4$Mappings
@@ -2052,6 +2571,9 @@
 com.android.org.bouncycastle.jcajce.provider.util.AlgorithmProvider
 com.android.org.bouncycastle.jcajce.provider.util.AsymmetricAlgorithmProvider
 com.android.org.bouncycastle.jcajce.provider.util.AsymmetricKeyInfoConverter
+com.android.org.bouncycastle.jcajce.util.BCJcaJceHelper
+com.android.org.bouncycastle.jcajce.util.JcaJceHelper
+com.android.org.bouncycastle.jcajce.util.ProviderJcaJceHelper
 com.android.org.bouncycastle.jce.exception.ExtException
 com.android.org.bouncycastle.jce.interfaces.BCKeyStore
 com.android.org.bouncycastle.jce.provider.AnnotatedException
@@ -2065,8 +2587,10 @@
 com.android.org.bouncycastle.jce.provider.PKIXNameConstraintValidator
 com.android.org.bouncycastle.jce.provider.PKIXNameConstraintValidatorException
 com.android.org.bouncycastle.jce.provider.PKIXPolicyNode
+com.android.org.bouncycastle.jce.provider.PrincipalUtils
 com.android.org.bouncycastle.jce.provider.RFC3280CertPathUtilities
 com.android.org.bouncycastle.util.Arrays
+com.android.org.bouncycastle.util.Encodable
 com.android.org.bouncycastle.util.Strings
 com.android.org.bouncycastle.util.encoders.Encoder
 com.android.org.bouncycastle.util.encoders.Hex
@@ -2075,6 +2599,7 @@
 com.android.org.bouncycastle.x509.ExtendedPKIXParameters
 com.android.org.conscrypt.AbstractSessionContext
 com.android.org.conscrypt.AbstractSessionContext$1
+com.android.org.conscrypt.AddressUtils
 com.android.org.conscrypt.ByteArray
 com.android.org.conscrypt.CertPinManager
 com.android.org.conscrypt.ChainStrengthAnalyzer
@@ -2088,17 +2613,23 @@
 com.android.org.conscrypt.KeyManagerImpl
 com.android.org.conscrypt.NativeCrypto
 com.android.org.conscrypt.NativeCrypto$SSLHandshakeCallbacks
+com.android.org.conscrypt.NativeCryptoJni
+com.android.org.conscrypt.NativeRef
+com.android.org.conscrypt.NativeRef$EC_GROUP
+com.android.org.conscrypt.NativeRef$EC_POINT
+com.android.org.conscrypt.NativeRef$EVP_MD_CTX
+com.android.org.conscrypt.NativeRef$EVP_PKEY
 com.android.org.conscrypt.OpenSSLBIOInputStream
-com.android.org.conscrypt.OpenSSLCipher$AES$CBC$PKCS5Padding
 com.android.org.conscrypt.OpenSSLContextImpl
-com.android.org.conscrypt.OpenSSLDigestContext
+com.android.org.conscrypt.OpenSSLContextImpl$TLSv12
+com.android.org.conscrypt.OpenSSLECGroupContext
+com.android.org.conscrypt.OpenSSLECPointContext
+com.android.org.conscrypt.OpenSSLECPublicKey
 com.android.org.conscrypt.OpenSSLKey
 com.android.org.conscrypt.OpenSSLKeyHolder
 com.android.org.conscrypt.OpenSSLMessageDigestJDK
 com.android.org.conscrypt.OpenSSLMessageDigestJDK$MD5
 com.android.org.conscrypt.OpenSSLMessageDigestJDK$SHA1
-com.android.org.conscrypt.OpenSSLMessageDigestJDK$SHA512
-com.android.org.conscrypt.OpenSSLNativeReference
 com.android.org.conscrypt.OpenSSLProvider
 com.android.org.conscrypt.OpenSSLRSAPublicKey
 com.android.org.conscrypt.OpenSSLRandom
@@ -2117,7 +2648,6 @@
 com.android.org.conscrypt.OpenSSLX509CertificateFactory$Parser
 com.android.org.conscrypt.OpenSSLX509CertificateFactory$ParsingException
 com.android.org.conscrypt.PinEntryException
-com.android.org.conscrypt.PinListEntry
 com.android.org.conscrypt.PinManagerException
 com.android.org.conscrypt.Platform
 com.android.org.conscrypt.Platform$OpenSSLMapper
@@ -2135,7 +2665,7 @@
 com.android.org.conscrypt.TrustedCertificateStore$1
 com.android.org.conscrypt.TrustedCertificateStore$2
 com.android.org.conscrypt.TrustedCertificateStore$CertSelector
-com.android.org.conscrypt.util.Arrays
+com.android.org.conscrypt.util.ArrayUtils
 com.android.server.NetworkManagementSocketTagger
 com.android.server.NetworkManagementSocketTagger$1
 com.android.server.NetworkManagementSocketTagger$SocketTags
@@ -2143,17 +2673,27 @@
 com.google.android.collect.Maps
 com.google.android.gles_jni.EGLImpl
 com.google.android.gles_jni.GLImpl
+dalvik.system.BaseDexClassLoader
 dalvik.system.BlockGuard
 dalvik.system.BlockGuard$1
 dalvik.system.BlockGuard$2
 dalvik.system.BlockGuard$BlockGuardPolicyException
 dalvik.system.BlockGuard$Policy
+dalvik.system.CloseGuard
+dalvik.system.CloseGuard$DefaultReporter
+dalvik.system.CloseGuard$Reporter
 dalvik.system.DalvikLogHandler
 dalvik.system.DalvikLogging
+dalvik.system.DexFile
+dalvik.system.DexFile$DFEnum
+dalvik.system.DexPathList
+dalvik.system.DexPathList$Element
+dalvik.system.PathClassLoader
 dalvik.system.SocketTagger
 dalvik.system.SocketTagger$1
 dalvik.system.VMDebug
 dalvik.system.VMRuntime
+dalvik.system.VMStack
 dalvik.system.ZygoteHooks
 java.beans.PropertyChangeEvent
 java.beans.PropertyChangeSupport
@@ -2162,40 +2702,73 @@
 java.io.BufferedReader
 java.io.BufferedWriter
 java.io.ByteArrayInputStream
+java.io.ByteArrayOutputStream
 java.io.Closeable
+java.io.DataInput
 java.io.DataInputStream
+java.io.DataOutput
+java.io.DataOutputStream
 java.io.EOFException
 java.io.Externalizable
 java.io.File
 java.io.FileDescriptor
+java.io.FileFilter
 java.io.FileInputStream
 java.io.FileNotFoundException
 java.io.FileOutputStream
 java.io.FileReader
 java.io.FilterInputStream
+java.io.FilterOutputStream
+java.io.FilterReader
+java.io.Flushable
 java.io.IOException
 java.io.InputStream
 java.io.InputStreamReader
 java.io.InterruptedIOException
+java.io.InvalidObjectException
+java.io.ObjectInput
 java.io.ObjectInputStream
+java.io.ObjectOutput
+java.io.ObjectOutputStream
+java.io.ObjectOutputStream$PutField
 java.io.ObjectStreamClass
+java.io.ObjectStreamClass$5
+java.io.ObjectStreamConstants
+java.io.ObjectStreamException
+java.io.ObjectStreamField
 java.io.OutputStream
 java.io.OutputStreamWriter
+java.io.PrintStream
 java.io.PrintWriter
 java.io.PushbackInputStream
+java.io.PushbackReader
 java.io.RandomAccessFile
 java.io.Reader
 java.io.Serializable
+java.io.SerializablePermission
+java.io.SerializationHandleMap
 java.io.StringReader
 java.io.StringWriter
+java.io.UTFDataFormatException
 java.io.UnsupportedEncodingException
+java.io.Writer
 java.lang.AbstractMethodError
+java.lang.AbstractStringBuilder
+java.lang.Appendable
 java.lang.ArrayIndexOutOfBoundsException
+java.lang.AssertionError
+java.lang.AutoCloseable
 java.lang.Boolean
+java.lang.BootClassLoader
 java.lang.Byte
+java.lang.CaseMapper
+java.lang.CaseMapper$1
 java.lang.CharSequence
 java.lang.Character
+java.lang.Character$Subset
+java.lang.Character$UnicodeBlock
 java.lang.Class
+java.lang.Class$Caches
 java.lang.ClassCastException
 java.lang.ClassLoader
 java.lang.ClassLoader$SystemClassLoader
@@ -2207,23 +2780,32 @@
 java.lang.Daemons$Daemon
 java.lang.Daemons$FinalizerDaemon
 java.lang.Daemons$FinalizerWatchdogDaemon
-java.lang.Daemons$GCDaemon
-java.lang.Daemons$HeapTrimmerDaemon
+java.lang.Daemons$HeapTaskDaemon
 java.lang.Daemons$ReferenceQueueDaemon
+java.lang.DexCache
 java.lang.Double
 java.lang.Enum
+java.lang.Enum$1
 java.lang.Error
 java.lang.Exception
 java.lang.Float
 java.lang.IllegalAccessException
 java.lang.IllegalArgumentException
 java.lang.IllegalStateException
+java.lang.IllegalThreadStateException
+java.lang.IncompatibleClassChangeError
+java.lang.IndexOutOfBoundsException
 java.lang.InstantiationException
 java.lang.Integer
+java.lang.IntegralToString
+java.lang.IntegralToString$1
+java.lang.InternalError
 java.lang.InterruptedException
 java.lang.Iterable
+java.lang.LinkageError
 java.lang.Long
 java.lang.Math
+java.lang.Math$NoImagePreloadHolder
 java.lang.NoClassDefFoundError
 java.lang.NoSuchFieldError
 java.lang.NoSuchFieldException
@@ -2234,41 +2816,78 @@
 java.lang.NumberFormatException
 java.lang.Object
 java.lang.OutOfMemoryError
+java.lang.Package
+java.lang.Readable
+java.lang.RealToString
+java.lang.RealToString$1
+java.lang.ReflectiveOperationException
 java.lang.Runnable
 java.lang.Runtime
 java.lang.RuntimeException
 java.lang.RuntimePermission
 java.lang.SecurityException
 java.lang.Short
+java.lang.StackOverflowError
+java.lang.StackTraceElement
 java.lang.StrictMath
 java.lang.String
+java.lang.String$CaseInsensitiveComparator
+java.lang.StringBuffer
 java.lang.StringBuilder
+java.lang.StringFactory
+java.lang.StringIndexOutOfBoundsException
+java.lang.StringToReal
 java.lang.StringToReal$StringExponentPair
 java.lang.System
 java.lang.System$PropertiesWithNonOverrideableDefaults
 java.lang.Thread
+java.lang.Thread$State
 java.lang.Thread$UncaughtExceptionHandler
+java.lang.ThreadDeath
+java.lang.ThreadGroup
 java.lang.ThreadLocal
+java.lang.ThreadLocal$Values
 java.lang.Throwable
+java.lang.TwoEnumerationsInOne
 java.lang.UnsatisfiedLinkError
 java.lang.UnsupportedOperationException
+java.lang.VMClassLoader
+java.lang.VirtualMachineError
 java.lang.Void
 java.lang.annotation.Annotation
 java.lang.annotation.Inherited
+java.lang.ref.FinalizerReference
+java.lang.ref.FinalizerReference$Sentinel
+java.lang.ref.PhantomReference
+java.lang.ref.Reference
+java.lang.ref.ReferenceQueue
 java.lang.ref.SoftReference
 java.lang.ref.WeakReference
+java.lang.reflect.AbstractMethod
+java.lang.reflect.AbstractMethod$GenericInfo
+java.lang.reflect.AccessibleObject
+java.lang.reflect.AnnotatedElement
+java.lang.reflect.Array
+java.lang.reflect.Constructor
 java.lang.reflect.Field
+java.lang.reflect.Field$1
 java.lang.reflect.GenericArrayType
+java.lang.reflect.GenericDeclaration
+java.lang.reflect.InvocationHandler
 java.lang.reflect.InvocationTargetException
+java.lang.reflect.Member
 java.lang.reflect.Method
+java.lang.reflect.Method$1
+java.lang.reflect.Modifier
 java.lang.reflect.ParameterizedType
+java.lang.reflect.Proxy
+java.lang.reflect.Proxy$1
 java.lang.reflect.Type
+java.lang.reflect.TypeVariable
 java.lang.reflect.WildcardType
 java.math.BigDecimal
 java.math.BigInt
 java.math.BigInteger
-java.math.Conversion
-java.math.Multiplication
 java.math.NativeBN
 java.math.RoundingMode
 java.net.AddressCache
@@ -2286,18 +2905,24 @@
 java.net.JarURLConnection
 java.net.MalformedURLException
 java.net.PlainSocketImpl
+java.net.ProtocolException
 java.net.Proxy
 java.net.Proxy$Type
 java.net.ProxySelector
 java.net.ProxySelectorImpl
 java.net.ResponseCache
+java.net.ServerSocket
 java.net.Socket
 java.net.SocketAddress
 java.net.SocketException
 java.net.SocketImpl
 java.net.SocketOptions
 java.net.SocketTimeoutException
+java.net.URI
+java.net.URI$1
+java.net.URI$PartEncoder
 java.net.URISyntaxException
+java.net.URL
 java.net.URLConnection
 java.net.URLConnection$DefaultContentHandler
 java.net.URLEncoder
@@ -2305,19 +2930,47 @@
 java.net.URLStreamHandler
 java.net.URLStreamHandlerFactory
 java.net.UnknownHostException
+java.nio.Buffer
+java.nio.BufferOverflowException
+java.nio.BufferUnderflowException
+java.nio.ByteArrayBuffer
+java.nio.ByteBuffer
+java.nio.ByteBufferAsCharBuffer
+java.nio.ByteBufferAsDoubleBuffer
+java.nio.ByteBufferAsFloatBuffer
+java.nio.ByteBufferAsIntBuffer
+java.nio.ByteBufferAsLongBuffer
+java.nio.ByteBufferAsShortBuffer
 java.nio.ByteOrder
 java.nio.CharArrayBuffer
+java.nio.CharBuffer
 java.nio.CharSequenceAdapter
+java.nio.DirectByteBuffer
+java.nio.DoubleBuffer
 java.nio.FileChannelImpl
 java.nio.FileChannelImpl$1
+java.nio.FileChannelImpl$FileLockImpl
+java.nio.FloatBuffer
+java.nio.IntBuffer
+java.nio.InvalidMarkException
+java.nio.LongBuffer
+java.nio.MappedByteBuffer
+java.nio.MemoryBlock
+java.nio.MemoryBlock$MemoryMappedBlock
+java.nio.MemoryBlock$NonMovableHeapBlock
 java.nio.MemoryBlock$UnmanagedBlock
 java.nio.NIOAccess
+java.nio.NioUtils
+java.nio.ReadOnlyBufferException
+java.nio.ShortBuffer
 java.nio.channels.AsynchronousCloseException
 java.nio.channels.ByteChannel
 java.nio.channels.Channel
 java.nio.channels.ClosedByInterruptException
 java.nio.channels.ClosedChannelException
 java.nio.channels.FileChannel
+java.nio.channels.FileChannel$MapMode
+java.nio.channels.FileLock
 java.nio.channels.GatheringByteChannel
 java.nio.channels.InterruptibleChannel
 java.nio.channels.ReadableByteChannel
@@ -2325,33 +2978,44 @@
 java.nio.channels.WritableByteChannel
 java.nio.channels.spi.AbstractInterruptibleChannel
 java.nio.channels.spi.AbstractInterruptibleChannel$1
+java.nio.charset.CharacterCodingException
 java.nio.charset.Charset
 java.nio.charset.CharsetDecoder
+java.nio.charset.CharsetDecoderICU
 java.nio.charset.CharsetEncoder
 java.nio.charset.CharsetEncoderICU
 java.nio.charset.CharsetICU
 java.nio.charset.CoderResult
+java.nio.charset.CodingErrorAction
+java.nio.charset.IllegalCharsetNameException
 java.nio.charset.ModifiedUtf8
 java.nio.charset.StandardCharsets
+java.nio.charset.UnsupportedCharsetException
+java.security.AccessControlException
 java.security.AccessController
+java.security.BasicPermission
 java.security.DigestException
 java.security.GeneralSecurityException
+java.security.Guard
 java.security.InvalidAlgorithmParameterException
 java.security.InvalidKeyException
 java.security.Key
 java.security.KeyException
 java.security.KeyFactorySpi
 java.security.KeyManagementException
-java.security.KeyPairGeneratorSpi
 java.security.KeyStore
 java.security.KeyStoreException
 java.security.KeyStoreSpi
 java.security.MessageDigest
 java.security.MessageDigest$MessageDigestImpl
+java.security.MessageDigestSpi
 java.security.NoSuchAlgorithmException
 java.security.NoSuchProviderException
+java.security.Permission
 java.security.Principal
+java.security.PrivateKey
 java.security.PrivilegedAction
+java.security.ProtectionDomain
 java.security.Provider
 java.security.Provider$Service
 java.security.PublicKey
@@ -2359,8 +3023,13 @@
 java.security.SecureRandomSpi
 java.security.Security
 java.security.Security$SecurityDoor
+java.security.Signature
+java.security.Signature$SignatureImpl
+java.security.SignatureException
+java.security.SignatureSpi
 java.security.UnrecoverableEntryException
 java.security.UnrecoverableKeyException
+java.security.cert.CRL
 java.security.cert.CRLException
 java.security.cert.CertPath
 java.security.cert.CertPathBuilderException
@@ -2390,13 +3059,25 @@
 java.security.cert.X509Extension
 java.security.interfaces.DSAKey
 java.security.interfaces.DSAPublicKey
+java.security.interfaces.ECKey
+java.security.interfaces.ECPrivateKey
+java.security.interfaces.ECPublicKey
 java.security.interfaces.RSAKey
+java.security.interfaces.RSAPrivateKey
 java.security.interfaces.RSAPublicKey
 java.security.spec.AlgorithmParameterSpec
+java.security.spec.ECField
+java.security.spec.ECFieldFp
+java.security.spec.ECParameterSpec
+java.security.spec.ECPoint
+java.security.spec.EllipticCurve
 java.security.spec.InvalidKeySpecException
+java.security.spec.InvalidParameterSpecException
+java.security.spec.KeySpec
 java.text.AttributedCharacterIterator$Attribute
 java.text.Bidi
 java.text.Bidi$Run
+java.text.Collator
 java.text.DateFormat
 java.text.DateFormat$Field
 java.text.DateFormatSymbols
@@ -2409,47 +3090,115 @@
 java.text.NumberFormat$Field
 java.text.ParseException
 java.text.ParsePosition
+java.text.RuleBasedCollator
 java.text.SimpleDateFormat
 java.util.AbstractCollection
+java.util.AbstractList
+java.util.AbstractList$FullListIterator
+java.util.AbstractList$SimpleListIterator
+java.util.AbstractList$SubAbstractList
+java.util.AbstractList$SubAbstractListRandomAccess
 java.util.AbstractMap
+java.util.AbstractMap$1
+java.util.AbstractMap$2
+java.util.AbstractMap$2$1
+java.util.AbstractQueue
 java.util.AbstractSequentialList
 java.util.AbstractSet
 java.util.ArrayDeque
 java.util.ArrayList
+java.util.ArrayList$ArrayListIterator
 java.util.Arrays
 java.util.Arrays$ArrayList
 java.util.BitSet
 java.util.Calendar
 java.util.Collection
 java.util.Collections
+java.util.Collections$1
+java.util.Collections$2
+java.util.Collections$3
+java.util.Collections$AsLIFOQueue
+java.util.Collections$CheckedCollection
+java.util.Collections$CheckedList
+java.util.Collections$CheckedMap
+java.util.Collections$CheckedRandomAccessList
+java.util.Collections$CheckedSet
+java.util.Collections$CheckedSortedMap
+java.util.Collections$CheckedSortedSet
+java.util.Collections$CopiesList
+java.util.Collections$EmptyList
+java.util.Collections$EmptyMap
+java.util.Collections$EmptySet
+java.util.Collections$ReverseComparator
+java.util.Collections$ReverseComparator2
+java.util.Collections$SetFromMap
+java.util.Collections$SingletonList
+java.util.Collections$SingletonMap
+java.util.Collections$SingletonSet
 java.util.Collections$SingletonSet$1
+java.util.Collections$SynchronizedCollection
+java.util.Collections$SynchronizedList
+java.util.Collections$SynchronizedMap
+java.util.Collections$SynchronizedRandomAccessList
+java.util.Collections$SynchronizedSet
+java.util.Collections$SynchronizedSortedMap
+java.util.Collections$SynchronizedSortedSet
+java.util.Collections$UnmodifiableCollection
 java.util.Collections$UnmodifiableCollection$1
+java.util.Collections$UnmodifiableList
+java.util.Collections$UnmodifiableMap
 java.util.Collections$UnmodifiableMap$UnmodifiableEntrySet
 java.util.Collections$UnmodifiableMap$UnmodifiableEntrySet$1
 java.util.Collections$UnmodifiableMap$UnmodifiableEntrySet$UnmodifiableMapEntry
+java.util.Collections$UnmodifiableRandomAccessList
+java.util.Collections$UnmodifiableSet
+java.util.Collections$UnmodifiableSortedMap
+java.util.Collections$UnmodifiableSortedSet
 java.util.ComparableTimSort
 java.util.Comparator
+java.util.ConcurrentModificationException
 java.util.Currency
 java.util.Date
+java.util.Deque
+java.util.Dictionary
 java.util.DualPivotQuicksort
 java.util.EnumMap
 java.util.EnumSet
+java.util.Enumeration
+java.util.EventListener
 java.util.EventObject
 java.util.Formattable
+java.util.Formatter
+java.util.Formatter$1
+java.util.Formatter$CachedDecimalFormat
 java.util.Formatter$FormatSpecifierParser
 java.util.Formatter$FormatToken
 java.util.GregorianCalendar
 java.util.HashMap
+java.util.HashMap$EntryIterator
+java.util.HashMap$EntrySet
+java.util.HashMap$HashIterator
+java.util.HashMap$HashMapEntry
+java.util.HashMap$KeyIterator
+java.util.HashMap$KeySet
+java.util.HashMap$ValueIterator
+java.util.HashMap$Values
 java.util.HashSet
+java.util.Hashtable
 java.util.Hashtable$HashIterator
+java.util.Hashtable$HashtableEntry
 java.util.Hashtable$KeyEnumeration
 java.util.Hashtable$ValueIterator
 java.util.Hashtable$Values
 java.util.IdentityHashMap
+java.util.IdentityHashMap$IdentityHashMapIterator
+java.util.IllegalFormatException
+java.util.IllformedLocaleException
 java.util.Iterator
 java.util.LinkedHashMap
 java.util.LinkedHashMap$EntryIterator
 java.util.LinkedHashMap$KeyIterator
+java.util.LinkedHashMap$LinkedEntry
 java.util.LinkedHashMap$LinkedHashIterator
 java.util.LinkedHashMap$ValueIterator
 java.util.LinkedHashSet
@@ -2460,6 +3209,7 @@
 java.util.ListIterator
 java.util.Locale
 java.util.Locale$Builder
+java.util.Locale$NoImagePreloadHolder
 java.util.Map
 java.util.Map$Entry
 java.util.MapEntry
@@ -2476,7 +3226,8 @@
 java.util.Queue
 java.util.Random
 java.util.RandomAccess
-java.util.Scanner
+java.util.ResourceBundle
+java.util.ResourceBundle$MissingBundle
 java.util.Set
 java.util.SimpleTimeZone
 java.util.SortedMap
@@ -2492,11 +3243,12 @@
 java.util.TimerTask
 java.util.TreeMap
 java.util.TreeMap$1
-java.util.TreeMap$2
 java.util.TreeMap$Bound
 java.util.TreeMap$Bound$1
 java.util.TreeMap$Bound$2
 java.util.TreeMap$Bound$3
+java.util.TreeMap$BoundedMap
+java.util.TreeMap$BoundedMap$BoundedIterator
 java.util.TreeMap$EntrySet
 java.util.TreeMap$EntrySet$1
 java.util.TreeMap$KeySet
@@ -2528,31 +3280,41 @@
 java.util.concurrent.ConcurrentHashMap$Node
 java.util.concurrent.ConcurrentHashMap$Segment
 java.util.concurrent.ConcurrentHashMap$Traverser
+java.util.concurrent.ConcurrentHashMap$TreeBin
+java.util.concurrent.ConcurrentHashMap$TreeNode
 java.util.concurrent.ConcurrentLinkedQueue
 java.util.concurrent.ConcurrentLinkedQueue$Node
 java.util.concurrent.ConcurrentMap
-java.util.concurrent.ConcurrentSkipListMap
 java.util.concurrent.CopyOnWriteArrayList
 java.util.concurrent.CopyOnWriteArrayList$CowIterator
+java.util.concurrent.CopyOnWriteArraySet
 java.util.concurrent.CountDownLatch
 java.util.concurrent.CountDownLatch$Sync
+java.util.concurrent.Delayed
 java.util.concurrent.ExecutionException
 java.util.concurrent.Executor
 java.util.concurrent.ExecutorService
 java.util.concurrent.Executors
 java.util.concurrent.Executors$DefaultThreadFactory
 java.util.concurrent.Executors$DelegatedExecutorService
+java.util.concurrent.Executors$DelegatedScheduledExecutorService
 java.util.concurrent.Executors$FinalizableDelegatedExecutorService
 java.util.concurrent.Executors$RunnableAdapter
 java.util.concurrent.Future
 java.util.concurrent.FutureTask
 java.util.concurrent.FutureTask$WaitNode
-java.util.concurrent.LinkedBlockingDeque
 java.util.concurrent.LinkedBlockingQueue
 java.util.concurrent.LinkedBlockingQueue$Node
+java.util.concurrent.PriorityBlockingQueue
+java.util.concurrent.RejectedExecutionException
 java.util.concurrent.RejectedExecutionHandler
 java.util.concurrent.RunnableFuture
+java.util.concurrent.RunnableScheduledFuture
 java.util.concurrent.ScheduledExecutorService
+java.util.concurrent.ScheduledFuture
+java.util.concurrent.ScheduledThreadPoolExecutor
+java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue
+java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask
 java.util.concurrent.Semaphore
 java.util.concurrent.Semaphore$NonfairSync
 java.util.concurrent.Semaphore$Sync
@@ -2594,9 +3356,13 @@
 java.util.concurrent.locks.ReentrantReadWriteLock$Sync
 java.util.concurrent.locks.ReentrantReadWriteLock$Sync$ThreadLocalHoldCounter
 java.util.concurrent.locks.ReentrantReadWriteLock$WriteLock
+java.util.jar.Attributes
+java.util.jar.Attributes$Name
 java.util.jar.JarEntry
 java.util.jar.JarFile
 java.util.jar.JarFile$JarFileEnumerator
+java.util.jar.Manifest
+java.util.jar.ManifestReader
 java.util.jar.StrictJarFile
 java.util.logging.ConsoleHandler
 java.util.logging.ErrorManager
@@ -2611,21 +3377,39 @@
 java.util.logging.LoggingPermission
 java.util.logging.SimpleFormatter
 java.util.logging.StreamHandler
+java.util.regex.MatchResult
+java.util.regex.Matcher
 java.util.regex.Pattern
 java.util.regex.PatternSyntaxException
+java.util.regex.Splitter
+java.util.zip.Adler32
 java.util.zip.CRC32
+java.util.zip.Checksum
+java.util.zip.DataFormatException
 java.util.zip.Deflater
 java.util.zip.DeflaterOutputStream
 java.util.zip.GZIPInputStream
 java.util.zip.GZIPOutputStream
 java.util.zip.Inflater
 java.util.zip.InflaterInputStream
+java.util.zip.Zip64
+java.util.zip.ZipConstants
+java.util.zip.ZipEntry
+java.util.zip.ZipFile
 java.util.zip.ZipFile$1
+java.util.zip.ZipFile$EocdRecord
 java.util.zip.ZipFile$RAFStream
+java.util.zip.ZipFile$ZipInflaterInputStream
 javax.crypto.BadPaddingException
+javax.crypto.Cipher
+javax.crypto.Cipher$NeedToSet
+javax.crypto.CipherSpi
 javax.crypto.IllegalBlockSizeException
 javax.crypto.NoSuchPaddingException
-javax.crypto.spec.GCMParameterSpec
+javax.crypto.SecretKey
+javax.crypto.ShortBufferException
+javax.crypto.spec.IvParameterSpec
+javax.crypto.spec.SecretKeySpec
 javax.microedition.khronos.egl.EGL
 javax.microedition.khronos.egl.EGL10
 javax.microedition.khronos.opengles.GL
@@ -2635,17 +3419,22 @@
 javax.microedition.khronos.opengles.GL11Ext
 javax.microedition.khronos.opengles.GL11ExtensionPack
 javax.net.DefaultSocketFactory
+javax.net.ServerSocketFactory
 javax.net.SocketFactory
 javax.net.ssl.DistinguishedNameParser
+javax.net.ssl.HandshakeCompletedListener
 javax.net.ssl.HostnameVerifier
 javax.net.ssl.HttpsURLConnection
 javax.net.ssl.KeyManager
 javax.net.ssl.KeyManagerFactory
 javax.net.ssl.KeyManagerFactorySpi
+javax.net.ssl.SSLContext
 javax.net.ssl.SSLContextSpi
+javax.net.ssl.SSLEngine
 javax.net.ssl.SSLException
 javax.net.ssl.SSLPeerUnverifiedException
 javax.net.ssl.SSLProtocolException
+javax.net.ssl.SSLServerSocketFactory
 javax.net.ssl.SSLSession
 javax.net.ssl.SSLSessionContext
 javax.net.ssl.SSLSocket
@@ -2657,14 +3446,17 @@
 javax.net.ssl.X509KeyManager
 javax.net.ssl.X509TrustManager
 javax.security.auth.x500.X500Principal
+javax.security.cert.Certificate
 javax.security.cert.CertificateException
+javax.security.cert.X509Certificate
 javax.xml.parsers.ParserConfigurationException
 libcore.icu.AlphabeticIndex
 libcore.icu.AlphabeticIndex$ImmutableIndex
 libcore.icu.DateIntervalFormat
+libcore.icu.DateIntervalFormat$FormatterCache
+libcore.icu.DateUtilsBridge
 libcore.icu.ICU
 libcore.icu.LocaleData
-libcore.icu.NativeBreakIterator
 libcore.icu.NativeCollation
 libcore.icu.NativeConverter
 libcore.icu.NativeDecimalFormat
@@ -2672,10 +3464,12 @@
 libcore.icu.NativeIDN
 libcore.icu.NativeNormalizer
 libcore.icu.NativePluralRules
+libcore.icu.RuleBasedCollatorICU
 libcore.icu.TimeZoneNames
 libcore.icu.Transliterator
 libcore.internal.StringPool
 libcore.io.AsynchronousCloseMonitor
+libcore.io.BlockGuardOs
 libcore.io.BufferIterator
 libcore.io.DropBox
 libcore.io.DropBox$DefaultReporter
@@ -2683,14 +3477,21 @@
 libcore.io.EventLogger
 libcore.io.EventLogger$DefaultReporter
 libcore.io.EventLogger$Reporter
+libcore.io.ForwardingOs
 libcore.io.HeapBufferIterator
 libcore.io.IoBridge
+libcore.io.IoUtils
 libcore.io.IoUtils$FileReader
+libcore.io.Libcore
+libcore.io.Memory
 libcore.io.MemoryMappedFile
 libcore.io.NioBufferIterator
+libcore.io.Os
+libcore.io.Posix
 libcore.io.Streams
 libcore.math.MathUtils
-libcore.net.MimeUtils
+libcore.net.NetworkSecurityPolicy
+libcore.net.UriCodec
 libcore.net.event.NetworkEventDispatcher
 libcore.net.event.NetworkEventListener
 libcore.net.url.FileHandler
@@ -2700,11 +3501,23 @@
 libcore.net.url.JarURLConnectionImpl
 libcore.net.url.JarURLConnectionImpl$JarURLConnectionInputStream
 libcore.net.url.UrlUtils
+libcore.reflect.AnnotationAccess
 libcore.reflect.AnnotationFactory
 libcore.reflect.AnnotationMember
 libcore.reflect.AnnotationMember$DefaultValues
+libcore.reflect.GenericSignatureParser
+libcore.reflect.InternalNames
+libcore.reflect.ListOfTypes
 libcore.reflect.ListOfVariables
 libcore.reflect.ParameterizedTypeImpl
+libcore.reflect.Types
+libcore.util.BasicLruCache
+libcore.util.CharsetUtils
+libcore.util.CollectionUtils
+libcore.util.CollectionUtils$1
+libcore.util.CollectionUtils$1$1
+libcore.util.EmptyArray
+libcore.util.Objects
 libcore.util.ZoneInfo
 libcore.util.ZoneInfo$CheckedArithmeticException
 libcore.util.ZoneInfo$WallTime
@@ -2716,6 +3529,9 @@
 org.apache.commons.logging.impl.Jdk14Logger
 org.apache.commons.logging.impl.WeakHashtable
 org.apache.harmony.dalvik.NativeTestTarget
+org.apache.harmony.dalvik.ddmc.Chunk
+org.apache.harmony.dalvik.ddmc.ChunkHandler
+org.apache.harmony.dalvik.ddmc.DdmServer
 org.apache.harmony.dalvik.ddmc.DdmVmInternal
 org.apache.harmony.luni.internal.util.TimezoneGetter
 org.apache.harmony.security.asn1.ASN1Any
@@ -2744,12 +3560,11 @@
 org.apache.harmony.security.asn1.BerOutputStream
 org.apache.harmony.security.asn1.DerInputStream
 org.apache.harmony.security.asn1.DerOutputStream
+org.apache.harmony.security.fortress.Engine
 org.apache.harmony.security.fortress.Engine$ServiceCacheEntry
 org.apache.harmony.security.fortress.Engine$SpiAndProvider
 org.apache.harmony.security.fortress.SecurityAccess
 org.apache.harmony.security.fortress.Services
-org.apache.harmony.security.pkcs7.ContentInfo$1
-org.apache.harmony.security.pkcs7.SignedData
 org.apache.harmony.security.provider.crypto.CryptoProvider
 org.apache.harmony.security.utils.AlgNameMapper
 org.apache.harmony.security.utils.AlgNameMapperSource
@@ -2763,11 +3578,8 @@
 org.apache.harmony.security.x501.DirectoryString$1
 org.apache.harmony.security.x501.Name
 org.apache.harmony.security.x501.Name$1
-org.apache.harmony.security.x509.TBSCertificate
 org.apache.harmony.xml.ExpatAttributes
 org.apache.harmony.xml.ExpatParser
-org.apache.harmony.xml.dom.DocumentImpl
-org.apache.harmony.xml.dom.InnerNodeImpl
 org.apache.http.ConnectionReuseStrategy
 org.apache.http.FormattedHeader
 org.apache.http.Header
@@ -2859,7 +3671,6 @@
 org.apache.http.conn.ssl.SSLSocketFactory
 org.apache.http.conn.ssl.StrictHostnameVerifier
 org.apache.http.conn.ssl.X509HostnameVerifier
-org.apache.http.conn.util.InetAddressUtils
 org.apache.http.cookie.CookieSpecFactory
 org.apache.http.cookie.CookieSpecRegistry
 org.apache.http.cookie.MalformedCookieException
@@ -2870,9 +3681,7 @@
 org.apache.http.entity.HttpEntityWrapper
 org.apache.http.impl.AbstractHttpClientConnection
 org.apache.http.impl.DefaultConnectionReuseStrategy
-org.apache.http.impl.DefaultHttpClientConnection
 org.apache.http.impl.DefaultHttpResponseFactory
-org.apache.http.impl.DefaultHttpServerConnection
 org.apache.http.impl.EnglishReasonPhraseCatalog
 org.apache.http.impl.HttpConnectionMetricsImpl
 org.apache.http.impl.SocketHttpClientConnection
@@ -2903,7 +3712,6 @@
 org.apache.http.impl.conn.IdleConnectionHandler
 org.apache.http.impl.conn.IdleConnectionHandler$TimeValues
 org.apache.http.impl.conn.ProxySelectorRoutePlanner
-org.apache.http.impl.conn.ProxySelectorRoutePlanner$1
 org.apache.http.impl.conn.tsccm.AbstractConnPool
 org.apache.http.impl.conn.tsccm.BasicPoolEntry
 org.apache.http.impl.conn.tsccm.BasicPoolEntryRef
@@ -2932,7 +3740,6 @@
 org.apache.http.impl.io.AbstractSessionInputBuffer
 org.apache.http.impl.io.AbstractSessionOutputBuffer
 org.apache.http.impl.io.ChunkedInputStream
-org.apache.http.impl.io.ContentLengthInputStream
 org.apache.http.impl.io.ContentLengthOutputStream
 org.apache.http.impl.io.HttpRequestWriter
 org.apache.http.impl.io.HttpTransportMetricsImpl
@@ -2984,8 +3791,18 @@
 org.apache.http.util.ByteArrayBuffer
 org.apache.http.util.CharArrayBuffer
 org.apache.http.util.LangUtils
+org.ccil.cowan.tagsoup.AttributesImpl
+org.ccil.cowan.tagsoup.AutoDetector
+org.ccil.cowan.tagsoup.Element
+org.ccil.cowan.tagsoup.ElementType
+org.ccil.cowan.tagsoup.HTMLModels
 org.ccil.cowan.tagsoup.HTMLScanner
+org.ccil.cowan.tagsoup.HTMLSchema
 org.ccil.cowan.tagsoup.Parser
+org.ccil.cowan.tagsoup.Parser$1
+org.ccil.cowan.tagsoup.ScanHandler
+org.ccil.cowan.tagsoup.Scanner
+org.ccil.cowan.tagsoup.Schema
 org.json.JSON
 org.json.JSONArray
 org.json.JSONException
@@ -3007,7 +3824,9 @@
 org.xml.sax.SAXNotRecognizedException
 org.xml.sax.SAXNotSupportedException
 org.xml.sax.XMLReader
+org.xml.sax.ext.LexicalHandler
 org.xml.sax.helpers.DefaultHandler
 org.xmlpull.v1.XmlPullParser
 org.xmlpull.v1.XmlPullParserException
 org.xmlpull.v1.XmlSerializer
+sun.misc.Unsafe
diff --git a/rs/java/android/renderscript/ScriptIntrinsicBLAS.java b/rs/java/android/renderscript/ScriptIntrinsicBLAS.java
index f7e81b0..aa72fba 100644
--- a/rs/java/android/renderscript/ScriptIntrinsicBLAS.java
+++ b/rs/java/android/renderscript/ScriptIntrinsicBLAS.java
@@ -22,7 +22,12 @@
 
 /**
  *
- * BLAS
+ * ScriptIntrinsicBLAS class provides high performance RenderScript APIs to BLAS.
+ *
+ * The BLAS (Basic Linear Algebra Subprograms) are routines that provide standard
+ * building blocks for performing basic vector and matrix operations.
+ *
+ * For detailed description of BLAS, please refer to http://www.netlib.org/blas/
  *
  **/
 public final class ScriptIntrinsicBLAS extends ScriptIntrinsic {
@@ -179,24 +184,40 @@
     private static final int RsBlas_bnnm = 1000;
 
     /**
+     * Create an intrinsic to access BLAS subroutines.
+     *
+     * @param rs The RenderScript context
+     * @return ScriptIntrinsicBLAS
      */
     public static ScriptIntrinsicBLAS create(RenderScript rs) {
         long id = rs.nScriptIntrinsicCreate(13, Element.U32(rs).getID(rs));
         return new ScriptIntrinsicBLAS(id, rs);
     }
 
+    /**
+     * @hide
+     */
     @IntDef({NO_TRANSPOSE, TRANSPOSE, CONJ_TRANSPOSE})
     @Retention(RetentionPolicy.SOURCE)
     public @interface Transpose {}
 
+    /**
+     * @hide
+     */
     @IntDef({UPPER, LOWER})
     @Retention(RetentionPolicy.SOURCE)
     public @interface Uplo {}
 
+    /**
+     * @hide
+     */
     @IntDef({NON_UNIT, UNIT})
     @Retention(RetentionPolicy.SOURCE)
     public @interface Diag {}
 
+    /**
+     * @hide
+     */
     @IntDef({LEFT, RIGHT})
     @Retention(RetentionPolicy.SOURCE)
     public @interface Side {}
@@ -280,24 +301,88 @@
             throw new RSRuntimeException("Incorrect vector dimensions for GEMV");
         }
     }
+
+    /**
+     * SGEMV performs one of the matrix-vector operations
+     * y := alpha*A*x + beta*y   or   y := alpha*A**T*x + beta*y
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/db/d58/sgemv_8f.html
+     *
+     * @param TransA The type of transpose applied to matrix A.
+     * @param alpha The scalar alpha.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F32}.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F32}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     * @param beta The scalar beta.
+     * @param Y The input allocation contains vector y, supported elements type {@link Element#F32}.
+     * @param incY The increment for the elements of vector y, must be larger than zero.
+     */
     public void SGEMV(@Transpose int TransA, float alpha, Allocation A, Allocation X, int incX, float beta, Allocation Y, int incY) {
         validateGEMV(Element.F32(mRS), TransA, A, X, incX, Y, incY);
         int M = A.getType().getY();
         int N = A.getType().getX();
         mRS.nScriptIntrinsicBLAS_Single(getID(mRS), RsBlas_sgemv, TransA, 0, 0, 0, 0, M, N, 0, alpha, A.getID(mRS), X.getID(mRS), beta, Y.getID(mRS), incX, incY, 0, 0);
     }
+
+    /**
+     * DGEMV performs one of the matrix-vector operations
+     * y := alpha*A*x + beta*y   or   y := alpha*A**T*x + beta*y
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/dc/da8/dgemv_8f.html
+     *
+     * @param TransA The type of transpose applied to matrix A.
+     * @param alpha The scalar alpha.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F64}.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F64}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     * @param beta The scalar beta.
+     * @param Y The input allocation contains vector y, supported elements type {@link Element#F64}.
+     * @param incY The increment for the elements of vector y, must be larger than zero.
+     */
     public void DGEMV(@Transpose int TransA, double alpha, Allocation A, Allocation X, int incX, double beta, Allocation Y, int incY) {
         validateGEMV(Element.F64(mRS), TransA, A, X, incX, Y, incY);
         int M = A.getType().getY();
         int N = A.getType().getX();
         mRS.nScriptIntrinsicBLAS_Double(getID(mRS), RsBlas_dgemv, TransA, 0, 0, 0, 0, M, N, 0, alpha, A.getID(mRS), X.getID(mRS), beta, Y.getID(mRS), incX, incY, 0, 0);
     }
+
+    /**
+     * CGEMV performs one of the matrix-vector operations
+     * y := alpha*A*x + beta*y   or   y := alpha*A**T*x + beta*y   or   y := alpha*A**H*x + beta*y
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d4/d8a/cgemv_8f.html
+     *
+     * @param TransA The type of transpose applied to matrix A.
+     * @param alpha The scalar alpha.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F32_2}.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F32_2}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     * @param beta The scalar beta.
+     * @param Y The input allocation contains vector y, supported elements type {@link Element#F32_2}.
+     * @param incY The increment for the elements of vector y, must be larger than zero.
+     */
     public void CGEMV(@Transpose int TransA, Float2 alpha, Allocation A, Allocation X, int incX, Float2 beta, Allocation Y, int incY) {
         validateGEMV(Element.F32_2(mRS), TransA, A, X, incX, Y, incY);
         int M = A.getType().getY();
         int N = A.getType().getX();
         mRS.nScriptIntrinsicBLAS_Complex(getID(mRS), RsBlas_cgemv, TransA, 0, 0, 0, 0, M, N, 0, alpha.x, alpha.y, A.getID(mRS), X.getID(mRS), beta.x, beta.y, Y.getID(mRS), incX, incY, 0, 0);
     }
+
+    /**
+     * ZGEMV performs one of the matrix-vector operations
+     * y := alpha*A*x + beta*y   or   y := alpha*A**T*x + beta*y   or   y := alpha*A**H*x + beta*y
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/db/d40/zgemv_8f.html
+     *
+     * @param TransA The type of transpose applied to matrix A.
+     * @param alpha The scalar alpha.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F64_2}.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F64_2}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     * @param beta The scalar beta.
+     * @param Y The input allocation contains vector y, supported elements type {@link Element#F64_2}.
+     * @param incY The increment for the elements of vector y, must be larger than zero.
+     */
     public void ZGEMV(@Transpose int TransA, Double2 alpha, Allocation A, Allocation X, int incX, Double2 beta, Allocation Y, int incY) {
         validateGEMV(Element.F64_2(mRS), TransA, A, X, incX, Y, incY);
         int M = A.getType().getY();
@@ -305,6 +390,30 @@
         mRS.nScriptIntrinsicBLAS_Z(getID(mRS), RsBlas_zgemv, TransA, 0, 0, 0, 0, M, N, 0, alpha.x, alpha.y, A.getID(mRS), X.getID(mRS), beta.x, beta.y, Y.getID(mRS), incX, incY, 0, 0);
     }
 
+    /**
+     * SGBMV performs one of the matrix-vector operations
+     * y := alpha*A*x + beta*y   or   y := alpha*A**T*x + beta*y
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d6/d46/sgbmv_8f.html
+     *
+     * Note: For a M*N matrix, the input Allocation should also be of size M*N (dimY = M, dimX = N),
+     *       but only the region M*(KL+KU+1) will be referenced. The following subroutine can is an
+     *       example showing how to convert the original matrix 'a' to row-based band matrix 'b'.
+     *           for i in range(0, m):
+     *              for j in range(max(0, i-kl), min(i+ku+1, n)):
+     *                  b[i, j-i+kl] = a[i, j]
+     *
+     * @param TransA The type of transpose applied to matrix A.
+     * @param KL The number of sub-diagonals of the matrix A.
+     * @param KU The number of super-diagonals of the matrix A.
+     * @param alpha The scalar alpha.
+     * @param A The input allocation contains the band matrix A, supported elements type {@link Element#F32}.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F32}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     * @param beta The scalar beta.
+     * @param Y The input allocation contains vector y, supported elements type {@link Element#F32}.
+     * @param incY The increment for the elements of vector y, must be larger than zero.
+     */
     public void SGBMV(@Transpose int TransA, int KL, int KU, float alpha, Allocation A, Allocation X, int incX, float beta, Allocation Y, int incY) {
         // GBMV has the same validation requirements as GEMV + KL and KU >= 0
         validateGEMV(Element.F32(mRS), TransA, A, X, incX, Y, incY);
@@ -315,6 +424,31 @@
         int N = A.getType().getX();
         mRS.nScriptIntrinsicBLAS_Single(getID(mRS), RsBlas_sgbmv, TransA, 0, 0, 0, 0, M, N, 0, alpha, A.getID(mRS), X.getID(mRS), beta, Y.getID(mRS), incX, incY, KL, KU);
     }
+
+    /**
+     * DGBMV performs one of the matrix-vector operations
+     * y := alpha*A*x + beta*y   or   y := alpha*A**T*x + beta*y
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d2/d3f/dgbmv_8f.html
+     *
+     * Note: For a M*N matrix, the input Allocation should also be of size M*N (dimY = M, dimX = N),
+     *       but only the region M*(KL+KU+1) will be referenced. The following subroutine can is an
+     *       example showing how to convert the original matrix 'a' to row-based band matrix 'b'.
+     *           for i in range(0, m):
+     *              for j in range(max(0, i-kl), min(i+ku+1, n)):
+     *                  b[i, j-i+kl] = a[i, j]
+     *
+     * @param TransA The type of transpose applied to matrix A.
+     * @param KL The number of sub-diagonals of the matrix A.
+     * @param KU The number of super-diagonals of the matrix A.
+     * @param alpha The scalar alpha.
+     * @param A The input allocation contains the band matrix A, supported elements type {@link Element#F64}.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F64}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     * @param beta The scalar beta.
+     * @param Y The input allocation contains vector y, supported elements type {@link Element#F64}.
+     * @param incY The increment for the elements of vector y, must be larger than zero.
+     */
     public void DGBMV(@Transpose int TransA, int KL, int KU, double alpha, Allocation A, Allocation X, int incX, double beta, Allocation Y, int incY) {
         // GBMV has the same validation requirements as GEMV + KL and KU >= 0
         validateGEMV(Element.F64(mRS), TransA, A, X, incX, Y, incY);
@@ -325,6 +459,31 @@
         int N = A.getType().getX();
         mRS.nScriptIntrinsicBLAS_Double(getID(mRS), RsBlas_dgbmv, TransA, 0, 0, 0, 0, M, N, 0, alpha, A.getID(mRS), X.getID(mRS), beta, Y.getID(mRS), incX, incY, KL, KU);
     }
+
+    /**
+     * CGBMV performs one of the matrix-vector operations
+     * y := alpha*A*x + beta*y   or   y := alpha*A**T*x + beta*y   or   y := alpha*A**H*x + beta*y
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d0/d75/cgbmv_8f.html
+     *
+     * Note: For a M*N matrix, the input Allocation should also be of size M*N (dimY = M, dimX = N),
+     *       but only the region M*(KL+KU+1) will be referenced. The following subroutine can is an
+     *       example showing how to convert the original matrix 'a' to row-based band matrix 'b'.
+     *           for i in range(0, m):
+     *              for j in range(max(0, i-kl), min(i+ku+1, n)):
+     *                  b[i, j-i+kl] = a[i, j]
+     *
+     * @param TransA The type of transpose applied to matrix A.
+     * @param KL The number of sub-diagonals of the matrix A.
+     * @param KU The number of super-diagonals of the matrix A.
+     * @param alpha The scalar alpha.
+     * @param A The input allocation contains the band matrix A, supported elements type {@link Element#F32_2}.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F32_2}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     * @param beta The scalar beta.
+     * @param Y The input allocation contains vector y, supported elements type {@link Element#F32_2}.
+     * @param incY The increment for the elements of vector y, must be larger than zero.
+     */
     public void CGBMV(@Transpose int TransA, int KL, int KU, Float2 alpha, Allocation A, Allocation X, int incX, Float2 beta, Allocation Y, int incY) {
         // GBMV has the same validation requirements as GEMV + KL and KU >= 0
         validateGEMV(Element.F32_2(mRS), TransA, A, X, incX, Y, incY);
@@ -335,6 +494,31 @@
         int N = A.getType().getX();
         mRS.nScriptIntrinsicBLAS_Complex(getID(mRS), RsBlas_cgbmv, TransA, 0, 0, 0, 0, M, N, 0, alpha.x, alpha.y, A.getID(mRS), X.getID(mRS), beta.x, beta.y, Y.getID(mRS), incX, incY, KL, KU);
     }
+
+    /**
+     * ZGBMV performs one of the matrix-vector operations
+     * y := alpha*A*x + beta*y   or   y := alpha*A**T*x + beta*y   or   y := alpha*A**H*x + beta*y
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d9/d46/zgbmv_8f.html
+     *
+     * Note: For a M*N matrix, the input Allocation should also be of size M*N (dimY = M, dimX = N),
+     *       but only the region M*(KL+KU+1) will be referenced. The following subroutine can is an
+     *       example showing how to convert the original matrix 'a' to row-based band matrix 'b'.
+     *           for i in range(0, m):
+     *              for j in range(max(0, i-kl), min(i+ku+1, n)):
+     *                  b[i, j-i+kl] = a[i, j]
+     *
+     * @param TransA The type of transpose applied to matrix A.
+     * @param KL The number of sub-diagonals of the matrix A.
+     * @param KU The number of super-diagonals of the matrix A.
+     * @param alpha The scalar alpha.
+     * @param A The input allocation contains the band matrix A, supported elements type {@link Element#F64_2}.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F64_2}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     * @param beta The scalar beta.
+     * @param Y The input allocation contains vector y, supported elements type {@link Element#F64_2}.
+     * @param incY The increment for the elements of vector y, must be larger than zero.
+     */
     public void ZGBMV(@Transpose int TransA, int KL, int KU, Double2 alpha, Allocation A, Allocation X, int incX, Double2 beta, Allocation Y, int incY) {
         // GBMV has the same validation requirements as GEMV + KL and KU >= 0
         validateGEMV(Element.F64_2(mRS), TransA, A, X, incX, Y, incY);
@@ -403,27 +587,103 @@
         return N;
     }
 
+    /**
+     * STRMV performs one of the matrix-vector operations
+     * x := A*x   or   x := A**T*x
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/de/d45/strmv_8f.html
+     *
+     * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
+     * @param TransA The type of transpose applied to matrix A.
+     * @param Diag Specifies whether or not A is unit triangular.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F32}.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F32}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     */
     public void STRMV(@Uplo int Uplo, @Transpose int TransA, @Diag int Diag, Allocation A, Allocation X, int incX) {
         validateTRMV(Element.F32(mRS), Uplo, TransA, Diag, A, X, incX);
         int N = A.getType().getY();
         mRS.nScriptIntrinsicBLAS_Single(getID(mRS), RsBlas_strmv, TransA, 0, 0, Uplo, Diag, 0, N, 0, 0, A.getID(mRS), X.getID(mRS), 0, 0, incX, 0, 0, 0);
     }
+
+    /**
+     * DTRMV performs one of the matrix-vector operations
+     * x := A*x   or   x := A**T*x
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/dc/d7e/dtrmv_8f.html
+     *
+     * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
+     * @param TransA The type of transpose applied to matrix A.
+     * @param Diag Specifies whether or not A is unit triangular.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F64}.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F64}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     */
     public void DTRMV(@Uplo int Uplo, @Transpose int TransA, @Diag int Diag, Allocation A, Allocation X, int incX) {
         validateTRMV(Element.F64(mRS), Uplo, TransA, Diag, A, X, incX);
         int N = A.getType().getY();
         mRS.nScriptIntrinsicBLAS_Double(getID(mRS), RsBlas_dtrmv, TransA, 0, 0, Uplo, Diag, 0, N, 0, 0, A.getID(mRS), X.getID(mRS), 0, 0, incX, 0, 0, 0);
     }
+
+    /**
+     * CTRMV performs one of the matrix-vector operations
+     * x := A*x   or   x := A**T*x   or   x := A**H*x
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/df/d78/ctrmv_8f.html
+     *
+     * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
+     * @param TransA The type of transpose applied to matrix A.
+     * @param Diag Specifies whether or not A is unit triangular.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F32_2}.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F32_2}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     */
     public void CTRMV(@Uplo int Uplo, @Transpose int TransA, @Diag int Diag, Allocation A, Allocation X, int incX) {
         validateTRMV(Element.F32_2(mRS), Uplo, TransA, Diag, A, X, incX);
         int N = A.getType().getY();
         mRS.nScriptIntrinsicBLAS_Complex(getID(mRS), RsBlas_ctrmv, TransA, 0, 0, Uplo, Diag, 0, N, 0, 0, 0, A.getID(mRS), X.getID(mRS), 0, 0, 0, incX, 0, 0, 0);
     }
+
+    /**
+     * ZTRMV performs one of the matrix-vector operations
+     * x := A*x   or   x := A**T*x   or   x := A**H*x
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d0/dd1/ztrmv_8f.html
+     *
+     * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
+     * @param TransA The type of transpose applied to matrix A.
+     * @param Diag Specifies whether or not A is unit triangular.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F64_2}.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F64_2}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     */
     public void ZTRMV(@Uplo int Uplo, @Transpose int TransA, @Diag int Diag, Allocation A, Allocation X, int incX) {
         validateTRMV(Element.F64_2(mRS), Uplo, TransA, Diag, A, X, incX);
         int N = A.getType().getY();
         mRS.nScriptIntrinsicBLAS_Z(getID(mRS), RsBlas_ztrmv, TransA, 0, 0, Uplo, Diag, 0, N, 0, 0, 0, A.getID(mRS), X.getID(mRS), 0, 0, 0, incX, 0, 0, 0);
     }
 
+    /**
+     * STBMV performs one of the matrix-vector operations
+     * x := A*x   or   x := A**T*x
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d6/d7d/stbmv_8f.html
+     *
+     * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N),
+     *       but only the region N*(K+1) will be referenced. The following subroutine can is an
+     *       example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'.
+     *           for i in range(0, n):
+     *              for j in range(i, min(i+k+1, n)):
+     *                  b[i, j-i] = a[i, j]
+     *
+     * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
+     * @param TransA The type of transpose applied to matrix A.
+     * @param Diag Specifies whether or not A is unit triangular.
+     * @param K The number of off-diagonals of the matrix A
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F32}.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F32}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     */
     public void STBMV(@Uplo int Uplo, @Transpose int TransA, @Diag int Diag,  int K, Allocation A,  Allocation X,  int incX) {
         // TBMV has the same requirements as TRMV + K >= 0
         if (K < 0) {
@@ -433,6 +693,28 @@
         int N = A.getType().getY();
         mRS.nScriptIntrinsicBLAS_Single(getID(mRS), RsBlas_stbmv, TransA, 0, 0, Uplo, Diag, 0, N, K, 0, A.getID(mRS), X.getID(mRS), 0, 0, incX, 0, 0, 0);
     }
+
+    /**
+     * DTBMV performs one of the matrix-vector operations
+     * x := A*x   or   x := A**T*x
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/df/d29/dtbmv_8f.html
+     *
+     * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N),
+     *       but only the region N*(K+1) will be referenced. The following subroutine can is an
+     *       example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'.
+     *           for i in range(0, n):
+     *              for j in range(i, min(i+k+1, n)):
+     *                  b[i, j-i] = a[i, j]
+     *
+     * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
+     * @param TransA The type of transpose applied to matrix A.
+     * @param Diag Specifies whether or not A is unit triangular.
+     * @param K The number of off-diagonals of the matrix A
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F64}.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F64}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     */
     public void DTBMV(@Uplo int Uplo, @Transpose int TransA, @Diag int Diag,  int K, Allocation A,  Allocation X,  int incX) {
         // TBMV has the same requirements as TRMV + K >= 0
         if (K < 0) {
@@ -442,6 +724,28 @@
         int N = A.getType().getY();
         mRS.nScriptIntrinsicBLAS_Double(getID(mRS), RsBlas_dtbmv, TransA, 0, 0, Uplo, Diag, 0, N, K, 0, A.getID(mRS), X.getID(mRS), 0, 0, incX, 0, 0, 0);
     }
+
+    /**
+     * CTBMV performs one of the matrix-vector operations
+     * x := A*x   or   x := A**T*x   or   x := A**H*x
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d3/dcd/ctbmv_8f.html
+     *
+     * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N),
+     *       but only the region N*(K+1) will be referenced. The following subroutine can is an
+     *       example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'.
+     *           for i in range(0, n):
+     *              for j in range(i, min(i+k+1, n)):
+     *                  b[i, j-i] = a[i, j]
+     *
+     * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
+     * @param TransA The type of transpose applied to matrix A.
+     * @param Diag Specifies whether or not A is unit triangular.
+     * @param K The number of off-diagonals of the matrix A
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F32_2}.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F32_2}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     */
     public void CTBMV(@Uplo int Uplo, @Transpose int TransA, @Diag int Diag,  int K, Allocation A,  Allocation X,  int incX) {
         // TBMV has the same requirements as TRMV + K >= 0
         if (K < 0) {
@@ -451,6 +755,28 @@
         int N = A.getType().getY();
         mRS.nScriptIntrinsicBLAS_Complex(getID(mRS), RsBlas_ctbmv, TransA, 0, 0, Uplo, Diag, 0, N, K, 0, 0, A.getID(mRS), X.getID(mRS), 0, 0, 0, incX, 0, 0, 0);
     }
+
+    /**
+     * ZTBMV performs one of the matrix-vector operations
+     * x := A*x   or   x := A**T*x   or   x := A**H*x
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d3/d39/ztbmv_8f.html
+     *
+     * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N),
+     *       but only the region N*(K+1) will be referenced. The following subroutine can is an
+     *       example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'.
+     *           for i in range(0, n):
+     *              for j in range(i, min(i+k+1, n)):
+     *                  b[i, j-i] = a[i, j]
+     *
+     * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
+     * @param TransA The type of transpose applied to matrix A.
+     * @param Diag Specifies whether or not A is unit triangular.
+     * @param K The number of off-diagonals of the matrix A
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F64_2}.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F64_2}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     */
     public void ZTBMV(@Uplo int Uplo, @Transpose int TransA, @Diag int Diag,  int K, Allocation A,  Allocation X,  int incX) {
         // TBMV has the same requirements as TRMV + K >= 0
         if (K < 0) {
@@ -460,22 +786,124 @@
         int N = A.getType().getY();
         mRS.nScriptIntrinsicBLAS_Z(getID(mRS), RsBlas_ztbmv, TransA, 0, 0, Uplo, Diag, 0, N, K, 0, 0, A.getID(mRS), X.getID(mRS), 0, 0, 0, incX, 0, 0, 0);
     }
+
+    /**
+     * STPMV performs one of the matrix-vector operations
+     * x := A*x   or   x := A**T*x
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/db/db1/stpmv_8f.html
+     *
+     * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
+     *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
+     *       'a' to packed matrix 'b'.
+     *           k = 0
+     *           for i in range(0, n):
+     *              for j in range(i, n):
+     *                  b[k++] = a[i, j]
+     *
+     * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
+     * @param TransA The type of transpose applied to matrix A.
+     * @param Diag Specifies whether or not A is unit triangular.
+     * @param Ap The input allocation contains packed matrix A, supported elements type {@link Element#F32}.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F32}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     */
     public void STPMV(@Uplo int Uplo, @Transpose int TransA, @Diag int Diag,  Allocation Ap,  Allocation X,  int incX) {
         int N = validateTPMV(Element.F32(mRS), Uplo, TransA, Diag, Ap, X, incX);
         mRS.nScriptIntrinsicBLAS_Single(getID(mRS), RsBlas_stpmv, TransA, 0, 0, Uplo, Diag, 0, N, 0, 0, Ap.getID(mRS), X.getID(mRS), 0, 0, incX, 0, 0, 0);
     }
+
+    /**
+     * DTPMV performs one of the matrix-vector operations
+     * x := A*x   or   x := A**T*x
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/dc/dcd/dtpmv_8f.html
+     *
+     * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
+     *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
+     *       'a' to packed matrix 'b'.
+     *           k = 0
+     *           for i in range(0, n):
+     *              for j in range(i, n):
+     *                  b[k++] = a[i, j]
+     *
+     * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
+     * @param TransA The type of transpose applied to matrix A.
+     * @param Diag Specifies whether or not A is unit triangular.
+     * @param Ap The input allocation contains packed matrix A, supported elements type {@link Element#F64}.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F64}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     */
     public void DTPMV(@Uplo int Uplo, @Transpose int TransA, @Diag int Diag,  Allocation Ap,  Allocation X,  int incX) {
         int N = validateTPMV(Element.F64(mRS), Uplo, TransA, Diag, Ap, X, incX);
         mRS.nScriptIntrinsicBLAS_Double(getID(mRS), RsBlas_dtpmv, TransA, 0, 0, Uplo, Diag, 0, N, 0, 0, Ap.getID(mRS), X.getID(mRS), 0, 0, incX, 0, 0, 0);
     }
+
+    /**
+     * CTPMV performs one of the matrix-vector operations
+     * x := A*x   or   x := A**T*x   or   x := A**H*x
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d4/dbb/ctpmv_8f.html
+     *
+     * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
+     *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
+     *       'a' to packed matrix 'b'.
+     *           k = 0
+     *           for i in range(0, n):
+     *              for j in range(i, n):
+     *                  b[k++] = a[i, j]
+     *
+     * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
+     * @param TransA The type of transpose applied to matrix A.
+     * @param Diag Specifies whether or not A is unit triangular.
+     * @param Ap The input allocation contains packed matrix A, supported elements type {@link Element#F32_2}.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F32_2}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     */
     public void CTPMV(@Uplo int Uplo, @Transpose int TransA, @Diag int Diag,  Allocation Ap,  Allocation X,  int incX) {
         int N = validateTPMV(Element.F32_2(mRS), Uplo, TransA, Diag, Ap, X, incX);
         mRS.nScriptIntrinsicBLAS_Complex(getID(mRS), RsBlas_ctpmv, TransA, 0, 0, Uplo, Diag, 0, N, 0, 0, 0, Ap.getID(mRS), X.getID(mRS), 0, 0, 0, incX, 0, 0, 0);
     }
+
+    /**
+     * ZTPMV performs one of the matrix-vector operations
+     * x := A*x   or   x := A**T*x   or   x := A**H*x
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d2/d9e/ztpmv_8f.html
+     *
+     * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
+     *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
+     *       'a' to packed matrix 'b'.
+     *           k = 0
+     *           for i in range(0, n):
+     *              for j in range(i, n):
+     *                  b[k++] = a[i, j]
+     *
+     * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
+     * @param TransA The type of transpose applied to matrix A.
+     * @param Diag Specifies whether or not A is unit triangular.
+     * @param Ap The input allocation contains packed matrix A, supported elements type {@link Element#F64_2}.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F64_2}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     */
     public void ZTPMV(@Uplo int Uplo, @Transpose int TransA, @Diag int Diag,  Allocation Ap,  Allocation X,  int incX) {
         int N = validateTPMV(Element.F64_2(mRS), Uplo, TransA, Diag, Ap, X, incX);
         mRS.nScriptIntrinsicBLAS_Z(getID(mRS), RsBlas_ztpmv, TransA, 0, 0, Uplo, Diag, 0, N, 0, 0, 0, Ap.getID(mRS), X.getID(mRS), 0, 0, 0, incX, 0, 0, 0);
     }
+
+    /**
+     * STRSV solves one of the systems of equations
+     * A*x = b   or   A**T*x = b
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d0/d2a/strsv_8f.html
+     *
+     * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
+     * @param TransA The type of transpose applied to matrix A.
+     * @param Diag Specifies whether or not A is unit triangular.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F32}.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F32}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     */
     public void STRSV(@Uplo int Uplo, @Transpose int TransA, @Diag int Diag,  Allocation A,  Allocation X,  int incX) {
         // TRSV is the same as TRMV
         validateTRMV(Element.F32(mRS), Uplo, TransA, Diag, A, X, incX);
@@ -483,6 +911,20 @@
         mRS.nScriptIntrinsicBLAS_Single(getID(mRS), RsBlas_strsv, TransA, 0, 0, Uplo, Diag, 0, N, 0, 0, A.getID(mRS), X.getID(mRS), 0, 0, incX, 0, 0, 0);
 
     }
+
+    /**
+     * DTRSV solves one of the systems of equations
+     * A*x = b   or   A**T*x = b
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d6/d96/dtrsv_8f.html
+     *
+     * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
+     * @param TransA The type of transpose applied to matrix A.
+     * @param Diag Specifies whether or not A is unit triangular.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F64}.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F64}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     */
     public void DTRSV(@Uplo int Uplo, @Transpose int TransA, @Diag int Diag,  Allocation A,  Allocation X,  int incX) {
         // TRSV is the same as TRMV
         validateTRMV(Element.F64(mRS), Uplo, TransA, Diag, A, X, incX);
@@ -490,6 +932,20 @@
         mRS.nScriptIntrinsicBLAS_Double(getID(mRS), RsBlas_dtrsv, TransA, 0, 0, Uplo, Diag, 0, N, 0, 0, A.getID(mRS), X.getID(mRS), 0, 0, incX, 0, 0, 0);
 
     }
+
+    /**
+     * CTRSV solves one of the systems of equations
+     * A*x = b   or   A**T*x = b   or   A**H*x = b
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d4/dc8/ctrsv_8f.html
+     *
+     * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
+     * @param TransA The type of transpose applied to matrix A.
+     * @param Diag Specifies whether or not A is unit triangular.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F32_2}.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F32_2}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     */
     public void CTRSV(@Uplo int Uplo, @Transpose int TransA, @Diag int Diag,  Allocation A,  Allocation X,  int incX) {
         // TRSV is the same as TRMV
         validateTRMV(Element.F32_2(mRS), Uplo, TransA, Diag, A, X, incX);
@@ -497,6 +953,20 @@
         mRS.nScriptIntrinsicBLAS_Complex(getID(mRS), RsBlas_ctrsv, TransA, 0, 0, Uplo, Diag, 0, N, 0, 0, 0, A.getID(mRS), X.getID(mRS), 0, 0, 0, incX, 0, 0, 0);
 
     }
+
+    /**
+     * ZTRSV solves one of the systems of equations
+     * A*x = b   or   A**T*x = b   or   A**H*x = b
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d1/d2f/ztrsv_8f.html
+     *
+     * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
+     * @param TransA The type of transpose applied to matrix A.
+     * @param Diag Specifies whether or not A is unit triangular.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F64_2}.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F64_2}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     */
     public void ZTRSV(@Uplo int Uplo, @Transpose int TransA, @Diag int Diag,  Allocation A,  Allocation X,  int incX) {
         // TRSV is the same as TRMV
         validateTRMV(Element.F64_2(mRS), Uplo, TransA, Diag, A, X, incX);
@@ -504,6 +974,28 @@
         mRS.nScriptIntrinsicBLAS_Z(getID(mRS), RsBlas_ztrsv, TransA, 0, 0, Uplo, Diag, 0, N, 0, 0, 0, A.getID(mRS), X.getID(mRS), 0, 0, 0, incX, 0, 0, 0);
 
     }
+
+    /**
+     * STBSV solves one of the systems of equations
+     * A*x = b   or   A**T*x = b
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d0/d1f/stbsv_8f.html
+     *
+     * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N),
+     *       but only the region N*(K+1) will be referenced. The following subroutine can is an
+     *       example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'.
+     *           for i in range(0, n):
+     *              for j in range(i, min(i+k+1, n)):
+     *                  b[i, j-i] = a[i, j]
+     *
+     * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
+     * @param TransA The type of transpose applied to matrix A.
+     * @param Diag Specifies whether or not A is unit triangular.
+     * @param K The number of off-diagonals of the matrix A
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F32}.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F32}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     */
     public void STBSV(@Uplo int Uplo, @Transpose int TransA, @Diag int Diag,  int K, Allocation A,  Allocation X,  int incX) {
         // TBSV is the same as TRMV + K >= 0
         validateTRMV(Element.F32(mRS), Uplo, TransA, Diag, A, X, incX);
@@ -513,6 +1005,28 @@
         }
         mRS.nScriptIntrinsicBLAS_Single(getID(mRS), RsBlas_stbsv, TransA, 0, 0, Uplo, Diag, 0, N, K, 0, A.getID(mRS), X.getID(mRS), 0, 0, incX, 0, 0, 0);
     }
+
+    /**
+     * DTBSV solves one of the systems of equations
+     * A*x = b   or   A**T*x = b
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d4/dcf/dtbsv_8f.html
+     *
+     * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N),
+     *       but only the region N*(K+1) will be referenced. The following subroutine can is an
+     *       example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'.
+     *           for i in range(0, n):
+     *              for j in range(i, min(i+k+1, n)):
+     *                  b[i, j-i] = a[i, j]
+     *
+     * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
+     * @param TransA The type of transpose applied to matrix A.
+     * @param Diag Specifies whether or not A is unit triangular.
+     * @param K The number of off-diagonals of the matrix A
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F64}.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F64}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     */
     public void DTBSV(@Uplo int Uplo, @Transpose int TransA, @Diag int Diag,  int K, Allocation A,  Allocation X,  int incX) {
         // TBSV is the same as TRMV + K >= 0
         validateTRMV(Element.F64(mRS), Uplo, TransA, Diag, A, X, incX);
@@ -522,6 +1036,28 @@
         }
         mRS.nScriptIntrinsicBLAS_Double(getID(mRS), RsBlas_dtbsv, TransA, 0, 0, Uplo, Diag, 0, N, K, 0, A.getID(mRS), X.getID(mRS), 0, 0, incX, 0, 0, 0);
     }
+
+    /**
+     * CTBSV solves one of the systems of equations
+     * A*x = b   or   A**T*x = b   or   A**H*x = b
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d9/d5f/ctbsv_8f.html
+     *
+     * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N),
+     *       but only the region N*(K+1) will be referenced. The following subroutine can is an
+     *       example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'.
+     *           for i in range(0, n):
+     *              for j in range(i, min(i+k+1, n)):
+     *                  b[i, j-i] = a[i, j]
+     *
+     * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
+     * @param TransA The type of transpose applied to matrix A.
+     * @param Diag Specifies whether or not A is unit triangular.
+     * @param K The number of off-diagonals of the matrix A
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F32_2}.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F32_2}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     */
     public void CTBSV(@Uplo int Uplo, @Transpose int TransA, @Diag int Diag,  int K, Allocation A,  Allocation X,  int incX) {
         // TBSV is the same as TRMV + K >= 0
         validateTRMV(Element.F32_2(mRS), Uplo, TransA, Diag, A, X, incX);
@@ -531,6 +1067,28 @@
         }
         mRS.nScriptIntrinsicBLAS_Complex(getID(mRS), RsBlas_ctbsv, TransA, 0, 0, Uplo, Diag, 0, N, K, 0, 0, A.getID(mRS), X.getID(mRS), 0, 0, 0, incX, 0, 0, 0);
     }
+
+    /**
+     * ZTBSV solves one of the systems of equations
+     * A*x = b   or   A**T*x = b   or   A**H*x = b
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d4/d5a/ztbsv_8f.html
+     *
+     * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N),
+     *       but only the region N*(K+1) will be referenced. The following subroutine can is an
+     *       example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'.
+     *           for i in range(0, n):
+     *              for j in range(i, min(i+k+1, n)):
+     *                  b[i, j-i] = a[i, j]
+     *
+     * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
+     * @param TransA The type of transpose applied to matrix A.
+     * @param Diag Specifies whether or not A is unit triangular.
+     * @param K The number of off-diagonals of the matrix A
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F64_2}.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F64_2}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     */
     public void ZTBSV(@Uplo int Uplo, @Transpose int TransA, @Diag int Diag,  int K, Allocation A,  Allocation X,  int incX) {
         // TBSV is the same as TRMV + K >= 0
         validateTRMV(Element.F64_2(mRS), Uplo, TransA, Diag, A, X, incX);
@@ -540,21 +1098,109 @@
         }
         mRS.nScriptIntrinsicBLAS_Z(getID(mRS), RsBlas_ztbsv, TransA, 0, 0, Uplo, Diag, 0, N, K, 0, 0, A.getID(mRS), X.getID(mRS), 0, 0, 0, incX, 0, 0, 0);
     }
+
+    /**
+     * STPSV solves one of the systems of equations
+     * A*x = b   or   A**T*x = b
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d0/d7c/stpsv_8f.html
+     *
+     * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
+     *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
+     *       'a' to packed matrix 'b'.
+     *           k = 0
+     *           for i in range(0, n):
+     *              for j in range(i, n):
+     *                  b[k++] = a[i, j]
+     *
+     * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
+     * @param TransA The type of transpose applied to matrix A.
+     * @param Diag Specifies whether or not A is unit triangular.
+     * @param Ap The input allocation contains packed matrix A, supported elements type {@link Element#F32}.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F32}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     */
     public void STPSV(@Uplo int Uplo, @Transpose int TransA, @Diag int Diag,  Allocation Ap,  Allocation X,  int incX) {
         // TPSV is same as TPMV
         int N = validateTPMV(Element.F32(mRS), Uplo, TransA, Diag, Ap, X, incX);
         mRS.nScriptIntrinsicBLAS_Single(getID(mRS), RsBlas_stpsv, TransA, 0, 0, Uplo, Diag, 0, N, 0, 0, Ap.getID(mRS), X.getID(mRS), 0, 0, incX, 0, 0, 0);
     }
+
+    /**
+     * DTPSV solves one of the systems of equations
+     * A*x = b   or   A**T*x = b
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d9/d84/dtpsv_8f.html
+     *
+     * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
+     *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
+     *       'a' to packed matrix 'b'.
+     *           k = 0
+     *           for i in range(0, n):
+     *              for j in range(i, n):
+     *                  b[k++] = a[i, j]
+     *
+     * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
+     * @param TransA The type of transpose applied to matrix A.
+     * @param Diag Specifies whether or not A is unit triangular.
+     * @param Ap The input allocation contains packed matrix A, supported elements type {@link Element#F64}.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F64}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     */
     public void DTPSV(@Uplo int Uplo, @Transpose int TransA, @Diag int Diag,  Allocation Ap,  Allocation X,  int incX) {
         // TPSV is same as TPMV
         int N = validateTPMV(Element.F64(mRS), Uplo, TransA, Diag, Ap, X, incX);
         mRS.nScriptIntrinsicBLAS_Double(getID(mRS), RsBlas_dtpsv, TransA, 0, 0, Uplo, Diag, 0, N, 0, 0, Ap.getID(mRS), X.getID(mRS), 0, 0, incX, 0, 0, 0);
     }
+
+    /**
+     * CTPSV solves one of the systems of equations
+     * A*x = b   or   A**T*x = b   or   A**H*x = b
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d8/d56/ctpsv_8f.html
+     *
+     * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
+     *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
+     *       'a' to packed matrix 'b'.
+     *           k = 0
+     *           for i in range(0, n):
+     *              for j in range(i, n):
+     *                  b[k++] = a[i, j]
+     *
+     * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
+     * @param TransA The type of transpose applied to matrix A.
+     * @param Diag Specifies whether or not A is unit triangular.
+     * @param Ap The input allocation contains packed matrix A, supported elements type {@link Element#F32_2}.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F32_2}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     */
     public void CTPSV(@Uplo int Uplo, @Transpose int TransA, @Diag int Diag,  Allocation Ap,  Allocation X,  int incX) {
         // TPSV is same as TPMV
         int N = validateTPMV(Element.F32_2(mRS), Uplo, TransA, Diag, Ap, X, incX);
         mRS.nScriptIntrinsicBLAS_Complex(getID(mRS), RsBlas_ctpsv, TransA, 0, 0, Uplo, Diag, 0, N, 0, 0, 0, Ap.getID(mRS), X.getID(mRS), 0, 0, 0, incX, 0, 0, 0);
     }
+
+    /**
+     * ZTPSV solves one of the systems of equations
+     * A*x = b   or   A**T*x = b   or   A**H*x = b
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/da/d57/ztpsv_8f.html
+     *
+     * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
+     *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
+     *       'a' to packed matrix 'b'.
+     *           k = 0
+     *           for i in range(0, n):
+     *              for j in range(i, n):
+     *                  b[k++] = a[i, j]
+     *
+     * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
+     * @param TransA The type of transpose applied to matrix A.
+     * @param Diag Specifies whether or not A is unit triangular.
+     * @param Ap The input allocation contains packed matrix A, supported elements type {@link Element#F64_2}.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F64_2}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     */
     public void ZTPSV(@Uplo int Uplo, @Transpose int TransA, @Diag int Diag,  Allocation Ap,  Allocation X,  int incX) {
         // TPSV is same as TPMV
         int N = validateTPMV(Element.F64_2(mRS), Uplo, TransA, Diag, Ap, X, incX);
@@ -768,10 +1414,49 @@
         return N;
     }
 
+    /**
+     * SSYMV performs the matrix-vector operation
+     * y := alpha*A*x + beta*y
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d2/d94/ssymv_8f.html
+     *
+     * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
+     * @param alpha The scalar alpha.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F32}.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F32}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     * @param beta The scalar beta.
+     * @param Y The input allocation contains vector y, supported elements type {@link Element#F32}.
+     * @param incY The increment for the elements of vector y, must be larger than zero.
+     */
     public void SSYMV(@Uplo int Uplo, float alpha, Allocation A, Allocation X, int incX, float beta, Allocation Y, int incY) {
         int N = validateSYMV(Element.F32(mRS), Uplo, A, X, Y, incX, incY);
         mRS.nScriptIntrinsicBLAS_Single(getID(mRS), RsBlas_ssymv, 0, 0, 0, Uplo, 0, 0, N, 0, alpha, A.getID(mRS), X.getID(mRS), beta, Y.getID(mRS), incX, incY, 0, 0);
     }
+
+    /**
+     * SSBMV performs the matrix-vector operation
+     * y := alpha*A*x + beta*y
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d3/da1/ssbmv_8f.html
+     *
+     * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N),
+     *       but only the region N*(K+1) will be referenced. The following subroutine can is an
+     *       example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'.
+     *           for i in range(0, n):
+     *              for j in range(i, min(i+k+1, n)):
+     *                  b[i, j-i] = a[i, j]
+     *
+     * @param Uplo Specifies whether the upper or lower triangular part of the band matrix A is being supplied.
+     * @param K The number of off-diagonals of the matrix A
+     * @param alpha The scalar alpha.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F32}.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F32}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     * @param beta The scalar beta.
+     * @param Y The input allocation contains vector y, supported elements type {@link Element#F32}.
+     * @param incY The increment for the elements of vector y, must be larger than zero.
+     */
     public void SSBMV(@Uplo int Uplo, int K, float alpha, Allocation A, Allocation X, int incX, float beta, Allocation Y, int incY) {
         // SBMV is the same as SYMV + K >= 0
         if (K < 0) {
@@ -780,36 +1465,186 @@
         int N = validateSYMV(Element.F32(mRS), Uplo, A, X, Y, incX, incY);
         mRS.nScriptIntrinsicBLAS_Single(getID(mRS), RsBlas_ssbmv, 0, 0, 0, Uplo, 0, 0, N, K, alpha, A.getID(mRS), X.getID(mRS), beta, Y.getID(mRS), incX, incY, 0, 0);
     }
+
+    /**
+     * SSPMV performs the matrix-vector operation
+     * y := alpha*A*x + beta*y
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d8/d68/sspmv_8f.html
+     *
+     * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
+     *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
+     *       'a' to packed matrix 'b'.
+     *           k = 0
+     *           for i in range(0, n):
+     *              for j in range(i, n):
+     *                  b[k++] = a[i, j]
+     *
+     * @param Uplo Specifies whether the upper or lower triangular part of the matrix A is supplied in packed form.
+     * @param alpha The scalar alpha.
+     * @param Ap The input allocation contains matrix A, supported elements type {@link Element#F32}.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F32}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     * @param beta The scalar beta.
+     * @param Y The input allocation contains vector y, supported elements type {@link Element#F32}.
+     * @param incY The increment for the elements of vector y, must be larger than zero.
+     */
     public void SSPMV(@Uplo int Uplo, float alpha, Allocation Ap, Allocation X, int incX, float beta, Allocation Y, int incY) {
         int N = validateSPMV(Element.F32(mRS), Uplo, Ap, X, incX, Y, incY);
         mRS.nScriptIntrinsicBLAS_Single(getID(mRS), RsBlas_sspmv, 0, 0, 0, Uplo, 0, 0, N, 0, alpha, Ap.getID(mRS), X.getID(mRS), beta, Y.getID(mRS), incX, incY, 0, 0);
     }
+
+    /**
+     * SGER performs the rank 1 operation
+     * A := alpha*x*y**T + A
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/db/d5c/sger_8f.html
+     *
+     * @param alpha The scalar alpha.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F32}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     * @param Y The input allocation contains vector y, supported elements type {@link Element#F32}.
+     * @param incY The increment for the elements of vector y, must be larger than zero.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F32}.
+     */
     public void SGER(float alpha, Allocation X, int incX, Allocation Y, int incY, Allocation A) {
         int M = A.getType().getY();
         int N = A.getType().getX();
         validateGER(Element.F32(mRS), X, incX, Y, incY, A);
         mRS.nScriptIntrinsicBLAS_Single(getID(mRS), RsBlas_sger, 0, 0, 0, 0, 0, M, N, 0, alpha, X.getID(mRS), Y.getID(mRS), 0.f, A.getID(mRS), incX, incY, 0, 0);
     }
+
+    /**
+     * SSYR performs the rank 1 operation
+     * A := alpha*x*x**T + A
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d6/dac/ssyr_8f.html
+     *
+     * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
+     * @param alpha The scalar alpha.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F32}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F32}.
+     */
     public void SSYR(@Uplo int Uplo, float alpha, Allocation X, int incX, Allocation A) {
         int N = validateSYR(Element.F32(mRS), Uplo, X, incX, A);
         mRS.nScriptIntrinsicBLAS_Single(getID(mRS), RsBlas_ssyr, 0, 0, 0, Uplo, 0, 0, N, 0, alpha, X.getID(mRS), A.getID(mRS), 0.f, 0, incX, 0, 0, 0);
     }
+
+    /**
+     * SSPR performs the rank 1 operation
+     * A := alpha*x*x**T + A
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d2/d9b/sspr_8f.html
+     *
+     * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
+     *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
+     *       'a' to packed matrix 'b'.
+     *           k = 0
+     *           for i in range(0, n):
+     *              for j in range(i, n):
+     *                  b[k++] = a[i, j]
+     *
+     * @param Uplo Specifies whether the upper or lower triangular part is to be supplied in the packed form.
+     * @param alpha The scalar alpha.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F32}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     * @param Ap The input allocation contains matrix A, supported elements type {@link Element#F32}.
+     */
     public void SSPR(@Uplo int Uplo, float alpha, Allocation X, int incX, Allocation Ap) {
         int N = validateSPR(Element.F32(mRS), Uplo, X, incX, Ap);
         mRS.nScriptIntrinsicBLAS_Single(getID(mRS), RsBlas_sspr, 0, 0, 0, Uplo, 0, 0, N, 0, alpha, X.getID(mRS), Ap.getID(mRS), 0.f, 0, incX, 0, 0, 0);
     }
+
+    /**
+     * SSYR2 performs the symmetric rank 2 operation
+     * A := alpha*x*y**T + alpha*y*x**T + A
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/db/d99/ssyr2_8f.html
+     *
+     * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
+     * @param alpha The scalar alpha.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F32}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     * @param Y The input allocation contains vector y, supported elements type {@link Element#F32}.
+     * @param incY The increment for the elements of vector y, must be larger than zero.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F32}.
+     */
     public void SSYR2(@Uplo int Uplo, float alpha, Allocation X, int incX, Allocation Y, int incY, Allocation A) {
         int N = validateSYR2(Element.F32(mRS), Uplo, X, incX, Y, incY, A);
         mRS.nScriptIntrinsicBLAS_Single(getID(mRS), RsBlas_ssyr2, 0, 0, 0, Uplo, 0, 0, N, 0, alpha, X.getID(mRS), Y.getID(mRS), 0, A.getID(mRS), incX, incY, 0, 0);
     }
+
+    /**
+     * SSPR2 performs the symmetric rank 2 operation
+     * A := alpha*x*y**T + alpha*y*x**T + A
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/db/d3e/sspr2_8f.html
+     *
+     * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
+     *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
+     *       'a' to packed matrix 'b'.
+     *           k = 0
+     *           for i in range(0, n):
+     *              for j in range(i, n):
+     *                  b[k++] = a[i, j]
+     *
+     * @param Uplo Specifies whether the upper or lower triangular part is to be supplied in the packed form.
+     * @param alpha The scalar alpha.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F32}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     * @param Y The input allocation contains vector y, supported elements type {@link Element#F32}.
+     * @param incY The increment for the elements of vector y, must be larger than zero.
+     * @param Ap The input allocation contains matrix A, supported elements type {@link Element#F32}.
+     */
     public void SSPR2(@Uplo int Uplo, float alpha, Allocation X, int incX, Allocation Y, int incY, Allocation Ap) {
         int N = validateSPR2(Element.F32(mRS), Uplo, X, incX, Y, incY, Ap);
         mRS.nScriptIntrinsicBLAS_Single(getID(mRS), RsBlas_sspr2, 0, 0, 0, Uplo, 0, 0, N, 0, alpha, X.getID(mRS), Y.getID(mRS), 0, Ap.getID(mRS), incX, incY, 0, 0);
     }
+
+    /**
+     * DSYMV performs the matrix-vector operation
+     * y := alpha*A*x + beta*y
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d8/dbe/dsymv_8f.html
+     *
+     * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
+     * @param alpha The scalar alpha.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F64}.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F64}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     * @param beta The scalar beta.
+     * @param Y The input allocation contains vector y, supported elements type {@link Element#F64}.
+     * @param incY The increment for the elements of vector y, must be larger than zero.
+     */
     public void DSYMV(@Uplo int Uplo, double alpha, Allocation A, Allocation X, int incX, double beta, Allocation Y, int incY) {
         int N = validateSYMV(Element.F64(mRS), Uplo, A, X, Y, incX, incY);
         mRS.nScriptIntrinsicBLAS_Double(getID(mRS), RsBlas_dsymv, 0, 0, 0, Uplo, 0, 0, N, 0, alpha, A.getID(mRS), X.getID(mRS), beta, Y.getID(mRS), incX, incY, 0, 0);
     }
+
+    /**
+     * DSBMV performs the matrix-vector operation
+     * y := alpha*A*x + beta*y
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d8/d1e/dsbmv_8f.html
+     *
+     * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N),
+     *       but only the region N*(K+1) will be referenced. The following subroutine can is an
+     *       example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'.
+     *           for i in range(0, n):
+     *              for j in range(i, min(i+k+1, n)):
+     *                  b[i, j-i] = a[i, j]
+     *
+     * @param Uplo Specifies whether the upper or lower triangular part of the band matrix A is being supplied.
+     * @param K The number of off-diagonals of the matrix A
+     * @param alpha The scalar alpha.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F64}.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F64}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     * @param beta The scalar beta.
+     * @param Y The input allocation contains vector y, supported elements type {@link Element#F64}.
+     * @param incY The increment for the elements of vector y, must be larger than zero.
+     */
     public void DSBMV(@Uplo int Uplo, int K, double alpha, Allocation A, Allocation X, int incX, double beta, Allocation Y, int incY) {
         // SBMV is the same as SYMV + K >= 0
         if (K < 0) {
@@ -818,28 +1653,138 @@
         int N = validateSYMV(Element.F64(mRS), Uplo, A, X, Y, incX, incY);
         mRS.nScriptIntrinsicBLAS_Double(getID(mRS), RsBlas_dsbmv, 0, 0, 0, Uplo, 0, 0, N, K, alpha, A.getID(mRS), X.getID(mRS), beta, Y.getID(mRS), incX, incY, 0, 0);
     }
+
+    /**
+     * DSPMV performs the matrix-vector operation
+     * y := alpha*A*x + beta*y
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d4/d85/dspmv_8f.html
+     *
+     * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
+     *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
+     *       'a' to packed matrix 'b'.
+     *           k = 0
+     *           for i in range(0, n):
+     *              for j in range(i, n):
+     *                  b[k++] = a[i, j]
+     *
+     * @param Uplo Specifies whether the upper or lower triangular part of the matrix A is supplied in packed form.
+     * @param alpha The scalar alpha.
+     * @param Ap The input allocation contains matrix A, supported elements type {@link Element#F64}.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F64}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     * @param beta The scalar beta.
+     * @param Y The input allocation contains vector y, supported elements type {@link Element#F64}.
+     * @param incY The increment for the elements of vector y, must be larger than zero.
+     */
     public void DSPMV(@Uplo int Uplo, double alpha, Allocation Ap, Allocation X, int incX, double beta, Allocation Y, int incY) {
         int N = validateSPMV(Element.F64(mRS), Uplo, Ap, X, incX, Y, incY);
         mRS.nScriptIntrinsicBLAS_Double(getID(mRS), RsBlas_dspmv, 0, 0, 0, Uplo, 0, 0, N, 0, alpha, Ap.getID(mRS), X.getID(mRS), beta, Y.getID(mRS), incX, incY, 0, 0);
     }
+
+    /**
+     * DGER performs the rank 1 operation
+     * A := alpha*x*y**T + A
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/dc/da8/dger_8f.html
+     *
+     * @param alpha The scalar alpha.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F64}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     * @param Y The input allocation contains vector y, supported elements type {@link Element#F64}.
+     * @param incY The increment for the elements of vector y, must be larger than zero.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F64}.
+     */
     public void DGER(double alpha, Allocation X, int incX, Allocation Y, int incY, Allocation A) {
         int M = A.getType().getY();
         int N = A.getType().getX();
         validateGER(Element.F64(mRS), X, incX, Y, incY, A);
         mRS.nScriptIntrinsicBLAS_Double(getID(mRS), RsBlas_dger, 0, 0, 0, 0, 0, M, N, 0, alpha, X.getID(mRS), Y.getID(mRS), 0.f, A.getID(mRS), incX, incY, 0, 0);
     }
+
+    /**
+     * DSYR performs the rank 1 operation
+     * A := alpha*x*x**T + A
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d3/d60/dsyr_8f.html
+     *
+     * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
+     * @param alpha The scalar alpha.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F64}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F64}.
+     */
     public void DSYR(@Uplo int Uplo, double alpha, Allocation X, int incX, Allocation A) {
         int N = validateSYR(Element.F64(mRS), Uplo, X, incX, A);
         mRS.nScriptIntrinsicBLAS_Double(getID(mRS), RsBlas_dsyr, 0, 0, 0, Uplo, 0, 0, N, 0, alpha, X.getID(mRS), A.getID(mRS), 0.f, 0, incX, 0, 0, 0);
     }
+
+    /**
+     * DSPR performs the rank 1 operation
+     * A := alpha*x*x**T + A
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/dd/dba/dspr_8f.html
+     *
+     * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
+     *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
+     *       'a' to packed matrix 'b'.
+     *           k = 0
+     *           for i in range(0, n):
+     *              for j in range(i, n):
+     *                  b[k++] = a[i, j]
+     *
+     * @param Uplo Specifies whether the upper or lower triangular part is to be supplied in the packed form.
+     * @param alpha The scalar alpha.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F64}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     * @param Ap The input allocation contains matrix A, supported elements type {@link Element#F64}.
+     */
     public void DSPR(@Uplo int Uplo, double alpha, Allocation X, int incX, Allocation Ap) {
         int N = validateSPR(Element.F64(mRS), Uplo, X, incX, Ap);
         mRS.nScriptIntrinsicBLAS_Double(getID(mRS), RsBlas_dspr, 0, 0, 0, Uplo, 0, 0, N, 0, alpha, X.getID(mRS), Ap.getID(mRS), 0.f, 0, incX, 0, 0, 0);
     }
+
+    /**
+     * DSYR2 performs the symmetric rank 2 operation
+     * A := alpha*x*y**T + alpha*y*x**T + A
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/de/d41/dsyr2_8f.html
+     *
+     * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
+     * @param alpha The scalar alpha.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F64}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     * @param Y The input allocation contains vector y, supported elements type {@link Element#F64}.
+     * @param incY The increment for the elements of vector y, must be larger than zero.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F64}.
+     */
     public void DSYR2(@Uplo int Uplo, double alpha, Allocation X, int incX, Allocation Y, int incY, Allocation A) {
         int N = validateSYR2(Element.F64(mRS), Uplo, X, incX, Y, incY, A);
         mRS.nScriptIntrinsicBLAS_Double(getID(mRS), RsBlas_dsyr2, 0, 0, 0, Uplo, 0, 0, N, 0, alpha, X.getID(mRS), Y.getID(mRS), 0, A.getID(mRS), incX, incY, 0, 0);
     }
+
+    /**
+     * DSPR2 performs the symmetric rank 2 operation
+     * A := alpha*x*y**T + alpha*y*x**T + A
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/dd/d9e/dspr2_8f.html
+     *
+     * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
+     *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
+     *       'a' to packed matrix 'b'.
+     *           k = 0
+     *           for i in range(0, n):
+     *              for j in range(i, n):
+     *                  b[k++] = a[i, j]
+     *
+     * @param Uplo Specifies whether the upper or lower triangular part is to be supplied in the packed form.
+     * @param alpha The scalar alpha.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F64}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     * @param Y The input allocation contains vector y, supported elements type {@link Element#F64}.
+     * @param incY The increment for the elements of vector y, must be larger than zero.
+     * @param Ap The input allocation contains matrix A, supported elements type {@link Element#F64}.
+     */
     public void DSPR2(@Uplo int Uplo, double alpha, Allocation X, int incX, Allocation Y, int incY, Allocation Ap) {
         int N = validateSPR2(Element.F64(mRS), Uplo, X, incX, Y, incY, Ap);
         mRS.nScriptIntrinsicBLAS_Double(getID(mRS), RsBlas_dspr2, 0, 0, 0, Uplo, 0, 0, N, 0, alpha, X.getID(mRS), Y.getID(mRS), 0, Ap.getID(mRS), incX, incY, 0, 0);
@@ -876,11 +1821,50 @@
 
     }
 
+    /**
+     * CHEMV performs the matrix-vector operation
+     * y := alpha*A*x + beta*y
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d7/d51/chemv_8f.html
+     *
+     * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
+     * @param alpha The scalar alpha.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F32_2}.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F32_2}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     * @param beta The scalar beta.
+     * @param Y The input allocation contains vector y, supported elements type {@link Element#F32_2}.
+     * @param incY The increment for the elements of vector y, must be larger than zero.
+     */
     public void CHEMV(@Uplo int Uplo, Float2 alpha, Allocation A, Allocation X, int incX, Float2 beta, Allocation Y, int incY) {
         // HEMV is the same as SYR2 validation-wise
         int N = validateSYR2(Element.F32_2(mRS), Uplo, X, incX, Y, incY, A);
         mRS.nScriptIntrinsicBLAS_Complex(getID(mRS), RsBlas_chemv, 0, 0, 0, Uplo, 0, 0, N, 0, alpha.x, alpha.y, A.getID(mRS), X.getID(mRS), beta.x, beta.y, Y.getID(mRS), incX, incY, 0, 0);
     }
+
+    /**
+     * CHBMV performs the matrix-vector operation
+     * y := alpha*A*x + beta*y
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/db/dc2/chbmv_8f.html
+     *
+     * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N),
+     *       but only the region N*(K+1) will be referenced. The following subroutine can is an
+     *       example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'.
+     *           for i in range(0, n):
+     *              for j in range(i, min(i+k+1, n)):
+     *                  b[i, j-i] = a[i, j]
+     *
+     * @param Uplo Specifies whether the upper or lower triangular part of the band matrix A is being supplied.
+     * @param K The number of off-diagonals of the matrix A
+     * @param alpha The scalar alpha.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F32_2}.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F32_2}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     * @param beta The scalar beta.
+     * @param Y The input allocation contains vector y, supported elements type {@link Element#F32_2}.
+     * @param incY The increment for the elements of vector y, must be larger than zero.
+     */
     public void CHBMV(@Uplo int Uplo, int K, Float2 alpha, Allocation A, Allocation X, int incX, Float2 beta, Allocation Y, int incY) {
         // HBMV is the same as SYR2 validation-wise
         int N = validateSYR2(Element.F32_2(mRS), Uplo, X, incX, Y, incY, A);
@@ -889,17 +1873,69 @@
         }
         mRS.nScriptIntrinsicBLAS_Complex(getID(mRS), RsBlas_chbmv, 0, 0, 0, Uplo, 0, 0, N, K, alpha.x, alpha.y, A.getID(mRS), X.getID(mRS), beta.x, beta.y, Y.getID(mRS), incX, incY, 0, 0);
     }
+
+    /**
+     * CHPMV performs the matrix-vector operation
+     * y := alpha*A*x + beta*y
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d2/d06/chpmv_8f.html
+     *
+     * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
+     *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
+     *       'a' to packed matrix 'b'.
+     *           k = 0
+     *           for i in range(0, n):
+     *              for j in range(i, n):
+     *                  b[k++] = a[i, j]
+     *
+     * @param Uplo Specifies whether the upper or lower triangular part of the matrix A is supplied in packed form.
+     * @param alpha The scalar alpha.
+     * @param Ap The input allocation contains matrix A, supported elements type {@link Element#F32_2}.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F32_2}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     * @param beta The scalar beta.
+     * @param Y The input allocation contains vector y, supported elements type {@link Element#F32_2}.
+     * @param incY The increment for the elements of vector y, must be larger than zero.
+     */
     public void CHPMV(@Uplo int Uplo, Float2 alpha, Allocation Ap, Allocation X, int incX, Float2 beta, Allocation Y, int incY) {
         // HPMV is the same as SPR2
         int N = validateSPR2(Element.F32_2(mRS), Uplo, X, incX, Y, incY, Ap);
         mRS.nScriptIntrinsicBLAS_Complex(getID(mRS), RsBlas_chpmv, 0, 0, 0, Uplo, 0, 0, N, 0, alpha.x, alpha.y, Ap.getID(mRS), X.getID(mRS), beta.x, beta.y, Y.getID(mRS), incX, incY, 0, 0);
     }
+
+    /**
+     * CGERU performs the rank 1 operation
+     * A := alpha*x*y**T + A
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/db/d5f/cgeru_8f.html
+     *
+     * @param alpha The scalar alpha.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F32_2}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     * @param Y The input allocation contains vector y, supported elements type {@link Element#F32_2}.
+     * @param incY The increment for the elements of vector y, must be larger than zero.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F32_2}.
+     */
     public void CGERU(Float2 alpha, Allocation X, int incX, Allocation Y, int incY, Allocation A) {
         validateGERU(Element.F32_2(mRS), X, incX, Y, incY, A);
         int M = A.getType().getY();
         int N = A.getType().getX();
         mRS.nScriptIntrinsicBLAS_Complex(getID(mRS), RsBlas_cgeru, 0, 0, 0, 0, 0, M, N, 0, alpha.x, alpha.y, X.getID(mRS), Y.getID(mRS), 0, 0, A.getID(mRS), incX, incY, 0, 0);
     }
+
+    /**
+     * CGERC performs the rank 1 operation
+     * A := alpha*x*y**H + A
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/dd/d84/cgerc_8f.html
+     *
+     * @param alpha The scalar alpha.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F32_2}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     * @param Y The input allocation contains vector y, supported elements type {@link Element#F32_2}.
+     * @param incY The increment for the elements of vector y, must be larger than zero.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F32_2}.
+     */
     public void CGERC(Float2 alpha, Allocation X, int incX, Allocation Y, int incY, Allocation A) {
         // same as GERU
         validateGERU(Element.F32_2(mRS), X, incX, Y, incY, A);
@@ -907,31 +1943,143 @@
         int N = A.getType().getX();
         mRS.nScriptIntrinsicBLAS_Complex(getID(mRS), RsBlas_cgerc, 0, 0, 0, 0, 0, M, N, 0, alpha.x, alpha.y, X.getID(mRS), Y.getID(mRS), 0, 0, A.getID(mRS), incX, incY, 0, 0);
     }
+
+    /**
+     * CHER performs the rank 1 operation
+     * A := alpha*x*x**H + A
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d3/d6d/cher_8f.html
+     *
+     * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
+     * @param alpha The scalar alpha.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F32_2}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F32_2}.
+     */
     public void CHER(@Uplo int Uplo, float alpha, Allocation X, int incX, Allocation A) {
         // same as SYR
         int N = validateSYR(Element.F32_2(mRS), Uplo, X, incX, A);
         mRS.nScriptIntrinsicBLAS_Complex(getID(mRS), RsBlas_cher, 0, 0, 0, Uplo, 0, 0, N, 0, alpha, 0, X.getID(mRS), 0, 0, 0, A.getID(mRS), incX, 0, 0, 0);
     }
+
+    /**
+     * CHPR performs the rank 1 operation
+     * A := alpha*x*x**H + A
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/db/dcd/chpr_8f.html
+     *
+     * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
+     *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
+     *       'a' to packed matrix 'b'.
+     *           k = 0
+     *           for i in range(0, n):
+     *              for j in range(i, n):
+     *                  b[k++] = a[i, j]
+     *
+     * @param Uplo Specifies whether the upper or lower triangular part is to be supplied in the packed form.
+     * @param alpha The scalar alpha.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F32_2}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     * @param Ap The input allocation contains matrix A, supported elements type {@link Element#F32_2}.
+     */
     public void CHPR(@Uplo int Uplo, float alpha, Allocation X, int incX, Allocation Ap) {
         // equivalent to SPR for validation
         int N = validateSPR(Element.F32_2(mRS), Uplo, X, incX, Ap);
         mRS.nScriptIntrinsicBLAS_Complex(getID(mRS), RsBlas_chpr, 0, 0, 0, Uplo, 0, 0, N, 0, alpha, 0, X.getID(mRS), 0, 0, 0, Ap.getID(mRS), incX, 0, 0, 0);
     }
+
+    /**
+     * CHER2 performs the symmetric rank 2 operation
+     * A := alpha*x*y**H + alpha*y*x**H + A
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/db/d87/cher2_8f.html
+     *
+     * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
+     * @param alpha The scalar alpha.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F32_2}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     * @param Y The input allocation contains vector y, supported elements type {@link Element#F32_2}.
+     * @param incY The increment for the elements of vector y, must be larger than zero.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F32_2}.
+     */
     public void CHER2(@Uplo int Uplo, Float2 alpha, Allocation X, int incX, Allocation Y, int incY, Allocation A) {
         // same as SYR2
         int N = validateSYR2(Element.F32_2(mRS), Uplo, X, incX, Y, incY, A);
         mRS.nScriptIntrinsicBLAS_Complex(getID(mRS), RsBlas_cher2, 0, 0, 0, Uplo, 0, 0, N, 0, alpha.x, alpha.y, X.getID(mRS), Y.getID(mRS), 0, 0, A.getID(mRS), incX, incY, 0, 0);
     }
+
+    /**
+     * CHPR2 performs the symmetric rank 2 operation
+     * A := alpha*x*y**H + alpha*y*x**H + A
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d6/d44/chpr2_8f.html
+     *
+     * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
+     *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
+     *       'a' to packed matrix 'b'.
+     *           k = 0
+     *           for i in range(0, n):
+     *              for j in range(i, n):
+     *                  b[k++] = a[i, j]
+     *
+     * @param Uplo Specifies whether the upper or lower triangular part is to be supplied in the packed form.
+     * @param alpha The scalar alpha.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F32_2}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     * @param Y The input allocation contains vector y, supported elements type {@link Element#F32_2}.
+     * @param incY The increment for the elements of vector y, must be larger than zero.
+     * @param Ap The input allocation contains matrix A, supported elements type {@link Element#F32_2}.
+     */
     public void CHPR2(@Uplo int Uplo, Float2 alpha, Allocation X, int incX, Allocation Y, int incY, Allocation Ap) {
         // same as SPR2
         int N = validateSPR2(Element.F32_2(mRS), Uplo, X, incX, Y, incY, Ap);
         mRS.nScriptIntrinsicBLAS_Complex(getID(mRS), RsBlas_chpr2, 0, 0, 0, Uplo, 0, 0, N, 0, alpha.x, alpha.y, X.getID(mRS), Y.getID(mRS), 0, 0, Ap.getID(mRS), incX, incY, 0, 0);
     }
+
+    /**
+     * ZHEMV performs the matrix-vector operation
+     * y := alpha*A*x + beta*y
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d0/ddd/zhemv_8f.html
+     *
+     * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
+     * @param alpha The scalar alpha.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F64_2}.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F64_2}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     * @param beta The scalar beta.
+     * @param Y The input allocation contains vector y, supported elements type {@link Element#F64_2}.
+     * @param incY The increment for the elements of vector y, must be larger than zero.
+     */
     public void ZHEMV(@Uplo int Uplo, Double2 alpha, Allocation A, Allocation X, int incX, Double2 beta, Allocation Y, int incY) {
         // HEMV is the same as SYR2 validation-wise
         int N = validateSYR2(Element.F64_2(mRS), Uplo, X, incX, Y, incY, A);
         mRS.nScriptIntrinsicBLAS_Z(getID(mRS), RsBlas_zhemv, 0, 0, 0, Uplo, 0, 0, N, 0, alpha.x, alpha.y, A.getID(mRS), X.getID(mRS), beta.x, beta.y, Y.getID(mRS), incX, incY, 0, 0);
     }
+
+    /**
+     * ZHBMV performs the matrix-vector operation
+     * y := alpha*A*x + beta*y
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d3/d1a/zhbmv_8f.html
+     *
+     * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N),
+     *       but only the region N*(K+1) will be referenced. The following subroutine can is an
+     *       example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'.
+     *           for i in range(0, n):
+     *              for j in range(i, min(i+k+1, n)):
+     *                  b[i, j-i] = a[i, j]
+     *
+     * @param Uplo Specifies whether the upper or lower triangular part of the band matrix A is being supplied.
+     * @param K The number of off-diagonals of the matrix A
+     * @param alpha The scalar alpha.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F64_2}.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F64_2}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     * @param beta The scalar beta.
+     * @param Y The input allocation contains vector y, supported elements type {@link Element#F64_2}.
+     * @param incY The increment for the elements of vector y, must be larger than zero.
+     */
     public void ZHBMV(@Uplo int Uplo, int K, Double2 alpha, Allocation A, Allocation X, int incX, Double2 beta, Allocation Y, int incY) {
         // HBMV is the same as SYR2 validation-wise
         int N = validateSYR2(Element.F64_2(mRS), Uplo, X, incX, Y, incY, A);
@@ -940,17 +2088,69 @@
         }
         mRS.nScriptIntrinsicBLAS_Z(getID(mRS), RsBlas_zhbmv, 0, 0, 0, Uplo, 0, 0, N, K, alpha.x, alpha.y, A.getID(mRS), X.getID(mRS), beta.x, beta.y, Y.getID(mRS), incX, incY, 0, 0);
     }
+
+    /**
+     * ZHPMV performs the matrix-vector operation
+     * y := alpha*A*x + beta*y
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d0/d60/zhpmv_8f.html
+     *
+     * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
+     *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
+     *       'a' to packed matrix 'b'.
+     *           k = 0
+     *           for i in range(0, n):
+     *              for j in range(i, n):
+     *                  b[k++] = a[i, j]
+     *
+     * @param Uplo Specifies whether the upper or lower triangular part of the matrix A is supplied in packed form.
+     * @param alpha The scalar alpha.
+     * @param Ap The input allocation contains matrix A, supported elements type {@link Element#F64_2}.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F64_2}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     * @param beta The scalar beta.
+     * @param Y The input allocation contains vector y, supported elements type {@link Element#F64_2}.
+     * @param incY The increment for the elements of vector y, must be larger than zero.
+     */
     public void ZHPMV(@Uplo int Uplo, Double2 alpha, Allocation Ap, Allocation X, int incX, Double2 beta, Allocation Y, int incY) {
         // HPMV is the same as SPR2
         int N = validateSPR2(Element.F64_2(mRS), Uplo, X, incX, Y, incY, Ap);
         mRS.nScriptIntrinsicBLAS_Z(getID(mRS), RsBlas_zhpmv, 0, 0, 0, Uplo, 0, 0, N, 0, alpha.x, alpha.y, Ap.getID(mRS), X.getID(mRS), beta.x, beta.y, Y.getID(mRS), incX, incY, 0, 0);
     }
+
+    /**
+     * ZGERU performs the rank 1 operation
+     * A := alpha*x*y**T + A
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d7/d12/zgeru_8f.html
+     *
+     * @param alpha The scalar alpha.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F64_2}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     * @param Y The input allocation contains vector y, supported elements type {@link Element#F64_2}.
+     * @param incY The increment for the elements of vector y, must be larger than zero.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F64_2}.
+     */
     public void ZGERU(Double2 alpha, Allocation X, int incX, Allocation Y, int incY, Allocation A) {
         validateGERU(Element.F64_2(mRS), X, incX, Y, incY, A);
         int M = A.getType().getY();
         int N = A.getType().getX();
         mRS.nScriptIntrinsicBLAS_Z(getID(mRS), RsBlas_zgeru, 0, 0, 0, 0, 0, M, N, 0, alpha.x, alpha.y, X.getID(mRS), Y.getID(mRS), 0, 0, A.getID(mRS), incX, incY, 0, 0);
     }
+
+    /**
+     * ZGERC performs the rank 1 operation
+     * A := alpha*x*y**H + A
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d3/dad/zgerc_8f.html
+     *
+     * @param alpha The scalar alpha.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F64_2}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     * @param Y The input allocation contains vector y, supported elements type {@link Element#F64_2}.
+     * @param incY The increment for the elements of vector y, must be larger than zero.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F64_2}.
+     */
     public void ZGERC(Double2 alpha, Allocation X, int incX, Allocation Y, int incY, Allocation A) {
         // same as GERU
         validateGERU(Element.F64_2(mRS), X, incX, Y, incY, A);
@@ -958,21 +2158,93 @@
         int N = A.getType().getX();
         mRS.nScriptIntrinsicBLAS_Z(getID(mRS), RsBlas_zgerc, 0, 0, 0, 0, 0, M, N, 0, alpha.x, alpha.y, X.getID(mRS), Y.getID(mRS), 0, 0, A.getID(mRS), incX, incY, 0, 0);
     }
+
+    /**
+     * ZHER performs the rank 1 operation
+     * A := alpha*x*x**H + A
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/de/d0e/zher_8f.html
+     *
+     * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
+     * @param alpha The scalar alpha.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F64_2}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F64_2}.
+     */
     public void ZHER(@Uplo int Uplo, double alpha, Allocation X, int incX, Allocation A) {
         // same as SYR
         int N = validateSYR(Element.F64_2(mRS), Uplo, X, incX, A);
         mRS.nScriptIntrinsicBLAS_Z(getID(mRS), RsBlas_zher, 0, 0, 0, Uplo, 0, 0, N, 0, alpha, 0, X.getID(mRS), 0, 0, 0, A.getID(mRS), incX, 0, 0, 0);
     }
+
+    /**
+     * ZHPR performs the rank 1 operation
+     * A := alpha*x*x**H + A
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/de/de1/zhpr_8f.html
+     *
+     * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
+     *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
+     *       'a' to packed matrix 'b'.
+     *           k = 0
+     *           for i in range(0, n):
+     *              for j in range(i, n):
+     *                  b[k++] = a[i, j]
+     *
+     * @param Uplo Specifies whether the upper or lower triangular part is to be supplied in the packed form.
+     * @param alpha The scalar alpha.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F64_2}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     * @param Ap The input allocation contains matrix A, supported elements type {@link Element#F64_2}.
+     */
     public void ZHPR(@Uplo int Uplo, double alpha, Allocation X, int incX, Allocation Ap) {
         // equivalent to SPR for validation
         int N = validateSPR(Element.F64_2(mRS), Uplo, X, incX, Ap);
         mRS.nScriptIntrinsicBLAS_Z(getID(mRS), RsBlas_zhpr, 0, 0, 0, Uplo, 0, 0, N, 0, alpha, 0, X.getID(mRS), 0, 0, 0, Ap.getID(mRS), incX, 0, 0, 0);
     }
+
+    /**
+     * ZHER2 performs the symmetric rank 2 operation
+     * A := alpha*x*y**H + alpha*y*x**H + A
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/da/d8a/zher2_8f.html
+     *
+     * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
+     * @param alpha The scalar alpha.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F64_2}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     * @param Y The input allocation contains vector y, supported elements type {@link Element#F64_2}.
+     * @param incY The increment for the elements of vector y, must be larger than zero.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F64_2}.
+     */
     public void ZHER2(@Uplo int Uplo, Double2 alpha, Allocation X, int incX, Allocation Y, int incY, Allocation A) {
         // same as SYR2
         int N = validateSYR2(Element.F64_2(mRS), Uplo, X, incX, Y, incY, A);
         mRS.nScriptIntrinsicBLAS_Z(getID(mRS), RsBlas_zher2, 0, 0, 0, Uplo, 0, 0, N, 0, alpha.x, alpha.y, X.getID(mRS), Y.getID(mRS), 0, 0, A.getID(mRS), incX, incY, 0, 0);
     }
+
+    /**
+     * ZHPR2 performs the symmetric rank 2 operation
+     * A := alpha*x*y**H + alpha*y*x**H + A
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d5/d52/zhpr2_8f.html
+     *
+     * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
+     *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
+     *       'a' to packed matrix 'b'.
+     *           k = 0
+     *           for i in range(0, n):
+     *              for j in range(i, n):
+     *                  b[k++] = a[i, j]
+     *
+     * @param Uplo Specifies whether the upper or lower triangular part is to be supplied in the packed form.
+     * @param alpha The scalar alpha.
+     * @param X The input allocation contains vector x, supported elements type {@link Element#F64_2}.
+     * @param incX The increment for the elements of vector x, must be larger than zero.
+     * @param Y The input allocation contains vector y, supported elements type {@link Element#F64_2}.
+     * @param incY The increment for the elements of vector y, must be larger than zero.
+     * @param Ap The input allocation contains matrix A, supported elements type {@link Element#F64_2}.
+     */
     public void ZHPR2(@Uplo int Uplo, Double2 alpha, Allocation X, int incX, Allocation Y, int incY, Allocation Ap) {
         // same as SPR2
         int N = validateSPR2(Element.F64_2(mRS), Uplo, X, incX, Y, incY, Ap);
@@ -1051,6 +2323,20 @@
 
     }
 
+    /**
+     * SGEMM performs one of the matrix-matrix operations
+     * C := alpha*op(A)*op(B) + beta*C   where op(X) is one of op(X) = X  or  op(X) = X**T
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d4/de2/sgemm_8f.html
+     *
+     * @param TransA The type of transpose applied to matrix A.
+     * @param TransB The type of transpose applied to matrix B.
+     * @param alpha The scalar alpha.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F32}.
+     * @param B The input allocation contains matrix B, supported elements type {@link Element#F32}.
+     * @param beta The scalar beta.
+     * @param C The input allocation contains matrix C, supported elements type {@link Element#F32}.
+     */
     public void SGEMM(@Transpose int TransA, @Transpose int TransB, float alpha, Allocation A,
                       Allocation B, float beta, Allocation C) {
         validateTranspose(TransA);
@@ -1073,6 +2359,21 @@
         mRS.nScriptIntrinsicBLAS_Single(getID(mRS), RsBlas_sgemm, TransA, TransB, 0, 0, 0, M, N, K,  alpha, A.getID(mRS), B.getID(mRS),
                                         beta, C.getID(mRS), 0, 0, 0, 0);
     }
+
+    /**
+     * DGEMM performs one of the matrix-matrix operations
+     * C := alpha*op(A)*op(B) + beta*C   where op(X) is one of op(X) = X  or  op(X) = X**T
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d7/d2b/dgemm_8f.html
+     *
+     * @param TransA The type of transpose applied to matrix A.
+     * @param TransB The type of transpose applied to matrix B.
+     * @param alpha The scalar alpha.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F64}.
+     * @param B The input allocation contains matrix B, supported elements type {@link Element#F64}.
+     * @param beta The scalar beta.
+     * @param C The input allocation contains matrix C, supported elements type {@link Element#F64}.
+     */
     public void DGEMM(@Transpose int TransA, @Transpose int TransB, double alpha, Allocation A,
                       Allocation B, double beta, Allocation C) {
         validateTranspose(TransA);
@@ -1094,6 +2395,21 @@
         mRS.nScriptIntrinsicBLAS_Double(getID(mRS), RsBlas_dgemm, TransA, TransB, 0, 0, 0, M, N, K,  alpha, A.getID(mRS), B.getID(mRS),
                                         beta, C.getID(mRS), 0, 0, 0, 0);
     }
+
+    /**
+     * CGEMM performs one of the matrix-matrix operations
+     * C := alpha*op(A)*op(B) + beta*C   where op(X) is one of op(X) = X  or  op(X) = X**T  or  op(X) = X**H
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d6/d5b/cgemm_8f.html
+     *
+     * @param TransA The type of transpose applied to matrix A.
+     * @param TransB The type of transpose applied to matrix B.
+     * @param alpha The scalar alpha.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F32_2}.
+     * @param B The input allocation contains matrix B, supported elements type {@link Element#F32_2}.
+     * @param beta The scalar beta.
+     * @param C The input allocation contains matrix C, supported elements type {@link Element#F32_2}.
+     */
     public void CGEMM(@Transpose int TransA, @Transpose int TransB, Float2 alpha, Allocation A,
                       Allocation B, Float2 beta, Allocation C) {
         validateTranspose(TransA);
@@ -1116,6 +2432,20 @@
                                          beta.x, beta.y, C.getID(mRS), 0, 0, 0, 0);
     }
 
+    /**
+     * ZGEMM performs one of the matrix-matrix operations
+     * C := alpha*op(A)*op(B) + beta*C   where op(X) is one of op(X) = X  or  op(X) = X**T  or  op(X) = X**H
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d7/d76/zgemm_8f.html
+     *
+     * @param TransA The type of transpose applied to matrix A.
+     * @param TransB The type of transpose applied to matrix B.
+     * @param alpha The scalar alpha.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F64_2
+     * @param B The input allocation contains matrix B, supported elements type {@link Element#F64_2
+     * @param beta The scalar beta.
+     * @param C The input allocation contains matrix C, supported elements type {@link Element#F64_2
+     */
     public void ZGEMM(@Transpose int TransA, @Transpose int TransB, Double2 alpha, Allocation A,
                       Allocation B, Double2 beta, Allocation C) {
         validateTranspose(TransA);
@@ -1138,6 +2468,20 @@
                                    beta.x, beta.y, C.getID(mRS), 0, 0, 0, 0);
     }
 
+    /**
+     * SSYMM performs one of the matrix-matrix operations
+     * C := alpha*A*B + beta*C   or   C := alpha*B*A + beta*C
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d7/d42/ssymm_8f.html
+     *
+     * @param Side Specifies whether the symmetric matrix A appears on the left or right.
+     * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
+     * @param alpha The scalar alpha.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F32}.
+     * @param B The input allocation contains matrix B, supported elements type {@link Element#F32}.
+     * @param beta The scalar beta.
+     * @param C The input allocation contains matrix C, supported elements type {@link Element#F32}.
+     */
     public void SSYMM(@Side int Side, @Uplo int Uplo, float alpha, Allocation A,
                       Allocation B, float beta, Allocation C) {
         validateSide(Side);
@@ -1150,6 +2494,21 @@
         mRS.nScriptIntrinsicBLAS_Single(getID(mRS), RsBlas_ssymm, 0, 0, Side, Uplo, 0, C.getType().getY(), C.getType().getX(), 0, alpha, A.getID(mRS), B.getID(mRS),
                                         beta, C.getID(mRS), 0, 0, 0, 0);
     }
+
+    /**
+     * DSYMM performs one of the matrix-matrix operations
+     * C := alpha*A*B + beta*C   or   C := alpha*B*A + beta*C
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d8/db0/dsymm_8f.html
+     *
+     * @param Side Specifies whether the symmetric matrix A appears on the left or right.
+     * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
+     * @param alpha The scalar alpha.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F64}.
+     * @param B The input allocation contains matrix B, supported elements type {@link Element#F64}.
+     * @param beta The scalar beta.
+     * @param C The input allocation contains matrix C, supported elements type {@link Element#F64}.
+     */
     public void DSYMM(@Side int Side, @Uplo int Uplo, double alpha, Allocation A,
                       Allocation B, double beta, Allocation C) {
         validateSide(Side);
@@ -1161,6 +2520,21 @@
         mRS.nScriptIntrinsicBLAS_Double(getID(mRS), RsBlas_dsymm, 0, 0, Side, Uplo, 0, C.getType().getY(), C.getType().getX(), 0, alpha, A.getID(mRS), B.getID(mRS),
                                         beta, C.getID(mRS), 0, 0, 0, 0);
     }
+
+    /**
+     * CSYMM performs one of the matrix-matrix operations
+     * C := alpha*A*B + beta*C   or   C := alpha*B*A + beta*C
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/db/d59/csymm_8f.html
+     *
+     * @param Side Specifies whether the symmetric matrix A appears on the left or right.
+     * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
+     * @param alpha The scalar alpha.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F32_2}.
+     * @param B The input allocation contains matrix B, supported elements type {@link Element#F32_2}.
+     * @param beta The scalar beta.
+     * @param C The input allocation contains matrix C, supported elements type {@link Element#F32_2}.
+     */
     public void CSYMM(@Side int Side, @Uplo int Uplo, Float2 alpha, Allocation A,
                       Allocation B, Float2 beta, Allocation C) {
         validateSide(Side);
@@ -1172,6 +2546,21 @@
         mRS.nScriptIntrinsicBLAS_Complex(getID(mRS), RsBlas_csymm, 0, 0, Side, Uplo, 0, C.getType().getY(), C.getType().getX(), 0, alpha.x, alpha.y, A.getID(mRS), B.getID(mRS),
                                          beta.x, beta.y, C.getID(mRS), 0, 0, 0, 0);
     }
+
+    /**
+     * ZSYMM performs one of the matrix-matrix operations
+     * C := alpha*A*B + beta*C   or   C := alpha*B*A + beta*C
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/df/d51/zsymm_8f.html
+     *
+     * @param Side Specifies whether the symmetric matrix A appears on the left or right.
+     * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
+     * @param alpha The scalar alpha.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F64_2}.
+     * @param B The input allocation contains matrix B, supported elements type {@link Element#F64_2}.
+     * @param beta The scalar beta.
+     * @param C The input allocation contains matrix C, supported elements type {@link Element#F64_2}.
+     */
     public void ZSYMM(@Side int Side, @Uplo int Uplo, Double2 alpha, Allocation A,
                       Allocation B, Double2 beta, Allocation C) {
         validateSide(Side);
@@ -1184,6 +2573,19 @@
                                    beta.x, beta.y, C.getID(mRS), 0, 0, 0, 0);
     }
 
+    /**
+     * SSYRK performs one of the symmetric rank k operations
+     * C := alpha*A*A**T + beta*C   or   C := alpha*A**T*A + beta*C
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d0/d40/ssyrk_8f.html
+     *
+     * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced.
+     * @param Trans The type of transpose applied to the operation.
+     * @param alpha The scalar alpha.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F32}.
+     * @param beta The scalar beta.
+     * @param C The input allocation contains matrix C, supported elements type {@link Element#F32}.
+     */
     public void SSYRK(@Uplo int Uplo, @Transpose int Trans, float alpha, Allocation A, float beta, Allocation C) {
         validateTranspose(Trans);
         validateUplo(Uplo);
@@ -1198,6 +2600,19 @@
         mRS.nScriptIntrinsicBLAS_Single(getID(mRS), RsBlas_ssyrk, Trans, 0, 0, Uplo, 0, 0, C.getType().getX(), K, alpha, A.getID(mRS), 0, beta, C.getID(mRS), 0, 0, 0, 0);
     }
 
+    /**
+     * DSYRK performs one of the symmetric rank k operations
+     * C := alpha*A*A**T + beta*C   or   C := alpha*A**T*A + beta*C
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/dc/d05/dsyrk_8f.html
+     *
+     * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced.
+     * @param Trans The type of transpose applied to the operation.
+     * @param alpha The scalar alpha.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F64}.
+     * @param beta The scalar beta.
+     * @param C The input allocation contains matrix C, supported elements type {@link Element#F64}.
+     */
     public void DSYRK(@Uplo int Uplo, @Transpose int Trans, double alpha, Allocation A, double beta, Allocation C) {
         validateTranspose(Trans);
         validateUplo(Uplo);
@@ -1210,6 +2625,20 @@
         }
         mRS.nScriptIntrinsicBLAS_Double(getID(mRS), RsBlas_dsyrk, Trans, 0, 0, Uplo, 0, 0, C.getType().getX(), K, alpha, A.getID(mRS), 0, beta, C.getID(mRS), 0, 0, 0, 0);
     }
+
+    /**
+     * CSYRK performs one of the symmetric rank k operations
+     * C := alpha*A*A**T + beta*C   or   C := alpha*A**T*A + beta*C
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d3/d6a/csyrk_8f.html
+     *
+     * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced.
+     * @param Trans The type of transpose applied to the operation.
+     * @param alpha The scalar alpha.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F32_2}.
+     * @param beta The scalar beta.
+     * @param C The input allocation contains matrix C, supported elements type {@link Element#F32_2}.
+     */
     public void CSYRK(@Uplo int Uplo, @Transpose int Trans, Float2 alpha, Allocation A, Float2 beta, Allocation C) {
         validateTranspose(Trans);
         validateUplo(Uplo);
@@ -1223,6 +2652,20 @@
         mRS.nScriptIntrinsicBLAS_Complex(getID(mRS), RsBlas_csyrk, Trans, 0, 0, Uplo, 0, 0, C.getType().getX(), K, alpha.x, alpha.y, A.getID(mRS), 0, beta.x, beta.y,
                                          C.getID(mRS), 0, 0, 0, 0);
     }
+
+    /**
+     * ZSYRK performs one of the symmetric rank k operations
+     * C := alpha*A*A**T + beta*C   or   C := alpha*A**T*A + beta*C
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/de/d54/zsyrk_8f.html
+     *
+     * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced.
+     * @param Trans The type of transpose applied to the operation.
+     * @param alpha The scalar alpha.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F64_2}.
+     * @param beta The scalar beta.
+     * @param C The input allocation contains matrix C, supported elements type {@link Element#F64_2}.
+     */
     public void ZSYRK(@Uplo int Uplo, @Transpose int Trans, Double2 alpha, Allocation A, Double2 beta, Allocation C) {
         validateTranspose(Trans);
         validateUplo(Uplo);
@@ -1262,6 +2705,21 @@
             throw new RSRuntimeException("Invalid A and B in SYR2K");
         }
     }
+
+    /**
+     * SSYR2K performs one of the symmetric rank 2k operations
+     * C := alpha*A*B**T + alpha*B*A**T + beta*C   or   C := alpha*A**T*B + alpha*B**T*A + beta*C
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/df/d3d/ssyr2k_8f.html
+     *
+     * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced.
+     * @param Trans The type of transpose applied to the operation.
+     * @param alpha The scalar alpha.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F32}.
+     * @param B The input allocation contains matrix B, supported elements type {@link Element#F32}.
+     * @param beta The scalar beta.
+     * @param C The input allocation contains matrix C, supported elements type {@link Element#F32}.
+     */
     public void SSYR2K(@Uplo int Uplo, @Transpose int Trans, float alpha, Allocation A, Allocation B, float beta, Allocation C) {
         validateUplo(Uplo);
         validateSYR2K(Element.F32(mRS), Trans, A, B, C);
@@ -1273,6 +2731,21 @@
         }
         mRS.nScriptIntrinsicBLAS_Single(getID(mRS), RsBlas_ssyr2k, Trans, 0, 0, Uplo, 0, 0, C.getType().getX(), K, alpha, A.getID(mRS), B.getID(mRS), beta, C.getID(mRS), 0, 0, 0, 0);
     }
+
+    /**
+     * DSYR2K performs one of the symmetric rank 2k operations
+     * C := alpha*A*B**T + alpha*B*A**T + beta*C   or   C := alpha*A**T*B + alpha*B**T*A + beta*C
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d1/dec/dsyr2k_8f.html
+     *
+     * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced.
+     * @param Trans The type of transpose applied to the operation.
+     * @param alpha The scalar alpha.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F64}.
+     * @param B The input allocation contains matrix B, supported elements type {@link Element#F64}.
+     * @param beta The scalar beta.
+     * @param C The input allocation contains matrix C, supported elements type {@link Element#F64}.
+     */
     public void DSYR2K(@Uplo int Uplo, @Transpose int Trans, double alpha, Allocation A, Allocation B, double beta, Allocation C) {
         validateUplo(Uplo);
         validateSYR2K(Element.F64(mRS), Trans, A, B, C);
@@ -1284,6 +2757,21 @@
         }
         mRS.nScriptIntrinsicBLAS_Double(getID(mRS), RsBlas_dsyr2k, Trans, 0, 0, Uplo, 0, 0, C.getType().getX(), K, alpha, A.getID(mRS), B.getID(mRS), beta, C.getID(mRS), 0, 0, 0, 0);
     }
+
+    /**
+     * CSYR2K performs one of the symmetric rank 2k operations
+     * C := alpha*A*B**T + alpha*B*A**T + beta*C   or   C := alpha*A**T*B + alpha*B**T*A + beta*C
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/de/d7e/csyr2k_8f.html
+     *
+     * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced.
+     * @param Trans The type of transpose applied to the operation.
+     * @param alpha The scalar alpha.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F32_2}.
+     * @param B The input allocation contains matrix B, supported elements type {@link Element#F32_2}.
+     * @param beta The scalar beta.
+     * @param C The input allocation contains matrix C, supported elements type {@link Element#F32_2}.
+     */
     public void CSYR2K(@Uplo int Uplo, @Transpose int Trans, Float2 alpha, Allocation A, Allocation B, Float2 beta, Allocation C) {
         validateUplo(Uplo);
         validateSYR2K(Element.F32_2(mRS), Trans, A, B, C);
@@ -1295,6 +2783,21 @@
         }
         mRS.nScriptIntrinsicBLAS_Complex(getID(mRS), RsBlas_csyr2k, Trans, 0, 0, Uplo, 0, 0, C.getType().getX(), K, alpha.x, alpha.y, A.getID(mRS), B.getID(mRS), beta.x, beta.y, C.getID(mRS), 0, 0, 0, 0);
     }
+
+    /**
+     * ZSYR2K performs one of the symmetric rank 2k operations
+     * C := alpha*A*B**T + alpha*B*A**T + beta*C   or   C := alpha*A**T*B + alpha*B**T*A + beta*C
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/df/d20/zsyr2k_8f.html
+     *
+     * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced.
+     * @param Trans The type of transpose applied to the operation.
+     * @param alpha The scalar alpha.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F64_2}.
+     * @param B The input allocation contains matrix B, supported elements type {@link Element#F64_2}.
+     * @param beta The scalar beta.
+     * @param C The input allocation contains matrix C, supported elements type {@link Element#F64_2}.
+     */
     public void ZSYR2K(@Uplo int Uplo, @Transpose int Trans, Double2 alpha, Allocation A, Allocation B, Double2 beta, Allocation C) {
         validateUplo(Uplo);
         validateSYR2K(Element.F64_2(mRS), Trans, A, B, C);
@@ -1334,6 +2837,22 @@
             }
         }
     }
+
+    /**
+     * STRMM performs one of the matrix-matrix operations
+     * B := alpha*op(A)*B   or   B := alpha*B*op(A)
+     * op(A) is one of  op(A) = A  or  op(A) = A**T
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/df/d01/strmm_8f.html
+     *
+     * @param Side Specifies whether the symmetric matrix A appears on the left or right.
+     * @param Uplo Specifies whether matrix A is upper or lower triangular.
+     * @param TransA The type of transpose applied to matrix A.
+     * @param Diag Specifies whether or not A is unit triangular.
+     * @param alpha The scalar alpha.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F32}.
+     * @param B The input allocation contains matrix B, supported elements type {@link Element#F32}.
+     */
     public void STRMM(@Side int Side, @Uplo int Uplo, @Transpose int TransA, @Diag int Diag, float alpha, Allocation A, Allocation B) {
         validateUplo(Uplo);
         validateDiag(Diag);
@@ -1341,6 +2860,22 @@
         mRS.nScriptIntrinsicBLAS_Single(getID(mRS), RsBlas_strmm, TransA, 0, Side, Uplo, Diag, B.getType().getY(), B.getType().getX(), 0,
                                         alpha, A.getID(mRS), B.getID(mRS), 0.f, 0, 0, 0, 0, 0);
     }
+
+    /**
+     * DTRMM performs one of the matrix-matrix operations
+     * B := alpha*op(A)*B   or   B := alpha*B*op(A)
+     * op(A) is one of  op(A) = A  or  op(A) = A**T
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/dd/d19/dtrmm_8f.html
+     *
+     * @param Side Specifies whether the symmetric matrix A appears on the left or right.
+     * @param Uplo Specifies whether matrix A is upper or lower triangular.
+     * @param TransA The type of transpose applied to matrix A.
+     * @param Diag Specifies whether or not A is unit triangular.
+     * @param alpha The scalar alpha.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F64}.
+     * @param B The input allocation contains matrix B, supported elements type {@link Element#F64}.
+     */
     public void DTRMM(@Side int Side, @Uplo int Uplo, @Transpose int TransA, @Diag int Diag, double alpha, Allocation A, Allocation B) {
         validateUplo(Uplo);
         validateDiag(Diag);
@@ -1348,6 +2883,22 @@
         mRS.nScriptIntrinsicBLAS_Double(getID(mRS), RsBlas_dtrmm, TransA, 0, Side, Uplo, Diag, B.getType().getY(), B.getType().getX(), 0,
                                         alpha, A.getID(mRS), B.getID(mRS), 0, 0, 0, 0, 0, 0);
     }
+
+    /**
+     * CTRMM performs one of the matrix-matrix operations
+     * B := alpha*op(A)*B   or   B := alpha*B*op(A)
+     * op(A) is one of  op(A) = A  or  op(A) = A**T  or  op(A) = A**H
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d4/d9b/ctrmm_8f.html
+     *
+     * @param Side Specifies whether the symmetric matrix A appears on the left or right.
+     * @param Uplo Specifies whether matrix A is upper or lower triangular.
+     * @param TransA The type of transpose applied to matrix A.
+     * @param Diag Specifies whether or not A is unit triangular.
+     * @param alpha The scalar alpha.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F32_2}.
+     * @param B The input allocation contains matrix B, supported elements type {@link Element#F32_2}.
+     */
     public void CTRMM(@Side int Side, @Uplo int Uplo, @Transpose int TransA, @Diag int Diag, Float2 alpha, Allocation A, Allocation B) {
         validateUplo(Uplo);
         validateDiag(Diag);
@@ -1355,6 +2906,22 @@
         mRS.nScriptIntrinsicBLAS_Complex(getID(mRS), RsBlas_ctrmm, TransA, 0, Side, Uplo, Diag, B.getType().getY(), B.getType().getX(), 0,
                                          alpha.x, alpha.y, A.getID(mRS), B.getID(mRS), 0, 0, 0, 0, 0, 0, 0);
     }
+
+    /**
+     * ZTRMM performs one of the matrix-matrix operations
+     * B := alpha*op(A)*B   or   B := alpha*B*op(A)
+     * op(A) is one of  op(A) = A  or  op(A) = A**T  or  op(A) = A**H
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d8/de1/ztrmm_8f.html
+     *
+     * @param Side Specifies whether the symmetric matrix A appears on the left or right.
+     * @param Uplo Specifies whether matrix A is upper or lower triangular.
+     * @param TransA The type of transpose applied to matrix A.
+     * @param Diag Specifies whether or not A is unit triangular.
+     * @param alpha The scalar alpha.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F64_2}.
+     * @param B The input allocation contains matrix B, supported elements type {@link Element#F64_2}.
+     */
     public void ZTRMM(@Side int Side, @Uplo int Uplo, @Transpose int TransA, @Diag int Diag, Double2 alpha, Allocation A, Allocation B) {
         validateUplo(Uplo);
         validateDiag(Diag);
@@ -1392,6 +2959,22 @@
             }
         }
     }
+
+    /**
+     * STRSM solves one of the matrix equations
+     * op(A)*X := alpha*B   or   X*op(A) := alpha*B
+     * op(A) is one of  op(A) = A  or  op(A) = A**T
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d2/d8b/strsm_8f.html
+     *
+     * @param Side Specifies whether the symmetric matrix A appears on the left or right.
+     * @param Uplo Specifies whether matrix A is upper or lower triangular.
+     * @param TransA The type of transpose applied to matrix A.
+     * @param Diag Specifies whether or not A is unit triangular.
+     * @param alpha The scalar alpha.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F32}.
+     * @param B The input allocation contains matrix B, supported elements type {@link Element#F32}.
+     */
     public void STRSM(@Side int Side, @Uplo int Uplo, @Transpose int TransA, @Diag int Diag, float alpha, Allocation A, Allocation B) {
         validateUplo(Uplo);
         validateDiag(Diag);
@@ -1399,6 +2982,22 @@
         mRS.nScriptIntrinsicBLAS_Single(getID(mRS), RsBlas_strsm, TransA, 0, Side, Uplo, Diag, B.getType().getY(), B.getType().getX(), 0,
                                         alpha, A.getID(mRS), B.getID(mRS), 0, 0, 0, 0, 0, 0);
     }
+
+    /**
+     * DTRSM solves one of the matrix equations
+     * op(A)*X := alpha*B   or   X*op(A) := alpha*B
+     * op(A) is one of  op(A) = A  or  op(A) = A**T
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/de/da7/dtrsm_8f.html
+     *
+     * @param Side Specifies whether the symmetric matrix A appears on the left or right.
+     * @param Uplo Specifies whether matrix A is upper or lower triangular.
+     * @param TransA The type of transpose applied to matrix A.
+     * @param Diag Specifies whether or not A is unit triangular.
+     * @param alpha The scalar alpha.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F64}.
+     * @param B The input allocation contains matrix B, supported elements type {@link Element#F64}.
+     */
     public void DTRSM(@Side int Side, @Uplo int Uplo, @Transpose int TransA, @Diag int Diag, double alpha, Allocation A, Allocation B) {
         validateUplo(Uplo);
         validateDiag(Diag);
@@ -1406,6 +3005,22 @@
         mRS.nScriptIntrinsicBLAS_Double(getID(mRS), RsBlas_dtrsm, TransA, 0, Side, Uplo, Diag, B.getType().getY(), B.getType().getX(), 0,
                                         alpha, A.getID(mRS), B.getID(mRS), 0, 0, 0, 0, 0, 0);
     }
+
+    /**
+     * CTRSM solves one of the matrix equations
+     * op(A)*X := alpha*B   or   X*op(A) := alpha*B
+     * op(A) is one of  op(A) = A  or  op(A) = A**T  or  op(A) = A**H
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/de/d30/ctrsm_8f.html
+     *
+     * @param Side Specifies whether the symmetric matrix A appears on the left or right.
+     * @param Uplo Specifies whether matrix A is upper or lower triangular.
+     * @param TransA The type of transpose applied to matrix A.
+     * @param Diag Specifies whether or not A is unit triangular.
+     * @param alpha The scalar alpha.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F32_2}.
+     * @param B The input allocation contains matrix B, supported elements type {@link Element#F32_2}.
+     */
     public void CTRSM(@Side int Side, @Uplo int Uplo, @Transpose int TransA, @Diag int Diag, Float2 alpha, Allocation A, Allocation B) {
         validateUplo(Uplo);
         validateDiag(Diag);
@@ -1413,6 +3028,22 @@
         mRS.nScriptIntrinsicBLAS_Complex(getID(mRS), RsBlas_ctrsm, TransA, 0, Side, Uplo, Diag, B.getType().getY(), B.getType().getX(), 0,
                                          alpha.x, alpha.y, A.getID(mRS), B.getID(mRS), 0, 0, 0, 0, 0, 0, 0);
     }
+
+    /**
+     * ZTRSM solves one of the matrix equations
+     * op(A)*X := alpha*B   or   X*op(A) := alpha*B
+     * op(A) is one of  op(A) = A  or  op(A) = A**T  or  op(A) = A**H
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d1/d39/ztrsm_8f.html
+     *
+     * @param Side Specifies whether the symmetric matrix A appears on the left or right.
+     * @param Uplo Specifies whether matrix A is upper or lower triangular.
+     * @param TransA The type of transpose applied to matrix A.
+     * @param Diag Specifies whether or not A is unit triangular.
+     * @param alpha The scalar alpha.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F64_2}.
+     * @param B The input allocation contains matrix B, supported elements type {@link Element#F64_2}.
+     */
     public void ZTRSM(@Side int Side, @Uplo int Uplo, @Transpose int TransA, @Diag int Diag, Double2 alpha, Allocation A, Allocation B) {
         validateUplo(Uplo);
         validateDiag(Diag);
@@ -1444,12 +3075,42 @@
             throw new RSRuntimeException("Called HEMM with mismatched B and C");
         }
     }
+
+    /**
+     * CHEMM performs one of the matrix-matrix operations
+     * C := alpha*A*B + beta*C   or   C := alpha*B*A + beta*C
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d3/d66/chemm_8f.html
+     *
+     * @param Side Specifies whether the symmetric matrix A appears on the left or right.
+     * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
+     * @param alpha The scalar alpha.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F32_2}.
+     * @param B The input allocation contains matrix B, supported elements type {@link Element#F32_2}.
+     * @param beta The scalar beta.
+     * @param C The input allocation contains matrix C, supported elements type {@link Element#F32_2}.
+     */
     public void CHEMM(@Side int Side, @Uplo int Uplo, Float2 alpha, Allocation A, Allocation B, Float2 beta, Allocation C) {
         validateUplo(Uplo);
         validateHEMM(Element.F32_2(mRS), Side, A, B, C);
         mRS.nScriptIntrinsicBLAS_Complex(getID(mRS), RsBlas_chemm, 0, 0, Side, Uplo, 0, C.getType().getY(), C.getType().getX(), 0,
                                          alpha.x, alpha.y, A.getID(mRS), B.getID(mRS), beta.x, beta.y, C.getID(mRS), 0, 0, 0, 0);
     }
+
+    /**
+     * ZHEMM performs one of the matrix-matrix operations
+     * C := alpha*A*B + beta*C   or   C := alpha*B*A + beta*C
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d6/d3e/zhemm_8f.html
+     *
+     * @param Side Specifies whether the symmetric matrix A appears on the left or right.
+     * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
+     * @param alpha The scalar alpha.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F64_2}.
+     * @param B The input allocation contains matrix B, supported elements type {@link Element#F64_2}.
+     * @param beta The scalar beta.
+     * @param C The input allocation contains matrix C, supported elements type {@link Element#F64_2}.
+     */
     public void ZHEMM(@Side int Side, @Uplo int Uplo, Double2 alpha, Allocation A, Allocation B, Double2 beta, Allocation C) {
         validateUplo(Uplo);
         validateHEMM(Element.F64_2(mRS), Side, A, B, C);
@@ -1477,6 +3138,20 @@
             }
         }
     }
+
+    /**
+     * CHERK performs one of the hermitian rank k operations
+     * C := alpha*A*A**H + beta*C   or   C := alpha*A**H*A + beta*C
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d8/d52/cherk_8f.html
+     *
+     * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced.
+     * @param Trans The type of transpose applied to the operation.
+     * @param alpha The scalar alpha.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F32_2}.
+     * @param beta The scalar beta.
+     * @param C The input allocation contains matrix C, supported elements type {@link Element#F32_2}.
+     */
     public void CHERK(@Uplo int Uplo, @Transpose int Trans, float alpha, Allocation A, float beta, Allocation C) {
         validateUplo(Uplo);
         validateHERK(Element.F32_2(mRS), Trans, A, C);
@@ -1489,6 +3164,20 @@
         mRS.nScriptIntrinsicBLAS_Complex(getID(mRS), RsBlas_cherk, Trans, 0, 0, Uplo, 0, 0, C.getType().getX(), k,
                                          alpha, 0, A.getID(mRS), 0, beta, 0, C.getID(mRS), 0, 0, 0, 0);
     }
+
+    /**
+     * ZHERK performs one of the hermitian rank k operations
+     * C := alpha*A*A**H + beta*C   or   C := alpha*A**H*A + beta*C
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d1/db1/zherk_8f.html
+     *
+     * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced.
+     * @param Trans The type of transpose applied to the operation.
+     * @param alpha The scalar alpha.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F64_2}.
+     * @param beta The scalar beta.
+     * @param C The input allocation contains matrix C, supported elements type {@link Element#F64_2}.
+     */
     public void ZHERK(@Uplo int Uplo, @Transpose int Trans, double alpha, Allocation A, double beta, Allocation C) {
         validateUplo(Uplo);
         validateHERK(Element.F64_2(mRS), Trans, A, C);
@@ -1526,6 +3215,21 @@
             throw new RSRuntimeException("Called HER2K with invalid A and B matrices");
         }
     }
+
+    /**
+     * CHER2K performs one of the hermitian rank 2k operations
+     * C := alpha*A*B**H + conjg( alpha )*B*A**H + beta*C   or   C := alpha*A**H*B + conjg( alpha )*B**H*A + beta*C
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d1/d82/cher2k_8f.html
+     *
+     * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced.
+     * @param Trans The type of transpose applied to the operation.
+     * @param alpha The scalar alpha.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F32_2}.
+     * @param B The input allocation contains matrix B, supported elements type {@link Element#F32_2}.
+     * @param beta The scalar beta.
+     * @param C The input allocation contains matrix C, supported elements type {@link Element#F32_2}.
+     */
     public void CHER2K(@Uplo int Uplo, @Transpose int Trans, Float2 alpha, Allocation A, Allocation B, float beta, Allocation C) {
         validateUplo(Uplo);
         validateHER2K(Element.F32_2(mRS), Trans, A, B, C);
@@ -1538,6 +3242,21 @@
         mRS.nScriptIntrinsicBLAS_Complex(getID(mRS), RsBlas_cher2k, Trans, 0, 0, Uplo, 0, 0, C.getType().getX(), k, alpha.x, alpha.y,
                                          A.getID(mRS), B.getID(mRS), beta, 0, C.getID(mRS), 0, 0, 0, 0);
     }
+
+    /**
+     * ZHER2K performs one of the hermitian rank 2k operations
+     * C := alpha*A*B**H + conjg( alpha )*B*A**H + beta*C   or   C := alpha*A**H*B + conjg( alpha )*B**H*A + beta*C
+     *
+     * Details: http://www.netlib.org/lapack/explore-html/d7/dfa/zher2k_8f.html
+     *
+     * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced.
+     * @param Trans The type of transpose applied to the operation.
+     * @param alpha The scalar alpha.
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#F64_2}.
+     * @param B The input allocation contains matrix B, supported elements type {@link Element#F64_2}.
+     * @param beta The scalar beta.
+     * @param C The input allocation contains matrix C, supported elements type {@link Element#F64_2}.
+     */
     public void ZHER2K(@Uplo int Uplo, @Transpose int Trans, Double2 alpha, Allocation A, Allocation B, double beta, Allocation C) {
         validateUplo(Uplo);
         validateHER2K(Element.F64_2(mRS), Trans, A, B, C);
@@ -1553,9 +3272,19 @@
 
 
     /**
-     *
-     * 8-bit GEMM-like operation for neural networks
-     *
+     * 8-bit GEMM-like operation for neural networks: C = B.transposed() * A
+     * Calculations are done in 1.10.21 fixed-point format for the final output,
+     * just before there's a shift down to drop the fractional parts. The output
+     * values are gated to 0 to 255 to fit in a byte, but the 10-bit format
+     * gives some headroom to avoid wrapping around on small overflows.
+     * 
+     * @param A The input allocation contains matrix A, supported elements type {@link Element#U8}.
+     * @param a_offset The offset for all values in matrix A, e.g A[i,j] = A[i,j] - a_offset.
+     * @param B The input allocation contains matrix B, supported elements type {@link Element#U8}.
+     * @param b_offset The offset for all values in matrix B, e.g B[i,j] = B[i,j] - b_offset.
+     * @param C The input allocation contains matrix C, supported elements type {@link Element#U8}.
+     * @param c_offset The offset for all values in matrix C.
+     * @param c_mult The multiplier for all values in matrix C, e.g C[i,j] = (C[i,j] + c_offset) * c_mult.
      **/
     public void BNNM(Allocation A, int a_offset, Allocation B, int b_offset, Allocation C, int c_offset, int c_mult) {
         validateL3(Element.U8(mRS), NO_TRANSPOSE, TRANSPOSE, 0, A, B, C);
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java
index 98f0b45..25d4d5e 100644
--- a/services/core/java/com/android/server/ConnectivityService.java
+++ b/services/core/java/com/android/server/ConnectivityService.java
@@ -326,7 +326,7 @@
 
     /**
      * used to add a network request with a pending intent
-     * includes a NetworkRequestInfo
+     * obj = NetworkRequestInfo
      */
     private static final int EVENT_REGISTER_NETWORK_REQUEST_WITH_INTENT = 26;
 
@@ -356,6 +356,12 @@
      */
     private static final int EVENT_CONFIGURE_MOBILE_DATA_ALWAYS_ON = 30;
 
+    /**
+     * used to add a network listener with a pending intent
+     * obj = NetworkRequestInfo
+     */
+    private static final int EVENT_REGISTER_NETWORK_LISTENER_WITH_INTENT = 31;
+
     /** Handler used for internal events. */
     final private InternalHandler mHandler;
     /** Handler used for incoming {@link NetworkStateTracker} events. */
@@ -2068,15 +2074,6 @@
                 log(nai.name() + " got DISCONNECTED, was satisfying " + nai.networkRequests.size());
             }
             // A network agent has disconnected.
-            if (nai.created) {
-                // Tell netd to clean up the configuration for this network
-                // (routing rules, DNS, etc).
-                try {
-                    mNetd.removeNetwork(nai.network.netId);
-                } catch (Exception e) {
-                    loge("Exception removing network: " + e);
-                }
-            }
             // TODO - if we move the logic to the network agent (have them disconnect
             // because they lost all their requests or because their score isn't good)
             // then they would disconnect organically, report their new state and then
@@ -2095,8 +2092,9 @@
             mNetworkAgentInfos.remove(msg.replyTo);
             updateClat(null, nai.linkProperties, nai);
             synchronized (mNetworkForNetId) {
+                // Remove the NetworkAgent, but don't mark the netId as
+                // available until we've told netd to delete it below.
                 mNetworkForNetId.remove(nai.network.netId);
-                mNetIdInUse.delete(nai.network.netId);
             }
             // Since we've lost the network, go through all the requests that
             // it was satisfying and see if any other factory can satisfy them.
@@ -2138,9 +2136,28 @@
                 rematchNetworkAndRequests(networkToActivate, NascentState.NOT_JUST_VALIDATED,
                         ReapUnvalidatedNetworks.DONT_REAP);
             }
+            if (nai.created) {
+                // Tell netd to clean up the configuration for this network
+                // (routing rules, DNS, etc).
+                // This may be slow as it requires a lot of netd shelling out to ip and
+                // ip[6]tables to flush routes and remove the incoming packet mark rule, so do it
+                // after we've rematched networks with requests which should make a potential
+                // fallback network the default or requested a new network from the
+                // NetworkFactories, so network traffic isn't interrupted for an unnecessarily
+                // long time.
+                try {
+                    mNetd.removeNetwork(nai.network.netId);
+                } catch (Exception e) {
+                    loge("Exception removing network: " + e);
+                }
+            }
+            synchronized (mNetworkForNetId) {
+                mNetIdInUse.delete(nai.network.netId);
+            }
+        } else {
+            NetworkFactoryInfo nfi = mNetworkFactoryInfos.remove(msg.replyTo);
+            if (DBG && nfi != null) log("unregisterNetworkFactory for " + nfi.name);
         }
-        NetworkFactoryInfo nfi = mNetworkFactoryInfos.remove(msg.replyTo);
-        if (DBG && nfi != null) log("unregisterNetworkFactory for " + nfi.name);
     }
 
     // If this method proves to be too slow then we can maintain a separate
@@ -2185,7 +2202,9 @@
                     // Not setting bestNetwork here as a listening NetworkRequest may be
                     // satisfied by multiple Networks.  Instead the request is added to
                     // each satisfying Network and notified about each.
-                    network.addRequest(nri.request);
+                    if (!network.addRequest(nri.request)) {
+                        Slog.wtf(TAG, "BUG: " + network.name() + " already has " + nri.request);
+                    }
                     notifyNetworkCallback(network, nri);
                 } else if (bestNetwork == null ||
                         bestNetwork.getCurrentScore() < network.getCurrentScore()) {
@@ -2196,7 +2215,9 @@
         if (bestNetwork != null) {
             if (DBG) log("using " + bestNetwork.name());
             unlinger(bestNetwork);
-            bestNetwork.addRequest(nri.request);
+            if (!bestNetwork.addRequest(nri.request)) {
+                Slog.wtf(TAG, "BUG: " + bestNetwork.name() + " already has " + nri.request);
+            }
             mNetworkForRequestId.put(nri.request.requestId, bestNetwork);
             notifyNetworkCallback(bestNetwork, nri);
             if (nri.request.legacyType != TYPE_NONE) {
@@ -2480,7 +2501,8 @@
                     handleRegisterNetworkRequest((NetworkRequestInfo) msg.obj);
                     break;
                 }
-                case EVENT_REGISTER_NETWORK_REQUEST_WITH_INTENT: {
+                case EVENT_REGISTER_NETWORK_REQUEST_WITH_INTENT:
+                case EVENT_REGISTER_NETWORK_LISTENER_WITH_INTENT: {
                     handleRegisterNetworkRequestWithIntent(msg);
                     break;
                 }
@@ -3689,6 +3711,18 @@
     @Override
     public void pendingListenForNetwork(NetworkCapabilities networkCapabilities,
             PendingIntent operation) {
+        checkNotNull(operation, "PendingIntent cannot be null.");
+        if (!hasWifiNetworkListenPermission(networkCapabilities)) {
+            enforceAccessPermission();
+        }
+
+        NetworkRequest networkRequest = new NetworkRequest(new NetworkCapabilities(
+                networkCapabilities), TYPE_NONE, nextNetworkRequestId());
+        if (DBG) log("pendingListenForNetwork for " + networkRequest + " to trigger " + operation);
+        NetworkRequestInfo nri = new NetworkRequestInfo(networkRequest, operation,
+                NetworkRequestInfo.LISTEN);
+
+        mHandler.sendMessage(mHandler.obtainMessage(EVENT_REGISTER_NETWORK_LISTENER, nri));
     }
 
     @Override
@@ -4197,6 +4231,7 @@
         // Find and migrate to this Network any NetworkRequests for
         // which this network is now the best.
         ArrayList<NetworkAgentInfo> affectedNetworks = new ArrayList<NetworkAgentInfo>();
+        ArrayList<NetworkRequestInfo> addedRequests = new ArrayList<NetworkRequestInfo>();
         if (VDBG) log(" network has: " + newNetwork.networkCapabilities);
         for (NetworkRequestInfo nri : mNetworkRequests.values()) {
             NetworkAgentInfo currentNetwork = mNetworkForRequestId.get(nri.request.requestId);
@@ -4215,7 +4250,7 @@
                 if (!nri.isRequest) {
                     // This is not a request, it's a callback listener.
                     // Add it to newNetwork regardless of score.
-                    newNetwork.addRequest(nri.request);
+                    if (newNetwork.addRequest(nri.request)) addedRequests.add(nri);
                     continue;
                 }
 
@@ -4238,7 +4273,10 @@
                     }
                     unlinger(newNetwork);
                     mNetworkForRequestId.put(nri.request.requestId, newNetwork);
-                    newNetwork.addRequest(nri.request);
+                    if (!newNetwork.addRequest(nri.request)) {
+                        Slog.wtf(TAG, "BUG: " + newNetwork.name() + " already has " + nri.request);
+                    }
+                    addedRequests.add(nri);
                     keep = true;
                     // Tell NetworkFactories about the new score, so they can stop
                     // trying to connect if they know they cannot match it.
@@ -4281,7 +4319,7 @@
 
             // do this after the default net is switched, but
             // before LegacyTypeTracker sends legacy broadcasts
-            notifyNetworkCallbacks(newNetwork, ConnectivityManager.CALLBACK_AVAILABLE);
+            for (NetworkRequestInfo nri : addedRequests) notifyNetworkCallback(newNetwork, nri);
 
             if (isNewDefault) {
                 // Maintain the illusion: since the legacy API only
diff --git a/services/core/java/com/android/server/InputMethodManagerService.java b/services/core/java/com/android/server/InputMethodManagerService.java
index 2f153a0..47c9f04 100644
--- a/services/core/java/com/android/server/InputMethodManagerService.java
+++ b/services/core/java/com/android/server/InputMethodManagerService.java
@@ -16,6 +16,7 @@
 package com.android.server;
 
 import android.annotation.NonNull;
+import android.content.pm.PackageManagerInternal;
 import com.android.internal.content.PackageMonitor;
 import com.android.internal.inputmethod.InputMethodSubtypeSwitchingController;
 import com.android.internal.inputmethod.InputMethodSubtypeSwitchingController.ImeSubtypeListItem;
@@ -31,6 +32,7 @@
 import com.android.internal.view.IInputMethodManager;
 import com.android.internal.view.IInputMethodSession;
 import com.android.internal.view.InputBindResult;
+import com.android.server.pm.UserManagerService;
 import com.android.server.statusbar.StatusBarManagerService;
 import com.android.server.wm.WindowManagerService;
 
@@ -859,6 +861,38 @@
         // mSettings should be created before buildInputMethodListLocked
         mSettings = new InputMethodSettings(
                 mRes, context.getContentResolver(), mMethodMap, mMethodList, userId);
+
+        // Let the package manager query which are the default imes
+        // as they get certain permissions granted by default.
+        PackageManagerInternal packageManagerInternal = LocalServices.getService(
+                PackageManagerInternal.class);
+        packageManagerInternal.setImePackagesProvider(
+                new PackageManagerInternal.PackagesProvider() {
+                    @Override
+                    public String[] getPackages(int userId) {
+                        synchronized (mMethodMap) {
+                            final int currentUserId = mSettings.getCurrentUserId();
+                            // TODO: We are switching the current user id in the settings
+                            // object to query it and then revert the user id. Ideally, we
+                            // should call a API in settings with the user id as an argument.
+                            mSettings.setCurrentUserId(userId);
+                            List<InputMethodInfo> imes = mSettings
+                                    .getEnabledInputMethodListLocked();
+                            String[] packageNames = null;
+                            if (imes != null) {
+                                final int imeCount = imes.size();
+                                packageNames = new String[imeCount];
+                                for (int i = 0; i < imeCount; i++) {
+                                    InputMethodInfo ime = imes.get(i);
+                                    packageNames[i] = ime.getPackageName();
+                                }
+                            }
+                            mSettings.setCurrentUserId(currentUserId);
+                            return packageNames;
+                        }
+                    }
+                });
+
         updateCurrentProfileIds();
         mFileManager = new InputMethodFileManager(mMethodMap, userId);
         synchronized (mMethodMap) {
diff --git a/services/core/java/com/android/server/LocationManagerService.java b/services/core/java/com/android/server/LocationManagerService.java
index 743aafb..61bedf5 100644
--- a/services/core/java/com/android/server/LocationManagerService.java
+++ b/services/core/java/com/android/server/LocationManagerService.java
@@ -16,6 +16,7 @@
 
 package com.android.server;
 
+import android.content.pm.PackageManagerInternal;
 import com.android.internal.content.PackageMonitor;
 import com.android.internal.location.ProviderProperties;
 import com.android.internal.location.ProviderRequest;
@@ -218,6 +219,19 @@
         mContext = context;
         mAppOps = (AppOpsManager)context.getSystemService(Context.APP_OPS_SERVICE);
 
+        // Let the package manager query which are the default location
+        // providers as they get certain permissions granted by default.
+        PackageManagerInternal packageManagerInternal = LocalServices.getService(
+                PackageManagerInternal.class);
+        packageManagerInternal.setLocationPackagesProvider(
+                new PackageManagerInternal.PackagesProvider() {
+                    @Override
+                    public String[] getPackages(int userId) {
+                        return mContext.getResources().getStringArray(
+                                com.android.internal.R.array.config_locationProviderPackageNames);
+                    }
+                });
+
         if (D) Log.d(TAG, "Constructed");
 
         // most startup is deferred until systemReady()
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 2a67248..c0c401d 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -676,9 +676,9 @@
     final SparseArray<UidRecord> mActiveUids = new SparseArray<>();
 
     /**
-     * Which uses have been started, so are allowed to run code.
+     * Which users have been started, so are allowed to run code.
      */
-    final SparseArray<UserStartedState> mStartedUsers = new SparseArray<>();
+    final SparseArray<UserState> mStartedUsers = new SparseArray<>();
 
     /**
      * LRU list of history of current users.  Most recently current is at the end.
@@ -1781,15 +1781,15 @@
                 break;
             }
             case REPORT_USER_SWITCH_MSG: {
-                dispatchUserSwitch((UserStartedState) msg.obj, msg.arg1, msg.arg2);
+                dispatchUserSwitch((UserState) msg.obj, msg.arg1, msg.arg2);
                 break;
             }
             case CONTINUE_USER_SWITCH_MSG: {
-                continueUserSwitch((UserStartedState) msg.obj, msg.arg1, msg.arg2);
+                continueUserSwitch((UserState) msg.obj, msg.arg1, msg.arg2);
                 break;
             }
             case USER_SWITCH_TIMEOUT_MSG: {
-                timeoutUserSwitch((UserStartedState) msg.obj, msg.arg1, msg.arg2);
+                timeoutUserSwitch((UserState) msg.obj, msg.arg1, msg.arg2);
                 break;
             }
             case IMMERSIVE_MODE_LOCK_MSG: {
@@ -2309,7 +2309,7 @@
         mGrantFile = new AtomicFile(new File(systemDir, "urigrants.xml"));
 
         // User 0 is the first and only user that runs at boot.
-        mStartedUsers.put(UserHandle.USER_OWNER, new UserStartedState(UserHandle.OWNER, true));
+        mStartedUsers.put(UserHandle.USER_OWNER, new UserState(UserHandle.OWNER, true));
         mUserLru.add(UserHandle.USER_OWNER);
         updateStartedUserArrayLocked();
 
@@ -3264,9 +3264,9 @@
                     debugFlags |= Zygote.DEBUG_ENABLE_JIT;
                 }
             }
-            String genCFIDebugProperty = SystemProperties.get("debug.gencfi");
-            if ("true".equals(genCFIDebugProperty)) {
-                debugFlags |= Zygote.DEBUG_GENERATE_CFI;
+            String genDebugInfoProperty = SystemProperties.get("debug.generate-debug-info");
+            if ("true".equals(genDebugInfoProperty)) {
+                debugFlags |= Zygote.DEBUG_GENERATE_DEBUG_INFO;
             }
             if ("1".equals(SystemProperties.get("debug.jni.logging"))) {
                 debugFlags |= Zygote.DEBUG_ENABLE_JNI_LOGGING;
@@ -6305,9 +6305,9 @@
                     SystemProperties.set("dev.bootcomplete", "1");
                 }
                 for (int i=0; i<mStartedUsers.size(); i++) {
-                    UserStartedState uss = mStartedUsers.valueAt(i);
-                    if (uss.mState == UserStartedState.STATE_BOOTING) {
-                        uss.mState = UserStartedState.STATE_RUNNING;
+                    UserState uss = mStartedUsers.valueAt(i);
+                    if (uss.mState == UserState.STATE_BOOTING) {
+                        uss.mState = UserState.STATE_RUNNING;
                         final int userId = mStartedUsers.keyAt(i);
                         Intent intent = new Intent(Intent.ACTION_BOOT_COMPLETED, null);
                         intent.putExtra(Intent.EXTRA_USER_HANDLE, userId);
@@ -9434,6 +9434,7 @@
                     }
                     checkTime(startTime, "getContentProviderImpl: before updateOomAdj");
                     boolean success = updateOomAdjLocked(cpr.proc);
+                    maybeUpdateProviderUsageStatsLocked(r, cpr.info.packageName, name);
                     checkTime(startTime, "getContentProviderImpl: after updateOomAdj");
                     if (DEBUG_PROVIDER) Slog.i(TAG_PROVIDER, "Adjust success: " + success);
                     // NOTE: there is still a race here where a signal could be
@@ -9823,6 +9824,8 @@
                         dst.notifyAll();
                     }
                     updateOomAdjLocked(r);
+                    maybeUpdateProviderUsageStatsLocked(r, src.info.packageName,
+                            src.info.authority);
                 }
             }
 
@@ -13335,7 +13338,7 @@
             needSep = false;
             pw.println("  mStartedUsers:");
             for (int i=0; i<mStartedUsers.size(); i++) {
-                UserStartedState uss = mStartedUsers.valueAt(i);
+                UserState uss = mStartedUsers.valueAt(i);
                 pw.print("    User #"); pw.print(uss.mHandle.getIdentifier());
                         pw.print(": "); uss.dump("", pw);
             }
@@ -18607,6 +18610,22 @@
         uidRec.pendingChange.processState = uidRec.setProcState;
     }
 
+    private void maybeUpdateProviderUsageStatsLocked(ProcessRecord app, String providerPkgName,
+            String authority) {
+        if (app == null) return;
+        if (app.curProcState <= ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND) {
+            UserState userState = mStartedUsers.get(app.userId);
+            if (userState == null) return;
+            final long now = SystemClock.elapsedRealtime();
+            Long lastReported = userState.mProviderLastReportedFg.get(authority);
+            if (lastReported == null || lastReported < now - 60 * 1000L) {
+                mUsageStatsService.reportContentProviderUsage(
+                        authority, providerPkgName, app.userId);
+                userState.mProviderLastReportedFg.put(authority, now);
+            }
+        }
+    }
+
     private void maybeUpdateUsageStatsLocked(ProcessRecord app) {
         if (DEBUG_USAGE_STATS) {
             Slog.d(TAG, "Checking proc [" + Arrays.toString(app.getPackageList())
@@ -19594,7 +19613,7 @@
                 // If the user we are switching to is not currently started, then
                 // we need to start it now.
                 if (mStartedUsers.get(userId) == null) {
-                    mStartedUsers.put(userId, new UserStartedState(new UserHandle(userId), false));
+                    mStartedUsers.put(userId, new UserState(new UserHandle(userId), false));
                     updateStartedUserArrayLocked();
                     needStart = true;
                 }
@@ -19619,26 +19638,26 @@
                     mUserLru.add(currentUserIdInt);
                 }
 
-                final UserStartedState uss = mStartedUsers.get(userId);
+                final UserState uss = mStartedUsers.get(userId);
 
                 // Make sure user is in the started state.  If it is currently
                 // stopping, we need to knock that off.
-                if (uss.mState == UserStartedState.STATE_STOPPING) {
+                if (uss.mState == UserState.STATE_STOPPING) {
                     // If we are stopping, we haven't sent ACTION_SHUTDOWN,
                     // so we can just fairly silently bring the user back from
                     // the almost-dead.
-                    uss.mState = UserStartedState.STATE_RUNNING;
+                    uss.mState = UserState.STATE_RUNNING;
                     updateStartedUserArrayLocked();
                     needStart = true;
-                } else if (uss.mState == UserStartedState.STATE_SHUTDOWN) {
+                } else if (uss.mState == UserState.STATE_SHUTDOWN) {
                     // This means ACTION_SHUTDOWN has been sent, so we will
                     // need to treat this as a new boot of the user.
-                    uss.mState = UserStartedState.STATE_BOOTING;
+                    uss.mState = UserState.STATE_BOOTING;
                     updateStartedUserArrayLocked();
                     needStart = true;
                 }
 
-                if (uss.mState == UserStartedState.STATE_BOOTING) {
+                if (uss.mState == UserState.STATE_BOOTING) {
                     // Booting up a new user, need to tell system services about it.
                     // Note that this is on the same handler as scheduling of broadcasts,
                     // which is important because it needs to go first.
@@ -19776,7 +19795,7 @@
         }
     }
 
-    void dispatchUserSwitch(final UserStartedState uss, final int oldUserId,
+    void dispatchUserSwitch(final UserState uss, final int oldUserId,
             final int newUserId) {
         final int N = mUserSwitchObservers.beginBroadcast();
         if (N > 0) {
@@ -19813,21 +19832,21 @@
         mUserSwitchObservers.finishBroadcast();
     }
 
-    void timeoutUserSwitch(UserStartedState uss, int oldUserId, int newUserId) {
+    void timeoutUserSwitch(UserState uss, int oldUserId, int newUserId) {
         synchronized (this) {
             Slog.w(TAG, "User switch timeout: from " + oldUserId + " to " + newUserId);
             sendContinueUserSwitchLocked(uss, oldUserId, newUserId);
         }
     }
 
-    void sendContinueUserSwitchLocked(UserStartedState uss, int oldUserId, int newUserId) {
+    void sendContinueUserSwitchLocked(UserState uss, int oldUserId, int newUserId) {
         mCurUserSwitchCallback = null;
         mHandler.removeMessages(USER_SWITCH_TIMEOUT_MSG);
         mHandler.sendMessage(mHandler.obtainMessage(CONTINUE_USER_SWITCH_MSG,
                 oldUserId, newUserId, uss));
     }
 
-    void onUserInitialized(UserStartedState uss, boolean foreground, int oldUserId, int newUserId) {
+    void onUserInitialized(UserState uss, boolean foreground, int oldUserId, int newUserId) {
         synchronized (this) {
             if (foreground) {
                 moveUserToForeground(uss, oldUserId, newUserId);
@@ -19837,7 +19856,7 @@
         completeSwitchAndInitalize(uss, newUserId, true, false);
     }
 
-    void moveUserToForeground(UserStartedState uss, int oldUserId, int newUserId) {
+    void moveUserToForeground(UserState uss, int oldUserId, int newUserId) {
         boolean homeInFront = mStackSupervisor.switchUserLocked(newUserId, uss);
         if (homeInFront) {
             startHomeActivityLocked(newUserId, "moveUserToFroreground");
@@ -19849,11 +19868,11 @@
         sendUserSwitchBroadcastsLocked(oldUserId, newUserId);
     }
 
-    void continueUserSwitch(UserStartedState uss, int oldUserId, int newUserId) {
+    void continueUserSwitch(UserState uss, int oldUserId, int newUserId) {
         completeSwitchAndInitalize(uss, newUserId, false, true);
     }
 
-    void completeSwitchAndInitalize(UserStartedState uss, int newUserId,
+    void completeSwitchAndInitalize(UserState uss, int newUserId,
             boolean clearInitializing, boolean clearSwitching) {
         boolean unfrozen = false;
         synchronized (this) {
@@ -19890,10 +19909,10 @@
             final int num = mUserLru.size();
             for (int i = 0; i < num; i++) {
                 Integer oldUserId = mUserLru.get(i);
-                UserStartedState oldUss = mStartedUsers.get(oldUserId);
+                UserState oldUss = mStartedUsers.get(oldUserId);
                 if (oldUserId == UserHandle.USER_OWNER || oldUserId == mCurrentUserId
-                        || oldUss.mState == UserStartedState.STATE_STOPPING
-                        || oldUss.mState == UserStartedState.STATE_SHUTDOWN) {
+                        || oldUss.mState == UserState.STATE_STOPPING
+                        || oldUss.mState == UserState.STATE_SHUTDOWN) {
                     continue;
                 }
                 UserInfo userInfo = mUserManager.getUserInfo(oldUserId);
@@ -19934,11 +19953,11 @@
         }
     }
 
-    void finishUserBoot(UserStartedState uss) {
+    void finishUserBoot(UserState uss) {
         synchronized (this) {
-            if (uss.mState == UserStartedState.STATE_BOOTING
+            if (uss.mState == UserState.STATE_BOOTING
                     && mStartedUsers.get(uss.mHandle.getIdentifier()) == uss) {
-                uss.mState = UserStartedState.STATE_RUNNING;
+                uss.mState = UserState.STATE_RUNNING;
                 final int userId = uss.mHandle.getIdentifier();
                 Intent intent = new Intent(Intent.ACTION_BOOT_COMPLETED, null);
                 intent.putExtra(Intent.EXTRA_USER_HANDLE, userId);
@@ -19951,7 +19970,7 @@
         }
     }
 
-    void finishUserSwitch(UserStartedState uss) {
+    void finishUserSwitch(UserState uss) {
         synchronized (this) {
             finishUserBoot(uss);
 
@@ -19961,15 +19980,15 @@
             int i = 0;
             while (num > MAX_RUNNING_USERS && i < mUserLru.size()) {
                 Integer oldUserId = mUserLru.get(i);
-                UserStartedState oldUss = mStartedUsers.get(oldUserId);
+                UserState oldUss = mStartedUsers.get(oldUserId);
                 if (oldUss == null) {
                     // Shouldn't happen, but be sane if it does.
                     mUserLru.remove(i);
                     num--;
                     continue;
                 }
-                if (oldUss.mState == UserStartedState.STATE_STOPPING
-                        || oldUss.mState == UserStartedState.STATE_SHUTDOWN) {
+                if (oldUss.mState == UserState.STATE_STOPPING
+                        || oldUss.mState == UserState.STATE_SHUTDOWN) {
                     // This user is already stopping, doesn't count.
                     num--;
                     i++;
@@ -20014,7 +20033,7 @@
             return ActivityManager.USER_OP_IS_CURRENT;
         }
 
-        final UserStartedState uss = mStartedUsers.get(userId);
+        final UserState uss = mStartedUsers.get(userId);
         if (uss == null) {
             // User is not started, nothing to do...  but we do need to
             // callback if requested.
@@ -20036,9 +20055,9 @@
             uss.mStopCallbacks.add(callback);
         }
 
-        if (uss.mState != UserStartedState.STATE_STOPPING
-                && uss.mState != UserStartedState.STATE_SHUTDOWN) {
-            uss.mState = UserStartedState.STATE_STOPPING;
+        if (uss.mState != UserState.STATE_STOPPING
+                && uss.mState != UserState.STATE_SHUTDOWN) {
+            uss.mState = UserState.STATE_STOPPING;
             updateStartedUserArrayLocked();
 
             long ident = Binder.clearCallingIdentity();
@@ -20066,11 +20085,11 @@
                             Bundle extras, boolean ordered, boolean sticky, int sendingUser) {
                         // On to the next.
                         synchronized (ActivityManagerService.this) {
-                            if (uss.mState != UserStartedState.STATE_STOPPING) {
+                            if (uss.mState != UserState.STATE_STOPPING) {
                                 // Whoops, we are being started back up.  Abort, abort!
                                 return;
                             }
-                            uss.mState = UserStartedState.STATE_SHUTDOWN;
+                            uss.mState = UserState.STATE_SHUTDOWN;
                         }
                         mBatteryStatsService.noteEvent(
                                 BatteryStats.HistoryItem.EVENT_USER_RUNNING_FINISH,
@@ -20094,7 +20113,7 @@
         return ActivityManager.USER_OP_SUCCESS;
     }
 
-    void finishUserStop(UserStartedState uss) {
+    void finishUserStop(UserState uss) {
         final int userId = uss.mHandle.getIdentifier();
         boolean stopped;
         ArrayList<IStopUserCallback> callbacks;
@@ -20102,7 +20121,7 @@
             callbacks = new ArrayList<IStopUserCallback>(uss.mStopCallbacks);
             if (mStartedUsers.get(userId) != uss) {
                 stopped = false;
-            } else if (uss.mState != UserStartedState.STATE_SHUTDOWN) {
+            } else if (uss.mState != UserState.STATE_SHUTDOWN) {
                 stopped = false;
             } else {
                 stopped = true;
@@ -20176,15 +20195,15 @@
     }
 
     boolean isUserRunningLocked(int userId, boolean orStopped) {
-        UserStartedState state = mStartedUsers.get(userId);
+        UserState state = mStartedUsers.get(userId);
         if (state == null) {
             return false;
         }
         if (orStopped) {
             return true;
         }
-        return state.mState != UserStartedState.STATE_STOPPING
-                && state.mState != UserStartedState.STATE_SHUTDOWN;
+        return state.mState != UserState.STATE_STOPPING
+                && state.mState != UserState.STATE_SHUTDOWN;
     }
 
     @Override
@@ -20206,19 +20225,19 @@
     private void updateStartedUserArrayLocked() {
         int num = 0;
         for (int i=0; i<mStartedUsers.size();  i++) {
-            UserStartedState uss = mStartedUsers.valueAt(i);
+            UserState uss = mStartedUsers.valueAt(i);
             // This list does not include stopping users.
-            if (uss.mState != UserStartedState.STATE_STOPPING
-                    && uss.mState != UserStartedState.STATE_SHUTDOWN) {
+            if (uss.mState != UserState.STATE_STOPPING
+                    && uss.mState != UserState.STATE_SHUTDOWN) {
                 num++;
             }
         }
         mStartedUserArray = new int[num];
         num = 0;
         for (int i=0; i<mStartedUsers.size();  i++) {
-            UserStartedState uss = mStartedUsers.valueAt(i);
-            if (uss.mState != UserStartedState.STATE_STOPPING
-                    && uss.mState != UserStartedState.STATE_SHUTDOWN) {
+            UserState uss = mStartedUsers.valueAt(i);
+            if (uss.mState != UserState.STATE_STOPPING
+                    && uss.mState != UserState.STATE_SHUTDOWN) {
                 mStartedUserArray[num] = mStartedUsers.keyAt(i);
                 num++;
             }
diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
index 4e98576..f967aef 100644
--- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java
+++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
@@ -233,10 +233,10 @@
     final ArrayList<ActivityRecord> mGoingToSleepActivities = new ArrayList<>();
 
     /** Used on user changes */
-    final ArrayList<UserStartedState> mStartingUsers = new ArrayList<>();
+    final ArrayList<UserState> mStartingUsers = new ArrayList<>();
 
     /** Used to queue up any background users being started */
-    final ArrayList<UserStartedState> mStartingBackgroundUsers = new ArrayList<>();
+    final ArrayList<UserState> mStartingBackgroundUsers = new ArrayList<>();
 
     /** Set to indicate whether to issue an onUserLeaving callback when a newly launched activity
      * is being brought in front of us. */
@@ -883,8 +883,18 @@
 
     void startHomeActivity(Intent intent, ActivityInfo aInfo, String reason) {
         moveHomeStackTaskToTop(HOME_ACTIVITY_TYPE, reason);
-        startActivityLocked(null, intent, null, aInfo, null, null, null, null, 0, 0, 0, null,
-                0, 0, 0, null, false, null, null, null);
+        startActivityLocked(null /* caller */, intent, null /* resolvedType */, aInfo,
+                null /* voiceSession */, null /* voiceInteractor */, null /* resultTo */,
+                null /* resultWho */, 0 /* requestCode */, 0 /* callingPid */, 0 /* callingUid */,
+                null /* callingPackage */, 0 /* realCallingPid */, 0 /* realCallingUid */,
+                0 /* startFlags */, null /* options */, false /* componentSpecified */,
+                null /* outActivity */, null /* container */,  null /* inTask */);
+        if (inResumeTopActivity) {
+            // If we are in resume section already, home activity will be initialized, but not
+            // resumed (to avoid recursive resume) and will stay that way until something pokes it
+            // again. We need to schedule another resume.
+            scheduleResumeTopActivities();
+        }
     }
 
     final int startActivityMayWait(IApplicationThread caller, int callingUid,
@@ -2376,7 +2386,7 @@
 
         ArrayList<ActivityRecord> stops = null;
         ArrayList<ActivityRecord> finishes = null;
-        ArrayList<UserStartedState> startingUsers = null;
+        ArrayList<UserState> startingUsers = null;
         int NS = 0;
         int NF = 0;
         boolean booting = false;
@@ -2473,7 +2483,7 @@
             }
             // Complete starting up of background users
             if (mStartingBackgroundUsers.size() > 0) {
-                startingUsers = new ArrayList<UserStartedState>(mStartingBackgroundUsers);
+                startingUsers = new ArrayList<UserState>(mStartingBackgroundUsers);
                 mStartingBackgroundUsers.clear();
                 for (int i = 0; i < startingUsers.size(); i++) {
                     mService.finishUserBoot(startingUsers.get(i));
@@ -3235,7 +3245,7 @@
         }
     }
 
-    boolean switchUserLocked(int userId, UserStartedState uss) {
+    boolean switchUserLocked(int userId, UserState uss) {
         mUserStackInFront.put(mCurrentUser, mFocusedStack.getStackId());
         final int restoreStackId = mUserStackInFront.get(userId, HOME_STACK_ID);
         mCurrentUser = userId;
@@ -3276,7 +3286,7 @@
      * @param userId The user being started in the background
      * @param uss The state object for the user.
      */
-    public void startBackgroundUserLocked(int userId, UserStartedState uss) {
+    public void startBackgroundUserLocked(int userId, UserState uss) {
         mStartingBackgroundUsers.add(uss);
     }
 
diff --git a/services/core/java/com/android/server/am/UserStartedState.java b/services/core/java/com/android/server/am/UserState.java
similarity index 85%
rename from services/core/java/com/android/server/am/UserStartedState.java
rename to services/core/java/com/android/server/am/UserState.java
index d3e73d5..b3d82bc 100644
--- a/services/core/java/com/android/server/am/UserStartedState.java
+++ b/services/core/java/com/android/server/am/UserState.java
@@ -21,8 +21,9 @@
 
 import android.app.IStopUserCallback;
 import android.os.UserHandle;
+import android.util.ArrayMap;
 
-public final class UserStartedState {
+public final class UserState {
     // User is first coming up.
     public final static int STATE_BOOTING = 0;
     // User is in the normal running state.
@@ -40,7 +41,13 @@
     public boolean switching;
     public boolean initializing;
 
-    public UserStartedState(UserHandle handle, boolean initial) {
+    /**
+     * The last time that a provider was reported to usage stats as being brought to important
+     * foreground procstate.
+     */
+    public final ArrayMap<String,Long> mProviderLastReportedFg = new ArrayMap<>();
+
+    public UserState(UserHandle handle, boolean initial) {
         mHandle = handle;
     }
 
diff --git a/services/core/java/com/android/server/connectivity/NetworkAgentInfo.java b/services/core/java/com/android/server/connectivity/NetworkAgentInfo.java
index eac748f..3bf1183 100644
--- a/services/core/java/com/android/server/connectivity/NetworkAgentInfo.java
+++ b/services/core/java/com/android/server/connectivity/NetworkAgentInfo.java
@@ -106,8 +106,16 @@
         networkMisc = misc;
     }
 
-    public void addRequest(NetworkRequest networkRequest) {
+    /**
+     * Add {@code networkRequest} to this network as it's satisfied by this network.
+     * NOTE: This function must only be called on ConnectivityService's main thread.
+     * @return true if {@code networkRequest} was added or false if {@code networkRequest} was
+     *         already present.
+     */
+    public boolean addRequest(NetworkRequest networkRequest) {
+        if (networkRequests.get(networkRequest.requestId) == networkRequest) return false;
         networkRequests.put(networkRequest.requestId, networkRequest);
+        return true;
     }
 
     // Does this network satisfy request?
diff --git a/services/core/java/com/android/server/connectivity/NetworkMonitor.java b/services/core/java/com/android/server/connectivity/NetworkMonitor.java
index fc50e2c..99a0567 100644
--- a/services/core/java/com/android/server/connectivity/NetworkMonitor.java
+++ b/services/core/java/com/android/server/connectivity/NetworkMonitor.java
@@ -178,6 +178,13 @@
      */
     private static final int CMD_LAUNCH_CAPTIVE_PORTAL_APP = BASE + 11;
 
+    /**
+     * Retest network to see if captive portal is still in place.
+     * arg1 = UID responsible for requesting this reeval.  Will be billed for data.
+     *        0 indicates self-initiated, so nobody to blame.
+     */
+    private static final int CMD_CAPTIVE_PORTAL_RECHECK = BASE + 12;
+
     private static final String LINGER_DELAY_PROPERTY = "persist.netmon.linger";
     // Default to 30s linger time-out.  Modifyable only for testing.
     private static int DEFAULT_LINGER_DELAY_MS = 30000;
@@ -194,6 +201,8 @@
     private int mUidResponsibleForReeval = INVALID_UID;
     // Stop blaming UID that requested re-evaluation after this many attempts.
     private static final int BLAME_FOR_EVALUATION_ATTEMPTS = 5;
+    // Delay between reevaluations once a captive portal has been found.
+    private static final int CAPTIVE_PORTAL_REEVALUATE_DELAY_MS = 10*60*1000;
 
     private final Context mContext;
     private final Handler mConnectivityServiceHandler;
@@ -287,6 +296,7 @@
                     quit();
                     return HANDLED;
                 case CMD_FORCE_REEVALUATION:
+                case CMD_CAPTIVE_PORTAL_RECHECK:
                     if (DBG) log("Forcing reevaluation");
                     mUidResponsibleForReeval = message.arg1;
                     transitionTo(mEvaluatingState);
@@ -517,6 +527,9 @@
                     mNetworkAgentInfo.network.netId,
                     mLaunchCaptivePortalAppBroadcastReceiver.getPendingIntent());
             mConnectivityServiceHandler.sendMessage(message);
+            // Retest for captive portal occasionally.
+            sendMessageDelayed(CMD_CAPTIVE_PORTAL_RECHECK, 0 /* no UID */,
+                    CAPTIVE_PORTAL_REEVALUATE_DELAY_MS);
         }
 
         @Override
@@ -524,6 +537,11 @@
             if (DBG) log(getName() + message.toString());
             return NOT_HANDLED;
         }
+
+        @Override
+        public void exit() {
+             removeMessages(CMD_CAPTIVE_PORTAL_RECHECK);
+        }
     }
 
     // Being in the LingeringState State indicates a Network's validated bit is true and it once
diff --git a/services/core/java/com/android/server/content/ContentService.java b/services/core/java/com/android/server/content/ContentService.java
index ea461e5..93ed2ee 100644
--- a/services/core/java/com/android/server/content/ContentService.java
+++ b/services/core/java/com/android/server/content/ContentService.java
@@ -506,6 +506,21 @@
     }
 
     @Override
+    public String[] getSyncAdapterPackagesForAuthorityAsUser(String authority, int userId) {
+        enforceCrossUserPermission(userId,
+                "no permission to read sync settings for user " + userId);
+        // This makes it so that future permission checks will be in the context of this
+        // process rather than the caller's process. We will restore this before returning.
+        final long identityToken = clearCallingIdentity();
+        try {
+            SyncManager syncManager = getSyncManager();
+            return syncManager.getSyncAdapterPackagesForAuthorityAsUser(authority, userId);
+        } finally {
+            restoreCallingIdentity(identityToken);
+        }
+    }
+
+    @Override
     public boolean getSyncAutomatically(Account account, String providerName) {
         return getSyncAutomaticallyAsUser(account, providerName, UserHandle.getCallingUserId());
     }
diff --git a/services/core/java/com/android/server/content/SyncManager.java b/services/core/java/com/android/server/content/SyncManager.java
index 2eb8797..cd9c7fe 100644
--- a/services/core/java/com/android/server/content/SyncManager.java
+++ b/services/core/java/com/android/server/content/SyncManager.java
@@ -908,6 +908,10 @@
         return types;
     }
 
+    public String[] getSyncAdapterPackagesForAuthorityAsUser(String authority, int userId) {
+        return mSyncAdapters.getSyncAdapterPackagesForAuthority(authority, userId);
+    }
+
     private void sendSyncAlarmMessage() {
         if (Log.isLoggable(TAG, Log.VERBOSE)) Log.v(TAG, "sending MESSAGE_SYNC_ALARM");
         mSyncHandler.sendEmptyMessage(SyncHandler.MESSAGE_SYNC_ALARM);
diff --git a/services/core/java/com/android/server/pm/DefaultPermissionGrantPolicy.java b/services/core/java/com/android/server/pm/DefaultPermissionGrantPolicy.java
new file mode 100644
index 0000000..fe3103b
--- /dev/null
+++ b/services/core/java/com/android/server/pm/DefaultPermissionGrantPolicy.java
@@ -0,0 +1,521 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.server.pm;
+
+import android.Manifest;
+import android.content.Intent;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageManager;
+import android.content.pm.PackageManagerInternal.PackagesProvider;
+import android.content.pm.PackageParser;
+import android.content.pm.ResolveInfo;
+import android.net.Uri;
+import android.os.Build;
+import android.os.UserHandle;
+import android.provider.MediaStore;
+import android.util.ArraySet;
+import android.util.Log;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import static android.os.Process.FIRST_APPLICATION_UID;
+
+/**
+ * This class is the policy for granting runtime permissions to
+ * platform components and default handlers in the system such
+ * that the device is usable out-of-the-box. For example, the
+ * shell UID is a part of the system and the Phone app should
+ * have phone related permission by default.
+ */
+final class DefaultPermissionGrantPolicy {
+    private static final String TAG = "DefaultPermissionGrantPolicy";
+    private static final boolean DEBUG = false;
+
+    private static final String PACKAGE_MIME_TYPE = "application/vnd.android.package-archive";
+
+    private static final Set<String> PHONE_PERMISSIONS = new ArraySet<>();
+    static {
+        PHONE_PERMISSIONS.add(Manifest.permission.READ_PHONE_STATE);
+        PHONE_PERMISSIONS.add(Manifest.permission.CALL_PHONE);
+        PHONE_PERMISSIONS.add( Manifest.permission.READ_CALL_LOG);
+        PHONE_PERMISSIONS.add(Manifest.permission.WRITE_CALL_LOG);
+        PHONE_PERMISSIONS.add(Manifest.permission.ADD_VOICEMAIL);
+        PHONE_PERMISSIONS.add(Manifest.permission.USE_SIP);
+        PHONE_PERMISSIONS.add(Manifest.permission.PROCESS_OUTGOING_CALLS);
+    }
+
+    private static final Set<String> CONTACTS_PERMISSIONS = new ArraySet<>();
+    static {
+        CONTACTS_PERMISSIONS.add(Manifest.permission.READ_CONTACTS);
+        CONTACTS_PERMISSIONS.add(Manifest.permission.WRITE_CONTACTS);
+    }
+
+    private static final Set<String> LOCATION_PERMISSIONS = new ArraySet<>();
+    static {
+        LOCATION_PERMISSIONS.add(Manifest.permission.ACCESS_FINE_LOCATION);
+        LOCATION_PERMISSIONS.add(Manifest.permission.ACCESS_COARSE_LOCATION);
+    }
+
+    private static final Set<String> CALENDAR_PERMISSIONS = new ArraySet<>();
+    static {
+        CALENDAR_PERMISSIONS.add(Manifest.permission.READ_CALENDAR);
+        CALENDAR_PERMISSIONS.add(Manifest.permission.WRITE_CALENDAR);
+    }
+
+    private static final Set<String> SMS_PERMISSIONS = new ArraySet<>();
+    static {
+        SMS_PERMISSIONS.add(Manifest.permission.SEND_SMS);
+        SMS_PERMISSIONS.add(Manifest.permission.RECEIVE_SMS);
+        SMS_PERMISSIONS.add(Manifest.permission.READ_SMS);
+        SMS_PERMISSIONS.add(Manifest.permission.RECEIVE_WAP_PUSH);
+        SMS_PERMISSIONS.add(Manifest.permission.RECEIVE_MMS);
+        SMS_PERMISSIONS.add(Manifest.permission.READ_CELL_BROADCASTS);
+    }
+
+    private static final Set<String> MICROPHONE_PERMISSIONS = new ArraySet<>();
+    static {
+        MICROPHONE_PERMISSIONS.add(Manifest.permission.RECORD_AUDIO);
+    }
+
+    private static final Set<String> CAMERA_PERMISSIONS = new ArraySet<>();
+    static {
+        CAMERA_PERMISSIONS.add(Manifest.permission.CAMERA);
+    }
+
+    private static final Set<String> SENSORS_PERMISSIONS = new ArraySet<>();
+    static {
+        SENSORS_PERMISSIONS.add(Manifest.permission.BODY_SENSORS);
+    }
+
+    private static final Set<String> STORAGE_PERMISSIONS = new ArraySet<>();
+    static {
+//        STORAGE_PERMISSIONS.add(Manifest.permission.READ_EXTERNAL_STORAGE);
+        STORAGE_PERMISSIONS.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);
+    }
+
+    private static final Set<String> SETTINGS_PERMISSIONS = new ArraySet<>();
+    static {
+        SETTINGS_PERMISSIONS.add(Manifest.permission.WRITE_SETTINGS);
+    }
+
+    private static final Set<String> INSTALLER_PERMISSIONS = new ArraySet<>();
+    static {
+        INSTALLER_PERMISSIONS.add(Manifest.permission.GRANT_REVOKE_PERMISSIONS);
+        INSTALLER_PERMISSIONS.add(Manifest.permission.INTERACT_ACROSS_USERS_FULL);
+        INSTALLER_PERMISSIONS.add(Manifest.permission.CLEAR_APP_USER_DATA);
+        INSTALLER_PERMISSIONS.add(Manifest.permission.KILL_UID);
+    }
+
+    private static final Set<String> VERIFIER_PERMISSIONS = new ArraySet<>();
+    static {
+        INSTALLER_PERMISSIONS.add(Manifest.permission.GRANT_REVOKE_PERMISSIONS);
+    }
+
+    private final PackageManagerService mService;
+
+    private PackagesProvider mImePackagesProvider;
+    private PackagesProvider mLocationPackagesProvider;
+    private PackagesProvider mVoiceInteractionPackagesProvider;
+
+    public DefaultPermissionGrantPolicy(PackageManagerService service) {
+        mService = service;
+    }
+
+    public void setImePackagesProviderLPr(PackagesProvider provider) {
+        mImePackagesProvider = provider;
+    }
+
+    public void setLocationPackagesProviderLPw(PackagesProvider provider) {
+        mLocationPackagesProvider = provider;
+    }
+
+    public void setVoiceInteractionPackagesProviderLPw(PackagesProvider provider) {
+        mVoiceInteractionPackagesProvider = provider;
+    }
+
+    public void grantDefaultPermissions(int userId) {
+        grantPermissionsToSysComponentsAndPrivApps(userId);
+        grantDefaultSystemHandlerPermissions(userId);
+    }
+
+    private void grantPermissionsToSysComponentsAndPrivApps(int userId) {
+        Log.i(TAG, "Granting permissions to platform components");
+
+        synchronized (mService.mPackages) {
+            for (PackageParser.Package pkg : mService.mPackages.values()) {
+                if (!isSysComponentOrPersistentPrivApp(pkg)
+                        || !doesPackageSupportRuntimePermissions(pkg)) {
+                    continue;
+                }
+                final int permissionCount = pkg.requestedPermissions.size();
+                for (int i = 0; i < permissionCount; i++) {
+                    String permission = pkg.requestedPermissions.get(i);
+                    BasePermission bp = mService.mSettings.mPermissions.get(permission);
+                    if (bp != null && bp.isRuntime()) {
+                        final int flags = mService.getPermissionFlags(permission,
+                                pkg.packageName, userId);
+                        if ((flags & PackageManager.FLAG_PERMISSION_SYSTEM_FIXED) == 0) {
+                            mService.grantRuntimePermission(pkg.packageName, permission, userId);
+                            mService.updatePermissionFlags(permission, pkg.packageName,
+                                    PackageManager.MASK_PERMISSION_FLAGS,
+                                    PackageManager.FLAG_PERMISSION_SYSTEM_FIXED, userId);
+                            if (DEBUG) {
+                                Log.i(TAG, "Granted " + permission + " to system component "
+                                        + pkg.packageName);
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    private void grantDefaultSystemHandlerPermissions(int userId) {
+        Log.i(TAG, "Granting permissions to default platform handlers");
+
+        final PackagesProvider imePackagesProvider;
+        final PackagesProvider locationPackagesProvider;
+        final PackagesProvider voiceInteractionPackagesProvider;
+
+        synchronized (mService.mPackages) {
+            imePackagesProvider = mImePackagesProvider;
+            locationPackagesProvider = mLocationPackagesProvider;
+            voiceInteractionPackagesProvider = mVoiceInteractionPackagesProvider;
+        }
+
+        String[] imePackageNames = (imePackagesProvider != null)
+                ? imePackagesProvider.getPackages(userId) : null;
+        String[] voiceInteractPackageNames = (voiceInteractionPackagesProvider != null)
+                ? voiceInteractionPackagesProvider.getPackages(userId) : null;
+        String[] locationPackageNames = (locationPackagesProvider != null)
+                ? locationPackagesProvider.getPackages(userId) : null;
+
+        synchronized (mService.mPackages) {
+            // Installers
+            Intent installerIntent = new Intent(Intent.ACTION_INSTALL_PACKAGE);
+            installerIntent.addCategory(Intent.CATEGORY_DEFAULT);
+            installerIntent.setDataAndType(Uri.fromFile(new File("foo.apk")),
+                    PACKAGE_MIME_TYPE);
+            List<PackageParser.Package> installerPackages =
+                    getPrivilegedHandlerActivityPackagesLPr(installerIntent, userId);
+            final int installerCount = installerPackages.size();
+            for (int i = 0; i < installerCount; i++) {
+                PackageParser.Package installPackage = installerPackages.get(i);
+                grantInstallPermissionsLPw(installPackage, INSTALLER_PERMISSIONS, userId);
+            }
+
+            // Verifiers
+            Intent verifierIntent = new Intent(Intent.ACTION_PACKAGE_NEEDS_VERIFICATION);
+            verifierIntent.setType(PACKAGE_MIME_TYPE);
+            List<PackageParser.Package> verifierPackages =
+                    getPrivilegedHandlerReceiverPackagesLPr(verifierIntent, userId);
+            final int verifierCount = verifierPackages.size();
+            for (int i = 0; i < verifierCount; i++) {
+                PackageParser.Package verifierPackage = verifierPackages.get(i);
+                grantInstallPermissionsLPw(verifierPackage, VERIFIER_PERMISSIONS, userId);
+            }
+
+            // SetupWizard
+            Intent setupIntent = new Intent(Intent.ACTION_MAIN);
+            setupIntent.addCategory(Intent.CATEGORY_HOME);
+            PackageParser.Package setupPackage = getDefaultSystemHandlerActvityPackageLPr(
+                    setupIntent, userId);
+            if (setupPackage != null
+                    && doesPackageSupportRuntimePermissions(setupPackage)) {
+                grantRuntimePermissionsLPw(setupPackage, PHONE_PERMISSIONS, userId);
+                grantRuntimePermissionsLPw(setupPackage, CONTACTS_PERMISSIONS, userId);
+                grantRuntimePermissionsLPw(setupPackage, SETTINGS_PERMISSIONS, userId);
+            }
+
+            // Phone
+            Intent dialerIntent = new Intent(Intent.ACTION_DIAL);
+            PackageParser.Package dialerPackage = getDefaultSystemHandlerActvityPackageLPr(
+                    dialerIntent, userId);
+            if (dialerPackage != null
+                    && doesPackageSupportRuntimePermissions(dialerPackage)) {
+                grantRuntimePermissionsLPw(dialerPackage, PHONE_PERMISSIONS, userId);
+                grantRuntimePermissionsLPw(dialerPackage, CONTACTS_PERMISSIONS, userId);
+                grantRuntimePermissionsLPw(dialerPackage, SMS_PERMISSIONS, userId);
+                grantRuntimePermissionsLPw(dialerPackage, MICROPHONE_PERMISSIONS, userId);
+            }
+
+            // Camera
+            Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
+            PackageParser.Package cameraPackage = getDefaultSystemHandlerActvityPackageLPr(
+                    cameraIntent, userId);
+            if (cameraPackage != null
+                    && doesPackageSupportRuntimePermissions(cameraPackage)) {
+                grantRuntimePermissionsLPw(cameraPackage, CAMERA_PERMISSIONS, userId);
+                grantRuntimePermissionsLPw(cameraPackage, MICROPHONE_PERMISSIONS, userId);
+            }
+
+            // Messaging
+            Intent messagingIntent = new Intent(Intent.ACTION_MAIN);
+            messagingIntent.addCategory(Intent.CATEGORY_APP_MESSAGING);
+            PackageParser.Package messagingPackage = getDefaultSystemHandlerActvityPackageLPr(
+                    messagingIntent, userId);
+            if (messagingPackage != null
+                    && doesPackageSupportRuntimePermissions(messagingPackage)) {
+                grantRuntimePermissionsLPw(messagingPackage, PHONE_PERMISSIONS, userId);
+                grantRuntimePermissionsLPw(messagingPackage, CONTACTS_PERMISSIONS, userId);
+                grantRuntimePermissionsLPw(messagingPackage, SMS_PERMISSIONS, userId);
+            }
+
+            // Calendar
+            Intent calendarIntent = new Intent(Intent.ACTION_MAIN);
+            calendarIntent.addCategory(Intent.CATEGORY_APP_CALENDAR);
+            PackageParser.Package calendarPackage = getDefaultSystemHandlerActvityPackageLPr(
+                    calendarIntent, userId);
+            if (calendarPackage != null
+                    && doesPackageSupportRuntimePermissions(calendarPackage)) {
+                grantRuntimePermissionsLPw(calendarPackage, CALENDAR_PERMISSIONS, userId);
+                grantRuntimePermissionsLPw(calendarPackage, CONTACTS_PERMISSIONS, userId);
+            }
+
+            // Contacts
+            Intent contactsIntent = new Intent(Intent.ACTION_MAIN);
+            contactsIntent.addCategory(Intent.CATEGORY_APP_CONTACTS);
+            PackageParser.Package contactsPackage = getDefaultSystemHandlerActvityPackageLPr(
+                    contactsIntent, userId);
+            if (contactsPackage != null
+                    && doesPackageSupportRuntimePermissions(contactsPackage)) {
+                grantRuntimePermissionsLPw(contactsPackage, CONTACTS_PERMISSIONS, userId);
+                grantRuntimePermissionsLPw(contactsPackage, PHONE_PERMISSIONS, userId);
+            }
+
+            // Maps
+            Intent mapsIntent = new Intent(Intent.ACTION_MAIN);
+            mapsIntent.addCategory(Intent.CATEGORY_APP_MAPS);
+            PackageParser.Package mapsPackage = getDefaultSystemHandlerActvityPackageLPr(
+                    mapsIntent, userId);
+            if (mapsPackage != null
+                    && doesPackageSupportRuntimePermissions(mapsPackage)) {
+                grantRuntimePermissionsLPw(mapsPackage, LOCATION_PERMISSIONS, userId);
+            }
+
+            // Email
+            Intent emailIntent = new Intent(Intent.ACTION_MAIN);
+            emailIntent.addCategory(Intent.CATEGORY_APP_EMAIL);
+            PackageParser.Package emailPackage = getDefaultSystemHandlerActvityPackageLPr(
+                    emailIntent, userId);
+            if (emailPackage != null
+                    && doesPackageSupportRuntimePermissions(emailPackage)) {
+                grantRuntimePermissionsLPw(emailPackage, CONTACTS_PERMISSIONS, userId);
+            }
+
+            // Browser
+            Intent browserIntent = new Intent(Intent.ACTION_MAIN);
+            browserIntent.addCategory(Intent.CATEGORY_APP_BROWSER);
+            PackageParser.Package browserPackage = getDefaultSystemHandlerActvityPackageLPr(
+                    browserIntent, userId);
+            if (browserPackage != null
+                    && doesPackageSupportRuntimePermissions(browserPackage)) {
+                grantRuntimePermissionsLPw(browserPackage, LOCATION_PERMISSIONS, userId);
+            }
+
+            // IME
+            if (imePackageNames != null) {
+                for (String imePackageName : imePackageNames) {
+                    PackageParser.Package imePackage = getSystemPackageLPr(imePackageName);
+                    if (imePackage != null
+                            && doesPackageSupportRuntimePermissions(imePackage)) {
+                        grantRuntimePermissionsLPw(imePackage, CONTACTS_PERMISSIONS, userId);
+                    }
+                }
+            }
+
+            // Voice interaction
+            if (voiceInteractPackageNames != null) {
+                for (String voiceInteractPackageName : voiceInteractPackageNames) {
+                    PackageParser.Package voiceInteractPackage = getSystemPackageLPr(
+                            voiceInteractPackageName);
+                    if (voiceInteractPackage != null
+                            && doesPackageSupportRuntimePermissions(voiceInteractPackage)) {
+                        grantRuntimePermissionsLPw(voiceInteractPackage,
+                                CONTACTS_PERMISSIONS, userId);
+                        grantRuntimePermissionsLPw(voiceInteractPackage,
+                                CALENDAR_PERMISSIONS, userId);
+                        grantRuntimePermissionsLPw(voiceInteractPackage,
+                                MICROPHONE_PERMISSIONS, userId);
+                        grantRuntimePermissionsLPw(voiceInteractPackage,
+                                PHONE_PERMISSIONS, userId);
+                        grantRuntimePermissionsLPw(voiceInteractPackage,
+                                SMS_PERMISSIONS, userId);
+                        grantRuntimePermissionsLPw(voiceInteractPackage,
+                                LOCATION_PERMISSIONS, userId);
+                    }
+                }
+            }
+
+            // Location
+            if (locationPackageNames != null) {
+                for (String packageName : locationPackageNames) {
+                    PackageParser.Package locationPackage = getSystemPackageLPr(packageName);
+                    if (locationPackage != null
+                            && doesPackageSupportRuntimePermissions(locationPackage)) {
+                        grantRuntimePermissionsLPw(locationPackage, CONTACTS_PERMISSIONS, userId);
+                        grantRuntimePermissionsLPw(locationPackage, CALENDAR_PERMISSIONS, userId);
+                        grantRuntimePermissionsLPw(locationPackage, MICROPHONE_PERMISSIONS, userId);
+                        grantRuntimePermissionsLPw(locationPackage, PHONE_PERMISSIONS, userId);
+                        grantRuntimePermissionsLPw(locationPackage, SMS_PERMISSIONS, userId);
+                        grantRuntimePermissionsLPw(locationPackage, LOCATION_PERMISSIONS, userId);
+                        grantRuntimePermissionsLPw(locationPackage, CAMERA_PERMISSIONS, userId);
+                        grantRuntimePermissionsLPw(locationPackage, SENSORS_PERMISSIONS, userId);
+                        grantRuntimePermissionsLPw(locationPackage, STORAGE_PERMISSIONS, userId);
+                    }
+                }
+            }
+        }
+    }
+
+    private List<PackageParser.Package> getPrivilegedHandlerReceiverPackagesLPr(
+            Intent intent, int userId) {
+        List<ResolveInfo> handlers = mService.queryIntentReceivers(
+                intent, intent.resolveTypeIfNeeded(mService.mContext.getContentResolver()),
+                0, userId);
+        return getPrivilegedPackages(handlers);
+    }
+
+    private List<PackageParser.Package> getPrivilegedHandlerActivityPackagesLPr(
+            Intent intent, int userId) {
+        List<ResolveInfo> handlers = mService.queryIntentActivities(
+                intent, intent.resolveTypeIfNeeded(mService.mContext.getContentResolver()),
+                0, userId);
+        return getPrivilegedPackages(handlers);
+    }
+
+    private List<PackageParser.Package> getPrivilegedPackages(List<ResolveInfo> resolveInfos) {
+        List<PackageParser.Package> handlerPackages = new ArrayList<>();
+        final int handlerCount = resolveInfos.size();
+        for (int i = 0; i < handlerCount; i++) {
+            ResolveInfo handler = resolveInfos.get(i);
+            PackageParser.Package handlerPackage = getPrivilegedPackageLPr(
+                    handler.activityInfo.packageName);
+            if (handlerPackage != null) {
+                handlerPackages.add(handlerPackage);
+            }
+        }
+        return handlerPackages;
+    }
+
+    private PackageParser.Package getDefaultSystemHandlerActvityPackageLPr(
+            Intent intent, int userId) {
+        List<ResolveInfo> handlers = mService.queryIntentActivities(intent, null, 0, userId);
+        final int handlerCount = handlers.size();
+        for (int i = 0; i < handlerCount; i++) {
+            ResolveInfo handler = handlers.get(i);
+            // TODO: This is a temporary hack to figure out the setup app.
+            PackageParser.Package handlerPackage = getSystemPackageLPr(
+                    handler.activityInfo.packageName);
+            if (handlerPackage != null) {
+                return handlerPackage;
+            }
+        }
+        return null;
+    }
+
+    private PackageParser.Package getSystemPackageLPr(String packageName) {
+        PackageParser.Package pkg = mService.mPackages.get(packageName);
+        if (pkg != null && pkg.isSystemApp()) {
+            return !isSysComponentOrPersistentPrivApp(pkg) ? pkg : null;
+        }
+        return null;
+    }
+
+    private PackageParser.Package getPrivilegedPackageLPr(String packageName) {
+        PackageParser.Package pkg = mService.mPackages.get(packageName);
+        if (pkg != null && pkg.applicationInfo.isPrivilegedApp()) {
+            return !isSysComponentOrPersistentPrivApp(pkg) ? pkg : null;
+        }
+        return null;
+    }
+
+    private void grantRuntimePermissionsLPw(PackageParser.Package pkg, Set<String> permissions,
+            int userId) {
+        List<String> requestedPermissions = pkg.requestedPermissions;
+
+        if (pkg.isUpdatedSystemApp()) {
+            PackageSetting sysPs = mService.mSettings.getDisabledSystemPkgLPr(pkg.packageName);
+            if (sysPs != null) {
+                requestedPermissions = sysPs.pkg.requestedPermissions;
+            }
+        }
+
+        final int permissionCount = requestedPermissions.size();
+        for (int i = 0; i < permissionCount; i++) {
+            String permission = requestedPermissions.get(i);
+            if (permissions.contains(permission)) {
+                final int flags = mService.getPermissionFlags(permission, pkg.packageName, userId);
+
+                // If any flags are set to the permission, then it is either set in
+                // its current state by the system or device/profile owner or the user.
+                // In all these cases we do not want to clobber the current state.
+                if (flags == 0) {
+                    mService.grantRuntimePermission(pkg.packageName, permission, userId);
+                    if (DEBUG) {
+                        Log.i(TAG, "Granted " + permission + " to default handler "
+                                + pkg.packageName);
+                    }
+                }
+            }
+        }
+    }
+
+    private void grantInstallPermissionsLPw(PackageParser.Package pkg, Set<String> permissions,
+            int userId) {
+        List<String> requestedPermissions = pkg.requestedPermissions;
+
+        if (pkg.isUpdatedSystemApp()) {
+            PackageSetting sysPs = mService.mSettings.getDisabledSystemPkgLPr(pkg.packageName);
+            if (sysPs != null) {
+                requestedPermissions = sysPs.pkg.requestedPermissions;
+            }
+        }
+
+        final int permissionCount = requestedPermissions.size();
+        for (int i = 0; i < permissionCount; i++) {
+            String permission = requestedPermissions.get(i);
+            if (permissions.contains(permission)) {
+                final int flags = mService.getPermissionFlags(permission, pkg.packageName, userId);
+
+                // If any flags are set to the permission, then it is either set in
+                // its current state by the system or device/profile owner or the user.
+                // In all these cases we do not want to clobber the current state.
+                if (flags == 0) {
+                    mService.grantInstallPermissionLPw(permission, pkg);
+                    if (DEBUG) {
+                        Log.i(TAG, "Granted install " + permission + " to " + pkg.packageName);
+                    }
+                }
+            }
+        }
+    }
+
+    private static boolean isSysComponentOrPersistentPrivApp(PackageParser.Package pkg) {
+        return UserHandle.getAppId(pkg.applicationInfo.uid) < FIRST_APPLICATION_UID
+                || ((pkg.applicationInfo.privateFlags
+                & ApplicationInfo.PRIVATE_FLAG_PRIVILEGED) != 0
+                && (pkg.applicationInfo.flags & ApplicationInfo.FLAG_PERSISTENT) != 0);
+    }
+
+    private static boolean doesPackageSupportRuntimePermissions(PackageParser.Package pkg) {
+        return pkg.applicationInfo.targetSdkVersion > Build.VERSION_CODES.LOLLIPOP_MR1;
+    }
+}
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index e7fddb9..95cb11d 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -55,7 +55,6 @@
 import static android.content.pm.PackageManager.MOVE_FAILED_OPERATION_PENDING;
 import static android.content.pm.PackageManager.MOVE_FAILED_SYSTEM_PACKAGE;
 import static android.content.pm.PackageParser.isApkFile;
-import static android.os.Process.FIRST_APPLICATION_UID;
 import static android.os.Process.PACKAGE_INFO_GID;
 import static android.os.Process.SYSTEM_UID;
 import static android.system.OsConstants.O_CREAT;
@@ -111,6 +110,7 @@
 import android.content.pm.PackageInstaller;
 import android.content.pm.PackageManager;
 import android.content.pm.PackageManager.LegacyPackageDeleteObserver;
+import android.content.pm.PackageManagerInternal;
 import android.content.pm.PackageParser;
 import android.content.pm.PackageParser.ActivityIntentInfo;
 import android.content.pm.PackageParser.PackageLite;
@@ -281,6 +281,8 @@
     private static final boolean DEBUG_DEXOPT = false;
     private static final boolean DEBUG_ABI_SELECTION = false;
 
+    static final boolean CLEAR_RUNTIME_PERMISSIONS_ON_UPGRADE = Build.IS_DEBUGGABLE;
+
     private static final int RADIO_UID = Process.PHONE_UID;
     private static final int LOG_UID = Process.LOG_UID;
     private static final int NFC_UID = Process.NFC_UID;
@@ -551,6 +553,9 @@
     final SparseArray<IntentFilterVerificationState> mIntentFilterVerificationStates
             = new SparseArray<IntentFilterVerificationState>();
 
+    final DefaultPermissionGrantPolicy mDefaultPermissionPolicy =
+            new DefaultPermissionGrantPolicy(this);
+
     private interface IntentFilterVerifier<T extends IntentFilter> {
         boolean addOneIntentFilterVerification(int verifierId, int userId, int verificationId,
                                                T filter, String packageName);
@@ -2199,6 +2204,9 @@
         // are all flushed.  Not really needed, but keeps things nice and
         // tidy.
         Runtime.getRuntime().gc();
+
+        // Expose private service for system components to use.
+        LocalServices.addService(PackageManagerInternal.class, new PackageManagerInternalImpl());
     }
 
     @Override
@@ -3155,7 +3163,7 @@
     }
 
     @Override
-    public void grantRuntimePermission(String packageName, String name, int userId) {
+    public void grantRuntimePermission(String packageName, String name, final int userId) {
         if (!sUserManager.exists(userId)) {
             Log.e(TAG, "No such user:" + userId);
             return;
@@ -3168,7 +3176,6 @@
         enforceCrossUserPermission(Binder.getCallingUid(), userId, true, false,
                 "grantRuntimePermission");
 
-        boolean gidsChanged = false;
         final SettingBase sb;
 
         synchronized (mPackages) {
@@ -3204,7 +3211,12 @@
                 }
 
                 case PermissionsState.PERMISSION_OPERATION_SUCCESS_GIDS_CHANGED: {
-                    gidsChanged = true;
+                    mHandler.post(new Runnable() {
+                        @Override
+                        public void run() {
+                            killSettingPackagesForUser(sb, userId, KILL_APP_REASON_GIDS_CHANGED);
+                        }
+                    });
                 } break;
             }
 
@@ -3213,10 +3225,6 @@
             // Not critical if that is lost - app has to request again.
             mSettings.writeRuntimePermissionsForUserLPr(userId, false);
         }
-
-        if (gidsChanged) {
-            killSettingPackagesForUser(sb, userId, KILL_APP_REASON_GIDS_CHANGED);
-        }
     }
 
     @Override
@@ -3323,15 +3331,14 @@
         enforceCrossUserPermission(Binder.getCallingUid(), userId, true, false,
                 "updatePermissionFlags");
 
-        // Only the system can change policy flags.
+        // Only the system can change policy and system fixed flags.
         if (getCallingUid() != Process.SYSTEM_UID) {
             flagMask &= ~PackageManager.FLAG_PERMISSION_POLICY_FIXED;
             flagValues &= ~PackageManager.FLAG_PERMISSION_POLICY_FIXED;
-        }
 
-        // Only the package manager can change system flags.
-        flagMask &= ~PackageManager.FLAG_PERMISSION_SYSTEM_FIXED;
-        flagValues &= ~PackageManager.FLAG_PERMISSION_SYSTEM_FIXED;
+            flagMask &= ~PackageManager.FLAG_PERMISSION_SYSTEM_FIXED;
+            flagValues &= ~PackageManager.FLAG_PERMISSION_SYSTEM_FIXED;
+        }
 
         synchronized (mPackages) {
             final PackageParser.Package pkg = mPackages.get(packageName);
@@ -3409,6 +3416,21 @@
         return (flags & PackageManager.FLAG_PERMISSION_USER_SET) != 0;
     }
 
+    void grantInstallPermissionLPw(String permission, PackageParser.Package pkg) {
+        BasePermission bp = mSettings.mPermissions.get(permission);
+        if (bp == null) {
+            throw new SecurityException("Missing " + permission + " permission");
+        }
+
+        SettingBase sb = (SettingBase) pkg.mExtras;
+        PermissionsState permissionsState = sb.getPermissionsState();
+
+        if (permissionsState.grantInstallPermission(bp) !=
+                PermissionsState.PERMISSION_OPERATION_FAILURE) {
+            scheduleWriteSettingsLocked();
+        }
+    }
+
     @Override
     public void addOnPermissionsChangeListener(IOnPermissionsChangeListener listener) {
         mContext.enforceCallingOrSelfPermission(
@@ -7753,7 +7775,6 @@
 
         final int[] currentUserIds = UserManagerService.getInstance().getUserIds();
 
-        int[] upgradeUserIds = EMPTY_INT_ARRAY;
         int[] changedRuntimePermissionUserIds = EMPTY_INT_ARRAY;
 
         boolean changedInstallPermission = false;
@@ -7810,32 +7831,11 @@
                     if (pkg.applicationInfo.targetSdkVersion <= Build.VERSION_CODES.LOLLIPOP_MR1) {
                         // For legacy apps dangerous permissions are install time ones.
                         grant = GRANT_INSTALL_LEGACY;
-                    } else if (ps.isSystem()) {
-                        final int[] updatedUserIds = ps.getPermissionsUpdatedForUserIds();
-                        if (origPermissions.hasInstallPermission(bp.name)) {
-                            // If a system app had an install permission, then the app was
-                            // upgraded and we grant the permissions as runtime to all users.
-                            grant = GRANT_UPGRADE;
-                            upgradeUserIds = currentUserIds;
-                        } else if (!Arrays.equals(updatedUserIds, currentUserIds)) {
-                            // If users changed since the last permissions update for a
-                            // system app, we grant the permission as runtime to the new users.
-                            grant = GRANT_UPGRADE;
-                            upgradeUserIds = currentUserIds;
-                            for (int userId : updatedUserIds) {
-                                upgradeUserIds = ArrayUtils.removeInt(upgradeUserIds, userId);
-                            }
-                        } else {
-                            // Otherwise, we grant the permission as runtime if the app
-                            // already had it, i.e. we preserve runtime permissions.
-                            grant = GRANT_RUNTIME;
-                        }
                     } else if (origPermissions.hasInstallPermission(bp.name)) {
                         // For legacy apps that became modern, install becomes runtime.
                         grant = GRANT_UPGRADE;
-                        upgradeUserIds = currentUserIds;
-                    } else if (replace) {
-                        // For upgraded modern apps keep runtime permissions unchanged.
+                    } else {
+                        // For modern apps keep runtime permissions unchanged.
                         grant = GRANT_RUNTIME;
                     }
                 } break;
@@ -7870,7 +7870,7 @@
                 switch (grant) {
                     case GRANT_INSTALL: {
                         // Revoke this as runtime permission to handle the case of
-                        // a runtime permssion being downgraded to an install one.
+                        // a runtime permission being downgraded to an install one.
                         for (int userId : UserManagerService.getInstance().getUserIds()) {
                             if (origPermissions.getRuntimePermissionState(
                                     bp.name, userId) != null) {
@@ -7901,26 +7901,20 @@
                     case GRANT_RUNTIME: {
                         // Grant previously granted runtime permissions.
                         for (int userId : UserManagerService.getInstance().getUserIds()) {
+                            PermissionState permissionState = origPermissions
+                                    .getRuntimePermissionState(bp.name, userId);
+                            final int flags = permissionState != null
+                                    ? permissionState.getFlags() : 0;
                             if (origPermissions.hasRuntimePermission(bp.name, userId)) {
-                                PermissionState permissionState = origPermissions
-                                        .getRuntimePermissionState(bp.name, userId);
-                                final int flags = permissionState.getFlags();
                                 if (permissionsState.grantRuntimePermission(bp, userId) ==
                                         PermissionsState.PERMISSION_OPERATION_FAILURE) {
                                     // If we cannot put the permission as it was, we have to write.
                                     changedRuntimePermissionUserIds = ArrayUtils.appendInt(
                                             changedRuntimePermissionUserIds, userId);
-                                } else {
-                                    // System components not only get the permissions but
-                                    // they are also fixed, so nothing can change that.
-                                    final int newFlags = !isSystemComponentOrPersistentPrivApp(pkg)
-                                            ? flags
-                                            : flags | PackageManager.FLAG_PERMISSION_SYSTEM_FIXED;
-                                    // Propagate the permission flags.
-                                    permissionsState.updatePermissionFlags(bp, userId,
-                                            newFlags, newFlags);
                                 }
                             }
+                            // Propagate the permission flags.
+                            permissionsState.updatePermissionFlags(bp, userId, flags, flags);
                         }
                     } break;
 
@@ -7930,25 +7924,23 @@
                                 .getInstallPermissionState(bp.name);
                         final int flags = permissionState != null ? permissionState.getFlags() : 0;
 
-                        origPermissions.revokeInstallPermission(bp);
-                        // We will be transferring the permission flags, so clear them.
-                        origPermissions.updatePermissionFlags(bp, UserHandle.USER_ALL,
-                                PackageManager.MASK_PERMISSION_FLAGS, 0);
+                        if (origPermissions.revokeInstallPermission(bp)
+                                != PermissionsState.PERMISSION_OPERATION_FAILURE) {
+                            // We will be transferring the permission flags, so clear them.
+                            origPermissions.updatePermissionFlags(bp, UserHandle.USER_ALL,
+                                    PackageManager.MASK_PERMISSION_FLAGS, 0);
+                            changedInstallPermission = true;
+                        }
 
                         // If the permission is not to be promoted to runtime we ignore it and
                         // also its other flags as they are not applicable to install permissions.
                         if ((flags & PackageManager.FLAG_PERMISSION_REVOKE_ON_UPGRADE) == 0) {
-                            for (int userId : upgradeUserIds) {
+                            for (int userId : currentUserIds) {
                                 if (permissionsState.grantRuntimePermission(bp, userId) !=
                                         PermissionsState.PERMISSION_OPERATION_FAILURE) {
-                                    // System components not only get the permissions but
-                                    // they are also fixed so nothing can change that.
-                                    final int newFlags = !isSystemComponentOrPersistentPrivApp(pkg)
-                                            ? flags
-                                            : flags | PackageManager.FLAG_PERMISSION_SYSTEM_FIXED;
                                     // Transfer the permission flags.
                                     permissionsState.updatePermissionFlags(bp, userId,
-                                            newFlags, newFlags);
+                                            flags, flags);
                                     // If we granted the permission, we have to write.
                                     changedRuntimePermissionUserIds = ArrayUtils.appendInt(
                                             changedRuntimePermissionUserIds, userId);
@@ -8000,8 +7992,6 @@
             ps.installPermissionsFixed = true;
         }
 
-        ps.setPermissionsUpdatedForUserIds(currentUserIds);
-
         // Persist the runtime permissions state for users with changes.
         for (int userId : changedRuntimePermissionUserIds) {
             mSettings.writeRuntimePermissionsForUserLPr(userId, false);
@@ -11881,13 +11871,6 @@
         }
     }
 
-    private boolean isSystemComponentOrPersistentPrivApp(PackageParser.Package pkg) {
-        return UserHandle.getAppId(pkg.applicationInfo.uid) < FIRST_APPLICATION_UID
-                || ((pkg.applicationInfo.privateFlags
-                        & ApplicationInfo.PRIVATE_FLAG_PRIVILEGED) != 0
-                && (pkg.applicationInfo.flags & ApplicationInfo.FLAG_PERSISTENT) != 0);
-    }
-
     private static boolean isMultiArch(PackageSetting ps) {
         return (ps.pkgFlags & ApplicationInfo.FLAG_MULTIARCH) != 0;
     }
@@ -12743,6 +12726,9 @@
             }
         }
 
+        // Ensure default permissions are never cleared.
+        mDefaultPermissionPolicy.grantDefaultPermissions(userId);
+
         if (needsWrite) {
             mSettings.writeRuntimePermissionsForUserLPr(userId, true);
         }
@@ -13706,6 +13692,14 @@
         }
         sUserManager.systemReady();
 
+        // If we upgraded grant all default permissions before kicking off.
+        if (isFirstBoot() || (CLEAR_RUNTIME_PERMISSIONS_ON_UPGRADE && mIsUpgrade)) {
+            updatePermissionsLPw(null, null, UPDATE_PERMISSIONS_ALL);
+            for (int userId : UserManagerService.getInstance().getUserIds()) {
+                mDefaultPermissionPolicy.grantDefaultPermissions(userId);
+            }
+        }
+
         // Kick off any messages waiting for system ready
         if (mPostSystemReadyMessages != null) {
             for (Message msg : mPostSystemReadyMessages) {
@@ -15095,9 +15089,16 @@
         }
     }
 
-    void newUserCreatedLILPw(int userHandle) {
-        // Adding a user requires updating runtime permissions for system apps.
-        updatePermissionsLPw(null, null, UPDATE_PERMISSIONS_ALL);
+    void newUserCreatedLILPw(final int userHandle) {
+        // We cannot grant the default permissions with a lock held as
+        // we query providers from other components for default handlers
+        // such as enabled IMEs, etc.
+        mHandler.post(new Runnable() {
+            @Override
+            public void run() {
+                mDefaultPermissionPolicy.grantDefaultPermissions(userHandle);
+            }
+        });
     }
 
     @Override
@@ -15449,4 +15450,27 @@
             }
         }
     }
+
+    private class PackageManagerInternalImpl extends PackageManagerInternal {
+        @Override
+        public void setLocationPackagesProvider(PackagesProvider provider) {
+            synchronized (mPackages) {
+                mDefaultPermissionPolicy.setLocationPackagesProviderLPw(provider);
+            }
+        }
+
+        @Override
+        public void setImePackagesProvider(PackagesProvider provider) {
+            synchronized (mPackages) {
+                mDefaultPermissionPolicy.setImePackagesProviderLPr(provider);
+            }
+        }
+
+        @Override
+        public void setVoiceInteractionPackagesProvider(PackagesProvider provider) {
+            synchronized (mPackages) {
+                mDefaultPermissionPolicy.setVoiceInteractionPackagesProviderLPw(provider);
+            }
+        }
+    }
 }
diff --git a/services/core/java/com/android/server/pm/PackageSettingBase.java b/services/core/java/com/android/server/pm/PackageSettingBase.java
index f62c00c..6f46f69 100644
--- a/services/core/java/com/android/server/pm/PackageSettingBase.java
+++ b/services/core/java/com/android/server/pm/PackageSettingBase.java
@@ -24,7 +24,6 @@
 import android.content.pm.PackageManager;
 import android.content.pm.PackageUserState;
 import android.os.storage.VolumeInfo;
-import android.text.TextUtils;
 import android.util.ArraySet;
 import android.util.SparseArray;
 
@@ -223,7 +222,6 @@
      * Make a shallow copy of this package settings.
      */
     public void copyFrom(PackageSettingBase base) {
-        setPermissionsUpdatedForUserIds(base.getPermissionsUpdatedForUserIds());
         mPermissionsState.copyFrom(base.mPermissionsState);
         primaryCpuAbiString = base.primaryCpuAbiString;
         secondaryCpuAbiString = base.secondaryCpuAbiString;
diff --git a/services/core/java/com/android/server/pm/SettingBase.java b/services/core/java/com/android/server/pm/SettingBase.java
index c35258a..5cf92a9 100644
--- a/services/core/java/com/android/server/pm/SettingBase.java
+++ b/services/core/java/com/android/server/pm/SettingBase.java
@@ -18,16 +18,11 @@
 
 import android.content.pm.ApplicationInfo;
 
-import java.util.Arrays;
-
 abstract class SettingBase {
-    private static final int[] USERS_NONE = new int[0];
-
     int pkgFlags;
     int pkgPrivateFlags;
 
     protected final PermissionsState mPermissionsState;
-    private int[] mPermissionsUpdatedForUserIds = USERS_NONE;
 
     SettingBase(int pkgFlags, int pkgPrivateFlags) {
         setFlags(pkgFlags);
@@ -39,29 +34,12 @@
         pkgFlags = base.pkgFlags;
         pkgPrivateFlags = base.pkgPrivateFlags;
         mPermissionsState = new PermissionsState(base.mPermissionsState);
-        setPermissionsUpdatedForUserIds(base.mPermissionsUpdatedForUserIds);
     }
 
     public PermissionsState getPermissionsState() {
         return mPermissionsState;
     }
 
-    public int[] getPermissionsUpdatedForUserIds() {
-        return mPermissionsUpdatedForUserIds;
-    }
-
-    public void setPermissionsUpdatedForUserIds(int[] userIds) {
-        if (Arrays.equals(mPermissionsUpdatedForUserIds, userIds)) {
-            return;
-        }
-
-        if (userIds == USERS_NONE) {
-            mPermissionsUpdatedForUserIds = userIds;
-        } else {
-            mPermissionsUpdatedForUserIds = Arrays.copyOf(userIds, userIds.length);
-        }
-    }
-
     void setFlags(int pkgFlags) {
         this.pkgFlags = pkgFlags
                 & (ApplicationInfo.FLAG_SYSTEM
diff --git a/services/core/java/com/android/server/pm/Settings.java b/services/core/java/com/android/server/pm/Settings.java
index cd50946..6415343 100644
--- a/services/core/java/com/android/server/pm/Settings.java
+++ b/services/core/java/com/android/server/pm/Settings.java
@@ -1139,17 +1139,6 @@
         return new File(userDir, RUNTIME_PERMISSIONS_FILE_NAME);
     }
 
-    boolean isFirstRuntimePermissionsBoot() {
-        return !getUserRuntimePermissionsFile(UserHandle.USER_OWNER).exists();
-    }
-
-    void deleteRuntimePermissionsFiles() {
-        for (int userId : UserManagerService.getInstance().getUserIds()) {
-            File file = getUserRuntimePermissionsFile(userId);
-            file.delete();
-        }
-    }
-
     private File getUserPackagesStateBackupFile(int userId) {
         return new File(Environment.getUserSystemDirectory(userId),
                 "package-restrictions-backup.xml");
@@ -2098,7 +2087,7 @@
                 }
 
                 final ApplicationInfo ai = pkg.pkg.applicationInfo;
-                final String dataPath = ai.dataDir;
+                final String dataPath = new File(ai.dataDir).getCanonicalPath();
                 final boolean isDebug = (ai.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
                 final int[] gids = pkg.getPermissionsState().computeGids(userIds);
 
@@ -2466,6 +2455,22 @@
                     } catch (NumberFormatException e) {
                     }
                     mFingerprint = parser.getAttributeValue(null, "fingerprint");
+
+                    // If the build is setup to drop runtime permissions
+                    // on update drop the files before loading them.
+                    if (PackageManagerService.CLEAR_RUNTIME_PERMISSIONS_ON_UPGRADE) {
+                        if (!Build.FINGERPRINT.equals(mFingerprint)) {
+                            if (users == null) {
+                                mRuntimePermissionsPersistence.deleteUserRuntimePermissionsFile(
+                                        UserHandle.USER_OWNER);
+                            } else {
+                                for (UserInfo user : users) {
+                                    mRuntimePermissionsPersistence.deleteUserRuntimePermissionsFile(
+                                            user.id);
+                                }
+                            }
+                        }
+                    }
                 } else if (tagName.equals("database-version")) {
                     mInternalDatabaseVersion = mExternalDatabaseVersion = 0;
                     try {
@@ -2554,15 +2559,21 @@
         } else {
             if (users == null) {
                 readPackageRestrictionsLPr(0);
-                mRuntimePermissionsPersistence.readStateForUserSyncLPr(UserHandle.USER_OWNER);
             } else {
                 for (UserInfo user : users) {
                     readPackageRestrictionsLPr(user.id);
-                    mRuntimePermissionsPersistence.readStateForUserSyncLPr(user.id);
                 }
             }
         }
 
+        if (users == null) {
+            mRuntimePermissionsPersistence.readStateForUserSyncLPr(UserHandle.USER_OWNER);
+        } else {
+            for (UserInfo user : users) {
+                mRuntimePermissionsPersistence.readStateForUserSyncLPr(user.id);
+            }
+        }
+
         /*
          * Make sure all the updated system packages have their shared users
          * associated with them.
@@ -3056,18 +3067,6 @@
             }
         }
 
-        // We keep track for which users we granted permissions to be able
-        // to grant runtime permissions to system apps for newly appeared
-        // users or newly appeared system apps. If we supported runtime
-        // permissions during the previous boot, then we already granted
-        // permissions for all device users. In such a case we set the users
-        // for which we granted permissions to avoid clobbering of runtime
-        // permissions we granted to system apps but the user revoked later.
-        if (!isFirstRuntimePermissionsBoot()) {
-            final int[] userIds = UserManagerService.getInstance().getUserIds();
-            ps.setPermissionsUpdatedForUserIds(userIds);
-        }
-
         mDisabledSysPackages.put(name, ps);
     }
 
@@ -3364,18 +3363,6 @@
                     XmlUtils.skipCurrentTag(parser);
                 }
             }
-
-            // We keep track for which users we granted permissions to be able
-            // to grant runtime permissions to system apps for newly appeared
-            // users or newly appeared system apps. If we supported runtime
-            // permissions during the previous boot, then we already granted
-            // permissions for all device users. In such a case we set the users
-            // for which we granted permissions to avoid clobbering of runtime
-            // permissions we granted to system apps but the user revoked later.
-            if (!isFirstRuntimePermissionsBoot()) {
-                final int[] userIds = UserManagerService.getInstance().getUserIds();
-                packageSetting.setPermissionsUpdatedForUserIds(userIds);
-            }
         } else {
             XmlUtils.skipCurrentTag(parser);
         }
@@ -3493,18 +3480,6 @@
                     XmlUtils.skipCurrentTag(parser);
                 }
             }
-
-            // We keep track for which users we granted permissions to be able
-            // to grant runtime permissions to system apps for newly appeared
-            // users or newly appeared system apps. If we supported runtime
-            // permissions during the previous boot, then we already granted
-            // permissions for all device users. In such a case we set the users
-            // for which we granted permissions to avoid clobbering of runtime
-            // permissions we granted to system apps but the user revoked later.
-            if (!isFirstRuntimePermissionsBoot()) {
-                final int[] userIds = UserManagerService.getInstance().getUserIds();
-                su.setPermissionsUpdatedForUserIds(userIds);
-            }
         } else {
             XmlUtils.skipCurrentTag(parser);
         }
@@ -4364,8 +4339,6 @@
                 Slog.wtf(PackageManagerService.TAG,
                         "Failed to write settings, restoring backup", t);
                 destination.failWrite(out);
-                throw new IllegalStateException("Failed to write runtime permissions,"
-                        + " restoring backup", t);
             } finally {
                 IoUtils.closeQuietly(out);
             }
@@ -4397,6 +4370,10 @@
             }
         }
 
+        public void deleteUserRuntimePermissionsFile(int userId) {
+            getUserRuntimePermissionsFile(userId).delete();
+        }
+
         public void readStateForUserSyncLPr(int userId) {
             File permissionsFile = getUserRuntimePermissionsFile(userId);
             if (!permissionsFile.exists()) {
@@ -4489,22 +4466,12 @@
                                 ? Integer.parseInt(flagsStr, 16) : 0;
 
                         if (granted) {
-                            if (permissionsState.grantRuntimePermission(bp, userId) ==
-                                    PermissionsState.PERMISSION_OPERATION_FAILURE) {
-                                Slog.w(PackageManagerService.TAG, "Duplicate permission:" + name);
-                            } else {
-                                permissionsState.updatePermissionFlags(bp, userId,
+                            permissionsState.grantRuntimePermission(bp, userId);
+                            permissionsState.updatePermissionFlags(bp, userId,
                                         PackageManager.MASK_PERMISSION_FLAGS, flags);
-
-                            }
                         } else {
-                            if (permissionsState.revokeRuntimePermission(bp, userId) ==
-                                    PermissionsState.PERMISSION_OPERATION_FAILURE) {
-                                Slog.w(PackageManagerService.TAG, "Duplicate permission:" + name);
-                            } else {
-                                permissionsState.updatePermissionFlags(bp, userId,
-                                        PackageManager.MASK_PERMISSION_FLAGS, flags);
-                            }
+                            permissionsState.updatePermissionFlags(bp, userId,
+                                    PackageManager.MASK_PERMISSION_FLAGS, flags);
                         }
 
                     } break;
diff --git a/services/core/java/com/android/server/statusbar/StatusBarManagerInternal.java b/services/core/java/com/android/server/statusbar/StatusBarManagerInternal.java
index 58c3ea1..4692403 100644
--- a/services/core/java/com/android/server/statusbar/StatusBarManagerInternal.java
+++ b/services/core/java/com/android/server/statusbar/StatusBarManagerInternal.java
@@ -24,4 +24,5 @@
     void notificationLightPulse(int argb, int onMillis, int offMillis);
     void notificationLightOff();
     void showScreenPinningRequest();
+    void showAssistDisclosure();
 }
diff --git a/services/core/java/com/android/server/statusbar/StatusBarManagerService.java b/services/core/java/com/android/server/statusbar/StatusBarManagerService.java
index 5669f30..a754379 100644
--- a/services/core/java/com/android/server/statusbar/StatusBarManagerService.java
+++ b/services/core/java/com/android/server/statusbar/StatusBarManagerService.java
@@ -154,6 +154,16 @@
                 }
             }
         }
+
+        @Override
+        public void showAssistDisclosure() {
+            if (mBar != null) {
+                try {
+                    mBar.showAssistDisclosure();
+                } catch (RemoteException e) {
+                }
+            }
+        }
     };
 
     // ================================================================================
diff --git a/services/core/java/com/android/server/wm/WindowStateAnimator.java b/services/core/java/com/android/server/wm/WindowStateAnimator.java
index 5064d8f..f1331e9 100644
--- a/services/core/java/com/android/server/wm/WindowStateAnimator.java
+++ b/services/core/java/com/android/server/wm/WindowStateAnimator.java
@@ -1383,10 +1383,21 @@
 
         // Adjust for surface insets.
         final LayoutParams attrs = w.getAttrs();
-        width += attrs.surfaceInsets.left + attrs.surfaceInsets.right;
-        height += attrs.surfaceInsets.top + attrs.surfaceInsets.bottom;
-        left -= attrs.surfaceInsets.left;
-        top -= attrs.surfaceInsets.top;
+        final int displayId = w.getDisplayId();
+        float scale = 1.0f;
+        // Magnification is supported only for the default display.
+        if (mService.mAccessibilityController != null && displayId == Display.DEFAULT_DISPLAY) {
+            MagnificationSpec spec =
+                    mService.mAccessibilityController.getMagnificationSpecForWindowLocked(w);
+            if (spec != null && !spec.isNop()) {
+                scale = spec.scale;
+            }
+        }
+
+        width += scale * (attrs.surfaceInsets.left + attrs.surfaceInsets.right);
+        height += scale * (attrs.surfaceInsets.top + attrs.surfaceInsets.bottom);
+        left -= scale * attrs.surfaceInsets.left;
+        top -= scale * attrs.surfaceInsets.top;
 
         final boolean surfaceMoved = mSurfaceX != left || mSurfaceY != top;
         if (surfaceMoved) {
diff --git a/services/tests/servicestests/src/com/android/server/ConnectivityServiceTest.java b/services/tests/servicestests/src/com/android/server/ConnectivityServiceTest.java
index b58c2e2..712db09 100644
--- a/services/tests/servicestests/src/com/android/server/ConnectivityServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/ConnectivityServiceTest.java
@@ -134,6 +134,7 @@
         private final NetworkInfo mNetworkInfo;
         private final NetworkCapabilities mNetworkCapabilities;
         private final Thread mThread;
+        private int mScore;
         private NetworkAgent mNetworkAgent;
 
         MockNetworkAgent(int transport) {
@@ -142,13 +143,12 @@
             mNetworkInfo = new NetworkInfo(type, 0, typeName, "Mock");
             mNetworkCapabilities = new NetworkCapabilities();
             mNetworkCapabilities.addTransportType(transport);
-            final int score;
             switch (transport) {
                 case TRANSPORT_WIFI:
-                    score = 60;
+                    mScore = 60;
                     break;
                 case TRANSPORT_CELLULAR:
-                    score = 50;
+                    mScore = 50;
                     break;
                 default:
                     throw new UnsupportedOperationException("unimplemented network type");
@@ -159,7 +159,7 @@
                     Looper.prepare();
                     mNetworkAgent = new NetworkAgent(Looper.myLooper(), mServiceContext,
                             "Mock" + typeName, mNetworkInfo, mNetworkCapabilities,
-                            new LinkProperties(), score, new NetworkMisc()) {
+                            new LinkProperties(), mScore, new NetworkMisc()) {
                         public void unwanted() {}
                     };
                     initComplete.open();
@@ -167,7 +167,12 @@
                 }
             };
             mThread.start();
-            initComplete.block();
+            waitFor(initComplete);
+        }
+
+        public void adjustScore(int change) {
+            mScore += change;
+            mNetworkAgent.sendNetworkScore(mScore);
         }
 
         /**
@@ -209,7 +214,7 @@
 
             if (validated) {
                 // Wait for network to validate.
-                validatedCv.block();
+                waitFor(validatedCv);
                 mNetworkCapabilities.addCapability(NET_CAPABILITY_INTERNET);
                 mNetworkAgent.sendNetworkCapabilities(mNetworkCapabilities);
             }
@@ -330,6 +335,10 @@
         public boolean get();
     }
 
+    /**
+     * Wait up to 500ms for {@code criteria.get()} to become true, polling.
+     * Fails if 500ms goes by before {@code criteria.get()} to become true.
+     */
     static private void waitFor(Criteria criteria) {
         int delays = 0;
         while (!criteria.get()) {
@@ -341,6 +350,26 @@
         }
     }
 
+    /**
+     * Wait up to 500ms for {@code conditonVariable} to open.
+     * Fails if 500ms goes by before {@code conditionVariable} opens.
+     */
+    static private void waitFor(ConditionVariable conditionVariable) {
+        assertTrue(conditionVariable.block(500));
+    }
+
+    /**
+     * This should only be used to verify that nothing happens, in other words that no unexpected
+     * changes occur.  It should never be used to wait for a specific positive signal to occur.
+     */
+    private void shortSleep() {
+        // TODO: Instead of sleeping, instead wait for all message loops to idle.
+        try {
+            Thread.sleep(500);
+        } catch (InterruptedException e) {
+        }
+    }
+
     @Override
     public void setUp() throws Exception {
         super.setUp();
@@ -431,7 +460,7 @@
         // Test bringing up validated cellular.
         ConditionVariable cv = waitForConnectivityBroadcasts(1);
         mCellNetworkAgent.connect(true);
-        cv.block();
+        waitFor(cv);
         verifyActiveNetwork(TRANSPORT_CELLULAR);
         assertEquals(2, mCm.getAllNetworks().length);
         assertTrue(mCm.getAllNetworks()[0].equals(mCm.getActiveNetwork()) ||
@@ -441,7 +470,7 @@
         // Test bringing up validated WiFi.
         cv = waitForConnectivityBroadcasts(2);
         mWiFiNetworkAgent.connect(true);
-        cv.block();
+        waitFor(cv);
         verifyActiveNetwork(TRANSPORT_WIFI);
         assertEquals(2, mCm.getAllNetworks().length);
         assertTrue(mCm.getAllNetworks()[0].equals(mCm.getActiveNetwork()) ||
@@ -459,7 +488,7 @@
         // Test WiFi disconnect.
         cv = waitForConnectivityBroadcasts(1);
         mWiFiNetworkAgent.disconnect();
-        cv.block();
+        waitFor(cv);
         verifyNoNetwork();
     }
 
@@ -469,38 +498,32 @@
         mWiFiNetworkAgent = new MockNetworkAgent(TRANSPORT_WIFI);
         ConditionVariable cv = waitForConnectivityBroadcasts(1);
         mWiFiNetworkAgent.connect(false);
-        cv.block();
+        waitFor(cv);
         verifyActiveNetwork(TRANSPORT_WIFI);
         // Test bringing up unvalidated cellular
         mCellNetworkAgent = new MockNetworkAgent(TRANSPORT_CELLULAR);
         mCellNetworkAgent.connect(false);
-        try {
-            Thread.sleep(1000);
-        } catch (InterruptedException e) {
-        }
+        shortSleep();
         verifyActiveNetwork(TRANSPORT_WIFI);
         // Test cellular disconnect.
         mCellNetworkAgent.disconnect();
-        try {
-            Thread.sleep(1000);
-        } catch (InterruptedException e) {
-        }
+        shortSleep();
         verifyActiveNetwork(TRANSPORT_WIFI);
         // Test bringing up validated cellular
         mCellNetworkAgent = new MockNetworkAgent(TRANSPORT_CELLULAR);
         cv = waitForConnectivityBroadcasts(2);
         mCellNetworkAgent.connect(true);
-        cv.block();
+        waitFor(cv);
         verifyActiveNetwork(TRANSPORT_CELLULAR);
         // Test cellular disconnect.
         cv = waitForConnectivityBroadcasts(2);
         mCellNetworkAgent.disconnect();
-        cv.block();
+        waitFor(cv);
         verifyActiveNetwork(TRANSPORT_WIFI);
         // Test WiFi disconnect.
         cv = waitForConnectivityBroadcasts(1);
         mWiFiNetworkAgent.disconnect();
-        cv.block();
+        waitFor(cv);
         verifyNoNetwork();
     }
 
@@ -510,27 +533,209 @@
         mCellNetworkAgent = new MockNetworkAgent(TRANSPORT_CELLULAR);
         ConditionVariable cv = waitForConnectivityBroadcasts(1);
         mCellNetworkAgent.connect(false);
-        cv.block();
+        waitFor(cv);
         verifyActiveNetwork(TRANSPORT_CELLULAR);
         // Test bringing up unvalidated WiFi.
         mWiFiNetworkAgent = new MockNetworkAgent(TRANSPORT_WIFI);
         cv = waitForConnectivityBroadcasts(2);
         mWiFiNetworkAgent.connect(false);
-        cv.block();
+        waitFor(cv);
         verifyActiveNetwork(TRANSPORT_WIFI);
         // Test WiFi disconnect.
         cv = waitForConnectivityBroadcasts(2);
         mWiFiNetworkAgent.disconnect();
-        cv.block();
+        waitFor(cv);
         verifyActiveNetwork(TRANSPORT_CELLULAR);
         // Test cellular disconnect.
         cv = waitForConnectivityBroadcasts(1);
         mCellNetworkAgent.disconnect();
-        cv.block();
+        waitFor(cv);
         verifyNoNetwork();
     }
 
     @LargeTest
+    public void testCellularOutscoresWeakWifi() throws Exception {
+        // Test bringing up validated cellular.
+        mCellNetworkAgent = new MockNetworkAgent(TRANSPORT_CELLULAR);
+        ConditionVariable cv = waitForConnectivityBroadcasts(1);
+        mCellNetworkAgent.connect(true);
+        waitFor(cv);
+        verifyActiveNetwork(TRANSPORT_CELLULAR);
+        // Test bringing up validated WiFi.
+        mWiFiNetworkAgent = new MockNetworkAgent(TRANSPORT_WIFI);
+        cv = waitForConnectivityBroadcasts(2);
+        mWiFiNetworkAgent.connect(true);
+        waitFor(cv);
+        verifyActiveNetwork(TRANSPORT_WIFI);
+        // Test WiFi getting really weak.
+        cv = waitForConnectivityBroadcasts(2);
+        mWiFiNetworkAgent.adjustScore(-11);
+        waitFor(cv);
+        verifyActiveNetwork(TRANSPORT_CELLULAR);
+        // Test WiFi restoring signal strength.
+        cv = waitForConnectivityBroadcasts(2);
+        mWiFiNetworkAgent.adjustScore(11);
+        waitFor(cv);
+        verifyActiveNetwork(TRANSPORT_WIFI);
+        mCellNetworkAgent.disconnect();
+        mWiFiNetworkAgent.disconnect();
+    }
+
+    enum CallbackState {
+        NONE,
+        AVAILABLE,
+        LOSING,
+        LOST
+    }
+
+    private class TestNetworkCallback extends NetworkCallback {
+        private final ConditionVariable mConditionVariable = new ConditionVariable();
+        private CallbackState mLastCallback = CallbackState.NONE;
+
+        public void onAvailable(Network network) {
+            assertEquals(CallbackState.NONE, mLastCallback);
+            mLastCallback = CallbackState.AVAILABLE;
+            mConditionVariable.open();
+        }
+
+        public void onLosing(Network network, int maxMsToLive) {
+            assertEquals(CallbackState.NONE, mLastCallback);
+            mLastCallback = CallbackState.LOSING;
+            mConditionVariable.open();
+        }
+
+        public void onLost(Network network) {
+            assertEquals(CallbackState.NONE, mLastCallback);
+            mLastCallback = CallbackState.LOST;
+            mConditionVariable.open();
+        }
+
+        ConditionVariable getConditionVariable() {
+            mLastCallback = CallbackState.NONE;
+            mConditionVariable.close();
+            return mConditionVariable;
+        }
+
+        CallbackState getLastCallback() {
+            return mLastCallback;
+        }
+    }
+
+    @LargeTest
+    public void testStateChangeNetworkCallbacks() throws Exception {
+        final TestNetworkCallback wifiNetworkCallback = new TestNetworkCallback();
+        final TestNetworkCallback cellNetworkCallback = new TestNetworkCallback();
+        final NetworkRequest wifiRequest = new NetworkRequest.Builder()
+                .addTransportType(TRANSPORT_WIFI).build();
+        final NetworkRequest cellRequest = new NetworkRequest.Builder()
+                .addTransportType(TRANSPORT_CELLULAR).build();
+        mCm.registerNetworkCallback(wifiRequest, wifiNetworkCallback);
+        mCm.registerNetworkCallback(cellRequest, cellNetworkCallback);
+
+        // Test unvalidated networks
+        ConditionVariable cellCv = cellNetworkCallback.getConditionVariable();
+        ConditionVariable wifiCv = wifiNetworkCallback.getConditionVariable();
+        ConditionVariable cv = waitForConnectivityBroadcasts(1);
+        mCellNetworkAgent = new MockNetworkAgent(TRANSPORT_CELLULAR);
+        mCellNetworkAgent.connect(false);
+        waitFor(cellCv);
+        assertEquals(CallbackState.AVAILABLE, cellNetworkCallback.getLastCallback());
+        assertEquals(CallbackState.NONE, wifiNetworkCallback.getLastCallback());
+        assertEquals(mCellNetworkAgent.getNetwork(), mCm.getActiveNetwork());
+        waitFor(cv);
+
+        cellCv = cellNetworkCallback.getConditionVariable();
+        wifiCv = wifiNetworkCallback.getConditionVariable();
+        // This should not trigger spurious onAvailable() callbacks, b/21762680.
+        mCellNetworkAgent.adjustScore(-1);
+        shortSleep();
+        assertEquals(CallbackState.NONE, wifiNetworkCallback.getLastCallback());
+        assertEquals(CallbackState.NONE, cellNetworkCallback.getLastCallback());
+        assertEquals(mCellNetworkAgent.getNetwork(), mCm.getActiveNetwork());
+
+        cellCv = cellNetworkCallback.getConditionVariable();
+        wifiCv = wifiNetworkCallback.getConditionVariable();
+        cv = waitForConnectivityBroadcasts(2);
+        mWiFiNetworkAgent = new MockNetworkAgent(TRANSPORT_WIFI);
+        mWiFiNetworkAgent.connect(false);
+        waitFor(wifiCv);
+        assertEquals(CallbackState.AVAILABLE, wifiNetworkCallback.getLastCallback());
+        assertEquals(CallbackState.NONE, cellNetworkCallback.getLastCallback());
+        assertEquals(mWiFiNetworkAgent.getNetwork(), mCm.getActiveNetwork());
+        waitFor(cv);
+
+        cellCv = cellNetworkCallback.getConditionVariable();
+        wifiCv = wifiNetworkCallback.getConditionVariable();
+        cv = waitForConnectivityBroadcasts(2);
+        mWiFiNetworkAgent.disconnect();
+        waitFor(wifiCv);
+        assertEquals(CallbackState.LOST, wifiNetworkCallback.getLastCallback());
+        assertEquals(CallbackState.NONE, cellNetworkCallback.getLastCallback());
+        waitFor(cv);
+
+        cellCv = cellNetworkCallback.getConditionVariable();
+        wifiCv = wifiNetworkCallback.getConditionVariable();
+        cv = waitForConnectivityBroadcasts(1);
+        mCellNetworkAgent.disconnect();
+        waitFor(cellCv);
+        assertEquals(CallbackState.LOST, cellNetworkCallback.getLastCallback());
+        assertEquals(CallbackState.NONE, wifiNetworkCallback.getLastCallback());
+        waitFor(cv);
+
+        // Test validated networks
+
+        cellCv = cellNetworkCallback.getConditionVariable();
+        wifiCv = wifiNetworkCallback.getConditionVariable();
+        // Our method for faking successful validation generates an additional callback, so wait
+        // for broadcast instead.
+        cv = waitForConnectivityBroadcasts(1);
+        mCellNetworkAgent = new MockNetworkAgent(TRANSPORT_CELLULAR);
+        mCellNetworkAgent.connect(true);
+        waitFor(cv);
+        waitFor(cellCv);
+        assertEquals(CallbackState.AVAILABLE, cellNetworkCallback.getLastCallback());
+        assertEquals(CallbackState.NONE, wifiNetworkCallback.getLastCallback());
+        assertEquals(mCellNetworkAgent.getNetwork(), mCm.getActiveNetwork());
+
+        cellCv = cellNetworkCallback.getConditionVariable();
+        wifiCv = wifiNetworkCallback.getConditionVariable();
+        // This should not trigger spurious onAvailable() callbacks, b/21762680.
+        mCellNetworkAgent.adjustScore(-1);
+        shortSleep();
+        assertEquals(CallbackState.NONE, wifiNetworkCallback.getLastCallback());
+        assertEquals(CallbackState.NONE, cellNetworkCallback.getLastCallback());
+        assertEquals(mCellNetworkAgent.getNetwork(), mCm.getActiveNetwork());
+
+        cellCv = cellNetworkCallback.getConditionVariable();
+        wifiCv = wifiNetworkCallback.getConditionVariable();
+        // Our method for faking successful validation generates an additional callback, so wait
+        // for broadcast instead.
+        cv = waitForConnectivityBroadcasts(1);
+        mWiFiNetworkAgent = new MockNetworkAgent(TRANSPORT_WIFI);
+        mWiFiNetworkAgent.connect(true);
+        waitFor(cv);
+        waitFor(wifiCv);
+        assertEquals(CallbackState.AVAILABLE, wifiNetworkCallback.getLastCallback());
+        waitFor(cellCv);
+        assertEquals(CallbackState.LOSING, cellNetworkCallback.getLastCallback());
+        assertEquals(mWiFiNetworkAgent.getNetwork(), mCm.getActiveNetwork());
+
+        cellCv = cellNetworkCallback.getConditionVariable();
+        wifiCv = wifiNetworkCallback.getConditionVariable();
+        mWiFiNetworkAgent.disconnect();
+        waitFor(wifiCv);
+        assertEquals(CallbackState.LOST, wifiNetworkCallback.getLastCallback());
+        assertEquals(CallbackState.NONE, cellNetworkCallback.getLastCallback());
+
+        cellCv = cellNetworkCallback.getConditionVariable();
+        wifiCv = wifiNetworkCallback.getConditionVariable();
+        mCellNetworkAgent.disconnect();
+        waitFor(cellCv);
+        assertEquals(CallbackState.LOST, cellNetworkCallback.getLastCallback());
+        assertEquals(CallbackState.NONE, wifiNetworkCallback.getLastCallback());
+    }
+
+    @LargeTest
     public void testNetworkFactoryRequests() throws Exception {
         NetworkCapabilities filter = new NetworkCapabilities();
         filter.addCapability(NET_CAPABILITY_INTERNET);
@@ -541,7 +746,7 @@
         testFactory.setScoreFilter(40);
         ConditionVariable cv = testFactory.getNetworkStartedCV();
         testFactory.register();
-        cv.block();
+        waitFor(cv);
         assertEquals(1, testFactory.getMyRequestCount());
         assertEquals(true, testFactory.getMyStartRequested());
 
@@ -550,10 +755,10 @@
         cv = waitForConnectivityBroadcasts(1);
         ConditionVariable cvRelease = testFactory.getNetworkStoppedCV();
         testAgent.connect(true);
-        cv.block();
+        waitFor(cv);
         // part of the bringup makes another network request and then releases it
         // wait for the release
-        cvRelease.block();
+        waitFor(cvRelease);
         assertEquals(false, testFactory.getMyStartRequested());
         testFactory.waitForNetworkRequests(1);
 
@@ -579,7 +784,7 @@
         // drop the higher scored network
         cv = waitForConnectivityBroadcasts(1);
         testAgent.disconnect();
-        cv.block();
+        waitFor(cv);
         assertEquals(1, testFactory.getMyRequestCount());
         assertEquals(true, testFactory.getMyStartRequested());
 
@@ -605,7 +810,7 @@
 //
 //        cv = waitForConnectivityBroadcasts(1);
 //        mTrackerHandler.obtainMessage(EVENT_STATE_CHANGED, mMobile.info).sendToTarget();
-//        cv.block();
+//        waitFor(cv);
 //
 //        // verify that both routes were added
 //        int mobileNetId = mMobile.tracker.getNetwork().netId;
@@ -625,7 +830,7 @@
 //
 //        cv = waitForConnectivityBroadcasts(1);
 //        mTrackerHandler.obtainMessage(EVENT_STATE_CHANGED, mMobile.info).sendToTarget();
-//        cv.block();
+//        waitFor(cv);
 //
 //        reset(mNetManager);
 //
@@ -641,7 +846,7 @@
 //
 //        cv = waitForConnectivityBroadcasts(1);
 //        mTrackerHandler.obtainMessage(EVENT_STATE_CHANGED, mWifi.info).sendToTarget();
-//        cv.block();
+//        waitFor(cv);
 //
 //        // verify that wifi routes added, and teardown requested
 //        int wifiNetId = mWifi.tracker.getNetwork().netId;
@@ -660,7 +865,7 @@
 //
 //        cv = waitForConnectivityBroadcasts(1);
 //        mTrackerHandler.obtainMessage(EVENT_STATE_CHANGED, mMobile.info).sendToTarget();
-//        cv.block();
+//        waitFor(cv);
 //
 //        verify(mNetManager).removeRoute(eq(mobileNetId), eq(MOBILE_ROUTE_V4));
 //        verify(mNetManager).removeRoute(eq(mobileNetId), eq(MOBILE_ROUTE_V6));
diff --git a/services/usage/java/com/android/server/usage/UsageStatsService.java b/services/usage/java/com/android/server/usage/UsageStatsService.java
index 3767fce..3b7ed91 100644
--- a/services/usage/java/com/android/server/usage/UsageStatsService.java
+++ b/services/usage/java/com/android/server/usage/UsageStatsService.java
@@ -31,9 +31,12 @@
 import android.appwidget.AppWidgetManager;
 import android.content.BroadcastReceiver;
 import android.content.ComponentName;
+import android.content.ContentResolver;
 import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
+import android.content.SyncAdapterType;
+import android.content.pm.ApplicationInfo;
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager;
 import android.content.pm.ParceledListSlice;
@@ -69,6 +72,7 @@
 import com.android.internal.annotations.GuardedBy;
 import com.android.internal.app.IBatteryStats;
 import com.android.internal.os.BackgroundThread;
+import com.android.internal.os.SomeArgs;
 import com.android.internal.util.IndentingPrintWriter;
 import com.android.server.DeviceIdleController;
 import com.android.server.SystemService;
@@ -117,6 +121,7 @@
     static final int MSG_CHECK_IDLE_STATES = 5;
     static final int MSG_CHECK_PAROLE_TIMEOUT = 6;
     static final int MSG_PAROLE_END_TIMEOUT = 7;
+    static final int MSG_REPORT_CONTENT_PROVIDER_USAGE = 8;
 
     private final Object mLock = new Object();
     Handler mHandler;
@@ -583,6 +588,29 @@
         }
     }
 
+    void reportContentProviderUsage(String authority, String providerPkgName, int userId) {
+        // Get sync adapters for the authority
+        String[] packages = ContentResolver.getSyncAdapterPackagesForAuthorityAsUser(
+                authority, userId);
+        for (String packageName: packages) {
+            // Only force the sync adapters to active if the provider is not in the same package and
+            // the sync adapter is a system package.
+            try {
+                PackageInfo pi = AppGlobals.getPackageManager().getPackageInfo(
+                        packageName, 0, userId);
+                if (pi == null || pi.applicationInfo == null
+                        || !pi.applicationInfo.isSystemApp()) {
+                    continue;
+                }
+                if (!packageName.equals(providerPkgName)) {
+                    forceIdleState(packageName, userId, false);
+                }
+            } catch (RemoteException re) {
+                // Shouldn't happen
+            }
+        }
+    }
+
     /**
      * Forces the app's beginIdleTime and lastUsedTime to reflect idle or active. If idle,
      * then it rolls back the beginIdleTime and lastUsedTime to a point in time that's behind
@@ -605,7 +633,7 @@
                     timeNow - (idle ? mAppIdleWallclockThresholdMillis : 0) - 5000);
             // Inform listeners if necessary
             if (previouslyIdle != idle) {
-                // Slog.d(TAG, "Informing listeners of out-of-idle " + event.mPackage);
+                // Slog.d(TAG, "Informing listeners of out-of-idle " + packageName);
                 mHandler.sendMessage(mHandler.obtainMessage(MSG_INFORM_LISTENERS, userId,
                         /* idle = */ idle ? 1 : 0, packageName));
                 if (!idle) {
@@ -916,6 +944,14 @@
                     setAppIdleParoled(false);
                     break;
 
+                case MSG_REPORT_CONTENT_PROVIDER_USAGE:
+                    SomeArgs args = (SomeArgs) msg.obj;
+                    reportContentProviderUsage((String) args.arg1, // authority name
+                            (String) args.arg2, // package name
+                            (int) args.arg3); // userId
+                    args.recycle();
+                    break;
+
                 default:
                     super.handleMessage(msg);
                     break;
@@ -1177,6 +1213,16 @@
         }
 
         @Override
+        public void reportContentProviderUsage(String name, String packageName, int userId) {
+            SomeArgs args = SomeArgs.obtain();
+            args.arg1 = name;
+            args.arg2 = packageName;
+            args.arg3 = userId;
+            mHandler.obtainMessage(MSG_REPORT_CONTENT_PROVIDER_USAGE, args)
+                    .sendToTarget();
+        }
+
+        @Override
         public boolean isAppIdle(String packageName, int userId) {
             return UsageStatsService.this.isAppIdleFiltered(packageName, userId, -1);
         }
diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java
index fafe44a..b68abab 100644
--- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java
+++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java
@@ -26,6 +26,7 @@
 import android.content.pm.ApplicationInfo;
 import android.content.pm.IPackageManager;
 import android.content.pm.PackageManager;
+import android.content.pm.PackageManagerInternal;
 import android.content.pm.ResolveInfo;
 import android.content.pm.ServiceInfo;
 import android.content.res.Resources;
@@ -57,6 +58,7 @@
 import com.android.internal.app.IVoiceInteractor;
 import com.android.internal.content.PackageMonitor;
 import com.android.internal.os.BackgroundThread;
+import com.android.server.LocalServices;
 import com.android.server.SystemService;
 import com.android.server.UiThread;
 
@@ -83,6 +85,21 @@
         mDbHelper = new DatabaseHelper(context);
         mSoundTriggerHelper = new SoundTriggerHelper(context);
         mServiceStub = new VoiceInteractionManagerServiceStub();
+
+        PackageManagerInternal packageManagerInternal = LocalServices.getService(
+                PackageManagerInternal.class);
+        packageManagerInternal.setVoiceInteractionPackagesProvider(
+                new PackageManagerInternal.PackagesProvider() {
+            @Override
+            public String[] getPackages(int userId) {
+                mServiceStub.initForUser(userId);
+                ComponentName interactor = mServiceStub.getCurInteractor(userId);
+                if (interactor != null) {
+                    return new String[] {interactor.getPackageName()};
+                }
+                return null;
+            }
+        });
     }
 
     @Override
diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java
index acd484d..af0ddbe 100644
--- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java
+++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java
@@ -139,7 +139,7 @@
             IVoiceInteractionSessionShowCallback showCallback) {
         if (mActiveSession == null) {
             mActiveSession = new VoiceInteractionSessionConnection(mLock, mSessionComponentName,
-                    mUser, mContext, this, mInfo.getServiceInfo().applicationInfo.uid);
+                    mUser, mContext, this, mInfo.getServiceInfo().applicationInfo.uid, mHandler);
         }
         return mActiveSession.showLocked(args, flags, showCallback);
     }
diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java
index 47a230a..cc6a9c5 100644
--- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java
+++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java
@@ -32,6 +32,7 @@
 import android.net.Uri;
 import android.os.Binder;
 import android.os.Bundle;
+import android.os.Handler;
 import android.os.IBinder;
 import android.os.RemoteException;
 import android.os.ServiceManager;
@@ -48,6 +49,8 @@
 import com.android.internal.app.IVoiceInteractionSessionShowCallback;
 import com.android.internal.app.IVoiceInteractor;
 import com.android.internal.os.IResultReceiver;
+import com.android.server.LocalServices;
+import com.android.server.statusbar.StatusBarManagerInternal;
 
 import java.io.PrintWriter;
 import java.util.ArrayList;
@@ -63,6 +66,7 @@
     final Context mContext;
     final Callback mCallback;
     final int mCallingUid;
+    final Handler mHandler;
     final IActivityManager mAm;
     final IWindowManager mIWindowManager;
     final AppOpsManager mAppOps;
@@ -141,13 +145,14 @@
     };
 
     public VoiceInteractionSessionConnection(Object lock, ComponentName component, int user,
-            Context context, Callback callback, int callingUid) {
+            Context context, Callback callback, int callingUid, Handler handler) {
         mLock = lock;
         mSessionComponentName = component;
         mUser = user;
         mContext = context;
         mCallback = callback;
         mCallingUid = callingUid;
+        mHandler = handler;
         mAm = ActivityManagerNative.getDefault();
         mIWindowManager = IWindowManager.Stub.asInterface(
                 ServiceManager.getService(Context.WINDOW_SERVICE));
@@ -193,11 +198,13 @@
             mShowArgs = args;
             mShowFlags = flags;
             mHaveAssistData = false;
+            boolean needDisclosure = false;
             if ((flags& VoiceInteractionSession.SHOW_WITH_ASSIST) != 0) {
                 if (mAppOps.noteOpNoThrow(AppOpsManager.OP_ASSIST_STRUCTURE, mCallingUid,
                         mSessionComponentName.getPackageName()) == AppOpsManager.MODE_ALLOWED
                         && allDataEnabled) {
                     try {
+                        needDisclosure = true;
                         mAm.requestAssistContextExtras(ActivityManager.ASSIST_CONTEXT_FULL,
                                 mAssistReceiver);
                     } catch (RemoteException e) {
@@ -215,6 +222,7 @@
                         mSessionComponentName.getPackageName()) == AppOpsManager.MODE_ALLOWED
                         && allDataEnabled) {
                     try {
+                        needDisclosure = true;
                         mIWindowManager.requestAssistScreenshot(mScreenshotReceiver);
                     } catch (RemoteException e) {
                     }
@@ -225,6 +233,9 @@
             } else {
                 mScreenshot = null;
             }
+            if (needDisclosure) {
+                mHandler.post(mShowAssistDisclosureRunnable);
+            }
             if (mSession != null) {
                 try {
                     mSession.show(mShowArgs, mShowFlags, showCallback);
@@ -483,4 +494,15 @@
             pw.print(prefix); pw.print("mAssistData="); pw.println(mAssistData);
         }
     }
+
+    private Runnable mShowAssistDisclosureRunnable = new Runnable() {
+        @Override
+        public void run() {
+            StatusBarManagerInternal statusBarInternal = LocalServices.getService(
+                    StatusBarManagerInternal.class);
+            if (statusBarInternal != null) {
+                statusBarInternal.showAssistDisclosure();
+            }
+        }
+    };
 };
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
index 01cab33..4b8a10f 100644
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -84,7 +84,7 @@
      * from config.xml under apps/Contacts.
      */
     public static final String
-            KEY_ENABLE_DIALER_KEY_VIBRATION_BOOL = "enable_dialer_vibration_bool";
+            KEY_ENABLE_DIALER_KEY_VIBRATION_BOOL = "enable_dialer_key_vibration_bool";
 
     /** Flag indicating if dtmf tone type is enabled */
     public static final String KEY_DTMF_TYPE_ENABLED_BOOL = "dtmf_type_enabled_bool";
@@ -298,6 +298,14 @@
     public static final String KEY_CI_ACTION_ON_SYS_UPDATE_EXTRA_VAL_STRING =
             "ci_action_on_sys_update_extra_val_string";
 
+    /**
+     * If this is true, the SIM card (through Customer Service Profile EF file) will be able to
+     * prevent manual operator selection. If false, this SIM setting will be ignored and manual
+     * operator selection will always be available. See CPHS4_2.WW6, CPHS B.4.7.1 for more
+     * information
+     */
+    public static final String KEY_CSP_ENABLED_BOOL = "csp_enabled_bool";
+
     // These variables are used by the MMS service and exposed through another API, {@link
     // SmsManager}. The variable names and string values are copied from there.
     public static final String KEY_MMS_ALIAS_ENABLED_BOOL = "aliasEnabled";
@@ -377,6 +385,7 @@
         sDefaults.putString(KEY_CI_ACTION_ON_SYS_UPDATE_INTENT_STRING, "");
         sDefaults.putString(KEY_CI_ACTION_ON_SYS_UPDATE_EXTRA_STRING, "");
         sDefaults.putString(KEY_CI_ACTION_ON_SYS_UPDATE_EXTRA_VAL_STRING, "");
+        sDefaults.putBoolean(KEY_CSP_ENABLED_BOOL, false);
 
         sDefaults.putStringArray(KEY_GSM_ROAMING_NETWORKS_STRING_ARRAY, null);
         sDefaults.putStringArray(KEY_GSM_NONROAMING_NETWORKS_STRING_ARRAY, null);
@@ -422,6 +431,9 @@
      * specific SIM card. If an invalid subId is used, the returned config will contain default
      * values.
      *
+     * <p>Requires Permission:
+     * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
+     *
      * @param subId the subscription ID, normally obtained from {@link SubscriptionManager}.
      * @return A {@link PersistableBundle} containing the config for the given subId, or default
      *         values for an invalid subId.
@@ -443,6 +455,9 @@
     /**
      * Gets the configuration values for the default subscription.
      *
+     * <p>Requires Permission:
+     * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
+     *
      * @see #getConfigForSubId
      */
     @Nullable
@@ -457,6 +472,8 @@
      * This should be called by a carrier service app if it wants to update config at an arbitrary
      * moment.
      * </p>
+     * <p>Requires that the calling app has carrier privileges.
+     * @see #hasCarrierPrivileges
      * <p>
      * This method returns before the reload has completed, and
      * {@link android.service.carrier.CarrierService#onLoadConfig} will be called from an