implementation 'com.mikepenz:foundation-icons-typeface:3.0.0.5'
implementation 'moe.banana:toast-compat:1.0.5'
implementation group:'com.twofortyfouram', name:'android-plugin-api-for-locale', version:'[1.0.2,2.0['
- implementation "org.lsposed.hiddenapibypass:hiddenapibypass:$HIDDEN_API_BYPASS_VERSION"
+ debugImplementation "org.lsposed.hiddenapibypass:hiddenapibypass:$HIDDEN_API_BYPASS_VERSION"
+ releaseImplementation "org.lsposed.hiddenapibypass:hiddenapibypass:$HIDDEN_API_BYPASS_VERSION"
testImplementation "com.google.truth:truth:1.1.3"
testImplementation 'junit:junit:4.13.2'
--- /dev/null
+/*
+ * Copyright (C) 2021 Braden Farmer
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.lsposed.hiddenapibypass;
+
+import java.lang.reflect.Method;
+
+public final class HiddenApiBypass {
+ public static boolean addHiddenApiExemptions(String... signaturePrefixes) {
+
+ // This is the older logic for U.allowReflection(), kept here to preserve compatibility with unit tests
+ try {
+ Method forName = Class.class.getDeclaredMethod("forName", String.class);
+ Method getDeclaredMethod = Class.class.getDeclaredMethod("getDeclaredMethod", String.class, Class[].class);
+
+ Class<?> vmRuntimeClass = (Class<?>) forName.invoke(null, "dalvik.system.VMRuntime");
+ Method getRuntime = (Method) getDeclaredMethod.invoke(vmRuntimeClass, "getRuntime", null);
+ Method setHiddenApiExemptions = (Method) getDeclaredMethod.invoke(vmRuntimeClass, "setHiddenApiExemptions", new Class[]{String[].class});
+
+ Object vmRuntime = getRuntime.invoke(null);
+ setHiddenApiExemptions.invoke(vmRuntime, new Object[]{new String[]{"L"}});
+ } catch (Throwable ignored) {}
+
+ return false;
+ }
+}