am 96352104: Merge change 25550 into eclair

Merge commit '96352104fbb172d91f957551c772988e02d79f33' into eclair-plus-aosp

* commit '96352104fbb172d91f957551c772988e02d79f33':
  add system property to disable gzip, to help with debugging.
diff --git a/core/java/com/google/android/gdata/client/AndroidGDataClient.java b/core/java/com/google/android/gdata/client/AndroidGDataClient.java
index 998f940..9a2a51d 100644
--- a/core/java/com/google/android/gdata/client/AndroidGDataClient.java
+++ b/core/java/com/google/android/gdata/client/AndroidGDataClient.java
@@ -19,6 +19,7 @@
 import org.apache.http.client.methods.HttpUriRequest;
 import org.apache.http.entity.InputStreamEntity;
 import org.apache.http.entity.AbstractHttpEntity;
+import org.apache.http.entity.ByteArrayEntity;
 
 import android.content.ContentResolver;
 import android.content.Context;
@@ -26,6 +27,7 @@
 import android.text.TextUtils;
 import android.util.Config;
 import android.util.Log;
+import android.os.SystemProperties;
 
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
@@ -55,6 +57,10 @@
 
     private static final int MAX_REDIRECTS = 10;
 
+    // boolean system property that can be used to control whether or not
+    // requests/responses are gzip'd.
+    private static final String NO_GZIP_SYSTEM_PROPERTY = "sync.nogzip";
+
     private final GoogleHttpClient mHttpClient;
     private ContentResolver mResolver;
 
@@ -212,7 +218,10 @@
 
             HttpUriRequest request = creator.createRequest(uri);
 
-            AndroidHttpClient.modifyRequestToAcceptGzipResponse(request);
+            if (!SystemProperties.getBoolean(NO_GZIP_SYSTEM_PROPERTY, false)) {
+                AndroidHttpClient.modifyRequestToAcceptGzipResponse(request);
+            }
+
             // only add the auth token if not null (to allow for GData feeds that do not require
             // authentication.)
             if (!TextUtils.isEmpty(authToken)) {
@@ -487,7 +496,12 @@
             }
         }
 
-        AbstractHttpEntity entity = AndroidHttpClient.getCompressedEntity(entryBytes, mResolver);
+        AbstractHttpEntity entity;
+        if (SystemProperties.getBoolean(NO_GZIP_SYSTEM_PROPERTY, false)) {
+            entity = new ByteArrayEntity(entryBytes);
+        } else {
+            entity = AndroidHttpClient.getCompressedEntity(entryBytes, mResolver);
+        }
         entity.setContentType(entry.getContentType());
         return entity;
     }
diff --git a/core/java/com/google/android/gdata2/client/AndroidGDataClient.java b/core/java/com/google/android/gdata2/client/AndroidGDataClient.java
index 6ba791d..3721fa4 100644
--- a/core/java/com/google/android/gdata2/client/AndroidGDataClient.java
+++ b/core/java/com/google/android/gdata2/client/AndroidGDataClient.java
@@ -22,6 +22,7 @@
 import org.apache.http.client.methods.HttpUriRequest;
 import org.apache.http.entity.InputStreamEntity;
 import org.apache.http.entity.AbstractHttpEntity;
+import org.apache.http.entity.ByteArrayEntity;
 
 import android.content.ContentResolver;
 import android.content.Context;
@@ -29,6 +30,7 @@
 import android.text.TextUtils;
 import android.util.Config;
 import android.util.Log;
+import android.os.SystemProperties;
 
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
@@ -59,6 +61,9 @@
     private static final int MAX_REDIRECTS = 10;
     private static String DEFAULT_GDATA_VERSION = "2.0";
 
+    // boolean system property that can be used to control whether or not
+    // requests/responses are gzip'd.
+    private static final String NO_GZIP_SYSTEM_PROPERTY = "sync.nogzip";
 
     private String mGDataVersion; 
     private final GoogleHttpClient mHttpClient;
@@ -213,7 +218,7 @@
         HttpResponse response = null;
         int status = 500;
         int redirectsLeft = MAX_REDIRECTS;
-        
+
         URI uri;
         try {
             uri = new URI(uriString);
@@ -230,7 +235,10 @@
 
             HttpUriRequest request = creator.createRequest(uri);
 
-            AndroidHttpClient.modifyRequestToAcceptGzipResponse(request);
+            if (!SystemProperties.getBoolean(NO_GZIP_SYSTEM_PROPERTY, false)) {
+                AndroidHttpClient.modifyRequestToAcceptGzipResponse(request);
+            }
+
             // only add the auth token if not null (to allow for GData feeds that do not require
             // authentication.)
             if (!TextUtils.isEmpty(authToken)) {
@@ -547,7 +555,13 @@
             }
         }
 
-        AbstractHttpEntity entity = AndroidHttpClient.getCompressedEntity(entryBytes, mResolver);
+        AbstractHttpEntity entity;
+        if (SystemProperties.getBoolean(NO_GZIP_SYSTEM_PROPERTY, false)) {
+            entity = new ByteArrayEntity(entryBytes);
+        } else {
+            entity = AndroidHttpClient.getCompressedEntity(entryBytes, mResolver);
+        }
+
         entity.setContentType(entry.getContentType());
         return entity;
     }
@@ -587,4 +601,3 @@
         throw new IOException("Unable to process batch request.");
     }
 }   
-