Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 33 additions & 53 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,84 +23,64 @@ jobs:
uses: gradle/actions/setup-gradle@v6
with:
cache-encryption-key: ${{ secrets.GradleEncryptionKey }}
- name: "Execute Gradle build"
# Single unified APK shipping both the Mapbox (MapLibre) and VTM renderers, selected at
# runtime from the MicroG "Map renderer" setting (default: Mapbox).

- name: "Build universal icon APK"
run: "./gradlew --no-daemon :play-services-core:assembleDefaultRelease"
- name: "Build ARM64 icon APK"
run: "./gradlew --no-daemon :play-services-core:assembleDefaultRelease -Pabi=arm64-v8a"
- name: "Build universal noicon APK"
run: "./gradlew --no-daemon :play-services-core:assembleDefaultRelease -PnoIcon=true"
- name: "Build ARM64 noicon APK"
run: "./gradlew --no-daemon :play-services-core:assembleDefaultRelease -PnoIcon=true -Pabi=arm64-v8a"

- name: "Prepare APKs"
id: prepare
run: |
mkdir -p dist
APK_DIR=play-services-core/build/outputs/apk/default/release
# Each build overwrites the same output directory; copy immediately after
# each build so the ABI/noicon selection cannot be inferred from a stale file.
cp "$(find "$APK_DIR" -maxdepth 1 -type f -name '*.apk' | head -1)" dist/microg.apk
./gradlew --no-daemon :play-services-core:assembleDefaultRelease -Pabi=arm64-v8a
cp "$(find "$APK_DIR" -maxdepth 1 -type f -name '*.apk' | head -1)" dist/microg-arm64-v8a.apk
./gradlew --no-daemon :play-services-core:assembleDefaultRelease -PnoIcon=true
cp "$(find "$APK_DIR" -maxdepth 1 -type f -name '*.apk' | head -1)" dist/microg-noicon.apk
./gradlew --no-daemon :play-services-core:assembleDefaultRelease -PnoIcon=true -Pabi=arm64-v8a
cp "$(find "$APK_DIR" -maxdepth 1 -type f -name '*.apk' | head -1)" dist/microg-noicon-arm64-v8a.apk
ls -l dist

