version:1.7.4

date:2021-10-11 18:27:04
fix:修复禁止升级功能失效,修复重复下载,修复时钟管控失效,设备信息的激活时间修复
add:
This commit is contained in:
2021-10-11 18:27:32 +08:00
parent e41becbdb0
commit e1c6d69428
11 changed files with 100 additions and 51 deletions

View File

@@ -15,8 +15,8 @@ android {
applicationId "com.info.sn" applicationId "com.info.sn"
minSdkVersion 24 minSdkVersion 24
targetSdkVersion 29 targetSdkVersion 29
versionCode 73 versionCode 74
versionName "1.7.3" versionName "1.7.4"
multiDexEnabled true multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
ndk { ndk {
@@ -220,7 +220,8 @@ dependencies {
// If you are using Kotlin, replace annotationProcessor with kapt. // If you are using Kotlin, replace annotationProcessor with kapt.
// annotationProcessor rootProject.ext.dependencies["butterknife-compiler"] // annotationProcessor rootProject.ext.dependencies["butterknife-compiler"]
annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.1' annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.1'
//沉浸状态栏
implementation 'com.gitee.zackratos:UltimateBarX:0.7.1'
} }
preBuild { preBuild {

View File

@@ -57,10 +57,10 @@
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:networkSecurityConfig="@xml/network" android:networkSecurityConfig="@xml/network"
android:roundIcon="@mipmap/ic_launcher"
android:requestLegacyExternalStorage="true" android:requestLegacyExternalStorage="true"
android:roundIcon="@mipmap/ic_launcher"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/AppTheme"> android:theme="@style/ImmerseTheme">
<activity <activity
android:name=".activity.SNUidActivity" android:name=".activity.SNUidActivity"
android:launchMode="singleTask" android:launchMode="singleTask"

View File

@@ -40,12 +40,7 @@ public class SNUidActivity extends BaseActivity {
ButterKnife.bind(this); ButterKnife.bind(this);
mRecyclerView.setLayoutManager(new LinearLayoutManager(SNUidActivity.this)); mRecyclerView.setLayoutManager(new LinearLayoutManager(SNUidActivity.this));
mRecyclerView.setAdapter(mAdapter); mRecyclerView.setAdapter(mAdapter);
root.setOnClickListener(new View.OnClickListener() { root.setOnClickListener(view -> finish());
@Override
public void onClick(View view) {
finish();
}
});
} }
@Override @Override

View File

@@ -1,26 +1,46 @@
package com.info.sn.base; package com.info.sn.base;
import android.app.ActivityManager;
import android.graphics.Bitmap;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import com.info.sn.BuildConfig;
import com.info.sn.R;
import com.info.sn.utils.StatusBarUtil; import com.info.sn.utils.StatusBarUtil;
import com.trello.rxlifecycle2.components.support.RxAppCompatActivity; import com.trello.rxlifecycle2.components.support.RxAppCompatActivity;
import com.zackratos.ultimatebarx.ultimatebarx.java.UltimateBarX;
public abstract class BaseActivity extends RxAppCompatActivity { public abstract class BaseActivity extends RxAppCompatActivity {
@Override @Override
protected void onCreate(@Nullable Bundle savedInstanceState) { protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(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()); setContentView(this.getLayoutId());
initView(); initView();
initData(); 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(); public abstract int getLayoutId();

View File

@@ -662,6 +662,7 @@ public class HTTPInterface {
if (null != appInfos && appInfos.size() != 0) { if (null != appInfos && appInfos.size() != 0) {
getForceInstallState(context, appInfos); getForceInstallState(context, appInfos);
} }
JGYUtils.getInstance().deleteOtherApp();
} else { } else {
boolean qch_force_app = JGYUtils.putString(context.getContentResolver(), "qch_force_app", "invalid"); boolean qch_force_app = JGYUtils.putString(context.getContentResolver(), "qch_force_app", "invalid");
Log.e(TAG, "qch_force_app:" + qch_force_app + ":" + "invalid"); Log.e(TAG, "qch_force_app:" + qch_force_app + ":" + "invalid");

View File

@@ -49,6 +49,7 @@ import com.info.sn.utils.ApkUtils;
import com.info.sn.utils.CacheUtils; import com.info.sn.utils.CacheUtils;
import com.info.sn.utils.CmdUtil; import com.info.sn.utils.CmdUtil;
import com.info.sn.manager.DeviceManager; import com.info.sn.manager.DeviceManager;
import com.info.sn.utils.ForegroundAppUtil;
import com.info.sn.utils.JGYUtils; import com.info.sn.utils.JGYUtils;
import com.info.sn.utils.LaunchTools; import com.info.sn.utils.LaunchTools;
import com.info.sn.utils.SPUtils; import com.info.sn.utils.SPUtils;
@@ -61,11 +62,15 @@ import org.jetbrains.annotations.NotNull;
import java.io.File; import java.io.File;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.TimeZone;
import cn.jpush.android.api.JPushInterface; import cn.jpush.android.api.JPushInterface;
import io.reactivex.Observable; import io.reactivex.Observable;
@@ -213,7 +218,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
String type = bundle.getString(JPushInterface.EXTRA_CONTENT_TYPE); String type = bundle.getString(JPushInterface.EXTRA_CONTENT_TYPE);
String extras = bundle.getString(JPushInterface.EXTRA_EXTRA); String extras = bundle.getString(JPushInterface.EXTRA_EXTRA);
// HTTPInterface.checkDevicesInfo(context); // HTTPInterface.checkDevicesInfo(context);
Log.e(TAG, "processCustomMessage: " + message); Log.e(TAG, "processCustomMessage: " + extras);
switch (message) { switch (message) {
default: default:
break; break;
@@ -266,7 +271,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
ToastUtil.debugShow("收到推送消息: 强制安装应用"); ToastUtil.debugShow("收到推送消息: 强制安装应用");
HTTPInterface.getAllappPackage(context); HTTPInterface.getAllappPackage(context);
HTTPInterface.getForceInstall(context); HTTPInterface.getForceInstall(context);
intallApk(context, extras); // intallApk(context, extras);
break; break;
case JIGUANG_FORCE_UNINSTALLAPK: case JIGUANG_FORCE_UNINSTALLAPK:
ToastUtil.debugShow("收到推送消息: 强制卸载应用"); ToastUtil.debugShow("收到推送消息: 强制卸载应用");
@@ -322,6 +327,14 @@ public class MyJPushReceiver extends BroadcastReceiver {
case JIGUANG_SYSTEM_SETTING: case JIGUANG_SYSTEM_SETTING:
ToastUtil.debugShow("收到推送消息: 系统管控"); ToastUtil.debugShow("收到推送消息: 系统管控");
ControlManager.getInstance().setSystemSetting(context, extras); 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; break;
case JIGUANG_RESET_DEVICES: case JIGUANG_RESET_DEVICES:
ToastUtil.debugShow("收到推送消息: 设备恢复出厂设置"); ToastUtil.debugShow("收到推送消息: 设备恢复出厂设置");
@@ -984,12 +997,12 @@ public class MyJPushReceiver extends BroadcastReceiver {
} else { } else {
HashSet<String> infoSet = new HashSet<>(Arrays.asList(taocan.split(","))); HashSet<String> infoSet = new HashSet<>(Arrays.asList(taocan.split(",")));
for (String cardInfo : infoSet) { 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 appid = Scheme.partner_id;
String timestamp = String.valueOf(System.currentTimeMillis()); String timestamp = String.valueOf(System.currentTimeMillis());
HashMap<String, String> params = new HashMap<>(); HashMap<String, String> params = new HashMap<>();
@@ -1020,7 +1033,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
product = availableProduct; product = availableProduct;
} }
} }
activeUser(product); activeUser(context, product);
} else { } else {
ToastUtil.show("获取激活套餐失败"); 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) { if (product == null) {
ToastUtil.show("获取套餐失败"); ToastUtil.show("获取套餐失败");
return; return;
@@ -1071,7 +1084,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
switch (gankaoBaseResponse.code) { switch (gankaoBaseResponse.code) {
case 10000: case 10000:
case 50000: case 50000:
// sendUid(product, gankaoUID); queryAvailableProduct(context);
ToastUtil.show("激活成功:" + product.getDuration()); ToastUtil.show("激活成功:" + product.getDuration());
break; break;
default: default:
@@ -1298,7 +1311,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("card_info", powerUser.getAuthorityName()); jsonObject.put("card_info", powerUser.getAuthorityName());
jsonObject.put("grade", powerUser.getGrade()); 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("user_power_id", powerUser.getAuthorizationNumber());
jsonObject.put("specification_id", mAvailableProductHashMap.get(powerUser.getAuthorityName())); jsonObject.put("specification_id", mAvailableProductHashMap.get(powerUser.getAuthorityName()));
jsonArray.add(jsonObject); 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) { public void sendUid(Context context, String jsonString) {
int grade = (int) SPUtils.get(context, "int_grade", 0); int grade = (int) SPUtils.get(context, "int_grade", 0);

View File

@@ -576,6 +576,9 @@ public class JGYUtils {
disableApp.add("com.android.documentsui"); disableApp.add("com.android.documentsui");
disableApp.add("com.mediatek.filemanager"); 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) { if (JGYUtils.getInt(context.getContentResolver(), "qch_app_soundrecorder", 0) == 1) {
disableApp.add("com.android.soundrecorder"); disableApp.add("com.android.soundrecorder");
} }

View File

@@ -188,7 +188,7 @@ public class SPUtils {
public static boolean apply(SharedPreferences.Editor editor) { public static boolean apply(SharedPreferences.Editor editor) {
try { try {
if (sApplyMethod != null) { if (sApplyMethod != null) {
Log.e(TAG, "apply: false"); Log.i(TAG, "apply: false");
sApplyMethod.invoke(editor); sApplyMethod.invoke(editor);
return false; return false;
} }

View File

@@ -870,56 +870,44 @@ public class Utils {
//所有app //所有app
String only_jgy_shortcut_list = Settings.System.getString(context.getContentResolver(), "only_jgy_shortcut_list"); String only_jgy_shortcut_list = Settings.System.getString(context.getContentResolver(), "only_jgy_shortcut_list");
Log.e("writeDisableUpdateList", now); Log.e("writeDisableUpdateList", now);
List<String> nowList = new ArrayList<>(); HashSet<String> nowList = new HashSet<>();
List<String> disallowList = new ArrayList<>(); HashSet<String> disallowList = new HashSet<>();
List<String> allList = new ArrayList<>(); HashSet<String> allList = new HashSet<>();
if (!TextUtils.isEmpty(now)) { 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)) { 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)) { 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", "nowList: " + nowList);
Log.e("writeDisableUpdateList", "upgrade_disallow: " + disallowList); Log.e("writeDisableUpdateList", "upgrade_disallow: " + disallowList);
Log.e("writeDisableUpdateList", "only_jgy_shortcut_list: " + allList); Log.e("writeDisableUpdateList", "only_jgy_shortcut_list: " + allList);
if (allList.size() != 0) { //合并
List<String> finalAllList = allList; allList.addAll(nowList);
nowList.removeIf(new Predicate<String>() {
@Override
public boolean test(String s) {
return !finalAllList.contains(s);
}
});
}
boolean writeSucceed = false;
for (String s : disallowList) { for (String s : disallowList) {
if (ApkUtils.isAvailable(context, s)) { if (ApkUtils.isAvailable(context, s)) {
if (nowList.remove(s)) { if (allList.remove(s)) {
Log.e("writeDisableUpdateList", "remove :" + s); Log.e("writeDisableUpdateList", "remove :" + s);
} else { } else {
Log.e("writeDisableUpdateList", "remove failed:" + s); Log.e("writeDisableUpdateList", "remove failed:" + s);
} }
//去掉已经安装的 //去掉已经安装的
} else { } else {
if (!nowList.contains(s)) { if (!allList.contains(s)) {
nowList.add(s); allList.add(s);
} }
//没有安装就加入进去 //没有安装就加入进去
//没有加入会导致安装后卸载不能再安装的情况 //没有加入会导致安装后卸载不能再安装的情况
} }
Log.e("writeDisableUpdateList", "nowList:" + nowList); Log.e("writeDisableUpdateList", "allList:" + allList);
}
for (String s : nowList) {
if (!allList.contains(s)) {
allList.add(s);
//没找到元素添加到白名单
}
} }
boolean writeSucceed = false;
if (allList.size() > 0) { if (allList.size() > 0) {
Log.e("writeDisableUpdateList", "allList:" + allList);
String list = String.join(",", allList); String list = String.join(",", allList);
writeSucceed = JGYUtils.putString(context.getContentResolver(), "qch_app_forbid", list); writeSucceed = JGYUtils.putString(context.getContentResolver(), "qch_app_forbid", list);
Log.e("writeDisableUpdateList", "qch_app_forbid:" + list); Log.e("writeDisableUpdateList", "qch_app_forbid:" + list);

View File

@@ -1,8 +1,11 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<color name="colorPrimary">#008577</color> <color name="colorPrimary">#FFFFFF</color>
<color name="colorPrimaryDark">#00574B</color> <color name="colorPrimaryDark">#FFFFFF</color>
<color name="colorAccent">#D81B60</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="white">#ffffff</color>
<color name="black">#000000</color> <color name="black">#000000</color>

View File

@@ -7,6 +7,17 @@
<item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item> <item name="colorAccent">@color/colorAccent</item>
</style> </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"> <style name="CustomDialog" parent="Theme.AppCompat.Dialog.Alert">
<!--背景颜色及和透明程度--> <!--背景颜色及和透明程度-->
<item name="android:windowBackground">@android:color/transparent</item> <item name="android:windowBackground">@android:color/transparent</item>