version:1.3.4
update: fix: add:开发人员选项管控推送
This commit is contained in:
@@ -1283,6 +1283,10 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
|
||||
@Override
|
||||
public void setTopApp() {
|
||||
if (JGYUtils.isOfficialVersion()) {
|
||||
mView.setTopAppFinished();
|
||||
return;
|
||||
}
|
||||
NetInterfaceManager.getInstance().getTopAppControl()
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
@@ -1333,9 +1337,9 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
JSONObject jsonObject = (JSONObject) JSON.toJSON(baseResponse.data);
|
||||
int is_developer = jsonObject.getInteger("is_developer");
|
||||
//后台1是0否 底层0是1否
|
||||
setDeveloper(is_developer == 0 ? 1 : 0);
|
||||
JGYUtils.getInstance().setDeveloper(is_developer == 0 ? 1 : 0);
|
||||
} 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
|
||||
public void getScreenLockState() {
|
||||
int locked = Settings.System.getInt(mContext.getContentResolver(), "qch_unlock_ipad", 1);
|
||||
|
||||
@@ -115,7 +115,7 @@ public class BaseApplication extends MultiDexApplication {
|
||||
JGYUtils.init(this);
|
||||
XAPKUtils.init(this);
|
||||
FileManager.init(this);
|
||||
hookWebView();
|
||||
JGYUtils.getInstance().hookWebView();
|
||||
Configuration config = getResources().getConfiguration();
|
||||
int smallestScreenWidthDp = config.smallestScreenWidthDp;
|
||||
Log.e("mjsheng", "smallestScreenWidthDp=" + smallestScreenWidthDp);
|
||||
@@ -162,63 +162,6 @@ public class BaseApplication extends MultiDexApplication {
|
||||
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
|
||||
*/
|
||||
public class URLAddress {
|
||||
//根网址
|
||||
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 GET_DEVICES_LOCKED = HTTP_TAG_HEAD_NEW + "lock/index";
|
||||
|
||||
//发送设备信息
|
||||
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 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
|
||||
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内部网页管控
|
||||
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获取信息
|
||||
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管控
|
||||
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
|
||||
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_DEVELOPER = HTTP_TAG_HEAD_NEW + "Sn/getDeveloper";
|
||||
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";
|
||||
|
||||
}
|
||||
|
||||
@@ -131,6 +131,8 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
|
||||
private final String CLEAN_APP_CACHE = "32";//清除app数据
|
||||
|
||||
private final String DEVELOPER_OPTIONS = "33";//开发人员选项
|
||||
|
||||
|
||||
private Context mContext;
|
||||
|
||||
@@ -365,6 +367,9 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
case CLEAN_APP_CACHE:
|
||||
cleanCache(context, extras);
|
||||
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
|
||||
public void onError(Throwable e) {
|
||||
Log.e("RemoveTask", "onError: ");
|
||||
Log.e("RemoveTask", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -32,6 +32,9 @@ import com.mjsheng.myappstore.comm.CommonDatas;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
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.Path;
|
||||
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 {
|
||||
|
||||
//设为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){
|
||||
if (LOG_ENABLE){
|
||||
|
||||
@@ -88,7 +88,7 @@ public class ToastUtil {
|
||||
mainHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (BuildConfig.LOG_DEBUG) {
|
||||
if (BuildConfig.DEBUG) {
|
||||
if (toast != null) {
|
||||
toast.setText(msg);
|
||||
toast.show();
|
||||
|
||||
Reference in New Issue
Block a user