Merge change I2d4deb11 into eclair

* changes:
  Placeholder mdpi assets
diff --git a/api/current.xml b/api/current.xml
index 201e20a..3ef93c5 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -117869,6 +117869,21 @@
  visibility="public"
 >
 </constructor>
+<method name="cancelThumbnailRequest"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="cr" type="android.content.ContentResolver">
+</parameter>
+<parameter name="origId" type="long">
+</parameter>
+</method>
 <method name="getContentUri"
  return="android.net.Uri"
  abstract="false"
@@ -118311,6 +118326,21 @@
  visibility="public"
 >
 </constructor>
+<method name="cancelThumbnailRequest"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="cr" type="android.content.ContentResolver">
+</parameter>
+<parameter name="origId" type="long">
+</parameter>
+</method>
 <method name="getContentUri"
  return="android.net.Uri"
  abstract="false"
@@ -186207,6 +186237,146 @@
 </parameter>
 </method>
 </class>
+<class name="QuickContactBadge"
+ extends="android.widget.ImageView"
+ abstract="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<implements name="android.view.View.OnClickListener">
+</implements>
+<constructor name="QuickContactBadge"
+ type="android.widget.QuickContactBadge"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="context" type="android.content.Context">
+</parameter>
+</constructor>
+<constructor name="QuickContactBadge"
+ type="android.widget.QuickContactBadge"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="context" type="android.content.Context">
+</parameter>
+<parameter name="attrs" type="android.util.AttributeSet">
+</parameter>
+</constructor>
+<constructor name="QuickContactBadge"
+ type="android.widget.QuickContactBadge"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="context" type="android.content.Context">
+</parameter>
+<parameter name="attrs" type="android.util.AttributeSet">
+</parameter>
+<parameter name="defStyle" type="int">
+</parameter>
+</constructor>
+<method name="assignContactFromEmail"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="emailAddress" type="java.lang.String">
+</parameter>
+<parameter name="lazyLookup" type="boolean">
+</parameter>
+</method>
+<method name="assignContactFromPhone"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="phoneNumber" type="java.lang.String">
+</parameter>
+<parameter name="lazyLookup" type="boolean">
+</parameter>
+</method>
+<method name="assignContactUri"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="contactUri" type="android.net.Uri">
+</parameter>
+</method>
+<method name="onClick"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="v" type="android.view.View">
+</parameter>
+</method>
+<method name="setExcludeMimes"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="excludeMimes" type="java.lang.String[]">
+</parameter>
+</method>
+<method name="setMode"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="size" type="int">
+</parameter>
+</method>
+<field name="mExcludeMimes"
+ type="java.lang.String[]"
+ transient="false"
+ volatile="false"
+ value="null"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="protected"
+>
+</field>
+</class>
 <class name="RadioButton"
  extends="android.widget.CompoundButton"
  abstract="false"
diff --git a/core/java/android/accounts/AccountManagerService.java b/core/java/android/accounts/AccountManagerService.java
index 3b39ae43..6dea023 100644
--- a/core/java/android/accounts/AccountManagerService.java
+++ b/core/java/android/accounts/AccountManagerService.java
@@ -73,7 +73,7 @@
 public class AccountManagerService
         extends IAccountManager.Stub
         implements RegisteredServicesCacheListener {
-    private static final String GOOGLE_ACCOUNT_TYPE = "com.google.GAIA";
+    private static final String GOOGLE_ACCOUNT_TYPE = "com.google";
 
     private static final String NO_BROADCAST_FLAG = "nobroadcast";
 
@@ -81,7 +81,7 @@
 
     private static final int TIMEOUT_DELAY_MS = 1000 * 60;
     private static final String DATABASE_NAME = "accounts.db";
-    private static final int DATABASE_VERSION = 3;
+    private static final int DATABASE_VERSION = 4;
 
     private final Context mContext;
 
@@ -852,7 +852,7 @@
         try {
             new Session(response, accountType, expectActivityLaunch) {
                 public void run() throws RemoteException {
-                    mAuthenticator.addAccount(this, mAccountType, authTokenType, requiredFeatures, 
+                    mAuthenticator.addAccount(this, mAccountType, authTokenType, requiredFeatures,
                             options);
                 }
 
@@ -1287,7 +1287,7 @@
         MessageHandler(Looper looper) {
             super(looper);
         }
-        
+
         public void handleMessage(Message msg) {
             if (mBindHelper.handleMessage(msg)) {
                 return;
@@ -1379,6 +1379,12 @@
                 createAccountsDeletionTrigger(db);
                 oldVersion++;
             }
+
+            if (oldVersion == 3) {
+                db.execSQL("UPDATE " + TABLE_ACCOUNTS + " SET " + ACCOUNTS_TYPE +
+                        " = 'com.google' WHERE " + ACCOUNTS_TYPE + " == 'com.google.GAIA'");
+                oldVersion++;
+            }
         }
 
         @Override
@@ -1417,7 +1423,7 @@
             filter.addAction(Intent.ACTION_DEVICE_STORAGE_OK);
             context.registerReceiver(this, filter);
         }
-        
+
         /**
          * Compare the IMSI to the one stored in the login service's
          * database.  If they differ, erase all passwords and
diff --git a/core/java/android/app/SearchDialog.java b/core/java/android/app/SearchDialog.java
index 1e9d5a1..36d3678 100644
--- a/core/java/android/app/SearchDialog.java
+++ b/core/java/android/app/SearchDialog.java
@@ -127,8 +127,8 @@
     private ArrayList<ComponentName> mPreviousComponents;
 
     // For voice searching
-    private Intent mVoiceWebSearchIntent;
-    private Intent mVoiceAppSearchIntent;
+    private final Intent mVoiceWebSearchIntent;
+    private final Intent mVoiceAppSearchIntent;
 
     // support for AutoCompleteTextView suggestions display
     private SuggestionsAdapter mSuggestionsAdapter;
@@ -156,18 +156,25 @@
      */
     public SearchDialog(Context context) {
         super(context, com.android.internal.R.style.Theme_GlobalSearchBar);
+
+        // Save voice intent for later queries/launching
+        mVoiceWebSearchIntent = new Intent(RecognizerIntent.ACTION_WEB_SEARCH);
+        mVoiceWebSearchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+        mVoiceWebSearchIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
+                RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);
+
+        mVoiceAppSearchIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
+        mVoiceAppSearchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
     }
 
     /**
-     * We create the search dialog just once, and it stays around (hidden)
-     * until activated by the user.
+     * Create the search dialog and any resources that are used for the
+     * entire lifetime of the dialog.
      */
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
 
-        setContentView(com.android.internal.R.layout.search_bar);
-
         Window theWindow = getWindow();
         WindowManager.LayoutParams lp = theWindow.getAttributes();
         lp.type = WindowManager.LayoutParams.TYPE_SEARCH_BAR;
@@ -180,6 +187,17 @@
         lp.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
         theWindow.setAttributes(lp);
 
+        // Touching outside of the search dialog will dismiss it
+        setCanceledOnTouchOutside(true);        
+    }
+
+    /**
+     * We recreate the dialog view each time it becomes visible so as to limit
+     * the scope of any problems with the contained resources.
+     */
+    private void createContentView() {
+        setContentView(com.android.internal.R.layout.search_bar);
+
         // get the view elements for local access
         SearchBar searchBar = (SearchBar) findViewById(com.android.internal.R.id.search_bar);
         searchBar.setSearchDialog(this);
@@ -211,19 +229,6 @@
         mBadgeLabel.setVisibility(View.GONE);
 
         // Additional adjustments to make Dialog work for Search
-
-        // Touching outside of the search dialog will dismiss it 
-        setCanceledOnTouchOutside(true);
-
-        // Save voice intent for later queries/launching
-        mVoiceWebSearchIntent = new Intent(RecognizerIntent.ACTION_WEB_SEARCH);
-        mVoiceWebSearchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-        mVoiceWebSearchIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
-                RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);
-        
-        mVoiceAppSearchIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
-        mVoiceAppSearchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-
         mSearchAutoCompleteImeOptions = mSearchAutoComplete.getImeOptions();
     }
 
@@ -358,7 +363,9 @@
         // isDefaultSearchable() should always give the same result.
         mGlobalSearchMode = globalSearch || searchManager.isDefaultSearchable(mSearchable);
         mActivityContext = mSearchable.getActivityContext(getContext());
-        
+
+        createContentView();
+
         // show the dialog. this will call onStart().
         if (!isShowing()) {            
             // The Dialog uses a ContextThemeWrapper for the context; use this to change the
diff --git a/core/java/android/content/AbstractSyncableContentProvider.java b/core/java/android/content/AbstractSyncableContentProvider.java
index 808f30c..fc3acc5 100644
--- a/core/java/android/content/AbstractSyncableContentProvider.java
+++ b/core/java/android/content/AbstractSyncableContentProvider.java
@@ -170,7 +170,7 @@
                         // AbstractGDataSyncAdapter, which will put acore into a crash loop
                         ArrayList<Account> gaiaAccounts = new ArrayList<Account>();
                         for (Account acct: accounts) {
-                            if (acct.type.equals("com.google.GAIA")) {
+                            if (acct.type.equals("com.google")) {
                                 gaiaAccounts.add(acct);
                             }
                         }
diff --git a/core/java/android/content/ContentResolver.java b/core/java/android/content/ContentResolver.java
index 307899a..c9edc41 100644
--- a/core/java/android/content/ContentResolver.java
+++ b/core/java/android/content/ContentResolver.java
@@ -903,7 +903,7 @@
         if (extras != null) {
             String accountName = extras.getString(SYNC_EXTRAS_ACCOUNT);
             if (!TextUtils.isEmpty(accountName)) {
-                account = new Account(accountName, "com.google.GAIA");
+                account = new Account(accountName, "com.google");
             }
             extras.remove(SYNC_EXTRAS_ACCOUNT);
         }
diff --git a/core/java/android/content/SyncManager.java b/core/java/android/content/SyncManager.java
index 6181a07..5376f78 100644
--- a/core/java/android/content/SyncManager.java
+++ b/core/java/android/content/SyncManager.java
@@ -73,6 +73,7 @@
 import java.util.PriorityQueue;
 import java.util.Random;
 import java.util.Collection;
+import java.util.concurrent.CountDownLatch;
 
 /**
  * @hide
@@ -200,11 +201,7 @@
 
     private BroadcastReceiver mBootCompletedReceiver = new BroadcastReceiver() {
         public void onReceive(Context context, Intent intent) {
-            if (!mFactoryTest) {
-                mBootCompleted = true;
-                AccountManager.get(mContext).addOnAccountsUpdatedListener(SyncManager.this,
-                        mSyncHandler, true /* updateImmediately */);
-            }
+            mSyncHandler.onBootCompleted();
         }
     };
 
@@ -357,8 +354,10 @@
         IntentFilter intentFilter = new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION);
         context.registerReceiver(mConnectivityIntentReceiver, intentFilter);
 
-        intentFilter = new IntentFilter(Intent.ACTION_BOOT_COMPLETED);
-        context.registerReceiver(mBootCompletedReceiver, intentFilter);
+        if (!factoryTest) {
+            intentFilter = new IntentFilter(Intent.ACTION_BOOT_COMPLETED);
+            context.registerReceiver(mBootCompletedReceiver, intentFilter);
+        }
 
         intentFilter = new IntentFilter(ConnectivityManager.ACTION_BACKGROUND_DATA_SETTING_CHANGED);
         context.registerReceiver(mBackgroundDataSettingChanged, intentFilter);
@@ -398,6 +397,13 @@
                 sendCheckAlarmsMessage();
             }
         });
