Enables you to enter an Activity by pressing a preset button on any non-lock screen interface.
Modify the following methods in the alps/frameworks/base/policy/src/com/android/internal/policy/impl/PhoneWindowManager. java file:
Public long interceptKeyBeforeDispatching (WindowState win, KeyEvent event, int policyFlags)
Find the following code snippet:
Else if (keyCode = KeyEvent. KEYCODE_APP_SWITCH ){
If (down & repeatCount = 0 &&! KeyguardOn ){
Showorhiderecent1_dialog (recent_assist_behavior_show_or_dismiss );
}
Return-1;
}
Add the corresponding code after this else if:
Else if (keyCode = KeyEvent. KEYCODE_APP_SWITCH ){
If (down & repeatCount = 0 &&! KeyguardOn ){
Showorhiderecent1_dialog (recent_assist_behavior_show_or_dismiss );
}
Return-1;
} // Add begin
Else if (keyCode = KeyEvent. KEYCODE_XXX ){
If (down & repeatCount = 0 &&! KeyguardOn ){
MContext. startActivity (new Intent (intent. xxx). addFlags (Intent. FLAG_ACTIVITY_NEW_TASK ));
}
Return-1;
} // Add end
Note:
1. The KeyEvent. KEYCODE_XXX written above is the pre-set key value of the hard key. You can set it as needed;
2. In startActivity (new Intent (intent. xxx), intent. xxx needs to be written according to the started activity.