Merge "More work on rotation animation."
diff --git a/cmds/dumpstate/dumpstate.c b/cmds/dumpstate/dumpstate.c
index ba79c9f..aa95b35 100644
--- a/cmds/dumpstate/dumpstate.c
+++ b/cmds/dumpstate/dumpstate.c
@@ -124,6 +124,24 @@
         dump_file("VM TRACES AT LAST ANR", anr_traces_path);
     }
 
+    /* slow traces for slow operations */
+    if (anr_traces_path[0] != 0) {
+        int tail = strlen(anr_traces_path)-1;
+        while (tail > 0 && anr_traces_path[tail] != '/') {
+            tail--;
+        }
+        int i = 0;
+        while (1) {
+            sprintf(anr_traces_path+tail+1, "slow%02d.txt", i);
+            if (stat(anr_traces_path, &st)) {
+                // No traces file at this index, done with the files.
+                break;
+            }
+            dump_file("VM TRACES WHEN SLOW", anr_traces_path);
+            i++;
+        }
+    }
+
     dump_file("NETWORK DEV INFO", "/proc/net/dev");
     dump_file("QTAGUID NETWORK INTERFACES INFO", "/proc/net/xt_qtaguid/iface_stat_all");
     dump_file("QTAGUID CTRL INFO", "/proc/net/xt_qtaguid/ctrl");
diff --git a/cmds/stagefright/sf2.cpp b/cmds/stagefright/sf2.cpp
index 1d28793..e47cdc0 100644
--- a/cmds/stagefright/sf2.cpp
+++ b/cmds/stagefright/sf2.cpp
@@ -14,6 +14,10 @@
  * limitations under the License.
  */
 
+//#define LOG_NDEBUG 0
+#define LOG_TAG "sf2"
+#include <utils/Log.h>
+
 #include <binder/ProcessState.h>
 
 #include <media/stagefright/foundation/hexdump.h>
@@ -205,6 +209,12 @@
                     }
 
                     looper()->stop();
+                } else if (what == ACodec::kWhatError) {
+                    ALOGE("something went wrong, codec reported an error.");
+
+                    printf("E\n");
+
+                    (new AMessage(kWhatStop, id()))->post();
                 }
                 break;
             }
diff --git a/core/java/android/animation/ValueAnimator.java b/core/java/android/animation/ValueAnimator.java
index f69120a..e2b8ce4 100755
--- a/core/java/android/animation/ValueAnimator.java
+++ b/core/java/android/animation/ValueAnimator.java
@@ -557,12 +557,22 @@
         public void handleMessage(Message msg) {
             switch (msg.what) {
                 case ANIMATION_START:
-                    doAnimationStart();
+                    // If there are already active animations, or if another ANIMATION_START
+                    // message was processed during this frame, then the pending list may already
+                    // have been cleared. If that's the case, we've already processed the
+                    // active animations for this frame - don't do it again.
+                    if (mPendingAnimations.size() > 0) {
+                        doAnimationFrame();
+                    }
                     break;
             }
         }
 
-        private void doAnimationStart() {
+        private void doAnimationFrame() {
+            // currentTime holds the common time for all animations processed
+            // during this frame
+            long currentTime = AnimationUtils.currentAnimationTimeMillis();
+
             // mPendingAnimations holds any animations that have requested to be started
             // We're going to clear mPendingAnimations, but starting animation may
             // cause more to be added to the pending list (for example, if one animation
@@ -583,15 +593,7 @@
                     }
                 }
             }
