Fix issue #3362484: Can't dismiss activity picker by tapping outside dialog

Change-Id: Idc2fe5a86c61e8f94fe9d902a0087a05f6f7918e
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index ec2f771..9ec187f 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -1806,6 +1806,14 @@
     }
 
     /**
+     * Sets whether this activity is finished when touched outside its window's
+     * bounds.
+     */
+    public void setFinishOnTouchOutside(boolean finish) {
+        mWindow.setCloseOnTouchOutside(finish);
+    }
+    
+    /**
      * Use with {@link #setDefaultKeyMode} to turn off default handling of
      * keys.
      * 
@@ -2061,6 +2069,11 @@
      * The default implementation always returns false.
      */
     public boolean onTouchEvent(MotionEvent event) {
+        if (mWindow.shouldCloseOnTouch(this, event)) {
+            finish();
+            return true;
+        }
+        
         return false;
     }