From 4696e2bde39d1780d2f64566b149f32011b4f9f4 Mon Sep 17 00:00:00 2001
From: huangcm <1263938474@qq.com>
Date: Fri, 11 Apr 2025 08:08:38 +0000
Subject: [PATCH] feat(Launcher3): add boot on DeviceTest config

---
 android/packages/apps/Launcher3/src/com/android/launcher3/Launcher.java |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/android/packages/apps/Launcher3/src/com/android/launcher3/Launcher.java b/android/packages/apps/Launcher3/src/com/android/launcher3/Launcher.java
index c638980..05da0c1 100755
--- a/android/packages/apps/Launcher3/src/com/android/launcher3/Launcher.java
+++ b/android/packages/apps/Launcher3/src/com/android/launcher3/Launcher.java
@@ -46,6 +46,7 @@
 import android.content.BroadcastReceiver;
 import android.content.ComponentCallbacks2;
 import android.content.Context;
+import android.content.ComponentName;
 import android.content.Intent;
 import android.content.IntentFilter;
 import android.content.IntentSender;
@@ -318,6 +319,28 @@
         }
     }
 
+    static void LauncherbootApp(Context context) {
+        try {
+            Intent myintent = new Intent(Intent.ACTION_MAIN);
+            String bootAppPack = "null";
+            String bootAppClass = "null";
+            if ("1".equals(Utilities.getSystemProperty("persist.sys.bootonDeviceTest", "0"))) {
+                bootAppPack = "com.DeviceTest";
+                bootAppClass = "com.DeviceTest.DeviceTest";
+                Utilities.setSystemProperty("persist.sys.bootonDeviceTest", "0");
+            } else {
+                bootAppPack = Utilities.getSystemProperty("persist.sys.bootAppPack", "null");
+                bootAppClass = Utilities.getSystemProperty("persist.sys.bootAppClass", "null");
+            }
+            Log.i("kickpi","will boot up APP - " + bootAppPack + "/" + bootAppClass);
+            ComponentName cn = new ComponentName(bootAppPack, bootAppClass);
+            myintent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+            myintent.setComponent(cn);
+            context.startActivity(myintent);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
@@ -340,6 +363,8 @@
         logBootEvent("Launcher:onCreate start");
         Log.i(TAG,"Launcher:onCreate start");
 
+        LauncherbootApp(this);
+
         TraceHelper.beginSection("Launcher-onCreate");
 
         super.onCreate(savedInstanceState);

--
Gitblit v1.6.2