summaryrefslogtreecommitdiff
path: root/java/com/android/incallui/InCallPresenter.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/com/android/incallui/InCallPresenter.java')
-rw-r--r--java/com/android/incallui/InCallPresenter.java150
1 files changed, 95 insertions, 55 deletions
diff --git a/java/com/android/incallui/InCallPresenter.java b/java/com/android/incallui/InCallPresenter.java
index 0bfd67e87..1528e7dcf 100644
--- a/java/com/android/incallui/InCallPresenter.java
+++ b/java/com/android/incallui/InCallPresenter.java
@@ -54,6 +54,7 @@ import com.android.incallui.call.CallList;
import com.android.incallui.call.DialerCall;
import com.android.incallui.call.ExternalCallList;
import com.android.incallui.call.TelecomAdapter;
+import com.android.incallui.disconnectdialog.DisconnectMessage;
import com.android.incallui.latencyreport.LatencyReport;
import com.android.incallui.legacyblocking.BlockedNumberContentObserver;
import com.android.incallui.spam.SpamCallListListener;
@@ -133,7 +134,9 @@ public class InCallPresenter implements CallList.Listener {
android.telecom.Call telecomCall, String remainingPostDialSequence) {
final DialerCall call = mCallList.getDialerCallFromTelecomCall(telecomCall);
if (call == null) {
- Log.w(this, "DialerCall not found in call list: " + telecomCall);
+ LogUtil.w(
+ "InCallPresenter.onPostDialWait",
+ "DialerCall not found in call list: " + telecomCall);
return;
}
onPostDialCharWait(call.getId(), remainingPostDialSequence);
@@ -144,7 +147,9 @@ public class InCallPresenter implements CallList.Listener {
android.telecom.Call telecomCall, android.telecom.Call.Details details) {
final DialerCall call = mCallList.getDialerCallFromTelecomCall(telecomCall);
if (call == null) {
- Log.w(this, "DialerCall not found in call list: " + telecomCall);
+ LogUtil.w(
+ "InCallPresenter.onDetailsChanged",
+ "DialerCall not found in call list: " + telecomCall);
return;
}
@@ -152,7 +157,7 @@ public class InCallPresenter implements CallList.Listener {
&& !mExternalCallList.isCallTracked(telecomCall)) {
// A regular call became an external call so swap call lists.
- Log.i(this, "Call became external: " + telecomCall);
+ LogUtil.i("InCallPresenter.onDetailsChanged", "Call became external: " + telecomCall);
mCallList.onInternalCallMadeExternal(mContext, telecomCall);
mExternalCallList.onCallAdded(telecomCall);
return;
@@ -166,7 +171,9 @@ public class InCallPresenter implements CallList.Listener {
@Override
public void onConferenceableCallsChanged(
android.telecom.Call telecomCall, List<android.telecom.Call> conferenceableCalls) {
- Log.i(this, "onConferenceableCallsChanged: " + telecomCall);
+ LogUtil.i(
+ "InCallPresenter.onConferenceableCallsChanged",
+ "onConferenceableCallsChanged: " + telecomCall);
onDetailsChanged(telecomCall, telecomCall.getDetails());
}
};
@@ -289,7 +296,8 @@ public class InCallPresenter implements CallList.Listener {
if ((call.getAccountHandle() == null
&& (phoneAccountHandles == null || phoneAccountHandles.isEmpty()))) {
- Log.i(InCallPresenter.getInstance(), "No valid accounts for call " + call);
+ LogUtil.i(
+ "InCallPresenter.isCallWithNoValidAccounts", "No valid accounts for call " + call);
return true;
}
}
@@ -314,7 +322,7 @@ public class InCallPresenter implements CallList.Listener {
ProximitySensor proximitySensor,
FilteredNumberAsyncQueryHandler filteredNumberQueryHandler) {
if (mServiceConnected) {
- Log.i(this, "New service connection replacing existing one.");
+ LogUtil.i("InCallPresenter.setUp", "New service connection replacing existing one.");
if (context != mContext || callList != mCallList) {
throw new IllegalStateException();
}
@@ -362,7 +370,7 @@ public class InCallPresenter implements CallList.Listener {
.getSystemService(TelephonyManager.class)
.listen(mPhoneStateListener, PhoneStateListener.LISTEN_CALL_STATE);
- Log.d(this, "Finished InCallPresenter.setUp");
+ LogUtil.d("InCallPresenter.setUp", "Finished InCallPresenter.setUp");
}
/**
@@ -373,7 +381,7 @@ public class InCallPresenter implements CallList.Listener {
* secondary method that performs the aforementioned logic.
*/
public void tearDown() {
- Log.d(this, "tearDown");
+ LogUtil.d("InCallPresenter.tearDown", "tearDown");
mCallList.clearOnDisconnect();
mServiceConnected = false;
@@ -388,7 +396,7 @@ public class InCallPresenter implements CallList.Listener {
private void attemptFinishActivity() {
final boolean doFinish = (mInCallActivity != null && isActivityStarted());
- Log.i(this, "Hide in call UI: " + doFinish);
+ LogUtil.i("InCallPresenter.attemptFinishActivity", "Hide in call UI: " + doFinish);
if (doFinish) {
mInCallActivity.setExcludeFromRecents(true);
mInCallActivity.finish();
@@ -404,12 +412,13 @@ public class InCallPresenter implements CallList.Listener {
throw new IllegalArgumentException("unregisterActivity cannot be called with null");
}
if (mInCallActivity == null) {
- Log.i(this, "No InCallActivity currently set, no need to unset.");
+ LogUtil.i(
+ "InCallPresenter.unsetActivity", "No InCallActivity currently set, no need to unset.");
return;
}
if (mInCallActivity != inCallActivity) {
- Log.w(
- this,
+ LogUtil.w(
+ "InCallPresenter.unsetActivity",
"Second instance of InCallActivity is trying to unregister when another"
+ " instance is active. Ignoring.");
return;
@@ -428,7 +437,7 @@ public class InCallPresenter implements CallList.Listener {
if (inCallActivity != null) {
if (mInCallActivity == null) {
updateListeners = true;
- Log.i(this, "UI Initialized");
+ LogUtil.i("InCallPresenter.updateActivity", "UI Initialized");
} else {
// since setActivity is called onStart(), it can be called multiple times.
// This is fine and ignorable, but we do not want to update the world every time
@@ -451,12 +460,12 @@ public class InCallPresenter implements CallList.Listener {
// NOTE: This code relies on {@link #mInCallActivity} being set so we run it after
// it has been set.
if (mInCallState == InCallState.NO_CALLS) {
- Log.i(this, "UI Initialized, but no calls left. shut down.");
+ LogUtil.i("InCallPresenter.updateActivity", "UI Initialized, but no calls left. Shut down");
attemptFinishActivity();
return;
}
} else {
- Log.i(this, "UI Destroyed");
+ LogUtil.i("InCallPresenter.updateActivity", "UI Destroyed");
updateListeners = true;
mInCallActivity = null;
@@ -496,7 +505,7 @@ public class InCallPresenter implements CallList.Listener {
}
public void onBringToForeground(boolean showDialpad) {
- Log.i(this, "Bringing UI to foreground.");
+ LogUtil.i("InCallPresenter.onBringToForeground", "Bringing UI to foreground.");
bringToForeground(showDialpad);
}
@@ -529,11 +538,15 @@ public class InCallPresenter implements CallList.Listener {
return false;
}
if (TelecomCallUtil.isEmergencyCall(call)) {
- Log.i(this, "Not attempting to block incoming emergency call");
+ LogUtil.i(
+ "InCallPresenter.shouldAttemptBlocking",
+ "Not attempting to block incoming emergency call");
return false;
}
if (FilteredNumbersUtil.hasRecentEmergencyCall(mContext)) {
- Log.i(this, "Not attempting to block incoming call due to recent emergency call");
+ LogUtil.i(
+ "InCallPresenter.shouldAttemptBlocking",
+ "Not attempting to block incoming call due to recent emergency call");
return false;
}
if (call.getDetails().hasProperty(CallCompat.Details.PROPERTY_IS_EXTERNAL_CALL)) {
@@ -583,7 +596,7 @@ public class InCallPresenter implements CallList.Listener {
@Override
public void onCheckComplete(final Integer id) {
if (isReadyForTearDown()) {
- Log.i(this, "InCallPresenter is torn down, not adding call");
+ LogUtil.i("InCallPresenter.onCheckComplete", "torn down, not adding call");
return;
}
if (!hasTimedOut.get()) {
@@ -595,7 +608,8 @@ public class InCallPresenter implements CallList.Listener {
mCallList.onCallAdded(mContext, call, latencyReport);
}
} else if (id == FilteredNumberAsyncQueryHandler.INVALID_ID) {
- Log.d(this, "checkForBlockedCall: invalid number, skipping block checking");
+ LogUtil.d(
+ "InCallPresenter.onCheckComplete", "invalid number, skipping block checking");
if (!hasTimedOut.get()) {
handler.removeCallbacks(runnable);
@@ -603,7 +617,8 @@ public class InCallPresenter implements CallList.Listener {
mCallList.onCallAdded(mContext, call, latencyReport);
}
} else {
- Log.i(this, "Rejecting incoming call from blocked number");
+ LogUtil.i(
+ "InCallPresenter.onCheckComplete", "Rejecting incoming call from blocked number");
call.reject(false, null);
Logger.get(mContext).logInteraction(InteractionEvent.Type.CALL_BLOCKED);
@@ -684,7 +699,9 @@ public class InCallPresenter implements CallList.Listener {
InCallState newState = getPotentialStateFromCallList(callList);
InCallState oldState = mInCallState;
- Log.d(this, "onCallListChange oldState= " + oldState + " newState=" + newState);
+ LogUtil.d(
+ "InCallPresenter.onCallListChange",
+ "onCallListChange oldState= " + oldState + " newState=" + newState);
// If the user placed a call and was asked to choose the account, but then pressed "Home", the
// incall activity for that call will still exist (even if it's not visible). In the case of
@@ -702,15 +719,20 @@ public class InCallPresenter implements CallList.Listener {
}
newState = startOrFinishUi(newState);
- Log.d(this, "onCallListChange newState changed to " + newState);
+ LogUtil.d(
+ "InCallPresenter.onCallListChange", "onCallListChange newState changed to " + newState);
// Set the new state before announcing it to the world
- Log.i(this, "Phone switching state: " + oldState + " -> " + newState);
+ LogUtil.i(
+ "InCallPresenter.onCallListChange",
+ "Phone switching state: " + oldState + " -> " + newState);
mInCallState = newState;
// notify listeners of new state
for (InCallStateListener listener : mListeners) {
- Log.d(this, "Notify " + listener + " of state " + mInCallState.toString());
+ LogUtil.d(
+ "InCallPresenter.onCallListChange",
+ "Notify " + listener + " of state " + mInCallState.toString());
listener.onStateChange(oldState, mInCallState, callList);
}
@@ -727,7 +749,8 @@ public class InCallPresenter implements CallList.Listener {
InCallState newState = startOrFinishUi(InCallState.INCOMING);
InCallState oldState = mInCallState;
- Log.i(this, "Phone switching state: " + oldState + " -> " + newState);
+ LogUtil.i(
+ "InCallPresenter.onIncomingCall", "Phone switching state: " + oldState + " -> " + newState);
mInCallState = newState;
for (IncomingCallListener listener : mIncomingCallListeners) {
@@ -841,7 +864,9 @@ public class InCallPresenter implements CallList.Listener {
}
public void setBoundAndWaitingForOutgoingCall(boolean isBound, PhoneAccountHandle handle) {
- Log.i(this, "setBoundAndWaitingForOutgoingCall: " + isBound);
+ LogUtil.i(
+ "InCallPresenter.setBoundAndWaitingForOutgoingCall",
+ "setBoundAndWaitingForOutgoingCall: " + isBound);
mBoundAndWaitingForOutgoingCall = isBound;
mThemeColorManager.setPendingPhoneAccountHandle(handle);
if (isBound && mInCallState == InCallState.NO_CALLS) {
@@ -970,7 +995,9 @@ public class InCallPresenter implements CallList.Listener {
if (mInCallActivity != null) {
mIsChangingConfigurations = mInCallActivity.isChangingConfigurations();
}
- Log.v(this, "updateIsChangingConfigurations = " + mIsChangingConfigurations);
+ LogUtil.v(
+ "InCallPresenter.updateIsChangingConfigurations",
+ "updateIsChangingConfigurations = " + mIsChangingConfigurations);
}
/** Called when the activity goes in/out of the foreground. */
@@ -990,10 +1017,10 @@ public class InCallPresenter implements CallList.Listener {
broadcastIntent.putExtra(EXTRA_FIRST_TIME_SHOWN, !mIsActivityPreviouslyStarted);
if (showing) {
- Log.d(this, "Sending sticky broadcast: ", broadcastIntent);
+ LogUtil.d("InCallPresenter.onUiShowing", "Sending sticky broadcast: ", broadcastIntent);
mContext.sendStickyBroadcast(broadcastIntent);
} else {
- Log.d(this, "Removing sticky broadcast: ", broadcastIntent);
+ LogUtil.d("InCallPresenter.onUiShowing", "Removing sticky broadcast: ", broadcastIntent);
mContext.removeStickyBroadcast(broadcastIntent);
}
}
@@ -1031,7 +1058,7 @@ public class InCallPresenter implements CallList.Listener {
/*package*/
void onActivityStarted() {
- Log.d(this, "onActivityStarted");
+ LogUtil.d("InCallPresenter.onActivityStarted", "onActivityStarted");
notifyVideoPauseController(true);
if (mStatusBarNotifier != null) {
// TODO - b/36649622: Investigate this redundant call
@@ -1041,13 +1068,14 @@ public class InCallPresenter implements CallList.Listener {
/*package*/
void onActivityStopped() {
- Log.d(this, "onActivityStopped");
+ LogUtil.d("InCallPresenter.onActivityStopped", "onActivityStopped");
notifyVideoPauseController(false);
}
private void notifyVideoPauseController(boolean showing) {
- Log.d(
- this, "notifyVideoPauseController: mIsChangingConfigurations=" + mIsChangingConfigurations);
+ LogUtil.d(
+ "InCallPresenter.notifyVideoPauseController",
+ "mIsChangingConfigurations=" + mIsChangingConfigurations);
if (!mIsChangingConfigurations) {
VideoPauseController.getInstance().onUiShowing(showing);
}
@@ -1106,8 +1134,9 @@ public class InCallPresenter implements CallList.Listener {
final boolean canSwap =
activeCall.can(android.telecom.Call.Details.CAPABILITY_SWAP_CONFERENCE);
- Log.v(
- this, "activeCall: " + activeCall + ", canMerge: " + canMerge + ", canSwap: " + canSwap);
+ LogUtil.v(
+ "InCallPresenter.handleCallKey",
+ "activeCall: " + activeCall + ", canMerge: " + canMerge + ", canSwap: " + canSwap);
// (2) Attempt actions on conference calls
if (canMerge) {
@@ -1126,7 +1155,7 @@ public class InCallPresenter implements CallList.Listener {
// there is no harm in double checking.
final boolean canHold = heldCall.can(android.telecom.Call.Details.CAPABILITY_HOLD);
- Log.v(this, "heldCall: " + heldCall + ", canHold: " + canHold);
+ LogUtil.v("InCallPresenter.handleCallKey", "heldCall: " + heldCall + ", canHold: " + canHold);
// (4) unhold call
if (heldCall.getState() == DialerCall.State.ONHOLD && canHold) {
@@ -1144,7 +1173,7 @@ public class InCallPresenter implements CallList.Listener {
* checks to see if there should be any UI left and if not attempts to tear down the UI.
*/
public void onDismissDialog() {
- Log.i(this, "Dialog dismissed");
+ LogUtil.i("InCallPresenter.onDismissDialog", "Dialog dismissed");
if (mInCallState == InCallState.NO_CALLS) {
attemptFinishActivity();
attemptCleanup();
@@ -1174,16 +1203,18 @@ public class InCallPresenter implements CallList.Listener {
* @param force {@code true} if fullscreen mode should be set regardless of its current state.
*/
public void setFullScreen(boolean isFullScreen, boolean force) {
- Log.i(this, "setFullScreen = " + isFullScreen);
+ LogUtil.i("InCallPresenter.setFullScreen", "setFullScreen = " + isFullScreen);
// As a safeguard, ensure we cannot enter fullscreen if the dialpad is shown.
if (isDialpadVisible()) {
isFullScreen = false;
- Log.v(this, "setFullScreen overridden as dialpad is shown = " + isFullScreen);
+ LogUtil.v(
+ "InCallPresenter.setFullScreen",
+ "setFullScreen overridden as dialpad is shown = " + isFullScreen);
}
if (mIsFullScreen == isFullScreen && !force) {
- Log.v(this, "setFullScreen ignored as already in that state.");
+ LogUtil.v("InCallPresenter.setFullScreen", "setFullScreen ignored as already in that state.");
return;
}
mIsFullScreen = isFullScreen;
@@ -1219,7 +1250,8 @@ public class InCallPresenter implements CallList.Listener {
if (call.getAccountHandle() == null && !call.isConferenceCall()) {
setDisconnectCauseForMissingAccounts(call);
}
- mInCallActivity.maybeShowErrorDialogOnDisconnect(call.getDisconnectCause());
+ mInCallActivity.maybeShowErrorDialogOnDisconnect(
+ new DisconnectMessage(mInCallActivity, call));
}
}
@@ -1228,7 +1260,8 @@ public class InCallPresenter implements CallList.Listener {
* UI needs to be started or finished depending on the new state and does it.
*/
private InCallState startOrFinishUi(InCallState newState) {
- Log.d(this, "startOrFinishUi: " + mInCallState + " -> " + newState);
+ LogUtil.d(
+ "InCallPresenter.startOrFinishUi", "startOrFinishUi: " + mInCallState + " -> " + newState);
// TODO: Consider a proper state machine implementation
@@ -1310,7 +1343,9 @@ public class InCallPresenter implements CallList.Listener {
// up so we aren't going to lose anything by avoiding a second startup here.
boolean activityIsFinishing = mInCallActivity != null && !isActivityStarted();
if (activityIsFinishing) {
- Log.i(this, "Undo the state change: " + newState + " -> " + mInCallState);
+ LogUtil.i(
+ "InCallPresenter.startOrFinishUi",
+ "Undo the state change: " + newState + " -> " + mInCallState);
return mInCallState;
}
@@ -1325,10 +1360,10 @@ public class InCallPresenter implements CallList.Listener {
}
if (showCallUi || showAccountPicker) {
- Log.i(this, "Start in call UI");
+ LogUtil.i("InCallPresenter.startOrFinishUi", "Start in call UI");
showInCall(false /* showDialpad */, !showAccountPicker /* newOutgoingCall */);
} else if (startIncomingCallSequence) {
- Log.i(this, "Start Full Screen in call UI");
+ LogUtil.i("InCallPresenter.startOrFinishUi", "Start Full Screen in call UI");
mStatusBarNotifier.updateNotification(mCallList);
} else if (newState == InCallState.NO_CALLS) {
@@ -1381,7 +1416,7 @@ public class InCallPresenter implements CallList.Listener {
*/
private void attemptCleanup() {
if (isReadyForTearDown()) {
- Log.i(this, "Cleaning up");
+ LogUtil.i("InCallPresenter.attemptCleanup", "Cleaning up");
cleanupSurfaces();
@@ -1431,12 +1466,12 @@ public class InCallPresenter implements CallList.Listener {
mInCallEventListeners.clear();
mInCallUiListeners.clear();
- Log.d(this, "Finished InCallPresenter.CleanUp");
+ LogUtil.d("InCallPresenter.attemptCleanup", "finished");
}
}
public void showInCall(boolean showDialpad, boolean newOutgoingCall) {
- Log.i(this, "Showing InCallActivity");
+ LogUtil.i("InCallPresenter.showInCall", "Showing InCallActivity");
mContext.startActivity(
InCallActivity.getIntent(
mContext, showDialpad, newOutgoingCall, false /* forFullScreen */));
@@ -1507,12 +1542,14 @@ public class InCallPresenter implements CallList.Listener {
* InCallOrientationEventListener#SCREEN_ORIENTATION_270}).
*/
public void onDeviceOrientationChange(@ScreenOrientation int orientation) {
- Log.d(this, "onDeviceOrientationChange: orientation= " + orientation);
+ LogUtil.d(
+ "InCallPresenter.onDeviceOrientationChange",
+ "onDeviceOrientationChange: orientation= " + orientation);
if (mCallList != null) {
mCallList.notifyCallsOfDeviceRotation(orientation);
} else {
- Log.w(this, "onDeviceOrientationChange: CallList is null.");
+ LogUtil.w("InCallPresenter.onDeviceOrientationChange", "CallList is null.");
}
// Notify listeners of device orientation changed.
@@ -1530,16 +1567,18 @@ public class InCallPresenter implements CallList.Listener {
*/
public void setInCallAllowsOrientationChange(boolean allowOrientationChange) {
if (mInCallActivity == null) {
- Log.e(this, "InCallActivity is null. Can't set requested orientation.");
+ LogUtil.e(
+ "InCallPresenter.setInCallAllowsOrientationChange",
+ "InCallActivity is null. Can't set requested orientation.");
return;
}
mInCallActivity.setAllowOrientationChange(allowOrientationChange);
}
public void enableScreenTimeout(boolean enable) {
- Log.v(this, "enableScreenTimeout: value=" + enable);
+ LogUtil.v("InCallPresenter.enableScreenTimeout", "enableScreenTimeout: value=" + enable);
if (mInCallActivity == null) {
- Log.e(this, "enableScreenTimeout: InCallActivity is null.");
+ LogUtil.e("InCallPresenter.enableScreenTimeout", "InCallActivity is null.");
return;
}
@@ -1600,7 +1639,8 @@ public class InCallPresenter implements CallList.Listener {
throw new IllegalArgumentException("registerActivity cannot be called with null");
}
if (mInCallActivity != null && mInCallActivity != inCallActivity) {
- Log.w(this, "Setting a second activity before destroying the first.");
+ LogUtil.w(
+ "InCallPresenter.setActivity", "Setting a second activity before destroying the first.");
}
updateActivity(inCallActivity);
}