refactor(utils): 抽取输入法切换工具方法并增强 AndroidSettingsWriter 多版本兼容
- 移除 DebugActivity 与 NetInterfaceManager 中重复的 getInputMethodId,统一改用 JgyUtils 的输入法组件名获取与广播发送 - 输入法设置逻辑按全志/非全志分支处理,并修复 default_IME 为空时的兜底切换 - AndroidSettingsWriter 新增服务端 GET 校验与 4/5/6 参 call 重载适配,提升跨版本写入可靠性 - AoleyunActivityController 跳过对自身应用的启动拦截 - 新增 JxwApp2026 应用集合并纳入应用库判断,RemoveTask 增加 context 空判断
This commit is contained in:
1 parent
17837a1ad3
commit
1ebe19def9
11 files changed
+326
-191
No files matched your search
+2
-2
@@ -18,8 +18,8 @@ android {
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.aoleyun.sn"
|
||||
versionCode 257
|
||||
versionName "1.6.1027"
|
||||
versionCode 259
|
||||
versionName "1.6.1105"
|
||||
|
||||
//There are no CERT files because If the mini sdk version is 23+, the AGP will ignore the V1 scheme signature.
|
||||
minSdkVersion 24
|
||||
|
||||
@@ -24,6 +24,7 @@ import androidx.core.graphics.drawable.IconCompat;
|
||||
import com.aoleyun.sn.BuildConfig;
|
||||
import com.aoleyun.sn.R;
|
||||
import com.aoleyun.sn.base.mvvm.BaseMvvmActivity;
|
||||
import com.aoleyun.sn.comm.CommonConfig;
|
||||
import com.aoleyun.sn.databinding.ActivityDebugBinding;
|
||||
import com.aoleyun.sn.manager.AllwinnerCubeMdmManager;
|
||||
import com.aoleyun.sn.receiver.ShortcutReceiver;
|
||||
@@ -33,9 +34,7 @@ import com.aoleyun.sn.utils.JgyUtils;
|
||||
import com.hjq.toast.Toaster;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
public class DebugActivity extends BaseMvvmActivity<DebugViewModel, ActivityDebugBinding> {
|
||||
@@ -96,18 +95,6 @@ public class DebugActivity extends BaseMvvmActivity<DebugViewModel, ActivityDebu
|
||||
startActivity(i);
|
||||
}
|
||||
|
||||
private String getInputMethodId(String pkg) {
|
||||
InputMethodManager imeManager = (InputMethodManager) getApplicationContext().getSystemService(INPUT_METHOD_SERVICE);
|
||||
List<InputMethodInfo> InputMethods = imeManager.getInputMethodList();
|
||||
Map<String, String> inputMap = new HashMap<>();
|
||||
for (InputMethodInfo inputMethodInfo : InputMethods) {
|
||||
inputMap.put(inputMethodInfo.getPackageName(), inputMethodInfo.getId());
|
||||
}
|
||||
String id = inputMap.get(pkg);
|
||||
Log.e(TAG, "getInputMethodId: " + id);
|
||||
return id;
|
||||
}
|
||||
|
||||
public static void addShortCutCompact(Context context) {
|
||||
if (ShortcutManagerCompat.isRequestPinShortcutSupported(context)) {
|
||||
Intent shortcutInfoIntent = new Intent(context, DebugActivity.class);
|
||||
@@ -565,7 +552,7 @@ public class DebugActivity extends BaseMvvmActivity<DebugViewModel, ActivityDebu
|
||||
}
|
||||
|
||||
public void getMenuList(View view) {
|
||||
String aole_restore_forbid_on = Settings.System.getString(getContentResolver(), "aole_settings_disallow");
|
||||
String aole_restore_forbid_on = Settings.System.getString(getContentResolver(), CommonConfig.AOLE_SETTINGS_DISALLOW);
|
||||
mViewDataBinding.btMenuStatu.setText("列表:" + aole_restore_forbid_on);
|
||||
Toaster.show(aole_restore_forbid_on);
|
||||
}
|
||||
@@ -586,12 +573,12 @@ public class DebugActivity extends BaseMvvmActivity<DebugViewModel, ActivityDebu
|
||||
}};
|
||||
|
||||
public void setMenuList(View view) {
|
||||
AndroidSettingsWriter.putString(DebugActivity.this, AndroidSettingsWriter.NAMESPACE_SYSTEM, "aole_settings_disallow", String.join(",", menuList));
|
||||
AndroidSettingsWriter.putString(DebugActivity.this, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_SETTINGS_DISALLOW, String.join(",", menuList));
|
||||
|
||||
}
|
||||
|
||||
public void cleanMenuList(View view) {
|
||||
AndroidSettingsWriter.putString(DebugActivity.this, AndroidSettingsWriter.NAMESPACE_SYSTEM, "aole_settings_disallow", "");
|
||||
AndroidSettingsWriter.putString(DebugActivity.this, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_SETTINGS_DISALLOW, "");
|
||||
}
|
||||
|
||||
public void listInputMeth(View view) {
|
||||
@@ -601,46 +588,50 @@ public class DebugActivity extends BaseMvvmActivity<DebugViewModel, ActivityDebu
|
||||
}
|
||||
|
||||
public void setInputBaidu(View view) {
|
||||
Log.e(TAG, "init: " + getInputMethodId("com.baidu.input"));
|
||||
Intent intent = new Intent("setDefaultInputMethod");
|
||||
intent.putExtra("package", getInputMethodId("com.baidu.input"));
|
||||
intent.setPackage("com.android.settings");
|
||||
sendBroadcast(intent);
|
||||
Log.e(TAG, "init: " + JgyUtils.getInstance().getInputMethComponentName("com.baidu.input"));
|
||||
if (JgyUtils.isAllWinnerDevice()) {
|
||||
AllwinnerCubeMdmManager.getInstance().setDefaultInputMethod(new ComponentName("com.baidu.input", "com.baidu.input.ImeService").toString());
|
||||
} else {
|
||||
Intent intent = new Intent("setDefaultInputMethod");
|
||||
intent.putExtra("package", JgyUtils.getInstance().getInputMethComponentName("com.baidu.input"));
|
||||
intent.setPackage("com.android.settings");
|
||||
sendBroadcast(intent);
|
||||
}
|
||||
}
|
||||
|
||||
public void setInputSogou(View view) {
|
||||
Log.e(TAG, "init: " + getInputMethodId("com.sohu.inputmethod.sogou"));
|
||||
Intent intent = new Intent("setDefaultInputMethod");
|
||||
intent.putExtra("package", getInputMethodId("com.sohu.inputmethod.sogou"));
|
||||
intent.setPackage("com.android.settings");
|
||||
sendBroadcast(intent);
|
||||
Log.e(TAG, "init: " + JgyUtils.getInstance().getInputMethComponentName("com.sohu.inputmethod.sogou"));
|
||||
if (JgyUtils.isAllWinnerDevice()) {
|
||||
AllwinnerCubeMdmManager.getInstance().setDefaultInputMethod(new ComponentName("com.sohu.inputmethod.sogou", "com.sohu.inputmethod.sogou.SogouIME").toString());
|
||||
} else {
|
||||
Intent intent = new Intent("setDefaultInputMethod");
|
||||
intent.putExtra("package", JgyUtils.getInstance().getInputMethComponentName("com.sohu.inputmethod.sogou"));
|
||||
intent.setPackage("com.android.settings");
|
||||
sendBroadcast(intent);
|
||||
}
|
||||
}
|
||||
|
||||
public void setInputGoogle(View view) {
|
||||
Log.e(TAG, "init: " + getInputMethodId("com.google.android.inputmethod.pinyin"));
|
||||
Intent intent = new Intent("setDefaultInputMethod");
|
||||
intent.putExtra("package", getInputMethodId("com.google.android.inputmethod.pinyin"));
|
||||
intent.setPackage("com.android.settings");
|
||||
sendBroadcast(intent);
|
||||
Log.e(TAG, "init: " + JgyUtils.getInstance().getInputMethComponentName("com.google.android.inputmethod.pinyin"));
|
||||
if (JgyUtils.isAllWinnerDevice()) {
|
||||
AllwinnerCubeMdmManager.getInstance().setDefaultInputMethod(new ComponentName("com.google.android.inputmethod.pinyin", "com.google.android.inputmethod.pinyin.PinyinIME").toString());
|
||||
} else {
|
||||
Intent intent = new Intent("setDefaultInputMethod");
|
||||
intent.putExtra("package", JgyUtils.getInstance().getInputMethComponentName("com.google.android.inputmethod.pinyin"));
|
||||
intent.setPackage("com.android.settings");
|
||||
sendBroadcast(intent);
|
||||
}
|
||||
}
|
||||
|
||||
public void setInputWetype(View view) {
|
||||
Log.e(TAG, "init: " + getInputMethodId("com.tencent.wetype"));
|
||||
Intent intent = new Intent("setDefaultInputMethod");
|
||||
intent.putExtra("package", getInputMethodId("com.tencent.wetype"));
|
||||
intent.setPackage("com.android.settings");
|
||||
sendBroadcast(intent);
|
||||
Log.e(TAG, "init: " + JgyUtils.getInstance().getInputMethComponentName("com.tencent.wetype"));
|
||||
if (JgyUtils.isAllWinnerDevice()) {
|
||||
AllwinnerCubeMdmManager.getInstance().setDefaultInputMethod(new ComponentName("com.tencent.wetype", "com.tencent.wetype.plugin.hld.WxHldService").toString());
|
||||
} else {
|
||||
Intent intent = new Intent("setDefaultInputMethod");
|
||||
intent.putExtra("package", JgyUtils.getInstance().getInputMethComponentName("com.tencent.wetype"));
|
||||
intent.setPackage("com.android.settings");
|
||||
sendBroadcast(intent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -183,11 +183,12 @@ public class MainActivity extends BaseMvvmActivity<MainViewModel, ActivityMainBi
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
Log.e(TAG, "initView: Build.getSerial = " + Utils.getSerial(MainActivity.this));
|
||||
|
||||
if (BuildConfig.DEBUG) {
|
||||
// Uri uri = Uri.parse("https://www.baidu.com");
|
||||
// Intent intent = new Intent(Intent.ACTION_VIEW, uri);
|
||||
// startActivity(intent);
|
||||
// Log.e(TAG, "initView: Build.getSerial = " + Build.getSerial());
|
||||
// startActivity(new Intent(Settings.ACTION_SECURITY_SETTINGS));
|
||||
JgyUtils.getInstance().getAllRunningAppProcessInfo();
|
||||
JgyUtils.getInstance().getAllRunningServices();
|
||||
|
||||
@@ -11,6 +11,7 @@ import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.aoleyun.sn.BuildConfig;
|
||||
import com.aoleyun.sn.comm.CommonConfig;
|
||||
import com.aoleyun.sn.utils.ApkUtils;
|
||||
import com.hjq.toast.Toaster;
|
||||
@@ -107,6 +108,10 @@ public class AoleyunActivityController extends IActivityController.Stub {
|
||||
if (TextUtils.isEmpty(pkg)) {
|
||||
return true;
|
||||
}
|
||||
if (BuildConfig.APPLICATION_ID.equals(pkg)) {
|
||||
Log.e(TAG, "activityStarting: 跳过拦截本身");
|
||||
return true;
|
||||
}
|
||||
//本地默认禁用应用 + 接口下发的禁用应用,禁止启动
|
||||
if (mDisablePkgs.contains(pkg)) {
|
||||
Log.e(TAG, "activityStarting: 应用已被禁用,拦截启动 " + pkg);
|
||||
|
||||
@@ -18,8 +18,6 @@ import android.os.Build;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.inputmethod.InputMethodInfo;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
|
||||
import com.alibaba.sdk.android.push.CloudPushService;
|
||||
import com.alibaba.sdk.android.push.CommonCallback;
|
||||
@@ -1505,10 +1503,10 @@ public class NetInterfaceManager {
|
||||
String hideString = TextUtils.join(",", hidePkgs);
|
||||
String showString = TextUtils.join(",", showPkgs);
|
||||
Log.e("getIconControl", "applyIconControl: disable = " + hideString + ", show = " + showString);
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_GLOBAL,
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_GLOBAL,
|
||||
CommonConfig.AOLE_ACTION_HIDE_DESKTOP_ICON,
|
||||
TextUtils.isEmpty(hideString) ? "null" : hideString);
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_GLOBAL,
|
||||
AndroidSettingsWriter.putString(mContext, AndroidSettingsWriter.NAMESPACE_GLOBAL,
|
||||
CommonConfig.AOLE_ACTION_SHOW_DESKTOP_ICON,
|
||||
TextUtils.isEmpty(showString) ? "null" : showString);
|
||||
//2、按清单禁用
|
||||
@@ -1978,18 +1976,16 @@ public class NetInterfaceManager {
|
||||
if (!TextUtils.isEmpty(default_IME)) {
|
||||
mMMKV.encode(CommonConfig.DEFAULT_IME_PACKAGE_NAME_KEY, default_IME);
|
||||
if (JgyUtils.isAllWinnerDevice()) {
|
||||
Intent intent = new Intent("setDefaultInputMethod");
|
||||
intent.putExtra("package", "com.android.inputmethod.latin");
|
||||
intent.setPackage("com.android.settings");
|
||||
mContext.sendBroadcast(intent);
|
||||
JgyUtils.getInstance().setAllwinnerDefaulInputMeth(default_IME);
|
||||
} else {
|
||||
Intent intent = new Intent("setDefaultInputMethod");
|
||||
intent.putExtra("package", default_IME);
|
||||
intent.setPackage("com.android.settings");
|
||||
mContext.sendBroadcast(intent);
|
||||
JgyUtils.getInstance().sendInputBroadcast(default_IME);
|
||||
}
|
||||
} else {
|
||||
if (JgyUtils.isAllWinnerDevice()) {
|
||||
JgyUtils.getInstance().setAllwinnerDefaulInputMeth("com.android.inputmethod.latin");
|
||||
} else {
|
||||
JgyUtils.getInstance().sendInputBroadcast("com.android.inputmethod.latin");
|
||||
}
|
||||
Log.e(TAG, "setDefaultApp: default_IME is empty");
|
||||
mMMKV.encode(CommonConfig.DEFAULT_IME_PACKAGE_NAME_KEY, "");
|
||||
}
|
||||
@@ -2031,18 +2027,6 @@ public class NetInterfaceManager {
|
||||
}
|
||||
}
|
||||
|
||||
private String getInputMethodId(String pkg) {
|
||||
InputMethodManager imeManager = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
List<InputMethodInfo> InputMethods = imeManager.getInputMethodList();
|
||||
Map<String, String> inputMap = new HashMap<>();
|
||||
for (InputMethodInfo inputMethodInfo : InputMethods) {
|
||||
inputMap.put(inputMethodInfo.getPackageName(), inputMethodInfo.getId());
|
||||
}
|
||||
String id = inputMap.get(pkg);
|
||||
Log.e(TAG, "getInputMethodId: " + id);
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置默认简易桌面或学习桌面
|
||||
*
|
||||
|
||||
@@ -1134,25 +1134,10 @@ public class PushManager {
|
||||
}
|
||||
JsonElement keyboardElement = jsonObject.get("default_IME");
|
||||
if (keyboardElement.isJsonNull() || TextUtils.isEmpty(keyboardElement.getAsString())) {
|
||||
Intent intent = new Intent("setDefaultInputMethod");
|
||||
if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.QualcommPlatform) {
|
||||
intent.putExtra("package", "com.onyx.kime");
|
||||
intent.setPackage("com.onyx.neoservice");
|
||||
} else {
|
||||
intent.putExtra("package", "com.android.inputmethod.latin");
|
||||
intent.setPackage("com.android.settings");
|
||||
}
|
||||
mContext.sendBroadcast(intent);
|
||||
JgyUtils.getInstance().sendInputBroadcast("");
|
||||
} else {
|
||||
String default_IME = jsonObject.get("default_IME").getAsString();
|
||||
Intent intent = new Intent("setDefaultInputMethod");
|
||||
intent.putExtra("package", default_IME);
|
||||
if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.QualcommPlatform) {
|
||||
intent.setPackage("com.onyx.neoservice");
|
||||
} else {
|
||||
intent.setPackage("com.android.settings");
|
||||
}
|
||||
mContext.sendBroadcast(intent);
|
||||
JgyUtils.getInstance().sendInputBroadcast(default_IME);
|
||||
}
|
||||
|
||||
String default_browser = jsonObject.get("default_browser").getAsString();
|
||||
|
||||
@@ -10,6 +10,9 @@ import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 以 "android" 包名记账写 Settings.System/Secure/Global(system uid + platform 签名前提),
|
||||
@@ -53,10 +56,7 @@ public final class AndroidSettingsWriter {
|
||||
}
|
||||
|
||||
public static boolean putString(Context context, String namespace, String name, String value) {
|
||||
Context targetContext = context;
|
||||
if (targetContext == null) {
|
||||
targetContext = sAppContext;
|
||||
}
|
||||
Context targetContext = context != null ? context : sAppContext;
|
||||
if (targetContext == null) {
|
||||
Log.e(TAG, "putString: Context is null");
|
||||
return false;
|
||||
@@ -71,23 +71,31 @@ public final class AndroidSettingsWriter {
|
||||
// _user 是 SettingsProvider 定位落库用户的必填项,与包名伪装无关;只管主用户
|
||||
arg.putInt(CALL_METHOD_USER_KEY, 0);
|
||||
|
||||
// 注意:发起方进程绝不能 clearCallingIdentity——它会篡改本进程事务携带的
|
||||
// 调用身份,SettingsProvider 侧校验 calling pid 会直接拒绝("doesn't match source pid")。
|
||||
// 那个手法只适用于服务端(代理进程处理入站 binder 调用时)。
|
||||
// 1. 优先尝试伪装 "android" 包名调用 SettingsProvider 的 call 接口
|
||||
Bundle result = callSettingsPut(targetContext, namespace, arg, name);
|
||||
boolean bundleOk = isOk(result);
|
||||
// 该厂商 SettingsProvider 对 PUT_* 静默返回 null(不抛异常也不回 Bundle),
|
||||
// 成败以写后读回为准。
|
||||
String readBack = readSetting(targetContext.getContentResolver(), namespace, name);
|
||||
boolean verified = TextUtils.equals(readBack, value);
|
||||
if (bundleOk || verified) {
|
||||
Log.d(TAG, "putString succeeded for " + namespace + "/" + name
|
||||
+ " (bundleOk=" + bundleOk + ", verified=" + verified + ")");
|
||||
|
||||
// 2. 直接查询 SettingsProvider 服务端数据库校验(绕过本进程 sNameValueCache 本地内存缓存)
|
||||
String serverValue = callSettingsGet(targetContext, namespace, name);
|
||||
boolean serverVerified = TextUtils.equals(serverValue, value);
|
||||
|
||||
if (serverVerified) {
|
||||
Log.d(TAG, "putString succeeded via SettingsProvider for " + namespace + "/" + name
|
||||
+ " (serverVerified=true)");
|
||||
return true;
|
||||
}
|
||||
Log.w(TAG, "putString failed for " + namespace + "/" + name
|
||||
+ " (result=" + result + ", readBack=" + readBack + "), fallback to direct put");
|
||||
return directPutString(targetContext.getContentResolver(), namespace, name, value);
|
||||
|
||||
// 3. 服务端校验未通过或 result 为空时,退回 directPutString 直接写入
|
||||
Log.w(TAG, "putString via provider failed for " + namespace + "/" + name
|
||||
+ " (result=" + result + ", serverValue=" + serverValue + "), fallback to direct put");
|
||||
boolean directOk = directPutString(targetContext.getContentResolver(), namespace, name, value);
|
||||
|
||||
// 4. 读取校验
|
||||
String readBackDirect = readSetting(targetContext.getContentResolver(), namespace, name);
|
||||
boolean directVerified = TextUtils.equals(readBackDirect, value);
|
||||
|
||||
Log.d(TAG, "directPutString for " + namespace + "/" + name + " (directOk=" + directOk
|
||||
+ ", verified=" + directVerified + ")");
|
||||
return directOk || directVerified;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -126,68 +134,103 @@ public final class AndroidSettingsWriter {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 直路一条:反射 acquireExistingProvider 拿 ContentProviderProxy,
|
||||
* 用伪造的 AttributionSource(uid=1000, package="android") 调其 call。
|
||||
* 事务由设备框架自己生成的 Proxy 写出,事务码/布局永远和 ROM 匹配。
|
||||
* 前提:android.uid.system + platform 签名。
|
||||
*/
|
||||
private static Bundle callSettingsPut(Context context, String namespace, Bundle arg, String name) {
|
||||
Object provider = getSettingsProvider(context);
|
||||
if (provider == null) {
|
||||
return null;
|
||||
Bundle result = null;
|
||||
if (provider != null) {
|
||||
result = invokeProviderCall(provider, "PUT_" + namespace, arg, name);
|
||||
if (result == null) {
|
||||
// 可能 binder 已死亡,清缓存重取再试一次
|
||||
sSettingsProvider = null;
|
||||
provider = getSettingsProvider(context);
|
||||
if (provider != null) {
|
||||
result = invokeProviderCall(provider, "PUT_" + namespace, arg, name);
|
||||
}
|
||||
}
|
||||
}
|
||||
Bundle result = invokeProviderCall(provider, namespace, arg, name);
|
||||
if (result == null) {
|
||||
// 可能 binder 已死亡,清缓存重取再试一次
|
||||
sSettingsProvider = null;
|
||||
provider = getSettingsProvider(context);
|
||||
if (provider != null) {
|
||||
result = invokeProviderCall(provider, namespace, arg, name);
|
||||
if (result == null && context != null) {
|
||||
try {
|
||||
result = context.getContentResolver().call(SETTINGS_URI, "PUT_" + namespace, name, arg);
|
||||
} catch (Throwable t) {
|
||||
Log.w(TAG, "callSettingsPut ContentResolver.call failed: " + t);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* S+ 的 ContentProviderProxy 记账包名取自 AttributionSource:
|
||||
* 伪造 AttributionSource(uid=1000, packageName="android") 调
|
||||
* call(AttributionSource, authority, method, arg, extras)。
|
||||
* 本 App 就是 uid 1000,enforceCallingUid 校验通过;"android" 包属于 uid 1000,
|
||||
* attribution 链校验也通过。旧 4 参 call 无包名槽位(会记真实包名),不用。
|
||||
*/
|
||||
private static Bundle invokeProviderCall(Object provider, String namespace, Bundle arg,
|
||||
String name) {
|
||||
Object attribution = buildAndroidAttributionSource();
|
||||
if (attribution == null) {
|
||||
Log.e(TAG, "putString: attribution source is null, abort");
|
||||
return null;
|
||||
private static String callSettingsGet(Context context, String namespace, String name) {
|
||||
Bundle arg = new Bundle();
|
||||
arg.putInt(CALL_METHOD_USER_KEY, 0);
|
||||
|
||||
Object provider = getSettingsProvider(context);
|
||||
Bundle result = null;
|
||||
if (provider != null) {
|
||||
result = invokeProviderCall(provider, "GET_" + namespace, arg, name);
|
||||
}
|
||||
String callMethod = "PUT_" + namespace;
|
||||
if (result == null && context != null) {
|
||||
try {
|
||||
result = context.getContentResolver().call(SETTINGS_URI, "GET_" + namespace, name, arg);
|
||||
} catch (Throwable t) {
|
||||
Log.w(TAG, "callSettingsGet ContentResolver.call failed: " + t);
|
||||
}
|
||||
}
|
||||
if (result != null) {
|
||||
return result.getString(Settings.NameValueTable.VALUE);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 多版本兼容的 ContentProvider.call 调用支持:
|
||||
* 针对 Android 12+(AttributionSource)、Android 11(6参)、Android 10(5参)、Android 9及更低(4参/3参)逐个适配
|
||||
*/
|
||||
private static Bundle invokeProviderCall(Object provider, String callMethod, Bundle arg, String name) {
|
||||
Object attribution = buildAndroidAttributionSource();
|
||||
|
||||
for (Method m : provider.getClass().getMethods()) {
|
||||
if (!"call".equals(m.getName())) {
|
||||
continue;
|
||||
}
|
||||
Class<?>[] p = m.getParameterTypes();
|
||||
if (p.length == 5 && p[1] == String.class && p[4] == Bundle.class
|
||||
&& p[0].getName().equals("android.content.AttributionSource")) {
|
||||
try {
|
||||
Bundle r = (Bundle) m.invoke(provider, attribution, SETTINGS_AUTHORITY,
|
||||
callMethod, name, arg);
|
||||
Log.d(TAG, "putString: invoked " + callMethod + " "
|
||||
+ java.util.Arrays.toString(p) + " -> "
|
||||
+ (r == null ? "null" : r.toString()));
|
||||
return r;
|
||||
} catch (Throwable t) {
|
||||
Throwable root = t instanceof java.lang.reflect.InvocationTargetException
|
||||
&& t.getCause() != null ? t.getCause() : t;
|
||||
Log.w(TAG, "putString: provider call failed: " + root);
|
||||
return null;
|
||||
try {
|
||||
// 1. Android 12+ (5 params: AttributionSource, String, String, String, Bundle)
|
||||
if (p.length == 5 && p[0].getName().equals("android.content.AttributionSource")
|
||||
&& p[1] == String.class && p[2] == String.class && p[3] == String.class && p[4] == Bundle.class) {
|
||||
if (attribution != null) {
|
||||
Bundle r = (Bundle) m.invoke(provider, attribution, SETTINGS_AUTHORITY, callMethod, name, arg);
|
||||
return r != null ? r : new Bundle();
|
||||
}
|
||||
}
|
||||
// 2. Android 11 (6 params: String callingPkg, String featureId, String authority, String method, String request, Bundle extras)
|
||||
else if (p.length == 6 && p[0] == String.class && p[1] == String.class && p[2] == String.class
|
||||
&& p[3] == String.class && p[4] == String.class && p[5] == Bundle.class) {
|
||||
Bundle r = (Bundle) m.invoke(provider, "android", null, SETTINGS_AUTHORITY, callMethod, name, arg);
|
||||
return r != null ? r : new Bundle();
|
||||
}
|
||||
// 3. Android 10 (5 params: String callingPkg, String authority, String method, String request, Bundle extras)
|
||||
else if (p.length == 5 && p[0] == String.class && p[1] == String.class && p[2] == String.class
|
||||
&& p[3] == String.class && p[4] == Bundle.class) {
|
||||
Bundle r = (Bundle) m.invoke(provider, "android", SETTINGS_AUTHORITY, callMethod, name, arg);
|
||||
return r != null ? r : new Bundle();
|
||||
}
|
||||
// 4. Android 9 / earlier (4 params: String callingPkg, String method, String request, Bundle extras)
|
||||
else if (p.length == 4 && p[0] == String.class && p[1] == String.class
|
||||
&& p[2] == String.class && p[3] == Bundle.class) {
|
||||
Bundle r = (Bundle) m.invoke(provider, "android", callMethod, name, arg);
|
||||
return r != null ? r : new Bundle();
|
||||
}
|
||||
// 5. 3 params: String method, String request, Bundle extras
|
||||
else if (p.length == 3 && p[0] == String.class && p[1] == String.class && p[2] == Bundle.class) {
|
||||
Bundle r = (Bundle) m.invoke(provider, callMethod, name, arg);
|
||||
return r != null ? r : new Bundle();
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
Throwable root = t instanceof java.lang.reflect.InvocationTargetException
|
||||
&& t.getCause() != null ? t.getCause() : t;
|
||||
Log.w(TAG, "invokeProviderCall " + callMethod + " failed via " + m.getName() + ": " + root);
|
||||
}
|
||||
}
|
||||
Log.w(TAG, "putString: no AttributionSource call overload on "
|
||||
+ provider.getClass().getName());
|
||||
Log.w(TAG, "invokeProviderCall: no matching call overload on " + provider.getClass().getName());
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -201,19 +244,12 @@ public final class AndroidSettingsWriter {
|
||||
builder.getMethod("setPackageName", String.class).invoke(b, "android");
|
||||
return builder.getMethod("build").invoke(b);
|
||||
} catch (Throwable t) {
|
||||
Log.e(TAG, "putString: build AttributionSource failed: " + t);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isOk(Bundle result) {
|
||||
return result != null && !"error".equals(result.getString("tag"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 反射 ContentResolver.acquireProvider / acquireExistingProvider(各 ROM 签名不同,
|
||||
* 扫描方法名+按参数类型填槽,String 槽位两种顺序都试),返回并缓存 IContentProvider 代理。
|
||||
* 调用者是 android.uid.system,hidden API 豁免生效。
|
||||
* 反射 ContentResolver.acquireProvider / acquireExistingProvider,返回并缓存 IContentProvider 代理。
|
||||
*/
|
||||
private static Object getSettingsProvider(Context context) {
|
||||
Object cached = sSettingsProvider;
|
||||
@@ -225,7 +261,7 @@ public final class AndroidSettingsWriter {
|
||||
return sSettingsProvider;
|
||||
}
|
||||
ContentResolver cr = context.getContentResolver();
|
||||
java.util.List<Method> candidates = new java.util.ArrayList<>();
|
||||
List<Method> candidates = new ArrayList<>();
|
||||
for (Method m : ContentResolver.class.getDeclaredMethods()) {
|
||||
String n = m.getName();
|
||||
if (("acquireProvider".equals(n) || "acquireExistingProvider".equals(n))
|
||||
@@ -233,8 +269,7 @@ public final class AndroidSettingsWriter {
|
||||
candidates.add(m);
|
||||
}
|
||||
}
|
||||
java.util.Collections.sort(candidates,
|
||||
(a, b) -> a.getParameterCount() - b.getParameterCount());
|
||||
candidates.sort(Comparator.comparingInt(Method::getParameterCount));
|
||||
for (Method m : candidates) {
|
||||
Object provider = tryAcquire(cr, m);
|
||||
if (provider != null) {
|
||||
@@ -249,10 +284,6 @@ public final class AndroidSettingsWriter {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 3 参版是 (authority, name, ...),5 参版是 (config, name, userId, authority, stable),
|
||||
* String 槽位顺序在不同 API 上相反,猜错会 NPE,两组组合都试。
|
||||
*/
|
||||
private static Object tryAcquire(ContentResolver cr, Method m) {
|
||||
Class<?>[] types = m.getParameterTypes();
|
||||
String[][] slotCombos = {
|
||||
@@ -273,9 +304,8 @@ public final class AndroidSettingsWriter {
|
||||
} else if (t == boolean.class) {
|
||||
args[i] = false; // stable / tryLocal:走 binder 路径
|
||||
} else if (t == int.class) {
|
||||
args[i] = 0; // userId / pid(0 会让 ActivityThread 用 myPid)
|
||||
args[i] = 0; // userId / pid
|
||||
}
|
||||
// IBinder、Intent 等保持 null
|
||||
}
|
||||
m.setAccessible(true);
|
||||
Object provider = m.invoke(cr, args);
|
||||
|
||||
@@ -548,6 +548,38 @@ public class ApkUtils {
|
||||
this.add("com.jxw.xdfzq");
|
||||
}};
|
||||
|
||||
public static final Set<String> JxwApp2026 = new HashSet<String>() {{
|
||||
this.add("com.jxw.aixhb");
|
||||
this.add("com.jxw.bdc");
|
||||
this.add("com.jxw.dcttl");
|
||||
this.add("com.jxw.download");
|
||||
this.add("com.jxw.flch");
|
||||
this.add("com.jxw.hzdcg");
|
||||
this.add("com.jxw.hzjc");
|
||||
this.add("com.jxw.jpkc");
|
||||
this.add("com.jxw.kcb");
|
||||
this.add("com.jxw.ksdcg");
|
||||
this.add("com.jxw.lccj");
|
||||
this.add("com.jxw.mathgame");
|
||||
this.add("com.jxw.share");
|
||||
this.add("com.jxw.music");
|
||||
this.add("com.jxw.qjdh");
|
||||
this.add("com.jxw.qkxx");
|
||||
this.add("com.jxw.qwpy");
|
||||
this.add("com.jxwgb.qxpy");
|
||||
this.add("com.jxw.instruction");
|
||||
this.add("com.jxw.sjzx");
|
||||
this.add("com.jxw.tbfd");
|
||||
this.add("com.jxw.tbgs");
|
||||
this.add("com.jxw.txrw");
|
||||
this.add("com.jxw.yszqb");
|
||||
this.add("com.jxw.zcdtz");
|
||||
this.add("com.jxw.zhbd");
|
||||
this.add("com.jxwgb.zhtsg");
|
||||
this.add("com.jxw.maidain");
|
||||
}};
|
||||
|
||||
|
||||
public static final Set<String> G11Pkgs = new HashSet<String>() {{
|
||||
/*G11 平台*/
|
||||
this.add("com.lhcx.drawing");
|
||||
@@ -1765,6 +1797,7 @@ public class ApkUtils {
|
||||
&& !dongwa.contains(packageName)
|
||||
&& !yixuepaiApp.contains(packageName)
|
||||
&& !mJxwApp.contains(packageName)
|
||||
&& !JxwApp2026.contains(packageName)
|
||||
&& !G30_APP.contains(packageName)
|
||||
&& !DX11App.contains(packageName)
|
||||
&& !MX11App.contains(packageName)
|
||||
@@ -1808,20 +1841,40 @@ public class ApkUtils {
|
||||
}
|
||||
|
||||
public static void RemoveTask(final Context context, final String packageName) {
|
||||
if (TextUtils.isEmpty(packageName)) {
|
||||
if (context == null || TextUtils.isEmpty(packageName)) {
|
||||
return;
|
||||
}
|
||||
Observable.create(new ObservableOnSubscribe<String>() {
|
||||
@Override
|
||||
public void subscribe(ObservableEmitter<String> e) throws Exception {
|
||||
List<DownloadEntity> list = Aria.download(context).getTaskList();
|
||||
for (DownloadEntity entity : list) {
|
||||
long id = entity.getId();
|
||||
String extendField = Aria.download(this).load(id).getExtendField();
|
||||
JsonObject jsonObject = GsonUtils.getJsonObject(extendField);
|
||||
if (packageName.equals(jsonObject.get("app_package").getAsString())) {
|
||||
Log.e("RemoveTask", "subscribe: " + "删除文件:" + entity.getFilePath());
|
||||
Aria.download(this).load(id).cancel(true);
|
||||
if (list != null && !list.isEmpty()) {
|
||||
for (DownloadEntity entity : list) {
|
||||
if (entity == null) {
|
||||
continue;
|
||||
}
|
||||
long id = entity.getId();
|
||||
String extendField = null;
|
||||
if (Aria.download(context).load(id) != null) {
|
||||
extendField = Aria.download(context).load(id).getExtendField();
|
||||
}
|
||||
if (TextUtils.isEmpty(extendField)) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
JsonObject jsonObject = GsonUtils.getJsonObject(extendField);
|
||||
if (jsonObject != null && jsonObject.has("app_package") && !jsonObject.get("app_package").isJsonNull()) {
|
||||
String appPackage = jsonObject.get("app_package").getAsString();
|
||||
if (packageName.equals(appPackage)) {
|
||||
Log.e("RemoveTask", "subscribe: " + "删除文件:" + entity.getFilePath());
|
||||
if (Aria.download(context).load(id) != null) {
|
||||
Aria.download(context).load(id).cancel(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
Log.e("RemoveTask", "parse extendField error: " + ex.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
e.onComplete();
|
||||
|
||||
@@ -865,6 +865,7 @@ public class JgyUtils {
|
||||
this.add("com.aoleyun.calculator");
|
||||
this.add("com.aoleyun.gallery3d");
|
||||
this.addAll(ApkUtils.mJxwApp);
|
||||
this.addAll(ApkUtils.JxwApp2026);
|
||||
this.addAll(ApkUtils.desktopAPP);
|
||||
this.add("com.android.settings");
|
||||
this.add("com.aoleyunos.dop");
|
||||
@@ -1582,6 +1583,9 @@ public class JgyUtils {
|
||||
pkgSet.addAll(ApkUtils.desktopAPP);
|
||||
pkgSet.addAll(ApkUtils.aoleyunAPP);
|
||||
pkgSet.addAll(ApkUtils.mJxwApp);
|
||||
|
||||
pkgSet.addAll(ApkUtils.JxwApp2026);
|
||||
|
||||
if (G128T_TAG.equals(BuildConfig.platform)) {
|
||||
pkgSet.add("com.dmjc.xinhuo");
|
||||
}
|
||||
@@ -1956,6 +1960,9 @@ public class JgyUtils {
|
||||
if (ApkUtils.mJxwApp.contains(packageName)) {
|
||||
continue;
|
||||
}
|
||||
if (ApkUtils.JxwApp2026.contains(packageName)) {
|
||||
continue;
|
||||
}
|
||||
if (JgyUtils.DX11_TAG.equals(Build.MODEL)) {
|
||||
if (ApkUtils.DX11App.contains(packageName)) {
|
||||
continue;
|
||||
@@ -2072,6 +2079,10 @@ public class JgyUtils {
|
||||
|
||||
public void hideApp(String pkg) {
|
||||
Log.e(TAG, "hideApp: " + pkg);
|
||||
if (BuildConfig.APPLICATION_ID.equals(pkg)) {
|
||||
Log.e(TAG, "hideApp: " + "not hide self");
|
||||
return;
|
||||
}
|
||||
PackageManager pm = mContext.getPackageManager();
|
||||
try {
|
||||
pm.setApplicationEnabledSetting(pkg, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);
|
||||
@@ -2269,7 +2280,7 @@ public class JgyUtils {
|
||||
public void setDeveloperOptions(int state) {
|
||||
Log.e(TAG, "setDeveloperOptions: state = " + state);
|
||||
|
||||
int oldStatu = Settings.System.getInt(crv, CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, 0);
|
||||
int oldStatu = Settings.System.getInt(crv, CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, 1);
|
||||
if (oldStatu == (state ^ 1)) {
|
||||
Log.e(TAG, "setDeveloperOptions: oldStatu = " + oldStatu + " no changed");
|
||||
}
|
||||
@@ -2277,7 +2288,12 @@ public class JgyUtils {
|
||||
if (MT8768Tag.equalsIgnoreCase(BuildConfig.platform)
|
||||
|| G128T_TAG.equalsIgnoreCase(BuildConfig.platform)
|
||||
) {
|
||||
AndroidSettingsWriter.putInt(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, state);
|
||||
// TODO: 2026/11/3 Ebox201w型号单独区分
|
||||
if ("Ebox201w".equals(Build.MODEL)) {
|
||||
AndroidSettingsWriter.putInt(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, state ^ 1);
|
||||
} else {
|
||||
AndroidSettingsWriter.putInt(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, state);
|
||||
}
|
||||
} else {
|
||||
//这个需要反着来
|
||||
AndroidSettingsWriter.putInt(mContext, AndroidSettingsWriter.NAMESPACE_SYSTEM, CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, state ^ 1);
|
||||
@@ -3514,7 +3530,7 @@ public class JgyUtils {
|
||||
String apkPath = aolePath + File.separator + fileName;
|
||||
Log.e(TAG, "subscribe: " + apkPath);
|
||||
String pkg = ApkUtils.getPackageName(mContext, apkPath);
|
||||
if (ApkUtils.mJxwApp.contains(pkg)) {
|
||||
if (ApkUtils.mJxwApp.contains(pkg) || ApkUtils.JxwApp2026.contains(pkg)) {
|
||||
packageListMap.put(pkg, apkPath);
|
||||
} else {
|
||||
Log.e(TAG, "checkLocalAppInstall: skip: " + pkg + " fileName: " + fileName);
|
||||
@@ -3785,6 +3801,9 @@ public class JgyUtils {
|
||||
if (ApkUtils.mJxwApp.contains(pkg)) {
|
||||
return true;
|
||||
}
|
||||
if (ApkUtils.JxwApp2026.contains(pkg)) {
|
||||
return true;
|
||||
}
|
||||
if (mLessonJson == null)
|
||||
return true;
|
||||
if (mLessonJson.getIs_lesson() == 1) {
|
||||
@@ -3960,22 +3979,60 @@ public class JgyUtils {
|
||||
}
|
||||
|
||||
public String getInputMethComponentName(String pkg) {
|
||||
if (TextUtils.isEmpty(pkg)) {
|
||||
return "";
|
||||
}
|
||||
InputMethodManager imeManager = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
if (imeManager == null) {
|
||||
return "";
|
||||
}
|
||||
List<InputMethodInfo> InputMethods = imeManager.getInputMethodList();
|
||||
Optional<InputMethodInfo> inputMethodInfoOptional = InputMethods.stream().filter(new Predicate<InputMethodInfo>() {
|
||||
@Override
|
||||
public boolean test(InputMethodInfo inputMethodInfo) {
|
||||
return pkg.equals(inputMethodInfo.getPackageName());
|
||||
}
|
||||
}).findAny();
|
||||
}).findFirst();
|
||||
if (inputMethodInfoOptional.isPresent()) {
|
||||
InputMethodInfo inputMethodInfo = inputMethodInfoOptional.get();
|
||||
return inputMethodInfo.getComponent().toString();
|
||||
return inputMethodInfo.getComponent().flattenToShortString();
|
||||
} else {
|
||||
Log.e(TAG, "getInputMethComponentName: no IME found for " + pkg);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param imePkg secure default_input_method
|
||||
*/
|
||||
public void sendInputBroadcast(String imePkg) {
|
||||
Intent intent = new Intent("setDefaultInputMethod");
|
||||
if (TextUtils.isEmpty(imePkg)) {
|
||||
if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.QualcommPlatform) {
|
||||
intent.putExtra("package", "com.onyx.kime");
|
||||
intent.setPackage("com.onyx.neoservice");
|
||||
} else if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.TDT65Platform || "TDT65".equals(Build.MODEL)) {
|
||||
intent.putExtra("package", JgyUtils.getInstance().getInputMethComponentName("com.google.android.inputmethod.latin"));
|
||||
intent.setPackage("com.android.settings");
|
||||
} else {
|
||||
intent.putExtra("package", "com.android.inputmethod.latin");
|
||||
intent.setPackage("com.android.settings");
|
||||
}
|
||||
} else {
|
||||
if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.QualcommPlatform) {
|
||||
intent.putExtra("package", imePkg);
|
||||
intent.setPackage("com.onyx.neoservice");
|
||||
} else if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.TDT65Platform || "TDT65".equals(Build.MODEL)) {
|
||||
intent.putExtra("package", JgyUtils.getInstance().getInputMethComponentName(imePkg));
|
||||
intent.setPackage("com.android.settings");
|
||||
} else {
|
||||
intent.putExtra("package", imePkg);
|
||||
intent.setPackage("com.android.settings");
|
||||
}
|
||||
}
|
||||
mContext.sendBroadcast(intent);
|
||||
}
|
||||
|
||||
public String getDefaultIme() {
|
||||
return mMMKV.decodeString(CommonConfig.DEFAULT_IME_PACKAGE_NAME_KEY, "");
|
||||
}
|
||||
@@ -4219,5 +4276,4 @@ public class JgyUtils {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -400,6 +400,8 @@ public class SysSettingUtils {
|
||||
if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.TeclastP20sPlatform
|
||||
|| JgyUtils.getInstance().checkAppPlatform() == JgyUtils.AH6016Platform
|
||||
|| JgyUtils.getInstance().checkAppPlatform() == JgyUtils.DX11Platform
|
||||
|| JgyUtils.getInstance().checkAppPlatform() == JgyUtils.TDT65Platform
|
||||
|| "AOSP".equals(BuildConfig.platform)
|
||||
) {
|
||||
usbIntent.setPackage("com.android.settings");
|
||||
}
|
||||
@@ -641,7 +643,11 @@ public class SysSettingUtils {
|
||||
default:
|
||||
}
|
||||
Intent navIntent = new Intent(navigationStatus);
|
||||
// Intent navIntent = new Intent(navigationStatus).setPackage("com.android.systemui");
|
||||
if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.TDT65Platform
|
||||
|| "AOSP".equals(BuildConfig.platform)
|
||||
) {
|
||||
navIntent.setPackage("com.android.systemui");
|
||||
}
|
||||
if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.QualcommPlatform) {
|
||||
navIntent.setPackage("com.onyx");
|
||||
}
|
||||
@@ -666,7 +672,11 @@ public class SysSettingUtils {
|
||||
default:
|
||||
}
|
||||
Intent statusIntent = new Intent(statusbarStatus);
|
||||
// Intent statusIntent = new Intent(statusbarStatus).setPackage("com.android.systemui");
|
||||
if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.TDT65Platform
|
||||
|| "AOSP".equals(BuildConfig.platform)
|
||||
) {
|
||||
statusIntent.setPackage("com.android.systemui");
|
||||
}
|
||||
context.sendBroadcast(statusIntent);
|
||||
}
|
||||
}
|
||||
@@ -689,8 +699,13 @@ public class SysSettingUtils {
|
||||
break;
|
||||
default:
|
||||
}
|
||||
// Intent navIntent = new Intent(navigationStatus).setPackage("com.android.systemui");
|
||||
Intent navIntent = new Intent(navigationStatus);
|
||||
if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.TDT65Platform
|
||||
|| "AOSP".equals(BuildConfig.platform)
|
||||
) {
|
||||
navIntent.setPackage("com.android.systemui");
|
||||
}
|
||||
|
||||
if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.QualcommPlatform) {
|
||||
navIntent.setPackage("com.onyx");
|
||||
}
|
||||
@@ -720,7 +735,11 @@ public class SysSettingUtils {
|
||||
default:
|
||||
}
|
||||
Intent statusIntent = new Intent(statusbarStatus);
|
||||
// Intent statusIntent = new Intent(statusbarStatus).setPackage("com.android.systemui");
|
||||
if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.TDT65Platform
|
||||
|| "AOSP".equals(BuildConfig.platform)
|
||||
) {
|
||||
statusIntent.setPackage("com.android.systemui");
|
||||
}
|
||||
context.sendBroadcast(statusIntent);
|
||||
// }
|
||||
|
||||
@@ -1263,7 +1282,11 @@ public class SysSettingUtils {
|
||||
default:
|
||||
}
|
||||
Intent statusIntent = new Intent(statusbarStatus);
|
||||
// Intent statusIntent = new Intent(statusbarStatus).setPackage("com.android.systemui");
|
||||
if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.TDT65Platform
|
||||
|| "AOSP".equals(BuildConfig.platform)
|
||||
) {
|
||||
statusIntent.setPackage("com.android.systemui");
|
||||
}
|
||||
context.sendBroadcast(statusIntent);
|
||||
}
|
||||
}
|
||||
@@ -1284,7 +1307,11 @@ public class SysSettingUtils {
|
||||
default:
|
||||
}
|
||||
Intent navIntent = new Intent(navigationStatus);
|
||||
// Intent navIntent = new Intent(navigationStatus).setPackage("com.android.systemui");
|
||||
if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.TDT65Platform
|
||||
|| "AOSP".equals(BuildConfig.platform)
|
||||
) {
|
||||
navIntent.setPackage("com.android.systemui");
|
||||
}
|
||||
context.sendBroadcast(navIntent);
|
||||
}
|
||||
|
||||
@@ -1495,7 +1522,7 @@ public class SysSettingUtils {
|
||||
if (app_management_control == 0) {
|
||||
// menus.add("apps_management");
|
||||
// menus.add("apps_honor_tips");
|
||||
menus.add("apps");
|
||||
// menus.add("apps");
|
||||
}
|
||||
|
||||
// 儿童 (默认禁止)
|
||||
|
||||
@@ -789,6 +789,9 @@ public class Utils {
|
||||
if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.HL500Platform) {
|
||||
return getIMEI(context);
|
||||
}
|
||||
if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.TDT65Platform || "TDT65".equals(Build.MODEL)) {
|
||||
return getSn();
|
||||
}
|
||||
if (TECLAST_BRAND.equalsIgnoreCase(Build.BRAND)) {
|
||||
return getPushMac(context);
|
||||
} else {
|
||||
@@ -801,7 +804,7 @@ public class Utils {
|
||||
}
|
||||
|
||||
public static String getPushMac(Context context) {
|
||||
String macaddr = Utils.getMacAddrFromNvram();
|
||||
String macaddr = getAndroid10MAC(context);
|
||||
return macaddr.replace(":", "").toUpperCase().trim();
|
||||
}
|
||||
|
||||
@@ -1256,14 +1259,14 @@ public class Utils {
|
||||
public static void shotScreen(final Context context) {
|
||||
//adb截图方法
|
||||
Observable.create(new ObservableOnSubscribe<Integer>() {
|
||||
@Override
|
||||
public void subscribe(ObservableEmitter<Integer> e) throws Exception {
|
||||
String filepath = context.getCacheDir().getAbsolutePath();
|
||||
long time = System.currentTimeMillis();
|
||||
int n = CmdUtil.execute("screencap -p " + filepath + File.separator + time + ".db").code;
|
||||
e.onNext(n);
|
||||
}
|
||||
}).subscribeOn(Schedulers.io())
|
||||
@Override
|
||||
public void subscribe(ObservableEmitter<Integer> e) throws Exception {
|
||||
String filepath = context.getCacheDir().getAbsolutePath();
|
||||
long time = System.currentTimeMillis();
|
||||
int n = CmdUtil.execute("screencap -p " + filepath + File.separator + time + ".db").code;
|
||||
e.onNext(n);
|
||||
}
|
||||
}).subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<Integer>() {
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user