遥控器开启内存测试或者老化模式

85 阅读1分钟

diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java
index a55fee6961f..c8b33cf0cbe 100755
--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -158,6 +158,7 @@ import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;
+import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;

@@ -172,9 +173,9 @@ import com.android.server.am.ActivityStackSupervisor;
*/
public class PhoneWindowManager implements WindowManagerPolicy {
static final String TAG = "WindowManager";
static final boolean DEBUG = false;
static final boolean localLOGV = false;
static final boolean DEBUG_INPUT = false;
static final boolean DEBUG_KEYGUARD = false;
static final boolean DEBUG_LAYOUT = false;
static final boolean DEBUG_STARTING_WINDOW = false;
@@ -379,7 +380,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
int[] mNavigationBarWidthForRotationDefault = new int[4];
int[] mNavigationBarHeightForRotationInCarMode = new int[4];
int[] mNavigationBarWidthForRotationInCarMode = new int[4];
-
+     List<Integer> keyCounts=new ArrayList<Integer>();
private LongSparseArray<IShortcutService> mShortcutKeyServices = new LongSparseArray<>();

// Whether to allow dock apps with METADATA_DOCK_HOME to temporarily take over the Home key.
@@ -3279,10 +3280,45 @@ public class PhoneWindowManager implements WindowManagerPolicy {
if (mPendingMetaAction && !KeyEvent.isMetaKey(keyCode)) {
mPendingMetaAction = false;
}
-        // Any key that is not Alt or Meta cancels Caps Lock combo tracking.
-        if (mPendingCapsLockToggle && !KeyEvent.isMetaKey(keyCode) && !KeyEvent.isAltKey(keyCode)) {
-            mPendingCapsLockToggle = false;
-        }
+               if(down)
+               {      Log.e("ldp"," keycount0000000000000>="+keyCounts.size());
+                       if(keyCode!=KeyEvent.KEYCODE_1&&keyCode!=KeyEvent.KEYCODE_2&&keyCode!=KeyEvent.KEYCODE_3)
+                       {
+                               keyCounts.clear();
+                       }
+        //by lidongping start
+               //Log.e("ldp"," keycount000011111>="+keyCounts.size());
+                       if (keyCode == KeyEvent.KEYCODE_1)
+                       {
+                               if(keyCounts.size()==0)
+                                       keyCounts.add(1);
+                               else {
+                                       keyCounts.clear();
+                                       keyCounts.add(1);
+                               }
+                               //Log.e("ldp"," KeyEvent.KEYCODE_1>="+keyCounts.size());
+                       }
+                        else if (keyCode == KeyEvent.KEYCODE_2)
+                       {
+                               if(keyCounts.size()==1)
+                                       keyCounts.add(2);
+                               else {
+                                       keyCounts.clear();
+
+                               }
+                               //Log.e("ldp"," KeyEvent.KEYCODE_2>="+keyCounts.size());
+                       }
+                       else if(keyCode == KeyEvent.KEYCODE_3)
+                       {
+                               if(keyCounts.size()==2)
+                                       keyCounts.add(3);
+                               else {
+                                       keyCounts.clear();
+
+                               }
+                               //Log.e("ldp"," KeyEvent.KEYCODE_3>="+keyCounts.size());
+                       }
+               }

// First we always handle the home key here, so applications
// can never break it, although if keyguard is on, we do let
@@ -3692,7 +3728,18 @@ public class PhoneWindowManager implements WindowManagerPolicy {
if ((metaState & KeyEvent.META_META_ON) != 0) {
return -1;
}
-
+//by lidongping start
+      //  Log.e("ldp"," keycount111111111111111111>="+keyCounts.size());
+        if(keyCounts.size() ==3&&down)
+        {
+                       //Log.e("ldp"," keycount>="+keyCounts.size());
+            keyCounts.clear();
+            Intent agingIntent = new Intent();
+            agingIntent.setAction("com.rockchip.devicetest.action.MEMTESTACTIVITY");
+            agingIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+            startActivityAsUser(agingIntent,UserHandle.CURRENT_OR_SELF);
+        }
+        //by lidongping en
// Let the application handle the key.
return 0;
}