Merge "AdapterViewAnimator now properly handles notifyDataSetChanged"
diff --git a/api/current.xml b/api/current.xml
index bfbeaa2..77188b2 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -2088,6 +2088,39 @@
  visibility="public"
 >
 </field>
+<field name="actionBarTabBarStyle"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16843572"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="actionBarTabStyle"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16843571"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="actionBarTabTextStyle"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16843573"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="actionButtonPadding"
  type="int"
  transient="false"
diff --git a/core/java/android/net/Proxy.java b/core/java/android/net/Proxy.java
index e2e4d2c..9c63cd9 100644
--- a/core/java/android/net/Proxy.java
+++ b/core/java/android/net/Proxy.java
@@ -46,6 +46,8 @@
     // Set to true to enable extra debugging.
     private static final boolean DEBUG = false;
 
+    // Used to notify an app that's caching the default connection proxy
+    // that either the default connection or its proxy has changed
     public static final String PROXY_CHANGE_ACTION =
         "android.intent.action.PROXY_CHANGE";
 
@@ -74,9 +76,10 @@
         EXCLLIST_PATTERN = Pattern.compile(EXCLLIST_REGEXP);
     }
 
+    // useful because it holds the processed exclusion list - don't want to reparse it each time
     private static class ProxySpec {
         String[] exclusionList = null;
-        InetSocketAddress proxyAddress = null;
+        InetSocketAddress address = null;
         public ProxySpec() { };
     }
 
@@ -151,7 +154,7 @@
                     retval = java.net.Proxy.NO_PROXY;
                 } else {
                     retval =
-                        new java.net.Proxy(java.net.Proxy.Type.HTTP, sGlobalProxySpec.proxyAddress);
+                        new java.net.Proxy(java.net.Proxy.Type.HTTP, sGlobalProxySpec.address);
                 }
             } else {
                 // If network is WiFi, return no proxy.
@@ -187,7 +190,7 @@
                 parseGlobalProxyInfoReadLocked(ctx);
             }
             if (sGlobalProxySpec != null) {
-                InetSocketAddress sa = sGlobalProxySpec.proxyAddress;
+                InetSocketAddress sa = sGlobalProxySpec.address;
                 return sa.getHostName();
             }
             return getDefaultHost();
@@ -210,7 +213,7 @@
                 parseGlobalProxyInfoReadLocked(ctx);
             }
             if (sGlobalProxySpec != null) {
-                InetSocketAddress sa = sGlobalProxySpec.proxyAddress;
+                InetSocketAddress sa = sGlobalProxySpec.address;
                 return sa.getPort();
             }
             return getDefaultPort();