- name: "Compute version"
id: version
run: |
APK=$(ls play-services-core/build/outputs/apk/default/release/*.apk | head -1)
APK=$(find dist -name 'microg.apk' | head -1)
VER=$("$ANDROID_HOME"/build-tools/35.0.0/aapt dump badging "$APK" | grep -oP "versionName='\K[^']+")
# Version may carry a "-N (commit)" suffix; GitHub tags can't contain spaces/parens.
# Use the full version for the release name but a tag-safe form for the tag.
SAFE=$(echo "$VER" | sed -E 's/ \(.*\)//')
echo "version=$VER" >> "$GITHUB_OUTPUT"
echo "tag=$SAFE" >> "$GITHUB_OUTPUT"
echo "apk=$APK" >> "$GITHUB_OUTPUT"

- uses: ilharp/sign-android-release@v2
name: "Sign app APK (icon shown)"
id: sign_app
- name: "Sign APKs"
id: sign
uses: ilharp/sign-android-release@v2
with:
releaseDir: play-services-core/build/outputs/apk/default/release
releaseDir: dist
signingKey: ${{ secrets.KEYSTORE_B64 }}
keyAlias: ${{ secrets.KEYSTORE_ENTRY_ALIAS }}
keyStorePassword: ${{ secrets.KEYSTORE_PASSWORD }}
keyPassword: ${{ secrets.KEYSTORE_ENTRY_PASSWORD }}
buildToolsVersion: 35.0.0

- name: "Rename APK (icon shown)"
id: rename_apk
run: |
mkdir -p dist
mv "${{ steps.sign_app.outputs.signedFile }}" "dist/microg-${{ steps.version.outputs.version }}.apk"
echo "path=dist/microg-${{ steps.version.outputs.version }}.apk" >> "$GITHUB_OUTPUT"

- name: "Execute Gradle build (icon hidden)"
run: "./gradlew --no-daemon :play-services-core:assembleDefaultRelease -PnoIcon=true"

- uses: ilharp/sign-android-release@v2
name: "Sign app APK (icon hidden)"
id: sign_app_noicon
with:
releaseDir: play-services-core/build/outputs/apk/default/release
signingKey: ${{ secrets.KEYSTORE_B64 }}
keyAlias: ${{ secrets.KEYSTORE_ENTRY_ALIAS }}
keyStorePassword: ${{ secrets.KEYSTORE_PASSWORD }}
keyPassword: ${{ secrets.KEYSTORE_ENTRY_PASSWORD }}
buildToolsVersion: 35.0.0

- name: "Rename APK (icon hidden)"
id: rename_apk_noicon
run: |
mkdir -p dist
mv "${{ steps.sign_app_noicon.outputs.signedFile }}" "dist/microg-${{ steps.version.outputs.version }}-noicon.apk"
echo "path=dist/microg-${{ steps.version.outputs.version }}-noicon.apk" >> "$GITHUB_OUTPUT"

# - name: "Create release"
# uses: softprops/action-gh-release@v2
# with:
# tag_name: v${{ steps.version.outputs.tag }}
# name: v${{ steps.version.outputs.version }}
# files: |
# ${{ steps.rename_apk.outputs.path }}
# ${{ steps.rename_apk_noicon.outputs.path }}
# files: dist/*.apk
# generate_release_notes: true

- name: Upload APK (icon shown)
uses: actions/upload-artifact@v7
with:
name: MicroG-RE
if-no-files-found: error
archive: false
path: ${{ steps.rename_apk.outputs.path }}

- name: Upload APK (icon hidden)
- name: Upload APKs
uses: actions/upload-artifact@v7
with:
name: MicroG-RE-noicon
name: MicroG-RE-apks
if-no-files-found: error
archive: false
path: ${{ steps.rename_apk_noicon.outputs.path }}
path: dist/*.apk
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import android.os.Bundle
import android.os.IBinder
import android.util.Log
import androidx.core.os.bundleOf
import com.google.android.gms.common.BuildConfig
import com.google.android.gms.ads.identifier.internal.IAdvertisingIdService
import org.microg.gms.common.GooglePackagePermission
import org.microg.gms.common.PackageUtils
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
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import androidx.annotation.NonNull;
import com.google.android.gms.common.api.Status;
import org.microg.gms.auth.api.phone.SmsRetrieverClientImpl;
import com.google.android.gms.common.BuildConfig;

/**
* {@code SmsRetriever} provides access to Google services that help you retrieve SMS messages sent to your app without
Expand Down Expand Up @@ -47,7 +48,7 @@ public class SmsRetriever {
* Permission that's used to register the receiver to detect that the broadcaster is the SMS Retriever.
*/
@NonNull
public static final String SEND_PERMISSION = "com.google.android.gms.auth.api.phone.permission.SEND";
public static final String SEND_PERMISSION = BuildConfig.BASE_PACKAGE_NAME + ".android.gms.auth.api.phone.permission.SEND";
/**
* Intent action when SMS message is retrieved.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,21 @@
import com.google.android.gms.common.BuildConfig;

public final class GcmConstants {
public static final String ACTION_C2DM_RECEIVE = "com.google.android.c2dm.intent.RECEIVE";
public static final String ACTION_C2DM_REGISTER = "com.google.android.c2dm.intent.REGISTER";
public static final String ACTION_C2DM_REGISTRATION = "com.google.android.c2dm.intent.REGISTRATION";
public static final String ACTION_C2DM_UNREGISTER = "com.google.android.c2dm.intent.UNREGISTER";
// Package-scoped variants used by apps patched to target the renamed base package
public static final String ACTION_C2DM_RECEIVE_PACKAGE = BuildConfig.BASE_PACKAGE_NAME + ".android.c2dm.intent.RECEIVE";
public static final String ACTION_C2DM_REGISTER_PACKAGE = BuildConfig.BASE_PACKAGE_NAME + ".android.c2dm.intent.REGISTER";
public static final String ACTION_C2DM_REGISTRATION_PACKAGE = BuildConfig.BASE_PACKAGE_NAME + ".android.c2dm.intent.REGISTRATION";
public static final String ACTION_C2DM_UNREGISTER_PACKAGE = BuildConfig.BASE_PACKAGE_NAME + ".android.c2dm.intent.UNREGISTER";
// Legacy literal values are retained for wire compatibility. Client libraries should use the
// package-scoped values so they bind to a re-signed fork without depending on GmsCore's name.
public static final String ACTION_C2DM_RECEIVE = BuildConfig.BASE_PACKAGE_NAME + ".android.c2dm.intent.RECEIVE";
public static final String ACTION_C2DM_REGISTER = BuildConfig.BASE_PACKAGE_NAME + ".android.c2dm.intent.REGISTER";
public static final String ACTION_C2DM_REGISTRATION = BuildConfig.BASE_PACKAGE_NAME + ".android.c2dm.intent.REGISTRATION";
public static final String ACTION_C2DM_UNREGISTER = BuildConfig.BASE_PACKAGE_NAME + ".android.c2dm.intent.UNREGISTER";
public static final String ACTION_C2DM_RECEIVE_LEGACY = "com.google.android.c2dm.intent.RECEIVE";
public static final String ACTION_C2DM_REGISTER_LEGACY = "com.google.android.c2dm.intent.REGISTER";
public static final String ACTION_C2DM_REGISTRATION_LEGACY = "com.google.android.c2dm.intent.REGISTRATION";
public static final String ACTION_C2DM_UNREGISTER_LEGACY = "com.google.android.c2dm.intent.UNREGISTER";
// Explicit aliases retained for callers that need to address the namespaced protocol.
public static final String ACTION_C2DM_RECEIVE_PACKAGE = ACTION_C2DM_RECEIVE;
public static final String ACTION_C2DM_REGISTER_PACKAGE = ACTION_C2DM_REGISTER;
public static final String ACTION_C2DM_REGISTRATION_PACKAGE = ACTION_C2DM_REGISTRATION;
public static final String ACTION_C2DM_UNREGISTER_PACKAGE = ACTION_C2DM_UNREGISTER;
public static final String ACTION_GCM_SEND_PACKAGE = BuildConfig.BASE_PACKAGE_NAME + ".android.gcm.intent.SEND";
public static final String ACTION_GCM_SEND = "com.google.android.gcm.intent.SEND";
public static final String ACTION_NOTIFICATION_OPEN = "com.google.android.gms.gcm.NOTIFICATION_OPEN";
Expand Down Expand Up @@ -96,13 +102,14 @@ public final class GcmConstants {
public static final String SCHEDULER_ACTION_CANCEL_ALL = "CANCEL_ALL";
public static final String SCHEDULER_ACTION_SCHEDULE = "SCHEDULE_TASK";

public static final String PERMISSION_GTALK = "com.google.android.gtalkservice.permission.GTALK_SERVICE";
public static final String PERMISSION_NETWORK_TASK = "com.google.android.gms.permission.BIND_NETWORK_TASK_SERVICE";
public static final String PERMISSION_RECEIVE = "com.google.android.c2dm.permission.RECEIVE";
public static final String PERMISSION_SEND = "com.google.android.c2dm.permission.SEND";
// Package-scoped variants used by apps patched to target the renamed base package
public static final String PERMISSION_RECEIVE_PACKAGE = BuildConfig.BASE_PACKAGE_NAME + ".android.c2dm.permission.RECEIVE";
public static final String PERMISSION_GTALK_PACKAGE = BuildConfig.BASE_PACKAGE_NAME + ".android.gtalkservice.permission.GTALK_SERVICE";
public static final String PERMISSION_RECEIVE = BuildConfig.BASE_PACKAGE_NAME + ".android.c2dm.permission.RECEIVE";
public static final String PERMISSION_SEND = BuildConfig.BASE_PACKAGE_NAME + ".android.c2dm.permission.SEND";
public static final String PERMISSION_RECEIVE_LEGACY = "com.google.android.c2dm.permission.RECEIVE";
public static final String PERMISSION_SEND_LEGACY = "com.google.android.c2dm.permission.SEND";
public static final String PERMISSION_GTALK = BuildConfig.BASE_PACKAGE_NAME + ".android.gtalkservice.permission.GTALK_SERVICE";
public static final String PERMISSION_RECEIVE_PACKAGE = PERMISSION_RECEIVE;
public static final String PERMISSION_GTALK_PACKAGE = PERMISSION_GTALK;

public static final String ERROR_SERVICE_NOT_AVAILABLE = "SERVICE_NOT_AVAILABLE";

Expand Down
3 changes: 2 additions & 1 deletion play-services-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ android {
buildConfigField "String", "RECAPTCHA_ENTERPRISE_API_KEY", "\"${localProperties.get("recaptchaEnterpreise.apiKey", "")}\""

ndk {
abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
def requestedAbi = project.findProperty("abi")
abiFilters requestedAbi ? requestedAbi : "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
}
}

Expand Down
1 change: 1 addition & 0 deletions play-services-core/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:label="${appLabel}"
android:localeConfig="@xml/locales_config"
android:multiArch="true"
android:networkSecurityConfig="@xml/network_security_config"
android:theme="@style/Theme.App">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
package org.microg.gms.ui

import android.annotation.SuppressLint
import android.content.Intent
import android.content.pm.CrossProfileApps
import android.os.Build.VERSION.SDK_INT
import android.os.Bundle
import androidx.lifecycle.lifecycleScope
import androidx.preference.Preference
Expand Down Expand Up @@ -33,6 +36,12 @@ class WorkProfileFragment : PreferenceFragmentCompat() {
workProfileEnabled.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue ->
lifecycleScope.launchWhenResumed {
if (newValue is Boolean) {
if (newValue && SDK_INT >= 30) {
val crossProfileApps = requireContext().getSystemService(CrossProfileApps::class.java)
if (!crossProfileApps.canInteractAcrossProfiles() && crossProfileApps.canRequestInteractAcrossProfiles()) {
startActivity(crossProfileApps.createRequestInteractAcrossProfilesIntent())
}
}
workProfilePreferences.allowCreateWorkAccount = newValue
}
updateContent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
<fragment
android:id="@+id/gameManagerFragment"
android:name="org.microg.gms.ui.GameProfileFragment"
android:label="@string/pref_game_accounts_title"/>
android:label=""/>

<fragment
android:id="@+id/privacyFragment"
Expand Down
80 changes: 80 additions & 0 deletions play-services-core/src/main/res/xml/locales_config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?xml version="1.0" encoding="utf-8"?>
<locale-config xmlns:android="http://schemas.android.com/apk/res/android">
<locale android:name="af-ZA" />
<locale android:name="am-ET" />
<locale android:name="ar-SA" />
<locale android:name="as-IN" />
<locale android:name="ast" />
<locale android:name="az-AZ" />
<locale android:name="be-BY" />
<locale android:name="bg-BG" />
<locale android:name="bn-BD" />
<locale android:name="bs-BA" />
<locale android:name="ca-ES" />
<locale android:name="ckb-IR" />
<locale android:name="cs-CZ" />
<locale android:name="da-DK" />
<locale android:name="de-DE" />
<locale android:name="el-GR" />
<locale android:name="en" />
<locale android:name="eo" />
<locale android:name="es-ES" />
<locale android:name="et-EE" />
<locale android:name="eu-ES" />
<locale android:name="fa-IR" />
<locale android:name="fi-FI" />
<locale android:name="fil-PH" />
<locale android:name="fr-FR" />
<locale android:name="ga-IE" />
<locale android:name="gl-ES" />
<locale android:name="gu-IN" />
<locale android:name="in-ID" />
<locale android:name="is-IS" />
<locale android:name="it-IT" />
<locale android:name="iw-IL" />
<locale android:name="ja-JP" />
<locale android:name="ka-GE" />
<locale android:name="kk-KZ" />
<locale android:name="km-KH" />
<locale android:name="kmr-TR" />
<locale android:name="kn-IN" />
<locale android:name="ko-KR" />
<locale android:name="ky-KG" />
<locale android:name="lo-LA" />
<locale android:name="lt-LT" />
<locale android:name="lv-LV" />
<locale android:name="lzh" />
<locale android:name="mai-IN" />
<locale android:name="mk-MK" />
<locale android:name="ml" />
<locale android:name="mn-MN" />
<locale android:name="mr-IN" />
<locale android:name="ms-MY" />
<locale android:name="my-MM" />
<locale android:name="nb-NO" />
<locale android:name="ne-IN" />
<locale android:name="nl-NL" />
<locale android:name="or-IN" />
<locale android:name="pa-IN" />
<locale android:name="pl-PL" />
<locale android:name="pt-BR" />
<locale android:name="pt-PT" />
<locale android:name="ro-RO" />
<locale android:name="ru-RU" />
<locale android:name="si-LK" />
<locale android:name="sk-SK" />
<locale android:name="sl-SI" />
<locale android:name="sr-SP" />
<locale android:name="sv-SE" />
<locale android:name="ta-IN" />
<locale android:name="te-IN" />
<locale android:name="th-TH" />
<locale android:name="tr-TR" />
<locale android:name="ug" />
<locale android:name="uk-UA" />
<locale android:name="ur-IN" />
<locale android:name="uz-UZ" />
<locale android:name="zh-CN" />
<locale android:name="zh-TW" />
<locale android:name="zu-ZA" />
</locale-config>