huangcm
2025-05-08 76a1e955045b9ab0f6ff3d883403d08e1fcd2752
android/frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java
....@@ -2644,8 +2644,33 @@
26442644 + repeatCount + " keyguardOn=" + keyguardOn + " canceled=" + canceled);
26452645 }
26462646
2647
- if(down) {
2648
- pwd += String.valueOf(keyCode);
2647
+ //-----------------------kickpi code--------------
2648
+ if (down) {
2649
+ pwd += String.valueOf(keyCode);
2650
+
2651
+ Log.d(TAG, "kickpi pwd = " + pwd);
2652
+
2653
+ if (pwd.contains("1412151297")) { //758520
2654
+ String irConfig = SystemProperties.get("persist.sys.kickpi.irkeylock","0");
2655
+ if("1".equals(irConfig)) {
2656
+ SystemProperties.set("persist.sys.kickpi.irkeylock","0");
2657
+ mHandler.removeMessages(MSG_SHOW_TOAST);
2658
+ mHandler.sendMessage(mHandler.obtainMessage(MSG_SHOW_TOAST, "Close IR Key Lock"));
2659
+ } else {
2660
+ SystemProperties.set("persist.sys.kickpi.irkeylock","1");
2661
+ mHandler.removeMessages(MSG_SHOW_TOAST);
2662
+ mHandler.sendMessage(mHandler.obtainMessage(MSG_SHOW_TOAST, "Open IR Key Lock"));
2663
+ }
2664
+ pwd = "";
2665
+ }
2666
+
2667
+ String IRKeyProp = SystemProperties.get("persist.sys.kickpi.irkeylock");
2668
+ if ("1".equals(IRKeyProp)) {
2669
+ mHandler.removeMessages(MSG_SHOW_TOAST);
2670
+ mHandler.sendMessage(mHandler.obtainMessage(MSG_SHOW_TOAST, "IR Key Locking"));
2671
+ Log.e(TAG, "IR POWER KEY LOCK");
2672
+ return -1;
2673
+ }
26492674 if(pwd.contains("3822020")){ // home menu 2down
26502675 try {
26512676 Intent intent = new Intent(Intent.ACTION_MAIN);
....@@ -2701,18 +2726,6 @@
27012726 e.printStackTrace();
27022727 }
27032728 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 = "";
27162729 } else if(pwd.contains("14121512910")){ // 8521 adb switch
27172730 String adbConfig = SystemProperties.get("persist.vendor.adb.enable","0");
27182731 if("1".equals(adbConfig)) {
....@@ -2734,13 +2747,7 @@
27342747 pwd = "";
27352748 }
27362749 }
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;
2743
- }
2750
+ //------------------------------------------------
27442751
27452752 // If we think we might have a volume down & power key chord on the way
27462753 // but we're not sure, then tell the dispatcher to wait a little while and
....@@ -4004,17 +4011,23 @@
40044011 }
40054012
40064013 case KeyEvent.KEYCODE_POWER: {
4007
- EventLogTags.writeInterceptPower(
4008
- KeyEvent.actionToString(event.getAction()),
4009
- mPowerKeyHandled ? 1 : 0, mPowerKeyPressCounter);
4010
- // Any activity on the power button stops the accessibility shortcut
4011
- cancelPendingAccessibilityShortcutAction();
4012
- result &= ~ACTION_PASS_TO_USER;
4013
- isWakeKey = false; // wake-up will be handled separately
4014
- if (down) {
4015
- interceptPowerKeyDown(event, interactive);
4014
+ // kickpi when ir lock always return
4015
+ String IRKeyProp = SystemProperties.get("persist.sys.kickpi.irkeylock");
4016
+ if ("1".equals(IRKeyProp)) {
4017
+ Log.e(TAG, "IR POWER KEY LOCK");
40164018 } else {
4017
- interceptPowerKeyUp(event, interactive, canceled);
4019
+ EventLogTags.writeInterceptPower(
4020
+ KeyEvent.actionToString(event.getAction()),
4021
+ mPowerKeyHandled ? 1 : 0, mPowerKeyPressCounter);
4022
+ // Any activity on the power button stops the accessibility shortcut
4023
+ cancelPendingAccessibilityShortcutAction();
4024
+ result &= ~ACTION_PASS_TO_USER;
4025
+ isWakeKey = false; // wake-up will be handled separately
4026
+ if (down) {
4027
+ interceptPowerKeyDown(event, interactive);
4028
+ } else {
4029
+ interceptPowerKeyUp(event, interactive, canceled);
4030
+ }
40184031 }
40194032 break;
40204033 }