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/Utilities.java | 15 +++++++++++++++ android/packages/apps/Launcher3/src/com/android/launcher3/Launcher.java | 25 +++++++++++++++++++++++++ android/device/softwinner/ceres-c3/ceres_c3.mk | 14 +++++++++++++- 3 files changed, 53 insertions(+), 1 deletions(-) diff --git a/android/device/softwinner/ceres-c3/ceres_c3.mk b/android/device/softwinner/ceres-c3/ceres_c3.mk index 5ab65f0..a84a8a4 100755 --- a/android/device/softwinner/ceres-c3/ceres_c3.mk +++ b/android/device/softwinner/ceres-c3/ceres_c3.mk @@ -164,11 +164,13 @@ CalculateTest PRODUCT_PACKAGES += \ + DeviceTest + +PRODUCT_PACKAGES += \ tinyplay \ tinycap \ tinymix \ tinypcminfo - #PRODUCT_PACKAGES += AllwinnerGmsIntegration @@ -230,6 +232,9 @@ PRODUCT_COPY_FILES += \ $(LOCAL_PATH)/media/bootanimation.zip:system/media/bootanimation.zip +PRODUCT_COPY_FILES += \ + vendor/aw/public/package/apk/DeviceTest_V1/assets/DeviceTestConfig_K5C.xml:vendor/etc/DeviceTestConfig.xml + # preferred activity PRODUCT_COPY_FILES += \ $(LOCAL_PATH)/configs/preferred-apps/custom.xml:system/etc/preferred-apps/custom.xml @@ -264,6 +269,13 @@ ro.config.alarm_vol_default=7 \ ro.config.system_vol_default=7 +PRODUCT_PROPERTY_OVERRIDES += \ + persist.sys.bootAppPack=null \ + persist.sys.bootAppClass=null + +PRODUCT_PROPERTY_OVERRIDES += \ + persist.sys.bootonDeviceTest=0 + #language pack PRODUCT_PRODUCT_PROPERTIES += \ ro.com.google.ime.system_lm_dir= /product/usr/share/ime/google/d3_lms 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); diff --git a/android/packages/apps/Launcher3/src/com/android/launcher3/Utilities.java b/android/packages/apps/Launcher3/src/com/android/launcher3/Utilities.java index 65aa3a7..293efc7 100755 --- a/android/packages/apps/Launcher3/src/com/android/launcher3/Utilities.java +++ b/android/packages/apps/Launcher3/src/com/android/launcher3/Utilities.java @@ -537,6 +537,21 @@ return defaultValue; } + public static boolean setSystemProperty(String property, String value) { + if (TextUtils.isEmpty(property) || TextUtils.isEmpty(value)) { + return false; + } + try { + Class clazz = Class.forName("android.os.SystemProperties"); + Method setter = clazz.getDeclaredMethod("set", String.class, String.class); + setter.invoke(null, property, value); + return true; + } catch (Exception e) { + Log.d(TAG, "Failed to set property: " + e.getMessage()); + return false; + } + } + /** * Ensures that a value is within given bounds. Specifically: * If value is less than lowerBound, return lowerBound; else if value is greater than upperBound, -- Gitblit v1.6.2