version:1.7.4
date:2021-10-11 18:27:04 fix:修复禁止升级功能失效,修复重复下载,修复时钟管控失效,设备信息的激活时间修复 add:
This commit is contained in:
@@ -57,10 +57,10 @@
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:networkSecurityConfig="@xml/network"
|
||||
android:roundIcon="@mipmap/ic_launcher"
|
||||
android:requestLegacyExternalStorage="true"
|
||||
android:roundIcon="@mipmap/ic_launcher"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
android:theme="@style/ImmerseTheme">
|
||||
<activity
|
||||
android:name=".activity.SNUidActivity"
|
||||
android:launchMode="singleTask"
|
||||
|
||||
@@ -40,12 +40,7 @@ public class SNUidActivity extends BaseActivity {
|
||||
ButterKnife.bind(this);
|
||||
mRecyclerView.setLayoutManager(new LinearLayoutManager(SNUidActivity.this));
|
||||
mRecyclerView.setAdapter(mAdapter);
|
||||
root.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
root.setOnClickListener(view -> finish());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,26 +1,46 @@
|
||||
package com.info.sn.base;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.info.sn.BuildConfig;
|
||||
import com.info.sn.R;
|
||||
import com.info.sn.utils.StatusBarUtil;
|
||||
import com.trello.rxlifecycle2.components.support.RxAppCompatActivity;
|
||||
import com.zackratos.ultimatebarx.ultimatebarx.java.UltimateBarX;
|
||||
|
||||
|
||||
public abstract class BaseActivity extends RxAppCompatActivity {
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
StatusBarUtil.init(this);
|
||||
// StatusBarUtil.init(this);
|
||||
UltimateBarX.statusBar(this)
|
||||
.transparent()
|
||||
.colorRes(R.color.colorPrimaryDark)
|
||||
.light(true)
|
||||
.apply();
|
||||
UltimateBarX.navigationBar(this)
|
||||
.transparent()
|
||||
.colorRes(R.color.colorPrimaryDark)
|
||||
.light(true)
|
||||
.apply();
|
||||
setContentView(this.getLayoutId());
|
||||
initView();
|
||||
initData();
|
||||
//最近任务和应用图标不一样
|
||||
if (Build.VERSION.SDK_INT > 27) {
|
||||
ActivityManager.TaskDescription description = new ActivityManager.TaskDescription(getString(R.string.app_name), R.mipmap.ic_launcher, getColor(R.color.colorPrimary));
|
||||
this.setTaskDescription(description);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置布局
|
||||
*
|
||||
*/
|
||||
public abstract int getLayoutId();
|
||||
|
||||
|
||||
@@ -662,6 +662,7 @@ public class HTTPInterface {
|
||||
if (null != appInfos && appInfos.size() != 0) {
|
||||
getForceInstallState(context, appInfos);
|
||||
}
|
||||
JGYUtils.getInstance().deleteOtherApp();
|
||||
} else {
|
||||
boolean qch_force_app = JGYUtils.putString(context.getContentResolver(), "qch_force_app", "invalid");
|
||||
Log.e(TAG, "qch_force_app:" + qch_force_app + ":" + "invalid");
|
||||
|
||||
@@ -49,6 +49,7 @@ import com.info.sn.utils.ApkUtils;
|
||||
import com.info.sn.utils.CacheUtils;
|
||||
import com.info.sn.utils.CmdUtil;
|
||||
import com.info.sn.manager.DeviceManager;
|
||||
import com.info.sn.utils.ForegroundAppUtil;
|
||||
import com.info.sn.utils.JGYUtils;
|
||||
import com.info.sn.utils.LaunchTools;
|
||||
import com.info.sn.utils.SPUtils;
|
||||
@@ -61,11 +62,15 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Type;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import cn.jpush.android.api.JPushInterface;
|
||||
import io.reactivex.Observable;
|
||||
@@ -213,7 +218,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
String type = bundle.getString(JPushInterface.EXTRA_CONTENT_TYPE);
|
||||
String extras = bundle.getString(JPushInterface.EXTRA_EXTRA);
|
||||
// HTTPInterface.checkDevicesInfo(context);
|
||||
Log.e(TAG, "processCustomMessage: " + message);
|
||||
Log.e(TAG, "processCustomMessage: " + extras);
|
||||
switch (message) {
|
||||
default:
|
||||
break;
|
||||
@@ -266,7 +271,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
ToastUtil.debugShow("收到推送消息: 强制安装应用");
|
||||
HTTPInterface.getAllappPackage(context);
|
||||
HTTPInterface.getForceInstall(context);
|
||||
intallApk(context, extras);
|
||||
// intallApk(context, extras);
|
||||
break;
|
||||
case JIGUANG_FORCE_UNINSTALLAPK:
|
||||
ToastUtil.debugShow("收到推送消息: 强制卸载应用");
|
||||
@@ -322,6 +327,14 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
case JIGUANG_SYSTEM_SETTING:
|
||||
ToastUtil.debugShow("收到推送消息: 系统管控");
|
||||
ControlManager.getInstance().setSystemSetting(context, extras);
|
||||
// if ("com.jiaoguanyi.os".equals(ForegroundAppUtil.getForegroundPackageName(context))) {
|
||||
// JGYUtils.getInstance().killBackgroundProcesses(context, "com.jiaoguanyi.os");
|
||||
// Intent intent = context.getPackageManager().getLaunchIntentForPackage("com.jiaoguanyi.os");
|
||||
// intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
// context.startActivity(intent);
|
||||
// } else {
|
||||
// JGYUtils.getInstance().killBackgroundProcesses(context, "com.jiaoguanyi.os");
|
||||
// }
|
||||
break;
|
||||
case JIGUANG_RESET_DEVICES:
|
||||
ToastUtil.debugShow("收到推送消息: 设备恢复出厂设置");
|
||||
@@ -984,12 +997,12 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
} else {
|
||||
HashSet<String> infoSet = new HashSet<>(Arrays.asList(taocan.split(",")));
|
||||
for (String cardInfo : infoSet) {
|
||||
queryAvailableProduct(cardInfo);
|
||||
queryAvailableProduct(context, cardInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void queryAvailableProduct(String card_info) {
|
||||
public void queryAvailableProduct(Context context, String card_info) {
|
||||
String appid = Scheme.partner_id;
|
||||
String timestamp = String.valueOf(System.currentTimeMillis());
|
||||
HashMap<String, String> params = new HashMap<>();
|
||||
@@ -1020,7 +1033,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
product = availableProduct;
|
||||
}
|
||||
}
|
||||
activeUser(product);
|
||||
activeUser(context, product);
|
||||
} else {
|
||||
ToastUtil.show("获取激活套餐失败");
|
||||
}
|
||||
@@ -1038,7 +1051,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
});
|
||||
}
|
||||
|
||||
public void activeUser(@NotNull AvailableProduct product) {
|
||||
public void activeUser(Context context, @NotNull AvailableProduct product) {
|
||||
if (product == null) {
|
||||
ToastUtil.show("获取套餐失败");
|
||||
return;
|
||||
@@ -1071,7 +1084,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
switch (gankaoBaseResponse.code) {
|
||||
case 10000:
|
||||
case 50000:
|
||||
// sendUid(product, gankaoUID);
|
||||
queryAvailableProduct(context);
|
||||
ToastUtil.show("激活成功:" + product.getDuration());
|
||||
break;
|
||||
default:
|
||||
@@ -1298,7 +1311,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("card_info", powerUser.getAuthorityName());
|
||||
jsonObject.put("grade", powerUser.getGrade());
|
||||
jsonObject.put("activate_time", powerUser.getAuthorizationDate());
|
||||
jsonObject.put("activate_time", getTime(powerUser.getAuthorizationDate()));
|
||||
jsonObject.put("user_power_id", powerUser.getAuthorizationNumber());
|
||||
jsonObject.put("specification_id", mAvailableProductHashMap.get(powerUser.getAuthorityName()));
|
||||
jsonArray.add(jsonObject);
|
||||
@@ -1322,6 +1335,20 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
});
|
||||
}
|
||||
|
||||
private String getTime(String timestamp) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.S'Z'");
|
||||
sdf.setTimeZone(TimeZone.getTimeZone("GMT+00"));
|
||||
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
try {
|
||||
Date date = sdf.parse(timestamp);//拿到Date对象.
|
||||
String str = sdf2.format(date);
|
||||
return str;
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
return timestamp;
|
||||
}
|
||||
}
|
||||
|
||||
public void sendUid(Context context, String jsonString) {
|
||||
int grade = (int) SPUtils.get(context, "int_grade", 0);
|
||||
|
||||
|
||||
@@ -576,6 +576,9 @@ public class JGYUtils {
|
||||
disableApp.add("com.android.documentsui");
|
||||
disableApp.add("com.mediatek.filemanager");
|
||||
}
|
||||
if (JGYUtils.getInt(context.getContentResolver(), "qch_app_deskclock", 0) == 1) {
|
||||
disableApp.add("com.android.deskclock");
|
||||
}
|
||||
if (JGYUtils.getInt(context.getContentResolver(), "qch_app_soundrecorder", 0) == 1) {
|
||||
disableApp.add("com.android.soundrecorder");
|
||||
}
|
||||
|
||||
@@ -188,7 +188,7 @@ public class SPUtils {
|
||||
public static boolean apply(SharedPreferences.Editor editor) {
|
||||
try {
|
||||
if (sApplyMethod != null) {
|
||||
Log.e(TAG, "apply: false");
|
||||
Log.i(TAG, "apply: false");
|
||||
sApplyMethod.invoke(editor);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -870,56 +870,44 @@ public class Utils {
|
||||
//所有app
|
||||
String only_jgy_shortcut_list = Settings.System.getString(context.getContentResolver(), "only_jgy_shortcut_list");
|
||||
Log.e("writeDisableUpdateList", now);
|
||||
List<String> nowList = new ArrayList<>();
|
||||
List<String> disallowList = new ArrayList<>();
|
||||
List<String> allList = new ArrayList<>();
|
||||
HashSet<String> nowList = new HashSet<>();
|
||||
HashSet<String> disallowList = new HashSet<>();
|
||||
HashSet<String> allList = new HashSet<>();
|
||||
if (!TextUtils.isEmpty(now)) {
|
||||
nowList = new ArrayList<>(new HashSet<>(Arrays.asList(now.trim().replaceAll(" ", "").split(","))));
|
||||
nowList = new HashSet<>(Arrays.asList(now.trim().replaceAll(" ", "").split(",")));
|
||||
}
|
||||
if (!TextUtils.isEmpty(upgrade_disallow)) {
|
||||
disallowList = new ArrayList<>(new HashSet<>(Arrays.asList(upgrade_disallow.trim().replaceAll(" ", "").split(","))));
|
||||
disallowList = new HashSet<>(Arrays.asList(upgrade_disallow.trim().replaceAll(" ", "").split(",")));
|
||||
}
|
||||
if (!TextUtils.isEmpty(only_jgy_shortcut_list)) {
|
||||
allList = new ArrayList<>(new HashSet<>(Arrays.asList(only_jgy_shortcut_list.trim().replaceAll(" ", "").split(","))));
|
||||
allList = new HashSet<>(Arrays.asList(only_jgy_shortcut_list.trim().replaceAll(" ", "").split(",")));
|
||||
}
|
||||
Log.e("writeDisableUpdateList", "nowList: " + nowList);
|
||||
Log.e("writeDisableUpdateList", "upgrade_disallow: " + disallowList);
|
||||
Log.e("writeDisableUpdateList", "only_jgy_shortcut_list: " + allList);
|
||||
if (allList.size() != 0) {
|
||||
List<String> finalAllList = allList;
|
||||
nowList.removeIf(new Predicate<String>() {
|
||||
@Override
|
||||
public boolean test(String s) {
|
||||
return !finalAllList.contains(s);
|
||||
}
|
||||
});
|
||||
}
|
||||
//合并
|
||||
allList.addAll(nowList);
|
||||
|
||||
boolean writeSucceed = false;
|
||||
for (String s : disallowList) {
|
||||
if (ApkUtils.isAvailable(context, s)) {
|
||||
if (nowList.remove(s)) {
|
||||
if (allList.remove(s)) {
|
||||
Log.e("writeDisableUpdateList", "remove :" + s);
|
||||
} else {
|
||||
Log.e("writeDisableUpdateList", "remove failed:" + s);
|
||||
}
|
||||
//去掉已经安装的
|
||||
} else {
|
||||
if (!nowList.contains(s)) {
|
||||
nowList.add(s);
|
||||
if (!allList.contains(s)) {
|
||||
allList.add(s);
|
||||
}
|
||||
//没有安装就加入进去
|
||||
//没有加入会导致安装后卸载不能再安装的情况
|
||||
}
|
||||
Log.e("writeDisableUpdateList", "nowList:" + nowList);
|
||||
}
|
||||
for (String s : nowList) {
|
||||
if (!allList.contains(s)) {
|
||||
allList.add(s);
|
||||
//没找到元素添加到白名单
|
||||
}
|
||||
Log.e("writeDisableUpdateList", "allList:" + allList);
|
||||
}
|
||||
boolean writeSucceed = false;
|
||||
if (allList.size() > 0) {
|
||||
Log.e("writeDisableUpdateList", "allList:" + allList);
|
||||
String list = String.join(",", allList);
|
||||
writeSucceed = JGYUtils.putString(context.getContentResolver(), "qch_app_forbid", list);
|
||||
Log.e("writeDisableUpdateList", "qch_app_forbid:" + list);
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorPrimary">#008577</color>
|
||||
<color name="colorPrimaryDark">#00574B</color>
|
||||
<color name="colorAccent">#D81B60</color>
|
||||
<color name="colorPrimary">#FFFFFF</color>
|
||||
<color name="colorPrimaryDark">#FFFFFF</color>
|
||||
<color name="colorAccent">#FFFFFF</color>
|
||||
<!-- <color name="colorPrimary">#008577</color>-->
|
||||
<!-- <color name="colorPrimaryDark">#00574B</color>-->
|
||||
<!-- <color name="colorAccent">#D81B60</color>-->
|
||||
|
||||
<color name="white">#ffffff</color>
|
||||
<color name="black">#000000</color>
|
||||
|
||||
@@ -7,6 +7,17 @@
|
||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||
<item name="colorAccent">@color/colorAccent</item>
|
||||
</style>
|
||||
|
||||
<!--沉浸状态栏需要此主题-->
|
||||
<style name="ImmerseTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="colorPrimary">@color/colorPrimary</item>
|
||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||
<item name="colorAccent">@color/colorAccent</item>
|
||||
<item name="android:windowBackground">@color/colorPrimary</item>
|
||||
<item name="android:fitsSystemWindows">true</item>
|
||||
</style>
|
||||
|
||||
<style name="CustomDialog" parent="Theme.AppCompat.Dialog.Alert">
|
||||
<!--背景颜色及和透明程度-->
|
||||
<item name="android:windowBackground">@android:color/transparent</item>
|
||||
|
||||
Reference in New Issue
Block a user