Merge "Calculate bitmask array sizes correctly in the EventHub"
diff --git a/api/current.xml b/api/current.xml
index 442fc4f..3e8b9ac3 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -71481,6 +71481,19 @@
  visibility="public"
 >
 </method>
+<method name="reconnect"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="false"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<exception name="IOException" type="java.io.IOException">
+</exception>
+</method>
 <method name="release"
  return="void"
  abstract="false"
@@ -74110,7 +74123,7 @@
  type="float"
  transient="false"
  volatile="false"
- value="0.001f"
+ value="0.0010f"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -82150,6 +82163,210 @@
 </parameter>
 </method>
 </interface>
+<class name="CamcorderProfile"
+ extends="java.lang.Object"
+ abstract="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<method name="get"
+ return="android.media.CamcorderProfile"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="quality" type="android.media.CamcorderProfile.Quality">
+</parameter>
+</method>
+<method name="getMmsRecordingDurationInSeconds"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<field name="mAudioBitRate"
+ type="int"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="mAudioChannels"
+ type="int"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="mAudioCodec"
+ type="int"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="mAudioSampleRate"
+ type="int"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="mFileFormat"
+ type="int"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="mQuality"
+ type="android.media.CamcorderProfile.Quality"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="mVideoBitRate"
+ type="int"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="mVideoCodec"
+ type="int"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="mVideoFrameHeight"
+ type="int"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="mVideoFrameRate"
+ type="int"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="mVideoFrameWidth"
+ type="int"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+</class>
+<class name="CamcorderProfile.Quality"
+ extends="java.lang.Enum"
+ abstract="false"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<method name="valueOf"
+ return="android.media.CamcorderProfile.Quality"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="name" type="java.lang.String">
+</parameter>
+</method>
+<method name="values"
+ return="android.media.CamcorderProfile.Quality[]"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+</class>
+<class name="CameraProfile"
+ extends="java.lang.Object"
+ abstract="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<constructor name="CameraProfile"
+ type="android.media.CameraProfile"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</constructor>
+<method name="getImageEncodingQualityLevels"
+ return="int[]"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+</class>
 <class name="ExifInterface"
  extends="java.lang.Object"
  abstract="false"
@@ -213929,7 +214146,7 @@
  deprecated="not deprecated"
  visibility="public"
 >
-<parameter name="t" type="T">
+<parameter name="arg0" type="T">
 </parameter>
 </method>
 </interface>
diff --git a/core/java/android/accounts/AccountManager.java b/core/java/android/accounts/AccountManager.java
index e2263fc..1bb1d0f 100644
--- a/core/java/android/accounts/AccountManager.java
+++ b/core/java/android/accounts/AccountManager.java
@@ -704,6 +704,15 @@
             throws OperationCanceledException, IOException, AuthenticatorException {
         Bundle bundle = getAuthToken(account, authTokenType, notifyAuthFailure, null /* callback */,
                 null /* handler */).getResult();
+        if (bundle == null) {
+            // This should never happen, but it does, occasionally. If it does return null to
+            // signify that we were not able to get the authtoken.
+            // TODO: remove this when the bug is found that sometimes causes a null bundle to be
+            // returned
+            Log.e(TAG, "blockingGetAuthToken: null was returned from getResult() for "
+                    + account + ", authTokenType " + authTokenType);
+            return null;
+        }
         return bundle.getString(KEY_AUTHTOKEN);
     }
 
@@ -1166,6 +1175,16 @@
             return this;
         }
 
+        protected void set(Bundle bundle) {
+            // TODO: somehow a null is being set as the result of the Future. Log this
+            // case to help debug where this is occurring. When this bug is fixed this
+            // condition statement should be removed.
+            if (bundle == null) {
+                Log.e(TAG, "the bundle must not be null", new Exception());
+            }
+            super.set(bundle);
+        }
+
         public abstract void doWork() throws RemoteException;
 
         private Bundle internalGetResult(Long timeout, TimeUnit unit)
diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java
index 0efcad9..85d52ec 100644
--- a/core/java/android/hardware/Camera.java
+++ b/core/java/android/hardware/Camera.java
@@ -137,8 +137,6 @@
      * can be connected to another process.
      *
      * @throws IOException if the method fails.
-     *
-     * @hide
      */
     public native final void reconnect() throws IOException;
 
diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java
index 0b90f91..46c82e4 100644
--- a/core/java/android/provider/ContactsContract.java
+++ b/core/java/android/provider/ContactsContract.java
@@ -2935,6 +2935,13 @@
          */
         public static final Uri CONTENT_FILTER_URI = Uri.withAppendedPath(AUTHORITY_URI,
                 "phone_lookup");
