默认应用推送对接
This commit is contained in:
@@ -67,8 +67,8 @@ android {
|
|||||||
productFlavors {
|
productFlavors {
|
||||||
beta {
|
beta {
|
||||||
flavorDimensions "default"
|
flavorDimensions "default"
|
||||||
versionCode 17
|
versionCode 16
|
||||||
versionName "2.6"
|
versionName "2.5"
|
||||||
}
|
}
|
||||||
|
|
||||||
official {
|
official {
|
||||||
|
|||||||
@@ -912,24 +912,23 @@ public class NetInterfaceManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void checkAllAppUpdate(BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
|
public void checkAllAppUpdate(BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
|
||||||
Observable.zip(getUpdateObservable(JGYUtils.PACKAGE_APPSTORE),
|
Observable.zip(
|
||||||
|
getUpdateObservable(BuildConfig.APPLICATION_ID),
|
||||||
|
getUpdateObservable(JGYUtils.PACKAGE_APPSTORE),
|
||||||
getUpdateObservable(JGYUtils.PACKAGE_OS),
|
getUpdateObservable(JGYUtils.PACKAGE_OS),
|
||||||
getUpdateObservable(JGYUtils.PACKAGE_BROWSER),
|
getUpdateObservable(JGYUtils.PACKAGE_BROWSER),
|
||||||
new Function3<BaseResponse<AppInfo>, BaseResponse<AppInfo>, BaseResponse<AppInfo>, List<AppInfo>>() {
|
(appInfoBaseResponse, appInfoBaseResponse2, appInfoBaseResponse3, appInfoBaseResponse4) -> {
|
||||||
@Override
|
List<AppInfo> appInfoList = new ArrayList<>();
|
||||||
public List<AppInfo> apply(BaseResponse<AppInfo> appInfoBaseResponse, BaseResponse<AppInfo> appInfoBaseResponse2, BaseResponse<AppInfo> appInfoBaseResponse3) throws Throwable {
|
if (appInfoBaseResponse.code == 200) {
|
||||||
List<AppInfo> appInfoList = new ArrayList<>();
|
appInfoList.add(appInfoBaseResponse.data);
|
||||||
if (appInfoBaseResponse.code == 200) {
|
|
||||||
appInfoList.add(appInfoBaseResponse.data);
|
|
||||||
}
|
|
||||||
if (appInfoBaseResponse2.code == 200) {
|
|
||||||
appInfoList.add(appInfoBaseResponse2.data);
|
|
||||||
}
|
|
||||||
if (appInfoBaseResponse3.code == 200) {
|
|
||||||
appInfoList.add(appInfoBaseResponse3.data);
|
|
||||||
}
|
|
||||||
return appInfoList;
|
|
||||||
}
|
}
|
||||||
|
if (appInfoBaseResponse2.code == 200) {
|
||||||
|
appInfoList.add(appInfoBaseResponse2.data);
|
||||||
|
}
|
||||||
|
if (appInfoBaseResponse3.code == 200) {
|
||||||
|
appInfoList.add(appInfoBaseResponse3.data);
|
||||||
|
}
|
||||||
|
return appInfoList;
|
||||||
})
|
})
|
||||||
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
|
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
import okhttp3.Interceptor;
|
import okhttp3.Interceptor;
|
||||||
import okhttp3.Protocol;
|
import okhttp3.Protocol;
|
||||||
import okhttp3.Request;
|
import okhttp3.Request;
|
||||||
|
import okhttp3.RequestBody;
|
||||||
import okhttp3.Response;
|
import okhttp3.Response;
|
||||||
import okio.Buffer;
|
import okio.Buffer;
|
||||||
|
|
||||||
@@ -34,7 +35,7 @@ public class RepeatRequestInterceptor implements Interceptor {
|
|||||||
// Log.e(TAG, "请求体返回:| Response:" + content);
|
// Log.e(TAG, "请求体返回:| Response:" + content);
|
||||||
}
|
}
|
||||||
//相同的请求
|
//相同的请求
|
||||||
String requestKey = MD5Util.getUpperMD5Str(request.method() + request.url().toString() + request.body());
|
String requestKey = MD5Util.getUpperMD5Str(request.method() + request.url().toString() + requestBodyToString(request.body()));
|
||||||
long time = System.currentTimeMillis();//请求时间
|
long time = System.currentTimeMillis();//请求时间
|
||||||
try {
|
try {
|
||||||
if (requestIdsMap.size() > 0 && requestIdsMap.containsKey(requestKey)) {
|
if (requestIdsMap.size() > 0 && requestIdsMap.containsKey(requestKey)) {
|
||||||
@@ -84,4 +85,16 @@ public class RepeatRequestInterceptor implements Interceptor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String requestBodyToString(RequestBody body) {
|
||||||
|
try {
|
||||||
|
final Buffer buffer = new Buffer();
|
||||||
|
body.writeTo(buffer);
|
||||||
|
if (buffer.size() > 4096) {
|
||||||
|
return "-too long";
|
||||||
|
}
|
||||||
|
return buffer.readUtf8();
|
||||||
|
} catch (Exception e) {
|
||||||
|
return "-";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import android.widget.Toast;
|
|||||||
import com.android.internal.view.RotationPolicy;
|
import com.android.internal.view.RotationPolicy;
|
||||||
import com.arialyy.aria.core.Aria;
|
import com.arialyy.aria.core.Aria;
|
||||||
import com.arialyy.aria.core.download.DownloadEntity;
|
import com.arialyy.aria.core.download.DownloadEntity;
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.google.gson.JsonParser;
|
import com.google.gson.JsonParser;
|
||||||
import com.tencent.android.tpush.NotificationAction;
|
import com.tencent.android.tpush.NotificationAction;
|
||||||
@@ -745,10 +746,10 @@ public class MessageReceiver extends XGPushBaseReceiver {
|
|||||||
setHotPoint(context, extras);
|
setHotPoint(context, extras);
|
||||||
break;
|
break;
|
||||||
case ACTION_DEFAULT_DESKTOP:
|
case ACTION_DEFAULT_DESKTOP:
|
||||||
setDefaultDesktop(context,extras);
|
setDefaultDesktop(context, extras);
|
||||||
break;
|
break;
|
||||||
case ACTION_DEFAULT_BRPWSER:
|
case ACTION_DEFAULT_BRPWSER:
|
||||||
setDefaultBrowser(context,extras);
|
setDefaultBrowser(context, extras);
|
||||||
break;
|
break;
|
||||||
case ACTION_DEFAULT_INPUT_METHOD:
|
case ACTION_DEFAULT_INPUT_METHOD:
|
||||||
setDefaultInputMethod(context, extras);
|
setDefaultInputMethod(context, extras);
|
||||||
@@ -1472,16 +1473,26 @@ public class MessageReceiver extends XGPushBaseReceiver {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setDefaultDesktop(Context context, String extras){
|
private void setDefaultDesktop(Context context, String extras) {
|
||||||
JsonObject jsonObject = GsonUtils.getJsonObject(extras);
|
JsonObject jsonObject = GsonUtils.getJsonObject(extras);
|
||||||
String packeges = jsonObject.get("desktop_app").getAsString();
|
JsonElement jsonElement = jsonObject.get("desktop_app");
|
||||||
JGYUtils.getInstance().setDefaultInputMethod(packeges);
|
if (jsonElement != null) {
|
||||||
|
String packeges = jsonElement.getAsString();
|
||||||
|
JGYUtils.getInstance().setDefaultDesktop(packeges);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setDefaultBrowser(Context context, String extras){
|
private void setDefaultBrowser(Context context, String extras) {
|
||||||
JsonObject jsonObject = GsonUtils.getJsonObject(extras);
|
JsonObject jsonObject = GsonUtils.getJsonObject(extras);
|
||||||
String packeges = jsonObject.get("browser_app").getAsString();
|
JsonElement jsonElement = jsonObject.get("browser_app");
|
||||||
JGYUtils.getInstance().setDefaultInputMethod(packeges);
|
if (jsonElement != null) {
|
||||||
|
String packeges = jsonElement.getAsString();
|
||||||
|
JGYUtils.getInstance().setDefaultBrowser(packeges);
|
||||||
|
} else {
|
||||||
|
Log.e(TAG, "setDefaultBrowser: packeges is NULL");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setDefaultInputMethod(Context context, String extras) {
|
private void setDefaultInputMethod(Context context, String extras) {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import android.app.ActivityManager;
|
|||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
import android.app.usage.UsageStats;
|
import android.app.usage.UsageStats;
|
||||||
import android.app.usage.UsageStatsManager;
|
import android.app.usage.UsageStatsManager;
|
||||||
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
@@ -135,6 +136,58 @@ public class ApkUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean openPackage(Context context, String packageName) {
|
||||||
|
Context pkgContext = getPackageContext(context, packageName);
|
||||||
|
Intent intent = getAppOpenIntentByPackageName(context, packageName);
|
||||||
|
if (pkgContext != null && intent != null) {
|
||||||
|
pkgContext.startActivity(intent);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Context getPackageContext(Context context, String packageName) {
|
||||||
|
Context pkgContext = null;
|
||||||
|
if (context.getPackageName().equals(packageName)) {
|
||||||
|
pkgContext = context;
|
||||||
|
} else {
|
||||||
|
// 创建第三方应用的上下文环境
|
||||||
|
try {
|
||||||
|
pkgContext = context.createPackageContext(packageName,
|
||||||
|
Context.CONTEXT_IGNORE_SECURITY
|
||||||
|
| Context.CONTEXT_INCLUDE_CODE);
|
||||||
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return pkgContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Intent getAppOpenIntentByPackageName(Context context, String packageName) {
|
||||||
|
//Activity完整名
|
||||||
|
String mainAct = null;
|
||||||
|
//根据包名寻找
|
||||||
|
PackageManager pkgMag = context.getPackageManager();
|
||||||
|
Intent intent = new Intent(Intent.ACTION_MAIN);
|
||||||
|
intent.addCategory(Intent.CATEGORY_LAUNCHER);
|
||||||
|
intent.setFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
|
||||||
|
List<ResolveInfo> list = pkgMag.queryIntentActivities(intent,
|
||||||
|
PackageManager.GET_ACTIVITIES);
|
||||||
|
for (int i = 0; i < list.size(); i++) {
|
||||||
|
ResolveInfo info = list.get(i);
|
||||||
|
if (info.activityInfo.packageName.equals(packageName)) {
|
||||||
|
mainAct = info.activityInfo.name;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (TextUtils.isEmpty(mainAct)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
intent.setComponent(new ComponentName(packageName, mainAct));
|
||||||
|
return intent;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 安装一个apk文件
|
* 安装一个apk文件
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import android.app.ActivityManager;
|
|||||||
import android.app.ActivityManagerNative;
|
import android.app.ActivityManagerNative;
|
||||||
import android.app.ActivityTaskManager;
|
import android.app.ActivityTaskManager;
|
||||||
import android.app.NotificationManager;
|
import android.app.NotificationManager;
|
||||||
|
import android.app.role.RoleManager;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -12,7 +13,9 @@ import android.content.ContextWrapper;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
|
import android.content.pm.PackageInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
|
import android.content.pm.ResolveInfo;
|
||||||
import android.content.pm.UserInfo;
|
import android.content.pm.UserInfo;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.media.AudioManager;
|
import android.media.AudioManager;
|
||||||
@@ -23,7 +26,10 @@ import android.os.BatteryManager;
|
|||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
|
import android.os.Process;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
|
import android.os.SystemProperties;
|
||||||
|
import android.os.UserHandle;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@@ -52,6 +58,8 @@ import java.util.LinkedHashSet;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.Executor;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
import static android.app.ActivityManager.RECENT_IGNORE_UNAVAILABLE;
|
import static android.app.ActivityManager.RECENT_IGNORE_UNAVAILABLE;
|
||||||
|
|
||||||
@@ -639,14 +647,171 @@ public class JGYUtils {
|
|||||||
return processName;
|
return processName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String Launcher3 = "com.android.launcher3";
|
||||||
|
private String Launcher3Class = "com.android.launcher3.Launcher";
|
||||||
|
|
||||||
|
public void setDefaultLauncher(Context context, String defPackageName, String defClassName) {
|
||||||
|
try {
|
||||||
|
if (!TextUtils.isEmpty(defPackageName) && !TextUtils.isEmpty(defClassName)) {
|
||||||
|
IntentFilter filter = new IntentFilter();
|
||||||
|
filter.addAction("android.intent.action.MAIN");
|
||||||
|
filter.addCategory("android.intent.category.HOME");
|
||||||
|
filter.addCategory("android.intent.category.DEFAULT");
|
||||||
|
Intent intent = new Intent(Intent.ACTION_MAIN);
|
||||||
|
intent.addCategory(Intent.CATEGORY_HOME);
|
||||||
|
// 返回给定条件的所有ResolveInfo对象(本质上是Activity)
|
||||||
|
List<ResolveInfo> list = context.getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
|
||||||
|
int bestMatch = 0;
|
||||||
|
final int size = list.size();
|
||||||
|
ComponentName[] set = new ComponentName[size];
|
||||||
|
for (int i = 0; i < size; i++) {
|
||||||
|
ResolveInfo ri = list.get(i);
|
||||||
|
set[i] = new ComponentName(ri.activityInfo.packageName, ri.activityInfo.name);
|
||||||
|
if (ri.match > bestMatch) {
|
||||||
|
bestMatch = ri.match;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ComponentName preActivity = new ComponentName(defPackageName, defClassName);
|
||||||
|
context.getPackageManager().addPreferredActivity(filter, bestMatch, set, preActivity);
|
||||||
|
}
|
||||||
|
} catch (java.lang.SecurityException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
Log.e(TAG, "setDefaultLauncher: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleHolderAsUser(Context context, String packageName) {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||||
|
String roleName = "android.app.role.HOME";
|
||||||
|
boolean add = true;
|
||||||
|
int flags = 0;
|
||||||
|
UserHandle user = Process.myUserHandle();
|
||||||
|
Log.i("settingssssssstemf", (add ? "Adding" : "Removing") + " package as role holder, role: "
|
||||||
|
+ roleName + ", package: " + packageName);
|
||||||
|
if (JGYUtils.getInstance().checkAppPlatform() != JGYUtils.MTKPlatform) {
|
||||||
|
RoleManager roleManager = context.getSystemService(RoleManager.class);
|
||||||
|
Executor executor = context.getMainExecutor();
|
||||||
|
Consumer<Boolean> callback = successful -> {
|
||||||
|
if (successful) {
|
||||||
|
Log.d("settingssssssstemf", "Package " + (add ? "added" : "removed")
|
||||||
|
+ " as role holder, role: " + roleName + ", package: " + packageName);
|
||||||
|
} else {
|
||||||
|
Log.d("settingssssssstemf", "Failed to " + (add ? "add" : "remove")
|
||||||
|
+ " package as role holder, role: " + roleName + ", package: "
|
||||||
|
+ packageName);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
roleManager.addRoleHolderAsUser(roleName, packageName, flags, user, executor, callback);
|
||||||
|
Log.i("settingssssssstemf", "addRoleHolderAsUser done");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void checkDefaultDesktop(String pkg) {
|
||||||
|
String desktopPkg = (String) SPUtils.get(mContext, "default_launcher", "");
|
||||||
|
Log.e(TAG, "checkDefaultDesktop: " + desktopPkg);
|
||||||
|
if (desktopPkg.equalsIgnoreCase(pkg)) {
|
||||||
|
setDefaultDesktop(pkg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置默认桌面
|
||||||
|
public void setDefaultDesktop(String pkg) {
|
||||||
|
Log.e(TAG, "setDefaultDesktop: " + pkg);
|
||||||
|
if (TextUtils.isEmpty(pkg)) {
|
||||||
|
openLauncher3();
|
||||||
|
} else {
|
||||||
|
String className = getStartClassName(pkg);
|
||||||
|
if (TextUtils.isEmpty(className)) {
|
||||||
|
openLauncher3();
|
||||||
|
} else {
|
||||||
|
setDefaultDesktop(pkg, className);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void openLauncher3() {
|
||||||
|
setDefaultDesktop(Launcher3, Launcher3Class);
|
||||||
|
ApkUtils.openPackage(mContext, Launcher3);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStartClassName(String pkg) {
|
||||||
|
PackageInfo packageInfo = null;
|
||||||
|
try {
|
||||||
|
packageInfo = mContext.getPackageManager().getPackageInfo(pkg, 0);
|
||||||
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
if (packageInfo == null) {
|
||||||
|
return "";
|
||||||
|
} else {
|
||||||
|
// 创建一个类别为CATEGORY_LAUNCHER的该包名的Intent
|
||||||
|
Intent resolveIntent = new Intent(Intent.ACTION_MAIN, null);
|
||||||
|
resolveIntent.addCategory(Intent.CATEGORY_LAUNCHER);
|
||||||
|
resolveIntent.setPackage(packageInfo.packageName);
|
||||||
|
|
||||||
|
// 通过getPackageManager()的queryIntentActivities方法遍历
|
||||||
|
List<ResolveInfo> resolveinfoList = mContext.getPackageManager()
|
||||||
|
.queryIntentActivities(resolveIntent, 0);
|
||||||
|
if (resolveinfoList == null || resolveinfoList.size() == 0) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
ResolveInfo resolveinfo = resolveinfoList.iterator().next();
|
||||||
|
if (resolveinfo != null) {
|
||||||
|
// packagename = 参数packname
|
||||||
|
String packageName = resolveinfo.activityInfo.packageName;
|
||||||
|
// 这个就是我们要找的该APP的LAUNCHER的Activity[组织形式:packagename.mainActivityname]
|
||||||
|
String className = resolveinfo.activityInfo.name;
|
||||||
|
return className;
|
||||||
|
} else {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setDefaultDesktop(String pkg, String className) {
|
public void setDefaultDesktop(String pkg, String className) {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||||
|
setRoleHolderAsUser(mContext, pkg);
|
||||||
|
Log.e(TAG, "setDefaultDesktop: setRoleHolderAsUser");
|
||||||
|
} else {
|
||||||
|
//爱华设置,暂时屏蔽
|
||||||
|
// setDefaultLauncher(mContext, pkg, className);
|
||||||
|
Log.e(TAG, "setDefaultDesktop: setDefaultLauncher");
|
||||||
|
}
|
||||||
|
// String oldDesktop = (String) SPUtils.get(mContext, "default_launcher", "");
|
||||||
|
// if (Objects.equals(oldDesktop, pkg)) {
|
||||||
|
// Log.e(TAG, "setDefaultDesktop: " + "数据一致");
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
Intent intent = new Intent("setDefaultLauncher");
|
Intent intent = new Intent("setDefaultLauncher");
|
||||||
intent.putExtra("package", pkg);
|
intent.putExtra("package", pkg);
|
||||||
intent.putExtra("className", className);
|
intent.putExtra("className", className);
|
||||||
|
if (JGYUtils.getInstance().checkAppPlatform() == MTKPlatform) {
|
||||||
|
Log.e(TAG, "setDefaultDesktop: MTK");
|
||||||
|
//爱华定制
|
||||||
|
intent.setComponent(new ComponentName("com.android.settings", "com.android.settings.AoleReceiver"));
|
||||||
|
// TODO: 2022/7/6 有问题
|
||||||
|
setDefaultLauncher(mContext, "com.android.transfer", "com.android.transfer.MainActivity");
|
||||||
|
SystemProperties.set("persist.sys.launcher.pkgname", pkg);
|
||||||
|
SystemProperties.set("persist.sys.launcher.classname", className);
|
||||||
|
}
|
||||||
intent.setPackage("com.android.settings");
|
intent.setPackage("com.android.settings");
|
||||||
mContext.sendBroadcast(intent);
|
mContext.sendBroadcast(intent);
|
||||||
|
// ApkUtils.openPackage(mContext, pkg);
|
||||||
|
Log.e(TAG, "setDefaultDesktop: " + pkg + ":" + className);
|
||||||
|
Log.e(TAG, "setDefaultDesktop: " + "persist.sys.launcher.pkgname = " + SystemProperties.get("persist.sys.launcher.pkgname"));
|
||||||
|
Log.e(TAG, "setDefaultDesktop: " + "persist.sys.launcher.classname = " + SystemProperties.get("persist.sys.launcher.classname"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// public void setDefaultDesktop(String pkg, String className) {
|
||||||
|
// Intent intent = new Intent("setDefaultLauncher");
|
||||||
|
// intent.putExtra("package", pkg);
|
||||||
|
// intent.putExtra("className", className);
|
||||||
|
// intent.setPackage("com.android.settings");
|
||||||
|
// mContext.sendBroadcast(intent);
|
||||||
|
// }
|
||||||
|
|
||||||
public ArrayList<String> getForbidList() {
|
public ArrayList<String> getForbidList() {
|
||||||
ArrayList<String> disableApp = new ArrayList<>();
|
ArrayList<String> disableApp = new ArrayList<>();
|
||||||
int search_topic = (int) SPUtils.get(mContext, "search_topic", 0);
|
int search_topic = (int) SPUtils.get(mContext, "search_topic", 0);
|
||||||
@@ -958,7 +1123,7 @@ public class JGYUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void getLauncherClassName(String pkg) {
|
public void getLauncherClassName(String pkg) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getInputMethodId(String pkg) {
|
public String getInputMethodId(String pkg) {
|
||||||
@@ -985,6 +1150,13 @@ public class JGYUtils {
|
|||||||
mContext.sendBroadcast(intent);
|
mContext.sendBroadcast(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setDefaultBrowser(String pkg) {
|
||||||
|
Intent intent = new Intent("setDefaultBrowser");
|
||||||
|
intent.putExtra("package", pkg);
|
||||||
|
intent.setPackage("com.android.settings");
|
||||||
|
mContext.sendBroadcast(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*AI健康*/
|
/*AI健康*/
|
||||||
public static final String AIHealth = "com.uiui.health";
|
public static final String AIHealth = "com.uiui.health";
|
||||||
|
|||||||
Reference in New Issue
Block a user