public static org.apache.harmony.xnet.provider.jsse.SSLClientSessionCache | getCache(android.content.Context context)Returns a new {@link SSLClientSessionCache} based on the persistent cache that's specified,
if any, in gservices. If no cache is specified, returns null.
String type = Settings.Gservices.getString(context.getContentResolver(),
Settings.Gservices.SSL_SESSION_CACHE);
if (type != null) {
if (DB.equals(type)) {
return DbSSLSessionCache.getInstanceForPackage(context);
} else if (FILE.equals(type)) {
File dir = context.getFilesDir();
File cacheDir = new File(dir, "sslcache");
if (!cacheDir.exists()) {
cacheDir.mkdir();
}
try {
return FileClientSessionCache.usingDirectory(cacheDir);
} catch (IOException ioe) {
Log.w(TAG, "Unable to create FileClientSessionCache in " + cacheDir.getName(), ioe);
return null;
}
} else {
Log.w(TAG, "Ignoring unrecognized type: '" + type + "'");
}
}
return null;
|