按back键返回时,不结束当前的通话活动【生命周期】
/vendor/mediatek/proprietary/packages/apps/Dialer/java/com/android/incallui/InCallActivity.java
?@Override
? public boolean onKeyUp(int keyCode, KeyEvent event) {
? ? DialpadFragment dialpadFragment = getDialpadFragment();
? ? if (dialpadFragment != null
? ? ? ? && dialpadFragment.isVisible()
? ? ? ? && dialpadFragment.onDialerKeyUp(event)) {
? ? ? return true;
? ? }
? ? if (keyCode == KeyEvent.KEYCODE_CALL) {
? ? ? // Always consume KEYCODE_CALL to ensure the PhoneWindow won't do anything with it.
? ? ? return true;
? ? }
? ? return super.onKeyUp(keyCode, event);
? }
? @Override
? public boolean onKeyDown(int keyCode, KeyEvent event) {
? ? switch (keyCode) {
? ? ? case KeyEvent.KEYCODE_CALL:
? ? ? ? if (!InCallPresenter.getInstance().handleCallKey()) {
? ? ? ? ? LogUtil.e(
? ? ? ? ? ? ? "InCallActivity.onKeyDown",
? ? ? ? ? ? ? "InCallPresenter should always handle KEYCODE_CALL in onKeyDown");
? ? ? ? }
? ? ? ? // Always consume KEYCODE_CALL to ensure the PhoneWindow won't do anything with it.
? ? ? ? return true;
? ? ? ? // Note that KEYCODE_ENDCALL isn't handled here as the standard system-wide handling of it
? ? ? ? // is exactly what's needed, namely
? ? ? ? // (1) "hang up" if there's an active call, or
? ? ? ? // (2) "don't answer" if there's an incoming call.
? ? ? ? // (See PhoneWindowManager for implementation details.)
? ? ? case KeyEvent.KEYCODE_CAMERA:
? ? ? ? // Consume KEYCODE_CAMERA since it's easy to accidentally press the camera button.
? ? ? ? return true;
? ? ? case KeyEvent.KEYCODE_VOLUME_UP:
? ? ? case KeyEvent.KEYCODE_VOLUME_DOWN:
? ? ? case KeyEvent.KEYCODE_VOLUME_MUTE:
? ? ? ? // Ringer silencing handled by PhoneWindowManager.
? ? ? ? break;
? ? ? case KeyEvent.KEYCODE_MUTE:
? ? ? ? TelecomAdapter.getInstance()
? ? ? ? ? ? .mute(!AudioModeProvider.getInstance().getAudioState().isMuted());
? ? ? ? return true;
? ? ? //*/add,saving back key life activity
? ? ? case KeyEvent.KEYCODE_BACK:
? ? ? ? ? ?moveTaskToBack(true);
? ? ? ? return true;
? ? ? //*/
? ? ? case KeyEvent.KEYCODE_SLASH:
? ? ? ? // When verbose logging is enabled, dump the view for debugging/testing purposes.
? ? ? ? if (LogUtil.isVerboseEnabled()) {
? ? ? ? ? View decorView = getWindow().getDecorView();
? ? ? ? ? LogUtil.v("InCallActivity.onKeyDown", "View dump:\n%s", decorView);
? ? ? ? ? return true;
? ? ? ? }
? ? ? ? break;
? ? ? case KeyEvent.KEYCODE_EQUALS:
? ? ? ? break;
? ? ? default: // fall out
? ? }
?