version:1.9
fix: add:
@@ -60,8 +60,8 @@ android {
|
|||||||
productFlavors {
|
productFlavors {
|
||||||
beta {
|
beta {
|
||||||
flavorDimensions "default"
|
flavorDimensions "default"
|
||||||
versionCode 9
|
versionCode 10
|
||||||
versionName "1.8"
|
versionName "1.9"
|
||||||
manifestPlaceholders = [
|
manifestPlaceholders = [
|
||||||
JPUSH_PKGNAME: "com.uiui.sn",
|
JPUSH_PKGNAME: "com.uiui.sn",
|
||||||
JPUSH_APPKEY : "1a1e405ca5a1a5cd50e9f734", //JPush 上注册的包名对应的 Appkey.
|
JPUSH_APPKEY : "1a1e405ca5a1a5cd50e9f734", //JPush 上注册的包名对应的 Appkey.
|
||||||
|
|||||||
@@ -102,7 +102,21 @@
|
|||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/ImmerseTheme"
|
android:theme="@style/ImmerseTheme"
|
||||||
tools:replace="android:allowBackup">
|
tools:replace="android:allowBackup">
|
||||||
|
<activity
|
||||||
|
android:name=".activity.main.MainActivity"
|
||||||
|
android:launchMode="singleTask"
|
||||||
|
android:screenOrientation="portrait">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
<activity
|
||||||
|
android:name=".activity.SplashActivity"
|
||||||
|
android:launchMode="singleTask"
|
||||||
|
android:screenOrientation="portrait">
|
||||||
|
</activity>
|
||||||
<service
|
<service
|
||||||
android:name=".service.ControlPanelService"
|
android:name=".service.ControlPanelService"
|
||||||
android:enabled="true"
|
android:enabled="true"
|
||||||
@@ -114,22 +128,6 @@
|
|||||||
android:exported="true"
|
android:exported="true"
|
||||||
android:process=":remote" />
|
android:process=":remote" />
|
||||||
|
|
||||||
<activity
|
|
||||||
android:name=".activity.SplashActivity"
|
|
||||||
android:launchMode="singleTask"
|
|
||||||
android:screenOrientation="portrait">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.MAIN" />
|
|
||||||
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
|
||||||
</intent-filter>
|
|
||||||
</activity>
|
|
||||||
|
|
||||||
<activity
|
|
||||||
android:name=".activity.main.MainActivity"
|
|
||||||
android:launchMode="singleTask"
|
|
||||||
android:screenOrientation="portrait" />
|
|
||||||
|
|
||||||
<service
|
<service
|
||||||
android:name=".service.main.MainService"
|
android:name=".service.main.MainService"
|
||||||
android:enabled="true"
|
android:enabled="true"
|
||||||
@@ -162,7 +160,6 @@
|
|||||||
<action android:name="android.intent.action.TIME_TICK" />
|
<action android:name="android.intent.action.TIME_TICK" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</service>
|
</service>
|
||||||
|
|
||||||
<receiver
|
<receiver
|
||||||
android:name=".receiver.BootReceiver"
|
android:name=".receiver.BootReceiver"
|
||||||
android:enabled="true"
|
android:enabled="true"
|
||||||
@@ -199,7 +196,6 @@
|
|||||||
android:name=".receiver.InstallResultReceiver"
|
android:name=".receiver.InstallResultReceiver"
|
||||||
android:enabled="true"
|
android:enabled="true"
|
||||||
android:exported="true" />
|
android:exported="true" />
|
||||||
|
|
||||||
<provider
|
<provider
|
||||||
android:name="androidx.core.content.FileProvider"
|
android:name="androidx.core.content.FileProvider"
|
||||||
android:authorities="com.uiui.sn.fileprovider"
|
android:authorities="com.uiui.sn.fileprovider"
|
||||||
@@ -210,6 +206,8 @@
|
|||||||
android:resource="@xml/file_paths" />
|
android:resource="@xml/file_paths" />
|
||||||
</provider>
|
</provider>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Rich push 核心功能 since 2.0.6 -->
|
<!-- Rich push 核心功能 since 2.0.6 -->
|
||||||
<activity
|
<activity
|
||||||
android:name="cn.jpush.android.ui.PopWinActivity"
|
android:name="cn.jpush.android.ui.PopWinActivity"
|
||||||
@@ -451,7 +449,6 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
|
|
||||||
|
|
||||||
<!-- MQTT START -->
|
<!-- MQTT START -->
|
||||||
<service
|
<service
|
||||||
android:name="com.tencent.tpns.mqttchannel.services.MqttService"
|
android:name="com.tencent.tpns.mqttchannel.services.MqttService"
|
||||||
@@ -463,11 +460,8 @@
|
|||||||
android:authorities="com.uiui.sn.XG_SETTINGS_PROVIDER"
|
android:authorities="com.uiui.sn.XG_SETTINGS_PROVIDER"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
tools:replace="android:authorities" />
|
tools:replace="android:authorities" />
|
||||||
|
|
||||||
|
|
||||||
<!-- MQTT END-->
|
<!-- MQTT END-->
|
||||||
|
|
||||||
|
|
||||||
<!-- 【必须】 请修改为 APP 的 AccessId,“15”开头的10位数字,中间没空格 -->
|
<!-- 【必须】 请修改为 APP 的 AccessId,“15”开头的10位数字,中间没空格 -->
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="XG_V2_ACCESS_ID"
|
android:name="XG_V2_ACCESS_ID"
|
||||||
@@ -477,8 +471,6 @@
|
|||||||
<meta-data
|
<meta-data
|
||||||
android:name="XG_V2_ACCESS_KEY"
|
android:name="XG_V2_ACCESS_KEY"
|
||||||
android:value="AG2PUQL7TEX5" />
|
android:value="AG2PUQL7TEX5" />
|
||||||
|
|
||||||
|
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="JPUSH_CHANNEL"
|
android:name="JPUSH_CHANNEL"
|
||||||
android:value="developer-default" />
|
android:value="developer-default" />
|
||||||
@@ -496,5 +488,4 @@
|
|||||||
android:name="design_height_in_dp"
|
android:name="design_height_in_dp"
|
||||||
android:value="640" />
|
android:value="640" />
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
3、从3.4.1开始,如果线程数为1,文件初始化时将不再预占用对应长度的空间,下载多少byte,则占多大的空间;
|
3、从3.4.1开始,如果线程数为1,文件初始化时将不再预占用对应长度的空间,下载多少byte,则占多大的空间;
|
||||||
对于3.4.1之前版本的未完成的老任务,依然采用原来的文件空间占用方式;
|
对于3.4.1之前版本的未完成的老任务,依然采用原来的文件空间占用方式;
|
||||||
-->
|
-->
|
||||||
<threadNum value="3"/>
|
<threadNum value="1"/>
|
||||||
|
|
||||||
<!--设置下载队列最大任务数, 默认为2-->
|
<!--设置下载队列最大任务数, 默认为2-->
|
||||||
<maxTaskNum value="1"/>
|
<maxTaskNum value="1"/>
|
||||||
|
|||||||
@@ -333,13 +333,11 @@ public class MainActivity extends BaseActivity implements MainAContact.MainView,
|
|||||||
//设备已经绑定
|
//设备已经绑定
|
||||||
if (code == 200) {
|
if (code == 200) {
|
||||||
tv_bind.setText(getString(R.string.bind_succeed));
|
tv_bind.setText(getString(R.string.bind_succeed));
|
||||||
mPresenter.getAppletQRCode();
|
|
||||||
}
|
}
|
||||||
//设备没有绑定
|
//设备没有绑定
|
||||||
else if (code == 300) {
|
else if (code == 300) {
|
||||||
tv_bind.setText(getString(R.string.scan_tips));
|
tv_bind.setText(getString(R.string.scan_tips));
|
||||||
ControlManager.getInstance().setDisableSetting();
|
ControlManager.getInstance().setDisableSetting();
|
||||||
mPresenter.getAppletQRCode();
|
|
||||||
}
|
}
|
||||||
//没有授权的设备
|
//没有授权的设备
|
||||||
else if (code == 400) {
|
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));
|
Log.e(TAG, "setSnInfo: " + getString(R.string.device_unauthorized));
|
||||||
ControlManager.getInstance().setDisableSetting();
|
ControlManager.getInstance().setDisableSetting();
|
||||||
}
|
}
|
||||||
|
mPresenter.getAppletQRCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -9,7 +9,10 @@ public class CommonConfig {
|
|||||||
public final static String ONLY_SHORTCUT_LIST = "only_jgy_shortcut_list";
|
public final static String ONLY_SHORTCUT_LIST = "only_jgy_shortcut_list";
|
||||||
/*底层白名单*/
|
/*底层白名单*/
|
||||||
public final static String QCH_APP_FORBID = "qch_app_forbid";
|
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 isLogined = "isLogined";
|
||||||
public static String AES_KEY = "0123456789ABCDEF";
|
public static String AES_KEY = "0123456789ABCDEF";
|
||||||
|
|||||||
@@ -782,76 +782,7 @@ public class HTTPInterface {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void checkUpdate(final Context context, String packageName, String versionCode) {
|
public static void getSystemSettings() {
|
||||||
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<BaseResponse<AppInfo>>() {
|
|
||||||
@Override
|
|
||||||
public void onSubscribe(@NonNull Disposable d) {
|
|
||||||
Log.e("checkUpdate", "onSubscribe: ");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onNext(@NonNull BaseResponse<AppInfo> 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) {
|
|
||||||
NetInterfaceManager.getInstance().getsettingControl()
|
NetInterfaceManager.getInstance().getsettingControl()
|
||||||
.subscribe(new Observer<BaseResponse>() {
|
.subscribe(new Observer<BaseResponse>() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -11,14 +11,19 @@ import android.provider.Settings;
|
|||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.google.gson.JsonParser;
|
import com.google.gson.JsonParser;
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
import com.tencent.android.tpush.XGIOperateCallback;
|
import com.tencent.android.tpush.XGIOperateCallback;
|
||||||
import com.tencent.android.tpush.XGPushManager;
|
import com.tencent.android.tpush.XGPushManager;
|
||||||
|
import com.tencent.mmkv.MMKV;
|
||||||
import com.trello.rxlifecycle4.RxLifecycle;
|
import com.trello.rxlifecycle4.RxLifecycle;
|
||||||
import com.trello.rxlifecycle4.android.ActivityEvent;
|
import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||||
|
import com.uiui.sn.BuildConfig;
|
||||||
import com.uiui.sn.bean.AppInfo;
|
import com.uiui.sn.bean.AppInfo;
|
||||||
import com.uiui.sn.bean.AppStart;
|
import com.uiui.sn.bean.AppStart;
|
||||||
import com.uiui.sn.bean.AppUploadInfo;
|
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.UpdateAdminSn;
|
||||||
import com.uiui.sn.network.api.UploadScreenshot;
|
import com.uiui.sn.network.api.UploadScreenshot;
|
||||||
import com.uiui.sn.network.api.UserInfoControl;
|
import com.uiui.sn.network.api.UserInfoControl;
|
||||||
|
import com.uiui.sn.utils.FileUtils;
|
||||||
import com.uiui.sn.utils.JGYUtils;
|
import com.uiui.sn.utils.JGYUtils;
|
||||||
import com.uiui.sn.utils.MD5Util;
|
import com.uiui.sn.utils.MD5Util;
|
||||||
import com.uiui.sn.utils.SPUtils;
|
import com.uiui.sn.utils.SPUtils;
|
||||||
@@ -61,22 +67,28 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.lang.reflect.Type;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
||||||
import io.reactivex.rxjava3.annotations.NonNull;
|
import io.reactivex.rxjava3.annotations.NonNull;
|
||||||
|
import io.reactivex.rxjava3.core.Flowable;
|
||||||
import io.reactivex.rxjava3.core.Observable;
|
import io.reactivex.rxjava3.core.Observable;
|
||||||
import io.reactivex.rxjava3.core.ObservableEmitter;
|
import io.reactivex.rxjava3.core.ObservableEmitter;
|
||||||
import io.reactivex.rxjava3.core.ObservableOnSubscribe;
|
import io.reactivex.rxjava3.core.ObservableOnSubscribe;
|
||||||
import io.reactivex.rxjava3.core.ObservableSource;
|
import io.reactivex.rxjava3.core.ObservableSource;
|
||||||
import io.reactivex.rxjava3.core.Observer;
|
import io.reactivex.rxjava3.core.Observer;
|
||||||
import io.reactivex.rxjava3.disposables.Disposable;
|
import io.reactivex.rxjava3.disposables.Disposable;
|
||||||
|
import io.reactivex.rxjava3.functions.Consumer;
|
||||||
import io.reactivex.rxjava3.functions.Function;
|
import io.reactivex.rxjava3.functions.Function;
|
||||||
|
import io.reactivex.rxjava3.functions.Function3;
|
||||||
import io.reactivex.rxjava3.schedulers.Schedulers;
|
import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||||
import io.reactivex.rxjava3.subjects.BehaviorSubject;
|
import io.reactivex.rxjava3.subjects.BehaviorSubject;
|
||||||
import okhttp3.Cache;
|
import okhttp3.Cache;
|
||||||
@@ -91,11 +103,15 @@ import retrofit2.adapter.rxjava3.RxJava3CallAdapterFactory;
|
|||||||
import retrofit2.converter.gson.GsonConverterFactory;
|
import retrofit2.converter.gson.GsonConverterFactory;
|
||||||
|
|
||||||
public class NetInterfaceManager {
|
public class NetInterfaceManager {
|
||||||
|
private static final String TAG = NetInterfaceManager.class.getSimpleName();
|
||||||
|
|
||||||
@SuppressLint("StaticFieldLeak")
|
@SuppressLint("StaticFieldLeak")
|
||||||
private static NetInterfaceManager INSTANCE;
|
private static NetInterfaceManager INSTANCE;
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
|
private MMKV mMMKV = MMKV.defaultMMKV();
|
||||||
private Retrofit mRetrofit;
|
private Retrofit mRetrofit;
|
||||||
private OkHttpClient okHttpClient;
|
private OkHttpClient okHttpClient;
|
||||||
|
|
||||||
private final ConcurrentHashMap<String, Long> requestIdsMap = new ConcurrentHashMap<>();
|
private final ConcurrentHashMap<String, Long> requestIdsMap = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
//超时时间
|
//超时时间
|
||||||
@@ -103,7 +119,6 @@ public class NetInterfaceManager {
|
|||||||
// 缓存文件最大限制大小20M
|
// 缓存文件最大限制大小20M
|
||||||
private static long cacheSize = 1024 * 1024 * 64;
|
private static long cacheSize = 1024 * 1024 * 64;
|
||||||
public static final String CUSTOM_REPEAT_REQ_PROTOCOL = "MY_CUSTOM_REPEAT_REQ_PROTOCOL";
|
public static final String CUSTOM_REPEAT_REQ_PROTOCOL = "MY_CUSTOM_REPEAT_REQ_PROTOCOL";
|
||||||
private String TAG = NetInterfaceManager.class.getSimpleName();
|
|
||||||
|
|
||||||
private NetInterfaceManager(Context context) {
|
private NetInterfaceManager(Context context) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
@@ -456,13 +471,13 @@ public class NetInterfaceManager {
|
|||||||
.subscribe(new Observer<BaseResponse<SnInfo>>() {
|
.subscribe(new Observer<BaseResponse<SnInfo>>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSubscribe(Disposable d) {
|
public void onSubscribe(Disposable d) {
|
||||||
Log.e( "getSnInfo", "onSubscribe: ");
|
Log.e("getSnInfo", "onSubscribe: ");
|
||||||
callback.onSubscribe(d);
|
callback.onSubscribe(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNext(BaseResponse<SnInfo> userInfoBaseResponse) {
|
public void onNext(BaseResponse<SnInfo> userInfoBaseResponse) {
|
||||||
Log.e( "getSnInfo", "onNext: " + userInfoBaseResponse);
|
Log.e("getSnInfo", "onNext: " + userInfoBaseResponse);
|
||||||
SPUtils.put(mContext, CommonConfig.JGY_FIRST_CONNECT, 1);
|
SPUtils.put(mContext, CommonConfig.JGY_FIRST_CONNECT, 1);
|
||||||
callback.onNext(userInfoBaseResponse);
|
callback.onNext(userInfoBaseResponse);
|
||||||
int code = userInfoBaseResponse.code;
|
int code = userInfoBaseResponse.code;
|
||||||
@@ -490,7 +505,7 @@ public class NetInterfaceManager {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(Throwable e) {
|
public void onError(Throwable e) {
|
||||||
Log.e( "getSnInfo", "onError: " + e.getMessage());
|
Log.e("getSnInfo", "onError: " + e.getMessage());
|
||||||
callback.onError(e);
|
callback.onError(e);
|
||||||
onComplete();
|
onComplete();
|
||||||
}
|
}
|
||||||
@@ -525,7 +540,9 @@ public class NetInterfaceManager {
|
|||||||
Log.e(TAG + ":" + "setPushTags", "onNext: " + response);
|
Log.e(TAG + ":" + "setPushTags", "onNext: " + response);
|
||||||
if (response.code == 200) {
|
if (response.code == 200) {
|
||||||
JsonObject jsonObject = JsonParser.parseString(new Gson().toJson(response.data)).getAsJsonObject();
|
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();
|
String batch = jsonObject.get("batch_id").getAsString();
|
||||||
Log.e(TAG + ":" + "setPushTags", "onNext: " + batch);
|
Log.e(TAG + ":" + "setPushTags", "onNext: " + batch);
|
||||||
if (!TextUtils.isEmpty(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<BaseResponse<AppInfo>> 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<BaseResponse<AppInfo>>() {
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(@NonNull Disposable d) {
|
||||||
|
Log.e("checkUpdate", "onSubscribe: ");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNext(@NonNull BaseResponse<AppInfo> 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<AppInfo>, BaseResponse<AppInfo>, BaseResponse<AppInfo>, List<AppInfo>>() {
|
||||||
|
@Override
|
||||||
|
public List<AppInfo> apply(BaseResponse<AppInfo> appInfoBaseResponse, BaseResponse<AppInfo> appInfoBaseResponse2, BaseResponse<AppInfo> appInfoBaseResponse3) throws Throwable {
|
||||||
|
List<AppInfo> 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<List<AppInfo>>() {
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(@NonNull Disposable d) {
|
||||||
|
Log.e("checkAllAppUpdate", "onSubscribe: ");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNext(@NonNull List<AppInfo> 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<List<AppInfo>>() {
|
||||||
|
}.getType();
|
||||||
|
List<AppInfo> appInfoList = gson.fromJson(jsonString, listType);
|
||||||
|
getAllAppUpdate(appInfoList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getAllAppUpdate(List<AppInfo> appInfos) {
|
||||||
|
if (appInfos == null || appInfos.size() == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
HashMap<String, AppInfo> appInfoHashMap = new HashMap<>();
|
||||||
|
for (AppInfo appInfo : appInfos) {
|
||||||
|
appInfoHashMap.put(appInfo.getApp_package(), appInfo);
|
||||||
|
}
|
||||||
|
PackageManager pm = mContext.getPackageManager();
|
||||||
|
for (Map.Entry<String, AppInfo> 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()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,30 +91,28 @@ public class APKinstallReceiver extends BroadcastReceiver {
|
|||||||
.subscribe(new Observer<String>() {
|
.subscribe(new Observer<String>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSubscribe(Disposable d) {
|
public void onSubscribe(Disposable d) {
|
||||||
|
Log.e("sendAppInfo", "onSubscribe: ");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNext(String s) {
|
public void onNext(String s) {
|
||||||
|
Log.e("sendAppInfo", "onNext: " + s);
|
||||||
int isLogined = (int) SPUtils.get(mContext, CommonConfig.isLogined, 2);
|
int isLogined = (int) SPUtils.get(mContext, CommonConfig.isLogined, 2);
|
||||||
if (isLogined == 2) return;
|
if (isLogined == 2) return;
|
||||||
NetInterfaceManager.getInstance().SendAppInstallInfo();
|
NetInterfaceManager.getInstance().SendAppInstallInfo();
|
||||||
HTTPInterface.getForceInstall(mContext);
|
HTTPInterface.getForceInstall(mContext);
|
||||||
HTTPInterface.getAllappPackage(mContext);
|
HTTPInterface.getAllappPackage(mContext);
|
||||||
HTTPInterface.getAppInside(mContext);
|
HTTPInterface.getAppInside(mContext);
|
||||||
HTTPInterface.checkUpdate(mContext, JGYUtils.PACKAGE_APPSTORE);
|
|
||||||
HTTPInterface.checkUpdate(mContext, JGYUtils.PACKAGE_BROWSER);
|
|
||||||
HTTPInterface.checkUpdate(mContext, JGYUtils.PACKAGE_OS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(Throwable e) {
|
public void onError(Throwable e) {
|
||||||
|
Log.e("sendAppInfo", "onError: " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onComplete() {
|
public void onComplete() {
|
||||||
Log.e(TAG, "onComplete: ");
|
Log.e("sendAppInfo", "onComplete: ");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -412,7 +412,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
|||||||
case JIGUANG_APP_GALLERY:
|
case JIGUANG_APP_GALLERY:
|
||||||
case JIGUANG_APP_MUSIC:
|
case JIGUANG_APP_MUSIC:
|
||||||
ToastUtil.debugShow("收到推送消息: 系统APP管控");
|
ToastUtil.debugShow("收到推送消息: 系统APP管控");
|
||||||
hideDesktopIcon(context);
|
hideDesktopIcon();
|
||||||
break;
|
break;
|
||||||
case JIGUANG_SEARCH_TOPIC:
|
case JIGUANG_SEARCH_TOPIC:
|
||||||
ToastUtil.debugShow("收到推送消息: 搜题开关");
|
ToastUtil.debugShow("收到推送消息: 搜题开关");
|
||||||
@@ -433,7 +433,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
|||||||
case JIGUANG_APP_BROWSER:
|
case JIGUANG_APP_BROWSER:
|
||||||
ToastUtil.debugShow("收到推送消息: 系统APP管控");
|
ToastUtil.debugShow("收到推送消息: 系统APP管控");
|
||||||
Log.e(TAG, "processCustomMessage: " + extras);
|
Log.e(TAG, "processCustomMessage: " + extras);
|
||||||
hideDesktopIcon(context);
|
hideDesktopIcon();
|
||||||
break;
|
break;
|
||||||
case JIGUANG_BIND_UNBIND:
|
case JIGUANG_BIND_UNBIND:
|
||||||
ToastUtil.debugShow("老师授权/取消授权");
|
ToastUtil.debugShow("老师授权/取消授权");
|
||||||
@@ -868,7 +868,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setPhone(Context context, String jsonString) {
|
private void setPhone(Context context, String jsonString) {
|
||||||
HTTPInterface.getSystemSettings(context);
|
HTTPInterface.getSystemSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("NewApi")
|
@SuppressLint("NewApi")
|
||||||
@@ -1107,8 +1107,8 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void hideDesktopIcon(Context context) {
|
private void hideDesktopIcon() {
|
||||||
HTTPInterface.getSystemSettings(context);
|
HTTPInterface.getSystemSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void searchTopic(Context context, String jsonString) {
|
private void searchTopic(Context context, String jsonString) {
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import java.io.File;
|
|||||||
|
|
||||||
// 下载管理服务
|
// 下载管理服务
|
||||||
public class DownloadService extends Service {
|
public class DownloadService extends Service {
|
||||||
|
private static final String TAG = DownloadService.class.getSimpleName();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||||
@@ -150,7 +150,12 @@ public class DownloadService extends Service {
|
|||||||
Aria.download(this).resumeAllTask();
|
Aria.download(this).resumeAllTask();
|
||||||
final String filepath = task.getFilePath();
|
final String filepath = task.getFilePath();
|
||||||
final String packageName = task.getExtendField();
|
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)
|
// Aria.download(this)
|
||||||
// .load(task.getDownloadEntity().getRealUrl()) //读取下载地址
|
// .load(task.getDownloadEntity().getRealUrl()) //读取下载地址
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ import com.uiui.sn.rlog.LogDBManager;
|
|||||||
import com.uiui.sn.service.DownloadService;
|
import com.uiui.sn.service.DownloadService;
|
||||||
import com.uiui.sn.service.GuardService;
|
import com.uiui.sn.service.GuardService;
|
||||||
import com.uiui.sn.service.StepService;
|
import com.uiui.sn.service.StepService;
|
||||||
|
import com.uiui.sn.utils.ApkUtils;
|
||||||
import com.uiui.sn.utils.CacheUtils;
|
import com.uiui.sn.utils.CacheUtils;
|
||||||
import com.uiui.sn.utils.SPUtils;
|
import com.uiui.sn.utils.SPUtils;
|
||||||
import com.uiui.sn.utils.TimeUtils;
|
import com.uiui.sn.utils.TimeUtils;
|
||||||
@@ -106,7 +107,7 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
|||||||
start.onstar(WiFiAlias);
|
start.onstar(WiFiAlias);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
NetInterfaceManager.getInstance().checkAllAppUpdate();
|
||||||
TimeTask task = new TimeTask();
|
TimeTask task = new TimeTask();
|
||||||
task.execute("ntp.aliyun.com");
|
task.execute("ntp.aliyun.com");
|
||||||
}
|
}
|
||||||
@@ -304,6 +305,9 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
|||||||
TimeTask task = new TimeTask();
|
TimeTask task = new TimeTask();
|
||||||
task.execute("ntp.aliyun.com");
|
task.execute("ntp.aliyun.com");
|
||||||
|
|
||||||
|
ApkUtils.UninstallAPP(this, "com.joytv.live");
|
||||||
|
ApkUtils.UninstallAPP(this, "com.tencent.android.qqdownloader");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
getPackageManager().setApplicationEnabledSetting("com.android.email", PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);
|
getPackageManager().setApplicationEnabledSetting("com.android.email", PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -347,6 +351,7 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
|||||||
@Override
|
@Override
|
||||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||||
Log.e(TAG, "onStartCommand: " + System.currentTimeMillis());
|
Log.e(TAG, "onStartCommand: " + System.currentTimeMillis());
|
||||||
|
NetInterfaceManager.getInstance().checkAllAppUpdate();
|
||||||
return START_STICKY;
|
return START_STICKY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -547,7 +547,7 @@ public class MessageReceiver extends XGPushBaseReceiver {
|
|||||||
break;
|
break;
|
||||||
case JIGUANG_PHONE:
|
case JIGUANG_PHONE:
|
||||||
ToastUtil.debugShow("收到推送消息: 电话管控");
|
ToastUtil.debugShow("收到推送消息: 电话管控");
|
||||||
setPhone(context, extras);
|
setPhone(extras);
|
||||||
break;
|
break;
|
||||||
case JIGUANG_DISABLE_UPDATAE:
|
case JIGUANG_DISABLE_UPDATAE:
|
||||||
ToastUtil.debugShow("收到推送消息: 禁止升级");
|
ToastUtil.debugShow("收到推送消息: 禁止升级");
|
||||||
@@ -647,7 +647,7 @@ public class MessageReceiver extends XGPushBaseReceiver {
|
|||||||
case JIGUANG_APP_GALLERY:
|
case JIGUANG_APP_GALLERY:
|
||||||
case JIGUANG_APP_MUSIC:
|
case JIGUANG_APP_MUSIC:
|
||||||
ToastUtil.debugShow("收到推送消息: 系统APP管控");
|
ToastUtil.debugShow("收到推送消息: 系统APP管控");
|
||||||
hideDesktopIcon(context);
|
hideDesktopIcon();
|
||||||
break;
|
break;
|
||||||
case JIGUANG_SEARCH_TOPIC:
|
case JIGUANG_SEARCH_TOPIC:
|
||||||
ToastUtil.debugShow("收到推送消息: 搜题开关");
|
ToastUtil.debugShow("收到推送消息: 搜题开关");
|
||||||
@@ -655,7 +655,7 @@ public class MessageReceiver extends XGPushBaseReceiver {
|
|||||||
break;
|
break;
|
||||||
case JIGUANG_PHONE_LIST:
|
case JIGUANG_PHONE_LIST:
|
||||||
ToastUtil.debugShow("收到推送消息: 电话白名单管控");
|
ToastUtil.debugShow("收到推送消息: 电话白名单管控");
|
||||||
setPhone(context, extras);
|
setPhone(extras);
|
||||||
break;
|
break;
|
||||||
case JIGUANG_CHANGE_COMBO:
|
case JIGUANG_CHANGE_COMBO:
|
||||||
ToastUtil.debugShow("更换套餐");
|
ToastUtil.debugShow("更换套餐");
|
||||||
@@ -668,7 +668,7 @@ public class MessageReceiver extends XGPushBaseReceiver {
|
|||||||
case JIGUANG_APP_BROWSER:
|
case JIGUANG_APP_BROWSER:
|
||||||
ToastUtil.debugShow("收到推送消息: 系统APP管控");
|
ToastUtil.debugShow("收到推送消息: 系统APP管控");
|
||||||
Log.e(TAG, "processCustomMessage: " + extras);
|
Log.e(TAG, "processCustomMessage: " + extras);
|
||||||
hideDesktopIcon(context);
|
hideDesktopIcon();
|
||||||
break;
|
break;
|
||||||
case JIGUANG_BIND_UNBIND:
|
case JIGUANG_BIND_UNBIND:
|
||||||
ToastUtil.debugShow("老师授权/取消授权");
|
ToastUtil.debugShow("老师授权/取消授权");
|
||||||
@@ -1104,8 +1104,8 @@ public class MessageReceiver extends XGPushBaseReceiver {
|
|||||||
context.sendBroadcast(cameraIntent);
|
context.sendBroadcast(cameraIntent);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setPhone(Context context, String jsonString) {
|
private void setPhone(String jsonString) {
|
||||||
HTTPInterface.getSystemSettings(context);
|
HTTPInterface.getSystemSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("NewApi")
|
@SuppressLint("NewApi")
|
||||||
@@ -1113,7 +1113,7 @@ public class MessageReceiver extends XGPushBaseReceiver {
|
|||||||
JSONObject jsonObject = JSON.parseObject(jsonString);
|
JSONObject jsonObject = JSON.parseObject(jsonString);
|
||||||
String is_upgrade = jsonObject.getString("is_upgrade");
|
String is_upgrade = jsonObject.getString("is_upgrade");
|
||||||
String packageName = jsonObject.getString("package");
|
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<String> applist = new ArrayList<>(Arrays.asList(nowApplist.split(",")));
|
List<String> applist = new ArrayList<>(Arrays.asList(nowApplist.split(",")));
|
||||||
if ("0".equals(is_upgrade)) {
|
if ("0".equals(is_upgrade)) {
|
||||||
if (applist.contains(packageName)) {
|
if (applist.contains(packageName)) {
|
||||||
@@ -1126,8 +1126,8 @@ public class MessageReceiver extends XGPushBaseReceiver {
|
|||||||
applist.add(packageName);
|
applist.add(packageName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
JGYUtils.putString(context.getContentResolver(), CommonConfig.QCH_APP_FORBID, String.join(",", applist));
|
JGYUtils.putString(context.getContentResolver(), CommonConfig.QCH_APP_FORBID, String.join(",", applist));
|
||||||
Log.e("setAppUpdate", JGYUtils.getString(context.getContentResolver(), CommonConfig.QCH_APP_FORBID));
|
Log.e("setAppUpdate", JGYUtils.getString(context.getContentResolver(), CommonConfig.QCH_APP_FORBID));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setLock_screen(Context context, String jsonString) {
|
private void setLock_screen(Context context, String jsonString) {
|
||||||
@@ -1344,8 +1344,8 @@ public class MessageReceiver extends XGPushBaseReceiver {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void hideDesktopIcon(Context context) {
|
private void hideDesktopIcon() {
|
||||||
HTTPInterface.getSystemSettings(context);
|
HTTPInterface.getSystemSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void searchTopic(Context context, String jsonString) {
|
private void searchTopic(Context context, String jsonString) {
|
||||||
|
|||||||
@@ -51,6 +51,14 @@ import java.util.function.Predicate;
|
|||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
import java.util.zip.ZipFile;
|
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 {
|
public class ApkUtils {
|
||||||
private static String TAG = ApkUtils.class.getSimpleName();
|
private static String TAG = ApkUtils.class.getSimpleName();
|
||||||
@@ -510,6 +518,50 @@ public class ApkUtils {
|
|||||||
return sessionId;
|
return sessionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 静默卸载应用
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
* @param pkg
|
||||||
|
*/
|
||||||
|
public static void UninstallAPP(Context context, String pkg) {
|
||||||
|
Observable.create(new ObservableOnSubscribe<String>() {
|
||||||
|
@Override
|
||||||
|
public void subscribe(ObservableEmitter<String> 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<String>() {
|
||||||
|
@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) {
|
public static void uninstallApp(Context context, String packageName) {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
uninstall(context, packageName);
|
uninstall(context, packageName);
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 47 KiB |
|
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 40 KiB |
@@ -3,17 +3,5 @@
|
|||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:layout_width="200dp"
|
|
||||||
android:layout_height="200dp"
|
|
||||||
android:adjustViewBounds="true"
|
|
||||||
android:scaleType="centerCrop"
|
|
||||||
android:src="@mipmap/ic_launcher"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:layout_constraintVertical_bias="0.261" />
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 12 KiB |