@@ -389,7 +392,7 @@
         int port = parsePort(proxyHost);
         if (proxyHost != null) {
             sGlobalProxySpec = new ProxySpec();
-            sGlobalProxySpec.proxyAddress = new InetSocketAddress(host, port);
+            sGlobalProxySpec.address= new InetSocketAddress(host, port);
             if ((exclusionListSpec != null) && (exclusionListSpec.length() != 0)) {
                 String[] exclusionListEntries = exclusionListSpec.toLowerCase().split(",");
                 String[] processedEntries = new String[exclusionListEntries.length];
diff --git a/core/java/android/net/ProxyProperties.java b/core/java/android/net/ProxyProperties.java
index bce7ec0..fb59fed 100644
--- a/core/java/android/net/ProxyProperties.java
+++ b/core/java/android/net/ProxyProperties.java
@@ -21,6 +21,7 @@
 import android.os.Parcelable;
 
 import java.net.InetAddress;
+import java.net.InetSocketAddress;
 import java.net.UnknownHostException;
 
 /**
@@ -29,8 +30,7 @@
  */
 public class ProxyProperties implements Parcelable {
 
-    private InetAddress mProxy;
-    private int mPort;
+    private InetSocketAddress mProxy;
     private String mExclusionList;
 
     public ProxyProperties() {
@@ -39,8 +39,7 @@
     // copy constructor instead of clone
     public ProxyProperties(ProxyProperties source) {
         if (source != null) {
-            mProxy = source.getAddress();
-            mPort = source.getPort();
+            mProxy = source.getSocketAddress();
             String exclusionList = source.getExclusionList();
             if (exclusionList != null) {
                 mExclusionList = new String(exclusionList);
@@ -48,22 +47,14 @@
         }
     }
 
-    public InetAddress getAddress() {
+    public InetSocketAddress getSocketAddress() {
         return mProxy;
     }
 
-    public void setAddress(InetAddress proxy) {
+    public void setSocketAddress(InetSocketAddress proxy) {
         mProxy = proxy;
     }
 
-    public int getPort() {
-        return mPort;
-    }
-
-    public void setPort(int port) {
-        mPort = port;
-    }
-
     public String getExclusionList() {
         return mExclusionList;
     }
@@ -76,7 +67,7 @@
     public String toString() {
         StringBuilder sb = new StringBuilder();
         if (mProxy != null) {
-            sb.append(mProxy.getHostAddress()).append(":").append(mPort);
+            sb.append(mProxy.toString());
             if (mExclusionList != null) {
                     sb.append(" xl=").append(mExclusionList);
             }
@@ -98,13 +89,15 @@
      */
     public void writeToParcel(Parcel dest, int flags) {
         if (mProxy != null) {
-            dest.writeByte((byte)1);
-            dest.writeString(mProxy.getHostName());
-            dest.writeByteArray(mProxy.getAddress());
+            InetAddress addr = mProxy.getAddress();
+            if (addr != null) {
+                dest.writeByte((byte)1);
+                dest.writeByteArray(addr.getAddress());
+                dest.writeInt(mProxy.getPort());
+            }
         } else {
             dest.writeByte((byte)0);
         }
-        dest.writeInt(mPort);
         dest.writeString(mExclusionList);
     }
 
@@ -118,11 +111,10 @@
                 ProxyProperties proxyProperties = new ProxyProperties();
                 if (in.readByte() == 1) {
                     try {
-                        proxyProperties.setAddress(InetAddress.getByAddress(in.readString(),
-                                in.createByteArray()));
-                    } catch (UnknownHostException e) {}
+                        InetAddress addr = InetAddress.getByAddress(in.createByteArray());
+                        proxyProperties.setSocketAddress(new InetSocketAddress(addr, in.readInt()));
+                    } catch (UnknownHostException e) { }
                 }
-                proxyProperties.setPort(in.readInt());
                 proxyProperties.setExclusionList(in.readString());
                 return proxyProperties;
             }
diff --git a/core/java/android/service/wallpaper/WallpaperService.java b/core/java/android/service/wallpaper/WallpaperService.java
index 57a72bf..2b083dc 100644
--- a/core/java/android/service/wallpaper/WallpaperService.java
+++ b/core/java/android/service/wallpaper/WallpaperService.java
@@ -30,6 +30,7 @@
 import android.content.Intent;
 import android.content.IntentFilter;
 import android.content.res.Configuration;
+import android.graphics.PixelFormat;
 import android.graphics.Rect;
 import android.os.Bundle;
 import android.os.IBinder;
@@ -178,6 +179,9 @@
         };
         
         final BaseSurfaceHolder mSurfaceHolder = new BaseSurfaceHolder() {
+            {
+                mRequestedFormat = PixelFormat.RGB_565;
+            }
 
             @Override
             public boolean onAllowLockCanvas() {
diff --git a/core/java/android/text/method/TextKeyListener.java b/core/java/android/text/method/TextKeyListener.java
index 5be2a48..09cbbb8 100644
--- a/core/java/android/text/method/TextKeyListener.java
+++ b/core/java/android/text/method/TextKeyListener.java
@@ -246,8 +246,10 @@
     private void initPrefs(Context context) {
         final ContentResolver contentResolver = context.getContentResolver();
         mResolver = new WeakReference<ContentResolver>(contentResolver);
-        mObserver = new SettingsObserver();
-        contentResolver.registerContentObserver(Settings.System.CONTENT_URI, true, mObserver);
+        if (mObserver == null) {
+            mObserver = new SettingsObserver();
+            contentResolver.registerContentObserver(Settings.System.CONTENT_URI, true, mObserver);
+        }
 
         updatePrefs(contentResolver);
         mPrefsInited = true;
diff --git a/core/java/com/android/internal/view/BaseSurfaceHolder.java b/core/java/com/android/internal/view/BaseSurfaceHolder.java
index 3a04993..1e97cd6 100644
--- a/core/java/com/android/internal/view/BaseSurfaceHolder.java
+++ b/core/java/com/android/internal/view/BaseSurfaceHolder.java
@@ -41,7 +41,8 @@
 
     int mRequestedWidth = -1;
     int mRequestedHeight = -1;
-    int mRequestedFormat = PixelFormat.OPAQUE;
+    /** @hide */
+    protected int mRequestedFormat = PixelFormat.OPAQUE;
     int mRequestedType = -1;
 
     long mLastLockTime = 0;
diff --git a/core/java/com/android/internal/widget/ActionBarView.java b/core/java/com/android/internal/widget/ActionBarView.java
index 6b3d353..308a709 100644
--- a/core/java/com/android/internal/widget/ActionBarView.java
+++ b/core/java/com/android/internal/widget/ActionBarView.java
@@ -371,7 +371,8 @@
                 break;
             case ActionBar.NAVIGATION_MODE_TABS:
                 mTabScrollView = new HorizontalScrollView(getContext());
-                mTabLayout = new LinearLayout(getContext());
+                mTabLayout = new LinearLayout(getContext(), null,
+                        com.android.internal.R.attr.actionBarTabBarStyle);
                 mTabScrollView.addView(mTabLayout);
                 addView(mTabScrollView);
                 break;
@@ -609,7 +610,7 @@
             if (mTabScrollView != null) {
                 mTabScrollView.measure(
                         MeasureSpec.makeMeasureSpec(availableWidth, MeasureSpec.AT_MOST),
-                        MeasureSpec.makeMeasureSpec(height, MeasureSpec.AT_MOST));
+                        MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY));
             }
             break;
         }
@@ -711,7 +712,7 @@
         private ActionBar.Tab mTab;
 
         public TabView(Context context, ActionBar.Tab tab) {
-            super(context);
+            super(context, null, com.android.internal.R.attr.actionBarTabStyle);
             mTab = tab;
 
             final View custom = tab.getCustomView();
@@ -734,7 +735,8 @@
                 }
 
                 if (text != null) {
-                    TextView textView = new TextView(context);
+                    TextView textView = new TextView(context, null,
+                            com.android.internal.R.attr.actionBarTabTextStyle);
                     textView.setText(text);
                     textView.setSingleLine();
                     textView.setEllipsize(TruncateAt.END);
diff --git a/core/jni/android/graphics/Bitmap.cpp b/core/jni/android/graphics/Bitmap.cpp
index b062264..95bb24f 100644
--- a/core/jni/android/graphics/Bitmap.cpp
+++ b/core/jni/android/graphics/Bitmap.cpp
@@ -12,6 +12,8 @@
 

 #include <jni.h>

 

+#include <Caches.h>

+

 #if 0

     #define TRACE_BITMAP(code)  code

 #else

@@ -251,6 +253,9 @@
 }

 

 static void Bitmap_destructor(JNIEnv* env, jobject, SkBitmap* bitmap) {

+#ifdef USE_OPENGL_RENDERER

+    android::uirenderer::Caches::getInstance().textureCache.remove(bitmap);

+#endif

     delete bitmap;

 }

 

diff --git a/core/res/res/drawable-mdpi/minitab_lt_focus.9.png b/core/res/res/drawable-mdpi/minitab_lt_focus.9.png
new file mode 100644
index 0000000..415c571
--- /dev/null
+++ b/core/res/res/drawable-mdpi/minitab_lt_focus.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/minitab_lt_press.9.png b/core/res/res/drawable-mdpi/minitab_lt_press.9.png
new file mode 100644
index 0000000..4166543
--- /dev/null
+++ b/core/res/res/drawable-mdpi/minitab_lt_press.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/minitab_lt_selected.9.png b/core/res/res/drawable-mdpi/minitab_lt_selected.9.png
new file mode 100644
index 0000000..fefa27e
--- /dev/null
+++ b/core/res/res/drawable-mdpi/minitab_lt_selected.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/minitab_lt_unselected.9.png b/core/res/res/drawable-mdpi/minitab_lt_unselected.9.png
new file mode 100644
index 0000000..0051cd5
--- /dev/null
+++ b/core/res/res/drawable-mdpi/minitab_lt_unselected.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/minitab_lt_unselected_press.9.png b/core/res/res/drawable-mdpi/minitab_lt_unselected_press.9.png
new file mode 100644
index 0000000..69444dd
--- /dev/null
+++ b/core/res/res/drawable-mdpi/minitab_lt_unselected_press.9.png
Binary files differ
diff --git a/core/res/res/drawable/minitab_lt.xml b/core/res/res/drawable/minitab_lt.xml
new file mode 100644
index 0000000..aeea97c
--- /dev/null
+++ b/core/res/res/drawable/minitab_lt.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 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.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_pressed="true" android:state_selected="true"
+          android:drawable="@drawable/minitab_lt_press" />
+    <item android:state_selected="true"
+          android:drawable="@drawable/minitab_lt_selected" />
+    <item android:state_pressed="true"
+          android:drawable="@drawable/minitab_lt_unselected_press" />
+    <item android:drawable="@drawable/minitab_lt_unselected" />
+</selector>
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index b476b44..3130b20 100755
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -473,6 +473,10 @@
         <eat-comment />
         <!-- Default amount of padding to use between action buttons. -->
         <attr name="actionButtonPadding" format="dimension" />
+        <!-- Default style for tabs within an action bar -->
+        <attr name="actionBarTabStyle" format="reference" />
+        <attr name="actionBarTabBarStyle" format="reference" />
+        <attr name="actionBarTabTextStyle" format="reference" />
 
         <!-- =================== -->
         <!-- Action mode styles  -->
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index 7bb56bd..515f817 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -1335,6 +1335,9 @@
   <public type="attr" name="listChoiceBackgroundIndicator" />
   <public type="attr" name="spinnerMode" />
   <public type="attr" name="animateLayoutChanges" />
+  <public type="attr" name="actionBarTabStyle" />
+  <public type="attr" name="actionBarTabBarStyle" />
+  <public type="attr" name="actionBarTabTextStyle" />
 
   <public type="anim" name="animator_fade_in" />
   <public type="anim" name="animator_fade_out" />
diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml
index 6964808..bbdad62 100644
--- a/core/res/res/values/styles.xml
+++ b/core/res/res/values/styles.xml
@@ -885,12 +885,27 @@
         <item name="android:divider">@android:drawable/action_bar_divider</item>
         <item name="android:height">?android:attr/windowActionBarSize</item>
         <item name="android:paddingLeft">3dip</item>
-        <item name="android:paddingTop">3dip</item>
+        <item name="android:paddingTop">0dip</item>
         <item name="android:paddingRight">3dip</item>
-        <item name="android:paddingBottom">3dip</item>
+        <item name="android:paddingBottom">0dip</item>
     </style>
 
     <style name="Widget.ActionButton">
         <item name="android:background">@null</item>
     </style>
+
+    <style name="Widget.ActionBarView_TabView">
+        <item name="android:background">@drawable/minitab_lt</item>
+        <item name="android:paddingLeft">4dip</item>
+        <item name="android:paddingRight">4dip</item>
+    </style>
+
+    <style name="Widget.ActionBarView_TabBar">
+    </style>
+
+    <style name="Widget.ActionBarView_TabText">
+        <item name="android:textAppearance">@style/TextAppearance.Widget.TextView.PopupMenu</item>
+        <item name="android:textColor">?android:attr/textColorPrimaryInverse</item>
+        <item name="android:textSize">18sp</item>
+    </style>
 </resources>
diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml
index 6ed7b71..652121c 100644
--- a/core/res/res/values/themes.xml
+++ b/core/res/res/values/themes.xml
@@ -199,6 +199,9 @@
         <item name="quickContactBadgeStyleSmallWindowSmall">@android:style/Widget.QuickContactBadgeSmall.WindowSmall</item>
         <item name="quickContactBadgeStyleSmallWindowMedium">@android:style/Widget.QuickContactBadgeSmall.WindowMedium</item>
         <item name="quickContactBadgeStyleSmallWindowLarge">@android:style/Widget.QuickContactBadgeSmall.WindowLarge</item>
+        <item name="actionBarTabStyle">@style/Widget.ActionBarView_TabView</item>
+        <item name="actionBarTabBarStyle">@style/Widget.ActionBarView_TabBar</item>
+        <item name="actionBarTabTextStyle">@style/Widget.ActionBarView_TabText</item>
         
         <!-- Preference styles -->
         <item name="preferenceScreenStyle">@android:style/Preference.PreferenceScreen</item>
diff --git a/include/media/EffectEnvironmentalReverbApi.h b/include/media/EffectEnvironmentalReverbApi.h
index 2233e3f..36accd8 100644
--- a/include/media/EffectEnvironmentalReverbApi.h
+++ b/include/media/EffectEnvironmentalReverbApi.h
@@ -48,16 +48,16 @@
 
 //t_reverb_settings is equal to SLEnvironmentalReverbSettings defined in OpenSL ES specification.
 typedef struct s_reverb_settings {
-    int16_t roomLevel;
-    int16_t roomHFLevel;
-    int32_t decayTime;
-    int16_t decayHFRatio;
-    int16_t reflectionsLevel;
-    int32_t reflectionsDelay;
-    int16_t reverbLevel;
-    int32_t reverbDelay;
-    int16_t diffusion;
-    int16_t density;
+    int16_t     roomLevel;
+    int16_t     roomHFLevel;
+    uint32_t    decayTime;
+    int16_t     decayHFRatio;
+    int16_t     reflectionsLevel;
+    uint32_t    reflectionsDelay;
+    int16_t     reverbLevel;
+    uint32_t    reverbDelay;
+    int16_t     diffusion;
+    int16_t     density;
 } __attribute__((packed)) t_reverb_settings;
 
 
diff --git a/libs/hwui/GenerationCache.h b/libs/hwui/GenerationCache.h
index c358c80..c42a5d8 100644
--- a/libs/hwui/GenerationCache.h
+++ b/libs/hwui/GenerationCache.h
@@ -143,11 +143,7 @@
     }
 
     ssize_t index = mCache.indexOfKey(key);
-    if (index >= 0) {
-        sp<Entry<K, V> > entry = mCache.valueAt(index);
-        detachFromCache(entry);
-        addToCache(entry, key, value);
-    } else {
+    if (index < 0) {
         sp<Entry<K, V> > entry = new Entry<K, V>;
         addToCache(entry, key, value);
     }
diff --git a/libs/hwui/PatchCache.h b/libs/hwui/PatchCache.h
index e874a16..6dad831 100644
--- a/libs/hwui/PatchCache.h
+++ b/libs/hwui/PatchCache.h
@@ -17,6 +17,8 @@
 #ifndef ANDROID_UI_PATCH_CACHE_H
 #define ANDROID_UI_PATCH_CACHE_H
 
+#include <utils/ResourceTypes.h>
+
 #include "Patch.h"
 #include "GenerationCache.h"
 
diff --git a/libs/hwui/Texture.h b/libs/hwui/Texture.h
index 90f548b..817f143 100644
--- a/libs/hwui/Texture.h
+++ b/libs/hwui/Texture.h
@@ -28,6 +28,7 @@
 struct Texture {
     Texture() {
         cleanup = false;
+        bitmapSize = 0;
     }
 
     /**
@@ -54,6 +55,10 @@
      * Indicates whether this texture should be cleaned up after use.
      */
     bool cleanup;
+    /**
+     * Optional, size of the original bitmap.
+     */
+    uint32_t bitmapSize;
 }; // struct Texture
 
 class AutoTexture {
diff --git a/libs/hwui/TextureCache.cpp b/libs/hwui/TextureCache.cpp
index 753c544..e558870 100644
--- a/libs/hwui/TextureCache.cpp
+++ b/libs/hwui/TextureCache.cpp
@@ -18,6 +18,8 @@
 
 #include <GLES2/gl2.h>
 
+#include <utils/threads.h>
+
 #include "TextureCache.h"
 #include "Properties.h"
 
@@ -49,6 +51,7 @@
 }
 
 TextureCache::~TextureCache() {
+    Mutex::Autolock _l(mLock);
     mCache.clear();
 }
 
@@ -64,14 +67,17 @@
 ///////////////////////////////////////////////////////////////////////////////
 
 uint32_t TextureCache::getSize() {
+    Mutex::Autolock _l(mLock);
     return mSize;
 }
 
 uint32_t TextureCache::getMaxSize() {
+    Mutex::Autolock _l(mLock);
     return mMaxSize;
 }
 
 void TextureCache::setMaxSize(uint32_t maxSize) {
+    Mutex::Autolock _l(mLock);
     mMaxSize = maxSize;
     while (mSize > mMaxSize) {
         mCache.removeOldest();
@@ -83,12 +89,9 @@
 ///////////////////////////////////////////////////////////////////////////////
 
 void TextureCache::operator()(SkBitmap*& bitmap, Texture*& texture) {
-    if (bitmap) {
-        const uint32_t size = bitmap->rowBytes() * bitmap->height();
-        mSize -= size;
-    }
-
+    // This will be called already locked
     if (texture) {
+        mSize -= texture->bitmapSize;
         glDeleteTextures(1, &texture->id);
         delete texture;
     }
@@ -99,6 +102,8 @@
 ///////////////////////////////////////////////////////////////////////////////
 
 Texture* TextureCache::get(SkBitmap* bitmap) {
+    Mutex::Autolock _l(mLock);
+
     Texture* texture = mCache.get(bitmap);
     if (!texture) {
         if (bitmap->width() > mMaxTextureSize || bitmap->height() > mMaxTextureSize) {
@@ -115,6 +120,7 @@
         }
 
         texture = new Texture;
+        texture->bitmapSize = size;
         generateTexture(bitmap, texture, false);
 
         if (size < mMaxSize) {
@@ -131,15 +137,18 @@
 }
 
 void TextureCache::remove(SkBitmap* bitmap) {
+    Mutex::Autolock _l(mLock);
     mCache.remove(bitmap);
 }
 
 void TextureCache::clear() {
+    Mutex::Autolock _l(mLock);
     mCache.clear();
 }
 
 void TextureCache::generateTexture(SkBitmap* bitmap, Texture* texture, bool regenerate) {
     SkAutoLockPixels alp(*bitmap);
+
     if (!bitmap->readyToDraw()) {
         LOGE("Cannot generate texture from bitmap");
         return;
@@ -159,6 +168,7 @@
     switch (bitmap->getConfig()) {
     case SkBitmap::kA8_Config:
         texture->blend = true;
+        glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
         glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, bitmap->rowBytesAsPixels(), texture->height, 0,
                 GL_ALPHA, GL_UNSIGNED_BYTE, bitmap->getPixels());
         break;
@@ -175,6 +185,7 @@
         texture->blend = !bitmap->isOpaque();
         break;
     default:
+        LOGW("Unsupported bitmap config");
         break;
     }
 
diff --git a/libs/hwui/TextureCache.h b/libs/hwui/TextureCache.h
index b5e4c7c..847d69c 100644
--- a/libs/hwui/TextureCache.h
+++ b/libs/hwui/TextureCache.h
@@ -86,6 +86,8 @@
     uint32_t mSize;
     uint32_t mMaxSize;
     GLint mMaxTextureSize;
+
+    mutable Mutex mLock;
 }; // class TextureCache
 
 }; // namespace uirenderer
diff --git a/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp b/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp
index 45ef416..b3e1531 100755
--- a/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp
+++ b/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp
@@ -1133,7 +1133,7 @@
     //LOGV("\tReverbSetDecayTime() just Got -> %d\n", ActiveParams.T60);
 
     if (time <= LVREV_MAX_T60) {
-        ActiveParams.T60 = time;
+        ActiveParams.T60 = (LVM_UINT16)time;
     }
     else {
         ActiveParams.T60 = LVREV_MAX_T60;
@@ -1146,7 +1146,7 @@
 
     pContext->SamplesToExitCount = (ActiveParams.T60 * pContext->config.inputCfg.samplingRate)/1000;
     //LOGV("\tReverbSetDecayTime() just Set SamplesToExitCount-> %d\n",pContext->SamplesToExitCount);
-    pContext->SavedDecayTime = time;
+    pContext->SavedDecayTime = (int16_t)time;
     //LOGV("\tReverbSetDecayTime end");
     return;
 }
@@ -1162,7 +1162,7 @@
 //
 //----------------------------------------------------------------------------
 
-int32_t ReverbGetDecayTime(ReverbContext *pContext){
+uint32_t ReverbGetDecayTime(ReverbContext *pContext){
     //LOGV("\tReverbGetDecayTime start");
 
     LVREV_ControlParams_st    ActiveParams;              /* Current control Parameters */
@@ -1181,7 +1181,7 @@
     }
 
     //LOGV("\tReverbGetDecayTime end");
-    return ActiveParams.T60;
+    return (uint32_t)ActiveParams.T60;
 }
 
 //----------------------------------------------------------------------------
@@ -1606,7 +1606,7 @@
             //        *(int16_t *)pValue);
             break;
         case REVERB_PARAM_DECAY_TIME:
-            *(int32_t *)pValue = ReverbGetDecayTime(pContext);
+            *(uint32_t *)pValue = ReverbGetDecayTime(pContext);
 
             //LOGV("\tReverb_getParameter() REVERB_PARAM_DECAY_TIME Value is %d",
             //        *(int32_t *)pValue);
@@ -1671,6 +1671,7 @@
 int Reverb_setParameter (ReverbContext *pContext, void *pParam, void *pValue){
     int status = 0;
     int16_t level;
+    int16_t ratio;
     uint32_t time;
     t_reverb_settings *pProperties;
     int32_t *pParamTemp = (int32_t *)pParam;
@@ -1688,6 +1689,7 @@
             return -EINVAL;
         }
         pContext->nextPreset = preset;
+        return 0;
     }
 
     switch (param){
@@ -1724,10 +1726,10 @@
             //LOGV("\tReverb_setParameter() Called ReverbSetDecayTime");
            break;
         case REVERB_PARAM_DECAY_HF_RATIO:
-            time = *(int16_t *)pValue;
-            //LOGV("\tReverb_setParameter() REVERB_PARAM_DECAY_HF_RATIO value is %d", time);
+            ratio = *(int16_t *)pValue;
+            //LOGV("\tReverb_setParameter() REVERB_PARAM_DECAY_HF_RATIO value is %d", ratio);
             //LOGV("\tReverb_setParameter() Calling ReverbSetDecayHfRatio");
-            ReverbSetDecayHfRatio(pContext, time);
+            ReverbSetDecayHfRatio(pContext, ratio);
             //LOGV("\tReverb_setParameter() Called ReverbSetDecayHfRatio");
             break;
          case REVERB_PARAM_REVERB_LEVEL:
@@ -1738,17 +1740,17 @@
             //LOGV("\tReverb_setParameter() Called ReverbSetReverbLevel");
            break;
         case REVERB_PARAM_DIFFUSION:
-            time = *(int16_t *)pValue;
-            //LOGV("\tReverb_setParameter() REVERB_PARAM_DECAY_DIFFUSION value is %d", time);
+            ratio = *(int16_t *)pValue;
+            //LOGV("\tReverb_setParameter() REVERB_PARAM_DECAY_DIFFUSION value is %d", ratio);
             //LOGV("\tReverb_setParameter() Calling ReverbSetDiffusion");
-            ReverbSetDiffusion(pContext, time);
+            ReverbSetDiffusion(pContext, ratio);
             //LOGV("\tReverb_setParameter() Called ReverbSetDiffusion");
             break;
         case REVERB_PARAM_DENSITY:
-            time = *(int16_t *)pValue;
-            //LOGV("\tReverb_setParameter() REVERB_PARAM_DECAY_DENSITY value is %d", time);
+            ratio = *(int16_t *)pValue;
+            //LOGV("\tReverb_setParameter() REVERB_PARAM_DECAY_DENSITY value is %d", ratio);
             //LOGV("\tReverb_setParameter() Calling ReverbSetDensity");
-            ReverbSetDensity(pContext, time);
+            ReverbSetDensity(pContext, ratio);
             //LOGV("\tReverb_setParameter() Called ReverbSetDensity");
             break;
            break;
diff --git a/services/java/com/android/server/BackupManagerService.java b/services/java/com/android/server/BackupManagerService.java
index 3db5dc1..e454c08 100644
--- a/services/java/com/android/server/BackupManagerService.java
+++ b/services/java/com/android/server/BackupManagerService.java
@@ -668,7 +668,7 @@
                     while (true) {
                         String packageName = in.readUTF();
                         Slog.i(TAG, "    + " + packageName);
-                        dataChanged(packageName);
+                        dataChangedImpl(packageName);
                     }
                 } catch (EOFException e) {
                     // no more data; we're done
@@ -740,7 +740,7 @@
                 int uid = mBackupParticipants.keyAt(i);
                 HashSet<ApplicationInfo> participants = mBackupParticipants.valueAt(i);
                 for (ApplicationInfo app: participants) {
-                    dataChanged(app.packageName);
+                    dataChangedImpl(app.packageName);
                 }
             }
         }
@@ -896,7 +896,7 @@
                 if (!mEverStoredApps.contains(pkg.packageName)) {
                     if (DEBUG) Slog.i(TAG, "New app " + pkg.packageName
                             + " never backed up; scheduling");
-                    dataChanged(pkg.packageName);
+                    dataChangedImpl(pkg.packageName);
                 }
             }
         }
@@ -1327,7 +1327,7 @@
                 if (status != BackupConstants.TRANSPORT_OK) {
                     Slog.w(TAG, "Backup pass unsuccessful, restaging");
                     for (BackupRequest req : mQueue) {
-                        dataChanged(req.appInfo.packageName);
+                        dataChangedImpl(req.appInfo.packageName);
                     }
 
                     // We also want to reset the backup schedule based on whatever
@@ -1997,25 +1997,66 @@
         }
     }
 
+    private void dataChangedImpl(String packageName) {
+        HashSet<ApplicationInfo> targets = dataChangedTargets(packageName);
+        dataChangedImpl(packageName, targets);
+    }
 
-    // ----- IBackupManager binder interface -----
-
-    public void dataChanged(String packageName) {
+    private void dataChangedImpl(String packageName, HashSet<ApplicationInfo> targets) {
         // Record that we need a backup pass for the caller.  Since multiple callers
         // may share a uid, we need to note all candidates within that uid and schedule
         // a backup pass for each of them.
         EventLog.writeEvent(EventLogTags.BACKUP_DATA_CHANGED, packageName);
 
+        if (targets == null) {
+            Slog.w(TAG, "dataChanged but no participant pkg='" + packageName + "'"
+                   + " uid=" + Binder.getCallingUid());
+            return;
+        }
+
+        synchronized (mQueueLock) {
+            // Note that this client has made data changes that need to be backed up
+            for (ApplicationInfo app : targets) {
+                // validate the caller-supplied package name against the known set of
+                // packages associated with this uid
+                if (app.packageName.equals(packageName)) {
+                    // Add the caller to the set of pending backups.  If there is
+                    // one already there, then overwrite it, but no harm done.
+                    BackupRequest req = new BackupRequest(app, false);
+                    if (mPendingBackups.put(app, req) == null) {
+                        // Journal this request in case of crash.  The put()
+                        // operation returned null when this package was not already
+                        // in the set; we want to avoid touching the disk redundantly.
+                        writeToJournalLocked(packageName);
+
+                        if (DEBUG) {
+                            int numKeys = mPendingBackups.size();
+                            Slog.d(TAG, "Now awaiting backup for " + numKeys + " participants:");
+                            for (BackupRequest b : mPendingBackups.values()) {
+                                Slog.d(TAG, "    + " + b + " agent=" + b.appInfo.backupAgentName);
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    // Note: packageName is currently unused, but may be in the future
+    private HashSet<ApplicationInfo> dataChangedTargets(String packageName) {
         // If the caller does not hold the BACKUP permission, it can only request a
         // backup of its own data.
-        HashSet<ApplicationInfo> targets;
         if ((mContext.checkPermission(android.Manifest.permission.BACKUP, Binder.getCallingPid(),
                 Binder.getCallingUid())) == PackageManager.PERMISSION_DENIED) {
-            targets = mBackupParticipants.get(Binder.getCallingUid());
-        } else {
-            // a caller with full permission can ask to back up any participating app
-            // !!! TODO: allow backup of ANY app?
-            targets = new HashSet<ApplicationInfo>();
+            synchronized (mBackupParticipants) {
+                return mBackupParticipants.get(Binder.getCallingUid());
+            }
+        }
+
+        // a caller with full permission can ask to back up any participating app
+        // !!! TODO: allow backup of ANY app?
+        HashSet<ApplicationInfo> targets = new HashSet<ApplicationInfo>();
+        synchronized (mBackupParticipants) {
             int N = mBackupParticipants.size();
             for (int i = 0; i < N; i++) {
                 HashSet<ApplicationInfo> s = mBackupParticipants.valueAt(i);
@@ -2024,37 +2065,7 @@
                 }
             }
         }
-        if (targets != null) {
-            synchronized (mQueueLock) {
-                // Note that this client has made data changes that need to be backed up
-                for (ApplicationInfo app : targets) {
-                    // validate the caller-supplied package name against the known set of
-                    // packages associated with this uid
-                    if (app.packageName.equals(packageName)) {
-                        // Add the caller to the set of pending backups.  If there is
-                        // one already there, then overwrite it, but no harm done.
-                        BackupRequest req = new BackupRequest(app, false);
-                        if (mPendingBackups.put(app, req) == null) {
-                            // Journal this request in case of crash.  The put()
-                            // operation returned null when this package was not already
-                            // in the set; we want to avoid touching the disk redundantly.
-                            writeToJournalLocked(packageName);
-
-                            if (DEBUG) {
-                                int numKeys = mPendingBackups.size();
-                                Slog.d(TAG, "Now awaiting backup for " + numKeys + " participants:");
-                                for (BackupRequest b : mPendingBackups.values()) {
-                                    Slog.d(TAG, "    + " + b + " agent=" + b.appInfo.backupAgentName);
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-        } else {
-            Slog.w(TAG, "dataChanged but no participant pkg='" + packageName + "'"
-                    + " uid=" + Binder.getCallingUid());
-        }
+        return targets;
     }
 
     private void writeToJournalLocked(String str) {
@@ -2072,6 +2083,23 @@
         }
     }
 
+    // ----- IBackupManager binder interface -----
+
+    public void dataChanged(final String packageName) {
+        final HashSet<ApplicationInfo> targets = dataChangedTargets(packageName);
+        if (targets == null) {
+            Slog.w(TAG, "dataChanged but no participant pkg='" + packageName + "'"
+                   + " uid=" + Binder.getCallingUid());
+            return;
+        }
+
+        mBackupHandler.post(new Runnable() {
+                public void run() {
+                    dataChangedImpl(packageName, targets);
+                }
+            });
+    }
+
     // Clear the given package's backup data from the current transport
     public void clearBackupData(String packageName) {
         if (DEBUG) Slog.v(TAG, "clearBackupData() of " + packageName);
diff --git a/telephony/java/com/android/internal/telephony/CallManager.java b/telephony/java/com/android/internal/telephony/CallManager.java
index c1232e8..caec7e1 100644
--- a/telephony/java/com/android/internal/telephony/CallManager.java
+++ b/telephony/java/com/android/internal/telephony/CallManager.java
@@ -466,6 +466,33 @@
     }
 
     /**
+     * Hangup foreground call and resume the specific background call
+     *
+     * Note: this is noop if there is no foreground call or the heldCall is null
+     *
+     * @param heldCall to become foreground
+     * @throws CallStateException
+     */
+    public void hangupForegroundResumeBackground(Call heldCall) throws CallStateException {
+        Phone foregroundPhone = null;
+        Phone backgroundPhone = null;
+
+        if (hasActiveFgCall()) {
+            foregroundPhone = getFgPhone();
+            if (heldCall != null) {
+                backgroundPhone = heldCall.getPhone();
+                if (foregroundPhone == backgroundPhone) {
+                    getActiveFgCall().hangup();
+                } else {
+                // the call to be hangup and resumed belongs to different phones
+                    getActiveFgCall().hangup();
+                    switchHoldingAndActive(heldCall);
+                }
+            }
+        }
+    }
+
+    /**
      * Whether or not the phone can conference in the current phone
      * state--that is, one call holding and one call active.
      * @return true if the phone can conference; false otherwise.
diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java
index 4414460..885e5bc 100644
--- a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java
+++ b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java
@@ -58,6 +58,7 @@
 
 import java.io.IOException;
 import java.net.InetAddress;
+import java.net.InetSocketAddress;
 import java.net.UnknownHostException;
 import java.util.ArrayList;
 
@@ -1104,8 +1105,8 @@
             if (apn.proxy != null && apn.proxy.length() != 0) {
                 try {
                     ProxyProperties proxy = new ProxyProperties();
-                    proxy.setAddress(InetAddress.getByName(apn.proxy));
-                    proxy.setPort(Integer.parseInt(apn.port));
+                    proxy.setSocketAddress(new InetSocketAddress(InetAddress.getByName(apn.proxy),
+                            Integer.parseInt(apn.port)));
                     mLinkProperties.setHttpProxy(proxy);
                 } catch (UnknownHostException e) {
                     Log.e(LOG_TAG, "UnknownHostException making ProxyProperties: " + e);