1
0
mirror of https://github.com/owncloud/android-library.git synced 2025-06-07 16:06:08 +00:00

Merge pull request #325 from owncloud/feature/android10

Upgrade target version to v29
This commit is contained in:
Abel García de Prada 2020-06-16 17:16:34 +02:00 committed by GitHub
commit e5e226dee0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 15 deletions

View File

@ -23,11 +23,11 @@ allOpen {
}
android {
compileSdkVersion 28
compileSdkVersion 29
defaultConfig {
minSdkVersion 21
targetSdkVersion 28
targetSdkVersion 29
versionCode = 10000500
versionName = "1.0.5"

View File

@ -71,16 +71,21 @@ public class HttpClient {
SSLContext sslContext;
try {
sslContext = SSLContext.getInstance("TLSv1.2");
} catch (NoSuchAlgorithmException tlsv12Exception) {
sslContext = SSLContext.getInstance("TLSv1.3");
} catch (NoSuchAlgorithmException tlsv13Exception) {
try {
Timber.w("TLSv1.2 is not supported in this device; falling through TLSv1.1");
sslContext = SSLContext.getInstance("TLSv1.1");
} catch (NoSuchAlgorithmException tlsv11Exception) {
Timber.w("TLSv1.1 is not supported in this device; falling through TLSv1.0");
sslContext = SSLContext.getInstance("TLSv1");
// should be available in any device; see reference of supported protocols in
// http://developer.android.com/reference/javax/net/ssl/SSLSocket.html
Timber.w("TLSv1.3 is not supported in this device; falling through TLSv1.2");
sslContext = SSLContext.getInstance("TLSv1.2");
} catch (NoSuchAlgorithmException tlsv12Exception) {
try {
Timber.w("TLSv1.2 is not supported in this device; falling through TLSv1.1");
sslContext = SSLContext.getInstance("TLSv1.1");
} catch (NoSuchAlgorithmException tlsv11Exception) {
Timber.w("TLSv1.1 is not supported in this device; falling through TLSv1.0");
sslContext = SSLContext.getInstance("TLSv1");
// should be available in any device; see reference of supported protocols in
// http://developer.android.com/reference/javax/net/ssl/SSLSocket.html
}
}
}

View File

@ -74,8 +74,8 @@ public class TLSSocketFactory extends SSLSocketFactory {
}
private Socket enableTLSOnSocket(Socket socket) {
if(socket != null && (socket instanceof SSLSocket)) {
((SSLSocket)socket).setEnabledProtocols(new String[] {"TLSv1.1", "TLSv1.2"});
if((socket instanceof SSLSocket)) {
((SSLSocket)socket).setEnabledProtocols(new String[] {"TLSv1.1", "TLSv1.2", "TLSv1.3"});
}
return socket;
}

View File

@ -5,11 +5,11 @@ dependencies {
}
android {
compileSdkVersion 28
compileSdkVersion 29
defaultConfig {
minSdkVersion 21
targetSdkVersion 28
targetSdkVersion 29
// This is pretty ugly but manifest placeholders don't seem to work very well when using different modules
// See https://github.com/openid/AppAuth-Android/issues/325