huangcm
2024-08-24 fc4c8ccc838b61e008a4a83be4b26b05dc3603d0
feat(test): add factory test app
3 files modified
3 files added
294 ■■■■■ changed files
android/device/softwinner/ceres-c3/ceres_c3.mk 3 ●●●●● patch | view | raw | blame | history
android/frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java 125 ●●●●● patch | view | raw | blame | history
android/frameworks/base/services/core/java/com/android/server/policy/TvWindowManager.java 114 ●●●●● patch | view | raw | blame | history
android/vendor/aw/homlet/prebuild/Android.mk 22 ●●●●● patch | view | raw | blame | history
android/vendor/aw/homlet/prebuild/FT618/Android.mk 30 ●●●●● patch | view | raw | blame | history
android/vendor/aw/homlet/prebuild/FT618/FT618.apk patch | view | raw | blame | history
android/device/softwinner/ceres-c3/ceres_c3.mk
....@@ -159,6 +159,9 @@
159159 PRODUCT_PACKAGES += \
160160 SoundRecorder
161161
162
+PRODUCT_PACKAGES += \
163
+ FT618
164
+
162165 #PRODUCT_PACKAGES += AllwinnerGmsIntegration
163166
164167 ############################### 3G Dongle Support ###############################
android/frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java
....@@ -232,6 +232,8 @@
232232 import java.io.PrintWriter;
233233 import java.util.HashSet;
234234 import java.util.List;
235
+import android.widget.Toast;
236
+import android.content.ComponentName;
235237
236238 /**
237239 * WindowManagerPolicy implementation for the Android phone UI. This
....@@ -248,6 +250,7 @@
248250 static final boolean DEBUG_SPLASH_SCREEN = false;
249251 static final boolean DEBUG_WAKEUP = false;
250252 static final boolean SHOW_SPLASH_SCREENS = true;
253
+ private static final int MSG_SHOW_TOAST = 88;
251254
252255 // Whether to allow dock apps with METADATA_DOCK_HOME to temporarily take over the Home key.
253256 // No longer recommended for desk docks;
....@@ -386,6 +389,7 @@
386389 private boolean mHasFeatureWatch;
387390 private boolean mHasFeatureLeanback;
388391 private boolean mHasFeatureHdmiCec;
392
+ private String pwd="";
389393
390394 // Assigned on main thread, accessed on UI thread
391395 volatile VrManagerInternal mVrManagerInternal;
....@@ -731,6 +735,9 @@
731735 break;
732736 case MSG_RINGER_TOGGLE_CHORD:
733737 handleRingerChordGesture();
738
+ break;
739
+ case MSG_SHOW_TOAST:
740
+ Toast.makeText(mContext, (String)msg.obj , Toast.LENGTH_SHORT).show();
734741 break;
735742 case MSG_MOVE_DISPLAY_TO_TOP:
736743 mWindowManagerFuncs.moveDisplayToTop(msg.arg1);
....@@ -1918,6 +1925,12 @@
19181925 filter = new IntentFilter(Intent.ACTION_USER_SWITCHED);
19191926 context.registerReceiver(mMultiuserReceiver, filter);
19201927
1928
+ filter = new IntentFilter();
1929
+ filter.addAction(Intent.ACTION_SCREEN_OFF);
1930
+ filter.addAction(Intent.ACTION_SCREEN_ON);
1931
+ filter.addAction(Intent.ACTION_SHUTDOWN);
1932
+ context.registerReceiver(mScreenReceiver, filter);
1933
+
19211934 mVibrator = (Vibrator)context.getSystemService(Context.VIBRATOR_SERVICE);
19221935 mLongPressVibePattern = getLongIntArray(mContext.getResources(),
19231936 com.android.internal.R.array.config_longPressVibePattern);
....@@ -2629,6 +2642,104 @@
26292642 if (DEBUG_INPUT) {
26302643 Log.d(TAG, "interceptKeyTi keyCode=" + keyCode + " down=" + down + " repeatCount="
26312644 + repeatCount + " keyguardOn=" + keyguardOn + " canceled=" + canceled);
2645
+ }
2646
+
2647
+ if(down) {
2648
+ pwd += String.valueOf(keyCode);
2649
+ if(pwd.contains("3822020")){ // home menu 2down
2650
+ try {
2651
+ Intent intent = new Intent(Intent.ACTION_MAIN);
2652
+ ComponentName cn = new ComponentName("com.oranth.activate","com.oranth.activate.MainActivity");
2653
+ intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
2654
+ intent.setComponent(cn);
2655
+ mContext.startActivity(intent);
2656
+ } catch (Exception e) {
2657
+ e.printStackTrace();
2658
+ }
2659
+ pwd = "";
2660
+ }else if(pwd.contains("438282")){ //back home 2menu
2661
+ try {
2662
+ Intent intent = new Intent(Intent.ACTION_MAIN);
2663
+ ComponentName cn = new ComponentName("com.oranth.setmac","com.oranth.setmac.MainActivity");
2664
+ intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
2665
+ intent.setComponent(cn);
2666
+ mContext.startActivity(intent);
2667
+ } catch (Exception e) {
2668
+ e.printStackTrace();
2669
+ }
2670
+ pwd = "";
2671
+ } else if(pwd.contains("348282")){ //home+back+2menu
2672
+ try {
2673
+ Intent intent = new Intent(Intent.ACTION_MAIN);
2674
+ ComponentName cn = new ComponentName("com.oranth.factory","com.oranth.factory.MainActivity");
2675
+ intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
2676
+ intent.setComponent(cn);
2677
+ mContext.startActivity(intent);
2678
+ } catch (Exception e) {
2679
+ e.printStackTrace();
2680
+ }
2681
+ pwd = "";
2682
+ } else if(pwd.contains("1412151298")){ //758521
2683
+ try {
2684
+ Intent intent = new Intent(Intent.ACTION_MAIN);
2685
+ ComponentName cn = new ComponentName("com.oranth.factory","com.oranth.factory.MainActivity");
2686
+ intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
2687
+ intent.setComponent(cn);
2688
+ mContext.startActivity(intent);
2689
+ } catch (Exception e) {
2690
+ e.printStackTrace();
2691
+ }
2692
+ pwd = "";
2693
+ } else if(pwd.contains("1412151299")){ //758522
2694
+ try {
2695
+ Intent intent = new Intent(Intent.ACTION_MAIN);
2696
+ ComponentName cn = new ComponentName("com.DeviceTest","com.DeviceTest.DeviceTest");
2697
+ intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
2698
+ intent.setComponent(cn);
2699
+ mContext.startActivity(intent);
2700
+ } catch (Exception e) {
2701
+ e.printStackTrace();
2702
+ }
2703
+ pwd = "";
2704
+ } else if(pwd.contains("1412151297")){ //758520
2705
+ String irConfig = SystemProperties.get("vendor.kickpi.irkey.enable","0");
2706
+ if("1".equals(irConfig)) {
2707
+ SystemProperties.set("vendor.kickpi.irkey.enable","0");
2708
+ mHandler.removeMessages(MSG_SHOW_TOAST);
2709
+ mHandler.sendMessage(mHandler.obtainMessage(MSG_SHOW_TOAST, "Close IR Key"));
2710
+ } else {
2711
+ SystemProperties.set("vendor.kickpi.irkey.enable","1");
2712
+ mHandler.removeMessages(MSG_SHOW_TOAST);
2713
+ mHandler.sendMessage(mHandler.obtainMessage(MSG_SHOW_TOAST, "Open IR Key"));
2714
+ }
2715
+ pwd = "";
2716
+ } else if(pwd.contains("14121512910")){ // 8521 adb switch
2717
+ String adbConfig = SystemProperties.get("persist.vendor.adb.enable","0");
2718
+ if("1".equals(adbConfig)) {
2719
+ SystemProperties.set("persist.vendor.adb.enable","0");
2720
+ mHandler.removeMessages(MSG_SHOW_TOAST);
2721
+ mHandler.sendMessage(mHandler.obtainMessage(MSG_SHOW_TOAST, "Close Adb Debug"));
2722
+ } else {
2723
+ SystemProperties.set("persist.vendor.adb.enable","1");
2724
+ mHandler.removeMessages(MSG_SHOW_TOAST);
2725
+ mHandler.sendMessage(mHandler.obtainMessage(MSG_SHOW_TOAST, "Open Adb Debug"));
2726
+ SystemProperties.set("vendor.remote.logging.upload","1");
2727
+ }
2728
+ pwd = "";
2729
+ }
2730
+
2731
+ if (keyCode == KeyEvent.KEYCODE_DPAD_RIGHT || keyCode == KeyEvent.KEYCODE_DPAD_LEFT ||
2732
+ keyCode == KeyEvent.KEYCODE_DPAD_CENTER ||
2733
+ keyCode == KeyEvent.KEYCODE_DPAD_UP) {
2734
+ pwd = "";
2735
+ }
2736
+ }
2737
+
2738
+ String IRKeyProp = SystemProperties.get("vendor.kickpi.irkey.enable");
2739
+ if ("1".equals(IRKeyProp)) {
2740
+ mHandler.removeMessages(MSG_SHOW_TOAST);
2741
+ mHandler.sendMessage(mHandler.obtainMessage(MSG_SHOW_TOAST, "Close IR Key"));
2742
+ return -1;
26322743 }
26332744
26342745 // If we think we might have a volume down & power key chord on the way
....@@ -4415,6 +4526,20 @@
44154526 }
44164527 };
44174528
4529
+ BroadcastReceiver mScreenReceiver = new BroadcastReceiver() {
4530
+ @Override
4531
+ public void onReceive(Context context, Intent intent) {
4532
+ String action = intent.getAction();
4533
+ if (Intent.ACTION_SCREEN_ON.equals(action)) {
4534
+ SystemProperties.set("vendor.power.status","1");
4535
+ } else if (Intent.ACTION_SCREEN_OFF.equals(action)) {
4536
+ SystemProperties.set("vendor.power.status","0");
4537
+ } else if (Intent.ACTION_SHUTDOWN.equals(action)) {
4538
+ SystemProperties.set("vendor.power.status","0");
4539
+ }
4540
+ }
4541
+ };
4542
+
44184543 // Called on the PowerManager's Notifier thread.
44194544 @Override
44204545 public void startedGoingToSleep(int why) {
android/frameworks/base/services/core/java/com/android/server/policy/TvWindowManager.java
....@@ -129,6 +129,7 @@
129129
130130 import java.io.File;
131131 import java.io.FileReader;
132
+import java.io.FileWriter;
132133 import java.io.IOException;
133134 import java.io.PrintWriter;
134135 import java.util.HashSet;
....@@ -240,6 +241,53 @@
240241 }
241242 };
242243 */
244
+
245
+
246
+ private static final String ROOT_PROPERTY = "persist.vendor.root.enabled";
247
+ private static final String ADB_PROPERTY = "persist.vendor.adb.enabled";
248
+
249
+ private void switchRoot() {
250
+ boolean enabled = SystemProperties.getBoolean(ROOT_PROPERTY, false);
251
+ if (enabled) {
252
+ SystemProperties.set(ROOT_PROPERTY, "0");
253
+ mHandler.post(new Runnable() {
254
+ @Override
255
+ public void run() {
256
+ Toast.makeText(mContext, "Root disabled!", Toast.LENGTH_SHORT).show();
257
+ }
258
+ });
259
+ } else {
260
+ SystemProperties.set(ROOT_PROPERTY, "1");
261
+ mHandler.post(new Runnable() {
262
+ @Override
263
+ public void run() {
264
+ Toast.makeText(mContext, "Root enabled!", Toast.LENGTH_SHORT).show();
265
+ }
266
+ });
267
+ }
268
+ }
269
+
270
+ private void switchAdb() {
271
+ boolean enabled = SystemProperties.getBoolean(ADB_PROPERTY, false);
272
+ if (enabled) {
273
+ SystemProperties.set(ADB_PROPERTY, "0");
274
+ mHandler.post(new Runnable() {
275
+ @Override
276
+ public void run() {
277
+ Toast.makeText(mContext, "ADB disabled!", Toast.LENGTH_SHORT).show();
278
+ }
279
+ });
280
+ } else {
281
+ SystemProperties.set(ADB_PROPERTY, "1");
282
+ mHandler.post(new Runnable() {
283
+ @Override
284
+ public void run() {
285
+ Toast.makeText(mContext, "ADB enabled!", Toast.LENGTH_SHORT).show();
286
+ }
287
+ });
288
+ }
289
+ }
290
+
243291 /** {@inheritDoc} */
244292 @Override
245293 public void init(Context context, IWindowManager windowManager,
....@@ -263,6 +311,7 @@
263311 */
264312 }
265313
314
+ private String pwd = "";
266315 @Override
267316 public void onSystemUiStarted() {
268317 super.onSystemUiStarted();
....@@ -282,6 +331,26 @@
282331
283332 if(down && keyCode != KeyEvent.KEYCODE_POWER && keyCode != KeyEvent.KEYCODE_UNKNOWN){
284333 startFlicker();
334
+ }
335
+
336
+ if (down) {
337
+ pwd += String.valueOf(keyCode);
338
+ if (pwd.contains("1412151298")) { // factory test(password 758521)
339
+ startApp("com.oranth.factory", "com.oranth.factory.MainActivity");
340
+ pwd = "";
341
+ } else if (pwd.contains("1412151299")) { // root switch(password 758522)
342
+ switchRoot();
343
+ pwd = "";
344
+ } else if (pwd.contains("14121512910")) { // adb switch(password 758523)
345
+ switchAdb();
346
+ pwd = "";
347
+ }
348
+
349
+ if (keyCode == KeyEvent.KEYCODE_DPAD_RIGHT || keyCode == KeyEvent.KEYCODE_DPAD_LEFT ||
350
+ keyCode == KeyEvent.KEYCODE_DPAD_CENTER || keyCode == KeyEvent.KEYCODE_DPAD_DOWN ||
351
+ keyCode == KeyEvent.KEYCODE_DPAD_UP) {
352
+ pwd = "";
353
+ }
285354 }
286355
287356 if (keyCode == KeyEvent.KEYCODE_MOUSE) {
....@@ -433,6 +502,51 @@
433502 mFocusedTvWindow = newFocus;
434503 }
435504
505
+ private int startApp(String propertyPkg, Bundle bundle) {
506
+ Intent launchIntent;
507
+ PackageManager packageManager = mContext.getPackageManager();
508
+ String packageName = SystemProperties.get(propertyPkg);
509
+
510
+ if ((packageName == null) || (packageName.length() == 0)) {
511
+ Log.e(TAG, "[startApp] propertyPkg: " + propertyPkg + " is empty!");
512
+ return -1;
513
+ }
514
+
515
+ launchIntent = packageManager.getLaunchIntentForPackage(packageName);
516
+ if (launchIntent == null) {
517
+ launchIntent = packageManager.getLeanbackLaunchIntentForPackage(packageName);
518
+ if (launchIntent == null) {
519
+ Log.e(TAG, "[startApp] can not get intent for package: " + packageName);
520
+ return -1;
521
+ }
522
+ }
523
+ if (bundle != null)
524
+ launchIntent.putExtras(bundle);
525
+
526
+ mContext.startActivity(launchIntent);
527
+ return 0;
528
+ }
529
+
530
+ private int startApp(String propertyPkg) {
531
+ Bundle bundle = null;
532
+ return startApp(propertyPkg, bundle);
533
+ }
534
+
535
+ private int startApp(String propertyPkg, String propertyCls, Bundle bundle) {
536
+
537
+ Intent intent = new Intent();
538
+ intent.setComponent(new ComponentName(propertyPkg, propertyCls));
539
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
540
+ if (bundle != null)
541
+ intent.putExtras(bundle);
542
+ mContext.startActivity(intent);
543
+ return 0;
544
+ }
545
+
546
+ private int startApp(String propertyPkg, String propertyCls) {
547
+ return startApp(propertyPkg, propertyCls, null);
548
+ }
549
+
436550 @Override
437551 public int interceptKeyBeforeQueueing(KeyEvent event, int policyFlags) {
438552 int keyCode = event.getKeyCode();
android/vendor/aw/homlet/prebuild/Android.mk
....@@ -0,0 +1,22 @@
1
+
2
+# Copyright (C) 2008 The Android Open Source Project
3
+# Copyright (C) 2012 Broadcom Corporation
4
+#
5
+# Licensed under the Apache License, Version 2.0 (the "License");
6
+# you may not use this file except in compliance with the License.
7
+# You may obtain a copy of the License at
8
+#
9
+# http://www.apache.org/licenses/LICENSE-2.0
10
+#
11
+# Unless required by applicable law or agreed to in writing, software
12
+# distributed under the License is distributed on an "AS IS" BASIS,
13
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+# See the License for the specific language governing permissions and
15
+# limitations under the License.
16
+#
17
+
18
+LOCAL_PATH := $(call my-dir)
19
+
20
+
21
+include $(call all-makefiles-under,$(LOCAL_PATH))
22
+
android/vendor/aw/homlet/prebuild/FT618/Android.mk
....@@ -0,0 +1,30 @@
1
+# Copyright (C) 2008 The Android Open Source Project
2
+# Copyright (C) 2012 Broadcom Corporation
3
+#
4
+# Licensed under the Apache License, Version 2.0 (the "License");
5
+# you may not use this file except in compliance with the License.
6
+# You may obtain a copy of the License at
7
+#
8
+# http://www.apache.org/licenses/LICENSE-2.0
9
+#
10
+# Unless required by applicable law or agreed to in writing, software
11
+# distributed under the License is distributed on an "AS IS" BASIS,
12
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+# See the License for the specific language governing permissions and
14
+# limitations under the License.
15
+#
16
+#
17
+
18
+LOCAL_PATH := $(call my-dir)
19
+include $(CLEAR_VARS)
20
+LOCAL_MODULE_TAGS := optional
21
+LOCAL_MODULE_CLASS := APPS
22
+LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
23
+LOCAL_CERTIFICATE := PRESIGNED
24
+
25
+LOCAL_MODULE := FT618
26
+
27
+LOCAL_SRC_FILES := $(LOCAL_MODULE).apk
28
+
29
+include $(BUILD_PREBUILT)
30
+
android/vendor/aw/homlet/prebuild/FT618/FT618.apk
Binary files differ