Android 电话拨打界面按back键不结束通话活动
按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
? ? }
?
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。 如若内容造成侵权/违法违规/事实不符,请联系我的编程经验分享网邮箱:veading@qq.com进行投诉反馈,一经查实,立即删除!