style: 修改更新界面描述

This commit is contained in:
2026-07-13 16:19:59 +08:00
parent e127939dda
commit 132000b4e1
8 changed files with 243 additions and 243 deletions

View File

@@ -18,8 +18,8 @@ android {
defaultConfig { defaultConfig {
applicationId "com.aoleyun.sn" applicationId "com.aoleyun.sn"
versionCode 228 versionCode 229
versionName "1.6.0629-2" versionName "1.6.0711"
//There are no CERT files because If the mini sdk version is 23+, the AGP will ignore the V1 scheme signature. //There are no CERT files because If the mini sdk version is 23+, the AGP will ignore the V1 scheme signature.
minSdkVersion 24 minSdkVersion 24
@@ -776,6 +776,7 @@ dependencies {
//Google //Google
implementation 'com.google.code.gson:gson:2.9.0' implementation 'com.google.code.gson:gson:2.9.0'
implementation 'com.google.zxing:core:3.5.0' implementation 'com.google.zxing:core:3.5.0'
// implementation 'com.google.mlkit:face-detection:16.1.7'
//图片加载框架 //图片加载框架
implementation 'com.github.bumptech.glide:glide:4.13.2' implementation 'com.github.bumptech.glide:glide:4.13.2'
annotationProcessor 'com.github.bumptech.glide:compiler:4.13.2' annotationProcessor 'com.github.bumptech.glide:compiler:4.13.2'

View File

@@ -214,7 +214,7 @@
android:name=".activity.update.UpdateActivity" android:name=".activity.update.UpdateActivity"
android:exported="true" android:exported="true"
android:icon="@drawable/com_aoleyun_update" android:icon="@drawable/com_aoleyun_update"
android:label="检查更新" android:label="策略更新"
android:launchMode="singleInstance"> android:launchMode="singleInstance">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />

View File

@@ -6,10 +6,7 @@ import android.graphics.drawable.Drawable;
import android.os.Environment; import android.os.Environment;
import android.util.Log; import android.util.Log;
import com.aoleyun.sn.comm.CommonConfig;
import com.jakewharton.disklrucache.DiskLruCache; import com.jakewharton.disklrucache.DiskLruCache;
import com.tencent.mmkv.BuildConfig;
import com.tencent.mmkv.MMKV;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
@@ -20,29 +17,28 @@ import java.io.ByteArrayOutputStream;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.ObjectInputStream; import java.io.ObjectInputStream;
import java.io.ObjectOutputStream; import java.io.ObjectOutputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.io.OutputStreamWriter; import java.io.OutputStreamWriter;
import java.io.Serializable; import java.io.Serializable;
import java.nio.charset.StandardCharsets;
/** /**
* 磁盘缓存帮助类 * 磁盘缓存帮助类
* https://www.cnblogs.com/aademeng/articles/6817058.html
*/ */
public class CacheHelper { public class CacheHelper {
private static final String TAG = "CacheHelper"; private static final String TAG = "DiskLruCacheHelper";
private MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
private static final String DIR_NAME = "diskCache"; private static final String DIR_NAME = "diskCache";
private static final int MAX_COUNT = 1024 * 1024 * 1024; private static final int MAX_COUNT = 1024 * 1024 * 1024;
private static final int DEFAULT_APP_VERSION = 1; private static final int DEFAULT_APP_VERSION = 1;
private DiskLruCache mDiskLruCache; private DiskLruCache mDiskLruCache;
private Context mContext;
public CacheHelper(Context context) { public CacheHelper(Context context) {
this.mContext = context;
mDiskLruCache = generateCache(context, DIR_NAME, MAX_COUNT); mDiskLruCache = generateCache(context, DIR_NAME, MAX_COUNT);
} }
@@ -75,9 +71,8 @@ public class CacheHelper {
int appVersion = context == null ? DEFAULT_APP_VERSION : Utils.getAppVersion(context); int appVersion = context == null ? DEFAULT_APP_VERSION : Utils.getAppVersion(context);
DiskLruCache diskLruCache = null;
try { try {
diskLruCache = DiskLruCache.open( return DiskLruCache.open(
dir, dir,
appVersion, appVersion,
DEFAULT_APP_VERSION, DEFAULT_APP_VERSION,
@@ -85,13 +80,12 @@ public class CacheHelper {
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
return diskLruCache; return null;
} }
private DiskLruCache generateCache(Context context, String dirName, int maxCount) { private DiskLruCache generateCache(Context context, String dirName, int maxCount) {
DiskLruCache diskLruCache = null;
try { try {
diskLruCache = DiskLruCache.open( return DiskLruCache.open(
getDiskCacheDir(context, dirName), getDiskCacheDir(context, dirName),
Utils.getAppVersion(context), Utils.getAppVersion(context),
DEFAULT_APP_VERSION, DEFAULT_APP_VERSION,
@@ -99,7 +93,7 @@ public class CacheHelper {
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
return diskLruCache; return null;
} }
// ======================================= // =======================================
@@ -107,9 +101,7 @@ public class CacheHelper {
// ======================================= // =======================================
public void put(String key, String value) { public void put(String key, String value) {
Log.e(TAG, "put: " + key); Log.e(TAG, "put: key = " + key + " value = " + value);
mMMKV.encode(key + "_time", System.currentTimeMillis());
mMMKV.encode(key + "_mmkv", value);
DiskLruCache.Editor edit = null; DiskLruCache.Editor edit = null;
BufferedWriter bw = null; BufferedWriter bw = null;
@@ -119,15 +111,16 @@ public class CacheHelper {
return; return;
} }
OutputStream os = edit.newOutputStream(0); OutputStream os = edit.newOutputStream(0);
bw = new BufferedWriter(new OutputStreamWriter(os)); bw = new BufferedWriter(new OutputStreamWriter(os, StandardCharsets.UTF_8));
bw.write(value); bw.write(value);
edit.commit();//write CLEAN edit.commit();//write CLEAN
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
Log.e(TAG, "put: " + e.getMessage()); Log.e(TAG, "put: " + e.getMessage());
try { try {
//s if (edit != null) {
edit.abort();//write REMOVE edit.abort();//write REMOVE
}
} catch (IOException e1) { } catch (IOException e1) {
e1.printStackTrace(); e1.printStackTrace();
Log.e(TAG, "put: " + e1.getMessage()); Log.e(TAG, "put: " + e1.getMessage());
@@ -148,30 +141,27 @@ public class CacheHelper {
Log.e(TAG, "getAsString: " + key); Log.e(TAG, "getAsString: " + key);
InputStream inputStream = null; InputStream inputStream = null;
try { try {
//write READ
inputStream = get(key); inputStream = get(key);
if (inputStream == null) { if (inputStream == null) {
return mMMKV.decodeString(key + "_mmkv", null); return null;
} }
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
int len = 0; InputStreamReader isr = new InputStreamReader(inputStream, StandardCharsets.UTF_8);
byte[] buf = new byte[128]; char[] buf = new char[1024];
while ((len = inputStream.read(buf)) != -1) { int len;
sb.append(new String(buf, 0, len)); while ((len = isr.read(buf)) != -1) {
} sb.append(buf, 0, len);
if (BuildConfig.DEBUG) {
Log.e(TAG, "getAsString: " + sb.toString());
} }
return sb.toString(); return sb.toString();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
Log.e(TAG, "getAsString: " + e.getMessage()); Log.e(TAG, "getAsString: " + e.getMessage());
} finally {
if (inputStream != null) { if (inputStream != null) {
try { try {
inputStream.close(); inputStream.close();
} catch (IOException e1) { } catch (IOException e) {
e1.printStackTrace(); e.printStackTrace();
Log.e(TAG, "getAsString: " + e1.getMessage());
} }
} }
} }
@@ -205,9 +195,9 @@ public class CacheHelper {
public JSONArray getAsJSONArray(String key) { public JSONArray getAsJSONArray(String key) {
String JSONString = getAsString(key); String JSONString = getAsString(key);
if (JSONString == null) return null;
try { try {
JSONArray obj = new JSONArray(JSONString); return new JSONArray(JSONString);
return obj;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return null; return null;
@@ -239,7 +229,9 @@ public class CacheHelper {
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
try { try {
if (editor != null) {
editor.abort();//write REMOVE editor.abort();//write REMOVE
}
} catch (IOException e1) { } catch (IOException e1) {
e1.printStackTrace(); e1.printStackTrace();
} }
@@ -262,8 +254,8 @@ public class CacheHelper {
if (is == null) { if (is == null) {
return null; return null;
} }
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try { try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] buf = new byte[256]; byte[] buf = new byte[256];
int len = 0; int len = 0;
while ((len = is.read(buf)) != -1) { while ((len = is.read(buf)) != -1) {
@@ -272,6 +264,12 @@ public class CacheHelper {
res = baos.toByteArray(); res = baos.toByteArray();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} finally {
try {
is.close();
} catch (IOException e) {
e.printStackTrace();
}
} }
return res; return res;
} }
@@ -295,7 +293,9 @@ public class CacheHelper {
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
try { try {
if (editor != null) {
editor.abort(); editor.abort();
}
} catch (IOException e1) { } catch (IOException e1) {
e1.printStackTrace(); e1.printStackTrace();
} }
@@ -371,8 +371,8 @@ public class CacheHelper {
// ======================================= // =======================================
public boolean remove(String key) { public boolean remove(String key) {
try { try {
key = Utils.hashKeyForDisk(key); String hashKey = Utils.hashKeyForDisk(key);
return mDiskLruCache.remove(key); return mDiskLruCache.remove(hashKey);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
@@ -385,7 +385,6 @@ public class CacheHelper {
public void delete() throws IOException { public void delete() throws IOException {
mDiskLruCache.delete(); mDiskLruCache.delete();
mMMKV.clearAll();
} }
public void flush() throws IOException { public void flush() throws IOException {
@@ -419,12 +418,12 @@ public class CacheHelper {
//basic editor //basic editor
public DiskLruCache.Editor editor(String key) { public DiskLruCache.Editor editor(String key) {
try { try {
key = Utils.hashKeyForDisk(key); String hashKey = Utils.hashKeyForDisk(key);
//wirte DIRTY //wirte DIRTY
DiskLruCache.Editor edit = mDiskLruCache.edit(key); DiskLruCache.Editor edit = mDiskLruCache.edit(hashKey);
//edit maybe null :the entry is editing //edit maybe null :the entry is editing
if (edit == null) { if (edit == null) {
Log.w(TAG, "the entry spcified key:" + key + " is editing by other . "); Log.w(TAG, "the entry spcified key:" + hashKey + " is editing by other . ");
} }
return edit; return edit;
} catch (IOException e) { } catch (IOException e) {
@@ -461,19 +460,17 @@ public class CacheHelper {
// ======================================= // =======================================
private File getDiskCacheDir(Context context, String uniqueName) { private File getDiskCacheDir(Context context, String uniqueName) {
String cachePath; File cacheDir;
if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState()) if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())
|| !Environment.isExternalStorageRemovable()) { || !Environment.isExternalStorageRemovable()) {
if (context.getExternalCacheDir() != null) { cacheDir = context.getExternalCacheDir();
cachePath = context.getExternalCacheDir().getPath(); if (cacheDir == null) {
} else if (context.getExternalFilesDir("cache") != null) { cacheDir = context.getCacheDir();
cachePath = context.getExternalFilesDir("cache").getPath();
} else {
cachePath = context.getCacheDir().getPath();
} }
} else { } else {
cachePath = context.getCacheDir().getPath(); cacheDir = context.getCacheDir();
} }
return new File(cachePath + File.separator + uniqueName); return new File(cacheDir, uniqueName);
} }
} }

View File

@@ -644,13 +644,13 @@ public class NetInterfaceManager {
public Observable<BaseResponse<Batch>> getSnTagObservable() { public Observable<BaseResponse<Batch>> getSnTagObservable() {
return withCache(schedule(getDevicesStatusApi().getSnTag(Utils.getSerial(mContext))), return withCache(schedule(getDevicesStatusApi().getSnTag(Utils.getSerial(mContext))),
UrlAddress.GET_DEVICES_TAGS, UrlAddress.GET_DEVICES_TAGS,
10 * CACHE_EXPIRE_ONE_MINUTE); CACHE_EXPIRE_ONE_MINUTE);
} }
public Observable<BaseResponse<PushTag>> getPushTagObservable() { public Observable<BaseResponse<PushTag>> getPushTagObservable() {
return withCache(schedule(getDevicesStatusApi().getPushTag(Utils.getSerial(mContext), 1)), return withCache(schedule(getDevicesStatusApi().getPushTag(Utils.getSerial(mContext), 1)),
UrlAddress.GET_PUSH_TAG, UrlAddress.GET_PUSH_TAG,
10 * CACHE_EXPIRE_ONE_MINUTE); CACHE_EXPIRE_ONE_MINUTE);
} }
public Observable<BaseResponse<ScreenLockState>> getScreenLockObservable() { public Observable<BaseResponse<ScreenLockState>> getScreenLockObservable() {

View File

@@ -1,5 +1,7 @@
package com.aoleyun.sn.utils; package com.aoleyun.sn.utils;
import static android.app.ActivityManager.RECENT_IGNORE_UNAVAILABLE;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.app.ActivityManager; import android.app.ActivityManager;
import android.app.ActivityManagerNative; import android.app.ActivityManagerNative;
@@ -125,8 +127,6 @@ import io.reactivex.rxjava3.core.ObservableOnSubscribe;
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 static android.app.ActivityManager.RECENT_IGNORE_UNAVAILABLE;
public class JgyUtils { public class JgyUtils {
private static final String TAG = "JgyUtils"; private static final String TAG = "JgyUtils";
@@ -1804,9 +1804,11 @@ public class JgyUtils {
if (ApkUtils.canremove_systemapp.contains(packageName)) { if (ApkUtils.canremove_systemapp.contains(packageName)) {
continue; continue;
} }
if ("K101".equals(Build.MODEL) || "AS001".equals(Build.MODEL)) {
if (ApkUtils.aihuaApp.contains(packageName)) { if (ApkUtils.aihuaApp.contains(packageName)) {
continue; continue;
} }
}
if (ApkUtils.mJxwApp.contains(packageName)) { if (ApkUtils.mJxwApp.contains(packageName)) {
continue; continue;
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

@@ -41,7 +41,7 @@
android:id="@+id/textView5" android:id="@+id/textView5"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="应用更新检测" android:text="管控策略检测"
android:textColor="@color/black" android:textColor="@color/black"
android:textSize="@dimen/sp_14" android:textSize="@dimen/sp_14"
android:textStyle="bold" android:textStyle="bold"

View File

@@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules. // Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript { buildscript {
ext.kotlin_version = '2.3.21' ext.kotlin_version = '2.4.0'
repositories { repositories {
google() google()