fix:
update:接口优化,耗电优化
This commit is contained in:
@@ -81,23 +81,23 @@ android {
|
||||
//酷比魔方
|
||||
cube {
|
||||
flavorDimensions "default"
|
||||
versionCode 78
|
||||
versionName "6.3.8"
|
||||
versionCode 79
|
||||
versionName "6.3.9"
|
||||
buildConfigField "String", "platform", '"ZhanRuiCube"'
|
||||
}
|
||||
|
||||
//MTK
|
||||
MTKnewly {
|
||||
flavorDimensions "default"
|
||||
versionCode 52
|
||||
versionName "2.4.2"
|
||||
versionCode 53
|
||||
versionName "2.4.3"
|
||||
buildConfigField "String", "platform", '"MTK"'
|
||||
}
|
||||
|
||||
Huaruian {
|
||||
flavorDimensions "default"
|
||||
versionCode 3
|
||||
versionName "1.0.2"
|
||||
versionCode 6
|
||||
versionName "1.0.5"
|
||||
buildConfigField "String", "platform", '"MTK11"'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,13 +135,15 @@ public class MainAPresenter implements MainAContact.Presenter {
|
||||
|
||||
@Override
|
||||
public void checkTestUpdate() {
|
||||
NetInterfaceManager.getInstance()
|
||||
.checkTestUpdate(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
mView.checkTestUpdateFinish();
|
||||
}
|
||||
});
|
||||
if (!JGYUtils.getInstance().tagEmpty()) {
|
||||
NetInterfaceManager.getInstance()
|
||||
.checkTestUpdate(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
mView.checkTestUpdateFinish();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void checkUpdateInfo() {
|
||||
|
||||
@@ -69,6 +69,8 @@ public class CommonConfig {
|
||||
public final static String AOLE_ACTION_USB_USB_MIDI = "aole_action_usb_usb_midi";
|
||||
|
||||
|
||||
/*是否允许应用安装*/
|
||||
public final static String AOLE_APP_ALLOW_INSTALL = "aole_app_allow_install";
|
||||
/*应用安装白名单*/
|
||||
public final static String AOLE_ACTION_APP_FORBID = "aole_app_forbid";
|
||||
/*强制安装应用,禁止卸载*/
|
||||
|
||||
@@ -75,7 +75,7 @@ public class MapManager {
|
||||
mOption.setIsNeedLocationDescribe(true); // 可选,默认false,设置是否需要位置语义化结果,可以在BDLocation
|
||||
mOption.setIsNeedLocationPoiList(true); // 可选,默认false,设置是否需要POI结果,可以在BDLocation
|
||||
mOption.SetIgnoreCacheException(false); // 可选,默认false,设置是否收集CRASH信息,默认收集
|
||||
mOption.setLocationMode(LocationClientOption.LocationMode.Hight_Accuracy); // 可选,默认高精度,设置定位模式,高精度,低功耗,仅设备,模糊
|
||||
mOption.setLocationMode(LocationClientOption.LocationMode.Battery_Saving); // 可选,默认高精度,设置定位模式,高精度,低功耗,仅设备,模糊
|
||||
mOption.setIsNeedAltitude(false); // 可选,默认false,设置定位时是否需要海拔信息,默认不需要,除基础定位版本都可用
|
||||
// 可选,设置首次定位时选择定位速度优先还是定位准确性优先,默认为速度优先
|
||||
// mOption.setFirstLocType(LocationClientOption.FirstLocType.SPEED_IN_FIRST_LOC);
|
||||
|
||||
@@ -2032,9 +2032,10 @@ public class NetInterfaceManager {
|
||||
if (ConnectManager.getInstance().isNeedConnect(UrlAddress.GET_DEVICES_TAGS, connectMode)) {
|
||||
setPushTags(lifecycle, callback);
|
||||
} else {
|
||||
String cache = cacheHelper.getAsString(UrlAddress.GET_DEVICES_TAGS);
|
||||
String batch = mMMKV.decodeString(CommonConfig.DEVICES_TAG, "");
|
||||
//为 "" 是已经请求成功的
|
||||
if (TextUtils.isEmpty(batch)) {
|
||||
if (cache == null) {
|
||||
setPushTags(lifecycle, callback);
|
||||
} else {
|
||||
Log.e("setPushTags", "tagSets: " + batch);
|
||||
@@ -2053,46 +2054,59 @@ public class NetInterfaceManager {
|
||||
public void setPushTags(BehaviorSubject<ActivityEvent> lifecycle, PushTagCallback callback) {
|
||||
getPushTagsObservable()
|
||||
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<Batch>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("setPushTags", "onSubscribe: ");
|
||||
}
|
||||
.subscribe(getgetPushTagsObserver(callback));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<Batch> response) {
|
||||
if (response.code == OK) {
|
||||
cacheHelper.put(UrlAddress.GET_DEVICES_TAGS, GsonUtils.toJSONString(response.data));
|
||||
String batch = response.data.getBatch();
|
||||
Log.e("setPushTags", "onNext: " + batch);
|
||||
if (TextUtils.isEmpty(batch)) {
|
||||
Log.e("setPushTags", "onNext: " + "batch empty");
|
||||
callback.setPushTag("");
|
||||
} else {
|
||||
callback.setPushTag(batch);
|
||||
mMMKV.encode(CommonConfig.DEVICES_TAG, batch);
|
||||
}
|
||||
} else {
|
||||
cacheHelper.put(UrlAddress.GET_DEVICES_TAGS, "");
|
||||
public void setPushTags() {
|
||||
getPushTagsObservable()
|
||||
.subscribe(getgetPushTagsObserver(null));
|
||||
}
|
||||
|
||||
private Observer<BaseResponse<Batch>> getgetPushTagsObserver(PushTagCallback callback) {
|
||||
return new Observer<BaseResponse<Batch>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("setPushTags", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<Batch> response) {
|
||||
if (response.code == OK) {
|
||||
cacheHelper.put(UrlAddress.GET_DEVICES_TAGS, GsonUtils.toJSONString(response.data));
|
||||
String batch = response.data.getBatch();
|
||||
Log.e("setPushTags", "onNext: " + batch);
|
||||
if (TextUtils.isEmpty(batch)) {
|
||||
Log.e("setPushTags", "onNext: " + "batch empty");
|
||||
if (callback != null)
|
||||
callback.setPushTag("");
|
||||
Log.e("setPushTags", "onNext: " + response.toString());
|
||||
}
|
||||
} else {
|
||||
if (callback != null)
|
||||
callback.setPushTag(batch);
|
||||
mMMKV.encode(CommonConfig.DEVICES_TAG, batch);
|
||||
}
|
||||
} else {
|
||||
cacheHelper.put(UrlAddress.GET_DEVICES_TAGS, "");
|
||||
if (callback != null)
|
||||
callback.setPushTag("");
|
||||
Log.e("setPushTags", "onNext: " + response.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("setPushTags", "onError: " + e.getMessage());
|
||||
String batch = mMMKV.decodeString(CommonConfig.DEVICES_TAG, "");
|
||||
Log.e("setPushTags", "tagSets: " + batch);
|
||||
callback.setPushTag(batch);
|
||||
onComplete();
|
||||
}
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("setPushTags", "onError: " + e.getMessage());
|
||||
String batch = mMMKV.decodeString(CommonConfig.DEVICES_TAG, "");
|
||||
Log.e("setPushTags", "tagSets: " + batch);
|
||||
if (callback != null)
|
||||
callback.setPushTag(batch);
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("setPushTags", "onComplete: ");
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("setPushTags", "onComplete: ");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public void clearAndAppendTags(Set tagSets) {
|
||||
|
||||
@@ -96,6 +96,7 @@ public class NewAppReceiver extends BroadcastReceiver {
|
||||
public void onNext(@NonNull String s) {
|
||||
Log.e(TAG, "sendAppInfo: onNext: " + s);
|
||||
JGYUtils.getInstance().checkForceDownload();
|
||||
JGYUtils.getInstance().updateNetworkWhiteList();
|
||||
NetInterfaceManager.getInstance().getAppLimit();
|
||||
NetInterfaceManager.getInstance().getDefaultDesktop();
|
||||
NetInterfaceManager.getInstance().sendInstalledAppInfo(new NetInterfaceManager.onCompleteCallback() {
|
||||
|
||||
@@ -415,7 +415,7 @@ public class GuardService extends Service {
|
||||
* @param time 和锁屏状态无关,记录设备使用时长的
|
||||
*/
|
||||
private void getLockState(String status, String time) {
|
||||
if (JGYUtils.isOfficialVersion()) {
|
||||
if (JGYUtils.isOfficialVersion() || JGYUtils.getInstance().tagEmpty()) {
|
||||
return;
|
||||
}
|
||||
NetInterfaceManager.getInstance()
|
||||
|
||||
@@ -200,12 +200,14 @@ public class MainSPresenter implements MainSContact.Presenter {
|
||||
if (JGYUtils.isOfficialVersion()) {
|
||||
mView.updateDeviceInfoFinish();
|
||||
}
|
||||
NetInterfaceManager.getInstance().updateDeviceInfo(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
mView.updateDeviceInfoFinish();
|
||||
}
|
||||
});
|
||||
if (!JGYUtils.getInstance().tagEmpty()) {
|
||||
NetInterfaceManager.getInstance().updateDeviceInfo(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
mView.updateDeviceInfoFinish();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -213,12 +215,14 @@ public class MainSPresenter implements MainSContact.Presenter {
|
||||
*/
|
||||
@Override
|
||||
public void sendInstalled() {
|
||||
NetInterfaceManager.getInstance().sendInstalledAppInfo(new NetInterfaceManager.onCompleteCallback() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
mView.sendInstalledFinish();
|
||||
}
|
||||
});
|
||||
if (!JGYUtils.getInstance().tagEmpty()) {
|
||||
NetInterfaceManager.getInstance().sendInstalledAppInfo(new NetInterfaceManager.onCompleteCallback() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
mView.sendInstalledFinish();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -239,13 +243,15 @@ public class MainSPresenter implements MainSContact.Presenter {
|
||||
|
||||
@Override
|
||||
public void checkTestUpdate() {
|
||||
NetInterfaceManager.getInstance()
|
||||
.checkTestUpdate(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
mView.checkTestUpdateFinish();
|
||||
}
|
||||
});
|
||||
if (!JGYUtils.getInstance().tagEmpty()) {
|
||||
NetInterfaceManager.getInstance()
|
||||
.checkTestUpdate(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
mView.checkTestUpdateFinish();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -116,6 +116,7 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
if (!checkAoleyunApp()) {
|
||||
mPresenter.checkAoleyunUpdate();
|
||||
}
|
||||
mPresenter.sendNetwork(JGYUtils.getInstance().getNetworkConnectedTime());
|
||||
mPresenter.getLockedState();
|
||||
}
|
||||
}
|
||||
@@ -328,7 +329,7 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
}
|
||||
switch (action) {
|
||||
case Intent.ACTION_SCREEN_ON:
|
||||
mPresenter.sendNetwork(JGYUtils.getInstance().getNetworkConnectedTime());
|
||||
|
||||
break;
|
||||
case Intent.ACTION_SCREEN_OFF:
|
||||
break;
|
||||
@@ -930,7 +931,6 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
// notificationManager.cancel(NotificationID);
|
||||
SysSettingUtils.setEnableSetting(this);
|
||||
}
|
||||
mPresenter.sendMacAddress();
|
||||
|
||||
//更新主页锁定状态
|
||||
Intent intent = new Intent(MainActivity.UPDATE_LOCKED_STATUS);
|
||||
@@ -943,11 +943,13 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
//没有批次就没有管控
|
||||
Log.e(TAG, "setTagsFinish: " + "not set tag");
|
||||
// mPresenter.getStudesInfo(true);
|
||||
mPresenter.checkAoleyunUpdate();
|
||||
} else {
|
||||
mPresenter.getFirstConnect();
|
||||
mPresenter.getStudesInfo();
|
||||
mPresenter.getDeveloper();
|
||||
mPresenter.sendMacAddress();
|
||||
}
|
||||
mPresenter.getStudesInfo();
|
||||
mPresenter.getDeveloper();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -514,6 +514,7 @@ public class MessageReceiver extends XGPushBaseReceiver {
|
||||
MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE).clearAll();
|
||||
JGYUtils.getInstance().cleanAoleAppCache();
|
||||
JGYUtils.getInstance().wakeUpAoleyunAPP();
|
||||
NetInterfaceManager.getInstance().setPushTags();
|
||||
sendRefreshBroadcast(context);
|
||||
break;
|
||||
case MSG_INSTALL:
|
||||
@@ -765,6 +766,7 @@ public class MessageReceiver extends XGPushBaseReceiver {
|
||||
break;
|
||||
case UPDATE_BATCH:
|
||||
ToastUtil.betaShow("收到管控:更换批次不恢复出厂设置");
|
||||
NetInterfaceManager.getInstance().setPushTags();
|
||||
Aria.download(this).removeAllTask(true);
|
||||
JGYUtils.getInstance().cleanAoleAppCache();
|
||||
try {
|
||||
|
||||
@@ -19,6 +19,7 @@ public class BootManager {
|
||||
public void start() {
|
||||
sendLauncherIcon();
|
||||
timeControlUpdate();
|
||||
JGYUtils.getInstance().updateNetworkWhiteList();
|
||||
JGYUtils.getInstance().onBootSendNetwork();
|
||||
JGYUtils.getInstance().onBootSetAppInsideWeb();
|
||||
}
|
||||
|
||||
@@ -276,6 +276,11 @@ public class JGYUtils {
|
||||
return locked == JGYActions.FRAME_CODE_LOCKED;
|
||||
}
|
||||
|
||||
public boolean tagEmpty() {
|
||||
String tag = mMMKV.decodeString(CommonConfig.DEVICES_TAG, "");
|
||||
return TextUtils.isEmpty(tag);
|
||||
}
|
||||
|
||||
public int getBatteryLevel() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
BatteryManager batteryManager = (BatteryManager) mContext.getSystemService(Context.BATTERY_SERVICE);
|
||||
@@ -579,88 +584,17 @@ public class JGYUtils {
|
||||
synchronized public static void setAppNetwork(Context context, HashSet<String> blackList, HashSet<String> whiteList) {
|
||||
ContentResolver contentResolver = context.getContentResolver();
|
||||
Log.e(TAG, "setAppNetwork: " + "设置应用联网管控" + blackList);
|
||||
// String dis = Settings.System.getString(contentResolver, CommonConfig.AOLE_ACTION_NETWORK_DISALLOW);
|
||||
// String not = Settings.System.getString(contentResolver, CommonConfig.AOLE_ACTION_NETWORK_ALLOW);
|
||||
// //清除旧数据
|
||||
// if (!TextUtils.isEmpty(dis)) {
|
||||
// Log.e(TAG, "setAppNetwork: dis = " + dis);
|
||||
// Settings.System.putString(contentResolver, CommonConfig.AOLE_ACTION_NETWORK_DISALLOW, "Invalid");
|
||||
// }
|
||||
// if (!TextUtils.isEmpty(not)) {
|
||||
// Log.e(TAG, "setAppNetwork: not = " + not);
|
||||
// Settings.System.putString(contentResolver, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, "Invalid");
|
||||
// }
|
||||
|
||||
// String oldBlackList = Settings.System.getString(contentResolver, CommonConfig.AOLE_ACTION_NETWORK_DISALLOW);
|
||||
// HashSet<String> oldBlackListSet = new HashSet<>(Arrays.asList(oldBlackList.split(",")));
|
||||
// oldBlackListSet.removeIf(s -> TextUtils.isEmpty(s.trim()));
|
||||
// //之前禁止上网得列表
|
||||
// Log.e(TAG, "setAppNetwork: oldBlackListSet: " + oldBlackListSet);
|
||||
// if (oldBlackListSet.size() == 0) {
|
||||
// Log.e(TAG, "setAppNetwork: blackList: " + blackList);
|
||||
// for (String pkg : new HashSet<>(blackList)) {
|
||||
// if (TextUtils.isEmpty(pkg)) continue;
|
||||
// //发送没有安装的
|
||||
// if (!ApkUtils.isAvailable(context, pkg)) {
|
||||
// Log.e(TAG, "setAppNetwork: skip: " + pkg);
|
||||
// blackList.remove(pkg);
|
||||
// continue;
|
||||
// } else {
|
||||
// Log.e(TAG, "setAppNetwork: " + pkg + " 已安装");
|
||||
// }
|
||||
// Intent netControlNotIntent = new Intent(CommonConfig.AOLE_ACTION_NETWORK_DISALLOW);
|
||||
// netControlNotIntent.putExtra("package_name", pkg);
|
||||
// netControlNotIntent.setPackage("com.android.settings");
|
||||
// context.sendBroadcast(netControlNotIntent);
|
||||
// }
|
||||
// } else {
|
||||
// //减少的
|
||||
// Set<String> removedNet = oldBlackListSet;
|
||||
// //增加的
|
||||
// Set<String> addedNet = new HashSet<>();
|
||||
// for (String pkg : blackList) {
|
||||
// if (TextUtils.isEmpty(pkg)) continue;
|
||||
// if (removedNet.contains(pkg)) {
|
||||
// removedNet.remove(pkg);
|
||||
// } else {
|
||||
// addedNet.add(pkg);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// Log.e(TAG, "setAppNetwork: removedNet: " + removedNet);
|
||||
// Log.e(TAG, "setAppNetwork: addedNet: " + addedNet);
|
||||
// for (String pkg : removedNet) {
|
||||
// if (TextUtils.isEmpty(pkg)) continue;
|
||||
// Settings.System.putString(contentResolver, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, pkg);
|
||||
// Intent netControlNotIntent = new Intent(CommonConfig.AOLE_ACTION_NETWORK_ALLOW);
|
||||
// netControlNotIntent.putExtra("package_name", pkg);
|
||||
// netControlNotIntent.setPackage("com.android.settings");
|
||||
// context.sendBroadcast(netControlNotIntent);
|
||||
// }
|
||||
// for (String pkg : addedNet) {
|
||||
// if (TextUtils.isEmpty(pkg)) continue;
|
||||
// if (!ApkUtils.isAvailable(context, pkg)) {
|
||||
// Log.e(TAG, "setAppNetwork: skip: " + pkg);
|
||||
// blackList.remove(pkg);
|
||||
// continue;
|
||||
// } else {
|
||||
// Log.e(TAG, "setAppNetwork: " + pkg + " 已安装");
|
||||
// }
|
||||
// Intent netControlNotIntent = new Intent(CommonConfig.AOLE_ACTION_NETWORK_DISALLOW);
|
||||
// netControlNotIntent.putExtra("package_name", pkg);
|
||||
// netControlNotIntent.setPackage("com.android.settings");
|
||||
// context.sendBroadcast(netControlNotIntent);
|
||||
// }
|
||||
// }
|
||||
|
||||
if (blackList == null || blackList.size() == 0) {
|
||||
SPUtils.put(context, CommonConfig.AOLE_ACTION_NETWORK_DISALLOW, "");
|
||||
Settings.System.putString(contentResolver, CommonConfig.AOLE_ACTION_NETWORK_DISALLOW, "");
|
||||
} else {
|
||||
String net_not = String.join(",", blackList);
|
||||
SPUtils.put(context, CommonConfig.AOLE_ACTION_NETWORK_DISALLOW, net_not);
|
||||
Settings.System.putString(contentResolver, CommonConfig.AOLE_ACTION_NETWORK_DISALLOW, net_not);
|
||||
Log.e(TAG, "setAppNetwork: " + net_not);
|
||||
if (!MTK11Tag.equals(JGYUtils.getInstance().getAppPlatform())) {
|
||||
if (blackList == null || blackList.size() == 0) {
|
||||
SPUtils.put(context, CommonConfig.AOLE_ACTION_NETWORK_DISALLOW, "");
|
||||
Settings.System.putString(contentResolver, CommonConfig.AOLE_ACTION_NETWORK_DISALLOW, "");
|
||||
} else {
|
||||
String net_not = String.join(",", blackList);
|
||||
SPUtils.put(context, CommonConfig.AOLE_ACTION_NETWORK_DISALLOW, net_not);
|
||||
Settings.System.putString(contentResolver, CommonConfig.AOLE_ACTION_NETWORK_DISALLOW, net_not);
|
||||
Log.e(TAG, "setAppNetwork: " + net_not);
|
||||
}
|
||||
}
|
||||
|
||||
if (whiteList == null || whiteList.size() == 0) {
|
||||
@@ -669,9 +603,16 @@ public class JGYUtils {
|
||||
} else {
|
||||
String net_not = String.join(",", whiteList);
|
||||
SPUtils.put(context, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, net_not);
|
||||
Settings.System.putString(contentResolver, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, net_not);
|
||||
Log.e(TAG, "setAppNetwork: " + net_not);
|
||||
Log.e(TAG, "setAppNetwork: net_not = " + net_not);
|
||||
List<String> filterList = whiteList.stream().filter(s -> !ApkUtils.isAvailable(context, s)).collect(Collectors.toList());
|
||||
if (filterList.size() == 0) {
|
||||
Settings.System.putString(contentResolver, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, "");
|
||||
} else {
|
||||
Settings.System.putString(contentResolver, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, String.join(",", filterList));
|
||||
}
|
||||
Log.e(TAG, "setAppNetwork: filterList = " + filterList);
|
||||
}
|
||||
|
||||
//Intent netControlIntent = new Intent(CommonDatas.ACTION_HrReceiver_JGY_DIS);
|
||||
//netControlIntent.putExtra("package_name", net_not);
|
||||
//sendBroadcast(netControlIntent);
|
||||
@@ -681,27 +622,45 @@ public class JGYUtils {
|
||||
//sendBroadcast(netControlNotIntent);
|
||||
}
|
||||
|
||||
public void updateNetworkWhiteList() {
|
||||
String whiteString = (String) SPUtils.get(mContext, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, "");
|
||||
if (TextUtils.isEmpty(whiteString)) {
|
||||
Log.e(TAG, "updateNetworkWhiteList: allow content is empty");
|
||||
return;
|
||||
}
|
||||
List<String> whiteList = new ArrayList<>(Arrays.asList(whiteString.split(",")));
|
||||
List<String> filterList = whiteList.stream().filter(s -> !ApkUtils.isAvailable(mContext, s)).collect(Collectors.toList());
|
||||
if (filterList.size() == 0) {
|
||||
Settings.System.putString(crv, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, "");
|
||||
} else {
|
||||
Settings.System.putString(crv, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, String.join(",", filterList));
|
||||
}
|
||||
Log.e(TAG, "updateNetworkWhiteList: " + filterList);
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
synchronized public void onBootSendNetwork() {
|
||||
String oldBlackListString = (String) SPUtils.get(mContext, CommonConfig.AOLE_ACTION_NETWORK_DISALLOW, "");
|
||||
HashSet<String> oldBlackListSet = new HashSet<>(Arrays.asList(oldBlackListString.split(",")));
|
||||
Log.e(TAG, "setAppNetwork: oldBlackListSet: " + oldBlackListSet);
|
||||
oldBlackListSet.removeIf(new Predicate<String>() {
|
||||
@Override
|
||||
public boolean test(String s) {
|
||||
return TextUtils.isEmpty(s.trim());
|
||||
if (!MTK11Tag.equals(JGYUtils.getInstance().getAppPlatform())) {
|
||||
String oldBlackListString = (String) SPUtils.get(mContext, CommonConfig.AOLE_ACTION_NETWORK_DISALLOW, "");
|
||||
HashSet<String> oldBlackListSet = new HashSet<>(Arrays.asList(oldBlackListString.split(",")));
|
||||
Log.e(TAG, "setAppNetwork: oldBlackListSet: " + oldBlackListSet);
|
||||
oldBlackListSet.removeIf(new Predicate<String>() {
|
||||
@Override
|
||||
public boolean test(String s) {
|
||||
return TextUtils.isEmpty(s.trim());
|
||||
}
|
||||
});
|
||||
for (String pkg : oldBlackListSet) {
|
||||
if (TextUtils.isEmpty(pkg)) continue;
|
||||
if (!ApkUtils.isAvailable(mContext, pkg)) {
|
||||
Log.e(TAG, "setAppNetwork: skip: " + pkg);
|
||||
continue;
|
||||
}
|
||||
Intent netControlNotIntent = new Intent(CommonConfig.AOLE_ACTION_NETWORK_DISALLOW);
|
||||
netControlNotIntent.putExtra("package_name", pkg);
|
||||
netControlNotIntent.setPackage("com.android.settings");
|
||||
mContext.sendBroadcast(netControlNotIntent);
|
||||
}
|
||||
});
|
||||
for (String pkg : oldBlackListSet) {
|
||||
if (TextUtils.isEmpty(pkg)) continue;
|
||||
if (!ApkUtils.isAvailable(mContext, pkg)) {
|
||||
Log.e(TAG, "setAppNetwork: skip: " + pkg);
|
||||
continue;
|
||||
}
|
||||
Intent netControlNotIntent = new Intent(CommonConfig.AOLE_ACTION_NETWORK_DISALLOW);
|
||||
netControlNotIntent.putExtra("package_name", pkg);
|
||||
netControlNotIntent.setPackage("com.android.settings");
|
||||
mContext.sendBroadcast(netControlNotIntent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -806,7 +806,7 @@ public class Utils {
|
||||
Log.e("getSerial", "读取设备序列号异常:" + e.toString());
|
||||
}
|
||||
if (BuildConfig.DEBUG) {
|
||||
return "LTPKD22110000051";
|
||||
// return "LTPKD22110000051";
|
||||
// serial = "012345679ABCDEF";
|
||||
}
|
||||
if (NOSN.equalsIgnoreCase(serial)) {
|
||||
|
||||
Reference in New Issue
Block a user