Fix for Duplicate FileChooser Result exception

The callback was not getting cleaned up properly
due to which exception was getting triggered
when browser was getting destroyed.

Change-Id: I97400e72eb52e3f7af6e01d82479b1764cd9b4af
diff --git a/src/com/android/browser/UploadHandler.java b/src/com/android/browser/UploadHandler.java
index 6b0a39f..c06d24e 100644
--- a/src/com/android/browser/UploadHandler.java
+++ b/src/com/android/browser/UploadHandler.java
@@ -75,8 +75,11 @@
     protected void setHandled(boolean handled) {
         mHandled = handled;
         mCaughtActivityNotFoundException = false;
-        if (!mHandled)
+        // If  upload dialog shown to the user got dismissed
+        if (!mHandled) {
             mUploadFilePaths.onReceiveValue(null);
+        }
+        mUploadFilePaths = null;
     }
 
     void onResult(int resultCode, Intent intent) {
@@ -151,15 +154,13 @@
         if (mUploadFilePaths != null) {
             if (hasGoodFilePath && !isDRMFileType) {
                 Log.d(TAG, "upload file path:" + filePath);
-
                 mUploadFilePaths.onReceiveValue(new String[]{filePath});
             } else {
                 mUploadFilePaths.onReceiveValue(null);
             }
         }
 
-        mHandled = true;
-        mCaughtActivityNotFoundException = false;
+        setHandled(true);
     }