summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormaxwelb <maxwelb@google.com>2017-06-28 13:39:16 -0700
committerBrandon Maxwell <maxwelb@google.com>2017-06-30 14:39:48 -0700
commitad2cb45e7006de3fbe1d953a61c57345ca40a6a0 (patch)
tree6389ab7f3dc9011126313d8aba79a1d2d6fab694
parent431b0c3433405652de195653b48623bb0b0f6f89 (diff)
Change InCallPresenter to use LogUtil
The old Log class uses the calling class name for the tag. Proguard minifies class names, making it annoying to figure out which class is logging in a bugreport. You'd see something like: 06-14 08:50:10.942 10022 20233 20233 I Dialer : bhp - Phone switching state: OUTGOING -> OUTGOING Now you'll see 06-14 08:50:10.942 10022 20233 20233 I Dialer : InCallPresenter.onCallListChange - Phone switching state: OUTGOING -> OUTGOING Test: Code builds, no changes were made to the actual logged strings PiperOrigin-RevId: 160445433 Change-Id: Id4d07a33b9ec7a9bceca48e71cdcfc5e6291b571
-rw-r--r--java/com/android/incallui/InCallPresenter.java146
1 files changed, 92 insertions, 54 deletions
diff --git a/java/com/android/incallui/InCallPresenter.java b/java/com/android/incallui/InCallPresenter.java
index 31a58c56a..eb0d2d38a 100644
--- a/java/com/android/incallui/InCallPresenter.java
+++ b/java/com/android/incallui/InCallPresenter.java
@@ -133,7 +133,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 +146,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 +156,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 +170,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 +295,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 +321,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 +369,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 +380,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 +395,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 +411,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 +436,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 +459,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 +504,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 +537,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 +595,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 +607,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 +616,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 +698,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 +718,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 +748,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 +863,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 +994,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 +1016,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 +1057,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(maxwelb) - b/36649622: Investigate this redundant call
@@ -1041,13 +1067,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 +1133,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 +1154,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 +1172,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 +1202,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;
@@ -1228,7 +1258,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 +1341,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 +1358,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 +1414,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 +1464,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 +1540,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 +1565,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 +1637,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);
}