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 { android {
compileSdkVersion 28 compileSdkVersion 29
defaultConfig { defaultConfig {
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 28 targetSdkVersion 29
versionCode = 10000500 versionCode = 10000500
versionName = "1.0.5" versionName = "1.0.5"

View File

@ -71,16 +71,21 @@ public class HttpClient {
SSLContext sslContext; SSLContext sslContext;
try { try {
sslContext = SSLContext.getInstance("TLSv1.2"); sslContext = SSLContext.getInstance("TLSv1.3");
} catch (NoSuchAlgorithmException tlsv12Exception) { } catch (NoSuchAlgorithmException tlsv13Exception) {
try { try {
Timber.w("TLSv1.2 is not supported in this device; falling through TLSv1.1"); Timber.w("TLSv1.3 is not supported in this device; falling through TLSv1.2");
sslContext = SSLContext.getInstance("TLSv1.1"); sslContext = SSLContext.getInstance("TLSv1.2");
} catch (NoSuchAlgorithmException tlsv11Exception) { } catch (NoSuchAlgorithmException tlsv12Exception) {
Timber.w("TLSv1.1 is not supported in this device; falling through TLSv1.0"); try {
sslContext = SSLContext.getInstance("TLSv1"); Timber.w("TLSv1.2 is not supported in this device; falling through TLSv1.1");
// should be available in any device; see reference of supported protocols in sslContext = SSLContext.getInstance("TLSv1.1");
// http://developer.android.com/reference/javax/net/ssl/SSLSocket.html } 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) { private Socket enableTLSOnSocket(Socket socket) {
if(socket != null && (socket instanceof SSLSocket)) { if((socket instanceof SSLSocket)) {
((SSLSocket)socket).setEnabledProtocols(new String[] {"TLSv1.1", "TLSv1.2"}); ((SSLSocket)socket).setEnabledProtocols(new String[] {"TLSv1.1", "TLSv1.2", "TLSv1.3"});
} }
return socket; return socket;
} }

View File

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