feat: 优化管控
This commit is contained in:
@@ -15,7 +15,7 @@ android {
|
||||
buildToolsVersion "29.0.3"
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 24
|
||||
minSdkVersion 26
|
||||
targetSdkVersion 29
|
||||
|
||||
multiDexEnabled true
|
||||
@@ -63,8 +63,8 @@ android {
|
||||
|
||||
official {
|
||||
flavorDimensions "default"
|
||||
versionCode 88
|
||||
versionName "3.4.8"
|
||||
versionCode 89
|
||||
versionName "3.4.9"
|
||||
applicationId "com.fuying.sn"
|
||||
|
||||
buildConfigField "String", "ROOT_URL", '"https://as.fuyingy.com/android/"'
|
||||
@@ -570,6 +570,22 @@ project.afterEvaluate {
|
||||
}
|
||||
}
|
||||
|
||||
tasks.register('deleteAppSourceWhiteList', Exec) {
|
||||
// Windows 系统使用 cmd /c, Mac/Linux 使用 sh -c
|
||||
if (System.properties['os.name'].toLowerCase().contains('windows')) {
|
||||
commandLine 'cmd', '/c', 'adb', 'shell', 'settings', 'delete', 'system', 'app_source_white_list'
|
||||
} else {
|
||||
commandLine 'adb', 'shell', 'settings', 'delete', 'system', 'app_source_white_list'
|
||||
}
|
||||
|
||||
// 即使命令执行失败也不中断构建(可选,防止因为没连手机导致编译失败)
|
||||
ignoreExitValue = true
|
||||
|
||||
doLast {
|
||||
println "ADB command executed: settings delete system app_source_white_list"
|
||||
}
|
||||
}
|
||||
|
||||
//preBuild {
|
||||
// doLast {
|
||||
// def imlFile = file(project.name + ".iml")
|
||||
|
||||
@@ -214,7 +214,7 @@
|
||||
|
||||
<provider
|
||||
android:name="androidx.core.content.FileProvider"
|
||||
android:authorities="com.fuying.sn.fileprovider"
|
||||
android:authorities="${applicationId}.fileprovider"
|
||||
android:exported="false"
|
||||
android:grantUriPermissions="true">
|
||||
<meta-data
|
||||
|
||||
@@ -449,13 +449,30 @@ public class RunningAppManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* 如果界面正在最近任务列表,有些app可能不会被清理
|
||||
* 强行返回主桌面,优化跳转逻辑以确保回到系统默认桌面。
|
||||
*/
|
||||
private void gotoLauncher() {
|
||||
Intent i = new Intent(Intent.ACTION_MAIN);
|
||||
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); //android123提示如果是服务里调用,必须加入new task标识
|
||||
i.addCategory(Intent.CATEGORY_HOME);
|
||||
mContext.startActivity(i);
|
||||
Intent intent = new Intent(Intent.ACTION_MAIN);
|
||||
intent.addCategory(Intent.CATEGORY_HOME);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
|
||||
|
||||
// 优先定位到当前的默认桌面应用,避免在存在多个桌面时弹出系统选择框
|
||||
PackageManager pm = mContext.getPackageManager();
|
||||
ResolveInfo resolveInfo = pm.resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY);
|
||||
if (resolveInfo != null && resolveInfo.activityInfo != null && !resolveInfo.activityInfo.packageName.equals("android")) {
|
||||
intent.setComponent(new ComponentName(resolveInfo.activityInfo.packageName, resolveInfo.activityInfo.name));
|
||||
}
|
||||
|
||||
try {
|
||||
mContext.startActivity(intent);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "gotoLauncher failed: " + e.getMessage());
|
||||
// 如果精准跳转失败,则使用基础的 Home Intent
|
||||
Intent fallback = new Intent(Intent.ACTION_MAIN);
|
||||
fallback.addCategory(Intent.CATEGORY_HOME);
|
||||
fallback.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
mContext.startActivity(fallback);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -3339,11 +3339,13 @@ public class NetInterfaceManager {
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<SnTimeControlInfo> snTimeControlInfoBaseResponse) {
|
||||
Log.e("getSnTimeControlObserver", "onNext: ");
|
||||
Log.e("getSnTimeControl", "onNext: " + snTimeControlInfoBaseResponse);
|
||||
if (snTimeControlInfoBaseResponse.code == 200) {
|
||||
SnTimeControlInfo snTimeControlInfo = snTimeControlInfoBaseResponse.data;
|
||||
TimeManager.getInstance().setSnTimeControlInfo(snTimeControlInfo);
|
||||
mMMKV.encode(TimeManager.SN_TIME_CONTROL_INFO, GsonUtils.toJSONString(snTimeControlInfo));
|
||||
} else if (snTimeControlInfoBaseResponse.code == 400) {
|
||||
Log.e("getSnTimeControl", "onNext: Too frequent");
|
||||
} else {
|
||||
TimeManager.getInstance().setSnTimeControlInfo(null);
|
||||
}
|
||||
@@ -3352,7 +3354,7 @@ public class NetInterfaceManager {
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getSnTimeControlObserver", "onError: ");
|
||||
Log.e("getSnTimeControl", "onError: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -570,6 +570,7 @@ public class PushManager {
|
||||
}
|
||||
|
||||
private void updateUserSettings() {
|
||||
Log.e(TAG, "updateUserSettings: " );
|
||||
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
@@ -15,7 +15,8 @@ import com.fuying.sn.service.main.MainService;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
|
||||
|
||||
public class BootReceiver extends BroadcastReceiver {
|
||||
public class
|
||||
BootReceiver extends BroadcastReceiver {
|
||||
private static final String TAG = "BootReceiver";
|
||||
public static final String BOOT_COMPLETED = "zuoyeos.action.BOOT_COMPLETED";
|
||||
private MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
|
||||
|
||||
@@ -722,13 +722,30 @@ public class JgyUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 如果界面正在最近任务列表,有些app可能不会被清理
|
||||
* 强行返回主桌面,优化跳转逻辑以确保回到系统默认桌面。
|
||||
*/
|
||||
public void gotoLauncher() {
|
||||
Intent i = new Intent(Intent.ACTION_MAIN);
|
||||
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); //android123提示如果是服务里调用,必须加入new task标识
|
||||
i.addCategory(Intent.CATEGORY_HOME);
|
||||
mContext.startActivity(i);
|
||||
Intent intent = new Intent(Intent.ACTION_MAIN);
|
||||
intent.addCategory(Intent.CATEGORY_HOME);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
|
||||
|
||||
// 优先定位到当前的默认桌面应用,避免在存在多个桌面时弹出系统选择框
|
||||
PackageManager pm = mContext.getPackageManager();
|
||||
ResolveInfo resolveInfo = pm.resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY);
|
||||
if (resolveInfo != null && resolveInfo.activityInfo != null && !resolveInfo.activityInfo.packageName.equals("android")) {
|
||||
intent.setComponent(new ComponentName(resolveInfo.activityInfo.packageName, resolveInfo.activityInfo.name));
|
||||
}
|
||||
|
||||
try {
|
||||
mContext.startActivity(intent);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "gotoLauncher failed: " + e.getMessage());
|
||||
// 如果精准跳转失败,则使用基础的 Home Intent
|
||||
Intent fallback = new Intent(Intent.ACTION_MAIN);
|
||||
fallback.addCategory(Intent.CATEGORY_HOME);
|
||||
fallback.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
mContext.startActivity(fallback);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user