version:1.6.4

fix:修复U807设置默认桌面问题
update:没有安装设备信息可以直接打开应用
This commit is contained in:
2023-10-26 10:04:01 +08:00
parent 7ed3114868
commit a8f1198eef
7 changed files with 74 additions and 44 deletions

View File

@@ -606,12 +606,21 @@ public class ApkUtils {
public static void gotoLauncher(Context context) {
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.Q) {
Intent homeIntent = new Intent(Intent.ACTION_MAIN);
homeIntent.setPackage("com.android.launcher3");
homeIntent.addCategory(Intent.CATEGORY_HOME);
homeIntent.addCategory(Intent.CATEGORY_DEFAULT);
homeIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(homeIntent);
if ("U807".equals(BuildConfig.platform)) {
Intent homeIntent = new Intent(Intent.ACTION_MAIN);
homeIntent.setPackage("com.uiuipad.os");
homeIntent.addCategory(Intent.CATEGORY_HOME);
homeIntent.addCategory(Intent.CATEGORY_DEFAULT);
homeIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(homeIntent);
} else {
Intent homeIntent = new Intent(Intent.ACTION_MAIN);
homeIntent.setPackage("com.android.launcher3");
homeIntent.addCategory(Intent.CATEGORY_HOME);
homeIntent.addCategory(Intent.CATEGORY_DEFAULT);
homeIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(homeIntent);
}
} else {
Intent i = new Intent(Intent.ACTION_MAIN);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); //android123提示如果是服务里调用必须加入new task标识

View File

@@ -55,6 +55,9 @@ public class OpenApkUtils {
}
private boolean checkActivation() {
if (!ApkUtils.isAvailable(mContext, "com.uiui.zy")) {
return true;
}
int is_activation = Settings.Global.getInt(mContext.getContentResolver(), CommonConfig.UIUI_ACTIVATION_KEY, 0);
if (is_activation != 1) {
ApkUtils.openPackage(mContext, "com.uiui.zy", "com.uiui.zy.activity.main.MainActivity");

View File

@@ -1,6 +1,6 @@
package com.uiui.zyos.utils;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.Intent;
@@ -29,6 +29,7 @@ import com.google.zxing.qrcode.QRCodeWriter;
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
import com.uiui.zyos.BuildConfig;
import com.uiui.zyos.R;
import com.uiui.zyos.manager.RemoteManager;
import java.io.File;
import java.lang.reflect.Method;
@@ -40,9 +41,10 @@ public class Utils {
/**
* 获取设备序列号
*
// * @return
// */
* <p>
* // * @return
* //
*/
// @SuppressLint("MissingPermission")
// public static String getSerial() {
// String serial = "unknow";
@@ -65,7 +67,6 @@ public class Utils {
// }
// return serial;
// }
public static String getAndroiodScreenProperty(Context context) {
Log.e("getAndroiodScreenProperty", "heightPixels" + context.getResources().getDisplayMetrics().heightPixels);
Log.e("getAndroiodScreenProperty", "widthPixels" + context.getResources().getDisplayMetrics().widthPixels);
@@ -236,4 +237,30 @@ public class Utils {
//true为打开false为关闭
return powerManager.isInteractive();
}
public static void exitDesktop(Activity context) {
if ("U807".equals(BuildConfig.platform)) {
RemoteManager.getInstance().setDefaultDesktop("com.uiuipad.os");
} else {
RemoteManager.getInstance().setDefaultDesktop(ApkUtils.ANDROID_LAUNCHER3_PACKAGE_NAME);
}
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.Q) {
if ("U807".equals(BuildConfig.platform)) {
if (!ApkUtils.openPackage(context, "com.uiuipad.os", "com.uiuipad.os.Launcher")) {
ApkUtils.gotoLauncher(context);
}
} else {
if (!ApkUtils.openPackage(context, ApkUtils.ANDROID_LAUNCHER3_PACKAGE_NAME, ApkUtils.ANDROID_LAUNCHER3_Quickstep_CLASS_NAME)) {
ApkUtils.gotoLauncher(context);
}
}
} else {
if (!ApkUtils.openPackage(context, ApkUtils.ANDROID_LAUNCHER3_PACKAGE_NAME, ApkUtils.ANDROID_LAUNCHER3_CLASS_NAME)) {
ApkUtils.gotoLauncher(context);
}
}
context.finish();
System.exit(0);
}
}