-            doAnimationFrame();
-        }
-
-        private void doAnimationFrame() {
-            // currentTime holds the common time for all animations processed
-            // during this frame
-            long currentTime = AnimationUtils.currentAnimationTimeMillis();
-
-            // First, process animations currently sitting on the delayed queue, adding
+            // Next, process animations currently sitting on the delayed queue, adding
             // them to the active animations if they are ready
             int numDelayedAnims = mDelayedAnims.size();
             for (int i = 0; i < numDelayedAnims; ++i) {
diff --git a/core/java/android/os/StrictMode.java b/core/java/android/os/StrictMode.java
index 759be91..ce213fb 100644
--- a/core/java/android/os/StrictMode.java
+++ b/core/java/android/os/StrictMode.java
@@ -1201,7 +1201,7 @@
             // throttled back to 60fps via SurfaceFlinger/View
             // invalidates, _not_ by posting frame updates every 16
             // milliseconds.
-            threadHandler.get().post(new Runnable() {
+            threadHandler.get().postAtFrontOfQueue(new Runnable() {
                     public void run() {
                         long loopFinishTime = SystemClock.uptimeMillis();
 
diff --git a/core/java/android/webkit/FindActionModeCallback.java b/core/java/android/webkit/FindActionModeCallback.java
index 964cf3e..6c331ac 100644
--- a/core/java/android/webkit/FindActionModeCallback.java
+++ b/core/java/android/webkit/FindActionModeCallback.java
@@ -45,7 +45,6 @@
     private int mNumberOfMatches;
     private int mActiveMatchIndex;
     private ActionMode mActionMode;
-    private String mLastFind;
 
     FindActionModeCallback(Context context) {
         mCustomView = LayoutInflater.from(context).inflate(
@@ -134,13 +133,12 @@
             mWebView.clearMatches();
             mMatches.setVisibility(View.GONE);
             mMatchesFound = false;
-            mLastFind = null;
+            mWebView.findAll(null);
         } else {
             mMatchesFound = true;
             mMatches.setVisibility(View.INVISIBLE);
             mNumberOfMatches = 0;
-            mLastFind = find.toString();
-            mWebView.findAllAsync(mLastFind);
+            mWebView.findAllAsync(find.toString());
         }
     }
 
@@ -150,9 +148,8 @@
         mInput.showSoftInput(mEditText, 0);
     }
 
-    public void updateMatchCount(int matchIndex, int matchCount,
-        String findText) {
-        if (mLastFind != null && mLastFind.equals(findText)) {
+    public void updateMatchCount(int matchIndex, int matchCount, boolean isNewFind) {
+        if (!isNewFind) {
             mNumberOfMatches = matchCount;
             mActiveMatchIndex = matchIndex;
             updateMatchesString();
diff --git a/core/java/android/webkit/FindListener.java b/core/java/android/webkit/FindListener.java
new file mode 100644
index 0000000..124f737
--- /dev/null
+++ b/core/java/android/webkit/FindListener.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.webkit;
+
+/**
+ * @hide
+ */
+public interface FindListener {
+    /**
+     * Notify the host application that a find result is available.
+     *
+     * @param numberOfMatches How many matches have been found
+     * @param activeMatchOrdinal The ordinal of the currently selected match
+     * @param isDoneCounting Whether we have finished counting matches
+     */
+    public void onFindResultReceived(int numberOfMatches,
+        int activeMatchOrdinal, boolean isDoneCounting);
+}
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index a561577..5e09416 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -1226,7 +1226,19 @@
 
     }
 
-    /*
+    /**
+     * Register the interface to be used when a find-on-page result has become
+     * available. This will replace the current handler.
+     *
+     * @param listener An implementation of FindListener
+     * @hide
+     */
+    public void setFindListener(FindListener listener) {
+        checkThread();
+        mProvider.setFindListener(listener);
+    }
+
+    /**
      * Highlight and scroll to the next occurance of String in findAll.
      * Wraps the page infinitely, and scrolls.  Must be called after
      * calling findAll.
@@ -1238,8 +1250,9 @@
         mProvider.findNext(forward);
     }
 
-    /*
+    /**
      * Find all instances of find on the page and highlight them.
+     *
      * @param find  String to find.
      * @return int  The number of occurances of the String "find"
      *              that were found.
@@ -1250,6 +1263,18 @@
     }
 
     /**
+     * Find all instances of find on the page and highlight them,
+     * asynchronously.
+     *
+     * @param find  String to find.
+     * @hide
+     */
+    public void findAllAsync(String find) {
+        checkThread();
+        mProvider.findAllAsync(find);
+    }
+
+    /**
      * Start an ActionMode for finding text in this WebView.  Only works if this
      *              WebView is attached to the view system.
      * @param text If non-null, will be the initial text to search for.
diff --git a/core/java/android/webkit/WebViewClassic.java b/core/java/android/webkit/WebViewClassic.java
index ed43043..e5434ce 100644
--- a/core/java/android/webkit/WebViewClassic.java
+++ b/core/java/android/webkit/WebViewClassic.java
@@ -1440,6 +1440,9 @@
     // Used to notify listeners of a new picture.
     private PictureListener mPictureListener;
 
+    // Used to notify listeners about find-on-page results.
+    private FindListener mFindListener;
+
     /**
      * Refer to {@link WebView#requestFocusNodeHref(Message)} for more information
      */
@@ -3695,6 +3698,17 @@
     }
 
     /**
+     * Register the interface to be used when a find-on-page result has become
+     * available. This will replace the current handler.
+     *
+     * @param listener An implementation of FindListener
+     */
+     public void setFindListener(FindListener listener) {
+         checkThread();
+         mFindListener = listener;
+     }
+
+    /**
      * See {@link WebView#findNext(boolean)}
      */
     @Override
@@ -3723,6 +3737,7 @@
         checkThread();
         if (0 == mNativeClass) return 0; // client isn't initialized
         mLastFind = find;
+        if (find == null) return 0;
         mWebViewCore.removeMessages(EventHub.FIND_ALL);
         WebViewCore.FindAllRequest request = new
             WebViewCore.FindAllRequest(find);
@@ -4909,11 +4924,9 @@
      */
     private void getSelectionHandles(int[] handles) {
         handles[0] = mSelectCursorBase.right;
-        handles[1] = mSelectCursorBase.bottom -
-                (mSelectCursorBase.height() / 4);
+        handles[1] = mSelectCursorBase.bottom;
         handles[2] = mSelectCursorExtent.left;
-        handles[3] = mSelectCursorExtent.bottom
-                - (mSelectCursorExtent.height() / 4);
+        handles[3] = mSelectCursorExtent.bottom;
         if (!nativeIsBaseFirst(mNativeClass)) {
             int swap = handles[0];
             handles[0] = handles[2];
@@ -8478,10 +8491,11 @@
                 }
 
                 case UPDATE_MATCH_COUNT: {
-                    if (mFindCallback != null) {
-                        mFindCallback.updateMatchCount(msg.arg1, msg.arg2,
-                            (String) msg.obj);
-                    }
+                    boolean isNewFind = mLastFind == null || !mLastFind.equals(msg.obj);
+                    if (mFindCallback != null)
+                        mFindCallback.updateMatchCount(msg.arg1, msg.arg2, isNewFind);
+                    if (mFindListener != null)
+                        mFindListener.onFindResultReceived(msg.arg1, msg.arg2, true);
                     break;
                 }
                 case CLEAR_CARET_HANDLE:
diff --git a/core/java/android/webkit/WebViewProvider.java b/core/java/android/webkit/WebViewProvider.java
index 2e8ad6d..9016fbc 100644
--- a/core/java/android/webkit/WebViewProvider.java
+++ b/core/java/android/webkit/WebViewProvider.java
@@ -191,10 +191,14 @@
 
     public WebBackForwardList copyBackForwardList();
 
+    public void setFindListener(FindListener listener);
+
     public void findNext(boolean forward);
 
     public int findAll(String find);
 
+    public void findAllAsync(String find);
+
     public boolean showFindDialog(String text, boolean showIme);
 
     public void clearMatches();
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index 0c5a827..caee1ab 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -110,6 +110,7 @@
 import android.os.SystemProperties;
 import android.os.UserId;
 import android.provider.Settings;
+import android.text.format.Time;
 import android.util.EventLog;
 import android.util.Pair;
 import android.util.Slog;
@@ -197,6 +198,8 @@
     
     private static final String SYSTEM_DEBUGGABLE = "ro.debuggable";
 
+    static final boolean IS_USER_BUILD = "user".equals(Build.TYPE);
+
     // Maximum number of recent tasks that we can remember.
     static final int MAX_RECENT_TASKS = 20;
     
@@ -2962,6 +2965,12 @@
             return null;
         }
 
+        dumpStackTraces(tracesPath, firstPids, processStats, lastPids);
+        return tracesFile;
+    }
+
+    private static void dumpStackTraces(String tracesPath, ArrayList<Integer> firstPids,
+            ProcessStats processStats, SparseArray<Boolean> lastPids) {
         // Use a FileObserver to detect when traces finish writing.
         // The order of traces is considered important to maintain for legibility.
         FileObserver observer = new FileObserver(tracesPath, FileObserver.CLOSE_WRITE) {
@@ -2972,16 +2981,18 @@
             observer.startWatching();
 
             // First collect all of the stacks of the most important pids.
-            try {
-                int num = firstPids.size();
-                for (int i = 0; i < num; i++) {
-                    synchronized (observer) {
-                        Process.sendSignal(firstPids.get(i), Process.SIGNAL_QUIT);
-                        observer.wait(200);  // Wait for write-close, give up after 200msec
+            if (firstPids != null) {
+                try {
+                    int num = firstPids.size();
+                    for (int i = 0; i < num; i++) {
+                        synchronized (observer) {
+                            Process.sendSignal(firstPids.get(i), Process.SIGNAL_QUIT);
+                            observer.wait(200);  // Wait for write-close, give up after 200msec
+                        }
                     }
+                } catch (InterruptedException e) {
+                    Log.wtf(TAG, e);
                 }
-            } catch (InterruptedException e) {
-                Log.wtf(TAG, e);
             }
 
             // Next measure CPU usage.
@@ -3017,13 +3028,83 @@
                 }
             }
 
-            return tracesFile;
-
         } finally {
             observer.stopWatching();
         }
     }
 
+    final void logAppTooSlow(ProcessRecord app, long startTime, String msg) {
+        if (IS_USER_BUILD) {
+            return;
+        }
+        String tracesPath = SystemProperties.get("dalvik.vm.stack-trace-file", null);
+        if (tracesPath == null || tracesPath.length() == 0) {
+            return;
+        }
+
+        StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads();
+        StrictMode.allowThreadDiskWrites();
+        try {
+            final File tracesFile = new File(tracesPath);
+            final File tracesDir = tracesFile.getParentFile();
+            final File tracesTmp = new File(tracesDir, "__tmp__");
+            try {
+                if (!tracesDir.exists()) tracesFile.mkdirs();
+                FileUtils.setPermissions(tracesDir.getPath(), 0775, -1, -1);  // drwxrwxr-x
+
+                if (tracesFile.exists()) {
+                    tracesTmp.delete();
+                    tracesFile.renameTo(tracesTmp);
+                }
+                StringBuilder sb = new StringBuilder();
+                Time tobj = new Time();
+                tobj.set(System.currentTimeMillis());
+                sb.append(tobj.format("%Y-%m-%d %H:%M:%S"));
+                sb.append(": ");
+                TimeUtils.formatDuration(SystemClock.uptimeMillis()-startTime, sb);
+                sb.append(" since ");
+                sb.append(msg);
+                FileOutputStream fos = new FileOutputStream(tracesFile);
+                fos.write(sb.toString().getBytes());
+                if (app == null) {
+                    fos.write("\n*** No application process!".getBytes());
+                }
+                fos.close();
+                FileUtils.setPermissions(tracesFile.getPath(), 0666, -1, -1); // -rw-rw-rw-
+            } catch (IOException e) {
+                Slog.w(TAG, "Unable to prepare slow app traces file: " + tracesPath, e);
+                return;
+            }
+
+            if (app != null) {
+                ArrayList<Integer> firstPids = new ArrayList<Integer>();
+                firstPids.add(app.pid);
+                dumpStackTraces(tracesPath, firstPids, null, null);
+            }
+
+            File lastTracesFile = null;
+            File curTracesFile = null;
+            for (int i=9; i>=0; i--) {
+                String name = String.format("slow%02d.txt", i);
+                curTracesFile = new File(tracesDir, name);
+                if (curTracesFile.exists()) {
+                    if (lastTracesFile != null) {
+                        curTracesFile.renameTo(lastTracesFile);
+                    } else {
+                        curTracesFile.delete();
+                    }
+                }
+                lastTracesFile = curTracesFile;
+            }
+            tracesFile.renameTo(curTracesFile);
+            if (tracesTmp.exists()) {
+                tracesTmp.renameTo(tracesFile);
+            }
+        } finally {
+            StrictMode.setThreadPolicy(oldPolicy);
+        }
+    }
+
     final void appNotResponding(ProcessRecord app, ActivityRecord activity,
             ActivityRecord parent, final String annotation) {
         ArrayList<Integer> firstPids = new ArrayList<Integer>(5);
diff --git a/services/java/com/android/server/am/ActivityRecord.java b/services/java/com/android/server/am/ActivityRecord.java
index a337b40..b42d98e 100644
--- a/services/java/com/android/server/am/ActivityRecord.java
+++ b/services/java/com/android/server/am/ActivityRecord.java
@@ -85,6 +85,8 @@
     long startTime;         // last time this activity was started
     long lastVisibleTime;   // last time this activity became visible
     long cpuTimeAtResume;   // the cpu time of host process at the time of resuming activity
+    long pauseTime;         // last time we started pausing the activity
+    long launchTickTime;    // base time for launch tick messages
     Configuration configuration; // configuration activity was last running in
     CompatibilityInfo compat;// last used compatibility mode
     ActivityRecord resultTo; // who started this entry, so will get our reply
@@ -576,6 +578,32 @@
         }
     }
 
+    void startLaunchTickingLocked() {
+        if (ActivityManagerService.IS_USER_BUILD) {
+            return;
+        }
+        if (launchTickTime == 0) {
+            launchTickTime = SystemClock.uptimeMillis();
+            continueLaunchTickingLocked();
+        }
+    }
+
+    boolean continueLaunchTickingLocked() {
+        if (launchTickTime != 0) {
+            Message msg = stack.mHandler.obtainMessage(ActivityStack.LAUNCH_TICK_MSG);
+            msg.obj = this;
+            stack.mHandler.removeMessages(ActivityStack.LAUNCH_TICK_MSG);
+            stack.mHandler.sendMessageDelayed(msg, ActivityStack.LAUNCH_TICK);
+            return true;
+        }
+        return false;
+    }
+
+    void finishLaunchTickingLocked() {
+        launchTickTime = 0;
+        stack.mHandler.removeMessages(ActivityStack.LAUNCH_TICK_MSG);
+    }
+
     // IApplicationToken
 
     public boolean mayFreezeScreenLocked(ProcessRecord app) {
@@ -631,6 +659,7 @@
                 stack.mInitialStartTime = 0;
             }
             startTime = 0;
+            finishLaunchTickingLocked();
         }
     }
 
diff --git a/services/java/com/android/server/am/ActivityStack.java b/services/java/com/android/server/am/ActivityStack.java
index a375d30..13ee008 100644
--- a/services/java/com/android/server/am/ActivityStack.java
+++ b/services/java/com/android/server/am/ActivityStack.java
@@ -87,7 +87,10 @@
     // How long we wait until giving up on the last activity telling us it
     // is idle.
     static final int IDLE_TIMEOUT = 10*1000;
-    
+
+    // Ticks during which we check progress while waiting for an app to launch.
+    static final int LAUNCH_TICK = 500;
+
     // How long we wait until giving up on the last activity to pause.  This
     // is short because it directly impacts the responsiveness of starting the
     // next activity.
@@ -275,6 +278,7 @@
     static final int LAUNCH_TIMEOUT_MSG = ActivityManagerService.FIRST_ACTIVITY_STACK_MSG + 4;
     static final int DESTROY_TIMEOUT_MSG = ActivityManagerService.FIRST_ACTIVITY_STACK_MSG + 5;
     static final int RESUME_TOP_ACTIVITY_MSG = ActivityManagerService.FIRST_ACTIVITY_STACK_MSG + 6;
+    static final int LAUNCH_TICK_MSG = ActivityManagerService.FIRST_ACTIVITY_STACK_MSG + 7;
     
     final Handler mHandler = new Handler() {
         //public Handler() {
@@ -297,6 +301,13 @@
                     // We don't at this point know if the activity is fullscreen,
                     // so we need to be conservative and assume it isn't.
                     Slog.w(TAG, "Activity pause timeout for " + r);
+                    synchronized (mService) {
+                        if (r.app != null) {
+                            mService.logAppTooSlow(r.app, r.pauseTime,
+                                    "pausing " + r);
+                        }
+                    }
+
                     activityPaused(r != null ? r.appToken : null, true);
                 } break;
                 case IDLE_TIMEOUT_MSG: {
@@ -313,6 +324,15 @@
                     Slog.w(TAG, "Activity idle timeout for " + r);
                     activityIdleInternal(r != null ? r.appToken : null, true, null);
                 } break;
+                case LAUNCH_TICK_MSG: {
+                    ActivityRecord r = (ActivityRecord)msg.obj;
+                    synchronized (mService) {
+                        if (r.continueLaunchTickingLocked()) {
+                            mService.logAppTooSlow(r.app, r.launchTickTime,
+                                    "launching " + r);
+                        }
+                    }
+                } break;
                 case DESTROY_TIMEOUT_MSG: {
                     ActivityRecord r = (ActivityRecord)msg.obj;
                     // We don't at this point know if the activity is fullscreen,
@@ -554,6 +574,9 @@
         r.startFreezingScreenLocked(app, 0);
         mService.mWindowManager.setAppVisibility(r.appToken, true);
 
+        // schedule launch ticks to collect information about slow apps.
+        r.startLaunchTickingLocked();
+
         // Have the window manager re-evaluate the orientation of
         // the screen based on the new activity order.  Note that
         // as a result of this, it can call back into the activity
@@ -936,6 +959,7 @@
             // responsiveness seen by the user.
             Message msg = mHandler.obtainMessage(PAUSE_TIMEOUT_MSG);
             msg.obj = prev;
+            prev.pauseTime = SystemClock.uptimeMillis();
             mHandler.sendMessageDelayed(msg, PAUSE_TIMEOUT);
             if (DEBUG_PAUSE) Slog.v(TAG, "Waiting for pause to complete...");
         } else {
@@ -1480,6 +1504,9 @@
             // This activity is now becoming visible.
             mService.mWindowManager.setAppVisibility(next.appToken, true);
 
+            // schedule launch ticks to collect information about slow apps.
+            next.startLaunchTickingLocked();
+
             ActivityRecord lastResumedActivity = mResumedActivity;
             ActivityState lastState = next.state;
 
@@ -3257,6 +3284,7 @@
             ActivityRecord r = ActivityRecord.forToken(token);
             if (r != null) {
                 mHandler.removeMessages(IDLE_TIMEOUT_MSG, r);
+                r.finishLaunchTickingLocked();
             }
 
             // Get the activity record.
@@ -3627,6 +3655,7 @@
         mHandler.removeMessages(PAUSE_TIMEOUT_MSG, r);
         mHandler.removeMessages(IDLE_TIMEOUT_MSG, r);
         mHandler.removeMessages(DESTROY_TIMEOUT_MSG, r);
+        r.finishLaunchTickingLocked();
     }
 
     final void removeActivityFromHistoryLocked(ActivityRecord r) {
diff --git a/services/java/com/android/server/wm/AppWindowToken.java b/services/java/com/android/server/wm/AppWindowToken.java
index 5ca09e7..67b667a 100644
--- a/services/java/com/android/server/wm/AppWindowToken.java
+++ b/services/java/com/android/server/wm/AppWindowToken.java
@@ -240,8 +240,10 @@
                     animation.setStartTime(currentTime);
                     animating = true;
                 }
-                // we're done!
-                return stepAnimation(currentTime);
+                if (stepAnimation(currentTime)) {
+                    // we're done!
+                    return true;
+                }
             }
         } else if (animation != null) {
             // If the display is frozen, and there is a pending animation,
diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java
index f4c4069..6993657 100644
--- a/services/java/com/android/server/wm/WindowManagerService.java
+++ b/services/java/com/android/server/wm/WindowManagerService.java
@@ -7688,9 +7688,9 @@
         Surface.openTransaction();
 
         try {
+            updateWindowsAppsAndRotationAnimationsLocked(currentTime, innerDw, innerDh);
             mPendingLayoutChanges = performAnimationsLocked(currentTime, dw, dh,
                     innerDw, innerDh);
-            updateWindowsAppsAndRotationAnimationsLocked(currentTime, innerDw, innerDh);
         
             // THIRD LOOP: Update the surfaces of all windows.
             
diff --git a/services/java/com/android/server/wm/WindowState.java b/services/java/com/android/server/wm/WindowState.java
index 42ce291..57d0374 100644
--- a/services/java/com/android/server/wm/WindowState.java
+++ b/services/java/com/android/server/wm/WindowState.java
@@ -305,11 +305,6 @@
     int mAnimDw;
     int mAnimDh;
 
-    static final int ANIM_STATE_IDLE = 0;
-    static final int ANIM_STATE_RUNNING = 1;
-    static final int ANIM_STATE_STOPPING = 2;
-    int mAnimState = ANIM_STATE_IDLE;
-
     WindowState(WindowManagerService service, Session s, IWindow c, WindowToken token,
            WindowState attachedWindow, int seq, WindowManager.LayoutParams a,
            int viewVisibility) {
@@ -653,7 +648,6 @@
             mLocalAnimating = false;
             mAnimation.cancel();
             mAnimation = null;
-            mAnimState = ANIM_STATE_IDLE;
         }
     }
 
@@ -665,7 +659,6 @@
             mAnimation.cancel();
             mAnimation = null;
             destroySurfaceLocked();
-            mAnimState = ANIM_STATE_IDLE;
         }
         mExiting = false;
     }
@@ -971,7 +964,8 @@
                 mAppToken.firstWindowDrawn = true;
 
                 if (mAppToken.startingData != null) {
-                    if (WindowManagerService.DEBUG_STARTING_WINDOW || WindowManagerService.DEBUG_ANIM) Slog.v(WindowManagerService.TAG,
+                    if (WindowManagerService.DEBUG_STARTING_WINDOW ||
+                            WindowManagerService.DEBUG_ANIM) Slog.v(WindowManagerService.TAG,
                             "Finish starting " + mToken
                             + ": first real window is shown, no animation");
                     // If this initial window is animating, stop it -- we
@@ -983,7 +977,6 @@
                         mAnimation = null;
                         // Make sure we clean up the animation.
                         mAnimating = true;
-                        mAnimState = ANIM_STATE_IDLE;
                     }
                     mService.mFinishedStarting.add(mAppToken);
                     mService.mH.sendEmptyMessage(H.FINISHED_STARTING);
@@ -995,7 +988,7 @@
     }
 
     private boolean stepAnimation(long currentTime) {
-        if ((mAnimation == null) || !mLocalAnimating || (mAnimState != ANIM_STATE_RUNNING)) {
+        if ((mAnimation == null) || !mLocalAnimating) {
             return false;
         }
         mTransformation.clear();
@@ -1003,9 +996,6 @@
         if (WindowManagerService.DEBUG_ANIM) Slog.v(
             WindowManagerService.TAG, "Stepped animation in " + this +
             ": more=" + more + ", xform=" + mTransformation);
-        if (!more) {
-            mAnimState = ANIM_STATE_STOPPING;
-        }
         return more;
     }
 
@@ -1032,11 +1022,11 @@
                     mAnimation.setStartTime(currentTime);
                     mLocalAnimating = true;
                     mAnimating = true;
-                    mAnimState = ANIM_STATE_RUNNING;
                 }
-                if ((mAnimation != null) && mLocalAnimating && 
-                        (mAnimState != ANIM_STATE_STOPPING)) {
-                    return stepAnimation(currentTime);
+                if ((mAnimation != null) && mLocalAnimating) {
+                    if (stepAnimation(currentTime)) {
+                        return true;
+                    }
                 }
                 if (WindowManagerService.DEBUG_ANIM) Slog.v(
                     WindowManagerService.TAG, "Finished animation in " + this +
@@ -1137,7 +1127,6 @@
             mAppToken.updateReportedVisibilityLocked();
         }
 
-        mAnimState = ANIM_STATE_IDLE;
         return false;
     }
 
diff --git a/tools/layoutlib/bridge/src/android/content/res/BridgeResources.java b/tools/layoutlib/bridge/src/android/content/res/BridgeResources.java
index 7b672da..8794452 100644
--- a/tools/layoutlib/bridge/src/android/content/res/BridgeResources.java
+++ b/tools/layoutlib/bridge/src/android/content/res/BridgeResources.java
@@ -120,10 +120,8 @@
         mProjectCallback = projectCallback;
     }
 
-    public BridgeTypedArray newTypeArray(int numEntries, boolean platformFile,
-            boolean platformStyleable, String styleableName) {
-        return new BridgeTypedArray(this, mContext, numEntries, platformFile,
-                platformStyleable, styleableName);
+    public BridgeTypedArray newTypeArray(int numEntries, boolean platformFile) {
+        return new BridgeTypedArray(this, mContext, numEntries, platformFile);
     }
 
     private Pair<String, ResourceValue> getResourceValue(int id, boolean[] platformResFlag_out) {
diff --git a/tools/layoutlib/bridge/src/android/content/res/BridgeTypedArray.java b/tools/layoutlib/bridge/src/android/content/res/BridgeTypedArray.java
index 8fdac02..cbc199a 100644
--- a/tools/layoutlib/bridge/src/android/content/res/BridgeTypedArray.java
+++ b/tools/layoutlib/bridge/src/android/content/res/BridgeTypedArray.java
@@ -16,7 +16,7 @@
 
 package android.content.res;
 
-import com.android.ide.common.rendering.api.DeclareStyleableResourceValue;
+import com.android.ide.common.rendering.api.AttrResourceValue;
 import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.ide.common.rendering.api.RenderResources;
 import com.android.ide.common.rendering.api.ResourceValue;
@@ -51,28 +51,33 @@
     private final BridgeResources mBridgeResources;
     private final BridgeContext mContext;
     private final boolean mPlatformFile;
-    private final boolean mPlatformStyleable;
-    private final String mStyleableName;
 
     private ResourceValue[] mResourceData;
     private String[] mNames;
+    private boolean[] mIsFramework;
 
     public BridgeTypedArray(BridgeResources resources, BridgeContext context, int len,
-            boolean platformFile, boolean platformStyleable, String styleableName) {
+            boolean platformFile) {
         super(null, null, null, 0);
         mBridgeResources = resources;
         mContext = context;
         mPlatformFile = platformFile;
-        mPlatformStyleable = platformStyleable;
-        mStyleableName = styleableName;
         mResourceData = new ResourceValue[len];
         mNames = new String[len];
+        mIsFramework = new boolean[len];
     }
 
-    /** A bridge-specific method that sets a value in the type array */
-    public void bridgeSetValue(int index, String name, ResourceValue value) {
+    /**
+     * A bridge-specific method that sets a value in the type array
+     * @param index the index of the value in the TypedArray
+     * @param name the name of the attribute
+     * @param isFramework whether the attribute is in the android namespace.
+     * @param value the value of the attribute
+     */
+    public void bridgeSetValue(int index, String name, boolean isFramework, ResourceValue value) {
         mResourceData[index] = value;
         mNames[index] = name;
+        mIsFramework[index] = isFramework;
     }
 
     /**
@@ -213,8 +218,12 @@
             return defValue;
         }
 
+        if (s == null) {
+            return defValue;
+        }
+
         try {
-            return (s == null) ? defValue : XmlUtils.convertValueToInt(s, defValue);
+            return XmlUtils.convertValueToInt(s, defValue);
         } catch (NumberFormatException e) {
             // pass
         }
@@ -223,15 +232,14 @@
         // Check for possible constants and try to find them.
         // Get the map of attribute-constant -> IntegerValue
         Map<String, Integer> map = null;
-        if (mPlatformStyleable) {
+        if (mIsFramework[index]) {
             map = Bridge.getEnumValues(mNames[index]);
-        } else if (mStyleableName != null) {
+        } else {
             // get the styleable matching the resolved name
             RenderResources res = mContext.getRenderResources();
-            ResourceValue styleable = res.getProjectResource(ResourceType.DECLARE_STYLEABLE,
-                    mStyleableName);
-            if (styleable instanceof DeclareStyleableResourceValue) {
-                map = ((DeclareStyleableResourceValue) styleable).getAttributeValues(mNames[index]);
+            ResourceValue attr = res.getProjectResource(ResourceType.ATTR, mNames[index]);
+            if (attr instanceof AttrResourceValue) {
+                map = ((AttrResourceValue) attr).getAttributeValues();
             }
         }
 
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeRenderSession.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeRenderSession.java
index 529be97..f9f4b3a 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeRenderSession.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeRenderSession.java
@@ -70,13 +70,13 @@
 
     @Override
     public Result getProperty(Object objectView, String propertyName) {
-        // TODO Auto-generated method stub
+        // pass
         return super.getProperty(objectView, propertyName);
     }
 
     @Override
     public Result setProperty(Object objectView, String propertyName, String propertyValue) {
-        // TODO Auto-generated method stub
+        // pass
         return super.setProperty(objectView, propertyName, propertyValue);
     }
 
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java
index 1555d6124..f9e48e2 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java
@@ -76,13 +76,11 @@
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.IdentityHashMap;
+import java.util.List;
 import java.util.Map;
-import java.util.Map.Entry;
-import java.util.TreeMap;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicReference;
 
 /**
  * Custom implementation of Context/Activity to handle non compiled resources.
@@ -247,15 +245,18 @@
 
     public boolean resolveThemeAttribute(int resid, TypedValue outValue, boolean resolveRefs) {
         Pair<ResourceType, String> resourceInfo = Bridge.resolveResourceId(resid);
+        boolean isFrameworkRes = true;
         if (resourceInfo == null) {
             resourceInfo = mProjectCallback.resolveResourceId(resid);
+            isFrameworkRes = false;
         }
 
         if (resourceInfo == null) {
             return false;
         }
 
-        ResourceValue value = mRenderResources.findItemInTheme(resourceInfo.getSecond());
+        ResourceValue value = mRenderResources.findItemInTheme(resourceInfo.getSecond(),
+                isFrameworkRes);
         if (resolveRefs) {
             value = mRenderResources.resolveResValue(value);
         }
@@ -315,12 +316,7 @@
 
         if (isPlatformLayout == false && skipCallbackParser == false) {
             // check if the project callback can provide us with a custom parser.
-            ILayoutPullParser parser;
-            if (resource instanceof ResourceValue) {
-                parser = mProjectCallback.getParser((ResourceValue) resource);
-            } else {
-                parser = mProjectCallback.getParser(resource.getName());
-            }
+            ILayoutPullParser parser = getParser(resource);
 
             if (parser != null) {
                 BridgeXmlBlockParser blockParser = new BridgeXmlBlockParser(parser,
@@ -393,6 +389,17 @@
         return Pair.of(null, false);
     }
 
+    @SuppressWarnings("deprecation")
+    private ILayoutPullParser getParser(ResourceReference resource) {
+        ILayoutPullParser parser;
+        if (resource instanceof ResourceValue) {
+            parser = mProjectCallback.getParser((ResourceValue) resource);
+        } else {
+            parser = mProjectCallback.getParser(resource.getName());
+        }
+        return parser;
+    }
+
     // ------------ Context methods
 
     @Override
@@ -524,12 +531,10 @@
             return null;
         }
 
-        AtomicBoolean frameworkAttributes = new AtomicBoolean();
-        AtomicReference<String> attrName = new AtomicReference<String>();
-        TreeMap<Integer, String> styleNameMap = searchAttrs(attrs, frameworkAttributes, attrName);
+        List<Pair<String, Boolean>> attributeList = searchAttrs(attrs);
 
         BridgeTypedArray ta = ((BridgeResources) mSystemResources).newTypeArray(attrs.length,
-                isPlatformFile, frameworkAttributes.get(), attrName.get());
+                isPlatformFile);
 
         // look for a custom style.
         String customStyle = null;
@@ -555,14 +560,19 @@
 
         if (defStyleAttr != 0) {
             // get the name from the int.
-            String defStyleName = searchAttr(defStyleAttr);
+            Pair<String, Boolean> defStyleAttribute = searchAttr(defStyleAttr);
 
             if (defaultPropMap != null) {
+                String defStyleName = defStyleAttribute.getFirst();
+                if (defStyleAttribute.getSecond()) {
+                    defStyleName = "android:" + defStyleName;
+                }
                 defaultPropMap.put("style", defStyleName);
             }
 
             // look for the style in the current theme, and its parent:
-            ResourceValue item = mRenderResources.findItemInTheme(defStyleName);
+            ResourceValue item = mRenderResources.findItemInTheme(defStyleAttribute.getFirst(),
+                    defStyleAttribute.getSecond());
 
             if (item != null) {
                 // item is a reference to a style entry. Search for it.
@@ -575,19 +585,23 @@
             } else {
                 Bridge.getLog().error(LayoutLog.TAG_RESOURCES_RESOLVE_THEME_ATTR,
                         String.format(
-                                "Failed to find style '%s' in current theme", defStyleName),
+                                "Failed to find style '%s' in current theme",
+                                defStyleAttribute.getFirst()),
                         null /*data*/);
             }
         } else if (defStyleRes != 0) {
+            boolean isFrameworkRes = true;
             Pair<ResourceType, String> value = Bridge.resolveResourceId(defStyleRes);
             if (value == null) {
                 value = mProjectCallback.resolveResourceId(defStyleRes);
+                isFrameworkRes = false;
             }
 
             if (value != null) {
                 if (value.getFirst() == ResourceType.STYLE) {
                     // look for the style in the current theme, and its parent:
-                    ResourceValue item = mRenderResources.findItemInTheme(value.getSecond());
+                    ResourceValue item = mRenderResources.findItemInTheme(value.getSecond(),
+                            isFrameworkRes);
                     if (item != null) {
                         if (item instanceof StyleResourceValue) {
                             if (defaultPropMap != null) {
@@ -619,26 +633,28 @@
             }
         }
 
-        String namespace = BridgeConstants.NS_RESOURCES;
-        boolean useFrameworkNS = frameworkAttributes.get();
-        if (useFrameworkNS == false) {
-            // need to use the application namespace
-            namespace = mProjectCallback.getNamespace();
-        }
+        String appNamespace = mProjectCallback.getNamespace();
 
-        if (styleNameMap != null) {
-            for (Entry<Integer, String> styleAttribute : styleNameMap.entrySet()) {
-                int index = styleAttribute.getKey().intValue();
+        if (attributeList != null) {
+            for (int index = 0 ; index < attributeList.size() ; index++) {
+                Pair<String, Boolean> attribute = attributeList.get(index);
 
-                String name = styleAttribute.getValue();
+                if (attribute == null) {
+                    continue;
+                }
+
+                String attrName = attribute.getFirst();
+                boolean frameworkAttr = attribute.getSecond().booleanValue();
                 String value = null;
                 if (set != null) {
-                    value = set.getAttributeValue(namespace, name);
+                    value = set.getAttributeValue(
+                            frameworkAttr ? BridgeConstants.NS_RESOURCES : appNamespace,
+                                    attrName);
 
                     // if this is an app attribute, and the first get fails, try with the
                     // new res-auto namespace as well
-                    if (useFrameworkNS == false && value == null) {
-                        value = set.getAttributeValue(BridgeConstants.NS_APP_RES_AUTO, name);
+                    if (frameworkAttr == false && value == null) {
+                        value = set.getAttributeValue(BridgeConstants.NS_APP_RES_AUTO, attrName);
                     }
                 }
 
@@ -649,18 +665,20 @@
 
                     // look for the value in the custom style first (and its parent if needed)
                     if (customStyleValues != null) {
-                        resValue = mRenderResources.findItemInStyle(customStyleValues, name);
+                        resValue = mRenderResources.findItemInStyle(customStyleValues,
+                                attrName, frameworkAttr);
                     }
 
                     // then look for the value in the default Style (and its parent if needed)
                     if (resValue == null && defStyleValues != null) {
-                        resValue = mRenderResources.findItemInStyle(defStyleValues, name);
+                        resValue = mRenderResources.findItemInStyle(defStyleValues,
+                                attrName, frameworkAttr);
                     }
 
                     // if the item is not present in the defStyle, we look in the main theme (and
                     // its parent themes)
                     if (resValue == null) {
-                        resValue = mRenderResources.findItemInTheme(name);
+                        resValue = mRenderResources.findItemInTheme(attrName, frameworkAttr);
                     }
 
                     // if we found a value, we make sure this doesn't reference another value.
@@ -668,18 +686,18 @@
                     if (resValue != null) {
                         // put the first default value, before the resolution.
                         if (defaultPropMap != null) {
-                            defaultPropMap.put(name, resValue.getValue());
+                            defaultPropMap.put(attrName, resValue.getValue());
                         }
 
                         resValue = mRenderResources.resolveResValue(resValue);
                     }
 
-                    ta.bridgeSetValue(index, name, resValue);
+                    ta.bridgeSetValue(index, attrName, frameworkAttr, resValue);
                 } else {
                     // there is a value in the XML, but we need to resolve it in case it's
                     // referencing another resource or a theme value.
-                    ta.bridgeSetValue(index, name,
-                            mRenderResources.resolveValue(null, name, value, isPlatformFile));
+                    ta.bridgeSetValue(index, attrName, frameworkAttr,
+                            mRenderResources.resolveValue(null, attrName, value, isPlatformFile));
                 }
             }
         }
@@ -705,23 +723,23 @@
     private BridgeTypedArray createStyleBasedTypedArray(StyleResourceValue style, int[] attrs)
             throws Resources.NotFoundException {
 
+        List<Pair<String, Boolean>> attributes = searchAttrs(attrs);
+
         BridgeTypedArray ta = ((BridgeResources) mSystemResources).newTypeArray(attrs.length,
-                false, true, null);
+                false);
 
         // for each attribute, get its name so that we can search it in the style
         for (int i = 0 ; i < attrs.length ; i++) {
-            Pair<ResourceType, String> resolvedResource = Bridge.resolveResourceId(attrs[i]);
-            if (resolvedResource != null) {
-                String attrName = resolvedResource.getSecond();
-                // look for the value in the given style
-                ResourceValue resValue = mRenderResources.findItemInStyle(style, attrName);
+            Pair<String, Boolean> attribute = attributes.get(i);
 
-                if (resValue != null) {
-                    // resolve it to make sure there are no references left.
-                    ta.bridgeSetValue(i, attrName, mRenderResources.resolveResValue(resValue));
+            // look for the value in the given style
+            ResourceValue resValue = mRenderResources.findItemInStyle(style, attribute.getFirst(),
+                    attribute.getSecond());
 
-                    resValue = mRenderResources.resolveResValue(resValue);
-                }
+            if (resValue != null) {
+                // resolve it to make sure there are no references left.
+                ta.bridgeSetValue(i, attribute.getFirst(), attribute.getSecond(),
+                        mRenderResources.resolveResValue(resValue));
             }
         }
 
@@ -732,91 +750,52 @@
 
 
     /**
-     * The input int[] attrs is one of com.android.internal.R.styleable fields where the name
-     * of the field is the style being referenced and the array contains one index per attribute.
+     * The input int[] attrs is a list of attributes. The returns a list of information about
+     * each attributes. The information is (name, isFramework)
      * <p/>
-     * searchAttrs() finds all the names of the attributes referenced so for example if
-     * attrs == com.android.internal.R.styleable.View, this returns the list of the "xyz" where
-     * there's a field com.android.internal.R.styleable.View_xyz and the field value is the index
-     * that is used to reference the attribute later in the TypedArray.
      *
      * @param attrs An attribute array reference given to obtainStyledAttributes.
-     * @param outFrameworkFlag out value indicating if the attr array is a framework value
-     * @param outAttrName out value for the resolved attr name.
-     * @return A sorted map Attribute-Value to Attribute-Name for all attributes declared by the
-     *         attribute array. Returns null if nothing is found.
+     * @return List of attribute information.
      */
-    private TreeMap<Integer,String> searchAttrs(int[] attrs, AtomicBoolean outFrameworkFlag,
-            AtomicReference<String> outAttrName) {
-        // get the name of the array from the framework resources
-        String arrayName = Bridge.resolveResourceId(attrs);
-        if (arrayName != null) {
-            // if we found it, get the name of each of the int in the array.
-            TreeMap<Integer,String> attributes = new TreeMap<Integer, String>();
-            for (int i = 0 ; i < attrs.length ; i++) {
-                Pair<ResourceType, String> info = Bridge.resolveResourceId(attrs[i]);
-                if (info != null) {
-                    attributes.put(i, info.getSecond());
-                } else {
-                    // FIXME Not sure what we should be doing here...
-                    attributes.put(i, null);
-                }
+    private List<Pair<String, Boolean>> searchAttrs(int[] attrs) {
+        List<Pair<String, Boolean>> results = new ArrayList<Pair<String, Boolean>>(attrs.length);
+
+        // for each attribute, get its name so that we can search it in the style
+        for (int i = 0 ; i < attrs.length ; i++) {
+            Pair<ResourceType, String> resolvedResource = Bridge.resolveResourceId(attrs[i]);
+            boolean isFramework = false;
+            if (resolvedResource != null) {
+                isFramework = true;
+            } else {
+                resolvedResource = mProjectCallback.resolveResourceId(attrs[i]);
             }
 
-            if (outFrameworkFlag != null) {
-                outFrameworkFlag.set(true);
+            if (resolvedResource != null) {
+                results.add(Pair.of(resolvedResource.getSecond(), isFramework));
+            } else {
+                results.add(null);
             }
-            if (outAttrName != null) {
-                outAttrName.set(arrayName);
-            }
-
-            return attributes;
         }
 
-        // if the name was not found in the framework resources, look in the project
-        // resources
-        arrayName = mProjectCallback.resolveResourceId(attrs);
-        if (arrayName != null) {
-            TreeMap<Integer,String> attributes = new TreeMap<Integer, String>();
-            for (int i = 0 ; i < attrs.length ; i++) {
-                Pair<ResourceType, String> info = mProjectCallback.resolveResourceId(attrs[i]);
-                if (info != null) {
-                    attributes.put(i, info.getSecond());
-                } else {
-                    // FIXME Not sure what we should be doing here...
-                    attributes.put(i, null);
-                }
-            }
-
-            if (outFrameworkFlag != null) {
-                outFrameworkFlag.set(false);
-            }
-            if (outAttrName != null) {
-                outAttrName.set(arrayName);
-            }
-
-            return attributes;
-        }
-
-        return null;
+        return results;
     }
 
     /**
      * Searches for the attribute referenced by its internal id.
      *
      * @param attr An attribute reference given to obtainStyledAttributes such as defStyle.
-     * @return The unique name of the attribute, if found, e.g. "buttonStyle". Returns null
+     * @return A (name, isFramework) pair describing the attribute if found. Returns null
      *         if nothing is found.
      */
-    public String searchAttr(int attr) {
+    public Pair<String, Boolean> searchAttr(int attr) {
         Pair<ResourceType, String> info = Bridge.resolveResourceId(attr);
         if (info != null) {
-            return info.getSecond();
+            return Pair.of(info.getSecond(), Boolean.TRUE);
         }
 
         info = mProjectCallback.resolveResourceId(attr);
         if (info != null) {
-            return info.getSecond();
+            return Pair.of(info.getSecond(), Boolean.FALSE);
         }
 
         return null;
@@ -876,149 +855,149 @@
 
     @Override
     public boolean bindService(Intent arg0, ServiceConnection arg1, int arg2) {
-        // TODO Auto-generated method stub
+        // pass
         return false;
     }
 
     @Override
     public int checkCallingOrSelfPermission(String arg0) {
-        // TODO Auto-generated method stub
+        // pass
         return 0;
     }
 
     @Override
     public int checkCallingOrSelfUriPermission(Uri arg0, int arg1) {
-        // TODO Auto-generated method stub
+        // pass
         return 0;
     }
 
     @Override
     public int checkCallingPermission(String arg0) {
-        // TODO Auto-generated method stub
+        // pass
         return 0;
     }
 
     @Override
     public int checkCallingUriPermission(Uri arg0, int arg1) {
-        // TODO Auto-generated method stub
+        // pass
         return 0;
     }
 
     @Override
     public int checkPermission(String arg0, int arg1, int arg2) {
-        // TODO Auto-generated method stub
+        // pass
         return 0;
     }
 
     @Override
     public int checkUriPermission(Uri arg0, int arg1, int arg2, int arg3) {
-        // TODO Auto-generated method stub
+        // pass
         return 0;
     }
 
     @Override
     public int checkUriPermission(Uri arg0, String arg1, String arg2, int arg3,
             int arg4, int arg5) {
-        // TODO Auto-generated method stub
+        // pass
         return 0;
     }
 
     @Override
     public void clearWallpaper() {
-        // TODO Auto-generated method stub
+        // pass
 
     }
 
     @Override
     public Context createPackageContext(String arg0, int arg1) {
-        // TODO Auto-generated method stub
+        // pass
         return null;
     }
 
     @Override
     public String[] databaseList() {
-        // TODO Auto-generated method stub
+        // pass
         return null;
     }
 
     @Override
     public boolean deleteDatabase(String arg0) {
-        // TODO Auto-generated method stub
+        // pass
         return false;
     }
 
     @Override
     public boolean deleteFile(String arg0) {
-        // TODO Auto-generated method stub
+        // pass
         return false;
     }
 
     @Override
     public void enforceCallingOrSelfPermission(String arg0, String arg1) {
-        // TODO Auto-generated method stub
+        // pass
 
     }
 
     @Override
     public void enforceCallingOrSelfUriPermission(Uri arg0, int arg1,
             String arg2) {
-        // TODO Auto-generated method stub
+        // pass
 
     }
 
     @Override
     public void enforceCallingPermission(String arg0, String arg1) {
-        // TODO Auto-generated method stub
+        // pass
 
     }
 
     @Override
     public void enforceCallingUriPermission(Uri arg0, int arg1, String arg2) {
-        // TODO Auto-generated method stub
+        // pass
 
     }
 
     @Override
     public void enforcePermission(String arg0, int arg1, int arg2, String arg3) {
-        // TODO Auto-generated method stub
+        // pass
 
     }
 
     @Override
     public void enforceUriPermission(Uri arg0, int arg1, int arg2, int arg3,
             String arg4) {
-        // TODO Auto-generated method stub
+        // pass
 
     }
 
     @Override
     public void enforceUriPermission(Uri arg0, String arg1, String arg2,
             int arg3, int arg4, int arg5, String arg6) {
-        // TODO Auto-generated method stub
+        // pass
 
     }
 
     @Override
     public String[] fileList() {
-        // TODO Auto-generated method stub
+        // pass
         return null;
     }
 
     @Override
     public AssetManager getAssets() {
-        // TODO Auto-generated method stub
+        // pass
         return null;
     }
 
     @Override
     public File getCacheDir() {
-        // TODO Auto-generated method stub
+        // pass
         return null;
     }
 
     @Override
     public File getExternalCacheDir() {
-        // TODO Auto-generated method stub
+        // pass
         return null;
     }
 
@@ -1032,49 +1011,49 @@
 
     @Override
     public File getDatabasePath(String arg0) {
-        // TODO Auto-generated method stub
+        // pass
         return null;
     }
 
     @Override
     public File getDir(String arg0, int arg1) {
-        // TODO Auto-generated method stub
+        // pass
         return null;
     }
 
     @Override
     public File getFileStreamPath(String arg0) {
-        // TODO Auto-generated method stub
+        // pass
         return null;
     }
 
     @Override
     public File getFilesDir() {
-        // TODO Auto-generated method stub
+        // pass
         return null;
     }
 
     @Override
     public File getExternalFilesDir(String type) {
-        // TODO Auto-generated method stub
+        // pass
         return null;
     }
 
     @Override
     public String getPackageCodePath() {
-        // TODO Auto-generated method stub
+        // pass
         return null;
     }
 
     @Override
     public PackageManager getPackageManager() {
-        // TODO Auto-generated method stub
+        // pass
         return null;
     }
 
     @Override
     public String getPackageName() {
-        // TODO Auto-generated method stub
+        // pass
         return null;
     }
 
@@ -1085,25 +1064,25 @@
 
     @Override
     public String getPackageResourcePath() {
-        // TODO Auto-generated method stub
+        // pass
         return null;
     }
 
     @Override
     public File getSharedPrefsFile(String name) {
-        // TODO Auto-generated method stub
+        // pass
         return null;
     }
 
     @Override
     public SharedPreferences getSharedPreferences(String arg0, int arg1) {
-        // TODO Auto-generated method stub
+        // pass
         return null;
     }
 
     @Override
     public Drawable getWallpaper() {
-        // TODO Auto-generated method stub
+        // pass
         return null;
     }
 
@@ -1119,81 +1098,81 @@
 
     @Override
     public void grantUriPermission(String arg0, Uri arg1, int arg2) {
-        // TODO Auto-generated method stub
+        // pass
 
     }
 
     @Override
     public FileInputStream openFileInput(String arg0) throws FileNotFoundException {
-        // TODO Auto-generated method stub
+        // pass
         return null;
     }
 
     @Override
     public FileOutputStream openFileOutput(String arg0, int arg1) throws FileNotFoundException {
-        // TODO Auto-generated method stub
+        // pass
         return null;
     }
 
     @Override
     public SQLiteDatabase openOrCreateDatabase(String arg0, int arg1, CursorFactory arg2) {
-        // TODO Auto-generated method stub
+        // pass
         return null;
     }
 
     @Override
     public SQLiteDatabase openOrCreateDatabase(String arg0, int arg1,
             CursorFactory arg2, DatabaseErrorHandler arg3) {
-        // TODO Auto-generated method stub
+        // pass
         return null;
     }
 
     @Override
     public Drawable peekWallpaper() {
-        // TODO Auto-generated method stub
+        // pass
         return null;
     }
 
     @Override
     public Intent registerReceiver(BroadcastReceiver arg0, IntentFilter arg1) {
-        // TODO Auto-generated method stub
+        // pass
         return null;
     }
 
     @Override
     public Intent registerReceiver(BroadcastReceiver arg0, IntentFilter arg1,
             String arg2, Handler arg3) {
-        // TODO Auto-generated method stub
+        // pass
         return null;
     }
 
     @Override
     public void removeStickyBroadcast(Intent arg0) {
-        // TODO Auto-generated method stub
+        // pass
 
     }
 
     @Override
     public void revokeUriPermission(Uri arg0, int arg1) {
-        // TODO Auto-generated method stub
+        // pass
 
     }
 
     @Override
     public void sendBroadcast(Intent arg0) {
-        // TODO Auto-generated method stub
+        // pass
 
     }
 
     @Override
     public void sendBroadcast(Intent arg0, String arg1) {
-        // TODO Auto-generated method stub
+        // pass
 
     }
 
     @Override
     public void sendOrderedBroadcast(Intent arg0, String arg1) {
-        // TODO Auto-generated method stub
+        // pass
 
     }
 
@@ -1201,13 +1180,13 @@
     public void sendOrderedBroadcast(Intent arg0, String arg1,
             BroadcastReceiver arg2, Handler arg3, int arg4, String arg5,
             Bundle arg6) {
-        // TODO Auto-generated method stub
+        // pass
 
     }
 
     @Override
     public void sendStickyBroadcast(Intent arg0) {
-        // TODO Auto-generated method stub
+        // pass
 
     }
 
@@ -1215,79 +1194,79 @@
     public void sendStickyOrderedBroadcast(Intent intent,
             BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, String initialData,
            Bundle initialExtras) {
-        // TODO Auto-generated method stub
+        // pass
     }
 
     @Override
     public void setTheme(int arg0) {
-        // TODO Auto-generated method stub
+        // pass
 
     }
 
     @Override
     public void setWallpaper(Bitmap arg0) throws IOException {
-        // TODO Auto-generated method stub
+        // pass
 
     }
 
     @Override
     public void setWallpaper(InputStream arg0) throws IOException {
-        // TODO Auto-generated method stub
+        // pass
 
     }
 
     @Override
     public void startActivity(Intent arg0) {
-        // TODO Auto-generated method stub
+        // pass
     }
 
     @Override
     public void startActivity(Intent arg0, Bundle arg1) {
-        // TODO Auto-generated method stub
+        // pass
     }
 
     @Override
     public void startIntentSender(IntentSender intent,
             Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags)
             throws IntentSender.SendIntentException {
-        // TODO Auto-generated method stub
+        // pass
     }
 
     @Override
     public void startIntentSender(IntentSender intent,
             Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags,
             Bundle options) throws IntentSender.SendIntentException {
-        // TODO Auto-generated method stub
+        // pass
     }
 
     @Override
     public boolean startInstrumentation(ComponentName arg0, String arg1,
             Bundle arg2) {
-        // TODO Auto-generated method stub
+        // pass
         return false;
     }
 
     @Override
     public ComponentName startService(Intent arg0) {
-        // TODO Auto-generated method stub
+        // pass
         return null;
     }
 
     @Override
     public boolean stopService(Intent arg0) {
-        // TODO Auto-generated method stub
+        // pass
         return false;
     }
 
     @Override
     public void unbindService(ServiceConnection arg0) {
-        // TODO Auto-generated method stub
+        // pass
 
     }
 
     @Override
     public void unregisterReceiver(BroadcastReceiver arg0) {
-        // TODO Auto-generated method stub
+        // pass
 
     }
 
@@ -1298,13 +1277,13 @@
 
     @Override
     public void startActivities(Intent[] arg0) {
-        // TODO Auto-generated method stub
+        // pass
 
     }
 
     @Override
     public void startActivities(Intent[] arg0, Bundle arg1) {
-        // TODO Auto-generated method stub
+        // pass
 
     }