Skip to content

Commit f2bfe2b

Browse files
author
Steve Block
committed
Remove superfluous code after removal of Android HTTP stack
See b/5495616. Bug: 6228353 Change-Id: I16cfd7b37973919d5bf14d2d80954caede264961
1 parent a026b48 commit f2bfe2b

File tree

3 files changed

+1
-214
lines changed

3 files changed

+1
-214
lines changed

core/java/android/webkit/CacheManager.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,18 @@
1717
package android.webkit;
1818

1919
import android.content.Context;
20-
import android.net.http.AndroidHttpClient;
2120
import android.net.http.Headers;
22-
import android.os.FileUtils;
2321
import android.util.Log;
22+
2423
import java.io.File;
2524
import java.io.FileInputStream;
2625
import java.io.FileNotFoundException;
27-
import java.io.FileOutputStream;
28-
import java.io.FilenameFilter;
2926
import java.io.IOException;
3027
import java.io.InputStream;
3128
import java.io.OutputStream;
32-
import java.util.List;
3329
import java.util.Map;
3430

3531

36-
import com.android.org.bouncycastle.crypto.Digest;
37-
import com.android.org.bouncycastle.crypto.digests.SHA1Digest;
38-
3932
/**
4033
* Manages the HTTP cache used by an application's {@link WebView} instances.
4134
* @deprecated Access to the HTTP cache will be removed in a future release.

core/java/android/webkit/CookieManager.java

Lines changed: 0 additions & 200 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,10 @@
1818

1919
import android.net.ParseException;
2020
import android.net.WebAddress;
21-
import android.net.http.AndroidHttpClient;
2221
import android.os.AsyncTask;
2322
import android.util.Log;
2423

2524

26-
import java.util.ArrayList;
27-
import java.util.Arrays;
28-
import java.util.Collection;
29-
import java.util.Comparator;
30-
import java.util.Iterator;
31-
import java.util.LinkedHashMap;
32-
import java.util.Map;
33-
import java.util.SortedSet;
34-
import java.util.TreeSet;
35-
3625
/**
3726
* Manages the cookies used by an application's {@link WebView} instances.
3827
* Cookies are manipulated according to RFC2109.
@@ -43,197 +32,8 @@ public final class CookieManager {
4332

4433
private static final String LOGTAG = "webkit";
4534

46-
private static final String DOMAIN = "domain";
47-
48-
private static final String PATH = "path";
49-
50-
private static final String EXPIRES = "expires";
51-
52-
private static final String SECURE = "secure";
53-
54-
private static final String MAX_AGE = "max-age";
55-
56-
private static final String HTTP_ONLY = "httponly";
57-
58-
private static final String HTTPS = "https";
59-
60-
private static final char PERIOD = '.';
61-
62-
private static final char COMMA = ',';
63-
64-
private static final char SEMICOLON = ';';
65-
66-
private static final char EQUAL = '=';
67-
68-
private static final char PATH_DELIM = '/';
69-
70-
private static final char QUESTION_MARK = '?';
71-
72-
private static final char WHITE_SPACE = ' ';
73-
74-
private static final char QUOTATION = '\"';
75-
76-
private static final int SECURE_LENGTH = SECURE.length();
77-
78-
private static final int HTTP_ONLY_LENGTH = HTTP_ONLY.length();
79-
80-
// RFC2109 defines 4k as maximum size of a cookie
81-
private static final int MAX_COOKIE_LENGTH = 4 * 1024;
82-
83-
// RFC2109 defines 20 as max cookie count per domain. As we track with base
84-
// domain, we allow 50 per base domain
85-
private static final int MAX_COOKIE_COUNT_PER_BASE_DOMAIN = 50;
86-
87-
// RFC2109 defines 300 as max count of domains. As we track with base
88-
// domain, we set 200 as max base domain count
89-
private static final int MAX_DOMAIN_COUNT = 200;
90-
91-
// max cookie count to limit RAM cookie takes less than 100k, it is based on
92-
// average cookie entry size is less than 100 bytes
93-
private static final int MAX_RAM_COOKIES_COUNT = 1000;
94-
95-
// max domain count to limit RAM cookie takes less than 100k,
96-
private static final int MAX_RAM_DOMAIN_COUNT = 15;
97-
9835
private int mPendingCookieOperations = 0;
9936

100-
/**
101-
* This contains a list of 2nd-level domains that aren't allowed to have
102-
* wildcards when combined with country-codes. For example: [.co.uk].
103-
*/
104-
private final static String[] BAD_COUNTRY_2LDS =
105-
{ "ac", "co", "com", "ed", "edu", "go", "gouv", "gov", "info",
106-
"lg", "ne", "net", "or", "org" };
107-
108-
static {
109-
Arrays.sort(BAD_COUNTRY_2LDS);
110-
}
111-
112-
/**
113-
* Package level class to be accessed by cookie sync manager
114-
*/
115-
static class Cookie {
116-
static final byte MODE_NEW = 0;
117-
118-
static final byte MODE_NORMAL = 1;
119-
120-
static final byte MODE_DELETED = 2;
121-
122-
static final byte MODE_REPLACED = 3;
123-
124-
String domain;
125-
126-
String path;
127-
128-
String name;
129-
130-
String value;
131-
132-
long expires;
133-
134-
long lastAcessTime;
135-
136-
long lastUpdateTime;
137-
138-
boolean secure;
139-
140-
byte mode;
141-
142-
Cookie() {
143-
}
144-
145-
Cookie(String defaultDomain, String defaultPath) {
146-
domain = defaultDomain;
147-
path = defaultPath;
148-
expires = -1;
149-
}
150-
151-
boolean exactMatch(Cookie in) {
152-
// An exact match means that domain, path, and name are equal. If
153-
// both values are null, the cookies match. If both values are
154-
// non-null, the cookies match. If one value is null and the other
155-
// is non-null, the cookies do not match (i.e. "foo=;" and "foo;")
156-
boolean valuesMatch = !((value == null) ^ (in.value == null));
157-
return domain.equals(in.domain) && path.equals(in.path) &&
158-
name.equals(in.name) && valuesMatch;
159-
}
160-
161-
boolean domainMatch(String urlHost) {
162-
if (domain.startsWith(".")) {
163-
if (urlHost.endsWith(domain.substring(1))) {
164-
int len = domain.length();
165-
int urlLen = urlHost.length();
166-
if (urlLen > len - 1) {
167-
// make sure bar.com doesn't match .ar.com
168-
return urlHost.charAt(urlLen - len) == PERIOD;
169-
}
170-
return true;
171-
}
172-
return false;
173-
} else {
174-
// exact match if domain is not leading w/ dot
175-
return urlHost.equals(domain);
176-
}
177-
}
178-
179-
boolean pathMatch(String urlPath) {
180-
if (urlPath.startsWith(path)) {
181-
int len = path.length();
182-
if (len == 0) {
183-
Log.w(LOGTAG, "Empty cookie path");
184-
return false;
185-
}
186-
int urlLen = urlPath.length();
187-
if (path.charAt(len-1) != PATH_DELIM && urlLen > len) {
188-
// make sure /wee doesn't match /we
189-
return urlPath.charAt(len) == PATH_DELIM;
190-
}
191-
return true;
192-
}
193-
return false;
194-
}
195-
196-
public String toString() {
197-
return "domain: " + domain + "; path: " + path + "; name: " + name
198-
+ "; value: " + value;
199-
}
200-
}
201-
202-
private static final CookieComparator COMPARATOR = new CookieComparator();
203-
204-
private static final class CookieComparator implements Comparator<Cookie> {
205-
public int compare(Cookie cookie1, Cookie cookie2) {
206-
// According to RFC 2109, multiple cookies are ordered in a way such
207-
// that those with more specific Path attributes precede those with
208-
// less specific. Ordering with respect to other attributes (e.g.,
209-
// Domain) is unspecified.
210-
// As Set is not modified if the two objects are same, we do want to
211-
// assign different value for each cookie.
212-
int diff = cookie2.path.length() - cookie1.path.length();
213-
if (diff != 0) return diff;
214-
215-
diff = cookie2.domain.length() - cookie1.domain.length();
216-
if (diff != 0) return diff;
217-
218-
// If cookie2 has a null value, it should come later in
219-
// the list.
220-
if (cookie2.value == null) {
221-
// If both cookies have null values, fall back to using the name
222-
// difference.
223-
if (cookie1.value != null) {
224-
return -1;
225-
}
226-
} else if (cookie1.value == null) {
227-
// Now we know that cookie2 does not have a null value, if
228-
// cookie1 has a null value, place it later in the list.
229-
return 1;
230-
}
231-
232-
// Fallback to comparing the name to ensure consistent order.
233-
return cookie1.name.compareTo(cookie2.name);
234-
}
235-
}
236-
23737
private CookieManager() {
23838
}
23939

core/java/android/webkit/CookieSyncManager.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@
1818

1919
import android.content.Context;
2020
import android.util.Log;
21-
import android.webkit.CookieManager.Cookie;
2221

23-
import java.util.ArrayList;
24-
import java.util.Iterator;
2522

2623
/**
2724
* The CookieSyncManager is used to synchronize the browser cookie store
@@ -62,9 +59,6 @@ public final class CookieSyncManager extends WebSyncManager {
6259

6360
private static CookieSyncManager sRef;
6461

65-
// time when last update happened
66-
private long mLastUpdate;
67-
6862
private CookieSyncManager(Context context) {
6963
super(context, "CookieSyncManager");
7064
}

0 commit comments

Comments
 (0)