.. | .. |
---|
232 | 232 | import java.io.PrintWriter; |
---|
233 | 233 | import java.util.HashSet; |
---|
234 | 234 | import java.util.List; |
---|
| 235 | +import android.widget.Toast; |
---|
| 236 | +import android.content.ComponentName; |
---|
235 | 237 | |
---|
236 | 238 | /** |
---|
237 | 239 | * WindowManagerPolicy implementation for the Android phone UI. This |
---|
.. | .. |
---|
248 | 250 | static final boolean DEBUG_SPLASH_SCREEN = false; |
---|
249 | 251 | static final boolean DEBUG_WAKEUP = false; |
---|
250 | 252 | static final boolean SHOW_SPLASH_SCREENS = true; |
---|
| 253 | + private static final int MSG_SHOW_TOAST = 88; |
---|
251 | 254 | |
---|
252 | 255 | // Whether to allow dock apps with METADATA_DOCK_HOME to temporarily take over the Home key. |
---|
253 | 256 | // No longer recommended for desk docks; |
---|
.. | .. |
---|
386 | 389 | private boolean mHasFeatureWatch; |
---|
387 | 390 | private boolean mHasFeatureLeanback; |
---|
388 | 391 | private boolean mHasFeatureHdmiCec; |
---|
| 392 | + private String pwd=""; |
---|
389 | 393 | |
---|
390 | 394 | // Assigned on main thread, accessed on UI thread |
---|
391 | 395 | volatile VrManagerInternal mVrManagerInternal; |
---|
.. | .. |
---|
731 | 735 | break; |
---|
732 | 736 | case MSG_RINGER_TOGGLE_CHORD: |
---|
733 | 737 | handleRingerChordGesture(); |
---|
| 738 | + break; |
---|
| 739 | + case MSG_SHOW_TOAST: |
---|
| 740 | + Toast.makeText(mContext, (String)msg.obj , Toast.LENGTH_SHORT).show(); |
---|
734 | 741 | break; |
---|
735 | 742 | case MSG_MOVE_DISPLAY_TO_TOP: |
---|
736 | 743 | mWindowManagerFuncs.moveDisplayToTop(msg.arg1); |
---|
.. | .. |
---|
1918 | 1925 | filter = new IntentFilter(Intent.ACTION_USER_SWITCHED); |
---|
1919 | 1926 | context.registerReceiver(mMultiuserReceiver, filter); |
---|
1920 | 1927 | |
---|
| 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 | + |
---|
1921 | 1934 | mVibrator = (Vibrator)context.getSystemService(Context.VIBRATOR_SERVICE); |
---|
1922 | 1935 | mLongPressVibePattern = getLongIntArray(mContext.getResources(), |
---|
1923 | 1936 | com.android.internal.R.array.config_longPressVibePattern); |
---|
.. | .. |
---|
2629 | 2642 | if (DEBUG_INPUT) { |
---|
2630 | 2643 | Log.d(TAG, "interceptKeyTi keyCode=" + keyCode + " down=" + down + " repeatCount=" |
---|
2631 | 2644 | + 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; |
---|
2632 | 2743 | } |
---|
2633 | 2744 | |
---|
2634 | 2745 | // If we think we might have a volume down & power key chord on the way |
---|
.. | .. |
---|
4415 | 4526 | } |
---|
4416 | 4527 | }; |
---|
4417 | 4528 | |
---|
| 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 | + |
---|
4418 | 4543 | // Called on the PowerManager's Notifier thread. |
---|
4419 | 4544 | @Override |
---|
4420 | 4545 | public void startedGoingToSleep(int why) { |
---|