Skip to content

Commit

Permalink
Spoof package name
Browse files Browse the repository at this point in the history
  • Loading branch information
YT-Advanced committed Mar 27, 2024
1 parent 9e2337a commit ce0ccac
Show file tree
Hide file tree
Showing 112 changed files with 818 additions and 1,010 deletions.
63 changes: 12 additions & 51 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
*/

buildscript {
ext.applicationNamespace = "com.google.android.gms"
ext.basePackageName = "app.revanced"

ext.cronetVersion = '102.5005.125'
ext.wearableVersion = '0.1.1'

ext.kotlinVersion = '1.9.22'
ext.kotlinVersion = '1.9.23'
ext.coroutineVersion = '1.7.3'

ext.annotationVersion = '1.7.1'
Expand All @@ -18,18 +21,18 @@ buildscript {
ext.lifecycleVersion = '2.7.0'
ext.loaderVersion = '1.1.0'
ext.materialVersion = '1.11.0'
ext.mediarouterVersion = '1.6.0'
ext.mediarouterVersion = '1.7.0'
ext.multidexVersion = '2.0.1'
ext.navigationVersion = '2.7.7'
ext.preferenceVersion = '1.2.0'
ext.preferenceVersion = '1.2.1'
ext.recyclerviewVersion = '1.3.2'
ext.webkitVersion = '1.10.0'

ext.slf4jVersion = '1.7.36'
ext.volleyVersion = '1.2.1'
ext.wireVersion = '4.8.0'
ext.wireVersion = '4.9.8'

ext.androidBuildGradleVersion = '8.2.2'
ext.androidBuildGradleVersion = '8.3.1'

ext.androidBuildVersionTools = '34.0.0'

Expand Down Expand Up @@ -63,62 +66,20 @@ buildscript {
}
}

def execResult(...args) {
def stdout = new ByteArrayOutputStream()
exec {
commandLine args
standardOutput = stdout
}
return stdout.toString()
}

def gmsVersion = "24.09.13"
def gmsVersionCode = Integer.parseInt(gmsVersion.replaceAll('\\.', ''))
def vendingVersion = "40.2.26"
def vendingVersionCode = Integer.parseInt(vendingVersion.replaceAll('\\.', ''))
def gitVersionBase = execResult('git', 'describe', '--tags', '--abbrev=0', '--match=v[0-9]*').trim().substring(1)
def gitCommitCount = Integer.parseInt(execResult('git', 'rev-list', '--count', "v$gitVersionBase..HEAD").trim())
def gitCommitId = execResult('git', 'show-ref', '--abbrev=7', '--head', 'HEAD').trim().split(' ')[0]
def gitDirty = false
execResult('git', 'status', '--porcelain').lines().each { stat ->
def status = stat.substring(0,2)
def file = stat.substring(3)
if (status == '??') {
if (subprojects.any { p -> file.startsWith(p.name + '/') }) {
logger.lifecycle('Dirty file: {} (untracked)', file)
gitDirty = true
} else {
logger.info('New file outside module: {} (ignored for dirty check)', file)
}
} else {
logger.lifecycle('Dirty file: {} (changed)', file)
gitDirty = true
}
}
def ourVersionBase = gitVersionBase.substring(0, gitVersionBase.lastIndexOf('.'))
def ourVersionMinor = Integer.parseInt(ourVersionBase.substring(ourVersionBase.lastIndexOf('.') + 1))
def ourGmsVersionCode = gmsVersionCode * 1000 + ourVersionMinor * 2 + (gitCommitCount > 0 || gitDirty ? 1 : 0)
def ourGmsVersionName = "$ourVersionBase.$gmsVersionCode" + (gitCommitCount > 0 && !gitDirty ? "-$gitCommitCount" : "") + (gitDirty ? "-dirty" : "") + (gitCommitCount > 0 && !gitDirty ? " ($gitCommitId)" : "")
def ourVendingVersionCode = 80000000 + vendingVersionCode * 100 + ourVersionMinor * 2 + (gitCommitCount > 0 || gitDirty ? 1 : 0)
def ourVendingVersionName = "$ourVersionBase.$vendingVersionCode" + (gitCommitCount > 0 && !gitDirty ? "-$gitCommitCount" : "") + (gitDirty ? "-dirty" : "") + (gitCommitCount > 0 && !gitDirty ? " ($gitCommitId)" : "")
logger.lifecycle('Starting build for GMS version {} ({})...', ourGmsVersionName, ourGmsVersionCode)

allprojects {
apply plugin: 'idea'

group = 'org.microg.gms'
version = ourGmsVersionName
ext.vendingAppVersionName = ourVendingVersionName
ext.vendingAppVersionCode = ourVendingVersionCode
ext.appVersionCode = ourGmsVersionCode
ext.isReleaseVersion = false
ext.appVersionCode = 241017000
ext.baseVersion = ext.appVersionCode.toString()[0..1] + '.' + ext.appVersionCode.toString()[2..3] + '.' + ext.appVersionCode.toString()[4..5]
version = "0.3.0." + ext.baseVersion.replaceAll("\\.", "")
ext.isReleaseVersion = true
}

subprojects {
repositories {
mavenCentral()
google()
if (hasModule("hms", false)) maven {url 'https://developer.huawei.com/repo/'}
}
}

4 changes: 4 additions & 0 deletions firebase-auth/core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ android {
versionName version
minSdkVersion androidMinSdk
targetSdkVersion androidTargetSdk

manifestPlaceholders = [
basePackageName: "$basePackageName"
]
}

sourceSets {
Expand Down
2 changes: 1 addition & 1 deletion firebase-auth/core/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<application>
<service android:name="org.microg.gms.firebase.auth.FirebaseAuthService">
<intent-filter>
<action android:name="com.google.firebase.auth.api.gms.service.START" />
<action android:name="${basePackageName}.firebase.auth.api.gms.service.START" />
</intent-filter>
</service>
<activity
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
android.useAndroidX=true
org.gradle.jvmargs=-Xmx2048m -XX:+UseParallelGC --add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED
org.gradle.jvmargs=-Xmx4096m -XX:+UseParallelGC --add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED
6 changes: 2 additions & 4 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# SPDX-FileCopyrightText: 2015, microG Project Team
# SPDX-License-Identifier: CC0-1.0

#Mon Mar 25 16:20:02 ICT 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
4 changes: 4 additions & 0 deletions play-services-ads-identifier/core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ android {
versionName version
minSdkVersion androidMinSdk
targetSdkVersion androidTargetSdk

manifestPlaceholders = [
basePackageName: "$basePackageName"
]
}

sourceSets {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<application>
<service android:name=".AdvertisingIdService">
<intent-filter>
<action android:name="com.google.android.gms.ads.identifier.service.START" />
<action android:name="${basePackageName}.android.gms.ads.identifier.service.START" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</service>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import android.os.IBinder
import android.util.Log
import androidx.core.os.bundleOf
import com.google.android.gms.ads.identifier.internal.IAdvertisingIdService
import com.google.android.gms.common.BuildConfig
import org.microg.gms.common.GooglePackagePermission
import org.microg.gms.common.PackageUtils
import java.util.UUID
Expand Down Expand Up @@ -64,7 +65,7 @@ abstract class AdvertisingIdConfiguration(private val context: Context) {
for (packageName in packageNames) {
val applicationInfo = context.packageManager.getApplicationInfo(packageName, 0)
if (applicationInfo.targetSdkVersion > 33) {
if (context.packageManager.checkPermission("com.google.android.gms.permission.AD_ID", packageName) == PackageManager.PERMISSION_DENIED) {
if (context.packageManager.checkPermission(BuildConfig.BASE_PACKAGE_NAME + ".android.gms.permission.AD_ID", packageName) == PackageManager.PERMISSION_DENIED) {
throw SecurityException("Permission not granted")
}
}
Expand Down
4 changes: 4 additions & 0 deletions play-services-ads-lite/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ android {
versionName version
minSdkVersion androidMinSdk
targetSdkVersion androidTargetSdk

manifestPlaceholders = [
basePackageName: "$basePackageName"
]
}

compileOptions {
Expand Down
2 changes: 1 addition & 1 deletion play-services-ads-lite/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="com.google.android.gms.permission.AD_ID" />
<uses-permission android:name="${basePackageName}.android.gms.permission.AD_ID" />

<queries>
<!-- Website links -->
Expand Down
4 changes: 4 additions & 0 deletions play-services-ads/core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ android {
versionName version
minSdkVersion androidMinSdk
targetSdkVersion androidTargetSdk

manifestPlaceholders = [
basePackageName: "$basePackageName"
]
}

sourceSets {
Expand Down
2 changes: 1 addition & 1 deletion play-services-ads/core/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<application>
<service android:name="org.microg.gms.ads.AdRequestService">
<intent-filter>
<action android:name="com.google.android.gms.ads.service.START" />
<action android:name="${basePackageName}.android.gms.ads.service.START" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</service>
Expand Down
4 changes: 4 additions & 0 deletions play-services-appinvite/core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ android {
versionName version
minSdkVersion androidMinSdk
targetSdkVersion androidTargetSdk

manifestPlaceholders = [
basePackageName: "$basePackageName"
]
}

sourceSets {
Expand Down
4 changes: 2 additions & 2 deletions play-services-appinvite/core/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
android:name="org.microg.gms.appinivite.AppInviteService"
android:exported="true">
<intent-filter>
<action android:name="com.google.android.gms.appinvite.service.START" />
<action android:name="${basePackageName}.android.gms.appinvite.service.START" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</service>
Expand All @@ -37,7 +37,7 @@
<data android:pathPrefix="/" />
</intent-filter>
<intent-filter>
<action android:name="com.google.firebase.dynamiclinks.VIEW_DYNAMIC_LINK" />
<action android:name="${basePackageName}.firebase.dynamiclinks.VIEW_DYNAMIC_LINK" />

<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
Expand Down
4 changes: 4 additions & 0 deletions play-services-appset/core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ android {
versionName version
minSdkVersion androidMinSdk
targetSdkVersion androidTargetSdk

manifestPlaceholders = [
basePackageName: "$basePackageName"
]
}

sourceSets {
Expand Down
2 changes: 1 addition & 1 deletion play-services-appset/core/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<service android:name="org.microg.gms.appset.AppSetService">
<intent-filter>
<action android:name="com.google.android.gms.appset.service.START" />
<action android:name="${basePackageName}.android.gms.appset.service.START" />
</intent-filter>
</service>
</application>
Expand Down
4 changes: 4 additions & 0 deletions play-services-auth-api-phone/core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ android {
versionName version
minSdkVersion androidMinSdk
targetSdkVersion androidTargetSdk

manifestPlaceholders = [
basePackageName: "$basePackageName"
]
}

sourceSets {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
android:name="org.microg.gms.auth.phone.SmsRetrieverService"
android:exported="true">
<intent-filter>
<action android:name="com.google.android.gms.auth.api.phone.service.SmsRetrieverApiService.START" />
<action android:name="${basePackageName}.android.gms.auth.api.phone.service.SmsRetrieverApiService.START" />

<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
Expand Down
2 changes: 1 addition & 1 deletion play-services-auth-base/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ description = 'microG implementation of play-services-auth-base'

dependencies {
// Dependencies from play-services-auth-base:18.0.6
api "androidx.collection:collection:1.0.0"
api 'androidx.collection:collection:1.4.0'
api project(':play-services-basement')
api project(':play-services-base')
api project(':play-services-tasks')
Expand Down
5 changes: 2 additions & 3 deletions play-services-auth/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ description = 'microG implementation of play-services-auth'

dependencies {
// Dependencies from play-services-auth:20.4.0
api "androidx.fragment:fragment:1.0.0"
api "androidx.loader:loader:1.0.0"
api project(':play-services-auth-api-phone')
api 'androidx.fragment:fragment:1.6.2'
api 'androidx.loader:loader:1.1.0'
api project(':play-services-auth-base')
api project(':play-services-base')
api project(':play-services-basement')
Expand Down
9 changes: 6 additions & 3 deletions play-services-base/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,15 @@ android {

buildFeatures {
aidl = true
buildConfig = true
}

defaultConfig {
versionName version
minSdkVersion androidMinSdk
targetSdkVersion androidTargetSdk

buildConfigField "String", "BASE_PACKAGE_NAME", "\"$basePackageName\""
}

compileOptions {
Expand All @@ -50,9 +53,9 @@ description = 'microG implementation of play-services-base'

dependencies {
// Dependencies from play-services-base:18.1.0
api "androidx.collection:collection:1.0.0"
api "androidx.core:core:1.2.0"
api "androidx.fragment:fragment:1.0.0"
api 'androidx.collection:collection:1.4.0'
api 'androidx.core:core:1.12.0'
api 'androidx.fragment:fragment:1.6.2'
api project(':play-services-basement')
api project(':play-services-tasks')

Expand Down
4 changes: 4 additions & 0 deletions play-services-base/core/package/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ android {
versionName version
minSdkVersion androidMinSdk
targetSdkVersion androidTargetSdk

manifestPlaceholders = [
basePackageName: "$basePackageName"
]
}

sourceSets {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
android:name="org.microg.gms.moduleinstall.ModuleInstallService"
android:exported="true">
<intent-filter>
<action android:name="com.google.android.gms.chimera.container.moduleinstall.ModuleInstallService.START" />
<action android:name="${basePackageName}.android.gms.chimera.container.moduleinstall.ModuleInstallService.START" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</service>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import android.os.RemoteException;
import android.util.Log;

import com.google.android.gms.common.BuildConfig;
import com.google.android.gms.common.api.Scope;
import com.google.android.gms.common.internal.*;

Expand Down Expand Up @@ -235,7 +236,7 @@ private void callGetService(GmsService service, IGmsCallbacks callback, int gmsV
request.gmsVersion = gmsVersion;
request.packageName = packageName;
request.extras = extras;
request.account = accountName == null ? null : new Account(accountName, "com.google");
request.account = accountName == null ? null : new Account(accountName, BuildConfig.BASE_PACKAGE_NAME);
request.scopes = scopes == null ? null : scopesFromStringArray(scopes);
getService(callback, request);
}
Expand Down
Loading

0 comments on commit ce0ccac

Please sign in to comment.