+
+        if (!factoryTest) {
+            AccountManager.get(mContext).addOnAccountsUpdatedListener(SyncManager.this,
+                mSyncHandler, false /* updateImmediately */);
+            // do this synchronously to ensure we have the accounts before this call returns
+            onAccountsUpdated(AccountManager.get(mContext).getAccounts());
+        }
     }
 
     private synchronized void initializeSyncPoll() {
@@ -580,10 +586,8 @@
             Bundle extras, long delay, boolean onlyThoseWithUnkownSyncableState) {
         boolean isLoggable = Log.isLoggable(TAG, Log.VERBOSE);
 
-        if (!mBootCompleted) {
-            if (isLoggable) {
-                Log.v(TAG, "suppressing scheduleSync() since boot hasn't completed");
-            }
+        if (mAccounts == null) {
+            Log.e(TAG, "scheduleSync: the accounts aren't known yet, this should never happen");
             return;
         }
 
@@ -595,10 +599,9 @@
             return;
         }
 
-        final boolean backgroundDataUsageAllowed =
+        final boolean backgroundDataUsageAllowed = !mBootCompleted ||
                 getConnectivityManager().getBackgroundDataSetting();
 
-        if (mAccounts == null) setStatusText("The accounts aren't known yet.");
         if (!mDataConnectionIsConnected) setStatusText("No data connection");
         if (mStorageIsLow) setStatusText("Memory low");
 
@@ -1453,7 +1456,29 @@
         // used to track if we have installed the error notification so that we don't reinstall
         // it if sync is still failing
         private boolean mErrorNotificationInstalled = false;
+        private volatile CountDownLatch mReadyToRunLatch = new CountDownLatch(1);
 
+        public void onBootCompleted() {
+            mBootCompleted = true;
+            if (mReadyToRunLatch != null) {
+                mReadyToRunLatch.countDown();
+            }
+        }
+
+        private void waitUntilReadyToRun() {
+            CountDownLatch latch = mReadyToRunLatch;
+            if (latch != null) {
+                while (true) {
+                    try {
+                        latch.await();
+                        mReadyToRunLatch = null;
+                        return;
+                    } catch (InterruptedException e) {
+                        Thread.currentThread().interrupt();
+                    }
+                }
+            }
+        }
         /**
          * Used to keep track of whether a sync notification is active and who it is for.
          */
@@ -1491,11 +1516,8 @@
         }
 
         public void handleMessage(Message msg) {
-            handleSyncHandlerMessage(msg);
-        }
-
-        private void handleSyncHandlerMessage(Message msg) {
             try {
+                waitUntilReadyToRun();
                 switch (msg.what) {
                     case SyncHandler.MESSAGE_SYNC_FINISHED:
                         if (Log.isLoggable(TAG, Log.VERBOSE)) {
diff --git a/core/java/android/content/SyncStorageEngine.java b/core/java/android/content/SyncStorageEngine.java
index fbdd5ae..11d984d 100644
--- a/core/java/android/content/SyncStorageEngine.java
+++ b/core/java/android/content/SyncStorageEngine.java
@@ -1104,7 +1104,7 @@
                                 String accountType = parser.getAttributeValue(
                                         null, "type");
                                 if (accountType == null) {
-                                    accountType = "com.google.GAIA";
+                                    accountType = "com.google";
                                 }
                                 String authorityName = parser.getAttributeValue(
                                         null, "authority");
@@ -1272,7 +1272,7 @@
                 String accountType = hasType
                         ? c.getString(c.getColumnIndex("account_type")) : null;
                 if (accountType == null) {
-                    accountType = "com.google.GAIA";
+                    accountType = "com.google";
                 }
                 String authorityName = c.getString(c.getColumnIndex("authority"));
                 AuthorityInfo authority = this.getOrCreateAuthorityLocked(
diff --git a/core/java/android/pim/vcard/ContactStruct.java b/core/java/android/pim/vcard/ContactStruct.java
index 915f09e..e87c796 100644
--- a/core/java/android/pim/vcard/ContactStruct.java
+++ b/core/java/android/pim/vcard/ContactStruct.java
@@ -1123,7 +1123,7 @@
     }
     
     // From GoogleSource.java in Contacts app.
-    private static final String ACCOUNT_TYPE_GOOGLE = "com.google.GAIA";
+    private static final String ACCOUNT_TYPE_GOOGLE = "com.google";
     private static final String GOOGLE_MY_CONTACTS_GROUP = "System Group: My Contacts";
 
     public void pushIntoContentResolver(ContentResolver resolver) {
diff --git a/core/java/android/pim/vcard/VCardComposer.java b/core/java/android/pim/vcard/VCardComposer.java
index b0376c4..c943d85 100644
--- a/core/java/android/pim/vcard/VCardComposer.java
+++ b/core/java/android/pim/vcard/VCardComposer.java
@@ -284,7 +284,9 @@
     private final boolean mUsesQuotedPrintable;
     private final boolean mUsesAndroidProperty;
     private final boolean mUsesDefactProperty;
+    private final boolean mUsesUtf8;
     private final boolean mUsesShiftJis;
+    private final boolean mUsesQPToPrimaryProperties;
 
     private Cursor mCursor;
     private int mIdColumn;
@@ -366,7 +368,9 @@
         mUsesAndroidProperty = VCardConfig
                 .usesAndroidSpecificProperty(vcardType);
         mUsesDefactProperty = VCardConfig.usesDefactProperty(vcardType);
+        mUsesUtf8 = VCardConfig.usesUtf8(vcardType);
         mUsesShiftJis = VCardConfig.usesShiftJis(vcardType);
+        mUsesQPToPrimaryProperties = VCardConfig.usesQPToPrimaryProperties(vcardType);
 
         if (mIsDoCoMo) {
             mCharsetString = CharsetUtils.charsetForVendor(SHIFT_JIS, "docomo").name();
@@ -400,6 +404,7 @@
         if (!(VCardUtils.containsOnlyPrintableAscii(phoneName))) {
             needCharset = true;
         }
+        // TODO: QP should be used? Using mUsesQPToPrimaryProperties should help.
         appendVCardLine(builder, VCARD_PROPERTY_FULL_NAME, phoneName, needCharset, false);
         appendVCardLine(builder, VCARD_PROPERTY_NAME, phoneName, needCharset, false);
 
@@ -598,6 +603,7 @@
             name = mCursor.getString(NUMBER_COLUMN_INDEX);
         }
         final boolean needCharset = !(VCardUtils.containsOnlyPrintableAscii(name));
+        // TODO: QP should be used? Using mUsesQPToPrimaryProperties should help.
         appendVCardLine(builder, VCARD_PROPERTY_FULL_NAME, name, needCharset, false);
         appendVCardLine(builder, VCARD_PROPERTY_NAME, name, needCharset, false);
 
@@ -634,8 +640,8 @@
                     ContentValues contentValues = namedContentValues.values;
                     String key = contentValues.getAsString(Data.MIMETYPE);
                     if (key != null) {
-                        List<ContentValues> contentValuesList = contentValuesListMap
-                                .get(key);
+                        List<ContentValues> contentValuesList =
+                                contentValuesListMap.get(key);
                         if (contentValuesList == null) {
                             contentValuesList = new ArrayList<ContentValues>();
                             contentValuesListMap.put(key, contentValuesList);
@@ -788,26 +794,46 @@
         final String displayName = primaryContentValues
                 .getAsString(StructuredName.DISPLAY_NAME);
 
-        // For now, some primary element is not encoded into Quoted-Printable, which is not
-        // valid in vCard spec strictly. In the future, we may have to have some flag to
-        // enable composer to encode these primary field into Quoted-Printable.
         if (!TextUtils.isEmpty(familyName) || !TextUtils.isEmpty(givenName)) {
-            final String encodedFamily = escapeCharacters(familyName);
-            final String encodedGiven = escapeCharacters(givenName);
-            final String encodedMiddle = escapeCharacters(middleName);
-            final String encodedPrefix = escapeCharacters(prefix);
-            final String encodedSuffix = escapeCharacters(suffix);
+            final String encodedFamily;
+            final String encodedGiven;
+            final String encodedMiddle;
+            final String encodedPrefix;
+            final String encodedSuffix;
+
+            final boolean reallyUseQuotedPrintableToName =
+                (mUsesQPToPrimaryProperties &&
+                    !(VCardUtils.containsOnlyNonCrLfPrintableAscii(familyName) &&
+                            VCardUtils.containsOnlyNonCrLfPrintableAscii(givenName) &&
+                            VCardUtils.containsOnlyNonCrLfPrintableAscii(middleName) &&
+                            VCardUtils.containsOnlyNonCrLfPrintableAscii(prefix) &&
+                            VCardUtils.containsOnlyNonCrLfPrintableAscii(suffix)));
+
+            if (reallyUseQuotedPrintableToName) {
+                encodedFamily = encodeQuotedPrintable(familyName);
+                encodedGiven = encodeQuotedPrintable(givenName);
+                encodedMiddle = encodeQuotedPrintable(middleName);
+                encodedPrefix = encodeQuotedPrintable(prefix);
+                encodedSuffix = encodeQuotedPrintable(suffix);
+            } else {
+                encodedFamily = escapeCharacters(familyName);
+                encodedGiven = escapeCharacters(givenName);
+                encodedMiddle = escapeCharacters(middleName);
+                encodedPrefix = escapeCharacters(prefix);
+                encodedSuffix = escapeCharacters(suffix);
+            }
 
             // N property. This order is specified by vCard spec and does not depend on countries.
             builder.append(VCARD_PROPERTY_NAME);
-            if (!(VCardUtils.containsOnlyPrintableAscii(familyName) &&
-                    VCardUtils.containsOnlyPrintableAscii(givenName) &&
-                    VCardUtils.containsOnlyPrintableAscii(middleName) &&
-                    VCardUtils.containsOnlyPrintableAscii(prefix) &&
-                    VCardUtils.containsOnlyPrintableAscii(suffix))) {
+            if (shouldAppendCharsetAttribute(Arrays.asList(
+                    familyName, givenName, middleName, prefix, suffix))) {
                 builder.append(VCARD_ATTR_SEPARATOR);
                 builder.append(mVCardAttributeCharset);
             }
+            if (reallyUseQuotedPrintableToName) {
+                builder.append(VCARD_ATTR_SEPARATOR);
+                builder.append(VCARD_ATTR_ENCODING_QP);
+            }
 
             builder.append(VCARD_DATA_SEPARATOR);
             builder.append(encodedFamily);
@@ -821,25 +847,51 @@
             builder.append(encodedSuffix);
             builder.append(VCARD_COL_SEPARATOR);
 
-            final String encodedFullname = VCardUtils.constructNameFromElements(
+            final String fullname = VCardUtils.constructNameFromElements(
                     VCardConfig.getNameOrderType(mVCardType),
                     encodedFamily, encodedMiddle, encodedGiven, encodedPrefix, encodedSuffix);
+            final boolean reallyUseQuotedPrintableToFullname =
+                mUsesQPToPrimaryProperties &&
+                !VCardUtils.containsOnlyNonCrLfPrintableAscii(fullname);
+
+            final String encodedFullname =
+                reallyUseQuotedPrintableToFullname ?
+                        encodeQuotedPrintable(fullname) :
+                            escapeCharacters(fullname);
 
             // FN property
             builder.append(VCARD_PROPERTY_FULL_NAME);
-            if (!VCardUtils.containsOnlyPrintableAscii(encodedFullname)) {
+            if (shouldAppendCharsetAttribute(encodedFullname)) {
                 builder.append(VCARD_ATTR_SEPARATOR);
                 builder.append(mVCardAttributeCharset);
             }
+            if (reallyUseQuotedPrintableToFullname) {
+                builder.append(VCARD_ATTR_SEPARATOR);
+                builder.append(VCARD_ATTR_ENCODING_QP);
+            }
             builder.append(VCARD_DATA_SEPARATOR);
             builder.append(encodedFullname);
             builder.append(VCARD_COL_SEPARATOR);
         } else if (!TextUtils.isEmpty(displayName)) {
+            final boolean reallyUseQuotedPrintableToDisplayName =
+                (mUsesQPToPrimaryProperties &&
+                        !VCardUtils.containsOnlyNonCrLfPrintableAscii(displayName));
+            final String encodedDisplayName =
+                    reallyUseQuotedPrintableToDisplayName ?
+                            encodeQuotedPrintable(displayName) :
+                                escapeCharacters(displayName);
+
             builder.append(VCARD_PROPERTY_NAME);
-            builder.append(VCARD_ATTR_SEPARATOR);
-            builder.append(mVCardAttributeCharset);
+            if (shouldAppendCharsetAttribute(encodedDisplayName)) {
+                builder.append(VCARD_ATTR_SEPARATOR);
+                builder.append(mVCardAttributeCharset);
+            }
+            if (reallyUseQuotedPrintableToDisplayName) {
+                builder.append(VCARD_ATTR_SEPARATOR);
+                builder.append(VCARD_ATTR_ENCODING_QP);
+            }
             builder.append(VCARD_DATA_SEPARATOR);
-            builder.append(escapeCharacters(displayName));
+            builder.append(encodedDisplayName);
             builder.append(VCARD_ITEM_SEPARATOR);
             builder.append(VCARD_ITEM_SEPARATOR);
             builder.append(VCARD_ITEM_SEPARATOR);
@@ -873,54 +925,65 @@
             if (mIsV30) {
                 final String sortString = VCardUtils
                         .constructNameFromElements(mVCardType,
-                                phoneticFamilyName, phoneticMiddleName,
+                                phoneticFamilyName,
+                                phoneticMiddleName,
                                 phoneticGivenName);
                 builder.append(VCARD_PROPERTY_SORT_STRING);
 
-                if (!VCardUtils.containsOnlyPrintableAscii(sortString)) {
-                    // Strictly, adding charset information is NOT valid in
-                    // VCard 3.0,
-                    // but we'll add this info since parser side may be able to
-                    // use the charset via
-                    // this attribute field.
-                    //
-                    // e.g. Japanese mobile phones use Shift_Jis while RFC 2426
-                    // recommends
-                    // UTF-8. By adding this field, parsers may be able to know
-                    // this text
-                    // is NOT UTF-8 but Shift_Jis.
+                // Do not need to care about QP, since vCard 3.0 does not allow it.
+                final String encodedSortString = escapeCharacters(sortString);
+                if (shouldAppendCharsetAttribute(encodedSortString)) {
                     builder.append(VCARD_ATTR_SEPARATOR);
                     builder.append(mVCardAttributeCharset);
                 }
-
                 builder.append(VCARD_DATA_SEPARATOR);
-                builder.append(sortString);
+                builder.append(encodedSortString);
                 builder.append(VCARD_COL_SEPARATOR);
             } else {
                 // Note: There is no appropriate property for expressing
-                // phonetic name in
-                // VCard 2.1, while there is in VCard 3.0 (SORT-STRING).
-                // We chose to use DoCoMo's way since it is supported by a
-                // lot of Japanese mobile phones.
-                //
-                // TODO: should use Quoted-Pritable?
+                //       phonetic name in vCard 2.1, while there is in
+                //       vCard 3.0 (SORT-STRING).
+                //       We chose to use DoCoMo's way since it is supported by
+                //       a lot of Japanese mobile phones. This is "X-" property, so
+                //       any parser hopefully would not get confused with this.
                 builder.append(VCARD_PROPERTY_SOUND);
                 builder.append(VCARD_ATTR_SEPARATOR);
                 builder.append(Constants.ATTR_TYPE_X_IRMC_N);
-                builder.append(VCARD_ATTR_SEPARATOR);
 
-                if (!(VCardUtils.containsOnlyPrintableAscii(phoneticFamilyName) &&
-                        VCardUtils.containsOnlyPrintableAscii(phoneticMiddleName) &&
-                        VCardUtils.containsOnlyPrintableAscii(phoneticGivenName))) {
-                    builder.append(mVCardAttributeCharset);
-                    builder.append(VCARD_DATA_SEPARATOR);
+                boolean reallyUseQuotedPrintable =
+                    (mUsesQPToPrimaryProperties &&
+                            !(VCardUtils.containsOnlyNonCrLfPrintableAscii(
+                                    phoneticFamilyName) &&
+                              VCardUtils.containsOnlyNonCrLfPrintableAscii(
+                                    phoneticMiddleName) &&
+                              VCardUtils.containsOnlyNonCrLfPrintableAscii(
+                                    phoneticGivenName)));
+
+                final String encodedPhoneticFamilyName;
+                final String encodedPhoneticMiddleName;
+                final String encodedPhoneticGivenName;
+                if (reallyUseQuotedPrintable) {
+                    encodedPhoneticFamilyName = encodeQuotedPrintable(phoneticFamilyName);
+                    encodedPhoneticMiddleName = encodeQuotedPrintable(phoneticMiddleName);
+                    encodedPhoneticGivenName = encodeQuotedPrintable(phoneticGivenName);
+                } else {
+                    encodedPhoneticFamilyName = escapeCharacters(phoneticFamilyName);
+                    encodedPhoneticMiddleName = escapeCharacters(phoneticMiddleName);
+                    encodedPhoneticGivenName = escapeCharacters(phoneticGivenName);
                 }
 
-                builder.append(escapeCharacters(phoneticFamilyName));
+                if (shouldAppendCharsetAttribute(Arrays.asList(
+                        encodedPhoneticFamilyName, encodedPhoneticMiddleName,
+                        encodedPhoneticGivenName))) {
+                    builder.append(VCARD_ATTR_SEPARATOR);
+                    builder.append(mVCardAttributeCharset);
+                }
+                builder.append(VCARD_DATA_SEPARATOR);
+                builder.append(encodedPhoneticFamilyName);
                 builder.append(VCARD_ITEM_SEPARATOR);
-                builder.append(escapeCharacters(phoneticMiddleName));
+                builder.append(encodedPhoneticGivenName);
                 builder.append(VCARD_ITEM_SEPARATOR);
-                builder.append(escapeCharacters(phoneticGivenName));
+                builder.append(encodedPhoneticMiddleName);
                 builder.append(VCARD_ITEM_SEPARATOR);
                 builder.append(VCARD_ITEM_SEPARATOR);
                 builder.append(VCARD_COL_SEPARATOR);
@@ -939,21 +1002,72 @@
 
         if (mUsesDefactProperty) {
             if (!TextUtils.isEmpty(phoneticGivenName)) {
+                final boolean reallyUseQuotedPrintable =
+                    (mUsesQPToPrimaryProperties &&
+                            !VCardUtils.containsOnlyNonCrLfPrintableAscii(phoneticGivenName));
+                final String encodedPhoneticGivenName;
+                if (reallyUseQuotedPrintable) {
+                    encodedPhoneticGivenName = encodeQuotedPrintable(phoneticGivenName);
+                } else {
+                    encodedPhoneticGivenName = escapeCharacters(phoneticGivenName);
+                }
                 builder.append(VCARD_PROPERTY_X_PHONETIC_FIRST_NAME);
+                if (shouldAppendCharsetAttribute(encodedPhoneticGivenName)) {
+                    builder.append(VCARD_ATTR_SEPARATOR);
+                    builder.append(mVCardAttributeCharset);
+                }
+                if (reallyUseQuotedPrintable) {
+                    builder.append(VCARD_ATTR_SEPARATOR);
+                    builder.append(VCARD_ATTR_ENCODING_QP);
+                }
                 builder.append(VCARD_DATA_SEPARATOR);
-                builder.append(phoneticGivenName);
+                builder.append(encodedPhoneticGivenName);
                 builder.append(VCARD_COL_SEPARATOR);
             }
             if (!TextUtils.isEmpty(phoneticMiddleName)) {
+                final boolean reallyUseQuotedPrintable =
+                    (mUsesQPToPrimaryProperties &&
+                            !VCardUtils.containsOnlyNonCrLfPrintableAscii(phoneticMiddleName));
+                final String encodedPhoneticMiddleName;
+                if (reallyUseQuotedPrintable) {
+                    encodedPhoneticMiddleName = encodeQuotedPrintable(phoneticMiddleName);
+                } else {
+                    encodedPhoneticMiddleName = escapeCharacters(phoneticMiddleName);
+                }
                 builder.append(VCARD_PROPERTY_X_PHONETIC_MIDDLE_NAME);
+                if (shouldAppendCharsetAttribute(encodedPhoneticMiddleName)) {
+                    builder.append(VCARD_ATTR_SEPARATOR);
+                    builder.append(mVCardAttributeCharset);
+                }
+                if (reallyUseQuotedPrintable) {
+                    builder.append(VCARD_ATTR_SEPARATOR);
+                    builder.append(VCARD_ATTR_ENCODING_QP);
+                }
                 builder.append(VCARD_DATA_SEPARATOR);
-                builder.append(phoneticMiddleName);
+                builder.append(encodedPhoneticMiddleName);
                 builder.append(VCARD_COL_SEPARATOR);
             }
             if (!TextUtils.isEmpty(phoneticFamilyName)) {
+                final boolean reallyUseQuotedPrintable =
+                    (mUsesQPToPrimaryProperties &&
+                            !VCardUtils.containsOnlyNonCrLfPrintableAscii(phoneticFamilyName));
+                final String encodedPhoneticFamilyName;
+                if (reallyUseQuotedPrintable) {
+                    encodedPhoneticFamilyName = encodeQuotedPrintable(phoneticFamilyName);
+                } else {
+                    encodedPhoneticFamilyName = escapeCharacters(phoneticFamilyName);
+                }
                 builder.append(VCARD_PROPERTY_X_PHONETIC_LAST_NAME);
+                if (shouldAppendCharsetAttribute(encodedPhoneticFamilyName)) {
+                    builder.append(VCARD_ATTR_SEPARATOR);
+                    builder.append(mVCardAttributeCharset);
+                }
+                if (reallyUseQuotedPrintable) {
+                    builder.append(VCARD_ATTR_SEPARATOR);
+                    builder.append(VCARD_ATTR_ENCODING_QP);
+                }
                 builder.append(VCARD_DATA_SEPARATOR);
-                builder.append(phoneticFamilyName);
+                builder.append(encodedPhoneticFamilyName);
                 builder.append(VCARD_COL_SEPARATOR);
             }
         }
@@ -975,21 +1089,32 @@
             }
 
             for (ContentValues contentValues : contentValuesList) {
-                final String nickname = contentValues
-                        .getAsString(Nickname.NAME);
+                final String nickname = contentValues.getAsString(Nickname.NAME);
                 if (TextUtils.isEmpty(nickname)) {
                     continue;
                 }
-                builder.append(propertyNickname);
 
-                if (!VCardUtils.containsOnlyPrintableAscii(propertyNickname)) {
-                    //  Strictly, this is not valid in vCard 3.0. See above.
+                final String encodedNickname;
+                final boolean reallyUseQuotedPrintable =
+                    (mUsesQuotedPrintable &&
+                            !VCardUtils.containsOnlyNonCrLfPrintableAscii(nickname));
+                if (reallyUseQuotedPrintable) {
+                    encodedNickname = encodeQuotedPrintable(nickname);
+                } else {
+                    encodedNickname = escapeCharacters(nickname);
+                }
+
+                builder.append(propertyNickname);
+                if (shouldAppendCharsetAttribute(propertyNickname)) {
                     builder.append(VCARD_ATTR_SEPARATOR);
                     builder.append(mVCardAttributeCharset);
                 }
-
+                if (reallyUseQuotedPrintable) {
+                    builder.append(VCARD_ATTR_SEPARATOR);
+                    builder.append(VCARD_ATTR_ENCODING_QP);
+                }
                 builder.append(VCARD_DATA_SEPARATOR);
-                builder.append(escapeCharacters(nickname));
+                builder.append(encodedNickname);
                 builder.append(VCARD_COL_SEPARATOR);
             }
         }
@@ -1048,7 +1173,6 @@
                     continue;
                 }
                 emailAddressExists = true;
-                // Do not allow completely same email address line emitted into each file.
                 if (!addressSet.contains(emailAddress)) {
                     addressSet.add(emailAddress);
                     appendVCardEmailLine(builder, type, label, emailAddress);
@@ -1065,7 +1189,6 @@
             final Map<String, List<ContentValues>> contentValuesListMap) {
         final List<ContentValues> contentValuesList = contentValuesListMap
                 .get(StructuredPostal.CONTENT_ITEM_TYPE);
-
         if (contentValuesList != null) {
             if (mIsDoCoMo) {
                 appendPostalsForDoCoMo(builder, contentValuesList);
@@ -1082,7 +1205,7 @@
     }
 
     /**
-     * Try to append just one line. If there's no appropriate address
+     * Tries to append just one line. If there's no appropriate address
      * information, append an empty line.
      */
     private void appendPostalsForDoCoMo(final StringBuilder builder,
@@ -1751,6 +1874,35 @@
         builder.append(type);
     }
 
+    /**
+     * Returns true when the property line should contain charset attribute
+     * information. This method may return true even when vCard version is 3.0.
+     *
+     * Strictly, adding charset information is invalid in VCard 3.0.
+     * However we'll add the info only when used charset is not UTF-8
+     * in vCard 3.0 format, since parser side may be able to use the charset
+     * via this field, though we may encounter another problem by adding it...
+     *
+     * e.g. Japanese mobile phones use Shift_Jis while RFC 2426
+     * recommends UTF-8. By adding this field, parsers may be able
+     * to know this text is NOT UTF-8 but Shift_Jis.
+     */
+    private boolean shouldAppendCharsetAttribute(final String propertyValue) {
+        return (!VCardUtils.containsOnlyPrintableAscii(propertyValue) &&
+                        (!mIsV30 || !mUsesUtf8));
+    }
+
+    private boolean shouldAppendCharsetAttribute(final List<String> propertyValueList) {
+        boolean shouldAppendBasically = false;
+        for (String propertyValue : propertyValueList) {
+            if (!VCardUtils.containsOnlyPrintableAscii(propertyValue)) {
+                shouldAppendBasically = true;
+                break;
+            }
+        }
+        return shouldAppendBasically && (!mIsV30 || !mUsesUtf8);
+    }
+
     private String encodeQuotedPrintable(String str) {
         if (TextUtils.isEmpty(str)) {
             return "";
diff --git a/core/java/android/pim/vcard/VCardConfig.java b/core/java/android/pim/vcard/VCardConfig.java
index bc19551..68cd0df 100644
--- a/core/java/android/pim/vcard/VCardConfig.java
+++ b/core/java/android/pim/vcard/VCardConfig.java
@@ -55,7 +55,7 @@
     
     private static final int FLAG_CHARSET_UTF8 = 0;
     private static final int FLAG_CHARSET_SHIFT_JIS = 0x20;
-    
+
     /**
      * The flag indicating the vCard composer will add some "X-" properties used only in Android
      * when the formal vCard specification does not have appropriate fields for that data.
@@ -85,7 +85,7 @@
      * in vCard 3.0). Some external parsers may get confused with non-valid, non-"X-" properties.
      */
     private static final int FLAG_USE_DEFACT_PROPERTY = 0x40000000;
-    
+
     /**
      * The flag indicating some specific dialect seen in vcard of DoCoMo (one of Japanese
      * mobile careers) should be used. This flag does not include any other information like
@@ -94,10 +94,20 @@
      */
     private static final int FLAG_DOCOMO = 0x20000000;
 
+    /**
+     * The flag indicating the vCard composer use Quoted-Printable toward even "primary" types.
+     * In this context, "primary" types means "N", "FN", etc. which are usually "not" encoded
+     * into Quoted-Printable format in external exporters.
+     * This flag is useful when some target importer does not accept "primary" property values
+     * without Quoted-Printable encoding.
+     *
+     * @hide Temporaly made public. We don't strictly define "primary", so we may change the
+     * behavior around this flag in the future. Do not use this flag without any reason.
+     */
+    public static final int FLAG_USE_QP_TO_PRIMARY_PROPERTIES = 0x10000000;
     
     // VCard types
 
-
     /**
      * General vCard format with the version 2.1. Uses UTF-8 for the charset.
      * When composing a vCard entry, the US convension will be used.
@@ -114,10 +124,10 @@
     /**
      * General vCard format with the version 3.0. Uses UTF-8 for the charset.
      * 
-     * Note that this type is not fully implemented, so probably some bugs remain especially
-     * in parsing part.
-     * 
-     * TODO: implement this type.
+     * Note that this type is not fully implemented, so probably some bugs remain both in
+     * parsing and composing.
+     *
+     * TODO: implement this type correctly.
      */
     public static final int VCARD_TYPE_V30_GENERIC =
         (FLAG_V30 | NAME_ORDER_DEFAULT | FLAG_CHARSET_UTF8 |
@@ -243,6 +253,10 @@
                 (vcardType == VCARD_TYPE_DOCOMO));
     }
 
+    public static boolean usesUtf8(int vcardType) {
+        return ((vcardType & FLAG_CHARSET_UTF8) != 0);
+    }
+
     public static boolean usesShiftJis(int vcardType) {
         return ((vcardType & FLAG_CHARSET_SHIFT_JIS) != 0);
     }
@@ -257,7 +271,7 @@
     public static boolean needsToConvertPhoneticString(int vcardType) {
         return (vcardType == VCARD_TYPE_DOCOMO);
     }
-    
+
     public static int getNameOrderType(int vcardType) {
         return vcardType & NAME_ORDER_MASK;
     }
@@ -265,19 +279,27 @@
     public static boolean usesAndroidSpecificProperty(int vcardType) {
         return ((vcardType & FLAG_USE_ANDROID_PROPERTY) != 0);
     }
-    
+
     public static boolean usesDefactProperty(int vcardType) {
         return ((vcardType & FLAG_USE_DEFACT_PROPERTY) != 0);
     }
-    
+
     public static boolean onlyOneNoteFieldIsAvailable(int vcardType) {
         return vcardType == VCARD_TYPE_DOCOMO;
     }
-    
+
     public static boolean showPerformanceLog() {
         return (VCardConfig.LOG_LEVEL & VCardConfig.LOG_LEVEL_PERFORMANCE_MEASUREMENT) != 0;
     }
-    
+
+    /**
+     * @hide
+     */
+    public static boolean usesQPToPrimaryProperties(int vcardType) {
+       return (usesQuotedPrintable(vcardType) &&
+               ((vcardType & FLAG_USE_QP_TO_PRIMARY_PROPERTIES) != 0));
+    }
+
     private VCardConfig() {
     }
 }
\ No newline at end of file
diff --git a/core/java/android/provider/MediaStore.java b/core/java/android/provider/MediaStore.java
index 106e833..7fabfc8 100644
--- a/core/java/android/provider/MediaStore.java
+++ b/core/java/android/provider/MediaStore.java
@@ -240,6 +240,26 @@
         private static final String[] PROJECTION = new String[] {_ID, MediaColumns.DATA};
 
         /**
+         * This method cancels the thumbnail request so clients waiting for getThumbnail will be
+         * interrupted and return immediately. Only the original process which made the getThumbnail
+         * requests can cancel their own requests.
+         *
+         * @param cr ContentResolver
+         * @param origId original image or video id
+         * @param baseUri the base URI of requested thumbnails
+         */
+        static void cancelThumbnailRequest(ContentResolver cr, long origId, Uri baseUri) {
+            Uri cancelUri = baseUri.buildUpon().appendQueryParameter("cancel", "1")
+                    .appendQueryParameter("orig_id", String.valueOf(origId)).build();
+            Cursor c = null;
+            try {
+                c = cr.query(cancelUri, PROJECTION, null, null, null);
+            }
+            finally {
+                if (c != null) c.close();
+            }
+        }
+        /**
          * This method ensure thumbnails associated with origId are generated and decode the byte
          * stream from database (MICRO_KIND) or file (MINI_KIND).
          *
@@ -257,6 +277,7 @@
                 BitmapFactory.Options options, Uri baseUri, boolean isVideo) {
             Bitmap bitmap = null;
             String filePath = null;
+            // Log.v(TAG, "getThumbnail: origId="+origId+", kind="+kind+", isVideo="+isVideo);
             // some optimization for MICRO_KIND: if the magic is non-zero, we don't bother
             // querying MediaProvider and simply return thumbnail.
             if (kind == MICRO_KIND) {
@@ -635,6 +656,18 @@
             }
 
             /**
+             * This method cancels the thumbnail request so clients waiting for getThumbnail will be
+             * interrupted and return immediately. Only the original process which made the getThumbnail
+             * requests can cancel their own requests.
+             *
+             * @param cr ContentResolver
+             * @param origId original image id
+             */
+            public static void cancelThumbnailRequest(ContentResolver cr, long origId) {
+                InternalThumbnails.cancelThumbnailRequest(cr, origId, EXTERNAL_CONTENT_URI);
+            }
+
+            /**
              * This method checks if the thumbnails of the specified image (origId) has been created.
              * It will be blocked until the thumbnails are generated.
              *
@@ -1552,6 +1585,18 @@
          */
         public static class Thumbnails implements BaseColumns {
             /**
+             * This method cancels the thumbnail request so clients waiting for getThumbnail will be
+             * interrupted and return immediately. Only the original process which made the getThumbnail
+             * requests can cancel their own requests.
+             *
+             * @param cr ContentResolver
+             * @param origId original video id
+             */
+            public static void cancelThumbnailRequest(ContentResolver cr, long origId) {
+                InternalThumbnails.cancelThumbnailRequest(cr, origId, EXTERNAL_CONTENT_URI);
+            }
+
+            /**
              * This method checks if the thumbnails of the specified image (origId) has been created.
              * It will be blocked until the thumbnails are generated.
              *
diff --git a/core/java/android/server/BluetoothService.java b/core/java/android/server/BluetoothService.java
index 4e926a6..edf6d10 100644
--- a/core/java/android/server/BluetoothService.java
+++ b/core/java/android/server/BluetoothService.java
@@ -757,9 +757,7 @@
         if (!BluetoothAdapter.checkBluetoothAddress(address)) {
             return null;
         }
-        Map <String, String> properties = mDeviceProperties.get(address);
-        if (properties != null) return properties.get("Name");
-        return null;
+        return getRemoteDeviceProperty(address, "Name");
     }
 
     /**
diff --git a/core/java/android/webkit/CallbackProxy.java b/core/java/android/webkit/CallbackProxy.java
index 37efdb0..8d55247 100644
--- a/core/java/android/webkit/CallbackProxy.java
+++ b/core/java/android/webkit/CallbackProxy.java
@@ -106,6 +106,7 @@
     private static final int GEOLOCATION_PERMISSIONS_SHOW_PROMPT = 130;
     private static final int GEOLOCATION_PERMISSIONS_HIDE_PROMPT = 131;
     private static final int RECEIVED_TOUCH_ICON_URL             = 132;
+    private static final int GET_VISITED_HISTORY                 = 133;
 
     // Message triggered by the client to resume execution
     private static final int NOTIFY                              = 200;
@@ -655,6 +656,12 @@
                 int lineNumber = msg.getData().getInt("lineNumber");
                 mWebChromeClient.addMessageToConsole(message, lineNumber, sourceID);
                 break;
+
+            case GET_VISITED_HISTORY:
+                if (mWebChromeClient != null) {
+                    mWebChromeClient.getVisitedHistory((ValueCallback<String[]>)msg.obj);
+                }
+                break;
         }
     }
 
@@ -1329,4 +1336,16 @@
         }
         return result.getResult();
     }
+
+    /**
+     * @hide pending API council approval
+     */
+    public void getVisitedHistory(ValueCallback<String[]> callback) {
+        if (mWebChromeClient == null) {
+            return;
+        }
+        Message msg = obtainMessage(GET_VISITED_HISTORY);
+        msg.obj = callback;
+        sendMessage(msg);
+    }
 }
diff --git a/core/java/android/webkit/WebChromeClient.java b/core/java/android/webkit/WebChromeClient.java
index bbc567d..7f5b862 100644
--- a/core/java/android/webkit/WebChromeClient.java
+++ b/core/java/android/webkit/WebChromeClient.java
@@ -295,4 +295,11 @@
     public View getVideoLoadingProgressView() {
         return null;
     }
+
+    /** Obtains a list of all visited history items, used for link coloring
+     * @hide pending API Council approval
+     */
+    public void getVisitedHistory(ValueCallback<String[]> callback) {
+    }
+
 }
diff --git a/core/java/android/webkit/WebTextView.java b/core/java/android/webkit/WebTextView.java
index f479124..e0d41c2 100644
--- a/core/java/android/webkit/WebTextView.java
+++ b/core/java/android/webkit/WebTextView.java
@@ -87,11 +87,12 @@
     // Gets set to true when the the IME jumps to the next textfield.  When this
     // happens, the next time the user hits a key it is okay for the focus
     // pointer to not match the WebTextView's node pointer
-    private boolean         mOkayForFocusNotToMatch;
+    boolean                 mOkayForFocusNotToMatch;
     // Whether or not a selection change was generated from webkit.  If it was,
     // we do not need to pass the selection back to webkit.
     private boolean         mFromWebKit;
     private boolean         mGotTouchDown;
+    private boolean         mInSetTextAndKeepSelection;
     // Array to store the final character added in onTextChanged, so that its
     // KeyEvents may be determined.
     private char[]          mCharacter = new char[1];
@@ -395,7 +396,9 @@
                 Log.v(LOGTAG, "onTextChanged start=" + start
                         + " start + before=" + (start + before));
             }
-            mWebView.setSelection(start, start + before);
+            if (!mInSetTextAndKeepSelection) {
+                mWebView.setSelection(start, start + before);
+            }
         }
         if (!cannotUseKeyEvents) {
             int length = events.length;
@@ -791,7 +794,9 @@
     /* package */ void setTextAndKeepSelection(String text) {
         mPreChange = text.toString();
         Editable edit = (Editable) getText();
+        mInSetTextAndKeepSelection = true;
         edit.replace(0, edit.length(), text);
+        mInSetTextAndKeepSelection = false;
         updateCachedTextfield();
     }
 
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 68a9a92..50358c2 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -4804,9 +4804,11 @@
     /* package */ void passToJavaScript(String currentText, KeyEvent event) {
         if (nativeCursorWantsKeyEvents() && !nativeCursorMatchesFocus()) {
             mWebViewCore.sendMessage(EventHub.CLICK);
-            int select = nativeFocusCandidateIsTextField() ?
-                    nativeFocusCandidateMaxLength() : 0;
-            setSelection(select, select);
+            if (mWebTextView.mOkayForFocusNotToMatch) {
+                int select = nativeFocusCandidateIsTextField() ?
+                        nativeFocusCandidateMaxLength() : 0;
+                setSelection(select, select);
+            }
         }
         WebViewCore.JSKeyData arg = new WebViewCore.JSKeyData();
         arg.mEvent = event;
diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java
index e2aa1d0..86685fb 100644
--- a/core/java/android/webkit/WebViewCore.java
+++ b/core/java/android/webkit/WebViewCore.java
@@ -311,10 +311,13 @@
                 });
     }
 
-    protected String[] populateVisitedLinks() {
-        // FIXME: getVisitedHistory needs permission and host may not have.
-//        return Browser.getVisitedHistory(mContext.getContentResolver());
-        return new String[0];
+    protected void populateVisitedLinks() {
+        ValueCallback callback = new ValueCallback<String[]>() {
+            public void onReceiveValue(String[] value) {
+                sendMessage(EventHub.POPULATE_VISITED_LINKS, (Object)value);
+            }
+        };
+        mCallbackProxy.getVisitedHistory(callback);
     }
 
     /**
@@ -531,6 +534,11 @@
      */
     private native void nativeGeolocationPermissionsProvide(String origin, boolean allow, boolean remember);
 
+    /**
+     * Provide WebCore with the previously visted links from the history database
+     */
+    private native void  nativeProvideVisitedHistory(String[] history);
+
     // EventHub for processing messages
     private final EventHub mEventHub;
     // WebCore thread handler
@@ -811,6 +819,8 @@
         // Geolocation
         static final int GEOLOCATION_PERMISSIONS_PROVIDE = 180;
 
+        static final int POPULATE_VISITED_LINKS = 181;
+
         // private message ids
         private static final int DESTROY =     200;
 
@@ -1234,6 +1244,10 @@
                                 ((Message) msg.obj).sendToTarget();
                             }
                             break;
+
+                        case POPULATE_VISITED_LINKS:
+                            nativeProvideVisitedHistory((String[])msg.obj);
+                            break;
                     }
                 }
             };
diff --git a/core/java/android/widget/FasttrackBadgeWidget.java b/core/java/android/widget/QuickContactBadge.java
similarity index 91%
rename from core/java/android/widget/FasttrackBadgeWidget.java
rename to core/java/android/widget/QuickContactBadge.java
index ba8539f..775245a 100644
--- a/core/java/android/widget/FasttrackBadgeWidget.java
+++ b/core/java/android/widget/QuickContactBadge.java
@@ -36,12 +36,10 @@
 import com.android.internal.R;
 
 /**
- * Widget used to show an image with the standard fasttrack badge
+ * Widget used to show an image with the standard QuickContact badge
  * and on-click behavior.
- *
- * @hide
  */
-public class FasttrackBadgeWidget extends ImageView implements OnClickListener {
+public class QuickContactBadge extends ImageView implements OnClickListener {
 
     private Uri mContactUri;
     private String mContactEmail;
@@ -74,22 +72,22 @@
 
 
 
-    public FasttrackBadgeWidget(Context context) {
+    public QuickContactBadge(Context context) {
         this(context, null);
     }
 
-    public FasttrackBadgeWidget(Context context, AttributeSet attrs) {
+    public QuickContactBadge(Context context, AttributeSet attrs) {
         this(context, attrs, 0);
     }
 
-    public FasttrackBadgeWidget(Context context, AttributeSet attrs, int defStyle) {
+    public QuickContactBadge(Context context, AttributeSet attrs, int defStyle) {
         super(context, attrs, defStyle);
 
         TypedArray a =
             context.obtainStyledAttributes(attrs,
-                    com.android.internal.R.styleable.FasttrackBadgeWidget, defStyle, 0);
+                    com.android.internal.R.styleable.QuickContactBadge, defStyle, 0);
 
-        mMode = a.getInt(com.android.internal.R.styleable.FasttrackBadgeWidget_fasttrackWindowSize,
+        mMode = a.getInt(com.android.internal.R.styleable.QuickContactBadge_quickContactWindowSize,
                 FastTrack.MODE_MEDIUM);
 
         a.recycle();
@@ -105,8 +103,8 @@
     }
 
     /**
-     * Assign the contact uri that this fasttrack badge should be associated
-     * with. Note that this is only used for displaying the fasttrack window and
+     * Assign the contact uri that this QuickContactBadge should be associated
+     * with. Note that this is only used for displaying the QuickContact window and
      * won't bind the contact's photo for you.
      *
      * @param contactUri Either a {@link Contacts#CONTENT_URI} or
@@ -122,7 +120,7 @@
     private void onContactUriChanged() {
         if (mContactUri == null && mContactEmail == null && mContactPhone == null) {
             if (mNoBadgeBackground == null) {
-                mNoBadgeBackground = getResources().getDrawable(R.drawable.fasttrack_nobadge);
+                mNoBadgeBackground = getResources().getDrawable(R.drawable.quickcontact_nobadge);
             }
             setBackgroundDrawable(mNoBadgeBackground);
         } else {
@@ -173,7 +171,7 @@
     }
 
     /**
-     * Set the fasttrack window mode. Options are {@link FastTrack#MODE_SMALL},
+     * Set the QuickContact window mode. Options are {@link FastTrack#MODE_SMALL},
      * {@link FastTrack#MODE_MEDIUM}, {@link FastTrack#MODE_LARGE}.
      * @param size
      */
diff --git a/core/java/android/widget/VideoView.java b/core/java/android/widget/VideoView.java
index 549f984..8142a82 100644
--- a/core/java/android/widget/VideoView.java
+++ b/core/java/android/widget/VideoView.java
@@ -222,11 +222,13 @@
             Log.w(TAG, "Unable to open content: " + mUri, ex);
             mCurrentState = STATE_ERROR;
             mTargetState = STATE_ERROR;
+            mErrorListener.onError(mMediaPlayer, MediaPlayer.MEDIA_ERROR_UNKNOWN, 0);
             return;
         } catch (IllegalArgumentException ex) {
             Log.w(TAG, "Unable to open content: " + mUri, ex);
             mCurrentState = STATE_ERROR;
             mTargetState = STATE_ERROR;
+            mErrorListener.onError(mMediaPlayer, MediaPlayer.MEDIA_ERROR_UNKNOWN, 0);
             return;
         }
     }
diff --git a/core/java/com/android/internal/widget/ContactHeaderWidget.java b/core/java/com/android/internal/widget/ContactHeaderWidget.java
index 0d25728..b98794b 100644
--- a/core/java/com/android/internal/widget/ContactHeaderWidget.java
+++ b/core/java/com/android/internal/widget/ContactHeaderWidget.java
@@ -47,7 +47,7 @@
 import android.view.LayoutInflater;
 import android.view.View;
 import android.widget.CheckBox;
-import android.widget.FasttrackBadgeWidget;
+import android.widget.QuickContactBadge;
 import android.widget.FrameLayout;
 import android.widget.ImageView;
 import android.widget.TextView;
@@ -68,7 +68,7 @@
     private View mAggregateBadge;
     private TextView mPhoneticNameView;
     private CheckBox mStarredView;
-    private FasttrackBadgeWidget mPhotoView;
+    private QuickContactBadge mPhotoView;
     private ImageView mPresenceView;
     private TextView mStatusView;
     private TextView mStatusAttributionView;
@@ -171,7 +171,7 @@
         mStarredView = (CheckBox)findViewById(R.id.star);
         mStarredView.setOnClickListener(this);
 
-        mPhotoView = (FasttrackBadgeWidget) findViewById(R.id.photo);
+        mPhotoView = (QuickContactBadge) findViewById(R.id.photo);
 
         mPresenceView = (ImageView) findViewById(R.id.presence);
 
diff --git a/core/java/com/android/internal/widget/LockPatternView.java b/core/java/com/android/internal/widget/LockPatternView.java
index 0d0a3c2..6adce6d 100644
--- a/core/java/com/android/internal/widget/LockPatternView.java
+++ b/core/java/com/android/internal/widget/LockPatternView.java
@@ -20,6 +20,7 @@
 import com.android.internal.R;
 
 import android.content.Context;
+import android.content.res.Resources;
 import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
 import android.graphics.Canvas;
@@ -34,6 +35,7 @@
 import android.os.SystemClock;
 import android.os.Vibrator;
 import android.util.AttributeSet;
+import android.util.Log;
 import android.view.MotionEvent;
 import android.view.View;
 
@@ -49,7 +51,7 @@
  */
 public class LockPatternView extends View {
     // Vibrator pattern for creating a tactile bump
-    private static final long[] VIBE_PATTERN = {0, 1, 40, 41};
+    private static final long[] DEFAULT_VIBE_PATTERN = {0, 1, 40, 41};
 
     private static final boolean PROFILE_DRAWING = false;
     private boolean mDrawingProfilingStarted = false;
@@ -118,6 +120,8 @@
 
     private Vibrator vibe; // Vibrator for creating tactile feedback
 
+    private long[] mVibePattern;
+
     /**
      * Represents a cell in the 3 X 3 matrix of the unlock pattern view.
      */
@@ -256,6 +260,27 @@
         // we assume all bitmaps have the same size
         mBitmapWidth = mBitmapBtnDefault.getWidth();
         mBitmapHeight = mBitmapBtnDefault.getHeight();
+
+        // allow vibration pattern to be customized
+        mVibePattern = loadVibratePattern(com.android.internal.R.array.config_virtualKeyVibePattern);
+    }
+
+    private long[] loadVibratePattern(int id) {
+        int[] pattern = null;
+        try {
+            pattern = getResources().getIntArray(id);
+        } catch (Resources.NotFoundException e) {
+            Log.e("LockPatternView", "Vibrate pattern missing, using default", e);
+        }
+        if (pattern == null) {
+            return DEFAULT_VIBE_PATTERN;
+        }
+
+        long[] tmpPattern = new long[pattern.length];
+        for (int i = 0; i < pattern.length; i++) {
+            tmpPattern[i] = pattern[i];
+        }
+        return tmpPattern;
     }
 
     private Bitmap getBitmapFor(int resId) {
@@ -443,7 +468,7 @@
             }
             addCellToPattern(cell);
             if (mTactileFeedbackEnabled){
-                vibe.vibrate(VIBE_PATTERN, -1); // Generate tactile feedback
+                vibe.vibrate(mVibePattern, -1); // Generate tactile feedback
             }
             return cell;
         }
diff --git a/core/res/res/drawable-hdpi/fasttrack_badge_pressed.9.png b/core/res/res/drawable-hdpi/quickcontact_badge_pressed.9.png
similarity index 100%
rename from core/res/res/drawable-hdpi/fasttrack_badge_pressed.9.png
rename to core/res/res/drawable-hdpi/quickcontact_badge_pressed.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/fasttrack_badge_small_pressed.9.png b/core/res/res/drawable-hdpi/quickcontact_badge_small_pressed.9.png
similarity index 100%
rename from core/res/res/drawable-hdpi/fasttrack_badge_small_pressed.9.png
rename to core/res/res/drawable-hdpi/quickcontact_badge_small_pressed.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/fasttrack_badge_small_unpressed.9.png b/core/res/res/drawable-hdpi/quickcontact_badge_small_unpressed.9.png
similarity index 100%
rename from core/res/res/drawable-hdpi/fasttrack_badge_small_unpressed.9.png
rename to core/res/res/drawable-hdpi/quickcontact_badge_small_unpressed.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/fasttrack_badge_unpressed.9.png b/core/res/res/drawable-hdpi/quickcontact_badge_unpressed.9.png
similarity index 100%
rename from core/res/res/drawable-hdpi/fasttrack_badge_unpressed.9.png
rename to core/res/res/drawable-hdpi/quickcontact_badge_unpressed.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/fasttrack_badge_pressed.9.png b/core/res/res/drawable-mdpi/quickcontact_badge_pressed.9.png
similarity index 100%
rename from core/res/res/drawable-mdpi/fasttrack_badge_pressed.9.png
rename to core/res/res/drawable-mdpi/quickcontact_badge_pressed.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/fasttrack_badge_small_pressed.9.png b/core/res/res/drawable-mdpi/quickcontact_badge_small_pressed.9.png
similarity index 100%
rename from core/res/res/drawable-mdpi/fasttrack_badge_small_pressed.9.png
rename to core/res/res/drawable-mdpi/quickcontact_badge_small_pressed.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/fasttrack_badge_small_unpressed.9.png b/core/res/res/drawable-mdpi/quickcontact_badge_small_unpressed.9.png
similarity index 100%
rename from core/res/res/drawable-mdpi/fasttrack_badge_small_unpressed.9.png
rename to core/res/res/drawable-mdpi/quickcontact_badge_small_unpressed.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/fasttrack_badge_unpressed.9.png b/core/res/res/drawable-mdpi/quickcontact_badge_unpressed.9.png
similarity index 100%
rename from core/res/res/drawable-mdpi/fasttrack_badge_unpressed.9.png
rename to core/res/res/drawable-mdpi/quickcontact_badge_unpressed.9.png
Binary files differ
diff --git a/core/res/res/drawable/fasttrack_badge.xml b/core/res/res/drawable/quickcontact_badge.xml
similarity index 87%
rename from core/res/res/drawable/fasttrack_badge.xml
rename to core/res/res/drawable/quickcontact_badge.xml
index c6c9a93..bd5aeb6 100644
--- a/core/res/res/drawable/fasttrack_badge.xml
+++ b/core/res/res/drawable/quickcontact_badge.xml
@@ -19,10 +19,10 @@
         android:state_focused="false"
         android:state_selected="false"
         android:state_pressed="false"
-        android:drawable="@drawable/fasttrack_badge_unpressed" />
+        android:drawable="@drawable/quickcontact_badge_unpressed" />
 
     <item
         android:state_pressed="true"
-        android:drawable="@drawable/fasttrack_badge_pressed" />
+        android:drawable="@drawable/quickcontact_badge_pressed" />
 
 </selector>
diff --git a/core/res/res/drawable/fasttrack_badge_small.xml b/core/res/res/drawable/quickcontact_badge_small.xml
similarity index 86%
rename from core/res/res/drawable/fasttrack_badge_small.xml
rename to core/res/res/drawable/quickcontact_badge_small.xml
index c8837e4..a38ba1e 100644
--- a/core/res/res/drawable/fasttrack_badge_small.xml
+++ b/core/res/res/drawable/quickcontact_badge_small.xml
@@ -19,10 +19,10 @@
         android:state_focused="false"
         android:state_selected="false"
         android:state_pressed="false"
-        android:drawable="@drawable/fasttrack_badge_small_unpressed" />
+        android:drawable="@drawable/quickcontact_badge_small_unpressed" />
 
     <item
         android:state_pressed="true"
-        android:drawable="@drawable/fasttrack_badge_small_pressed" />
+        android:drawable="@drawable/quickcontact_badge_small_pressed" />
 
 </selector>
diff --git a/core/res/res/drawable/fasttrack_nobadge.xml b/core/res/res/drawable/quickcontact_nobadge.xml
similarity index 82%
rename from core/res/res/drawable/fasttrack_nobadge.xml
rename to core/res/res/drawable/quickcontact_nobadge.xml
index 538e165..922fa0e 100644
--- a/core/res/res/drawable/fasttrack_nobadge.xml
+++ b/core/res/res/drawable/quickcontact_nobadge.xml
@@ -18,9 +18,9 @@
 */
 -->
 <selector xmlns:android="http://schemas.android.com/apk/res/android">
-    <item android:state_pressed="true" android:drawable="@drawable/fasttrack_nobadge_pressed" />
-    <item android:state_selected="true" android:drawable="@drawable/fasttrack_nobadge_highlight" />
-    <item android:state_focused="true" android:drawable="@drawable/fasttrack_nobadge_highlight" />
-    <item android:state_enabled="false" android:drawable="@drawable/fasttrack_nobadge_normal" />
-    <item android:drawable="@drawable/fasttrack_nobadge_normal" />
+    <item android:state_pressed="true" android:drawable="@drawable/quickcontact_nobadge_pressed" />
+    <item android:state_selected="true" android:drawable="@drawable/quickcontact_nobadge_highlight" />
+    <item android:state_focused="true" android:drawable="@drawable/quickcontact_nobadge_highlight" />
+    <item android:state_enabled="false" android:drawable="@drawable/quickcontact_nobadge_normal" />
+    <item android:drawable="@drawable/quickcontact_nobadge_normal" />
 </selector>
diff --git a/core/res/res/drawable/fasttrack_nobadge_highlight.9.png b/core/res/res/drawable/quickcontact_nobadge_highlight.9.png
similarity index 100%
rename from core/res/res/drawable/fasttrack_nobadge_highlight.9.png
rename to core/res/res/drawable/quickcontact_nobadge_highlight.9.png
Binary files differ
diff --git a/core/res/res/drawable/fasttrack_nobadge_normal.9.png b/core/res/res/drawable/quickcontact_nobadge_normal.9.png
similarity index 100%
rename from core/res/res/drawable/fasttrack_nobadge_normal.9.png
rename to core/res/res/drawable/quickcontact_nobadge_normal.9.png
Binary files differ
diff --git a/core/res/res/drawable/fasttrack_nobadge_pressed.9.png b/core/res/res/drawable/quickcontact_nobadge_pressed.9.png
similarity index 100%
rename from core/res/res/drawable/fasttrack_nobadge_pressed.9.png
rename to core/res/res/drawable/quickcontact_nobadge_pressed.9.png
Binary files differ
diff --git a/core/res/res/layout/contact_header.xml b/core/res/res/layout/contact_header.xml
index 2dbc311..b2bc845 100644
--- a/core/res/res/layout/contact_header.xml
+++ b/core/res/res/layout/contact_header.xml
@@ -22,12 +22,12 @@
     android:background="@drawable/title_bar_medium"
     android:paddingRight="5dip">
 
-    <android.widget.FasttrackBadgeWidget android:id="@+id/photo"
+    <android.widget.QuickContactBadge android:id="@+id/photo"
         android:layout_alignParentLeft="true"
         android:layout_gravity="center_vertical"
         android:layout_marginRight="10dip"
         android:layout_marginLeft="10dip"
-        style="@*android:style/Widget.FasttrackBadgeWidget.WindowSmall" />
+        style="@*android:style/Widget.QuickContactBadge.WindowSmall" />
     />
 
     <LinearLayout
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index f1ef6df..bfb25b8 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -401,20 +401,20 @@
         <attr name="spinnerItemStyle" format="reference" />
         <!-- Default MapView style. -->
         <attr name="mapViewStyle" format="reference" />
-        <!-- Default Fasttrack badge style. -->
-        <attr name="fasttrackBadgeWidgetStyle" format="reference" />
-        <!-- Default Fasttrack badge style with small fasttrack window. -->
-        <attr name="fasttrackBadgeWidgetStyleWindowSmall" format="reference" />
-        <!-- Default Fasttrack badge style with medium fasttrack window. -->
-        <attr name="fasttrackBadgeWidgetStyleWindowMedium" format="reference" />
-        <!-- Default Fasttrack badge style with large fasttrack window. -->
-        <attr name="fasttrackBadgeWidgetStyleWindowLarge" format="reference" />
-        <!-- Default Fasttrack badge style with small fasttrack window. -->
-        <attr name="fasttrackBadgeWidgetStyleSmallWindowSmall" format="reference" />
-        <!-- Default Fasttrack badge style with medium fasttrack window. -->
-        <attr name="fasttrackBadgeWidgetStyleSmallWindowMedium" format="reference" />
-        <!-- Default Fasttrack badge style with large fasttrack window. -->
-        <attr name="fasttrackBadgeWidgetStyleSmallWindowLarge" format="reference" />
+        <!-- Default quickcontact badge style. -->
+        <attr name="quickContactBadgeStyle" format="reference" />
+        <!-- Default quickcontact badge style with small quickcontact window. -->
+        <attr name="quickContactBadgeStyleWindowSmall" format="reference" />
+        <!-- Default quickcontact badge style with medium quickcontact window. -->
+        <attr name="quickContactBadgeStyleWindowMedium" format="reference" />
+        <!-- Default quickcontact badge style with large quickcontact window. -->
+        <attr name="quickContactBadgeStyleWindowLarge" format="reference" />
+        <!-- Default quickcontact badge style with small quickcontact window. -->
+        <attr name="quickContactBadgeStyleSmallWindowSmall" format="reference" />
+        <!-- Default quickcontact badge style with medium quickcontact window. -->
+        <attr name="quickContactBadgeStyleSmallWindowMedium" format="reference" />
+        <!-- Default quickcontact badge style with large quickcontact window. -->
+        <attr name="quickContactBadgeStyleSmallWindowLarge" format="reference" />
 
         <!-- =================== -->
         <!-- Preference styles   -->
@@ -2227,8 +2227,8 @@
         <attr name="orientation" />
     </declare-styleable>
 
-    <declare-styleable name="FasttrackBadgeWidget">
-        <attr name="fasttrackWindowSize">
+    <declare-styleable name="QuickContactBadge">
+        <attr name="quickContactWindowSize">
             <enum name="modeSmall" value="1" />
             <enum name="modeMedium" value="2" />
             <enum name="modeLarge" value="3" />
diff --git a/core/res/res/values/colors.xml b/core/res/res/values/colors.xml
index 15841a8..f570e93 100644
--- a/core/res/res/values/colors.xml
+++ b/core/res/res/values/colors.xml
@@ -4,22 +4,22 @@
 **
 ** Copyright 2006, 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 
+** 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 
+**     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 
+** 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.
 */
 -->
 <resources>
 	<drawable name="screen_background_light">#ffffffff</drawable>
-	<drawable name="screen_background_dark">#ff000000</drawable>
+	<drawable name="screen_background_dark">#ff1a1a1a</drawable>
     <drawable name="status_bar_closed_default_background">#ff000000</drawable>
     <drawable name="status_bar_opened_default_background">#ff000000</drawable>
     <drawable name="search_bar_default_color">#ff000000</drawable>
@@ -36,7 +36,7 @@
     <color name="white">#ffffffff</color>
     <color name="black">#ff000000</color>
     <color name="transparent">#00000000</color>
-    <color name="background_dark">#ff000000</color>
+    <color name="background_dark">#ff1a1a1a</color>
     <color name="bright_foreground_dark">#ffffffff</color>
     <color name="bright_foreground_dark_disabled">#80ffffff</color>
     <color name="bright_foreground_dark_inverse">#ff000000</color>
@@ -65,12 +65,12 @@
     <drawable name="menu_full_frame">@drawable/menu_background_fill_parent_width</drawable>
     <drawable name="editbox_dropdown_dark_frame">@drawable/editbox_dropdown_background_dark</drawable>
     <drawable name="editbox_dropdown_light_frame">@drawable/editbox_dropdown_background</drawable>
-    
+
     <drawable name="input_method_fullscreen_background">#fff9f9f9</drawable>
-    
+
     <!-- For date picker widget -->
     <drawable name="selected_day_background">#ff0092f4</drawable>
-  
+
     <!-- For settings framework -->
     <color name="lighter_gray">#ddd</color>
     <color name="darker_gray">#aaa</color>
@@ -78,7 +78,7 @@
     <!-- For security permissions -->
     <color name="perms_dangerous_grp_color">#dd6826</color>
     <color name="perms_dangerous_perm_color">#dd6826</color>
-    
+
     <!-- For search-related UIs -->
     <color name="search_url_text_normal">#7fa87f</color>
     <color name="search_url_text_selected">@android:color/black</color>
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 0ff537d..7191a46 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -2088,4 +2088,9 @@
 
     <!-- Do Not Translate: Alternate eri.xml -->
     <string name="alternate_eri_file">/data/eri.xml</string>
+
+    <string name="pptp_vpn_description">Point-to-Point Tunneling Protocol</string>
+    <string name="l2tp_vpn_description">Layer 2 Tunneling Protocol</string>
+    <string name="l2tp_ipsec_psk_vpn_description">Pre-shared key based L2TP/IPSec VPN</string>
+    <string name="l2tp_ipsec_crt_vpn_description">Certificate based L2TP/IPSec VPN</string>
 </resources>
diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml
index e071e99..6e38138 100644
--- a/core/res/res/values/styles.xml
+++ b/core/res/res/values/styles.xml
@@ -524,44 +524,44 @@
         <item name="android:shadowRadius">2.75</item>
     </style>
 
-    <style name="Widget.FasttrackBadgeWidget">
+    <style name="Widget.QuickContactBadge">
         <item name="android:layout_width">50dip</item>
         <item name="android:layout_height">56dip</item>
-        <item name="android:background">@android:drawable/fasttrack_badge</item>
+        <item name="android:background">@android:drawable/quickcontact_badge</item>
         <item name="android:clickable">true</item>
         <item name="android:scaleType">fitCenter</item>
     </style>
     
-    <style name="Widget.FasttrackBadgeWidgetSmall">
+    <style name="Widget.QuickContactBadgeSmall">
         <item name="android:layout_width">39dip</item>
         <item name="android:layout_height">42dip</item>
-        <item name="android:background">@android:drawable/fasttrack_badge_small</item>
+        <item name="android:background">@android:drawable/quickcontact_badge_small</item>
         <item name="android:clickable">true</item>
         <item name="android:scaleType">fitCenter</item>
     </style>
 
-    <style name="Widget.FasttrackBadgeWidget.WindowSmall">
-        <item name="android:fasttrackWindowSize">modeSmall</item>
+    <style name="Widget.QuickContactBadge.WindowSmall">
+        <item name="android:quickContactWindowSize">modeSmall</item>
     </style>
 
-    <style name="Widget.FasttrackBadgeWidget.WindowMedium">
-        <item name="android:fasttrackWindowSize">modeMedium</item>
+    <style name="Widget.QuickContactBadge.WindowMedium">
+        <item name="android:quickContactWindowSize">modeMedium</item>
     </style>
 
-    <style name="Widget.FasttrackBadgeWidget.WindowLarge">
-        <item name="android:fasttrackWindowSize">modeLarge</item>
+    <style name="Widget.QuickContactBadge.WindowLarge">
+        <item name="android:quickContactWindowSize">modeLarge</item>
     </style>
     
-    <style name="Widget.FasttrackBadgeWidgetSmall.WindowSmall">
-        <item name="android:fasttrackWindowSize">modeSmall</item>
+    <style name="Widget.QuickContactBadgeSmall.WindowSmall">
+        <item name="android:quickContactWindowSize">modeSmall</item>
     </style>
 
-    <style name="Widget.FasttrackBadgeWidgetSmall.WindowMedium">
-        <item name="android:fasttrackWindowSize">modeMedium</item>
+    <style name="Widget.QuickContactBadgeSmall.WindowMedium">
+        <item name="android:quickContactWindowSize">modeMedium</item>
     </style>
 
-    <style name="Widget.FasttrackBadgeWidgetSmall.WindowLarge">
-        <item name="android:fasttrackWindowSize">modeLarge</item>
+    <style name="Widget.QuickContactBadgeSmall.WindowLarge">
+        <item name="android:quickContactWindowSize">modeLarge</item>
     </style>
 
     <!-- Text Appearances -->
diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml
index 119f174..17ea66a 100644
--- a/core/res/res/values/themes.xml
+++ b/core/res/res/values/themes.xml
@@ -175,12 +175,12 @@
         <item name="spinnerItemStyle">@android:style/Widget.TextView.SpinnerItem</item>
         <item name="dropDownHintAppearance">@android:style/TextAppearance.Widget.DropDownHint</item>
         <item name="keyboardViewStyle">@android:style/Widget.KeyboardView</item>
-        <item name="fasttrackBadgeWidgetStyleWindowSmall">@android:style/Widget.FasttrackBadgeWidget.WindowSmall</item>
-        <item name="fasttrackBadgeWidgetStyleWindowMedium">@android:style/Widget.FasttrackBadgeWidget.WindowMedium</item>
-        <item name="fasttrackBadgeWidgetStyleWindowLarge">@android:style/Widget.FasttrackBadgeWidget.WindowLarge</item>
-        <item name="fasttrackBadgeWidgetStyleSmallWindowSmall">@android:style/Widget.FasttrackBadgeWidgetSmall.WindowSmall</item>
-        <item name="fasttrackBadgeWidgetStyleSmallWindowMedium">@android:style/Widget.FasttrackBadgeWidgetSmall.WindowMedium</item>
-        <item name="fasttrackBadgeWidgetStyleSmallWindowLarge">@android:style/Widget.FasttrackBadgeWidgetSmall.WindowLarge</item>
+        <item name="quickContactBadgeStyleWindowSmall">@android:style/Widget.QuickContactBadge.WindowSmall</item>
+        <item name="quickContactBadgeStyleWindowMedium">@android:style/Widget.QuickContactBadge.WindowMedium</item>
+        <item name="quickContactBadgeStyleWindowLarge">@android:style/Widget.QuickContactBadge.WindowLarge</item>
+        <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>
         
         <!-- Preference styles -->
         <item name="preferenceScreenStyle">@android:style/Preference.PreferenceScreen</item>
diff --git a/graphics/java/android/graphics/drawable/GradientDrawable.java b/graphics/java/android/graphics/drawable/GradientDrawable.java
index ddbbaf1..91a2bc1 100644
--- a/graphics/java/android/graphics/drawable/GradientDrawable.java
+++ b/graphics/java/android/graphics/drawable/GradientDrawable.java
@@ -319,7 +319,16 @@
                     }
                 }
                 else {
+                    // since the caller is only giving us 1 value, we will force
+                    // it to be square if the rect is too small in one dimension
+                    // to show it. If we did nothing, Skia would clamp the rad
+                    // independently along each axis, giving us a thin ellips
+                    // if the rect were very wide but not very tall
                     float rad = st.mRadius;
+                    float r = Math.min(mRect.width(), mRect.height()) * 0.5f;
+                    if (rad > r) {
+                        rad = r;
+                    }
                     canvas.drawRoundRect(mRect, rad, rad, mFillPaint);
                     if (haveStroke) {
                         canvas.drawRoundRect(mRect, rad, rad, mStrokePaint);
diff --git a/libs/audioflinger/AudioFlinger.cpp b/libs/audioflinger/AudioFlinger.cpp
index 6500791..2ed5d3b 100644
--- a/libs/audioflinger/AudioFlinger.cpp
+++ b/libs/audioflinger/AudioFlinger.cpp
@@ -74,6 +74,8 @@
 static const int kDumpLockRetries = 50;
 static const int kDumpLockSleep = 20000;
 
+static const nsecs_t kWarningThrottle = seconds(5);
+
 
 #define AUDIOFLINGER_SECURITY_ENABLED 1
 
@@ -1170,7 +1172,10 @@
     size_t enabledTracks = 0;
     nsecs_t standbyTime = systemTime();
     size_t mixBufferSize = mFrameCount * mFrameSize;
-    nsecs_t maxPeriod = seconds(mFrameCount) / mSampleRate * 2;
+    // FIXME: Relaxed timing because of a certain device that can't meet latency
+    // Should be reduced to 2x after the vendor fixes the driver issue
+    nsecs_t maxPeriod = seconds(mFrameCount) / mSampleRate * 3;
+    nsecs_t lastWarning = 0;
 
     while (!exitPending())
     {
@@ -1183,7 +1188,9 @@
 
             if (checkForNewParameters_l()) {
                 mixBufferSize = mFrameCount * mFrameSize;
-                maxPeriod = seconds(mFrameCount) / mSampleRate * 2;
+                // FIXME: Relaxed timing because of a certain device that can't meet latency
+                // Should be reduced to 2x after the vendor fixes the driver issue
+                maxPeriod = seconds(mFrameCount) / mSampleRate * 3;
             }
 
             const SortedVector< wp<Track> >& activeTracks = mActiveTracks;
@@ -1260,10 +1267,15 @@
             mNumWrites++;
             mInWrite = false;
             mStandby = false;
-            nsecs_t delta = systemTime() - mLastWriteTime;
+            nsecs_t now = systemTime();
+            nsecs_t delta = now - mLastWriteTime;
             if (delta > maxPeriod) {
-                LOGW("write blocked for %llu msecs, thread %p", ns2ms(delta), this);
                 mNumDelayedWrites++;
+                if ((now - lastWarning) > kWarningThrottle) {
+                    LOGW("write blocked for %llu msecs, %d delayed writes, thread %p",
+                            ns2ms(delta), mNumDelayedWrites, this);
+                    lastWarning = now;
+                }
             }
         } else {
             usleep(sleepTime);
diff --git a/media/libmediaplayerservice/MediaPlayerService.cpp b/media/libmediaplayerservice/MediaPlayerService.cpp
index 8b1c9dc..a11477a 100644
--- a/media/libmediaplayerservice/MediaPlayerService.cpp
+++ b/media/libmediaplayerservice/MediaPlayerService.cpp
@@ -201,7 +201,7 @@
 };
 
 // TODO: Find real cause of Audio/Video delay in PV framework and remove this workaround
-/* static */ const uint32_t MediaPlayerService::AudioOutput::kAudioVideoDelayMs = 96;
+/* static */ const uint32_t MediaPlayerService::AudioOutput::kAudioVideoDelayMs = 0;
 /* static */ int MediaPlayerService::AudioOutput::mMinBufferCount = 4;
 /* static */ bool MediaPlayerService::AudioOutput::mIsOnEmulator = false;
 
diff --git a/opengl/tests/gl_jni/jni/gl_code.cpp b/opengl/tests/gl_jni/jni/gl_code.cpp
index b85a433..33b25ab 100644
--- a/opengl/tests/gl_jni/jni/gl_code.cpp
+++ b/opengl/tests/gl_jni/jni/gl_code.cpp
@@ -2,16 +2,19 @@
 
 #include <nativehelper/jni.h>
 #define LOG_TAG "GLJNI gl_code.cpp"
-#include <utils/Log.h>

+#include <utils/Log.h>
+
 #include <GLES/gl.h>
 
-#include <stdio.h>

+#include <stdio.h>
+
 #include <stdlib.h>
 #include <math.h>
-

-GLuint texture;

-

-#define FIXED_ONE 0x10000

+
+GLuint texture;
+GLfloat background;
+
+#define FIXED_ONE 0x10000
 
 static void printGLString(const char *name, GLenum s) {
     const char *v = (const char *) glGetString(s);
@@ -77,38 +80,38 @@
     glTranslatef(-eyeX, -eyeY, -eyeZ);
 }
 
-void init_scene(int width, int height)

+void init_scene(int width, int height)
 {
     printGLString("Version", GL_VERSION);
     printGLString("Vendor", GL_VENDOR);
     printGLString("Renderer", GL_RENDERER);
-    printGLString("Extensions", GL_EXTENSIONS);

+    printGLString("Extensions", GL_EXTENSIONS);
+
     glDisable(GL_DITHER);
     glEnable(GL_CULL_FACE);
 
-
     float ratio = width / height;
     glViewport(0, 0, width, height);
 
     glMatrixMode(GL_PROJECTION);
     glLoadIdentity();
-    glFrustumf(-ratio, ratio, -1, 1, 1, 10);

+    glFrustumf(-ratio, ratio, -1, 1, 1, 10);
 
+    glMatrixMode(GL_MODELVIEW);
 
-    glMatrixMode(GL_MODELVIEW);

     glLoadIdentity();
     gluLookAt(
             0, 0, 3,  // eye
             0, 0, 0,  // center
             0, 1, 0); // up
-

-    glEnable(GL_TEXTURE_2D);

-    glEnableClientState(GL_VERTEX_ARRAY);

+
+    glEnable(GL_TEXTURE_2D);
+    glEnableClientState(GL_VERTEX_ARRAY);
     glEnableClientState(GL_TEXTURE_COORD_ARRAY);
-}

-

-void create_texture()

-{

+}
+
+void create_texture()
+{
     const unsigned int on = 0xff0000ff;
     const unsigned int off = 0xffffffff;
     const unsigned int pixels[] =
@@ -121,57 +124,60 @@
             off, on, off, on, off, on, off, on,
             on, off, on, off, on, off, on, off,
             off, on, off, on, off, on, off, on,
-    };

-    glGenTextures(1, &texture);

-    glBindTexture(GL_TEXTURE_2D, texture);

-    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 8, 8, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);

-    glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);

-    glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);

-    glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);

+    };
+
+    glGenTextures(1, &texture);
+    glBindTexture(GL_TEXTURE_2D, texture);
+    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 8, 8, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
+    glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+    glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+    glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
 }
 
 extern "C" {
     JNIEXPORT void JNICALL Java_com_android_gljni_GLJNILib_init(JNIEnv * env, jobject obj,  jint width, jint height);
     JNIEXPORT void JNICALL Java_com_android_gljni_GLJNILib_step(JNIEnv * env, jobject obj);
+    JNIEXPORT void JNICALL Java_com_android_gljni_GLJNILib_changeBackground(JNIEnv * env, jobject obj);
 };
-

-

-JNIEXPORT void JNICALL Java_com_android_gljni_GLJNILib_init(JNIEnv * env, jobject obj,  jint width, jint height)

-{

-    init_scene(width, height);

-    create_texture();

-}

 
-JNIEXPORT void JNICALL Java_com_android_gljni_GLJNILib_step(JNIEnv * env, jobject obj)

-{

-    const GLfloat vertices[] = {

-            -1,  -1,  0,

-             1,  -1,  0,

-             1,   1,  0,

-            -1,   1,  0

-    };

-

-    const GLfixed texCoords[] = {

-            0,            0,

-            FIXED_ONE,    0,

-            FIXED_ONE,    FIXED_ONE,

-            0,            FIXED_ONE

-    };

-

+JNIEXPORT void JNICALL Java_com_android_gljni_GLJNILib_init(JNIEnv * env, jobject obj,  jint width, jint height)
+{
+    init_scene(width, height);
+    create_texture();
+}
+
+JNIEXPORT void JNICALL Java_com_android_gljni_GLJNILib_step(JNIEnv * env, jobject obj)
+{
+    const GLfloat vertices[] = {
+            -1,  -1,  0,
+             1,  -1,  0,
+             1,   1,  0,
+            -1,   1,  0
+    };
+
+    const GLfixed texCoords[] = {
+            0,            0,
+            FIXED_ONE,    0,
+            FIXED_ONE,    FIXED_ONE,
+            0,            FIXED_ONE
+    };
+
     const GLushort quadIndices[] = { 0, 1, 2,  0, 2, 3 };
-
-    glVertexPointer(3, GL_FLOAT, 0, vertices);

+    glVertexPointer(3, GL_FLOAT, 0, vertices);
     glTexCoordPointer(2, GL_FIXED, 0, texCoords);
 
-
     int nelem = sizeof(quadIndices)/sizeof(quadIndices[0]);
     static float grey;
     grey += 0.01f;
     if (grey > 1.0f) {
         grey = 0.0f;
     }
-    glClearColor(grey, grey, grey, 1.0f);
+    glClearColor(background, grey, grey, 1.0f);
     glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
-    glDrawElements(GL_TRIANGLES, nelem, GL_UNSIGNED_SHORT, quadIndices);

-}

+    glDrawElements(GL_TRIANGLES, nelem, GL_UNSIGNED_SHORT, quadIndices);
+}
 
+JNIEXPORT void JNICALL Java_com_android_gljni_GLJNILib_changeBackground(JNIEnv * env, jobject obj)
+{
+    background = 1.0f - background;
+}
\ No newline at end of file
diff --git a/opengl/tests/gl_jni/src/com/android/gljni/GLJNIActivity.java b/opengl/tests/gl_jni/src/com/android/gljni/GLJNIActivity.java
index df1f957..c6f5313 100644
--- a/opengl/tests/gl_jni/src/com/android/gljni/GLJNIActivity.java
+++ b/opengl/tests/gl_jni/src/com/android/gljni/GLJNIActivity.java
@@ -18,28 +18,27 @@
 
 import android.app.Activity;
 import android.os.Bundle;
-import android.util.Log;
-import android.view.WindowManager;
-
-import java.io.File;
-
 
 public class GLJNIActivity extends Activity {
 
     GLJNIView mView;
 
-    @Override protected void onCreate(Bundle icicle) {
+    @Override
+    protected void onCreate(Bundle icicle) {
         super.onCreate(icicle);
         mView = new GLJNIView(getApplication());
-	setContentView(mView);
+	    mView.setFocusableInTouchMode(true);
+	    setContentView(mView);
     }
 
-    @Override protected void onPause() {
+    @Override
+    protected void onPause() {
         super.onPause();
         mView.onPause();
     }
 
-    @Override protected void onResume() {
+    @Override
+    protected void onResume() {
         super.onResume();
         mView.onResume();
     }
diff --git a/opengl/tests/gl_jni/src/com/android/gljni/GLJNILib.java b/opengl/tests/gl_jni/src/com/android/gljni/GLJNILib.java
index 8662725..f56d2af 100644
--- a/opengl/tests/gl_jni/src/com/android/gljni/GLJNILib.java
+++ b/opengl/tests/gl_jni/src/com/android/gljni/GLJNILib.java
@@ -30,4 +30,5 @@
      */
      public static native void init(int width, int height);
      public static native void step();
+     public static native void changeBackground();
 }
diff --git a/opengl/tests/gl_jni/src/com/android/gljni/GLJNIView.java b/opengl/tests/gl_jni/src/com/android/gljni/GLJNIView.java
index 9ea1059..9a2c8c4 100644
--- a/opengl/tests/gl_jni/src/com/android/gljni/GLJNIView.java
+++ b/opengl/tests/gl_jni/src/com/android/gljni/GLJNIView.java
@@ -80,5 +80,11 @@
             // Do nothing.
         }
     }
+    
+    @Override
+    public boolean onKeyDown(int keyCode, KeyEvent event) {
+        GLJNILib.changeBackground();
+        return true;
+    }
 }
 
diff --git a/packages/SubscribedFeedsProvider/src/com/android/providers/subscribedfeeds/SubscribedFeedsIntentService.java b/packages/SubscribedFeedsProvider/src/com/android/providers/subscribedfeeds/SubscribedFeedsIntentService.java
index b854f86..2e910b7 100644
--- a/packages/SubscribedFeedsProvider/src/com/android/providers/subscribedfeeds/SubscribedFeedsIntentService.java
+++ b/packages/SubscribedFeedsProvider/src/com/android/providers/subscribedfeeds/SubscribedFeedsIntentService.java
@@ -111,7 +111,7 @@
                 + "and " + SubscribedFeeds.Feeds.FEED + "= ?";
         try {
             // TODO(fredq) fix the hardcoded type
-            final Account account = new Account(accountName, "com.google.GAIA");
+            final Account account = new Account(accountName, "com.google");
             c = context.getContentResolver().query(SubscribedFeeds.Feeds.CONTENT_URI,
                     null, where, new String[]{account.name, account.type, feed}, null);
             if (c.getCount() == 0) {
diff --git a/packages/SubscribedFeedsProvider/src/com/android/providers/subscribedfeeds/SubscribedFeedsProvider.java b/packages/SubscribedFeedsProvider/src/com/android/providers/subscribedfeeds/SubscribedFeedsProvider.java
index 2647752..8585082 100644
--- a/packages/SubscribedFeedsProvider/src/com/android/providers/subscribedfeeds/SubscribedFeedsProvider.java
+++ b/packages/SubscribedFeedsProvider/src/com/android/providers/subscribedfeeds/SubscribedFeedsProvider.java
@@ -127,7 +127,7 @@
     protected void onAccountsChanged(Account[] accountsArray) {
         super.onAccountsChanged(accountsArray);
         for (Account account : accountsArray) {
-            if (account.type.equals("com.google.GAIA")) {
+            if (account.type.equals("com.google")) {
                 ContentResolver.setSyncAutomatically(account, "subscribedfeeds", true);
             }
         }
diff --git a/preloaded-classes b/preloaded-classes
index c9cf70c..c4b1c66 100644
--- a/preloaded-classes
+++ b/preloaded-classes
@@ -910,7 +910,6 @@
 android.widget.ExpandableListView$SavedState
 android.widget.FastScroller
 android.widget.FastScroller$ScrollFade
-android.widget.FasttrackBadgeWidget
 android.widget.Filter
 android.widget.FrameLayout
 android.widget.FrameLayout$LayoutParams
@@ -934,6 +933,7 @@
 android.widget.PopupWindow$PopupViewContainer
 android.widget.ProgressBar
 android.widget.ProgressBar$SavedState
+android.widget.QuickContactBadge
 android.widget.RadioButton
 android.widget.RadioGroup
 android.widget.RadioGroup$CheckedStateTracker
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index 65b3e3f..e5c6010 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -119,6 +119,7 @@
 
             mContentResolver = context.getContentResolver();
 
+            // The AccountManager must come before the ContentService
             try {
                 Log.i(TAG, "Account Manager");
                 ServiceManager.addService(Context.ACCOUNT_SERVICE,
diff --git a/services/java/com/android/server/WifiService.java b/services/java/com/android/server/WifiService.java
index cc1b697..a3589c7 100644
--- a/services/java/com/android/server/WifiService.java
+++ b/services/java/com/android/server/WifiService.java
@@ -1324,9 +1324,16 @@
                 if (!shouldWifiStayAwake(stayAwakeConditions, mPluggedType)) {
                     WifiInfo info = mWifiStateTracker.requestConnectionInfo();
                     if (info.getSupplicantState() != SupplicantState.COMPLETED) {
-                        // do not keep Wifi awake when screen is off if Wifi is not associated
-                        mDeviceIdle = true;
-                        updateWifiState();
+                        // we used to go to sleep immediately, but this caused some race conditions
+                        // we don't have time to track down for this release.  Delay instead, but not
+                        // as long as we would if connected (below)
+                        // TODO - fix the race conditions and switch back to the immediate turn-off
+                        long triggerTime = System.currentTimeMillis() + (2*60*1000); // 2 min
+                        Log.d(TAG, "setting ACTION_DEVICE_IDLE timer for 120,000 ms");
+                        mAlarmManager.set(AlarmManager.RTC_WAKEUP, triggerTime, mIdleIntent);
+                        //  // do not keep Wifi awake when screen is off if Wifi is not associated
+                        //  mDeviceIdle = true;
+                        //  updateWifiState();
                     } else {
                         long triggerTime = System.currentTimeMillis() + idleMillis;
                         Log.d(TAG, "setting ACTION_DEVICE_IDLE timer for " + idleMillis + "ms");
diff --git a/test-runner/android/test/SyncBaseInstrumentation.java b/test-runner/android/test/SyncBaseInstrumentation.java
index a860bb3..e8d72d9 100644
--- a/test-runner/android/test/SyncBaseInstrumentation.java
+++ b/test-runner/android/test/SyncBaseInstrumentation.java
@@ -47,7 +47,7 @@
     protected void syncProvider(Uri uri, String accountName, String authority) throws Exception {
         Bundle extras = new Bundle();
         extras.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
-        Account account = new Account(accountName, "com.google.GAIA");
+        Account account = new Account(accountName, "com.google");
 
         ContentResolver.requestSync(account, authority, extras);
         long startTimeInMillis = SystemClock.elapsedRealtime();
diff --git a/tests/AndroidTests/src/com/android/unit_tests/VpnTest.java b/tests/AndroidTests/src/com/android/unit_tests/VpnTest.java
index 67fcd61..cb64293 100755
--- a/tests/AndroidTests/src/com/android/unit_tests/VpnTest.java
+++ b/tests/AndroidTests/src/com/android/unit_tests/VpnTest.java
@@ -130,7 +130,6 @@
 
     private void testVpnType(VpnType type) {
         assertFalse(TextUtils.isEmpty(type.getDisplayName()));
-        assertNotNull(type.getDescription());
         assertNotNull(type.getProfileClass());
     }
 
diff --git a/vpn/java/android/net/vpn/VpnType.java b/vpn/java/android/net/vpn/VpnType.java
index c7df943..356f8b1 100644
--- a/vpn/java/android/net/vpn/VpnType.java
+++ b/vpn/java/android/net/vpn/VpnType.java
@@ -16,26 +16,28 @@
 
 package android.net.vpn;
 
+import com.android.internal.R;
+
 /**
  * Enumeration of all supported VPN types.
  * {@hide}
  */
 public enum VpnType {
-    PPTP("PPTP", "", PptpProfile.class),
-    L2TP("L2TP", "", L2tpProfile.class),
-    L2TP_IPSEC_PSK("L2TP/IPSec PSK", "Pre-shared key based L2TP/IPSec VPN",
+    PPTP("PPTP", R.string.pptp_vpn_description, PptpProfile.class),
+    L2TP("L2TP", R.string.l2tp_vpn_description, L2tpProfile.class),
+    L2TP_IPSEC_PSK("L2TP/IPSec PSK", R.string.l2tp_ipsec_psk_vpn_description,
             L2tpIpsecPskProfile.class),
-    L2TP_IPSEC("L2TP/IPSec CRT", "Certificate based L2TP/IPSec VPN",
+    L2TP_IPSEC("L2TP/IPSec CRT", R.string.l2tp_ipsec_crt_vpn_description,
             L2tpIpsecProfile.class);
 
     private String mDisplayName;
-    private String mDescription;
+    private int mDescriptionId;
     private Class<? extends VpnProfile> mClass;
 
-    VpnType(String displayName, String description,
+    VpnType(String displayName, int descriptionId,
             Class<? extends VpnProfile> klass) {
         mDisplayName = displayName;
-        mDescription = description;
+        mDescriptionId = descriptionId;
         mClass = klass;
     }
 
@@ -43,8 +45,8 @@
         return mDisplayName;
     }
 
-    public String getDescription() {
-        return mDescription;
+    public int getDescriptionId() {
+        return mDescriptionId;
     }
 
     public Class<? extends VpnProfile> getProfileClass() {