bugfixes:增加应用禁用和卸载监听
This commit is contained in:
2025-05-27 16:34:33 +08:00
parent 7599d14897
commit 0e9f0e8394
15 changed files with 168 additions and 200 deletions

View File

@@ -48,10 +48,14 @@ import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Set;
public class SplashActivity extends AppCompatActivity {
private static String TAG = "SplashActivity";
private static final String TAG = "SplashActivity";
private MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
private Button bt_log;
private Button bt_stop;
@@ -96,7 +100,7 @@ public class SplashActivity extends AppCompatActivity {
JgyUtils.getModel();
Utils.getAndroiodScreenProperty(SplashActivity.this);
Log.e(TAG, "getOperators: " + NetworkUtils.getOperators(this));
Log.e(TAG, "PublicIP: " + MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE).decodeString(NetInterfaceManager.PublicIP, ""));
Log.e(TAG, "PublicIP: " + mMMKV.decodeString(NetInterfaceManager.PublicIP, ""));
NetInterfaceManager.GetWhois();
Log.e(TAG, "initView: " + NetworkUtils.getPhoneNumber(this));
FlowInfo flowInfo1 = GetFlowUtil.getAppFlowInfo(BuildConfig.APPLICATION_ID, this);
@@ -151,8 +155,8 @@ public class SplashActivity extends AppCompatActivity {
// boolean qch_force_app = Settings.System.putString(getContentResolver(), "qch_launcher_icon_app", "");
Log.i(TAG, "DebugTest: qch_launcher_icon_app:" + Settings.System.getString(getContentResolver(), "qch_launcher_icon_app"));
Log.i(TAG, "DebugTest: aole_hide_NavigationBar: " + Settings.System.getString(getContentResolver(), CommonConfig.AOLE_ACTION_HIDE_NAVIGATION_BAR));
String only_jgy_shortcut_list = Settings.System.getString(getContentResolver(), JGYActions.ACTION_JGY_SHORTCUTLIST);
Log.i(TAG, "debugTest: only_jgy_shortcut_list:" + only_jgy_shortcut_list);
Set<String> aole_all_app_white_list = mMMKV.decodeStringSet(CommonConfig.AOLE_ALL_APP_WHITE_LIST_KEY);
Log.i(TAG, "debugTest: aole_all_app_white_list:" + aole_all_app_white_list);
// String aole_app_forbid = Settings.System.getString(getContentResolver(), CommonConfig.AOLE_ACTION_APP_FORBID);
// if (!TextUtils.isEmpty(aole_app_forbid)) {
// Settings.System.putString(getContentResolver(), CommonConfig.AOLE_ACTION_APP_FORBID, aole_app_forbid + ",com.aoleyun.browser");

View File

@@ -170,4 +170,6 @@ public class CommonConfig {
public final static String AOLE_ACTION_DISABLE_APP = "aole_disable_app_list";
public final static String AOLE_ALL_APP_WHITE_LIST_KEY = "aole_all_app_white_list";
}

View File

@@ -20,11 +20,4 @@ public class JGYActions {
public final static String ACTION_STATUSBAR_STATUS = "jgy_statusbar_status";
/*
* 应用内部的数据
* */
//后台上传所有应用包名 将添加到桌面
// TODO: 2021/10/13
public final static String ACTION_JGY_SHORTCUTLIST = "only_jgy_shortcut_list";
}

View File

@@ -183,6 +183,8 @@ import io.reactivex.rxjava3.functions.Function7;
import io.reactivex.rxjava3.schedulers.Schedulers;
import io.reactivex.rxjava3.subjects.BehaviorSubject;
import okhttp3.Cache;
import okhttp3.ConnectionPool;
import okhttp3.Dispatcher;
import okhttp3.Interceptor;
import okhttp3.MediaType;
import okhttp3.MultipartBody;
@@ -335,7 +337,11 @@ public class NetInterfaceManager {
// builder.addNetworkInterceptor(new PostCacheInterceptor(mDiskLruCacheHelper));
// builder.addNetworkInterceptor(NetCacheInterceptor);
// builder.addInterceptor(OfflineCacheInterceptor);
Dispatcher dispatcher = new Dispatcher();
dispatcher.setMaxRequests(1);// 全局最大并发请求数设为1
dispatcher.setMaxRequestsPerHost(1);// 同一主机的并发请求数也设为1可选但更严格
builder.dispatcher(dispatcher);
builder.connectionPool(new ConnectionPool(20, 1, TimeUnit.SECONDS));
// 设置缓存文件路径
String cacheDirectory = mContext.getExternalCacheDir().getAbsolutePath() + "/OkHttpCache";
Cache cache = new Cache(new File(cacheDirectory), cacheSize);
@@ -1938,28 +1944,6 @@ public class NetInterfaceManager {
}
}
public void setSystemSetting(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
ConnectMode connectMode = ConnectMode.ONE_HOUR;
if (refresh) {
connectMode = ConnectMode.DEFAULT;
}
if (ConnectManager.getInstance().isNeedConnect(UrlAddress.GET_FIRMWARE, connectMode)) {
setSystemSetting(lifecycle, callback);
} else {
String jsonString = cacheHelper.getAsString(UrlAddress.GET_FIRMWARE);
//为 "" 是已经请求成功的
if (jsonString == null) {
setSystemSetting(lifecycle, callback);
} else {
Gson gson = new Gson();
Type type = new TypeToken<String>() {
}.getType();
callback.onComplete();
}
}
}
public void setSystemSetting(BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
getSystemSettingObservable()
.observeOn(Schedulers.io())
@@ -3234,31 +3218,6 @@ public class NetInterfaceManager {
});
}
public void getAppLimit(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
ConnectMode connectMode = ConnectMode.ONE_MINUTE;
if (refresh) {
connectMode = ConnectMode.DEFAULT;
}
if (ConnectManager.getInstance().isNeedConnect(UrlAddress.SET_WHITE_PACKAGE_LIST, connectMode)) {
getAppLimit(lifecycle, callback);
} else {
String jsonString = cacheHelper.getAsString(UrlAddress.SET_WHITE_PACKAGE_LIST);
//为 "" 是已经请求成功的
if (jsonString == null) {
getAppLimit(lifecycle, callback);
} else {
Gson gson = new Gson();
Type type = new TypeToken<AppLimit>() {
}.getType();
AppLimit appLimit = gson.fromJson(jsonString, type);
if (appLimit != null) {
Settings.System.putString(mContext.getContentResolver(), JGYActions.ACTION_JGY_SHORTCUTLIST, appLimit.getResult());
}
callback.onComplete();
}
}
}
public void getAppLimit(BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
Observable.zip(getAppLimitObservable(), getAdminAppObservable(), getBiFunction())
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
@@ -3325,15 +3284,11 @@ public class NetInterfaceManager {
public void onNext(@NonNull List<String> strings) {
Log.e("getAppLimitList", "onNext: " + strings);
if (strings.size() == 0) {
Settings.System.putString(mContext.getContentResolver(), JGYActions.ACTION_JGY_SHORTCUTLIST, "");
JgyUtils.getInstance().writeAppPackageList();
cacheHelper.put(UrlAddress.SET_WHITE_PACKAGE_LIST, "");
mMMKV.remove(CommonConfig.AOLE_ALL_APP_WHITE_LIST_KEY);
} else {
String pkgString = String.join(",", strings);
cacheHelper.put(UrlAddress.SET_WHITE_PACKAGE_LIST, GsonUtils.toJSONString(strings));
//开机图标 只记录后台传的包名
Log.e(TAG, "onNext: only_jgy_shortcut_list: " + Settings.System.putString(mContext.getContentResolver(), JGYActions.ACTION_JGY_SHORTCUTLIST, pkgString));
JgyUtils.getInstance().writeAppPackageList(pkgString);
mMMKV.encode(CommonConfig.AOLE_ALL_APP_WHITE_LIST_KEY, new HashSet<>(strings));
JgyUtils.getInstance().writeAppPackageList(strings);
JgyUtils.getInstance().deleteOtherApp();
}
}
@@ -3353,49 +3308,6 @@ public class NetInterfaceManager {
};
}
private Observer<BaseResponse<AppLimit>> getAppLimitObserver(onCompleteCallback callback) {
return new Observer<BaseResponse<AppLimit>>() {
@Override
public void onSubscribe(@NonNull Disposable d) {
Log.e("getAppLimit", "onSubscribe: ");
}
@Override
public void onNext(@NonNull BaseResponse<AppLimit> baseResponse) {
Log.e("getAppLimit", "onNext: " + baseResponse);
if (baseResponse.code == 200) {
AppLimit appLimit = baseResponse.data;
cacheHelper.put(UrlAddress.SET_WHITE_PACKAGE_LIST, GsonUtils.toJSONString(appLimit));
String result = appLimit.getResult();
//开机图标 只记录后台传的包名
Log.e(TAG, "onNext: only_jgy_shortcut_list: " + Settings.System.putString(mContext.getContentResolver(), JGYActions.ACTION_JGY_SHORTCUTLIST, result));
JgyUtils.getInstance().writeAppPackageList(result);
JgyUtils.getInstance().deleteOtherApp();
} else {
Settings.System.putString(mContext.getContentResolver(), JGYActions.ACTION_JGY_SHORTCUTLIST, "");
JgyUtils.getInstance().writeAppPackageList();
cacheHelper.put(UrlAddress.SET_WHITE_PACKAGE_LIST, "");
Log.e("getAppLimit", "onNext: " + baseResponse);
}
}
@Override
public void onError(@NonNull Throwable e) {
Log.e("getAppLimit", "onError: " + e.getMessage());
onComplete();
}
@Override
public void onComplete() {
Log.e("getAppLimit", "onComplete: ");
if (callback != null) {
callback.onComplete();
}
// getAllAppList();
}
};
}
/**
* 获取所有app详细信息
*/

View File

@@ -11,6 +11,7 @@ import android.util.Log;
import com.aoleyun.sn.comm.PackageNames;
import com.aoleyun.sn.network.NetInterfaceManager;
import com.aoleyun.sn.utils.ApkUtils;
import com.aoleyun.sn.utils.CmdUtil;
import com.aoleyun.sn.utils.JgyUtils;
import java.util.concurrent.TimeUnit;
@@ -39,14 +40,13 @@ public class NewAppReceiver extends BroadcastReceiver {
public void onReceive(Context context, Intent intent) {
mContext = context;
String action = intent.getAction();
JgyUtils.getInstance().cleanLauncherCache();
Log.e(TAG, "onReceive: " + "action = " + action);
String state;
if (TextUtils.isEmpty(action)) {
Log.e(TAG, "onReceive: " + "action is empty ");
return;
}
String packageName = intent.getDataString().replace("package:", "");
String state;
switch (action) {
case Intent.ACTION_PACKAGE_ADDED:
state = "安装了:";
@@ -57,8 +57,15 @@ public class NewAppReceiver extends BroadcastReceiver {
state = "重装了:";
break;
case Intent.ACTION_PACKAGE_REMOVED:
JgyUtils.getInstance().checkAoleyunApp();
state = "卸载了:";
break;
case Intent.ACTION_PACKAGE_CHANGED:
// 判断是禁用还是启用
boolean isDisabled = ApkUtils.isDisable(mContext, packageName);
JgyUtils.getInstance().checkAoleyunApp();
state = (isDisabled ? "禁用:" : "启用:");
break;
default:
state = "未知:";
break;
@@ -134,7 +141,7 @@ public class NewAppReceiver extends BroadcastReceiver {
Observable.create((ObservableEmitter<String> emitter) -> {
launcherListener = emitter::onNext;
})
.throttleFirst(10, TimeUnit.SECONDS)
.throttleLast(10, TimeUnit.SECONDS)
//这句很关键这是RxJava中的操作符在规定时间内观察者不在接收被观察者发送的事件
.subscribe(new Observer<String>() {
@Override

View File

@@ -257,6 +257,7 @@ public class GuardService extends Service {
filter.addAction(Intent.ACTION_PACKAGE_ADDED);
filter.addAction(Intent.ACTION_PACKAGE_REPLACED);
filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
filter.addAction(Intent.ACTION_PACKAGE_CHANGED);
filter.addDataScheme("package");
registerReceiver(mNewAppReceiver, filter);
}

View File

@@ -335,7 +335,7 @@ public class MainSPresenter implements MainSContact.Presenter {
@Override
public void getAppLimit() {
NetInterfaceManager.getInstance()
.getAppLimit(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
.getAppLimit( getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
@Override
public void onComplete() {
mView.getAppLimitFinish();
@@ -492,7 +492,7 @@ public class MainSPresenter implements MainSContact.Presenter {
@Override
public void getSystemSetting() {
NetInterfaceManager.getInstance()
.setSystemSetting(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
.setSystemSetting( getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
@Override
public void onComplete() {
mView.getSystemSettingFinish();

View File

@@ -557,6 +557,7 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
.throttleLast(30, TimeUnit.SECONDS)
// .throttleLast(3, TimeUnit.SECONDS)
.subscribe(killObserver);
JgyUtils.getInstance().checkAoleyunApp();
}
@Override

View File

@@ -725,6 +725,18 @@ public class ApkUtils {
return isAvailable(context, getPackageName(context, file.getAbsolutePath()));
}
public static boolean isDisable(Context context, String pkg) {
if (!isAvailable(context, pkg)) {
return true;
}
PackageManager pm = context.getPackageManager();
if (pm.getApplicationEnabledSetting(pkg) == PackageManager.COMPONENT_ENABLED_STATE_DISABLED) {
return true;
} else {
return false;
}
}
/**
* 根据文件路径获取包名
*/
@@ -1354,53 +1366,7 @@ public class ApkUtils {
}
public static void addShortcut(Context context) {
String result = Settings.System.getString(context.getContentResolver(), JGYActions.ACTION_JGY_SHORTCUTLIST);
if (TextUtils.isEmpty(result)) {
Settings.System.putString(context.getContentResolver(), "qch_launcher_icon_app", "");
return;
}
Log.e("addShortcut", "addShortcut: " + result);
String[] stringList = result.split(",");
HashSet<String> packages = new HashSet<>(Arrays.asList(stringList));
String romapps = Settings.System.getString(context.getContentResolver(), "jgy_customromapp");
Log.e(TAG, "addShortcut: romapps: " + romapps);
HashSet<String> appSet = new HashSet<>();
if (!TextUtils.isEmpty(romapps)) {
appSet = new HashSet<>(Arrays.asList(romapps.split(",")));
packages.addAll(appSet);
}
packages.removeIf(new Predicate<String>() {
@Override
public boolean test(String s) {
return TextUtils.isEmpty(s);
}
});
StringBuilder installedListBuilder = new StringBuilder();
for (String s : packages) {
if (PackageNames.DEVICE_INFO.equals(s) || PackageNames.APPSTORE.equals(s)) {
continue;
}
if (ApkUtils.isSystemApp(context, s)) {
if (!appSet.contains(s)) {
continue;
}
}
if (!ApkUtils.isAvailable(context, s)) {
continue;
}
// ApkUtils.getStartActivityName(context, s);
if (installedListBuilder.length() > 0) {
installedListBuilder.append(",");
}
installedListBuilder.append(s);
Log.i("addShortcut", "packages: " + s);
}
String installedList = installedListBuilder.toString();
boolean aole_force_app = Settings.System.putString(context.getContentResolver(), "qch_launcher_icon_app", installedList);
// String old = Settings.System.getString(context.getContentResolver(), "qch_launcher_icon_app");
// Log.e("addShortcut", old);
Log.e("addShortcut", "installedList:" + installedList);
Log.e("addShortcut", "putstring:" + aole_force_app);
}
private static final Set<String> AoleyunOSApp = new HashSet<String>() {{
@@ -1431,6 +1397,25 @@ public class ApkUtils {
}};
public static final HashSet<String> G30_APP = new HashSet<String>() {{
this.add("com.android.browser");
this.add("com.android.calendar");
this.add("com.android.contacts");
this.add("com.android.dialer");
this.add("com.android.gallery3d");
this.add("com.android.mms");
this.add("com.android.music");
this.add("com.android.documentsui");
this.add("com.android.fmradio");
this.add("com.android.inputmethod.latin");
this.add("com.android.stk");
this.add("com.eduyun.app.factory.ykt");
this.add("com.huawei.appmarket");
this.add("com.qiyi.video");
this.add("com.ss.android.ugc.aweme");
this.add("com.tencent.mm");
}};
public static String getRunningAppInfo(Context context) {
MMKV mmkv = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
@@ -1442,11 +1427,11 @@ public class ApkUtils {
ArrayList<UploadAppInfo> appList = new ArrayList<>();
List<PackageInfo> packages = context.getPackageManager().getInstalledPackages(0);
String topPkg = ForegroundAppUtil.getForegroundPackageName(context);
Log.e(TAG, "getRunningAppInfo: " + topPkg);
Log.e(TAG, "getRunningAppInfo: topPkg = " + topPkg);
for (PackageInfo packageInfo : packages) {
String packageName = packageInfo.packageName;
//排除出厂自带app
if (factoryapp.contains(packageName)) {
if (factoryapp.contains(packageName) && !G30_APP.contains(packageName)) {
continue;
}
//排除所有系统应用,不显示
@@ -1457,21 +1442,23 @@ public class ApkUtils {
&& !dongwa.contains(packageName)
&& !yixuepaiApp.contains(packageName)
&& !mJxwApp.contains(packageName)
&& !G30_APP.contains(packageName)
&& !allPkgSet.contains(packageName)
) {
Log.e(TAG, "getRunningAppInfo: continue = " + packageName);
Log.e(TAG, "getRunningAppInfo system: continue = " + packageName);
continue;
}
} else {
//排除预装可以卸载的应用
if (canremove_systemapp.contains(packageName)) {
Log.e(TAG, "getRunningAppInfo user: continue = " + packageName);
continue;
}
}
UploadAppInfo uploadAppInfo = new UploadAppInfo();
uploadAppInfo.setApp_name(packageInfo.applicationInfo.loadLabel(context.getPackageManager()).toString());
uploadAppInfo.setPackage_name(packageName);
Log.e("getRunningAppInfo", "getRunningAppInfo:" + packageName);
Log.e("getRunningAppInfo", "add:" + packageName);
String firstInstallTime = TimeUtils.transferLongToDate(packageInfo.lastUpdateTime);
uploadAppInfo.setInstall_time(firstInstallTime);
uploadAppInfo.setVersionCode(String.valueOf(packageInfo.versionCode));

View File

@@ -25,10 +25,7 @@ public class BootManager {
}
private void sendLauncherIcon() {
String packageList = Settings.System.getString(mContext.getContentResolver(), JGYActions.ACTION_JGY_SHORTCUTLIST);
if (TextUtils.isEmpty(packageList)) {
Settings.System.putString(mContext.getContentResolver(), "qch_launcher_icon_app", "");
}
}
private void timeControlUpdate() {

View File

@@ -1364,6 +1364,10 @@ public class JgyUtils {
SysSettingUtils.setDisableSetting(mContext);
SPUtils.put(mContext, JGYActions.ACTION_STATUSBAR_STATUS, "");
} else {
if (JgyUtils.getInstance().getAppPlatform().equals(JgyUtils.ZR6016Tag)) {
Log.e(TAG, "SettingSysData: ZR6016Tag");
SysSettingUtils.setBluetooth(mContext, 0);
}
SysSettingUtils.setSystemSetting(mContext, data);
}
}
@@ -1441,14 +1445,15 @@ public class JgyUtils {
}
@SuppressLint("NewApi")
public void writeAppPackageList(String packageList) {
public void writeAppPackageList(List<String> pkgs) {
if (isUnlocked(mContext)) {
addAppInstallWhiteList(new ArrayList<>());
setAppRestriction(0);
return;
}
ApkUtils.addShortcut(mContext);
HashSet<String> pkgSet = new HashSet<>(Arrays.asList(packageList.split(",")));
HashSet<String> pkgSet = new HashSet<>(defaultPackages);
pkgSet.addAll(pkgs);
pkgSet.addAll(getWhitePkgList());
pkgSet.removeIf(TextUtils::isEmpty);
String aole_app_forbid = String.join(",", pkgSet);
@@ -1701,29 +1706,23 @@ public class JgyUtils {
}
Log.e(TAG, "deleteOtherApp: " + "start");
String[] result_white = new String[]{};
String[] result_forbid = new String[]{};
//获取后台应用白名单
String only_jgy_shortcut_list = Settings.System.getString(crv, JGYActions.ACTION_JGY_SHORTCUTLIST);
if (!TextUtils.isEmpty(only_jgy_shortcut_list)) {
result_white = only_jgy_shortcut_list.split(",");
}
Set<String> allAppWhiteSet = mMMKV.decodeStringSet(CommonConfig.AOLE_ALL_APP_WHITE_LIST_KEY, new HashSet<>());
Log.e("deleteOtherApp", "allAppWhiteSet:" + allAppWhiteSet);
List<String> resulWhitetList = new ArrayList<>(defaultPackages);
resulWhitetList.addAll(allAppWhiteSet);
//获取可以被安装的包名
String aole_app_forbid = Settings.System.getString(crv, CommonConfig.AOLE_ACTION_APP_FORBID);
if (!TextUtils.isEmpty(aole_app_forbid)) {
result_forbid = aole_app_forbid.split(",");
}
Log.e("deleteOtherApp", "only_jgy_shortcut_list:" + only_jgy_shortcut_list);
Log.e("deleteOtherApp", "aole_app_forbid:" + aole_app_forbid);
if (!TextUtils.isEmpty(aole_app_forbid)) {
List<String> result_forbid = new ArrayList<>(Arrays.asList(aole_app_forbid.split(",")));
resulWhitetList.addAll(result_forbid);
}
List<String> resulWhitetList = new ArrayList<>(Arrays.asList(result_white));
List<String> resulForbidtList = new ArrayList<>(Arrays.asList(result_forbid));
resulWhitetList.addAll(resulForbidtList);
HashSet<String> allWhitePkg = new HashSet<>(resulWhitetList);
List<String> installedPackageList = ApkUtils.queryFilterAppInfo(mContext);
Log.e("deleteOtherApp", "installedPackageList:" + installedPackageList.toString());
if (allWhitePkg.size() > 0) {
if (resulWhitetList.size() > 0) {
for (final String packageName : installedPackageList) {
if (ApkUtils.isSystemApp(mContext, packageName)) {
Log.e("deleteOtherApp", "is systemApp:" + packageName);
@@ -1748,7 +1747,7 @@ public class JgyUtils {
) {
continue;
}
if (!allWhitePkg.contains(packageName)) {
if (!resulWhitetList.contains(packageName)) {
ApkUtils.UninstallAPP(mContext, packageName);
Log.e("deleteOtherApp", "uninstall apkName:" + packageName);
}
@@ -2039,22 +2038,17 @@ public class JgyUtils {
}
}
private static int changeNum(int status) {
return status == 0 ? 1 : 0;
}
/**
* @param state 1打开 0关闭
*/
public void setDeveloperOptions(int state) {
int newStatu = changeNum(state);
int oldStatu = Settings.System.getInt(crv, CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, 1);
if (oldStatu == newStatu) {
int oldStatu = Settings.System.getInt(crv, CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, 0);
if (oldStatu == state) {
Log.e(TAG, "setDeveloperOptions: oldStatu = " + oldStatu + " no changed");
}
Log.e(TAG, "getDeveloper: state = " + state);
//这个需要反着来
Settings.System.putInt(crv, CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, newStatu);
Settings.System.putInt(crv, CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, state);
Log.e(TAG, "setDeveloperOptions: DEVELOPMENT_SETTINGS_ENABLED = " + Settings.Global.getInt(crv, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0));
Log.e(TAG, "setDeveloperOptions: ADB_ENABLED = " + Settings.Global.getInt(crv, Settings.Global.ADB_ENABLED, 0));
@@ -2203,6 +2197,7 @@ public class JgyUtils {
mContext.startActivity(intent);
}
@Deprecated
public void cleanLauncherCache() {
Log.e(TAG, "cleanLauncherCache: Start");
int cleaned = (int) SPUtils.get(mContext, "fristcleanLauncherCache", 0);
@@ -3524,4 +3519,48 @@ public class JgyUtils {
|| "G11J".equals(Build.MODEL);
}
public void checkAoleyunApp() {
boolean availableSn = ApkUtils.isAvailable(mContext, "com.aoleyun.sn");
boolean disableSn = ApkUtils.isDisable(mContext, "com.aoleyun.sn");
Log.e(TAG, "checkAoleyunApp: sn isAvailable = " + availableSn);
if (!availableSn || disableSn) {
CmdUtil.Result installResult = CmdUtil.execute("cmd package install-existing com.aoleyun.sn");
Log.e(TAG, "checkAoleyunApp: sn install = " + installResult);
CmdUtil.Result enableResult = CmdUtil.execute("pm enable com.aoleyun.sn");
Log.e(TAG, "checkAoleyunApp: sn enable = " + enableResult);
}
boolean availableAudos = ApkUtils.isAvailable(mContext, "com.aoleyun.audos");
boolean disableAudos = ApkUtils.isDisable(mContext, "com.aoleyun.audos");
Log.e(TAG, "checkAoleyunApp: audos isAvailable = " + availableAudos);
if (!availableAudos || disableAudos) {
CmdUtil.Result installResult = CmdUtil.execute("cmd package install-existing com.aoleyun.audos");
Log.e(TAG, "checkAoleyunApp: audos install = " + installResult);
CmdUtil.Result enableResult = CmdUtil.execute("pm enable com.aoleyun.audos");
Log.e(TAG, "checkAoleyunApp: audos enable = " + enableResult);
}
boolean availableOs = ApkUtils.isAvailable(mContext, "com.aoleyun.os");
boolean disableOs = ApkUtils.isDisable(mContext, "com.aoleyun.os");
Log.e(TAG, "checkAoleyunApp: os isAvailable = " + availableOs);
if (!availableOs || disableOs) {
CmdUtil.Result installResult = CmdUtil.execute("cmd package install-existing com.aoleyun.os");
Log.e(TAG, "checkAoleyunApp: os install = " + installResult);
CmdUtil.Result enableResult = CmdUtil.execute("pm enable com.aoleyun.os");
Log.e(TAG, "checkAoleyunApp: os enable = " + enableResult);
}
// boolean availableAppstore = ApkUtils.isAvailable(mContext, "com.aoleyun.appstore");
// boolean disableAppstore = ApkUtils.isDisable(mContext, "com.aoleyun.audos");
// Log.e(TAG, "checkAoleyunApp: appstore isAvailable = " + availableAppstore);
// if (!availableAppstore || disableAppstore) {
// CmdUtil.Result installResult = CmdUtil.execute("cmd package install-existing com.aoleyun.appstore");
// Log.e(TAG, "checkAoleyunApp: appstore install = " + installResult);
// CmdUtil.Result enableResult = CmdUtil.execute("pm enable com.aoleyun.appstore");
// Log.e(TAG, "checkAoleyunApp: appstore enable = " + enableResult);
// }
}
}

View File

@@ -84,6 +84,7 @@ public class SysSettingUtils {
setUSBstate(context, 1);
if (JgyUtils.getInstance().getAppPlatform().equals(JgyUtils.YXPD1TAG)
|| JgyUtils.getInstance().getAppPlatform().equals(JgyUtils.C2Tag)
|| JgyUtils.getInstance().getAppPlatform().equals(JgyUtils.ZR6016Tag)
) {
setBluetooth(context, 0);
} else {
@@ -297,7 +298,7 @@ public class SysSettingUtils {
* @param context
* @param state 1关闭 0打开
*/
private static void setBluetooth(Context context, int state) {
public static void setBluetooth(Context context, int state) {
Log.e(TAG, "setBluetooth: state = " + state);
MMKV mmkv = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);