Merge "Fix cast to String[] in FullBackupAgent"
diff --git a/api/current.xml b/api/current.xml
index f2f59e7d..eb1c6d6 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -5960,6 +5960,17 @@
  visibility="public"
 >
 </field>
+<field name="overscrollMode"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16843450"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="padding"
  type="int"
  transient="false"
@@ -9066,7 +9077,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843450"
+ value="16843449"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -150327,9 +150338,9 @@
 </parameter>
 <parameter name="align" type="android.text.Layout.Alignment">
 </parameter>
-<parameter name="spacingmult" type="float">
+<parameter name="spacingMult" type="float">
 </parameter>
-<parameter name="spacingadd" type="float">
+<parameter name="spacingAdd" type="float">
 </parameter>
 </constructor>
 <method name="draw"
@@ -150359,7 +150370,7 @@
 </parameter>
 <parameter name="highlight" type="android.graphics.Path">
 </parameter>
-<parameter name="highlightpaint" type="android.graphics.Paint">
+<parameter name="highlightPaint" type="android.graphics.Paint">
 </parameter>
 <parameter name="cursorOffsetVertical" type="int">
 </parameter>
diff --git a/core/java/android/server/BluetoothService.java b/core/java/android/server/BluetoothService.java
index dfb775f..aa20ac4 100644
--- a/core/java/android/server/BluetoothService.java
+++ b/core/java/android/server/BluetoothService.java
@@ -136,6 +136,14 @@
             }
             return false;
         }
+
+        @Override
+        public int hashCode() {
+            int hash = 1;
+            hash = hash * 31 + (address == null ? 0 : address.hashCode());
+            hash = hash * 31 + (uuid == null ? 0 : uuid.hashCode());
+            return hash;
+        }
     }
 
     static {
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 57fdd8b..e5db120 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -1504,6 +1504,31 @@
      * @hide
      */
     private static final int PREPRESSED             = 0x02000000;
+    
+    /**
+     * Always allow a user to overscroll this view, provided it is a
+     * view that can scroll.
+     */
+    private static final int OVERSCROLL_ALWAYS = 0;
+    
+    /**
+     * Allow a user to overscroll this view only if the content is large
+     * enough to meaningfully scroll, provided it is a view that can scroll.
+     */
+    private static final int OVERSCROLL_IF_CONTENT_SCROLLS = 1;
+    
+    /**
+     * Never allow a user to overscroll this view.
+     */
+    private static final int OVERSCROLL_NEVER = 2;
+    
+    /**
+     * Controls the overscroll mode for this view.
+     * See {@link #overscrollBy(int, int, int, int, int, int, int, int)},
+     * {@link #OVERSCROLL_ALWAYS}, {@link #OVERSCROLL_IF_CONTENT_SCROLLS},
+     * and {@link #OVERSCROLL_NEVER}.
+     */
+    private int mOverscrollMode = OVERSCROLL_ALWAYS;
 
     /**
      * The parent this view is attached to.
@@ -2053,6 +2078,9 @@
                         });
                     }
                     break;
+                case R.styleable.View_overscrollMode:
+                    mOverscrollMode = a.getInt(attr, OVERSCROLL_ALWAYS);
+                    break;
             }
         }
 
@@ -8573,43 +8601,59 @@
             int scrollX, int scrollY,
             int scrollRangeX, int scrollRangeY,
             int maxOverscrollX, int maxOverscrollY) {
-        // Scale the scroll amount if we're in the dropoff zone
-        final int dropoffX = maxOverscrollX / 2;
-        final int dropoffLeft = -dropoffX;
-        final int dropoffRight = dropoffX + scrollRangeX;
-        int newScrollX;
-        if ((scrollX < dropoffLeft && deltaX < 0) ||
-                (scrollX > dropoffRight && deltaX > 0)) {
-            newScrollX = scrollX + deltaX / 2;
-        } else {
-            newScrollX = scrollX + deltaX;
-            if (newScrollX > dropoffRight && deltaX > 0) {
-                int extra = newScrollX - dropoffRight;
-                newScrollX = dropoffRight + extra / 2;
-            } else if (newScrollX < dropoffLeft && deltaX < 0) {
-                int extra = newScrollX - dropoffLeft;
-                newScrollX = dropoffLeft + extra / 2;
-            }
-        }
+        final int overscrollMode = mOverscrollMode;
+        final boolean canScrollHorizontal = 
+                computeHorizontalScrollRange() > computeHorizontalScrollExtent();
+        final boolean canScrollVertical = 
+                computeVerticalScrollRange() > computeVerticalScrollExtent();
+        final boolean overscrollHorizontal = overscrollMode == OVERSCROLL_ALWAYS ||
+                (overscrollMode == OVERSCROLL_IF_CONTENT_SCROLLS && canScrollHorizontal);
+        final boolean overscrollVertical = overscrollMode == OVERSCROLL_ALWAYS ||
+                (overscrollMode == OVERSCROLL_IF_CONTENT_SCROLLS && canScrollVertical);
         
-        final int dropoffY = maxOverscrollY / 2;
-        final int dropoffTop = -dropoffY;
-        final int dropoffBottom = dropoffY + scrollRangeY;
-        int newScrollY;
-        if ((scrollY < dropoffTop && deltaY < 0) ||
-                (scrollY > dropoffBottom && deltaY > 0)) {
-            newScrollY = scrollY + deltaY / 2;
-        } else {
-            newScrollY = scrollY + deltaY;
-            if (newScrollY > dropoffBottom && deltaY > 0) {
-                int extra = newScrollY - dropoffBottom;
-                newScrollY = dropoffBottom + extra / 2;
-            } else if (newScrollY < dropoffTop && deltaY < 0) {
-                int extra = newScrollY - dropoffTop;
-                newScrollY = dropoffTop + extra / 2;
+        int newScrollX = scrollX + deltaX;
+        if (overscrollHorizontal) {
+            // Scale the scroll amount if we're in the dropoff zone
+            final int dropoffX = maxOverscrollX / 2;
+            final int dropoffLeft = -dropoffX;
+            final int dropoffRight = dropoffX + scrollRangeX;
+            if ((scrollX < dropoffLeft && deltaX < 0) ||
+                    (scrollX > dropoffRight && deltaX > 0)) {
+                newScrollX = scrollX + deltaX / 2;
+            } else {
+                if (newScrollX > dropoffRight && deltaX > 0) {
+                    int extra = newScrollX - dropoffRight;
+                    newScrollX = dropoffRight + extra / 2;
+                } else if (newScrollX < dropoffLeft && deltaX < 0) {
+                    int extra = newScrollX - dropoffLeft;
+                    newScrollX = dropoffLeft + extra / 2;
+                }
             }
+        } else {
+            maxOverscrollX = 0;
         }
 
+        int newScrollY = scrollY + deltaY;
+        if (overscrollVertical) {
+            final int dropoffY = maxOverscrollY / 2;
+            final int dropoffTop = -dropoffY;
+            final int dropoffBottom = dropoffY + scrollRangeY;
+            if ((scrollY < dropoffTop && deltaY < 0) ||
+                    (scrollY > dropoffBottom && deltaY > 0)) {
+                newScrollY = scrollY + deltaY / 2;
+            } else {
+                if (newScrollY > dropoffBottom && deltaY > 0) {
+                    int extra = newScrollY - dropoffBottom;
+                    newScrollY = dropoffBottom + extra / 2;
+                } else if (newScrollY < dropoffTop && deltaY < 0) {
+                    int extra = newScrollY - dropoffTop;
+                    newScrollY = dropoffTop + extra / 2;
+                }
+            }
+        } else {
+            maxOverscrollY = 0;
+        }
+        
         // Clamp values if at the limits and record
         final int left = -maxOverscrollX;
         final int right = maxOverscrollX + scrollRangeX;
@@ -8636,8 +8680,8 @@
         
         // Bump the device with some haptic feedback if we're at the edge
         // and didn't start there.
-        if ((clampedX && scrollX != left && scrollX != right) ||
-                (clampedY && scrollY != top && scrollY != bottom)) {
+        if ((overscrollHorizontal && clampedX && scrollX != left && scrollX != right) ||
+                (overscrollVertical && clampedY && scrollY != top && scrollY != bottom)) {
             performHapticFeedback(HapticFeedbackConstants.SCROLL_BARRIER);
         }
 
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index acb64aa..9672892 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -1102,7 +1102,7 @@
      * methods may be called on a WebView after destroy.
      */
     public void destroy() {
-        clearTextEntry();
+        clearTextEntry(false);
         if (mWebViewCore != null) {
             // Set the handlers to null before destroying WebViewCore so no
             // more messages will be posted.
@@ -1388,7 +1388,7 @@
         arg.mUrl = url;
         arg.mExtraHeaders = extraHeaders;
         mWebViewCore.sendMessage(EventHub.LOAD_URL, arg);
-        clearTextEntry();
+        clearTextEntry(false);
     }
 
     /**
@@ -1417,7 +1417,7 @@
             arg.mUrl = url;
             arg.mPostData = postData;
             mWebViewCore.sendMessage(EventHub.POST_URL, arg);
-            clearTextEntry();
+            clearTextEntry(false);
         } else {
             loadUrl(url);
         }
@@ -1473,7 +1473,7 @@
         arg.mEncoding = encoding;
         arg.mFailUrl = failUrl;
         mWebViewCore.sendMessage(EventHub.LOAD_DATA, arg);
-        clearTextEntry();
+        clearTextEntry(false);
     }
 
     /**
@@ -1490,7 +1490,7 @@
      * Reload the current url.
      */
     public void reload() {
-        clearTextEntry();
+        clearTextEntry(false);
         switchOutDrawHistory();
         mWebViewCore.sendMessage(EventHub.RELOAD);
     }
@@ -1577,7 +1577,7 @@
         // null, and that will be the case
         mCertificate = null;
         if (steps != 0) {
-            clearTextEntry();
+            clearTextEntry(false);
             mWebViewCore.sendMessage(EventHub.GO_BACK_FORWARD, steps,
                     ignoreSnapshot ? 1 : 0);
         }
@@ -1677,9 +1677,17 @@
                 && mWebTextView.hasFocus();
     }
 
-    private void clearTextEntry() {
+    /**
+     * Remove the WebTextView.
+     * @param disableFocusController If true, send a message to webkit
+     *     disabling the focus controller, so the caret stops blinking.
+     */
+    private void clearTextEntry(boolean disableFocusController) {
         if (inEditingMode()) {
             mWebTextView.remove();
+            if (disableFocusController) {
+                setFocusControllerInactive();
+            }
         }
     }
 
@@ -1713,7 +1721,7 @@
             Log.w(LOGTAG, "This WebView doesn't support zoom.");
             return;
         }
-        clearTextEntry();
+        clearTextEntry(false);
         if (getSettings().getBuiltInZoomControls()) {
             mZoomButtonsController.setVisible(true);
         } else {
@@ -3759,6 +3767,7 @@
                 }
                 return true;
             }
