summaryrefslogtreecommitdiff
path: root/java/com/android/incallui
diff options
context:
space:
mode:
Diffstat (limited to 'java/com/android/incallui')
-rw-r--r--java/com/android/incallui/AccelerometerListener.java65
-rw-r--r--java/com/android/incallui/CallButtonPresenter.java231
-rw-r--r--java/com/android/incallui/CallCardPresenter.java428
-rw-r--r--java/com/android/incallui/CallerInfo.java20
-rw-r--r--java/com/android/incallui/CallerInfoAsyncQuery.java98
-rw-r--r--java/com/android/incallui/ConferenceManagerFragment.java24
-rw-r--r--java/com/android/incallui/ConferenceParticipantListAdapter.java114
-rw-r--r--java/com/android/incallui/ContactInfoCache.java154
-rw-r--r--java/com/android/incallui/ContactsPreferencesFactory.java12
-rw-r--r--java/com/android/incallui/DialpadFragment.java96
-rw-r--r--java/com/android/incallui/DialpadPresenter.java16
-rw-r--r--java/com/android/incallui/ExternalCallNotifier.java98
-rw-r--r--java/com/android/incallui/InCallCameraManager.java46
-rw-r--r--java/com/android/incallui/InCallOrientationEventListener.java26
-rw-r--r--java/com/android/incallui/InCallPresenter.java632
-rw-r--r--java/com/android/incallui/InCallUIMaterialColorMapUtils.java20
-rw-r--r--java/com/android/incallui/PostCharDialogFragment.java24
-rw-r--r--java/com/android/incallui/ProximitySensor.java128
-rw-r--r--java/com/android/incallui/StatusBarNotifier.java209
-rw-r--r--java/com/android/incallui/TransactionSafeFragmentActivity.java12
-rw-r--r--java/com/android/incallui/VideoCallPresenter.java276
-rw-r--r--java/com/android/incallui/VideoPauseController.java90
-rw-r--r--java/com/android/incallui/answer/impl/FixedAspectSurfaceView.java8
-rw-r--r--java/com/android/incallui/answer/impl/affordance/SwipeButtonHelper.java6
-rw-r--r--java/com/android/incallui/answer/impl/affordance/SwipeButtonView.java6
-rw-r--r--java/com/android/incallui/answer/impl/classifier/AccelerationClassifier.java16
-rw-r--r--java/com/android/incallui/answer/impl/classifier/AnglesClassifier.java131
-rw-r--r--java/com/android/incallui/answer/impl/classifier/Classifier.java2
-rw-r--r--java/com/android/incallui/answer/impl/classifier/ClassifierData.java36
-rw-r--r--java/com/android/incallui/answer/impl/classifier/EndPointLengthClassifier.java2
-rw-r--r--java/com/android/incallui/answer/impl/classifier/EndPointRatioClassifier.java2
-rw-r--r--java/com/android/incallui/answer/impl/classifier/FalsingManager.java52
-rw-r--r--java/com/android/incallui/answer/impl/classifier/HistoryEvaluator.java25
-rw-r--r--java/com/android/incallui/answer/impl/classifier/HumanInteractionClassifier.java66
-rw-r--r--java/com/android/incallui/answer/impl/classifier/PointerCountClassifier.java10
-rw-r--r--java/com/android/incallui/answer/impl/classifier/ProximityClassifier.java36
-rw-r--r--java/com/android/incallui/answer/impl/classifier/SpeedAnglesClassifier.java88
-rw-r--r--java/com/android/incallui/answer/impl/classifier/Stroke.java34
-rw-r--r--java/com/android/incallui/answer/impl/utils/FlingAnimationUtils.java56
-rw-r--r--java/com/android/incallui/baseui/BaseFragment.java14
-rw-r--r--java/com/android/incallui/baseui/Presenter.java8
-rw-r--r--java/com/android/incallui/call/CallList.java130
-rw-r--r--java/com/android/incallui/call/DialerCall.java395
-rw-r--r--java/com/android/incallui/call/ExternalCallList.java32
-rw-r--r--java/com/android/incallui/call/InCallVideoCallCallbackNotifier.java14
-rw-r--r--java/com/android/incallui/call/TelecomAdapter.java40
-rw-r--r--java/com/android/incallui/calllocation/impl/DownloadMapImageTask.java8
-rw-r--r--java/com/android/incallui/calllocation/impl/HttpFetcher.java12
-rw-r--r--java/com/android/incallui/calllocation/impl/LocationPresenter.java24
-rw-r--r--java/com/android/incallui/calllocation/impl/ReverseGeocodeTask.java8
-rw-r--r--java/com/android/incallui/latencyreport/LatencyReport.java76
-rw-r--r--java/com/android/incallui/ringtone/DialerRingtoneManager.java24
-rw-r--r--java/com/android/incallui/ringtone/InCallTonePlayer.java36
53 files changed, 2102 insertions, 2114 deletions
diff --git a/java/com/android/incallui/AccelerometerListener.java b/java/com/android/incallui/AccelerometerListener.java
index 01f884354..92e62b098 100644
--- a/java/com/android/incallui/AccelerometerListener.java
+++ b/java/com/android/incallui/AccelerometerListener.java
@@ -23,7 +23,7 @@ import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.os.Handler;
import android.os.Message;
-import android.util.Log;
+import com.android.dialer.common.LogUtil;
/**
* This class is used to listen to the accelerometer to monitor the orientation of the phone. The
@@ -42,40 +42,40 @@ public class AccelerometerListener {
private static final int VERTICAL_DEBOUNCE = 100;
private static final int HORIZONTAL_DEBOUNCE = 500;
private static final double VERTICAL_ANGLE = 50.0;
- private SensorManager mSensorManager;
- private Sensor mSensor;
+ private SensorManager sensorManager;
+ private Sensor sensor;
// mOrientation is the orientation value most recently reported to the client.
- private int mOrientation;
+ private int orientation;
// mPendingOrientation is the latest orientation computed based on the sensor value.
// This is sent to the client after a rebounce delay, at which point it is copied to
// mOrientation.
- private int mPendingOrientation;
- private OrientationListener mListener;
- Handler mHandler =
+ private int pendingOrientation;
+ private OrientationListener listener;
+ Handler handler =
new Handler() {
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case ORIENTATION_CHANGED:
synchronized (this) {
- mOrientation = mPendingOrientation;
+ orientation = pendingOrientation;
if (DEBUG) {
- Log.d(
+ LogUtil.d(
TAG,
"orientation: "
- + (mOrientation == ORIENTATION_HORIZONTAL
+ + (orientation == ORIENTATION_HORIZONTAL
? "horizontal"
- : (mOrientation == ORIENTATION_VERTICAL ? "vertical" : "unknown")));
+ : (orientation == ORIENTATION_VERTICAL ? "vertical" : "unknown")));
}
- if (mListener != null) {
- mListener.orientationChanged(mOrientation);
+ if (listener != null) {
+ listener.orientationChanged(orientation);
}
}
break;
}
}
};
- SensorEventListener mSensorListener =
+ SensorEventListener sensorListener =
new SensorEventListener() {
@Override
public void onSensorChanged(SensorEvent event) {
@@ -89,34 +89,33 @@ public class AccelerometerListener {
};
public AccelerometerListener(Context context) {
- mSensorManager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);
- mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
+ sensorManager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);
+ sensor = sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
}
public void setListener(OrientationListener listener) {
- mListener = listener;
+ this.listener = listener;
}
public void enable(boolean enable) {
if (DEBUG) {
- Log.d(TAG, "enable(" + enable + ")");
+ LogUtil.d(TAG, "enable(" + enable + ")");
}
synchronized (this) {
if (enable) {
- mOrientation = ORIENTATION_UNKNOWN;
- mPendingOrientation = ORIENTATION_UNKNOWN;
- mSensorManager.registerListener(
- mSensorListener, mSensor, SensorManager.SENSOR_DELAY_NORMAL);
+ orientation = ORIENTATION_UNKNOWN;
+ pendingOrientation = ORIENTATION_UNKNOWN;
+ sensorManager.registerListener(sensorListener, sensor, SensorManager.SENSOR_DELAY_NORMAL);
} else {
- mSensorManager.unregisterListener(mSensorListener);
- mHandler.removeMessages(ORIENTATION_CHANGED);
+ sensorManager.unregisterListener(sensorListener);
+ handler.removeMessages(ORIENTATION_CHANGED);
}
}
}
private void setOrientation(int orientation) {
synchronized (this) {
- if (mPendingOrientation == orientation) {
+ if (pendingOrientation == orientation) {
// Pending orientation has not changed, so do nothing.
return;
}
@@ -124,26 +123,26 @@ public class AccelerometerListener {
// Cancel any pending messages.
// We will either start a new timer or cancel alltogether
// if the orientation has not changed.
- mHandler.removeMessages(ORIENTATION_CHANGED);
+ handler.removeMessages(ORIENTATION_CHANGED);
- if (mOrientation != orientation) {
+ if (this.orientation != orientation) {
// Set timer to send an event if the orientation has changed since its
// previously reported value.
- mPendingOrientation = orientation;
- final Message m = mHandler.obtainMessage(ORIENTATION_CHANGED);
+ pendingOrientation = orientation;
+ final Message m = handler.obtainMessage(ORIENTATION_CHANGED);
// set delay to our debounce timeout
int delay = (orientation == ORIENTATION_VERTICAL ? VERTICAL_DEBOUNCE : HORIZONTAL_DEBOUNCE);
- mHandler.sendMessageDelayed(m, delay);
+ handler.sendMessageDelayed(m, delay);
} else {
// no message is pending
- mPendingOrientation = ORIENTATION_UNKNOWN;
+ pendingOrientation = ORIENTATION_UNKNOWN;
}
}
}
private void onSensorEvent(double x, double y, double z) {
if (VDEBUG) {
- Log.d(TAG, "onSensorEvent(" + x + ", " + y + ", " + z + ")");
+ LogUtil.d(TAG, "onSensorEvent(" + x + ", " + y + ", " + z + ")");
}
// If some values are exactly zero, then likely the sensor is not powered up yet.
@@ -161,7 +160,7 @@ public class AccelerometerListener {
final int orientation =
(angle > VERTICAL_ANGLE ? ORIENTATION_VERTICAL : ORIENTATION_HORIZONTAL);
if (VDEBUG) {
- Log.d(TAG, "angle: " + angle + " orientation: " + orientation);
+ LogUtil.d(TAG, "angle: " + angle + " orientation: " + orientation);
}
setOrientation(orientation);
}
diff --git a/java/com/android/incallui/CallButtonPresenter.java b/java/com/android/incallui/CallButtonPresenter.java
index c20642b59..88aeaf581 100644
--- a/java/com/android/incallui/CallButtonPresenter.java
+++ b/java/com/android/incallui/CallButtonPresenter.java
@@ -62,22 +62,22 @@ public class CallButtonPresenter
private static final String KEY_AUTOMATICALLY_MUTED = "incall_key_automatically_muted";
private static final String KEY_PREVIOUS_MUTE_STATE = "incall_key_previous_mute_state";
- private final Context mContext;
- private InCallButtonUi mInCallButtonUi;
- private DialerCall mCall;
- private boolean mAutomaticallyMuted = false;
- private boolean mPreviousMuteState = false;
+ private final Context context;
+ private InCallButtonUi inCallButtonUi;
+ private DialerCall call;
+ private boolean automaticallyMuted = false;
+ private boolean previousMuteState = false;
private boolean isInCallButtonUiReady;
- private PhoneAccountHandle mOtherAccount;
+ private PhoneAccountHandle otherAccount;
public CallButtonPresenter(Context context) {
- mContext = context.getApplicationContext();
+ this.context = context.getApplicationContext();
}
@Override
public void onInCallButtonUiReady(InCallButtonUi ui) {
Assert.checkState(!isInCallButtonUiReady);
- mInCallButtonUi = ui;
+ inCallButtonUi = ui;
AudioModeProvider.getInstance().addListener(this);
// register for call state changes last
@@ -96,7 +96,7 @@ public class CallButtonPresenter
@Override
public void onInCallButtonUiUnready() {
Assert.checkState(isInCallButtonUiReady);
- mInCallButtonUi = null;
+ inCallButtonUi = null;
InCallPresenter.getInstance().removeListener(this);
AudioModeProvider.getInstance().removeListener(this);
InCallPresenter.getInstance().removeIncomingCallListener(this);
@@ -110,16 +110,16 @@ public class CallButtonPresenter
public void onStateChange(InCallState oldState, InCallState newState, CallList callList) {
Trace.beginSection("CallButtonPresenter.onStateChange");
if (newState == InCallState.OUTGOING) {
- mCall = callList.getOutgoingCall();
+ call = callList.getOutgoingCall();
} else if (newState == InCallState.INCALL) {
- mCall = callList.getActiveOrBackgroundCall();
+ call = callList.getActiveOrBackgroundCall();
// When connected to voice mail, automatically shows the dialpad.
// (On previous releases we showed it when in-call shows up, before waiting for
// OUTGOING. We may want to do that once we start showing "Voice mail" label on
// the dialpad too.)
- if (oldState == InCallState.OUTGOING && mCall != null) {
- if (mCall.isVoiceMailNumber() && getActivity() != null) {
+ if (oldState == InCallState.OUTGOING && call != null) {
+ if (call.isVoiceMailNumber() && getActivity() != null) {
getActivity().showDialpadFragment(true /* show */, true /* animate */);
}
}
@@ -127,11 +127,11 @@ public class CallButtonPresenter
if (getActivity() != null) {
getActivity().showDialpadFragment(false /* show */, true /* animate */);
}
- mCall = callList.getIncomingCall();
+ call = callList.getIncomingCall();
} else {
- mCall = null;
+ call = null;
}
- updateUi(newState, mCall);
+ updateUi(newState, call);
Trace.endSection();
}
@@ -146,7 +146,7 @@ public class CallButtonPresenter
@Override
public void onDetailsChanged(DialerCall call, android.telecom.Call.Details details) {
// Only update if the changes are for the currently active call
- if (mInCallButtonUi != null && call != null && call.equals(mCall)) {
+ if (inCallButtonUi != null && call != null && call.equals(this.call)) {
updateButtonsState(call);
}
}
@@ -158,15 +158,15 @@ public class CallButtonPresenter
@Override
public void onCanAddCallChanged(boolean canAddCall) {
- if (mInCallButtonUi != null && mCall != null) {
- updateButtonsState(mCall);
+ if (inCallButtonUi != null && call != null) {
+ updateButtonsState(call);
}
}
@Override
public void onAudioStateChanged(CallAudioState audioState) {
- if (mInCallButtonUi != null) {
- mInCallButtonUi.setAudioState(audioState);
+ if (inCallButtonUi != null) {
+ inCallButtonUi.setAudioState(audioState);
}
}
@@ -192,25 +192,25 @@ public class CallButtonPresenter
// It's clear the UI is wrong, so update the supported mode once again.
LogUtil.e(
"CallButtonPresenter", "toggling speakerphone not allowed when bluetooth supported.");
- mInCallButtonUi.setAudioState(audioState);
+ inCallButtonUi.setAudioState(audioState);
return;
}
int newRoute;
if (audioState.getRoute() == CallAudioState.ROUTE_SPEAKER) {
newRoute = CallAudioState.ROUTE_WIRED_OR_EARPIECE;
- Logger.get(mContext)
+ Logger.get(context)
.logCallImpression(
DialerImpression.Type.IN_CALL_SCREEN_TURN_ON_WIRED_OR_EARPIECE,
- mCall.getUniqueCallId(),
- mCall.getTimeAddedMs());
+ call.getUniqueCallId(),
+ call.getTimeAddedMs());
} else {
newRoute = CallAudioState.ROUTE_SPEAKER;
- Logger.get(mContext)
+ Logger.get(context)
.logCallImpression(
DialerImpression.Type.IN_CALL_SCREEN_TURN_ON_SPEAKERPHONE,
- mCall.getUniqueCallId(),
- mCall.getTimeAddedMs());
+ call.getUniqueCallId(),
+ call.getTimeAddedMs());
}
setAudioRoute(newRoute);
@@ -221,61 +221,61 @@ public class CallButtonPresenter
LogUtil.i(
"CallButtonPresenter", "turning on mute: %s, clicked by user: %s", checked, clickedByUser);
if (clickedByUser) {
- Logger.get(mContext)
+ Logger.get(context)
.logCallImpression(
checked
? DialerImpression.Type.IN_CALL_SCREEN_TURN_ON_MUTE
: DialerImpression.Type.IN_CALL_SCREEN_TURN_OFF_MUTE,
- mCall.getUniqueCallId(),
- mCall.getTimeAddedMs());
+ call.getUniqueCallId(),
+ call.getTimeAddedMs());
}
TelecomAdapter.getInstance().mute(checked);
}
@Override
public void holdClicked(boolean checked) {
- if (mCall == null) {
+ if (call == null) {
return;
}
if (checked) {
- LogUtil.i("CallButtonPresenter", "putting the call on hold: " + mCall);
- mCall.hold();
+ LogUtil.i("CallButtonPresenter", "putting the call on hold: " + call);
+ call.hold();
} else {
- LogUtil.i("CallButtonPresenter", "removing the call from hold: " + mCall);
- mCall.unhold();
+ LogUtil.i("CallButtonPresenter", "removing the call from hold: " + call);
+ call.unhold();
}
}
@Override
public void swapClicked() {
- if (mCall == null) {
+ if (call == null) {
return;
}
- LogUtil.i("CallButtonPresenter", "swapping the call: " + mCall);
- TelecomAdapter.getInstance().swap(mCall.getId());
+ LogUtil.i("CallButtonPresenter", "swapping the call: " + call);
+ TelecomAdapter.getInstance().swap(call.getId());
}
@Override
public void mergeClicked() {
- Logger.get(mContext)
+ Logger.get(context)
.logCallImpression(
DialerImpression.Type.IN_CALL_MERGE_BUTTON_PRESSED,
- mCall.getUniqueCallId(),
- mCall.getTimeAddedMs());
- TelecomAdapter.getInstance().merge(mCall.getId());
+ call.getUniqueCallId(),
+ call.getTimeAddedMs());
+ TelecomAdapter.getInstance().merge(call.getId());
}
@Override
public void addCallClicked() {
- Logger.get(mContext)
+ Logger.get(context)
.logCallImpression(
DialerImpression.Type.IN_CALL_ADD_CALL_BUTTON_PRESSED,
- mCall.getUniqueCallId(),
- mCall.getTimeAddedMs());
+ call.getUniqueCallId(),
+ call.getTimeAddedMs());
// Automatically mute the current call
- mAutomaticallyMuted = true;
- mPreviousMuteState = AudioModeProvider.getInstance().getAudioState().isMuted();
+ automaticallyMuted = true;
+ previousMuteState = AudioModeProvider.getInstance().getAudioState().isMuted();
// Simulate a click on the mute button
muteClicked(true /* checked */, false /* clickedByUser */);
TelecomAdapter.getInstance().addCall();
@@ -283,11 +283,11 @@ public class CallButtonPresenter
@Override
public void showDialpadClicked(boolean checked) {
- Logger.get(mContext)
+ Logger.get(context)
.logCallImpression(
DialerImpression.Type.IN_CALL_SHOW_DIALPAD_BUTTON_PRESSED,
- mCall.getUniqueCallId(),
- mCall.getTimeAddedMs());
+ call.getUniqueCallId(),
+ call.getTimeAddedMs());
LogUtil.v("CallButtonPresenter", "show dialpad " + String.valueOf(checked));
getActivity().showDialpadFragment(checked /* show */, true /* animate */);
}
@@ -295,25 +295,25 @@ public class CallButtonPresenter
@Override
public void changeToVideoClicked() {
LogUtil.enterBlock("CallButtonPresenter.changeToVideoClicked");
- Logger.get(mContext)
+ Logger.get(context)
.logCallImpression(
DialerImpression.Type.VIDEO_CALL_UPGRADE_REQUESTED,
- mCall.getUniqueCallId(),
- mCall.getTimeAddedMs());
- mCall.getVideoTech().upgradeToVideo(mContext);
+ call.getUniqueCallId(),
+ call.getTimeAddedMs());
+ call.getVideoTech().upgradeToVideo(context);
}
@Override
public void onEndCallClicked() {
- LogUtil.i("CallButtonPresenter.onEndCallClicked", "call: " + mCall);
- if (mCall != null) {
- mCall.disconnect();
+ LogUtil.i("CallButtonPresenter.onEndCallClicked", "call: " + call);
+ if (call != null) {
+ call.disconnect();
}
}
@Override
public void showAudioRouteSelector() {
- mInCallButtonUi.showAudioRouteSelector();
+ inCallButtonUi.showAudioRouteSelector();
}
@Override
@@ -323,9 +323,9 @@ public class CallButtonPresenter
SwapSimWorker worker =
new SwapSimWorker(
getContext(),
- mCall,
+ call,
InCallPresenter.getInstance().getCallList(),
- mOtherAccount,
+ otherAccount,
InCallPresenter.getInstance().acquireInCallUiLock("swapSim"));
DialerExecutorComponent.get(getContext())
.dialerExecutorFactory()
@@ -348,14 +348,14 @@ public class CallButtonPresenter
@Override
public void toggleCameraClicked() {
LogUtil.i("CallButtonPresenter.toggleCameraClicked", "");
- if (mCall == null) {
+ if (call == null) {
return;
}
- Logger.get(mContext)
+ Logger.get(context)
.logCallImpression(
DialerImpression.Type.IN_CALL_SCREEN_SWAP_CAMERA,
- mCall.getUniqueCallId(),
- mCall.getTimeAddedMs());
+ call.getUniqueCallId(),
+ call.getTimeAddedMs());
switchCameraClicked(
!InCallPresenter.getInstance().getInCallCameraManager().isUsingFrontFacingCamera());
}
@@ -370,25 +370,25 @@ public class CallButtonPresenter
public void pauseVideoClicked(boolean pause) {
LogUtil.i("CallButtonPresenter.pauseVideoClicked", "%s", pause ? "pause" : "unpause");
- Logger.get(mContext)
+ Logger.get(context)
.logCallImpression(
pause
? DialerImpression.Type.IN_CALL_SCREEN_TURN_OFF_VIDEO
: DialerImpression.Type.IN_CALL_SCREEN_TURN_ON_VIDEO,
- mCall.getUniqueCallId(),
- mCall.getTimeAddedMs());
+ call.getUniqueCallId(),
+ call.getTimeAddedMs());
if (pause) {
- mCall.getVideoTech().setCamera(null);
- mCall.getVideoTech().stopTransmission();
+ call.getVideoTech().setCamera(null);
+ call.getVideoTech().stopTransmission();
} else {
updateCamera(
InCallPresenter.getInstance().getInCallCameraManager().isUsingFrontFacingCamera());
- mCall.getVideoTech().resumeTransmission(mContext);
+ call.getVideoTech().resumeTransmission(context);
}
- mInCallButtonUi.setVideoPaused(pause);
- mInCallButtonUi.enableButton(InCallButtonIds.BUTTON_PAUSE_VIDEO, false);
+ inCallButtonUi.setVideoPaused(pause);
+ inCallButtonUi.enableButton(InCallButtonIds.BUTTON_PAUSE_VIDEO, false);
}
private void updateCamera(boolean useFrontFacingCamera) {
@@ -401,26 +401,26 @@ public class CallButtonPresenter
cameraManager.isUsingFrontFacingCamera()
? CameraDirection.CAMERA_DIRECTION_FRONT_FACING
: CameraDirection.CAMERA_DIRECTION_BACK_FACING;
- mCall.setCameraDir(cameraDir);
- mCall.getVideoTech().setCamera(cameraId);
+ call.setCameraDir(cameraDir);
+ call.getVideoTech().setCamera(cameraId);
}
}
private void updateUi(InCallState state, DialerCall call) {
LogUtil.v("CallButtonPresenter", "updating call UI for call: %s", call);
- if (mInCallButtonUi == null) {
+ if (inCallButtonUi == null) {
return;
}
if (call != null) {
- mInCallButtonUi.updateInCallButtonUiColors(
+ inCallButtonUi.updateInCallButtonUiColors(
InCallPresenter.getInstance().getThemeColorManager().getSecondaryColor());
}
final boolean isEnabled =
state.isConnectingOrConnected() && !state.isIncoming() && call != null;
- mInCallButtonUi.setEnabled(isEnabled);
+ inCallButtonUi.setEnabled(isEnabled);
if (call == null) {
return;
@@ -451,53 +451,53 @@ public class CallButtonPresenter
final boolean isCallOnHold = call.getState() == DialerCall.State.ONHOLD;
final boolean showAddCall =
- TelecomAdapter.getInstance().canAddCall() && UserManagerCompat.isUserUnlocked(mContext);
+ TelecomAdapter.getInstance().canAddCall() && UserManagerCompat.isUserUnlocked(context);
final boolean showMerge = call.can(android.telecom.Call.Details.CAPABILITY_MERGE_CONFERENCE);
final boolean showUpgradeToVideo = !isVideo && (hasVideoCallCapabilities(call));
final boolean showDowngradeToAudio = isVideo && isDowngradeToAudioSupported(call);
final boolean showMute = call.can(android.telecom.Call.Details.CAPABILITY_MUTE);
final boolean hasCameraPermission =
- isVideo && VideoUtils.hasCameraPermissionAndShownPrivacyToast(mContext);
+ isVideo && VideoUtils.hasCameraPermissionAndShownPrivacyToast(context);
// Disabling local video doesn't seem to work when dialing. See a bug.
final boolean showPauseVideo =
isVideo
&& call.getState() != DialerCall.State.DIALING
&& call.getState() != DialerCall.State.CONNECTING;
- mOtherAccount = TelecomUtil.getOtherAccount(getContext(), call.getAccountHandle());
+ otherAccount = TelecomUtil.getOtherAccount(getContext(), call.getAccountHandle());
boolean showSwapSim =
- mOtherAccount != null
+ otherAccount != null
&& !call.isVoiceMailNumber()
&& DialerCall.State.isDialing(call.getState())
// Most devices cannot make calls on 2 SIMs at the same time.
&& InCallPresenter.getInstance().getCallList().getAllCalls().size() == 1;
- mInCallButtonUi.showButton(InCallButtonIds.BUTTON_AUDIO, true);
- mInCallButtonUi.showButton(InCallButtonIds.BUTTON_SWAP, showSwap);
- mInCallButtonUi.showButton(InCallButtonIds.BUTTON_HOLD, showHold);
- mInCallButtonUi.setHold(isCallOnHold);
- mInCallButtonUi.showButton(InCallButtonIds.BUTTON_MUTE, showMute);
- mInCallButtonUi.showButton(InCallButtonIds.BUTTON_SWAP_SIM, showSwapSim);
- mInCallButtonUi.showButton(InCallButtonIds.BUTTON_ADD_CALL, true);
- mInCallButtonUi.enableButton(InCallButtonIds.BUTTON_ADD_CALL, showAddCall);
- mInCallButtonUi.showButton(InCallButtonIds.BUTTON_UPGRADE_TO_VIDEO, showUpgradeToVideo);
- mInCallButtonUi.showButton(InCallButtonIds.BUTTON_DOWNGRADE_TO_AUDIO, showDowngradeToAudio);
- mInCallButtonUi.showButton(
+ inCallButtonUi.showButton(InCallButtonIds.BUTTON_AUDIO, true);
+ inCallButtonUi.showButton(InCallButtonIds.BUTTON_SWAP, showSwap);
+ inCallButtonUi.showButton(InCallButtonIds.BUTTON_HOLD, showHold);
+ inCallButtonUi.setHold(isCallOnHold);
+ inCallButtonUi.showButton(InCallButtonIds.BUTTON_MUTE, showMute);
+ inCallButtonUi.showButton(InCallButtonIds.BUTTON_SWAP_SIM, showSwapSim);
+ inCallButtonUi.showButton(InCallButtonIds.BUTTON_ADD_CALL, true);
+ inCallButtonUi.enableButton(InCallButtonIds.BUTTON_ADD_CALL, showAddCall);
+ inCallButtonUi.showButton(InCallButtonIds.BUTTON_UPGRADE_TO_VIDEO, showUpgradeToVideo);
+ inCallButtonUi.showButton(InCallButtonIds.BUTTON_DOWNGRADE_TO_AUDIO, showDowngradeToAudio);
+ inCallButtonUi.showButton(
InCallButtonIds.BUTTON_SWITCH_CAMERA,
isVideo && hasCameraPermission && call.getVideoTech().isTransmitting());
- mInCallButtonUi.showButton(InCallButtonIds.BUTTON_PAUSE_VIDEO, showPauseVideo);
+ inCallButtonUi.showButton(InCallButtonIds.BUTTON_PAUSE_VIDEO, showPauseVideo);
if (isVideo) {
- mInCallButtonUi.setVideoPaused(!call.getVideoTech().isTransmitting() || !hasCameraPermission);
+ inCallButtonUi.setVideoPaused(!call.getVideoTech().isTransmitting() || !hasCameraPermission);
}
- mInCallButtonUi.showButton(InCallButtonIds.BUTTON_DIALPAD, true);
- mInCallButtonUi.showButton(InCallButtonIds.BUTTON_MERGE, showMerge);
+ inCallButtonUi.showButton(InCallButtonIds.BUTTON_DIALPAD, true);
+ inCallButtonUi.showButton(InCallButtonIds.BUTTON_MERGE, showMerge);
- mInCallButtonUi.updateButtonStates();
+ inCallButtonUi.updateButtonStates();
}
private boolean hasVideoCallCapabilities(DialerCall call) {
- return call.getVideoTech().isAvailable(mContext);
+ return call.getVideoTech().isAvailable(context);
}
/**
@@ -516,52 +516,51 @@ public class CallButtonPresenter
@Override
public void refreshMuteState() {
// Restore the previous mute state
- if (mAutomaticallyMuted
- && AudioModeProvider.getInstance().getAudioState().isMuted() != mPreviousMuteState) {
- if (mInCallButtonUi == null) {
+ if (automaticallyMuted
+ && AudioModeProvider.getInstance().getAudioState().isMuted() != previousMuteState) {
+ if (inCallButtonUi == null) {
return;
}
- muteClicked(mPreviousMuteState, false /* clickedByUser */);
+ muteClicked(previousMuteState, false /* clickedByUser */);
}
- mAutomaticallyMuted = false;
+ automaticallyMuted = false;
}
@Override
public void onSaveInstanceState(Bundle outState) {
- outState.putBoolean(KEY_AUTOMATICALLY_MUTED, mAutomaticallyMuted);
- outState.putBoolean(KEY_PREVIOUS_MUTE_STATE, mPreviousMuteState);
+ outState.putBoolean(KEY_AUTOMATICALLY_MUTED, automaticallyMuted);
+ outState.putBoolean(KEY_PREVIOUS_MUTE_STATE, previousMuteState);
}
@Override
public void onRestoreInstanceState(Bundle savedInstanceState) {
- mAutomaticallyMuted =
- savedInstanceState.getBoolean(KEY_AUTOMATICALLY_MUTED, mAutomaticallyMuted);
- mPreviousMuteState = savedInstanceState.getBoolean(KEY_PREVIOUS_MUTE_STATE, mPreviousMuteState);
+ automaticallyMuted = savedInstanceState.getBoolean(KEY_AUTOMATICALLY_MUTED, automaticallyMuted);
+ previousMuteState = savedInstanceState.getBoolean(KEY_PREVIOUS_MUTE_STATE, previousMuteState);
}
@Override
public void onCameraPermissionGranted() {
- if (mCall != null) {
- updateButtonsState(mCall);
+ if (call != null) {
+ updateButtonsState(call);
}
}
@Override
public void onActiveCameraSelectionChanged(boolean isUsingFrontFacingCamera) {
- if (mInCallButtonUi == null) {
+ if (inCallButtonUi == null) {
return;
}
- mInCallButtonUi.setCameraSwitched(!isUsingFrontFacingCamera);
+ inCallButtonUi.setCameraSwitched(!isUsingFrontFacingCamera);
}
@Override
public Context getContext() {
- return mContext;
+ return context;
}
private InCallActivity getActivity() {
- if (mInCallButtonUi != null) {
- Fragment fragment = mInCallButtonUi.getInCallButtonUiFragment();
+ if (inCallButtonUi != null) {
+ Fragment fragment = inCallButtonUi.getInCallButtonUiFragment();
if (fragment != null) {
return (InCallActivity) fragment.getActivity();
}
diff --git a/java/com/android/incallui/CallCardPresenter.java b/java/com/android/incallui/CallCardPresenter.java
index eb5221669..67473d75e 100644
--- a/java/com/android/incallui/CallCardPresenter.java
+++ b/java/com/android/incallui/CallCardPresenter.java
@@ -113,16 +113,16 @@ public class CallCardPresenter
private static final long CONFIG_MIN_BATTERY_PERCENT_FOR_EMERGENCY_LOCATION_DEFAULT = 10;
- private final Context mContext;
+ private final Context context;
private final Handler handler = new Handler();
- private DialerCall mPrimary;
- private DialerCall mSecondary;
- private ContactCacheEntry mPrimaryContactInfo;
- private ContactCacheEntry mSecondaryContactInfo;
- @Nullable private ContactsPreferences mContactsPreferences;
- private boolean mIsFullscreen = false;
- private InCallScreen mInCallScreen;
+ private DialerCall primary;
+ private DialerCall secondary;
+ private ContactCacheEntry primaryContactInfo;
+ private ContactCacheEntry secondaryContactInfo;
+ @Nullable private ContactsPreferences contactsPreferences;
+ private boolean isFullscreen = false;
+ private InCallScreen inCallScreen;
private boolean isInCallScreenReady;
private boolean shouldSendAccessibilityEvent;
@@ -131,7 +131,7 @@ public class CallCardPresenter
new Runnable() {
@Override
public void run() {
- shouldSendAccessibilityEvent = !sendAccessibilityEvent(mContext, getUi());
+ shouldSendAccessibilityEvent = !sendAccessibilityEvent(context, getUi());
LogUtil.i(
"CallCardPresenter.sendAccessibilityEventRunnable",
"still should send: %b",
@@ -144,8 +144,8 @@ public class CallCardPresenter
public CallCardPresenter(Context context) {
LogUtil.i("CallCardPresenter.constructor", null);
- mContext = Assert.isNotNull(context).getApplicationContext();
- callLocation = CallLocationComponent.get(mContext).getCallLocation();
+ this.context = Assert.isNotNull(context).getApplicationContext();
+ callLocation = CallLocationComponent.get(this.context).getCallLocation();
}
private static boolean hasCallSubject(DialerCall call) {
@@ -160,18 +160,18 @@ public class CallCardPresenter
@Override
public void onInCallScreenDelegateInit(InCallScreen inCallScreen) {
Assert.isNotNull(inCallScreen);
- mInCallScreen = inCallScreen;
- mContactsPreferences = ContactsPreferencesFactory.newContactsPreferences(mContext);
+ this.inCallScreen = inCallScreen;
+ contactsPreferences = ContactsPreferencesFactory.newContactsPreferences(context);
// Call may be null if disconnect happened already.
DialerCall call = CallList.getInstance().getFirstCall();
if (call != null) {
- mPrimary = call;
- if (shouldShowNoteSentToast(mPrimary)) {
- mInCallScreen.showNoteSentToast();
+ primary = call;
+ if (shouldShowNoteSentToast(primary)) {
+ this.inCallScreen.showNoteSentToast();
}
call.addListener(this);
- addCallFeedbackListener(mContext);
+ addCallFeedbackListener(context);
// start processing lookups right away.
if (!call.isConferenceCall()) {
startContactInfoSearch(call, true, call.getState() == DialerCall.State.INCOMING);
@@ -187,12 +187,12 @@ public class CallCardPresenter
public void onInCallScreenReady() {
LogUtil.i("CallCardPresenter.onInCallScreenReady", null);
Assert.checkState(!isInCallScreenReady);
- if (mContactsPreferences != null) {
- mContactsPreferences.refreshValue(ContactsPreferences.DISPLAY_ORDER_KEY);
+ if (contactsPreferences != null) {
+ contactsPreferences.refreshValue(ContactsPreferences.DISPLAY_ORDER_KEY);
}
// Contact search may have completed before ui is ready.
- if (mPrimaryContactInfo != null) {
+ if (primaryContactInfo != null) {
updatePrimaryDisplayInfo();
}
@@ -204,24 +204,24 @@ public class CallCardPresenter
isInCallScreenReady = true;
// Log location impressions
- if (isOutgoingEmergencyCall(mPrimary)) {
- Logger.get(mContext).logImpression(DialerImpression.Type.EMERGENCY_NEW_EMERGENCY_CALL);
- } else if (isIncomingEmergencyCall(mPrimary) || isIncomingEmergencyCall(mSecondary)) {
- Logger.get(mContext).logImpression(DialerImpression.Type.EMERGENCY_CALLBACK);
+ if (isOutgoingEmergencyCall(primary)) {
+ Logger.get(context).logImpression(DialerImpression.Type.EMERGENCY_NEW_EMERGENCY_CALL);
+ } else if (isIncomingEmergencyCall(primary) || isIncomingEmergencyCall(secondary)) {
+ Logger.get(context).logImpression(DialerImpression.Type.EMERGENCY_CALLBACK);
}
// Showing the location may have been skipped if the UI wasn't ready during previous layout.
if (shouldShowLocation()) {
- mInCallScreen.showLocationUi(getLocationFragment());
+ inCallScreen.showLocationUi(getLocationFragment());
// Log location impressions
if (!hasLocationPermission()) {
- Logger.get(mContext).logImpression(DialerImpression.Type.EMERGENCY_NO_LOCATION_PERMISSION);
+ Logger.get(context).logImpression(DialerImpression.Type.EMERGENCY_NO_LOCATION_PERMISSION);
} else if (isBatteryTooLowForEmergencyLocation()) {
- Logger.get(mContext)
+ Logger.get(context)
.logImpression(DialerImpression.Type.EMERGENCY_BATTERY_TOO_LOW_TO_GET_LOCATION);
- } else if (!callLocation.canGetLocation(mContext)) {
- Logger.get(mContext).logImpression(DialerImpression.Type.EMERGENCY_CANT_GET_LOCATION);
+ } else if (!callLocation.canGetLocation(context)) {
+ Logger.get(context).logImpression(DialerImpression.Type.EMERGENCY_CANT_GET_LOCATION);
}
}
}
@@ -236,15 +236,15 @@ public class CallCardPresenter
InCallPresenter.getInstance().removeIncomingCallListener(this);
InCallPresenter.getInstance().removeDetailsListener(this);
InCallPresenter.getInstance().removeInCallEventListener(this);
- if (mPrimary != null) {
- mPrimary.removeListener(this);
+ if (primary != null) {
+ primary.removeListener(this);
}
callLocation.close();
- mPrimary = null;
- mPrimaryContactInfo = null;
- mSecondaryContactInfo = null;
+ primary = null;
+ primaryContactInfo = null;
+ secondaryContactInfo = null;
isInCallScreenReady = false;
}
@@ -258,7 +258,7 @@ public class CallCardPresenter
public void onStateChange(InCallState oldState, InCallState newState, CallList callList) {
Trace.beginSection("CallCardPresenter.onStateChange");
LogUtil.v("CallCardPresenter.onStateChange", "oldState: %s, newState: %s", oldState, newState);
- if (mInCallScreen == null) {
+ if (inCallScreen == null) {
Trace.endSection();
return;
}
@@ -286,22 +286,23 @@ public class CallCardPresenter
LogUtil.v("CallCardPresenter.onStateChange", "secondary call: " + secondary);
final boolean primaryChanged =
- !(DialerCall.areSame(mPrimary, primary) && DialerCall.areSameNumber(mPrimary, primary));
+ !(DialerCall.areSame(this.primary, primary)
+ && DialerCall.areSameNumber(this.primary, primary));
final boolean secondaryChanged =
- !(DialerCall.areSame(mSecondary, secondary)
- && DialerCall.areSameNumber(mSecondary, secondary));
+ !(DialerCall.areSame(this.secondary, secondary)
+ && DialerCall.areSameNumber(this.secondary, secondary));
- mSecondary = secondary;
- DialerCall previousPrimary = mPrimary;
- mPrimary = primary;
+ this.secondary = secondary;
+ DialerCall previousPrimary = this.primary;
+ this.primary = primary;
- if (mPrimary != null) {
- InCallPresenter.getInstance().onForegroundCallChanged(mPrimary);
- mInCallScreen.updateInCallScreenColors();
+ if (this.primary != null) {
+ InCallPresenter.getInstance().onForegroundCallChanged(this.primary);
+ inCallScreen.updateInCallScreenColors();
}
if (primaryChanged && shouldShowNoteSentToast(primary)) {
- mInCallScreen.showNoteSentToast();
+ inCallScreen.showNoteSentToast();
}
// Refresh primary call information if either:
@@ -312,38 +313,38 @@ public class CallCardPresenter
if (previousPrimary != null) {
previousPrimary.removeListener(this);
}
- mPrimary.addListener(this);
+ this.primary.addListener(this);
- mPrimaryContactInfo =
+ primaryContactInfo =
ContactInfoCache.buildCacheEntryFromCall(
- mContext, mPrimary, mPrimary.getState() == DialerCall.State.INCOMING);
+ context, this.primary, this.primary.getState() == DialerCall.State.INCOMING);
updatePrimaryDisplayInfo();
- maybeStartSearch(mPrimary, true);
+ maybeStartSearch(this.primary, true);
}
- if (previousPrimary != null && mPrimary == null) {
+ if (previousPrimary != null && this.primary == null) {
previousPrimary.removeListener(this);
}
if (secondaryChanged) {
- if (mSecondary == null) {
+ if (this.secondary == null) {
// Secondary call may have ended. Update the ui.
- mSecondaryContactInfo = null;
+ secondaryContactInfo = null;
updateSecondaryDisplayInfo();
} else {
// secondary call has changed
- mSecondaryContactInfo =
+ secondaryContactInfo =
ContactInfoCache.buildCacheEntryFromCall(
- mContext, mSecondary, mSecondary.getState() == DialerCall.State.INCOMING);
+ context, this.secondary, this.secondary.getState() == DialerCall.State.INCOMING);
updateSecondaryDisplayInfo();
- maybeStartSearch(mSecondary, false);
+ maybeStartSearch(this.secondary, false);
}
}
// Set the call state
int callState = DialerCall.State.IDLE;
- if (mPrimary != null) {
- callState = mPrimary.getState();
+ if (this.primary != null) {
+ callState = this.primary.getState();
updatePrimaryCallState();
} else {
getUi().setCallState(PrimaryCallState.createEmptyPrimaryCallState());
@@ -354,7 +355,7 @@ public class CallCardPresenter
// Hide the end call button instantly if we're receiving an incoming call.
getUi()
.setEndCallButtonEnabled(
- shouldShowEndCallButton(mPrimary, callState),
+ shouldShowEndCallButton(this.primary, callState),
callState != DialerCall.State.INCOMING /* animate */);
maybeSendAccessibilityEvent(oldState, newState, primaryChanged);
@@ -399,7 +400,7 @@ public class CallCardPresenter
public void onDialerCallChildNumberChange() {
LogUtil.v("CallCardPresenter.onDialerCallChildNumberChange", "");
- if (mPrimary == null) {
+ if (primary == null) {
return;
}
updatePrimaryDisplayInfo();
@@ -410,7 +411,7 @@ public class CallCardPresenter
public void onDialerCallLastForwardedNumberChange() {
LogUtil.v("CallCardPresenter.onDialerCallLastForwardedNumberChange", "");
- if (mPrimary == null) {
+ if (primary == null) {
return;
}
updatePrimaryDisplayInfo();
@@ -425,78 +426,78 @@ public class CallCardPresenter
public void onDialerCallSessionModificationStateChange() {
LogUtil.enterBlock("CallCardPresenter.onDialerCallSessionModificationStateChange");
- if (mPrimary == null) {
+ if (primary == null) {
return;
}
getUi()
.setEndCallButtonEnabled(
- mPrimary.getVideoTech().getSessionModificationState()
+ primary.getVideoTech().getSessionModificationState()
!= SessionModificationState.RECEIVED_UPGRADE_TO_VIDEO_REQUEST,
true /* shouldAnimate */);
updatePrimaryCallState();
}
private boolean shouldRefreshPrimaryInfo(boolean primaryChanged) {
- if (mPrimary == null) {
+ if (primary == null) {
return false;
}
return primaryChanged
- || mInCallScreen.isManageConferenceVisible() != shouldShowManageConference();
+ || inCallScreen.isManageConferenceVisible() != shouldShowManageConference();
}
private void updatePrimaryCallState() {
- if (getUi() != null && mPrimary != null) {
+ if (getUi() != null && primary != null) {
boolean isWorkCall =
- mPrimary.hasProperty(PROPERTY_ENTERPRISE_CALL)
- || (mPrimaryContactInfo != null
- && mPrimaryContactInfo.userType == ContactsUtils.USER_TYPE_WORK);
+ primary.hasProperty(PROPERTY_ENTERPRISE_CALL)
+ || (primaryContactInfo != null
+ && primaryContactInfo.userType == ContactsUtils.USER_TYPE_WORK);
boolean isHdAudioCall =
- isPrimaryCallActive() && mPrimary.hasProperty(Details.PROPERTY_HIGH_DEF_AUDIO);
+ isPrimaryCallActive() && primary.hasProperty(Details.PROPERTY_HIGH_DEF_AUDIO);
boolean isAttemptingHdAudioCall =
!isHdAudioCall
- && !mPrimary.hasProperty(DialerCall.PROPERTY_CODEC_KNOWN)
- && MotorolaUtils.shouldBlinkHdIconWhenConnectingCall(mContext);
+ && !primary.hasProperty(DialerCall.PROPERTY_CODEC_KNOWN)
+ && MotorolaUtils.shouldBlinkHdIconWhenConnectingCall(context);
- boolean isBusiness = mPrimaryContactInfo != null && mPrimaryContactInfo.isBusiness;
+ boolean isBusiness = primaryContactInfo != null && primaryContactInfo.isBusiness;
// Check for video state change and update the visibility of the contact photo. The contact
// photo is hidden when the incoming video surface is shown.
// The contact photo visibility can also change in setPrimary().
boolean shouldShowContactPhoto =
- !VideoCallPresenter.showIncomingVideo(mPrimary.getVideoState(), mPrimary.getState());
+ !VideoCallPresenter.showIncomingVideo(primary.getVideoState(), primary.getState());
getUi()
.setCallState(
new PrimaryCallState(
- mPrimary.getState(),
- mPrimary.isVideoCall(),
- mPrimary.getVideoTech().getSessionModificationState(),
- mPrimary.getDisconnectCause(),
+ primary.getState(),
+ primary.isVideoCall(),
+ primary.getVideoTech().getSessionModificationState(),
+ primary.getDisconnectCause(),
getConnectionLabel(),
getCallStateIcon(),
getGatewayNumber(),
- shouldShowCallSubject(mPrimary) ? mPrimary.getCallSubject() : null,
+ shouldShowCallSubject(primary) ? primary.getCallSubject() : null,
PhoneNumberHelper.formatNumber(
- mPrimary.getCallbackNumber(), mPrimary.getSimCountryIso()),
- mPrimary.hasProperty(Details.PROPERTY_WIFI),
- mPrimary.isConferenceCall()
- && !mPrimary.hasProperty(Details.PROPERTY_GENERIC_CONFERENCE),
+ primary.getCallbackNumber(), primary.getSimCountryIso()),
+ primary.hasProperty(Details.PROPERTY_WIFI),
+ primary.isConferenceCall()
+ && !primary.hasProperty(Details.PROPERTY_GENERIC_CONFERENCE),
isWorkCall,
isAttemptingHdAudioCall,
isHdAudioCall,
- !TextUtils.isEmpty(mPrimary.getLastForwardedNumber()),
+ !TextUtils.isEmpty(primary.getLastForwardedNumber()),
shouldShowContactPhoto,
- mPrimary.getConnectTimeMillis(),
- mPrimary.isVoiceMailNumber(),
- mPrimary.isRemotelyHeld(),
+ primary.getConnectTimeMillis(),
+ primary.isVoiceMailNumber(),
+ primary.isRemotelyHeld(),
isBusiness,
supports2ndCallOnHold(),
getSwapToSecondaryButtonState(),
- mPrimary.isAssistedDialed(),
+ primary.isAssistedDialed(),
null,
- mPrimary.getAssistedDialingExtras()));
+ primary.getAssistedDialingExtras()));
InCallActivity activity =
- (InCallActivity) (mInCallScreen.getInCallScreenFragment().getActivity());
+ (InCallActivity) (inCallScreen.getInCallScreenFragment().getActivity());
if (activity != null) {
activity.onPrimaryCallStateChanged();
}
@@ -504,10 +505,10 @@ public class CallCardPresenter
}
private @ButtonState int getSwapToSecondaryButtonState() {
- if (mSecondary == null) {
+ if (secondary == null) {
return ButtonState.NOT_SUPPORT;
}
- if (mPrimary.getState() == State.ACTIVE) {
+ if (primary.getState() == State.ACTIVE) {
return ButtonState.ENABLED;
}
return ButtonState.DISABLED;
@@ -525,12 +526,11 @@ public class CallCardPresenter
* @return {@code True} if the manage conference button should be visible.
*/
private boolean shouldShowManageConference() {
- if (mPrimary == null) {
+ if (primary == null) {
return false;
}
- return mPrimary.can(android.telecom.Call.Details.CAPABILITY_MANAGE_CONFERENCE)
- && !mIsFullscreen;
+ return primary.can(android.telecom.Call.Details.CAPABILITY_MANAGE_CONFERENCE) && !isFullscreen;
}
private boolean supports2ndCallOnHold() {
@@ -544,19 +544,19 @@ public class CallCardPresenter
@Override
public void onCallStateButtonClicked() {
- Intent broadcastIntent = Bindings.get(mContext).getCallStateButtonBroadcastIntent(mContext);
+ Intent broadcastIntent = Bindings.get(context).getCallStateButtonBroadcastIntent(context);
if (broadcastIntent != null) {
LogUtil.v(
"CallCardPresenter.onCallStateButtonClicked",
"sending call state button broadcast: " + broadcastIntent);
- mContext.sendBroadcast(broadcastIntent, Manifest.permission.READ_PHONE_STATE);
+ context.sendBroadcast(broadcastIntent, Manifest.permission.READ_PHONE_STATE);
}
}
@Override
public void onManageConferenceClicked() {
InCallActivity activity =
- (InCallActivity) (mInCallScreen.getInCallScreenFragment().getActivity());
+ (InCallActivity) (inCallScreen.getInCallScreenFragment().getActivity());
activity.showConferenceFragment(true);
}
@@ -575,15 +575,15 @@ public class CallCardPresenter
/** Starts a query for more contact data for the save primary and secondary calls. */
private void startContactInfoSearch(
final DialerCall call, final boolean isPrimary, boolean isIncoming) {
- final ContactInfoCache cache = ContactInfoCache.getInstance(mContext);
+ final ContactInfoCache cache = ContactInfoCache.getInstance(context);
cache.findInfo(call, isIncoming, new ContactLookupCallback(this, isPrimary));
}
private void onContactInfoComplete(String callId, ContactCacheEntry entry, boolean isPrimary) {
final boolean entryMatchesExistingCall =
- (isPrimary && mPrimary != null && TextUtils.equals(callId, mPrimary.getId()))
- || (!isPrimary && mSecondary != null && TextUtils.equals(callId, mSecondary.getId()));
+ (isPrimary && primary != null && TextUtils.equals(callId, primary.getId()))
+ || (!isPrimary && secondary != null && TextUtils.equals(callId, secondary.getId()));
if (entryMatchesExistingCall) {
updateContactEntry(entry, isPrimary);
} else {
@@ -597,7 +597,7 @@ public class CallCardPresenter
call.getLogState().contactLookupResult = entry.contactLookupResult;
}
if (entry.lookupUri != null) {
- CallerInfoUtils.sendViewNotification(mContext, entry.lookupUri);
+ CallerInfoUtils.sendViewNotification(context, entry.lookupUri);
}
}
@@ -607,9 +607,9 @@ public class CallCardPresenter
}
if (entry.photo != null) {
- if (mPrimary != null && callId.equals(mPrimary.getId())) {
+ if (primary != null && callId.equals(primary.getId())) {
updateContactEntry(entry, true /* isPrimary */);
- } else if (mSecondary != null && callId.equals(mSecondary.getId())) {
+ } else if (secondary != null && callId.equals(secondary.getId())) {
updateContactEntry(entry, false /* isPrimary */);
}
}
@@ -617,10 +617,10 @@ public class CallCardPresenter
private void updateContactEntry(ContactCacheEntry entry, boolean isPrimary) {
if (isPrimary) {
- mPrimaryContactInfo = entry;
+ primaryContactInfo = entry;
updatePrimaryDisplayInfo();
} else {
- mSecondaryContactInfo = entry;
+ secondaryContactInfo = entry;
updateSecondaryDisplayInfo();
}
}
@@ -674,7 +674,7 @@ public class CallCardPresenter
}
private void updatePrimaryDisplayInfo() {
- if (mInCallScreen == null) {
+ if (inCallScreen == null) {
// TODO: May also occur if search result comes back after ui is destroyed. Look into
// removing that case completely.
LogUtil.v(
@@ -683,35 +683,35 @@ public class CallCardPresenter
return;
}
- if (mPrimary == null) {
+ if (primary == null) {
// Clear the primary display info.
- mInCallScreen.setPrimary(PrimaryInfo.createEmptyPrimaryInfo());
+ inCallScreen.setPrimary(PrimaryInfo.createEmptyPrimaryInfo());
return;
}
// Hide the contact photo if we are in a video call and the incoming video surface is
// showing.
boolean showContactPhoto =
- !VideoCallPresenter.showIncomingVideo(mPrimary.getVideoState(), mPrimary.getState());
+ !VideoCallPresenter.showIncomingVideo(primary.getVideoState(), primary.getState());
// DialerCall placed through a work phone account.
- boolean hasWorkCallProperty = mPrimary.hasProperty(PROPERTY_ENTERPRISE_CALL);
+ boolean hasWorkCallProperty = primary.hasProperty(PROPERTY_ENTERPRISE_CALL);
MultimediaData multimediaData = null;
- if (mPrimary.getEnrichedCallSession() != null) {
- multimediaData = mPrimary.getEnrichedCallSession().getMultimediaData();
+ if (primary.getEnrichedCallSession() != null) {
+ multimediaData = primary.getEnrichedCallSession().getMultimediaData();
}
- if (mPrimary.isConferenceCall()) {
+ if (primary.isConferenceCall()) {
LogUtil.v(
"CallCardPresenter.updatePrimaryDisplayInfo",
"update primary display info for conference call.");
- mInCallScreen.setPrimary(
+ inCallScreen.setPrimary(
new PrimaryInfo(
null /* number */,
CallerInfoUtils.getConferenceString(
- mContext, mPrimary.hasProperty(Details.PROPERTY_GENERIC_CONFERENCE)),
+ context, primary.hasProperty(Details.PROPERTY_GENERIC_CONFERENCE)),
false /* nameIsNumber */,
null /* location */,
null /* label */,
@@ -727,63 +727,63 @@ public class CallCardPresenter
null /* contactInfoLookupKey */,
null /* enrichedCallMultimediaData */,
true /* showInCallButtonGrid */,
- mPrimary.getNumberPresentation()));
- } else if (mPrimaryContactInfo != null) {
+ primary.getNumberPresentation()));
+ } else if (primaryContactInfo != null) {
LogUtil.v(
"CallCardPresenter.updatePrimaryDisplayInfo",
- "update primary display info for " + mPrimaryContactInfo);
+ "update primary display info for " + primaryContactInfo);
- String name = getNameForCall(mPrimaryContactInfo);
+ String name = getNameForCall(primaryContactInfo);
String number;
- boolean isChildNumberShown = !TextUtils.isEmpty(mPrimary.getChildNumber());
- boolean isForwardedNumberShown = !TextUtils.isEmpty(mPrimary.getLastForwardedNumber());
- boolean isCallSubjectShown = shouldShowCallSubject(mPrimary);
+ boolean isChildNumberShown = !TextUtils.isEmpty(primary.getChildNumber());
+ boolean isForwardedNumberShown = !TextUtils.isEmpty(primary.getLastForwardedNumber());
+ boolean isCallSubjectShown = shouldShowCallSubject(primary);
if (isCallSubjectShown) {
number = null;
} else if (isChildNumberShown) {
- number = mContext.getString(R.string.child_number, mPrimary.getChildNumber());
+ number = context.getString(R.string.child_number, primary.getChildNumber());
} else if (isForwardedNumberShown) {
// Use last forwarded number instead of second line, if present.
- number = mPrimary.getLastForwardedNumber();
+ number = primary.getLastForwardedNumber();
} else {
- number = mPrimaryContactInfo.number;
+ number = primaryContactInfo.number;
}
- boolean nameIsNumber = name != null && name.equals(mPrimaryContactInfo.number);
+ boolean nameIsNumber = name != null && name.equals(primaryContactInfo.number);
// DialerCall with caller that is a work contact.
- boolean isWorkContact = (mPrimaryContactInfo.userType == ContactsUtils.USER_TYPE_WORK);
- mInCallScreen.setPrimary(
+ boolean isWorkContact = (primaryContactInfo.userType == ContactsUtils.USER_TYPE_WORK);
+ inCallScreen.setPrimary(
new PrimaryInfo(
number,
- mPrimary.updateNameIfRestricted(name),
+ primary.updateNameIfRestricted(name),
nameIsNumber,
- shouldShowLocationAsLabel(nameIsNumber, mPrimaryContactInfo.shouldShowLocation)
- ? mPrimaryContactInfo.location
+ shouldShowLocationAsLabel(nameIsNumber, primaryContactInfo.shouldShowLocation)
+ ? primaryContactInfo.location
: null,
- isChildNumberShown || isCallSubjectShown ? null : mPrimaryContactInfo.label,
- mPrimaryContactInfo.photo,
- mPrimaryContactInfo.photoType,
- mPrimaryContactInfo.isSipCall,
+ isChildNumberShown || isCallSubjectShown ? null : primaryContactInfo.label,
+ primaryContactInfo.photo,
+ primaryContactInfo.photoType,
+ primaryContactInfo.isSipCall,
showContactPhoto,
hasWorkCallProperty || isWorkContact,
- mPrimary.isSpam(),
- mPrimaryContactInfo.isLocalContact(),
- mPrimary.answeringDisconnectsForegroundVideoCall(),
+ primary.isSpam(),
+ primaryContactInfo.isLocalContact(),
+ primary.answeringDisconnectsForegroundVideoCall(),
shouldShowLocation(),
- mPrimaryContactInfo.lookupKey,
+ primaryContactInfo.lookupKey,
multimediaData,
true /* showInCallButtonGrid */,
- mPrimary.getNumberPresentation()));
+ primary.getNumberPresentation()));
} else {
// Clear the primary display info.
- mInCallScreen.setPrimary(PrimaryInfo.createEmptyPrimaryInfo());
+ inCallScreen.setPrimary(PrimaryInfo.createEmptyPrimaryInfo());
}
if (isInCallScreenReady) {
- mInCallScreen.showLocationUi(getLocationFragment());
+ inCallScreen.showLocationUi(getLocationFragment());
} else {
LogUtil.i("CallCardPresenter.updatePrimaryDisplayInfo", "UI not ready, not showing location");
}
@@ -805,11 +805,11 @@ public class CallCardPresenter
return null;
}
LogUtil.i("CallCardPresenter.getLocationFragment", "returning location fragment");
- return callLocation.getLocationFragment(mContext);
+ return callLocation.getLocationFragment(context);
}
private boolean shouldShowLocation() {
- if (!ConfigProviderBindings.get(mContext)
+ if (!ConfigProviderBindings.get(context)
.getBoolean(CONFIG_ENABLE_EMERGENCY_LOCATION, CONFIG_ENABLE_EMERGENCY_LOCATION_DEFAULT)) {
LogUtil.i("CallCardPresenter.getLocationFragment", "disabled by config.");
return false;
@@ -826,15 +826,15 @@ public class CallCardPresenter
LogUtil.i("CallCardPresenter.getLocationFragment", "low battery.");
return false;
}
- if (ActivityCompat.isInMultiWindowMode(mInCallScreen.getInCallScreenFragment().getActivity())) {
+ if (ActivityCompat.isInMultiWindowMode(inCallScreen.getInCallScreenFragment().getActivity())) {
LogUtil.i("CallCardPresenter.getLocationFragment", "in multi-window mode");
return false;
}
- if (mPrimary.isVideoCall()) {
+ if (primary.isVideoCall()) {
LogUtil.i("CallCardPresenter.getLocationFragment", "emergency video calls not supported");
return false;
}
- if (!callLocation.canGetLocation(mContext)) {
+ if (!callLocation.canGetLocation(context)) {
LogUtil.i("CallCardPresenter.getLocationFragment", "can't get current location");
return false;
}
@@ -842,13 +842,13 @@ public class CallCardPresenter
}
private boolean isPotentialEmergencyCall() {
- if (isOutgoingEmergencyCall(mPrimary)) {
+ if (isOutgoingEmergencyCall(primary)) {
LogUtil.i("CallCardPresenter.shouldShowLocation", "new emergency call");
return true;
- } else if (isIncomingEmergencyCall(mPrimary)) {
+ } else if (isIncomingEmergencyCall(primary)) {
LogUtil.i("CallCardPresenter.shouldShowLocation", "potential emergency callback");
return true;
- } else if (isIncomingEmergencyCall(mSecondary)) {
+ } else if (isIncomingEmergencyCall(secondary)) {
LogUtil.i("CallCardPresenter.shouldShowLocation", "has potential emergency callback");
return true;
}
@@ -864,13 +864,13 @@ public class CallCardPresenter
}
private boolean hasLocationPermission() {
- return ContextCompat.checkSelfPermission(mContext, Manifest.permission.ACCESS_FINE_LOCATION)
+ return ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION)
== PackageManager.PERMISSION_GRANTED;
}
private boolean isBatteryTooLowForEmergencyLocation() {
Intent batteryStatus =
- mContext.registerReceiver(null, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
+ context.registerReceiver(null, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
int status = batteryStatus.getIntExtra(BatteryManager.EXTRA_STATUS, -1);
if (status == BatteryManager.BATTERY_STATUS_CHARGING
|| status == BatteryManager.BATTERY_STATUS_FULL) {
@@ -881,7 +881,7 @@ public class CallCardPresenter
int scale = batteryStatus.getIntExtra(BatteryManager.EXTRA_SCALE, -1);
float batteryPercent = (100f * level) / scale;
long threshold =
- ConfigProviderBindings.get(mContext)
+ ConfigProviderBindings.get(context)
.getLong(
CONFIG_MIN_BATTERY_PERCENT_FOR_EMERGENCY_LOCATION,
CONFIG_MIN_BATTERY_PERCENT_FOR_EMERGENCY_LOCATION_DEFAULT);
@@ -892,60 +892,60 @@ public class CallCardPresenter
}
private void updateSecondaryDisplayInfo() {
- if (mInCallScreen == null) {
+ if (inCallScreen == null) {
return;
}
- if (mSecondary == null) {
+ if (secondary == null) {
// Clear the secondary display info.
- mInCallScreen.setSecondary(SecondaryInfo.createEmptySecondaryInfo(mIsFullscreen));
+ inCallScreen.setSecondary(SecondaryInfo.createEmptySecondaryInfo(isFullscreen));
return;
}
- if (mSecondary.isMergeInProcess()) {
+ if (secondary.isMergeInProcess()) {
LogUtil.i(
"CallCardPresenter.updateSecondaryDisplayInfo",
"secondary call is merge in process, clearing info");
- mInCallScreen.setSecondary(SecondaryInfo.createEmptySecondaryInfo(mIsFullscreen));
+ inCallScreen.setSecondary(SecondaryInfo.createEmptySecondaryInfo(isFullscreen));
return;
}
- if (mSecondary.isConferenceCall()) {
- mInCallScreen.setSecondary(
+ if (secondary.isConferenceCall()) {
+ inCallScreen.setSecondary(
new SecondaryInfo(
true /* show */,
CallerInfoUtils.getConferenceString(
- mContext, mSecondary.hasProperty(Details.PROPERTY_GENERIC_CONFERENCE)),
+ context, secondary.hasProperty(Details.PROPERTY_GENERIC_CONFERENCE)),
false /* nameIsNumber */,
null /* label */,
- mSecondary.getCallProviderLabel(),
+ secondary.getCallProviderLabel(),
true /* isConference */,
- mSecondary.isVideoCall(),
- mIsFullscreen));
- } else if (mSecondaryContactInfo != null) {
- LogUtil.v("CallCardPresenter.updateSecondaryDisplayInfo", "" + mSecondaryContactInfo);
- String name = getNameForCall(mSecondaryContactInfo);
- boolean nameIsNumber = name != null && name.equals(mSecondaryContactInfo.number);
- mInCallScreen.setSecondary(
+ secondary.isVideoCall(),
+ isFullscreen));
+ } else if (secondaryContactInfo != null) {
+ LogUtil.v("CallCardPresenter.updateSecondaryDisplayInfo", "" + secondaryContactInfo);
+ String name = getNameForCall(secondaryContactInfo);
+ boolean nameIsNumber = name != null && name.equals(secondaryContactInfo.number);
+ inCallScreen.setSecondary(
new SecondaryInfo(
true /* show */,
- mSecondary.updateNameIfRestricted(name),
+ secondary.updateNameIfRestricted(name),
nameIsNumber,
- mSecondaryContactInfo.label,
- mSecondary.getCallProviderLabel(),
+ secondaryContactInfo.label,
+ secondary.getCallProviderLabel(),
false /* isConference */,
- mSecondary.isVideoCall(),
- mIsFullscreen));
+ secondary.isVideoCall(),
+ isFullscreen));
} else {
// Clear the secondary display info.
- mInCallScreen.setSecondary(SecondaryInfo.createEmptySecondaryInfo(mIsFullscreen));
+ inCallScreen.setSecondary(SecondaryInfo.createEmptySecondaryInfo(isFullscreen));
}
}
/** Returns the gateway number for any existing outgoing call. */
private String getGatewayNumber() {
if (hasOutgoingGatewayCall()) {
- return DialerCall.getNumberFromHandle(mPrimary.getGatewayInfo().getGatewayAddress());
+ return DialerCall.getNumberFromHandle(primary.getGatewayInfo().getGatewayAddress());
}
return null;
}
@@ -955,35 +955,35 @@ public class CallCardPresenter
* "calling via [Account/Google Voice]" for outgoing calls.
*/
private String getConnectionLabel() {
- if (ContextCompat.checkSelfPermission(mContext, Manifest.permission.READ_PHONE_STATE)
+ if (ContextCompat.checkSelfPermission(context, Manifest.permission.READ_PHONE_STATE)
!= PackageManager.PERMISSION_GRANTED) {
return null;
}
- StatusHints statusHints = mPrimary.getStatusHints();
+ StatusHints statusHints = primary.getStatusHints();
if (statusHints != null && !TextUtils.isEmpty(statusHints.getLabel())) {
return statusHints.getLabel().toString();
}
if (hasOutgoingGatewayCall() && getUi() != null) {
// Return the label for the gateway app on outgoing calls.
- final PackageManager pm = mContext.getPackageManager();
+ final PackageManager pm = context.getPackageManager();
try {
ApplicationInfo info =
- pm.getApplicationInfo(mPrimary.getGatewayInfo().getGatewayProviderPackageName(), 0);
+ pm.getApplicationInfo(primary.getGatewayInfo().getGatewayProviderPackageName(), 0);
return pm.getApplicationLabel(info).toString();
} catch (PackageManager.NameNotFoundException e) {
LogUtil.e("CallCardPresenter.getConnectionLabel", "gateway Application Not Found.", e);
return null;
}
}
- return mPrimary.getCallProviderLabel();
+ return primary.getCallProviderLabel();
}
private Drawable getCallStateIcon() {
// Return connection icon if one exists.
- StatusHints statusHints = mPrimary.getStatusHints();
+ StatusHints statusHints = primary.getStatusHints();
if (statusHints != null && statusHints.getIcon() != null) {
- Drawable icon = statusHints.getIcon().loadDrawable(mContext);
+ Drawable icon = statusHints.getIcon().loadDrawable(context);
if (icon != null) {
return icon;
}
@@ -998,19 +998,19 @@ public class CallCardPresenter
// TODO: mPrimary can be null because this is called from updatePrimaryDisplayInfo which
// is also called after a contact search completes (call is not present yet). Split the
// UI update so it can receive independent updates.
- if (mPrimary == null) {
+ if (primary == null) {
return false;
}
- return DialerCall.State.isDialing(mPrimary.getState())
- && mPrimary.getGatewayInfo() != null
- && !mPrimary.getGatewayInfo().isEmpty();
+ return DialerCall.State.isDialing(primary.getState())
+ && primary.getGatewayInfo() != null
+ && !primary.getGatewayInfo().isEmpty();
}
/** Gets the name to display for the call. */
private String getNameForCall(ContactCacheEntry contactInfo) {
String preferredName =
ContactDisplayUtils.getPreferredDisplayName(
- contactInfo.namePrimary, contactInfo.nameAlternative, mContactsPreferences);
+ contactInfo.namePrimary, contactInfo.nameAlternative, contactsPreferences);
if (TextUtils.isEmpty(preferredName)) {
return contactInfo.number;
}
@@ -1019,30 +1019,30 @@ public class CallCardPresenter
@Override
public void onSecondaryInfoClicked() {
- if (mSecondary == null) {
+ if (secondary == null) {
LogUtil.e(
"CallCardPresenter.onSecondaryInfoClicked",
"secondary info clicked but no secondary call.");
return;
}
- Logger.get(mContext)
+ Logger.get(context)
.logCallImpression(
DialerImpression.Type.IN_CALL_SWAP_SECONDARY_BUTTON_PRESSED,
- mPrimary.getUniqueCallId(),
- mPrimary.getTimeAddedMs());
+ primary.getUniqueCallId(),
+ primary.getTimeAddedMs());
LogUtil.i(
- "CallCardPresenter.onSecondaryInfoClicked", "swapping call to foreground: " + mSecondary);
- mSecondary.unhold();
+ "CallCardPresenter.onSecondaryInfoClicked", "swapping call to foreground: " + secondary);
+ secondary.unhold();
}
@Override
public void onEndCallClicked() {
- LogUtil.i("CallCardPresenter.onEndCallClicked", "disconnecting call: " + mPrimary);
- if (mPrimary != null) {
- mPrimary.disconnect();
+ LogUtil.i("CallCardPresenter.onEndCallClicked", "disconnecting call: " + primary);
+ if (primary != null) {
+ primary.disconnect();
}
- PostCall.onDisconnectPressed(mContext);
+ PostCall.onDisconnectPressed(context);
}
/**
@@ -1052,15 +1052,15 @@ public class CallCardPresenter
*/
@Override
public void onFullscreenModeChanged(boolean isFullscreenMode) {
- mIsFullscreen = isFullscreenMode;
- if (mInCallScreen == null) {
+ isFullscreen = isFullscreenMode;
+ if (inCallScreen == null) {
return;
}
maybeShowManageConferenceCallButton();
}
private boolean isPrimaryCallActive() {
- return mPrimary != null && mPrimary.getState() == DialerCall.State.ACTIVE;
+ return primary != null && primary.getState() == DialerCall.State.ACTIVE;
}
private boolean shouldShowEndCallButton(DialerCall primary, int callState) {
@@ -1073,7 +1073,7 @@ public class CallCardPresenter
|| callState == DialerCall.State.INCOMING) {
return false;
}
- if (mPrimary.getVideoTech().getSessionModificationState()
+ if (this.primary.getVideoTech().getSessionModificationState()
== SessionModificationState.RECEIVED_UPGRADE_TO_VIDEO_REQUEST) {
return false;
}
@@ -1128,11 +1128,11 @@ public class CallCardPresenter
private void maybeSendAccessibilityEvent(
InCallState oldState, final InCallState newState, boolean primaryChanged) {
shouldSendAccessibilityEvent = false;
- if (mContext == null) {
+ if (context == null) {
return;
}
final AccessibilityManager am =
- (AccessibilityManager) mContext.getSystemService(Context.ACCESSIBILITY_SERVICE);
+ (AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE);
if (!am.isEnabled()) {
return;
}
@@ -1161,8 +1161,8 @@ public class CallCardPresenter
}
boolean isIncomingOrWaiting =
- mPrimary.getState() == DialerCall.State.INCOMING
- || mPrimary.getState() == DialerCall.State.CALL_WAITING;
+ primary.getState() == DialerCall.State.INCOMING
+ || primary.getState() == DialerCall.State.CALL_WAITING;
return isIncomingOrWaiting
&& !TextUtils.isEmpty(call.getCallSubject())
&& call.getNumberPresentation() == TelecomManager.PRESENTATION_ALLOWED
@@ -1184,30 +1184,30 @@ public class CallCardPresenter
}
private InCallScreen getUi() {
- return mInCallScreen;
+ return inCallScreen;
}
public static class ContactLookupCallback implements ContactInfoCacheCallback {
- private final WeakReference<CallCardPresenter> mCallCardPresenter;
- private final boolean mIsPrimary;
+ private final WeakReference<CallCardPresenter> callCardPresenter;
+ private final boolean isPrimary;
public ContactLookupCallback(CallCardPresenter callCardPresenter, boolean isPrimary) {
- mCallCardPresenter = new WeakReference<CallCardPresenter>(callCardPresenter);
- mIsPrimary = isPrimary;
+ this.callCardPresenter = new WeakReference<CallCardPresenter>(callCardPresenter);
+ this.isPrimary = isPrimary;
}
@Override
public void onContactInfoComplete(String callId, ContactCacheEntry entry) {
- CallCardPresenter presenter = mCallCardPresenter.get();
+ CallCardPresenter presenter = callCardPresenter.get();
if (presenter != null) {
- presenter.onContactInfoComplete(callId, entry, mIsPrimary);
+ presenter.onContactInfoComplete(callId, entry, isPrimary);
}
}
@Override
public void onImageLoadComplete(String callId, ContactCacheEntry entry) {
- CallCardPresenter presenter = mCallCardPresenter.get();
+ CallCardPresenter presenter = callCardPresenter.get();
if (presenter != null) {
presenter.onImageLoadComplete(callId, entry);
}
diff --git a/java/com/android/incallui/CallerInfo.java b/java/com/android/incallui/CallerInfo.java
index d3b12c158..7a5002d0e 100644
--- a/java/com/android/incallui/CallerInfo.java
+++ b/java/com/android/incallui/CallerInfo.java
@@ -164,13 +164,13 @@ public class CallerInfo {
public String countryIso;
- private boolean mIsEmergency;
- private boolean mIsVoiceMail;
+ private boolean isEmergency;
+ private boolean isVoiceMail;
public CallerInfo() {
// TODO: Move all the basic initialization here?
- mIsEmergency = false;
- mIsVoiceMail = false;
+ isEmergency = false;
+ isVoiceMail = false;
userType = ContactsUtils.USER_TYPE_CURRENT;
}
@@ -467,12 +467,12 @@ public class CallerInfo {
/** @return true if the caller info is an emergency number. */
public boolean isEmergencyNumber() {
- return mIsEmergency;
+ return isEmergency;
}
/** @return true if the caller info is a voicemail number. */
public boolean isVoiceMailNumber() {
- return mIsVoiceMail;
+ return isVoiceMail;
}
/**
@@ -485,7 +485,7 @@ public class CallerInfo {
name = context.getString(R.string.emergency_call_dialog_number_for_display);
phoneNumber = null;
- mIsEmergency = true;
+ isEmergency = true;
return this;
}
@@ -497,7 +497,7 @@ public class CallerInfo {
* @return this instance.
*/
/* package */ CallerInfo markAsVoiceMail(Context context) {
- mIsVoiceMail = true;
+ isVoiceMail = true;
try {
// For voicemail calls, we display the voice mail tag
@@ -565,8 +565,8 @@ public class CallerInfo {
.append("\nshouldSendToVoicemail: " + shouldSendToVoicemail)
.append("\ncachedPhoto: " + cachedPhoto)
.append("\nisCachedPhotoCurrent: " + isCachedPhotoCurrent)
- .append("\nemergency: " + mIsEmergency)
- .append("\nvoicemail: " + mIsVoiceMail)
+ .append("\nemergency: " + isEmergency)
+ .append("\nvoicemail: " + isVoiceMail)
.append("\nuserType: " + userType)
.append(" }")
.toString();
diff --git a/java/com/android/incallui/CallerInfoAsyncQuery.java b/java/com/android/incallui/CallerInfoAsyncQuery.java
index f9d8da819..52ca8cafa 100644
--- a/java/com/android/incallui/CallerInfoAsyncQuery.java
+++ b/java/com/android/incallui/CallerInfoAsyncQuery.java
@@ -287,56 +287,56 @@ public class CallerInfoAsyncQuery {
private static final class DirectoryQueryCompleteListenerFactory {
- private final OnQueryCompleteListener mListener;
- private final Context mContext;
+ private final OnQueryCompleteListener listener;
+ private final Context context;
// Make sure listener to be called once and only once
- private int mCount;
- private boolean mIsListenerCalled;
+ private int count;
+ private boolean isListenerCalled;
DirectoryQueryCompleteListenerFactory(
Context context, int size, OnQueryCompleteListener listener) {
- mCount = size;
- mListener = listener;
- mIsListenerCalled = false;
- mContext = context;
+ count = size;
+ this.listener = listener;
+ isListenerCalled = false;
+ this.context = context;
}
private void onDirectoryQueryComplete(
int token, Object cookie, CallerInfo ci, long directoryId) {
boolean shouldCallListener = false;
synchronized (this) {
- mCount = mCount - 1;
- if (!mIsListenerCalled && (ci.contactExists || mCount == 0)) {
- mIsListenerCalled = true;
+ count = count - 1;
+ if (!isListenerCalled && (ci.contactExists || count == 0)) {
+ isListenerCalled = true;
shouldCallListener = true;
}
}
// Don't call callback in synchronized block because mListener.onQueryComplete may
// take long time to complete
- if (shouldCallListener && mListener != null) {
+ if (shouldCallListener && listener != null) {
addCallerInfoIntoCache(ci, directoryId);
- mListener.onQueryComplete(token, cookie, ci);
+ listener.onQueryComplete(token, cookie, ci);
}
}
private void addCallerInfoIntoCache(CallerInfo ci, long directoryId) {
CachedNumberLookupService cachedNumberLookupService =
- PhoneNumberCache.get(mContext).getCachedNumberLookupService();
+ PhoneNumberCache.get(context).getCachedNumberLookupService();
if (ci.contactExists && cachedNumberLookupService != null) {
// 1. Cache caller info
CachedContactInfo cachedContactInfo =
CallerInfoUtils.buildCachedContactInfo(cachedNumberLookupService, ci);
- String directoryLabel = mContext.getString(R.string.directory_search_label);
+ String directoryLabel = context.getString(R.string.directory_search_label);
cachedContactInfo.setDirectorySource(directoryLabel, directoryId);
- cachedNumberLookupService.addContact(mContext, cachedContactInfo);
+ cachedNumberLookupService.addContact(context, cachedContactInfo);
// 2. Cache photo
if (ci.contactDisplayPhotoUri != null && ci.normalizedNumber != null) {
try (InputStream in =
- mContext.getContentResolver().openInputStream(ci.contactDisplayPhotoUri)) {
+ context.getContentResolver().openInputStream(ci.contactDisplayPhotoUri)) {
if (in != null) {
- cachedNumberLookupService.addPhoto(mContext, ci.normalizedNumber, in);
+ cachedNumberLookupService.addPhoto(context, ci.normalizedNumber, in);
}
} catch (IOException e) {
Log.e(LOG_TAG, "failed to fetch directory contact photo", e);
@@ -351,22 +351,22 @@ public class CallerInfoAsyncQuery {
private class DirectoryQueryCompleteListener implements OnQueryCompleteListener {
- private final long mDirectoryId;
+ private final long directoryId;
DirectoryQueryCompleteListener(long directoryId) {
- mDirectoryId = directoryId;
+ this.directoryId = directoryId;
}
@Override
public void onDataLoaded(int token, Object cookie, CallerInfo ci) {
Log.d(LOG_TAG, "DirectoryQueryCompleteListener.onDataLoaded");
- mListener.onDataLoaded(token, cookie, ci);
+ listener.onDataLoaded(token, cookie, ci);
}
@Override
public void onQueryComplete(int token, Object cookie, CallerInfo ci) {
Log.d(LOG_TAG, "DirectoryQueryCompleteListener.onQueryComplete");
- onDirectoryQueryComplete(token, cookie, ci, mDirectoryId);
+ onDirectoryQueryComplete(token, cookie, ci, directoryId);
}
}
}
@@ -380,16 +380,16 @@ public class CallerInfoAsyncQuery {
* with a new query event, and one with a end event, with 0 or more additional listeners in
* between).
*/
- private Context mQueryContext;
+ private Context queryContext;
- private Uri mQueryUri;
- private CallerInfo mCallerInfo;
+ private Uri queryUri;
+ private CallerInfo callerInfo;
/** Asynchronous query handler class for the contact / callerinfo object. */
private CallerInfoAsyncQueryHandler(Context context, Uri contactRef) {
super(context.getContentResolver());
- this.mQueryContext = context;
- this.mQueryUri = contactRef;
+ this.queryContext = context;
+ this.queryUri = contactRef;
}
@Override
@@ -448,12 +448,12 @@ public class CallerInfoAsyncQuery {
+ cw.listener.getClass().toString()
+ " for token: "
+ token
- + mCallerInfo);
- cw.listener.onQueryComplete(token, cw.cookie, mCallerInfo);
+ + callerInfo);
+ cw.listener.onQueryComplete(token, cw.cookie, callerInfo);
}
- mQueryContext = null;
- mQueryUri = null;
- mCallerInfo = null;
+ queryContext = null;
+ queryUri = null;
+ callerInfo = null;
}
void updateData(int token, Object cookie, Cursor cursor) {
@@ -472,8 +472,8 @@ public class CallerInfoAsyncQuery {
}
// check the token and if needed, create the callerinfo object.
- if (mCallerInfo == null) {
- if ((mQueryContext == null) || (mQueryUri == null)) {
+ if (callerInfo == null) {
+ if ((queryContext == null) || (queryUri == null)) {
throw new QueryPoolException(
"Bad context or query uri, or CallerInfoAsyncQuery already released.");
}
@@ -486,20 +486,20 @@ public class CallerInfoAsyncQuery {
if (cw.event == EVENT_EMERGENCY_NUMBER) {
// Note we're setting the phone number here (refer to javadoc
// comments at the top of CallerInfo class).
- mCallerInfo = new CallerInfo().markAsEmergency(mQueryContext);
+ callerInfo = new CallerInfo().markAsEmergency(queryContext);
} else if (cw.event == EVENT_VOICEMAIL_NUMBER) {
- mCallerInfo = new CallerInfo().markAsVoiceMail(mQueryContext);
+ callerInfo = new CallerInfo().markAsVoiceMail(queryContext);
} else {
- mCallerInfo = CallerInfo.getCallerInfo(mQueryContext, mQueryUri, cursor);
- Log.d(this, "==> Got mCallerInfo: " + mCallerInfo);
+ callerInfo = CallerInfo.getCallerInfo(queryContext, queryUri, cursor);
+ Log.d(this, "==> Got mCallerInfo: " + callerInfo);
CallerInfo newCallerInfo =
- CallerInfo.doSecondaryLookupIfNecessary(mQueryContext, cw.number, mCallerInfo);
- if (newCallerInfo != mCallerInfo) {
- mCallerInfo = newCallerInfo;
- Log.d(this, "#####async contact look up with numeric username" + mCallerInfo);
+ CallerInfo.doSecondaryLookupIfNecessary(queryContext, cw.number, callerInfo);
+ if (newCallerInfo != callerInfo) {
+ callerInfo = newCallerInfo;
+ Log.d(this, "#####async contact look up with numeric username" + callerInfo);
}
- mCallerInfo.countryIso = cw.countryIso;
+ callerInfo.countryIso = cw.countryIso;
// Final step: look up the geocoded description.
if (ENABLE_UNKNOWN_NUMBER_GEO_DESCRIPTION) {
@@ -514,25 +514,25 @@ public class CallerInfoAsyncQuery {
// new parameter to CallerInfoAsyncQuery.startQuery() to force
// the geoDescription field to be populated.)
- if (TextUtils.isEmpty(mCallerInfo.name)) {
+ if (TextUtils.isEmpty(callerInfo.name)) {
// Actually when no contacts match the incoming phone number,
// the CallerInfo object is totally blank here (i.e. no name
// *or* phoneNumber). So we need to pass in cw.number as
// a fallback number.
- mCallerInfo.updateGeoDescription(mQueryContext, cw.number);
+ callerInfo.updateGeoDescription(queryContext, cw.number);
}
}
// Use the number entered by the user for display.
if (!TextUtils.isEmpty(cw.number)) {
- mCallerInfo.phoneNumber = cw.number;
+ callerInfo.phoneNumber = cw.number;
}
}
Log.d(this, "constructing CallerInfo object for token: " + token);
if (cw.listener != null) {
- cw.listener.onDataLoaded(token, cw.cookie, mCallerInfo);
+ cw.listener.onDataLoaded(token, cw.cookie, callerInfo);
}
}
@@ -598,14 +598,14 @@ public class CallerInfoAsyncQuery {
switch (cw.event) {
case EVENT_NEW_QUERY:
- final ContentResolver resolver = mQueryContext.getContentResolver();
+ final ContentResolver resolver = queryContext.getContentResolver();
// This should never happen.
if (resolver == null) {
Log.e(this, "Content Resolver is null!");
return;
}
- //start the sql command.
+ // start the sql command.
Cursor cursor;
try {
cursor =
diff --git a/java/com/android/incallui/ConferenceManagerFragment.java b/java/com/android/incallui/ConferenceManagerFragment.java
index bd6cb850b..20625c43d 100644
--- a/java/com/android/incallui/ConferenceManagerFragment.java
+++ b/java/com/android/incallui/ConferenceManagerFragment.java
@@ -35,9 +35,9 @@ public class ConferenceManagerFragment
extends BaseFragment<ConferenceManagerPresenter, ConferenceManagerUi>
implements ConferenceManagerPresenter.ConferenceManagerUi {
- private ListView mConferenceParticipantList;
- private ContactPhotoManager mContactPhotoManager;
- private ConferenceParticipantListAdapter mConferenceParticipantListAdapter;
+ private ListView conferenceParticipantList;
+ private ContactPhotoManager contactPhotoManager;
+ private ConferenceParticipantListAdapter conferenceParticipantListAdapter;
@Override
public ConferenceManagerPresenter createPresenter() {
@@ -62,8 +62,8 @@ public class ConferenceManagerFragment
LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View parent = inflater.inflate(R.layout.conference_manager_fragment, container, false);
- mConferenceParticipantList = (ListView) parent.findViewById(R.id.participantList);
- mContactPhotoManager = ContactPhotoManager.getInstance(getActivity().getApplicationContext());
+ conferenceParticipantList = (ListView) parent.findViewById(R.id.participantList);
+ contactPhotoManager = ContactPhotoManager.getInstance(getActivity().getApplicationContext());
return parent;
}
@@ -75,7 +75,7 @@ public class ConferenceManagerFragment
getPresenter().init(calls);
// Request focus on the list of participants for accessibility purposes. This ensures
// that once the list of participants is shown, the first participant is announced.
- mConferenceParticipantList.requestFocus();
+ conferenceParticipantList.requestFocus();
}
@Override
@@ -90,17 +90,17 @@ public class ConferenceManagerFragment
@Override
public void update(List<DialerCall> participants, boolean parentCanSeparate) {
- if (mConferenceParticipantListAdapter == null) {
- mConferenceParticipantListAdapter =
- new ConferenceParticipantListAdapter(mConferenceParticipantList, mContactPhotoManager);
+ if (conferenceParticipantListAdapter == null) {
+ conferenceParticipantListAdapter =
+ new ConferenceParticipantListAdapter(conferenceParticipantList, contactPhotoManager);
- mConferenceParticipantList.setAdapter(mConferenceParticipantListAdapter);
+ conferenceParticipantList.setAdapter(conferenceParticipantListAdapter);
}
- mConferenceParticipantListAdapter.updateParticipants(participants, parentCanSeparate);
+ conferenceParticipantListAdapter.updateParticipants(participants, parentCanSeparate);
}
@Override
public void refreshCall(DialerCall call) {
- mConferenceParticipantListAdapter.refreshCall(call);
+ conferenceParticipantListAdapter.refreshCall(call);
}
}
diff --git a/java/com/android/incallui/ConferenceParticipantListAdapter.java b/java/com/android/incallui/ConferenceParticipantListAdapter.java
index 66b6a97c1..d4579b1ed 100644
--- a/java/com/android/incallui/ConferenceParticipantListAdapter.java
+++ b/java/com/android/incallui/ConferenceParticipantListAdapter.java
@@ -55,15 +55,15 @@ import java.util.Set;
public class ConferenceParticipantListAdapter extends BaseAdapter {
/** The ListView containing the participant information. */
- private final ListView mListView;
+ private final ListView listView;
/** Hashmap to make accessing participant info by call Id faster. */
- private final Map<String, ParticipantInfo> mParticipantsByCallId = new ArrayMap<>();
+ private final Map<String, ParticipantInfo> participantsByCallId = new ArrayMap<>();
/** ContactsPreferences used to lookup displayName preferences */
- @Nullable private final ContactsPreferences mContactsPreferences;
+ @Nullable private final ContactsPreferences contactsPreferences;
/** Contact photo manager to retrieve cached contact photo information. */
- private final ContactPhotoManager mContactPhotoManager;
+ private final ContactPhotoManager contactPhotoManager;
/** Listener used to handle tap of the "disconnect' button for a participant. */
- private View.OnClickListener mDisconnectListener =
+ private View.OnClickListener disconnectListener =
new View.OnClickListener() {
@Override
public void onClick(View view) {
@@ -76,7 +76,7 @@ public class ConferenceParticipantListAdapter extends BaseAdapter {
}
};
/** Listener used to handle tap of the "separate' button for a participant. */
- private View.OnClickListener mSeparateListener =
+ private View.OnClickListener separateListener =
new View.OnClickListener() {
@Override
public void onClick(View view) {
@@ -88,9 +88,9 @@ public class ConferenceParticipantListAdapter extends BaseAdapter {
}
};
/** The conference participants to show in the ListView. */
- private List<ParticipantInfo> mConferenceParticipants = new ArrayList<>();
+ private List<ParticipantInfo> conferenceParticipants = new ArrayList<>();
/** {@code True} if the conference parent supports separating calls from the conference. */
- private boolean mParentCanSeparate;
+ private boolean parentCanSeparate;
/**
* Creates an instance of the ConferenceParticipantListAdapter.
@@ -101,9 +101,9 @@ public class ConferenceParticipantListAdapter extends BaseAdapter {
public ConferenceParticipantListAdapter(
ListView listView, ContactPhotoManager contactPhotoManager) {
- mListView = listView;
- mContactsPreferences = ContactsPreferencesFactory.newContactsPreferences(getContext());
- mContactPhotoManager = contactPhotoManager;
+ this.listView = listView;
+ contactsPreferences = ContactsPreferencesFactory.newContactsPreferences(getContext());
+ this.contactPhotoManager = contactPhotoManager;
}
/**
@@ -115,11 +115,11 @@ public class ConferenceParticipantListAdapter extends BaseAdapter {
*/
public void updateParticipants(
List<DialerCall> conferenceParticipants, boolean parentCanSeparate) {
- if (mContactsPreferences != null) {
- mContactsPreferences.refreshValue(ContactsPreferences.DISPLAY_ORDER_KEY);
- mContactsPreferences.refreshValue(ContactsPreferences.SORT_ORDER_KEY);
+ if (contactsPreferences != null) {
+ contactsPreferences.refreshValue(ContactsPreferences.DISPLAY_ORDER_KEY);
+ contactsPreferences.refreshValue(ContactsPreferences.SORT_ORDER_KEY);
}
- mParentCanSeparate = parentCanSeparate;
+ this.parentCanSeparate = parentCanSeparate;
updateParticipantInfo(conferenceParticipants);
}
@@ -130,7 +130,7 @@ public class ConferenceParticipantListAdapter extends BaseAdapter {
*/
@Override
public int getCount() {
- return mConferenceParticipants.size();
+ return conferenceParticipants.size();
}
/**
@@ -141,7 +141,7 @@ public class ConferenceParticipantListAdapter extends BaseAdapter {
*/
@Override
public Object getItem(int position) {
- return mConferenceParticipants.get(position);
+ return conferenceParticipants.get(position);
}
/**
@@ -163,15 +163,15 @@ public class ConferenceParticipantListAdapter extends BaseAdapter {
public void refreshCall(DialerCall call) {
String callId = call.getId();
- if (mParticipantsByCallId.containsKey(callId)) {
- ParticipantInfo participantInfo = mParticipantsByCallId.get(callId);
+ if (participantsByCallId.containsKey(callId)) {
+ ParticipantInfo participantInfo = participantsByCallId.get(callId);
participantInfo.setCall(call);
refreshView(callId);
}
}
private Context getContext() {
- return mListView.getContext();
+ return listView.getContext();
}
/**
@@ -181,14 +181,14 @@ public class ConferenceParticipantListAdapter extends BaseAdapter {
* @param callId The call id.
*/
private void refreshView(String callId) {
- int first = mListView.getFirstVisiblePosition();
- int last = mListView.getLastVisiblePosition();
+ int first = listView.getFirstVisiblePosition();
+ int last = listView.getLastVisiblePosition();
for (int position = 0; position <= last - first; position++) {
- View view = mListView.getChildAt(position);
+ View view = listView.getChildAt(position);
String rowCallId = (String) view.getTag();
if (rowCallId.equals(callId)) {
- getView(position + first, view, mListView);
+ getView(position + first, view, listView);
break;
}
}
@@ -212,7 +212,7 @@ public class ConferenceParticipantListAdapter extends BaseAdapter {
.inflate(R.layout.caller_in_conference, parent, false)
: convertView;
- ParticipantInfo participantInfo = mConferenceParticipants.get(position);
+ ParticipantInfo participantInfo = conferenceParticipants.get(position);
DialerCall call = participantInfo.getCall();
ContactCacheEntry contactCache = participantInfo.getContactCacheEntry();
@@ -228,14 +228,14 @@ public class ConferenceParticipantListAdapter extends BaseAdapter {
}
boolean thisRowCanSeparate =
- mParentCanSeparate
+ parentCanSeparate
&& call.can(android.telecom.Call.Details.CAPABILITY_SEPARATE_FROM_CONFERENCE);
boolean thisRowCanDisconnect =
call.can(android.telecom.Call.Details.CAPABILITY_DISCONNECT_FROM_CONFERENCE);
String name =
ContactDisplayUtils.getPreferredDisplayName(
- contactCache.namePrimary, contactCache.nameAlternative, mContactsPreferences);
+ contactCache.namePrimary, contactCache.nameAlternative, contactsPreferences);
setCallerInfoForRow(
result,
@@ -262,8 +262,8 @@ public class ConferenceParticipantListAdapter extends BaseAdapter {
* @param entry The new contact info.
*/
/* package */ void updateContactInfo(String callId, ContactCacheEntry entry) {
- if (mParticipantsByCallId.containsKey(callId)) {
- ParticipantInfo participantInfo = mParticipantsByCallId.get(callId);
+ if (participantsByCallId.containsKey(callId)) {
+ ParticipantInfo participantInfo = participantsByCallId.get(callId);
participantInfo.setContactCacheEntry(entry);
participantInfo.setCacheLookupComplete(true);
refreshView(callId);
@@ -307,14 +307,14 @@ public class ConferenceParticipantListAdapter extends BaseAdapter {
endButton.setVisibility(thisRowCanDisconnect ? View.VISIBLE : View.GONE);
if (thisRowCanDisconnect) {
- endButton.setOnClickListener(mDisconnectListener);
+ endButton.setOnClickListener(disconnectListener);
} else {
endButton.setOnClickListener(null);
}
separateButton.setVisibility(thisRowCanSeparate ? View.VISIBLE : View.GONE);
if (thisRowCanSeparate) {
- separateButton.setOnClickListener(mSeparateListener);
+ separateButton.setOnClickListener(separateListener);
} else {
separateButton.setOnClickListener(null);
}
@@ -325,7 +325,7 @@ public class ConferenceParticipantListAdapter extends BaseAdapter {
? null
: new DefaultImageRequest(displayNameForImage, lookupKey, true /* isCircularPhoto */);
- mContactPhotoManager.loadDirectoryPhoto(photoView, photoUri, false, true, imageRequest);
+ contactPhotoManager.loadDirectoryPhoto(photoView, photoUri, false, true, imageRequest);
// set the caller name
if (TextUtils.isEmpty(preferredName)) {
@@ -404,26 +404,26 @@ public class ConferenceParticipantListAdapter extends BaseAdapter {
getContext(), call, call.getState() == DialerCall.State.INCOMING);
}
- if (mParticipantsByCallId.containsKey(callId)) {
- ParticipantInfo participantInfo = mParticipantsByCallId.get(callId);
+ if (participantsByCallId.containsKey(callId)) {
+ ParticipantInfo participantInfo = participantsByCallId.get(callId);
participantInfo.setCall(call);
participantInfo.setContactCacheEntry(contactCache);
} else {
newParticipantAdded = true;
ParticipantInfo participantInfo = new ParticipantInfo(call, contactCache);
- mConferenceParticipants.add(participantInfo);
- mParticipantsByCallId.put(call.getId(), participantInfo);
+ this.conferenceParticipants.add(participantInfo);
+ participantsByCallId.put(call.getId(), participantInfo);
}
}
// Remove any participants that no longer exist.
- Iterator<Map.Entry<String, ParticipantInfo>> it = mParticipantsByCallId.entrySet().iterator();
+ Iterator<Map.Entry<String, ParticipantInfo>> it = participantsByCallId.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, ParticipantInfo> entry = it.next();
String existingCallId = entry.getKey();
if (!newCallIds.contains(existingCallId)) {
ParticipantInfo existingInfo = entry.getValue();
- mConferenceParticipants.remove(existingInfo);
+ this.conferenceParticipants.remove(existingInfo);
it.remove();
}
}
@@ -438,7 +438,7 @@ public class ConferenceParticipantListAdapter extends BaseAdapter {
/** Sorts the participant list by contact name. */
private void sortParticipantList() {
Collections.sort(
- mConferenceParticipants,
+ conferenceParticipants,
new Comparator<ParticipantInfo>() {
@Override
public int compare(ParticipantInfo p1, ParticipantInfo p2) {
@@ -446,13 +446,13 @@ public class ConferenceParticipantListAdapter extends BaseAdapter {
ContactCacheEntry c1 = p1.getContactCacheEntry();
String p1Name =
ContactDisplayUtils.getPreferredSortName(
- c1.namePrimary, c1.nameAlternative, mContactsPreferences);
+ c1.namePrimary, c1.nameAlternative, contactsPreferences);
p1Name = p1Name != null ? p1Name : "";
ContactCacheEntry c2 = p2.getContactCacheEntry();
String p2Name =
ContactDisplayUtils.getPreferredSortName(
- c2.namePrimary, c2.nameAlternative, mContactsPreferences);
+ c2.namePrimary, c2.nameAlternative, contactsPreferences);
p2Name = p2Name != null ? p2Name : "";
return p1Name.compareToIgnoreCase(p2Name);
@@ -472,10 +472,10 @@ public class ConferenceParticipantListAdapter extends BaseAdapter {
*/
public static class ContactLookupCallback implements ContactInfoCache.ContactInfoCacheCallback {
- private final WeakReference<ConferenceParticipantListAdapter> mListAdapter;
+ private final WeakReference<ConferenceParticipantListAdapter> listAdapter;
public ContactLookupCallback(ConferenceParticipantListAdapter listAdapter) {
- mListAdapter = new WeakReference<>(listAdapter);
+ this.listAdapter = new WeakReference<>(listAdapter);
}
/**
@@ -507,7 +507,7 @@ public class ConferenceParticipantListAdapter extends BaseAdapter {
* @param entry The new contact information.
*/
private void update(String callId, ContactCacheEntry entry) {
- ConferenceParticipantListAdapter listAdapter = mListAdapter.get();
+ ConferenceParticipantListAdapter listAdapter = this.listAdapter.get();
if (listAdapter != null) {
listAdapter.updateContactInfo(callId, entry);
}
@@ -520,51 +520,51 @@ public class ConferenceParticipantListAdapter extends BaseAdapter {
*/
private static class ParticipantInfo {
- private DialerCall mCall;
- private ContactCacheEntry mContactCacheEntry;
- private boolean mCacheLookupComplete = false;
+ private DialerCall call;
+ private ContactCacheEntry contactCacheEntry;
+ private boolean cacheLookupComplete = false;
public ParticipantInfo(DialerCall call, ContactCacheEntry contactCacheEntry) {
- mCall = call;
- mContactCacheEntry = contactCacheEntry;
+ this.call = call;
+ this.contactCacheEntry = contactCacheEntry;
}
public DialerCall getCall() {
- return mCall;
+ return call;
}
public void setCall(DialerCall call) {
- mCall = call;
+ this.call = call;
}
public ContactCacheEntry getContactCacheEntry() {
- return mContactCacheEntry;
+ return contactCacheEntry;
}
public void setContactCacheEntry(ContactCacheEntry entry) {
- mContactCacheEntry = entry;
+ contactCacheEntry = entry;
}
public boolean isCacheLookupComplete() {
- return mCacheLookupComplete;
+ return cacheLookupComplete;
}
public void setCacheLookupComplete(boolean cacheLookupComplete) {
- mCacheLookupComplete = cacheLookupComplete;
+ this.cacheLookupComplete = cacheLookupComplete;
}
@Override
public boolean equals(Object o) {
if (o instanceof ParticipantInfo) {
ParticipantInfo p = (ParticipantInfo) o;
- return Objects.equals(p.getCall().getId(), mCall.getId());
+ return Objects.equals(p.getCall().getId(), call.getId());
}
return false;
}
@Override
public int hashCode() {
- return mCall.getId().hashCode();
+ return call.getId().hashCode();
}
}
}
diff --git a/java/com/android/incallui/ContactInfoCache.java b/java/com/android/incallui/ContactInfoCache.java
index 67a294f97..fbee743c6 100644
--- a/java/com/android/incallui/ContactInfoCache.java
+++ b/java/com/android/incallui/ContactInfoCache.java
@@ -78,14 +78,14 @@ public class ContactInfoCache implements OnImageLoadCompleteListener {
private static final String TAG = ContactInfoCache.class.getSimpleName();
private static final int TOKEN_UPDATE_PHOTO_FOR_CALL_STATE = 0;
- private static ContactInfoCache sCache = null;
- private final Context mContext;
- private final PhoneNumberService mPhoneNumberService;
+ private static ContactInfoCache cache = null;
+ private final Context context;
+ private final PhoneNumberService phoneNumberService;
// Cache info map needs to be thread-safe since it could be modified by both main thread and
// worker thread.
- private final ConcurrentHashMap<String, ContactCacheEntry> mInfoMap = new ConcurrentHashMap<>();
- private final Map<String, Set<ContactInfoCacheCallback>> mCallBacks = new ArrayMap<>();
- private int mQueryId;
+ private final ConcurrentHashMap<String, ContactCacheEntry> infoMap = new ConcurrentHashMap<>();
+ private final Map<String, Set<ContactInfoCacheCallback>> callBacks = new ArrayMap<>();
+ private int queryId;
private final DialerExecutor<CnapInformationWrapper> cachedNumberLookupExecutor;
private static class CachedNumberLookupWorker implements Worker<CnapInformationWrapper, Void> {
@@ -123,10 +123,10 @@ public class ContactInfoCache implements OnImageLoadCompleteListener {
private ContactInfoCache(Context context) {
Trace.beginSection("ContactInfoCache constructor");
- mContext = context;
- mPhoneNumberService = Bindings.get(context).newPhoneNumberService(context);
+ this.context = context;
+ phoneNumberService = Bindings.get(context).newPhoneNumberService(context);
cachedNumberLookupExecutor =
- DialerExecutorComponent.get(mContext)
+ DialerExecutorComponent.get(this.context)
.dialerExecutorFactory()
.createNonUiTaskBuilder(new CachedNumberLookupWorker())
.build();
@@ -134,10 +134,10 @@ public class ContactInfoCache implements OnImageLoadCompleteListener {
}
public static synchronized ContactInfoCache getInstance(Context mContext) {
- if (sCache == null) {
- sCache = new ContactInfoCache(mContext.getApplicationContext());
+ if (cache == null) {
+ cache = new ContactInfoCache(mContext.getApplicationContext());
}
- return sCache;
+ return cache;
}
static ContactCacheEntry buildCacheEntryFromCall(
@@ -300,7 +300,7 @@ public class ContactInfoCache implements OnImageLoadCompleteListener {
}
ContactCacheEntry getInfo(String callId) {
- return mInfoMap.get(callId);
+ return infoMap.get(callId);
}
private static final class CnapInformationWrapper {
@@ -328,7 +328,7 @@ public class ContactInfoCache implements OnImageLoadCompleteListener {
}
if (cachedNumberLookupService == null
|| TextUtils.isEmpty(info.cnapName)
- || mInfoMap.get(call.getId()) != null) {
+ || infoMap.get(call.getId()) != null) {
return;
}
Log.i(TAG, "Found contact with CNAP name - inserting into cache");
@@ -355,8 +355,8 @@ public class ContactInfoCache implements OnImageLoadCompleteListener {
Trace.beginSection("prepare callback");
final String callId = call.getId();
- final ContactCacheEntry cacheEntry = mInfoMap.get(callId);
- Set<ContactInfoCacheCallback> callBacks = mCallBacks.get(callId);
+ final ContactCacheEntry cacheEntry = infoMap.get(callId);
+ Set<ContactInfoCacheCallback> callBacks = this.callBacks.get(callId);
// We need to force a new query if phone number has changed.
boolean forceQuery = needForceQuery(call, cacheEntry);
@@ -392,7 +392,7 @@ public class ContactInfoCache implements OnImageLoadCompleteListener {
// New lookup
callBacks = new ArraySet<>();
callBacks.add(callback);
- mCallBacks.put(callId, callBacks);
+ this.callBacks.put(callId, callBacks);
}
Trace.beginSection("prepare query");
@@ -402,11 +402,11 @@ public class ContactInfoCache implements OnImageLoadCompleteListener {
* such as those for voicemail and emergency call information, will not perform an additional
* asynchronous query.
*/
- final CallerInfoQueryToken queryToken = new CallerInfoQueryToken(mQueryId, callId);
- mQueryId++;
+ final CallerInfoQueryToken queryToken = new CallerInfoQueryToken(queryId, callId);
+ queryId++;
final CallerInfo callerInfo =
CallerInfoUtils.getCallerInfoForCall(
- mContext,
+ context,
call,
new DialerCallCookieWrapper(callId, call.getNumberPresentation(), call.getCnapName()),
new FindInfoCallback(isIncoming, queryToken));
@@ -417,7 +417,7 @@ public class ContactInfoCache implements OnImageLoadCompleteListener {
// back. We should only update the queryId. Otherwise, we may see
// flicker of the name and image (old cache -> new cache before query
// -> new cache after query)
- cacheEntry.queryId = queryToken.mQueryId;
+ cacheEntry.queryId = queryToken.queryId;
Log.d(TAG, "There is an existing cache. Do not override until new query is back");
} else {
ContactCacheEntry initialCacheEntry =
@@ -441,20 +441,20 @@ public class ContactInfoCache implements OnImageLoadCompleteListener {
"updateCallerInfoInCacheOnAnyThread: callId = "
+ callId
+ "; queryId = "
- + queryToken.mQueryId
+ + queryToken.queryId
+ "; didLocalLookup = "
+ didLocalLookup);
- ContactCacheEntry existingCacheEntry = mInfoMap.get(callId);
+ ContactCacheEntry existingCacheEntry = infoMap.get(callId);
Log.d(TAG, "Existing cacheEntry in hashMap " + existingCacheEntry);
// Mark it as emergency/voicemail if the cache exists and was emergency/voicemail before the
// number changed.
if (existingCacheEntry != null) {
if (existingCacheEntry.isEmergencyNumber) {
- callerInfo.markAsEmergency(mContext);
+ callerInfo.markAsEmergency(context);
} else if (existingCacheEntry.isVoicemailNumber) {
- callerInfo.markAsVoiceMail(mContext);
+ callerInfo.markAsVoiceMail(context);
}
}
@@ -466,8 +466,8 @@ public class ContactInfoCache implements OnImageLoadCompleteListener {
}
// We always replace the entry. The only exception is the same photo case.
- ContactCacheEntry cacheEntry = buildEntry(mContext, callerInfo, presentationMode);
- cacheEntry.queryId = queryToken.mQueryId;
+ ContactCacheEntry cacheEntry = buildEntry(context, callerInfo, presentationMode);
+ cacheEntry.queryId = queryToken.queryId;
if (didLocalLookup) {
if (cacheEntry.displayPhotoUri != null) {
@@ -491,17 +491,17 @@ public class ContactInfoCache implements OnImageLoadCompleteListener {
cacheEntry.hasPendingQuery = true;
ContactsAsyncHelper.startObtainPhotoAsync(
TOKEN_UPDATE_PHOTO_FOR_CALL_STATE,
- mContext,
+ context,
cacheEntry.displayPhotoUri,
ContactInfoCache.this,
queryToken);
}
Log.d(TAG, "put entry into map: " + cacheEntry);
- mInfoMap.put(callId, cacheEntry);
+ infoMap.put(callId, cacheEntry);
} else {
// Don't overwrite if there is existing cache.
Log.d(TAG, "put entry into map if not exists: " + cacheEntry);
- mInfoMap.putIfAbsent(callId, cacheEntry);
+ infoMap.putIfAbsent(callId, cacheEntry);
}
Trace.endSection();
return cacheEntry;
@@ -509,7 +509,7 @@ public class ContactInfoCache implements OnImageLoadCompleteListener {
private void maybeUpdateFromCequintCallerId(
CallerInfo callerInfo, String cnapName, boolean isIncoming) {
- if (!CequintCallerIdManager.isCequintCallerIdEnabled(mContext)) {
+ if (!CequintCallerIdManager.isCequintCallerIdEnabled(context)) {
return;
}
if (callerInfo.phoneNumber == null) {
@@ -517,7 +517,7 @@ public class ContactInfoCache implements OnImageLoadCompleteListener {
}
CequintCallerIdContact cequintCallerIdContact =
CequintCallerIdManager.getCequintCallerIdContactForInCall(
- mContext, callerInfo.phoneNumber, cnapName, isIncoming);
+ context, callerInfo.phoneNumber, cnapName, isIncoming);
if (cequintCallerIdContact == null) {
return;
@@ -553,8 +553,8 @@ public class ContactInfoCache implements OnImageLoadCompleteListener {
public void onImageLoaded(int token, Drawable photo, Bitmap photoIcon, Object cookie) {
Assert.isWorkerThread();
CallerInfoQueryToken myCookie = (CallerInfoQueryToken) cookie;
- final String callId = myCookie.mCallId;
- final int queryId = myCookie.mQueryId;
+ final String callId = myCookie.callId;
+ final int queryId = myCookie.queryId;
if (!isWaitingForThisQuery(callId, queryId)) {
return;
}
@@ -562,12 +562,12 @@ public class ContactInfoCache implements OnImageLoadCompleteListener {
}
private void loadImage(Drawable photo, Bitmap photoIcon, Object cookie) {
- Log.d(TAG, "Image load complete with context: ", mContext);
+ Log.d(TAG, "Image load complete with context: ", context);
// TODO: may be nice to update the image view again once the newer one
// is available on contacts database.
CallerInfoQueryToken myCookie = (CallerInfoQueryToken) cookie;
- final String callId = myCookie.mCallId;
- ContactCacheEntry entry = mInfoMap.get(callId);
+ final String callId = myCookie.callId;
+ ContactCacheEntry entry = infoMap.get(callId);
if (entry == null) {
Log.e(TAG, "Image Load received for empty search entry.");
@@ -584,7 +584,7 @@ public class ContactInfoCache implements OnImageLoadCompleteListener {
entry.photoType = ContactPhotoType.CONTACT;
} else if (photoIcon != null) {
Log.v(TAG, "photo icon: ", photoIcon);
- entry.photo = new BitmapDrawable(mContext.getResources(), photoIcon);
+ entry.photo = new BitmapDrawable(context.getResources(), photoIcon);
entry.photoType = ContactPhotoType.CONTACT;
} else {
Log.v(TAG, "unknown photo");
@@ -602,21 +602,21 @@ public class ContactInfoCache implements OnImageLoadCompleteListener {
public void onImageLoadComplete(int token, Drawable photo, Bitmap photoIcon, Object cookie) {
Assert.isMainThread();
CallerInfoQueryToken myCookie = (CallerInfoQueryToken) cookie;
- final String callId = myCookie.mCallId;
- final int queryId = myCookie.mQueryId;
+ final String callId = myCookie.callId;
+ final int queryId = myCookie.queryId;
if (!isWaitingForThisQuery(callId, queryId)) {
return;
}
- sendImageNotifications(callId, mInfoMap.get(callId));
+ sendImageNotifications(callId, infoMap.get(callId));
clearCallbacks(callId);
}
/** Blows away the stored cache values. */
public void clearCache() {
- mInfoMap.clear();
- mCallBacks.clear();
- mQueryId = 0;
+ infoMap.clear();
+ callBacks.clear();
+ queryId = 0;
}
private ContactCacheEntry buildEntry(Context context, CallerInfo info, int presentation) {
@@ -662,7 +662,7 @@ public class ContactInfoCache implements OnImageLoadCompleteListener {
private void sendInfoNotifications(String callId, ContactCacheEntry entry) {
Trace.beginSection("ContactInfoCache.sendInfoNotifications");
Assert.isMainThread();
- final Set<ContactInfoCacheCallback> callBacks = mCallBacks.get(callId);
+ final Set<ContactInfoCacheCallback> callBacks = this.callBacks.get(callId);
if (callBacks != null) {
for (ContactInfoCacheCallback callBack : callBacks) {
callBack.onContactInfoComplete(callId, entry);
@@ -675,7 +675,7 @@ public class ContactInfoCache implements OnImageLoadCompleteListener {
private void sendImageNotifications(String callId, ContactCacheEntry entry) {
Trace.beginSection("ContactInfoCache.sendImageNotifications");
Assert.isMainThread();
- final Set<ContactInfoCacheCallback> callBacks = mCallBacks.get(callId);
+ final Set<ContactInfoCacheCallback> callBacks = this.callBacks.get(callId);
if (callBacks != null && entry.photo != null) {
for (ContactInfoCacheCallback callBack : callBacks) {
callBack.onImageLoadComplete(callId, entry);
@@ -685,7 +685,7 @@ public class ContactInfoCache implements OnImageLoadCompleteListener {
}
private void clearCallbacks(String callId) {
- mCallBacks.remove(callId);
+ callBacks.remove(callId);
}
/** Callback interface for the contact query. */
@@ -791,26 +791,26 @@ public class ContactInfoCache implements OnImageLoadCompleteListener {
private class FindInfoCallback implements OnQueryCompleteListener {
- private final boolean mIsIncoming;
- private final CallerInfoQueryToken mQueryToken;
+ private final boolean isIncoming;
+ private final CallerInfoQueryToken queryToken;
FindInfoCallback(boolean isIncoming, CallerInfoQueryToken queryToken) {
- mIsIncoming = isIncoming;
- mQueryToken = queryToken;
+ this.isIncoming = isIncoming;
+ this.queryToken = queryToken;
}
@Override
public void onDataLoaded(int token, Object cookie, CallerInfo ci) {
Assert.isWorkerThread();
DialerCallCookieWrapper cw = (DialerCallCookieWrapper) cookie;
- if (!isWaitingForThisQuery(cw.callId, mQueryToken.mQueryId)) {
+ if (!isWaitingForThisQuery(cw.callId, queryToken.queryId)) {
return;
}
long start = SystemClock.uptimeMillis();
- maybeUpdateFromCequintCallerId(ci, cw.cnapName, mIsIncoming);
+ maybeUpdateFromCequintCallerId(ci, cw.cnapName, isIncoming);
long time = SystemClock.uptimeMillis() - start;
Log.d(TAG, "Cequint Caller Id look up takes " + time + " ms.");
- updateCallerInfoInCacheOnAnyThread(cw.callId, cw.numberPresentation, ci, true, mQueryToken);
+ updateCallerInfoInCacheOnAnyThread(cw.callId, cw.numberPresentation, ci, true, queryToken);
}
@Override
@@ -819,11 +819,11 @@ public class ContactInfoCache implements OnImageLoadCompleteListener {
Assert.isMainThread();
DialerCallCookieWrapper cw = (DialerCallCookieWrapper) cookie;
String callId = cw.callId;
- if (!isWaitingForThisQuery(cw.callId, mQueryToken.mQueryId)) {
+ if (!isWaitingForThisQuery(cw.callId, queryToken.queryId)) {
Trace.endSection();
return;
}
- ContactCacheEntry cacheEntry = mInfoMap.get(callId);
+ ContactCacheEntry cacheEntry = infoMap.get(callId);
// This may happen only when InCallPresenter attempt to cleanup.
if (cacheEntry == null) {
Log.w(TAG, "Contact lookup done, but cache entry is not found.");
@@ -834,12 +834,12 @@ public class ContactInfoCache implements OnImageLoadCompleteListener {
// Before issuing a request for more data from other services, we only check that the
// contact wasn't found in the local DB. We don't check the if the cache entry already
// has a name because we allow overriding cnap data with data from other services.
- if (!callerInfo.contactExists && mPhoneNumberService != null) {
+ if (!callerInfo.contactExists && phoneNumberService != null) {
Log.d(TAG, "Contact lookup. Local contacts miss, checking remote");
final PhoneNumberServiceListener listener =
- new PhoneNumberServiceListener(callId, mQueryToken.mQueryId);
+ new PhoneNumberServiceListener(callId, queryToken.queryId);
cacheEntry.hasPendingQuery = true;
- mPhoneNumberService.getPhoneNumberInfo(cacheEntry.number, listener, listener, mIsIncoming);
+ phoneNumberService.getPhoneNumberInfo(cacheEntry.number, listener, listener, isIncoming);
}
sendInfoNotifications(callId, cacheEntry);
if (!cacheEntry.hasPendingQuery) {
@@ -860,18 +860,18 @@ public class ContactInfoCache implements OnImageLoadCompleteListener {
class PhoneNumberServiceListener
implements PhoneNumberService.NumberLookupListener, PhoneNumberService.ImageLookupListener {
- private final String mCallId;
- private final int mQueryIdOfRemoteLookup;
+ private final String callId;
+ private final int queryIdOfRemoteLookup;
PhoneNumberServiceListener(String callId, int queryId) {
- mCallId = callId;
- mQueryIdOfRemoteLookup = queryId;
+ this.callId = callId;
+ queryIdOfRemoteLookup = queryId;
}
@Override
public void onPhoneNumberInfoComplete(final PhoneNumberService.PhoneNumberInfo info) {
Log.d(TAG, "PhoneNumberServiceListener.onPhoneNumberInfoComplete");
- if (!isWaitingForThisQuery(mCallId, mQueryIdOfRemoteLookup)) {
+ if (!isWaitingForThisQuery(callId, queryIdOfRemoteLookup)) {
return;
}
@@ -879,7 +879,7 @@ public class ContactInfoCache implements OnImageLoadCompleteListener {
// so clear the callbacks and return.
if (info == null) {
Log.d(TAG, "Contact lookup done. Remote contact not found.");
- clearCallbacks(mCallId);
+ clearCallbacks(callId);
return;
}
ContactCacheEntry entry = new ContactCacheEntry();
@@ -892,10 +892,10 @@ public class ContactInfoCache implements OnImageLoadCompleteListener {
if (type == Phone.TYPE_CUSTOM) {
entry.label = label;
} else {
- final CharSequence typeStr = Phone.getTypeLabel(mContext.getResources(), type, label);
+ final CharSequence typeStr = Phone.getTypeLabel(context.getResources(), type, label);
entry.label = typeStr == null ? null : typeStr.toString();
}
- final ContactCacheEntry oldEntry = mInfoMap.get(mCallId);
+ final ContactCacheEntry oldEntry = infoMap.get(callId);
if (oldEntry != null) {
// Location is only obtained from local lookup so persist
// the value for remote lookups. Once we have a name this
@@ -915,25 +915,25 @@ public class ContactInfoCache implements OnImageLoadCompleteListener {
}
Log.d(TAG, "put entry into map: " + entry);
- mInfoMap.put(mCallId, entry);
- sendInfoNotifications(mCallId, entry);
+ infoMap.put(callId, entry);
+ sendInfoNotifications(callId, entry);
entry.hasPendingQuery = info.getImageUrl() != null;
// If there is no image then we should not expect another callback.
if (!entry.hasPendingQuery) {
// We're done, so clear callbacks
- clearCallbacks(mCallId);
+ clearCallbacks(callId);
}
}
@Override
public void onImageFetchComplete(Bitmap bitmap) {
Log.d(TAG, "PhoneNumberServiceListener.onImageFetchComplete");
- if (!isWaitingForThisQuery(mCallId, mQueryIdOfRemoteLookup)) {
+ if (!isWaitingForThisQuery(callId, queryIdOfRemoteLookup)) {
return;
}
- CallerInfoQueryToken queryToken = new CallerInfoQueryToken(mQueryIdOfRemoteLookup, mCallId);
+ CallerInfoQueryToken queryToken = new CallerInfoQueryToken(queryIdOfRemoteLookup, callId);
loadImage(null, bitmap, queryToken);
onImageLoadComplete(TOKEN_UPDATE_PHOTO_FOR_CALL_STATE, null, bitmap, queryToken);
}
@@ -961,18 +961,18 @@ public class ContactInfoCache implements OnImageLoadCompleteListener {
}
private static final class CallerInfoQueryToken {
- final int mQueryId;
- final String mCallId;
+ final int queryId;
+ final String callId;
CallerInfoQueryToken(int queryId, String callId) {
- mQueryId = queryId;
- mCallId = callId;
+ this.queryId = queryId;
+ this.callId = callId;
}
}
/** Check if the queryId in the cached map is the same as the one from query result. */
private boolean isWaitingForThisQuery(String callId, int queryId) {
- final ContactCacheEntry existingCacheEntry = mInfoMap.get(callId);
+ final ContactCacheEntry existingCacheEntry = infoMap.get(callId);
if (existingCacheEntry == null) {
// This might happen if lookup on background thread comes back before the initial entry is
// created.
diff --git a/java/com/android/incallui/ContactsPreferencesFactory.java b/java/com/android/incallui/ContactsPreferencesFactory.java
index 429de7bc9..a9a210963 100644
--- a/java/com/android/incallui/ContactsPreferencesFactory.java
+++ b/java/com/android/incallui/ContactsPreferencesFactory.java
@@ -24,8 +24,8 @@ import com.android.contacts.common.preference.ContactsPreferences;
/** Factory class for {@link ContactsPreferences}. */
public class ContactsPreferencesFactory {
- private static boolean sUseTestInstance;
- private static ContactsPreferences sTestInstance;
+ private static boolean useTestInstance;
+ private static ContactsPreferences testInstance;
/**
* Creates a new {@link ContactsPreferences} object if possible.
@@ -35,8 +35,8 @@ public class ContactsPreferencesFactory {
*/
@Nullable
public static ContactsPreferences newContactsPreferences(Context context) {
- if (sUseTestInstance) {
- return sTestInstance;
+ if (useTestInstance) {
+ return testInstance;
}
if (UserManagerCompat.isUserUnlocked(context)) {
return new ContactsPreferences(context);
@@ -50,7 +50,7 @@ public class ContactsPreferencesFactory {
* @param testInstance the instance to return.
*/
static void setTestInstance(ContactsPreferences testInstance) {
- sUseTestInstance = true;
- sTestInstance = testInstance;
+ useTestInstance = true;
+ ContactsPreferencesFactory.testInstance = testInstance;
}
}
diff --git a/java/com/android/incallui/DialpadFragment.java b/java/com/android/incallui/DialpadFragment.java
index b2aacf71d..c5b9d785f 100644
--- a/java/com/android/incallui/DialpadFragment.java
+++ b/java/com/android/incallui/DialpadFragment.java
@@ -45,26 +45,26 @@ public class DialpadFragment extends BaseFragment<DialpadPresenter, DialpadUi>
implements DialpadUi, OnKeyListener, OnClickListener, OnPressedListener {
/** Hash Map to map a view id to a character */
- private static final Map<Integer, Character> mDisplayMap = new ArrayMap<>();
+ private static final Map<Integer, Character> displayMap = new ArrayMap<>();
/** Set up the static maps */
static {
// Map the buttons to the display characters
- mDisplayMap.put(R.id.one, '1');
- mDisplayMap.put(R.id.two, '2');
- mDisplayMap.put(R.id.three, '3');
- mDisplayMap.put(R.id.four, '4');
- mDisplayMap.put(R.id.five, '5');
- mDisplayMap.put(R.id.six, '6');
- mDisplayMap.put(R.id.seven, '7');
- mDisplayMap.put(R.id.eight, '8');
- mDisplayMap.put(R.id.nine, '9');
- mDisplayMap.put(R.id.zero, '0');
- mDisplayMap.put(R.id.pound, '#');
- mDisplayMap.put(R.id.star, '*');
+ displayMap.put(R.id.one, '1');
+ displayMap.put(R.id.two, '2');
+ displayMap.put(R.id.three, '3');
+ displayMap.put(R.id.four, '4');
+ displayMap.put(R.id.five, '5');
+ displayMap.put(R.id.six, '6');
+ displayMap.put(R.id.seven, '7');
+ displayMap.put(R.id.eight, '8');
+ displayMap.put(R.id.nine, '9');
+ displayMap.put(R.id.zero, '0');
+ displayMap.put(R.id.pound, '#');
+ displayMap.put(R.id.star, '*');
}
- private final int[] mButtonIds =
+ private final int[] buttonIds =
new int[] {
R.id.zero,
R.id.one,
@@ -79,11 +79,11 @@ public class DialpadFragment extends BaseFragment<DialpadPresenter, DialpadUi>
R.id.star,
R.id.pound
};
- private EditText mDtmfDialerField;
+ private EditText dtmfDialerField;
// KeyListener used with the "dialpad digits" EditText widget.
- private DtmfKeyListener mDtmfKeyListener;
- private DialpadView mDialpadView;
- private int mCurrentTextColor;
+ private DtmfKeyListener dtmfKeyListener;
+ private DialpadView dialpadView;
+ private int currentTextColor;
@Override
public void onClick(View v) {
@@ -100,11 +100,11 @@ public class DialpadFragment extends BaseFragment<DialpadPresenter, DialpadUi>
if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER || keyCode == KeyEvent.KEYCODE_ENTER) {
int viewId = v.getId();
- if (mDisplayMap.containsKey(viewId)) {
+ if (displayMap.containsKey(viewId)) {
switch (event.getAction()) {
case KeyEvent.ACTION_DOWN:
if (event.getRepeatCount() == 0) {
- getPresenter().processDtmf(mDisplayMap.get(viewId));
+ getPresenter().processDtmf(displayMap.get(viewId));
}
break;
case KeyEvent.ACTION_UP:
@@ -135,21 +135,21 @@ public class DialpadFragment extends BaseFragment<DialpadPresenter, DialpadUi>
public View onCreateView(
LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View parent = inflater.inflate(R.layout.incall_dialpad_fragment, container, false);
- mDialpadView = (DialpadView) parent.findViewById(R.id.dialpad_view);
- mDialpadView.setCanDigitsBeEdited(false);
- mDialpadView.setBackgroundResource(R.color.incall_dialpad_background);
- mDtmfDialerField = (EditText) parent.findViewById(R.id.digits);
- if (mDtmfDialerField != null) {
+ dialpadView = (DialpadView) parent.findViewById(R.id.dialpad_view);
+ dialpadView.setCanDigitsBeEdited(false);
+ dialpadView.setBackgroundResource(R.color.incall_dialpad_background);
+ dtmfDialerField = (EditText) parent.findViewById(R.id.digits);
+ if (dtmfDialerField != null) {
LogUtil.i("DialpadFragment.onCreateView", "creating dtmfKeyListener");
- mDtmfKeyListener = new DtmfKeyListener(getPresenter());
- mDtmfDialerField.setKeyListener(mDtmfKeyListener);
+ dtmfKeyListener = new DtmfKeyListener(getPresenter());
+ dtmfDialerField.setKeyListener(dtmfKeyListener);
// remove the long-press context menus that support
// the edit (copy / paste / select) functions.
- mDtmfDialerField.setLongClickable(false);
- mDtmfDialerField.setElegantTextHeight(false);
+ dtmfDialerField.setLongClickable(false);
+ dtmfDialerField.setElegantTextHeight(false);
configureKeypadListeners();
}
- View backButton = mDialpadView.findViewById(R.id.dialpad_back);
+ View backButton = dialpadView.findViewById(R.id.dialpad_back);
backButton.setVisibility(View.VISIBLE);
backButton.setOnClickListener(this);
@@ -165,22 +165,22 @@ public class DialpadFragment extends BaseFragment<DialpadPresenter, DialpadUi>
public void updateColors() {
int textColor = InCallPresenter.getInstance().getThemeColorManager().getPrimaryColor();
- if (mCurrentTextColor == textColor) {
+ if (currentTextColor == textColor) {
return;
}
DialpadKeyButton dialpadKey;
- for (int i = 0; i < mButtonIds.length; i++) {
- dialpadKey = (DialpadKeyButton) mDialpadView.findViewById(mButtonIds[i]);
+ for (int i = 0; i < buttonIds.length; i++) {
+ dialpadKey = (DialpadKeyButton) dialpadView.findViewById(buttonIds[i]);
((TextView) dialpadKey.findViewById(R.id.dialpad_key_number)).setTextColor(textColor);
}
- mCurrentTextColor = textColor;
+ currentTextColor = textColor;
}
@Override
public void onDestroyView() {
- mDtmfKeyListener = null;
+ dtmfKeyListener = null;
super.onDestroyView();
}
@@ -190,7 +190,7 @@ public class DialpadFragment extends BaseFragment<DialpadPresenter, DialpadUi>
* @return String containing current Dialpad EditText text.
*/
public String getDtmfText() {
- return mDtmfDialerField.getText().toString();
+ return dtmfDialerField.getText().toString();
}
/**
@@ -199,7 +199,7 @@ public class DialpadFragment extends BaseFragment<DialpadPresenter, DialpadUi>
* @param text Text to set Dialpad EditText to.
*/
public void setDtmfText(String text) {
- mDtmfDialerField.setText(PhoneNumberUtilsCompat.createTtsSpannable(text));
+ dtmfDialerField.setText(PhoneNumberUtilsCompat.createTtsSpannable(text));
}
/** Starts the slide up animation for the Dialpad keys when the Dialpad is revealed. */
@@ -210,7 +210,7 @@ public class DialpadFragment extends BaseFragment<DialpadPresenter, DialpadUi>
@Override
public void appendDigitsToField(char digit) {
- if (mDtmfDialerField != null) {
+ if (dtmfDialerField != null) {
// TODO: maybe *don't* manually append this digit if
// mDialpadDigits is focused and this key came from the HW
// keyboard, since in that case the EditText field will
@@ -220,15 +220,15 @@ public class DialpadFragment extends BaseFragment<DialpadPresenter, DialpadUi>
// *not* handle HW key presses. That seems to be more
// complicated than just setting focusable="false" on it,
// though.)
- mDtmfDialerField.getText().append(digit);
+ dtmfDialerField.getText().append(digit);
}
}
/** Called externally (from InCallScreen) to play a DTMF Tone. */
/* package */ boolean onDialerKeyDown(KeyEvent event) {
Log.d(this, "Notifying dtmf key down.");
- if (mDtmfKeyListener != null) {
- return mDtmfKeyListener.onKeyDown(event);
+ if (dtmfKeyListener != null) {
+ return dtmfKeyListener.onKeyDown(event);
} else {
return false;
}
@@ -237,8 +237,8 @@ public class DialpadFragment extends BaseFragment<DialpadPresenter, DialpadUi>
/** Called externally (from InCallScreen) to cancel the last DTMF Tone played. */
public boolean onDialerKeyUp(KeyEvent event) {
Log.d(this, "Notifying dtmf key up.");
- if (mDtmfKeyListener != null) {
- return mDtmfKeyListener.onKeyUp(event);
+ if (dtmfKeyListener != null) {
+ return dtmfKeyListener.onKeyUp(event);
} else {
return false;
}
@@ -246,8 +246,8 @@ public class DialpadFragment extends BaseFragment<DialpadPresenter, DialpadUi>
private void configureKeypadListeners() {
DialpadKeyButton dialpadKey;
- for (int i = 0; i < mButtonIds.length; i++) {
- dialpadKey = (DialpadKeyButton) mDialpadView.findViewById(mButtonIds[i]);
+ for (int i = 0; i < buttonIds.length; i++) {
+ dialpadKey = (DialpadKeyButton) dialpadView.findViewById(buttonIds[i]);
dialpadKey.setOnKeyListener(this);
dialpadKey.setOnClickListener(this);
dialpadKey.setOnPressedListener(this);
@@ -256,11 +256,11 @@ public class DialpadFragment extends BaseFragment<DialpadPresenter, DialpadUi>
@Override
public void onPressed(View view, boolean pressed) {
- if (pressed && mDisplayMap.containsKey(view.getId())) {
+ if (pressed && displayMap.containsKey(view.getId())) {
Logger.get(getContext())
.logImpression(DialerImpression.Type.IN_CALL_DIALPAD_NUMBER_BUTTON_PRESSED);
- Log.d(this, "onPressed: " + pressed + " " + mDisplayMap.get(view.getId()));
- getPresenter().processDtmf(mDisplayMap.get(view.getId()));
+ Log.d(this, "onPressed: " + pressed + " " + displayMap.get(view.getId()));
+ getPresenter().processDtmf(displayMap.get(view.getId()));
}
if (!pressed) {
Log.d(this, "onPressed: " + pressed);
diff --git a/java/com/android/incallui/DialpadPresenter.java b/java/com/android/incallui/DialpadPresenter.java
index 002fefce7..e6fbdc22d 100644
--- a/java/com/android/incallui/DialpadPresenter.java
+++ b/java/com/android/incallui/DialpadPresenter.java
@@ -28,13 +28,13 @@ import com.android.incallui.call.TelecomAdapter;
public class DialpadPresenter extends Presenter<DialpadUi>
implements InCallPresenter.InCallStateListener {
- private DialerCall mCall;
+ private DialerCall call;
@Override
public void onUiReady(DialpadUi ui) {
super.onUiReady(ui);
InCallPresenter.getInstance().addListener(this);
- mCall = CallList.getInstance().getOutgoingOrActive();
+ call = CallList.getInstance().getOutgoingOrActive();
}
@Override
@@ -48,8 +48,8 @@ public class DialpadPresenter extends Presenter<DialpadUi>
InCallPresenter.InCallState oldState,
InCallPresenter.InCallState newState,
CallList callList) {
- mCall = callList.getOutgoingOrActive();
- Log.d(this, "DialpadPresenter mCall = " + mCall);
+ call = callList.getOutgoingOrActive();
+ Log.d(this, "DialpadPresenter mCall = " + call);
}
/**
@@ -59,7 +59,7 @@ public class DialpadPresenter extends Presenter<DialpadUi>
public final void processDtmf(char c) {
Log.d(this, "Processing dtmf key " + c);
// if it is a valid key, then update the display and send the dtmf tone.
- if (PhoneNumberUtils.is12Key(c) && mCall != null) {
+ if (PhoneNumberUtils.is12Key(c) && call != null) {
Log.d(this, "updating display and sending dtmf tone for '" + c + "'");
// Append this key to the "digits" widget.
@@ -68,7 +68,7 @@ public class DialpadPresenter extends Presenter<DialpadUi>
dialpadUi.appendDigitsToField(c);
}
// Plays the tone through Telecom.
- TelecomAdapter.getInstance().playDtmfTone(mCall.getId(), c);
+ TelecomAdapter.getInstance().playDtmfTone(call.getId(), c);
} else {
Log.d(this, "ignoring dtmf request for '" + c + "'");
}
@@ -76,9 +76,9 @@ public class DialpadPresenter extends Presenter<DialpadUi>
/** Stops the local tone based on the phone type. */
public void stopDtmf() {
- if (mCall != null) {
+ if (call != null) {
Log.d(this, "stopping remote tone");
- TelecomAdapter.getInstance().stopDtmfTone(mCall.getId());
+ TelecomAdapter.getInstance().stopDtmfTone(call.getId());
}
}
diff --git a/java/com/android/incallui/ExternalCallNotifier.java b/java/com/android/incallui/ExternalCallNotifier.java
index 7915b85af..8c882d2a3 100644
--- a/java/com/android/incallui/ExternalCallNotifier.java
+++ b/java/com/android/incallui/ExternalCallNotifier.java
@@ -73,18 +73,18 @@ public class ExternalCallNotifier implements ExternalCallList.ExternalCallListen
*/
private static final String GROUP_KEY = "ExternalCallGroup";
- private final Context mContext;
- private final ContactInfoCache mContactInfoCache;
- private Map<Call, NotificationInfo> mNotifications = new ArrayMap<>();
- private int mNextUniqueNotificationId;
- private ContactsPreferences mContactsPreferences;
+ private final Context context;
+ private final ContactInfoCache contactInfoCache;
+ private Map<Call, NotificationInfo> notifications = new ArrayMap<>();
+ private int nextUniqueNotificationId;
+ private ContactsPreferences contactsPreferences;
/** Initializes a new instance of the external call notifier. */
public ExternalCallNotifier(
@NonNull Context context, @NonNull ContactInfoCache contactInfoCache) {
- mContext = context;
- mContactsPreferences = ContactsPreferencesFactory.newContactsPreferences(mContext);
- mContactInfoCache = contactInfoCache;
+ this.context = context;
+ contactsPreferences = ContactsPreferencesFactory.newContactsPreferences(this.context);
+ this.contactInfoCache = contactInfoCache;
}
/**
@@ -94,9 +94,9 @@ public class ExternalCallNotifier implements ExternalCallList.ExternalCallListen
@Override
public void onExternalCallAdded(android.telecom.Call call) {
Log.i(this, "onExternalCallAdded " + call);
- Assert.checkArgument(!mNotifications.containsKey(call));
- NotificationInfo info = new NotificationInfo(call, mNextUniqueNotificationId++);
- mNotifications.put(call, info);
+ Assert.checkArgument(!notifications.containsKey(call));
+ NotificationInfo info = new NotificationInfo(call, nextUniqueNotificationId++);
+ notifications.put(call, info);
showNotifcation(info);
}
@@ -115,8 +115,8 @@ public class ExternalCallNotifier implements ExternalCallList.ExternalCallListen
/** Handles updates to an external call. */
@Override
public void onExternalCallUpdated(Call call) {
- Assert.checkArgument(mNotifications.containsKey(call));
- postNotification(mNotifications.get(call));
+ Assert.checkArgument(notifications.containsKey(call));
+ postNotification(notifications.get(call));
}
@Override
@@ -132,7 +132,7 @@ public class ExternalCallNotifier implements ExternalCallList.ExternalCallListen
*/
@TargetApi(VERSION_CODES.N_MR1)
public void pullExternalCall(int notificationId) {
- for (NotificationInfo info : mNotifications.values()) {
+ for (NotificationInfo info : notifications.values()) {
if (info.getNotificationId() == notificationId
&& CallCompat.canPullExternalCall(info.getCall())) {
info.getCall().pullExternalCall();
@@ -153,13 +153,13 @@ public class ExternalCallNotifier implements ExternalCallList.ExternalCallListen
// call into the contacts provider for more data.
DialerCall dialerCall =
new DialerCall(
- mContext,
+ context,
new DialerCallDelegateStub(),
info.getCall(),
new LatencyReport(),
false /* registerCallback */);
- mContactInfoCache.findInfo(
+ contactInfoCache.findInfo(
dialerCall,
false /* isIncoming */,
new ContactInfoCache.ContactInfoCacheCallback() {
@@ -169,7 +169,7 @@ public class ExternalCallNotifier implements ExternalCallList.ExternalCallListen
// Ensure notification still exists as the external call could have been
// removed during async contact info lookup.
- if (mNotifications.containsKey(info.getCall())) {
+ if (notifications.containsKey(info.getCall())) {
saveContactInfo(info, entry);
}
}
@@ -179,7 +179,7 @@ public class ExternalCallNotifier implements ExternalCallList.ExternalCallListen
// Ensure notification still exists as the external call could have been
// removed during async contact info lookup.
- if (mNotifications.containsKey(info.getCall())) {
+ if (notifications.containsKey(info.getCall())) {
savePhoto(info, entry);
}
}
@@ -188,13 +188,13 @@ public class ExternalCallNotifier implements ExternalCallList.ExternalCallListen
/** Dismisses a notification for an external call. */
private void dismissNotification(Call call) {
- Assert.checkArgument(mNotifications.containsKey(call));
+ Assert.checkArgument(notifications.containsKey(call));
// This will also dismiss the group summary if there are no more external call notifications.
DialerNotificationManager.cancel(
- mContext, NOTIFICATION_TAG, mNotifications.get(call).getNotificationId());
+ context, NOTIFICATION_TAG, notifications.get(call).getNotificationId());
- mNotifications.remove(call);
+ notifications.remove(call);
}
/**
@@ -202,9 +202,9 @@ public class ExternalCallNotifier implements ExternalCallList.ExternalCallListen
* the updated notification to the notification manager.
*/
private void savePhoto(NotificationInfo info, ContactInfoCache.ContactCacheEntry entry) {
- Bitmap largeIcon = getLargeIconToDisplay(mContext, entry, info.getCall());
+ Bitmap largeIcon = getLargeIconToDisplay(context, entry, info.getCall());
if (largeIcon != null) {
- largeIcon = getRoundedIcon(mContext, largeIcon);
+ largeIcon = getRoundedIcon(context, largeIcon);
}
info.setLargeIcon(largeIcon);
postNotification(info);
@@ -215,14 +215,14 @@ public class ExternalCallNotifier implements ExternalCallList.ExternalCallListen
* notification to the notification manager.
*/
private void saveContactInfo(NotificationInfo info, ContactInfoCache.ContactCacheEntry entry) {
- info.setContentTitle(getContentTitle(mContext, mContactsPreferences, entry, info.getCall()));
+ info.setContentTitle(getContentTitle(context, contactsPreferences, entry, info.getCall()));
info.setPersonReference(getPersonReference(entry, info.getCall()));
postNotification(info);
}
/** Rebuild an existing or show a new notification given {@link NotificationInfo}. */
private void postNotification(NotificationInfo info) {
- Notification.Builder builder = new Notification.Builder(mContext);
+ Notification.Builder builder = new Notification.Builder(context);
// Set notification as ongoing since calls are long-running versus a point-in-time notice.
builder.setOngoing(true);
// Make the notification prioritized over the other normal notifications.
@@ -232,14 +232,14 @@ public class ExternalCallNotifier implements ExternalCallList.ExternalCallListen
boolean isVideoCall = VideoProfile.isVideo(info.getCall().getDetails().getVideoState());
// Set the content ("Ongoing call on another device")
builder.setContentText(
- mContext.getString(
+ context.getString(
isVideoCall
? R.string.notification_external_video_call
: R.string.notification_external_call));
builder.setSmallIcon(R.drawable.quantum_ic_call_white_24);
builder.setContentTitle(info.getContentTitle());
builder.setLargeIcon(info.getLargeIcon());
- builder.setColor(mContext.getResources().getColor(R.color.dialer_theme_color));
+ builder.setColor(context.getResources().getColor(R.color.dialer_theme_color));
builder.addPerson(info.getPersonReference());
if (BuildCompat.isAtLeastO()) {
builder.setChannelId(NotificationChannelId.DEFAULT);
@@ -253,18 +253,18 @@ public class ExternalCallNotifier implements ExternalCallList.ExternalCallListen
new Intent(
NotificationBroadcastReceiver.ACTION_PULL_EXTERNAL_CALL,
null,
- mContext,
+ context,
NotificationBroadcastReceiver.class);
intent.putExtra(
NotificationBroadcastReceiver.EXTRA_NOTIFICATION_ID, info.getNotificationId());
builder.addAction(
new Notification.Action.Builder(
R.drawable.quantum_ic_call_white_24,
- mContext.getString(
+ context.getString(
isVideoCall
? R.string.notification_take_video_call
: R.string.notification_take_call),
- PendingIntent.getBroadcast(mContext, info.getNotificationId(), intent, 0))
+ PendingIntent.getBroadcast(context, info.getNotificationId(), intent, 0))
.build());
}
@@ -273,9 +273,9 @@ public class ExternalCallNotifier implements ExternalCallList.ExternalCallListen
* set their notification settings to 'hide sensitive content' {@see
* Notification.Builder#setPublicVersion}.
*/
- Notification.Builder publicBuilder = new Notification.Builder(mContext);
+ Notification.Builder publicBuilder = new Notification.Builder(context);
publicBuilder.setSmallIcon(R.drawable.quantum_ic_call_white_24);
- publicBuilder.setColor(mContext.getResources().getColor(R.color.dialer_theme_color));
+ publicBuilder.setColor(context.getResources().getColor(R.color.dialer_theme_color));
if (BuildCompat.isAtLeastO()) {
publicBuilder.setChannelId(NotificationChannelId.DEFAULT);
}
@@ -284,9 +284,9 @@ public class ExternalCallNotifier implements ExternalCallList.ExternalCallListen
Notification notification = builder.build();
DialerNotificationManager.notify(
- mContext, NOTIFICATION_TAG, info.getNotificationId(), notification);
+ context, NOTIFICATION_TAG, info.getNotificationId(), notification);
- showGroupSummaryNotification(mContext);
+ showGroupSummaryNotification(context);
}
/**
@@ -404,47 +404,47 @@ public class ExternalCallNotifier implements ExternalCallList.ExternalCallListen
/** Represents a call and associated cached notification data. */
private static class NotificationInfo {
- @NonNull private final Call mCall;
- private final int mNotificationId;
- @Nullable private String mContentTitle;
- @Nullable private Bitmap mLargeIcon;
- @Nullable private String mPersonReference;
+ @NonNull private final Call call;
+ private final int notificationId;
+ @Nullable private String contentTitle;
+ @Nullable private Bitmap largeIcon;
+ @Nullable private String personReference;
public NotificationInfo(@NonNull Call call, int notificationId) {
- mCall = call;
- mNotificationId = notificationId;
+ this.call = call;
+ this.notificationId = notificationId;
}
public Call getCall() {
- return mCall;
+ return call;
}
public int getNotificationId() {
- return mNotificationId;
+ return notificationId;
}
public @Nullable String getContentTitle() {
- return mContentTitle;
+ return contentTitle;
}
public void setContentTitle(@Nullable String contentTitle) {
- mContentTitle = contentTitle;
+ this.contentTitle = contentTitle;
}
public @Nullable Bitmap getLargeIcon() {
- return mLargeIcon;
+ return largeIcon;
}
public void setLargeIcon(@Nullable Bitmap largeIcon) {
- mLargeIcon = largeIcon;
+ this.largeIcon = largeIcon;
}
public @Nullable String getPersonReference() {
- return mPersonReference;
+ return personReference;
}
public void setPersonReference(@Nullable String personReference) {
- mPersonReference = personReference;
+ this.personReference = personReference;
}
}
diff --git a/java/com/android/incallui/InCallCameraManager.java b/java/com/android/incallui/InCallCameraManager.java
index fdb422643..b5a8f91af 100644
--- a/java/com/android/incallui/InCallCameraManager.java
+++ b/java/com/android/incallui/InCallCameraManager.java
@@ -27,21 +27,21 @@ import java.util.concurrent.ConcurrentHashMap;
/** Used to track which camera is used for outgoing video. */
public class InCallCameraManager {
- private final Set<Listener> mCameraSelectionListeners =
+ private final Set<Listener> cameraSelectionListeners =
Collections.newSetFromMap(new ConcurrentHashMap<Listener, Boolean>(8, 0.9f, 1));
/** The camera ID for the front facing camera. */
- private String mFrontFacingCameraId;
+ private String frontFacingCameraId;
/** The camera ID for the rear facing camera. */
- private String mRearFacingCameraId;
+ private String rearFacingCameraId;
/** The currently active camera. */
- private boolean mUseFrontFacingCamera;
+ private boolean useFrontFacingCamera;
/**
* Indicates whether the list of cameras has been initialized yet. Initialization is delayed until
* a video call is present.
*/
- private boolean mIsInitialized = false;
+ private boolean isInitialized = false;
/** The context. */
- private Context mContext;
+ private Context context;
/**
* Initializes the InCall CameraManager.
@@ -49,8 +49,8 @@ public class InCallCameraManager {
* @param context The current context.
*/
public InCallCameraManager(Context context) {
- mUseFrontFacingCamera = true;
- mContext = context;
+ useFrontFacingCamera = true;
+ this.context = context;
}
/**
@@ -59,9 +59,9 @@ public class InCallCameraManager {
* @param useFrontFacingCamera {@code True} if the front facing camera is to be used.
*/
public void setUseFrontFacingCamera(boolean useFrontFacingCamera) {
- mUseFrontFacingCamera = useFrontFacingCamera;
- for (Listener listener : mCameraSelectionListeners) {
- listener.onActiveCameraSelectionChanged(mUseFrontFacingCamera);
+ this.useFrontFacingCamera = useFrontFacingCamera;
+ for (Listener listener : cameraSelectionListeners) {
+ listener.onActiveCameraSelectionChanged(this.useFrontFacingCamera);
}
}
@@ -71,7 +71,7 @@ public class InCallCameraManager {
* @return {@code True} if the front facing camera is in use.
*/
public boolean isUsingFrontFacingCamera() {
- return mUseFrontFacingCamera;
+ return useFrontFacingCamera;
}
/**
@@ -80,18 +80,18 @@ public class InCallCameraManager {
* @return The active camera ID.
*/
public String getActiveCameraId() {
- maybeInitializeCameraList(mContext);
+ maybeInitializeCameraList(context);
- if (mUseFrontFacingCamera) {
- return mFrontFacingCameraId;
+ if (useFrontFacingCamera) {
+ return frontFacingCameraId;
} else {
- return mRearFacingCameraId;
+ return rearFacingCameraId;
}
}
/** Calls when camera permission is granted by user. */
public void onCameraPermissionGranted() {
- for (Listener listener : mCameraSelectionListeners) {
+ for (Listener listener : cameraSelectionListeners) {
listener.onCameraPermissionGranted();
}
}
@@ -102,7 +102,7 @@ public class InCallCameraManager {
* @param context The context.
*/
private void maybeInitializeCameraList(Context context) {
- if (mIsInitialized || context == null) {
+ if (isInitialized || context == null) {
return;
}
@@ -141,26 +141,26 @@ public class InCallCameraManager {
if (c != null) {
int facingCharacteristic = c.get(CameraCharacteristics.LENS_FACING);
if (facingCharacteristic == CameraCharacteristics.LENS_FACING_FRONT) {
- mFrontFacingCameraId = cameraIds[i];
+ frontFacingCameraId = cameraIds[i];
} else if (facingCharacteristic == CameraCharacteristics.LENS_FACING_BACK) {
- mRearFacingCameraId = cameraIds[i];
+ rearFacingCameraId = cameraIds[i];
}
}
}
- mIsInitialized = true;
+ isInitialized = true;
Log.v(this, "initializeCameraList : done");
}
public void addCameraSelectionListener(Listener listener) {
if (listener != null) {
- mCameraSelectionListeners.add(listener);
+ cameraSelectionListeners.add(listener);
}
}
public void removeCameraSelectionListener(Listener listener) {
if (listener != null) {
- mCameraSelectionListeners.remove(listener);
+ cameraSelectionListeners.remove(listener);
}
}
diff --git a/java/com/android/incallui/InCallOrientationEventListener.java b/java/com/android/incallui/InCallOrientationEventListener.java
index 8aae6fb37..854bdd193 100644
--- a/java/com/android/incallui/InCallOrientationEventListener.java
+++ b/java/com/android/incallui/InCallOrientationEventListener.java
@@ -68,9 +68,9 @@ public class InCallOrientationEventListener extends OrientationEventListener {
private static final int ROTATION_THRESHOLD = 10;
/** Cache the current rotation of the device. */
- @ScreenOrientation private static int sCurrentOrientation = SCREEN_ORIENTATION_0;
+ @ScreenOrientation private static int currentOrientation = SCREEN_ORIENTATION_0;
- private boolean mEnabled = false;
+ private boolean enabled = false;
public InCallOrientationEventListener(Context context) {
super(context);
@@ -94,7 +94,7 @@ public class InCallOrientationEventListener extends OrientationEventListener {
@ScreenOrientation
public static int getCurrentOrientation() {
- return sCurrentOrientation;
+ return currentOrientation;
}
/**
@@ -114,14 +114,14 @@ public class InCallOrientationEventListener extends OrientationEventListener {
final int orientation = toScreenOrientation(rotation);
- if (orientation != SCREEN_ORIENTATION_UNKNOWN && sCurrentOrientation != orientation) {
+ if (orientation != SCREEN_ORIENTATION_UNKNOWN && currentOrientation != orientation) {
LogUtil.i(
"InCallOrientationEventListener.onOrientationChanged",
"orientation: %d -> %d",
- sCurrentOrientation,
+ currentOrientation,
orientation);
- sCurrentOrientation = orientation;
- InCallPresenter.getInstance().onDeviceOrientationChange(sCurrentOrientation);
+ currentOrientation = orientation;
+ InCallPresenter.getInstance().onDeviceOrientationChange(currentOrientation);
}
}
@@ -133,15 +133,15 @@ public class InCallOrientationEventListener extends OrientationEventListener {
* changed.
*/
public void enable(boolean notifyDeviceOrientationChange) {
- if (mEnabled) {
+ if (enabled) {
Log.v(this, "enable: Orientation listener is already enabled. Ignoring...");
return;
}
super.enable();
- mEnabled = true;
+ enabled = true;
if (notifyDeviceOrientationChange) {
- InCallPresenter.getInstance().onDeviceOrientationChange(sCurrentOrientation);
+ InCallPresenter.getInstance().onDeviceOrientationChange(currentOrientation);
}
}
@@ -154,18 +154,18 @@ public class InCallOrientationEventListener extends OrientationEventListener {
/** Disables the OrientationEventListener. */
@Override
public void disable() {
- if (!mEnabled) {
+ if (!enabled) {
Log.v(this, "enable: Orientation listener is already disabled. Ignoring...");
return;
}
- mEnabled = false;
+ enabled = false;
super.disable();
}
/** Returns true the OrientationEventListener is enabled, false otherwise. */
public boolean isEnabled() {
- return mEnabled;
+ return enabled;
}
/**
diff --git a/java/com/android/incallui/InCallPresenter.java b/java/com/android/incallui/InCallPresenter.java
index 3debd704e..ae25f4dc1 100644
--- a/java/com/android/incallui/InCallPresenter.java
+++ b/java/com/android/incallui/InCallPresenter.java
@@ -93,53 +93,53 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
private static final Bundle EMPTY_EXTRAS = new Bundle();
- private static InCallPresenter sInCallPresenter;
+ private static InCallPresenter inCallPresenter;
/**
* ConcurrentHashMap constructor params: 8 is initial table size, 0.9f is load factor before
* resizing, 1 means we only expect a single thread to access the map so make only a single shard
*/
- private final Set<InCallStateListener> mListeners =
+ private final Set<InCallStateListener> listeners =
Collections.newSetFromMap(new ConcurrentHashMap<InCallStateListener, Boolean>(8, 0.9f, 1));
- private final List<IncomingCallListener> mIncomingCallListeners = new CopyOnWriteArrayList<>();
- private final Set<InCallDetailsListener> mDetailsListeners =
+ private final List<IncomingCallListener> incomingCallListeners = new CopyOnWriteArrayList<>();
+ private final Set<InCallDetailsListener> detailsListeners =
Collections.newSetFromMap(new ConcurrentHashMap<InCallDetailsListener, Boolean>(8, 0.9f, 1));
- private final Set<CanAddCallListener> mCanAddCallListeners =
+ private final Set<CanAddCallListener> canAddCallListeners =
Collections.newSetFromMap(new ConcurrentHashMap<CanAddCallListener, Boolean>(8, 0.9f, 1));
- private final Set<InCallUiListener> mInCallUiListeners =
+ private final Set<InCallUiListener> inCallUiListeners =
Collections.newSetFromMap(new ConcurrentHashMap<InCallUiListener, Boolean>(8, 0.9f, 1));
- private final Set<InCallOrientationListener> mOrientationListeners =
+ private final Set<InCallOrientationListener> orientationListeners =
Collections.newSetFromMap(
new ConcurrentHashMap<InCallOrientationListener, Boolean>(8, 0.9f, 1));
- private final Set<InCallEventListener> mInCallEventListeners =
+ private final Set<InCallEventListener> inCallEventListeners =
Collections.newSetFromMap(new ConcurrentHashMap<InCallEventListener, Boolean>(8, 0.9f, 1));
- private StatusBarNotifier mStatusBarNotifier;
- private ExternalCallNotifier mExternalCallNotifier;
- private ContactInfoCache mContactInfoCache;
- private Context mContext;
- private final OnCheckBlockedListener mOnCheckBlockedListener =
+ private StatusBarNotifier statusBarNotifier;
+ private ExternalCallNotifier externalCallNotifier;
+ private ContactInfoCache contactInfoCache;
+ private Context context;
+ private final OnCheckBlockedListener onCheckBlockedListener =
new OnCheckBlockedListener() {
@Override
public void onCheckComplete(final Integer id) {
if (id != null && id != FilteredNumberAsyncQueryHandler.INVALID_ID) {
// Silence the ringer now to prevent ringing and vibration before the call is
// terminated when Telecom attempts to add it.
- TelecomUtil.silenceRinger(mContext);
+ TelecomUtil.silenceRinger(context);
}
}
};
- private CallList mCallList;
- private ExternalCallList mExternalCallList;
- private InCallActivity mInCallActivity;
- private ManageConferenceActivity mManageConferenceActivity;
- private final android.telecom.Call.Callback mCallCallback =
+ private CallList callList;
+ private ExternalCallList externalCallList;
+ private InCallActivity inCallActivity;
+ private ManageConferenceActivity manageConferenceActivity;
+ private final android.telecom.Call.Callback callCallback =
new android.telecom.Call.Callback() {
@Override
public void onPostDialWait(
android.telecom.Call telecomCall, String remainingPostDialSequence) {
- final DialerCall call = mCallList.getDialerCallFromTelecomCall(telecomCall);
+ final DialerCall call = callList.getDialerCallFromTelecomCall(telecomCall);
if (call == null) {
LogUtil.w(
"InCallPresenter.onPostDialWait",
@@ -152,7 +152,7 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
@Override
public void onDetailsChanged(
android.telecom.Call telecomCall, android.telecom.Call.Details details) {
- final DialerCall call = mCallList.getDialerCallFromTelecomCall(telecomCall);
+ final DialerCall call = callList.getDialerCallFromTelecomCall(telecomCall);
if (call == null) {
LogUtil.w(
"InCallPresenter.onDetailsChanged",
@@ -161,16 +161,16 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
}
if (details.hasProperty(Details.PROPERTY_IS_EXTERNAL_CALL)
- && !mExternalCallList.isCallTracked(telecomCall)) {
+ && !externalCallList.isCallTracked(telecomCall)) {
// A regular call became an external call so swap call lists.
LogUtil.i("InCallPresenter.onDetailsChanged", "Call became external: " + telecomCall);
- mCallList.onInternalCallMadeExternal(mContext, telecomCall);
- mExternalCallList.onCallAdded(telecomCall);
+ callList.onInternalCallMadeExternal(context, telecomCall);
+ externalCallList.onCallAdded(telecomCall);
return;
}
- for (InCallDetailsListener listener : mDetailsListeners) {
+ for (InCallDetailsListener listener : detailsListeners) {
listener.onDetailsChanged(call, details);
}
}
@@ -184,38 +184,38 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
onDetailsChanged(telecomCall, telecomCall.getDetails());
}
};
- private InCallState mInCallState = InCallState.NO_CALLS;
- private ProximitySensor mProximitySensor;
- private final PseudoScreenState mPseudoScreenState = new PseudoScreenState();
- private boolean mServiceConnected;
- private InCallCameraManager mInCallCameraManager;
- private FilteredNumberAsyncQueryHandler mFilteredQueryHandler;
- private CallList.Listener mSpamCallListListener;
+ private InCallState inCallState = InCallState.NO_CALLS;
+ private ProximitySensor proximitySensor;
+ private final PseudoScreenState pseudoScreenState = new PseudoScreenState();
+ private boolean serviceConnected;
+ private InCallCameraManager inCallCameraManager;
+ private FilteredNumberAsyncQueryHandler filteredQueryHandler;
+ private CallList.Listener spamCallListListener;
/** Whether or not we are currently bound and waiting for Telecom to send us a new call. */
- private boolean mBoundAndWaitingForOutgoingCall;
+ private boolean boundAndWaitingForOutgoingCall;
/** Determines if the InCall UI is in fullscreen mode or not. */
- private boolean mIsFullScreen = false;
+ private boolean isFullScreen = false;
- private boolean mScreenTimeoutEnabled = true;
+ private boolean screenTimeoutEnabled = true;
- private PhoneStateListener mPhoneStateListener =
+ private PhoneStateListener phoneStateListener =
new PhoneStateListener() {
@Override
public void onCallStateChanged(int state, String incomingNumber) {
if (state == TelephonyManager.CALL_STATE_RINGING) {
- if (FilteredNumbersUtil.hasRecentEmergencyCall(mContext)) {
+ if (FilteredNumbersUtil.hasRecentEmergencyCall(context)) {
return;
}
// Check if the number is blocked, to silence the ringer.
- String countryIso = GeoUtil.getCurrentCountryIso(mContext);
- mFilteredQueryHandler.isBlockedNumber(
- mOnCheckBlockedListener, incomingNumber, countryIso);
+ String countryIso = GeoUtil.getCurrentCountryIso(context);
+ filteredQueryHandler.isBlockedNumber(
+ onCheckBlockedListener, incomingNumber, countryIso);
}
}
};
/** Whether or not InCallService is bound to Telecom. */
- private boolean mServiceBound = false;
+ private boolean serviceBound = false;
/**
* When configuration changes Android kills the current activity and starts a new one. The flag is
@@ -223,11 +223,11 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
* started), or if a new activity will be started right after the current one is destroyed, and
* therefore no need in release all resources.
*/
- private boolean mIsChangingConfigurations = false;
+ private boolean isChangingConfigurations = false;
- private boolean mAwaitingCallListUpdate = false;
+ private boolean awaitingCallListUpdate = false;
- private ExternalCallList.ExternalCallListener mExternalCallListener =
+ private ExternalCallList.ExternalCallListener externalCallListener =
new ExternalCallList.ExternalCallListener() {
@Override
@@ -236,8 +236,8 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
LatencyReport latencyReport = new LatencyReport(call);
latencyReport.onCallBlockingDone();
// Note: External calls do not require spam checking.
- mCallList.onCallAdded(mContext, call, latencyReport);
- call.registerCallback(mCallCallback);
+ callList.onCallAdded(context, call, latencyReport);
+ call.registerCallback(callCallback);
}
@Override
@@ -256,26 +256,26 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
}
};
- private ThemeColorManager mThemeColorManager;
- private VideoSurfaceTexture mLocalVideoSurfaceTexture;
- private VideoSurfaceTexture mRemoteVideoSurfaceTexture;
+ private ThemeColorManager themeColorManager;
+ private VideoSurfaceTexture localVideoSurfaceTexture;
+ private VideoSurfaceTexture remoteVideoSurfaceTexture;
/** Inaccessible constructor. Must use getRunningInstance() to get this singleton. */
@VisibleForTesting
InCallPresenter() {}
public static synchronized InCallPresenter getInstance() {
- if (sInCallPresenter == null) {
+ if (inCallPresenter == null) {
Trace.beginSection("InCallPresenter.Constructor");
- sInCallPresenter = new InCallPresenter();
+ inCallPresenter = new InCallPresenter();
Trace.endSection();
}
- return sInCallPresenter;
+ return inCallPresenter;
}
@VisibleForTesting
public static synchronized void setInstanceForTesting(InCallPresenter inCallPresenter) {
- sInCallPresenter = inCallPresenter;
+ InCallPresenter.inCallPresenter = inCallPresenter;
}
/**
@@ -309,11 +309,11 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
}
public InCallState getInCallState() {
- return mInCallState;
+ return inCallState;
}
public CallList getCallList() {
- return mCallList;
+ return callList;
}
public void setUp(
@@ -326,9 +326,9 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
ProximitySensor proximitySensor,
FilteredNumberAsyncQueryHandler filteredNumberQueryHandler) {
Trace.beginSection("InCallPresenter.setUp");
- if (mServiceConnected) {
+ if (serviceConnected) {
LogUtil.i("InCallPresenter.setUp", "New service connection replacing existing one.");
- if (context != mContext || callList != mCallList) {
+ if (context != this.context || callList != this.callList) {
throw new IllegalStateException();
}
Trace.endSection();
@@ -336,49 +336,49 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
}
Objects.requireNonNull(context);
- mContext = context;
+ this.context = context;
- mContactInfoCache = contactInfoCache;
+ this.contactInfoCache = contactInfoCache;
- mStatusBarNotifier = statusBarNotifier;
- mExternalCallNotifier = externalCallNotifier;
- addListener(mStatusBarNotifier);
- EnrichedCallComponent.get(mContext)
+ this.statusBarNotifier = statusBarNotifier;
+ this.externalCallNotifier = externalCallNotifier;
+ addListener(this.statusBarNotifier);
+ EnrichedCallComponent.get(this.context)
.getEnrichedCallManager()
- .registerStateChangedListener(mStatusBarNotifier);
+ .registerStateChangedListener(this.statusBarNotifier);
- mProximitySensor = proximitySensor;
- addListener(mProximitySensor);
+ this.proximitySensor = proximitySensor;
+ addListener(this.proximitySensor);
- if (mThemeColorManager == null) {
- mThemeColorManager =
- new ThemeColorManager(new InCallUIMaterialColorMapUtils(mContext.getResources()));
+ if (themeColorManager == null) {
+ themeColorManager =
+ new ThemeColorManager(new InCallUIMaterialColorMapUtils(this.context.getResources()));
}
- mCallList = callList;
- mExternalCallList = externalCallList;
- externalCallList.addExternalCallListener(mExternalCallNotifier);
- externalCallList.addExternalCallListener(mExternalCallListener);
+ this.callList = callList;
+ this.externalCallList = externalCallList;
+ externalCallList.addExternalCallListener(this.externalCallNotifier);
+ externalCallList.addExternalCallListener(externalCallListener);
// This only gets called by the service so this is okay.
- mServiceConnected = true;
+ serviceConnected = true;
// The final thing we do in this set up is add ourselves as a listener to CallList. This
// will kick off an update and the whole process can start.
- mCallList.addListener(this);
+ this.callList.addListener(this);
// Create spam call list listener and add it to the list of listeners
- mSpamCallListListener =
+ spamCallListListener =
new SpamCallListListener(
context, DialerExecutorComponent.get(context).dialerExecutorFactory());
- mCallList.addListener(mSpamCallListListener);
+ this.callList.addListener(spamCallListListener);
VideoPauseController.getInstance().setUp(this);
- mFilteredQueryHandler = filteredNumberQueryHandler;
- mContext
+ filteredQueryHandler = filteredNumberQueryHandler;
+ this.context
.getSystemService(TelephonyManager.class)
- .listen(mPhoneStateListener, PhoneStateListener.LISTEN_CALL_STATE);
+ .listen(phoneStateListener, PhoneStateListener.LISTEN_CALL_STATE);
AudioModeProvider.getInstance().addListener(this);
@@ -395,13 +395,13 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
*/
public void tearDown() {
LogUtil.d("InCallPresenter.tearDown", "tearDown");
- mCallList.clearOnDisconnect();
+ callList.clearOnDisconnect();
- mServiceConnected = false;
+ serviceConnected = false;
- mContext
+ context
.getSystemService(TelephonyManager.class)
- .listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE);
+ .listen(phoneStateListener, PhoneStateListener.LISTEN_NONE);
attemptCleanup();
VideoPauseController.getInstance().tearDown();
@@ -409,12 +409,12 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
}
private void attemptFinishActivity() {
- mScreenTimeoutEnabled = true;
- final boolean doFinish = (mInCallActivity != null && isActivityStarted());
+ screenTimeoutEnabled = true;
+ final boolean doFinish = (inCallActivity != null && isActivityStarted());
LogUtil.i("InCallPresenter.attemptFinishActivity", "Hide in call UI: " + doFinish);
if (doFinish) {
- mInCallActivity.setExcludeFromRecents(true);
- mInCallActivity.finish();
+ inCallActivity.setExcludeFromRecents(true);
+ inCallActivity.finish();
}
}
@@ -426,12 +426,12 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
if (inCallActivity == null) {
throw new IllegalArgumentException("unregisterActivity cannot be called with null");
}
- if (mInCallActivity == null) {
+ if (this.inCallActivity == null) {
LogUtil.i(
"InCallPresenter.unsetActivity", "No InCallActivity currently set, no need to unset.");
return;
}
- if (mInCallActivity != inCallActivity) {
+ if (this.inCallActivity != inCallActivity) {
LogUtil.w(
"InCallPresenter.unsetActivity",
"Second instance of InCallActivity is trying to unregister when another"
@@ -451,8 +451,8 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
boolean doAttemptCleanup = false;
if (inCallActivity != null) {
- if (mInCallActivity == null) {
- mContext = inCallActivity.getApplicationContext();
+ if (this.inCallActivity == null) {
+ context = inCallActivity.getApplicationContext();
updateListeners = true;
LogUtil.i("InCallPresenter.updateActivity", "UI Initialized");
} else {
@@ -461,13 +461,13 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
// this happens (like going to/from background) so we do not set updateListeners.
}
- mInCallActivity = inCallActivity;
- mInCallActivity.setExcludeFromRecents(false);
+ this.inCallActivity = inCallActivity;
+ this.inCallActivity.setExcludeFromRecents(false);
// By the time the UI finally comes up, the call may already be disconnected.
// If that's the case, we may need to show an error dialog.
- if (mCallList != null && mCallList.getDisconnectedCall() != null) {
- showDialogOrToastForDisconnectedCall(mCallList.getDisconnectedCall());
+ if (callList != null && callList.getDisconnectedCall() != null) {
+ showDialogOrToastForDisconnectedCall(callList.getDisconnectedCall());
}
// When the UI comes up, we need to first check the in-call state.
@@ -476,7 +476,7 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
// If we dont have any calls, start tearing down the UI instead.
// NOTE: This code relies on {@link #mInCallActivity} being set so we run it after
// it has been set.
- if (mInCallState == InCallState.NO_CALLS) {
+ if (inCallState == InCallState.NO_CALLS) {
LogUtil.i("InCallPresenter.updateActivity", "UI Initialized, but no calls left. Shut down");
attemptFinishActivity();
Trace.endSection();
@@ -485,7 +485,7 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
} else {
LogUtil.i("InCallPresenter.updateActivity", "UI Destroyed");
updateListeners = true;
- mInCallActivity = null;
+ this.inCallActivity = null;
// We attempt cleanup for the destroy case but only after we recalculate the state
// to see if we need to come back up or stay shut down. This is why we do the
@@ -509,7 +509,7 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
// state here even if the service is disconnected since we may not have finished a state
// transition while finish()ing.
if (updateListeners) {
- onCallListChange(mCallList);
+ onCallListChange(callList);
}
if (doAttemptCleanup) {
@@ -520,7 +520,7 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
public void setManageConferenceActivity(
@Nullable ManageConferenceActivity manageConferenceActivity) {
- mManageConferenceActivity = manageConferenceActivity;
+ this.manageConferenceActivity = manageConferenceActivity;
}
public void onBringToForeground(boolean showDialpad) {
@@ -535,18 +535,18 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
maybeBlockCall(call, latencyReport);
} else {
if (call.getDetails().hasProperty(CallCompat.Details.PROPERTY_IS_EXTERNAL_CALL)) {
- mExternalCallList.onCallAdded(call);
+ externalCallList.onCallAdded(call);
} else {
latencyReport.onCallBlockingDone();
- mCallList.onCallAdded(mContext, call, latencyReport);
+ callList.onCallAdded(context, call, latencyReport);
}
}
// Since a call has been added we are no longer waiting for Telecom to send us a call.
setBoundAndWaitingForOutgoingCall(false, null);
- call.registerCallback(mCallCallback);
+ call.registerCallback(callCallback);
// TODO(maxwelb): Return the future in recordPhoneLookupInfo and propagate.
- PhoneLookupHistoryRecorder.recordPhoneLookupInfo(mContext.getApplicationContext(), call);
+ PhoneLookupHistoryRecorder.recordPhoneLookupInfo(context.getApplicationContext(), call);
Trace.endSection();
}
@@ -554,7 +554,7 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
if (call.getState() != android.telecom.Call.STATE_RINGING) {
return false;
}
- if (!UserManagerCompat.isUserUnlocked(mContext)) {
+ if (!UserManagerCompat.isUserUnlocked(context)) {
LogUtil.i(
"InCallPresenter.shouldAttemptBlocking",
"not attempting to block incoming call because user is locked");
@@ -566,7 +566,7 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
"Not attempting to block incoming emergency call");
return false;
}
- if (FilteredNumbersUtil.hasRecentEmergencyCall(mContext)) {
+ if (FilteredNumbersUtil.hasRecentEmergencyCall(context)) {
LogUtil.i(
"InCallPresenter.shouldAttemptBlocking",
"Not attempting to block incoming call due to recent emergency call");
@@ -575,7 +575,7 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
if (call.getDetails().hasProperty(CallCompat.Details.PROPERTY_IS_EXTERNAL_CALL)) {
return false;
}
- if (FilteredNumberCompat.useNewFiltering(mContext)) {
+ if (FilteredNumberCompat.useNewFiltering(context)) {
LogUtil.i(
"InCallPresenter.shouldAttemptBlocking",
"not attempting to block incoming call because framework blocking is in use");
@@ -591,7 +591,7 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
* call anyways.
*/
private void maybeBlockCall(final android.telecom.Call call, final LatencyReport latencyReport) {
- final String countryIso = GeoUtil.getCurrentCountryIso(mContext);
+ final String countryIso = GeoUtil.getCurrentCountryIso(context);
final String number = TelecomCallUtil.getNumber(call);
final long timeAdded = System.currentTimeMillis();
@@ -609,7 +609,7 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
public void run() {
hasTimedOut.set(true);
latencyReport.onCallBlockingDone();
- mCallList.onCallAdded(mContext, call, latencyReport);
+ callList.onCallAdded(context, call, latencyReport);
}
};
handler.postDelayed(runnable, BLOCK_QUERY_TIMEOUT_MS);
@@ -628,7 +628,7 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
if (id == null) {
if (!hasTimedOut.get()) {
latencyReport.onCallBlockingDone();
- mCallList.onCallAdded(mContext, call, latencyReport);
+ callList.onCallAdded(context, call, latencyReport);
}
} else if (id == FilteredNumberAsyncQueryHandler.INVALID_ID) {
LogUtil.d(
@@ -637,68 +637,68 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
handler.removeCallbacks(runnable);
latencyReport.onCallBlockingDone();
- mCallList.onCallAdded(mContext, call, latencyReport);
+ callList.onCallAdded(context, call, latencyReport);
}
} else {
LogUtil.i(
"InCallPresenter.onCheckComplete", "Rejecting incoming call from blocked number");
call.reject(false, null);
- Logger.get(mContext).logInteraction(InteractionEvent.Type.CALL_BLOCKED);
+ Logger.get(context).logInteraction(InteractionEvent.Type.CALL_BLOCKED);
/*
* If mContext is null, then the InCallPresenter was torn down before the
* block check had a chance to complete. The context is no longer valid, so
* don't attempt to remove the call log entry.
*/
- if (mContext == null) {
+ if (context == null) {
return;
}
// Register observer to update the call log.
// BlockedNumberContentObserver will unregister after successful log or timeout.
BlockedNumberContentObserver contentObserver =
- new BlockedNumberContentObserver(mContext, new Handler(), number, timeAdded);
+ new BlockedNumberContentObserver(context, new Handler(), number, timeAdded);
contentObserver.register();
}
}
};
- mFilteredQueryHandler.isBlockedNumber(onCheckBlockedListener, number, countryIso);
+ filteredQueryHandler.isBlockedNumber(onCheckBlockedListener, number, countryIso);
}
public void onCallRemoved(android.telecom.Call call) {
if (call.getDetails().hasProperty(CallCompat.Details.PROPERTY_IS_EXTERNAL_CALL)) {
- mExternalCallList.onCallRemoved(call);
+ externalCallList.onCallRemoved(call);
} else {
- mCallList.onCallRemoved(mContext, call);
- call.unregisterCallback(mCallCallback);
+ callList.onCallRemoved(context, call);
+ call.unregisterCallback(callCallback);
}
}
public void onCanAddCallChanged(boolean canAddCall) {
- for (CanAddCallListener listener : mCanAddCallListeners) {
+ for (CanAddCallListener listener : canAddCallListeners) {
listener.onCanAddCallChanged(canAddCall);
}
}
@Override
public void onWiFiToLteHandover(DialerCall call) {
- if (mInCallActivity != null) {
- mInCallActivity.showToastForWiFiToLteHandover(call);
+ if (inCallActivity != null) {
+ inCallActivity.showToastForWiFiToLteHandover(call);
}
}
@Override
public void onHandoverToWifiFailed(DialerCall call) {
- if (mInCallActivity != null) {
- mInCallActivity.showDialogOrToastForWifiHandoverFailure(call);
+ if (inCallActivity != null) {
+ inCallActivity.showDialogOrToastForWifiHandoverFailure(call);
}
}
@Override
public void onInternationalCallOnWifi(@NonNull DialerCall call) {
LogUtil.enterBlock("InCallPresenter.onInternationalCallOnWifi");
- if (mInCallActivity != null) {
- mInCallActivity.showDialogForInternationalCallOnWifi(call);
+ if (inCallActivity != null) {
+ inCallActivity.showDialogForInternationalCallOnWifi(call);
}
}
@@ -711,8 +711,8 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
@Override
public void onCallListChange(CallList callList) {
Trace.beginSection("InCallPresenter.onCallListChange");
- if (mInCallActivity != null && mInCallActivity.isInCallScreenAnimating()) {
- mAwaitingCallListUpdate = true;
+ if (inCallActivity != null && inCallActivity.isInCallScreenAnimating()) {
+ awaitingCallListUpdate = true;
Trace.endSection();
return;
}
@@ -721,10 +721,10 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
return;
}
- mAwaitingCallListUpdate = false;
+ awaitingCallListUpdate = false;
InCallState newState = getPotentialStateFromCallList(callList);
- InCallState oldState = mInCallState;
+ InCallState oldState = inCallState;
LogUtil.d(
"InCallPresenter.onCallListChange",
"onCallListChange oldState= " + oldState + " newState=" + newState);
@@ -740,7 +740,7 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
waitingForAccountCall.disconnect();
// The InCallActivity might be destroyed or not started yet at this point.
if (isActivityStarted()) {
- mInCallActivity.dismissPendingDialogs();
+ inCallActivity.dismissPendingDialogs();
}
}
@@ -752,20 +752,20 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
LogUtil.i(
"InCallPresenter.onCallListChange",
"Phone switching state: " + oldState + " -> " + newState);
- mInCallState = newState;
+ inCallState = newState;
// notify listeners of new state
- for (InCallStateListener listener : mListeners) {
+ for (InCallStateListener listener : listeners) {
LogUtil.d(
"InCallPresenter.onCallListChange",
- "Notify " + listener + " of state " + mInCallState.toString());
- listener.onStateChange(oldState, mInCallState, callList);
+ "Notify " + listener + " of state " + inCallState.toString());
+ listener.onStateChange(oldState, inCallState, callList);
}
if (isActivityStarted()) {
final boolean hasCall =
callList.getActiveOrBackgroundCall() != null || callList.getOutgoingCall() != null;
- mInCallActivity.dismissKeyguard(hasCall);
+ inCallActivity.dismissKeyguard(hasCall);
}
Trace.endSection();
}
@@ -775,22 +775,22 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
public void onIncomingCall(DialerCall call) {
Trace.beginSection("InCallPresenter.onIncomingCall");
InCallState newState = startOrFinishUi(InCallState.INCOMING);
- InCallState oldState = mInCallState;
+ InCallState oldState = inCallState;
LogUtil.i(
"InCallPresenter.onIncomingCall", "Phone switching state: " + oldState + " -> " + newState);
- mInCallState = newState;
+ inCallState = newState;
Trace.beginSection("listener.onIncomingCall");
- for (IncomingCallListener listener : mIncomingCallListeners) {
- listener.onIncomingCall(oldState, mInCallState, call);
+ for (IncomingCallListener listener : incomingCallListeners) {
+ listener.onIncomingCall(oldState, inCallState, call);
}
Trace.endSection();
Trace.beginSection("onPrimaryCallStateChanged");
- if (mInCallActivity != null) {
+ if (inCallActivity != null) {
// Re-evaluate which fragment is being shown.
- mInCallActivity.onPrimaryCallStateChanged();
+ inCallActivity.onPrimaryCallStateChanged();
}
Trace.endSection();
Trace.endSection();
@@ -799,16 +799,16 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
@Override
public void onUpgradeToVideo(DialerCall call) {
if (VideoUtils.hasReceivedVideoUpgradeRequest(call.getVideoTech().getSessionModificationState())
- && mInCallState == InCallPresenter.InCallState.INCOMING) {
+ && inCallState == InCallPresenter.InCallState.INCOMING) {
LogUtil.i(
"InCallPresenter.onUpgradeToVideo",
"rejecting upgrade request due to existing incoming call");
call.getVideoTech().declineVideoRequest();
}
- if (mInCallActivity != null) {
+ if (inCallActivity != null) {
// Re-evaluate which fragment is being shown.
- mInCallActivity.onPrimaryCallStateChanged();
+ inCallActivity.onPrimaryCallStateChanged();
}
}
@@ -816,15 +816,15 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
public void onSessionModificationStateChange(DialerCall call) {
int newState = call.getVideoTech().getSessionModificationState();
LogUtil.i("InCallPresenter.onSessionModificationStateChange", "state: %d", newState);
- if (mProximitySensor == null) {
+ if (proximitySensor == null) {
LogUtil.i("InCallPresenter.onSessionModificationStateChange", "proximitySensor is null");
return;
}
- mProximitySensor.setIsAttemptingVideoCall(
+ proximitySensor.setIsAttemptingVideoCall(
call.hasSentVideoUpgradeRequest() || call.hasReceivedVideoUpgradeRequest());
- if (mInCallActivity != null) {
+ if (inCallActivity != null) {
// Re-evaluate which fragment is being shown.
- mInCallActivity.onPrimaryCallStateChanged();
+ inCallActivity.onPrimaryCallStateChanged();
}
}
@@ -837,21 +837,21 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
showDialogOrToastForDisconnectedCall(call);
// We need to do the run the same code as onCallListChange.
- onCallListChange(mCallList);
+ onCallListChange(callList);
if (isActivityStarted()) {
- mInCallActivity.dismissKeyguard(false);
+ inCallActivity.dismissKeyguard(false);
}
if (call.isEmergencyCall()) {
- FilteredNumbersUtil.recordLastEmergencyCallTime(mContext);
+ FilteredNumbersUtil.recordLastEmergencyCallTime(context);
}
- if (!mCallList.hasLiveCall()
+ if (!callList.hasLiveCall()
&& !call.getLogState().isIncoming
&& !isSecretCode(call.getNumber())
&& !call.isVoiceMailNumber()) {
- PostCall.onCallDisconnected(mContext, call.getNumber(), call.getConnectTimeMillis());
+ PostCall.onCallDisconnected(context, call.getNumber(), call.getConnectTimeMillis());
}
}
@@ -884,7 +884,7 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
}
if (newState == InCallState.NO_CALLS) {
- if (mBoundAndWaitingForOutgoingCall) {
+ if (boundAndWaitingForOutgoingCall) {
return InCallState.PENDING_OUTGOING;
}
}
@@ -893,98 +893,98 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
}
public boolean isBoundAndWaitingForOutgoingCall() {
- return mBoundAndWaitingForOutgoingCall;
+ return boundAndWaitingForOutgoingCall;
}
public void setBoundAndWaitingForOutgoingCall(boolean isBound, PhoneAccountHandle handle) {
LogUtil.i(
"InCallPresenter.setBoundAndWaitingForOutgoingCall",
"setBoundAndWaitingForOutgoingCall: " + isBound);
- mBoundAndWaitingForOutgoingCall = isBound;
- mThemeColorManager.setPendingPhoneAccountHandle(handle);
- if (isBound && mInCallState == InCallState.NO_CALLS) {
- mInCallState = InCallState.PENDING_OUTGOING;
+ boundAndWaitingForOutgoingCall = isBound;
+ themeColorManager.setPendingPhoneAccountHandle(handle);
+ if (isBound && inCallState == InCallState.NO_CALLS) {
+ inCallState = InCallState.PENDING_OUTGOING;
}
}
public void onShrinkAnimationComplete() {
- if (mAwaitingCallListUpdate) {
- onCallListChange(mCallList);
+ if (awaitingCallListUpdate) {
+ onCallListChange(callList);
}
}
public void addIncomingCallListener(IncomingCallListener listener) {
Objects.requireNonNull(listener);
- mIncomingCallListeners.add(listener);
+ incomingCallListeners.add(listener);
}
public void removeIncomingCallListener(IncomingCallListener listener) {
if (listener != null) {
- mIncomingCallListeners.remove(listener);
+ incomingCallListeners.remove(listener);
}
}
public void addListener(InCallStateListener listener) {
Objects.requireNonNull(listener);
- mListeners.add(listener);
+ listeners.add(listener);
}
public void removeListener(InCallStateListener listener) {
if (listener != null) {
- mListeners.remove(listener);
+ listeners.remove(listener);
}
}
public void addDetailsListener(InCallDetailsListener listener) {
Objects.requireNonNull(listener);
- mDetailsListeners.add(listener);
+ detailsListeners.add(listener);
}
public void removeDetailsListener(InCallDetailsListener listener) {
if (listener != null) {
- mDetailsListeners.remove(listener);
+ detailsListeners.remove(listener);
}
}
public void addCanAddCallListener(CanAddCallListener listener) {
Objects.requireNonNull(listener);
- mCanAddCallListeners.add(listener);
+ canAddCallListeners.add(listener);
}
public void removeCanAddCallListener(CanAddCallListener listener) {
if (listener != null) {
- mCanAddCallListeners.remove(listener);
+ canAddCallListeners.remove(listener);
}
}
public void addOrientationListener(InCallOrientationListener listener) {
Objects.requireNonNull(listener);
- mOrientationListeners.add(listener);
+ orientationListeners.add(listener);
}
public void removeOrientationListener(InCallOrientationListener listener) {
if (listener != null) {
- mOrientationListeners.remove(listener);
+ orientationListeners.remove(listener);
}
}
public void addInCallEventListener(InCallEventListener listener) {
Objects.requireNonNull(listener);
- mInCallEventListeners.add(listener);
+ inCallEventListeners.add(listener);
}
public void removeInCallEventListener(InCallEventListener listener) {
if (listener != null) {
- mInCallEventListeners.remove(listener);
+ inCallEventListeners.remove(listener);
}
}
public ProximitySensor getProximitySensor() {
- return mProximitySensor;
+ return proximitySensor;
}
public PseudoScreenState getPseudoScreenState() {
- return mPseudoScreenState;
+ return pseudoScreenState;
}
/** Returns true if the incall app is the foreground application. */
@@ -992,10 +992,10 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
if (!isActivityStarted()) {
return false;
}
- if (mManageConferenceActivity != null && mManageConferenceActivity.isVisible()) {
+ if (manageConferenceActivity != null && manageConferenceActivity.isVisible()) {
return true;
}
- return mInCallActivity.isVisible();
+ return inCallActivity.isVisible();
}
/**
@@ -1004,9 +1004,9 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
* (not in foreground).
*/
public boolean isActivityStarted() {
- return (mInCallActivity != null
- && !mInCallActivity.isDestroyed()
- && !mInCallActivity.isFinishing());
+ return (inCallActivity != null
+ && !inCallActivity.isDestroyed()
+ && !inCallActivity.isFinishing());
}
/**
@@ -1015,7 +1015,7 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
* @return {@code true} if the In-Call app is changing configuration.
*/
public boolean isChangingConfigurations() {
- return mIsChangingConfigurations;
+ return isChangingConfigurations;
}
/**
@@ -1024,54 +1024,54 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
*/
/*package*/
void updateIsChangingConfigurations() {
- mIsChangingConfigurations = false;
- if (mInCallActivity != null) {
- mIsChangingConfigurations = mInCallActivity.isChangingConfigurations();
+ isChangingConfigurations = false;
+ if (inCallActivity != null) {
+ isChangingConfigurations = inCallActivity.isChangingConfigurations();
}
LogUtil.v(
"InCallPresenter.updateIsChangingConfigurations",
- "updateIsChangingConfigurations = " + mIsChangingConfigurations);
+ "updateIsChangingConfigurations = " + isChangingConfigurations);
}
/** Called when the activity goes in/out of the foreground. */
public void onUiShowing(boolean showing) {
// We need to update the notification bar when we leave the UI because that
// could trigger it to show again.
- if (mStatusBarNotifier != null) {
- mStatusBarNotifier.updateNotification();
+ if (statusBarNotifier != null) {
+ statusBarNotifier.updateNotification();
}
- if (mProximitySensor != null) {
- mProximitySensor.onInCallShowing(showing);
+ if (proximitySensor != null) {
+ proximitySensor.onInCallShowing(showing);
}
if (!showing) {
updateIsChangingConfigurations();
}
- for (InCallUiListener listener : mInCallUiListeners) {
+ for (InCallUiListener listener : inCallUiListeners) {
listener.onUiShowing(showing);
}
- if (mInCallActivity != null) {
+ if (inCallActivity != null) {
// Re-evaluate which fragment is being shown.
- mInCallActivity.onPrimaryCallStateChanged();
+ inCallActivity.onPrimaryCallStateChanged();
}
}
public void refreshUi() {
- if (mInCallActivity != null) {
+ if (inCallActivity != null) {
// Re-evaluate which fragment is being shown.
- mInCallActivity.onPrimaryCallStateChanged();
+ inCallActivity.onPrimaryCallStateChanged();
}
}
public void addInCallUiListener(InCallUiListener listener) {
- mInCallUiListeners.add(listener);
+ inCallUiListeners.add(listener);
}
public boolean removeInCallUiListener(InCallUiListener listener) {
- return mInCallUiListeners.remove(listener);
+ return inCallUiListeners.remove(listener);
}
/*package*/
@@ -1090,8 +1090,8 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
private void notifyVideoPauseController(boolean showing) {
LogUtil.d(
"InCallPresenter.notifyVideoPauseController",
- "mIsChangingConfigurations=" + mIsChangingConfigurations);
- if (!mIsChangingConfigurations) {
+ "mIsChangingConfigurations=" + isChangingConfigurations);
+ if (!isChangingConfigurations) {
VideoPauseController.getInstance().onUiShowing(showing);
}
}
@@ -1105,14 +1105,14 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
// If the activity hadn't actually been started previously, yet there are still calls
// present (e.g. a call was accepted by a bluetooth or wired headset), we want to
// bring it up the UI regardless.
- if (!isShowingInCallUi() && mInCallState != InCallState.NO_CALLS) {
+ if (!isShowingInCallUi() && inCallState != InCallState.NO_CALLS) {
showInCall(showDialpad, false /* newOutgoingCall */);
}
}
public void onPostDialCharWait(String callId, String chars) {
if (isActivityStarted()) {
- mInCallActivity.showDialogForPostCharWait(callId, chars);
+ inCallActivity.showDialogForPostCharWait(callId, chars);
}
}
@@ -1129,7 +1129,7 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
// of the Phone.
/** INCOMING CALL */
- final CallList calls = mCallList;
+ final CallList calls = callList;
final DialerCall incomingCall = calls.getIncomingCall();
LogUtil.v("InCallPresenter.handleCallKey", "incomingCall: " + incomingCall);
@@ -1185,7 +1185,7 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
/** Clears the previous fullscreen state. */
public void clearFullscreen() {
- mIsFullScreen = false;
+ isFullScreen = false;
}
/**
@@ -1216,12 +1216,12 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
"setFullScreen overridden as dialpad is shown = " + isFullScreen);
}
- if (mIsFullScreen == isFullScreen && !force) {
+ if (this.isFullScreen == isFullScreen && !force) {
LogUtil.v("InCallPresenter.setFullScreen", "setFullScreen ignored as already in that state.");
return;
}
- mIsFullScreen = isFullScreen;
- notifyFullscreenModeChange(mIsFullScreen);
+ this.isFullScreen = isFullScreen;
+ notifyFullscreenModeChange(this.isFullScreen);
}
/**
@@ -1229,7 +1229,7 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
* otherwise.
*/
public boolean isFullscreen() {
- return mIsFullScreen;
+ return isFullScreen;
}
/**
@@ -1238,7 +1238,7 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
* @param isFullscreenMode {@code True} if entering full screen mode.
*/
public void notifyFullscreenModeChange(boolean isFullscreenMode) {
- for (InCallEventListener listener : mInCallEventListeners) {
+ for (InCallEventListener listener : inCallEventListeners) {
listener.onFullscreenModeChanged(isFullscreenMode);
}
}
@@ -1254,8 +1254,8 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
setDisconnectCauseForMissingAccounts(call);
}
- mInCallActivity.showDialogOrToastForDisconnectedCall(
- new DisconnectMessage(mInCallActivity, call));
+ inCallActivity.showDialogOrToastForDisconnectedCall(
+ new DisconnectMessage(inCallActivity, call));
}
/**
@@ -1265,13 +1265,13 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
private InCallState startOrFinishUi(InCallState newState) {
Trace.beginSection("InCallPresenter.startOrFinishUi");
LogUtil.d(
- "InCallPresenter.startOrFinishUi", "startOrFinishUi: " + mInCallState + " -> " + newState);
+ "InCallPresenter.startOrFinishUi", "startOrFinishUi: " + inCallState + " -> " + newState);
// TODO: Consider a proper state machine implementation
// If the state isn't changing we have already done any starting/stopping of activities in
// a previous pass...so lets cut out early
- if (newState == mInCallState) {
+ if (newState == inCallState) {
Trace.endSection();
return newState;
}
@@ -1318,14 +1318,14 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
// This is different from the incoming call sequence because we do not need to shock the
// user with a top-level notification. Just show the call UI normally.
boolean callCardFragmentVisible =
- mInCallActivity != null && mInCallActivity.getCallCardFragmentVisible();
+ inCallActivity != null && inCallActivity.getCallCardFragmentVisible();
final boolean mainUiNotVisible = !isShowingInCallUi() || !callCardFragmentVisible;
boolean showCallUi = InCallState.OUTGOING == newState && mainUiNotVisible;
// Direct transition from PENDING_OUTGOING -> INCALL means that there was an error in the
// outgoing call process, so the UI should be brought up to show an error dialog.
showCallUi |=
- (InCallState.PENDING_OUTGOING == mInCallState
+ (InCallState.PENDING_OUTGOING == inCallState
&& InCallState.INCALL == newState
&& !isShowingInCallUi());
@@ -1340,19 +1340,19 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
showCallUi |=
InCallState.PENDING_OUTGOING == newState
&& mainUiNotVisible
- && isCallWithNoValidAccounts(mCallList.getPendingOutgoingCall());
+ && isCallWithNoValidAccounts(callList.getPendingOutgoingCall());
// The only time that we have an instance of mInCallActivity and it isn't started is
// when it is being destroyed. In that case, lets avoid bringing up another instance of
// the activity. When it is finally destroyed, we double check if we should bring it back
// up so we aren't going to lose anything by avoiding a second startup here.
- boolean activityIsFinishing = mInCallActivity != null && !isActivityStarted();
+ boolean activityIsFinishing = inCallActivity != null && !isActivityStarted();
if (activityIsFinishing) {
LogUtil.i(
"InCallPresenter.startOrFinishUi",
- "Undo the state change: " + newState + " -> " + mInCallState);
+ "Undo the state change: " + newState + " -> " + inCallState);
Trace.endSection();
- return mInCallState;
+ return inCallState;
}
// We're about the bring up the in-call UI for outgoing and incoming call. If we still have
@@ -1362,7 +1362,7 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
if ((newState == InCallState.INCOMING || newState == InCallState.PENDING_OUTGOING)
&& !showCallUi
&& isActivityStarted()) {
- mInCallActivity.dismissPendingDialogs();
+ inCallActivity.dismissPendingDialogs();
}
if (showCallUi || showAccountPicker) {
@@ -1371,7 +1371,7 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
} else if (startIncomingCallSequence) {
LogUtil.i("InCallPresenter.startOrFinishUi", "Start Full Screen in call UI");
- mStatusBarNotifier.updateNotification();
+ statusBarNotifier.updateNotification();
} else if (newState == InCallState.NO_CALLS) {
// The new state is the no calls state. Tear everything down.
attemptFinishActivity();
@@ -1401,8 +1401,8 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
String scheme = call.getHandle().getScheme();
final String errorMsg =
PhoneAccount.SCHEME_TEL.equals(scheme)
- ? mContext.getString(R.string.callFailed_simError)
- : mContext.getString(R.string.incall_error_supp_service_unknown);
+ ? context.getString(R.string.callFailed_simError)
+ : context.getString(R.string.incall_error_supp_service_unknown);
DisconnectCause disconnectCause =
new DisconnectCause(DisconnectCause.ERROR, null, errorMsg, errorMsg);
call.setDisconnectCause(disconnectCause);
@@ -1415,7 +1415,7 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
* InCallPresenter or not.
*/
public boolean isReadyForTearDown() {
- return mInCallActivity == null && !mServiceConnected && mInCallState == InCallState.NO_CALLS;
+ return inCallActivity == null && !serviceConnected && inCallState == InCallState.NO_CALLS;
}
/**
@@ -1427,53 +1427,53 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
cleanupSurfaces();
- mIsChangingConfigurations = false;
+ isChangingConfigurations = false;
// blow away stale contact info so that we get fresh data on
// the next set of calls
- if (mContactInfoCache != null) {
- mContactInfoCache.clearCache();
+ if (contactInfoCache != null) {
+ contactInfoCache.clearCache();
}
- mContactInfoCache = null;
+ contactInfoCache = null;
- if (mProximitySensor != null) {
- removeListener(mProximitySensor);
- mProximitySensor.tearDown();
+ if (proximitySensor != null) {
+ removeListener(proximitySensor);
+ proximitySensor.tearDown();
}
- mProximitySensor = null;
+ proximitySensor = null;
- if (mStatusBarNotifier != null) {
- removeListener(mStatusBarNotifier);
- EnrichedCallComponent.get(mContext)
+ if (statusBarNotifier != null) {
+ removeListener(statusBarNotifier);
+ EnrichedCallComponent.get(context)
.getEnrichedCallManager()
- .unregisterStateChangedListener(mStatusBarNotifier);
+ .unregisterStateChangedListener(statusBarNotifier);
}
- if (mExternalCallNotifier != null && mExternalCallList != null) {
- mExternalCallList.removeExternalCallListener(mExternalCallNotifier);
+ if (externalCallNotifier != null && externalCallList != null) {
+ externalCallList.removeExternalCallListener(externalCallNotifier);
}
- mStatusBarNotifier = null;
+ statusBarNotifier = null;
- if (mCallList != null) {
- mCallList.removeListener(this);
- mCallList.removeListener(mSpamCallListListener);
+ if (callList != null) {
+ callList.removeListener(this);
+ callList.removeListener(spamCallListListener);
}
- mCallList = null;
-
- mContext = null;
- mInCallActivity = null;
- mManageConferenceActivity = null;
-
- mListeners.clear();
- mIncomingCallListeners.clear();
- mDetailsListeners.clear();
- mCanAddCallListeners.clear();
- mOrientationListeners.clear();
- mInCallEventListeners.clear();
- mInCallUiListeners.clear();
- if (!mInCallUiLocks.isEmpty()) {
- LogUtil.e("InCallPresenter.attemptCleanup", "held in call locks: " + mInCallUiLocks);
- mInCallUiLocks.clear();
+ callList = null;
+
+ context = null;
+ inCallActivity = null;
+ manageConferenceActivity = null;
+
+ listeners.clear();
+ incomingCallListeners.clear();
+ detailsListeners.clear();
+ canAddCallListeners.clear();
+ orientationListeners.clear();
+ inCallEventListeners.clear();
+ inCallUiListeners.clear();
+ if (!inCallUiLocks.isEmpty()) {
+ LogUtil.e("InCallPresenter.attemptCleanup", "held in call locks: " + inCallUiLocks);
+ inCallUiLocks.clear();
}
LogUtil.d("InCallPresenter.attemptCleanup", "finished");
}
@@ -1481,26 +1481,25 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
public void showInCall(boolean showDialpad, boolean newOutgoingCall) {
LogUtil.i("InCallPresenter.showInCall", "Showing InCallActivity");
- mContext.startActivity(
- InCallActivity.getIntent(
- mContext, showDialpad, newOutgoingCall, false /* forFullScreen */));
+ context.startActivity(
+ InCallActivity.getIntent(context, showDialpad, newOutgoingCall, false /* forFullScreen */));
}
public void onServiceBind() {
- mServiceBound = true;
+ serviceBound = true;
}
public void onServiceUnbind() {
InCallPresenter.getInstance().setBoundAndWaitingForOutgoingCall(false, null);
- mServiceBound = false;
+ serviceBound = false;
}
public boolean isServiceBound() {
- return mServiceBound;
+ return serviceBound;
}
public void maybeStartRevealAnimation(Intent intent) {
- if (intent == null || mInCallActivity != null) {
+ if (intent == null || inCallActivity != null) {
return;
}
final Bundle extras = intent.getBundleExtra(TelecomManager.EXTRA_OUTGOING_CALL_EXTRAS);
@@ -1521,9 +1520,9 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
InCallPresenter.getInstance().setBoundAndWaitingForOutgoingCall(true, accountHandle);
final Intent activityIntent =
- InCallActivity.getIntent(mContext, false, true, false /* forFullScreen */);
+ InCallActivity.getIntent(context, false, true, false /* forFullScreen */);
activityIntent.putExtra(TouchPointManager.TOUCH_POINT, touchPoint);
- mContext.startActivity(activityIntent);
+ context.startActivity(activityIntent);
}
/**
@@ -1533,11 +1532,11 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
*/
public InCallCameraManager getInCallCameraManager() {
synchronized (this) {
- if (mInCallCameraManager == null) {
- mInCallCameraManager = new InCallCameraManager(mContext);
+ if (inCallCameraManager == null) {
+ inCallCameraManager = new InCallCameraManager(context);
}
- return mInCallCameraManager;
+ return inCallCameraManager;
}
}
@@ -1555,14 +1554,14 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
"InCallPresenter.onDeviceOrientationChange",
"onDeviceOrientationChange: orientation= " + orientation);
- if (mCallList != null) {
- mCallList.notifyCallsOfDeviceRotation(orientation);
+ if (callList != null) {
+ callList.notifyCallsOfDeviceRotation(orientation);
} else {
LogUtil.w("InCallPresenter.onDeviceOrientationChange", "CallList is null.");
}
// Notify listeners of device orientation changed.
- for (InCallOrientationListener listener : mOrientationListeners) {
+ for (InCallOrientationListener listener : orientationListeners) {
listener.onDeviceOrientationChanged(orientation);
}
}
@@ -1575,29 +1574,29 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
* landscape. {@code false} if the in-call UI should be locked in portrait.
*/
public void setInCallAllowsOrientationChange(boolean allowOrientationChange) {
- if (mInCallActivity == null) {
+ if (inCallActivity == null) {
LogUtil.e(
"InCallPresenter.setInCallAllowsOrientationChange",
"InCallActivity is null. Can't set requested orientation.");
return;
}
- mInCallActivity.setAllowOrientationChange(allowOrientationChange);
+ inCallActivity.setAllowOrientationChange(allowOrientationChange);
}
public void enableScreenTimeout(boolean enable) {
LogUtil.v("InCallPresenter.enableScreenTimeout", "enableScreenTimeout: value=" + enable);
- mScreenTimeoutEnabled = enable;
+ screenTimeoutEnabled = enable;
applyScreenTimeout();
}
private void applyScreenTimeout() {
- if (mInCallActivity == null) {
+ if (inCallActivity == null) {
LogUtil.e("InCallPresenter.applyScreenTimeout", "InCallActivity is null.");
return;
}
- final Window window = mInCallActivity.getWindow();
- if (mScreenTimeoutEnabled) {
+ final Window window = inCallActivity.getWindow();
+ if (screenTimeoutEnabled) {
window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
} else {
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
@@ -1611,11 +1610,11 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
* be hidden.
*/
public void showConferenceCallManager(boolean show) {
- if (mInCallActivity != null) {
- mInCallActivity.showConferenceFragment(show);
+ if (inCallActivity != null) {
+ inCallActivity.showConferenceFragment(show);
}
- if (!show && mManageConferenceActivity != null) {
- mManageConferenceActivity.finish();
+ if (!show && manageConferenceActivity != null) {
+ manageConferenceActivity.finish();
}
}
@@ -1625,31 +1624,31 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
* @return {@code true} if the dialpad is visible, {@code false} otherwise.
*/
public boolean isDialpadVisible() {
- if (mInCallActivity == null) {
+ if (inCallActivity == null) {
return false;
}
- return mInCallActivity.isDialpadVisible();
+ return inCallActivity.isDialpadVisible();
}
public ThemeColorManager getThemeColorManager() {
- return mThemeColorManager;
+ return themeColorManager;
}
@VisibleForTesting
public void setThemeColorManager(ThemeColorManager themeColorManager) {
- mThemeColorManager = themeColorManager;
+ this.themeColorManager = themeColorManager;
}
/** Called when the foreground call changes. */
public void onForegroundCallChanged(DialerCall newForegroundCall) {
- mThemeColorManager.onForegroundCallChanged(mContext, newForegroundCall);
- if (mInCallActivity != null) {
- mInCallActivity.onForegroundCallChanged(newForegroundCall);
+ themeColorManager.onForegroundCallChanged(context, newForegroundCall);
+ if (inCallActivity != null) {
+ inCallActivity.onForegroundCallChanged(newForegroundCall);
}
}
public InCallActivity getActivity() {
- return mInCallActivity;
+ return inCallActivity;
}
/** Called when the UI begins, and starts the callstate callbacks if necessary. */
@@ -1657,7 +1656,7 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
if (inCallActivity == null) {
throw new IllegalArgumentException("registerActivity cannot be called with null");
}
- if (mInCallActivity != null && mInCallActivity != inCallActivity) {
+ if (this.inCallActivity != null && this.inCallActivity != inCallActivity) {
LogUtil.w(
"InCallPresenter.setActivity", "Setting a second activity before destroying the first.");
}
@@ -1665,47 +1664,46 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
}
ExternalCallNotifier getExternalCallNotifier() {
- return mExternalCallNotifier;
+ return externalCallNotifier;
}
VideoSurfaceTexture getLocalVideoSurfaceTexture() {
- if (mLocalVideoSurfaceTexture == null) {
+ if (localVideoSurfaceTexture == null) {
boolean isPixel2017 = false;
- if (mContext != null) {
- isPixel2017 = mContext.getPackageManager().hasSystemFeature(PIXEL2017_SYSTEM_FEATURE);
+ if (context != null) {
+ isPixel2017 = context.getPackageManager().hasSystemFeature(PIXEL2017_SYSTEM_FEATURE);
}
- mLocalVideoSurfaceTexture = VideoSurfaceBindings.createLocalVideoSurfaceTexture(isPixel2017);
+ localVideoSurfaceTexture = VideoSurfaceBindings.createLocalVideoSurfaceTexture(isPixel2017);
}
- return mLocalVideoSurfaceTexture;
+ return localVideoSurfaceTexture;
}
VideoSurfaceTexture getRemoteVideoSurfaceTexture() {
- if (mRemoteVideoSurfaceTexture == null) {
+ if (remoteVideoSurfaceTexture == null) {
boolean isPixel2017 = false;
- if (mContext != null) {
- isPixel2017 = mContext.getPackageManager().hasSystemFeature(PIXEL2017_SYSTEM_FEATURE);
+ if (context != null) {
+ isPixel2017 = context.getPackageManager().hasSystemFeature(PIXEL2017_SYSTEM_FEATURE);
}
- mRemoteVideoSurfaceTexture =
- VideoSurfaceBindings.createRemoteVideoSurfaceTexture(isPixel2017);
+ remoteVideoSurfaceTexture = VideoSurfaceBindings.createRemoteVideoSurfaceTexture(isPixel2017);
}
- return mRemoteVideoSurfaceTexture;
+ return remoteVideoSurfaceTexture;
}
void cleanupSurfaces() {
- if (mRemoteVideoSurfaceTexture != null) {
- mRemoteVideoSurfaceTexture.setDoneWithSurface();
- mRemoteVideoSurfaceTexture = null;
+ if (remoteVideoSurfaceTexture != null) {
+ remoteVideoSurfaceTexture.setDoneWithSurface();
+ remoteVideoSurfaceTexture = null;
}
- if (mLocalVideoSurfaceTexture != null) {
- mLocalVideoSurfaceTexture.setDoneWithSurface();
- mLocalVideoSurfaceTexture = null;
+ if (localVideoSurfaceTexture != null) {
+ localVideoSurfaceTexture.setDoneWithSurface();
+ localVideoSurfaceTexture = null;
}
}
@Override
public void onAudioStateChanged(CallAudioState audioState) {
- if (mStatusBarNotifier != null) {
- mStatusBarNotifier.updateNotification();
+ if (statusBarNotifier != null) {
+ statusBarNotifier.updateNotification();
}
}
@@ -1804,7 +1802,7 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
public InCallUiLock acquireInCallUiLock(String tag) {
Assert.isMainThread();
InCallUiLock lock = new InCallUiLockImpl(tag);
- mInCallUiLocks.add(lock);
+ inCallUiLocks.add(lock);
return lock;
}
@@ -1812,10 +1810,10 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
private void releaseInCallUiLock(InCallUiLock lock) {
Assert.isMainThread();
LogUtil.i("InCallPresenter.releaseInCallUiLock", "releasing %s", lock);
- mInCallUiLocks.remove(lock);
- if (mInCallUiLocks.isEmpty()) {
+ inCallUiLocks.remove(lock);
+ if (inCallUiLocks.isEmpty()) {
LogUtil.i("InCallPresenter.releaseInCallUiLock", "all locks released");
- if (mInCallState == InCallState.NO_CALLS) {
+ if (inCallState == InCallState.NO_CALLS) {
LogUtil.i("InCallPresenter.releaseInCallUiLock", "no more calls, finishing UI");
attemptFinishActivity();
attemptCleanup();
@@ -1826,14 +1824,14 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud
@MainThread
public boolean isInCallUiLocked() {
Assert.isMainThread();
- if (mInCallUiLocks.isEmpty()) {
+ if (inCallUiLocks.isEmpty()) {
return false;
}
- for (InCallUiLock lock : mInCallUiLocks) {
+ for (InCallUiLock lock : inCallUiLocks) {
LogUtil.i("InCallPresenter.isInCallUiLocked", "still locked by %s", lock);
}
return true;
}
- private final Set<InCallUiLock> mInCallUiLocks = new ArraySet<>();
+ private final Set<InCallUiLock> inCallUiLocks = new ArraySet<>();
}
diff --git a/java/com/android/incallui/InCallUIMaterialColorMapUtils.java b/java/com/android/incallui/InCallUIMaterialColorMapUtils.java
index 7b06a5e39..945e9fb5a 100644
--- a/java/com/android/incallui/InCallUIMaterialColorMapUtils.java
+++ b/java/com/android/incallui/InCallUIMaterialColorMapUtils.java
@@ -23,15 +23,15 @@ import com.android.contacts.common.util.MaterialColorMapUtils;
public class InCallUIMaterialColorMapUtils extends MaterialColorMapUtils {
- private final TypedArray mPrimaryColors;
- private final TypedArray mSecondaryColors;
- private final Resources mResources;
+ private final TypedArray primaryColors;
+ private final TypedArray secondaryColors;
+ private final Resources resources;
public InCallUIMaterialColorMapUtils(Resources resources) {
super(resources);
- mPrimaryColors = resources.obtainTypedArray(R.array.background_colors);
- mSecondaryColors = resources.obtainTypedArray(R.array.background_colors_dark);
- mResources = resources;
+ primaryColors = resources.obtainTypedArray(R.array.background_colors);
+ secondaryColors = resources.obtainTypedArray(R.array.background_colors_dark);
+ this.resources = resources;
}
/**
@@ -52,12 +52,12 @@ public class InCallUIMaterialColorMapUtils extends MaterialColorMapUtils {
@Override
public MaterialPalette calculatePrimaryAndSecondaryColor(int color) {
if (color == PhoneAccount.NO_HIGHLIGHT_COLOR) {
- return getDefaultPrimaryAndSecondaryColors(mResources);
+ return getDefaultPrimaryAndSecondaryColors(resources);
}
- for (int i = 0; i < mPrimaryColors.length(); i++) {
- if (mPrimaryColors.getColor(i, 0) == color) {
- return new MaterialPalette(mPrimaryColors.getColor(i, 0), mSecondaryColors.getColor(i, 0));
+ for (int i = 0; i < primaryColors.length(); i++) {
+ if (primaryColors.getColor(i, 0) == color) {
+ return new MaterialPalette(primaryColors.getColor(i, 0), secondaryColors.getColor(i, 0));
}
}
diff --git a/java/com/android/incallui/PostCharDialogFragment.java b/java/com/android/incallui/PostCharDialogFragment.java
index a852f7683..4bcc68e33 100644
--- a/java/com/android/incallui/PostCharDialogFragment.java
+++ b/java/com/android/incallui/PostCharDialogFragment.java
@@ -32,28 +32,28 @@ public class PostCharDialogFragment extends DialogFragment {
private static final String STATE_CALL_ID = "CALL_ID";
private static final String STATE_POST_CHARS = "POST_CHARS";
- private String mCallId;
- private String mPostDialStr;
+ private String callId;
+ private String postDialStr;
public PostCharDialogFragment() {}
public PostCharDialogFragment(String callId, String postDialStr) {
- mCallId = callId;
- mPostDialStr = postDialStr;
+ this.callId = callId;
+ this.postDialStr = postDialStr;
}
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
super.onCreateDialog(savedInstanceState);
- if (mPostDialStr == null && savedInstanceState != null) {
- mCallId = savedInstanceState.getString(STATE_CALL_ID);
- mPostDialStr = savedInstanceState.getString(STATE_POST_CHARS);
+ if (postDialStr == null && savedInstanceState != null) {
+ callId = savedInstanceState.getString(STATE_CALL_ID);
+ postDialStr = savedInstanceState.getString(STATE_POST_CHARS);
}
final StringBuilder buf = new StringBuilder();
buf.append(getResources().getText(R.string.wait_prompt_str));
- buf.append(mPostDialStr);
+ buf.append(postDialStr);
final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setMessage(buf.toString());
@@ -63,7 +63,7 @@ public class PostCharDialogFragment extends DialogFragment {
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int whichButton) {
- TelecomAdapter.getInstance().postDialContinue(mCallId, true);
+ TelecomAdapter.getInstance().postDialContinue(callId, true);
}
});
builder.setNegativeButton(
@@ -83,14 +83,14 @@ public class PostCharDialogFragment extends DialogFragment {
public void onCancel(DialogInterface dialog) {
super.onCancel(dialog);
- TelecomAdapter.getInstance().postDialContinue(mCallId, false);
+ TelecomAdapter.getInstance().postDialContinue(callId, false);
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
- outState.putString(STATE_CALL_ID, mCallId);
- outState.putString(STATE_POST_CHARS, mPostDialStr);
+ outState.putString(STATE_CALL_ID, callId);
+ outState.putString(STATE_POST_CHARS, postDialStr);
}
}
diff --git a/java/com/android/incallui/ProximitySensor.java b/java/com/android/incallui/ProximitySensor.java
index 123ca539f..f82b75d06 100644
--- a/java/com/android/incallui/ProximitySensor.java
+++ b/java/com/android/incallui/ProximitySensor.java
@@ -44,49 +44,49 @@ public class ProximitySensor
private static final String TAG = ProximitySensor.class.getSimpleName();
- private final PowerManager mPowerManager;
- private final PowerManager.WakeLock mProximityWakeLock;
- private final AudioModeProvider mAudioModeProvider;
- private final AccelerometerListener mAccelerometerListener;
- private final ProximityDisplayListener mDisplayListener;
- private int mOrientation = AccelerometerListener.ORIENTATION_UNKNOWN;
- private boolean mUiShowing = false;
- private boolean mIsPhoneOffhook = false;
- private boolean mDialpadVisible;
- private boolean mIsAttemptingVideoCall;
- private boolean mIsVideoCall;
+ private final PowerManager powerManager;
+ private final PowerManager.WakeLock proximityWakeLock;
+ private final AudioModeProvider audioModeProvider;
+ private final AccelerometerListener accelerometerListener;
+ private final ProximityDisplayListener displayListener;
+ private int orientation = AccelerometerListener.ORIENTATION_UNKNOWN;
+ private boolean uiShowing = false;
+ private boolean isPhoneOffhook = false;
+ private boolean dialpadVisible;
+ private boolean isAttemptingVideoCall;
+ private boolean isVideoCall;
public ProximitySensor(
@NonNull Context context,
@NonNull AudioModeProvider audioModeProvider,
@NonNull AccelerometerListener accelerometerListener) {
Trace.beginSection("ProximitySensor.Constructor");
- mPowerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
- if (mPowerManager.isWakeLockLevelSupported(PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK)) {
- mProximityWakeLock =
- mPowerManager.newWakeLock(PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK, TAG);
+ powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
+ if (powerManager.isWakeLockLevelSupported(PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK)) {
+ proximityWakeLock =
+ powerManager.newWakeLock(PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK, TAG);
} else {
LogUtil.i("ProximitySensor.constructor", "Device does not support proximity wake lock.");
- mProximityWakeLock = null;
+ proximityWakeLock = null;
}
- mAccelerometerListener = accelerometerListener;
- mAccelerometerListener.setListener(this);
+ this.accelerometerListener = accelerometerListener;
+ this.accelerometerListener.setListener(this);
- mDisplayListener =
+ displayListener =
new ProximityDisplayListener(
(DisplayManager) context.getSystemService(Context.DISPLAY_SERVICE));
- mDisplayListener.register();
+ displayListener.register();
- mAudioModeProvider = audioModeProvider;
- mAudioModeProvider.addListener(this);
+ this.audioModeProvider = audioModeProvider;
+ this.audioModeProvider.addListener(this);
Trace.endSection();
}
public void tearDown() {
- mAudioModeProvider.removeListener(this);
+ audioModeProvider.removeListener(this);
- mAccelerometerListener.enable(false);
- mDisplayListener.unregister();
+ accelerometerListener.enable(false);
+ displayListener.unregister();
turnOffProximitySensor(true);
}
@@ -94,7 +94,7 @@ public class ProximitySensor
/** Called to identify when the device is laid down flat. */
@Override
public void orientationChanged(int orientation) {
- mOrientation = orientation;
+ this.orientation = orientation;
updateProximitySensorMode();
}
@@ -113,12 +113,12 @@ public class ProximitySensor
DialerCall activeCall = callList.getActiveCall();
boolean isVideoCall = activeCall != null && activeCall.isVideoCall();
- if (isOffhook != mIsPhoneOffhook || mIsVideoCall != isVideoCall) {
- mIsPhoneOffhook = isOffhook;
- mIsVideoCall = isVideoCall;
+ if (isOffhook != isPhoneOffhook || this.isVideoCall != isVideoCall) {
+ isPhoneOffhook = isOffhook;
+ this.isVideoCall = isVideoCall;
- mOrientation = AccelerometerListener.ORIENTATION_UNKNOWN;
- mAccelerometerListener.enable(mIsPhoneOffhook);
+ orientation = AccelerometerListener.ORIENTATION_UNKNOWN;
+ accelerometerListener.enable(isPhoneOffhook);
updateProximitySensorMode();
}
@@ -130,7 +130,7 @@ public class ProximitySensor
}
public void onDialpadVisible(boolean visible) {
- mDialpadVisible = visible;
+ dialpadVisible = visible;
updateProximitySensorMode();
}
@@ -139,25 +139,25 @@ public class ProximitySensor
"ProximitySensor.setIsAttemptingVideoCall",
"isAttemptingVideoCall: %b",
isAttemptingVideoCall);
- mIsAttemptingVideoCall = isAttemptingVideoCall;
+ this.isAttemptingVideoCall = isAttemptingVideoCall;
updateProximitySensorMode();
}
/** Used to save when the UI goes in and out of the foreground. */
public void onInCallShowing(boolean showing) {
if (showing) {
- mUiShowing = true;
+ uiShowing = true;
// We only consider the UI not showing for instances where another app took the foreground.
// If we stopped showing because the screen is off, we still consider that showing.
- } else if (mPowerManager.isScreenOn()) {
- mUiShowing = false;
+ } else if (powerManager.isScreenOn()) {
+ uiShowing = false;
}
updateProximitySensorMode();
}
void onDisplayStateChanged(boolean isDisplayOn) {
LogUtil.i("ProximitySensor.onDisplayStateChanged", "isDisplayOn: %b", isDisplayOn);
- mAccelerometerListener.enable(isDisplayOn);
+ accelerometerListener.enable(isDisplayOn);
}
/**
@@ -167,14 +167,14 @@ public class ProximitySensor
* replaced with the ProximityDisplayListener.
*/
public boolean isScreenReallyOff() {
- return !mPowerManager.isScreenOn();
+ return !powerManager.isScreenOn();
}
private void turnOnProximitySensor() {
- if (mProximityWakeLock != null) {
- if (!mProximityWakeLock.isHeld()) {
+ if (proximityWakeLock != null) {
+ if (!proximityWakeLock.isHeld()) {
LogUtil.i("ProximitySensor.turnOnProximitySensor", "acquiring wake lock");
- mProximityWakeLock.acquire();
+ proximityWakeLock.acquire();
} else {
LogUtil.i("ProximitySensor.turnOnProximitySensor", "wake lock already acquired");
}
@@ -182,11 +182,11 @@ public class ProximitySensor
}
private void turnOffProximitySensor(boolean screenOnImmediately) {
- if (mProximityWakeLock != null) {
- if (mProximityWakeLock.isHeld()) {
+ if (proximityWakeLock != null) {
+ if (proximityWakeLock.isHeld()) {
LogUtil.i("ProximitySensor.turnOffProximitySensor", "releasing wake lock");
int flags = (screenOnImmediately ? 0 : PowerManager.RELEASE_FLAG_WAIT_FOR_NO_PROXIMITY);
- mProximityWakeLock.release(flags);
+ proximityWakeLock.release(flags);
} else {
LogUtil.i("ProximitySensor.turnOffProximitySensor", "wake lock already released");
}
@@ -210,39 +210,39 @@ public class ProximitySensor
*/
private synchronized void updateProximitySensorMode() {
Trace.beginSection("ProximitySensor.updateProximitySensorMode");
- final int audioRoute = mAudioModeProvider.getAudioState().getRoute();
+ final int audioRoute = audioModeProvider.getAudioState().getRoute();
boolean screenOnImmediately =
(CallAudioState.ROUTE_WIRED_HEADSET == audioRoute
|| CallAudioState.ROUTE_SPEAKER == audioRoute
|| CallAudioState.ROUTE_BLUETOOTH == audioRoute
- || mIsAttemptingVideoCall
- || mIsVideoCall);
+ || isAttemptingVideoCall
+ || isVideoCall);
// We do not keep the screen off when the user is outside in-call screen and we are
// horizontal, but we do not force it on when we become horizontal until the
// proximity sensor goes negative.
- final boolean horizontal = (mOrientation == AccelerometerListener.ORIENTATION_HORIZONTAL);
- screenOnImmediately |= !mUiShowing && horizontal;
+ final boolean horizontal = (orientation == AccelerometerListener.ORIENTATION_HORIZONTAL);
+ screenOnImmediately |= !uiShowing && horizontal;
// We do not keep the screen off when dialpad is visible, we are horizontal, and
// the in-call screen is being shown.
// At that moment we're pretty sure users want to use it, instead of letting the
// proximity sensor turn off the screen by their hands.
- screenOnImmediately |= mDialpadVisible && horizontal;
+ screenOnImmediately |= dialpadVisible && horizontal;
LogUtil.i(
"ProximitySensor.updateProximitySensorMode",
"screenOnImmediately: %b, dialPadVisible: %b, "
+ "offHook: %b, horizontal: %b, uiShowing: %b, audioRoute: %s",
screenOnImmediately,
- mDialpadVisible,
- mIsPhoneOffhook,
- mOrientation == AccelerometerListener.ORIENTATION_HORIZONTAL,
- mUiShowing,
+ dialpadVisible,
+ isPhoneOffhook,
+ orientation == AccelerometerListener.ORIENTATION_HORIZONTAL,
+ uiShowing,
CallAudioState.audioRouteToString(audioRoute));
- if (mIsPhoneOffhook && !screenOnImmediately) {
+ if (isPhoneOffhook && !screenOnImmediately) {
LogUtil.v("ProximitySensor.updateProximitySensorMode", "turning on proximity sensor");
// Phone is in use! Arrange for the screen to turn off
// automatically when the sensor detects a close object.
@@ -263,19 +263,19 @@ public class ProximitySensor
*/
public class ProximityDisplayListener implements DisplayListener {
- private DisplayManager mDisplayManager;
- private boolean mIsDisplayOn = true;
+ private DisplayManager displayManager;
+ private boolean isDisplayOn = true;
ProximityDisplayListener(DisplayManager displayManager) {
- mDisplayManager = displayManager;
+ this.displayManager = displayManager;
}
void register() {
- mDisplayManager.registerDisplayListener(this, null);
+ displayManager.registerDisplayListener(this, null);
}
void unregister() {
- mDisplayManager.unregisterDisplayListener(this);
+ displayManager.unregisterDisplayListener(this);
}
@Override
@@ -284,14 +284,14 @@ public class ProximitySensor
@Override
public void onDisplayChanged(int displayId) {
if (displayId == Display.DEFAULT_DISPLAY) {
- final Display display = mDisplayManager.getDisplay(displayId);
+ final Display display = displayManager.getDisplay(displayId);
final boolean isDisplayOn = display.getState() != Display.STATE_OFF;
// For call purposes, we assume that as long as the screen is not truly off, it is
// considered on, even if it is in an unknown or low power idle state.
- if (isDisplayOn != mIsDisplayOn) {
- mIsDisplayOn = isDisplayOn;
- onDisplayStateChanged(mIsDisplayOn);
+ if (isDisplayOn != this.isDisplayOn) {
+ this.isDisplayOn = isDisplayOn;
+ onDisplayStateChanged(this.isDisplayOn);
}
}
}
diff --git a/java/com/android/incallui/StatusBarNotifier.java b/java/com/android/incallui/StatusBarNotifier.java
index 4da858fff..960fd14df 100644
--- a/java/com/android/incallui/StatusBarNotifier.java
+++ b/java/com/android/incallui/StatusBarNotifier.java
@@ -112,31 +112,31 @@ public class StatusBarNotifier
private static final long[] VIBRATE_PATTERN = new long[] {0, 1000, 1000};
- private final Context mContext;
- private final ContactInfoCache mContactInfoCache;
- private final DialerRingtoneManager mDialerRingtoneManager;
- @Nullable private ContactsPreferences mContactsPreferences;
- private int mCurrentNotification = NOTIFICATION_NONE;
- private int mCallState = DialerCall.State.INVALID;
- private int mVideoState = VideoProfile.STATE_AUDIO_ONLY;
- private int mSavedIcon = 0;
- private String mSavedContent = null;
- private Bitmap mSavedLargeIcon;
- private String mSavedContentTitle;
+ private final Context context;
+ private final ContactInfoCache contactInfoCache;
+ private final DialerRingtoneManager dialerRingtoneManager;
+ @Nullable private ContactsPreferences contactsPreferences;
+ private int currentNotification = NOTIFICATION_NONE;
+ private int callState = DialerCall.State.INVALID;
+ private int videoState = VideoProfile.STATE_AUDIO_ONLY;
+ private int savedIcon = 0;
+ private String savedContent = null;
+ private Bitmap savedLargeIcon;
+ private String savedContentTitle;
private CallAudioState savedCallAudioState;
- private Uri mRingtone;
- private StatusBarCallListener mStatusBarCallListener;
+ private Uri ringtone;
+ private StatusBarCallListener statusBarCallListener;
public StatusBarNotifier(@NonNull Context context, @NonNull ContactInfoCache contactInfoCache) {
Trace.beginSection("StatusBarNotifier.Constructor");
- mContext = Assert.isNotNull(context);
- mContactsPreferences = ContactsPreferencesFactory.newContactsPreferences(mContext);
- mContactInfoCache = contactInfoCache;
- mDialerRingtoneManager =
+ this.context = Assert.isNotNull(context);
+ contactsPreferences = ContactsPreferencesFactory.newContactsPreferences(this.context);
+ this.contactInfoCache = contactInfoCache;
+ dialerRingtoneManager =
new DialerRingtoneManager(
new InCallTonePlayer(new ToneGeneratorFactory(), new PausableExecutorImpl()),
CallList.getInstance());
- mCurrentNotification = NOTIFICATION_NONE;
+ currentNotification = NOTIFICATION_NONE;
Trace.endSection();
}
@@ -213,12 +213,12 @@ public class StatusBarNotifier
* @see #updateInCallNotification()
*/
private void cancelNotification() {
- if (mStatusBarCallListener != null) {
+ if (statusBarCallListener != null) {
setStatusBarCallListener(null);
}
- if (mCurrentNotification != NOTIFICATION_NONE) {
+ if (currentNotification != NOTIFICATION_NONE) {
TelecomAdapter.getInstance().stopForegroundNotification();
- mCurrentNotification = NOTIFICATION_NONE;
+ currentNotification = NOTIFICATION_NONE;
}
}
@@ -253,7 +253,7 @@ public class StatusBarNotifier
// This callback will always get called immediately and synchronously with whatever data
// it has available, and may make a subsequent call later (same thread) if it had to
// call into the contacts provider for more data.
- mContactInfoCache.findInfo(call, isIncoming, this);
+ contactInfoCache.findInfo(call, isIncoming, this);
Trace.endSection();
}
@@ -278,7 +278,7 @@ public class StatusBarNotifier
Trace.beginSection("read icon and strings");
// Check if data has changed; if nothing is different, don't issue another notification.
final int iconResId = getIconToDisplay(call);
- Bitmap largeIcon = getLargeIconToDisplay(mContext, contactInfo, call);
+ Bitmap largeIcon = getLargeIconToDisplay(context, contactInfo, call);
final CharSequence content = getContentString(call, contactInfo.userType);
final String contentTitle = getContentTitle(contactInfo, call);
Trace.endSection();
@@ -290,7 +290,7 @@ public class StatusBarNotifier
if (callState == DialerCall.State.INCOMING
|| callState == DialerCall.State.CALL_WAITING
|| isVideoUpgradeRequest) {
- if (ConfigProviderBindings.get(mContext)
+ if (ConfigProviderBindings.get(context)
.getBoolean("quiet_incoming_call_if_ui_showing", true)) {
notificationType =
InCallPresenter.getInstance().isShowingInCallUi()
@@ -329,10 +329,10 @@ public class StatusBarNotifier
// This builder is used for the notification shown when the device is locked and the user
// has set their notification settings to 'hide sensitive content'
// {@see Notification.Builder#setPublicVersion}.
- Notification.Builder publicBuilder = new Notification.Builder(mContext);
+ Notification.Builder publicBuilder = new Notification.Builder(context);
publicBuilder
.setSmallIcon(iconResId)
- .setColor(mContext.getResources().getColor(R.color.dialer_theme_color, mContext.getTheme()))
+ .setColor(context.getResources().getColor(R.color.dialer_theme_color, context.getTheme()))
// Hide work call state for the lock screen notification
.setContentTitle(getContentString(call, ContactsUtils.USER_TYPE_CURRENT));
setNotificationWhen(call, callState, publicBuilder);
@@ -357,7 +357,7 @@ public class StatusBarNotifier
builder.setCategory(Notification.CATEGORY_CALL);
// This will be ignored on O+ and handled by the channel
builder.setPriority(Notification.PRIORITY_MAX);
- if (mCurrentNotification != NOTIFICATION_INCOMING_CALL) {
+ if (currentNotification != NOTIFICATION_INCOMING_CALL) {
LogUtil.i(
"StatusBarNotifier.buildAndSendNotification",
"Canceling old notification so this one can be noisy");
@@ -403,20 +403,20 @@ public class StatusBarNotifier
// Fire off the notification
Notification notification = builder.build();
- if (mDialerRingtoneManager.shouldPlayRingtone(callState, contactInfo.contactRingtoneUri)) {
+ if (dialerRingtoneManager.shouldPlayRingtone(callState, contactInfo.contactRingtoneUri)) {
notification.flags |= Notification.FLAG_INSISTENT;
notification.sound = contactInfo.contactRingtoneUri;
AudioAttributes.Builder audioAttributes = new AudioAttributes.Builder();
audioAttributes.setContentType(AudioAttributes.CONTENT_TYPE_MUSIC);
audioAttributes.setUsage(AudioAttributes.USAGE_NOTIFICATION_RINGTONE);
notification.audioAttributes = audioAttributes.build();
- if (mDialerRingtoneManager.shouldVibrate(mContext.getContentResolver())) {
+ if (dialerRingtoneManager.shouldVibrate(context.getContentResolver())) {
notification.vibrate = VIBRATE_PATTERN;
}
}
- if (mDialerRingtoneManager.shouldPlayCallWaitingTone(callState)) {
+ if (dialerRingtoneManager.shouldPlayCallWaitingTone(callState)) {
LogUtil.v("StatusBarNotifier.buildAndSendNotification", "playing call waiting tone");
- mDialerRingtoneManager.playCallWaitingTone();
+ dialerRingtoneManager.playCallWaitingTone();
}
LogUtil.i(
@@ -428,7 +428,7 @@ public class StatusBarNotifier
Trace.endSection();
call.getLatencyReport().onNotificationShown();
- mCurrentNotification = notificationType;
+ currentNotification = notificationType;
Trace.endSection();
}
@@ -486,57 +486,57 @@ public class StatusBarNotifier
// if new title is not null, it should be different from saved version OR
// if new title is null, the saved version should not be null
final boolean contentTitleChanged =
- (contentTitle != null && !contentTitle.equals(mSavedContentTitle))
- || (contentTitle == null && mSavedContentTitle != null);
+ (contentTitle != null && !contentTitle.equals(savedContentTitle))
+ || (contentTitle == null && savedContentTitle != null);
boolean largeIconChanged;
- if (mSavedLargeIcon == null) {
+ if (savedLargeIcon == null) {
largeIconChanged = largeIcon != null;
} else {
- largeIconChanged = largeIcon == null || !mSavedLargeIcon.sameAs(largeIcon);
+ largeIconChanged = largeIcon == null || !savedLargeIcon.sameAs(largeIcon);
}
// any change means we are definitely updating
boolean retval =
- (mSavedIcon != icon)
- || !Objects.equals(mSavedContent, content)
- || (mCallState != state)
- || (mVideoState != videoState)
+ (savedIcon != icon)
+ || !Objects.equals(savedContent, content)
+ || (callState != state)
+ || (this.videoState != videoState)
|| largeIconChanged
|| contentTitleChanged
- || !Objects.equals(mRingtone, ringtone)
+ || !Objects.equals(this.ringtone, ringtone)
|| !Objects.equals(savedCallAudioState, callAudioState);
LogUtil.d(
"StatusBarNotifier.checkForChangeAndSaveData",
"data changed: icon: %b, content: %b, state: %b, videoState: %b, largeIcon: %b, title: %b,"
+ "ringtone: %b, audioState: %b, type: %b",
- (mSavedIcon != icon),
- !Objects.equals(mSavedContent, content),
- (mCallState != state),
- (mVideoState != videoState),
+ (savedIcon != icon),
+ !Objects.equals(savedContent, content),
+ (callState != state),
+ (this.videoState != videoState),
largeIconChanged,
contentTitleChanged,
- !Objects.equals(mRingtone, ringtone),
+ !Objects.equals(this.ringtone, ringtone),
!Objects.equals(savedCallAudioState, callAudioState),
- mCurrentNotification != notificationType);
+ currentNotification != notificationType);
// If we aren't showing a notification right now or the notification type is changing,
// definitely do an update.
- if (mCurrentNotification != notificationType) {
- if (mCurrentNotification == NOTIFICATION_NONE) {
+ if (currentNotification != notificationType) {
+ if (currentNotification == NOTIFICATION_NONE) {
LogUtil.d(
"StatusBarNotifier.checkForChangeAndSaveData", "showing notification for first time.");
}
retval = true;
}
- mSavedIcon = icon;
- mSavedContent = content;
- mCallState = state;
- mVideoState = videoState;
- mSavedLargeIcon = largeIcon;
- mSavedContentTitle = contentTitle;
- mRingtone = ringtone;
+ savedIcon = icon;
+ savedContent = content;
+ callState = state;
+ this.videoState = videoState;
+ savedLargeIcon = largeIcon;
+ savedContentTitle = contentTitle;
+ this.ringtone = ringtone;
savedCallAudioState = callAudioState;
if (retval) {
@@ -553,12 +553,12 @@ public class StatusBarNotifier
String getContentTitle(ContactCacheEntry contactInfo, DialerCall call) {
if (call.isConferenceCall()) {
return CallerInfoUtils.getConferenceString(
- mContext, call.hasProperty(Details.PROPERTY_GENERIC_CONFERENCE));
+ context, call.hasProperty(Details.PROPERTY_GENERIC_CONFERENCE));
}
String preferredName =
ContactDisplayUtils.getPreferredDisplayName(
- contactInfo.namePrimary, contactInfo.nameAlternative, mContactsPreferences);
+ contactInfo.namePrimary, contactInfo.nameAlternative, contactsPreferences);
if (TextUtils.isEmpty(preferredName)) {
return TextUtils.isEmpty(contactInfo.number)
? null
@@ -623,9 +623,9 @@ public class StatusBarNotifier
return null;
}
final int height =
- (int) mContext.getResources().getDimension(android.R.dimen.notification_large_icon_height);
+ (int) context.getResources().getDimension(android.R.dimen.notification_large_icon_height);
final int width =
- (int) mContext.getResources().getDimension(android.R.dimen.notification_large_icon_width);
+ (int) context.getResources().getDimension(android.R.dimen.notification_large_icon_width);
return BitmapUtil.getRoundedBitmap(bitmap, width, height);
}
@@ -649,7 +649,7 @@ public class StatusBarNotifier
|| call.isVideoCall()) {
return R.drawable.quantum_ic_videocam_white_24;
} else if (call.hasProperty(PROPERTY_HIGH_DEF_AUDIO)
- && MotorolaUtils.shouldShowHdIconInNotification(mContext)) {
+ && MotorolaUtils.shouldShowHdIconInNotification(context)) {
// Normally when a call is ongoing the status bar displays an icon of a phone. This is a
// helpful hint for users so they know how to get back to the call. For Sprint HD calls, we
// replace this icon with an icon of a phone with a HD badge. This is a carrier requirement.
@@ -658,8 +658,7 @@ public class StatusBarNotifier
return R.drawable.quantum_ic_phone_locked_vd_theme_24;
}
// If ReturnToCall is enabled, use the static icon. The animated one will show in the bubble.
- if (ReturnToCallController.isEnabled(mContext)
- || NewReturnToCallController.isEnabled(mContext)) {
+ if (ReturnToCallController.isEnabled(context) || NewReturnToCallController.isEnabled(context)) {
return R.drawable.quantum_ic_call_vd_theme_24;
} else {
return R.drawable.on_going_call;
@@ -676,14 +675,14 @@ public class StatusBarNotifier
&& call.getNumberPresentation() == TelecomManager.PRESENTATION_ALLOWED) {
if (!TextUtils.isEmpty(call.getChildNumber())) {
- return mContext.getString(R.string.child_number, call.getChildNumber());
+ return context.getString(R.string.child_number, call.getChildNumber());
} else if (!TextUtils.isEmpty(call.getCallSubject()) && call.isCallSubjectSupported()) {
return call.getCallSubject();
}
}
int resId = R.string.notification_ongoing_call;
- String wifiBrand = mContext.getString(R.string.notification_call_wifi_brand);
+ String wifiBrand = context.getString(R.string.notification_call_wifi_brand);
if (call.hasProperty(Details.PROPERTY_WIFI)) {
resId = R.string.notification_ongoing_call_wifi_template;
}
@@ -720,16 +719,16 @@ public class StatusBarNotifier
boolean isWorkCall = call.hasProperty(PROPERTY_ENTERPRISE_CALL);
if (userType == ContactsUtils.USER_TYPE_WORK || isWorkCall) {
resId = getWorkStringFromPersonalString(resId);
- wifiBrand = mContext.getString(R.string.notification_call_wifi_work_brand);
+ wifiBrand = context.getString(R.string.notification_call_wifi_work_brand);
}
if (resId == R.string.notification_incoming_call_wifi_template
|| resId == R.string.notification_ongoing_call_wifi_template) {
// TODO(a bug): Potentially apply this template logic everywhere.
- return mContext.getString(resId, wifiBrand);
+ return context.getString(resId, wifiBrand);
}
- return mContext.getString(resId);
+ return context.getString(resId);
}
private boolean shouldShowEnrichedCallNotification(Session session) {
@@ -769,7 +768,7 @@ public class StatusBarNotifier
} else {
resId = R.string.important_notification_incoming_call;
}
- if (mContext.getString(resId).length() > 50) {
+ if (context.getString(resId).length() > 50) {
resId = R.string.important_notification_incoming_call_attachments;
}
} else {
@@ -795,7 +794,7 @@ public class StatusBarNotifier
resId = R.string.notification_incoming_call_with_message;
}
}
- if (mContext.getString(resId).length() > 50) {
+ if (context.getString(resId).length() > 50) {
resId = R.string.notification_incoming_call_attachments;
}
return resId;
@@ -803,10 +802,10 @@ public class StatusBarNotifier
private CharSequence getMultiSimIncomingText(DialerCall call) {
PhoneAccount phoneAccount =
- mContext.getSystemService(TelecomManager.class).getPhoneAccount(call.getAccountHandle());
+ context.getSystemService(TelecomManager.class).getPhoneAccount(call.getAccountHandle());
SpannableString string =
new SpannableString(
- mContext.getString(
+ context.getString(
R.string.notification_incoming_call_mutli_sim, phoneAccount.getLabel()));
int accountStart = string.toString().lastIndexOf(phoneAccount.getLabel().toString());
int accountEnd = accountStart + phoneAccount.getLabel().length();
@@ -838,13 +837,13 @@ public class StatusBarNotifier
}
private Spannable getActionText(@StringRes int stringRes, @ColorRes int colorRes) {
- Spannable spannable = new SpannableString(mContext.getText(stringRes));
+ Spannable spannable = new SpannableString(context.getText(stringRes));
if (VERSION.SDK_INT >= VERSION_CODES.N_MR1) {
// This will only work for cases where the Notification.Builder has a fullscreen intent set
// Notification.Builder that does not have a full screen intent will take the color of the
// app and the following leads to a no-op.
spannable.setSpan(
- new ForegroundColorSpan(mContext.getColor(colorRes)), 0, spannable.length(), 0);
+ new ForegroundColorSpan(context.getColor(colorRes)), 0, spannable.length(), 0);
}
return spannable;
}
@@ -854,10 +853,10 @@ public class StatusBarNotifier
"StatusBarNotifier.addAnswerAction",
"will show \"answer\" action in the incoming call Notification");
PendingIntent answerVoicePendingIntent =
- createNotificationPendingIntent(mContext, ACTION_ANSWER_VOICE_INCOMING_CALL);
+ createNotificationPendingIntent(context, ACTION_ANSWER_VOICE_INCOMING_CALL);
builder.addAction(
new Notification.Action.Builder(
- Icon.createWithResource(mContext, R.drawable.quantum_ic_call_white_24),
+ Icon.createWithResource(context, R.drawable.quantum_ic_call_white_24),
getActionText(
R.string.notification_action_answer, R.color.notification_action_accept),
answerVoicePendingIntent)
@@ -869,10 +868,10 @@ public class StatusBarNotifier
"StatusBarNotifier.addDismissAction",
"will show \"decline\" action in the incoming call Notification");
PendingIntent declinePendingIntent =
- createNotificationPendingIntent(mContext, ACTION_DECLINE_INCOMING_CALL);
+ createNotificationPendingIntent(context, ACTION_DECLINE_INCOMING_CALL);
builder.addAction(
new Notification.Action.Builder(
- Icon.createWithResource(mContext, R.drawable.quantum_ic_close_white_24),
+ Icon.createWithResource(context, R.drawable.quantum_ic_close_white_24),
getActionText(
R.string.notification_action_dismiss, R.color.notification_action_dismiss),
declinePendingIntent)
@@ -884,11 +883,11 @@ public class StatusBarNotifier
"StatusBarNotifier.addHangupAction",
"will show \"hang-up\" action in the ongoing active call Notification");
PendingIntent hangupPendingIntent =
- createNotificationPendingIntent(mContext, ACTION_HANG_UP_ONGOING_CALL);
+ createNotificationPendingIntent(context, ACTION_HANG_UP_ONGOING_CALL);
builder.addAction(
new Notification.Action.Builder(
- Icon.createWithResource(mContext, R.drawable.quantum_ic_call_end_white_24),
- mContext.getText(R.string.notification_action_end_call),
+ Icon.createWithResource(context, R.drawable.quantum_ic_call_end_white_24),
+ context.getText(R.string.notification_action_end_call),
hangupPendingIntent)
.build());
}
@@ -911,11 +910,11 @@ public class StatusBarNotifier
"StatusBarNotifier.addSpeakerOnAction",
"will show \"Speaker on\" action in the ongoing active call Notification");
PendingIntent speakerOnPendingIntent =
- createNotificationPendingIntent(mContext, ACTION_TURN_ON_SPEAKER);
+ createNotificationPendingIntent(context, ACTION_TURN_ON_SPEAKER);
builder.addAction(
new Notification.Action.Builder(
- Icon.createWithResource(mContext, R.drawable.quantum_ic_volume_up_white_24),
- mContext.getText(R.string.notification_action_speaker_on),
+ Icon.createWithResource(context, R.drawable.quantum_ic_volume_up_white_24),
+ context.getText(R.string.notification_action_speaker_on),
speakerOnPendingIntent)
.build());
}
@@ -925,11 +924,11 @@ public class StatusBarNotifier
"StatusBarNotifier.addSpeakerOffAction",
"will show \"Speaker off\" action in the ongoing active call Notification");
PendingIntent speakerOffPendingIntent =
- createNotificationPendingIntent(mContext, ACTION_TURN_OFF_SPEAKER);
+ createNotificationPendingIntent(context, ACTION_TURN_OFF_SPEAKER);
builder.addAction(
new Notification.Action.Builder(
- Icon.createWithResource(mContext, R.drawable.quantum_ic_phone_in_talk_white_24),
- mContext.getText(R.string.notification_action_speaker_off),
+ Icon.createWithResource(context, R.drawable.quantum_ic_phone_in_talk_white_24),
+ context.getText(R.string.notification_action_speaker_off),
speakerOffPendingIntent)
.build());
}
@@ -939,10 +938,10 @@ public class StatusBarNotifier
"StatusBarNotifier.addVideoCallAction",
"will show \"video\" action in the incoming call Notification");
PendingIntent answerVideoPendingIntent =
- createNotificationPendingIntent(mContext, ACTION_ANSWER_VIDEO_INCOMING_CALL);
+ createNotificationPendingIntent(context, ACTION_ANSWER_VIDEO_INCOMING_CALL);
builder.addAction(
new Notification.Action.Builder(
- Icon.createWithResource(mContext, R.drawable.quantum_ic_videocam_white_24),
+ Icon.createWithResource(context, R.drawable.quantum_ic_videocam_white_24),
getActionText(
R.string.notification_action_answer_video,
R.color.notification_action_answer_video),
@@ -955,10 +954,10 @@ public class StatusBarNotifier
"StatusBarNotifier.addAcceptUpgradeRequestAction",
"will show \"accept upgrade\" action in the incoming call Notification");
PendingIntent acceptVideoPendingIntent =
- createNotificationPendingIntent(mContext, ACTION_ACCEPT_VIDEO_UPGRADE_REQUEST);
+ createNotificationPendingIntent(context, ACTION_ACCEPT_VIDEO_UPGRADE_REQUEST);
builder.addAction(
new Notification.Action.Builder(
- Icon.createWithResource(mContext, R.drawable.quantum_ic_videocam_white_24),
+ Icon.createWithResource(context, R.drawable.quantum_ic_videocam_white_24),
getActionText(
R.string.notification_action_accept, R.color.notification_action_accept),
acceptVideoPendingIntent)
@@ -970,10 +969,10 @@ public class StatusBarNotifier
"StatusBarNotifier.addDismissUpgradeRequestAction",
"will show \"dismiss upgrade\" action in the incoming call Notification");
PendingIntent declineVideoPendingIntent =
- createNotificationPendingIntent(mContext, ACTION_DECLINE_VIDEO_UPGRADE_REQUEST);
+ createNotificationPendingIntent(context, ACTION_DECLINE_VIDEO_UPGRADE_REQUEST);
builder.addAction(
new Notification.Action.Builder(
- Icon.createWithResource(mContext, R.drawable.quantum_ic_videocam_white_24),
+ Icon.createWithResource(context, R.drawable.quantum_ic_videocam_white_24),
getActionText(
R.string.notification_action_dismiss, R.color.notification_action_dismiss),
declineVideoPendingIntent)
@@ -992,7 +991,7 @@ public class StatusBarNotifier
}
private Notification.Builder getNotificationBuilder() {
- final Notification.Builder builder = new Notification.Builder(mContext);
+ final Notification.Builder builder = new Notification.Builder(context);
builder.setOngoing(true);
builder.setOnlyAlertOnce(true);
// This will be ignored on O+ and handled by the channel
@@ -1005,7 +1004,7 @@ public class StatusBarNotifier
private PendingIntent createLaunchPendingIntent(boolean isFullScreen) {
Intent intent =
InCallActivity.getIntent(
- mContext, false /* showDialpad */, false /* newOutgoingCall */, isFullScreen);
+ context, false /* showDialpad */, false /* newOutgoingCall */, isFullScreen);
int requestCode = InCallActivity.PendingIntentRequestCodes.NON_FULL_SCREEN;
if (isFullScreen) {
@@ -1019,14 +1018,14 @@ public class StatusBarNotifier
// and clicks the notification's expanded view. It's also used to
// launch the InCallActivity immediately when when there's an incoming
// call (see the "fullScreenIntent" field below).
- return PendingIntent.getActivity(mContext, requestCode, intent, 0);
+ return PendingIntent.getActivity(context, requestCode, intent, 0);
}
private void setStatusBarCallListener(StatusBarCallListener listener) {
- if (mStatusBarCallListener != null) {
- mStatusBarCallListener.cleanup();
+ if (statusBarCallListener != null) {
+ statusBarCallListener.cleanup();
}
- mStatusBarCallListener = listener;
+ statusBarCallListener = listener;
}
private boolean hasMultiplePhoneAccounts(DialerCall call) {
@@ -1057,15 +1056,15 @@ public class StatusBarNotifier
private class StatusBarCallListener implements DialerCallListener {
- private DialerCall mDialerCall;
+ private DialerCall dialerCall;
StatusBarCallListener(DialerCall dialerCall) {
- mDialerCall = dialerCall;
- mDialerCall.addListener(this);
+ this.dialerCall = dialerCall;
+ this.dialerCall.addListener(this);
}
void cleanup() {
- mDialerCall.removeListener(this);
+ dialerCall.removeListener(this);
}
@Override
@@ -1074,7 +1073,7 @@ public class StatusBarNotifier
@Override
public void onDialerCallUpdate() {
if (CallList.getInstance().getIncomingCall() == null) {
- mDialerRingtoneManager.stopCallWaitingTone();
+ dialerRingtoneManager.stopCallWaitingTone();
}
}
@@ -1105,7 +1104,7 @@ public class StatusBarNotifier
*/
@Override
public void onDialerCallSessionModificationStateChange() {
- if (mDialerCall.getVideoTech().getSessionModificationState()
+ if (dialerCall.getVideoTech().getSessionModificationState()
== SessionModificationState.NO_REQUEST) {
cleanup();
updateNotification();
diff --git a/java/com/android/incallui/TransactionSafeFragmentActivity.java b/java/com/android/incallui/TransactionSafeFragmentActivity.java
index a6b078cb4..696ecf1bd 100644
--- a/java/com/android/incallui/TransactionSafeFragmentActivity.java
+++ b/java/com/android/incallui/TransactionSafeFragmentActivity.java
@@ -25,30 +25,30 @@ import android.support.v4.app.FragmentActivity;
*/
public abstract class TransactionSafeFragmentActivity extends FragmentActivity {
- private boolean mIsSafeToCommitTransactions;
+ private boolean isSafeToCommitTransactions;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- mIsSafeToCommitTransactions = true;
+ isSafeToCommitTransactions = true;
}
@Override
protected void onStart() {
super.onStart();
- mIsSafeToCommitTransactions = true;
+ isSafeToCommitTransactions = true;
}
@Override
protected void onResume() {
super.onResume();
- mIsSafeToCommitTransactions = true;
+ isSafeToCommitTransactions = true;
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
- mIsSafeToCommitTransactions = false;
+ isSafeToCommitTransactions = false;
}
/**
@@ -59,6 +59,6 @@ public abstract class TransactionSafeFragmentActivity extends FragmentActivity {
* outState)} (if that method is overridden), so the flag is properly set.
*/
public boolean isSafeToCommitTransactions() {
- return mIsSafeToCommitTransactions;
+ return isSafeToCommitTransactions;
}
}
diff --git a/java/com/android/incallui/VideoCallPresenter.java b/java/com/android/incallui/VideoCallPresenter.java
index e589bb317..a19d45f7a 100644
--- a/java/com/android/incallui/VideoCallPresenter.java
+++ b/java/com/android/incallui/VideoCallPresenter.java
@@ -82,61 +82,61 @@ public class VideoCallPresenter
InCallPresenter.InCallEventListener,
VideoCallScreenDelegate {
- private static boolean mIsVideoMode = false;
+ private static boolean isVideoMode = false;
- private final Handler mHandler = new Handler();
- private VideoCallScreen mVideoCallScreen;
+ private final Handler handler = new Handler();
+ private VideoCallScreen videoCallScreen;
/** The current context. */
- private Context mContext;
+ private Context context;
/** The call the video surfaces are currently related to */
- private DialerCall mPrimaryCall;
+ private DialerCall primaryCall;
/**
* The {@link VideoCall} used to inform the video telephony layer of changes to the video
* surfaces.
*/
- private VideoCall mVideoCall;
+ private VideoCall videoCall;
/** Determines if the current UI state represents a video call. */
- private int mCurrentVideoState;
+ private int currentVideoState;
/** DialerCall's current state */
- private int mCurrentCallState = DialerCall.State.INVALID;
+ private int currentCallState = DialerCall.State.INVALID;
/** Determines the device orientation (portrait/lanscape). */
- private int mDeviceOrientation = InCallOrientationEventListener.SCREEN_ORIENTATION_UNKNOWN;
+ private int deviceOrientation = InCallOrientationEventListener.SCREEN_ORIENTATION_UNKNOWN;
/** Tracks the state of the preview surface negotiation with the telephony layer. */
- private int mPreviewSurfaceState = PreviewSurfaceState.NONE;
+ private int previewSurfaceState = PreviewSurfaceState.NONE;
/**
* Determines whether video calls should automatically enter full screen mode after {@link
- * #mAutoFullscreenTimeoutMillis} milliseconds.
+ * #autoFullscreenTimeoutMillis} milliseconds.
*/
- private boolean mIsAutoFullscreenEnabled = false;
+ private boolean isAutoFullscreenEnabled = false;
/**
* Determines the number of milliseconds after which a video call will automatically enter
- * fullscreen mode. Requires {@link #mIsAutoFullscreenEnabled} to be {@code true}.
+ * fullscreen mode. Requires {@link #isAutoFullscreenEnabled} to be {@code true}.
*/
- private int mAutoFullscreenTimeoutMillis = 0;
+ private int autoFullscreenTimeoutMillis = 0;
/**
* Determines if the countdown is currently running to automatically enter full screen video mode.
*/
- private boolean mAutoFullScreenPending = false;
+ private boolean autoFullScreenPending = false;
/** Whether if the call is remotely held. */
- private boolean mIsRemotelyHeld = false;
+ private boolean isRemotelyHeld = false;
/**
* Runnable which is posted to schedule automatically entering fullscreen mode. Will not auto
* enter fullscreen mode if the dialpad is visible (doing so would make it impossible to exit the
* dialpad).
*/
- private Runnable mAutoFullscreenRunnable =
+ private Runnable autoFullscreenRunnable =
new Runnable() {
@Override
public void run() {
- if (mAutoFullScreenPending
+ if (autoFullScreenPending
&& !InCallPresenter.getInstance().isDialpadVisible()
- && mIsVideoMode) {
+ && isVideoMode) {
LogUtil.v("VideoCallPresenter.mAutoFullScreenRunnable", "entering fullscreen mode");
InCallPresenter.getInstance().setFullScreen(true);
- mAutoFullScreenPending = false;
+ autoFullScreenPending = false;
} else {
LogUtil.v(
"VideoCallPresenter.mAutoFullScreenRunnable",
@@ -293,12 +293,12 @@ public class VideoCallPresenter
*/
@Override
public void initVideoCallScreenDelegate(Context context, VideoCallScreen videoCallScreen) {
- mContext = context;
- mVideoCallScreen = videoCallScreen;
- mIsAutoFullscreenEnabled =
- mContext.getResources().getBoolean(R.bool.video_call_auto_fullscreen);
- mAutoFullscreenTimeoutMillis =
- mContext.getResources().getInteger(R.integer.video_call_auto_fullscreen_timeout);
+ this.context = context;
+ this.videoCallScreen = videoCallScreen;
+ isAutoFullscreenEnabled =
+ this.context.getResources().getBoolean(R.bool.video_call_auto_fullscreen);
+ autoFullscreenTimeoutMillis =
+ this.context.getResources().getInteger(R.integer.video_call_auto_fullscreen_timeout);
}
/** Called when the user interface is ready to be used. */
@@ -313,7 +313,7 @@ public class VideoCallPresenter
return;
}
- mDeviceOrientation = InCallOrientationEventListener.getCurrentOrientation();
+ deviceOrientation = InCallOrientationEventListener.getCurrentOrientation();
// Register for call state changes last
InCallPresenter.getInstance().addListener(this);
@@ -327,8 +327,8 @@ public class VideoCallPresenter
// Register for surface and video events from {@link InCallVideoCallListener}s.
InCallVideoCallCallbackNotifier.getInstance().addSurfaceChangeListener(this);
- mCurrentVideoState = VideoProfile.STATE_AUDIO_ONLY;
- mCurrentCallState = DialerCall.State.INVALID;
+ currentVideoState = VideoProfile.STATE_AUDIO_ONLY;
+ currentCallState = DialerCall.State.INVALID;
InCallPresenter.InCallState inCallState = InCallPresenter.getInstance().getInCallState();
onStateChange(inCallState, inCallState, CallList.getInstance());
@@ -359,8 +359,8 @@ public class VideoCallPresenter
// Ensure that the call's camera direction is updated (most likely to UNKNOWN). Normally this
// happens after any call state changes but we're unregistering from InCallPresenter above so
// we won't get any more call state changes. See a bug.
- if (mPrimaryCall != null) {
- updateCameraSelection(mPrimaryCall);
+ if (primaryCall != null) {
+ updateCameraSelection(primaryCall);
}
isVideoCallScreenUiReady = false;
@@ -376,7 +376,7 @@ public class VideoCallPresenter
InCallPresenter.getInstance().setFullScreen(true);
} else {
InCallPresenter.getInstance().setFullScreen(false);
- maybeAutoEnterFullscreen(mPrimaryCall);
+ maybeAutoEnterFullscreen(primaryCall);
// If Activity is not multiwindow, fullscreen will be driven by SystemUI visibility changes
// instead. See #onSystemUiVisibilityChange(boolean)
@@ -391,7 +391,7 @@ public class VideoCallPresenter
LogUtil.i("VideoCallPresenter.onSystemUiVisibilityChange", "visible: " + visible);
if (visible) {
InCallPresenter.getInstance().setFullScreen(false);
- maybeAutoEnterFullscreen(mPrimaryCall);
+ maybeAutoEnterFullscreen(primaryCall);
}
}
@@ -412,7 +412,7 @@ public class VideoCallPresenter
@Override
public int getDeviceOrientation() {
- return mDeviceOrientation;
+ return deviceOrientation;
}
/**
@@ -422,13 +422,13 @@ public class VideoCallPresenter
@Override
public void onCameraPermissionGranted() {
LogUtil.i("VideoCallPresenter.onCameraPermissionGranted", "");
- PermissionsUtil.setCameraPrivacyToastShown(mContext);
- enableCamera(mPrimaryCall, isCameraRequired());
+ PermissionsUtil.setCameraPrivacyToastShown(context);
+ enableCamera(primaryCall, isCameraRequired());
showVideoUi(
- mPrimaryCall.getVideoState(),
- mPrimaryCall.getState(),
- mPrimaryCall.getVideoTech().getSessionModificationState(),
- mPrimaryCall.isRemotelyHeld());
+ primaryCall.getVideoState(),
+ primaryCall.getState(),
+ primaryCall.getVideoTech().getSessionModificationState(),
+ primaryCall.isRemotelyHeld());
InCallPresenter.getInstance().getInCallCameraManager().onCameraPermissionGranted();
}
@@ -438,10 +438,10 @@ public class VideoCallPresenter
*/
@Override
public void resetAutoFullscreenTimer() {
- if (mAutoFullScreenPending) {
+ if (autoFullScreenPending) {
LogUtil.i("VideoCallPresenter.resetAutoFullscreenTimer", "resetting");
- mHandler.removeCallbacks(mAutoFullscreenRunnable);
- mHandler.postDelayed(mAutoFullscreenRunnable, mAutoFullscreenTimeoutMillis);
+ handler.removeCallbacks(autoFullscreenRunnable);
+ handler.postDelayed(autoFullscreenRunnable, autoFullscreenTimeoutMillis);
}
}
@@ -519,16 +519,16 @@ public class VideoCallPresenter
currentCall = primary = callList.getActiveCall();
}
- final boolean primaryChanged = !Objects.equals(mPrimaryCall, primary);
+ final boolean primaryChanged = !Objects.equals(primaryCall, primary);
LogUtil.i(
"VideoCallPresenter.onStateChange",
"primaryChanged: %b, primary: %s, mPrimaryCall: %s",
primaryChanged,
primary,
- mPrimaryCall);
+ primaryCall);
if (primaryChanged) {
onPrimaryCallChanged(primary);
- } else if (mPrimaryCall != null) {
+ } else if (primaryCall != null) {
updateVideoCall(primary);
}
updateCallCache(primary);
@@ -549,9 +549,9 @@ public class VideoCallPresenter
@Override
public void onFullscreenModeChanged(boolean isFullscreenMode) {
cancelAutoFullScreen();
- if (mPrimaryCall != null) {
+ if (primaryCall != null) {
updateFullscreenAndGreenScreenMode(
- mPrimaryCall.getState(), mPrimaryCall.getVideoTech().getSessionModificationState());
+ primaryCall.getState(), primaryCall.getVideoTech().getSessionModificationState());
} else {
updateFullscreenAndGreenScreenMode(State.INVALID, SessionModificationState.NO_REQUEST);
}
@@ -559,7 +559,7 @@ public class VideoCallPresenter
private void checkForVideoStateChange(DialerCall call) {
final boolean shouldShowVideoUi = shouldShowVideoUiForCall(call);
- final boolean hasVideoStateChanged = mCurrentVideoState != call.getVideoState();
+ final boolean hasVideoStateChanged = currentVideoState != call.getVideoState();
LogUtil.v(
"VideoCallPresenter.checkForVideoStateChange",
@@ -568,7 +568,7 @@ public class VideoCallPresenter
shouldShowVideoUi,
hasVideoStateChanged,
isVideoMode(),
- VideoProfile.videoStateToString(mCurrentVideoState),
+ VideoProfile.videoStateToString(currentVideoState),
VideoProfile.videoStateToString(call.getVideoState()));
if (!hasVideoStateChanged) {
return;
@@ -586,8 +586,8 @@ public class VideoCallPresenter
private void checkForCallStateChange(DialerCall call) {
final boolean shouldShowVideoUi = shouldShowVideoUiForCall(call);
final boolean hasCallStateChanged =
- mCurrentCallState != call.getState() || mIsRemotelyHeld != call.isRemotelyHeld();
- mIsRemotelyHeld = call.isRemotelyHeld();
+ currentCallState != call.getState() || isRemotelyHeld != call.isRemotelyHeld();
+ isRemotelyHeld = call.isRemotelyHeld();
LogUtil.v(
"VideoCallPresenter.checkForCallStateChange",
@@ -646,20 +646,20 @@ public class VideoCallPresenter
}
private boolean isVideoMode() {
- return mIsVideoMode;
+ return isVideoMode;
}
private void updateCallCache(DialerCall call) {
if (call == null) {
- mCurrentVideoState = VideoProfile.STATE_AUDIO_ONLY;
- mCurrentCallState = DialerCall.State.INVALID;
- mVideoCall = null;
- mPrimaryCall = null;
+ currentVideoState = VideoProfile.STATE_AUDIO_ONLY;
+ currentCallState = DialerCall.State.INVALID;
+ videoCall = null;
+ primaryCall = null;
} else {
- mCurrentVideoState = call.getVideoState();
- mVideoCall = call.getVideoCall();
- mCurrentCallState = call.getState();
- mPrimaryCall = call;
+ currentVideoState = call.getVideoState();
+ videoCall = call.getVideoCall();
+ currentCallState = call.getState();
+ primaryCall = call;
}
}
@@ -677,12 +677,12 @@ public class VideoCallPresenter
"call: %s, details: %s, mPrimaryCall: %s",
call,
details,
- mPrimaryCall);
+ primaryCall);
if (call == null) {
return;
}
// If the details change is not for the currently active call no update is required.
- if (!call.equals(mPrimaryCall)) {
+ if (!call.equals(primaryCall)) {
LogUtil.v("VideoCallPresenter.onDetailsChanged", "details not for current active call");
return;
}
@@ -708,14 +708,14 @@ public class VideoCallPresenter
private void updateFullscreenAndGreenScreenMode(
int callState, @SessionModificationState int sessionModificationState) {
- if (mVideoCallScreen != null) {
+ if (videoCallScreen != null) {
boolean shouldShowFullscreen = InCallPresenter.getInstance().isFullscreen();
boolean shouldShowGreenScreen =
callState == State.DIALING
|| callState == State.CONNECTING
|| callState == State.INCOMING
|| isVideoUpgrade(sessionModificationState);
- mVideoCallScreen.updateFullscreenAndGreenScreenMode(
+ videoCallScreen.updateFullscreenAndGreenScreenMode(
shouldShowFullscreen, shouldShowGreenScreen);
}
}
@@ -727,8 +727,8 @@ public class VideoCallPresenter
"VideoCallPresenter.checkForVideoCallChange",
"videoCall: %s, mVideoCall: %s",
videoCall,
- mVideoCall);
- if (!Objects.equals(videoCall, mVideoCall)) {
+ this.videoCall);
+ if (!Objects.equals(videoCall, this.videoCall)) {
changeVideoCall(call);
}
}
@@ -745,11 +745,11 @@ public class VideoCallPresenter
"VideoCallPresenter.changeVideoCall",
"videoCall: %s, mVideoCall: %s",
videoCall,
- mVideoCall);
- final boolean hasChanged = mVideoCall == null && videoCall != null;
+ this.videoCall);
+ final boolean hasChanged = this.videoCall == null && videoCall != null;
- mVideoCall = videoCall;
- if (mVideoCall == null) {
+ this.videoCall = videoCall;
+ if (this.videoCall == null) {
LogUtil.v("VideoCallPresenter.changeVideoCall", "video call or primary call is null. Return");
return;
}
@@ -760,10 +760,9 @@ public class VideoCallPresenter
}
private boolean isCameraRequired() {
- return mPrimaryCall != null
+ return primaryCall != null
&& isCameraRequired(
- mPrimaryCall.getVideoState(),
- mPrimaryCall.getVideoTech().getSessionModificationState());
+ primaryCall.getVideoState(), primaryCall.getVideoTech().getSessionModificationState());
}
/**
@@ -781,7 +780,7 @@ public class VideoCallPresenter
"videoCall: %s, videoState: %d",
videoCall,
newVideoState);
- if (mVideoCallScreen == null) {
+ if (videoCallScreen == null) {
LogUtil.e("VideoCallPresenter.adjustVideoMode", "error VideoCallScreen is null so returning");
return;
}
@@ -803,14 +802,14 @@ public class VideoCallPresenter
}
Assert.checkState(
- mDeviceOrientation != InCallOrientationEventListener.SCREEN_ORIENTATION_UNKNOWN);
- videoCall.setDeviceOrientation(mDeviceOrientation);
+ deviceOrientation != InCallOrientationEventListener.SCREEN_ORIENTATION_UNKNOWN);
+ videoCall.setDeviceOrientation(deviceOrientation);
enableCamera(
call, isCameraRequired(newVideoState, call.getVideoTech().getSessionModificationState()));
}
- int previousVideoState = mCurrentVideoState;
- mCurrentVideoState = newVideoState;
- mIsVideoMode = true;
+ int previousVideoState = currentVideoState;
+ currentVideoState = newVideoState;
+ isVideoMode = true;
// adjustVideoMode may be called if we are already in a 1-way video state. In this case
// we do not want to trigger auto-fullscreen mode.
@@ -842,17 +841,17 @@ public class VideoCallPresenter
return;
}
- boolean hasCameraPermission = VideoUtils.hasCameraPermissionAndShownPrivacyToast(mContext);
+ boolean hasCameraPermission = VideoUtils.hasCameraPermissionAndShownPrivacyToast(context);
if (!hasCameraPermission) {
call.getVideoTech().setCamera(null);
- mPreviewSurfaceState = PreviewSurfaceState.NONE;
+ previewSurfaceState = PreviewSurfaceState.NONE;
// TODO(wangqi): Inform remote party that the video is off. This is similar to a bug.
} else if (isCameraRequired) {
InCallCameraManager cameraManager = InCallPresenter.getInstance().getInCallCameraManager();
call.getVideoTech().setCamera(cameraManager.getActiveCameraId());
- mPreviewSurfaceState = PreviewSurfaceState.CAMERA_SET;
+ previewSurfaceState = PreviewSurfaceState.CAMERA_SET;
} else {
- mPreviewSurfaceState = PreviewSurfaceState.NONE;
+ previewSurfaceState = PreviewSurfaceState.NONE;
call.getVideoTech().setCamera(null);
}
}
@@ -866,10 +865,10 @@ public class VideoCallPresenter
DialerCall.State.ACTIVE,
SessionModificationState.NO_REQUEST,
false /* isRemotelyHeld */);
- enableCamera(mPrimaryCall, false);
+ enableCamera(primaryCall, false);
InCallPresenter.getInstance().setFullScreen(false);
InCallPresenter.getInstance().enableScreenTimeout(false);
- mIsVideoMode = false;
+ isVideoMode = false;
}
/**
@@ -885,12 +884,12 @@ public class VideoCallPresenter
int callState,
@SessionModificationState int sessionModificationState,
boolean isRemotelyHeld) {
- if (mVideoCallScreen == null) {
+ if (videoCallScreen == null) {
LogUtil.e("VideoCallPresenter.showVideoUi", "videoCallScreen is null returning");
return;
}
boolean showIncomingVideo = showIncomingVideo(videoState, callState);
- boolean showOutgoingVideo = showOutgoingVideo(mContext, videoState, sessionModificationState);
+ boolean showOutgoingVideo = showOutgoingVideo(context, videoState, sessionModificationState);
LogUtil.i(
"VideoCallPresenter.showVideoUi",
"showIncoming: %b, showOutgoing: %b, isRemotelyHeld: %b",
@@ -898,7 +897,7 @@ public class VideoCallPresenter
showOutgoingVideo,
isRemotelyHeld);
updateRemoteVideoSurfaceDimensions();
- mVideoCallScreen.showVideoViews(showOutgoingVideo, showIncomingVideo, isRemotelyHeld);
+ videoCallScreen.showVideoViews(showOutgoingVideo, showIncomingVideo, isRemotelyHeld);
InCallPresenter.getInstance().enableScreenTimeout(VideoProfile.isAudioOnly(videoState));
updateFullscreenAndGreenScreenMode(callState, sessionModificationState);
@@ -914,20 +913,20 @@ public class VideoCallPresenter
@Override
public void onUpdatePeerDimensions(DialerCall call, int width, int height) {
LogUtil.i("VideoCallPresenter.onUpdatePeerDimensions", "width: %d, height: %d", width, height);
- if (mVideoCallScreen == null) {
+ if (videoCallScreen == null) {
LogUtil.e("VideoCallPresenter.onUpdatePeerDimensions", "videoCallScreen is null");
return;
}
- if (!call.equals(mPrimaryCall)) {
+ if (!call.equals(primaryCall)) {
LogUtil.e(
"VideoCallPresenter.onUpdatePeerDimensions", "current call is not equal to primary");
return;
}
// Change size of display surface to match the peer aspect ratio
- if (width > 0 && height > 0 && mVideoCallScreen != null) {
+ if (width > 0 && height > 0 && videoCallScreen != null) {
getRemoteVideoSurfaceTexture().setSourceVideoDimensions(new Point(width, height));
- mVideoCallScreen.onRemoteVideoDimensionsChanged();
+ videoCallScreen.onRemoteVideoDimensionsChanged();
}
}
@@ -947,25 +946,25 @@ public class VideoCallPresenter
call,
width,
height);
- if (mVideoCallScreen == null) {
+ if (videoCallScreen == null) {
LogUtil.e("VideoCallPresenter.onCameraDimensionsChange", "ui is null");
return;
}
- if (!call.equals(mPrimaryCall)) {
+ if (!call.equals(primaryCall)) {
LogUtil.e("VideoCallPresenter.onCameraDimensionsChange", "not the primary call");
return;
}
- mPreviewSurfaceState = PreviewSurfaceState.CAPABILITIES_RECEIVED;
+ previewSurfaceState = PreviewSurfaceState.CAPABILITIES_RECEIVED;
changePreviewDimensions(width, height);
// Check if the preview surface is ready yet; if it is, set it on the {@code VideoCall}.
// If it not yet ready, it will be set when when creation completes.
Surface surface = getLocalVideoSurfaceTexture().getSavedSurface();
if (surface != null) {
- mPreviewSurfaceState = PreviewSurfaceState.SURFACE_SET;
- mVideoCall.setPreviewSurface(surface);
+ previewSurfaceState = PreviewSurfaceState.SURFACE_SET;
+ videoCall.setPreviewSurface(surface);
}
}
@@ -976,13 +975,13 @@ public class VideoCallPresenter
* @param height The new height.
*/
private void changePreviewDimensions(int width, int height) {
- if (mVideoCallScreen == null) {
+ if (videoCallScreen == null) {
return;
}
// Resize the surface used to display the preview video
getLocalVideoSurfaceTexture().setSurfaceDimensions(new Point(width, height));
- mVideoCallScreen.onLocalVideoDimensionsChanged();
+ videoCallScreen.onLocalVideoDimensionsChanged();
}
/**
@@ -999,11 +998,11 @@ public class VideoCallPresenter
LogUtil.i(
"VideoCallPresenter.onDeviceOrientationChanged",
"orientation: %d -> %d",
- mDeviceOrientation,
+ deviceOrientation,
orientation);
- mDeviceOrientation = orientation;
+ deviceOrientation = orientation;
- if (mVideoCallScreen == null) {
+ if (videoCallScreen == null) {
LogUtil.e("VideoCallPresenter.onDeviceOrientationChanged", "videoCallScreen is null");
return;
}
@@ -1019,7 +1018,7 @@ public class VideoCallPresenter
previewDimensions);
changePreviewDimensions(previewDimensions.x, previewDimensions.y);
- mVideoCallScreen.onLocalVideoOrientationChanged();
+ videoCallScreen.onLocalVideoOrientationChanged();
}
/**
@@ -1046,7 +1045,7 @@ public class VideoCallPresenter
* @param call The current call.
*/
protected void maybeAutoEnterFullscreen(DialerCall call) {
- if (!mIsAutoFullscreenEnabled) {
+ if (!isAutoFullscreenEnabled) {
return;
}
@@ -1054,63 +1053,62 @@ public class VideoCallPresenter
|| call.getState() != DialerCall.State.ACTIVE
|| !isBidirectionalVideoCall(call)
|| InCallPresenter.getInstance().isFullscreen()
- || (mContext != null && AccessibilityUtil.isTouchExplorationEnabled(mContext))) {
+ || (context != null && AccessibilityUtil.isTouchExplorationEnabled(context))) {
// Ensure any previously scheduled attempt to enter fullscreen is cancelled.
cancelAutoFullScreen();
return;
}
- if (mAutoFullScreenPending) {
+ if (autoFullScreenPending) {
LogUtil.v("VideoCallPresenter.maybeAutoEnterFullscreen", "already pending.");
return;
}
LogUtil.v("VideoCallPresenter.maybeAutoEnterFullscreen", "scheduled");
- mAutoFullScreenPending = true;
- mHandler.removeCallbacks(mAutoFullscreenRunnable);
- mHandler.postDelayed(mAutoFullscreenRunnable, mAutoFullscreenTimeoutMillis);
+ autoFullScreenPending = true;
+ handler.removeCallbacks(autoFullscreenRunnable);
+ handler.postDelayed(autoFullscreenRunnable, autoFullscreenTimeoutMillis);
}
/** Cancels pending auto fullscreen mode. */
@Override
public void cancelAutoFullScreen() {
- if (!mAutoFullScreenPending) {
+ if (!autoFullScreenPending) {
LogUtil.v("VideoCallPresenter.cancelAutoFullScreen", "none pending.");
return;
}
LogUtil.v("VideoCallPresenter.cancelAutoFullScreen", "cancelling pending");
- mAutoFullScreenPending = false;
- mHandler.removeCallbacks(mAutoFullscreenRunnable);
+ autoFullScreenPending = false;
+ handler.removeCallbacks(autoFullscreenRunnable);
}
@Override
public boolean shouldShowCameraPermissionToast() {
- if (mPrimaryCall == null) {
+ if (primaryCall == null) {
LogUtil.i("VideoCallPresenter.shouldShowCameraPermissionToast", "null call");
return false;
}
- if (mPrimaryCall.didShowCameraPermission()) {
+ if (primaryCall.didShowCameraPermission()) {
LogUtil.i(
"VideoCallPresenter.shouldShowCameraPermissionToast", "already shown for this call");
return false;
}
- if (!ConfigProviderBindings.get(mContext)
- .getBoolean("camera_permission_dialog_allowed", true)) {
+ if (!ConfigProviderBindings.get(context).getBoolean("camera_permission_dialog_allowed", true)) {
LogUtil.i("VideoCallPresenter.shouldShowCameraPermissionToast", "disabled by config");
return false;
}
- return !VideoUtils.hasCameraPermission(mContext)
- || !PermissionsUtil.hasCameraPrivacyToastShown(mContext);
+ return !VideoUtils.hasCameraPermission(context)
+ || !PermissionsUtil.hasCameraPrivacyToastShown(context);
}
@Override
public void onCameraPermissionDialogShown() {
- if (mPrimaryCall != null) {
- mPrimaryCall.setDidShowCameraPermission(true);
+ if (primaryCall != null) {
+ primaryCall.setDidShowCameraPermission(true);
}
}
private void updateRemoteVideoSurfaceDimensions() {
- Activity activity = mVideoCallScreen.getVideoCallScreenFragment().getActivity();
+ Activity activity = videoCallScreen.getVideoCallScreenFragment().getActivity();
if (activity != null) {
Point screenSize = new Point();
activity.getWindowManager().getDefaultDisplay().getSize(screenSize);
@@ -1131,46 +1129,46 @@ public class VideoCallPresenter
private class LocalDelegate implements VideoSurfaceDelegate {
@Override
public void onSurfaceCreated(VideoSurfaceTexture videoCallSurface) {
- if (mVideoCallScreen == null) {
+ if (videoCallScreen == null) {
LogUtil.e("VideoCallPresenter.LocalDelegate.onSurfaceCreated", "no UI");
return;
}
- if (mVideoCall == null) {
+ if (videoCall == null) {
LogUtil.e("VideoCallPresenter.LocalDelegate.onSurfaceCreated", "no video call");
return;
}
// If the preview surface has just been created and we have already received camera
// capabilities, but not yet set the surface, we will set the surface now.
- if (mPreviewSurfaceState == PreviewSurfaceState.CAPABILITIES_RECEIVED) {
- mPreviewSurfaceState = PreviewSurfaceState.SURFACE_SET;
- mVideoCall.setPreviewSurface(videoCallSurface.getSavedSurface());
- } else if (mPreviewSurfaceState == PreviewSurfaceState.NONE && isCameraRequired()) {
- enableCamera(mPrimaryCall, true);
+ if (previewSurfaceState == PreviewSurfaceState.CAPABILITIES_RECEIVED) {
+ previewSurfaceState = PreviewSurfaceState.SURFACE_SET;
+ videoCall.setPreviewSurface(videoCallSurface.getSavedSurface());
+ } else if (previewSurfaceState == PreviewSurfaceState.NONE && isCameraRequired()) {
+ enableCamera(primaryCall, true);
}
}
@Override
public void onSurfaceReleased(VideoSurfaceTexture videoCallSurface) {
- if (mVideoCall == null) {
+ if (videoCall == null) {
LogUtil.e("VideoCallPresenter.LocalDelegate.onSurfaceReleased", "no video call");
return;
}
- mVideoCall.setPreviewSurface(null);
- enableCamera(mPrimaryCall, false);
+ videoCall.setPreviewSurface(null);
+ enableCamera(primaryCall, false);
}
@Override
public void onSurfaceDestroyed(VideoSurfaceTexture videoCallSurface) {
- if (mVideoCall == null) {
+ if (videoCall == null) {
LogUtil.e("VideoCallPresenter.LocalDelegate.onSurfaceDestroyed", "no video call");
return;
}
boolean isChangingConfigurations = InCallPresenter.getInstance().isChangingConfigurations();
if (!isChangingConfigurations) {
- enableCamera(mPrimaryCall, false);
+ enableCamera(primaryCall, false);
} else {
LogUtil.i(
"VideoCallPresenter.LocalDelegate.onSurfaceDestroyed",
@@ -1187,24 +1185,24 @@ public class VideoCallPresenter
private class RemoteDelegate implements VideoSurfaceDelegate {
@Override
public void onSurfaceCreated(VideoSurfaceTexture videoCallSurface) {
- if (mVideoCallScreen == null) {
+ if (videoCallScreen == null) {
LogUtil.e("VideoCallPresenter.RemoteDelegate.onSurfaceCreated", "no UI");
return;
}
- if (mVideoCall == null) {
+ if (videoCall == null) {
LogUtil.e("VideoCallPresenter.RemoteDelegate.onSurfaceCreated", "no video call");
return;
}
- mVideoCall.setDisplaySurface(videoCallSurface.getSavedSurface());
+ videoCall.setDisplaySurface(videoCallSurface.getSavedSurface());
}
@Override
public void onSurfaceReleased(VideoSurfaceTexture videoCallSurface) {
- if (mVideoCall == null) {
+ if (videoCall == null) {
LogUtil.e("VideoCallPresenter.RemoteDelegate.onSurfaceReleased", "no video call");
return;
}
- mVideoCall.setDisplaySurface(null);
+ videoCall.setDisplaySurface(null);
}
@Override
diff --git a/java/com/android/incallui/VideoPauseController.java b/java/com/android/incallui/VideoPauseController.java
index 36c9ef350..1a65010f0 100644
--- a/java/com/android/incallui/VideoPauseController.java
+++ b/java/com/android/incallui/VideoPauseController.java
@@ -32,26 +32,26 @@ import java.util.Objects;
* to the background and subsequently brought back to the foreground.
*/
class VideoPauseController implements InCallStateListener, IncomingCallListener {
- private static VideoPauseController sVideoPauseController;
- private InCallPresenter mInCallPresenter;
+ private static VideoPauseController videoPauseController;
+ private InCallPresenter inCallPresenter;
/** The current call, if applicable. */
- private DialerCall mPrimaryCall = null;
+ private DialerCall primaryCall = null;
/**
* The cached state of primary call, updated after onStateChange has processed.
*
* <p>These values are stored to detect specific changes in state between onStateChange calls.
*/
- private int mPrevCallState = State.INVALID;
+ private int prevCallState = State.INVALID;
- private boolean mWasVideoCall = false;
+ private boolean wasVideoCall = false;
/**
* Tracks whether the application is in the background. {@code True} if the application is in the
* background, {@code false} otherwise.
*/
- private boolean mIsInBackground = false;
+ private boolean isInBackground = false;
/**
* Singleton accessor for the {@link VideoPauseController}.
@@ -60,10 +60,10 @@ class VideoPauseController implements InCallStateListener, IncomingCallListener
*/
/*package*/
static synchronized VideoPauseController getInstance() {
- if (sVideoPauseController == null) {
- sVideoPauseController = new VideoPauseController();
+ if (videoPauseController == null) {
+ videoPauseController = new VideoPauseController();
}
- return sVideoPauseController;
+ return videoPauseController;
}
/**
@@ -84,7 +84,7 @@ class VideoPauseController implements InCallStateListener, IncomingCallListener
* @return {@code true} if the call is dialing, {@code false} otherwise.
*/
private boolean wasDialing() {
- return DialerCall.State.isDialing(mPrevCallState);
+ return DialerCall.State.isDialing(prevCallState);
}
/**
@@ -95,9 +95,9 @@ class VideoPauseController implements InCallStateListener, IncomingCallListener
*/
public void setUp(@NonNull InCallPresenter inCallPresenter) {
LogUtil.enterBlock("VideoPauseController.setUp");
- mInCallPresenter = Assert.isNotNull(inCallPresenter);
- mInCallPresenter.addListener(this);
- mInCallPresenter.addIncomingCallListener(this);
+ this.inCallPresenter = Assert.isNotNull(inCallPresenter);
+ this.inCallPresenter.addListener(this);
+ this.inCallPresenter.addIncomingCallListener(this);
}
/**
@@ -106,18 +106,18 @@ class VideoPauseController implements InCallStateListener, IncomingCallListener
*/
public void tearDown() {
LogUtil.enterBlock("VideoPauseController.tearDown");
- mInCallPresenter.removeListener(this);
- mInCallPresenter.removeIncomingCallListener(this);
+ inCallPresenter.removeListener(this);
+ inCallPresenter.removeIncomingCallListener(this);
clear();
}
/** Clears the internal state for the {@link VideoPauseController}. */
private void clear() {
- mInCallPresenter = null;
- mPrimaryCall = null;
- mPrevCallState = State.INVALID;
- mWasVideoCall = false;
- mIsInBackground = false;
+ inCallPresenter = null;
+ primaryCall = null;
+ prevCallState = State.INVALID;
+ wasVideoCall = false;
+ isInBackground = false;
}
/**
@@ -143,7 +143,7 @@ class VideoPauseController implements InCallStateListener, IncomingCallListener
call = callList.getActiveCall();
}
- boolean hasPrimaryCallChanged = !Objects.equals(call, mPrimaryCall);
+ boolean hasPrimaryCallChanged = !Objects.equals(call, primaryCall);
boolean canVideoPause = videoCanPause(call);
LogUtil.i(
@@ -151,18 +151,18 @@ class VideoPauseController implements InCallStateListener, IncomingCallListener
"hasPrimaryCallChanged: %b, videoCanPause: %b, isInBackground: %b",
hasPrimaryCallChanged,
canVideoPause,
- mIsInBackground);
+ isInBackground);
if (hasPrimaryCallChanged) {
onPrimaryCallChanged(call);
return;
}
- if (wasDialing() && canVideoPause && mIsInBackground) {
+ if (wasDialing() && canVideoPause && isInBackground) {
// Bring UI to foreground if outgoing request becomes active while UI is in
// background.
bringToForeground();
- } else if (!mWasVideoCall && canVideoPause && mIsInBackground) {
+ } else if (!wasVideoCall && canVideoPause && isInBackground) {
// Bring UI to foreground if VoLTE call becomes active while UI is in
// background.
bringToForeground();
@@ -185,22 +185,22 @@ class VideoPauseController implements InCallStateListener, IncomingCallListener
"VideoPauseController.onPrimaryCallChanged",
"new call: %s, old call: %s, mIsInBackground: %b",
call,
- mPrimaryCall,
- mIsInBackground);
+ primaryCall,
+ isInBackground);
- if (Objects.equals(call, mPrimaryCall)) {
+ if (Objects.equals(call, primaryCall)) {
throw new IllegalStateException();
}
final boolean canVideoPause = videoCanPause(call);
- if (canVideoPause && !mIsInBackground) {
+ if (canVideoPause && !isInBackground) {
// Send resume request for the active call, if user rejects incoming call, ends dialing
// call, or the call was previously in a paused state and UI is in the foreground.
sendRequest(call, true);
- } else if (isIncomingCall(call) && videoCanPause(mPrimaryCall)) {
+ } else if (isIncomingCall(call) && videoCanPause(primaryCall)) {
// Send pause request if there is an active video call, and we just received a new
// incoming call.
- sendRequest(mPrimaryCall, false);
+ sendRequest(primaryCall, false);
}
updatePrimaryCallContext(call);
@@ -222,7 +222,7 @@ class VideoPauseController implements InCallStateListener, IncomingCallListener
newState,
call);
- if (Objects.equals(call, mPrimaryCall)) {
+ if (Objects.equals(call, primaryCall)) {
return;
}
@@ -236,13 +236,13 @@ class VideoPauseController implements InCallStateListener, IncomingCallListener
*/
private void updatePrimaryCallContext(DialerCall call) {
if (call == null) {
- mPrimaryCall = null;
- mPrevCallState = State.INVALID;
- mWasVideoCall = false;
+ primaryCall = null;
+ prevCallState = State.INVALID;
+ wasVideoCall = false;
} else {
- mPrimaryCall = call;
- mPrevCallState = call.getState();
- mWasVideoCall = call.isVideoCall();
+ primaryCall = call;
+ prevCallState = call.getState();
+ wasVideoCall = call.isVideoCall();
}
}
@@ -252,11 +252,11 @@ class VideoPauseController implements InCallStateListener, IncomingCallListener
* @param showing true if UI is in the foreground, false otherwise.
*/
public void onUiShowing(boolean showing) {
- if (mInCallPresenter == null) {
+ if (inCallPresenter == null) {
return;
}
- final boolean isInCall = mInCallPresenter.getInCallState() == InCallState.INCALL;
+ final boolean isInCall = inCallPresenter.getInCallState() == InCallState.INCALL;
if (showing) {
onResume(isInCall);
} else {
@@ -272,9 +272,9 @@ class VideoPauseController implements InCallStateListener, IncomingCallListener
* video provider if we are in a call.
*/
private void onResume(boolean isInCall) {
- mIsInBackground = false;
+ isInBackground = false;
if (isInCall) {
- sendRequest(mPrimaryCall, true);
+ sendRequest(primaryCall, true);
}
}
@@ -286,16 +286,16 @@ class VideoPauseController implements InCallStateListener, IncomingCallListener
* video provider if we are in a call.
*/
private void onPause(boolean isInCall) {
- mIsInBackground = true;
+ isInBackground = true;
if (isInCall) {
- sendRequest(mPrimaryCall, false);
+ sendRequest(primaryCall, false);
}
}
private void bringToForeground() {
LogUtil.enterBlock("VideoPauseController.bringToForeground");
- if (mInCallPresenter != null) {
- mInCallPresenter.bringToForeground(false);
+ if (inCallPresenter != null) {
+ inCallPresenter.bringToForeground(false);
} else {
LogUtil.e(
"VideoPauseController.bringToForeground",
diff --git a/java/com/android/incallui/answer/impl/FixedAspectSurfaceView.java b/java/com/android/incallui/answer/impl/FixedAspectSurfaceView.java
index ad7d94d95..1f7e6fe91 100644
--- a/java/com/android/incallui/answer/impl/FixedAspectSurfaceView.java
+++ b/java/com/android/incallui/answer/impl/FixedAspectSurfaceView.java
@@ -34,7 +34,7 @@ import com.android.dialer.common.Assert;
public class FixedAspectSurfaceView extends SurfaceView {
/** Desired width/height ratio */
- private float mAspectRatio;
+ private float aspectRatio;
private final boolean scaleWidth;
private final boolean scaleHeight;
@@ -60,7 +60,7 @@ public class FixedAspectSurfaceView extends SurfaceView {
*/
public void setAspectRatio(float aspect) {
Assert.checkArgument(aspect >= 0, "Aspect ratio must be positive");
- mAspectRatio = aspect;
+ aspectRatio = aspect;
requestLayout();
}
@@ -71,9 +71,9 @@ public class FixedAspectSurfaceView extends SurfaceView {
// Do the scaling
if (scaleWidth) {
- width = (int) (height * mAspectRatio);
+ width = (int) (height * aspectRatio);
} else if (scaleHeight) {
- height = (int) (width / mAspectRatio);
+ height = (int) (width / aspectRatio);
}
// Override width/height if needed for EXACTLY and AT_MOST specs
diff --git a/java/com/android/incallui/answer/impl/affordance/SwipeButtonHelper.java b/java/com/android/incallui/answer/impl/affordance/SwipeButtonHelper.java
index 1c66e63b8..6fb520c8c 100644
--- a/java/com/android/incallui/answer/impl/affordance/SwipeButtonHelper.java
+++ b/java/com/android/incallui/answer/impl/affordance/SwipeButtonHelper.java
@@ -273,16 +273,16 @@ public class SwipeButtonHelper {
}
animator.addListener(
new AnimatorListenerAdapter() {
- private boolean mCancelled;
+ private boolean cancelled;
@Override
public void onAnimationCancel(Animator animation) {
- mCancelled = true;
+ cancelled = true;
}
@Override
public void onAnimationEnd(Animator animation) {
- if (mCancelled) {
+ if (cancelled) {
swipeAnimator = null;
targetedView = null;
if (onFinishedListener != null) {
diff --git a/java/com/android/incallui/answer/impl/affordance/SwipeButtonView.java b/java/com/android/incallui/answer/impl/affordance/SwipeButtonView.java
index 46879ea3f..249c47a65 100644
--- a/java/com/android/incallui/answer/impl/affordance/SwipeButtonView.java
+++ b/java/com/android/incallui/answer/impl/affordance/SwipeButtonView.java
@@ -474,16 +474,16 @@ public class SwipeButtonView extends ImageView {
private Animator.AnimatorListener getEndListener(final Runnable runnable) {
return new AnimatorListenerAdapter() {
- boolean mCancelled;
+ boolean cancelled;
@Override
public void onAnimationCancel(Animator animation) {
- mCancelled = true;
+ cancelled = true;
}
@Override
public void onAnimationEnd(Animator animation) {
- if (!mCancelled) {
+ if (!cancelled) {
runnable.run();
}
}
diff --git a/java/com/android/incallui/answer/impl/classifier/AccelerationClassifier.java b/java/com/android/incallui/answer/impl/classifier/AccelerationClassifier.java
index ac504444e..ae0d1c800 100644
--- a/java/com/android/incallui/answer/impl/classifier/AccelerationClassifier.java
+++ b/java/com/android/incallui/answer/impl/classifier/AccelerationClassifier.java
@@ -29,10 +29,10 @@ import java.util.Map;
* the speed of a part.
*/
class AccelerationClassifier extends StrokeClassifier {
- private final Map<Stroke, Data> mStrokeMap = new ArrayMap<>();
+ private final Map<Stroke, Data> strokeMap = new ArrayMap<>();
public AccelerationClassifier(ClassifierData classifierData) {
- mClassifierData = classifierData;
+ this.classifierData = classifierData;
}
@Override
@@ -45,23 +45,23 @@ class AccelerationClassifier extends StrokeClassifier {
int action = event.getActionMasked();
if (action == MotionEvent.ACTION_DOWN) {
- mStrokeMap.clear();
+ strokeMap.clear();
}
for (int i = 0; i < event.getPointerCount(); i++) {
- Stroke stroke = mClassifierData.getStroke(event.getPointerId(i));
+ Stroke stroke = classifierData.getStroke(event.getPointerId(i));
Point point = stroke.getPoints().get(stroke.getPoints().size() - 1);
- if (mStrokeMap.get(stroke) == null) {
- mStrokeMap.put(stroke, new Data(point));
+ if (strokeMap.get(stroke) == null) {
+ strokeMap.put(stroke, new Data(point));
} else {
- mStrokeMap.get(stroke).addPoint(point);
+ strokeMap.get(stroke).addPoint(point);
}
}
}
@Override
public float getFalseTouchEvaluation(Stroke stroke) {
- Data data = mStrokeMap.get(stroke);
+ Data data = strokeMap.get(stroke);
return 2 * SpeedRatioEvaluator.evaluate(data.maxSpeedRatio);
}
diff --git a/java/com/android/incallui/answer/impl/classifier/AnglesClassifier.java b/java/com/android/incallui/answer/impl/classifier/AnglesClassifier.java
index dbfbcfc1c..24f04c438 100644
--- a/java/com/android/incallui/answer/impl/classifier/AnglesClassifier.java
+++ b/java/com/android/incallui/answer/impl/classifier/AnglesClassifier.java
@@ -47,10 +47,10 @@ import java.util.Map;
* angels or right angles)
*/
class AnglesClassifier extends StrokeClassifier {
- private Map<Stroke, Data> mStrokeMap = new ArrayMap<>();
+ private Map<Stroke, Data> strokeMap = new ArrayMap<>();
public AnglesClassifier(ClassifierData classifierData) {
- mClassifierData = classifierData;
+ this.classifierData = classifierData;
}
@Override
@@ -63,22 +63,22 @@ class AnglesClassifier extends StrokeClassifier {
int action = event.getActionMasked();
if (action == MotionEvent.ACTION_DOWN) {
- mStrokeMap.clear();
+ strokeMap.clear();
}
for (int i = 0; i < event.getPointerCount(); i++) {
- Stroke stroke = mClassifierData.getStroke(event.getPointerId(i));
+ Stroke stroke = classifierData.getStroke(event.getPointerId(i));
- if (mStrokeMap.get(stroke) == null) {
- mStrokeMap.put(stroke, new Data());
+ if (strokeMap.get(stroke) == null) {
+ strokeMap.put(stroke, new Data());
}
- mStrokeMap.get(stroke).addPoint(stroke.getPoints().get(stroke.getPoints().size() - 1));
+ strokeMap.get(stroke).addPoint(stroke.getPoints().get(stroke.getPoints().size() - 1));
}
}
@Override
public float getFalseTouchEvaluation(Stroke stroke) {
- Data data = mStrokeMap.get(stroke);
+ Data data = strokeMap.get(stroke);
return AnglesVarianceEvaluator.evaluate(data.getAnglesVariance())
+ AnglesPercentageEvaluator.evaluate(data.getAnglesPercentage());
}
@@ -87,82 +87,82 @@ class AnglesClassifier extends StrokeClassifier {
private static final float ANGLE_DEVIATION = (float) Math.PI / 20.0f;
private static final float MIN_MOVE_DIST_DP = .01f;
- private List<Point> mLastThreePoints = new ArrayList<>();
- private float mFirstAngleVariance;
- private float mPreviousAngle;
- private float mBiggestAngle;
- private float mSumSquares;
- private float mSecondSumSquares;
- private float mSum;
- private float mSecondSum;
- private float mCount;
- private float mSecondCount;
- private float mFirstLength;
- private float mLength;
- private float mAnglesCount;
- private float mLeftAngles;
- private float mRightAngles;
- private float mStraightAngles;
+ private List<Point> lastThreePoints = new ArrayList<>();
+ private float firstAngleVariance;
+ private float previousAngle;
+ private float biggestAngle;
+ private float sumSquares;
+ private float secondSumSquares;
+ private float sum;
+ private float secondSum;
+ private float count;
+ private float secondCount;
+ private float firstLength;
+ private float length;
+ private float anglesCount;
+ private float leftAngles;
+ private float rightAngles;
+ private float straightAngles;
public Data() {
- mFirstAngleVariance = 0.0f;
- mPreviousAngle = (float) Math.PI;
- mBiggestAngle = 0.0f;
- mSumSquares = mSecondSumSquares = 0.0f;
- mSum = mSecondSum = 0.0f;
- mCount = mSecondCount = 1.0f;
- mLength = mFirstLength = 0.0f;
- mAnglesCount = mLeftAngles = mRightAngles = mStraightAngles = 0.0f;
+ firstAngleVariance = 0.0f;
+ previousAngle = (float) Math.PI;
+ biggestAngle = 0.0f;
+ sumSquares = secondSumSquares = 0.0f;
+ sum = secondSum = 0.0f;
+ count = secondCount = 1.0f;
+ length = firstLength = 0.0f;
+ anglesCount = leftAngles = rightAngles = straightAngles = 0.0f;
}
public void addPoint(Point point) {
// Checking if the added point is different than the previously added point
// Repetitions and short distances are being ignored so that proper angles are calculated.
- if (mLastThreePoints.isEmpty()
- || (!mLastThreePoints.get(mLastThreePoints.size() - 1).equals(point)
- && (mLastThreePoints.get(mLastThreePoints.size() - 1).dist(point)
+ if (lastThreePoints.isEmpty()
+ || (!lastThreePoints.get(lastThreePoints.size() - 1).equals(point)
+ && (lastThreePoints.get(lastThreePoints.size() - 1).dist(point)
> MIN_MOVE_DIST_DP))) {
- if (!mLastThreePoints.isEmpty()) {
- mLength += mLastThreePoints.get(mLastThreePoints.size() - 1).dist(point);
+ if (!lastThreePoints.isEmpty()) {
+ length += lastThreePoints.get(lastThreePoints.size() - 1).dist(point);
}
- mLastThreePoints.add(point);
- if (mLastThreePoints.size() == 4) {
- mLastThreePoints.remove(0);
+ lastThreePoints.add(point);
+ if (lastThreePoints.size() == 4) {
+ lastThreePoints.remove(0);
float angle =
- mLastThreePoints.get(1).getAngle(mLastThreePoints.get(0), mLastThreePoints.get(2));
+ lastThreePoints.get(1).getAngle(lastThreePoints.get(0), lastThreePoints.get(2));
- mAnglesCount++;
+ anglesCount++;
if (angle < Math.PI - ANGLE_DEVIATION) {
- mLeftAngles++;
+ leftAngles++;
} else if (angle <= Math.PI + ANGLE_DEVIATION) {
- mStraightAngles++;
+ straightAngles++;
} else {
- mRightAngles++;
+ rightAngles++;
}
- float difference = angle - mPreviousAngle;
+ float difference = angle - previousAngle;
// If this is the biggest angle of the stroke so then we save the value of
// the angle variance so far and start to count the values for the angle
// variance of the second part.
- if (mBiggestAngle < angle) {
- mBiggestAngle = angle;
- mFirstLength = mLength;
- mFirstAngleVariance = getAnglesVariance(mSumSquares, mSum, mCount);
- mSecondSumSquares = 0.0f;
- mSecondSum = 0.0f;
- mSecondCount = 1.0f;
+ if (biggestAngle < angle) {
+ biggestAngle = angle;
+ firstLength = length;
+ firstAngleVariance = getAnglesVariance(sumSquares, sum, count);
+ secondSumSquares = 0.0f;
+ secondSum = 0.0f;
+ secondCount = 1.0f;
} else {
- mSecondSum += difference;
- mSecondSumSquares += difference * difference;
- mSecondCount += 1.0f;
+ secondSum += difference;
+ secondSumSquares += difference * difference;
+ secondCount += 1.0f;
}
- mSum += difference;
- mSumSquares += difference * difference;
- mCount += 1.0f;
- mPreviousAngle = angle;
+ sum += difference;
+ sumSquares += difference * difference;
+ count += 1.0f;
+ previousAngle = angle;
}
}
}
@@ -172,22 +172,21 @@ class AnglesClassifier extends StrokeClassifier {
}
public float getAnglesVariance() {
- float anglesVariance = getAnglesVariance(mSumSquares, mSum, mCount);
- if (mFirstLength < mLength / 2f) {
+ float anglesVariance = getAnglesVariance(sumSquares, sum, count);
+ if (firstLength < length / 2f) {
anglesVariance =
Math.min(
anglesVariance,
- mFirstAngleVariance
- + getAnglesVariance(mSecondSumSquares, mSecondSum, mSecondCount));
+ firstAngleVariance + getAnglesVariance(secondSumSquares, secondSum, secondCount));
}
return anglesVariance;
}
public float getAnglesPercentage() {
- if (mAnglesCount == 0.0f) {
+ if (anglesCount == 0.0f) {
return 1.0f;
}
- return (Math.max(mLeftAngles, mRightAngles) + mStraightAngles) / mAnglesCount;
+ return (Math.max(leftAngles, rightAngles) + straightAngles) / anglesCount;
}
}
}
diff --git a/java/com/android/incallui/answer/impl/classifier/Classifier.java b/java/com/android/incallui/answer/impl/classifier/Classifier.java
index c6fbff327..1baa6b4f4 100644
--- a/java/com/android/incallui/answer/impl/classifier/Classifier.java
+++ b/java/com/android/incallui/answer/impl/classifier/Classifier.java
@@ -23,7 +23,7 @@ import android.view.MotionEvent;
abstract class Classifier {
/** Contains all the information about touch events from which the classifier can query */
- protected ClassifierData mClassifierData;
+ protected ClassifierData classifierData;
/** Informs the classifier that a new touch event has occurred */
public void onTouchEvent(MotionEvent event) {}
diff --git a/java/com/android/incallui/answer/impl/classifier/ClassifierData.java b/java/com/android/incallui/answer/impl/classifier/ClassifierData.java
index ae07d27a0..fe3fbe0cf 100644
--- a/java/com/android/incallui/answer/impl/classifier/ClassifierData.java
+++ b/java/com/android/incallui/answer/impl/classifier/ClassifierData.java
@@ -26,31 +26,31 @@ import java.util.concurrent.TimeUnit;
* example, provide information on the current touch state.
*/
class ClassifierData {
- private SparseArray<Stroke> mCurrentStrokes = new SparseArray<>();
- private ArrayList<Stroke> mEndingStrokes = new ArrayList<>();
- private final float mDpi;
- private final float mScreenHeight;
+ private SparseArray<Stroke> currentStrokes = new SparseArray<>();
+ private ArrayList<Stroke> endingStrokes = new ArrayList<>();
+ private final float dpi;
+ private final float screenHeight;
public ClassifierData(float dpi, float screenHeight) {
- mDpi = dpi;
- mScreenHeight = screenHeight / dpi;
+ this.dpi = dpi;
+ this.screenHeight = screenHeight / dpi;
}
public void update(MotionEvent event) {
- mEndingStrokes.clear();
+ endingStrokes.clear();
int action = event.getActionMasked();
if (action == MotionEvent.ACTION_DOWN) {
- mCurrentStrokes.clear();
+ currentStrokes.clear();
}
for (int i = 0; i < event.getPointerCount(); i++) {
int id = event.getPointerId(i);
- if (mCurrentStrokes.get(id) == null) {
+ if (currentStrokes.get(id) == null) {
// TODO (keyboardr): See if there's a way to use event.getEventTimeNanos() instead
- mCurrentStrokes.put(
- id, new Stroke(TimeUnit.MILLISECONDS.toNanos(event.getEventTime()), mDpi));
+ currentStrokes.put(
+ id, new Stroke(TimeUnit.MILLISECONDS.toNanos(event.getEventTime()), dpi));
}
- mCurrentStrokes
+ currentStrokes
.get(id)
.addPoint(
event.getX(i), event.getY(i), TimeUnit.MILLISECONDS.toNanos(event.getEventTime()));
@@ -58,27 +58,27 @@ class ClassifierData {
if (action == MotionEvent.ACTION_UP
|| action == MotionEvent.ACTION_CANCEL
|| (action == MotionEvent.ACTION_POINTER_UP && i == event.getActionIndex())) {
- mEndingStrokes.add(getStroke(id));
+ endingStrokes.add(getStroke(id));
}
}
}
void cleanUp(MotionEvent event) {
- mEndingStrokes.clear();
+ endingStrokes.clear();
int action = event.getActionMasked();
for (int i = 0; i < event.getPointerCount(); i++) {
int id = event.getPointerId(i);
if (action == MotionEvent.ACTION_UP
|| action == MotionEvent.ACTION_CANCEL
|| (action == MotionEvent.ACTION_POINTER_UP && i == event.getActionIndex())) {
- mCurrentStrokes.remove(id);
+ currentStrokes.remove(id);
}
}
}
/** @return the list of Strokes which are ending in the recently added MotionEvent */
public ArrayList<Stroke> getEndingStrokes() {
- return mEndingStrokes;
+ return endingStrokes;
}
/**
@@ -86,11 +86,11 @@ class ClassifierData {
* @return the Stroke assigned to the id
*/
public Stroke getStroke(int id) {
- return mCurrentStrokes.get(id);
+ return currentStrokes.get(id);
}
/** @return the height of the screen in inches */
public float getScreenHeight() {
- return mScreenHeight;
+ return screenHeight;
}
}
diff --git a/java/com/android/incallui/answer/impl/classifier/EndPointLengthClassifier.java b/java/com/android/incallui/answer/impl/classifier/EndPointLengthClassifier.java
index 95b317638..a111ccc70 100644
--- a/java/com/android/incallui/answer/impl/classifier/EndPointLengthClassifier.java
+++ b/java/com/android/incallui/answer/impl/classifier/EndPointLengthClassifier.java
@@ -21,7 +21,7 @@ package com.android.incallui.answer.impl.classifier;
*/
class EndPointLengthClassifier extends StrokeClassifier {
public EndPointLengthClassifier(ClassifierData classifierData) {
- mClassifierData = classifierData;
+ this.classifierData = classifierData;
}
@Override
diff --git a/java/com/android/incallui/answer/impl/classifier/EndPointRatioClassifier.java b/java/com/android/incallui/answer/impl/classifier/EndPointRatioClassifier.java
index 01a35c126..4336e00da 100644
--- a/java/com/android/incallui/answer/impl/classifier/EndPointRatioClassifier.java
+++ b/java/com/android/incallui/answer/impl/classifier/EndPointRatioClassifier.java
@@ -22,7 +22,7 @@ package com.android.incallui.answer.impl.classifier;
*/
class EndPointRatioClassifier extends StrokeClassifier {
public EndPointRatioClassifier(ClassifierData classifierData) {
- mClassifierData = classifierData;
+ this.classifierData = classifierData;
}
@Override
diff --git a/java/com/android/incallui/answer/impl/classifier/FalsingManager.java b/java/com/android/incallui/answer/impl/classifier/FalsingManager.java
index 9cdd888d1..3deff8852 100644
--- a/java/com/android/incallui/answer/impl/classifier/FalsingManager.java
+++ b/java/com/android/incallui/answer/impl/classifier/FalsingManager.java
@@ -36,23 +36,23 @@ public class FalsingManager implements SensorEventListener {
Sensor.TYPE_PROXIMITY,
};
- private final SensorManager mSensorManager;
- private final HumanInteractionClassifier mHumanInteractionClassifier;
- private final AccessibilityManager mAccessibilityManager;
+ private final SensorManager sensorManager;
+ private final HumanInteractionClassifier humanInteractionClassifier;
+ private final AccessibilityManager accessibilityManager;
- private boolean mSessionActive = false;
- private boolean mScreenOn;
+ private boolean sessionActive = false;
+ private boolean screenOn;
public FalsingManager(Context context) {
- mSensorManager = context.getSystemService(SensorManager.class);
- mAccessibilityManager = context.getSystemService(AccessibilityManager.class);
- mHumanInteractionClassifier = new HumanInteractionClassifier(context);
- mScreenOn = context.getSystemService(PowerManager.class).isInteractive();
+ sensorManager = context.getSystemService(SensorManager.class);
+ accessibilityManager = context.getSystemService(AccessibilityManager.class);
+ humanInteractionClassifier = new HumanInteractionClassifier(context);
+ screenOn = context.getSystemService(PowerManager.class).isInteractive();
}
/** Returns {@code true} iff the FalsingManager is enabled and able to classify touches */
public boolean isEnabled() {
- return mHumanInteractionClassifier.isEnabled();
+ return humanInteractionClassifier.isEnabled();
}
/**
@@ -62,8 +62,8 @@ public class FalsingManager implements SensorEventListener {
public boolean isFalseTouch() {
// Touch exploration triggers false positives in the classifier and
// already sufficiently prevents false unlocks.
- return !mAccessibilityManager.isTouchExplorationEnabled()
- && mHumanInteractionClassifier.isFalseTouch();
+ return !accessibilityManager.isTouchExplorationEnabled()
+ && humanInteractionClassifier.isFalseTouch();
}
/**
@@ -71,7 +71,7 @@ public class FalsingManager implements SensorEventListener {
* tracking changes if the manager is enabled.
*/
public void onScreenOn() {
- mScreenOn = true;
+ screenOn = true;
sessionEntrypoint();
}
@@ -80,7 +80,7 @@ public class FalsingManager implements SensorEventListener {
* will cause the manager to stop tracking changes.
*/
public void onScreenOff() {
- mScreenOn = false;
+ screenOn = false;
sessionExitpoint();
}
@@ -90,25 +90,25 @@ public class FalsingManager implements SensorEventListener {
* @param event MotionEvent to be classified as human or false.
*/
public void onTouchEvent(MotionEvent event) {
- if (mSessionActive) {
- mHumanInteractionClassifier.onTouchEvent(event);
+ if (sessionActive) {
+ humanInteractionClassifier.onTouchEvent(event);
}
}
@Override
public synchronized void onSensorChanged(SensorEvent event) {
- mHumanInteractionClassifier.onSensorChanged(event);
+ humanInteractionClassifier.onSensorChanged(event);
}
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {}
private boolean shouldSessionBeActive() {
- return isEnabled() && mScreenOn;
+ return isEnabled() && screenOn;
}
private boolean sessionEntrypoint() {
- if (!mSessionActive && shouldSessionBeActive()) {
+ if (!sessionActive && shouldSessionBeActive()) {
onSessionStart();
return true;
}
@@ -116,16 +116,16 @@ public class FalsingManager implements SensorEventListener {
}
private void sessionExitpoint() {
- if (mSessionActive && !shouldSessionBeActive()) {
- mSessionActive = false;
- mSensorManager.unregisterListener(this);
+ if (sessionActive && !shouldSessionBeActive()) {
+ sessionActive = false;
+ sensorManager.unregisterListener(this);
}
}
private void onSessionStart() {
- mSessionActive = true;
+ sessionActive = true;
- if (mHumanInteractionClassifier.isEnabled()) {
+ if (humanInteractionClassifier.isEnabled()) {
registerSensors(CLASSIFIER_SENSORS);
}
}
@@ -134,11 +134,11 @@ public class FalsingManager implements SensorEventListener {
Trace.beginSection("FalsingManager.registerSensors");
for (int sensorType : sensors) {
Trace.beginSection("get sensor " + sensorType);
- Sensor s = mSensorManager.getDefaultSensor(sensorType);
+ Sensor s = sensorManager.getDefaultSensor(sensorType);
Trace.endSection();
if (s != null) {
Trace.beginSection("register");
- mSensorManager.registerListener(this, s, SensorManager.SENSOR_DELAY_GAME);
+ sensorManager.registerListener(this, s, SensorManager.SENSOR_DELAY_GAME);
Trace.endSection();
}
}
diff --git a/java/com/android/incallui/answer/impl/classifier/HistoryEvaluator.java b/java/com/android/incallui/answer/impl/classifier/HistoryEvaluator.java
index 3f302c65f..c0256a5d8 100644
--- a/java/com/android/incallui/answer/impl/classifier/HistoryEvaluator.java
+++ b/java/com/android/incallui/answer/impl/classifier/HistoryEvaluator.java
@@ -17,7 +17,6 @@
package com.android.incallui.answer.impl.classifier;
import android.os.SystemClock;
-
import java.util.ArrayList;
/**
@@ -28,27 +27,27 @@ class HistoryEvaluator {
private static final float HISTORY_FACTOR = 0.9f;
private static final float EPSILON = 1e-5f;
- private final ArrayList<Data> mStrokes = new ArrayList<>();
- private final ArrayList<Data> mGestureWeights = new ArrayList<>();
- private long mLastUpdate;
+ private final ArrayList<Data> strokes = new ArrayList<>();
+ private final ArrayList<Data> gestureWeights = new ArrayList<>();
+ private long lastUpdate;
public HistoryEvaluator() {
- mLastUpdate = SystemClock.elapsedRealtime();
+ lastUpdate = SystemClock.elapsedRealtime();
}
public void addStroke(float evaluation) {
decayValue();
- mStrokes.add(new Data(evaluation));
+ strokes.add(new Data(evaluation));
}
public void addGesture(float evaluation) {
decayValue();
- mGestureWeights.add(new Data(evaluation));
+ gestureWeights.add(new Data(evaluation));
}
/** Calculates the weighted average of strokes and adds to it the weighted average of gestures */
public float getEvaluation() {
- return weightedAverage(mStrokes) + weightedAverage(mGestureWeights);
+ return weightedAverage(strokes) + weightedAverage(gestureWeights);
}
private float weightedAverage(ArrayList<Data> list) {
@@ -71,16 +70,16 @@ class HistoryEvaluator {
private void decayValue() {
long time = SystemClock.elapsedRealtime();
- if (time <= mLastUpdate) {
+ if (time <= lastUpdate) {
return;
}
// All weights are multiplied by HISTORY_FACTOR after each INTERVAL milliseconds.
- float factor = (float) Math.pow(HISTORY_FACTOR, (time - mLastUpdate) / INTERVAL);
+ float factor = (float) Math.pow(HISTORY_FACTOR, (time - lastUpdate) / INTERVAL);
- decayValue(mStrokes, factor);
- decayValue(mGestureWeights, factor);
- mLastUpdate = time;
+ decayValue(strokes, factor);
+ decayValue(gestureWeights, factor);
+ lastUpdate = time;
}
private void decayValue(ArrayList<Data> list, float factor) {
diff --git a/java/com/android/incallui/answer/impl/classifier/HumanInteractionClassifier.java b/java/com/android/incallui/answer/impl/classifier/HumanInteractionClassifier.java
index 5e83dfc78..b661579a3 100644
--- a/java/com/android/incallui/answer/impl/classifier/HumanInteractionClassifier.java
+++ b/java/com/android/incallui/answer/impl/classifier/HumanInteractionClassifier.java
@@ -28,10 +28,10 @@ class HumanInteractionClassifier extends Classifier {
private static final String CONFIG_ANSWER_FALSE_TOUCH_DETECTION_ENABLED =
"answer_false_touch_detection_enabled";
- private final StrokeClassifier[] mStrokeClassifiers;
- private final GestureClassifier[] mGestureClassifiers;
- private final HistoryEvaluator mHistoryEvaluator;
- private final boolean mEnabled;
+ private final StrokeClassifier[] strokeClassifiers;
+ private final GestureClassifier[] gestureClassifiers;
+ private final HistoryEvaluator historyEvaluator;
+ private final boolean enabled;
HumanInteractionClassifier(Context context) {
DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
@@ -41,28 +41,28 @@ class HumanInteractionClassifier extends Classifier {
// take the average.
// Note that xdpi and ydpi are the physical pixels per inch and are not affected by scaling.
float dpi = (displayMetrics.xdpi + displayMetrics.ydpi) / 2.0f;
- mClassifierData = new ClassifierData(dpi, displayMetrics.heightPixels);
- mHistoryEvaluator = new HistoryEvaluator();
- mEnabled =
+ classifierData = new ClassifierData(dpi, displayMetrics.heightPixels);
+ historyEvaluator = new HistoryEvaluator();
+ enabled =
ConfigProviderBindings.get(context)
.getBoolean(CONFIG_ANSWER_FALSE_TOUCH_DETECTION_ENABLED, true);
- mStrokeClassifiers =
+ strokeClassifiers =
new StrokeClassifier[] {
- new AnglesClassifier(mClassifierData),
- new SpeedClassifier(mClassifierData),
- new DurationCountClassifier(mClassifierData),
- new EndPointRatioClassifier(mClassifierData),
- new EndPointLengthClassifier(mClassifierData),
- new AccelerationClassifier(mClassifierData),
- new SpeedAnglesClassifier(mClassifierData),
- new LengthCountClassifier(mClassifierData),
- new DirectionClassifier(mClassifierData)
+ new AnglesClassifier(classifierData),
+ new SpeedClassifier(classifierData),
+ new DurationCountClassifier(classifierData),
+ new EndPointRatioClassifier(classifierData),
+ new EndPointLengthClassifier(classifierData),
+ new AccelerationClassifier(classifierData),
+ new SpeedAnglesClassifier(classifierData),
+ new LengthCountClassifier(classifierData),
+ new DirectionClassifier(classifierData)
};
- mGestureClassifiers =
+ gestureClassifiers =
new GestureClassifier[] {
- new PointerCountClassifier(mClassifierData), new ProximityClassifier(mClassifierData)
+ new PointerCountClassifier(classifierData), new ProximityClassifier(classifierData)
};
}
@@ -80,59 +80,59 @@ class HumanInteractionClassifier extends Classifier {
}
private void addTouchEvent(MotionEvent event) {
- mClassifierData.update(event);
+ classifierData.update(event);
- for (StrokeClassifier c : mStrokeClassifiers) {
+ for (StrokeClassifier c : strokeClassifiers) {
c.onTouchEvent(event);
}
- for (GestureClassifier c : mGestureClassifiers) {
+ for (GestureClassifier c : gestureClassifiers) {
c.onTouchEvent(event);
}
- int size = mClassifierData.getEndingStrokes().size();
+ int size = classifierData.getEndingStrokes().size();
for (int i = 0; i < size; i++) {
- Stroke stroke = mClassifierData.getEndingStrokes().get(i);
+ Stroke stroke = classifierData.getEndingStrokes().get(i);
float evaluation = 0.0f;
- for (StrokeClassifier c : mStrokeClassifiers) {
+ for (StrokeClassifier c : strokeClassifiers) {
float e = c.getFalseTouchEvaluation(stroke);
evaluation += e;
}
- mHistoryEvaluator.addStroke(evaluation);
+ historyEvaluator.addStroke(evaluation);
}
int action = event.getActionMasked();
if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL) {
float evaluation = 0.0f;
- for (GestureClassifier c : mGestureClassifiers) {
+ for (GestureClassifier c : gestureClassifiers) {
float e = c.getFalseTouchEvaluation();
evaluation += e;
}
- mHistoryEvaluator.addGesture(evaluation);
+ historyEvaluator.addGesture(evaluation);
}
- mClassifierData.cleanUp(event);
+ classifierData.cleanUp(event);
}
@Override
public void onSensorChanged(SensorEvent event) {
- for (Classifier c : mStrokeClassifiers) {
+ for (Classifier c : strokeClassifiers) {
c.onSensorChanged(event);
}
- for (Classifier c : mGestureClassifiers) {
+ for (Classifier c : gestureClassifiers) {
c.onSensorChanged(event);
}
}
boolean isFalseTouch() {
- float evaluation = mHistoryEvaluator.getEvaluation();
+ float evaluation = historyEvaluator.getEvaluation();
return evaluation >= 5.0f;
}
public boolean isEnabled() {
- return mEnabled;
+ return enabled;
}
@Override
diff --git a/java/com/android/incallui/answer/impl/classifier/PointerCountClassifier.java b/java/com/android/incallui/answer/impl/classifier/PointerCountClassifier.java
index 070de6c9b..b3ee84984 100644
--- a/java/com/android/incallui/answer/impl/classifier/PointerCountClassifier.java
+++ b/java/com/android/incallui/answer/impl/classifier/PointerCountClassifier.java
@@ -20,10 +20,10 @@ import android.view.MotionEvent;
/** A classifier which looks at the total number of traces in the whole gesture. */
class PointerCountClassifier extends GestureClassifier {
- private int mCount;
+ private int count;
public PointerCountClassifier(ClassifierData classifierData) {
- mCount = 0;
+ count = 0;
}
@Override
@@ -36,16 +36,16 @@ class PointerCountClassifier extends GestureClassifier {
int action = event.getActionMasked();
if (action == MotionEvent.ACTION_DOWN) {
- mCount = 1;
+ count = 1;
}
if (action == MotionEvent.ACTION_POINTER_DOWN) {
- ++mCount;
+ ++count;
}
}
@Override
public float getFalseTouchEvaluation() {
- return PointerCountEvaluator.evaluate(mCount);
+ return PointerCountEvaluator.evaluate(count);
}
}
diff --git a/java/com/android/incallui/answer/impl/classifier/ProximityClassifier.java b/java/com/android/incallui/answer/impl/classifier/ProximityClassifier.java
index 28701ea6d..b63f15d53 100644
--- a/java/com/android/incallui/answer/impl/classifier/ProximityClassifier.java
+++ b/java/com/android/incallui/answer/impl/classifier/ProximityClassifier.java
@@ -26,11 +26,11 @@ import java.util.concurrent.TimeUnit;
* the proximity sensor showing the near state during the whole gesture
*/
class ProximityClassifier extends GestureClassifier {
- private long mGestureStartTimeNano;
- private long mNearStartTimeNano;
- private long mNearDuration;
- private boolean mNear;
- private float mAverageNear;
+ private long gestureStartTimeNano;
+ private long nearStartTimeNano;
+ private long nearDuration;
+ private boolean near;
+ private float averageNear;
public ProximityClassifier(ClassifierData classifierData) {}
@@ -51,19 +51,19 @@ class ProximityClassifier extends GestureClassifier {
int action = event.getActionMasked();
if (action == MotionEvent.ACTION_DOWN) {
- mGestureStartTimeNano = TimeUnit.MILLISECONDS.toNanos(event.getEventTime());
- mNearStartTimeNano = TimeUnit.MILLISECONDS.toNanos(event.getEventTime());
- mNearDuration = 0;
+ gestureStartTimeNano = TimeUnit.MILLISECONDS.toNanos(event.getEventTime());
+ nearStartTimeNano = TimeUnit.MILLISECONDS.toNanos(event.getEventTime());
+ nearDuration = 0;
}
if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL) {
- update(mNear, TimeUnit.MILLISECONDS.toNanos(event.getEventTime()));
- long duration = TimeUnit.MILLISECONDS.toNanos(event.getEventTime()) - mGestureStartTimeNano;
+ update(near, TimeUnit.MILLISECONDS.toNanos(event.getEventTime()));
+ long duration = TimeUnit.MILLISECONDS.toNanos(event.getEventTime()) - gestureStartTimeNano;
if (duration == 0) {
- mAverageNear = mNear ? 1.0f : 0.0f;
+ averageNear = near ? 1.0f : 0.0f;
} else {
- mAverageNear = (float) mNearDuration / (float) duration;
+ averageNear = (float) nearDuration / (float) duration;
}
}
}
@@ -75,23 +75,23 @@ class ProximityClassifier extends GestureClassifier {
private void update(boolean near, long timestampNano) {
// This if is necessary because MotionEvents and SensorEvents do not come in
// chronological order
- if (timestampNano > mNearStartTimeNano) {
+ if (timestampNano > nearStartTimeNano) {
// if the state before was near then add the difference of the current time and
// mNearStartTimeNano to mNearDuration.
- if (mNear) {
- mNearDuration += timestampNano - mNearStartTimeNano;
+ if (this.near) {
+ nearDuration += timestampNano - nearStartTimeNano;
}
// if the new state is near, set mNearStartTimeNano equal to this moment.
if (near) {
- mNearStartTimeNano = timestampNano;
+ nearStartTimeNano = timestampNano;
}
}
- mNear = near;
+ this.near = near;
}
@Override
public float getFalseTouchEvaluation() {
- return ProximityEvaluator.evaluate(mAverageNear);
+ return ProximityEvaluator.evaluate(averageNear);
}
}
diff --git a/java/com/android/incallui/answer/impl/classifier/SpeedAnglesClassifier.java b/java/com/android/incallui/answer/impl/classifier/SpeedAnglesClassifier.java
index 36ae3ad7c..034c4fea3 100644
--- a/java/com/android/incallui/answer/impl/classifier/SpeedAnglesClassifier.java
+++ b/java/com/android/incallui/answer/impl/classifier/SpeedAnglesClassifier.java
@@ -33,10 +33,10 @@ import java.util.Map;
* a good stroke is most often increases, so most of these angels should be in this interval.
*/
class SpeedAnglesClassifier extends StrokeClassifier {
- private Map<Stroke, Data> mStrokeMap = new ArrayMap<>();
+ private Map<Stroke, Data> strokeMap = new ArrayMap<>();
public SpeedAnglesClassifier(ClassifierData classifierData) {
- mClassifierData = classifierData;
+ this.classifierData = classifierData;
}
@Override
@@ -49,27 +49,27 @@ class SpeedAnglesClassifier extends StrokeClassifier {
int action = event.getActionMasked();
if (action == MotionEvent.ACTION_DOWN) {
- mStrokeMap.clear();
+ strokeMap.clear();
}
for (int i = 0; i < event.getPointerCount(); i++) {
- Stroke stroke = mClassifierData.getStroke(event.getPointerId(i));
+ Stroke stroke = classifierData.getStroke(event.getPointerId(i));
- if (mStrokeMap.get(stroke) == null) {
- mStrokeMap.put(stroke, new Data());
+ if (strokeMap.get(stroke) == null) {
+ strokeMap.put(stroke, new Data());
}
if (action != MotionEvent.ACTION_UP
&& action != MotionEvent.ACTION_CANCEL
&& !(action == MotionEvent.ACTION_POINTER_UP && i == event.getActionIndex())) {
- mStrokeMap.get(stroke).addPoint(stroke.getPoints().get(stroke.getPoints().size() - 1));
+ strokeMap.get(stroke).addPoint(stroke.getPoints().get(stroke.getPoints().size() - 1));
}
}
}
@Override
public float getFalseTouchEvaluation(Stroke stroke) {
- Data data = mStrokeMap.get(stroke);
+ Data data = strokeMap.get(stroke);
return SpeedVarianceEvaluator.evaluate(data.getAnglesVariance())
+ SpeedAnglesPercentageEvaluator.evaluate(data.getAnglesPercentage());
}
@@ -79,69 +79,69 @@ class SpeedAnglesClassifier extends StrokeClassifier {
private static final float LENGTH_SCALE = 1.0f;
private static final float ANGLE_DEVIATION = (float) Math.PI / 10.0f;
- private List<Point> mLastThreePoints = new ArrayList<>();
- private Point mPreviousPoint;
- private float mPreviousAngle;
- private float mSumSquares;
- private float mSum;
- private float mCount;
- private float mDist;
- private float mAnglesCount;
- private float mAcceleratingAngles;
+ private List<Point> lastThreePoints = new ArrayList<>();
+ private Point previousPoint;
+ private float previousAngle;
+ private float sumSquares;
+ private float sum;
+ private float count;
+ private float dist;
+ private float anglesCount;
+ private float acceleratingAngles;
public Data() {
- mPreviousPoint = null;
- mPreviousAngle = (float) Math.PI;
- mSumSquares = 0.0f;
- mSum = 0.0f;
- mCount = 1.0f;
- mDist = 0.0f;
- mAnglesCount = mAcceleratingAngles = 0.0f;
+ previousPoint = null;
+ previousAngle = (float) Math.PI;
+ sumSquares = 0.0f;
+ sum = 0.0f;
+ count = 1.0f;
+ dist = 0.0f;
+ anglesCount = acceleratingAngles = 0.0f;
}
public void addPoint(Point point) {
- if (mPreviousPoint != null) {
- mDist += mPreviousPoint.dist(point);
+ if (previousPoint != null) {
+ dist += previousPoint.dist(point);
}
- mPreviousPoint = point;
+ previousPoint = point;
Point speedPoint =
- new Point((float) point.timeOffsetNano / DURATION_SCALE, mDist / LENGTH_SCALE);
+ new Point((float) point.timeOffsetNano / DURATION_SCALE, dist / LENGTH_SCALE);
// Checking if the added point is different than the previously added point
// Repetitions are being ignored so that proper angles are calculated.
- if (mLastThreePoints.isEmpty()
- || !mLastThreePoints.get(mLastThreePoints.size() - 1).equals(speedPoint)) {
- mLastThreePoints.add(speedPoint);
- if (mLastThreePoints.size() == 4) {
- mLastThreePoints.remove(0);
+ if (lastThreePoints.isEmpty()
+ || !lastThreePoints.get(lastThreePoints.size() - 1).equals(speedPoint)) {
+ lastThreePoints.add(speedPoint);
+ if (lastThreePoints.size() == 4) {
+ lastThreePoints.remove(0);
float angle =
- mLastThreePoints.get(1).getAngle(mLastThreePoints.get(0), mLastThreePoints.get(2));
+ lastThreePoints.get(1).getAngle(lastThreePoints.get(0), lastThreePoints.get(2));
- mAnglesCount++;
+ anglesCount++;
if (angle >= (float) Math.PI - ANGLE_DEVIATION) {
- mAcceleratingAngles++;
+ acceleratingAngles++;
}
- float difference = angle - mPreviousAngle;
- mSum += difference;
- mSumSquares += difference * difference;
- mCount += 1.0f;
- mPreviousAngle = angle;
+ float difference = angle - previousAngle;
+ sum += difference;
+ sumSquares += difference * difference;
+ count += 1.0f;
+ previousAngle = angle;
}
}
}
public float getAnglesVariance() {
- return mSumSquares / mCount - (mSum / mCount) * (mSum / mCount);
+ return sumSquares / count - (sum / count) * (sum / count);
}
public float getAnglesPercentage() {
- if (mAnglesCount == 0.0f) {
+ if (anglesCount == 0.0f) {
return 1.0f;
}
- return (mAcceleratingAngles) / mAnglesCount;
+ return (acceleratingAngles) / anglesCount;
}
}
}
diff --git a/java/com/android/incallui/answer/impl/classifier/Stroke.java b/java/com/android/incallui/answer/impl/classifier/Stroke.java
index c542d0f7c..a33424946 100644
--- a/java/com/android/incallui/answer/impl/classifier/Stroke.java
+++ b/java/com/android/incallui/answer/impl/classifier/Stroke.java
@@ -26,40 +26,40 @@ class Stroke {
private static final float NANOS_TO_SECONDS = 1e9f;
- private ArrayList<Point> mPoints = new ArrayList<>();
- private long mStartTimeNano;
- private long mEndTimeNano;
- private float mLength;
- private final float mDpi;
+ private ArrayList<Point> points = new ArrayList<>();
+ private long startTimeNano;
+ private long endTimeNano;
+ private float length;
+ private final float dpi;
public Stroke(long eventTimeNano, float dpi) {
- mDpi = dpi;
- mStartTimeNano = mEndTimeNano = eventTimeNano;
+ this.dpi = dpi;
+ startTimeNano = endTimeNano = eventTimeNano;
}
public void addPoint(float x, float y, long eventTimeNano) {
- mEndTimeNano = eventTimeNano;
- Point point = new Point(x / mDpi, y / mDpi, eventTimeNano - mStartTimeNano);
- if (!mPoints.isEmpty()) {
- mLength += mPoints.get(mPoints.size() - 1).dist(point);
+ endTimeNano = eventTimeNano;
+ Point point = new Point(x / dpi, y / dpi, eventTimeNano - startTimeNano);
+ if (!points.isEmpty()) {
+ length += points.get(points.size() - 1).dist(point);
}
- mPoints.add(point);
+ points.add(point);
}
public int getCount() {
- return mPoints.size();
+ return points.size();
}
public float getTotalLength() {
- return mLength;
+ return length;
}
public float getEndPointLength() {
- return mPoints.get(0).dist(mPoints.get(mPoints.size() - 1));
+ return points.get(0).dist(points.get(points.size() - 1));
}
public long getDurationNanos() {
- return mEndTimeNano - mStartTimeNano;
+ return endTimeNano - startTimeNano;
}
public float getDurationSeconds() {
@@ -67,6 +67,6 @@ class Stroke {
}
public ArrayList<Point> getPoints() {
- return mPoints;
+ return points;
}
}
diff --git a/java/com/android/incallui/answer/impl/utils/FlingAnimationUtils.java b/java/com/android/incallui/answer/impl/utils/FlingAnimationUtils.java
index 3acb2a205..baec30819 100644
--- a/java/com/android/incallui/answer/impl/utils/FlingAnimationUtils.java
+++ b/java/com/android/incallui/answer/impl/utils/FlingAnimationUtils.java
@@ -41,7 +41,7 @@ public class FlingAnimationUtils {
private float maxLengthSeconds;
private float highVelocityPxPerSecond;
- private AnimatorProperties mAnimatorProperties = new AnimatorProperties();
+ private AnimatorProperties animatorProperties = new AnimatorProperties();
public FlingAnimationUtils(Context ctx, float maxLengthSeconds) {
this.maxLengthSeconds = maxLengthSeconds;
@@ -127,23 +127,23 @@ public class FlingAnimationUtils {
float velAbs = Math.abs(velocity);
float durationSeconds = LINEAR_OUT_SLOW_IN_START_GRADIENT * diff / velAbs;
if (durationSeconds <= maxLengthSeconds) {
- mAnimatorProperties.interpolator = linearOutSlowIn;
+ animatorProperties.interpolator = linearOutSlowIn;
} else if (velAbs >= minVelocityPxPerSecond) {
// Cross fade between fast-out-slow-in and linear interpolator with current velocity.
durationSeconds = maxLengthSeconds;
VelocityInterpolator velocityInterpolator =
new VelocityInterpolator(durationSeconds, velAbs, diff);
- mAnimatorProperties.interpolator =
+ animatorProperties.interpolator =
new InterpolatorInterpolator(velocityInterpolator, linearOutSlowIn, linearOutSlowIn);
} else {
// Just use a normal interpolator which doesn't take the velocity into account.
durationSeconds = maxLengthSeconds;
- mAnimatorProperties.interpolator = Interpolators.FAST_OUT_SLOW_IN;
+ animatorProperties.interpolator = Interpolators.FAST_OUT_SLOW_IN;
}
- mAnimatorProperties.duration = (long) (durationSeconds * 1000);
- return mAnimatorProperties;
+ animatorProperties.duration = (long) (durationSeconds * 1000);
+ return animatorProperties;
}
/**
@@ -203,7 +203,7 @@ public class FlingAnimationUtils {
Interpolator mLinearOutFasterIn = new PathInterpolator(0, 0, LINEAR_OUT_FASTER_IN_X2, y2);
float durationSeconds = startGradient * diff / velAbs;
if (durationSeconds <= maxLengthSeconds) {
- mAnimatorProperties.interpolator = mLinearOutFasterIn;
+ animatorProperties.interpolator = mLinearOutFasterIn;
} else if (velAbs >= minVelocityPxPerSecond) {
// Cross fade between linear-out-faster-in and linear interpolator with current
@@ -213,15 +213,15 @@ public class FlingAnimationUtils {
new VelocityInterpolator(durationSeconds, velAbs, diff);
InterpolatorInterpolator superInterpolator =
new InterpolatorInterpolator(velocityInterpolator, mLinearOutFasterIn, linearOutSlowIn);
- mAnimatorProperties.interpolator = superInterpolator;
+ animatorProperties.interpolator = superInterpolator;
} else {
// Just use a normal interpolator which doesn't take the velocity into account.
durationSeconds = maxLengthSeconds;
- mAnimatorProperties.interpolator = Interpolators.FAST_OUT_LINEAR_IN;
+ animatorProperties.interpolator = Interpolators.FAST_OUT_LINEAR_IN;
}
- mAnimatorProperties.duration = (long) (durationSeconds * 1000);
- return mAnimatorProperties;
+ animatorProperties.duration = (long) (durationSeconds * 1000);
+ return animatorProperties;
}
/**
@@ -246,42 +246,42 @@ public class FlingAnimationUtils {
/** An interpolator which interpolates two interpolators with an interpolator. */
private static final class InterpolatorInterpolator implements Interpolator {
- private Interpolator mInterpolator1;
- private Interpolator mInterpolator2;
- private Interpolator mCrossfader;
+ private Interpolator interpolator1;
+ private Interpolator interpolator2;
+ private Interpolator crossfader;
InterpolatorInterpolator(
Interpolator interpolator1, Interpolator interpolator2, Interpolator crossfader) {
- mInterpolator1 = interpolator1;
- mInterpolator2 = interpolator2;
- mCrossfader = crossfader;
+ this.interpolator1 = interpolator1;
+ this.interpolator2 = interpolator2;
+ this.crossfader = crossfader;
}
@Override
public float getInterpolation(float input) {
- float t = mCrossfader.getInterpolation(input);
- return (1 - t) * mInterpolator1.getInterpolation(input)
- + t * mInterpolator2.getInterpolation(input);
+ float t = crossfader.getInterpolation(input);
+ return (1 - t) * interpolator1.getInterpolation(input)
+ + t * interpolator2.getInterpolation(input);
}
}
/** An interpolator which interpolates with a fixed velocity. */
private static final class VelocityInterpolator implements Interpolator {
- private float mDurationSeconds;
- private float mVelocity;
- private float mDiff;
+ private float durationSeconds;
+ private float velocity;
+ private float diff;
private VelocityInterpolator(float durationSeconds, float velocity, float diff) {
- mDurationSeconds = durationSeconds;
- mVelocity = velocity;
- mDiff = diff;
+ this.durationSeconds = durationSeconds;
+ this.velocity = velocity;
+ this.diff = diff;
}
@Override
public float getInterpolation(float input) {
- float time = input * mDurationSeconds;
- return time * mVelocity / mDiff;
+ float time = input * durationSeconds;
+ return time * velocity / diff;
}
}
diff --git a/java/com/android/incallui/baseui/BaseFragment.java b/java/com/android/incallui/baseui/BaseFragment.java
index 58b8c6f8d..c1b614899 100644
--- a/java/com/android/incallui/baseui/BaseFragment.java
+++ b/java/com/android/incallui/baseui/BaseFragment.java
@@ -24,10 +24,10 @@ public abstract class BaseFragment<T extends Presenter<U>, U extends Ui> extends
private static final String KEY_FRAGMENT_HIDDEN = "key_fragment_hidden";
- private T mPresenter;
+ private T presenter;
protected BaseFragment() {
- mPresenter = createPresenter();
+ presenter = createPresenter();
}
public abstract T createPresenter();
@@ -40,20 +40,20 @@ public abstract class BaseFragment<T extends Presenter<U>, U extends Ui> extends
* @return The presenter associated with this fragment.
*/
public T getPresenter() {
- return mPresenter;
+ return presenter;
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
- mPresenter.onUiReady(getUi());
+ presenter.onUiReady(getUi());
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (savedInstanceState != null) {
- mPresenter.onRestoreInstanceState(savedInstanceState);
+ presenter.onRestoreInstanceState(savedInstanceState);
if (savedInstanceState.getBoolean(KEY_FRAGMENT_HIDDEN)) {
getFragmentManager().beginTransaction().hide(this).commit();
}
@@ -63,13 +63,13 @@ public abstract class BaseFragment<T extends Presenter<U>, U extends Ui> extends
@Override
public void onDestroyView() {
super.onDestroyView();
- mPresenter.onUiDestroy(getUi());
+ presenter.onUiDestroy(getUi());
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
- mPresenter.onSaveInstanceState(outState);
+ presenter.onSaveInstanceState(outState);
outState.putBoolean(KEY_FRAGMENT_HIDDEN, isHidden());
}
}
diff --git a/java/com/android/incallui/baseui/Presenter.java b/java/com/android/incallui/baseui/Presenter.java
index 581ad47c7..e4df9382f 100644
--- a/java/com/android/incallui/baseui/Presenter.java
+++ b/java/com/android/incallui/baseui/Presenter.java
@@ -21,7 +21,7 @@ import android.os.Bundle;
/** Base class for Presenters. */
public abstract class Presenter<U extends Ui> {
- private U mUi;
+ private U ui;
/**
* Called after the UI view has been created. That is when fragment.onViewCreated() is called.
@@ -29,13 +29,13 @@ public abstract class Presenter<U extends Ui> {
* @param ui The Ui implementation that is now ready to be used.
*/
public void onUiReady(U ui) {
- mUi = ui;
+ this.ui = ui;
}
/** Called when the UI view is destroyed in Fragment.onDestroyView(). */
public final void onUiDestroy(U ui) {
onUiUnready(ui);
- mUi = null;
+ this.ui = null;
}
/**
@@ -49,6 +49,6 @@ public abstract class Presenter<U extends Ui> {
public void onRestoreInstanceState(Bundle savedInstanceState) {}
public U getUi() {
- return mUi;
+ return ui;
}
}
diff --git a/java/com/android/incallui/call/CallList.java b/java/com/android/incallui/call/CallList.java
index 150b20e28..e5948084d 100644
--- a/java/com/android/incallui/call/CallList.java
+++ b/java/com/android/incallui/call/CallList.java
@@ -65,24 +65,24 @@ public class CallList implements DialerCallDelegate {
private static final int EVENT_DISCONNECTED_TIMEOUT = 1;
- private static CallList sInstance = new CallList();
+ private static CallList instance = new CallList();
- private final Map<String, DialerCall> mCallById = new ArrayMap<>();
- private final Map<android.telecom.Call, DialerCall> mCallByTelecomCall = new ArrayMap<>();
+ private final Map<String, DialerCall> callById = new ArrayMap<>();
+ private final Map<android.telecom.Call, DialerCall> callByTelecomCall = new ArrayMap<>();
/**
* ConcurrentHashMap constructor params: 8 is initial table size, 0.9f is load factor before
* resizing, 1 means we only expect a single thread to access the map so make only a single shard
*/
- private final Set<Listener> mListeners =
+ private final Set<Listener> listeners =
Collections.newSetFromMap(new ConcurrentHashMap<Listener, Boolean>(8, 0.9f, 1));
- private final Set<DialerCall> mPendingDisconnectCalls =
+ private final Set<DialerCall> pendingDisconnectCalls =
Collections.newSetFromMap(new ConcurrentHashMap<DialerCall, Boolean>(8, 0.9f, 1));
- private UiListener mUiListeners;
+ private UiListener uiListeners;
/** Handles the timeout for destroying disconnected calls. */
- private final Handler mHandler =
+ private final Handler handler =
new Handler() {
@Override
public void handleMessage(Message msg) {
@@ -107,12 +107,12 @@ public class CallList implements DialerCallDelegate {
@VisibleForTesting
public static void setCallListInstance(CallList callList) {
- sInstance = callList;
+ instance = callList;
}
/** Static singleton accessor method. */
public static CallList getInstance() {
- return sInstance;
+ return instance;
}
public void onCallAdded(
@@ -125,8 +125,8 @@ public class CallList implements DialerCallDelegate {
Logger.get(context)
.logStartLatencyTimer(LoggingBindings.ON_CALL_ADDED_TO_ON_INCALL_UI_SHOWN_INCOMING);
}
- if (mUiListeners != null) {
- mUiListeners.onCallAdded();
+ if (uiListeners != null) {
+ uiListeners.onCallAdded();
}
final DialerCall call =
new DialerCall(context, this, telecomCall, latencyReport, true /* registerCallback */);
@@ -257,7 +257,7 @@ public class CallList implements DialerCallDelegate {
@Override
public DialerCall getDialerCallFromTelecomCall(Call telecomCall) {
- return mCallByTelecomCall.get(telecomCall);
+ return callByTelecomCall.get(telecomCall);
}
private void updateUserMarkedSpamStatus(
@@ -301,8 +301,8 @@ public class CallList implements DialerCallDelegate {
}
public void onCallRemoved(Context context, android.telecom.Call telecomCall) {
- if (mCallByTelecomCall.containsKey(telecomCall)) {
- DialerCall call = mCallByTelecomCall.get(telecomCall);
+ if (callByTelecomCall.containsKey(telecomCall)) {
+ DialerCall call = callByTelecomCall.get(telecomCall);
Assert.checkArgument(!call.isExternalCall());
EnrichedCallManager manager = EnrichedCallComponent.get(context).getEnrichedCallManager();
@@ -352,8 +352,8 @@ public class CallList implements DialerCallDelegate {
*/
public void onInternalCallMadeExternal(Context context, android.telecom.Call telecomCall) {
- if (mCallByTelecomCall.containsKey(telecomCall)) {
- DialerCall call = mCallByTelecomCall.get(telecomCall);
+ if (callByTelecomCall.containsKey(telecomCall)) {
+ DialerCall call = callByTelecomCall.get(telecomCall);
// Don't log an already logged call. logCall() might be called multiple times
// for the same call due to a bug.
@@ -367,8 +367,8 @@ public class CallList implements DialerCallDelegate {
// However, the call won't be disconnected in this case. Also, logic in updateCallInMap
// would just re-add the call anyways.
call.unregisterCallback();
- mCallById.remove(call.getId());
- mCallByTelecomCall.remove(telecomCall);
+ callById.remove(call.getId());
+ callByTelecomCall.remove(telecomCall);
}
}
@@ -379,7 +379,7 @@ public class CallList implements DialerCallDelegate {
LogUtil.i("CallList.onIncoming", String.valueOf(call));
}
- for (Listener listener : mListeners) {
+ for (Listener listener : listeners) {
listener.onIncomingCall(call);
}
Trace.endSection();
@@ -388,19 +388,19 @@ public class CallList implements DialerCallDelegate {
public void addListener(@NonNull Listener listener) {
Objects.requireNonNull(listener);
- mListeners.add(listener);
+ listeners.add(listener);
// Let the listener know about the active calls immediately.
listener.onCallListChange(this);
}
public void setUiListener(UiListener uiListener) {
- mUiListeners = uiListener;
+ uiListeners = uiListener;
}
public void removeListener(@Nullable Listener listener) {
if (listener != null) {
- mListeners.remove(listener);
+ listeners.remove(listener);
}
}
@@ -517,7 +517,7 @@ public class CallList implements DialerCallDelegate {
* @return The first call with the upgrade to video state.
*/
public DialerCall getVideoUpgradeRequestCall() {
- for (DialerCall call : mCallById.values()) {
+ for (DialerCall call : callById.values()) {
if (call.getVideoTech().getSessionModificationState()
== SessionModificationState.RECEIVED_UPGRADE_TO_VIDEO_REQUEST) {
return call;
@@ -527,11 +527,11 @@ public class CallList implements DialerCallDelegate {
}
public DialerCall getCallById(String callId) {
- return mCallById.get(callId);
+ return callById.get(callId);
}
public Collection<DialerCall> getAllCalls() {
- return mCallById.values();
+ return callById.values();
}
/** Returns first call found in the call map with the specified state. */
@@ -546,7 +546,7 @@ public class CallList implements DialerCallDelegate {
public DialerCall getCallWithState(int state, int positionToFind) {
DialerCall retval = null;
int position = 0;
- for (DialerCall call : mCallById.values()) {
+ for (DialerCall call : callById.values()) {
if (call.getState() == state) {
if (position >= positionToFind) {
retval = call;
@@ -565,7 +565,7 @@ public class CallList implements DialerCallDelegate {
* call)
*/
public boolean hasNonParentActiveOrBackgroundCall() {
- for (DialerCall call : mCallById.values()) {
+ for (DialerCall call : callById.values()) {
if ((call.getState() == State.ACTIVE
|| call.getState() == State.ONHOLD
|| call.getState() == State.CONFERENCED)
@@ -583,7 +583,7 @@ public class CallList implements DialerCallDelegate {
* active calls, so this is relatively safe thing to do.
*/
public void clearOnDisconnect() {
- for (DialerCall call : mCallById.values()) {
+ for (DialerCall call : callById.values()) {
final int state = call.getState();
if (state != DialerCall.State.IDLE
&& state != DialerCall.State.INVALID
@@ -602,7 +602,7 @@ public class CallList implements DialerCallDelegate {
* disconnect cause, and that any pending disconnects should immediately occur.
*/
public void onErrorDialogDismissed() {
- final Iterator<DialerCall> iterator = mPendingDisconnectCalls.iterator();
+ final Iterator<DialerCall> iterator = pendingDisconnectCalls.iterator();
while (iterator.hasNext()) {
DialerCall call = iterator.next();
iterator.remove();
@@ -619,7 +619,7 @@ public class CallList implements DialerCallDelegate {
void onUpdateCall(DialerCall call) {
Trace.beginSection("CallList.onUpdateCall");
LogUtil.d("CallList.onUpdateCall", String.valueOf(call));
- if (!mCallById.containsKey(call.getId()) && call.isExternalCall()) {
+ if (!callById.containsKey(call.getId()) && call.isExternalCall()) {
// When a regular call becomes external, it is removed from the call list, and there may be
// pending updates to Telecom which are queued up on the Telecom call's handler which we no
// longer wish to cause updates to the call in the CallList. Bail here if the list of tracked
@@ -639,14 +639,14 @@ public class CallList implements DialerCallDelegate {
*/
private void notifyGenericListeners() {
Trace.beginSection("CallList.notifyGenericListeners");
- for (Listener listener : mListeners) {
+ for (Listener listener : listeners) {
listener.onCallListChange(this);
}
Trace.endSection();
}
private void notifyListenersOfDisconnect(DialerCall call) {
- for (Listener listener : mListeners) {
+ for (Listener listener : listeners) {
listener.onDisconnect(call);
}
}
@@ -664,26 +664,26 @@ public class CallList implements DialerCallDelegate {
if (call.getState() == DialerCall.State.DISCONNECTED) {
// update existing (but do not add!!) disconnected calls
- if (mCallById.containsKey(call.getId())) {
+ if (callById.containsKey(call.getId())) {
// For disconnected calls, we want to keep them alive for a few seconds so that the
// UI has a chance to display anything it needs when a call is disconnected.
// Set up a timer to destroy the call after X seconds.
- final Message msg = mHandler.obtainMessage(EVENT_DISCONNECTED_TIMEOUT, call);
- mHandler.sendMessageDelayed(msg, getDelayForDisconnect(call));
- mPendingDisconnectCalls.add(call);
+ final Message msg = handler.obtainMessage(EVENT_DISCONNECTED_TIMEOUT, call);
+ handler.sendMessageDelayed(msg, getDelayForDisconnect(call));
+ pendingDisconnectCalls.add(call);
- mCallById.put(call.getId(), call);
- mCallByTelecomCall.put(call.getTelecomCall(), call);
+ callById.put(call.getId(), call);
+ callByTelecomCall.put(call.getTelecomCall(), call);
updated = true;
}
} else if (!isCallDead(call)) {
- mCallById.put(call.getId(), call);
- mCallByTelecomCall.put(call.getTelecomCall(), call);
+ callById.put(call.getId(), call);
+ callByTelecomCall.put(call.getTelecomCall(), call);
updated = true;
- } else if (mCallById.containsKey(call.getId())) {
- mCallById.remove(call.getId());
- mCallByTelecomCall.remove(call.getTelecomCall());
+ } else if (callById.containsKey(call.getId())) {
+ callById.remove(call.getId());
+ callByTelecomCall.remove(call.getTelecomCall());
updated = true;
}
@@ -727,8 +727,8 @@ public class CallList implements DialerCallDelegate {
/** Sets up a call for deletion and notifies listeners of change. */
private void finishDisconnectedCall(DialerCall call) {
- if (mPendingDisconnectCalls.contains(call)) {
- mPendingDisconnectCalls.remove(call);
+ if (pendingDisconnectCalls.contains(call)) {
+ pendingDisconnectCalls.remove(call);
}
call.setState(DialerCall.State.IDLE);
updateCallInMap(call);
@@ -741,17 +741,17 @@ public class CallList implements DialerCallDelegate {
* @param rotation The new rotation angle (in degrees).
*/
public void notifyCallsOfDeviceRotation(int rotation) {
- for (DialerCall call : mCallById.values()) {
+ for (DialerCall call : callById.values()) {
call.getVideoTech().setDeviceOrientation(rotation);
}
}
public void onInCallUiShown(boolean forFullScreenIntent) {
- for (DialerCall call : mCallById.values()) {
+ for (DialerCall call : callById.values()) {
call.getLatencyReport().onInCallUiShown(forFullScreenIntent);
}
- if (mUiListeners != null) {
- mUiListeners.onInCallUiShown();
+ if (uiListeners != null) {
+ uiListeners.onInCallUiShown();
}
}
@@ -813,25 +813,25 @@ public class CallList implements DialerCallDelegate {
private class DialerCallListenerImpl implements DialerCallListener {
- @NonNull private final DialerCall mCall;
+ @NonNull private final DialerCall call;
DialerCallListenerImpl(@NonNull DialerCall call) {
- mCall = Assert.isNotNull(call);
+ this.call = Assert.isNotNull(call);
}
@Override
public void onDialerCallDisconnect() {
- if (updateCallInMap(mCall)) {
- LogUtil.i("DialerCallListenerImpl.onDialerCallDisconnect", String.valueOf(mCall));
+ if (updateCallInMap(call)) {
+ LogUtil.i("DialerCallListenerImpl.onDialerCallDisconnect", String.valueOf(call));
// notify those listening for all disconnects
- notifyListenersOfDisconnect(mCall);
+ notifyListenersOfDisconnect(call);
}
}
@Override
public void onDialerCallUpdate() {
Trace.beginSection("CallList.onDialerCallUpdate");
- onUpdateCall(mCall);
+ onUpdateCall(call);
notifyGenericListeners();
Trace.endSection();
}
@@ -844,30 +844,30 @@ public class CallList implements DialerCallDelegate {
@Override
public void onDialerCallUpgradeToVideo() {
- for (Listener listener : mListeners) {
- listener.onUpgradeToVideo(mCall);
+ for (Listener listener : listeners) {
+ listener.onUpgradeToVideo(call);
}
}
@Override
public void onWiFiToLteHandover() {
- for (Listener listener : mListeners) {
- listener.onWiFiToLteHandover(mCall);
+ for (Listener listener : listeners) {
+ listener.onWiFiToLteHandover(call);
}
}
@Override
public void onHandoverToWifiFailure() {
- for (Listener listener : mListeners) {
- listener.onHandoverToWifiFailed(mCall);
+ for (Listener listener : listeners) {
+ listener.onHandoverToWifiFailed(call);
}
}
@Override
public void onInternationalCallOnWifi() {
LogUtil.enterBlock("DialerCallListenerImpl.onInternationalCallOnWifi");
- for (Listener listener : mListeners) {
- listener.onInternationalCallOnWifi(mCall);
+ for (Listener listener : listeners) {
+ listener.onInternationalCallOnWifi(call);
}
}
@@ -876,8 +876,8 @@ public class CallList implements DialerCallDelegate {
@Override
public void onDialerCallSessionModificationStateChange() {
- for (Listener listener : mListeners) {
- listener.onSessionModificationStateChange(mCall);
+ for (Listener listener : listeners) {
+ listener.onSessionModificationStateChange(call);
}
}
}
diff --git a/java/com/android/incallui/call/DialerCall.java b/java/com/android/incallui/call/DialerCall.java
index 94c79e904..543cc3f07 100644
--- a/java/com/android/incallui/call/DialerCall.java
+++ b/java/com/android/incallui/call/DialerCall.java
@@ -102,14 +102,14 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
private static final String ID_PREFIX = "DialerCall_";
private static final String CONFIG_EMERGENCY_CALLBACK_WINDOW_MILLIS =
"emergency_callback_window_millis";
- private static int sIdCounter = 0;
+ private static int idCounter = 0;
/**
* A counter used to append to restricted/private/hidden calls so that users can identify them in
* a conversation. This value is reset in {@link CallList#onCallRemoved(Context, Call)} when there
* are no live calls.
*/
- private static int sHiddenCounter;
+ private static int hiddenCounter;
/**
* The unique call ID for every call. This will help us to identify each call and allow us the
@@ -117,34 +117,34 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
*/
private final String uniqueCallId = UUID.randomUUID().toString();
- private final Call mTelecomCall;
- private final LatencyReport mLatencyReport;
- private final String mId;
- private final int mHiddenId;
- private final List<String> mChildCallIds = new ArrayList<>();
- private final LogState mLogState = new LogState();
- private final Context mContext;
- private final DialerCallDelegate mDialerCallDelegate;
- private final List<DialerCallListener> mListeners = new CopyOnWriteArrayList<>();
- private final List<CannedTextResponsesLoadedListener> mCannedTextResponsesLoadedListeners =
+ private final Call telecomCall;
+ private final LatencyReport latencyReport;
+ private final String id;
+ private final int hiddenId;
+ private final List<String> childCallIds = new ArrayList<>();
+ private final LogState logState = new LogState();
+ private final Context context;
+ private final DialerCallDelegate dialerCallDelegate;
+ private final List<DialerCallListener> listeners = new CopyOnWriteArrayList<>();
+ private final List<CannedTextResponsesLoadedListener> cannedTextResponsesLoadedListeners =
new CopyOnWriteArrayList<>();
- private final VideoTechManager mVideoTechManager;
+ private final VideoTechManager videoTechManager;
- private boolean mIsEmergencyCall;
- private Uri mHandle;
- private int mState = State.INVALID;
- private DisconnectCause mDisconnectCause;
+ private boolean isEmergencyCall;
+ private Uri handle;
+ private int state = State.INVALID;
+ private DisconnectCause disconnectCause;
private boolean hasShownWiFiToLteHandoverToast;
private boolean doNotShowDialogForHandoffToWifiFailure;
- private String mChildNumber;
- private String mLastForwardedNumber;
- private String mCallSubject;
- private PhoneAccountHandle mPhoneAccountHandle;
- @CallHistoryStatus private int mCallHistoryStatus = CALL_HISTORY_STATUS_UNKNOWN;
- private boolean mIsSpam;
- private boolean mIsBlocked;
+ private String childNumber;
+ private String lastForwardedNumber;
+ private String callSubject;
+ private PhoneAccountHandle phoneAccountHandle;
+ @CallHistoryStatus private int callHistoryStatus = CALL_HISTORY_STATUS_UNKNOWN;
+ private boolean isSpam;
+ private boolean isBlocked;
@Nullable private Boolean isInUserSpamList;
@@ -154,9 +154,9 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
private boolean didShowCameraPermission;
private String callProviderLabel;
private String callbackNumber;
- private int mCameraDirection = CameraDirection.CAMERA_DIRECTION_UNKNOWN;
- private EnrichedCallCapabilities mEnrichedCallCapabilities;
- private Session mEnrichedCallSession;
+ private int cameraDirection = CameraDirection.CAMERA_DIRECTION_UNKNOWN;
+ private EnrichedCallCapabilities enrichedCallCapabilities;
+ private Session enrichedCallSession;
private int answerAndReleaseButtonDisplayedTimes = 0;
private boolean releasedByAnsweringSecondCall = false;
@@ -188,9 +188,9 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
* Indicates whether the phone account associated with this call supports specifying a call
* subject.
*/
- private boolean mIsCallSubjectSupported;
+ private boolean isCallSubjectSupported;
- private final Call.Callback mTelecomCallCallback =
+ private final Call.Callback telecomCallCallback =
new Call.Callback() {
@Override
public void onStateChanged(Call call, int newState) {
@@ -222,7 +222,7 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
LogUtil.v(
"TelecomCallCallback.onCannedTextResponsesLoaded",
"call=" + call + " cannedTextResponses=" + cannedTextResponses);
- for (CannedTextResponsesLoadedListener listener : mCannedTextResponsesLoadedListeners) {
+ for (CannedTextResponsesLoadedListener listener : cannedTextResponsesLoadedListeners) {
listener.onCannedTextResponsesLoaded(DialerCall.this);
}
}
@@ -301,7 +301,7 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
}
};
- private long mTimeAddedMs;
+ private long timeAddedMs;
public DialerCall(
Context context,
@@ -310,27 +310,27 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
LatencyReport latencyReport,
boolean registerCallback) {
Assert.isNotNull(context);
- mContext = context;
- mDialerCallDelegate = dialerCallDelegate;
- mTelecomCall = telecomCall;
- mLatencyReport = latencyReport;
- mId = ID_PREFIX + Integer.toString(sIdCounter++);
+ this.context = context;
+ this.dialerCallDelegate = dialerCallDelegate;
+ this.telecomCall = telecomCall;
+ this.latencyReport = latencyReport;
+ id = ID_PREFIX + Integer.toString(idCounter++);
// Must be after assigning mTelecomCall
- mVideoTechManager = new VideoTechManager(this);
+ videoTechManager = new VideoTechManager(this);
updateFromTelecomCall();
if (isHiddenNumber() && TextUtils.isEmpty(getNumber())) {
- mHiddenId = ++sHiddenCounter;
+ hiddenId = ++hiddenCounter;
} else {
- mHiddenId = 0;
+ hiddenId = 0;
}
if (registerCallback) {
- mTelecomCall.registerCallback(mTelecomCallCallback);
+ this.telecomCall.registerCallback(telecomCallCallback);
}
- mTimeAddedMs = System.currentTimeMillis();
+ timeAddedMs = System.currentTimeMillis();
parseCallSpecificAppData();
updateEnrichedCallSession();
@@ -339,13 +339,13 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
/** Test only constructor to avoid initializing dependencies. */
@VisibleForTesting
DialerCall(Context context) {
- mContext = context;
- mTelecomCall = null;
- mLatencyReport = null;
- mId = null;
- mHiddenId = 0;
- mDialerCallDelegate = null;
- mVideoTechManager = null;
+ this.context = context;
+ telecomCall = null;
+ latencyReport = null;
+ id = null;
+ hiddenId = 0;
+ dialerCallDelegate = null;
+ videoTechManager = null;
}
private static int translateState(int state) {
@@ -398,68 +398,68 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
public void addListener(DialerCallListener listener) {
Assert.isMainThread();
- mListeners.add(listener);
+ listeners.add(listener);
}
public void removeListener(DialerCallListener listener) {
Assert.isMainThread();
- mListeners.remove(listener);
+ listeners.remove(listener);
}
public void addCannedTextResponsesLoadedListener(CannedTextResponsesLoadedListener listener) {
Assert.isMainThread();
- mCannedTextResponsesLoadedListeners.add(listener);
+ cannedTextResponsesLoadedListeners.add(listener);
}
public void removeCannedTextResponsesLoadedListener(CannedTextResponsesLoadedListener listener) {
Assert.isMainThread();
- mCannedTextResponsesLoadedListeners.remove(listener);
+ cannedTextResponsesLoadedListeners.remove(listener);
}
public void notifyWiFiToLteHandover() {
LogUtil.i("DialerCall.notifyWiFiToLteHandover", "");
- for (DialerCallListener listener : mListeners) {
+ for (DialerCallListener listener : listeners) {
listener.onWiFiToLteHandover();
}
}
public void notifyHandoverToWifiFailed() {
LogUtil.i("DialerCall.notifyHandoverToWifiFailed", "");
- for (DialerCallListener listener : mListeners) {
+ for (DialerCallListener listener : listeners) {
listener.onHandoverToWifiFailure();
}
}
public void notifyInternationalCallOnWifi() {
LogUtil.enterBlock("DialerCall.notifyInternationalCallOnWifi");
- for (DialerCallListener dialerCallListener : mListeners) {
+ for (DialerCallListener dialerCallListener : listeners) {
dialerCallListener.onInternationalCallOnWifi();
}
}
/* package-private */ Call getTelecomCall() {
- return mTelecomCall;
+ return telecomCall;
}
public StatusHints getStatusHints() {
- return mTelecomCall.getDetails().getStatusHints();
+ return telecomCall.getDetails().getStatusHints();
}
public int getCameraDir() {
- return mCameraDirection;
+ return cameraDirection;
}
public void setCameraDir(int cameraDir) {
if (cameraDir == CameraDirection.CAMERA_DIRECTION_FRONT_FACING
|| cameraDir == CameraDirection.CAMERA_DIRECTION_BACK_FACING) {
- mCameraDirection = cameraDir;
+ cameraDirection = cameraDir;
} else {
- mCameraDirection = CameraDirection.CAMERA_DIRECTION_UNKNOWN;
+ cameraDirection = CameraDirection.CAMERA_DIRECTION_UNKNOWN;
}
}
public boolean wasParentCall() {
- return mLogState.conferencedCalls != 0;
+ return logState.conferencedCalls != 0;
}
public boolean isVoiceMailNumber() {
@@ -479,11 +479,11 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
isVoicemailNumber = true;
}
- if (!PermissionsUtil.hasPermission(mContext, permission.READ_PHONE_STATE)) {
+ if (!PermissionsUtil.hasPermission(context, permission.READ_PHONE_STATE)) {
isVoicemailNumber = false;
}
- isVoicemailNumber = TelecomUtil.isVoicemailNumber(mContext, getAccountHandle(), getNumber());
+ isVoicemailNumber = TelecomUtil.isVoicemailNumber(context, getAccountHandle(), getNumber());
}
private void update() {
@@ -494,17 +494,17 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
// We want to potentially register a video call callback here.
updateFromTelecomCall();
if (oldState != getState() && getState() == DialerCall.State.DISCONNECTED) {
- for (DialerCallListener listener : mListeners) {
+ for (DialerCallListener listener : listeners) {
listener.onDialerCallDisconnect();
}
- EnrichedCallComponent.get(mContext)
+ EnrichedCallComponent.get(context)
.getEnrichedCallManager()
.unregisterCapabilitiesListener(this);
- EnrichedCallComponent.get(mContext)
+ EnrichedCallComponent.get(context)
.getEnrichedCallManager()
.unregisterStateChangedListener(this);
} else {
- for (DialerCallListener listener : mListeners) {
+ for (DialerCallListener listener : listeners) {
listener.onDialerCallUpdate();
}
}
@@ -514,58 +514,58 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
@SuppressWarnings("MissingPermission")
private void updateFromTelecomCall() {
Trace.beginSection("DialerCall.updateFromTelecomCall");
- LogUtil.v("DialerCall.updateFromTelecomCall", mTelecomCall.toString());
+ LogUtil.v("DialerCall.updateFromTelecomCall", telecomCall.toString());
- mVideoTechManager.dispatchCallStateChanged(mTelecomCall.getState());
+ videoTechManager.dispatchCallStateChanged(telecomCall.getState());
- final int translatedState = translateState(mTelecomCall.getState());
- if (mState != State.BLOCKED) {
+ final int translatedState = translateState(telecomCall.getState());
+ if (state != State.BLOCKED) {
setState(translatedState);
- setDisconnectCause(mTelecomCall.getDetails().getDisconnectCause());
+ setDisconnectCause(telecomCall.getDetails().getDisconnectCause());
}
- mChildCallIds.clear();
- final int numChildCalls = mTelecomCall.getChildren().size();
+ childCallIds.clear();
+ final int numChildCalls = telecomCall.getChildren().size();
for (int i = 0; i < numChildCalls; i++) {
- mChildCallIds.add(
- mDialerCallDelegate
- .getDialerCallFromTelecomCall(mTelecomCall.getChildren().get(i))
+ childCallIds.add(
+ dialerCallDelegate
+ .getDialerCallFromTelecomCall(telecomCall.getChildren().get(i))
.getId());
}
// The number of conferenced calls can change over the course of the call, so use the
// maximum number of conferenced child calls as the metric for conference call usage.
- mLogState.conferencedCalls = Math.max(numChildCalls, mLogState.conferencedCalls);
+ logState.conferencedCalls = Math.max(numChildCalls, logState.conferencedCalls);
- updateFromCallExtras(mTelecomCall.getDetails().getExtras());
+ updateFromCallExtras(telecomCall.getDetails().getExtras());
// If the handle of the call has changed, update state for the call determining if it is an
// emergency call.
- Uri newHandle = mTelecomCall.getDetails().getHandle();
- if (!Objects.equals(mHandle, newHandle)) {
- mHandle = newHandle;
+ Uri newHandle = telecomCall.getDetails().getHandle();
+ if (!Objects.equals(handle, newHandle)) {
+ handle = newHandle;
updateEmergencyCallState();
}
- TelecomManager telecomManager = mContext.getSystemService(TelecomManager.class);
+ TelecomManager telecomManager = context.getSystemService(TelecomManager.class);
// If the phone account handle of the call is set, cache capability bit indicating whether
// the phone account supports call subjects.
- PhoneAccountHandle newPhoneAccountHandle = mTelecomCall.getDetails().getAccountHandle();
- if (!Objects.equals(mPhoneAccountHandle, newPhoneAccountHandle)) {
- mPhoneAccountHandle = newPhoneAccountHandle;
+ PhoneAccountHandle newPhoneAccountHandle = telecomCall.getDetails().getAccountHandle();
+ if (!Objects.equals(phoneAccountHandle, newPhoneAccountHandle)) {
+ phoneAccountHandle = newPhoneAccountHandle;
- if (mPhoneAccountHandle != null) {
- PhoneAccount phoneAccount = telecomManager.getPhoneAccount(mPhoneAccountHandle);
+ if (phoneAccountHandle != null) {
+ PhoneAccount phoneAccount = telecomManager.getPhoneAccount(phoneAccountHandle);
if (phoneAccount != null) {
- mIsCallSubjectSupported =
+ isCallSubjectSupported =
phoneAccount.hasCapabilities(PhoneAccount.CAPABILITY_CALL_SUBJECT);
}
}
}
- if (PermissionsUtil.hasPermission(mContext, permission.READ_PHONE_STATE)) {
+ if (PermissionsUtil.hasPermission(context, permission.READ_PHONE_STATE)) {
updateIsVoiceMailNumber();
callCapableAccounts = telecomManager.getCallCapablePhoneAccounts();
- countryIso = GeoUtil.getCurrentCountryIso(mContext);
+ countryIso = GeoUtil.getCurrentCountryIso(context);
}
Trace.endSection();
}
@@ -605,9 +605,9 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
// Check for a change in the child address and notify any listeners.
if (callExtras.containsKey(Connection.EXTRA_CHILD_ADDRESS)) {
String childNumber = callExtras.getString(Connection.EXTRA_CHILD_ADDRESS);
- if (!Objects.equals(childNumber, mChildNumber)) {
- mChildNumber = childNumber;
- for (DialerCallListener listener : mListeners) {
+ if (!Objects.equals(childNumber, this.childNumber)) {
+ this.childNumber = childNumber;
+ for (DialerCallListener listener : listeners) {
listener.onDialerCallChildNumberChange();
}
}
@@ -626,9 +626,9 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
lastForwardedNumber = lastForwardedNumbers.get(lastForwardedNumbers.size() - 1);
}
- if (!Objects.equals(lastForwardedNumber, mLastForwardedNumber)) {
- mLastForwardedNumber = lastForwardedNumber;
- for (DialerCallListener listener : mListeners) {
+ if (!Objects.equals(lastForwardedNumber, this.lastForwardedNumber)) {
+ this.lastForwardedNumber = lastForwardedNumber;
+ for (DialerCallListener listener : listeners) {
listener.onDialerCallLastForwardedNumberChange();
}
}
@@ -639,14 +639,14 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
// notify any other listeners of this.
if (callExtras.containsKey(Connection.EXTRA_CALL_SUBJECT)) {
String callSubject = callExtras.getString(Connection.EXTRA_CALL_SUBJECT);
- if (!Objects.equals(mCallSubject, callSubject)) {
- mCallSubject = callSubject;
+ if (!Objects.equals(this.callSubject, callSubject)) {
+ this.callSubject = callSubject;
}
}
}
public String getId() {
- return mId;
+ return id;
}
/**
@@ -655,14 +655,14 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
*/
@Nullable
public String updateNameIfRestricted(@Nullable String name) {
- if (name != null && isHiddenNumber() && mHiddenId != 0 && sHiddenCounter > 1) {
- return mContext.getString(R.string.unknown_counter, name, mHiddenId);
+ if (name != null && isHiddenNumber() && hiddenId != 0 && hiddenCounter > 1) {
+ return context.getString(R.string.unknown_counter, name, hiddenId);
}
return name;
}
public static void clearRestrictedCount() {
- sHiddenCounter = 0;
+ hiddenCounter = 0;
}
private boolean isHiddenNumber() {
@@ -687,26 +687,26 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
}
public long getTimeAddedMs() {
- return mTimeAddedMs;
+ return timeAddedMs;
}
@Nullable
public String getNumber() {
- return TelecomCallUtil.getNumber(mTelecomCall);
+ return TelecomCallUtil.getNumber(telecomCall);
}
public void blockCall() {
- mTelecomCall.reject(false, null);
+ telecomCall.reject(false, null);
setState(State.BLOCKED);
}
@Nullable
public Uri getHandle() {
- return mTelecomCall == null ? null : mTelecomCall.getDetails().getHandle();
+ return telecomCall == null ? null : telecomCall.getDetails().getHandle();
}
public boolean isEmergencyCall() {
- return mIsEmergencyCall;
+ return isEmergencyCall;
}
public boolean isPotentialEmergencyCallback() {
@@ -731,78 +731,78 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
boolean isInEmergencyCallbackWindow(long timestampMillis) {
long emergencyCallbackWindowMillis =
- ConfigProviderBindings.get(mContext)
+ ConfigProviderBindings.get(context)
.getLong(CONFIG_EMERGENCY_CALLBACK_WINDOW_MILLIS, TimeUnit.MINUTES.toMillis(5));
return System.currentTimeMillis() - timestampMillis < emergencyCallbackWindowMillis;
}
public int getState() {
- if (mTelecomCall != null && mTelecomCall.getParent() != null) {
+ if (telecomCall != null && telecomCall.getParent() != null) {
return State.CONFERENCED;
} else {
- return mState;
+ return state;
}
}
public int getNonConferenceState() {
- return mState;
+ return state;
}
public void setState(int state) {
if (state == State.INCOMING) {
- mLogState.isIncoming = true;
+ logState.isIncoming = true;
} else if (state == State.DISCONNECTED) {
long newDuration =
getConnectTimeMillis() == 0 ? 0 : System.currentTimeMillis() - getConnectTimeMillis();
- if (mState != state) {
- mLogState.duration = newDuration;
+ if (this.state != state) {
+ logState.duration = newDuration;
} else {
LogUtil.i(
"DialerCall.setState",
"ignoring state transition from DISCONNECTED to DISCONNECTED."
+ " Duration would have changed from %s to %s",
- mLogState.duration,
+ logState.duration,
newDuration);
}
}
- mState = state;
+ this.state = state;
}
public int getNumberPresentation() {
- return mTelecomCall == null ? -1 : mTelecomCall.getDetails().getHandlePresentation();
+ return telecomCall == null ? -1 : telecomCall.getDetails().getHandlePresentation();
}
public int getCnapNamePresentation() {
- return mTelecomCall == null ? -1 : mTelecomCall.getDetails().getCallerDisplayNamePresentation();
+ return telecomCall == null ? -1 : telecomCall.getDetails().getCallerDisplayNamePresentation();
}
@Nullable
public String getCnapName() {
- return mTelecomCall == null ? null : getTelecomCall().getDetails().getCallerDisplayName();
+ return telecomCall == null ? null : getTelecomCall().getDetails().getCallerDisplayName();
}
public Bundle getIntentExtras() {
- return mTelecomCall.getDetails().getIntentExtras();
+ return telecomCall.getDetails().getIntentExtras();
}
@Nullable
public Bundle getExtras() {
- return mTelecomCall == null ? null : mTelecomCall.getDetails().getExtras();
+ return telecomCall == null ? null : telecomCall.getDetails().getExtras();
}
/** @return The child number for the call, or {@code null} if none specified. */
public String getChildNumber() {
- return mChildNumber;
+ return childNumber;
}
/** @return The last forwarded number for the call, or {@code null} if none specified. */
public String getLastForwardedNumber() {
- return mLastForwardedNumber;
+ return lastForwardedNumber;
}
/** @return The call subject, or {@code null} if none specified. */
public String getCallSubject() {
- return mCallSubject;
+ return callSubject;
}
/**
@@ -810,36 +810,36 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
* otherwise.
*/
public boolean isCallSubjectSupported() {
- return mIsCallSubjectSupported;
+ return isCallSubjectSupported;
}
/** Returns call disconnect cause, defined by {@link DisconnectCause}. */
public DisconnectCause getDisconnectCause() {
- if (mState == State.DISCONNECTED || mState == State.IDLE) {
- return mDisconnectCause;
+ if (state == State.DISCONNECTED || state == State.IDLE) {
+ return disconnectCause;
}
return new DisconnectCause(DisconnectCause.UNKNOWN);
}
public void setDisconnectCause(DisconnectCause disconnectCause) {
- mDisconnectCause = disconnectCause;
- mLogState.disconnectCause = mDisconnectCause;
+ this.disconnectCause = disconnectCause;
+ logState.disconnectCause = this.disconnectCause;
}
/** Returns the possible text message responses. */
public List<String> getCannedSmsResponses() {
- return mTelecomCall.getCannedTextResponses();
+ return telecomCall.getCannedTextResponses();
}
/** Checks if the call supports the given set of capabilities supplied as a bit mask. */
public boolean can(int capabilities) {
- int supportedCapabilities = mTelecomCall.getDetails().getCallCapabilities();
+ int supportedCapabilities = telecomCall.getDetails().getCallCapabilities();
if ((capabilities & Call.Details.CAPABILITY_MERGE_CONFERENCE) != 0) {
// We allow you to merge if the capabilities allow it or if it is a call with
// conferenceable calls.
- if (mTelecomCall.getConferenceableCalls().isEmpty()
+ if (telecomCall.getConferenceableCalls().isEmpty()
&& ((Call.Details.CAPABILITY_MERGE_CONFERENCE & supportedCapabilities) == 0)) {
// Cannot merge calls if there are no calls to merge with.
return false;
@@ -850,7 +850,7 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
}
public boolean hasProperty(int property) {
- return mTelecomCall.getDetails().hasProperty(property);
+ return telecomCall.getDetails().hasProperty(property);
}
@NonNull
@@ -860,7 +860,7 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
/** Gets the time when the call first became active. */
public long getConnectTimeMillis() {
- return mTelecomCall.getDetails().getConnectTimeMillis();
+ return telecomCall.getDetails().getConnectTimeMillis();
}
public boolean isConferenceCall() {
@@ -869,33 +869,33 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
@Nullable
public GatewayInfo getGatewayInfo() {
- return mTelecomCall == null ? null : mTelecomCall.getDetails().getGatewayInfo();
+ return telecomCall == null ? null : telecomCall.getDetails().getGatewayInfo();
}
@Nullable
public PhoneAccountHandle getAccountHandle() {
- return mTelecomCall == null ? null : mTelecomCall.getDetails().getAccountHandle();
+ return telecomCall == null ? null : telecomCall.getDetails().getAccountHandle();
}
/** @return The {@link VideoCall} instance associated with the {@link Call}. */
public VideoCall getVideoCall() {
- return mTelecomCall == null ? null : mTelecomCall.getVideoCall();
+ return telecomCall == null ? null : telecomCall.getVideoCall();
}
public List<String> getChildCallIds() {
- return mChildCallIds;
+ return childCallIds;
}
public String getParentId() {
- Call parentCall = mTelecomCall.getParent();
+ Call parentCall = telecomCall.getParent();
if (parentCall != null) {
- return mDialerCallDelegate.getDialerCallFromTelecomCall(parentCall).getId();
+ return dialerCallDelegate.getDialerCallFromTelecomCall(parentCall).getId();
}
return null;
}
public int getVideoState() {
- return mTelecomCall.getDetails().getVideoState();
+ return telecomCall.getDetails().getVideoState();
}
public boolean isVideoCall() {
@@ -915,11 +915,11 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
* repeated calls to isEmergencyNumber.
*/
private void updateEmergencyCallState() {
- mIsEmergencyCall = TelecomCallUtil.isEmergencyCall(mTelecomCall);
+ isEmergencyCall = TelecomCallUtil.isEmergencyCall(telecomCall);
}
public LogState getLogState() {
- return mLogState;
+ return logState;
}
/**
@@ -957,17 +957,17 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
return;
}
- mLogState.callSpecificAppData = CallIntentParser.getCallSpecificAppData(getIntentExtras());
- if (mLogState.callSpecificAppData == null) {
+ logState.callSpecificAppData = CallIntentParser.getCallSpecificAppData(getIntentExtras());
+ if (logState.callSpecificAppData == null) {
- mLogState.callSpecificAppData =
+ logState.callSpecificAppData =
CallSpecificAppData.newBuilder()
.setCallInitiationType(CallInitiationType.Type.EXTERNAL_INITIATION)
.build();
}
if (getState() == State.INCOMING) {
- mLogState.callSpecificAppData =
- mLogState
+ logState.callSpecificAppData =
+ logState
.callSpecificAppData
.toBuilder()
.setCallInitiationType(CallInitiationType.Type.INCOMING_INITIATION)
@@ -977,24 +977,24 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
@Override
public String toString() {
- if (mTelecomCall == null) {
+ if (telecomCall == null) {
// This should happen only in testing since otherwise we would never have a null
// Telecom call.
- return String.valueOf(mId);
+ return String.valueOf(id);
}
return String.format(
Locale.US,
"[%s, %s, %s, %s, children:%s, parent:%s, "
+ "conferenceable:%s, videoState:%s, mSessionModificationState:%d, CameraDir:%s]",
- mId,
+ id,
State.toString(getState()),
- Details.capabilitiesToString(mTelecomCall.getDetails().getCallCapabilities()),
- Details.propertiesToString(mTelecomCall.getDetails().getCallProperties()),
- mChildCallIds,
+ Details.capabilitiesToString(telecomCall.getDetails().getCallCapabilities()),
+ Details.propertiesToString(telecomCall.getDetails().getCallProperties()),
+ childCallIds,
getParentId(),
- this.mTelecomCall.getConferenceableCalls(),
- VideoProfile.videoStateToString(mTelecomCall.getDetails().getVideoState()),
+ this.telecomCall.getConferenceableCalls(),
+ VideoProfile.videoStateToString(telecomCall.getDetails().getVideoState()),
getVideoTech().getSessionModificationState(),
getCameraDir());
}
@@ -1005,11 +1005,11 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
@CallHistoryStatus
public int getCallHistoryStatus() {
- return mCallHistoryStatus;
+ return callHistoryStatus;
}
public void setCallHistoryStatus(@CallHistoryStatus int callHistoryStatus) {
- mCallHistoryStatus = callHistoryStatus;
+ this.callHistoryStatus = callHistoryStatus;
}
public boolean didShowCameraPermission() {
@@ -1048,19 +1048,19 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
}
public boolean isSpam() {
- return mIsSpam;
+ return isSpam;
}
public void setSpam(boolean isSpam) {
- mIsSpam = isSpam;
+ this.isSpam = isSpam;
}
public boolean isBlocked() {
- return mIsBlocked;
+ return isBlocked;
}
public void setBlockedStatus(boolean isBlocked) {
- mIsBlocked = isBlocked;
+ this.isBlocked = isBlocked;
}
public boolean isRemotelyHeld() {
@@ -1072,7 +1072,7 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
}
public boolean isIncoming() {
- return mLogState.isIncoming;
+ return logState.isIncoming;
}
/**
@@ -1122,7 +1122,7 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
}
public LatencyReport getLatencyReport() {
- return mLatencyReport;
+ return latencyReport;
}
public int getAnswerAndReleaseButtonDisplayedTimes() {
@@ -1151,25 +1151,25 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
@Nullable
public EnrichedCallCapabilities getEnrichedCallCapabilities() {
- return mEnrichedCallCapabilities;
+ return enrichedCallCapabilities;
}
public void setEnrichedCallCapabilities(
@Nullable EnrichedCallCapabilities mEnrichedCallCapabilities) {
- this.mEnrichedCallCapabilities = mEnrichedCallCapabilities;
+ this.enrichedCallCapabilities = mEnrichedCallCapabilities;
}
@Nullable
public Session getEnrichedCallSession() {
- return mEnrichedCallSession;
+ return enrichedCallSession;
}
public void setEnrichedCallSession(@Nullable Session mEnrichedCallSession) {
- this.mEnrichedCallSession = mEnrichedCallSession;
+ this.enrichedCallSession = mEnrichedCallSession;
}
public void unregisterCallback() {
- mTelecomCall.unregisterCallback(mTelecomCallCallback);
+ telecomCall.unregisterCallback(telecomCallCallback);
}
public void phoneAccountSelected(PhoneAccountHandle accountHandle, boolean setDefault) {
@@ -1178,45 +1178,45 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
"accountHandle: %s, setDefault: %b",
accountHandle,
setDefault);
- mTelecomCall.phoneAccountSelected(accountHandle, setDefault);
+ telecomCall.phoneAccountSelected(accountHandle, setDefault);
}
public void disconnect() {
LogUtil.i("DialerCall.disconnect", "");
setState(DialerCall.State.DISCONNECTING);
- for (DialerCallListener listener : mListeners) {
+ for (DialerCallListener listener : listeners) {
listener.onDialerCallUpdate();
}
- mTelecomCall.disconnect();
+ telecomCall.disconnect();
}
public void hold() {
LogUtil.i("DialerCall.hold", "");
- mTelecomCall.hold();
+ telecomCall.hold();
}
public void unhold() {
LogUtil.i("DialerCall.unhold", "");
- mTelecomCall.unhold();
+ telecomCall.unhold();
}
public void splitFromConference() {
LogUtil.i("DialerCall.splitFromConference", "");
- mTelecomCall.splitFromConference();
+ telecomCall.splitFromConference();
}
public void answer(int videoState) {
LogUtil.i("DialerCall.answer", "videoState: " + videoState);
- mTelecomCall.answer(videoState);
+ telecomCall.answer(videoState);
}
public void answer() {
- answer(mTelecomCall.getDetails().getVideoState());
+ answer(telecomCall.getDetails().getVideoState());
}
public void reject(boolean rejectWithMessage, String message) {
LogUtil.i("DialerCall.reject", "");
- mTelecomCall.reject(rejectWithMessage, message);
+ telecomCall.reject(rejectWithMessage, message);
}
/** Return the string label to represent the call provider */
@@ -1240,12 +1240,12 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
if (accountHandle == null) {
return null;
}
- return mContext.getSystemService(TelecomManager.class).getPhoneAccount(accountHandle);
+ return context.getSystemService(TelecomManager.class).getPhoneAccount(accountHandle);
}
public VideoTech getVideoTech() {
if (videoTech == null) {
- videoTech = mVideoTechManager.getVideoTech();
+ videoTech = videoTechManager.getVideoTech();
// Only store the first video tech type found to be available during the life of the call.
if (selectedAvailableVideoTechType == com.android.dialer.logging.VideoTech.Type.NONE) {
@@ -1266,7 +1266,7 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
if (isEmergencyCall() || showCallbackNumber) {
callbackNumber =
- mContext.getSystemService(TelecomManager.class).getLine1Number(getAccountHandle());
+ context.getSystemService(TelecomManager.class).getLine1Number(getAccountHandle());
}
if (callbackNumber == null) {
@@ -1278,8 +1278,7 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
public String getSimCountryIso() {
String simCountryIso =
- TelephonyManagerCompat.getTelephonyManagerForPhoneAccountHandle(
- mContext, getAccountHandle())
+ TelephonyManagerCompat.getTelephonyManagerForPhoneAccountHandle(context, getAccountHandle())
.getSimCountryIso();
if (!TextUtils.isEmpty(simCountryIso)) {
simCountryIso = simCountryIso.toUpperCase(Locale.US);
@@ -1295,7 +1294,7 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
@Override
public void onSessionModificationStateChanged() {
Trace.beginSection("DialerCall.onSessionModificationStateChanged");
- for (DialerCallListener listener : mListeners) {
+ for (DialerCallListener listener : listeners) {
listener.onDialerCallSessionModificationStateChange();
}
Trace.endSection();
@@ -1315,13 +1314,13 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
public void onVideoUpgradeRequestReceived() {
LogUtil.enterBlock("DialerCall.onVideoUpgradeRequestReceived");
- for (DialerCallListener listener : mListeners) {
+ for (DialerCallListener listener : listeners) {
listener.onDialerCallUpgradeToVideo();
}
update();
- Logger.get(mContext)
+ Logger.get(context)
.logCallImpression(
DialerImpression.Type.VIDEO_CALL_REQUEST_RECEIVED, getUniqueCallId(), getTimeAddedMs());
}
@@ -1356,7 +1355,7 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
return;
}
EnrichedCallCapabilities capabilities =
- EnrichedCallComponent.get(mContext).getEnrichedCallManager().getCapabilities(getNumber());
+ EnrichedCallComponent.get(context).getEnrichedCallManager().getCapabilities(getNumber());
if (capabilities != null) {
setEnrichedCallCapabilities(capabilities);
update();
@@ -1370,10 +1369,10 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
@Override
public void onImpressionLoggingNeeded(DialerImpression.Type impressionType) {
- Logger.get(mContext).logCallImpression(impressionType, getUniqueCallId(), getTimeAddedMs());
+ Logger.get(context).logCallImpression(impressionType, getUniqueCallId(), getTimeAddedMs());
if (impressionType == DialerImpression.Type.LIGHTBRINGER_UPGRADE_REQUESTED) {
if (getLogState().contactLookupResult == Type.NOT_FOUND) {
- Logger.get(mContext)
+ Logger.get(context)
.logCallImpression(
DialerImpression.Type.LIGHTBRINGER_NON_CONTACT_UPGRADE_REQUESTED,
getUniqueCallId(),
@@ -1394,7 +1393,7 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
return;
}
- EnrichedCallManager manager = EnrichedCallComponent.get(mContext).getEnrichedCallManager();
+ EnrichedCallManager manager = EnrichedCallComponent.get(context).getEnrichedCallManager();
Filter filter =
isIncoming()
@@ -1419,14 +1418,14 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
}
private void dispatchOnEnrichedCallSessionUpdate() {
- for (DialerCallListener listener : mListeners) {
+ for (DialerCallListener listener : listeners) {
listener.onEnrichedCallSessionUpdate();
}
}
void onRemovedFromCallList() {
// Ensure we clean up when this call is removed.
- mVideoTechManager.dispatchRemovedFromCallList();
+ videoTechManager.dispatchRemovedFromCallList();
}
public com.android.dialer.logging.VideoTech.Type getSelectedAvailableVideoTechType() {
@@ -1630,7 +1629,7 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
private VideoTech savedTech;
VideoTechManager(DialerCall call) {
- this.context = call.mContext;
+ this.context = call.context;
String phoneNumber = call.getNumber();
phoneNumber = phoneNumber != null ? phoneNumber : "";
@@ -1639,13 +1638,13 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
// Insert order here determines the priority of that video tech option
videoTechs = new ArrayList<>();
- videoTechs.add(new ImsVideoTech(Logger.get(call.mContext), call, call.mTelecomCall));
+ videoTechs.add(new ImsVideoTech(Logger.get(call.context), call, call.telecomCall));
VideoTech rcsVideoTech =
- EnrichedCallComponent.get(call.mContext)
+ EnrichedCallComponent.get(call.context)
.getRcsVideoShareFactory()
.newRcsVideoShare(
- EnrichedCallComponent.get(call.mContext).getEnrichedCallManager(),
+ EnrichedCallComponent.get(call.context).getEnrichedCallManager(),
call,
phoneNumber);
if (rcsVideoTech != null) {
@@ -1654,7 +1653,7 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
videoTechs.add(
new DuoVideoTech(
- DuoComponent.get(call.mContext).getDuo(), call, call.mTelecomCall, phoneNumber));
+ DuoComponent.get(call.context).getDuo(), call, call.telecomCall, phoneNumber));
}
VideoTech getVideoTech() {
diff --git a/java/com/android/incallui/call/ExternalCallList.java b/java/com/android/incallui/call/ExternalCallList.java
index f104dfe9f..603ebf7b8 100644
--- a/java/com/android/incallui/call/ExternalCallList.java
+++ b/java/com/android/incallui/call/ExternalCallList.java
@@ -35,11 +35,11 @@ import java.util.concurrent.ConcurrentHashMap;
*/
public class ExternalCallList {
- private final Set<Call> mExternalCalls = new ArraySet<>();
- private final Set<ExternalCallListener> mExternalCallListeners =
+ private final Set<Call> externalCalls = new ArraySet<>();
+ private final Set<ExternalCallListener> externalCallListeners =
Collections.newSetFromMap(new ConcurrentHashMap<ExternalCallListener, Boolean>(8, 0.9f, 1));
/** Handles {@link android.telecom.Call.Callback} callbacks. */
- private final Call.Callback mTelecomCallCallback =
+ private final Call.Callback telecomCallCallback =
new Call.Callback() {
@Override
public void onDetailsChanged(Call call, Call.Details details) {
@@ -51,52 +51,52 @@ public class ExternalCallList {
public void onCallAdded(Call telecomCall) {
Assert.checkArgument(
telecomCall.getDetails().hasProperty(CallCompat.Details.PROPERTY_IS_EXTERNAL_CALL));
- mExternalCalls.add(telecomCall);
- telecomCall.registerCallback(mTelecomCallCallback, new Handler(Looper.getMainLooper()));
+ externalCalls.add(telecomCall);
+ telecomCall.registerCallback(telecomCallCallback, new Handler(Looper.getMainLooper()));
notifyExternalCallAdded(telecomCall);
}
/** Stops tracking an external call and notifies listeners of the removal of the call. */
public void onCallRemoved(Call telecomCall) {
- if (!mExternalCalls.contains(telecomCall)) {
+ if (!externalCalls.contains(telecomCall)) {
// This can happen on M for external calls from blocked numbers
LogUtil.i("ExternalCallList.onCallRemoved", "attempted to remove unregistered call");
return;
}
- mExternalCalls.remove(telecomCall);
- telecomCall.unregisterCallback(mTelecomCallCallback);
+ externalCalls.remove(telecomCall);
+ telecomCall.unregisterCallback(telecomCallCallback);
notifyExternalCallRemoved(telecomCall);
}
/** Adds a new listener to external call events. */
public void addExternalCallListener(@NonNull ExternalCallListener listener) {
- mExternalCallListeners.add(listener);
+ externalCallListeners.add(listener);
}
/** Removes a listener to external call events. */
public void removeExternalCallListener(@NonNull ExternalCallListener listener) {
- if (!mExternalCallListeners.contains(listener)) {
+ if (!externalCallListeners.contains(listener)) {
LogUtil.i(
"ExternalCallList.removeExternalCallListener",
"attempt to remove unregistered listener.");
}
- mExternalCallListeners.remove(listener);
+ externalCallListeners.remove(listener);
}
public boolean isCallTracked(@NonNull android.telecom.Call telecomCall) {
- return mExternalCalls.contains(telecomCall);
+ return externalCalls.contains(telecomCall);
}
/** Notifies listeners of the addition of a new external call. */
private void notifyExternalCallAdded(Call call) {
- for (ExternalCallListener listener : mExternalCallListeners) {
+ for (ExternalCallListener listener : externalCallListeners) {
listener.onExternalCallAdded(call);
}
}
/** Notifies listeners of the removal of an external call. */
private void notifyExternalCallRemoved(Call call) {
- for (ExternalCallListener listener : mExternalCallListeners) {
+ for (ExternalCallListener listener : externalCallListeners) {
listener.onExternalCallRemoved(call);
}
}
@@ -109,11 +109,11 @@ public class ExternalCallList {
// change.
onCallRemoved(call);
- for (ExternalCallListener listener : mExternalCallListeners) {
+ for (ExternalCallListener listener : externalCallListeners) {
listener.onExternalCallPulled(call);
}
} else {
- for (ExternalCallListener listener : mExternalCallListeners) {
+ for (ExternalCallListener listener : externalCallListeners) {
listener.onExternalCallUpdated(call);
}
}
diff --git a/java/com/android/incallui/call/InCallVideoCallCallbackNotifier.java b/java/com/android/incallui/call/InCallVideoCallCallbackNotifier.java
index ff94120bf..23a3dad05 100644
--- a/java/com/android/incallui/call/InCallVideoCallCallbackNotifier.java
+++ b/java/com/android/incallui/call/InCallVideoCallCallbackNotifier.java
@@ -27,13 +27,13 @@ import java.util.concurrent.ConcurrentHashMap;
public class InCallVideoCallCallbackNotifier {
/** Singleton instance of this class. */
- private static InCallVideoCallCallbackNotifier sInstance = new InCallVideoCallCallbackNotifier();
+ private static InCallVideoCallCallbackNotifier instance = new InCallVideoCallCallbackNotifier();
/**
* ConcurrentHashMap constructor params: 8 is initial table size, 0.9f is load factor before
* resizing, 1 means we only expect a single thread to access the map so make only a single shard
*/
- private final Set<SurfaceChangeListener> mSurfaceChangeListeners =
+ private final Set<SurfaceChangeListener> surfaceChangeListeners =
Collections.newSetFromMap(new ConcurrentHashMap<SurfaceChangeListener, Boolean>(8, 0.9f, 1));
/** Private constructor. Instance should only be acquired through getRunningInstance(). */
@@ -41,7 +41,7 @@ public class InCallVideoCallCallbackNotifier {
/** Static singleton accessor method. */
public static InCallVideoCallCallbackNotifier getInstance() {
- return sInstance;
+ return instance;
}
/**
@@ -51,7 +51,7 @@ public class InCallVideoCallCallbackNotifier {
*/
public void addSurfaceChangeListener(@NonNull SurfaceChangeListener listener) {
Objects.requireNonNull(listener);
- mSurfaceChangeListeners.add(listener);
+ surfaceChangeListeners.add(listener);
}
/**
@@ -61,7 +61,7 @@ public class InCallVideoCallCallbackNotifier {
*/
public void removeSurfaceChangeListener(@Nullable SurfaceChangeListener listener) {
if (listener != null) {
- mSurfaceChangeListeners.remove(listener);
+ surfaceChangeListeners.remove(listener);
}
}
@@ -73,7 +73,7 @@ public class InCallVideoCallCallbackNotifier {
* @param height New peer height.
*/
public void peerDimensionsChanged(DialerCall call, int width, int height) {
- for (SurfaceChangeListener listener : mSurfaceChangeListeners) {
+ for (SurfaceChangeListener listener : surfaceChangeListeners) {
listener.onUpdatePeerDimensions(call, width, height);
}
}
@@ -86,7 +86,7 @@ public class InCallVideoCallCallbackNotifier {
* @param height The new camera video height.
*/
public void cameraDimensionsChanged(DialerCall call, int width, int height) {
- for (SurfaceChangeListener listener : mSurfaceChangeListeners) {
+ for (SurfaceChangeListener listener : surfaceChangeListeners) {
listener.onCameraDimensionsChange(call, width, height);
}
}
diff --git a/java/com/android/incallui/call/TelecomAdapter.java b/java/com/android/incallui/call/TelecomAdapter.java
index d48ab68c2..a7e10d37c 100644
--- a/java/com/android/incallui/call/TelecomAdapter.java
+++ b/java/com/android/incallui/call/TelecomAdapter.java
@@ -32,8 +32,8 @@ public class TelecomAdapter implements InCallServiceListener {
private static final String ADD_CALL_MODE_KEY = "add_call_mode";
- private static TelecomAdapter sInstance;
- private InCallService mInCallService;
+ private static TelecomAdapter instance;
+ private InCallService inCallService;
private TelecomAdapter() {}
@@ -42,25 +42,25 @@ public class TelecomAdapter implements InCallServiceListener {
if (!Looper.getMainLooper().isCurrentThread()) {
throw new IllegalStateException();
}
- if (sInstance == null) {
- sInstance = new TelecomAdapter();
+ if (instance == null) {
+ instance = new TelecomAdapter();
}
- return sInstance;
+ return instance;
}
@VisibleForTesting(otherwise = VisibleForTesting.NONE)
public static void setInstanceForTesting(TelecomAdapter telecomAdapter) {
- sInstance = telecomAdapter;
+ instance = telecomAdapter;
}
@Override
public void setInCallService(InCallService inCallService) {
- mInCallService = inCallService;
+ this.inCallService = inCallService;
}
@Override
public void clearInCallService() {
- mInCallService = null;
+ inCallService = null;
}
private android.telecom.Call getTelecomCallById(String callId) {
@@ -69,16 +69,16 @@ public class TelecomAdapter implements InCallServiceListener {
}
public void mute(boolean shouldMute) {
- if (mInCallService != null) {
- mInCallService.setMuted(shouldMute);
+ if (inCallService != null) {
+ inCallService.setMuted(shouldMute);
} else {
LogUtil.e("TelecomAdapter.mute", "mInCallService is null");
}
}
public void setAudioRoute(int route) {
- if (mInCallService != null) {
- mInCallService.setAudioRoute(route);
+ if (inCallService != null) {
+ inCallService.setAudioRoute(route);
} else {
LogUtil.e("TelecomAdapter.setAudioRoute", "mInCallService is null");
}
@@ -116,7 +116,7 @@ public class TelecomAdapter implements InCallServiceListener {
}
public void addCall() {
- if (mInCallService != null) {
+ if (inCallService != null) {
Intent intent = new Intent(Intent.ACTION_DIAL);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
@@ -126,7 +126,7 @@ public class TelecomAdapter implements InCallServiceListener {
intent.putExtra(ADD_CALL_MODE_KEY, true);
try {
LogUtil.d("TelecomAdapter.addCall", "Sending the add DialerCall intent");
- mInCallService.startActivity(intent);
+ inCallService.startActivity(intent);
} catch (ActivityNotFoundException e) {
// This is rather rare but possible.
// Note: this method is used even when the phone is encrypted. At that moment
@@ -164,8 +164,8 @@ public class TelecomAdapter implements InCallServiceListener {
}
public boolean canAddCall() {
- if (mInCallService != null) {
- return mInCallService.canAddCall();
+ if (inCallService != null) {
+ return inCallService.canAddCall();
}
return false;
}
@@ -177,16 +177,16 @@ public class TelecomAdapter implements InCallServiceListener {
*/
public void startForegroundNotification(int id, Notification notification) {
Assert.isNotNull(
- mInCallService, "No inCallService available for starting foreground notification");
- mInCallService.startForeground(id, notification);
+ inCallService, "No inCallService available for starting foreground notification");
+ inCallService.startForeground(id, notification);
}
/**
* Stop a started foreground notification. This does not stop {@code mInCallService} from running.
*/
public void stopForegroundNotification() {
- if (mInCallService != null) {
- mInCallService.stopForeground(true /*removeNotification*/);
+ if (inCallService != null) {
+ inCallService.stopForeground(true /*removeNotification*/);
} else {
LogUtil.e(
"TelecomAdapter.stopForegroundNotification",
diff --git a/java/com/android/incallui/calllocation/impl/DownloadMapImageTask.java b/java/com/android/incallui/calllocation/impl/DownloadMapImageTask.java
index 035f5cdac..c7249e0fa 100644
--- a/java/com/android/incallui/calllocation/impl/DownloadMapImageTask.java
+++ b/java/com/android/incallui/calllocation/impl/DownloadMapImageTask.java
@@ -31,15 +31,15 @@ class DownloadMapImageTask extends AsyncTask<Location, Void, Drawable> {
private static final String STATIC_MAP_SRC_NAME = "src";
- private final WeakReference<LocationUi> mUiReference;
+ private final WeakReference<LocationUi> uiReference;
public DownloadMapImageTask(WeakReference<LocationUi> uiReference) {
- mUiReference = uiReference;
+ this.uiReference = uiReference;
}
@Override
protected Drawable doInBackground(Location... locations) {
- LocationUi ui = mUiReference.get();
+ LocationUi ui = uiReference.get();
if (ui == null) {
return null;
}
@@ -64,7 +64,7 @@ class DownloadMapImageTask extends AsyncTask<Location, Void, Drawable> {
@Override
protected void onPostExecute(Drawable mapImage) {
- LocationUi ui = mUiReference.get();
+ LocationUi ui = uiReference.get();
if (ui == null) {
return;
}
diff --git a/java/com/android/incallui/calllocation/impl/HttpFetcher.java b/java/com/android/incallui/calllocation/impl/HttpFetcher.java
index 10cc34d25..c182fa156 100644
--- a/java/com/android/incallui/calllocation/impl/HttpFetcher.java
+++ b/java/com/android/incallui/calllocation/impl/HttpFetcher.java
@@ -222,8 +222,6 @@ public class HttpFetcher {
/**
* Lookup up url re-write rules from gServices and apply to the given url.
*
-
- *
* @return The new url.
*/
private static URL reWriteUrl(Context context, String url) {
@@ -267,21 +265,21 @@ public class HttpFetcher {
/** Disconnect {@link HttpURLConnection} when InputStream is closed */
private static class HttpInputStreamWrapper extends FilterInputStream {
- final HttpURLConnection mHttpUrlConnection;
- final long mStartMillis = SystemClock.uptimeMillis();
+ final HttpURLConnection httpUrlConnection;
+ final long startMillis = SystemClock.uptimeMillis();
public HttpInputStreamWrapper(HttpURLConnection conn, InputStream in) {
super(in);
- mHttpUrlConnection = conn;
+ httpUrlConnection = conn;
}
@Override
public void close() throws IOException {
super.close();
- mHttpUrlConnection.disconnect();
+ httpUrlConnection.disconnect();
if (LogUtil.isDebugEnabled()) {
long endMillis = SystemClock.uptimeMillis();
- LogUtil.i("HttpFetcher.close", "fetch took " + (endMillis - mStartMillis) + " ms");
+ LogUtil.i("HttpFetcher.close", "fetch took " + (endMillis - startMillis) + " ms");
}
}
}
diff --git a/java/com/android/incallui/calllocation/impl/LocationPresenter.java b/java/com/android/incallui/calllocation/impl/LocationPresenter.java
index 1199308a5..83195baf8 100644
--- a/java/com/android/incallui/calllocation/impl/LocationPresenter.java
+++ b/java/com/android/incallui/calllocation/impl/LocationPresenter.java
@@ -37,9 +37,9 @@ import java.util.Objects;
public class LocationPresenter extends Presenter<LocationPresenter.LocationUi>
implements LocationListener {
- private Location mLastLocation;
- private AsyncTask mDownloadMapTask;
- private AsyncTask mReverseGeocodeTask;
+ private Location lastLocation;
+ private AsyncTask downloadMapTask;
+ private AsyncTask reverseGeocodeTask;
LocationPresenter() {}
@@ -47,7 +47,7 @@ public class LocationPresenter extends Presenter<LocationPresenter.LocationUi>
public void onUiReady(LocationUi ui) {
LogUtil.i("LocationPresenter.onUiReady", "");
super.onUiReady(ui);
- updateLocation(mLastLocation, true);
+ updateLocation(lastLocation, true);
}
@Override
@@ -55,11 +55,11 @@ public class LocationPresenter extends Presenter<LocationPresenter.LocationUi>
LogUtil.i("LocationPresenter.onUiUnready", "");
super.onUiUnready(ui);
- if (mDownloadMapTask != null) {
- mDownloadMapTask.cancel(true);
+ if (downloadMapTask != null) {
+ downloadMapTask.cancel(true);
}
- if (mReverseGeocodeTask != null) {
- mReverseGeocodeTask.cancel(true);
+ if (reverseGeocodeTask != null) {
+ reverseGeocodeTask.cancel(true);
}
}
@@ -71,13 +71,13 @@ public class LocationPresenter extends Presenter<LocationPresenter.LocationUi>
private void updateLocation(Location location, boolean forceUpdate) {
LogUtil.i("LocationPresenter.updateLocation", "location: " + location);
- if (forceUpdate || !Objects.equals(mLastLocation, location)) {
- mLastLocation = location;
+ if (forceUpdate || !Objects.equals(lastLocation, location)) {
+ lastLocation = location;
int status = LocationHelper.checkLocation(location);
LocationUi ui = getUi();
if (status == LocationHelper.LOCATION_STATUS_OK) {
- mDownloadMapTask = new DownloadMapImageTask(new WeakReference<>(ui)).execute(location);
- mReverseGeocodeTask = new ReverseGeocodeTask(new WeakReference<>(ui)).execute(location);
+ downloadMapTask = new DownloadMapImageTask(new WeakReference<>(ui)).execute(location);
+ reverseGeocodeTask = new ReverseGeocodeTask(new WeakReference<>(ui)).execute(location);
if (ui != null) {
ui.setLocation(location);
} else {
diff --git a/java/com/android/incallui/calllocation/impl/ReverseGeocodeTask.java b/java/com/android/incallui/calllocation/impl/ReverseGeocodeTask.java
index 060ec0b4f..f4592d4c8 100644
--- a/java/com/android/incallui/calllocation/impl/ReverseGeocodeTask.java
+++ b/java/com/android/incallui/calllocation/impl/ReverseGeocodeTask.java
@@ -39,15 +39,15 @@ class ReverseGeocodeTask extends AsyncTask<Location, Void, String> {
private static final String JSON_KEY_LONG_NAME = "long_name";
private static final String JSON_KEY_SHORT_NAME = "short_name";
- private WeakReference<LocationUi> mUiReference;
+ private WeakReference<LocationUi> uiReference;
public ReverseGeocodeTask(WeakReference<LocationUi> uiReference) {
- mUiReference = uiReference;
+ this.uiReference = uiReference;
}
@Override
protected String doInBackground(Location... locations) {
- LocationUi ui = mUiReference.get();
+ LocationUi ui = uiReference.get();
if (ui == null) {
return null;
}
@@ -131,7 +131,7 @@ class ReverseGeocodeTask extends AsyncTask<Location, Void, String> {
@Override
protected void onPostExecute(String address) {
- LocationUi ui = mUiReference.get();
+ LocationUi ui = uiReference.get();
if (ui == null) {
return;
}
diff --git a/java/com/android/incallui/latencyreport/LatencyReport.java b/java/com/android/incallui/latencyreport/LatencyReport.java
index 2e1fbd590..8ea66f9b3 100644
--- a/java/com/android/incallui/latencyreport/LatencyReport.java
+++ b/java/com/android/incallui/latencyreport/LatencyReport.java
@@ -30,111 +30,111 @@ public class LatencyReport {
"android.telecom.extra.CALL_TELECOM_ROUTING_START_TIME_MILLIS";
private static final String EXTRA_CALL_TELECOM_ROUTING_END_TIME_MILLIS =
"android.telecom.extra.CALL_TELECOM_ROUTING_END_TIME_MILLIS";
- private final boolean mWasIncoming;
+ private final boolean wasIncoming;
// Time elapsed since boot when the call was created by the connection service.
- private final long mCreatedTimeMillis;
+ private final long createdTimeMillis;
// Time elapsed since boot when telecom began processing the call.
- private final long mTelecomRoutingStartTimeMillis;
+ private final long telecomRoutingStartTimeMillis;
// Time elapsed since boot when telecom finished processing the call. This includes things like
// looking up contact info and call blocking but before showing any UI.
- private final long mTelecomRoutingEndTimeMillis;
+ private final long telecomRoutingEndTimeMillis;
// Time elapsed since boot when the call was added to the InCallUi.
- private final long mCallAddedTimeMillis;
+ private final long callAddedTimeMillis;
// Time elapsed since boot when the call was added and call blocking evaluation was completed.
- private long mCallBlockingTimeMillis = INVALID_TIME;
+ private long callBlockingTimeMillis = INVALID_TIME;
// Time elapsed since boot when the call notification was shown.
- private long mCallNotificationTimeMillis = INVALID_TIME;
+ private long callNotificationTimeMillis = INVALID_TIME;
// Time elapsed since boot when the InCallUI was shown.
- private long mInCallUiShownTimeMillis = INVALID_TIME;
+ private long inCallUiShownTimeMillis = INVALID_TIME;
// Whether the call was shown to the user as a heads up notification instead of a full screen
// UI.
- private boolean mDidDisplayHeadsUpNotification;
+ private boolean didDisplayHeadsUpNotification;
public LatencyReport() {
- mWasIncoming = false;
- mCreatedTimeMillis = INVALID_TIME;
- mTelecomRoutingStartTimeMillis = INVALID_TIME;
- mTelecomRoutingEndTimeMillis = INVALID_TIME;
- mCallAddedTimeMillis = SystemClock.elapsedRealtime();
+ wasIncoming = false;
+ createdTimeMillis = INVALID_TIME;
+ telecomRoutingStartTimeMillis = INVALID_TIME;
+ telecomRoutingEndTimeMillis = INVALID_TIME;
+ callAddedTimeMillis = SystemClock.elapsedRealtime();
}
public LatencyReport(android.telecom.Call telecomCall) {
- mWasIncoming = telecomCall.getState() == android.telecom.Call.STATE_RINGING;
+ wasIncoming = telecomCall.getState() == android.telecom.Call.STATE_RINGING;
Bundle extras = telecomCall.getDetails().getIntentExtras();
if (extras == null) {
- mCreatedTimeMillis = INVALID_TIME;
- mTelecomRoutingStartTimeMillis = INVALID_TIME;
- mTelecomRoutingEndTimeMillis = INVALID_TIME;
+ createdTimeMillis = INVALID_TIME;
+ telecomRoutingStartTimeMillis = INVALID_TIME;
+ telecomRoutingEndTimeMillis = INVALID_TIME;
} else {
- mCreatedTimeMillis = extras.getLong(EXTRA_CALL_CREATED_TIME_MILLIS, INVALID_TIME);
- mTelecomRoutingStartTimeMillis =
+ createdTimeMillis = extras.getLong(EXTRA_CALL_CREATED_TIME_MILLIS, INVALID_TIME);
+ telecomRoutingStartTimeMillis =
extras.getLong(EXTRA_CALL_TELECOM_ROUTING_START_TIME_MILLIS, INVALID_TIME);
- mTelecomRoutingEndTimeMillis =
+ telecomRoutingEndTimeMillis =
extras.getLong(EXTRA_CALL_TELECOM_ROUTING_END_TIME_MILLIS, INVALID_TIME);
}
- mCallAddedTimeMillis = SystemClock.elapsedRealtime();
+ callAddedTimeMillis = SystemClock.elapsedRealtime();
}
public boolean getWasIncoming() {
- return mWasIncoming;
+ return wasIncoming;
}
public long getCreatedTimeMillis() {
- return mCreatedTimeMillis;
+ return createdTimeMillis;
}
public long getTelecomRoutingStartTimeMillis() {
- return mTelecomRoutingStartTimeMillis;
+ return telecomRoutingStartTimeMillis;
}
public long getTelecomRoutingEndTimeMillis() {
- return mTelecomRoutingEndTimeMillis;
+ return telecomRoutingEndTimeMillis;
}
public long getCallAddedTimeMillis() {
- return mCallAddedTimeMillis;
+ return callAddedTimeMillis;
}
public long getCallBlockingTimeMillis() {
- return mCallBlockingTimeMillis;
+ return callBlockingTimeMillis;
}
public void onCallBlockingDone() {
- if (mCallBlockingTimeMillis == INVALID_TIME) {
- mCallBlockingTimeMillis = SystemClock.elapsedRealtime();
+ if (callBlockingTimeMillis == INVALID_TIME) {
+ callBlockingTimeMillis = SystemClock.elapsedRealtime();
}
}
public long getCallNotificationTimeMillis() {
- return mCallNotificationTimeMillis;
+ return callNotificationTimeMillis;
}
public void onNotificationShown() {
- if (mCallNotificationTimeMillis == INVALID_TIME) {
- mCallNotificationTimeMillis = SystemClock.elapsedRealtime();
+ if (callNotificationTimeMillis == INVALID_TIME) {
+ callNotificationTimeMillis = SystemClock.elapsedRealtime();
}
}
public long getInCallUiShownTimeMillis() {
- return mInCallUiShownTimeMillis;
+ return inCallUiShownTimeMillis;
}
public void onInCallUiShown(boolean forFullScreenIntent) {
- if (mInCallUiShownTimeMillis == INVALID_TIME) {
- mInCallUiShownTimeMillis = SystemClock.elapsedRealtime();
- mDidDisplayHeadsUpNotification = mWasIncoming && !forFullScreenIntent;
+ if (inCallUiShownTimeMillis == INVALID_TIME) {
+ inCallUiShownTimeMillis = SystemClock.elapsedRealtime();
+ didDisplayHeadsUpNotification = wasIncoming && !forFullScreenIntent;
}
}
public boolean getDidDisplayHeadsUpNotification() {
- return mDidDisplayHeadsUpNotification;
+ return didDisplayHeadsUpNotification;
}
}
diff --git a/java/com/android/incallui/ringtone/DialerRingtoneManager.java b/java/com/android/incallui/ringtone/DialerRingtoneManager.java
index 5ebd93378..49badf575 100644
--- a/java/com/android/incallui/ringtone/DialerRingtoneManager.java
+++ b/java/com/android/incallui/ringtone/DialerRingtoneManager.java
@@ -38,9 +38,9 @@ public class DialerRingtoneManager {
* Once we're ready to enable Dialer Ringing, these flags should be removed.
*/
private static final boolean IS_DIALER_RINGING_ENABLED = false;
- private final InCallTonePlayer mInCallTonePlayer;
- private final CallList mCallList;
- private Boolean mIsDialerRingingEnabledForTesting;
+ private final InCallTonePlayer inCallTonePlayer;
+ private final CallList callList;
+ private Boolean isDialerRingingEnabledForTesting;
/**
* Creates the DialerRingtoneManager with the given {@link InCallTonePlayer}.
@@ -51,8 +51,8 @@ public class DialerRingtoneManager {
*/
public DialerRingtoneManager(
@NonNull InCallTonePlayer inCallTonePlayer, @NonNull CallList callList) {
- mInCallTonePlayer = Objects.requireNonNull(inCallTonePlayer);
- mCallList = Objects.requireNonNull(callList);
+ this.inCallTonePlayer = Objects.requireNonNull(inCallTonePlayer);
+ this.callList = Objects.requireNonNull(callList);
}
/**
@@ -88,13 +88,13 @@ public class DialerRingtoneManager {
if (callState != State.INCOMING) {
return callState;
}
- return mCallList.getActiveCall() == null ? State.INCOMING : State.CALL_WAITING;
+ return callList.getActiveCall() == null ? State.INCOMING : State.CALL_WAITING;
}
private boolean isDialerRingingEnabled() {
boolean enabledFlag =
- mIsDialerRingingEnabledForTesting != null
- ? mIsDialerRingingEnabledForTesting
+ isDialerRingingEnabledForTesting != null
+ ? isDialerRingingEnabledForTesting
: IS_DIALER_RINGING_ENABLED;
return VERSION.SDK_INT >= VERSION_CODES.N && enabledFlag;
}
@@ -109,7 +109,7 @@ public class DialerRingtoneManager {
public boolean shouldPlayCallWaitingTone(int callState) {
return isDialerRingingEnabled()
&& translateCallStateForCallWaiting(callState) == State.CALL_WAITING
- && !mInCallTonePlayer.isPlayingTone();
+ && !inCallTonePlayer.isPlayingTone();
}
/** Plays the call waiting tone. */
@@ -117,7 +117,7 @@ public class DialerRingtoneManager {
if (!isDialerRingingEnabled()) {
return;
}
- mInCallTonePlayer.play(InCallTonePlayer.TONE_CALL_WAITING);
+ inCallTonePlayer.play(InCallTonePlayer.TONE_CALL_WAITING);
}
/** Stops playing the call waiting tone. */
@@ -125,10 +125,10 @@ public class DialerRingtoneManager {
if (!isDialerRingingEnabled()) {
return;
}
- mInCallTonePlayer.stop();
+ inCallTonePlayer.stop();
}
void setDialerRingingEnabledForTesting(boolean status) {
- mIsDialerRingingEnabledForTesting = status;
+ isDialerRingingEnabledForTesting = status;
}
}
diff --git a/java/com/android/incallui/ringtone/InCallTonePlayer.java b/java/com/android/incallui/ringtone/InCallTonePlayer.java
index c76b41d72..dac244d22 100644
--- a/java/com/android/incallui/ringtone/InCallTonePlayer.java
+++ b/java/com/android/incallui/ringtone/InCallTonePlayer.java
@@ -36,9 +36,9 @@ public class InCallTonePlayer {
public static final int VOLUME_RELATIVE_HIGH_PRIORITY = 80;
- @NonNull private final ToneGeneratorFactory mToneGeneratorFactory;
- @NonNull private final PausableExecutor mExecutor;
- private @Nullable CountDownLatch mNumPlayingTones;
+ @NonNull private final ToneGeneratorFactory toneGeneratorFactory;
+ @NonNull private final PausableExecutor executor;
+ private @Nullable CountDownLatch numPlayingTones;
/**
* Creates a new InCallTonePlayer.
@@ -51,13 +51,13 @@ public class InCallTonePlayer {
*/
public InCallTonePlayer(
@NonNull ToneGeneratorFactory toneGeneratorFactory, @NonNull PausableExecutor executor) {
- mToneGeneratorFactory = Objects.requireNonNull(toneGeneratorFactory);
- mExecutor = Objects.requireNonNull(executor);
+ this.toneGeneratorFactory = Objects.requireNonNull(toneGeneratorFactory);
+ this.executor = Objects.requireNonNull(executor);
}
/** @return {@code true} if a tone is currently playing, {@code false} otherwise. */
public boolean isPlayingTone() {
- return mNumPlayingTones != null && mNumPlayingTones.getCount() > 0;
+ return numPlayingTones != null && numPlayingTones.getCount() > 0;
}
/**
@@ -72,8 +72,8 @@ public class InCallTonePlayer {
throw new IllegalStateException("Tone already playing");
}
final ToneGeneratorInfo info = getToneGeneratorInfo(tone);
- mNumPlayingTones = new CountDownLatch(1);
- mExecutor.execute(
+ numPlayingTones = new CountDownLatch(1);
+ executor.execute(
new Runnable() {
@Override
public void run() {
@@ -106,17 +106,17 @@ public class InCallTonePlayer {
ToneGenerator toneGenerator = null;
try {
Log.v(this, "Starting tone " + info);
- toneGenerator = mToneGeneratorFactory.newInCallToneGenerator(info.stream, info.volume);
+ toneGenerator = toneGeneratorFactory.newInCallToneGenerator(info.stream, info.volume);
toneGenerator.startTone(info.tone);
/*
* During tests, this will block until the tests call mExecutor.ackMilestone. This call
* allows for synchronization to the point where the tone has started playing.
*/
- mExecutor.milestone();
- if (mNumPlayingTones != null) {
- mNumPlayingTones.await(info.toneLengthMillis, TimeUnit.MILLISECONDS);
+ executor.milestone();
+ if (numPlayingTones != null) {
+ numPlayingTones.await(info.toneLengthMillis, TimeUnit.MILLISECONDS);
// Allows for synchronization to the point where the tone has completed playing.
- mExecutor.milestone();
+ executor.milestone();
}
} catch (InterruptedException e) {
Log.w(this, "Interrupted while playing in-call tone.");
@@ -124,18 +124,18 @@ public class InCallTonePlayer {
if (toneGenerator != null) {
toneGenerator.release();
}
- if (mNumPlayingTones != null) {
- mNumPlayingTones.countDown();
+ if (numPlayingTones != null) {
+ numPlayingTones.countDown();
}
// Allows for synchronization to the point where this background thread has cleaned up.
- mExecutor.milestone();
+ executor.milestone();
}
}
/** Stops playback of the current tone. */
public void stop() {
- if (mNumPlayingTones != null) {
- mNumPlayingTones.countDown();
+ if (numPlayingTones != null) {
+ numPlayingTones.countDown();
}
}