|
19 | 19 |
|
20 | 20 | package eu.faircode.xlua;
|
21 | 21 |
|
| 22 | +import android.annotation.SuppressLint; |
22 | 23 | import android.app.Dialog;
|
23 | 24 | import android.app.Notification;
|
24 | 25 | import android.app.NotificationChannel;
|
|
28 | 29 | import android.content.pm.PackageInfo;
|
29 | 30 | import android.content.pm.PackageManager;
|
30 | 31 | import android.content.res.Resources;
|
| 32 | +import android.net.Uri; |
31 | 33 | import android.os.Build;
|
| 34 | +import android.os.Bundle; |
32 | 35 | import android.os.Process;
|
33 | 36 | import android.os.UserHandle;
|
34 | 37 | import android.text.TextUtils;
|
35 | 38 | import android.util.Log;
|
36 | 39 | import android.util.TypedValue;
|
37 | 40 |
|
38 |
| -import java.lang.reflect.Constructor; |
39 |
| -import java.lang.reflect.Method; |
40 |
| -import java.security.MessageDigest; |
41 |
| - |
42 | 41 | import androidx.appcompat.app.AlertDialog;
|
43 | 42 | import androidx.lifecycle.Lifecycle;
|
44 | 43 | import androidx.lifecycle.LifecycleObserver;
|
45 | 44 | import androidx.lifecycle.LifecycleOwner;
|
46 | 45 | import androidx.lifecycle.OnLifecycleEvent;
|
47 | 46 |
|
| 47 | +import java.lang.reflect.Constructor; |
| 48 | +import java.lang.reflect.Method; |
| 49 | +import java.security.MessageDigest; |
| 50 | + |
48 | 51 | class Util {
|
49 | 52 | private final static String TAG = "XLua.Util";
|
50 | 53 |
|
@@ -167,8 +170,36 @@ static void cancelAsUser(Context context, String tag, int id, int userid) throws
|
167 | 170 | Log.i(TAG, "Cancelled " + tag + ":" + id + " as " + userid);
|
168 | 171 | }
|
169 | 172 |
|
| 173 | + private static Boolean isExp; |
| 174 | + private static boolean isExpModuleActive() { |
| 175 | + if (isExp != null) { |
| 176 | + return isExp; |
| 177 | + } |
| 178 | + try { |
| 179 | + @SuppressLint("PrivateApi") Context context = (Context) Class.forName("android.app.ActivityThread") |
| 180 | + .getDeclaredMethod("currentApplication", new Class[0]).invoke(null, new Object[0]); |
| 181 | + if (context == null) { |
| 182 | + return isExp = false; |
| 183 | + } |
| 184 | + try { |
| 185 | + Bundle call = context.getContentResolver().call(Uri.parse("content://me.weishu.exposed.CP/"), "active", null, null); |
| 186 | + if (call == null) { |
| 187 | + return isExp = false; |
| 188 | + } |
| 189 | + isExp = call.getBoolean("active", false); |
| 190 | + return isExp; |
| 191 | + } catch (Throwable th) { |
| 192 | + return isExp = false; |
| 193 | + } |
| 194 | + } catch (Throwable th2) { |
| 195 | + return isExp = false; |
| 196 | + } |
| 197 | + } |
| 198 | + |
170 | 199 | static boolean isVirtualXposed() {
|
171 |
| - return !TextUtils.isEmpty(System.getProperty("vxp")); |
| 200 | + return !TextUtils.isEmpty(System.getProperty("vxp")) |
| 201 | + || !TextUtils.isEmpty(System.getProperty("exp")) |
| 202 | + || isExpModuleActive(); |
172 | 203 | }
|
173 | 204 |
|
174 | 205 | public static int resolveColor(Context context, int attr) {
|
|
0 commit comments