From 4924f2b9a65ae4e8fb2b566540b7320ab8400bc1 Mon Sep 17 00:00:00 2001 From: brian Date: Sun, 8 Mar 2026 20:05:07 -0400 Subject: [PATCH 1/8] Fix self-targeting for repackaged GmsCore Stop using canonical package identity at self-targeting call sites that actually mean the installed GmsCore APK, while keeping the Maps change narrowly scoped to the Mapbox backend path. For Maps, keep the loader and other backends unchanged and only stop the Mapbox backend from reconstructing a canonical com.google.android.gms context. Resolve the package context from the serving runtime application id instead, and keep MultiArchLoader version/APK lookup aligned with that Mapbox context. Also drop the transient self-package helpers and use direct package resolution at each call site: BuildConfig.APPLICATION_ID in play-services-core, and inline self-package context resolution in library modules that do not have the app BuildConfig. --- .../org/microg/gms/auth/phone/SmsRetrieverCore.kt | 5 ++--- .../android/gms/chimera/DynamiteContextFactory.java | 5 ++--- .../java/org/microg/gms/auth/login/LoginActivity.java | 4 ++-- .../java/org/microg/gms/games/GamesStubService.java | 2 +- .../src/main/java/org/microg/gms/gcm/McsService.java | 2 +- .../org/microg/gms/accountsettings/ui/MainActivity.kt | 4 ++-- .../auth/credentials/identity/AuthorizationService.kt | 6 +++--- .../org/microg/gms/auth/folsom/KeyRetrievalService.kt | 4 ++-- .../microg/gms/auth/signin/AssistedSignInActivity.kt | 5 ++--- .../microg/gms/credential/CredentialManagerService.kt | 6 +++--- .../main/kotlin/org/microg/gms/games/GamesService.kt | 6 +++--- .../kotlin/org/microg/gms/games/ui/GamesUiFragment.kt | 5 ++--- .../main/kotlin/org/microg/gms/gcm/GcmInGmsService.kt | 10 +++++----- .../gcm/registeration/ChimeGmsRegistrationHelper.kt | 5 +++-- .../main/kotlin/org/microg/gms/ui/AccountsFragment.kt | 3 +-- .../org/microg/gms/maps/mapbox/utils/MapContext.kt | 10 ++++++++-- .../microg/gms/maps/mapbox/utils/MultiArchLoader.kt | 3 +-- 17 files changed, 43 insertions(+), 42 deletions(-) diff --git a/play-services-auth-api-phone/core/src/main/kotlin/org/microg/gms/auth/phone/SmsRetrieverCore.kt b/play-services-auth-api-phone/core/src/main/kotlin/org/microg/gms/auth/phone/SmsRetrieverCore.kt index 1969359ec2..2c87d3a41a 100644 --- a/play-services-auth-api-phone/core/src/main/kotlin/org/microg/gms/auth/phone/SmsRetrieverCore.kt +++ b/play-services-auth-api-phone/core/src/main/kotlin/org/microg/gms/auth/phone/SmsRetrieverCore.kt @@ -41,7 +41,6 @@ import kotlinx.coroutines.sync.Mutex import kotlinx.coroutines.sync.withLock import org.microg.gms.auth.phone.SmsRetrieverRequestType.RETRIEVER import org.microg.gms.auth.phone.SmsRetrieverRequestType.USER_CONSENT -import org.microg.gms.common.Constants import org.microg.gms.utils.getSignatures import java.nio.charset.StandardCharsets import java.security.MessageDigest @@ -140,7 +139,7 @@ class SmsRetrieverCore(private val context: Context, override val lifecycle: Lif private fun sendUserConsentBroadcast(request: SmsRetrieverRequest, messageBody: String) { val userConsentIntent = Intent(context, UserConsentPromptActivity::class.java) - userConsentIntent.setPackage(Constants.GMS_PACKAGE_NAME) + userConsentIntent.setPackage(context.packageName) userConsentIntent.putExtra(EXTRA_MESSENGER, Messenger(object : Handler(Looper.getMainLooper()) { override fun handleMessage(msg: Message) { if (Binder.getCallingUid() == Process.myUid()) { @@ -356,4 +355,4 @@ class SmsRetrieverCore(private val context: Context, override val lifecycle: Lif } return deferred.await() } -} \ No newline at end of file +} diff --git a/play-services-core/src/main/java/com/google/android/gms/chimera/DynamiteContextFactory.java b/play-services-core/src/main/java/com/google/android/gms/chimera/DynamiteContextFactory.java index 80580d8342..d6bb943b48 100644 --- a/play-services-core/src/main/java/com/google/android/gms/chimera/DynamiteContextFactory.java +++ b/play-services-core/src/main/java/com/google/android/gms/chimera/DynamiteContextFactory.java @@ -15,12 +15,11 @@ import android.os.Process; import android.util.Log; +import com.google.android.gms.BuildConfig; import com.google.android.gms.chimera.container.DynamiteContext; import com.google.android.gms.chimera.container.DynamiteModuleInfo; import com.google.android.gms.chimera.container.FilteredClassLoader; -import org.microg.gms.common.Constants; - import java.io.File; import java.util.HashMap; import java.util.Map; @@ -49,7 +48,7 @@ public static DynamiteContext createDynamiteContext(String moduleId, Context ori } try { DynamiteModuleInfo moduleInfo = new DynamiteModuleInfo(moduleId); - Context gmsContext = originalContext.createPackageContext(Constants.GMS_PACKAGE_NAME, 0); + Context gmsContext = originalContext.createPackageContext(BuildConfig.APPLICATION_ID, 0); Context originalAppContext = originalContext.getApplicationContext(); DynamiteContext dynamiteContext; diff --git a/play-services-core/src/main/java/org/microg/gms/auth/login/LoginActivity.java b/play-services-core/src/main/java/org/microg/gms/auth/login/LoginActivity.java index ec032791f2..8ffbf645b9 100644 --- a/play-services-core/src/main/java/org/microg/gms/auth/login/LoginActivity.java +++ b/play-services-core/src/main/java/org/microg/gms/auth/login/LoginActivity.java @@ -137,7 +137,7 @@ public boolean shouldOverrideUrlLoading(WebView view, String url) { if (uriPath != null && uriPath.contains("/signup")) { String biz = uri.getQueryParameter("biz"); Intent intent = new Intent(LoginActivity.this, MainActivity.class); - intent.setPackage(GMS_PACKAGE_NAME); + intent.setPackage(getPackageName()); intent.putExtra(EXTRA_URL, biz != null ? GOOGLE_SIGNUP_URL + "?biz=" + biz : GOOGLE_SIGNUP_URL); startActivityForResult(intent, REQUEST_CODE_SIGNUP); return true; @@ -461,7 +461,7 @@ public void onException(Exception exception) { private void notifyGcmGroupUpdate(String accountName) { Intent intent = new Intent(ACTION_GCM_REGISTER_ACCOUNT); - intent.setPackage(Constants.GMS_PACKAGE_NAME); + intent.setPackage(getPackageName()); intent.putExtra(KEY_GCM_REGISTER_ACCOUNT_NAME, accountName); sendBroadcast(intent); } diff --git a/play-services-core/src/main/java/org/microg/gms/games/GamesStubService.java b/play-services-core/src/main/java/org/microg/gms/games/GamesStubService.java index 35b11fd1b4..f2a9a669d0 100644 --- a/play-services-core/src/main/java/org/microg/gms/games/GamesStubService.java +++ b/play-services-core/src/main/java/org/microg/gms/games/GamesStubService.java @@ -50,7 +50,7 @@ public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest reque } if (packageName == null) packageName = GMS_PACKAGE_NAME; Intent intent = new Intent(ACTION_PLAY_GAMES_UPGRADE); - intent.setPackage(GMS_PACKAGE_NAME); + intent.setPackage(getPackageName()); intent.putExtra(EXTRA_GAME_PACACKE_NAME, packageName); Bundle bundle = new Bundle(); bundle.putParcelable("pendingIntent", PendingIntentCompat.getActivity(this, packageName.hashCode(), intent, FLAG_UPDATE_CURRENT, false)); diff --git a/play-services-core/src/main/java/org/microg/gms/gcm/McsService.java b/play-services-core/src/main/java/org/microg/gms/gcm/McsService.java index 7bce08dbd3..b024ba9ec6 100644 --- a/play-services-core/src/main/java/org/microg/gms/gcm/McsService.java +++ b/play-services-core/src/main/java/org/microg/gms/gcm/McsService.java @@ -506,7 +506,7 @@ private void handleLoginResponse(LoginResponse loginResponse) { private void notifyGcmConnected() { Intent intent = new Intent(ACTION_GCM_CONNECTED); - intent.setPackage(Constants.GMS_PACKAGE_NAME); + intent.setPackage(getPackageName()); sendBroadcast(intent); } diff --git a/play-services-core/src/main/kotlin/org/microg/gms/accountsettings/ui/MainActivity.kt b/play-services-core/src/main/kotlin/org/microg/gms/accountsettings/ui/MainActivity.kt index b69f8ac8aa..3325cb645a 100644 --- a/play-services-core/src/main/kotlin/org/microg/gms/accountsettings/ui/MainActivity.kt +++ b/play-services-core/src/main/kotlin/org/microg/gms/accountsettings/ui/MainActivity.kt @@ -332,8 +332,8 @@ class MainActivity : AppCompatActivity() { Log.d(TAG, "updateVerifyNotification: notificationId: $notificationId") if (notificationId == -1) return Intent(ACTION_GCM_NOTIFY_COMPLETE).apply { - setPackage(GMS_PACKAGE_NAME) + setPackage(packageName) putExtra(EXTRA_NOTIFICATION_ACCOUNT, accountName) }.let { sendBroadcast(it) } } -} \ No newline at end of file +} diff --git a/play-services-core/src/main/kotlin/org/microg/gms/auth/credentials/identity/AuthorizationService.kt b/play-services-core/src/main/kotlin/org/microg/gms/auth/credentials/identity/AuthorizationService.kt index 286b543485..131a1754ee 100644 --- a/play-services-core/src/main/kotlin/org/microg/gms/auth/credentials/identity/AuthorizationService.kt +++ b/play-services-core/src/main/kotlin/org/microg/gms/auth/credentials/identity/AuthorizationService.kt @@ -15,6 +15,7 @@ import android.util.Log import androidx.lifecycle.Lifecycle import androidx.lifecycle.LifecycleOwner import androidx.lifecycle.lifecycleScope +import com.google.android.gms.BuildConfig import com.google.android.gms.auth.api.identity.AuthorizationRequest import com.google.android.gms.auth.api.identity.AuthorizationResult import com.google.android.gms.auth.api.identity.ClearTokenRequest @@ -45,7 +46,6 @@ import org.microg.gms.auth.signin.getServerAuthTokenManager import org.microg.gms.auth.signin.performSignIn import org.microg.gms.auth.signin.scopeUris import org.microg.gms.common.AccountUtils -import org.microg.gms.common.Constants import org.microg.gms.common.GmsService import org.microg.gms.common.PackageUtils import java.util.concurrent.atomic.AtomicInteger @@ -107,7 +107,7 @@ class AuthorizationServiceImpl(val context: Context, val packageName: String, ov defaultAccount?.name?.let { setAccountName(it) } }.build() val intent = Intent(context, AuthSignInActivity::class.java).apply { - `package` = Constants.GMS_PACKAGE_NAME + `package` = BuildConfig.APPLICATION_ID putExtra("config", SignInConfiguration(packageName, options)) } AuthorizationResult( @@ -179,4 +179,4 @@ class AuthorizationServiceImpl(val context: Context, val packageName: String, ov runCatching { callback?.onResult(Status.SUCCESS) } } -} \ No newline at end of file +} diff --git a/play-services-core/src/main/kotlin/org/microg/gms/auth/folsom/KeyRetrievalService.kt b/play-services-core/src/main/kotlin/org/microg/gms/auth/folsom/KeyRetrievalService.kt index 73332793d3..ef358d1083 100644 --- a/play-services-core/src/main/kotlin/org/microg/gms/auth/folsom/KeyRetrievalService.kt +++ b/play-services-core/src/main/kotlin/org/microg/gms/auth/folsom/KeyRetrievalService.kt @@ -11,6 +11,7 @@ import android.content.Intent import android.os.Parcel import android.util.Log import androidx.core.app.PendingIntentCompat +import com.google.android.gms.BuildConfig import com.google.android.gms.auth.folsom.RecoveryRequest import com.google.android.gms.auth.folsom.RecoveryResult import com.google.android.gms.auth.folsom.SharedKey @@ -35,7 +36,6 @@ import com.google.android.gms.common.internal.GetServiceRequest import com.google.android.gms.common.internal.IGmsCallbacks import org.microg.gms.BaseService import org.microg.gms.auth.folsom.ui.GenericActivity -import org.microg.gms.common.Constants.GMS_PACKAGE_NAME import org.microg.gms.common.GmsService import org.microg.gms.utils.warnOnTransactionIssues @@ -149,7 +149,7 @@ class KeyRetrievalServiceImpl(val context: Context) : IKeyRetrievalService.Stub( callback: IKeyRetrievalCallback?, accountName: String?, type: Int, metadata: ApiMetadata? ) { Log.d(TAG, "Not implemented startUxFlow accountName:$accountName type:$type metadata:$metadata") - val intent = Intent().apply { setClassName(GMS_PACKAGE_NAME, GenericActivity::class.java.name) } + val intent = Intent().apply { setClassName(BuildConfig.APPLICATION_ID, GenericActivity::class.java.name) } val pendingIntent = PendingIntentCompat.getActivity(context, 0, intent, FLAG_UPDATE_CURRENT, false) val states = Status(CommonStatusCodes.SUCCESS, "UX flow PendingIntent retrieved.", pendingIntent) callback?.onResult(states) diff --git a/play-services-core/src/main/kotlin/org/microg/gms/auth/signin/AssistedSignInActivity.kt b/play-services-core/src/main/kotlin/org/microg/gms/auth/signin/AssistedSignInActivity.kt index 15667eae1a..f2f36f92d7 100644 --- a/play-services-core/src/main/kotlin/org/microg/gms/auth/signin/AssistedSignInActivity.kt +++ b/play-services-core/src/main/kotlin/org/microg/gms/auth/signin/AssistedSignInActivity.kt @@ -20,7 +20,6 @@ import com.google.android.gms.common.api.CommonStatusCodes import com.google.android.gms.common.api.Status import com.google.android.gms.common.internal.safeparcel.SafeParcelableSerializer import org.microg.gms.auth.AuthConstants -import org.microg.gms.common.Constants const val ACTION_ASSISTED_SIGN_IN = "com.google.android.gms.auth.api.credentials.ASSISTED_SIGNIN" const val GET_SIGN_IN_INTENT_REQUEST = "get_sign_in_intent_request" @@ -98,7 +97,7 @@ class AssistedSignInActivity : AppCompatActivity() { Log.d(TAG, "prepareSignIn options:$googleSignInOptions") val signInConfiguration = SignInConfiguration(clientPackageName!!, googleSignInOptions!!) val intent = Intent(this, AuthSignInActivity::class.java).apply { - `package` = Constants.GMS_PACKAGE_NAME + `package` = this@AssistedSignInActivity.packageName putExtra("config", signInConfiguration) putExtra("nonce", signInIntentRequest?.nonce) } @@ -166,4 +165,4 @@ class AssistedSignInActivity : AppCompatActivity() { assistedSignInFragment.initView() } } -} \ No newline at end of file +} diff --git a/play-services-core/src/main/kotlin/org/microg/gms/credential/CredentialManagerService.kt b/play-services-core/src/main/kotlin/org/microg/gms/credential/CredentialManagerService.kt index f354349108..74a37eaa41 100644 --- a/play-services-core/src/main/kotlin/org/microg/gms/credential/CredentialManagerService.kt +++ b/play-services-core/src/main/kotlin/org/microg/gms/credential/CredentialManagerService.kt @@ -15,6 +15,7 @@ import androidx.core.app.PendingIntentCompat import androidx.lifecycle.Lifecycle import androidx.lifecycle.LifecycleOwner import androidx.lifecycle.lifecycleScope +import com.google.android.gms.BuildConfig import com.google.android.gms.common.ConnectionResult import com.google.android.gms.common.Feature import com.google.android.gms.common.api.Status @@ -29,7 +30,6 @@ import com.google.android.gms.credential.manager.common.ISettingsCallback import com.google.android.gms.credential.manager.firstparty.internal.ICredentialManagerService import com.google.android.gms.credential.manager.invocationparams.CredentialManagerInvocationParams import org.microg.gms.BaseService -import org.microg.gms.common.Constants import org.microg.gms.common.GmsService import org.microg.gms.common.GooglePackagePermission import org.microg.gms.common.PackageUtils @@ -63,7 +63,7 @@ private class CredentialManagerServiceImpl(private val context: Context, overrid lifecycleScope.launchWhenStarted { runCatching { val intent = Intent().apply { - setClassName(Constants.GMS_PACKAGE_NAME, PASSWORD_MANAGER_CLASS_NAME) + setClassName(BuildConfig.APPLICATION_ID, PASSWORD_MANAGER_CLASS_NAME) putExtra(EXTRA_KEY_ACCOUNT_NAME, params.account.name) addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) } @@ -99,4 +99,4 @@ private class CredentialManagerServiceImpl(private val context: Context, overrid } override fun onTransact(code: Int, data: Parcel, reply: Parcel?, flags: Int): Boolean = warnOnTransactionIssues(code, reply, flags, TAG) { super.onTransact(code, data, reply, flags) } -} \ No newline at end of file +} diff --git a/play-services-core/src/main/kotlin/org/microg/gms/games/GamesService.kt b/play-services-core/src/main/kotlin/org/microg/gms/games/GamesService.kt index cd30a1675b..06af97314f 100644 --- a/play-services-core/src/main/kotlin/org/microg/gms/games/GamesService.kt +++ b/play-services-core/src/main/kotlin/org/microg/gms/games/GamesService.kt @@ -22,6 +22,7 @@ import androidx.core.os.bundleOf import androidx.lifecycle.Lifecycle import androidx.lifecycle.LifecycleOwner import androidx.lifecycle.lifecycleScope +import com.google.android.gms.BuildConfig import com.google.android.gms.common.ConnectionResult import com.google.android.gms.common.Scopes import com.google.android.gms.common.api.CommonStatusCodes @@ -51,7 +52,6 @@ import org.microg.gms.auth.AuthConstants import org.microg.gms.auth.AuthManager import org.microg.gms.auth.AuthPrefs import org.microg.gms.auth.signin.checkAccountAuthStatus -import org.microg.gms.common.Constants import org.microg.gms.common.GmsService import org.microg.gms.common.PackageUtils import org.microg.gms.games.achievements.AchievementsApiClient @@ -580,7 +580,7 @@ class GamesServiceImpl(val context: Context, override val lifecycle: Lifecycle, private fun getGamesIntent(action: String, block: Intent.() -> Unit = {}) = Intent(action).apply { // Jump to internal page implementation - setPackage(Constants.GMS_PACKAGE_NAME) + setPackage(BuildConfig.APPLICATION_ID) putExtra(EXTRA_ACCOUNT_KEY, Integer.toHexString(account.name.hashCode())) putExtra(EXTRA_GAME_PACKAGE_NAME, packageName) addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP) @@ -793,4 +793,4 @@ class GamesServiceImpl(val context: Context, override val lifecycle: Lifecycle, override fun onTransact(code: Int, data: Parcel, reply: Parcel?, flags: Int): Boolean = warnOnTransactionIssues(code, reply, flags, TAG) { super.onTransact(code, data, reply, flags) } -} \ No newline at end of file +} diff --git a/play-services-core/src/main/kotlin/org/microg/gms/games/ui/GamesUiFragment.kt b/play-services-core/src/main/kotlin/org/microg/gms/games/ui/GamesUiFragment.kt index 1f25fb1b77..e1f492e212 100644 --- a/play-services-core/src/main/kotlin/org/microg/gms/games/ui/GamesUiFragment.kt +++ b/play-services-core/src/main/kotlin/org/microg/gms/games/ui/GamesUiFragment.kt @@ -41,7 +41,6 @@ import kotlinx.coroutines.withContext import org.microg.gms.auth.AuthConstants import org.microg.gms.auth.AuthManager import org.microg.gms.auth.signin.SignInConfigurationService -import org.microg.gms.common.Constants import org.microg.gms.games.ACTION_VIEW_ACHIEVEMENTS import org.microg.gms.games.ACTION_VIEW_LEADERBOARDS import org.microg.gms.games.ACTION_VIEW_LEADERBOARDS_SCORES @@ -348,7 +347,7 @@ class GamesUiFragment : BottomSheetDialogFragment() { } }?.adapter = LeaderboardsAdapter(context, loadLeaderboards) { leaderboard -> val intent = Intent(ACTION_VIEW_LEADERBOARDS_SCORES) - intent.setPackage(Constants.GMS_PACKAGE_NAME) + intent.setPackage(context.packageName) intent.putExtra(EXTRA_GAME_PACKAGE_NAME, clientPackageName) intent.putExtra(EXTRA_ACCOUNT_KEY, Integer.toHexString(currentAccount?.name.hashCode())) intent.putExtra(EXTRA_LEADERBOARD_ID, leaderboard.id) @@ -461,4 +460,4 @@ class GamesUiFragment : BottomSheetDialogFragment() { }?.adapter = AchievementsAdapter(context, targetList) } -} \ No newline at end of file +} diff --git a/play-services-core/src/main/kotlin/org/microg/gms/gcm/GcmInGmsService.kt b/play-services-core/src/main/kotlin/org/microg/gms/gcm/GcmInGmsService.kt index 36b0c36994..34832c17af 100644 --- a/play-services-core/src/main/kotlin/org/microg/gms/gcm/GcmInGmsService.kt +++ b/play-services-core/src/main/kotlin/org/microg/gms/gcm/GcmInGmsService.kt @@ -122,7 +122,7 @@ class GcmInGmsService : LifecycleService() { handleIntent(intent) } else { val intent = Intent(ACTION_GCM_RECONNECT).apply { - setPackage(Constants.GMS_PACKAGE_NAME) + setPackage(this@GcmInGmsService.packageName) } sendBroadcast(intent) } @@ -270,7 +270,7 @@ class GcmInGmsService : LifecycleService() { val content = notificationData.content ?: return val intentExtras = notificationData.intentActions?.primaryPayload?.extras ?: return val intent = Intent(this, MainActivity::class.java).apply { - `package` = Constants.GMS_PACKAGE_NAME + `package` = this@GcmInGmsService.packageName flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_MULTIPLE_TASK intentExtras.forEach { putExtra(it.key, it.value_) } putExtra(KEY_NOTIFICATION_ID, notificationId) @@ -309,9 +309,9 @@ class GcmInGmsService : LifecycleService() { } Log.d(TAG, "updateGroupsWithAccount extras: $extras") val intent = Intent(GcmConstants.ACTION_GCM_SEND).apply { - setPackage(Constants.GMS_PACKAGE_NAME) + setPackage(this@GcmInGmsService.packageName) putExtras(extras) - putExtra(GcmConstants.EXTRA_APP, Intent().apply { setPackage(Constants.GMS_PACKAGE_NAME) }.let { PendingIntentCompat.getBroadcast(this@GcmInGmsService, 0, it, 0, false) }) + putExtra(GcmConstants.EXTRA_APP, Intent().apply { setPackage(this@GcmInGmsService.packageName) }.let { PendingIntentCompat.getBroadcast(this@GcmInGmsService, 0, it, 0, false) }) }.also { it.putExtra(GcmConstants.EXTRA_MESSENGER, Messenger(object : Handler(Looper.getMainLooper()) { override fun handleMessage(msg: Message) { @@ -387,7 +387,7 @@ class GcmInGmsService : LifecycleService() { } else { Log.d(TAG, "registerGcmInGms: sendBroadcast: ${intent.action}") Intent(intent.action).apply { - setPackage(Constants.GMS_PACKAGE_NAME) + setPackage(this@GcmInGmsService.packageName) putExtras(intent) }.let { sendBroadcast(it) } } diff --git a/play-services-core/src/main/kotlin/org/microg/gms/gcm/registeration/ChimeGmsRegistrationHelper.kt b/play-services-core/src/main/kotlin/org/microg/gms/gcm/registeration/ChimeGmsRegistrationHelper.kt index 6131b492d2..61adcc8cd4 100644 --- a/play-services-core/src/main/kotlin/org/microg/gms/gcm/registeration/ChimeGmsRegistrationHelper.kt +++ b/play-services-core/src/main/kotlin/org/microg/gms/gcm/registeration/ChimeGmsRegistrationHelper.kt @@ -12,6 +12,7 @@ import android.os.LocaleList import android.util.Log import androidx.core.app.NotificationManagerCompat import androidx.core.content.edit +import com.google.android.gms.BuildConfig import google.internal.notifications.v1.AppBlockState import google.internal.notifications.v1.AppRegistration import google.internal.notifications.v1.AppRegistrationContainer @@ -128,7 +129,7 @@ class ChimeGmsRegistrationHelper(val context: Context) { private fun buildDeviceContext() = GmsDeviceContext.build { languageTag = if (SDK_INT >= 24) LocaleList.getDefault().get(0).toLanguageTag() else Locale.getDefault().language gmsDeviceProfile = GmsDeviceProfile.build { - val packageInfo = context.packageManager.getPackageInfo(Constants.GMS_PACKAGE_NAME, 0) + val packageInfo = context.packageManager.getPackageInfo(BuildConfig.APPLICATION_ID, 0) density = context.resources.displayMetrics.density versionName = packageInfo.versionName release = Build.VERSION.RELEASE @@ -175,4 +176,4 @@ class ChimeGmsRegistrationHelper(val context: Context) { fun resetAllData() { chimeAccountsStore.edit { clear() } } -} \ No newline at end of file +} diff --git a/play-services-core/src/main/kotlin/org/microg/gms/ui/AccountsFragment.kt b/play-services-core/src/main/kotlin/org/microg/gms/ui/AccountsFragment.kt index 2be044bd99..b132abb34f 100644 --- a/play-services-core/src/main/kotlin/org/microg/gms/ui/AccountsFragment.kt +++ b/play-services-core/src/main/kotlin/org/microg/gms/ui/AccountsFragment.kt @@ -25,7 +25,6 @@ import com.google.android.gms.R import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext import org.microg.gms.auth.AuthConstants -import org.microg.gms.common.Constants import org.microg.gms.gcm.ACTION_GCM_CONNECTED import org.microg.gms.gcm.ACTION_GCM_REGISTER_ALL_ACCOUNTS import org.microg.gms.people.DatabaseHelper @@ -67,7 +66,7 @@ class AccountsFragment : PreferenceFragmentCompat() { private fun registerGcmInGms() { Intent(ACTION_GCM_REGISTER_ALL_ACCOUNTS).apply { - `package` = Constants.GMS_PACKAGE_NAME + `package` = requireContext().packageName }.let { requireContext().sendBroadcast(it) } } diff --git a/play-services-maps/core/mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/utils/MapContext.kt b/play-services-maps/core/mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/utils/MapContext.kt index f889239647..61be960a75 100644 --- a/play-services-maps/core/mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/utils/MapContext.kt +++ b/play-services-maps/core/mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/utils/MapContext.kt @@ -21,10 +21,16 @@ import android.content.ContextWrapper import android.content.Intent import android.content.SharedPreferences import android.view.LayoutInflater -import org.microg.gms.common.Constants import java.io.File -class MapContext(private val context: Context) : ContextWrapper(context.createPackageContext(Constants.GMS_PACKAGE_NAME, Context.CONTEXT_INCLUDE_CODE or Context.CONTEXT_IGNORE_SECURITY)) { +class MapContext(private val context: Context) : ContextWrapper( + context.createPackageContext( + Class.forName("com.google.android.gms.BuildConfig") + .getField("APPLICATION_ID") + .get(null) as String, + Context.CONTEXT_INCLUDE_CODE or Context.CONTEXT_IGNORE_SECURITY + ) +) { private var layoutInflater: LayoutInflater? = null private val appContext: Context get() = context.applicationContext ?: context diff --git a/play-services-maps/core/mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/utils/MultiArchLoader.kt b/play-services-maps/core/mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/utils/MultiArchLoader.kt index 5a37a6d83c..7d148981ea 100644 --- a/play-services-maps/core/mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/utils/MultiArchLoader.kt +++ b/play-services-maps/core/mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/utils/MultiArchLoader.kt @@ -21,7 +21,6 @@ import android.content.Context import android.content.pm.ApplicationInfo import android.util.Log import com.mapbox.mapboxsdk.LibraryLoader -import org.microg.gms.common.Constants import org.microg.gms.common.PackageUtils import java.io.* import java.util.zip.ZipFile @@ -42,7 +41,7 @@ class MultiArchLoader(private val mapContext: Context, private val appContext: C val cacheFileStamp = File("${appContext.cacheDir.absolutePath}/.gmscore/$path.stamp") val cacheVersion = kotlin.runCatching { cacheFileStamp.readText() }.getOrNull() // TODO: Use better version indicator - val mapVersion = PackageUtils.versionName(mapContext, Constants.GMS_PACKAGE_NAME) + val mapVersion = PackageUtils.versionName(mapContext, mapContext.applicationInfo.packageName) val apkFile = File(mapContext.packageCodePath) if (!cacheFile.exists() || cacheVersion == null || cacheVersion != mapVersion) { val zipFile = ZipFile(apkFile) From 71f0b58a8444c049565a7835aceee5e2c76f6776 Mon Sep 17 00:00:00 2001 From: brian Date: Sun, 8 Mar 2026 20:05:35 -0400 Subject: [PATCH 2/8] Route vision face detectors through self package context The package-rename diagnostics showed that the Vision/MLKit face detector creators were still using the canonical package context even though the actual detector helper and model asset are owned by the serving self APK. Apply that ownership decision to all four remaining Vision/MLKit face detector creators by resolving the installed self package directly from the incoming context instead of going through a shared helper. --- .../vision/client/DynamiteNativeFaceDetectorCreator.kt | 9 ++++----- .../gms/vision/face/ChimeraNativeFaceDetectorCreator.kt | 9 ++++----- .../android/gms/vision/face/mlkit/FaceDetectorCreator.kt | 9 ++++----- .../face/bundled/internal/ThickFaceDetectorCreator.kt | 9 ++++----- 4 files changed, 16 insertions(+), 20 deletions(-) diff --git a/play-services-vision/core/src/main/kotlin/com/google/android/gms/vision/client/DynamiteNativeFaceDetectorCreator.kt b/play-services-vision/core/src/main/kotlin/com/google/android/gms/vision/client/DynamiteNativeFaceDetectorCreator.kt index 6406f69652..ac65e7e320 100644 --- a/play-services-vision/core/src/main/kotlin/com/google/android/gms/vision/client/DynamiteNativeFaceDetectorCreator.kt +++ b/play-services-vision/core/src/main/kotlin/com/google/android/gms/vision/client/DynamiteNativeFaceDetectorCreator.kt @@ -9,7 +9,6 @@ import android.content.Context import android.os.SystemClock import android.util.Log import androidx.annotation.Keep -import com.google.android.gms.common.GooglePlayServicesUtil import com.google.android.gms.dynamic.IObjectWrapper import com.google.android.gms.dynamic.unwrap import com.google.android.gms.vision.face.internal.client.DetectionOptions @@ -27,16 +26,16 @@ class DynamiteNativeFaceDetectorCreator : INativeFaceDetectorCreator.Stub() { try { val elapsedRealtime = SystemClock.elapsedRealtime() val context = context.unwrap() ?: throw RuntimeException("Context is null") - val remoteContext = GooglePlayServicesUtil.getRemoteContext(context) ?: throw RuntimeException("remoteContext is null") - Log.d(TAG, "newFaceDetector: context: ${context.packageName} remoteContext: ${remoteContext.packageName}") + val detectorContext = context.createPackageContext(context.applicationContext?.packageName ?: context.packageName, 0) + Log.d(TAG, "newFaceDetector: context: ${context.packageName} detectorContext: ${detectorContext.packageName}") if (!OpenCVLoader.initLocal()) { throw RuntimeException("Unable to load OpenCV") } Log.d(TAG, "DynamiteNativeFaceDetectorCreator newFaceDetector: load library in ${SystemClock.elapsedRealtime() - elapsedRealtime}ms") - return FaceDetector(remoteContext, faceDetectionOptions) + return FaceDetector(detectorContext, faceDetectionOptions) } catch (e: Throwable) { Log.w(TAG, "DynamiteNativeFaceDetectorCreator newFaceDetector load failed ", e) return null } } -} \ No newline at end of file +} diff --git a/play-services-vision/core/src/main/kotlin/com/google/android/gms/vision/face/ChimeraNativeFaceDetectorCreator.kt b/play-services-vision/core/src/main/kotlin/com/google/android/gms/vision/face/ChimeraNativeFaceDetectorCreator.kt index 5ece33ee89..ad8666002e 100644 --- a/play-services-vision/core/src/main/kotlin/com/google/android/gms/vision/face/ChimeraNativeFaceDetectorCreator.kt +++ b/play-services-vision/core/src/main/kotlin/com/google/android/gms/vision/face/ChimeraNativeFaceDetectorCreator.kt @@ -9,7 +9,6 @@ import android.content.Context import android.os.SystemClock import android.util.Log import androidx.annotation.Keep -import com.google.android.gms.common.GooglePlayServicesUtil import com.google.android.gms.dynamic.IObjectWrapper import com.google.android.gms.dynamic.unwrap import com.google.android.gms.vision.face.internal.client.DetectionOptions @@ -26,16 +25,16 @@ class ChimeraNativeFaceDetectorCreator : INativeFaceDetectorCreator.Stub() { try { val elapsedRealtime = SystemClock.elapsedRealtime() val context = context.unwrap() ?: throw RuntimeException("Context is null") - val remoteContext = GooglePlayServicesUtil.getRemoteContext(context) ?: throw RuntimeException("remoteContext is null") - Log.d(TAG, "newFaceDetector: context: ${context.packageName} remoteContext: ${remoteContext.packageName}") + val detectorContext = context.createPackageContext(context.applicationContext?.packageName ?: context.packageName, 0) + Log.d(TAG, "newFaceDetector: context: ${context.packageName} detectorContext: ${detectorContext.packageName}") if (!OpenCVLoader.initLocal()) { throw RuntimeException("Unable to load OpenCV") } Log.d(TAG, "ChimeraNativeFaceDetectorCreator newFaceDetector: load library in ${SystemClock.elapsedRealtime() - elapsedRealtime}ms") - return FaceDetector(remoteContext, faceDetectionOptions) + return FaceDetector(detectorContext, faceDetectionOptions) } catch (e: Throwable) { Log.w(TAG, "ChimeraNativeFaceDetectorCreator newFaceDetector load failed ", e) return null } } -} \ No newline at end of file +} diff --git a/play-services-vision/core/src/main/kotlin/com/google/android/gms/vision/face/mlkit/FaceDetectorCreator.kt b/play-services-vision/core/src/main/kotlin/com/google/android/gms/vision/face/mlkit/FaceDetectorCreator.kt index a0948771a2..f3747eb840 100644 --- a/play-services-vision/core/src/main/kotlin/com/google/android/gms/vision/face/mlkit/FaceDetectorCreator.kt +++ b/play-services-vision/core/src/main/kotlin/com/google/android/gms/vision/face/mlkit/FaceDetectorCreator.kt @@ -9,7 +9,6 @@ import android.content.Context import android.os.SystemClock import android.util.Log import androidx.annotation.Keep -import com.google.android.gms.common.GooglePlayServicesUtil import com.google.android.gms.dynamic.IObjectWrapper import com.google.android.gms.dynamic.unwrap import com.google.mlkit.vision.face.FaceDetectionOptions @@ -27,16 +26,16 @@ class FaceDetectorCreator : IFaceDetectorCreator.Stub() { try { val elapsedRealtime = SystemClock.elapsedRealtime() val context = context.unwrap() ?: throw RuntimeException("Context is null") - val remoteContext = GooglePlayServicesUtil.getRemoteContext(context) ?: throw RuntimeException("remoteContext is null") - Log.d(TAG, "newFaceDetector: context: ${context.packageName} remoteContext: ${remoteContext.packageName}") + val detectorContext = context.createPackageContext(context.applicationContext?.packageName ?: context.packageName, 0) + Log.d(TAG, "newFaceDetector: context: ${context.packageName} detectorContext: ${detectorContext.packageName}") if (!OpenCVLoader.initLocal()) { throw RuntimeException("Unable to load OpenCV") } Log.d(TAG, "FaceDetectorCreator newFaceDetector: load library in ${SystemClock.elapsedRealtime() - elapsedRealtime}ms") - return FaceDetector(remoteContext, faceDetectionOptions) + return FaceDetector(detectorContext, faceDetectionOptions) } catch (e: Throwable) { Log.w(TAG, "FaceDetectorCreator newFaceDetector load failed ", e) return null } } -} \ No newline at end of file +} diff --git a/play-services-vision/core/src/main/kotlin/com/google/mlkit/vision/face/bundled/internal/ThickFaceDetectorCreator.kt b/play-services-vision/core/src/main/kotlin/com/google/mlkit/vision/face/bundled/internal/ThickFaceDetectorCreator.kt index 9ebcd2078d..c0984d9fa9 100644 --- a/play-services-vision/core/src/main/kotlin/com/google/mlkit/vision/face/bundled/internal/ThickFaceDetectorCreator.kt +++ b/play-services-vision/core/src/main/kotlin/com/google/mlkit/vision/face/bundled/internal/ThickFaceDetectorCreator.kt @@ -9,7 +9,6 @@ import android.content.Context import android.os.SystemClock import android.util.Log import androidx.annotation.Keep -import com.google.android.gms.common.GooglePlayServicesUtil import com.google.android.gms.dynamic.IObjectWrapper import com.google.android.gms.dynamic.unwrap import com.google.mlkit.vision.face.FaceDetectionOptions @@ -27,16 +26,16 @@ class ThickFaceDetectorCreator : IFaceDetectorCreator.Stub() { try { val elapsedRealtime = SystemClock.elapsedRealtime() val context = context.unwrap() ?: throw RuntimeException("Context is null") - val remoteContext = GooglePlayServicesUtil.getRemoteContext(context) ?: throw RuntimeException("remoteContext is null") - Log.d(TAG, "ThickFaceDetectorCreator newFaceDetector: context: ${context.packageName} remoteContext: ${remoteContext.packageName}") + val detectorContext = context.createPackageContext(context.applicationContext?.packageName ?: context.packageName, 0) + Log.d(TAG, "ThickFaceDetectorCreator newFaceDetector: context: ${context.packageName} detectorContext: ${detectorContext.packageName}") if (!OpenCVLoader.initLocal()) { throw RuntimeException("Unable to load OpenCV") } Log.d(TAG, "ThickFaceDetectorCreator newFaceDetector: load library in ${SystemClock.elapsedRealtime() - elapsedRealtime}ms") - return FaceDetector(remoteContext, faceDetectionOptions) + return FaceDetector(detectorContext, faceDetectionOptions) } catch (e: Throwable) { Log.w(TAG, "ThickFaceDetectorCreator newFaceDetector load failed ", e) return null } } -} \ No newline at end of file +} From 3fb21f2504bf10342b9458be2316f7bf7c7c7b86 Mon Sep 17 00:00:00 2001 From: brian Date: Sun, 8 Mar 2026 20:41:53 -0400 Subject: [PATCH 3/8] Use BuildConfig.APPLICATION_ID in LoginActivity Runtime checks showed these LoginActivity package targets are self-owned flows. The signup handoff already resolved to LoginActivity's internal MainActivity component; the remaining issue was that the package field still pointed at canonical com.google.android.gms instead of the serving GmsCore app. The post-login ACTION_GCM_REGISTER_ACCOUNT broadcast also needs to target the receiver in the serving GmsCore app, not a separate canonical GMS package. Because LoginActivity is in the app module, BuildConfig.APPLICATION_ID is the simplest self-package constant for both call sites. --- .../main/java/org/microg/gms/auth/login/LoginActivity.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/play-services-core/src/main/java/org/microg/gms/auth/login/LoginActivity.java b/play-services-core/src/main/java/org/microg/gms/auth/login/LoginActivity.java index 8ffbf645b9..c980fd7fdc 100644 --- a/play-services-core/src/main/java/org/microg/gms/auth/login/LoginActivity.java +++ b/play-services-core/src/main/java/org/microg/gms/auth/login/LoginActivity.java @@ -46,6 +46,7 @@ import androidx.annotation.StringRes; import androidx.webkit.WebViewClientCompat; +import com.google.android.gms.BuildConfig; import com.google.android.gms.R; import org.json.JSONArray; @@ -137,7 +138,7 @@ public boolean shouldOverrideUrlLoading(WebView view, String url) { if (uriPath != null && uriPath.contains("/signup")) { String biz = uri.getQueryParameter("biz"); Intent intent = new Intent(LoginActivity.this, MainActivity.class); - intent.setPackage(getPackageName()); + intent.setPackage(BuildConfig.APPLICATION_ID); intent.putExtra(EXTRA_URL, biz != null ? GOOGLE_SIGNUP_URL + "?biz=" + biz : GOOGLE_SIGNUP_URL); startActivityForResult(intent, REQUEST_CODE_SIGNUP); return true; @@ -461,7 +462,7 @@ public void onException(Exception exception) { private void notifyGcmGroupUpdate(String accountName) { Intent intent = new Intent(ACTION_GCM_REGISTER_ACCOUNT); - intent.setPackage(getPackageName()); + intent.setPackage(BuildConfig.APPLICATION_ID); intent.putExtra(KEY_GCM_REGISTER_ACCOUNT_NAME, accountName); sendBroadcast(intent); } From 8a9fd42801a97247f1c05fb84bd48f887e284433 Mon Sep 17 00:00:00 2001 From: brian Date: Wed, 11 Mar 2026 19:08:30 -0400 Subject: [PATCH 4/8] Use BuildConfig.APPLICATION_ID for self package targets --- .../java/org/microg/gms/games/GamesStubService.java | 3 ++- .../src/main/java/org/microg/gms/gcm/McsService.java | 3 ++- .../org/microg/gms/accountsettings/ui/MainActivity.kt | 3 ++- .../microg/gms/auth/signin/AssistedSignInActivity.kt | 3 ++- .../kotlin/org/microg/gms/games/ui/GamesUiFragment.kt | 3 ++- .../main/kotlin/org/microg/gms/gcm/GcmInGmsService.kt | 10 +++++----- .../main/kotlin/org/microg/gms/ui/AccountsFragment.kt | 3 ++- 7 files changed, 17 insertions(+), 11 deletions(-) diff --git a/play-services-core/src/main/java/org/microg/gms/games/GamesStubService.java b/play-services-core/src/main/java/org/microg/gms/games/GamesStubService.java index f2a9a669d0..6dd8d57015 100644 --- a/play-services-core/src/main/java/org/microg/gms/games/GamesStubService.java +++ b/play-services-core/src/main/java/org/microg/gms/games/GamesStubService.java @@ -22,6 +22,7 @@ import android.os.RemoteException; import androidx.core.app.PendingIntentCompat; +import com.google.android.gms.BuildConfig; import com.google.android.gms.common.api.CommonStatusCodes; import com.google.android.gms.common.internal.GetServiceRequest; import com.google.android.gms.common.internal.IGmsCallbacks; @@ -50,7 +51,7 @@ public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest reque } if (packageName == null) packageName = GMS_PACKAGE_NAME; Intent intent = new Intent(ACTION_PLAY_GAMES_UPGRADE); - intent.setPackage(getPackageName()); + intent.setPackage(BuildConfig.APPLICATION_ID); intent.putExtra(EXTRA_GAME_PACACKE_NAME, packageName); Bundle bundle = new Bundle(); bundle.putParcelable("pendingIntent", PendingIntentCompat.getActivity(this, packageName.hashCode(), intent, FLAG_UPDATE_CURRENT, false)); diff --git a/play-services-core/src/main/java/org/microg/gms/gcm/McsService.java b/play-services-core/src/main/java/org/microg/gms/gcm/McsService.java index b024ba9ec6..fdbe367b76 100644 --- a/play-services-core/src/main/java/org/microg/gms/gcm/McsService.java +++ b/play-services-core/src/main/java/org/microg/gms/gcm/McsService.java @@ -45,6 +45,7 @@ import androidx.core.app.PendingIntentCompat; import androidx.legacy.content.WakefulBroadcastReceiver; +import com.google.android.gms.BuildConfig; import com.squareup.wire.Message; import org.microg.gms.checkin.LastCheckinInfo; @@ -506,7 +507,7 @@ private void handleLoginResponse(LoginResponse loginResponse) { private void notifyGcmConnected() { Intent intent = new Intent(ACTION_GCM_CONNECTED); - intent.setPackage(getPackageName()); + intent.setPackage(BuildConfig.APPLICATION_ID); sendBroadcast(intent); } diff --git a/play-services-core/src/main/kotlin/org/microg/gms/accountsettings/ui/MainActivity.kt b/play-services-core/src/main/kotlin/org/microg/gms/accountsettings/ui/MainActivity.kt index 3325cb645a..97203fe08e 100644 --- a/play-services-core/src/main/kotlin/org/microg/gms/accountsettings/ui/MainActivity.kt +++ b/play-services-core/src/main/kotlin/org/microg/gms/accountsettings/ui/MainActivity.kt @@ -28,6 +28,7 @@ import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.widget.Toolbar import androidx.core.content.ContextCompat import androidx.core.graphics.drawable.DrawableCompat +import com.google.android.gms.BuildConfig import com.google.android.gms.R import org.microg.gms.accountsettings.ui.bridge.OcAdvertisingIdBridge import org.microg.gms.accountsettings.ui.bridge.OcAndroidIdBridge @@ -332,7 +333,7 @@ class MainActivity : AppCompatActivity() { Log.d(TAG, "updateVerifyNotification: notificationId: $notificationId") if (notificationId == -1) return Intent(ACTION_GCM_NOTIFY_COMPLETE).apply { - setPackage(packageName) + setPackage(BuildConfig.APPLICATION_ID) putExtra(EXTRA_NOTIFICATION_ACCOUNT, accountName) }.let { sendBroadcast(it) } } diff --git a/play-services-core/src/main/kotlin/org/microg/gms/auth/signin/AssistedSignInActivity.kt b/play-services-core/src/main/kotlin/org/microg/gms/auth/signin/AssistedSignInActivity.kt index f2f36f92d7..e7641ed9ff 100644 --- a/play-services-core/src/main/kotlin/org/microg/gms/auth/signin/AssistedSignInActivity.kt +++ b/play-services-core/src/main/kotlin/org/microg/gms/auth/signin/AssistedSignInActivity.kt @@ -9,6 +9,7 @@ import android.content.Intent import android.os.Bundle import android.util.Log import androidx.appcompat.app.AppCompatActivity +import com.google.android.gms.BuildConfig import com.google.android.gms.R import com.google.android.gms.auth.api.identity.BeginSignInRequest import com.google.android.gms.auth.api.identity.GetSignInIntentRequest @@ -97,7 +98,7 @@ class AssistedSignInActivity : AppCompatActivity() { Log.d(TAG, "prepareSignIn options:$googleSignInOptions") val signInConfiguration = SignInConfiguration(clientPackageName!!, googleSignInOptions!!) val intent = Intent(this, AuthSignInActivity::class.java).apply { - `package` = this@AssistedSignInActivity.packageName + `package` = BuildConfig.APPLICATION_ID putExtra("config", signInConfiguration) putExtra("nonce", signInIntentRequest?.nonce) } diff --git a/play-services-core/src/main/kotlin/org/microg/gms/games/ui/GamesUiFragment.kt b/play-services-core/src/main/kotlin/org/microg/gms/games/ui/GamesUiFragment.kt index e1f492e212..e4be8f5674 100644 --- a/play-services-core/src/main/kotlin/org/microg/gms/games/ui/GamesUiFragment.kt +++ b/play-services-core/src/main/kotlin/org/microg/gms/games/ui/GamesUiFragment.kt @@ -28,6 +28,7 @@ import androidx.appcompat.app.AlertDialog import androidx.lifecycle.lifecycleScope import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView +import com.google.android.gms.BuildConfig import com.google.android.gms.R import com.google.android.gms.common.Scopes import com.google.android.gms.games.snapshot.SnapshotMetadataEntity @@ -347,7 +348,7 @@ class GamesUiFragment : BottomSheetDialogFragment() { } }?.adapter = LeaderboardsAdapter(context, loadLeaderboards) { leaderboard -> val intent = Intent(ACTION_VIEW_LEADERBOARDS_SCORES) - intent.setPackage(context.packageName) + intent.setPackage(BuildConfig.APPLICATION_ID) intent.putExtra(EXTRA_GAME_PACKAGE_NAME, clientPackageName) intent.putExtra(EXTRA_ACCOUNT_KEY, Integer.toHexString(currentAccount?.name.hashCode())) intent.putExtra(EXTRA_LEADERBOARD_ID, leaderboard.id) diff --git a/play-services-core/src/main/kotlin/org/microg/gms/gcm/GcmInGmsService.kt b/play-services-core/src/main/kotlin/org/microg/gms/gcm/GcmInGmsService.kt index 34832c17af..e8043298e0 100644 --- a/play-services-core/src/main/kotlin/org/microg/gms/gcm/GcmInGmsService.kt +++ b/play-services-core/src/main/kotlin/org/microg/gms/gcm/GcmInGmsService.kt @@ -122,7 +122,7 @@ class GcmInGmsService : LifecycleService() { handleIntent(intent) } else { val intent = Intent(ACTION_GCM_RECONNECT).apply { - setPackage(this@GcmInGmsService.packageName) + setPackage(BuildConfig.APPLICATION_ID) } sendBroadcast(intent) } @@ -270,7 +270,7 @@ class GcmInGmsService : LifecycleService() { val content = notificationData.content ?: return val intentExtras = notificationData.intentActions?.primaryPayload?.extras ?: return val intent = Intent(this, MainActivity::class.java).apply { - `package` = this@GcmInGmsService.packageName + `package` = BuildConfig.APPLICATION_ID flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_MULTIPLE_TASK intentExtras.forEach { putExtra(it.key, it.value_) } putExtra(KEY_NOTIFICATION_ID, notificationId) @@ -309,9 +309,9 @@ class GcmInGmsService : LifecycleService() { } Log.d(TAG, "updateGroupsWithAccount extras: $extras") val intent = Intent(GcmConstants.ACTION_GCM_SEND).apply { - setPackage(this@GcmInGmsService.packageName) + setPackage(BuildConfig.APPLICATION_ID) putExtras(extras) - putExtra(GcmConstants.EXTRA_APP, Intent().apply { setPackage(this@GcmInGmsService.packageName) }.let { PendingIntentCompat.getBroadcast(this@GcmInGmsService, 0, it, 0, false) }) + putExtra(GcmConstants.EXTRA_APP, Intent().apply { setPackage(BuildConfig.APPLICATION_ID) }.let { PendingIntentCompat.getBroadcast(this@GcmInGmsService, 0, it, 0, false) }) }.also { it.putExtra(GcmConstants.EXTRA_MESSENGER, Messenger(object : Handler(Looper.getMainLooper()) { override fun handleMessage(msg: Message) { @@ -387,7 +387,7 @@ class GcmInGmsService : LifecycleService() { } else { Log.d(TAG, "registerGcmInGms: sendBroadcast: ${intent.action}") Intent(intent.action).apply { - setPackage(this@GcmInGmsService.packageName) + setPackage(BuildConfig.APPLICATION_ID) putExtras(intent) }.let { sendBroadcast(it) } } diff --git a/play-services-core/src/main/kotlin/org/microg/gms/ui/AccountsFragment.kt b/play-services-core/src/main/kotlin/org/microg/gms/ui/AccountsFragment.kt index b132abb34f..9d1f2417f0 100644 --- a/play-services-core/src/main/kotlin/org/microg/gms/ui/AccountsFragment.kt +++ b/play-services-core/src/main/kotlin/org/microg/gms/ui/AccountsFragment.kt @@ -21,6 +21,7 @@ import androidx.preference.Preference import androidx.preference.PreferenceCategory import androidx.preference.PreferenceFragmentCompat import androidx.preference.TwoStatePreference +import com.google.android.gms.BuildConfig import com.google.android.gms.R import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext @@ -66,7 +67,7 @@ class AccountsFragment : PreferenceFragmentCompat() { private fun registerGcmInGms() { Intent(ACTION_GCM_REGISTER_ALL_ACCOUNTS).apply { - `package` = requireContext().packageName + `package` = BuildConfig.APPLICATION_ID }.let { requireContext().sendBroadcast(it) } } From 12227d7d2a3a3136f3dd12b1804955eed28a8feb Mon Sep 17 00:00:00 2001 From: brian Date: Fri, 20 Mar 2026 12:54:09 -0400 Subject: [PATCH 5/8] Use BuildConfig in library lookups --- gradle/publish-android.gradle | 6 +++-- .../core/build.gradle | 22 +++++++++++++++++++ .../microg/gms/auth/phone/SmsRetrieverCore.kt | 4 ++-- play-services-maps/core/mapbox/build.gradle | 18 +++++++++++++++ .../gms/maps/mapbox/utils/MapContext.kt | 5 ++--- .../gms/maps/mapbox/utils/MultiArchLoader.kt | 3 ++- play-services-vision/core/build.gradle | 22 +++++++++++++++++++ .../DynamiteNativeFaceDetectorCreator.kt | 9 ++++---- .../face/ChimeraNativeFaceDetectorCreator.kt | 9 ++++---- .../vision/face/mlkit/FaceDetectorCreator.kt | 9 ++++---- .../internal/ThickFaceDetectorCreator.kt | 9 ++++---- 11 files changed, 92 insertions(+), 24 deletions(-) diff --git a/gradle/publish-android.gradle b/gradle/publish-android.gradle index 46c6e63749..e6345310a8 100644 --- a/gradle/publish-android.gradle +++ b/gradle/publish-android.gradle @@ -13,6 +13,8 @@ android { } afterEvaluate { + def releaseComponent = components.findByName("release") ?: components.findByName("defaultRelease") + publishing { publications { release(MavenPublication) { @@ -39,7 +41,7 @@ afterEvaluate { } } - from components.release + from releaseComponent } } if (project.hasProperty('sonatype.username')) { @@ -60,5 +62,5 @@ afterEvaluate { sign publishing.publications } } - tasks.getByPath("sourceReleaseJar").duplicatesStrategy = DuplicatesStrategy.EXCLUDE + tasks.findByName("sourceReleaseJar")?.duplicatesStrategy = DuplicatesStrategy.EXCLUDE } diff --git a/play-services-auth-api-phone/core/build.gradle b/play-services-auth-api-phone/core/build.gradle index 4530d26072..16d90cab22 100644 --- a/play-services-auth-api-phone/core/build.gradle +++ b/play-services-auth-api-phone/core/build.gradle @@ -19,10 +19,32 @@ android { compileSdkVersion androidCompileSdk buildToolsVersion "$androidBuildVersionTools" + buildFeatures { + buildConfig = true + } + defaultConfig { versionName version minSdkVersion androidMinSdk targetSdkVersion androidTargetSdk + buildConfigField "String", "APPLICATION_ID", "\"app.revanced.android.gms\"" + } + + flavorDimensions = ['target'] + productFlavors { + "default" { + dimension 'target' + } + "huawei" { + dimension 'target' + } + "huaweilh" { + dimension 'target' + } + "user" { + dimension 'target' + buildConfigField "String", "APPLICATION_ID", "\"org.microg.gms\"" + } } sourceSets { diff --git a/play-services-auth-api-phone/core/src/main/kotlin/org/microg/gms/auth/phone/SmsRetrieverCore.kt b/play-services-auth-api-phone/core/src/main/kotlin/org/microg/gms/auth/phone/SmsRetrieverCore.kt index 2c87d3a41a..5dc28779aa 100644 --- a/play-services-auth-api-phone/core/src/main/kotlin/org/microg/gms/auth/phone/SmsRetrieverCore.kt +++ b/play-services-auth-api-phone/core/src/main/kotlin/org/microg/gms/auth/phone/SmsRetrieverCore.kt @@ -139,7 +139,7 @@ class SmsRetrieverCore(private val context: Context, override val lifecycle: Lif private fun sendUserConsentBroadcast(request: SmsRetrieverRequest, messageBody: String) { val userConsentIntent = Intent(context, UserConsentPromptActivity::class.java) - userConsentIntent.setPackage(context.packageName) + userConsentIntent.setPackage(BuildConfig.APPLICATION_ID) userConsentIntent.putExtra(EXTRA_MESSENGER, Messenger(object : Handler(Looper.getMainLooper()) { override fun handleMessage(msg: Message) { if (Binder.getCallingUid() == Process.myUid()) { @@ -355,4 +355,4 @@ class SmsRetrieverCore(private val context: Context, override val lifecycle: Lif } return deferred.await() } -} +} \ No newline at end of file diff --git a/play-services-maps/core/mapbox/build.gradle b/play-services-maps/core/mapbox/build.gradle index 409f465abc..1e705211a4 100644 --- a/play-services-maps/core/mapbox/build.gradle +++ b/play-services-maps/core/mapbox/build.gradle @@ -53,6 +53,7 @@ android { versionName version minSdkVersion androidMinSdk targetSdkVersion androidTargetSdk + buildConfigField "String", "APPLICATION_ID", "\"app.revanced.android.gms\"" buildConfigField "String", "MAPBOX_KEY", "\"${localProperties.getProperty("mapbox.key", System.getenv('MAPBOX_VECTOR_TILES_KEY') ?: "")}\"" buildConfigField "String", "STADIA_KEY", "\"${localProperties.getProperty("stadia.key", System.getenv('STADIA_API_KEY') ?: "")}\"" @@ -61,6 +62,23 @@ android { } } + flavorDimensions = ['target'] + productFlavors { + "default" { + dimension 'target' + } + "huawei" { + dimension 'target' + } + "huaweilh" { + dimension 'target' + } + "user" { + dimension 'target' + buildConfigField "String", "APPLICATION_ID", "\"org.microg.gms\"" + } + } + sourceSets { main.java.srcDirs += 'src/main/kotlin' } diff --git a/play-services-maps/core/mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/utils/MapContext.kt b/play-services-maps/core/mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/utils/MapContext.kt index 61be960a75..eaa8c5a282 100644 --- a/play-services-maps/core/mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/utils/MapContext.kt +++ b/play-services-maps/core/mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/utils/MapContext.kt @@ -21,13 +21,12 @@ import android.content.ContextWrapper import android.content.Intent import android.content.SharedPreferences import android.view.LayoutInflater +import org.microg.gms.maps.mapbox.BuildConfig import java.io.File class MapContext(private val context: Context) : ContextWrapper( context.createPackageContext( - Class.forName("com.google.android.gms.BuildConfig") - .getField("APPLICATION_ID") - .get(null) as String, + BuildConfig.APPLICATION_ID, Context.CONTEXT_INCLUDE_CODE or Context.CONTEXT_IGNORE_SECURITY ) ) { diff --git a/play-services-maps/core/mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/utils/MultiArchLoader.kt b/play-services-maps/core/mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/utils/MultiArchLoader.kt index 7d148981ea..a25f7c6bd8 100644 --- a/play-services-maps/core/mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/utils/MultiArchLoader.kt +++ b/play-services-maps/core/mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/utils/MultiArchLoader.kt @@ -21,6 +21,7 @@ import android.content.Context import android.content.pm.ApplicationInfo import android.util.Log import com.mapbox.mapboxsdk.LibraryLoader +import org.microg.gms.maps.mapbox.BuildConfig import org.microg.gms.common.PackageUtils import java.io.* import java.util.zip.ZipFile @@ -41,7 +42,7 @@ class MultiArchLoader(private val mapContext: Context, private val appContext: C val cacheFileStamp = File("${appContext.cacheDir.absolutePath}/.gmscore/$path.stamp") val cacheVersion = kotlin.runCatching { cacheFileStamp.readText() }.getOrNull() // TODO: Use better version indicator - val mapVersion = PackageUtils.versionName(mapContext, mapContext.applicationInfo.packageName) + val mapVersion = PackageUtils.versionName(mapContext, BuildConfig.APPLICATION_ID) val apkFile = File(mapContext.packageCodePath) if (!cacheFile.exists() || cacheVersion == null || cacheVersion != mapVersion) { val zipFile = ZipFile(apkFile) diff --git a/play-services-vision/core/build.gradle b/play-services-vision/core/build.gradle index 5db3d5c277..443c79e28c 100644 --- a/play-services-vision/core/build.gradle +++ b/play-services-vision/core/build.gradle @@ -31,10 +31,32 @@ android { compileSdkVersion androidCompileSdk buildToolsVersion "$androidBuildVersionTools" + buildFeatures { + buildConfig = true + } + defaultConfig { versionName version minSdkVersion androidMinSdk targetSdkVersion androidTargetSdk + buildConfigField "String", "APPLICATION_ID", "\"app.revanced.android.gms\"" + } + + flavorDimensions = ['target'] + productFlavors { + "default" { + dimension 'target' + } + "huawei" { + dimension 'target' + } + "huaweilh" { + dimension 'target' + } + "user" { + dimension 'target' + buildConfigField "String", "APPLICATION_ID", "\"org.microg.gms\"" + } } sourceSets { diff --git a/play-services-vision/core/src/main/kotlin/com/google/android/gms/vision/client/DynamiteNativeFaceDetectorCreator.kt b/play-services-vision/core/src/main/kotlin/com/google/android/gms/vision/client/DynamiteNativeFaceDetectorCreator.kt index ac65e7e320..148507a38f 100644 --- a/play-services-vision/core/src/main/kotlin/com/google/android/gms/vision/client/DynamiteNativeFaceDetectorCreator.kt +++ b/play-services-vision/core/src/main/kotlin/com/google/android/gms/vision/client/DynamiteNativeFaceDetectorCreator.kt @@ -14,6 +14,7 @@ import com.google.android.gms.dynamic.unwrap import com.google.android.gms.vision.face.internal.client.DetectionOptions import com.google.android.gms.vision.face.internal.client.INativeFaceDetector import com.google.android.gms.vision.face.internal.client.INativeFaceDetectorCreator +import org.microg.gms.vision.core.BuildConfig import org.microg.gms.vision.face.TAG import org.microg.gms.vision.face.FaceDetector import org.opencv.android.OpenCVLoader @@ -26,16 +27,16 @@ class DynamiteNativeFaceDetectorCreator : INativeFaceDetectorCreator.Stub() { try { val elapsedRealtime = SystemClock.elapsedRealtime() val context = context.unwrap() ?: throw RuntimeException("Context is null") - val detectorContext = context.createPackageContext(context.applicationContext?.packageName ?: context.packageName, 0) - Log.d(TAG, "newFaceDetector: context: ${context.packageName} detectorContext: ${detectorContext.packageName}") + val remoteContext = context.createPackageContext(BuildConfig.APPLICATION_ID, Context.CONTEXT_INCLUDE_CODE or Context.CONTEXT_IGNORE_SECURITY) + Log.d(TAG, "newFaceDetector: context: ${context.packageName} remoteContext: ${remoteContext.packageName}") if (!OpenCVLoader.initLocal()) { throw RuntimeException("Unable to load OpenCV") } Log.d(TAG, "DynamiteNativeFaceDetectorCreator newFaceDetector: load library in ${SystemClock.elapsedRealtime() - elapsedRealtime}ms") - return FaceDetector(detectorContext, faceDetectionOptions) + return FaceDetector(remoteContext, faceDetectionOptions) } catch (e: Throwable) { Log.w(TAG, "DynamiteNativeFaceDetectorCreator newFaceDetector load failed ", e) return null } } -} +} \ No newline at end of file diff --git a/play-services-vision/core/src/main/kotlin/com/google/android/gms/vision/face/ChimeraNativeFaceDetectorCreator.kt b/play-services-vision/core/src/main/kotlin/com/google/android/gms/vision/face/ChimeraNativeFaceDetectorCreator.kt index ad8666002e..3def5ffae7 100644 --- a/play-services-vision/core/src/main/kotlin/com/google/android/gms/vision/face/ChimeraNativeFaceDetectorCreator.kt +++ b/play-services-vision/core/src/main/kotlin/com/google/android/gms/vision/face/ChimeraNativeFaceDetectorCreator.kt @@ -14,6 +14,7 @@ import com.google.android.gms.dynamic.unwrap import com.google.android.gms.vision.face.internal.client.DetectionOptions import com.google.android.gms.vision.face.internal.client.INativeFaceDetector import com.google.android.gms.vision.face.internal.client.INativeFaceDetectorCreator +import org.microg.gms.vision.core.BuildConfig import org.microg.gms.vision.face.FaceDetector import org.microg.gms.vision.face.TAG import org.opencv.android.OpenCVLoader @@ -25,16 +26,16 @@ class ChimeraNativeFaceDetectorCreator : INativeFaceDetectorCreator.Stub() { try { val elapsedRealtime = SystemClock.elapsedRealtime() val context = context.unwrap() ?: throw RuntimeException("Context is null") - val detectorContext = context.createPackageContext(context.applicationContext?.packageName ?: context.packageName, 0) - Log.d(TAG, "newFaceDetector: context: ${context.packageName} detectorContext: ${detectorContext.packageName}") + val remoteContext = context.createPackageContext(BuildConfig.APPLICATION_ID, Context.CONTEXT_INCLUDE_CODE or Context.CONTEXT_IGNORE_SECURITY) + Log.d(TAG, "newFaceDetector: context: ${context.packageName} remoteContext: ${remoteContext.packageName}") if (!OpenCVLoader.initLocal()) { throw RuntimeException("Unable to load OpenCV") } Log.d(TAG, "ChimeraNativeFaceDetectorCreator newFaceDetector: load library in ${SystemClock.elapsedRealtime() - elapsedRealtime}ms") - return FaceDetector(detectorContext, faceDetectionOptions) + return FaceDetector(remoteContext, faceDetectionOptions) } catch (e: Throwable) { Log.w(TAG, "ChimeraNativeFaceDetectorCreator newFaceDetector load failed ", e) return null } } -} +} \ No newline at end of file diff --git a/play-services-vision/core/src/main/kotlin/com/google/android/gms/vision/face/mlkit/FaceDetectorCreator.kt b/play-services-vision/core/src/main/kotlin/com/google/android/gms/vision/face/mlkit/FaceDetectorCreator.kt index f3747eb840..3c38601e50 100644 --- a/play-services-vision/core/src/main/kotlin/com/google/android/gms/vision/face/mlkit/FaceDetectorCreator.kt +++ b/play-services-vision/core/src/main/kotlin/com/google/android/gms/vision/face/mlkit/FaceDetectorCreator.kt @@ -14,6 +14,7 @@ import com.google.android.gms.dynamic.unwrap import com.google.mlkit.vision.face.FaceDetectionOptions import com.google.mlkit.vision.face.aidls.IFaceDetector import com.google.mlkit.vision.face.aidls.IFaceDetectorCreator +import org.microg.gms.vision.core.BuildConfig import org.microg.gms.vision.face.TAG import org.microg.gms.vision.face.mlkit.FaceDetector import org.opencv.android.OpenCVLoader @@ -26,16 +27,16 @@ class FaceDetectorCreator : IFaceDetectorCreator.Stub() { try { val elapsedRealtime = SystemClock.elapsedRealtime() val context = context.unwrap() ?: throw RuntimeException("Context is null") - val detectorContext = context.createPackageContext(context.applicationContext?.packageName ?: context.packageName, 0) - Log.d(TAG, "newFaceDetector: context: ${context.packageName} detectorContext: ${detectorContext.packageName}") + val remoteContext = context.createPackageContext(BuildConfig.APPLICATION_ID, Context.CONTEXT_INCLUDE_CODE or Context.CONTEXT_IGNORE_SECURITY) + Log.d(TAG, "newFaceDetector: context: ${context.packageName} remoteContext: ${remoteContext.packageName}") if (!OpenCVLoader.initLocal()) { throw RuntimeException("Unable to load OpenCV") } Log.d(TAG, "FaceDetectorCreator newFaceDetector: load library in ${SystemClock.elapsedRealtime() - elapsedRealtime}ms") - return FaceDetector(detectorContext, faceDetectionOptions) + return FaceDetector(remoteContext, faceDetectionOptions) } catch (e: Throwable) { Log.w(TAG, "FaceDetectorCreator newFaceDetector load failed ", e) return null } } -} +} \ No newline at end of file diff --git a/play-services-vision/core/src/main/kotlin/com/google/mlkit/vision/face/bundled/internal/ThickFaceDetectorCreator.kt b/play-services-vision/core/src/main/kotlin/com/google/mlkit/vision/face/bundled/internal/ThickFaceDetectorCreator.kt index c0984d9fa9..70be196cd4 100644 --- a/play-services-vision/core/src/main/kotlin/com/google/mlkit/vision/face/bundled/internal/ThickFaceDetectorCreator.kt +++ b/play-services-vision/core/src/main/kotlin/com/google/mlkit/vision/face/bundled/internal/ThickFaceDetectorCreator.kt @@ -14,6 +14,7 @@ import com.google.android.gms.dynamic.unwrap import com.google.mlkit.vision.face.FaceDetectionOptions import com.google.mlkit.vision.face.aidls.IFaceDetector import com.google.mlkit.vision.face.aidls.IFaceDetectorCreator +import org.microg.gms.vision.core.BuildConfig import org.microg.gms.vision.face.TAG import org.microg.gms.vision.face.mlkit.FaceDetector import org.opencv.android.OpenCVLoader @@ -26,16 +27,16 @@ class ThickFaceDetectorCreator : IFaceDetectorCreator.Stub() { try { val elapsedRealtime = SystemClock.elapsedRealtime() val context = context.unwrap() ?: throw RuntimeException("Context is null") - val detectorContext = context.createPackageContext(context.applicationContext?.packageName ?: context.packageName, 0) - Log.d(TAG, "ThickFaceDetectorCreator newFaceDetector: context: ${context.packageName} detectorContext: ${detectorContext.packageName}") + val remoteContext = context.createPackageContext(BuildConfig.APPLICATION_ID, Context.CONTEXT_INCLUDE_CODE or Context.CONTEXT_IGNORE_SECURITY) + Log.d(TAG, "ThickFaceDetectorCreator newFaceDetector: context: ${context.packageName} remoteContext: ${remoteContext.packageName}") if (!OpenCVLoader.initLocal()) { throw RuntimeException("Unable to load OpenCV") } Log.d(TAG, "ThickFaceDetectorCreator newFaceDetector: load library in ${SystemClock.elapsedRealtime() - elapsedRealtime}ms") - return FaceDetector(detectorContext, faceDetectionOptions) + return FaceDetector(remoteContext, faceDetectionOptions) } catch (e: Throwable) { Log.w(TAG, "ThickFaceDetectorCreator newFaceDetector load failed ", e) return null } } -} +} \ No newline at end of file From ea7990b137a5274770296e4738d8cef71b2c6241 Mon Sep 17 00:00:00 2001 From: brian Date: Fri, 20 Mar 2026 16:44:35 -0400 Subject: [PATCH 6/8] Align flavor package mapping with constants --- play-services-auth-api-phone/core/build.gradle | 4 ++-- play-services-core/build.gradle | 8 ++++---- play-services-maps/core/mapbox/build.gradle | 4 ++-- play-services-vision/core/build.gradle | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/play-services-auth-api-phone/core/build.gradle b/play-services-auth-api-phone/core/build.gradle index 16d90cab22..f9b5b0598f 100644 --- a/play-services-auth-api-phone/core/build.gradle +++ b/play-services-auth-api-phone/core/build.gradle @@ -27,7 +27,7 @@ android { versionName version minSdkVersion androidMinSdk targetSdkVersion androidTargetSdk - buildConfigField "String", "APPLICATION_ID", "\"app.revanced.android.gms\"" + buildConfigField "String", "APPLICATION_ID", "\"com.google.android.gms\"" } flavorDimensions = ['target'] @@ -43,7 +43,7 @@ android { } "user" { dimension 'target' - buildConfigField "String", "APPLICATION_ID", "\"org.microg.gms\"" + buildConfigField "String", "APPLICATION_ID", "\"app.revanced.android.gms\"" } } diff --git a/play-services-core/build.gradle b/play-services-core/build.gradle index fb5add97f9..bf88ccf491 100644 --- a/play-services-core/build.gradle +++ b/play-services-core/build.gradle @@ -119,7 +119,7 @@ android { } defaultConfig { - applicationId = "app.revanced.android.gms" + applicationId = "com.google.android.gms" versionName version versionCode appVersionCode @@ -131,7 +131,7 @@ android { multiDexKeepProguard file('multidex-keep.pro') manifestPlaceholders = [appLabel: "@string/gms_app_name"] - resValue "string", "package_id", "app.revanced.android.gms" + resValue "string", "package_id", "com.google.android.gms" buildConfigField "String", "SAFETYNET_KEY", "\"${localProperties.get("safetynet.key", "")}\"" buildConfigField "String", "RECAPTCHA_SITE_KEY", "\"${localProperties.get("recaptcha.siteKey", "")}\"" @@ -183,11 +183,11 @@ android { } "user" { dimension 'target' - applicationId = "org.microg.gms" + applicationId = "app.revanced.android.gms" versionNameSuffix "-user" manifestPlaceholders = [appLabel: "@string/limited_services_app_name"] matchingFallbacks = ['default'] - resValue "string", "package_id", "org.microg.gms" + resValue "string", "package_id", "app.revanced.android.gms" } "hms" { dimension 'maps' diff --git a/play-services-maps/core/mapbox/build.gradle b/play-services-maps/core/mapbox/build.gradle index 1e705211a4..86da0f85de 100644 --- a/play-services-maps/core/mapbox/build.gradle +++ b/play-services-maps/core/mapbox/build.gradle @@ -53,7 +53,7 @@ android { versionName version minSdkVersion androidMinSdk targetSdkVersion androidTargetSdk - buildConfigField "String", "APPLICATION_ID", "\"app.revanced.android.gms\"" + buildConfigField "String", "APPLICATION_ID", "\"com.google.android.gms\"" buildConfigField "String", "MAPBOX_KEY", "\"${localProperties.getProperty("mapbox.key", System.getenv('MAPBOX_VECTOR_TILES_KEY') ?: "")}\"" buildConfigField "String", "STADIA_KEY", "\"${localProperties.getProperty("stadia.key", System.getenv('STADIA_API_KEY') ?: "")}\"" @@ -75,7 +75,7 @@ android { } "user" { dimension 'target' - buildConfigField "String", "APPLICATION_ID", "\"org.microg.gms\"" + buildConfigField "String", "APPLICATION_ID", "\"app.revanced.android.gms\"" } } diff --git a/play-services-vision/core/build.gradle b/play-services-vision/core/build.gradle index 443c79e28c..356eefcca7 100644 --- a/play-services-vision/core/build.gradle +++ b/play-services-vision/core/build.gradle @@ -39,7 +39,7 @@ android { versionName version minSdkVersion androidMinSdk targetSdkVersion androidTargetSdk - buildConfigField "String", "APPLICATION_ID", "\"app.revanced.android.gms\"" + buildConfigField "String", "APPLICATION_ID", "\"com.google.android.gms\"" } flavorDimensions = ['target'] @@ -55,7 +55,7 @@ android { } "user" { dimension 'target' - buildConfigField "String", "APPLICATION_ID", "\"org.microg.gms\"" + buildConfigField "String", "APPLICATION_ID", "\"app.revanced.android.gms\"" } } From 62ab6b5748819f2392dc3297c9faa8e0f09c4a67 Mon Sep 17 00:00:00 2001 From: brian Date: Thu, 26 Mar 2026 15:40:07 -0400 Subject: [PATCH 7/8] Keep the Vision remote fix centralized --- gradle/publish-android.gradle | 6 ++--- .../gms/common/GooglePlayServicesUtil.java | 6 ++++- .../gms/accountsettings/ui/MainActivity.kt | 2 +- .../identity/AuthorizationService.kt | 2 +- .../gms/auth/signin/AssistedSignInActivity.kt | 2 +- .../credential/CredentialManagerService.kt | 2 +- .../org/microg/gms/games/GamesService.kt | 2 +- .../microg/gms/games/ui/GamesUiFragment.kt | 2 +- .../ChimeGmsRegistrationHelper.kt | 2 +- play-services-vision/core/build.gradle | 22 ------------------- .../DynamiteNativeFaceDetectorCreator.kt | 4 ++-- .../face/ChimeraNativeFaceDetectorCreator.kt | 4 ++-- .../vision/face/mlkit/FaceDetectorCreator.kt | 4 ++-- .../internal/ThickFaceDetectorCreator.kt | 4 ++-- 14 files changed, 22 insertions(+), 42 deletions(-) diff --git a/gradle/publish-android.gradle b/gradle/publish-android.gradle index e6345310a8..46c6e63749 100644 --- a/gradle/publish-android.gradle +++ b/gradle/publish-android.gradle @@ -13,8 +13,6 @@ android { } afterEvaluate { - def releaseComponent = components.findByName("release") ?: components.findByName("defaultRelease") - publishing { publications { release(MavenPublication) { @@ -41,7 +39,7 @@ afterEvaluate { } } - from releaseComponent + from components.release } } if (project.hasProperty('sonatype.username')) { @@ -62,5 +60,5 @@ afterEvaluate { sign publishing.publications } } - tasks.findByName("sourceReleaseJar")?.duplicatesStrategy = DuplicatesStrategy.EXCLUDE + tasks.getByPath("sourceReleaseJar").duplicatesStrategy = DuplicatesStrategy.EXCLUDE } diff --git a/play-services-base/src/main/java/com/google/android/gms/common/GooglePlayServicesUtil.java b/play-services-base/src/main/java/com/google/android/gms/common/GooglePlayServicesUtil.java index fd168573b2..c06e5b7f36 100644 --- a/play-services-base/src/main/java/com/google/android/gms/common/GooglePlayServicesUtil.java +++ b/play-services-base/src/main/java/com/google/android/gms/common/GooglePlayServicesUtil.java @@ -136,8 +136,12 @@ public static String getOpenSourceSoftwareLicenseInfo(Context context) { * @return The Context object of the Buddy APK or null if the Buddy APK is not installed on the device. */ public static Context getRemoteContext(Context context) { + String packageName = Constants.GMS_PACKAGE_NAME; + if (Constants.USER_MICROG_PACKAGE_NAME.equals(context.getPackageName())) { + packageName = Constants.USER_MICROG_PACKAGE_NAME; + } try { - return context.createPackageContext(Constants.GMS_PACKAGE_NAME, Context.CONTEXT_INCLUDE_CODE | Context.CONTEXT_IGNORE_SECURITY); + return context.createPackageContext(packageName, Context.CONTEXT_INCLUDE_CODE | Context.CONTEXT_IGNORE_SECURITY); } catch (PackageManager.NameNotFoundException unused) { return null; } diff --git a/play-services-core/src/main/kotlin/org/microg/gms/accountsettings/ui/MainActivity.kt b/play-services-core/src/main/kotlin/org/microg/gms/accountsettings/ui/MainActivity.kt index 97203fe08e..8ddb43e9ce 100644 --- a/play-services-core/src/main/kotlin/org/microg/gms/accountsettings/ui/MainActivity.kt +++ b/play-services-core/src/main/kotlin/org/microg/gms/accountsettings/ui/MainActivity.kt @@ -337,4 +337,4 @@ class MainActivity : AppCompatActivity() { putExtra(EXTRA_NOTIFICATION_ACCOUNT, accountName) }.let { sendBroadcast(it) } } -} +} \ No newline at end of file diff --git a/play-services-core/src/main/kotlin/org/microg/gms/auth/credentials/identity/AuthorizationService.kt b/play-services-core/src/main/kotlin/org/microg/gms/auth/credentials/identity/AuthorizationService.kt index 131a1754ee..1d17ee32bd 100644 --- a/play-services-core/src/main/kotlin/org/microg/gms/auth/credentials/identity/AuthorizationService.kt +++ b/play-services-core/src/main/kotlin/org/microg/gms/auth/credentials/identity/AuthorizationService.kt @@ -179,4 +179,4 @@ class AuthorizationServiceImpl(val context: Context, val packageName: String, ov runCatching { callback?.onResult(Status.SUCCESS) } } -} +} \ No newline at end of file diff --git a/play-services-core/src/main/kotlin/org/microg/gms/auth/signin/AssistedSignInActivity.kt b/play-services-core/src/main/kotlin/org/microg/gms/auth/signin/AssistedSignInActivity.kt index e7641ed9ff..adfc5e83cf 100644 --- a/play-services-core/src/main/kotlin/org/microg/gms/auth/signin/AssistedSignInActivity.kt +++ b/play-services-core/src/main/kotlin/org/microg/gms/auth/signin/AssistedSignInActivity.kt @@ -166,4 +166,4 @@ class AssistedSignInActivity : AppCompatActivity() { assistedSignInFragment.initView() } } -} +} \ No newline at end of file diff --git a/play-services-core/src/main/kotlin/org/microg/gms/credential/CredentialManagerService.kt b/play-services-core/src/main/kotlin/org/microg/gms/credential/CredentialManagerService.kt index 74a37eaa41..7305599027 100644 --- a/play-services-core/src/main/kotlin/org/microg/gms/credential/CredentialManagerService.kt +++ b/play-services-core/src/main/kotlin/org/microg/gms/credential/CredentialManagerService.kt @@ -99,4 +99,4 @@ private class CredentialManagerServiceImpl(private val context: Context, overrid } override fun onTransact(code: Int, data: Parcel, reply: Parcel?, flags: Int): Boolean = warnOnTransactionIssues(code, reply, flags, TAG) { super.onTransact(code, data, reply, flags) } -} +} \ No newline at end of file diff --git a/play-services-core/src/main/kotlin/org/microg/gms/games/GamesService.kt b/play-services-core/src/main/kotlin/org/microg/gms/games/GamesService.kt index 06af97314f..4b4e71dfd2 100644 --- a/play-services-core/src/main/kotlin/org/microg/gms/games/GamesService.kt +++ b/play-services-core/src/main/kotlin/org/microg/gms/games/GamesService.kt @@ -793,4 +793,4 @@ class GamesServiceImpl(val context: Context, override val lifecycle: Lifecycle, override fun onTransact(code: Int, data: Parcel, reply: Parcel?, flags: Int): Boolean = warnOnTransactionIssues(code, reply, flags, TAG) { super.onTransact(code, data, reply, flags) } -} +} \ No newline at end of file diff --git a/play-services-core/src/main/kotlin/org/microg/gms/games/ui/GamesUiFragment.kt b/play-services-core/src/main/kotlin/org/microg/gms/games/ui/GamesUiFragment.kt index e4be8f5674..e68b3bc013 100644 --- a/play-services-core/src/main/kotlin/org/microg/gms/games/ui/GamesUiFragment.kt +++ b/play-services-core/src/main/kotlin/org/microg/gms/games/ui/GamesUiFragment.kt @@ -461,4 +461,4 @@ class GamesUiFragment : BottomSheetDialogFragment() { }?.adapter = AchievementsAdapter(context, targetList) } -} +} \ No newline at end of file diff --git a/play-services-core/src/main/kotlin/org/microg/gms/gcm/registeration/ChimeGmsRegistrationHelper.kt b/play-services-core/src/main/kotlin/org/microg/gms/gcm/registeration/ChimeGmsRegistrationHelper.kt index 61adcc8cd4..c4eb211431 100644 --- a/play-services-core/src/main/kotlin/org/microg/gms/gcm/registeration/ChimeGmsRegistrationHelper.kt +++ b/play-services-core/src/main/kotlin/org/microg/gms/gcm/registeration/ChimeGmsRegistrationHelper.kt @@ -176,4 +176,4 @@ class ChimeGmsRegistrationHelper(val context: Context) { fun resetAllData() { chimeAccountsStore.edit { clear() } } -} +} \ No newline at end of file diff --git a/play-services-vision/core/build.gradle b/play-services-vision/core/build.gradle index 356eefcca7..5db3d5c277 100644 --- a/play-services-vision/core/build.gradle +++ b/play-services-vision/core/build.gradle @@ -31,32 +31,10 @@ android { compileSdkVersion androidCompileSdk buildToolsVersion "$androidBuildVersionTools" - buildFeatures { - buildConfig = true - } - defaultConfig { versionName version minSdkVersion androidMinSdk targetSdkVersion androidTargetSdk - buildConfigField "String", "APPLICATION_ID", "\"com.google.android.gms\"" - } - - flavorDimensions = ['target'] - productFlavors { - "default" { - dimension 'target' - } - "huawei" { - dimension 'target' - } - "huaweilh" { - dimension 'target' - } - "user" { - dimension 'target' - buildConfigField "String", "APPLICATION_ID", "\"app.revanced.android.gms\"" - } } sourceSets { diff --git a/play-services-vision/core/src/main/kotlin/com/google/android/gms/vision/client/DynamiteNativeFaceDetectorCreator.kt b/play-services-vision/core/src/main/kotlin/com/google/android/gms/vision/client/DynamiteNativeFaceDetectorCreator.kt index 148507a38f..6406f69652 100644 --- a/play-services-vision/core/src/main/kotlin/com/google/android/gms/vision/client/DynamiteNativeFaceDetectorCreator.kt +++ b/play-services-vision/core/src/main/kotlin/com/google/android/gms/vision/client/DynamiteNativeFaceDetectorCreator.kt @@ -9,12 +9,12 @@ import android.content.Context import android.os.SystemClock import android.util.Log import androidx.annotation.Keep +import com.google.android.gms.common.GooglePlayServicesUtil import com.google.android.gms.dynamic.IObjectWrapper import com.google.android.gms.dynamic.unwrap import com.google.android.gms.vision.face.internal.client.DetectionOptions import com.google.android.gms.vision.face.internal.client.INativeFaceDetector import com.google.android.gms.vision.face.internal.client.INativeFaceDetectorCreator -import org.microg.gms.vision.core.BuildConfig import org.microg.gms.vision.face.TAG import org.microg.gms.vision.face.FaceDetector import org.opencv.android.OpenCVLoader @@ -27,7 +27,7 @@ class DynamiteNativeFaceDetectorCreator : INativeFaceDetectorCreator.Stub() { try { val elapsedRealtime = SystemClock.elapsedRealtime() val context = context.unwrap() ?: throw RuntimeException("Context is null") - val remoteContext = context.createPackageContext(BuildConfig.APPLICATION_ID, Context.CONTEXT_INCLUDE_CODE or Context.CONTEXT_IGNORE_SECURITY) + val remoteContext = GooglePlayServicesUtil.getRemoteContext(context) ?: throw RuntimeException("remoteContext is null") Log.d(TAG, "newFaceDetector: context: ${context.packageName} remoteContext: ${remoteContext.packageName}") if (!OpenCVLoader.initLocal()) { throw RuntimeException("Unable to load OpenCV") diff --git a/play-services-vision/core/src/main/kotlin/com/google/android/gms/vision/face/ChimeraNativeFaceDetectorCreator.kt b/play-services-vision/core/src/main/kotlin/com/google/android/gms/vision/face/ChimeraNativeFaceDetectorCreator.kt index 3def5ffae7..5ece33ee89 100644 --- a/play-services-vision/core/src/main/kotlin/com/google/android/gms/vision/face/ChimeraNativeFaceDetectorCreator.kt +++ b/play-services-vision/core/src/main/kotlin/com/google/android/gms/vision/face/ChimeraNativeFaceDetectorCreator.kt @@ -9,12 +9,12 @@ import android.content.Context import android.os.SystemClock import android.util.Log import androidx.annotation.Keep +import com.google.android.gms.common.GooglePlayServicesUtil import com.google.android.gms.dynamic.IObjectWrapper import com.google.android.gms.dynamic.unwrap import com.google.android.gms.vision.face.internal.client.DetectionOptions import com.google.android.gms.vision.face.internal.client.INativeFaceDetector import com.google.android.gms.vision.face.internal.client.INativeFaceDetectorCreator -import org.microg.gms.vision.core.BuildConfig import org.microg.gms.vision.face.FaceDetector import org.microg.gms.vision.face.TAG import org.opencv.android.OpenCVLoader @@ -26,7 +26,7 @@ class ChimeraNativeFaceDetectorCreator : INativeFaceDetectorCreator.Stub() { try { val elapsedRealtime = SystemClock.elapsedRealtime() val context = context.unwrap() ?: throw RuntimeException("Context is null") - val remoteContext = context.createPackageContext(BuildConfig.APPLICATION_ID, Context.CONTEXT_INCLUDE_CODE or Context.CONTEXT_IGNORE_SECURITY) + val remoteContext = GooglePlayServicesUtil.getRemoteContext(context) ?: throw RuntimeException("remoteContext is null") Log.d(TAG, "newFaceDetector: context: ${context.packageName} remoteContext: ${remoteContext.packageName}") if (!OpenCVLoader.initLocal()) { throw RuntimeException("Unable to load OpenCV") diff --git a/play-services-vision/core/src/main/kotlin/com/google/android/gms/vision/face/mlkit/FaceDetectorCreator.kt b/play-services-vision/core/src/main/kotlin/com/google/android/gms/vision/face/mlkit/FaceDetectorCreator.kt index 3c38601e50..a0948771a2 100644 --- a/play-services-vision/core/src/main/kotlin/com/google/android/gms/vision/face/mlkit/FaceDetectorCreator.kt +++ b/play-services-vision/core/src/main/kotlin/com/google/android/gms/vision/face/mlkit/FaceDetectorCreator.kt @@ -9,12 +9,12 @@ import android.content.Context import android.os.SystemClock import android.util.Log import androidx.annotation.Keep +import com.google.android.gms.common.GooglePlayServicesUtil import com.google.android.gms.dynamic.IObjectWrapper import com.google.android.gms.dynamic.unwrap import com.google.mlkit.vision.face.FaceDetectionOptions import com.google.mlkit.vision.face.aidls.IFaceDetector import com.google.mlkit.vision.face.aidls.IFaceDetectorCreator -import org.microg.gms.vision.core.BuildConfig import org.microg.gms.vision.face.TAG import org.microg.gms.vision.face.mlkit.FaceDetector import org.opencv.android.OpenCVLoader @@ -27,7 +27,7 @@ class FaceDetectorCreator : IFaceDetectorCreator.Stub() { try { val elapsedRealtime = SystemClock.elapsedRealtime() val context = context.unwrap() ?: throw RuntimeException("Context is null") - val remoteContext = context.createPackageContext(BuildConfig.APPLICATION_ID, Context.CONTEXT_INCLUDE_CODE or Context.CONTEXT_IGNORE_SECURITY) + val remoteContext = GooglePlayServicesUtil.getRemoteContext(context) ?: throw RuntimeException("remoteContext is null") Log.d(TAG, "newFaceDetector: context: ${context.packageName} remoteContext: ${remoteContext.packageName}") if (!OpenCVLoader.initLocal()) { throw RuntimeException("Unable to load OpenCV") diff --git a/play-services-vision/core/src/main/kotlin/com/google/mlkit/vision/face/bundled/internal/ThickFaceDetectorCreator.kt b/play-services-vision/core/src/main/kotlin/com/google/mlkit/vision/face/bundled/internal/ThickFaceDetectorCreator.kt index 70be196cd4..9ebcd2078d 100644 --- a/play-services-vision/core/src/main/kotlin/com/google/mlkit/vision/face/bundled/internal/ThickFaceDetectorCreator.kt +++ b/play-services-vision/core/src/main/kotlin/com/google/mlkit/vision/face/bundled/internal/ThickFaceDetectorCreator.kt @@ -9,12 +9,12 @@ import android.content.Context import android.os.SystemClock import android.util.Log import androidx.annotation.Keep +import com.google.android.gms.common.GooglePlayServicesUtil import com.google.android.gms.dynamic.IObjectWrapper import com.google.android.gms.dynamic.unwrap import com.google.mlkit.vision.face.FaceDetectionOptions import com.google.mlkit.vision.face.aidls.IFaceDetector import com.google.mlkit.vision.face.aidls.IFaceDetectorCreator -import org.microg.gms.vision.core.BuildConfig import org.microg.gms.vision.face.TAG import org.microg.gms.vision.face.mlkit.FaceDetector import org.opencv.android.OpenCVLoader @@ -27,7 +27,7 @@ class ThickFaceDetectorCreator : IFaceDetectorCreator.Stub() { try { val elapsedRealtime = SystemClock.elapsedRealtime() val context = context.unwrap() ?: throw RuntimeException("Context is null") - val remoteContext = context.createPackageContext(BuildConfig.APPLICATION_ID, Context.CONTEXT_INCLUDE_CODE or Context.CONTEXT_IGNORE_SECURITY) + val remoteContext = GooglePlayServicesUtil.getRemoteContext(context) ?: throw RuntimeException("remoteContext is null") Log.d(TAG, "ThickFaceDetectorCreator newFaceDetector: context: ${context.packageName} remoteContext: ${remoteContext.packageName}") if (!OpenCVLoader.initLocal()) { throw RuntimeException("Unable to load OpenCV") From 7dafecff49415db0c3ca773311d855a84e94b6ed Mon Sep 17 00:00:00 2001 From: brian Date: Thu, 26 Mar 2026 17:23:47 -0400 Subject: [PATCH 8/8] 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. --- .../core/build.gradle | 22 ------------------- .../microg/gms/auth/phone/SmsRetrieverCore.kt | 1 - 2 files changed, 23 deletions(-) diff --git a/play-services-auth-api-phone/core/build.gradle b/play-services-auth-api-phone/core/build.gradle index f9b5b0598f..4530d26072 100644 --- a/play-services-auth-api-phone/core/build.gradle +++ b/play-services-auth-api-phone/core/build.gradle @@ -19,32 +19,10 @@ android { compileSdkVersion androidCompileSdk buildToolsVersion "$androidBuildVersionTools" - buildFeatures { - buildConfig = true - } - defaultConfig { versionName version minSdkVersion androidMinSdk targetSdkVersion androidTargetSdk - buildConfigField "String", "APPLICATION_ID", "\"com.google.android.gms\"" - } - - flavorDimensions = ['target'] - productFlavors { - "default" { - dimension 'target' - } - "huawei" { - dimension 'target' - } - "huaweilh" { - dimension 'target' - } - "user" { - dimension 'target' - buildConfigField "String", "APPLICATION_ID", "\"app.revanced.android.gms\"" - } } sourceSets { diff --git a/play-services-auth-api-phone/core/src/main/kotlin/org/microg/gms/auth/phone/SmsRetrieverCore.kt b/play-services-auth-api-phone/core/src/main/kotlin/org/microg/gms/auth/phone/SmsRetrieverCore.kt index 5dc28779aa..5d27caa877 100644 --- a/play-services-auth-api-phone/core/src/main/kotlin/org/microg/gms/auth/phone/SmsRetrieverCore.kt +++ b/play-services-auth-api-phone/core/src/main/kotlin/org/microg/gms/auth/phone/SmsRetrieverCore.kt @@ -139,7 +139,6 @@ class SmsRetrieverCore(private val context: Context, override val lifecycle: Lif private fun sendUserConsentBroadcast(request: SmsRetrieverRequest, messageBody: String) { val userConsentIntent = Intent(context, UserConsentPromptActivity::class.java) - userConsentIntent.setPackage(BuildConfig.APPLICATION_ID) userConsentIntent.putExtra(EXTRA_MESSENGER, Messenger(object : Handler(Looper.getMainLooper()) { override fun handleMessage(msg: Message) { if (Binder.getCallingUid() == Process.myUid()) {