Skip to content

Commit

Permalink
Require GMS to be system app
Browse files Browse the repository at this point in the history
Fixes #8279.
aviraxp authored and topjohnwu committed Aug 20, 2024
1 parent e6bd2ff commit c2eb603
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
package com.topjohnwu.magisk;

import android.content.Context;
import android.content.pm.ApplicationInfo;

public class ProviderInstaller {

private static final String GMS_PACKAGE_NAME = "com.google.android.gms";

public static boolean install(Context context) {
try {
// Check if gms is a system app
ApplicationInfo appInfo = context.getPackageManager().getApplicationInfo(GMS_PACKAGE_NAME, 0);
if ((appInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0) {
return false;
}

// Try installing new SSL provider from Google Play Service
Context gms = context.createPackageContext("com.google.android.gms",
Context gms = context.createPackageContext(GMS_PACKAGE_NAME,
Context.CONTEXT_INCLUDE_CODE | Context.CONTEXT_IGNORE_SECURITY);
gms.getClassLoader()
.loadClass("com.google.android.gms.common.security.ProviderInstallerImpl")

1 comment on commit c2eb603

@Diapolo
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@topjohnwu Does this impose any implications for users which are relying on microG (https://github.com/microg/GmsCore)?

Please sign in to comment.