Merge "Reset the Experimental WebView property per build" into klp-dev
diff --git a/core/java/android/provider/AlarmClock.java b/core/java/android/provider/AlarmClock.java
index e750bc5..f3267ee 100644
--- a/core/java/android/provider/AlarmClock.java
+++ b/core/java/android/provider/AlarmClock.java
@@ -190,13 +190,13 @@
      * <p>
      * Used by {@link #ACTION_SET_ALARM}.
      * </p><p>
-     * This value is a {@link String} and can either be set to {@link #RINGTONE_SILENT} or to a
-     * content URI of the media to be played. If not specified or the URI doesn't exist,
+     * This value is a {@link String} and can either be set to {@link #VALUE_RINGTONE_SILENT} or
+     * to a content URI of the media to be played. If not specified or the URI doesn't exist,
      * {@code "content://settings/system/alarm_alert} will be used.
      * </p>
      *
      * @see #ACTION_SET_ALARM
-     * @see #RINGTONE_SILENT
+     * @see #VALUE_RINGTONE_SILENT
      * @see #EXTRA_VIBRATE
      */
     public static final String EXTRA_RINGTONE = "android.intent.extra.alarm.RINGTONE";
@@ -227,7 +227,7 @@
      *
      * @see #ACTION_SET_ALARM
      * @see #EXTRA_RINGTONE
-     * @see #RINGTONE_SILENT
+     * @see #VALUE_RINGTONE_SILENT
      */
     public static final String EXTRA_VIBRATE = "android.intent.extra.alarm.VIBRATE";
 
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index fad6c73..7539a4b 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -4344,22 +4344,6 @@
         }
 
         /**
-         * Helper method for determining if the location master switch is enabled.
-         *
-         * TODO: worth retaining this method?
-         *
-         * @param cr the content resolver to use
-         * @return true if the master switch is enabled
-         * @deprecated use {@link #getLocationMode(ContentResolver)} != {@link #LOCATION_MODE_OFF}
-         * @hide
-         */
-        @Deprecated
-        public static final boolean isLocationMasterSwitchEnabled(ContentResolver cr) {
-            int mode = getLocationMode(cr);
-            return mode != LOCATION_MODE_OFF;
-        }
-
-        /**
          * Helper method for determining if a location provider is enabled.
          * @param cr the content resolver to use
          * @param provider the location provider to query
@@ -4389,26 +4373,6 @@
         }
 
         /**
-         * Thread-safe method for enabling or disabling the location master switch.
-         *
-         * @param cr the content resolver to use
-         * @param enabled true if master switch should be enabled
-         * @deprecated use {@link #setLocationMode(ContentResolver, int)} with
-         * {@link #LOCATION_MODE_HIGH_ACCURACY}
-         * @hide
-         */
-        @Deprecated
-        public static final void setLocationMasterSwitchEnabled(ContentResolver cr,
-                boolean enabled) {
-            int uid = UserHandle.myUserId();
-            synchronized (mLocationSettingsLock) {
-                setLocationProviderEnabledForUser(cr, LocationManager.GPS_PROVIDER, enabled, uid);
-                setLocationProviderEnabledForUser(cr, LocationManager.NETWORK_PROVIDER, enabled,
-                        uid);
-            }
-        }
-
-        /**
          * Thread-safe method for enabling or disabling a single location provider.
          * @param cr the content resolver to use
          * @param provider the location provider to enable or disable
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp
index 9c323ba..a17b301 100644
--- a/core/jni/AndroidRuntime.cpp
+++ b/core/jni/AndroidRuntime.cpp
@@ -372,19 +372,6 @@
 }
 
 /*
- * We just want failed write() calls to just return with an error.
- */
-static void blockSigpipe()
-{
-    sigset_t mask;
-
-    sigemptyset(&mask);
-    sigaddset(&mask, SIGPIPE);
-    if (sigprocmask(SIG_BLOCK, &mask, NULL) != 0)
-        ALOGW("WARNING: SIGPIPE not blocked\n");
-}
-
-/*
  * Read the persistent locale.
  */
 static void readLocale(char* language, char* region)
@@ -820,8 +807,6 @@
     ALOGD("\n>>>>>> AndroidRuntime START %s <<<<<<\n",
             className != NULL ? className : "(unknown)");
 
-    blockSigpipe();
-
     /*
      * 'startSystemServer == true' means runtime is obsolete and not run from
      * init.rc anymore, so we print out the boot start event here.
diff --git a/core/jni/android_hardware_Camera.cpp b/core/jni/android_hardware_Camera.cpp
index 0018dd2..09d8d0f 100644
--- a/core/jni/android_hardware_Camera.cpp
+++ b/core/jni/android_hardware_Camera.cpp
@@ -553,7 +553,7 @@
         }
     }
 
-    if (camera->setPreviewTexture(gbp) != NO_ERROR) {
+    if (camera->setPreviewTarget(gbp) != NO_ERROR) {
         jniThrowException(env, "java/io/IOException", "setPreviewTexture failed");
     }
 }
@@ -576,7 +576,7 @@
 
     }
 
-    if (camera->setPreviewTexture(producer) != NO_ERROR) {
+    if (camera->setPreviewTarget(producer) != NO_ERROR) {
         jniThrowException(env, "java/io/IOException",
                 "setPreviewTexture failed");
     }
diff --git a/libs/hwui/PathCache.cpp b/libs/hwui/PathCache.cpp
index 70ab6e7..5df6408 100644
--- a/libs/hwui/PathCache.cpp
+++ b/libs/hwui/PathCache.cpp
@@ -214,7 +214,22 @@
 void PathCache::removeTexture(PathTexture* texture) {
     if (texture) {
         const uint32_t size = texture->width * texture->height;
-        mSize -= size;
+
+        // If there is a pending task we must wait for it to return
+        // before attempting our cleanup
+        const sp<Task<SkBitmap*> >& task = texture->task();
+        if (task != NULL) {
+            SkBitmap* bitmap = task->getResult();
+            texture->clearTask();
+        } else {
+            // If there is a pending task, the path was not added
+            // to the cache and the size wasn't increased
+            if (size > mSize) {
+                ALOGE("Removing path texture of size %d will leave "
+                        "the cache in an inconsistent state", size);
+            }
+            mSize -= size;
+        }
 
         PATH_LOGD("PathCache::delete name, size, mSize = %d, %d, %d",
                 texture->id, size, mSize);
@@ -283,6 +298,11 @@
             mCache.put(entry, texture);
         }
     } else {
+        // It's okay to add a texture that's bigger than the cache since
+        // we'll trim the cache later when addToCache is set to false
+        if (!addToCache) {
+            mSize += size;
+        }
         texture->cleanup = true;
     }
 }
diff --git a/libs/hwui/thread/TaskManager.cpp b/libs/hwui/thread/TaskManager.cpp
index c8bfd9c..189895c 100644
--- a/libs/hwui/thread/TaskManager.cpp
+++ b/libs/hwui/thread/TaskManager.cpp
@@ -29,7 +29,7 @@
 
 TaskManager::TaskManager() {
     // Get the number of available CPUs. This value does not change over time.
-    int cpuCount = sysconf(_SC_NPROCESSORS_ONLN);
+    int cpuCount = sysconf(_SC_NPROCESSORS_CONF);
 
     for (int i = 0; i < cpuCount / 2; i++) {
         String8 name;
diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/PathsCacheActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/PathsCacheActivity.java
index 9f97311..c1e7f4a 100644
--- a/tests/HwAccelerationTest/src/com/android/test/hwui/PathsCacheActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/PathsCacheActivity.java
@@ -88,8 +88,6 @@
         @Override
         protected void onDraw(Canvas canvas) {
             super.onDraw(canvas);
-            
-            Log.d("OpenGLRenderer", "Start frame");
 
             canvas.drawARGB(255, 255, 255, 255);
 
@@ -104,6 +102,13 @@
             canvas.drawPath(mPath, mMediumPaint);
             canvas.drawPath(mPath, mMediumPaint);
 
+            mPath.reset();
+            buildPath(mPath);
+
+            canvas.translate(30.0f, 30.0f);
+            canvas.drawPath(mPath, mMediumPaint);
+            canvas.drawPath(mPath, mMediumPaint);
+
             canvas.restore();
 
             for (int i = 0; i < mRandom.nextInt(20); i++) {