Skip to content

Commit

Permalink
fix: Rename permissions to fix conflict with MicroG GmsCore
Browse files Browse the repository at this point in the history
If MicroG GmsCore is installed next to this, conflicting permissions will prevent installation.
  • Loading branch information
oSumAtrIX committed Mar 27, 2024
1 parent 762e2cb commit 3686a2f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import android.util.Log;

import androidx.annotation.Nullable;
import com.google.android.gms.common.BuildConfig;
import org.microg.gms.utils.ExtendedPackageInfo;

import java.lang.reflect.Method;
Expand Down Expand Up @@ -60,7 +61,7 @@ public static boolean isGooglePackage(Context context, String packageName) {
*/
@Deprecated
public static boolean callerHasExtendedAccessPermission(Context context) {
return context.checkCallingPermission("org.microg.gms.EXTENDED_ACCESS") == PackageManager.PERMISSION_GRANTED;
return context.checkCallingPermission(BuildConfig.BASE_PACKAGE_NAME + ".microg.gms.EXTENDED_ACCESS") == PackageManager.PERMISSION_GRANTED;
}

public static void assertGooglePackagePermission(Context context, GooglePackagePermission permission) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import android.content.pm.ResolveInfo;
import android.os.IBinder;
import android.util.Log;
import com.google.android.gms.base.BuildConfig;

import java.util.HashMap;
import java.util.HashSet;
Expand Down Expand Up @@ -179,7 +180,7 @@ public boolean isMicrog(ResolveInfo resolveInfo) {
if (resolveInfo == null || resolveInfo.serviceInfo == null) return false;
if (resolveInfo.serviceInfo.name.startsWith("org.microg.")) return true;
try {
PermissionInfo info = context.getPackageManager().getPermissionInfo("org.microg.gms.EXTENDED_ACCESS", 0);
PermissionInfo info = context.getPackageManager().getPermissionInfo(BuildConfig.BASE_PACKAGE_NAME + ".microg.gms.EXTENDED_ACCESS", 0);
return info.packageName.equals(resolveInfo.serviceInfo.packageName);
} catch (PackageManager.NameNotFoundException e) {
return false;
Expand Down
10 changes: 5 additions & 5 deletions play-services-core/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,15 @@
android:protectionLevel="signature" />

<permission
android:name="org.microg.gms.STATUS_BROADCAST"
android:name="${basePackageName}.microg.gms.STATUS_BROADCAST"
android:label="@string/perm_status_broadcast_label"
android:protectionLevel="normal" />
<permission
android:name="org.microg.gms.EXTENDED_ACCESS"
android:name="${basePackageName}.microg.gms.EXTENDED_ACCESS"
android:label="@string/perm_extended_access_label"
android:protectionLevel="dangerous" />
<permission
android:name="org.microg.gms.PROVISION"
android:name="${basePackageName}.microg.gms.PROVISION"
android:description="@string/perm_provision_description"
android:label="@string/perm_provision_label"
android:protectionLevel="privileged|signature" />
Expand Down Expand Up @@ -146,7 +146,7 @@
<uses-permission android:name="${basePackageName}.android.gtalkservice.permission.GTALK_SERVICE" />
<uses-permission android:name="${basePackageName}.android.gms.auth.api.phone.permission.SEND" />

<uses-permission android:name="org.microg.gms.STATUS_BROADCAST" />
<uses-permission android:name="${basePackageName}.microg.gms.STATUS_BROADCAST" />

<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
Expand Down Expand Up @@ -176,7 +176,7 @@
<service
android:name="org.microg.gms.provision.ProvisionService"
android:exported="true"
android:permission="org.microg.gms.PROVISION" />
android:permission="${basePackageName}.microg.gms.PROVISION" />

<!-- Location -->

Expand Down

0 comments on commit 3686a2f

Please sign in to comment.