version:4.2

fix:修复不能自动下载强制应用,锁定状态显示问题,增加打开主页判断是否在请求
update:
This commit is contained in:
2022-04-15 11:40:02 +08:00
parent 0a75344b61
commit 2339e1484d
20 changed files with 369 additions and 374 deletions

View File

@@ -61,8 +61,8 @@ android {
//新平台正式
cube {
flavorDimensions "default"
versionCode 31
versionName "4.0"
versionCode 33
versionName "4.2"
/*********************************极光推送************************************/
manifestPlaceholders = [
XG_ACCESS_ID : "1500026372",

View File

@@ -9,7 +9,6 @@ import com.aoleyun.sn.R;
import com.aoleyun.sn.base.BaseActivity;
import com.aoleyun.sn.comm.CommonConfig;
import com.aoleyun.sn.utils.JGYUtils;
import com.aoleyun.sn.utils.SaveListUtils;
import com.aoleyun.sn.utils.SysSettingUtils;
import com.aoleyun.sn.utils.ToastUtil;
import com.aoleyun.sn.utils.Utils;
@@ -213,7 +212,6 @@ public class CheckNetActivity extends BaseActivity implements CheckNetContact.Ma
//发送设备mac地址和信息
mCheckNetPresenter.sendMACAddress();
if (loocked) {
SaveListUtils.getList();
//获取系统管控
mCheckNetPresenter.setPushTags();
} else {

View File

@@ -399,14 +399,14 @@ public class CheckNetPresenter implements CheckNetContact.Presenter {
@Override
public void getDefaultDesktop() {
if (JGYUtils.isOfficialVersion()) {
mView.getDefaultDesktopFinish();
if (JGYUtils.isOfficialVersion() || JGYUtils.getInstance().getDeviceIsLocked()) {
mNetInterfaceManager.getAppLimit(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
@Override
public void onComplete() {
}
});
mView.getDefaultDesktopFinish();
} else {
mNetInterfaceManager.getDefaultDesktop(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
@Override

View File

@@ -66,9 +66,16 @@ public class MainAPresenter implements MainAContact.Presenter {
@Override
public void getLockedState() {
int locked = Settings.System.getInt(mContext.getContentResolver(), JGYActions.ACTION_QCH_UNLOCK_IPAD, JGYActions.FRAME_CODE_LOCKED);
Log.e("getLockedState", "locked: " + locked);
mView.setLockedState(locked == JGYActions.FRAME_CODE_LOCKED);
NetInterfaceManager.getInstance()
.getLockedState(getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
@Override
public void onComplete() {
Log.e("getLockedState", "onComplete: ");
int locked = Settings.System.getInt(mContext.getContentResolver(), JGYActions.ACTION_QCH_UNLOCK_IPAD, JGYActions.FRAME_CODE_LOCKED);
Log.e("getLockedState", "locked: " + locked);
mView.setLockedState(locked == JGYActions.FRAME_CODE_LOCKED);
}
});
}
/**

View File

@@ -3,11 +3,14 @@ package com.aoleyun.sn.activity.main;
import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.ServiceConnection;
import android.graphics.Bitmap;
import android.os.IBinder;
import android.os.SystemClock;
import android.provider.Settings;
import android.text.TextUtils;
@@ -30,7 +33,6 @@ import com.aoleyun.sn.comm.JGYActions;
import com.aoleyun.sn.service.main.MainService;
import com.aoleyun.sn.utils.JGYUtils;
import com.aoleyun.sn.utils.SPUtils;
import com.aoleyun.sn.utils.SaveListUtils;
import com.aoleyun.sn.utils.SysSettingUtils;
import com.aoleyun.sn.utils.ToastUtil;
import com.aoleyun.sn.utils.Utils;
@@ -124,7 +126,6 @@ public class MainActivity extends BaseActivity implements MainAContact.MainView,
}
private MainAPresenter mMainAPresenter;
private MMKV mMMKV = MMKV.defaultMMKV();
private boolean updateApp = false;
@@ -151,6 +152,7 @@ public class MainActivity extends BaseActivity implements MainAContact.MainView,
mMainAPresenter.attachView(this);
mMainAPresenter.setLifecycle(lifecycleSubject);
NetworkUtils.registerNetworkStatusChangedListener(this);
registerUpdateReceiver();
JGYUtils.startServices(MainActivity.this);
getDevicesInfo();
setStoreUpdateListener(bt_checkupdate);
@@ -250,11 +252,29 @@ public class MainActivity extends BaseActivity implements MainAContact.MainView,
@Override
public void initData() {
Log.e("getMacAddress", Utils.getAndroid10MAC(this));
startService(new Intent(MainActivity.this, MainService.class));
// registerUpdateReceiver();
Intent intent = new Intent(MainActivity.this, MainService.class);
bindService(intent, serviceConnect, BIND_AUTO_CREATE);
startService(intent);
mMainAPresenter.getLockedState();
}
MainService.MainBinder mMainBinder;
ServiceConnect serviceConnect = new ServiceConnect();
private class ServiceConnect implements ServiceConnection {
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
Log.e(TAG, "onServiceConnected: ");
mMainBinder = (MainService.MainBinder) service;
mMainBinder.getService().getLockedState();
}
@Override
public void onServiceDisconnected(ComponentName name) {
Log.e(TAG, "onServiceDisconnected: ");
}
}
/**
* @param loocked 后台1是锁定底层0是锁定
*/
@@ -264,7 +284,6 @@ public class MainActivity extends BaseActivity implements MainAContact.MainView,
if (loocked) {
iv_locked.setVisibility(View.VISIBLE);
iv_locked.setImageDrawable(getDrawable(R.drawable.locked));
SaveListUtils.getList();
mMainAPresenter.getStudesInfo(false);
} else {
iv_locked.setVisibility(View.VISIBLE);
@@ -411,12 +430,12 @@ public class MainActivity extends BaseActivity implements MainAContact.MainView,
@Override
protected void onDestroy() {
super.onDestroy();
JGYUtils.startServices(MainActivity.this);
NetworkUtils.unregisterNetworkStatusChangedListener(this);
mMainAPresenter.detachView();
if (mUpdateReceiver != null) {
unregisterReceiver(mUpdateReceiver);
}
JGYUtils.startServices(MainActivity.this);
NetworkUtils.unregisterNetworkStatusChangedListener(this);
mMainAPresenter.detachView();
}
@Override
@@ -444,9 +463,10 @@ public class MainActivity extends BaseActivity implements MainAContact.MainView,
private void registerUpdateReceiver() {
if (mUpdateReceiver == null) {
mUpdateReceiver = new UpdateReceiver();
IntentFilter filter = new IntentFilter();
filter.addAction(UPDATE_LOCKED_STATUS);
}
IntentFilter filter = new IntentFilter();
filter.addAction(UPDATE_LOCKED_STATUS);
registerReceiver(mUpdateReceiver, filter);
}
class UpdateReceiver extends BroadcastReceiver {
@@ -457,7 +477,6 @@ public class MainActivity extends BaseActivity implements MainAContact.MainView,
if (locked == JGYActions.FRAME_CODE_LOCKED) {
iv_locked.setVisibility(View.VISIBLE);
iv_locked.setImageDrawable(getDrawable(R.drawable.locked));
SaveListUtils.getList();
} else {
iv_locked.setVisibility(View.VISIBLE);
iv_locked.setImageDrawable(getDrawable(R.drawable.unlock));

View File

@@ -551,24 +551,4 @@ public class BaseApplication extends MultiDexApplication {
}
}
boolean isForecDownload = false;
public boolean isDownloading() {
return isForecDownload;
}
public void setDownloadState(boolean state) {
isForecDownload = state;
}
public void checkIsDownloading() {
List<DownloadEntity> list = Aria.download(this).getDRunningTask();
if (list == null || list.size() == 0) {
BaseApplication.getInstance().setDownloadState(false);
} else {
BaseApplication.getInstance().setDownloadState(true);
}
Log.e(TAG, "isDownloading=" + BaseApplication.getInstance().isDownloading());
}
}

View File

@@ -7,6 +7,7 @@ import android.os.Environment;
import android.util.Log;
import com.jakewharton.disklrucache.DiskLruCache;
import com.tencent.mmkv.BuildConfig;
import com.tencent.mmkv.MMKV;
import org.json.JSONArray;
@@ -151,6 +152,9 @@ public class CacheHelper {
while ((len = inputStream.read(buf)) != -1) {
sb.append(new String(buf, 0, len));
}
if (BuildConfig.DEBUG) {
Log.e(TAG, "getAsString: " + sb.toString());
}
return sb.toString();

View File

@@ -0,0 +1,45 @@
package com.aoleyun.sn.gson;
import com.google.gson.Gson;
import com.google.gson.TypeAdapter;
import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;
public class NullStringToEmptyAdapterFactory<T> implements TypeAdapterFactory {
@Override
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
Class<T> rawType = (Class<T>) type.getRawType();
if (rawType != String.class) {
return null;
}
return (TypeAdapter<T>) new StringAdapter();
}
public static class StringAdapter extends TypeAdapter<String> {
@Override
public String read(JsonReader reader) throws IOException {
if (reader.peek() == JsonToken.NULL) {
reader.nextNull();
return "";
}
return reader.nextString();
}
@Override
public void write(JsonWriter writer, String value) throws IOException {
if (value == null) {
writer.nullValue();
return;
}
writer.value(value);
}
}
}

View File

@@ -42,6 +42,7 @@ import com.aoleyun.sn.comm.CommonConfig;
import com.aoleyun.sn.comm.JGYActions;
import com.aoleyun.sn.comm.PackageNames;
import com.aoleyun.sn.disklrucache.CacheHelper;
import com.aoleyun.sn.gson.NullStringToEmptyAdapterFactory;
import com.aoleyun.sn.manager.ConnectManager;
import com.aoleyun.sn.manager.ConnectMode;
import com.aoleyun.sn.network.api.get.CheckTestUpdateApi;
@@ -102,6 +103,7 @@ import com.aoleyun.sn.utils.Utils;
import com.aoleyun.sn.utils.WiFiUtils;
import com.arialyy.aria.core.Aria;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.reflect.TypeToken;
@@ -727,7 +729,9 @@ public class NetInterfaceManager {
Type listType = new TypeToken<List<ForceDownloadData>>() {
}.getType();
List<ForceDownloadData> APPlist = gson.fromJson(jsonString, listType);
JGYUtils.getInstance().installTestAPK(APPlist);
if (APPlist != null) {
JGYUtils.getInstance().installTestAPK(APPlist);
}
callback.onComplete();
}
}
@@ -769,7 +773,6 @@ public class NetInterfaceManager {
});
}
public void getForceDownload(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
ConnectMode connectMode = ConnectMode.ONE_HOUR;
if (refresh) {
@@ -786,8 +789,10 @@ public class NetInterfaceManager {
Gson gson = new Gson();
Type listType = new TypeToken<List<ForceDownloadData>>() {
}.getType();
List<ForceDownloadData> APPlist = gson.fromJson(jsonString, listType);
JGYUtils.getInstance().installTestAPK(APPlist);
List<ForceDownloadData> forceDownloadDataList = gson.fromJson(jsonString, listType);
if (forceDownloadDataList != null) {
JGYUtils.getInstance().forceDownload(forceDownloadDataList);
}
callback.onComplete();
}
}
@@ -818,18 +823,13 @@ public class NetInterfaceManager {
@Override
public void onNext(@NonNull BaseResponse<List<ForceDownloadData>> forceDownloadBean) {
Log.e("getForceDownload", "onNext: ");
Log.e("getForceDownload", "onNext: " + forceDownloadBean);
if (forceDownloadBean.code == OK) {
cacheHelper.getAsString(UrlAddress.GET_FORCE_INSTALL_LIST);
Log.e("getForceDownload", "isDownloading =" + BaseApplication.getInstance().isDownloading());
List<ForceDownloadData> forceDownloadData = forceDownloadBean.data;
cacheHelper.put(UrlAddress.GET_FORCE_INSTALL_LIST, GsonUtils.toJsonString(forceDownloadData));
BaseApplication.getInstance().checkIsDownloading();
if (!BaseApplication.getInstance().isDownloading()) {
JGYUtils.getInstance().forceDownload(forceDownloadData);
} else {
Aria.download(this).resumeAllTask();
}
Aria.download(this).resumeAllTask();
JGYUtils.getInstance().forceDownload(forceDownloadData);
} else if (forceDownloadBean.code == -200) {
cacheHelper.put(UrlAddress.GET_FORCE_INSTALL_LIST, "");
boolean qch_force_app = Settings.System.putString(mContext.getContentResolver(), "qch_force_app", "invalid");
@@ -1143,19 +1143,21 @@ public class NetInterfaceManager {
}.getType();
List<String> list = gson.fromJson(jsonString, type);
PackageManager pm = mContext.getPackageManager();
for (String pack : list) {
try {
// TODO: 2021/5/24 需要后端替换包名,暂时解决方案
if ("com.mediatek.camera".equals(pack)) {
pm.setApplicationEnabledSetting("com.android.camera2", PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);
if (list != null) {
for (String pack : list) {
try {
// TODO: 2021/5/24 需要后端替换包名,暂时解决方案
if ("com.mediatek.camera".equals(pack)) {
pm.setApplicationEnabledSetting("com.android.camera2", PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);
}
if ("com.android.mms".equals(pack)) {
pm.setApplicationEnabledSetting("com.android.messaging", PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);
}
pm.setApplicationEnabledSetting(pack, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);
Log.e("getDesktopIcon", pack);
} catch (Exception e) {
Log.e("getDesktopIcon", "Exception: " + e.getMessage());
}
if ("com.android.mms".equals(pack)) {
pm.setApplicationEnabledSetting("com.android.messaging", PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);
}
pm.setApplicationEnabledSetting(pack, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);
Log.e("getDesktopIcon", pack);
} catch (Exception e) {
Log.e("getDesktopIcon", "Exception: " + e.getMessage());
}
}
callback.onComplete();
@@ -1255,7 +1257,9 @@ public class NetInterfaceManager {
Type type = new TypeToken<NetAndLaunchBean>() {
}.getType();
NetAndLaunchBean netAndLaunchBean = gson.fromJson(jsonString, type);
JGYUtils.getInstance().setNetAndlaunch(netAndLaunchBean);
if (netAndLaunchBean != null) {
JGYUtils.getInstance().setNetAndlaunch(netAndLaunchBean);
}
callback.onComplete();
}
}
@@ -1657,6 +1661,13 @@ public class NetInterfaceManager {
});
}
/**
* 获取设备锁定状态
* 不需要缓存
* @param lifecycle
* @param callback
*/
public void getLockedState(BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
getDevicesLockedStateObservable()
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
@@ -2286,8 +2297,8 @@ public class NetInterfaceManager {
}
public void getScreenLockState(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, ScreenLockStateListener listener) {
int locked = Settings.System.getInt(mContext.getContentResolver(), JGYActions.ACTION_QCH_UNLOCK_IPAD, 0);
if (JGYUtils.isOfficialVersion() || locked == 1) {
int locked = Settings.System.getInt(mContext.getContentResolver(), JGYActions.ACTION_QCH_UNLOCK_IPAD, JGYActions.FRAME_CODE_LOCKED);
if (JGYUtils.isOfficialVersion() || locked == JGYActions.FRAME_CODE_UNLOCKED) {
listener.setScreenLockState(false, "");
return;
}
@@ -2302,7 +2313,7 @@ public class NetInterfaceManager {
if (jsonString == null) {
getScreenLock(lifecycle, listener);
} else {
Gson gson = new Gson();
Gson gson = new GsonBuilder().registerTypeAdapterFactory(new NullStringToEmptyAdapterFactory()).create();
Type Type = new TypeToken<ScreenLockState>() {
}.getType();
ScreenLockState screenLockState = gson.fromJson(jsonString, Type);
@@ -2513,10 +2524,10 @@ public class NetInterfaceManager {
if (refresh) {
connectMode = ConnectMode.ONE_HOUR;
}
if (ConnectManager.getInstance().isNeedConnect(UrlAddress.GET_LOCK_SCREEN_STATE, connectMode)) {
if (ConnectManager.getInstance().isNeedConnect(UrlAddress.GET_SN_TIME_CONTROL, connectMode)) {
getSnTimeControl(lifecycle, callback);
} else {
String jsonString = cacheHelper.getAsString(UrlAddress.GET_LOCK_SCREEN_STATE);
String jsonString = cacheHelper.getAsString(UrlAddress.GET_SN_TIME_CONTROL);
if (jsonString == null) {
getSnTimeControl(lifecycle, callback);
} else {

View File

@@ -4,78 +4,110 @@ package com.aoleyun.sn.network;
* @author Administrator
*/
public class UrlAddress {
/*app下载完成发送下载次数*/
public static final String SEND_DOWNLOAD_FILE_INFO = "app/downloadApp";
/*获取系统默认程序*/
public static final String GET_DEFAULT_APP = "app/getDefaultApp";
/*下载接口 根据包名匹配 请求后更新下载次数*/
public static final String SEND_DOWNLOAD_TIMES = "count/index";
/*获取设备锁定状态*/
public static final String GET_DEVICES_LOCKED = "lock/index";
/*获取批次*/
public static final String GET_BATCH = "log/getBatch";
/*上传锁屏状态*/
public static final String GET_LOCK_STATE = "Application/getLockState";
/*APPID管控*/
public static final String GET_APPID = "application/index";
/*获取系统设置*/
public static final String GET_FIRMWARE = "firmware/get";
/*上传安装的应用信息*/
public static final String UPLOAD_APPINFO = "log/index";
/*发送设备信息*/
public static final String SEND_DEVICES = "Mac/getMac";
/*发送app使用情况*/
public static final String GET_APP_LOG = "Applog/getAppLog";
/**
* 应用策略相关
*/
/*更新接口*/
public static final String CHECK_UPDATE = "Silent/silent";
/*获取设备标签*/
public static final String GET_DEVICES_TAGS = "Sn/getSnTag";
/*浏览器书签主页设置*/
public static final String SET_HOMEPAG_TAG = "Label";
/*浏览器黑白名单地址*/
public static final String SET_BROWSER_LIST = "browser";
/*app内部网页管控*/
public static final String SET_APPINSIDEWEB = "Appground";
/*强制安装应用*/
public static final String GET_FORCE_INSTALL_LIST = "forceinstall/index";
/*应用白名单*/
public static final String SET_WHITE_PACKAGE_LIST = "firmware/index";
/*获取隐藏桌面图标*/
public static final String GET_HIDE_DESKTOPICON = "Icon";
/*获取应用升级自启*/
public static final String NET_AND_LAUNCH_API = "automatic/get";
/*通过sn获取信息*/
public static final String GET_STUDENTS_INFO = "Sn/getStudent";
/*上传截图*/
public static final String SEND_SCREENSHOT = "Screenshot/addImg";
/*上传我的设备*/
public static final String UPDATE_DEVICEINFO = "Mac/getInfo";
/*获取霸屏状态*/
public static final String GET_LOCK_SCREEN_STATE = "Sn/getSnScreen";
/*获取默认桌面升级*/
public static final String GET_DESKTOP = "Sn/getSnDesktop";
/*获取时间管控*/
public static final String GET_SN_TIME_CONTROL = "Sn/getSnTimeControl";
/*获取顶部app管控*/
public static final String GET_TOP_APP_CONTROL = "Sn/getSnAppControl";
/*获取测试app*/
public static final String GET_SN_APP_TEST = "Sn/getSnAppTest";
/*开机动画*/
public static final String GET_LOGO_IMG = "Sn/getLogoImg";
/*开发人员选项开关*/
public static final String GET_DEVELOPER = "Sn/getDeveloper";
/*通过固件名获取内置应用*/
public static final String GET_ROM_APP = "And/getFirmwareApp";
/*应用白名单*/
public static final String SET_WHITE_PACKAGE_LIST = "firmware/index";
/*获取全部应用*/
public static final String GET_ALL_APP = "recommend/index";
/*强制安装应用*/
public static final String GET_FORCE_INSTALL_LIST = "forceinstall/index";
/*通过固件名获取内置应用*/
public static final String GET_ROM_APP = "And/getFirmwareApp";
/*获取应用升级自启*/
public static final String NET_AND_LAUNCH_API = "automatic/get";
/*获取顶部app管控*/
public static final String GET_TOP_APP_CONTROL = "Sn/getSnAppControl";
/*APPID管控*/
public static final String GET_APPID = "application/index";
/*app内部网页管控*/
public static final String SET_APPINSIDEWEB = "Appground";
/*app下载完成发送下载次数*/
@Deprecated
public static final String SEND_DOWNLOAD_FILE_INFO = "app/downloadApp";
/*下载接口 根据包名匹配 请求后更新下载次数*/
public static final String SEND_DOWNLOAD_TIMES = "count/index";
/**
* 设备相关
*/
/*获取设备锁定状态*/
public static final String GET_DEVICES_LOCKED = "lock/index";
/*获取设备标签*/
public static final String GET_DEVICES_TAGS = "Sn/getSnTag";
/*获取批次*/
public static final String GET_BATCH = "log/getBatch";
/*上传安装的应用信息*/
public static final String UPLOAD_APPINFO = "log/index";
/*通过sn获取信息*/
public static final String GET_STUDENTS_INFO = "Sn/getStudent";
/*发送设备信息*/
public static final String SEND_DEVICES = "Mac/getMac";
/*上传我的设备*/
public static final String UPDATE_DEVICEINFO = "Mac/getInfo";
/*发送app使用情况*/
public static final String GET_APP_LOG = "Applog/getAppLog";
/*获取电子书包激活码*/
public static final String GET_EBAG_CODE = "And/getEbagCode";
/*恢复出厂设置次数*/
public static final String SEND_RESTORE_TIMES = "And/restore";
/*获取远程关机时间*/
public static final String GET_POWEROFF_TIME = "And/getTimedShutdown";
/*上传截图*/
public static final String SEND_SCREENSHOT = "Screenshot/addImg";
/*上传锁屏状态*/
public static final String GET_LOCK_STATE = "Application/getLockState";
/*获取霸屏状态*/
public static final String GET_LOCK_SCREEN_STATE = "Sn/getSnScreen";
/**
* 系统策略相关
*/
/*获取隐藏桌面图标*/
public static final String GET_HIDE_DESKTOPICON = "Icon";
/*获取系统设置*/
public static final String GET_FIRMWARE = "firmware/get";
/*获取时间管控*/
public static final String GET_SN_TIME_CONTROL = "Sn/getSnTimeControl";
/*获取WiFi名和密码*/
public static final String GET_WIFI_ALIAS_PW = "And/SnControl/getWifi";
/*获取远程关机时间*/
public static final String GET_POWEROFF_TIME = "And/getTimedShutdown";
/**
* 浏览器策略
*/
/*浏览器书签主页设置*/
public static final String SET_HOMEPAG_TAG = "Label";
/*浏览器黑白名单地址*/
public static final String SET_BROWSER_LIST = "browser";
/**
* 系统定制
*/
/*开机动画*/
public static final String GET_LOGO_IMG = "Sn/getLogoImg";
/*获取默认桌面升级*/
public static final String GET_DESKTOP = "Sn/getSnDesktop";
/*获取系统默认程序*/
public static final String GET_DEFAULT_APP = "app/getDefaultApp";
/**
* 开发人员调试
*/
/*开发人员选项开关*/
public static final String GET_DEVELOPER = "Sn/getDeveloper";
/*获取log任务*/
public static final String GET_LOG_ORDER = "And/getSnRunLog";
/*上传log文件*/
@@ -86,13 +118,10 @@ public class UrlAddress {
/*获取公网IP*/
public static final String SHOUHU_CITYJSON = "http://pv.sohu.com/cityjson/";
/*删除alias*/
public static final String DELETE_JPUSH_ALIAS = "https://device.jpush.cn/v3/aliases/";
/*删除tags*/
public static final String DELETE_JPUSH_TAG = "https://device.jpush.cn/v3/tags/";
@Deprecated
/*删除Aliases*/
public static final String DELETE_GEDEVICE_ALIAS = "Sn/deleteAliases";
}

View File

@@ -8,6 +8,7 @@ import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.POST;
@Deprecated
public interface SendDownloadInfoApi {
@FormUrlEncoded
@POST(UrlAddress.SEND_DOWNLOAD_FILE_INFO)

View File

@@ -13,10 +13,8 @@ import com.aoleyun.sn.bean.BaseResponse;
import com.aoleyun.sn.comm.PackageNames;
import com.aoleyun.sn.network.NetInterfaceManager;
import com.aoleyun.sn.utils.ApkUtils;
import com.aoleyun.sn.utils.CacheUtils;
import com.aoleyun.sn.utils.JGYUtils;
import com.aoleyun.sn.utils.SPUtils;
import com.aoleyun.sn.utils.SaveListUtils;
import java.util.concurrent.TimeUnit;
@@ -65,12 +63,14 @@ public class NewAppReceiver extends BroadcastReceiver {
break;
}
Log.e(TAG, "sendAppInfo: " + state + packageName);
JGYUtils.getInstance().checkForceDownload();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
if (!PackageNames.APPSTORE.equals(packageName) || !PackageNames.DEVICE_INFO.equals(packageName)) {
ApkUtils.addShortcut(context);
ApkUtils.RemoveTask(context, packageName);
}
JGYUtils.getInstance().wakeUpAppstore();
//启动教官壹
}
newAppListener.setNewAppListener(packageName);
@@ -95,7 +95,6 @@ public class NewAppReceiver extends BroadcastReceiver {
@Override
public void onNext(@NonNull String s) {
Log.e(TAG, "sendAppInfo: onNext: " + s);
SaveListUtils.getDownLoadList().remove(s);
NetInterfaceManager.getInstance().sendInstalledAppInfo(new NetInterfaceManager.onCompleteCallback() {
@Override
public void onComplete() {

View File

@@ -491,11 +491,6 @@ public class GuardService extends Service {
Log.e(TAG, "taskComplete: " + filepath);
} else if (filepath.endsWith(".apk")) {
new Thread(() -> ApkUtils.installApp(GuardService.this, filepath)).start();
List<DownloadEntity> list = Aria.download(this).getDRunningTask();
if (list == null || list.size() == 0) {
BaseApplication.getInstance().setDownloadState(false);
Log.e("taskComplete", "isDownloading=" + BaseApplication.getInstance().isDownloading());
}
}
NetInterfaceManager.getInstance()
.getSendTimesApi()
@@ -525,32 +520,32 @@ public class GuardService extends Service {
});
int userId = (int) SPUtils.get(GuardService.this, CommonConfig.ADMIN_ID, 0);
long appSize = task.getFileSize();
NetInterfaceManager.getInstance()
.getSendInfoApi()
.sendDownloadTimes(NetInterfaceManager.HTTP_KEY, Utils.getSerial(), userId, app_package, appSize)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<BaseResponse>() {
@Override
public void onSubscribe(Disposable d) {
Log.e("SEND_DOWNLOAD_FILE_INFO", "onSubscribe: ");
}
@Override
public void onNext(BaseResponse baseResponse) {
Log.e("SEND_DOWNLOAD_FILE_INFO", "onNext: " + baseResponse.msg);
}
@Override
public void onError(Throwable e) {
Log.e("SEND_DOWNLOAD_FILE_INFO", "onError: " + e.getMessage());
}
@Override
public void onComplete() {
Log.e("SEND_DOWNLOAD_FILE_INFO", "onComplete: ");
}
});
// NetInterfaceManager.getInstance()
// .getSendInfoApi()
// .sendDownloadTimes(NetInterfaceManager.HTTP_KEY, Utils.getSerial(), userId, app_package, appSize)
// .subscribeOn(Schedulers.io())
// .observeOn(AndroidSchedulers.mainThread())
// .subscribe(new Observer<BaseResponse>() {
// @Override
// public void onSubscribe(Disposable d) {
// Log.e("SEND_DOWNLOAD_FILE_INFO", "onSubscribe: ");
// }
//
// @Override
// public void onNext(BaseResponse baseResponse) {
// Log.e("SEND_DOWNLOAD_FILE_INFO", "onNext: " + baseResponse.msg);
// }
//
// @Override
// public void onError(Throwable e) {
// Log.e("SEND_DOWNLOAD_FILE_INFO", "onError: " + e.getMessage());
// }
//
// @Override
// public void onComplete() {
// Log.e("SEND_DOWNLOAD_FILE_INFO", "onComplete: ");
// }
// });
} else if (filepath.endsWith(".zip")) {
Log.e("taskComplete", "下载完成:" + task.getPercent() + ":" + task.getExtendField());
JGYUtils.getInstance().setBootanimation(task.getFilePath());

View File

@@ -62,12 +62,26 @@ public class MainSPresenter implements MainSContact.Presenter {
this.mView = null;
}
private boolean requesting = false;
public boolean isRequesting() {
return requesting;
}
public void setRequesting(boolean requesting) {
this.requesting = requesting;
}
public long responseTime;
/**
* 1
*/
@Override
public void getLockedState(String key) {
Log.e(TAG, "getLockedState: " + key);
requesting = true;
responseTime = System.currentTimeMillis();
NetInterfaceManager.getInstance()
.getLockedState(getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
@Override
@@ -154,7 +168,6 @@ public class MainSPresenter implements MainSContact.Presenter {
public void updateDeviceInfo() {
if (JGYUtils.isOfficialVersion()) {
mView.updateDeviceInfoFinish();
return;
}
NetInterfaceManager.getInstance().updateDeviceInfo(new NetInterfaceManager.onCompleteCallback() {
@Override
@@ -229,32 +242,32 @@ public class MainSPresenter implements MainSContact.Presenter {
@Override
public void getDefaultDesktop() {
if (JGYUtils.isOfficialVersion()) {
if (JGYUtils.isOfficialVersion() || JGYUtils.getInstance().getDeviceIsLocked()) {
mView.getDefaultDesktopFinish();
return;
} else {
NetInterfaceManager.getInstance()
.getDefaultDesktop(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
@Override
public void onComplete() {
mView.getDefaultDesktopFinish();
}
});
}
NetInterfaceManager.getInstance()
.getDefaultDesktop(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
@Override
public void onComplete() {
mView.getDefaultDesktopFinish();
}
});
}
@Override
public void setLogoImg() {
if (JGYUtils.isOfficialVersion()) {
mView.setLogoImgFinish();
return;
} else {
NetInterfaceManager.getInstance()
.setLogoImg(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
@Override
public void onComplete() {
mView.setLogoImgFinish();
}
});
}
NetInterfaceManager.getInstance()
.setLogoImg(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
@Override
public void onComplete() {
mView.setLogoImgFinish();
}
});
}
@@ -308,11 +321,11 @@ public class MainSPresenter implements MainSContact.Presenter {
public void getBrowserBookmarks() {
NetInterfaceManager.getInstance()
.getBookMarkBlackWhiteList(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
@Override
public void onComplete() {
mView.getBrowserBookmarksFinish();
}
});
@Override
public void onComplete() {
mView.getBrowserBookmarksFinish();
}
});
}
@Override

View File

@@ -17,10 +17,12 @@ import android.net.NetworkInfo;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.os.AsyncTask;
import android.os.Binder;
import android.os.Build;
import android.os.Debug;
import android.os.Handler;
import android.os.IBinder;
import android.os.SystemClock;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.DisplayMetrics;
@@ -54,7 +56,6 @@ import com.aoleyun.sn.utils.CacheUtils;
import com.aoleyun.sn.utils.ForegroundAppUtil;
import com.aoleyun.sn.utils.JGYUtils;
import com.aoleyun.sn.utils.SPUtils;
import com.aoleyun.sn.utils.SaveListUtils;
import com.aoleyun.sn.utils.SysSettingUtils;
import com.aoleyun.sn.utils.TimeUtils;
import com.aoleyun.sn.utils.ToastUtil;
@@ -317,7 +318,24 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
@Override
public IBinder onBind(Intent intent) {
return null;
return mMainBinder;
}
public MainBinder mMainBinder = new MainBinder();
public class MainBinder extends Binder {
public MainService getService() {
return MainService.this;
}
}
public void getLockedState() {
Log.e(TAG, "getLockedState: MainBinder");
if (!mPresenter.isRequesting()) {
mPresenter.getLockedState("MainBinder");
} else {
Log.e(TAG, "getLockedState: MainSPresenter is requesting now");
}
}
@Override
@@ -333,8 +351,10 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
task.execute("ntp.aliyun.com");
//根据要求卸载这两个应用
ApkUtils.UninstallAPP(this, "com.joytv.live");
ApkUtils.UninstallAPP(this, "com.tencent.android.qqdownloader");
if (!JGYUtils.getInstance().getDeviceIsLocked()) {
ApkUtils.UninstallAPP(this, "com.joytv.live");
ApkUtils.UninstallAPP(this, "com.tencent.android.qqdownloader");
}
try {
getPackageManager().setApplicationEnabledSetting("com.android.email", PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);
@@ -375,8 +395,8 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
timeChangedStart.onstar(System.currentTimeMillis());
setStatusbar();
setFloatingWindow(this);
notificationManager = NotificationManagerCompat.from(this);
createNotificationChannel();
sendSimpleNotification();
}
@Override
@@ -430,6 +450,9 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
}
}
private NotificationManagerCompat notificationManager;
private int NotificationID = 1;
private void sendSimpleNotification() {
NotificationCompat.Builder builder = new NotificationCompat.Builder(this, "CHANNEL_ID")
.setSmallIcon(R.mipmap.ic_launcher)
@@ -439,10 +462,8 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
.setShowWhen(false)
.setOngoing(true)
.setPriority(NotificationCompat.PRIORITY_MAX);
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this);
// notificationId is a unique int for each notification that you must define
notificationManager.notify(1, builder.build());
notificationManager.notify(NotificationID, builder.build());
}
private void addShortcut() {
@@ -814,13 +835,17 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
@Override
public void setLockedState(boolean loocked) {
Log.e(TAG, "setLockedState: " + loocked);
if (loocked) {
ToastUtil.betaShow("设备已上锁");
sendSimpleNotification();
mPresenter.setPushTags();
mPresenter.getDeveloper();
SaveListUtils.getList();
ApkUtils.UninstallAPP(this, "com.joytv.live");
ApkUtils.UninstallAPP(this, "com.tencent.android.qqdownloader");
} else {
ToastUtil.betaShow("设备已解锁");
notificationManager.cancel(NotificationID);
SysSettingUtils.setEnableSetting(this);
mPresenter.checkAoleyunUpdate();
}
@@ -911,7 +936,9 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
@Override
public void setLogoImgFinish() {
mPresenter.setRequesting(false);
Log.e(TAG, "setLogoImgFinish: ");
Log.e(TAG, "SettingFinish: " + (System.currentTimeMillis() - mPresenter.responseTime) + " ms");
}
@Override
@@ -996,7 +1023,9 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
@Override
public void setWiFiPasswd() {
mPresenter.setRequesting(false);
Log.e(TAG, "setWiFiPasswd: ");
Log.e(TAG, "SettingFinish: " + (System.currentTimeMillis() - mPresenter.responseTime) + " ms");
}
@Override

View File

@@ -27,6 +27,7 @@ import com.aoleyun.sn.R;
import com.aoleyun.sn.base.BaseApplication;
import com.aoleyun.sn.bean.BaseResponse;
import com.aoleyun.sn.bean.RemoteDebug;
import com.aoleyun.sn.bean.ScreenLockState;
import com.aoleyun.sn.comm.CommonConfig;
import com.aoleyun.sn.comm.JGYActions;
import com.aoleyun.sn.disklrucache.CacheHelper;
@@ -40,10 +41,10 @@ import com.aoleyun.sn.utils.ApkUtils;
import com.aoleyun.sn.utils.CacheUtils;
import com.aoleyun.sn.utils.CmdUtil;
import com.aoleyun.sn.utils.ForegroundAppUtil;
import com.aoleyun.sn.utils.GsonUtils;
import com.aoleyun.sn.utils.JGYUtils;
import com.aoleyun.sn.utils.MySQLData;
import com.aoleyun.sn.utils.SPUtils;
import com.aoleyun.sn.utils.SaveListUtils;
import com.aoleyun.sn.utils.ServiceAliveUtils;
import com.aoleyun.sn.utils.ToastUtil;
import com.aoleyun.sn.utils.Utils;
@@ -457,10 +458,6 @@ public class MessageReceiver extends XGPushBaseReceiver {
JSONObject jsonObject = JSON.parseObject(extras);
String pkg = jsonObject.getString("package_name");
if (TextUtils.isEmpty(pkg)) return;
if (SaveListUtils.getlist().contains(pkg)) {
SaveListUtils.getlist().remove(pkg);
}
SaveListUtils.sendForceAPP(mContext);
ApkUtils.UninstallAPP(mContext, pkg);
}
NetInterfaceManager.getInstance().getNetAndLaunchSetting();
@@ -489,7 +486,9 @@ public class MessageReceiver extends XGPushBaseReceiver {
break;
case MSG_RESET:
ToastUtil.betaShow("收到管控:设备重置");
JGYUtils.getInstance().cleanAoleLauncher3Cache();
Utils.doMasterClear(mContext);
MainService.mPresenter.getLockedState("MSG_PUSH_RESET");
break;
case MSG_INSTALL:
ToastUtil.betaShow("收到管控:应用安装");
@@ -728,6 +727,10 @@ public class MessageReceiver extends XGPushBaseReceiver {
if (ServiceAliveUtils.isServiceAlive(mContext)) {
mContext.startService(new Intent(mContext, MainService.class));
}
ScreenLockState screenLockState = new ScreenLockState();
screenLockState.setIs_screen_lock(state);
screenLockState.setName(name);
cacheHelper.put(UrlAddress.GET_LOCK_SCREEN_STATE, GsonUtils.toJsonString(screenLockState));
Intent intent = new Intent();
intent.putExtra("name", name);
if (state == 1) {
@@ -761,8 +764,6 @@ public class MessageReceiver extends XGPushBaseReceiver {
packageObj.put("MD5", MD5);
Log.e(TAG, "doDownloadAndInstall: app_package:" + app_package);
Log.e(TAG, "doDownloadAndInstall: app_url:" + app_url);
SaveListUtils.addList(app_package);
SaveListUtils.sendForceAPP(mContext);
PackageInfo packageInfo = null;
try {
packageInfo = mPackageManager.getPackageInfo(app_package, 0);
@@ -771,10 +772,7 @@ public class MessageReceiver extends XGPushBaseReceiver {
}
if (packageInfo == null) {
Log.e(TAG, "doDownloadAndInstall: " + app_package + "未安装");
if (!SaveListUtils.isDownLoading(app_url)) {
Log.e(TAG, "doDownloadAndInstall: " + app_package + "开始下载");
Utils.ariaDownload(mContext, app_url, packageObj);
}
} else {
long appVersionCode;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
@@ -783,9 +781,7 @@ public class MessageReceiver extends XGPushBaseReceiver {
appVersionCode = packageInfo.versionCode;
}
if (app_version_code > appVersionCode) {
if (!SaveListUtils.isDownLoading(app_url)) {
Utils.ariaDownload(mContext, app_url, packageObj);
}
} else {
Log.e(TAG, "doDownloadAndInstall: " + app_package + "已安装最新版");
}

View File

@@ -16,12 +16,10 @@ public class GsonUtils {
}
// TODO: 2022/3/31 暂时没有实现
public static <E> E getJsonFromType(String jsonString) {
public static <T> T getJsonFromType(String jsonString, Class clazz) {
Gson gson = new Gson();
Type Type = new TypeToken<E>() {
}.getType();
E e = gson.fromJson(jsonString, Type);
return e;
T t = (T) gson.fromJson(jsonString, clazz);
return t;
}
public static String toJsonString(Object o) {

View File

@@ -35,6 +35,9 @@ import com.alibaba.fastjson.JSONObject;
import com.aoleyun.sn.comm.CommonConfig;
import com.aoleyun.sn.comm.JGYActions;
import com.aoleyun.sn.comm.PackageNames;
import com.aoleyun.sn.disklrucache.CacheHelper;
import com.aoleyun.sn.network.NetInterfaceManager;
import com.aoleyun.sn.network.UrlAddress;
import com.aoleyun.sn.receiver.BootReceiver;
import com.blankj.utilcode.util.FileUtils;
import com.google.gson.Gson;
@@ -106,6 +109,9 @@ public class JGYUtils {
public static String ZhanruiTag = "展锐cube";
public static String Other = "其他";
private CacheHelper cacheHelper;
static {
System.loadLibrary("jgy");
}
@@ -115,7 +121,7 @@ public class JGYUtils {
throw new RuntimeException("Context is NULL");
}
this.mContext = context;
this.cacheHelper = new CacheHelper(context);
}
public static void init(Context context) {
@@ -173,6 +179,11 @@ public class JGYUtils {
return path + File.separator;
}
public boolean getDeviceIsLocked() {
int locked = Settings.System.getInt(mContext.getContentResolver(), JGYActions.ACTION_QCH_UNLOCK_IPAD, JGYActions.FRAME_CODE_LOCKED);
return locked == JGYActions.FRAME_CODE_LOCKED;
}
public int getBatteryLevel() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
BatteryManager batteryManager = (BatteryManager) mContext.getSystemService(Context.BATTERY_SERVICE);
@@ -325,8 +336,6 @@ public class JGYUtils {
}
}
}
@SuppressLint("NewApi")
@@ -958,11 +967,26 @@ public class JGYUtils {
Log.e("writeAppPackageList: ", "qch_app_forbid is :" + b + " " + Settings.System.getString(mContext.getContentResolver(), "qch_app_forbid"));
}
public void checkForceDownload() {
String jsonString = cacheHelper.getAsString(UrlAddress.GET_FORCE_INSTALL_LIST);
//为 "" 是已经请求成功的
if (jsonString == null) {
NetInterfaceManager.getInstance().getForceDownload();
} else {
Gson gson = new Gson();
Type listType = new TypeToken<List<ForceDownloadData>>() {
}.getType();
List<ForceDownloadData> forceDownloadData = gson.fromJson(jsonString, listType);
if (forceDownloadData != null) {
JGYUtils.getInstance().forceDownload(forceDownloadData);
}
}
}
public void forceDownload(List<ForceDownloadData> data) {
if (data == null || data.size() <= 0) {
return;
}
getSelfDownload(data);
List<String> list = new ArrayList<>();
for (int i = 0; i < data.size(); i++) {
ForceDownloadData forceDownloadData = data.get(i);
@@ -1008,31 +1032,8 @@ public class JGYUtils {
Utils.ariaDownload(mContext, app_url, jsonObject);
}
}
SaveListUtils.setList(list);
SaveListUtils.sendForceAPP(mContext);
}
/**
* 获取教管壹下载,没什么用了
*
* @param forceDownloadDataList
*/
private void getSelfDownload(List<ForceDownloadData> forceDownloadDataList) {
for (ForceDownloadData forceDownloadData : forceDownloadDataList) {
if (PackageNames.OLD_APPSTORE.equals(forceDownloadData.getApp_package())) {
if (!ApkUtils.isAvailable(mContext, PackageNames.OLD_APPSTORE)) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("app_name", forceDownloadData.getApp_name());
jsonObject.put("app_package", forceDownloadData.getApp_package());
Utils.ariaDownload(mContext, forceDownloadData.getApp_url(), jsonObject);
}
} else {
// Log.e("fht", "未上传应用");
}
}
}
/**
* @param jsonObject 安装应用
*/
@@ -1150,14 +1151,10 @@ public class JGYUtils {
versionCode = info.versionCode;
}
if (app_version_code > versionCode) {
if (!SaveListUtils.isDownLoading(app_url)) {
Utils.ariaDownload(mContext, app_url, jsonObject);
}
}
} else {
if (!SaveListUtils.isDownLoading(app_url)) {
Utils.ariaDownload(mContext, app_url, jsonObject);
}
}
}

View File

@@ -1,125 +0,0 @@
package com.aoleyun.sn.utils;
import android.content.Context;
import android.provider.Settings;
import android.util.Log;
import com.aoleyun.sn.comm.CommonConfig;
import com.blankj.utilcode.util.SPStaticUtils;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
public class SaveListUtils {
private static List<String> downLoadList = new ArrayList<>();
private static List<String> forceList = new ArrayList<>();
public static List<String> getList() {
String data = SPStaticUtils.getString(CommonConfig.FORCE_INSTALL);
Log.e("SaveListUtils", data);
Gson gson = new Gson();
Type listType = new TypeToken<List<String>>() {
}.getType();
List<String> list = gson.fromJson(data, listType);
if (list != null && list.size() > 0) {
Log.e("fht", "getList:" + list.toString());
} else {
list = new ArrayList<>();
}
return list;
}
public static void addToList(String data) {
List<String> list = getList();
if (list == null) {
list = new ArrayList<>();
}
if (!list.contains(data)) {
list.add(data);
Gson gson = new Gson();
String gsonData = gson.toJson(list);
SPStaticUtils.put(CommonConfig.FORCE_INSTALL, gsonData);
}
Log.e("fht", "addToList:" + list.toString());
}
public static void setList(List<String> strings) {
forceList.clear();
forceList = strings;
for (String pkg : ApkUtils.desktopAPP) {
if (!forceList.contains(pkg)) {
forceList.add(pkg);
}
}
Gson gson = new Gson();
String gsonData = gson.toJson(forceList);
SPStaticUtils.put(CommonConfig.FORCE_INSTALL, gsonData);
Log.e("fht", "setList:" + forceList.toString());
}
public static void addList(String s) {
if (!forceList.contains(s)) {
forceList.add(s);
}
Log.e("fht", "addList:" + forceList.toString());
}
public static void setList() {
Gson gson = new Gson();
String gsonData = gson.toJson(forceList);
SPStaticUtils.put(CommonConfig.FORCE_INSTALL, gsonData);
}
public static List<String> getlist() {
return forceList;
}
public static void sendForceAPP(Context context) {
StringBuilder txtBuilder = new StringBuilder();
for (String s : forceList) {
if (txtBuilder.length() > 0) {
txtBuilder.append(",");
}
txtBuilder.append(s);
}
String txt = txtBuilder.toString();
if (txt.length() > 0) {
boolean qch_force_app = Settings.System.putString(context.getContentResolver(), "qch_force_app", txt);
Log.e("fht", "qch_force_app:" + qch_force_app + ":" + txt);
} else {
boolean qch_force_app = Settings.System.putString(context.getContentResolver(), "qch_force_app", "invalid");
Log.e("fht", "qch_force_app:" + qch_force_app + ":" + txt);
}
setList();
}
public static List<String> getDownLoadList() {
return downLoadList;
}
public static void addDownLoadList(String packageName) {
if (downLoadList == null) {
downLoadList = new ArrayList<>();
downLoadList.add(packageName);
} else {
if (!downLoadList.contains(packageName)) {
downLoadList.add(packageName);
}
}
}
public static boolean isDownLoading(String packageName) {
if (downLoadList.contains(packageName)) {
return true;
} else return false;
}
}

View File

@@ -1038,7 +1038,6 @@ public class Utils {
.ignoreFilePathOccupy()
.setExtendField(jsonObject.toJSONString())
.create(); //启动下载}
// SaveListUtils.addDownLoadList(app_package);
// }
}
} else {