+
+        /**
+         * The MIME type of {@link #CONTENT_FILTER_URI} providing a directory of phone lookup rows.
+         *
+         * @hide
+         */
+        public static final String CONTENT_TYPE = "vnd.android.cursor.dir/phone_lookup";
     }
 
     /**
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 8f410a9..7df509f 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -3085,13 +3085,6 @@
         public static final String MOUNT_UMS_NOTIFY_ENABLED = "mount_ums_notify_enabled";
 
         /**
-         * Whether or not a notification is displayed when a Tetherable interface is detected.
-         * (0 = false, 1 = true)
-         * @hide
-         */
-        public static final String TETHER_NOTIFY = "tether_notify";
-
-        /**
          * If nonzero, ANRs in invisible background processes bring up a dialog.
          * Otherwise, the process will be silently killed.
          * @hide
diff --git a/core/java/android/service/wallpaper/WallpaperService.java b/core/java/android/service/wallpaper/WallpaperService.java
index 52de64c..444135a 100644
--- a/core/java/android/service/wallpaper/WallpaperService.java
+++ b/core/java/android/service/wallpaper/WallpaperService.java
@@ -821,6 +821,7 @@
                 case MSG_WINDOW_RESIZED: {
                     final boolean reportDraw = message.arg1 != 0;
                     mEngine.updateSurface(true, false);
+                    mEngine.doOffsetsChanged();
                     if (reportDraw) {
                         try {
                             mEngine.mSession.finishDrawing(mEngine.mWindow);
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 4db5871..6a95831 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -1254,20 +1254,19 @@
             final FileOutputStream out = new FileOutputStream(dest);
             p.writeToStream(out);
             out.close();
-        } catch (FileNotFoundException e){
-            e.printStackTrace();
-        } catch (IOException e) {
-            e.printStackTrace();
-        } catch (RuntimeException e) {
-            e.printStackTrace();
-        }
-        if (dest.length() > 0) {
+            // now update the bundle
             b.putInt("scrollX", mScrollX);
             b.putInt("scrollY", mScrollY);
             b.putFloat("scale", mActualScale);
             b.putFloat("textwrapScale", mTextWrapScale);
             b.putBoolean("overview", mInZoomOverview);
             return true;
+        } catch (FileNotFoundException e){
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        } catch (RuntimeException e) {
+            e.printStackTrace();
         }
         return false;
     }
@@ -5928,40 +5927,43 @@
                     WebViewCore.RestoreState restoreState = draw.mRestoreState;
                     boolean hasRestoreState = restoreState != null;
                     if (hasRestoreState) {
-                        mInZoomOverview = false;
                         updateZoomRange(restoreState, viewSize.x,
                                 draw.mMinPrefWidth, true);
-                        if (mInitialScaleInPercent > 0) {
-                            setNewZoomScale(mInitialScaleInPercent / 100.0f,
+                        if (!mDrawHistory) {
+                            mInZoomOverview = false;
+
+                            if (mInitialScaleInPercent > 0) {
+                                setNewZoomScale(mInitialScaleInPercent / 100.0f,
                                     mInitialScaleInPercent != mTextWrapScale * 100,
                                     false);
-                        } else if (restoreState.mViewScale > 0) {
-                            mTextWrapScale = restoreState.mTextWrapScale;
-                            setNewZoomScale(restoreState.mViewScale, false,
+                            } else if (restoreState.mViewScale > 0) {
+                                mTextWrapScale = restoreState.mTextWrapScale;
+                                setNewZoomScale(restoreState.mViewScale, false,
                                     false);
-                        } else {
-                            mInZoomOverview = useWideViewport
-                                    && settings.getLoadWithOverviewMode();
-                            float scale;
-                            if (mInZoomOverview) {
-                                scale = (float) viewWidth
-                                        / DEFAULT_VIEWPORT_WIDTH;
                             } else {
-                                scale = restoreState.mTextWrapScale;
-                            }
-                            setNewZoomScale(scale, Math.abs(scale
+                                mInZoomOverview = useWideViewport
+                                    && settings.getLoadWithOverviewMode();
+                                float scale;
+                                if (mInZoomOverview) {
+                                    scale = (float) viewWidth
+                                        / DEFAULT_VIEWPORT_WIDTH;
+                                } else {
+                                    scale = restoreState.mTextWrapScale;
+                                }
+                                setNewZoomScale(scale, Math.abs(scale
                                     - mTextWrapScale) >= 0.01f, false);
-                        }
-                        setContentScrollTo(restoreState.mScrollX,
+                            }
+                            setContentScrollTo(restoreState.mScrollX,
                                 restoreState.mScrollY);
-                        // As we are on a new page, remove the WebTextView. This
-                        // is necessary for page loads driven by webkit, and in
-                        // particular when the user was on a password field, so
-                        // the WebTextView was visible.
-                        clearTextEntry(false);
-                        // update the zoom buttons as the scale can be changed
-                        if (getSettings().getBuiltInZoomControls()) {
-                            updateZoomButtonsEnabled();
+                            // As we are on a new page, remove the WebTextView. This
+                            // is necessary for page loads driven by webkit, and in
+                            // particular when the user was on a password field, so
+                            // the WebTextView was visible.
+                            clearTextEntry(false);
+                            // update the zoom buttons as the scale can be changed
+                            if (getSettings().getBuiltInZoomControls()) {
+                                updateZoomButtonsEnabled();
+                            }
                         }
                     }
                     // We update the layout (i.e. request a layout from the
diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java
index 71f69fe..b339015 100644
--- a/core/java/android/webkit/WebViewCore.java
+++ b/core/java/android/webkit/WebViewCore.java
@@ -2191,7 +2191,14 @@
                              );
                 }
                 data.mWidth = Math.round(webViewWidth / data.mScale);
-                data.mHeight = mCurrentViewHeight * data.mWidth / viewportWidth;
+                // We may get a call here when mCurrentViewHeight == 0 if webcore completes the
+                // first layout before we sync our webview dimensions to it. In that case, we
+                // request the real height of the webview. This is not a perfect solution as we
+                // are calling a WebView method from the WebCore thread. But this is preferable
+                // to syncing an incorrect height.
+                data.mHeight = mCurrentViewHeight == 0 ?
+                        Math.round(mWebView.getViewHeight() / data.mScale)
+                        : mCurrentViewHeight * data.mWidth / viewportWidth;
                 data.mTextWrapWidth = Math.round(webViewWidth
                         / mRestoreState.mTextWrapScale);
                 data.mIgnoreHeight = false;
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index b78373d4..06880a1 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -2067,10 +2067,10 @@
                     // Remember where the motion event started
                     v = getChildAt(motionPosition - mFirstPosition);
                     mMotionViewOriginalTop = v.getTop();
-                    mMotionX = x;
-                    mMotionY = y;
-                    mMotionPosition = motionPosition;
                 }
+                mMotionX = x;
+                mMotionY = y;
+                mMotionPosition = motionPosition;
                 mLastY = Integer.MIN_VALUE;
                 break;
             }
diff --git a/core/java/android/widget/VideoView.java b/core/java/android/widget/VideoView.java
index c2517a8..fb8b5aa 100644
--- a/core/java/android/widget/VideoView.java
+++ b/core/java/android/widget/VideoView.java
@@ -484,6 +484,9 @@
             // after we return from this we can't use the surface any more
             mSurfaceHolder = null;
             if (mMediaController != null) mMediaController.hide();
+            if (mCurrentState != STATE_SUSPEND) {
+                release(true);
+            }
         }
     };
 
diff --git a/core/java/com/android/internal/app/TetherActivity.java b/core/java/com/android/internal/app/TetherActivity.java
deleted file mode 100644
index 7f83b2b..0000000
--- a/core/java/com/android/internal/app/TetherActivity.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * Copyright (C) 2007 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.internal.app;
-
-import android.app.AlertDialog;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.net.ConnectivityManager;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.os.RemoteException;
-import android.os.ServiceManager;
-import android.widget.Toast;
-import android.util.Log;
-
-/**
- * This activity is shown to the user in two cases: when a connection is possible via
- * a usb tether and when any type of tether is connected.  In the connecting case
- * It allows them to start a USB tether.  In the Tethered/disconnecting case it
- * will disconnect all tethers.
- */
-public class TetherActivity extends AlertActivity implements
-        DialogInterface.OnClickListener {
-
-    private static final int POSITIVE_BUTTON = AlertDialog.BUTTON1;
-
-    // count of the number of tethered connections at activity create time.
-    private int mTethered;
-
-    /* Used to detect when the USB cable is unplugged, so we can call finish() */
-    private BroadcastReceiver mTetherReceiver = new BroadcastReceiver() {
-        @Override
-        public void onReceive(Context context, Intent intent) {
-            if (intent.getAction() == ConnectivityManager.ACTION_TETHER_STATE_CHANGED) {
-                handleTetherStateChanged(intent);
-            }
-        }
-    };
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        // determine if we advertise tethering or untethering
-        ConnectivityManager cm =
-                (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);
-
-        mTethered = cm.getTetheredIfaces().length;
-        int tetherable = cm.getTetherableIfaces().length;
-        if ((mTethered == 0) && (tetherable == 0)) {
-            finish();
-            return;
-        }
-
-        // Set up the dialog
-        // if we have a tethered connection we put up a "Do you want to Disconect" dialog
-        // otherwise we must have a tetherable interface (else we'd return above)
-        // and so we want to put up the "do you want to connect" dialog
-        if (mTethered == 0) {
-            mAlertParams.mIconId = com.android.internal.R.drawable.ic_dialog_usb;
-            mAlertParams.mTitle = getString(com.android.internal.R.string.tether_title);
-            mAlertParams.mMessage = getString(com.android.internal.R.string.tether_message);
-            mAlertParams.mPositiveButtonText =
-                    getString(com.android.internal.R.string.tether_button);
-            mAlertParams.mPositiveButtonListener = this;
-            mAlertParams.mNegativeButtonText =
-                    getString(com.android.internal.R.string.tether_button_cancel);
-            mAlertParams.mNegativeButtonListener = this;
-        } else {
-            mAlertParams.mIconId = com.android.internal.R.drawable.ic_dialog_usb;
-            mAlertParams.mTitle = getString(com.android.internal.R.string.tether_stop_title);
-            mAlertParams.mMessage = getString(com.android.internal.R.string.tether_stop_message);
-            mAlertParams.mPositiveButtonText =
-                    getString(com.android.internal.R.string.tether_stop_button);
-            mAlertParams.mPositiveButtonListener = this;
-            mAlertParams.mNegativeButtonText =
-                    getString(com.android.internal.R.string.tether_stop_button_cancel);
-            mAlertParams.mNegativeButtonListener = this;
-        }
-        setupAlert();
-    }
-
-    @Override
-    protected void onResume() {
-        super.onResume();
-
-        registerReceiver(mTetherReceiver, new IntentFilter(
-                ConnectivityManager.ACTION_TETHER_STATE_CHANGED));
-    }
-
-    @Override
-    protected void onPause() {
-        super.onPause();
-
-        unregisterReceiver(mTetherReceiver);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void onClick(DialogInterface dialog, int which) {
-        int error = ConnectivityManager.TETHER_ERROR_NO_ERROR;
-
-        if (which == POSITIVE_BUTTON) {
-            ConnectivityManager cm =
-                    (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);
-            // start/stop tethering
-            String[] tethered = cm.getTetheredIfaces();
-
-            if (tethered.length == 0) {
-                String[] tetherable = cm.getTetherableIfaces();
-                String[] usbRegexs = cm.getTetherableUsbRegexs();
-                for (String t : tetherable) {
-                    for (String r : usbRegexs) {
-                        if (t.matches(r)) {
-                            error = cm.tether(t);
-                            break;
-                        }
-                    }
-                }
-                showTetheringError(error);
-            } else {
-                for (String t : tethered) {
-                    error = cm.untether(t);
-                }
-                showUnTetheringError(error);
-            }
-        }
-        // No matter what, finish the activity
-        finish();
-    }
-
-    private void handleTetherStateChanged(Intent intent) {
-        // determine if we advertise tethering or untethering
-        ConnectivityManager cm =
-                (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);
-        if (mTethered != cm.getTetheredIfaces().length) {
-            finish();
-        }
-    }
-
-    private void showTetheringError(int error) {
-        switch(error) {
-        case ConnectivityManager.TETHER_ERROR_NO_ERROR:
-            return;
-        default:
-            Toast.makeText(this, com.android.internal.R.string.tether_error_message,
-                    Toast.LENGTH_LONG).show();
-        }
-    }
-
-    private void showUnTetheringError(int error) {
-        switch(error) {
-        case ConnectivityManager.TETHER_ERROR_NO_ERROR:
-            return;
-        default:
-            Toast.makeText(this, com.android.internal.R.string.tether_stop_error_message,
-                    Toast.LENGTH_LONG).show();
-        }
-    }
-}
diff --git a/core/jni/android_database_SQLiteDatabase.cpp b/core/jni/android_database_SQLiteDatabase.cpp
index b93311b..bd55e83 100644
--- a/core/jni/android_database_SQLiteDatabase.cpp
+++ b/core/jni/android_database_SQLiteDatabase.cpp
@@ -63,19 +63,28 @@
 
 static jfieldID offset_db_handle;
 
