version:2.2.8

update:0928
fix:修复浏览器删除主页和白名单,数据为空时,浏览器管控失效
add:更换批次不恢复出厂设置时清除浏览器缓存
This commit is contained in:
2021-09-28 10:32:32 +08:00
parent 35e2df454f
commit 9963b276f6
10 changed files with 54 additions and 16 deletions

View File

@@ -41,9 +41,9 @@ android {
//新平台正式 //新平台正式
newly { newly {
flavorDimensions "default" flavorDimensions "default"
versionCode 626 versionCode 628
//versionCode 1037 //versionCode 1037
versionName "2.2.6" versionName "2.2.8"
/*********************************极光推送************************************/ /*********************************极光推送************************************/
manifestPlaceholders = [ manifestPlaceholders = [
JPUSH_PKGNAME: "com.jiaoguanyi.appstore", JPUSH_PKGNAME: "com.jiaoguanyi.appstore",
@@ -361,6 +361,8 @@ dependencies {
implementation 'com.trello.rxlifecycle2:rxlifecycle:2.2.2' implementation 'com.trello.rxlifecycle2:rxlifecycle:2.2.2'
implementation 'com.trello.rxlifecycle2:rxlifecycle-android:2.2.2' implementation 'com.trello.rxlifecycle2:rxlifecycle-android:2.2.2'
implementation 'com.trello.rxlifecycle2:rxlifecycle-components:2.2.2' implementation 'com.trello.rxlifecycle2:rxlifecycle-components:2.2.2'
implementation 'com.tencent:mmkv-static:1.2.10'
} }
preBuild { preBuild {

View File

@@ -125,7 +125,7 @@
<service android:name=".service.GuardService" /> <service android:name=".service.GuardService" />
<service <service
android:name=".service.StepService" android:name=".service.StepService"
android:exported="true" > android:exported="true">
<intent-filter android:priority="1000"> <intent-filter android:priority="1000">
<action android:name="android.intent.action.SCREEN_OFF" /> <action android:name="android.intent.action.SCREEN_OFF" />
<action android:name="android.intent.action.SCREEN_ON" /> <action android:name="android.intent.action.SCREEN_ON" />

View File

@@ -253,7 +253,7 @@ public class MainPresenter implements MainContact.Presenter {
@Override @Override
public void onNext(@NonNull BaseResponse response) { public void onNext(@NonNull BaseResponse response) {
Logutils.e(TAG + ":" + "getLockedState", "onNext: "); Logutils.e(TAG + ":" + "getLockedState", "onNext: " + JSONObject.toJSONString(response));
if (response.code == OK) { if (response.code == OK) {
JsonObject jsonObject = JsonParser.parseString(new Gson().toJson(response.data)).getAsJsonObject(); JsonObject jsonObject = JsonParser.parseString(new Gson().toJson(response.data)).getAsJsonObject();
int locked = jsonObject.get("lock").getAsInt(); int locked = jsonObject.get("lock").getAsInt();

View File

@@ -34,6 +34,7 @@ import com.mjsheng.myappstore.utils.SystemUtils;
import com.mjsheng.myappstore.utils.ToastUtil; import com.mjsheng.myappstore.utils.ToastUtil;
import com.mjsheng.myappstore.utils.Utils; import com.mjsheng.myappstore.utils.Utils;
import com.mjsheng.myappstore.utils.XAPKUtils; import com.mjsheng.myappstore.utils.XAPKUtils;
import com.tencent.mmkv.MMKV;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -98,7 +99,8 @@ public class BaseApplication extends MultiDexApplication {
AmapManager.init(this); AmapManager.init(this);
AmapManager.getInstance().initAmap(); AmapManager.getInstance().initAmap();
ToastUtil.init(this); ToastUtil.init(this);
String rootDir = MMKV.initialize(this);
System.out.println("mmkv root: " + rootDir);
JGYUtils.getInstance().hookWebView(); JGYUtils.getInstance().hookWebView();
// 设置开启日志,发布时请关闭日志 // 设置开启日志,发布时请关闭日志

View File

@@ -433,6 +433,12 @@ public class MyJPushReceiver extends BroadcastReceiver {
case UPDATE_BATCH: case UPDATE_BATCH:
ToastUtil.betaShow("收到管控:更换批次不恢复出厂设置"); ToastUtil.betaShow("收到管控:更换批次不恢复出厂设置");
Aria.download(this).removeAllTask(true); Aria.download(this).removeAllTask(true);
try {
new CacheUtils().cleanApplicationUserData(mContext, "com.android.browser");
} catch (Exception e) {
e.printStackTrace();
Logutils.e(TAG, "setHomepagtag: " + e.getMessage());
}
if (MainService.mPresenter != null) { if (MainService.mPresenter != null) {
MainService.mPresenter.getLockedState(); MainService.mPresenter.getLockedState();
Logutils.e("getLockedState", "mPresenter: " + "getLockedState"); Logutils.e("getLockedState", "mPresenter: " + "getLockedState");

View File

@@ -3,6 +3,7 @@ package com.mjsheng.myappstore.service;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.app.Service; import android.app.Service;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
@@ -33,6 +34,7 @@ import com.mjsheng.myappstore.action.JGYActions;
import com.mjsheng.myappstore.activity.MainActivity; import com.mjsheng.myappstore.activity.MainActivity;
import com.mjsheng.myappstore.activity.MainContact; import com.mjsheng.myappstore.activity.MainContact;
import com.mjsheng.myappstore.activity.MainPresenter; import com.mjsheng.myappstore.activity.MainPresenter;
import com.mjsheng.myappstore.receiver.BootReceiver;
import com.mjsheng.myappstore.utils.ApkUtils; import com.mjsheng.myappstore.utils.ApkUtils;
import com.mjsheng.myappstore.utils.ForegroundAppUtil; import com.mjsheng.myappstore.utils.ForegroundAppUtil;
import com.mjsheng.myappstore.utils.Logutils; import com.mjsheng.myappstore.utils.Logutils;
@@ -150,7 +152,6 @@ public class MainService extends Service implements MainContact.MainView, Networ
mPresenter = new MainPresenter(this); mPresenter = new MainPresenter(this);
mPresenter.attachView(this); mPresenter.attachView(this);
mPresenter.setProvider(this); mPresenter.setProvider(this);
lifecycleSubject.onNext(ActivityEvent.CREATE);
if ((int) SPUtils.get(this, "first_connect", 0) == 0) { if ((int) SPUtils.get(this, "first_connect", 0) == 0) {
// TODO: 2021/5/26 待底层修改,临时解决办法 // TODO: 2021/5/26 待底层修改,临时解决办法
Logutils.e(TAG, "onCreate: " + "Disable All Settings"); Logutils.e(TAG, "onCreate: " + "Disable All Settings");
@@ -191,6 +192,9 @@ public class MainService extends Service implements MainContact.MainView, Networ
@Override @Override
public int onStartCommand(Intent intent, int flags, int startId) { public int onStartCommand(Intent intent, int flags, int startId) {
Intent bootIntent = new Intent(BootReceiver.BOOT_COMPLETED);
bootIntent.setComponent(new ComponentName("com.jiaoguanyi.store", "com.mjsheng.myappstore.receiver.BootReceiver"));
sendBroadcast(bootIntent);
JPushInterface.init(this); JPushInterface.init(this);
if (MainActivity.isForeground) { if (MainActivity.isForeground) {
Logutils.e(TAG, "onStartCommand: MainService: isForeground: " + MainActivity.isForeground); Logutils.e(TAG, "onStartCommand: MainService: isForeground: " + MainActivity.isForeground);

View File

@@ -219,7 +219,7 @@ public class StepService extends Service implements NetworkUtils.OnNetworkStatus
//connectBlocking多出一个等待操作会先连接再发送否则未连接发送会报错 //connectBlocking多出一个等待操作会先连接再发送否则未连接发送会报错
Logutils.i("JWebSocketClientService", "websocket链接中"); Logutils.i("JWebSocketClientService", "websocket链接中");
client.connectBlocking(); client.connectBlocking();
} catch (InterruptedException e) { } catch (Exception e) {
Logutils.i("JWebSocketClientService", e.getMessage()); Logutils.i("JWebSocketClientService", e.getMessage());
// e.printStackTrace(); // e.printStackTrace();
} }
@@ -251,11 +251,15 @@ public class StepService extends Service implements NetworkUtils.OnNetworkStatus
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("sn", Utils.getSerial()); jsonObject.put("sn", Utils.getSerial());
jsonObject.put("online", state); jsonObject.put("online", state);
if (null != client) { try {
Logutils.i("JWebSocketClientService", "发送的消息:" + jsonObject.toJSONString()); if (null != client) {
client.send(jsonObject.toJSONString()); Logutils.i("JWebSocketClientService", "发送的消息:" + jsonObject.toJSONString());
} else { client.send(jsonObject.toJSONString());
Logutils.i("JWebSocketClientService", "未连接"); } else {
Logutils.i("JWebSocketClientService", "未连接");
}
} catch (Exception e) {
Log.e(TAG, "sendMsg: " + e.getMessage());
} }
} }

View File

@@ -1178,7 +1178,9 @@ public class ApkUtils {
uploadAppInfo.setPackage_name(packageInfo.packageName); uploadAppInfo.setPackage_name(packageInfo.packageName);
Logutils.e("getAppInfo", "getAppInfo:" + packageInfo.packageName); Logutils.e("getAppInfo", "getAppInfo:" + packageInfo.packageName);
// uploadAppInfo.setId(i); // uploadAppInfo.setId(i);
String firstInstallTime = Utils.transferLongToDate(packageInfo.firstInstallTime); // String firstInstallTime = Utils.transferLongToDate(packageInfo.firstInstallTime);
// String lastUpdateTime = Utils.transferLongToDate(packageInfo.lastUpdateTime);
String firstInstallTime = Utils.transferLongToDate(packageInfo.lastUpdateTime);
uploadAppInfo.setInstall_time(firstInstallTime); uploadAppInfo.setInstall_time(firstInstallTime);
uploadAppInfo.setVersionCode(String.valueOf(packageInfo.versionCode)); uploadAppInfo.setVersionCode(String.valueOf(packageInfo.versionCode));
uploadAppInfo.setState(0); uploadAppInfo.setState(0);

View File

@@ -51,6 +51,12 @@ public class URLUtils {
} else { } else {
Logutils.e(TAG, "getBrowserWhiteList: " + "oldwhiteList is : " + oldwhiteList); Logutils.e(TAG, "getBrowserWhiteList: " + "oldwhiteList is : " + oldwhiteList);
HashSet<String> URLList = new HashSet<>(Arrays.asList(oldwhiteList.trim().split(","))); HashSet<String> URLList = new HashSet<>(Arrays.asList(oldwhiteList.trim().split(",")));
URLList.removeIf(TextUtils::isEmpty);
if (URLList.size() == 0) {
Log.e(TAG, "setBrowserWhiteList: URLList set is empty , set Invalid");
Settings.System.putString(mContext.getContentResolver(), "DeselectBrowserArray", "Invalid");
return;
}
Log.e(TAG, "setBrowserWhiteList: " + URLList); Log.e(TAG, "setBrowserWhiteList: " + URLList);
Observable.create(new ObservableOnSubscribe<String>() { Observable.create(new ObservableOnSubscribe<String>() {
@Override @Override
@@ -73,7 +79,9 @@ public class URLUtils {
// } // }
// }else { // }else {
// } // }
nohttpURLList.add("m." + getDomain(url)); if (haveDomain(url)){
nohttpURLList.add("m." + getDomain(url));
}
// nohttpURLList.add(getDomain(url)); // nohttpURLList.add(getDomain(url));
if (!url.startsWith("http")) { if (!url.startsWith("http")) {
@@ -294,6 +302,13 @@ public class URLUtils {
return domainVal; return domainVal;
} }
public boolean haveDomain(String url) {
String regexStr = "(?<=//|)((\\w)+(\\.cn|\\.com.cn|\\.org.cn|\\.com|\\.net|\\.org|\\.cc|\\.biz|\\.uk|\\.info|\\.in|\\.eu))+";
Pattern p = Pattern.compile(regexStr);
Matcher m = p.matcher(url);
return m.find();
}
/** /**
* Gets ip. * Gets ip.

View File

@@ -162,9 +162,9 @@ public class Utils {
} }
public static String getAndroid10MAC(Context context) { public static String getAndroid10MAC(Context context) {
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.N_MR1){ if (Build.VERSION.SDK_INT > Build.VERSION_CODES.N_MR1) {
return getMacAddress(context); return getMacAddress(context);
}else { } else {
return getAndroid7MAC(); return getAndroid7MAC();
} }
} }
@@ -703,6 +703,9 @@ public class Utils {
e.printStackTrace(); e.printStackTrace();
Logutils.e("e", "读取设备序列号异常:" + e.toString()); Logutils.e("e", "读取设备序列号异常:" + e.toString());
} }
if (BuildConfig.DEBUG) {
// return "QNG2DKB00463";
}
return serial; return serial;
} }