huangcm
2025-04-09 4696e2bde39d1780d2f64566b149f32011b4f9f4
feat(Launcher3): add boot on DeviceTest config
3 files modified
54 ■■■■■ changed files
android/device/softwinner/ceres-c3/ceres_c3.mk 14 ●●●●● patch | view | raw | blame | history
android/packages/apps/Launcher3/src/com/android/launcher3/Launcher.java 25 ●●●●● patch | view | raw | blame | history
android/packages/apps/Launcher3/src/com/android/launcher3/Utilities.java 15 ●●●●● patch | view | raw | blame | history
android/device/softwinner/ceres-c3/ceres_c3.mk
....@@ -164,11 +164,13 @@
164164 CalculateTest
165165
166166 PRODUCT_PACKAGES += \
167
+ DeviceTest
168
+
169
+PRODUCT_PACKAGES += \
167170 tinyplay \
168171 tinycap \
169172 tinymix \
170173 tinypcminfo
171
-
172174
173175 #PRODUCT_PACKAGES += AllwinnerGmsIntegration
174176
....@@ -230,6 +232,9 @@
230232 PRODUCT_COPY_FILES += \
231233 $(LOCAL_PATH)/media/bootanimation.zip:system/media/bootanimation.zip
232234
235
+PRODUCT_COPY_FILES += \
236
+ vendor/aw/public/package/apk/DeviceTest_V1/assets/DeviceTestConfig_K5C.xml:vendor/etc/DeviceTestConfig.xml
237
+
233238 # preferred activity
234239 PRODUCT_COPY_FILES += \
235240 $(LOCAL_PATH)/configs/preferred-apps/custom.xml:system/etc/preferred-apps/custom.xml
....@@ -264,6 +269,13 @@
264269 ro.config.alarm_vol_default=7 \
265270 ro.config.system_vol_default=7
266271
272
+PRODUCT_PROPERTY_OVERRIDES += \
273
+ persist.sys.bootAppPack=null \
274
+ persist.sys.bootAppClass=null
275
+
276
+PRODUCT_PROPERTY_OVERRIDES += \
277
+ persist.sys.bootonDeviceTest=0
278
+
267279 #language pack
268280 PRODUCT_PRODUCT_PROPERTIES += \
269281 ro.com.google.ime.system_lm_dir= /product/usr/share/ime/google/d3_lms
android/packages/apps/Launcher3/src/com/android/launcher3/Launcher.java
....@@ -46,6 +46,7 @@
4646 import android.content.BroadcastReceiver;
4747 import android.content.ComponentCallbacks2;
4848 import android.content.Context;
49
+import android.content.ComponentName;
4950 import android.content.Intent;
5051 import android.content.IntentFilter;
5152 import android.content.IntentSender;
....@@ -318,6 +319,28 @@
318319 }
319320 }
320321
322
+ static void LauncherbootApp(Context context) {
323
+ try {
324
+ Intent myintent = new Intent(Intent.ACTION_MAIN);
325
+ String bootAppPack = "null";
326
+ String bootAppClass = "null";
327
+ if ("1".equals(Utilities.getSystemProperty("persist.sys.bootonDeviceTest", "0"))) {
328
+ bootAppPack = "com.DeviceTest";
329
+ bootAppClass = "com.DeviceTest.DeviceTest";
330
+ Utilities.setSystemProperty("persist.sys.bootonDeviceTest", "0");
331
+ } else {
332
+ bootAppPack = Utilities.getSystemProperty("persist.sys.bootAppPack", "null");
333
+ bootAppClass = Utilities.getSystemProperty("persist.sys.bootAppClass", "null");
334
+ }
335
+ Log.i("kickpi","will boot up APP - " + bootAppPack + "/" + bootAppClass);
336
+ ComponentName cn = new ComponentName(bootAppPack, bootAppClass);
337
+ myintent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
338
+ myintent.setComponent(cn);
339
+ context.startActivity(myintent);
340
+ } catch (Exception e) {
341
+ e.printStackTrace();
342
+ }
343
+ }
321344
322345 @Override
323346 protected void onCreate(Bundle savedInstanceState) {
....@@ -340,6 +363,8 @@
340363 logBootEvent("Launcher:onCreate start");
341364 Log.i(TAG,"Launcher:onCreate start");
342365
366
+ LauncherbootApp(this);
367
+
343368 TraceHelper.beginSection("Launcher-onCreate");
344369
345370 super.onCreate(savedInstanceState);
android/packages/apps/Launcher3/src/com/android/launcher3/Utilities.java
....@@ -537,6 +537,21 @@
537537 return defaultValue;
538538 }
539539
540
+ public static boolean setSystemProperty(String property, String value) {
541
+ if (TextUtils.isEmpty(property) || TextUtils.isEmpty(value)) {
542
+ return false;
543
+ }
544
+ try {
545
+ Class clazz = Class.forName("android.os.SystemProperties");
546
+ Method setter = clazz.getDeclaredMethod("set", String.class, String.class);
547
+ setter.invoke(null, property, value);
548
+ return true;
549
+ } catch (Exception e) {
550
+ Log.d(TAG, "Failed to set property: " + e.getMessage());
551
+ return false;
552
+ }
553
+ }
554
+
540555 /**
541556 * Ensures that a value is within given bounds. Specifically:
542557 * If value is less than lowerBound, return lowerBound; else if value is greater than upperBound,