Move ReCAPTCHA Activity to UI package

This commit is contained in:
Marvin W 2022-01-24 19:11:36 +01:00
parent 6e21b52bfe
commit 91071bbea1
No known key found for this signature in database
GPG Key ID: 072E9235DB996F2A
11 changed files with 96 additions and 13 deletions

View File

@ -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'

View File

@ -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')

View File

@ -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'

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ SPDX-FileCopyrightText: 2021 microG Project Team
~ SPDX-License-Identifier: Apache-2.0
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.microg.gms.safetynet.core.ui">
<application>
<activity
android:name="org.microg.gms.safetynet.ReCaptchaActivity"
android:autoRemoveFromRecents="true"
android:icon="@drawable/ic_recaptcha"
android:process=":ui"
android:exported="false"
android:theme="@style/Theme.AppCompat.Light.Dialog.NoActionBar">
<intent-filter>
<action android:name="org.microg.gms.safetynet.RECAPTCHA_ACTIVITY" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>

View File

@ -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") } ?: "")

View File

@ -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"

View File

@ -13,12 +13,5 @@
<action android:name="com.google.android.gms.safetynet.service.START" />
</intent-filter>
</service>
<activity
android:name="org.microg.gms.safetynet.ReCaptchaActivity"
android:autoRemoveFromRecents="true"
android:icon="@drawable/ic_recaptcha"
android:process=":ui"
android:theme="@style/Theme.AppCompat.Light.Dialog.NoActionBar" />
</application>
</manifest>

View File

@ -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)

View File

@ -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'