huangcm
2025-08-14 5d6606c55520a76d5bb8297d83fd9bbf967e5244
feat(bootonapp): fix boot on app in SystemUI
2 files modified
1 files added
59 ■■■■■ changed files
android/frameworks/base/packages/SystemUI/AndroidManifest.xml 9 ●●●●● patch | view | raw | blame | history
android/frameworks/base/packages/SystemUI/src/com/android/systemui/BootonAppReceiver.java 48 ●●●●● patch | view | raw | blame | history
android/packages/apps/Launcher3/src/com/android/launcher3/Launcher.java 2 ●●● patch | view | raw | blame | history
android/frameworks/base/packages/SystemUI/AndroidManifest.xml
....@@ -658,5 +658,14 @@
658658 </intent-filter>
659659 </receiver>
660660
661
+ <receiver
662
+ android:name=".BootonAppReceiver"
663
+ android:enabled="true"
664
+ android:exported="true">
665
+ <intent-filter>
666
+ <action android:name="android.intent.action.BOOT_COMPLETED"></action>
667
+ </intent-filter>
668
+ </receiver>
669
+
661670 </application>
662671 </manifest>
android/frameworks/base/packages/SystemUI/src/com/android/systemui/BootonAppReceiver.java
....@@ -0,0 +1,48 @@
1
+
2
+package com.android.systemui;
3
+
4
+import android.app.NotificationManager;
5
+import android.content.BroadcastReceiver;
6
+import android.content.Context;
7
+import android.content.Intent;
8
+import android.os.Process;
9
+import android.os.SystemProperties;
10
+import android.util.Log;
11
+import android.content.ComponentName;
12
+
13
+import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
14
+
15
+public class BootonAppReceiver extends BroadcastReceiver {
16
+
17
+ static void LauncherbootApp(Context context) {
18
+ try {
19
+ Intent myintent = new Intent(Intent.ACTION_MAIN);
20
+ String bootAppPack = "null";
21
+ String bootAppClass = "null";
22
+
23
+ if ("1".equals(SystemProperties.get("persist.sys.bootonDeviceTest", "0"))) {
24
+ bootAppPack = "com.DeviceTest";
25
+ bootAppClass = "com.DeviceTest.DeviceTest";
26
+ SystemProperties.set("persist.sys.bootonDeviceTest", "0");
27
+ } else {
28
+ bootAppPack = SystemProperties.get("persist.sys.bootAppPack", "null");
29
+ bootAppClass = SystemProperties.get("persist.sys.bootAppClass", "null");
30
+ }
31
+ Log.i("kickpi","will boot up APP - " + bootAppPack + "/" + bootAppClass);
32
+
33
+ ComponentName cn = new ComponentName(bootAppPack, bootAppClass);
34
+ myintent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
35
+ myintent.setComponent(cn);
36
+ context.startActivity(myintent);
37
+ } catch (Exception e) {
38
+ e.printStackTrace();
39
+ }
40
+ }
41
+
42
+ @Override
43
+ public void onReceive(Context context, Intent intent) {
44
+ if (intent.getAction().equals("android.intent.action.BOOT_COMPLETED")) {
45
+ LauncherbootApp(context);
46
+ }
47
+ }
48
+}
android/packages/apps/Launcher3/src/com/android/launcher3/Launcher.java
....@@ -363,7 +363,7 @@
363363 logBootEvent("Launcher:onCreate start");
364364 Log.i(TAG,"Launcher:onCreate start");
365365
366
- LauncherbootApp(this);
366
+ // LauncherbootApp(this);
367367
368368 TraceHelper.beginSection("Launcher-onCreate");
369369