+            clearTextEntry(true);
             nativeSetFollowedLink(true);
             if (!mCallbackProxy.uiOverrideUrlLoading(nativeCursorText())) {
                 mWebViewCore.sendMessage(EventHub.CLICK, data.mFrame,
@@ -3839,7 +3848,7 @@
 
     @Override
     protected void onDetachedFromWindow() {
-        clearTextEntry();
+        clearTextEntry(false);
         super.onDetachedFromWindow();
         // Clean up the zoom controller
         mZoomButtonsController.setVisible(false);
@@ -5826,7 +5835,7 @@
                         // 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();
+                        clearTextEntry(false);
                         // update the zoom buttons as the scale can be changed
                         if (getSettings().getBuiltInZoomControls()) {
                             updateZoomButtonsEnabled();
@@ -5948,7 +5957,7 @@
                     }
                     break;
                 case CLEAR_TEXT_ENTRY:
-                    clearTextEntry();
+                    clearTextEntry(false);
                     break;
                 case INVAL_RECT_MSG_ID: {
                     Rect r = (Rect)msg.obj;
@@ -6555,8 +6564,7 @@
      */
     private void sendMoveMouseIfLatest(boolean removeFocus) {
         if (removeFocus) {
-            clearTextEntry();
-            setFocusControllerInactive();
+            clearTextEntry(true);
         }
         mWebViewCore.sendMessage(EventHub.SET_MOVE_MOUSE_IF_LATEST,
                 cursorData());
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index 4c77bdc..254efe7 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -2589,7 +2589,8 @@
                 if (trackMotionScroll(delta, delta)) {
                     if (motionView != null) {
                         // Tweak the scroll for how far we overshot
-                        mScrollY -= delta - (motionView.getTop() - oldTop);
+                        int overshoot = -(delta - (motionView.getTop() - oldTop));
+                        overscrollBy(0, overshoot, 0, mScrollY, 0, 0, 0, getOverscrollMax());
                     }
                     float vel = scroller.getCurrVelocity();
                     if (delta > 0) {
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index 0f6a5c1..ff93984 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -1307,6 +1307,19 @@
              <code>public void sayHello(View v)</code> method of your context
              (typically, your Activity). -->
         <attr name="onClick" format="string" />
+
+        <!-- Defines overscrolling behavior. This property is used only if the
+             View is scrollable. Overscrolling is the ability for the user to
+             scroll a View beyond its content boundaries into empty space. -->
+        <attr name="overscrollMode">
+            <!-- Always allow the user to overscroll the content. -->
+            <enum name="always" value="0" />
+            <!-- Only allow the user to overscroll content if the content is large
+                 enough to meaningfully scroll. -->
+            <enum name="ifContentScrolls" value="1" />
+            <!-- Never overscroll. -->
+            <enum name="never" value="2" />
+        </attr>
     </declare-styleable>
 
     <!-- Attributes that can be used with a {@link android.view.ViewGroup} or any
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index 82c02eb5..b334337 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -1230,6 +1230,7 @@
   <public type="attr" name="installLocation" id="0x010102b7" />
   <public type="attr" name="safeMode" id="0x010102b8" />
   <public type="attr" name="webTextViewStyle" id="0x010102b9" />
+  <public type="attr" name="overscrollMode" id="0x010102ba" />
 
   <public type="anim" name="cycle_interpolator" id="0x010a000c" />
     
diff --git a/services/java/com/android/server/DockObserver.java b/services/java/com/android/server/DockObserver.java
index d28047500..f0bab81 100644
--- a/services/java/com/android/server/DockObserver.java
+++ b/services/java/com/android/server/DockObserver.java
@@ -18,10 +18,12 @@
 
 import android.app.Activity;
 import android.app.ActivityManagerNative;
+import android.app.AlarmManager;
 import android.app.IActivityManager;
 import android.app.IUiModeManager;
 import android.app.KeyguardManager;
 import android.app.StatusBarManager;
+import android.app.PendingIntent;
 import android.bluetooth.BluetoothAdapter;
 import android.bluetooth.BluetoothDevice;
 import android.content.ActivityNotFoundException;
@@ -29,11 +31,18 @@
 import android.content.ContentResolver;
 import android.content.Context;
 import android.content.Intent;
+import android.content.IntentFilter;
 import android.content.res.Configuration;
+import android.location.Criteria;
+import android.location.Location;
+import android.location.LocationListener;
+import android.location.LocationManager;
+import android.location.LocationProvider;
 import android.os.Binder;
 import android.media.Ringtone;
 import android.media.RingtoneManager;
 import android.net.Uri;
+import android.os.Bundle;
 import android.os.Handler;
 import android.os.Message;
 import android.os.RemoteException;
@@ -42,6 +51,8 @@
 import android.os.UEventObserver;
 import android.provider.Settings;
 import android.server.BluetoothService;
+import android.text.format.DateUtils;
+import android.text.format.Time;
 import android.util.Log;
 
 import com.android.internal.widget.LockPatternUtils;
@@ -59,10 +70,26 @@
     private static final String DOCK_UEVENT_MATCH = "DEVPATH=/devices/virtual/switch/dock";
     private static final String DOCK_STATE_PATH = "/sys/class/switch/dock/state";
 
+    private static final String KEY_LAST_UPDATE_INTERVAL = "LAST_UPDATE_INTERVAL";
+
+    private static final int MSG_DOCK_STATE = 0;
+    private static final int MSG_UPDATE_TWILIGHT = 1;
+    private static final int MSG_ENABLE_LOCATION_UPDATES = 2;
+
     public static final int MODE_NIGHT_AUTO = Configuration.UI_MODE_NIGHT_MASK >> 4;
     public static final int MODE_NIGHT_NO = Configuration.UI_MODE_NIGHT_NO >> 4;
     public static final int MODE_NIGHT_YES = Configuration.UI_MODE_NIGHT_YES >> 4;
 
+    private static final long LOCATION_UPDATE_MS = 30 * DateUtils.MINUTE_IN_MILLIS;
+    private static final float LOCATION_UPDATE_DISTANCE_METER = 1000 * 20;
+    private static final long LOCATION_UPDATE_ENABLE_INTERVAL_MIN = 5000;
+    private static final long LOCATION_UPDATE_ENABLE_INTERVAL_MAX = 5 * DateUtils.MINUTE_IN_MILLIS;
+    // velocity for estimating a potential movement: 150km/h
+    private static final float MAX_VELOCITY_M_MS = 150 / 3600;
+    private static final double FACTOR_GMT_OFFSET_LONGITUDE = 1000.0 * 360.0 / DateUtils.DAY_IN_MILLIS;
+
+    private static final String ACTION_UPDATE_NIGHT_MODE = "com.android.server.action.UPDATE_NIGHT_MODE";
+
     private int mDockState = Intent.EXTRA_DOCK_STATE_UNDOCKED;
     private int mPreviousDockState = Intent.EXTRA_DOCK_STATE_UNDOCKED;
 
@@ -79,7 +106,11 @@
     private boolean mKeyguardDisabled;
     private LockPatternUtils mLockPatternUtils;
 
-    private StatusBarManager mStatusBarManager;    
+    private AlarmManager mAlarmManager;
+
+    private LocationManager mLocationManager;
+    private Location mLocation;
+    private StatusBarManager mStatusBarManager;
 
     // The broadcast receiver which receives the result of the ordered broadcast sent when
     // the dock state changes. The original ordered broadcast is sent with an initial result
@@ -115,6 +146,81 @@
         }
     };
 
+    private final BroadcastReceiver mTwilightUpdateReceiver = new BroadcastReceiver() {
+        @Override
+        public void onReceive(Context context, Intent intent) {
+            if (mCarModeEnabled && mNightMode == MODE_NIGHT_AUTO) {
+                mHandler.sendEmptyMessage(MSG_UPDATE_TWILIGHT);
+            }
+        }
+    };
+
+    private final LocationListener mLocationListener = new LocationListener() {
+
+        public void onLocationChanged(Location location) {
+            updateLocation(location);
+        }
+
+        public void onProviderDisabled(String provider) {
+        }
+
+        public void onProviderEnabled(String provider) {
+        }
+
+        public void onStatusChanged(String provider, int status, Bundle extras) {
+            // If the network location is no longer available check for a GPS fix
+            // and try to update the location.
+            if (provider == LocationManager.NETWORK_PROVIDER &&
+                    status != LocationProvider.AVAILABLE) {
+                updateLocation(mLocation);
+            }
+        }
+
+        private void updateLocation(Location location) {
+            location = DockObserver.chooseBestLocation(location,
+                    mLocationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER));
+            if (hasMoved(location)) {
+                synchronized (this) {
+                    mLocation = location;
+                }
+                if (mCarModeEnabled && mNightMode == MODE_NIGHT_AUTO) {
+                    mHandler.sendEmptyMessage(MSG_UPDATE_TWILIGHT);
+                }
+            }
+        }
+
+        /*
+         * The user has moved if the accuracy circles of the two locations
+         * don't overlap.
+         */
+        private boolean hasMoved(Location location) {
+            if (location == null) {
+                return false;
+            }
+            if (mLocation == null) {
+                return true;
+            }
+
+            /* if new location is older than the current one, the devices hasn't
+             * moved.
+             */
+            if (location.getTime() < mLocation.getTime()) {
+                return false;
+            }
+
+            /* Get the distance between the two points */
+            float distance = mLocation.distanceTo(location);
+
+            /* Get the total accuracy radius for both locations */
+            float totalAccuracy = mLocation.getAccuracy() + location.getAccuracy();
+
+            /* If the distance is greater than the combined accuracy of the two
+             * points then they can't overlap and hence the user has moved.
+             */
+            return distance > totalAccuracy;
+        }
+    };
+
     public DockObserver(Context context, PowerManagerService pm) {
         mContext = context;
         mPowerManager = pm;
@@ -123,6 +229,13 @@
 
         ServiceManager.addService("uimode", mBinder);
 
+        mAlarmManager =
+            (AlarmManager)mContext.getSystemService(Context.ALARM_SERVICE);
+        mLocationManager =
+            (LocationManager)mContext.getSystemService(Context.LOCATION_SERVICE);
+        mContext.registerReceiver(mTwilightUpdateReceiver,
+                new IntentFilter(ACTION_UPDATE_NIGHT_MODE));
+
         startObserving(DOCK_UEVENT_MATCH);
     }
 
@@ -190,83 +303,161 @@
                 update();
             }
             mSystemReady = true;
+            mHandler.sendEmptyMessage(MSG_ENABLE_LOCATION_UPDATES);
         }
     }
 
     private final void update() {
-        mHandler.sendEmptyMessage(0);
+        mHandler.sendEmptyMessage(MSG_DOCK_STATE);
     }
 
     private final Handler mHandler = new Handler() {
         @Override
         public void handleMessage(Message msg) {
-            synchronized (this) {
-                Log.i(TAG, "Dock state changed: " + mDockState);
+            switch (msg.what) {
+                case MSG_DOCK_STATE:
+                    synchronized (this) {
+                        Log.i(TAG, "Dock state changed: " + mDockState);
 
-                final ContentResolver cr = mContext.getContentResolver();
+                        final ContentResolver cr = mContext.getContentResolver();
 
-                if (Settings.Secure.getInt(cr,
-                        Settings.Secure.DEVICE_PROVISIONED, 0) == 0) {
-                    Log.i(TAG, "Device not provisioned, skipping dock broadcast");
-                    return;
-                }
-                // Pack up the values and broadcast them to everyone
-                Intent intent = new Intent(Intent.ACTION_DOCK_EVENT);
-                intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
-                if (mCarModeEnabled && mDockState != Intent.EXTRA_DOCK_STATE_CAR) {
-                    // Pretend to be in DOCK_STATE_CAR.
-                    intent.putExtra(Intent.EXTRA_DOCK_STATE, Intent.EXTRA_DOCK_STATE_CAR);
-                } else {
-                    intent.putExtra(Intent.EXTRA_DOCK_STATE, mDockState);
-                }
-                intent.putExtra(Intent.EXTRA_CAR_MODE_ENABLED, mCarModeEnabled);
-
-                // Check if this is Bluetooth Dock
-                String address = BluetoothService.readDockBluetoothAddress();
-                if (address != null)
-                    intent.putExtra(BluetoothDevice.EXTRA_DEVICE,
-                            BluetoothAdapter.getDefaultAdapter().getRemoteDevice(address));
-
-                // User feedback to confirm dock connection. Particularly
-                // useful for flaky contact pins...
-                if (Settings.System.getInt(cr,
-                        Settings.System.DOCK_SOUNDS_ENABLED, 1) == 1)
-                {
-                    String whichSound = null;
-                    if (mDockState == Intent.EXTRA_DOCK_STATE_UNDOCKED) {
-                        if (mPreviousDockState == Intent.EXTRA_DOCK_STATE_DESK) {
-                            whichSound = Settings.System.DESK_UNDOCK_SOUND;
-                        } else if (mPreviousDockState == Intent.EXTRA_DOCK_STATE_CAR) {
-                            whichSound = Settings.System.CAR_UNDOCK_SOUND;
+                        if (Settings.Secure.getInt(cr,
+                                Settings.Secure.DEVICE_PROVISIONED, 0) == 0) {
+                            Log.i(TAG, "Device not provisioned, skipping dock broadcast");
+                            return;
                         }
-                    } else {
-                        if (mDockState == Intent.EXTRA_DOCK_STATE_DESK) {
-                            whichSound = Settings.System.DESK_DOCK_SOUND;
-                        } else if (mDockState == Intent.EXTRA_DOCK_STATE_CAR) {
-                            whichSound = Settings.System.CAR_DOCK_SOUND;
+                        // Pack up the values and broadcast them to everyone
+                        Intent intent = new Intent(Intent.ACTION_DOCK_EVENT);
+                        intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
+                        if (mCarModeEnabled && mDockState != Intent.EXTRA_DOCK_STATE_CAR) {
+                            // Pretend to be in DOCK_STATE_CAR.
+                            intent.putExtra(Intent.EXTRA_DOCK_STATE, Intent.EXTRA_DOCK_STATE_CAR);
+                        } else {
+                            intent.putExtra(Intent.EXTRA_DOCK_STATE, mDockState);
                         }
+                        intent.putExtra(Intent.EXTRA_CAR_MODE_ENABLED, mCarModeEnabled);
+
+                        // Check if this is Bluetooth Dock
+                        String address = BluetoothService.readDockBluetoothAddress();
+                        if (address != null)
+                            intent.putExtra(BluetoothDevice.EXTRA_DEVICE,
+                                    BluetoothAdapter.getDefaultAdapter().getRemoteDevice(address));
+
+                        // User feedback to confirm dock connection. Particularly
+                        // useful for flaky contact pins...
+                        if (Settings.System.getInt(cr,
+                                Settings.System.DOCK_SOUNDS_ENABLED, 1) == 1)
+                        {
+                            String whichSound = null;
+                            if (mDockState == Intent.EXTRA_DOCK_STATE_UNDOCKED) {
+                                if (mPreviousDockState == Intent.EXTRA_DOCK_STATE_DESK) {
+                                    whichSound = Settings.System.DESK_UNDOCK_SOUND;
+                                } else if (mPreviousDockState == Intent.EXTRA_DOCK_STATE_CAR) {
+                                    whichSound = Settings.System.CAR_UNDOCK_SOUND;
+                                }
+                            } else {
+                                if (mDockState == Intent.EXTRA_DOCK_STATE_DESK) {
+                                    whichSound = Settings.System.DESK_DOCK_SOUND;
+                                } else if (mDockState == Intent.EXTRA_DOCK_STATE_CAR) {
+                                    whichSound = Settings.System.CAR_DOCK_SOUND;
+                                }
+                            }
+
+                            if (whichSound != null) {
+                                final String soundPath = Settings.System.getString(cr, whichSound);
+                                if (soundPath != null) {
+                                    final Uri soundUri = Uri.parse("file://" + soundPath);
+                                    if (soundUri != null) {
+                                        final Ringtone sfx = RingtoneManager.getRingtone(mContext, soundUri);
+                                        if (sfx != null) sfx.play();
+                                    }
+                                }
+                            }
+                        }
+
+                        // Send the ordered broadcast; the result receiver will receive after all
+                        // broadcasts have been sent. If any broadcast receiver changes the result
+                        // code from the initial value of RESULT_OK, then the result receiver will
+                        // not launch the corresponding dock application. This gives apps a chance
+                        // to override the behavior and stay in their app even when the device is
+                        // placed into a dock.
+                        mContext.sendStickyOrderedBroadcast(
+                                intent, mResultReceiver, null, Activity.RESULT_OK, null, null);
+
                     }
-
-                    if (whichSound != null) {
-                        final String soundPath = Settings.System.getString(cr, whichSound);
-                        if (soundPath != null) {
-                            final Uri soundUri = Uri.parse("file://" + soundPath);
-                            if (soundUri != null) {
-                                final Ringtone sfx = RingtoneManager.getRingtone(mContext, soundUri);
-                                if (sfx != null) sfx.play();
+                    break;
+                case MSG_UPDATE_TWILIGHT:
+                    synchronized (this) {
+                        if (mCarModeEnabled && mLocation != null && mNightMode == MODE_NIGHT_AUTO) {
+                            try {
+                                DockObserver.this.updateTwilight();
+                            } catch (RemoteException e) {
+                                Log.w(TAG, "Unable to change night mode.", e);
                             }
                         }
                     }
-                }
+                    break;
+                case MSG_ENABLE_LOCATION_UPDATES:
+                    if (mLocationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) {
+                        mLocationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER,
+                                LOCATION_UPDATE_MS, LOCATION_UPDATE_DISTANCE_METER, mLocationListener);
+                        retrieveLocation();
+                        if (mLocation != null) {
+                            try {
+                                DockObserver.this.updateTwilight();
+                            } catch (RemoteException e) {
+                                Log.w(TAG, "Unable to change night mode.", e);
+                            }
+                        }
+                    } else {
+                        long interval = msg.getData().getLong(KEY_LAST_UPDATE_INTERVAL);
+                        interval *= 1.5;
+                        if (interval == 0) {
+                            interval = LOCATION_UPDATE_ENABLE_INTERVAL_MIN;
+                        } else if (interval > LOCATION_UPDATE_ENABLE_INTERVAL_MAX) {
+                            interval = LOCATION_UPDATE_ENABLE_INTERVAL_MAX;
+                        }
+                        Bundle bundle = new Bundle();
+                        bundle.putLong(KEY_LAST_UPDATE_INTERVAL, interval);
+                        Message newMsg = mHandler.obtainMessage(MSG_ENABLE_LOCATION_UPDATES);
+                        newMsg.setData(bundle);
+                        mHandler.sendMessageDelayed(newMsg, interval);
+                    }
+                    break;
+            }
+        }
 
-                // Send the ordered broadcast; the result receiver will receive after all
-                // broadcasts have been sent. If any broadcast receiver changes the result
-                // code from the initial value of RESULT_OK, then the result receiver will
-                // not launch the corresponding dock application. This gives apps a chance
-                // to override the behavior and stay in their app even when the device is
-                // placed into a dock.
-                mContext.sendStickyOrderedBroadcast(
-                        intent, mResultReceiver, null, Activity.RESULT_OK, null, null);
+        private void retrieveLocation() {
+            final Location gpsLocation =
+                mLocationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
+            Location location;
+            Criteria criteria = new Criteria();
+            criteria.setSpeedRequired(false);
+            criteria.setAltitudeRequired(false);
+            criteria.setBearingRequired(false);
+            final String bestProvider = mLocationManager.getBestProvider(criteria, true);
+            if (LocationManager.GPS_PROVIDER.equals(bestProvider)) {
+                location = gpsLocation;
+            } else {
+                location = DockObserver.chooseBestLocation(gpsLocation,
+                        mLocationManager.getLastKnownLocation(bestProvider));
+            }
+            // In the case there is no location available (e.g. GPS fix or network location
+            // is not available yet), the longitude of the location is estimated using the timezone,
+            // latitude and accuracy are set to get a good average.
+            if (location == null) {
+                Time currentTime = new Time();
+                currentTime.set(System.currentTimeMillis());
+                double lngOffset = FACTOR_GMT_OFFSET_LONGITUDE * currentTime.gmtoff
+                        - (currentTime.isDst > 0 ? 3600 : 0);
+                location = new Location("fake");
+                location.setLongitude(lngOffset);
+                location.setLatitude(59.95);
+                location.setAccuracy(417000.0f);
+                location.setTime(System.currentTimeMillis());
+            }
+            synchronized (this) {
+                mLocation = location;
             }
         }
     };
@@ -274,10 +465,15 @@
     private void setCarMode(boolean enabled) throws RemoteException {
         mCarModeEnabled = enabled;
         if (enabled) {
-            setMode(Configuration.UI_MODE_TYPE_CAR, mNightMode);
+            if (mNightMode == MODE_NIGHT_AUTO) {
+                updateTwilight();
+            } else {
+                setMode(Configuration.UI_MODE_TYPE_CAR, mNightMode << 4);
+            }
         } else {
             // Disabling the car mode clears the night mode.
-            setMode(Configuration.UI_MODE_TYPE_NORMAL, MODE_NIGHT_NO);
+            setMode(Configuration.UI_MODE_TYPE_NORMAL,
+                    Configuration.UI_MODE_NIGHT_UNDEFINED);
         }
 
         if (mStatusBarManager == null) {
@@ -290,38 +486,112 @@
         // the status bar should be totally disabled, the calls below will
         // have no effect until the device is unlocked.
         if (mStatusBarManager != null) {
-            mStatusBarManager.disable(enabled 
+            mStatusBarManager.disable(enabled
                 ? StatusBarManager.DISABLE_NOTIFICATION_TICKER
                 : StatusBarManager.DISABLE_NONE);
         }
     }
 
     private void setMode(int modeType, int modeNight) throws RemoteException {
+        long ident = Binder.clearCallingIdentity();
         final IActivityManager am = ActivityManagerNative.getDefault();
         Configuration config = am.getConfiguration();
-
         if (config.uiMode != (modeType | modeNight)) {
             config.uiMode = modeType | modeNight;
-            long ident = Binder.clearCallingIdentity();
             am.updateConfiguration(config);
-            Binder.restoreCallingIdentity(ident);
         }
+        Binder.restoreCallingIdentity(ident);
     }
 
     private void setNightMode(int mode) throws RemoteException {
-        mNightMode = mode;
-        switch (mode) {
-            case MODE_NIGHT_NO:
-            case MODE_NIGHT_YES:
-                setMode(Configuration.UI_MODE_TYPE_CAR, mode << 4);
-                break;
-            case MODE_NIGHT_AUTO:
-                // FIXME: not yet supported, this functionality will be
-                // added in a separate change.
-                break;
-            default:
-                setMode(Configuration.UI_MODE_TYPE_CAR, MODE_NIGHT_NO << 4);
-                break;
+        if (mNightMode != mode) {
+            mNightMode = mode;
+            switch (mode) {
+                case MODE_NIGHT_NO:
+                case MODE_NIGHT_YES:
+                    setMode(Configuration.UI_MODE_TYPE_CAR, mode << 4);
+                    break;
+                case MODE_NIGHT_AUTO:
+                    long ident = Binder.clearCallingIdentity();
+                    updateTwilight();
+                    Binder.restoreCallingIdentity(ident);
+                    break;
+                default:
+                    setMode(Configuration.UI_MODE_TYPE_CAR, MODE_NIGHT_NO << 4);
+                    break;
+            }
+        }
+    }
+
+    private void updateTwilight() throws RemoteException {
+        synchronized (this) {
+            if (mLocation == null) {
+                return;
+            }
+            final long currentTime = System.currentTimeMillis();
+            int nightMode;
+            // calculate current twilight
+            TwilightCalculator tw = new TwilightCalculator();
+            tw.calculateTwilight(currentTime,
+                    mLocation.getLatitude(), mLocation.getLongitude());
+            if (tw.mState == TwilightCalculator.DAY) {
+                nightMode = MODE_NIGHT_NO;
+            } else {
+                nightMode =  MODE_NIGHT_YES;
+            }
+
+            // schedule next update
+            final int mLastTwilightState = tw.mState;
+            // add some extra time to be on the save side.
+            long nextUpdate = DateUtils.MINUTE_IN_MILLIS;
+            if (currentTime > tw.mSunset) {
+                // next update should be on the following day
+                tw.calculateTwilight(currentTime
+                        + DateUtils.DAY_IN_MILLIS, mLocation.getLatitude(),
+                        mLocation.getLongitude());
+            }
+
+            if (mLastTwilightState == TwilightCalculator.NIGHT) {
+                nextUpdate += tw.mSunrise;
+            } else {
+                nextUpdate += tw.mSunset;
+            }
+
+            Intent updateIntent = new Intent(ACTION_UPDATE_NIGHT_MODE);
+            PendingIntent pendingIntent =
+                    PendingIntent.getBroadcast(mContext, 0, updateIntent, 0);
+            mAlarmManager.cancel(pendingIntent);
+            mAlarmManager.set(AlarmManager.RTC_WAKEUP, nextUpdate, pendingIntent);
+
+            // set current mode
+            setMode(Configuration.UI_MODE_TYPE_CAR, nightMode << 4);
+        }
+    }
+
+    /**
+     * Check which of two locations is better by comparing the distance a device
+     * could have cover since the last timestamp of the location.
+     *
+     * @param location first location
+     * @param otherLocation second location
+     * @return one of the two locations
+     */
+    protected static Location chooseBestLocation(Location location, Location otherLocation) {
+        if (location == null) {
+            return otherLocation;
+        }
+        if (otherLocation == null) {
+            return location;
+        }
+        final long currentTime = System.currentTimeMillis();
+        float gpsPotentialMove = MAX_VELOCITY_M_MS * (currentTime - location.getTime())
+                + location.getAccuracy();
+        float otherPotentialMove = MAX_VELOCITY_M_MS * (currentTime - otherLocation.getTime())
+                + otherLocation.getAccuracy();
+        if (gpsPotentialMove < otherPotentialMove) {
+            return location;
+        } else {
+            return otherLocation;
         }
     }
 
diff --git a/services/java/com/android/server/TwilightCalculator.java b/services/java/com/android/server/TwilightCalculator.java
new file mode 100644
index 0000000..a8f67d8
--- /dev/null
+++ b/services/java/com/android/server/TwilightCalculator.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.server;
+
+import android.text.format.DateUtils;
+import android.util.FloatMath;
+
+/** @hide */
+public class TwilightCalculator {
+
+    /** Value of {@link #mState} if it is currently day */
+    public static final int DAY = 0;
+
+    /** Value of {@link #mState} if it is currently night */
+    public static final int NIGHT = 1;
+
+    private static final float DEGREES_TO_RADIANS = (float) (Math.PI / 180.0f);
+
+    // element for calculating solar transit.
+    private static final float J0 = 0.0009f;
+
+    // correction for civil twilight
+    private static final float ALTIDUTE_CORRECTION_CIVIL_TWILIGHT = -0.104719755f;
+
+    // coefficients for calculating Equation of Center.
+    private static final float C1 = 0.0334196f;
+    private static final float C2 = 0.000349066f;
+    private static final float C3 = 0.000005236f;
+
+    private static final float OBLIQUITY = 0.40927971f;
+
+    // Java time on Jan 1, 2000 12:00 UTC.
+    private static final long UTC_2000 = 946728000000L;
+
+    /** Time of sunset (civil twilight) in milliseconds. */
+    public long mSunset;
+
+    /** Time of sunrise (civil twilight) in milliseconds. */
+    public long mSunrise;
+
+    /** Current state */
+    public int mState;
+
+    /**
+     * calculates the civil twilight bases on time and geo-coordinates.
+     *
+     * @param time time in milliseconds.
+     * @param latiude latitude in degrees.
+     * @param longitude latitude in degrees.
+     */
+    public void calculateTwilight(long time, double latiude, double longitude) {
+        final float daysSince2000 = (float) (time - UTC_2000) / DateUtils.DAY_IN_MILLIS;
+
+        // mean anomaly
+        final float meanAnomaly = 6.240059968f + daysSince2000 * 0.01720197f;
+
+        // true anomaly
+        final float trueAnomaly = meanAnomaly + C1 * FloatMath.sin(meanAnomaly) + C2
+                * FloatMath.sin(2 * meanAnomaly) + C3 * FloatMath.sin(3 * meanAnomaly);
+
+        // ecliptic longitude
+        final float solarLng = trueAnomaly + 1.796593063f + (float) Math.PI;
+
+        // solar transit in days since 2000
+        final double arcLongitude = -longitude / 360;
+        float n = Math.round(daysSince2000 - J0 - arcLongitude);
+        double solarTransitJ2000 = n + J0 + arcLongitude + 0.0053f * FloatMath.sin(meanAnomaly)
+                + -0.0069f * FloatMath.sin(2 * solarLng);
+
+        // declination of sun
+        double solarDec = Math.asin(FloatMath.sin(solarLng) * FloatMath.sin(OBLIQUITY));
+
+        final double latRad = latiude * DEGREES_TO_RADIANS;
+        float hourAngle = (float) (Math
+                .acos((FloatMath.sin(ALTIDUTE_CORRECTION_CIVIL_TWILIGHT) - Math.sin(latRad)
+                        * Math.sin(solarDec))
+                        / (Math.cos(latRad) * Math.cos(solarDec))) / (2 * Math.PI));
+
+        mSunset = Math.round((solarTransitJ2000 + hourAngle) * DateUtils.DAY_IN_MILLIS) + UTC_2000;
+        mSunrise = Math.round((solarTransitJ2000 - hourAngle) * DateUtils.DAY_IN_MILLIS) + UTC_2000;
+
+        if (mSunrise < time && mSunset > time) {
+            mState = DAY;
+        } else {
+            mState = NIGHT;
+        }
+    }
+
+}
diff --git a/telephony/java/com/android/internal/telephony/IccUtils.java b/telephony/java/com/android/internal/telephony/IccUtils.java
index 3e7094e..71936f1 100644
--- a/telephony/java/com/android/internal/telephony/IccUtils.java
+++ b/telephony/java/com/android/internal/telephony/IccUtils.java
@@ -397,7 +397,7 @@
         int bits = data[valueIndex++] & 0xFF;
         int colorNumber = data[valueIndex++] & 0xFF;
         int clutOffset = ((data[valueIndex++] & 0xFF) << 8)
-                | data[valueIndex++];
+                | (data[valueIndex++] & 0xFF);
         length = length - 6;
 
         int[] colorIndexArray = getCLUT(data, clutOffset, colorNumber);
diff --git a/tests/DumpRenderTree/src/com/android/dumprendertree/FileFilter.java b/tests/DumpRenderTree/src/com/android/dumprendertree/FileFilter.java
index 8107c3a..4d51356 100644
--- a/tests/DumpRenderTree/src/com/android/dumprendertree/FileFilter.java
+++ b/tests/DumpRenderTree/src/com/android/dumprendertree/FileFilter.java
@@ -81,138 +81,88 @@
         "platform",  // platform specific
         "http/wml",
     };
-        
+
     static final String [] ignoreTestList = {
-        // RegExp is exponatal
-        "fast/regex/test1.html",
-        "fast/regex/slow.html",
-        // RegExp is too large, causing OOM
-        "fast/js/regexp-charclass-crash.html",
-        // The Android browser has no notion of private browsing.
-        "storage/private-browsing-readonly.html",
-        "storage/domstorage/localstorage/private-browsing-affects-storage.html",
-        "storage/domstorage/sessionstorage/private-browsing-affects-storage.html",
-        // Android layout tests are stored in "layout_tests". The following two
-        // tests expect "LayoutTests" in their output.
-        "storage/domstorage/localstorage/iframe-events.html",
-        "storage/domstorage/sessionstorage/iframe-events.html",
-        // We do not support multi touch events.
-        "fast/events/touch/basic-multi-touch-events.html",
-        // below tests (failed or crashes) are filtered out temporarily due to prioritizing
         "editing/selection/move-left-right.html",
+        "fast/events/touch/basic-multi-touch-events.html", // We do not support multi touch events.
+        "fast/js/regexp-charclass-crash.html", // RegExp is too large, causing OOM
+        "fast/regex/test1.html", // RegExp is exponential
+        "fast/regex/slow.html", // RegExp is exponential
+        "storage/domstorage/localstorage/iframe-events.html", // Expects test to be in LayoutTests
+        "storage/domstorage/localstorage/private-browsing-affects-storage.html", // No notion of private browsing.
+        "storage/domstorage/sessionstorage/iframe-events.html", // Expects test to be in LayoutTests
+        "storage/domstorage/sessionstorage/private-browsing-affects-storage.html", // No notion of private browsing.
+        "storage/private-browsing-readonly.html", // No notion of private browsing.
     };
-    
+
     static void fillIgnoreResultSet() {
-        // need test plugin
-        ignoreResultList.add("fast/dom/Window/Plug-ins.html");
-        // pixel depth
-        ignoreResultList.add("fast/dom/Window/window-screen-properties.html");
-        // missing space in textrun, ok as text is wrapped. ignore. #714933
-        ignoreResultList.add("fast/events/onload-webkit-before-webcore.html");
-        // missing support for textInputController.makeAttributedString()
-        ignoreResultList.add("fast/forms/attributed-strings.html");
-        // charset convert. #516936 ignore, won't fix
-        ignoreResultList.add("fast/forms/form-data-encoding-2.html");
-        // charset convert. #516936 ignore, won't fix
-        ignoreResultList.add("fast/forms/form-data-encoding.html");
-        // execCommand "insertText" not supported
-        ignoreResultList.add("fast/forms/input-appearance-maxlength.html");
-        // Copy&Paste commands not supported
-        ignoreResultList.add("fast/forms/input-truncate-newline.html");
-        ignoreResultList.add("fast/forms/textarea-paste-newline.html");
-        // requires eventSender.mouseMoveTo, mouseDown & mouseUp and 
-        // abs. position of mouse to select a word. ignore, won't fix #716583
-        ignoreResultList.add("fast/forms/onselect-textarea.html");
-        // requires eventSender.mouseMoveTo, mouseDown & mouseUp and 
-        // abs. position of mouse to select a word. ignore, won't fix #716583
-        ignoreResultList.add("fast/forms/onselect-textfield.html");
-        // not implemented queryCommandEnabled:BackColor, Undo & Redo
-        ignoreResultList.add("fast/forms/plaintext-mode-1.html");
-        // Our text areas are a little thinner than Apples. Also RTL test failes
-        ignoreResultList.add("fast/forms/textarea-appearance-wrap.html");
-        // Our text areas are a little thinner than Apples
-        ignoreResultList.add("fast/forms/textarea-hard-linewrap.html");
-        // screen width&height are different
-        ignoreResultList.add("fast/frames/frameElement-widthheight.html");
-        ignoreResultList.add("fast/frames/frame-js-url-clientWidth.html");
-        //  requires JS test API, textInputController
-        ignoreResultList.add("fast/text/attributed-substring-from-range.html"); 
-        ignoreResultList.add("fast/text/attributed-substring-from-range-001.html");
-        // will not fix #619707
-        ignoreResultList.add("fast/css/case-transform.html");
-        // different platform defaults for font and different screen size
-        ignoreResultList.add("fast/css/computed-style.html");
-        // different screen size result in extra spaces in Apple compared to us
-        ignoreResultList.add("fast/dom/Element/offsetLeft-offsetTop-body-quirk.html");
-        // xslt and xpath elements missing from property list
-        ignoreResultList.add("fast/dom/Window/window-properties.html");
-        // requires textInputController.characterIndexForPoint
-        ignoreResultList.add("fast/dom/character-index-for-point.html");
-        // requires xpath support
-        ignoreResultList.add("fast/dom/gc-9.html");
-        // requires xslt and xpath support
-        ignoreResultList.add("fast/dom/global-constructors.html");
-        // dynamic plugins not supported
-        ignoreResultList.add("fast/dom/object-embed-plugin-scripting.html");
-        ignoreResultList.add("fast/js/navigator-mimeTypes-length.html");
-        // there is extra spacing in the file due to multiple input boxes
-        // fitting on one line on Apple, ours are wrapped. Space at line ends
-        // are stripped.
-        ignoreResultList.add("fast/dom/tabindex-clamp.html");
-        
-        // requires eventSender.mouseDown(),mouseUp()
-        ignoreResultList.add("fast/dom/Window/window-xy-properties.html");
-        ignoreResultList.add("fast/events/window-events-bubble.html");
-        ignoreResultList.add("fast/events/window-events-bubble2.html");
-        ignoreResultList.add("fast/events/window-events-capture.html");
-        ignoreResultList.add("fast/forms/select-empty-list.html");
-        ignoreResultList.add("fast/replaced/image-map.html");
-        ignoreResultList.add("fast/events/capture-on-target.html");
-        ignoreResultList.add("fast/events/dblclick-addEventListener.html");
-        ignoreResultList.add("fast/events/drag-in-frames.html");
-        ignoreResultList.add("fast/events/drag-outside-window.html");
-        ignoreResultList.add("fast/events/event-sender-mouse-click.html");
-        ignoreResultList.add("fast/events/event-view-toString.html");
-        ignoreResultList.add("fast/events/frame-click-focus.html");
-        ignoreResultList.add("fast/events/input-image-scrolled-x-y.html");
-        ignoreResultList.add("fast/events/anchor-image-scrolled-x-y.html");
-        ignoreResultList.add("fast/events/mouseclick-target-and-positioning.html");
-        ignoreResultList.add("fast/events/mouseover-mouseout.html");
-        ignoreResultList.add("fast/events/mouseover-mouseout2.html");
-        ignoreResultList.add("fast/events/mouseup-outside-button.html");
-        ignoreResultList.add("fast/events/mouseup-outside-document.html");
-        ignoreResultList.add("fast/events/onclick-list-marker.html");
-        ignoreResultList.add("fast/events/ondragenter.html");
-        ignoreResultList.add("fast/forms/drag-into-textarea.html");
-        ignoreResultList.add("fast/forms/input-select-on-click.html");
-        ignoreResultList.add("fast/forms/listbox-onchange.html");
-        ignoreResultList.add("fast/forms/search-cancel-button-mouseup.html");
-        ignoreResultList.add("fast/forms/textarea-scrolled-endline-caret.html");
-        
-        // there is extra spacing in the file due to multiple frame boxes
-        // fitting on one line on Apple, ours are wrapped. Space at line ends
-        // are stripped.
-        ignoreResultList.add("fast/events/iframe-object-onload.html");
-        // eventSender.mouseDown(), mouseUp() and objc API missing
-        ignoreResultList.add("fast/events/mouseup-outside-document.html");
-        ignoreResultList.add("fast/events/objc-keyboard-event-creation.html");
-        ignoreResultList.add("fast/events/objc-event-api.html");
-        // not capturing the console messages
-        ignoreResultList.add("fast/forms/selected-index-assert.html");
-        ignoreResultList.add("fast/parser/script-tag-with-trailing-slash.html");
-        // there is extra spacing as the text areas and input boxes fit next
-        // to each other on Apple, but are wrapped on our screen.
-        ignoreResultList.add("fast/forms/selection-functions.html");
-        // Text selection done differently on our platform. When a inputbox
-        // gets focus, the entire block is selected.
-        ignoreResultList.add("fast/forms/textarea-initial-caret-position.html");
-        ignoreResultList.add("fast/forms/textarea-no-scroll-on-blur.html");
-        // Requires LayoutTests to exist at /tmp/LayoutTests
-        ignoreResultList.add("fast/loader/local-JavaScript-from-local.html");
-        ignoreResultList.add("fast/loader/local-iFrame-source-from-local.html");
-        // extra spacing because iFrames rendered next to each other on Apple
-        ignoreResultList.add("fast/loader/opaque-base-url.html");
-        ignoreResultList.add("fast/text/plain-text-line-breaks.html");
+        ignoreResultList.add("fast/css/case-transform.html"); // will not fix #619707
+        ignoreResultList.add("fast/css/computed-style.html"); // different platform defaults for font and different screen size
+        ignoreResultList.add("fast/dom/Element/offsetLeft-offsetTop-body-quirk.html"); // different screen size result in extra spaces in Apple compared to us
+        ignoreResultList.add("fast/dom/Window/Plug-ins.html"); // need test plugin
+        ignoreResultList.add("fast/dom/Window/window-properties.html"); // xslt and xpath elements missing from property list
+        ignoreResultList.add("fast/dom/Window/window-screen-properties.html"); // pixel depth
+        ignoreResultList.add("fast/dom/Window/window-xy-properties.html"); // requires eventSender.mouseDown(),mouseUp()
+        ignoreResultList.add("fast/dom/character-index-for-point.html"); // requires textInputController.characterIndexForPoint
+        ignoreResultList.add("fast/dom/gc-9.html"); // requires xpath support
+        ignoreResultList.add("fast/dom/global-constructors.html"); // requires xslt and xpath support
+        ignoreResultList.add("fast/dom/object-embed-plugin-scripting.html"); // dynamic plugins not supported
+        ignoreResultList.add("fast/dom/tabindex-clamp.html"); // there is extra spacing in the file due to multiple input boxes fitting on one line on Apple, ours are wrapped. Space at line ends are stripped.
+        ignoreResultList.add("fast/events/anchor-image-scrolled-x-y.html"); // requires eventSender.mouseDown(),mouseUp()
+        ignoreResultList.add("fast/events/capture-on-target.html"); // requires eventSender.mouseDown(),mouseUp()
+        ignoreResultList.add("fast/events/dblclick-addEventListener.html"); // requires eventSender.mouseDown(),mouseUp()
+        ignoreResultList.add("fast/events/drag-in-frames.html"); // requires eventSender.mouseDown(),mouseUp()
+        ignoreResultList.add("fast/events/drag-outside-window.html"); // requires eventSender.mouseDown(),mouseUp()
+        ignoreResultList.add("fast/events/event-sender-mouse-click.html"); // requires eventSender.mouseDown(),mouseUp()
+        ignoreResultList.add("fast/events/event-view-toString.html"); // requires eventSender.mouseDown(),mouseUp()
+        ignoreResultList.add("fast/events/frame-click-focus.html"); // requires eventSender.mouseDown(),mouseUp()
+        ignoreResultList.add("fast/events/iframe-object-onload.html"); // there is extra spacing in the file due to multiple frame boxes fitting on one line on Apple, ours are wrapped. Space at line ends are stripped.
+        ignoreResultList.add("fast/events/input-image-scrolled-x-y.html"); // requires eventSender.mouseDown(),mouseUp()
+        ignoreResultList.add("fast/events/mouseclick-target-and-positioning.html"); // requires eventSender.mouseDown(),mouseUp()
+        ignoreResultList.add("fast/events/mouseover-mouseout.html"); // requires eventSender.mouseDown(),mouseUp()
+        ignoreResultList.add("fast/events/mouseover-mouseout2.html"); // requires eventSender.mouseDown(),mouseUp()
+        ignoreResultList.add("fast/events/mouseup-outside-button.html"); // requires eventSender.mouseDown(),mouseUp()
+        ignoreResultList.add("fast/events/mouseup-outside-document.html"); // requires eventSender.mouseDown(),mouseUp()
+        ignoreResultList.add("fast/events/objc-event-api.html"); // eventSender.mouseDown(), mouseUp() and objc API missing
+        ignoreResultList.add("fast/events/objc-keyboard-event-creation.html"); // eventSender.mouseDown(), mouseUp() and objc API missing
+        ignoreResultList.add("fast/events/onclick-list-marker.html"); // requires eventSender.mouseDown(),mouseUp()
+        ignoreResultList.add("fast/events/ondragenter.html"); // requires eventSender.mouseDown(),mouseUp()
+        ignoreResultList.add("fast/events/onload-webkit-before-webcore.html"); // missing space in textrun, ok as text is wrapped. ignore. #714933
+        ignoreResultList.add("fast/events/window-events-bubble.html"); // requires eventSender.mouseDown(),mouseUp()
+        ignoreResultList.add("fast/events/window-events-bubble2.html"); // requires eventSender.mouseDown(),mouseUp()
+        ignoreResultList.add("fast/events/window-events-capture.html"); // requires eventSender.mouseDown(),mouseUp()
+        ignoreResultList.add("fast/forms/attributed-strings.html"); // missing support for textInputController.makeAttributedString()
+        ignoreResultList.add("fast/forms/drag-into-textarea.html"); // requires eventSender.mouseDown(),mouseUp()
+        ignoreResultList.add("fast/forms/form-data-encoding-2.html"); // charset convert. #516936 ignore, won't fix
+        ignoreResultList.add("fast/forms/form-data-encoding.html"); // charset convert. #516936 ignore, won't fix
+        ignoreResultList.add("fast/forms/input-appearance-maxlength.html"); // execCommand "insertText" not supported
+        ignoreResultList.add("fast/forms/input-select-on-click.html"); // requires eventSender.mouseDown(),mouseUp()
+        ignoreResultList.add("fast/forms/input-truncate-newline.html"); // Copy&Paste commands not supported
+        ignoreResultList.add("fast/forms/listbox-onchange.html"); // requires eventSender.mouseDown(),mouseUp()
+        ignoreResultList.add("fast/forms/onselect-textarea.html"); // requires eventSender.mouseMoveTo, mouseDown & mouseUp and abs. position of mouse to select a word. ignore, won't fix #716583
+        ignoreResultList.add("fast/forms/onselect-textfield.html"); // requires eventSender.mouseMoveTo, mouseDown & mouseUp and abs. position of mouse to select a word. ignore, won't fix #716583
+        ignoreResultList.add("fast/forms/plaintext-mode-1.html"); // not implemented queryCommandEnabled:BackColor, Undo & Redo
+        ignoreResultList.add("fast/forms/search-cancel-button-mouseup.html"); // requires eventSender.mouseDown(),mouseUp()
+        ignoreResultList.add("fast/forms/select-empty-list.html"); // requires eventSender.mouseDown(),mouseUp()
+        ignoreResultList.add("fast/forms/selected-index-assert.html"); // not capturing the console messages
+        ignoreResultList.add("fast/forms/selection-functions.html"); // there is extra spacing as the text areas and input boxes fit next to each other on Apple, but are wrapped on our screen.
+        ignoreResultList.add("fast/forms/textarea-appearance-wrap.html"); // Our text areas are a little thinner than Apples. Also RTL test failes
+        ignoreResultList.add("fast/forms/textarea-hard-linewrap.html"); // Our text areas are a little thinner than Apples
+        ignoreResultList.add("fast/forms/textarea-initial-caret-position.html"); // Text selection done differently on our platform. When a inputbox gets focus, the entire block is selected.
+        ignoreResultList.add("fast/forms/textarea-no-scroll-on-blur.html"); // Text selection done differently on our platform. When a inputbox gets focus, the entire block is selected.
+        ignoreResultList.add("fast/forms/textarea-paste-newline.html"); // Copy&Paste commands not supported
+        ignoreResultList.add("fast/forms/textarea-scrolled-endline-caret.html"); // requires eventSender.mouseDown(),mouseUp()
+        ignoreResultList.add("fast/frames/frameElement-widthheight.html"); // screen width&height are different
+        ignoreResultList.add("fast/frames/frame-js-url-clientWidth.html"); // screen width&height are different
+        ignoreResultList.add("fast/js/navigator-mimeTypes-length.html"); // dynamic plugins not supported
+        ignoreResultList.add("fast/loader/local-JavaScript-from-local.html"); // Requires LayoutTests to exist at /tmp/LayoutTests
+        ignoreResultList.add("fast/loader/local-iFrame-source-from-local.html"); // Requires LayoutTests to exist at /tmp/LayoutTests
+        ignoreResultList.add("fast/loader/opaque-base-url.html"); // extra spacing because iFrames rendered next to each other on Apple
+        ignoreResultList.add("fast/parser/script-tag-with-trailing-slash.html"); // not capturing the console messages
+        ignoreResultList.add("fast/replaced/image-map.html"); // requires eventSender.mouseDown(),mouseUp()
+        ignoreResultList.add("fast/text/attributed-substring-from-range.html"); //  requires JS test API, textInputController
+        ignoreResultList.add("fast/text/attributed-substring-from-range-001.html"); //  requires JS test API, textInputController
+        ignoreResultList.add("fast/text/plain-text-line-breaks.html"); // extra spacing because iFrames rendered next to each other on Apple
     }
 
     static void fillBugTable() {