diff --git a/build.gradle b/build.gradle
index e873b2bb..1652eaec 100644
--- a/build.gradle
+++ b/build.gradle
@@ -13,7 +13,7 @@ buildscript {
ext.coroutineVersion = '1.5.2'
ext.annotationVersion = '1.2.0'
- ext.appcompatVersion = '1.4.0'
+ ext.appcompatVersion = '1.4.1'
ext.coreVersion = '1.7.0'
ext.fragmentVersion = '1.4.0'
ext.lifecycleVersion = '2.4.0'
diff --git a/play-services-core/build.gradle b/play-services-core/build.gradle
index 05d07ce5..285970ad 100644
--- a/play-services-core/build.gradle
+++ b/play-services-core/build.gradle
@@ -50,6 +50,7 @@ dependencies {
withNearbyImplementation project(':play-services-nearby-core')
withNearbyImplementation project(':play-services-nearby-core-ui')
implementation project(':play-services-safetynet-core')
+ implementation project(':play-services-safetynet-core-ui')
implementation project(':play-services-tapandpay-core')
implementation project(':play-services-vision-core')
diff --git a/play-services-safetynet-core-ui/build.gradle b/play-services-safetynet-core-ui/build.gradle
new file mode 100644
index 00000000..23dd3f45
--- /dev/null
+++ b/play-services-safetynet-core-ui/build.gradle
@@ -0,0 +1,59 @@
+/*
+ * SPDX-FileCopyrightText: 2021 microG Project Team
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+apply plugin: 'com.android.library'
+apply plugin: 'kotlin-android'
+apply plugin: 'maven-publish'
+apply plugin: 'signing'
+
+dependencies {
+ api project(':play-services-safetynet-api')
+
+ implementation project(':play-services-base-core')
+ implementation project(':play-services-base-core-ui')
+ implementation project(':play-services-droidguard')
+ implementation project(':play-services-droidguard-core')
+
+ implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
+ implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutineVersion"
+ implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutineVersion"
+
+ implementation "androidx.appcompat:appcompat:$appcompatVersion"
+ implementation "androidx.core:core-ktx:$coreVersion"
+ implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycleVersion"
+ implementation "androidx.webkit:webkit:$webkitVersion"
+}
+
+android {
+ compileSdkVersion androidCompileSdk
+ buildToolsVersion "$androidBuildVersionTools"
+
+ defaultConfig {
+ versionName version
+ minSdkVersion androidMinSdk
+ targetSdkVersion androidTargetSdk
+ }
+
+ sourceSets {
+ main.java.srcDirs += 'src/main/kotlin'
+ }
+
+ lintOptions {
+ disable 'MissingTranslation'
+ }
+
+ compileOptions {
+ sourceCompatibility = 1.8
+ targetCompatibility = 1.8
+ }
+
+ kotlinOptions {
+ jvmTarget = 1.8
+ }
+}
+
+apply from: '../gradle/publish-android.gradle'
+
+description = 'UI for microG service implementation for play-services-safetynet'
diff --git a/play-services-safetynet-core-ui/src/main/AndroidManifest.xml b/play-services-safetynet-core-ui/src/main/AndroidManifest.xml
new file mode 100644
index 00000000..b12472f9
--- /dev/null
+++ b/play-services-safetynet-core-ui/src/main/AndroidManifest.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/play-services-safetynet-core/src/main/kotlin/org/microg/gms/safetynet/ReCaptchaActivity.kt b/play-services-safetynet-core-ui/src/main/kotlin/org/microg/gms/safetynet/ReCaptchaActivity.kt
similarity index 98%
rename from play-services-safetynet-core/src/main/kotlin/org/microg/gms/safetynet/ReCaptchaActivity.kt
rename to play-services-safetynet-core-ui/src/main/kotlin/org/microg/gms/safetynet/ReCaptchaActivity.kt
index 98f307f9..9808fcc5 100644
--- a/play-services-safetynet-core/src/main/kotlin/org/microg/gms/safetynet/ReCaptchaActivity.kt
+++ b/play-services-safetynet-core-ui/src/main/kotlin/org/microg/gms/safetynet/ReCaptchaActivity.kt
@@ -22,7 +22,7 @@ import androidx.lifecycle.lifecycleScope
import androidx.webkit.WebViewClientCompat
import com.google.android.gms.safetynet.SafetyNetStatusCodes.*
import org.microg.gms.droidguard.core.DroidGuardResultCreator
-import org.microg.gms.safetynet.core.R
+import org.microg.gms.safetynet.core.ui.R
import java.io.ByteArrayInputStream
import java.net.URLEncoder
import java.security.MessageDigest
@@ -30,7 +30,7 @@ import kotlin.math.min
private const val TAG = "GmsReCAPTCHA"
-fun StringBuilder.appendUrlEncodedParam(key: String, value: String?) = append("&")
+private fun StringBuilder.appendUrlEncodedParam(key: String, value: String?) = append("&")
.append(URLEncoder.encode(key, "UTF-8"))
.append("=")
.append(value?.let { URLEncoder.encode(it, "UTF-8") } ?: "")
diff --git a/play-services-safetynet-core/src/main/res/drawable/ic_recaptcha.xml b/play-services-safetynet-core-ui/src/main/res/drawable/ic_recaptcha.xml
similarity index 100%
rename from play-services-safetynet-core/src/main/res/drawable/ic_recaptcha.xml
rename to play-services-safetynet-core-ui/src/main/res/drawable/ic_recaptcha.xml
diff --git a/play-services-safetynet-core/src/main/res/layout/recaptcha_window.xml b/play-services-safetynet-core-ui/src/main/res/layout/recaptcha_window.xml
similarity index 100%
rename from play-services-safetynet-core/src/main/res/layout/recaptcha_window.xml
rename to play-services-safetynet-core-ui/src/main/res/layout/recaptcha_window.xml
diff --git a/play-services-safetynet-core/build.gradle b/play-services-safetynet-core/build.gradle
index 7bd08af3..b96ab704 100644
--- a/play-services-safetynet-core/build.gradle
+++ b/play-services-safetynet-core/build.gradle
@@ -20,11 +20,9 @@ dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutineVersion"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutineVersion"
- implementation "androidx.appcompat:appcompat:$appcompatVersion"
implementation "androidx.core:core-ktx:$coreVersion"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycleVersion"
implementation "androidx.lifecycle:lifecycle-service:$lifecycleVersion"
- implementation "androidx.webkit:webkit:$webkitVersion"
implementation "com.android.volley:volley:$volleyVersion"
implementation "com.squareup.wire:wire-runtime:$wireVersion"
diff --git a/play-services-safetynet-core/src/main/AndroidManifest.xml b/play-services-safetynet-core/src/main/AndroidManifest.xml
index 44348cdf..6941a154 100644
--- a/play-services-safetynet-core/src/main/AndroidManifest.xml
+++ b/play-services-safetynet-core/src/main/AndroidManifest.xml
@@ -13,12 +13,5 @@
-
-
diff --git a/play-services-safetynet-core/src/main/kotlin/org/microg/gms/safetynet/SafetyNetClientService.kt b/play-services-safetynet-core/src/main/kotlin/org/microg/gms/safetynet/SafetyNetClientService.kt
index 228d4ec8..4ba52f63 100644
--- a/play-services-safetynet-core/src/main/kotlin/org/microg/gms/safetynet/SafetyNetClientService.kt
+++ b/play-services-safetynet-core/src/main/kotlin/org/microg/gms/safetynet/SafetyNetClientService.kt
@@ -35,6 +35,7 @@ import org.microg.gms.settings.SettingsContract
import org.microg.gms.settings.SettingsContract.CheckIn.getContentUri
import org.microg.gms.settings.SettingsContract.getSettings
import java.io.IOException
+import java.net.URLEncoder
import java.util.*
private const val TAG = "GmsSafetyNet"
@@ -46,6 +47,10 @@ class SafetyNetClientService : BaseService(TAG, GmsService.SAFETY_NET_CLIENT) {
}
}
+private fun StringBuilder.appendUrlEncodedParam(key: String, value: String?) = append("&")
+ .append(URLEncoder.encode(key, "UTF-8"))
+ .append("=")
+ .append(value?.let { URLEncoder.encode(it, "UTF-8") } ?: "")
class SafetyNetClientServiceImpl(private val context: Context, private val packageName: String, private val lifecycle: Lifecycle) : ISafetyNetService.Stub(), LifecycleOwner {
override fun getLifecycle(): Lifecycle = lifecycle
@@ -133,7 +138,8 @@ class SafetyNetClientServiceImpl(private val context: Context, private val packa
return
}
- val intent = Intent(context, ReCaptchaActivity::class.java)
+ val intent = Intent("org.microg.gms.safetynet.RECAPTCHA_ACTIVITY")
+ intent.`package` = context.packageName
intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY)
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS)
diff --git a/settings.gradle b/settings.gradle
index f8812b76..1d066117 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -62,6 +62,7 @@ include ':play-services-vision-core'
include ':play-services-base-core-ui'
include ':play-services-droidguard-core-ui'
include ':play-services-nearby-core-ui'
+include ':play-services-safetynet-core-ui'
include ':firebase-auth-core'