Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dea64ad7 authored by jwilson's avatar jwilson Committed by Gerrit Code Review
Browse files

Adjust the HttpResponseCache for OkHttp.

Change-Id: I2a80f3c3f30a3d15673d797fa3d1211286f75030
parent a7e4795b
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -235,7 +235,7 @@ LOCAL_INTERMEDIATE_SOURCES := \
			$(framework_res_source_path)/com/android/internal/R.java

LOCAL_NO_STANDARD_LIBRARIES := true
LOCAL_JAVA_LIBRARIES := bouncycastle core core-junit ext
LOCAL_JAVA_LIBRARIES := bouncycastle core core-junit ext okhttp

LOCAL_MODULE := framework
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
@@ -401,6 +401,7 @@ framework_docs_LOCAL_INTERMEDIATE_SOURCES := \
framework_docs_LOCAL_JAVA_LIBRARIES := \
			bouncycastle \
			core \
			okhttp \
			ext \
			framework \
			mms-common \
+8 −7
Original line number Diff line number Diff line
@@ -17,21 +17,21 @@
package android.net.http;

import android.content.Context;
import com.android.okhttp.OkResponseCache;
import com.android.okhttp.ResponseSource;
import com.android.okhttp.internal.DiskLruCache;
import java.io.Closeable;
import java.io.File;
import java.io.IOException;
import java.net.CacheRequest;
import java.net.CacheResponse;
import java.net.ExtendedResponseCache;
import java.net.HttpURLConnection;
import java.net.ResponseCache;
import java.net.ResponseSource;
import java.net.URI;
import java.net.URLConnection;
import java.util.List;
import java.util.Map;
import javax.net.ssl.HttpsURLConnection;
import libcore.io.DiskLruCache;
import libcore.io.IoUtils;
import org.apache.http.impl.client.DefaultHttpClient;

@@ -152,12 +152,12 @@ import org.apache.http.impl.client.DefaultHttpClient;
 *       }}</pre>
 */
public final class HttpResponseCache extends ResponseCache
        implements Closeable, ExtendedResponseCache {
        implements Closeable, OkResponseCache {

    private final libcore.net.http.HttpResponseCache delegate;
    private final com.android.okhttp.internal.http.HttpResponseCache delegate;

    private HttpResponseCache(File directory, long maxSize) throws IOException {
        this.delegate = new libcore.net.http.HttpResponseCache(directory, maxSize);
        this.delegate = new com.android.okhttp.internal.http.HttpResponseCache(directory, maxSize);
    }

    /**
@@ -274,7 +274,8 @@ public final class HttpResponseCache extends ResponseCache
    }

    /** @hide */
    @Override public void update(CacheResponse conditionalCacheHit, HttpURLConnection connection) {
    @Override public void update(CacheResponse conditionalCacheHit, HttpURLConnection connection)
            throws IOException {
        delegate.update(conditionalCacheHit, connection);
    }