From 183cb71663320f16149d83eeebaff7795a4b55f2 Mon Sep 17 00:00:00 2001 From: linyuh Date: Wed, 27 Dec 2017 17:02:37 -0800 Subject: Remove field prefixes. Test: Existing tests PiperOrigin-RevId: 180230450 Change-Id: I0b2589cfeeaef81e42a04efa48af24b4e4d0e95f --- java/com/android/incallui/InCallPresenter.java | 632 ++++++++++++------------- 1 file changed, 315 insertions(+), 317 deletions(-) (limited to 'java/com/android/incallui/InCallPresenter.java') 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 mListeners = + private final Set listeners = Collections.newSetFromMap(new ConcurrentHashMap(8, 0.9f, 1)); - private final List mIncomingCallListeners = new CopyOnWriteArrayList<>(); - private final Set mDetailsListeners = + private final List incomingCallListeners = new CopyOnWriteArrayList<>(); + private final Set detailsListeners = Collections.newSetFromMap(new ConcurrentHashMap(8, 0.9f, 1)); - private final Set mCanAddCallListeners = + private final Set canAddCallListeners = Collections.newSetFromMap(new ConcurrentHashMap(8, 0.9f, 1)); - private final Set mInCallUiListeners = + private final Set inCallUiListeners = Collections.newSetFromMap(new ConcurrentHashMap(8, 0.9f, 1)); - private final Set mOrientationListeners = + private final Set orientationListeners = Collections.newSetFromMap( new ConcurrentHashMap(8, 0.9f, 1)); - private final Set mInCallEventListeners = + private final Set inCallEventListeners = Collections.newSetFromMap(new ConcurrentHashMap(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 mInCallUiLocks = new ArraySet<>(); + private final Set inCallUiLocks = new ArraySet<>(); } -- cgit v1.2.3