Skip to content

Commit 7dafecf

Browse files
committed
Drop setPackage from SmsRetriever consent flow
In my testing, we don't need setpackage here at all, its redudant and removing it allows us to avoid the need for flavoring (compile time) or switching it to runtime compilation. In my diagnostic probe tool, I tested three scenarios: ``` component-only = keep the explicit component, but do not call setPackage(...) component + self package = keep the same explicit component, and set the package to the renamed/local package (BuildConfig.APPLICATION_ID) component + canonical com.google.android.gms package = keep the same explicit component, but set the package field to the canonical Google package instead ``` all three intent variants still resolved to the same UserConsentPromptActivity. This is because the component itself is doing the routing work. ``` 03-12 13:13:54.342 I PkgRenameDiag: Consent prompt component-only -> action=null | package=null | component=app.revanced.android.gms/org.microg.gms.auth.phone.UserConsentPromptActivity | activities=1 match(es): app.revanced.android.gms/org.microg.gms.auth.phone.UserConsentPromptActivity 03-12 13:13:54.342 I PkgRenameDiag: Consent prompt component+self package -> action=null | package=app.revanced.android.gms | component=app.revanced.android.gms/org.microg.gms.auth.phone.UserConsentPromptActivity | activities=1 match(es): app.revanced.android.gms/org.microg.gms.auth.phone.UserConsentPromptActivity 03-12 13:13:54.342 I PkgRenameDiag: Consent prompt component+canonical package -> action=null | package=com.google.android.gms | component=app.revanced.android.gms/org.microg.gms.auth.phone.UserConsentPromptActivity | activities=1 match(es): app.revanced.android.gms/org.microg.gms.auth.phone.UserConsentPromptActivity ``` I also looked at how PackageManager resolves intents: ``` 1. SmsRetrieverCore creates an explicit intent for UserConsentPromptActivity. 2. It attaches the google.messenger extra. 3. It places that intent into SmsRetriever.EXTRA_CONSENT_INTENT. 4. That extra is returned to the client app as part of the SMS User Consent API result. 5. Later, the client app launches that consent intent. ``` So for an explicit local activity intent, the component itself is already doing the main routing work.
1 parent 62ab6b5 commit 7dafecf

2 files changed

Lines changed: 0 additions & 23 deletions

File tree

play-services-auth-api-phone/core/build.gradle

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,32 +19,10 @@ android {
1919
compileSdkVersion androidCompileSdk
2020
buildToolsVersion "$androidBuildVersionTools"
2121

22-
buildFeatures {
23-
buildConfig = true
24-
}
25-
2622
defaultConfig {
2723
versionName version
2824
minSdkVersion androidMinSdk
2925
targetSdkVersion androidTargetSdk
30-
buildConfigField "String", "APPLICATION_ID", "\"com.google.android.gms\""
31-
}
32-
33-
flavorDimensions = ['target']
34-
productFlavors {
35-
"default" {
36-
dimension 'target'
37-
}
38-
"huawei" {
39-
dimension 'target'
40-
}
41-
"huaweilh" {
42-
dimension 'target'
43-
}
44-
"user" {
45-
dimension 'target'
46-
buildConfigField "String", "APPLICATION_ID", "\"app.revanced.android.gms\""
47-
}
4826
}
4927

5028
sourceSets {

play-services-auth-api-phone/core/src/main/kotlin/org/microg/gms/auth/phone/SmsRetrieverCore.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ class SmsRetrieverCore(private val context: Context, override val lifecycle: Lif
139139

140140
private fun sendUserConsentBroadcast(request: SmsRetrieverRequest, messageBody: String) {
141141
val userConsentIntent = Intent(context, UserConsentPromptActivity::class.java)
142-
userConsentIntent.setPackage(BuildConfig.APPLICATION_ID)
143142
userConsentIntent.putExtra(EXTRA_MESSENGER, Messenger(object : Handler(Looper.getMainLooper()) {
144143
override fun handleMessage(msg: Message) {
145144
if (Binder.getCallingUid() == Process.myUid()) {

0 commit comments

Comments
 (0)