mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-22 16:07:39 +00:00
Require GMS to be system app
Fixes https://github.com/topjohnwu/Magisk/issues/8279.
This commit is contained in:
parent
e6bd2ff60f
commit
c2eb603957
@ -1,13 +1,22 @@
|
|||||||
package com.topjohnwu.magisk;
|
package com.topjohnwu.magisk;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.pm.ApplicationInfo;
|
||||||
|
|
||||||
public class ProviderInstaller {
|
public class ProviderInstaller {
|
||||||
|
|
||||||
|
private static final String GMS_PACKAGE_NAME = "com.google.android.gms";
|
||||||
|
|
||||||
public static boolean install(Context context) {
|
public static boolean install(Context context) {
|
||||||
try {
|
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
|
// 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);
|
Context.CONTEXT_INCLUDE_CODE | Context.CONTEXT_IGNORE_SECURITY);
|
||||||
gms.getClassLoader()
|
gms.getClassLoader()
|
||||||
.loadClass("com.google.android.gms.common.security.ProviderInstallerImpl")
|
.loadClass("com.google.android.gms.common.security.ProviderInstallerImpl")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user