diff options
Diffstat (limited to 'java/com/android/incallui/call')
-rw-r--r-- | java/com/android/incallui/call/CallList.java | 130 | ||||
-rw-r--r-- | java/com/android/incallui/call/DialerCall.java | 395 | ||||
-rw-r--r-- | java/com/android/incallui/call/ExternalCallList.java | 32 | ||||
-rw-r--r-- | java/com/android/incallui/call/InCallVideoCallCallbackNotifier.java | 14 | ||||
-rw-r--r-- | java/com/android/incallui/call/TelecomAdapter.java | 40 |
5 files changed, 305 insertions, 306 deletions
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", |