OSDN Git Service

Fix #1947053. Use EXTRA_POST_DATA to send POST request to the WebView. This is used...
authorGrace Kloba <klobag@google.com>
Tue, 30 Jun 2009 14:09:56 +0000 (07:09 -0700)
committerGrace Kloba <klobag@google.com>
Tue, 30 Jun 2009 14:09:56 +0000 (07:09 -0700)
src/com/android/browser/BrowserActivity.java

index eddcb28..84e7ca3 100644 (file)
@@ -746,7 +746,10 @@ public class BrowserActivity extends Activity
                     waitForCredentials();
                 }
             } else {
-                urlData.setPostData(getLocationData(intent));
+                if (extra != null) {
+                    urlData.setPostData(extra
+                            .getByteArray(Browser.EXTRA_POST_DATA));
+                }
                 urlData.loadIn(webView);
             }
         } else {
@@ -811,7 +814,8 @@ public class BrowserActivity extends Activity
             if (urlData.isEmpty()) {
                 urlData = new UrlData(mSettings.getHomePage());
             }
-            urlData.setPostData(getLocationData(intent));
+            urlData.setPostData(intent
+                    .getByteArrayExtra(Browser.EXTRA_POST_DATA));
 
             if (Intent.ACTION_VIEW.equals(action) &&
                     (flags & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != 0) {
@@ -995,42 +999,6 @@ public class BrowserActivity extends Activity
         return new UrlData(url);
     }
 
-    byte[] getLocationData(Intent intent) {
-        byte[] postData = null;
-        if (intent != null) {
-            final String action = intent.getAction();
-            if (Intent.ACTION_VIEW.equals(action)
-                    && intent.getBooleanExtra(Browser.EXTRA_APPEND_LOCATION,
-                            false)) {
-                ContentResolver cr = getContentResolver();
-                int use = Settings.Secure.getInt(cr,
-                        Settings.Secure.USE_LOCATION_FOR_SERVICES, -1);
-                if (use == -1) {
-                    // bring up the consent dialog if it is undefined. And we
-                    // will not send the location info for this query.
-                    Intent consent = new Intent(
-                            Settings.ACTION_SECURITY_SETTINGS);
-                    consent.putExtra("SHOW_USE_LOCATION", true);
-                    startActivity(consent);
-                } else if (use == 1
-                        && Settings.Secure.isLocationProviderEnabled(cr,
-                                LocationManager.NETWORK_PROVIDER)) {
-                    Location location = ((LocationManager) getSystemService(
-                            Context.LOCATION_SERVICE)).getLastKnownLocation(
-                                    LocationManager.NETWORK_PROVIDER);
-                    if (location != null) {
-                        StringBuilder str = new StringBuilder(
-                                "action=devloc&sll=");
-                        str.append(location.getLatitude()).append(',').append(
-                                location.getLongitude());
-                        postData = str.toString().getBytes();
-                    }
-                }
-            }
-        }
-        return postData;
-    }
-
     /* package */ static String fixUrl(String inUrl) {
         if (inUrl.startsWith("http://") || inUrl.startsWith("https://"))
             return inUrl;