Compare commits
1 Commits
v1.3.4
...
v1.3.4&V2.
| Author | SHA1 | Date | |
|---|---|---|---|
| e780b3ff44 |
@@ -50,8 +50,8 @@ android {
|
|||||||
productFlavors {
|
productFlavors {
|
||||||
official {
|
official {
|
||||||
flavorDimensions "default"
|
flavorDimensions "default"
|
||||||
versionCode 1037
|
versionCode 1038
|
||||||
versionName "2.0.3.7"
|
versionName "2.0.3.8"
|
||||||
/*********************************极光推送************************************/
|
/*********************************极光推送************************************/
|
||||||
manifestPlaceholders = [
|
manifestPlaceholders = [
|
||||||
JPUSH_PKGNAME: "com.jiaoguanyi.appstore",
|
JPUSH_PKGNAME: "com.jiaoguanyi.appstore",
|
||||||
@@ -136,7 +136,7 @@ android {
|
|||||||
v2SigningEnabled false
|
v2SigningEnabled false
|
||||||
}
|
}
|
||||||
|
|
||||||
release {// 签名文件
|
release {
|
||||||
storeFile file("src/main/doc/xueshibaoos.jks")
|
storeFile file("src/main/doc/xueshibaoos.jks")
|
||||||
storePassword "123456"
|
storePassword "123456"
|
||||||
keyAlias "xueshibaoos"
|
keyAlias "xueshibaoos"
|
||||||
@@ -147,10 +147,12 @@ android {
|
|||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
debug {
|
debug {
|
||||||
// 显示Log
|
// 不显示Log
|
||||||
buildConfigField "boolean", "LOG_DEBUG", "true"
|
//buildConfigField "boolean", "LOG_DEBUG", "false"
|
||||||
versionNameSuffix "-debug"
|
//
|
||||||
|
//versionNameSuffix "-debug"
|
||||||
minifyEnabled false
|
minifyEnabled false
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
//Zipalign优化
|
//Zipalign优化
|
||||||
zipAlignEnabled true
|
zipAlignEnabled true
|
||||||
signingConfig signingConfigs.debug
|
signingConfig signingConfigs.debug
|
||||||
@@ -165,14 +167,12 @@ android {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
release {
|
release {
|
||||||
// 不显示Log
|
|
||||||
buildConfigField "boolean", "LOG_DEBUG", "false"
|
|
||||||
//混淆
|
//混淆
|
||||||
minifyEnabled false
|
minifyEnabled false
|
||||||
//Zipalign优化
|
|
||||||
zipAlignEnabled true
|
|
||||||
//前一部分代表系统默认的android程序的混淆文件,该文件已经包含了基本的混淆声明,后一个文件是自己的定义混淆文件
|
//前一部分代表系统默认的android程序的混淆文件,该文件已经包含了基本的混淆声明,后一个文件是自己的定义混淆文件
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
|
//Zipalign优化
|
||||||
|
zipAlignEnabled true
|
||||||
//签名
|
//签名
|
||||||
signingConfig signingConfigs.release
|
signingConfig signingConfigs.release
|
||||||
//将release版本的包名重命名,加上版本及日期
|
//将release版本的包名重命名,加上版本及日期
|
||||||
@@ -225,10 +225,10 @@ dependencies {
|
|||||||
implementation 'com.blankj:utilcode:1.23.7'
|
implementation 'com.blankj:utilcode:1.23.7'
|
||||||
implementation 'com.arialyy.aria:core:3.8.15'
|
implementation 'com.arialyy.aria:core:3.8.15'
|
||||||
annotationProcessor 'com.arialyy.aria:compiler:3.8.15'
|
annotationProcessor 'com.arialyy.aria:compiler:3.8.15'
|
||||||
implementation 'com.amap.api:location:5.1.0'
|
|
||||||
//高德地图定位
|
//高德地图定位
|
||||||
implementation 'org.zeroturnaround:zt-zip:1.13'
|
implementation 'com.amap.api:location:5.1.0'
|
||||||
//压缩文件解压
|
//压缩文件解压
|
||||||
|
implementation 'org.zeroturnaround:zt-zip:1.13'
|
||||||
}
|
}
|
||||||
|
|
||||||
preBuild {
|
preBuild {
|
||||||
|
|||||||
@@ -1283,6 +1283,10 @@ public class MainPresenter implements MainContact.Presenter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setTopApp() {
|
public void setTopApp() {
|
||||||
|
if (JGYUtils.isOfficialVersion()) {
|
||||||
|
mView.setTopAppFinished();
|
||||||
|
return;
|
||||||
|
}
|
||||||
NetInterfaceManager.getInstance().getTopAppControl()
|
NetInterfaceManager.getInstance().getTopAppControl()
|
||||||
.subscribe(new Observer<BaseResponse>() {
|
.subscribe(new Observer<BaseResponse>() {
|
||||||
@Override
|
@Override
|
||||||
@@ -1333,9 +1337,9 @@ public class MainPresenter implements MainContact.Presenter {
|
|||||||
JSONObject jsonObject = (JSONObject) JSON.toJSON(baseResponse.data);
|
JSONObject jsonObject = (JSONObject) JSON.toJSON(baseResponse.data);
|
||||||
int is_developer = jsonObject.getInteger("is_developer");
|
int is_developer = jsonObject.getInteger("is_developer");
|
||||||
//后台1是0否 底层0是1否
|
//后台1是0否 底层0是1否
|
||||||
setDeveloper(is_developer == 0 ? 1 : 0);
|
JGYUtils.getInstance().setDeveloper(is_developer == 0 ? 1 : 0);
|
||||||
} else {
|
} else {
|
||||||
setDeveloper(1);
|
JGYUtils.getInstance().setDeveloper(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1354,16 +1358,6 @@ public class MainPresenter implements MainContact.Presenter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void setDeveloper(int state) {
|
|
||||||
Settings.System.putInt(mContext.getContentResolver(), "qch_Developeroptions", state);
|
|
||||||
if (state == 1) {
|
|
||||||
Intent intent = new Intent();
|
|
||||||
intent.setAction("qch_developeroptions_close");
|
|
||||||
intent.setPackage("com.android.settings");
|
|
||||||
mContext.sendBroadcast(intent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getScreenLockState() {
|
public void getScreenLockState() {
|
||||||
int locked = Settings.System.getInt(mContext.getContentResolver(), "qch_unlock_ipad", 1);
|
int locked = Settings.System.getInt(mContext.getContentResolver(), "qch_unlock_ipad", 1);
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ public class BaseApplication extends MultiDexApplication {
|
|||||||
JGYUtils.init(this);
|
JGYUtils.init(this);
|
||||||
XAPKUtils.init(this);
|
XAPKUtils.init(this);
|
||||||
FileManager.init(this);
|
FileManager.init(this);
|
||||||
hookWebView();
|
JGYUtils.getInstance().hookWebView();
|
||||||
Configuration config = getResources().getConfiguration();
|
Configuration config = getResources().getConfiguration();
|
||||||
int smallestScreenWidthDp = config.smallestScreenWidthDp;
|
int smallestScreenWidthDp = config.smallestScreenWidthDp;
|
||||||
Log.e("mjsheng", "smallestScreenWidthDp=" + smallestScreenWidthDp);
|
Log.e("mjsheng", "smallestScreenWidthDp=" + smallestScreenWidthDp);
|
||||||
@@ -162,63 +162,6 @@ public class BaseApplication extends MultiDexApplication {
|
|||||||
AmapManager.init(this);
|
AmapManager.init(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void hookWebView() {
|
|
||||||
int sdkInt = Build.VERSION.SDK_INT;
|
|
||||||
try {
|
|
||||||
Class<?> factoryClass = Class.forName("android.webkit.WebViewFactory");
|
|
||||||
Field field = factoryClass.getDeclaredField("sProviderInstance");
|
|
||||||
field.setAccessible(true);
|
|
||||||
Object sProviderInstance = field.get(null);
|
|
||||||
if (sProviderInstance != null) {
|
|
||||||
Log.i(TAG, "sProviderInstance isn't null");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Method getProviderClassMethod;
|
|
||||||
if (sdkInt > 22) {
|
|
||||||
getProviderClassMethod = factoryClass.getDeclaredMethod("getProviderClass");
|
|
||||||
} else if (sdkInt == 22) {
|
|
||||||
getProviderClassMethod = factoryClass.getDeclaredMethod("getFactoryClass");
|
|
||||||
} else {
|
|
||||||
Log.i(TAG, "Don't need to Hook WebView");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
getProviderClassMethod.setAccessible(true);
|
|
||||||
Class<?> factoryProviderClass = (Class<?>) getProviderClassMethod.invoke(factoryClass);
|
|
||||||
Class<?> delegateClass = Class.forName("android.webkit.WebViewDelegate");
|
|
||||||
Constructor<?> delegateConstructor = delegateClass.getDeclaredConstructor();
|
|
||||||
delegateConstructor.setAccessible(true);
|
|
||||||
if (sdkInt < 26) {//低于Android O版本
|
|
||||||
Constructor<?> providerConstructor = factoryProviderClass.getConstructor(delegateClass);
|
|
||||||
if (providerConstructor != null) {
|
|
||||||
providerConstructor.setAccessible(true);
|
|
||||||
sProviderInstance = providerConstructor.newInstance(delegateConstructor.newInstance());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Field chromiumMethodName = factoryClass.getDeclaredField("CHROMIUM_WEBVIEW_FACTORY_METHOD");
|
|
||||||
chromiumMethodName.setAccessible(true);
|
|
||||||
String chromiumMethodNameStr = (String) chromiumMethodName.get(null);
|
|
||||||
if (chromiumMethodNameStr == null) {
|
|
||||||
chromiumMethodNameStr = "create";
|
|
||||||
}
|
|
||||||
Method staticFactory = factoryProviderClass.getMethod(chromiumMethodNameStr, delegateClass);
|
|
||||||
if (staticFactory != null) {
|
|
||||||
sProviderInstance = staticFactory.invoke(null, delegateConstructor.newInstance());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sProviderInstance != null) {
|
|
||||||
field.set("sProviderInstance", sProviderInstance);
|
|
||||||
Log.i(TAG, "Hook success!");
|
|
||||||
} else {
|
|
||||||
Log.i(TAG, "Hook failed!");
|
|
||||||
}
|
|
||||||
} catch (Throwable e) {
|
|
||||||
Log.w(TAG, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 忽略电池优化
|
* 忽略电池优化
|
||||||
|
|||||||
@@ -6,54 +6,57 @@ import com.mjsheng.myappstore.manager.NetInterfaceManager;
|
|||||||
* @author Administrator
|
* @author Administrator
|
||||||
*/
|
*/
|
||||||
public class URLAddress {
|
public class URLAddress {
|
||||||
|
//根网址
|
||||||
private static final String HTTP_TAG_HEAD_NEW = NetInterfaceManager.ROOT_URL;
|
private static final String HTTP_TAG_HEAD_NEW = NetInterfaceManager.ROOT_URL;
|
||||||
|
|
||||||
public static final String HTTP_TAG_DOWNLOAD_URL = HTTP_TAG_HEAD_NEW + "count/index";
|
|
||||||
// 下载接口 根据包名匹配 请求后更新下载次数
|
// 下载接口 根据包名匹配 请求后更新下载次数
|
||||||
|
public static final String HTTP_TAG_DOWNLOAD_URL = HTTP_TAG_HEAD_NEW + "count/index";
|
||||||
|
//app下载完成发送下载次数
|
||||||
public static final String SEND_DOWNLOAD_FILE_INFO = HTTP_TAG_HEAD_NEW + "app/downloadApp";
|
public static final String SEND_DOWNLOAD_FILE_INFO = HTTP_TAG_HEAD_NEW + "app/downloadApp";
|
||||||
|
//获取设备锁定状态
|
||||||
public static final String GET_DEVICES_LOCKED = HTTP_TAG_HEAD_NEW + "lock/index";
|
public static final String GET_DEVICES_LOCKED = HTTP_TAG_HEAD_NEW + "lock/index";
|
||||||
|
//发送设备信息
|
||||||
public static final String SEND_DEVICES = HTTP_TAG_HEAD_NEW + "Mac/getMac";
|
public static final String SEND_DEVICES = HTTP_TAG_HEAD_NEW + "Mac/getMac";
|
||||||
|
//发送app使用情况
|
||||||
public static final String SEND_USEDTIME = HTTP_TAG_HEAD_NEW + "Applog/getAppLog";
|
public static final String SEND_USEDTIME = HTTP_TAG_HEAD_NEW + "Applog/getAppLog";
|
||||||
|
|
||||||
public static final String CHECK_UPDATE = HTTP_TAG_HEAD_NEW + "Silent/silent";
|
|
||||||
//更新接口
|
//更新接口
|
||||||
public static final String GET_DEVICES_TAGS = HTTP_TAG_HEAD_NEW + "Sn/getSnTag";
|
public static final String CHECK_UPDATE = HTTP_TAG_HEAD_NEW + "Silent/silent";
|
||||||
//获取设备标签
|
//获取设备标签
|
||||||
public static final String DELETE_GEDEVICE_ALIAS = HTTP_TAG_HEAD_NEW + "Sn/deleteAliases";
|
public static final String GET_DEVICES_TAGS = HTTP_TAG_HEAD_NEW + "Sn/getSnTag";
|
||||||
//删除Aliases
|
//删除Aliases
|
||||||
public static final String SET_HOMEPAG_TAG = HTTP_TAG_HEAD_NEW + "Label";
|
public static final String DELETE_GEDEVICE_ALIAS = HTTP_TAG_HEAD_NEW + "Sn/deleteAliases";
|
||||||
//浏览器书签主页设置
|
//浏览器书签主页设置
|
||||||
public static final String SET_APPINSIDEWEB = HTTP_TAG_HEAD_NEW + "Appground";
|
public static final String SET_HOMEPAG_TAG = HTTP_TAG_HEAD_NEW + "Label";
|
||||||
//app内部网页管控
|
//app内部网页管控
|
||||||
public static final String SET_BROWSER_LIST = HTTP_TAG_HEAD_NEW + "browser";
|
public static final String SET_APPINSIDEWEB = HTTP_TAG_HEAD_NEW + "Appground";
|
||||||
//浏览器黑白名单地址
|
//浏览器黑白名单地址
|
||||||
public static final String SET_WHITE_PACKAGE_LIST = HTTP_TAG_HEAD_NEW + "firmware/index";
|
public static final String SET_BROWSER_LIST = HTTP_TAG_HEAD_NEW + "browser";
|
||||||
//应用白名单
|
//应用白名单
|
||||||
public static final String GET_HIDE_DESKTOPICON = HTTP_TAG_HEAD_NEW + "Icon";
|
public static final String SET_WHITE_PACKAGE_LIST = HTTP_TAG_HEAD_NEW + "firmware/index";
|
||||||
//获取隐藏桌面图标
|
//获取隐藏桌面图标
|
||||||
public final static String NET_AND_LAUNCH_API = HTTP_TAG_HEAD_NEW + "automatic/get";
|
public static final String GET_HIDE_DESKTOPICON = HTTP_TAG_HEAD_NEW + "Icon";
|
||||||
//获取应用升级自启
|
//获取应用升级自启
|
||||||
public static final String GET_STUDENTS_INFO = HTTP_TAG_HEAD_NEW + "Sn/getStudent";
|
public final static String NET_AND_LAUNCH_API = HTTP_TAG_HEAD_NEW + "automatic/get";
|
||||||
//通过sn获取信息
|
//通过sn获取信息
|
||||||
public static final String SEND_SCREENSHOT = HTTP_TAG_HEAD_NEW + "Screenshot/addImg";
|
public static final String GET_STUDENTS_INFO = HTTP_TAG_HEAD_NEW + "Sn/getStudent";
|
||||||
//上传截图
|
//上传截图
|
||||||
//public static final String UPDATE_DEVICEINFO = HTTP_TAG_HEAD_NEW + "Mac/getInfo";
|
public static final String SEND_SCREENSHOT = HTTP_TAG_HEAD_NEW + "Screenshot/addImg";
|
||||||
//上传我的设备
|
//上传我的设备
|
||||||
public final static String GET_LOCK_SCREEN_STATE = HTTP_TAG_HEAD_NEW + "Sn/getSnScreen";
|
//public static final String UPDATE_DEVICEINFO = HTTP_TAG_HEAD_NEW + "Mac/getInfo";
|
||||||
//获取霸屏状态
|
//获取霸屏状态
|
||||||
public final static String GET_DESKTOP = HTTP_TAG_HEAD_NEW + "Sn/getSnDesktop";
|
public final static String GET_LOCK_SCREEN_STATE = HTTP_TAG_HEAD_NEW + "Sn/getSnScreen";
|
||||||
//获取默认桌面升级
|
//获取默认桌面升级
|
||||||
public final static String GET_SN_TIME_CONTROL = HTTP_TAG_HEAD_NEW + "Sn/getSnTimeControl";
|
public final static String GET_DESKTOP = HTTP_TAG_HEAD_NEW + "Sn/getSnDesktop";
|
||||||
//获取时间管控
|
//获取时间管控
|
||||||
public final static String GET_TOP_APP_CONTROL = HTTP_TAG_HEAD_NEW + "Sn/getSnAppControl";
|
public final static String GET_SN_TIME_CONTROL = HTTP_TAG_HEAD_NEW + "Sn/getSnTimeControl";
|
||||||
//获取顶部app管控
|
//获取顶部app管控
|
||||||
public final static String GET_SN_APP_TEST = HTTP_TAG_HEAD_NEW + "Sn/getSnAppTest";
|
public final static String GET_TOP_APP_CONTROL = HTTP_TAG_HEAD_NEW + "Sn/getSnAppControl";
|
||||||
//获取测试app
|
//获取测试app
|
||||||
public final static String GET_LOGO_IMG = HTTP_TAG_HEAD_NEW + "Sn/getLogoImg";
|
public final static String GET_SN_APP_TEST = HTTP_TAG_HEAD_NEW + "Sn/getSnAppTest";
|
||||||
//开机动画
|
//开机动画
|
||||||
|
public final static String GET_LOGO_IMG = HTTP_TAG_HEAD_NEW + "Sn/getLogoImg";
|
||||||
|
//开发人员选项开关
|
||||||
public final static String GET_DEVELOPER = HTTP_TAG_HEAD_NEW + "Sn/getDeveloper";
|
public final static String GET_DEVELOPER = HTTP_TAG_HEAD_NEW + "Sn/getDeveloper";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -131,6 +131,8 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
|||||||
|
|
||||||
private final String CLEAN_APP_CACHE = "32";//清除app数据
|
private final String CLEAN_APP_CACHE = "32";//清除app数据
|
||||||
|
|
||||||
|
private final String DEVELOPER_OPTIONS = "33";//开发人员选项
|
||||||
|
|
||||||
|
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
|
|
||||||
@@ -365,6 +367,9 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
|||||||
case CLEAN_APP_CACHE:
|
case CLEAN_APP_CACHE:
|
||||||
cleanCache(context, extras);
|
cleanCache(context, extras);
|
||||||
break;
|
break;
|
||||||
|
case DEVELOPER_OPTIONS:
|
||||||
|
setDeveloperoptions(extras);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1432,4 +1437,11 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setDeveloperoptions(String extras) {
|
||||||
|
com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(extras);
|
||||||
|
int is_developer = jsonObject.getInteger("is_developer");
|
||||||
|
Log.e(TAG, "setDeveloperoptions: " + is_developer);
|
||||||
|
JGYUtils.getInstance().setDeveloper(is_developer == 0 ? 1 : 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1140,7 +1140,7 @@ public class ApkUtils {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(Throwable e) {
|
public void onError(Throwable e) {
|
||||||
Log.e("RemoveTask", "onError: ");
|
Log.e("RemoveTask", "onError: " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -32,6 +32,9 @@ import com.mjsheng.myappstore.comm.CommonDatas;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.lang.reflect.Constructor;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
@@ -764,4 +767,71 @@ public class JGYUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setDeveloper(int state) {
|
||||||
|
Settings.System.putInt(mContext.getContentResolver(), "qch_Developeroptions", state);
|
||||||
|
if (state == 1) {
|
||||||
|
Intent intent = new Intent();
|
||||||
|
intent.setAction("qch_developeroptions_close");
|
||||||
|
intent.setPackage("com.android.settings");
|
||||||
|
mContext.sendBroadcast(intent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void hookWebView() {
|
||||||
|
int sdkInt = Build.VERSION.SDK_INT;
|
||||||
|
try {
|
||||||
|
Class<?> factoryClass = Class.forName("android.webkit.WebViewFactory");
|
||||||
|
Field field = factoryClass.getDeclaredField("sProviderInstance");
|
||||||
|
field.setAccessible(true);
|
||||||
|
Object sProviderInstance = field.get(null);
|
||||||
|
if (sProviderInstance != null) {
|
||||||
|
Log.i(TAG, "sProviderInstance isn't null");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Method getProviderClassMethod;
|
||||||
|
if (sdkInt > 22) {
|
||||||
|
getProviderClassMethod = factoryClass.getDeclaredMethod("getProviderClass");
|
||||||
|
} else if (sdkInt == 22) {
|
||||||
|
getProviderClassMethod = factoryClass.getDeclaredMethod("getFactoryClass");
|
||||||
|
} else {
|
||||||
|
Log.i(TAG, "Don't need to Hook WebView");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
getProviderClassMethod.setAccessible(true);
|
||||||
|
Class<?> factoryProviderClass = (Class<?>) getProviderClassMethod.invoke(factoryClass);
|
||||||
|
Class<?> delegateClass = Class.forName("android.webkit.WebViewDelegate");
|
||||||
|
Constructor<?> delegateConstructor = delegateClass.getDeclaredConstructor();
|
||||||
|
delegateConstructor.setAccessible(true);
|
||||||
|
if (sdkInt < 26) {//低于Android O版本
|
||||||
|
Constructor<?> providerConstructor = factoryProviderClass.getConstructor(delegateClass);
|
||||||
|
if (providerConstructor != null) {
|
||||||
|
providerConstructor.setAccessible(true);
|
||||||
|
sProviderInstance = providerConstructor.newInstance(delegateConstructor.newInstance());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Field chromiumMethodName = factoryClass.getDeclaredField("CHROMIUM_WEBVIEW_FACTORY_METHOD");
|
||||||
|
chromiumMethodName.setAccessible(true);
|
||||||
|
String chromiumMethodNameStr = (String) chromiumMethodName.get(null);
|
||||||
|
if (chromiumMethodNameStr == null) {
|
||||||
|
chromiumMethodNameStr = "create";
|
||||||
|
}
|
||||||
|
Method staticFactory = factoryProviderClass.getMethod(chromiumMethodNameStr, delegateClass);
|
||||||
|
if (staticFactory != null) {
|
||||||
|
sProviderInstance = staticFactory.invoke(null, delegateConstructor.newInstance());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sProviderInstance != null) {
|
||||||
|
field.set("sProviderInstance", sProviderInstance);
|
||||||
|
Log.i(TAG, "Hook success!");
|
||||||
|
} else {
|
||||||
|
Log.i(TAG, "Hook failed!");
|
||||||
|
}
|
||||||
|
} catch (Throwable e) {
|
||||||
|
Log.w(TAG, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import com.mjsheng.myappstore.BuildConfig;
|
|||||||
public class Logger {
|
public class Logger {
|
||||||
|
|
||||||
//设为false关闭日志
|
//设为false关闭日志
|
||||||
private static final boolean LOG_ENABLE = BuildConfig.LOG_DEBUG;
|
private static final boolean LOG_ENABLE = BuildConfig.DEBUG;
|
||||||
|
|
||||||
public static void i(String tag, String msg){
|
public static void i(String tag, String msg){
|
||||||
if (LOG_ENABLE){
|
if (LOG_ENABLE){
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ public class ToastUtil {
|
|||||||
mainHandler.post(new Runnable() {
|
mainHandler.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (BuildConfig.LOG_DEBUG) {
|
if (BuildConfig.DEBUG) {
|
||||||
if (toast != null) {
|
if (toast != null) {
|
||||||
toast.setText(msg);
|
toast.setText(msg);
|
||||||
toast.show();
|
toast.show();
|
||||||
|
|||||||
Reference in New Issue
Block a user