summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorlinyuh <linyuh@google.com>2017-11-17 14:32:32 -0800
committerzachh <zachh@google.com>2017-11-18 07:36:09 +0000
commit57b093b4815afd2d169403c56be1702fae25ad51 (patch)
treed407c65d84c717f7c5663384d523d64e8e83e3ab /java
parent6b96d28ddf93d87ad1253e633771946ea770dfb3 (diff)
Merge the following methods in InCallActivityCommon into InCallActivity:
01. handleDialerKeyDown(int, KeyEvent), 02. onBackPressed(boolean), 03. onDestroy(), 04. onKeyDown(int, KeyEvent), 05. onKeyUp(int, KeyEvent), 06. onPause(), 07. onSaveInstanceState(Bundle), 08. onStart(), 09. onStop(), 10. updateNavigationBar(boolean), and 11. updateTaskDescription(). Note that InCallActivityCommon#handleDialerKeyDown(int, KeyEvent) is merged into InCallActivity#onKeyDown(int, KeyEvent). This is part of the effort to delete InCallActivityCommon. Bug: 69272096 Test: None PiperOrigin-RevId: 176161247 Change-Id: I6e74c7feec5414fb4bc58814eef3bd297d6eb96f
Diffstat (limited to 'java')
-rw-r--r--java/com/android/incallui/InCallActivity.java217
-rw-r--r--java/com/android/incallui/InCallActivityCommon.java226
2 files changed, 197 insertions, 246 deletions
diff --git a/java/com/android/incallui/InCallActivity.java b/java/com/android/incallui/InCallActivity.java
index ed10ed0bb..1e5a5fc02 100644
--- a/java/com/android/incallui/InCallActivity.java
+++ b/java/com/android/incallui/InCallActivity.java
@@ -16,8 +16,10 @@
package com.android.incallui;
+import android.app.ActivityManager.TaskDescription;
import android.app.AlertDialog;
import android.app.Dialog;
+import android.app.KeyguardManager;
import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.GradientDrawable;
@@ -30,6 +32,7 @@ import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
+import android.support.v4.content.res.ResourcesCompat;
import android.support.v4.graphics.ColorUtils;
import android.telephony.TelephonyManager;
import android.view.KeyEvent;
@@ -54,9 +57,11 @@ import com.android.incallui.answer.protocol.AnswerScreen;
import com.android.incallui.answer.protocol.AnswerScreenDelegate;
import com.android.incallui.answer.protocol.AnswerScreenDelegateFactory;
import com.android.incallui.answerproximitysensor.PseudoScreenState;
+import com.android.incallui.audiomode.AudioModeProvider;
import com.android.incallui.call.CallList;
import com.android.incallui.call.DialerCall;
import com.android.incallui.call.DialerCall.State;
+import com.android.incallui.call.TelecomAdapter;
import com.android.incallui.callpending.CallPendingActivity;
import com.android.incallui.disconnectdialog.DisconnectMessage;
import com.android.incallui.incall.bindings.InCallBindings;
@@ -84,6 +89,10 @@ public class InCallActivity extends TransactionSafeFragmentActivity
public static final int PENDING_INTENT_REQUEST_CODE_FULL_SCREEN = 1;
public static final int PENDING_INTENT_REQUEST_CODE_BUBBLE = 2;
+ private static final String DIALPAD_TEXT_KEY = "InCallActivity.dialpad_text";
+
+ private static final String INTENT_EXTRA_SHOW_DIALPAD = "InCallActivity.show_dialpad";
+
private static final String TAG_ANSWER_SCREEN = "tag_answer_screen";
private static final String TAG_DIALPAD_FRAGMENT = "tag_dialpad_fragment";
private static final String TAG_INTERNATIONAL_CALL_ON_WIFI = "tag_international_call_on_wifi";
@@ -168,11 +177,19 @@ public class InCallActivity extends TransactionSafeFragmentActivity
@Override
protected void onSaveInstanceState(Bundle out) {
- LogUtil.i("InCallActivity.onSaveInstanceState", "");
- common.onSaveInstanceState(out);
+ LogUtil.enterBlock("InCallActivity.onSaveInstanceState");
+
+ // TODO: DialpadFragment should handle this as part of its own state
+ out.putBoolean(INTENT_EXTRA_SHOW_DIALPAD, isDialpadVisible());
+ DialpadFragment dialpadFragment = getDialpadFragment();
+ if (dialpadFragment != null) {
+ out.putString(DIALPAD_TEXT_KEY, dialpadFragment.getDtmfText());
+ }
+
out.putBoolean(DID_SHOW_ANSWER_SCREEN_KEY, didShowAnswerScreen);
out.putBoolean(DID_SHOW_IN_CALL_SCREEN_KEY, didShowInCallScreen);
out.putBoolean(DID_SHOW_VIDEO_CALL_SCREEN_KEY, didShowVideoCallScreen);
+
super.onSaveInstanceState(out);
isVisible = false;
}
@@ -180,18 +197,23 @@ public class InCallActivity extends TransactionSafeFragmentActivity
@Override
protected void onStart() {
Trace.beginSection("InCallActivity.onStart");
- LogUtil.i("InCallActivity.onStart", "");
- Trace.beginSection("call super");
super.onStart();
- Trace.endSection();
+
isVisible = true;
showMainInCallFragment();
- common.onStart();
+
+ InCallPresenter.getInstance().setActivity(this);
+ enableInCallOrientationEventListener(
+ getRequestedOrientation()
+ == InCallOrientationEventListener.ACTIVITY_PREFERENCE_ALLOW_ROTATION);
+ InCallPresenter.getInstance().onActivityStarted();
+
if (ActivityCompat.isInMultiWindowMode(this)
&& !getResources().getBoolean(R.bool.incall_dialpad_allowed)) {
// Hide the dialpad because there may not be enough room
showDialpadFragment(false, false);
}
+
Trace.endSection();
}
@@ -213,13 +235,21 @@ public class InCallActivity extends TransactionSafeFragmentActivity
1000);
}
- /** onPause is guaranteed to be called when the InCallActivity goes in the background. */
@Override
protected void onPause() {
Trace.beginSection("InCallActivity.onPause");
- LogUtil.i("InCallActivity.onPause", "");
super.onPause();
- common.onPause();
+
+ DialpadFragment dialpadFragment = getDialpadFragment();
+ if (dialpadFragment != null) {
+ dialpadFragment.onDialerKeyUp(null);
+ }
+
+ InCallPresenter.getInstance().onUiShowing(false);
+ if (isFinishing()) {
+ InCallPresenter.getInstance().unsetActivity(this);
+ }
+
InCallPresenter.getInstance().getPseudoScreenState().removeListener(this);
Trace.endSection();
}
@@ -227,19 +257,42 @@ public class InCallActivity extends TransactionSafeFragmentActivity
@Override
protected void onStop() {
Trace.beginSection("InCallActivity.onStop");
- LogUtil.i("InCallActivity.onStop", "");
isVisible = false;
super.onStop();
- common.onStop();
+
+ // Disconnects the call waiting for a phone account when the activity is hidden (e.g., after the
+ // user presses the home button).
+ // Without this the pending call will get stuck on phone account selection and new calls can't
+ // be created.
+ // Skip this when the screen is locked since the activity may complete its current life cycle
+ // and restart.
+ if (!common.getIsRecreating() && !getSystemService(KeyguardManager.class).isKeyguardLocked()) {
+ DialerCall waitingForAccountCall = CallList.getInstance().getWaitingForAccountCall();
+ if (waitingForAccountCall != null) {
+ waitingForAccountCall.disconnect();
+ }
+ }
+
+ enableInCallOrientationEventListener(false);
+ InCallPresenter.getInstance().updateIsChangingConfigurations();
+ InCallPresenter.getInstance().onActivityStopped();
+ if (!common.getIsRecreating()) {
+ Dialog errorDialog = common.getErrorDialog();
+ if (errorDialog != null) {
+ errorDialog.dismiss();
+ }
+ }
+
Trace.endSection();
}
@Override
protected void onDestroy() {
Trace.beginSection("InCallActivity.onDestroy");
- LogUtil.i("InCallActivity.onDestroy", "");
super.onDestroy();
- common.onDestroy();
+
+ InCallPresenter.getInstance().unsetActivity(this);
+ InCallPresenter.getInstance().updateIsChangingConfigurations();
Trace.endSection();
}
@@ -306,10 +359,31 @@ public class InCallActivity extends TransactionSafeFragmentActivity
@Override
public void onBackPressed() {
- LogUtil.i("InCallActivity.onBackPressed", "");
- if (!common.onBackPressed(didShowInCallScreen || didShowVideoCallScreen)) {
- super.onBackPressed();
+ LogUtil.enterBlock("InCallActivity.onBackPressed");
+
+ if (!isVisible()) {
+ return;
+ }
+
+ if (!getCallCardFragmentVisible()) {
+ return;
+ }
+
+ DialpadFragment dialpadFragment = getDialpadFragment();
+ if (dialpadFragment != null && dialpadFragment.isVisible()) {
+ showDialpadFragment(false /* show */, true /* animate */);
+ return;
}
+
+ if (CallList.getInstance().getIncomingCall() != null) {
+ LogUtil.i(
+ "InCallActivity.onBackPressed",
+ "Ignore the press of the back key when an incoming call is ringing");
+ return;
+ }
+
+ // Nothing special to do. Fall back to the default behavior.
+ super.onBackPressed();
}
@Override
@@ -324,12 +398,79 @@ public class InCallActivity extends TransactionSafeFragmentActivity
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
- return common.onKeyUp(keyCode, event) || super.onKeyUp(keyCode, 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) {
- return common.onKeyDown(keyCode, event) || super.onKeyDown(keyCode, 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;
+
+ 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
+ }
+
+ // Pass other key events to DialpadFragment's "onDialerKeyDown" method in case the user types
+ // in DTMF (Dual-tone multi-frequency signaling) code.
+ DialpadFragment dialpadFragment = getDialpadFragment();
+ if (dialpadFragment != null
+ && dialpadFragment.isVisible()
+ && dialpadFragment.onDialerKeyDown(event)) {
+ return true;
+ }
+
+ return super.onKeyDown(keyCode, event);
}
public boolean isInCallScreenAnimating() {
@@ -371,20 +512,26 @@ public class InCallActivity extends TransactionSafeFragmentActivity
}
public void onForegroundCallChanged(DialerCall newForegroundCall) {
- common.updateTaskDescription();
- if (didShowAnswerScreen && newForegroundCall != null) {
- if (newForegroundCall.getState() == State.DISCONNECTED
- || newForegroundCall.getState() == State.IDLE) {
- LogUtil.i(
- "InCallActivity.onForegroundCallChanged",
- "rejecting incoming call, not updating " + "window background color");
- }
- } else {
+ updateTaskDescription();
+
+ if (newForegroundCall == null || !didShowAnswerScreen) {
LogUtil.v("InCallActivity.onForegroundCallChanged", "resetting background color");
- updateWindowBackgroundColor(0);
+ updateWindowBackgroundColor(0 /* progress */);
}
}
+ // TODO(a bug): Make this method private after InCallActivityCommon is deleted.
+ void updateTaskDescription() {
+ int color =
+ getResources().getBoolean(R.bool.is_layout_landscape)
+ ? ResourcesCompat.getColor(
+ getResources(), R.color.statusbar_background_color, getTheme())
+ : InCallPresenter.getInstance().getThemeColorManager().getSecondaryColor();
+ setTaskDescription(
+ new TaskDescription(
+ getResources().getString(R.string.notification_ongoing_call), null /* icon */, color));
+ }
+
public void updateWindowBackgroundColor(@FloatRange(from = -1f, to = 1.0f) float progress) {
ThemeColorManager themeColorManager = InCallPresenter.getInstance().getThemeColorManager();
@ColorInt int top;
@@ -680,8 +827,18 @@ public class InCallActivity extends TransactionSafeFragmentActivity
@Override
public void onMultiWindowModeChanged(boolean isInMultiWindowMode) {
super.onMultiWindowModeChanged(isInMultiWindowMode);
- if (!isInMultiWindowMode) {
- common.updateNavigationBar(isDialpadVisible());
+ updateNavigationBar(isDialpadVisible());
+ }
+
+ // TODO(a bug): Make this method private after InCallActivityCommon is deleted.
+ void updateNavigationBar(boolean isDialpadVisible) {
+ if (ActivityCompat.isInMultiWindowMode(this)) {
+ return;
+ }
+
+ View navigationBarBackground = getWindow().findViewById(R.id.navigation_bar_background);
+ if (navigationBarBackground != null) {
+ navigationBarBackground.setVisibility(isDialpadVisible ? View.VISIBLE : View.GONE);
}
}
diff --git a/java/com/android/incallui/InCallActivityCommon.java b/java/com/android/incallui/InCallActivityCommon.java
index 8f82295ed..e8588a67a 100644
--- a/java/com/android/incallui/InCallActivityCommon.java
+++ b/java/com/android/incallui/InCallActivityCommon.java
@@ -18,12 +18,9 @@ package com.android.incallui;
import android.app.ActivityManager;
import android.app.ActivityManager.AppTask;
-import android.app.ActivityManager.TaskDescription;
import android.app.Dialog;
-import android.app.KeyguardManager;
import android.content.Intent;
import android.content.res.Configuration;
-import android.content.res.Resources;
import android.os.Bundle;
import android.os.Trace;
import android.support.annotation.IntDef;
@@ -33,12 +30,8 @@ import android.support.annotation.VisibleForTesting;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
-import android.support.v4.content.res.ResourcesCompat;
import android.telecom.CallAudioState;
import android.telecom.PhoneAccountHandle;
-import android.view.KeyEvent;
-import android.view.View;
-import android.view.Window;
import android.view.WindowManager;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
@@ -47,7 +40,6 @@ import com.android.contacts.common.widget.SelectPhoneAccountDialogFragment.Selec
import com.android.dialer.animation.AnimUtils;
import com.android.dialer.animation.AnimationListenerAdapter;
import com.android.dialer.common.LogUtil;
-import com.android.dialer.compat.ActivityCompat;
import com.android.dialer.compat.CompatUtils;
import com.android.dialer.logging.Logger;
import com.android.dialer.logging.ScreenEvent;
@@ -56,7 +48,6 @@ import com.android.incallui.audiomode.AudioModeProvider;
import com.android.incallui.call.CallList;
import com.android.incallui.call.DialerCall;
import com.android.incallui.call.DialerCall.State;
-import com.android.incallui.call.TelecomAdapter;
import com.android.incallui.telecomeventui.InternationalCallOnWifiDialogFragment;
import com.android.incallui.telecomeventui.InternationalCallOnWifiDialogFragment.Callback;
import com.google.common.base.Optional;
@@ -235,27 +226,6 @@ public class InCallActivityCommon {
}
}
- public void onSaveInstanceState(Bundle out) {
- // TODO: The dialpad fragment should handle this as part of its own state
- out.putBoolean(INTENT_EXTRA_SHOW_DIALPAD, inCallActivity.isDialpadVisible());
- DialpadFragment dialpadFragment = inCallActivity.getDialpadFragment();
- if (dialpadFragment != null) {
- out.putString(DIALPAD_TEXT_KEY, dialpadFragment.getDtmfText());
- }
- }
-
- public void onStart() {
- Trace.beginSection("InCallActivityCommon.onStart");
- // setting activity should be last thing in setup process
- InCallPresenter.getInstance().setActivity(inCallActivity);
- inCallActivity.enableInCallOrientationEventListener(
- inCallActivity.getRequestedOrientation()
- == InCallOrientationEventListener.ACTIVITY_PREFERENCE_ALLOW_ROTATION);
-
- InCallPresenter.getInstance().onActivityStarted();
- Trace.endSection();
- }
-
public void onResume() {
Trace.beginSection("InCallActivityCommon.onResume");
if (InCallPresenter.getInstance().isReadyForTearDown()) {
@@ -263,7 +233,7 @@ public class InCallActivityCommon {
"InCallActivityCommon.onResume",
"InCallPresenter is ready for tear down, not sending updates");
} else {
- updateTaskDescription();
+ inCallActivity.updateTaskDescription();
InCallPresenter.getInstance().onUiShowing(true);
}
@@ -290,7 +260,7 @@ public class InCallActivityCommon {
}
showDialpadRequest = DIALPAD_REQUEST_NONE;
}
- updateNavigationBar(inCallActivity.isDialpadVisible());
+ inCallActivity.updateNavigationBar(inCallActivity.isDialpadVisible());
if (showPostCharWaitDialogOnResume) {
showPostCharWaitDialog(showPostCharWaitDialogCallId, showPostCharWaitDialogChars);
@@ -302,48 +272,6 @@ public class InCallActivityCommon {
Trace.endSection();
}
- // onPause is guaranteed to be called when the InCallActivity goes
- // in the background.
- public void onPause() {
- DialpadFragment dialpadFragment = inCallActivity.getDialpadFragment();
- if (dialpadFragment != null) {
- dialpadFragment.onDialerKeyUp(null);
- }
-
- InCallPresenter.getInstance().onUiShowing(false);
- if (inCallActivity.isFinishing()) {
- InCallPresenter.getInstance().unsetActivity(inCallActivity);
- }
- }
-
- public void onStop() {
- // Disconnects call waiting for account when activity is hidden e.g. user press home button.
- // This is necessary otherwise the pending call will stuck on account choose and no new call
- // will be able to create. See a bug for more details.
- // Skip this on locked screen since the activity may go over life cycle and start again.
- if (!isRecreating
- && !inCallActivity.getSystemService(KeyguardManager.class).isKeyguardLocked()) {
- DialerCall waitingForAccountCall = CallList.getInstance().getWaitingForAccountCall();
- if (waitingForAccountCall != null) {
- waitingForAccountCall.disconnect();
- }
- }
-
- inCallActivity.enableInCallOrientationEventListener(false);
- InCallPresenter.getInstance().updateIsChangingConfigurations();
- InCallPresenter.getInstance().onActivityStopped();
- if (!isRecreating) {
- if (errorDialog != null) {
- errorDialog.dismiss();
- }
- }
- }
-
- public void onDestroy() {
- InCallPresenter.getInstance().unsetActivity(inCallActivity);
- InCallPresenter.getInstance().updateIsChangingConfigurations();
- }
-
void onNewIntent(Intent intent, boolean isRecreating) {
LogUtil.i("InCallActivityCommon.onNewIntent", "");
this.isRecreating = isRecreating;
@@ -368,106 +296,6 @@ public class InCallActivityCommon {
}
}
- public boolean onBackPressed(boolean isInCallScreenVisible) {
- LogUtil.i("InCallActivityCommon.onBackPressed", "");
-
- // BACK is also used to exit out of any "special modes" of the
- // in-call UI:
- if (!inCallActivity.isVisible()) {
- return true;
- }
-
- if (!isInCallScreenVisible) {
- return true;
- }
-
- DialpadFragment dialpadFragment = inCallActivity.getDialpadFragment();
- if (dialpadFragment != null && dialpadFragment.isVisible()) {
- inCallActivity.showDialpadFragment(false /* show */, true /* animate */);
- return true;
- }
-
- // Always disable the Back key while an incoming call is ringing
- DialerCall call = CallList.getInstance().getIncomingCall();
- if (call != null) {
- LogUtil.i("InCallActivityCommon.onBackPressed", "consume Back press for an incoming call");
- return true;
- }
-
- // Nothing special to do. Fall back to the default behavior.
- return false;
- }
-
- public boolean onKeyUp(int keyCode, KeyEvent event) {
- DialpadFragment dialpadFragment = inCallActivity.getDialpadFragment();
- // push input to the dialer.
- if (dialpadFragment != null
- && (dialpadFragment.isVisible())
- && (dialpadFragment.onDialerKeyUp(event))) {
- return true;
- } else if (keyCode == KeyEvent.KEYCODE_CALL) {
- // Always consume CALL to be sure the PhoneWindow won't do anything with it
- return true;
- }
- return false;
- }
-
- public boolean onKeyDown(int keyCode, KeyEvent event) {
- switch (keyCode) {
- case KeyEvent.KEYCODE_CALL:
- boolean handled = InCallPresenter.getInstance().handleCallKey();
- if (!handled) {
- LogUtil.e(
- "InCallActivityCommon.onKeyDown",
- "InCallPresenter should always handle KEYCODE_CALL in onKeyDown");
- }
- // Always consume CALL to be sure the PhoneWindow won't do anything with it
- return true;
-
- // Note there's no KeyEvent.KEYCODE_ENDCALL case here.
- // The standard system-wide handling of the ENDCALL key
- // (see PhoneWindowManager's handling of KEYCODE_ENDCALL)
- // already implements exactly what the UI spec wants,
- // namely (1) "hang up" if there's a current active call,
- // or (2) "don't answer" if there's a current ringing call.
-
- case KeyEvent.KEYCODE_CAMERA:
- // Disable the CAMERA button while in-call since it's too
- // easy to press accidentally.
- 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;
-
- // Various testing/debugging features, enabled ONLY when VERBOSE == true.
- case KeyEvent.KEYCODE_SLASH:
- if (LogUtil.isVerboseEnabled()) {
- LogUtil.v(
- "InCallActivityCommon.onKeyDown",
- "----------- InCallActivity View dump --------------");
- // Dump starting from the top-level view of the entire activity:
- Window w = inCallActivity.getWindow();
- View decorView = w.getDecorView();
- LogUtil.v("InCallActivityCommon.onKeyDown", "View dump:" + decorView);
- return true;
- }
- break;
- case KeyEvent.KEYCODE_EQUALS:
- break;
- default: // fall out
- }
-
- return event.getRepeatCount() == 0 && handleDialerKeyDown(keyCode, event);
- }
-
private void setWindowFlags() {
// Allow the activity to be shown when the screen is locked and filter out touch events that are
// "too fat".
@@ -498,20 +326,6 @@ public class InCallActivityCommon {
audioRouteForTesting = Optional.of(audioRoute);
}
- private boolean handleDialerKeyDown(int keyCode, KeyEvent event) {
- LogUtil.v("InCallActivityCommon.handleDialerKeyDown", "keyCode %d, event: %s", keyCode, event);
-
- // As soon as the user starts typing valid dialable keys on the
- // keyboard (presumably to type DTMF tones) we start passing the
- // key events to the DTMFDialer's onDialerKeyDown.
- DialpadFragment dialpadFragment = inCallActivity.getDialpadFragment();
- if (dialpadFragment != null && dialpadFragment.isVisible()) {
- return dialpadFragment.onDialerKeyDown(event);
- }
-
- return false;
- }
-
public void showPostCharWaitDialog(String callId, String chars) {
if (inCallActivity.isVisible()) {
PostCharDialogFragment fragment = new PostCharDialogFragment(callId, chars);
@@ -566,16 +380,6 @@ public class InCallActivityCommon {
}
}
- void updateNavigationBar(boolean isDialpadVisible) {
- if (!ActivityCompat.isInMultiWindowMode(inCallActivity)) {
- View navigationBarBackground =
- inCallActivity.getWindow().findViewById(R.id.navigation_bar_background);
- if (navigationBarBackground != null) {
- navigationBarBackground.setVisibility(isDialpadVisible ? View.VISIBLE : View.GONE);
- }
- }
- }
-
public boolean showDialpadFragment(boolean show, boolean animate) {
// If the dialpad is already visible, don't animate in. If it's gone, don't animate out.
boolean isDialpadVisible = inCallActivity.isDialpadVisible();
@@ -637,7 +441,7 @@ public class InCallActivityCommon {
dialpadFragmentManager.executePendingTransactions();
Logger.get(inCallActivity).logScreenView(ScreenEvent.Type.INCALL_DIALPAD, inCallActivity);
- updateNavigationBar(true /* isDialpadVisible */);
+ inCallActivity.updateNavigationBar(true /* isDialpadVisible */);
}
private void performHideDialpadFragment() {
@@ -655,23 +459,7 @@ public class InCallActivityCommon {
transaction.commitAllowingStateLoss();
fragmentManager.executePendingTransactions();
}
- updateNavigationBar(false /* isDialpadVisible */);
- }
-
- public void updateTaskDescription() {
- Resources resources = inCallActivity.getResources();
- int color;
- if (resources.getBoolean(R.bool.is_layout_landscape)) {
- color =
- ResourcesCompat.getColor(
- resources, R.color.statusbar_background_color, inCallActivity.getTheme());
- } else {
- color = InCallPresenter.getInstance().getThemeColorManager().getSecondaryColor();
- }
-
- TaskDescription td =
- new TaskDescription(resources.getString(R.string.notification_ongoing_call), null, color);
- inCallActivity.setTaskDescription(td);
+ inCallActivity.updateNavigationBar(false /* isDialpadVisible */);
}
private void internalResolveIntent(Intent intent) {
@@ -759,6 +547,12 @@ public class InCallActivityCommon {
/** @deprecated Only for temporary use during the deprecation of {@link InCallActivityCommon} */
@Deprecated
+ boolean getIsRecreating() {
+ return isRecreating;
+ }
+
+ /** @deprecated Only for temporary use during the deprecation of {@link InCallActivityCommon} */
+ @Deprecated
@Nullable
SelectPhoneAccountDialogFragment getSelectPhoneAccountDialogFragment() {
return selectPhoneAccountDialogFragment;