+static char *createStr(const char *path) {
+    int len = strlen(path);
+    char *str = (char *)malloc(len + 1);
+    strncpy(str, path, len);
+    str[len] = NULL;
+    return str;
+}
+
 static void sqlLogger(void *databaseName, int iErrCode, const char *zMsg) {
-    LOGI("sqlite returned: error code = %d, msg = %s\n", iErrCode, zMsg);
+    LOGI("sqlite returned: database = %s, error code = %d, msg = %s\n",
+            (char *)databaseName, iErrCode, zMsg);
 }
 
 // register the logging func on sqlite. needs to be done BEFORE any sqlite3 func is called.
-static void registerLoggingFunc() {
+static void registerLoggingFunc(const char *path) {
     static bool loggingFuncSet = false;
     if (loggingFuncSet) {
         return;
     }
 
     LOGV("Registering sqlite logging func \n");
-    int err = sqlite3_config(SQLITE_CONFIG_LOG, &sqlLogger, 0);
+    int err = sqlite3_config(SQLITE_CONFIG_LOG, &sqlLogger, (void *)createStr(path));
     if (err != SQLITE_OK) {
         LOGE("sqlite_config failed error_code = %d. THIS SHOULD NEVER occur.\n", err);
         return;
@@ -93,7 +102,7 @@
     int sqliteFlags;
 
     // register the logging func on sqlite. needs to be done BEFORE any sqlite3 func is called.
-    registerLoggingFunc();
+    registerLoggingFunc(path8);
 
     // convert our flags into the sqlite flags
     if (flags & CREATE_IF_NECESSARY) {
@@ -172,10 +181,7 @@
         LOGE("Failure in getDatabaseName(). VM ran out of memory?\n");
         return NULL; // VM would have thrown OutOfMemoryError
     }
-    int len = strlen(path);
-    char *dbNameStr = (char *)malloc(len + 1);
-    strncpy(dbNameStr, path, len);
-    dbNameStr[len-1] = NULL;
+    char *dbNameStr = createStr(path);
     env->ReleaseStringUTFChars(databaseName, path);
     return dbNameStr;
 }
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 63584ed..a41d25b 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -1271,10 +1271,6 @@
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
         </activity>
-        <activity android:name="com.android.internal.app.TetherActivity"
-                android:theme="@style/Theme.Dialog.Alert"
-                android:excludeFromRecents="true">
-        </activity>
         <activity android:name="com.android.server.status.UsbStorageActivity"
                 android:excludeFromRecents="true">
         </activity>
diff --git a/core/res/res/drawable-hdpi/ic_lock_silent_mode.png b/core/res/res/drawable-hdpi/ic_lock_silent_mode.png
index 00e1960..0d4c590 100644
--- a/core/res/res/drawable-hdpi/ic_lock_silent_mode.png
+++ b/core/res/res/drawable-hdpi/ic_lock_silent_mode.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/ic_lock_silent_mode_off.png b/core/res/res/drawable-hdpi/ic_lock_silent_mode_off.png
index 6b4ce89..17d705c 100644
--- a/core/res/res/drawable-hdpi/ic_lock_silent_mode_off.png
+++ b/core/res/res/drawable-hdpi/ic_lock_silent_mode_off.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/ic_lock_silent_mode_vibrate.png b/core/res/res/drawable-hdpi/ic_lock_silent_mode_vibrate.png
new file mode 100644
index 0000000..4503aceb
--- /dev/null
+++ b/core/res/res/drawable-hdpi/ic_lock_silent_mode_vibrate.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/ic_vibrate.png b/core/res/res/drawable-hdpi/ic_vibrate.png
index aa83534..ca23372 100644
--- a/core/res/res/drawable-hdpi/ic_vibrate.png
+++ b/core/res/res/drawable-hdpi/ic_vibrate.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/ic_vibrate_small.png b/core/res/res/drawable-hdpi/ic_vibrate_small.png
new file mode 100644
index 0000000..61b8bd9
--- /dev/null
+++ b/core/res/res/drawable-hdpi/ic_vibrate_small.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/ic_volume.png b/core/res/res/drawable-hdpi/ic_volume.png
index 7714f6a..bf538ee 100644
--- a/core/res/res/drawable-hdpi/ic_volume.png
+++ b/core/res/res/drawable-hdpi/ic_volume.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/ic_volume_off.png b/core/res/res/drawable-hdpi/ic_volume_off.png
index 313dd5b..aa344083 100644
--- a/core/res/res/drawable-hdpi/ic_volume_off.png
+++ b/core/res/res/drawable-hdpi/ic_volume_off.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/ic_volume_off_small.png b/core/res/res/drawable-hdpi/ic_volume_off_small.png
index 62322ec..1329414 100644
--- a/core/res/res/drawable-hdpi/ic_volume_off_small.png
+++ b/core/res/res/drawable-hdpi/ic_volume_off_small.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/ic_volume_small.png b/core/res/res/drawable-hdpi/ic_volume_small.png
index 96c7948..4e9a7ea 100644
--- a/core/res/res/drawable-hdpi/ic_volume_small.png
+++ b/core/res/res/drawable-hdpi/ic_volume_small.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_lock_silent_mode.png b/core/res/res/drawable-mdpi/ic_lock_silent_mode.png
index 439a6f5..5c3a226 100644
--- a/core/res/res/drawable-mdpi/ic_lock_silent_mode.png
+++ b/core/res/res/drawable-mdpi/ic_lock_silent_mode.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_lock_silent_mode_off.png b/core/res/res/drawable-mdpi/ic_lock_silent_mode_off.png
index fc7e960..95257a3 100644
--- a/core/res/res/drawable-mdpi/ic_lock_silent_mode_off.png
+++ b/core/res/res/drawable-mdpi/ic_lock_silent_mode_off.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_lock_silent_mode_vibrate.png b/core/res/res/drawable-mdpi/ic_lock_silent_mode_vibrate.png
new file mode 100644
index 0000000..7da79aa
--- /dev/null
+++ b/core/res/res/drawable-mdpi/ic_lock_silent_mode_vibrate.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_vibrate.png b/core/res/res/drawable-mdpi/ic_vibrate.png
old mode 100755
new mode 100644
index eb24e50..4fecce1
--- a/core/res/res/drawable-mdpi/ic_vibrate.png
+++ b/core/res/res/drawable-mdpi/ic_vibrate.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_vibrate_small.png b/core/res/res/drawable-mdpi/ic_vibrate_small.png
new file mode 100644
index 0000000..f04804e
--- /dev/null
+++ b/core/res/res/drawable-mdpi/ic_vibrate_small.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_volume.png b/core/res/res/drawable-mdpi/ic_volume.png
old mode 100755
new mode 100644
index cee70f0..20aa030
--- a/core/res/res/drawable-mdpi/ic_volume.png
+++ b/core/res/res/drawable-mdpi/ic_volume.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_volume_off.png b/core/res/res/drawable-mdpi/ic_volume_off.png
index f3850fc..fefb9c4 100644
--- a/core/res/res/drawable-mdpi/ic_volume_off.png
+++ b/core/res/res/drawable-mdpi/ic_volume_off.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_volume_off_small.png b/core/res/res/drawable-mdpi/ic_volume_off_small.png
old mode 100755
new mode 100644
index ae55bd6..529298c
--- a/core/res/res/drawable-mdpi/ic_volume_off_small.png
+++ b/core/res/res/drawable-mdpi/ic_volume_off_small.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_volume_small.png b/core/res/res/drawable-mdpi/ic_volume_small.png
old mode 100755
new mode 100644
index 00a4f89..2a7ec03
--- a/core/res/res/drawable-mdpi/ic_volume_small.png
+++ b/core/res/res/drawable-mdpi/ic_volume_small.png
Binary files differ
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 8308801..e68f214 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -1101,7 +1101,7 @@
       the state of network connectivity.</string>
 
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permlab_changeTetherState">change tethered connectivity</string>
+    <string name="permlab_changeTetherState">Change tethered connectivity</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the applicaiton to do this. -->
     <string name="permdesc_changeTetherState">Allows an application to change
       the state of tethered network connectivity.</string>
@@ -2246,44 +2246,6 @@
     -->
     <string name="description_star">favorite</string>
 
-
-    <!-- Strings for Tethering dialogs -->
-    <!-- This is the label for the activity, and should never be visible to the user. -->
-    <!-- See TETHERING.  TETHERING_DIALOG:  After the user selects the notification, a dialog is shown asking if he wants to Tether.  This is the title. -->
-    <string name="tether_title">USB tethering available</string>
-    <!-- See TETHER.    This is the message. -->
-    <string name="tether_message">Select \"Tether\" if you want to share your phone\'s data connection with your computer.</string>
-    <!-- See TETHER.    This is the button text to Tether the computer with the phone. -->
-    <string name="tether_button">Tether</string>
-    <!-- See TETHER.   This is the button text to ignore the plugging in of the phone.. -->
-    <string name="tether_button_cancel">Cancel</string>
-
-    <!-- See TETHER.  If there was a recoverable error, this is the text. -->
-    <string name="tether_error_message">We\'ve encountered a problem turning on Tethering.  Please try again.</string>
-
-    <!-- TETHER: When the user connects the phone to a computer, we show a notification asking if he wants to share his cellular network connection.  This is the title -->
-    <string name="tether_available_notification_title">USB tethering available</string>
-    <!-- See USB_STORAGE. This is the message. -->
-    <string name="tether_available_notification_message">Select to tether your computer to your phone.</string>
-    <!-- TETHER_STOP: While TETHER is enabled, we show a notification dialog asking if he wants to stop. This is the title -->
-    <string name="tether_stop_notification_title">Untether</string>
-    <!-- See TETHER. This is the message. -->
-    <string name="tether_stop_notification_message">Select to untether your computer.</string>
-
-    <!-- TETHER stop dialog strings -->
-    <!-- This is the label for the activity, and should never be visible to the user. -->
-    <!-- See TETHER_STOP.  TETHER_STOP_DIALOG:  After the user selects the notification, a dialog is shown asking if he wants to stop tethering.  This is the title. -->
-    <string name="tether_stop_title">Disconnect tethering</string>
-    <!-- See TETHER_STOP.    This is the message. -->
-    <string name="tether_stop_message">You have been sharing your phone\'s cellular data connection with your computer. Select \"Disconnect\" to disconnect USB tethering.</string>
-    <!-- See TETHER_STOP.    This is the button text to disconnect tethering. -->
-    <string name="tether_stop_button">Disconnect</string>
-    <!-- See TETHER_STOP.   This is the button text to cancel disconnecting the tether. -->
-    <string name="tether_stop_button_cancel">Cancel</string>
-
-    <!-- See TETHER_STOP.  If there was an error disconnect, this is the text. -->
-    <string name="tether_stop_error_message">We\'ve encountered a problem turning off Tethering. Please try again.</string>
-
     <!-- Strings for car mode notification -->
     <!-- Shown when car mode is enabled -->
     <string name="car_mode_disable_notification_title">Car mode enabled</string>
diff --git a/media/java/android/media/CamcorderProfile.java b/media/java/android/media/CamcorderProfile.java
index eade680..09ac0ac 100644
--- a/media/java/android/media/CamcorderProfile.java
+++ b/media/java/android/media/CamcorderProfile.java
@@ -34,7 +34,6 @@
  * <li> Audio sample rate
  * <li> Number of audio channels for recording.
  * </ul>
- * {@hide}
  */
 public class CamcorderProfile
 {
diff --git a/media/java/android/media/CameraProfile.java b/media/java/android/media/CameraProfile.java
index 9685e7e..f1616cc 100644
--- a/media/java/android/media/CameraProfile.java
+++ b/media/java/android/media/CameraProfile.java
@@ -21,7 +21,6 @@
  * capture (jpeg) quality levels (0-100) used for low, medium, and high
  * quality settings in the Camera application.
  *
- * {@hide}
  */
 public class CameraProfile
 {
diff --git a/media/libstagefright/MP3Extractor.cpp b/media/libstagefright/MP3Extractor.cpp
index ab38bca..c168771 100644
--- a/media/libstagefright/MP3Extractor.cpp
+++ b/media/libstagefright/MP3Extractor.cpp
@@ -36,8 +36,10 @@
 namespace android {
 
 // Everything must match except for
-// protection, bitrate, padding, private bits and mode extension.
-static const uint32_t kMask = 0xfffe0ccf;
+// protection, bitrate, padding, private bits, mode extension,
+// copyright bit, original bit and emphasis.
+// Yes ... there are things that must indeed match...
+static const uint32_t kMask = 0xfffe0cc0;
 
 static bool get_mp3_frame_size(
         uint32_t header, size_t *frame_size,
@@ -669,7 +671,7 @@
         }
 
         // Lost sync.
-        LOGV("lost sync!\n");
+        LOGV("lost sync! header = 0x%08x, old header = 0x%08x\n", header, mFixedHeader);
 
         off_t pos = mCurrentPos;
         if (!Resync(mDataSource, mFixedHeader, &pos, NULL)) {
diff --git a/services/java/com/android/server/DockObserver.java b/services/java/com/android/server/DockObserver.java
index 73e760e..28236f0 100644
--- a/services/java/com/android/server/DockObserver.java
+++ b/services/java/com/android/server/DockObserver.java
@@ -181,8 +181,7 @@
 
         public void onLocationChanged(Location location) {
             final boolean hasMoved = hasMoved(location);
-            final boolean hasBetterAccuracy = location.getAccuracy() < mLocation.getAccuracy();
-            if (hasMoved || hasBetterAccuracy) {
+            if (hasMoved || hasBetterAccuracy(location)) {
                 synchronized (this) {
                     mLocation = location;
                 }
@@ -201,6 +200,16 @@
         public void onStatusChanged(String provider, int status, Bundle extras) {
         }
 
+        private boolean hasBetterAccuracy(Location location) {
+            if (location == null) {
+                return false;
+            }
+            if (mLocation == null) {
+                return true;
+            }
+            return location.getAccuracy() < mLocation.getAccuracy();
+        }
+
         /*
          * The user has moved if the accuracy circles of the two locations
          * don't overlap.
diff --git a/services/java/com/android/server/LocationManagerService.java b/services/java/com/android/server/LocationManagerService.java
index eaf4802..8d00deb 100644
--- a/services/java/com/android/server/LocationManagerService.java
+++ b/services/java/com/android/server/LocationManagerService.java
@@ -1205,8 +1205,9 @@
             // Remove expired alerts
             if (intentsToRemove != null) {
                 for (PendingIntent i : intentsToRemove) {
-                    ProximityAlert alert = mProximityAlerts.remove(i);
+                    ProximityAlert alert = mProximityAlerts.get(i);
                     mProximitiesEntered.remove(alert);
+                    removeProximityAlertLocked(i);
                 }
             }
         }
diff --git a/services/java/com/android/server/Watchdog.java b/services/java/com/android/server/Watchdog.java
index ee69715..f97f50a 100644
--- a/services/java/com/android/server/Watchdog.java
+++ b/services/java/com/android/server/Watchdog.java
@@ -34,8 +34,10 @@
 import android.provider.Settings;
 import android.util.Config;
 import android.util.EventLog;
+import android.util.Log;
 import android.util.Slog;
 
+import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Calendar;
@@ -804,19 +806,14 @@
                 // to timeout on is asleep as well and won't have a chance to run. Causing a false
                 // positive on when to kill things.
                 long start = SystemClock.uptimeMillis();
-                do {
+                while (timeout > 0 && !mForceKillSystem) {
                     try {
-                        wait(timeout);
+                        wait(timeout);  // notifyAll() is called when mForceKillSystem is set
                     } catch (InterruptedException e) {
-                        if (SystemProperties.getBoolean("ro.secure", false)) {
-                            // If this is a secure build, just log the error.
-                            Slog.e("WatchDog", "Woof! Woof! Interrupter!");
-                        } else {
-                            throw new AssertionError("Someone interrupted the watchdog");
-                        }
+                        Log.wtf(TAG, e);
                     }
                     timeout = TIME_TO_WAIT - (SystemClock.uptimeMillis() - start);
-                } while (timeout > 0 && !mForceKillSystem);
+                }
 
                 if (mCompleted && !mForceKillSystem) {
                     // The monitors have returned.
@@ -825,22 +822,24 @@
             }
 
             // If we got here, that means that the system is most likely hung.
-            // First send a SIGQUIT so that we can see where it was hung. Then
-            // kill this process so that the system will restart.
+            // First collect stack traces from all threads of the system process.
+            // Then kill this process so that the system will restart.
+
             String name = (mCurrentMonitor != null) ? mCurrentMonitor.getClass().getName() : "null";
             EventLog.writeEvent(EventLogTags.WATCHDOG, name);
-            Process.sendSignal(Process.myPid(), Process.SIGNAL_QUIT);
 
-            // Wait a bit longer before killing so we can make sure that the stacks are captured.
-            try {
-                Thread.sleep(10*1000);
-            } catch (InterruptedException e) {
-            }
+            ArrayList pids = new ArrayList();
+            pids.add(Process.myPid());
+            File stack = ActivityManagerService.dumpStackTraces(pids);
+            mActivity.addErrorToDropBox("watchdog", null, null, null, name, null, stack, null);
 
             // Only kill the process if the debugger is not attached.
             if (!Debug.isDebuggerConnected()) {
-                Slog.i(TAG, "Watchdog is killing the system process");
+                Slog.w(TAG, "*** WATCHDOG KILLING SYSTEM PROCESS: " + name);
                 Process.killProcess(Process.myPid());
+                System.exit(10);
+            } else {
+                Slog.w(TAG, "Debugger connected: Watchdog is *not* killing the system process");
             }
         }
     }
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index a263b23..9018872 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -4662,7 +4662,7 @@
      * @param pids of dalvik VM processes to dump stack traces for
      * @return file containing stack traces, or null if no dump file is configured
      */
-    private static File dumpStackTraces(ArrayList<Integer> pids) {
+    public static File dumpStackTraces(ArrayList<Integer> pids) {
         String tracesPath = SystemProperties.get("dalvik.vm.stack-trace-file", null);
         if (tracesPath == null || tracesPath.length() == 0) {
             return null;
@@ -8958,10 +8958,13 @@
      * @param logFile to include in the report, null if none
      * @param crashInfo giving an application stack trace, null if absent
      */
-    private void addErrorToDropBox(String eventType,
+    public void addErrorToDropBox(String eventType,
             ProcessRecord process, HistoryRecord activity, HistoryRecord parent,
             String subject, String report, File logFile,
             ApplicationErrorReport.CrashInfo crashInfo) {
+        // NOTE -- this must never acquire the ActivityManagerService lock,
+        // otherwise the watchdog may be prevented from resetting the system.
+
         String dropboxTag;
         if (process == null || process.pid == MY_PID) {
             dropboxTag = "system_server_" + eventType;
diff --git a/services/java/com/android/server/connectivity/Tethering.java b/services/java/com/android/server/connectivity/Tethering.java
index ee54f73..78329db 100644
--- a/services/java/com/android/server/connectivity/Tethering.java
+++ b/services/java/com/android/server/connectivity/Tethering.java
@@ -40,7 +40,6 @@
 import android.os.ServiceManager;
 import android.provider.Settings;
 import android.util.Log;
-import android.widget.Toast;
 
 import com.android.internal.telephony.Phone;
 import com.android.internal.util.HierarchicalState;
@@ -66,7 +65,6 @@
     private Context mContext;
     private final String TAG = "Tethering";
 
-    private boolean mPlaySounds = false;
     private boolean mBooted = false;
     //used to remember if we got connected before boot finished
     private boolean mDeferedUsbConnection = false;
@@ -78,8 +76,6 @@
 
     private HashMap<String, TetherInterfaceSM> mIfaces;
 
-    private ArrayList<String> mActiveTtys;
-
     private BroadcastReceiver mStateReceiver;
 
     private static final String USB_NEAR_IFACE_ADDR      = "169.254.2.1";
@@ -112,7 +108,6 @@
         }
 
         mIfaces = new HashMap<String, TetherInterfaceSM>();
-        mActiveTtys = new ArrayList<String>();
 
         mTetherMasterSM = new TetherMasterSM("TetherMaster");
         mTetherMasterSM.start();
@@ -323,142 +318,6 @@
         mContext.sendStickyBroadcast(broadcast);
         Log.d(TAG, "sendTetherStateChangedBroadcast " + availableList.size() + ", " +
                 activeList.size() + ", " + erroredList.size());
-        // check if we need to send a USB notification
-        // Check if the user wants to be bothered
-        boolean tellUser = (Settings.Secure.getInt(mContext.getContentResolver(),
-                Settings.Secure.TETHER_NOTIFY, 0) == 1);
-        for (Object o : activeList) {
-            String s = (String)o;
-            for (Object regexObject : mTetherableUsbRegexs) {
-                if (s.matches((String)regexObject)) {
-                    showTetheredNotification();
-                    return;
-                }
-            }
-        }
-        if (tellUser) {
-            for (Object o : availableList) {
-                String s = (String)o;
-                for (String match : mTetherableUsbRegexs) {
-                    if (s.matches(match)) {
-                        showTetherAvailableNotification();
-                        return;
-                    }
-                }
-            }
-        }
-        clearNotification();
-    }
-
-    private void showTetherAvailableNotification() {
-        NotificationManager notificationManager = (NotificationManager)mContext.
-                getSystemService(Context.NOTIFICATION_SERVICE);
-        if (notificationManager == null) {
-            return;
-        }
-        Intent intent = new Intent();
-        intent.setClass(mContext, com.android.internal.app.TetherActivity.class);
-
-        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-        PendingIntent pi = PendingIntent.getActivity(mContext, 0, intent, 0);
-
-        Resources r = Resources.getSystem();
-        CharSequence title = r.getText(com.android.internal.R.string.
-                tether_available_notification_title);
-        CharSequence message = r.getText(com.android.internal.R.string.
-                tether_available_notification_message);
-
-        if(mTetheringNotification == null) {
-            mTetheringNotification = new Notification();
-            mTetheringNotification.when = 0;
-        }
-        mTetheringNotification.icon = com.android.internal.R.drawable.stat_sys_tether_usb;
-
-        boolean playSounds = false;
-        //playSounds = SystemProperties.get("persist.service.mount.playsnd", "1").equals("1");
-        if (playSounds) {
-            mTetheringNotification.defaults |= Notification.DEFAULT_SOUND;
-        } else {
-            mTetheringNotification.defaults &= ~Notification.DEFAULT_SOUND;
-        }
-
-        mTetheringNotification.flags = Notification.FLAG_ONGOING_EVENT;
-        mTetheringNotification.tickerText = title;
-        mTetheringNotification.setLatestEventInfo(mContext, title, message, pi);
-
-        notificationManager.notify(mTetheringNotification.icon, mTetheringNotification);
-
-    }
-
-    private void showTetheredNotification() {
-        NotificationManager notificationManager = (NotificationManager)mContext.
-                getSystemService(Context.NOTIFICATION_SERVICE);
-        if (notificationManager == null) {
-            return;
-        }
-
-        Intent intent = new Intent();
-        intent.setClass(mContext, com.android.internal.app.TetherActivity.class);
-
-        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-        PendingIntent pi = PendingIntent.getActivity(mContext, 0, intent, 0);
-
-        Resources r = Resources.getSystem();
-        CharSequence title = r.getText(com.android.internal.R.string.
-                tether_stop_notification_title);
-        CharSequence message = r.getText(com.android.internal.R.string.
-                tether_stop_notification_message);
-
-        if(mTetheringNotification == null) {
-            mTetheringNotification = new Notification();
-            mTetheringNotification.when = 0;
-        }
-        mTetheringNotification.icon = com.android.internal.R.drawable.stat_sys_tether_usb;
-
-        boolean playSounds = false;
-        //playSounds = SystemProperties.get("persist.service.mount.playsnd", "1").equals("1");
-        if (playSounds) {
-            mTetheringNotification.defaults |= Notification.DEFAULT_SOUND;
-        } else {
-            mTetheringNotification.defaults &= ~Notification.DEFAULT_SOUND;
-        }
-
-        mTetheringNotification.flags = Notification.FLAG_ONGOING_EVENT;
-        mTetheringNotification.tickerText = title;
-        mTetheringNotification.setLatestEventInfo(mContext, title, message, pi);
-
-        notificationManager.notify(mTetheringNotification.icon, mTetheringNotification);
-    }
-
-    private void clearNotification() {
-        NotificationManager notificationManager = (NotificationManager)mContext.
-                getSystemService(Context.NOTIFICATION_SERVICE);
-        if (notificationManager != null && mTetheringNotification != null) {
-            notificationManager.cancel(mTetheringNotification.icon);
-            mTetheringNotification = null;
-        }
-    }
-
-    private void showErrorToast(int error) {
-        int num;
-        switch(error) {
-        case ConnectivityManager.TETHER_ERROR_TETHER_IFACE_ERROR:
-        case ConnectivityManager.TETHER_ERROR_ENABLE_NAT_ERROR:
-        case ConnectivityManager.TETHER_ERROR_IFACE_CFG_ERROR:
-        case ConnectivityManager.TETHER_ERROR_MASTER_ERROR:
-            num = com.android.internal.R.string.tether_error_message;
-            break;
-        case ConnectivityManager.TETHER_ERROR_UNTETHER_IFACE_ERROR:
-        case ConnectivityManager.TETHER_ERROR_DISABLE_NAT_ERROR:
-            num = com.android.internal.R.string.tether_stop_error_message;
-            break;
-        default:
-            // do nothing
-            return;
-        }
-        String text = mContext.getResources().getString(num) + " - EC" + error;
-        Log.e(TAG, text);
-        Toast.makeText(mContext, text, Toast.LENGTH_LONG).show();
     }
 
     private class StateReceiver extends BroadcastReceiver {
@@ -748,7 +607,6 @@
                     // further error..
                     Tethering.this.configureUsbIface(false);
                 }
-                Tethering.this.showErrorToast(error);
             }
         }