diff --git a/app/build.gradle b/app/build.gradle
index 05fd5e1..2b02488 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -60,8 +60,8 @@ android {
productFlavors {
beta {
flavorDimensions "default"
- versionCode 9
- versionName "1.8"
+ versionCode 10
+ versionName "1.9"
manifestPlaceholders = [
JPUSH_PKGNAME: "com.uiui.sn",
JPUSH_APPKEY : "1a1e405ca5a1a5cd50e9f734", //JPush 上注册的包名对应的 Appkey.
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 3a13033..93efb2c 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -102,7 +102,21 @@
android:supportsRtl="true"
android:theme="@style/ImmerseTheme"
tools:replace="android:allowBackup">
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
@@ -496,5 +488,4 @@
android:name="design_height_in_dp"
android:value="640" />
-
\ No newline at end of file
diff --git a/app/src/main/assets/aria_config.xml b/app/src/main/assets/aria_config.xml
index facc04f..a85bbf6 100644
--- a/app/src/main/assets/aria_config.xml
+++ b/app/src/main/assets/aria_config.xml
@@ -41,7 +41,7 @@
3、从3.4.1开始,如果线程数为1,文件初始化时将不再预占用对应长度的空间,下载多少byte,则占多大的空间;
对于3.4.1之前版本的未完成的老任务,依然采用原来的文件空间占用方式;
-->
-
+
diff --git a/app/src/main/java/com/uiui/sn/activity/main/MainActivity.java b/app/src/main/java/com/uiui/sn/activity/main/MainActivity.java
index 5858f83..d5ff8b5 100644
--- a/app/src/main/java/com/uiui/sn/activity/main/MainActivity.java
+++ b/app/src/main/java/com/uiui/sn/activity/main/MainActivity.java
@@ -333,13 +333,11 @@ public class MainActivity extends BaseActivity implements MainAContact.MainView,
//设备已经绑定
if (code == 200) {
tv_bind.setText(getString(R.string.bind_succeed));
- mPresenter.getAppletQRCode();
}
//设备没有绑定
else if (code == 300) {
tv_bind.setText(getString(R.string.scan_tips));
ControlManager.getInstance().setDisableSetting();
- mPresenter.getAppletQRCode();
}
//没有授权的设备
else if (code == 400) {
@@ -348,6 +346,7 @@ public class MainActivity extends BaseActivity implements MainAContact.MainView,
Log.e(TAG, "setSnInfo: " + getString(R.string.device_unauthorized));
ControlManager.getInstance().setDisableSetting();
}
+ mPresenter.getAppletQRCode();
}
@Override
diff --git a/app/src/main/java/com/uiui/sn/config/CommonConfig.java b/app/src/main/java/com/uiui/sn/config/CommonConfig.java
index 07c84a2..3befc45 100644
--- a/app/src/main/java/com/uiui/sn/config/CommonConfig.java
+++ b/app/src/main/java/com/uiui/sn/config/CommonConfig.java
@@ -9,7 +9,10 @@ public class CommonConfig {
public final static String ONLY_SHORTCUT_LIST = "only_jgy_shortcut_list";
/*底层白名单*/
public final static String QCH_APP_FORBID = "qch_app_forbid";
-
+ /*所有app更新*/
+ public final static String ALL_APP_UPDATE = "AllAppUpdate";
+ /*上次检查更新时间*/
+ public final static String LAST_CHECK_ALL_UPDATE_TIME = "lastCheckAllUpdateTime";
public static String isLogined = "isLogined";
public static String AES_KEY = "0123456789ABCDEF";
diff --git a/app/src/main/java/com/uiui/sn/network/HTTPInterface.java b/app/src/main/java/com/uiui/sn/network/HTTPInterface.java
index 17413e3..d2f743a 100644
--- a/app/src/main/java/com/uiui/sn/network/HTTPInterface.java
+++ b/app/src/main/java/com/uiui/sn/network/HTTPInterface.java
@@ -782,76 +782,7 @@ public class HTTPInterface {
}
}
- public static void checkUpdate(final Context context, String packageName, String versionCode) {
- Log.e("checkUpdate", "packageName: " + packageName);
- NewestAppUpdate newestAppUpdate = NetInterfaceManager.getInstance().getNewestAppUpdateControl();
- newestAppUpdate.getAppUpdate(packageName, versionCode, JGYUtils.getInstance().checkAppPlatform())
- .subscribeOn(Schedulers.io())
- .observeOn(AndroidSchedulers.mainThread())
- .subscribe(new Observer>() {
- @Override
- public void onSubscribe(@NonNull Disposable d) {
- Log.e("checkUpdate", "onSubscribe: ");
- }
-
- @Override
- public void onNext(@NonNull BaseResponse appInfoBaseResponse) {
- Log.e("checkUpdate", "onNext: " + appInfoBaseResponse);
- int code = appInfoBaseResponse.code;
- if (code == 200) {
- AppInfo appInfo = appInfoBaseResponse.data;
- if (null != appInfo) {
- JSONObject jsonObject = (JSONObject) JSON.toJSON(appInfo);
- FileUtils.ariaDownload(context, appInfo.getApp_url(), jsonObject);
- }
- Log.e("checkUpdate", "update now");
- } else {
- Log.e("checkUpdate", "not found update");
- }
- }
-
- @Override
- public void onError(@NonNull Throwable e) {
- Log.e("checkUpdate", "onError: " + e.getMessage());
- }
-
- @Override
- public void onComplete() {
- Log.e("checkUpdate", "onComplete: ");
- }
- });
-
- }
-
- public static void checkUpdate(Context context) {
- String packageName = BuildConfig.APPLICATION_ID;
- String versionCode = String.valueOf(BuildConfig.VERSION_CODE);
- checkUpdate(context, packageName, versionCode);
- }
-
- public static void checkUpdate(Context context, String packageName) {
- Log.e(TAG, "checkUpdate: " + packageName);
- PackageManager pm = context.getPackageManager();
- PackageInfo info = null;
- try {
- info = pm.getPackageInfo(packageName, 0);
- } catch (PackageManager.NameNotFoundException e) {
- e.printStackTrace();
- }
- if (null != info) {
- long appVersionCode;
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
- appVersionCode = info.getLongVersionCode();
- } else {
- appVersionCode = info.versionCode;
- }
- checkUpdate(context, packageName, String.valueOf(appVersionCode));
- } else {
- checkUpdate(context, packageName, "0");
- }
- }
-
- public static void getSystemSettings(final Context context) {
+ public static void getSystemSettings() {
NetInterfaceManager.getInstance().getsettingControl()
.subscribe(new Observer() {
@Override
diff --git a/app/src/main/java/com/uiui/sn/network/NetInterfaceManager.java b/app/src/main/java/com/uiui/sn/network/NetInterfaceManager.java
index 7007929..ed8e4db 100644
--- a/app/src/main/java/com/uiui/sn/network/NetInterfaceManager.java
+++ b/app/src/main/java/com/uiui/sn/network/NetInterfaceManager.java
@@ -11,14 +11,19 @@ import android.provider.Settings;
import android.text.TextUtils;
import android.util.Log;
+import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
+import com.google.gson.reflect.TypeToken;
import com.tencent.android.tpush.XGIOperateCallback;
import com.tencent.android.tpush.XGPushManager;
+import com.tencent.mmkv.MMKV;
import com.trello.rxlifecycle4.RxLifecycle;
import com.trello.rxlifecycle4.android.ActivityEvent;
+import com.uiui.sn.BuildConfig;
import com.uiui.sn.bean.AppInfo;
import com.uiui.sn.bean.AppStart;
import com.uiui.sn.bean.AppUploadInfo;
@@ -52,6 +57,7 @@ import com.uiui.sn.network.api.TimeControl;
import com.uiui.sn.network.api.UpdateAdminSn;
import com.uiui.sn.network.api.UploadScreenshot;
import com.uiui.sn.network.api.UserInfoControl;
+import com.uiui.sn.utils.FileUtils;
import com.uiui.sn.utils.JGYUtils;
import com.uiui.sn.utils.MD5Util;
import com.uiui.sn.utils.SPUtils;
@@ -61,22 +67,28 @@ import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.io.IOException;
+import java.lang.reflect.Type;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.annotations.NonNull;
+import io.reactivex.rxjava3.core.Flowable;
import io.reactivex.rxjava3.core.Observable;
import io.reactivex.rxjava3.core.ObservableEmitter;
import io.reactivex.rxjava3.core.ObservableOnSubscribe;
import io.reactivex.rxjava3.core.ObservableSource;
import io.reactivex.rxjava3.core.Observer;
import io.reactivex.rxjava3.disposables.Disposable;
+import io.reactivex.rxjava3.functions.Consumer;
import io.reactivex.rxjava3.functions.Function;
+import io.reactivex.rxjava3.functions.Function3;
import io.reactivex.rxjava3.schedulers.Schedulers;
import io.reactivex.rxjava3.subjects.BehaviorSubject;
import okhttp3.Cache;
@@ -91,11 +103,15 @@ import retrofit2.adapter.rxjava3.RxJava3CallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;
public class NetInterfaceManager {
+ private static final String TAG = NetInterfaceManager.class.getSimpleName();
+
@SuppressLint("StaticFieldLeak")
private static NetInterfaceManager INSTANCE;
private Context mContext;
+ private MMKV mMMKV = MMKV.defaultMMKV();
private Retrofit mRetrofit;
private OkHttpClient okHttpClient;
+
private final ConcurrentHashMap requestIdsMap = new ConcurrentHashMap<>();
//超时时间
@@ -103,7 +119,6 @@ public class NetInterfaceManager {
// 缓存文件最大限制大小20M
private static long cacheSize = 1024 * 1024 * 64;
public static final String CUSTOM_REPEAT_REQ_PROTOCOL = "MY_CUSTOM_REPEAT_REQ_PROTOCOL";
- private String TAG = NetInterfaceManager.class.getSimpleName();
private NetInterfaceManager(Context context) {
mContext = context;
@@ -456,13 +471,13 @@ public class NetInterfaceManager {
.subscribe(new Observer>() {
@Override
public void onSubscribe(Disposable d) {
- Log.e( "getSnInfo", "onSubscribe: ");
+ Log.e("getSnInfo", "onSubscribe: ");
callback.onSubscribe(d);
}
@Override
public void onNext(BaseResponse userInfoBaseResponse) {
- Log.e( "getSnInfo", "onNext: " + userInfoBaseResponse);
+ Log.e("getSnInfo", "onNext: " + userInfoBaseResponse);
SPUtils.put(mContext, CommonConfig.JGY_FIRST_CONNECT, 1);
callback.onNext(userInfoBaseResponse);
int code = userInfoBaseResponse.code;
@@ -490,7 +505,7 @@ public class NetInterfaceManager {
@Override
public void onError(Throwable e) {
- Log.e( "getSnInfo", "onError: " + e.getMessage());
+ Log.e("getSnInfo", "onError: " + e.getMessage());
callback.onError(e);
onComplete();
}
@@ -525,7 +540,9 @@ public class NetInterfaceManager {
Log.e(TAG + ":" + "setPushTags", "onNext: " + response);
if (response.code == 200) {
JsonObject jsonObject = JsonParser.parseString(new Gson().toJson(response.data)).getAsJsonObject();
- if (jsonObject.get("batch_id") == null) return;
+ if (jsonObject.get("batch_id") == null) {
+ return;
+ }
String batch = jsonObject.get("batch_id").getAsString();
Log.e(TAG + ":" + "setPushTags", "onNext: " + batch);
if (!TextUtils.isEmpty(batch)) {
@@ -644,4 +661,195 @@ public class NetInterfaceManager {
}
+
+ public void checkUpdate(String packageName) {
+ Log.e(TAG, "checkUpdate: " + packageName);
+ PackageManager pm = mContext.getPackageManager();
+ PackageInfo info = null;
+ try {
+ info = pm.getPackageInfo(packageName, 0);
+ } catch (PackageManager.NameNotFoundException e) {
+ e.printStackTrace();
+ }
+ if (null != info) {
+ long appVersionCode;
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
+ appVersionCode = info.getLongVersionCode();
+ } else {
+ appVersionCode = info.versionCode;
+ }
+ checkUpdate(packageName, String.valueOf(appVersionCode));
+ } else {
+ checkUpdate(packageName, "0");
+ }
+ }
+
+ public Observable> getUpdateObservable(String packageName) {
+ return NetInterfaceManager.getInstance()
+ .getNewestAppUpdateControl()
+ .getAppUpdate(packageName, "0", JGYUtils.getInstance().checkAppPlatform())
+ .subscribeOn(Schedulers.io())
+ .observeOn(AndroidSchedulers.mainThread());
+ }
+
+ public void checkUpdate(String packageName, String versionCode) {
+ Log.e("checkUpdate", "packageName: " + packageName);
+ NetInterfaceManager.getInstance()
+ .getNewestAppUpdateControl()
+ .getAppUpdate(packageName, versionCode, JGYUtils.getInstance().checkAppPlatform())
+ .subscribeOn(Schedulers.io())
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe(new Observer>() {
+ @Override
+ public void onSubscribe(@NonNull Disposable d) {
+ Log.e("checkUpdate", "onSubscribe: ");
+ }
+
+ @Override
+ public void onNext(@NonNull BaseResponse appInfoBaseResponse) {
+ Log.e("checkUpdate", "onNext: " + appInfoBaseResponse);
+ int code = appInfoBaseResponse.code;
+ if (code == 200) {
+ AppInfo appInfo = appInfoBaseResponse.data;
+ if (appInfo != null) {
+ JSONObject jsonObject = (JSONObject) JSON.toJSON(appInfo);
+ FileUtils.ariaDownload(mContext, appInfo.getApp_url(), jsonObject);
+ }
+ Log.e("checkUpdate", "update now");
+ } else {
+ Log.e("checkUpdate", "not found update");
+ }
+ }
+
+ @Override
+ public void onError(@NonNull Throwable e) {
+ Log.e("checkUpdate", "onError: " + e.getMessage());
+ }
+
+ @Override
+ public void onComplete() {
+ Log.e("checkUpdate", "onComplete: ");
+ }
+ });
+
+ }
+
+ public void checkSelfUpdate() {
+ String packageName = BuildConfig.APPLICATION_ID;
+ String versionCode = String.valueOf(BuildConfig.VERSION_CODE);
+ checkUpdate(packageName, versionCode);
+ }
+
+ private static final long ONE_MINUTE = 60 * 1000;
+ private static final long HALF_HOUR = ONE_MINUTE * 30;
+ private static final long ONE_HOUR = HALF_HOUR * 2;
+
+
+ public void checkAllAppUpdate() {
+ long lastCheckAllUpdateTime = mMMKV.decodeLong(CommonConfig.LAST_CHECK_ALL_UPDATE_TIME, 0);
+ if (System.currentTimeMillis() - lastCheckAllUpdateTime < ONE_HOUR) {
+ Log.e(TAG, "checkAllAppUpdate: " + lastCheckAllUpdateTime);
+ String jsonString = mMMKV.decodeString(CommonConfig.ALL_APP_UPDATE, "");
+ getAllAppUpdate(jsonString);
+ return;
+ }
+ Observable.zip(getUpdateObservable(JGYUtils.PACKAGE_APPSTORE),
+ getUpdateObservable(JGYUtils.PACKAGE_OS),
+ getUpdateObservable(JGYUtils.PACKAGE_BROWSER),
+ new Function3, BaseResponse, BaseResponse, List>() {
+ @Override
+ public List apply(BaseResponse appInfoBaseResponse, BaseResponse appInfoBaseResponse2, BaseResponse appInfoBaseResponse3) throws Throwable {
+ List appInfoList = new ArrayList<>();
+ if (appInfoBaseResponse.code == 200) {
+ appInfoList.add(appInfoBaseResponse.data);
+ }
+ if (appInfoBaseResponse2.code == 200) {
+ appInfoList.add(appInfoBaseResponse2.data);
+ }
+ if (appInfoBaseResponse3.code == 200) {
+ appInfoList.add(appInfoBaseResponse3.data);
+ }
+ return appInfoList;
+ }
+ })
+ .subscribeOn(Schedulers.io())
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe(new Observer>() {
+ @Override
+ public void onSubscribe(@NonNull Disposable d) {
+ Log.e("checkAllAppUpdate", "onSubscribe: ");
+ }
+
+ @Override
+ public void onNext(@NonNull List appInfos) {
+ mMMKV.encode(CommonConfig.LAST_CHECK_ALL_UPDATE_TIME, System.currentTimeMillis());
+ getAllAppUpdate(appInfos);
+ String jsonString = JSON.toJSONString(appInfos);
+ mMMKV.encode(CommonConfig.ALL_APP_UPDATE, jsonString);
+ Log.e("checkAllAppUpdate", "onNext: " + jsonString);
+ }
+
+ @Override
+ public void onError(@NonNull Throwable e) {
+ Log.e("checkAllAppUpdate", "onError: " + e.getMessage());
+ }
+
+ @Override
+ public void onComplete() {
+ Log.e("checkAllAppUpdate", "onComplete: ");
+ }
+ });
+
+
+ }
+
+ public void getAllAppUpdate(String jsonString) {
+ if (TextUtils.isEmpty(jsonString)) {
+ return;
+ }
+ Gson gson = new Gson();
+ Type listType = new TypeToken>() {
+ }.getType();
+ List appInfoList = gson.fromJson(jsonString, listType);
+ getAllAppUpdate(appInfoList);
+ }
+
+ public void getAllAppUpdate(List appInfos) {
+ if (appInfos == null || appInfos.size() == 0) {
+ return;
+ }
+ HashMap appInfoHashMap = new HashMap<>();
+ for (AppInfo appInfo : appInfos) {
+ appInfoHashMap.put(appInfo.getApp_package(), appInfo);
+ }
+ PackageManager pm = mContext.getPackageManager();
+ for (Map.Entry entry : appInfoHashMap.entrySet()) {
+ PackageInfo packageInfo = null;
+ try {
+ packageInfo = pm.getPackageInfo(entry.getKey(), 0);
+ } catch (PackageManager.NameNotFoundException e) {
+ e.printStackTrace();
+ }
+ if (entry.getValue() != null) {
+ if (packageInfo == null) {
+ //未安装
+ FileUtils.ariaDownload(mContext, entry.getValue().getApp_url(), (JSONObject) JSON.toJSON(entry.getValue()));
+ } else {
+ long appVersionCode;
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
+ appVersionCode = packageInfo.getLongVersionCode();
+ } else {
+ appVersionCode = packageInfo.versionCode;
+ }
+ long versionCode = entry.getValue().getApp_version_code();
+ //版本升级
+ if (appVersionCode < versionCode) {
+ FileUtils.ariaDownload(mContext, entry.getValue().getApp_url(), (JSONObject) JSON.toJSON(entry.getValue()));
+ }
+ }
+ }
+
+ }
+ }
+
}
diff --git a/app/src/main/java/com/uiui/sn/receiver/APKinstallReceiver.java b/app/src/main/java/com/uiui/sn/receiver/APKinstallReceiver.java
index 726917e..11f01f7 100644
--- a/app/src/main/java/com/uiui/sn/receiver/APKinstallReceiver.java
+++ b/app/src/main/java/com/uiui/sn/receiver/APKinstallReceiver.java
@@ -91,30 +91,28 @@ public class APKinstallReceiver extends BroadcastReceiver {
.subscribe(new Observer() {
@Override
public void onSubscribe(Disposable d) {
-
+ Log.e("sendAppInfo", "onSubscribe: ");
}
@Override
public void onNext(String s) {
+ Log.e("sendAppInfo", "onNext: " + s);
int isLogined = (int) SPUtils.get(mContext, CommonConfig.isLogined, 2);
if (isLogined == 2) return;
NetInterfaceManager.getInstance().SendAppInstallInfo();
HTTPInterface.getForceInstall(mContext);
HTTPInterface.getAllappPackage(mContext);
HTTPInterface.getAppInside(mContext);
- HTTPInterface.checkUpdate(mContext, JGYUtils.PACKAGE_APPSTORE);
- HTTPInterface.checkUpdate(mContext, JGYUtils.PACKAGE_BROWSER);
- HTTPInterface.checkUpdate(mContext, JGYUtils.PACKAGE_OS);
}
@Override
public void onError(Throwable e) {
-
+ Log.e("sendAppInfo", "onError: " + e.getMessage());
}
@Override
public void onComplete() {
- Log.e(TAG, "onComplete: ");
+ Log.e("sendAppInfo", "onComplete: ");
}
});
}
diff --git a/app/src/main/java/com/uiui/sn/receiver/MyJPushReceiver.java b/app/src/main/java/com/uiui/sn/receiver/MyJPushReceiver.java
index 93aa922..e3908cc 100644
--- a/app/src/main/java/com/uiui/sn/receiver/MyJPushReceiver.java
+++ b/app/src/main/java/com/uiui/sn/receiver/MyJPushReceiver.java
@@ -412,7 +412,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
case JIGUANG_APP_GALLERY:
case JIGUANG_APP_MUSIC:
ToastUtil.debugShow("收到推送消息: 系统APP管控");
- hideDesktopIcon(context);
+ hideDesktopIcon();
break;
case JIGUANG_SEARCH_TOPIC:
ToastUtil.debugShow("收到推送消息: 搜题开关");
@@ -433,7 +433,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
case JIGUANG_APP_BROWSER:
ToastUtil.debugShow("收到推送消息: 系统APP管控");
Log.e(TAG, "processCustomMessage: " + extras);
- hideDesktopIcon(context);
+ hideDesktopIcon();
break;
case JIGUANG_BIND_UNBIND:
ToastUtil.debugShow("老师授权/取消授权");
@@ -868,7 +868,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
}
private void setPhone(Context context, String jsonString) {
- HTTPInterface.getSystemSettings(context);
+ HTTPInterface.getSystemSettings();
}
@SuppressLint("NewApi")
@@ -1107,8 +1107,8 @@ public class MyJPushReceiver extends BroadcastReceiver {
}
}
- private void hideDesktopIcon(Context context) {
- HTTPInterface.getSystemSettings(context);
+ private void hideDesktopIcon() {
+ HTTPInterface.getSystemSettings();
}
private void searchTopic(Context context, String jsonString) {
diff --git a/app/src/main/java/com/uiui/sn/service/DownloadService.java b/app/src/main/java/com/uiui/sn/service/DownloadService.java
index da06c83..382821c 100644
--- a/app/src/main/java/com/uiui/sn/service/DownloadService.java
+++ b/app/src/main/java/com/uiui/sn/service/DownloadService.java
@@ -29,7 +29,7 @@ import java.io.File;
// 下载管理服务
public class DownloadService extends Service {
-
+ private static final String TAG = DownloadService.class.getSimpleName();
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
@@ -150,7 +150,12 @@ public class DownloadService extends Service {
Aria.download(this).resumeAllTask();
final String filepath = task.getFilePath();
final String packageName = task.getExtendField();
- Log.e("aria", "taskFail: " + packageName + "filepath: " + filepath + "Exception: " + e.getMessage());
+ try {
+ Log.e(TAG, "taskFail: " + "Exception: " + e.getMessage());
+ } catch (Exception ex) {
+
+ }
+ Log.e(TAG, "taskFail: " + packageName + "filepath: " + filepath);
// Aria.download(this)
// .load(task.getDownloadEntity().getRealUrl()) //读取下载地址
diff --git a/app/src/main/java/com/uiui/sn/service/main/MainService.java b/app/src/main/java/com/uiui/sn/service/main/MainService.java
index 3394774..5f01435 100644
--- a/app/src/main/java/com/uiui/sn/service/main/MainService.java
+++ b/app/src/main/java/com/uiui/sn/service/main/MainService.java
@@ -39,6 +39,7 @@ import com.uiui.sn.rlog.LogDBManager;
import com.uiui.sn.service.DownloadService;
import com.uiui.sn.service.GuardService;
import com.uiui.sn.service.StepService;
+import com.uiui.sn.utils.ApkUtils;
import com.uiui.sn.utils.CacheUtils;
import com.uiui.sn.utils.SPUtils;
import com.uiui.sn.utils.TimeUtils;
@@ -106,7 +107,7 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
start.onstar(WiFiAlias);
}
}
-
+ NetInterfaceManager.getInstance().checkAllAppUpdate();
TimeTask task = new TimeTask();
task.execute("ntp.aliyun.com");
}
@@ -304,6 +305,9 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
TimeTask task = new TimeTask();
task.execute("ntp.aliyun.com");
+ 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);
} catch (Exception e) {
@@ -347,6 +351,7 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
Log.e(TAG, "onStartCommand: " + System.currentTimeMillis());
+ NetInterfaceManager.getInstance().checkAllAppUpdate();
return START_STICKY;
}
diff --git a/app/src/main/java/com/uiui/sn/tpush/MessageReceiver.java b/app/src/main/java/com/uiui/sn/tpush/MessageReceiver.java
index d295573..b348e5f 100644
--- a/app/src/main/java/com/uiui/sn/tpush/MessageReceiver.java
+++ b/app/src/main/java/com/uiui/sn/tpush/MessageReceiver.java
@@ -547,7 +547,7 @@ public class MessageReceiver extends XGPushBaseReceiver {
break;
case JIGUANG_PHONE:
ToastUtil.debugShow("收到推送消息: 电话管控");
- setPhone(context, extras);
+ setPhone(extras);
break;
case JIGUANG_DISABLE_UPDATAE:
ToastUtil.debugShow("收到推送消息: 禁止升级");
@@ -647,7 +647,7 @@ public class MessageReceiver extends XGPushBaseReceiver {
case JIGUANG_APP_GALLERY:
case JIGUANG_APP_MUSIC:
ToastUtil.debugShow("收到推送消息: 系统APP管控");
- hideDesktopIcon(context);
+ hideDesktopIcon();
break;
case JIGUANG_SEARCH_TOPIC:
ToastUtil.debugShow("收到推送消息: 搜题开关");
@@ -655,7 +655,7 @@ public class MessageReceiver extends XGPushBaseReceiver {
break;
case JIGUANG_PHONE_LIST:
ToastUtil.debugShow("收到推送消息: 电话白名单管控");
- setPhone(context, extras);
+ setPhone(extras);
break;
case JIGUANG_CHANGE_COMBO:
ToastUtil.debugShow("更换套餐");
@@ -668,7 +668,7 @@ public class MessageReceiver extends XGPushBaseReceiver {
case JIGUANG_APP_BROWSER:
ToastUtil.debugShow("收到推送消息: 系统APP管控");
Log.e(TAG, "processCustomMessage: " + extras);
- hideDesktopIcon(context);
+ hideDesktopIcon();
break;
case JIGUANG_BIND_UNBIND:
ToastUtil.debugShow("老师授权/取消授权");
@@ -1104,8 +1104,8 @@ public class MessageReceiver extends XGPushBaseReceiver {
context.sendBroadcast(cameraIntent);
}
- private void setPhone(Context context, String jsonString) {
- HTTPInterface.getSystemSettings(context);
+ private void setPhone(String jsonString) {
+ HTTPInterface.getSystemSettings();
}
@SuppressLint("NewApi")
@@ -1113,7 +1113,7 @@ public class MessageReceiver extends XGPushBaseReceiver {
JSONObject jsonObject = JSON.parseObject(jsonString);
String is_upgrade = jsonObject.getString("is_upgrade");
String packageName = jsonObject.getString("package");
- String nowApplist = JGYUtils.getString(context.getContentResolver(), CommonConfig.QCH_APP_FORBID);
+ String nowApplist = JGYUtils.getString(context.getContentResolver(), CommonConfig.QCH_APP_FORBID);
List applist = new ArrayList<>(Arrays.asList(nowApplist.split(",")));
if ("0".equals(is_upgrade)) {
if (applist.contains(packageName)) {
@@ -1126,8 +1126,8 @@ public class MessageReceiver extends XGPushBaseReceiver {
applist.add(packageName);
}
}
- JGYUtils.putString(context.getContentResolver(), CommonConfig.QCH_APP_FORBID, String.join(",", applist));
- Log.e("setAppUpdate", JGYUtils.getString(context.getContentResolver(), CommonConfig.QCH_APP_FORBID));
+ JGYUtils.putString(context.getContentResolver(), CommonConfig.QCH_APP_FORBID, String.join(",", applist));
+ Log.e("setAppUpdate", JGYUtils.getString(context.getContentResolver(), CommonConfig.QCH_APP_FORBID));
}
private void setLock_screen(Context context, String jsonString) {
@@ -1344,8 +1344,8 @@ public class MessageReceiver extends XGPushBaseReceiver {
}
}
- private void hideDesktopIcon(Context context) {
- HTTPInterface.getSystemSettings(context);
+ private void hideDesktopIcon() {
+ HTTPInterface.getSystemSettings();
}
private void searchTopic(Context context, String jsonString) {
diff --git a/app/src/main/java/com/uiui/sn/utils/ApkUtils.java b/app/src/main/java/com/uiui/sn/utils/ApkUtils.java
index f63e035..eaf9eb9 100644
--- a/app/src/main/java/com/uiui/sn/utils/ApkUtils.java
+++ b/app/src/main/java/com/uiui/sn/utils/ApkUtils.java
@@ -51,6 +51,14 @@ import java.util.function.Predicate;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
+import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
+import io.reactivex.rxjava3.core.Observable;
+import io.reactivex.rxjava3.core.ObservableEmitter;
+import io.reactivex.rxjava3.core.ObservableOnSubscribe;
+import io.reactivex.rxjava3.core.Observer;
+import io.reactivex.rxjava3.disposables.Disposable;
+import io.reactivex.rxjava3.schedulers.Schedulers;
+
public class ApkUtils {
private static String TAG = ApkUtils.class.getSimpleName();
@@ -510,6 +518,50 @@ public class ApkUtils {
return sessionId;
}
+ /**
+ * 静默卸载应用
+ *
+ * @param context
+ * @param pkg
+ */
+ public static void UninstallAPP(Context context, String pkg) {
+ Observable.create(new ObservableOnSubscribe() {
+ @Override
+ public void subscribe(ObservableEmitter emitter) throws Exception {
+ Log.e("UninstallAPP", "call: " + Thread.currentThread().getName());
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ ApkUtils.uninstall(context, pkg);
+ } else {
+ ApkUtils.deleteApkInSilence(pkg);
+ }
+ emitter.onNext(pkg);
+ }
+ }).subscribeOn(Schedulers.io())
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe(new Observer() {
+ @Override
+ public void onSubscribe(Disposable d) {
+ Log.e("UninstallAPP", "onSubscribe: ");
+ }
+
+ @Override
+ public void onNext(String s) {
+ Log.e("UninstallAPP", "onNext: " + Thread.currentThread().getName());
+ Log.e("UninstallAPP", "onNext: " + s);
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ Log.e("UninstallAPP", "onError: " + e.getMessage());
+ }
+
+ @Override
+ public void onComplete() {
+ Log.e("UninstallAPP", "onComplete: ");
+ }
+ });
+ }
+
public static void uninstallApp(Context context, String packageName) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
uninstall(context, packageName);
diff --git a/app/src/main/res/drawable-hdpi/applet_qrcode.png b/app/src/main/res/drawable-hdpi/applet_qrcode.png
index 57b3c3f..edd216e 100644
Binary files a/app/src/main/res/drawable-hdpi/applet_qrcode.png and b/app/src/main/res/drawable-hdpi/applet_qrcode.png differ
diff --git a/app/src/main/res/drawable-hdpi/bind_applet.png b/app/src/main/res/drawable-hdpi/bind_applet.png
index f42729a..842cd5a 100644
Binary files a/app/src/main/res/drawable-hdpi/bind_applet.png and b/app/src/main/res/drawable-hdpi/bind_applet.png differ
diff --git a/app/src/main/res/layout/activity_home.xml b/app/src/main/res/layout/activity_home.xml
index 4117aa8..fed34c1 100644
--- a/app/src/main/res/layout/activity_home.xml
+++ b/app/src/main/res/layout/activity_home.xml
@@ -3,17 +3,5 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
-
-
-
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png
index a904eb9..57ad53d 100644
Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png
index a904eb9..57ad53d 100644
Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png
index a904eb9..57ad53d 100644
Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
index a904eb9..57ad53d 100644
Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
index a904eb9..57ad53d 100644
Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