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/CallCardPresenter.java | 428 +++++++++++------------ 1 file changed, 214 insertions(+), 214 deletions(-) (limited to 'java/com/android/incallui/CallCardPresenter.java') diff --git a/java/com/android/incallui/CallCardPresenter.java b/java/com/android/incallui/CallCardPresenter.java index eb5221669..67473d75e 100644 --- a/java/com/android/incallui/CallCardPresenter.java +++ b/java/com/android/incallui/CallCardPresenter.java @@ -113,16 +113,16 @@ public class CallCardPresenter private static final long CONFIG_MIN_BATTERY_PERCENT_FOR_EMERGENCY_LOCATION_DEFAULT = 10; - private final Context mContext; + private final Context context; private final Handler handler = new Handler(); - private DialerCall mPrimary; - private DialerCall mSecondary; - private ContactCacheEntry mPrimaryContactInfo; - private ContactCacheEntry mSecondaryContactInfo; - @Nullable private ContactsPreferences mContactsPreferences; - private boolean mIsFullscreen = false; - private InCallScreen mInCallScreen; + private DialerCall primary; + private DialerCall secondary; + private ContactCacheEntry primaryContactInfo; + private ContactCacheEntry secondaryContactInfo; + @Nullable private ContactsPreferences contactsPreferences; + private boolean isFullscreen = false; + private InCallScreen inCallScreen; private boolean isInCallScreenReady; private boolean shouldSendAccessibilityEvent; @@ -131,7 +131,7 @@ public class CallCardPresenter new Runnable() { @Override public void run() { - shouldSendAccessibilityEvent = !sendAccessibilityEvent(mContext, getUi()); + shouldSendAccessibilityEvent = !sendAccessibilityEvent(context, getUi()); LogUtil.i( "CallCardPresenter.sendAccessibilityEventRunnable", "still should send: %b", @@ -144,8 +144,8 @@ public class CallCardPresenter public CallCardPresenter(Context context) { LogUtil.i("CallCardPresenter.constructor", null); - mContext = Assert.isNotNull(context).getApplicationContext(); - callLocation = CallLocationComponent.get(mContext).getCallLocation(); + this.context = Assert.isNotNull(context).getApplicationContext(); + callLocation = CallLocationComponent.get(this.context).getCallLocation(); } private static boolean hasCallSubject(DialerCall call) { @@ -160,18 +160,18 @@ public class CallCardPresenter @Override public void onInCallScreenDelegateInit(InCallScreen inCallScreen) { Assert.isNotNull(inCallScreen); - mInCallScreen = inCallScreen; - mContactsPreferences = ContactsPreferencesFactory.newContactsPreferences(mContext); + this.inCallScreen = inCallScreen; + contactsPreferences = ContactsPreferencesFactory.newContactsPreferences(context); // Call may be null if disconnect happened already. DialerCall call = CallList.getInstance().getFirstCall(); if (call != null) { - mPrimary = call; - if (shouldShowNoteSentToast(mPrimary)) { - mInCallScreen.showNoteSentToast(); + primary = call; + if (shouldShowNoteSentToast(primary)) { + this.inCallScreen.showNoteSentToast(); } call.addListener(this); - addCallFeedbackListener(mContext); + addCallFeedbackListener(context); // start processing lookups right away. if (!call.isConferenceCall()) { startContactInfoSearch(call, true, call.getState() == DialerCall.State.INCOMING); @@ -187,12 +187,12 @@ public class CallCardPresenter public void onInCallScreenReady() { LogUtil.i("CallCardPresenter.onInCallScreenReady", null); Assert.checkState(!isInCallScreenReady); - if (mContactsPreferences != null) { - mContactsPreferences.refreshValue(ContactsPreferences.DISPLAY_ORDER_KEY); + if (contactsPreferences != null) { + contactsPreferences.refreshValue(ContactsPreferences.DISPLAY_ORDER_KEY); } // Contact search may have completed before ui is ready. - if (mPrimaryContactInfo != null) { + if (primaryContactInfo != null) { updatePrimaryDisplayInfo(); } @@ -204,24 +204,24 @@ public class CallCardPresenter isInCallScreenReady = true; // Log location impressions - if (isOutgoingEmergencyCall(mPrimary)) { - Logger.get(mContext).logImpression(DialerImpression.Type.EMERGENCY_NEW_EMERGENCY_CALL); - } else if (isIncomingEmergencyCall(mPrimary) || isIncomingEmergencyCall(mSecondary)) { - Logger.get(mContext).logImpression(DialerImpression.Type.EMERGENCY_CALLBACK); + if (isOutgoingEmergencyCall(primary)) { + Logger.get(context).logImpression(DialerImpression.Type.EMERGENCY_NEW_EMERGENCY_CALL); + } else if (isIncomingEmergencyCall(primary) || isIncomingEmergencyCall(secondary)) { + Logger.get(context).logImpression(DialerImpression.Type.EMERGENCY_CALLBACK); } // Showing the location may have been skipped if the UI wasn't ready during previous layout. if (shouldShowLocation()) { - mInCallScreen.showLocationUi(getLocationFragment()); + inCallScreen.showLocationUi(getLocationFragment()); // Log location impressions if (!hasLocationPermission()) { - Logger.get(mContext).logImpression(DialerImpression.Type.EMERGENCY_NO_LOCATION_PERMISSION); + Logger.get(context).logImpression(DialerImpression.Type.EMERGENCY_NO_LOCATION_PERMISSION); } else if (isBatteryTooLowForEmergencyLocation()) { - Logger.get(mContext) + Logger.get(context) .logImpression(DialerImpression.Type.EMERGENCY_BATTERY_TOO_LOW_TO_GET_LOCATION); - } else if (!callLocation.canGetLocation(mContext)) { - Logger.get(mContext).logImpression(DialerImpression.Type.EMERGENCY_CANT_GET_LOCATION); + } else if (!callLocation.canGetLocation(context)) { + Logger.get(context).logImpression(DialerImpression.Type.EMERGENCY_CANT_GET_LOCATION); } } } @@ -236,15 +236,15 @@ public class CallCardPresenter InCallPresenter.getInstance().removeIncomingCallListener(this); InCallPresenter.getInstance().removeDetailsListener(this); InCallPresenter.getInstance().removeInCallEventListener(this); - if (mPrimary != null) { - mPrimary.removeListener(this); + if (primary != null) { + primary.removeListener(this); } callLocation.close(); - mPrimary = null; - mPrimaryContactInfo = null; - mSecondaryContactInfo = null; + primary = null; + primaryContactInfo = null; + secondaryContactInfo = null; isInCallScreenReady = false; } @@ -258,7 +258,7 @@ public class CallCardPresenter public void onStateChange(InCallState oldState, InCallState newState, CallList callList) { Trace.beginSection("CallCardPresenter.onStateChange"); LogUtil.v("CallCardPresenter.onStateChange", "oldState: %s, newState: %s", oldState, newState); - if (mInCallScreen == null) { + if (inCallScreen == null) { Trace.endSection(); return; } @@ -286,22 +286,23 @@ public class CallCardPresenter LogUtil.v("CallCardPresenter.onStateChange", "secondary call: " + secondary); final boolean primaryChanged = - !(DialerCall.areSame(mPrimary, primary) && DialerCall.areSameNumber(mPrimary, primary)); + !(DialerCall.areSame(this.primary, primary) + && DialerCall.areSameNumber(this.primary, primary)); final boolean secondaryChanged = - !(DialerCall.areSame(mSecondary, secondary) - && DialerCall.areSameNumber(mSecondary, secondary)); + !(DialerCall.areSame(this.secondary, secondary) + && DialerCall.areSameNumber(this.secondary, secondary)); - mSecondary = secondary; - DialerCall previousPrimary = mPrimary; - mPrimary = primary; + this.secondary = secondary; + DialerCall previousPrimary = this.primary; + this.primary = primary; - if (mPrimary != null) { - InCallPresenter.getInstance().onForegroundCallChanged(mPrimary); - mInCallScreen.updateInCallScreenColors(); + if (this.primary != null) { + InCallPresenter.getInstance().onForegroundCallChanged(this.primary); + inCallScreen.updateInCallScreenColors(); } if (primaryChanged && shouldShowNoteSentToast(primary)) { - mInCallScreen.showNoteSentToast(); + inCallScreen.showNoteSentToast(); } // Refresh primary call information if either: @@ -312,38 +313,38 @@ public class CallCardPresenter if (previousPrimary != null) { previousPrimary.removeListener(this); } - mPrimary.addListener(this); + this.primary.addListener(this); - mPrimaryContactInfo = + primaryContactInfo = ContactInfoCache.buildCacheEntryFromCall( - mContext, mPrimary, mPrimary.getState() == DialerCall.State.INCOMING); + context, this.primary, this.primary.getState() == DialerCall.State.INCOMING); updatePrimaryDisplayInfo(); - maybeStartSearch(mPrimary, true); + maybeStartSearch(this.primary, true); } - if (previousPrimary != null && mPrimary == null) { + if (previousPrimary != null && this.primary == null) { previousPrimary.removeListener(this); } if (secondaryChanged) { - if (mSecondary == null) { + if (this.secondary == null) { // Secondary call may have ended. Update the ui. - mSecondaryContactInfo = null; + secondaryContactInfo = null; updateSecondaryDisplayInfo(); } else { // secondary call has changed - mSecondaryContactInfo = + secondaryContactInfo = ContactInfoCache.buildCacheEntryFromCall( - mContext, mSecondary, mSecondary.getState() == DialerCall.State.INCOMING); + context, this.secondary, this.secondary.getState() == DialerCall.State.INCOMING); updateSecondaryDisplayInfo(); - maybeStartSearch(mSecondary, false); + maybeStartSearch(this.secondary, false); } } // Set the call state int callState = DialerCall.State.IDLE; - if (mPrimary != null) { - callState = mPrimary.getState(); + if (this.primary != null) { + callState = this.primary.getState(); updatePrimaryCallState(); } else { getUi().setCallState(PrimaryCallState.createEmptyPrimaryCallState()); @@ -354,7 +355,7 @@ public class CallCardPresenter // Hide the end call button instantly if we're receiving an incoming call. getUi() .setEndCallButtonEnabled( - shouldShowEndCallButton(mPrimary, callState), + shouldShowEndCallButton(this.primary, callState), callState != DialerCall.State.INCOMING /* animate */); maybeSendAccessibilityEvent(oldState, newState, primaryChanged); @@ -399,7 +400,7 @@ public class CallCardPresenter public void onDialerCallChildNumberChange() { LogUtil.v("CallCardPresenter.onDialerCallChildNumberChange", ""); - if (mPrimary == null) { + if (primary == null) { return; } updatePrimaryDisplayInfo(); @@ -410,7 +411,7 @@ public class CallCardPresenter public void onDialerCallLastForwardedNumberChange() { LogUtil.v("CallCardPresenter.onDialerCallLastForwardedNumberChange", ""); - if (mPrimary == null) { + if (primary == null) { return; } updatePrimaryDisplayInfo(); @@ -425,78 +426,78 @@ public class CallCardPresenter public void onDialerCallSessionModificationStateChange() { LogUtil.enterBlock("CallCardPresenter.onDialerCallSessionModificationStateChange"); - if (mPrimary == null) { + if (primary == null) { return; } getUi() .setEndCallButtonEnabled( - mPrimary.getVideoTech().getSessionModificationState() + primary.getVideoTech().getSessionModificationState() != SessionModificationState.RECEIVED_UPGRADE_TO_VIDEO_REQUEST, true /* shouldAnimate */); updatePrimaryCallState(); } private boolean shouldRefreshPrimaryInfo(boolean primaryChanged) { - if (mPrimary == null) { + if (primary == null) { return false; } return primaryChanged - || mInCallScreen.isManageConferenceVisible() != shouldShowManageConference(); + || inCallScreen.isManageConferenceVisible() != shouldShowManageConference(); } private void updatePrimaryCallState() { - if (getUi() != null && mPrimary != null) { + if (getUi() != null && primary != null) { boolean isWorkCall = - mPrimary.hasProperty(PROPERTY_ENTERPRISE_CALL) - || (mPrimaryContactInfo != null - && mPrimaryContactInfo.userType == ContactsUtils.USER_TYPE_WORK); + primary.hasProperty(PROPERTY_ENTERPRISE_CALL) + || (primaryContactInfo != null + && primaryContactInfo.userType == ContactsUtils.USER_TYPE_WORK); boolean isHdAudioCall = - isPrimaryCallActive() && mPrimary.hasProperty(Details.PROPERTY_HIGH_DEF_AUDIO); + isPrimaryCallActive() && primary.hasProperty(Details.PROPERTY_HIGH_DEF_AUDIO); boolean isAttemptingHdAudioCall = !isHdAudioCall - && !mPrimary.hasProperty(DialerCall.PROPERTY_CODEC_KNOWN) - && MotorolaUtils.shouldBlinkHdIconWhenConnectingCall(mContext); + && !primary.hasProperty(DialerCall.PROPERTY_CODEC_KNOWN) + && MotorolaUtils.shouldBlinkHdIconWhenConnectingCall(context); - boolean isBusiness = mPrimaryContactInfo != null && mPrimaryContactInfo.isBusiness; + boolean isBusiness = primaryContactInfo != null && primaryContactInfo.isBusiness; // Check for video state change and update the visibility of the contact photo. The contact // photo is hidden when the incoming video surface is shown. // The contact photo visibility can also change in setPrimary(). boolean shouldShowContactPhoto = - !VideoCallPresenter.showIncomingVideo(mPrimary.getVideoState(), mPrimary.getState()); + !VideoCallPresenter.showIncomingVideo(primary.getVideoState(), primary.getState()); getUi() .setCallState( new PrimaryCallState( - mPrimary.getState(), - mPrimary.isVideoCall(), - mPrimary.getVideoTech().getSessionModificationState(), - mPrimary.getDisconnectCause(), + primary.getState(), + primary.isVideoCall(), + primary.getVideoTech().getSessionModificationState(), + primary.getDisconnectCause(), getConnectionLabel(), getCallStateIcon(), getGatewayNumber(), - shouldShowCallSubject(mPrimary) ? mPrimary.getCallSubject() : null, + shouldShowCallSubject(primary) ? primary.getCallSubject() : null, PhoneNumberHelper.formatNumber( - mPrimary.getCallbackNumber(), mPrimary.getSimCountryIso()), - mPrimary.hasProperty(Details.PROPERTY_WIFI), - mPrimary.isConferenceCall() - && !mPrimary.hasProperty(Details.PROPERTY_GENERIC_CONFERENCE), + primary.getCallbackNumber(), primary.getSimCountryIso()), + primary.hasProperty(Details.PROPERTY_WIFI), + primary.isConferenceCall() + && !primary.hasProperty(Details.PROPERTY_GENERIC_CONFERENCE), isWorkCall, isAttemptingHdAudioCall, isHdAudioCall, - !TextUtils.isEmpty(mPrimary.getLastForwardedNumber()), + !TextUtils.isEmpty(primary.getLastForwardedNumber()), shouldShowContactPhoto, - mPrimary.getConnectTimeMillis(), - mPrimary.isVoiceMailNumber(), - mPrimary.isRemotelyHeld(), + primary.getConnectTimeMillis(), + primary.isVoiceMailNumber(), + primary.isRemotelyHeld(), isBusiness, supports2ndCallOnHold(), getSwapToSecondaryButtonState(), - mPrimary.isAssistedDialed(), + primary.isAssistedDialed(), null, - mPrimary.getAssistedDialingExtras())); + primary.getAssistedDialingExtras())); InCallActivity activity = - (InCallActivity) (mInCallScreen.getInCallScreenFragment().getActivity()); + (InCallActivity) (inCallScreen.getInCallScreenFragment().getActivity()); if (activity != null) { activity.onPrimaryCallStateChanged(); } @@ -504,10 +505,10 @@ public class CallCardPresenter } private @ButtonState int getSwapToSecondaryButtonState() { - if (mSecondary == null) { + if (secondary == null) { return ButtonState.NOT_SUPPORT; } - if (mPrimary.getState() == State.ACTIVE) { + if (primary.getState() == State.ACTIVE) { return ButtonState.ENABLED; } return ButtonState.DISABLED; @@ -525,12 +526,11 @@ public class CallCardPresenter * @return {@code True} if the manage conference button should be visible. */ private boolean shouldShowManageConference() { - if (mPrimary == null) { + if (primary == null) { return false; } - return mPrimary.can(android.telecom.Call.Details.CAPABILITY_MANAGE_CONFERENCE) - && !mIsFullscreen; + return primary.can(android.telecom.Call.Details.CAPABILITY_MANAGE_CONFERENCE) && !isFullscreen; } private boolean supports2ndCallOnHold() { @@ -544,19 +544,19 @@ public class CallCardPresenter @Override public void onCallStateButtonClicked() { - Intent broadcastIntent = Bindings.get(mContext).getCallStateButtonBroadcastIntent(mContext); + Intent broadcastIntent = Bindings.get(context).getCallStateButtonBroadcastIntent(context); if (broadcastIntent != null) { LogUtil.v( "CallCardPresenter.onCallStateButtonClicked", "sending call state button broadcast: " + broadcastIntent); - mContext.sendBroadcast(broadcastIntent, Manifest.permission.READ_PHONE_STATE); + context.sendBroadcast(broadcastIntent, Manifest.permission.READ_PHONE_STATE); } } @Override public void onManageConferenceClicked() { InCallActivity activity = - (InCallActivity) (mInCallScreen.getInCallScreenFragment().getActivity()); + (InCallActivity) (inCallScreen.getInCallScreenFragment().getActivity()); activity.showConferenceFragment(true); } @@ -575,15 +575,15 @@ public class CallCardPresenter /** Starts a query for more contact data for the save primary and secondary calls. */ private void startContactInfoSearch( final DialerCall call, final boolean isPrimary, boolean isIncoming) { - final ContactInfoCache cache = ContactInfoCache.getInstance(mContext); + final ContactInfoCache cache = ContactInfoCache.getInstance(context); cache.findInfo(call, isIncoming, new ContactLookupCallback(this, isPrimary)); } private void onContactInfoComplete(String callId, ContactCacheEntry entry, boolean isPrimary) { final boolean entryMatchesExistingCall = - (isPrimary && mPrimary != null && TextUtils.equals(callId, mPrimary.getId())) - || (!isPrimary && mSecondary != null && TextUtils.equals(callId, mSecondary.getId())); + (isPrimary && primary != null && TextUtils.equals(callId, primary.getId())) + || (!isPrimary && secondary != null && TextUtils.equals(callId, secondary.getId())); if (entryMatchesExistingCall) { updateContactEntry(entry, isPrimary); } else { @@ -597,7 +597,7 @@ public class CallCardPresenter call.getLogState().contactLookupResult = entry.contactLookupResult; } if (entry.lookupUri != null) { - CallerInfoUtils.sendViewNotification(mContext, entry.lookupUri); + CallerInfoUtils.sendViewNotification(context, entry.lookupUri); } } @@ -607,9 +607,9 @@ public class CallCardPresenter } if (entry.photo != null) { - if (mPrimary != null && callId.equals(mPrimary.getId())) { + if (primary != null && callId.equals(primary.getId())) { updateContactEntry(entry, true /* isPrimary */); - } else if (mSecondary != null && callId.equals(mSecondary.getId())) { + } else if (secondary != null && callId.equals(secondary.getId())) { updateContactEntry(entry, false /* isPrimary */); } } @@ -617,10 +617,10 @@ public class CallCardPresenter private void updateContactEntry(ContactCacheEntry entry, boolean isPrimary) { if (isPrimary) { - mPrimaryContactInfo = entry; + primaryContactInfo = entry; updatePrimaryDisplayInfo(); } else { - mSecondaryContactInfo = entry; + secondaryContactInfo = entry; updateSecondaryDisplayInfo(); } } @@ -674,7 +674,7 @@ public class CallCardPresenter } private void updatePrimaryDisplayInfo() { - if (mInCallScreen == null) { + if (inCallScreen == null) { // TODO: May also occur if search result comes back after ui is destroyed. Look into // removing that case completely. LogUtil.v( @@ -683,35 +683,35 @@ public class CallCardPresenter return; } - if (mPrimary == null) { + if (primary == null) { // Clear the primary display info. - mInCallScreen.setPrimary(PrimaryInfo.createEmptyPrimaryInfo()); + inCallScreen.setPrimary(PrimaryInfo.createEmptyPrimaryInfo()); return; } // Hide the contact photo if we are in a video call and the incoming video surface is // showing. boolean showContactPhoto = - !VideoCallPresenter.showIncomingVideo(mPrimary.getVideoState(), mPrimary.getState()); + !VideoCallPresenter.showIncomingVideo(primary.getVideoState(), primary.getState()); // DialerCall placed through a work phone account. - boolean hasWorkCallProperty = mPrimary.hasProperty(PROPERTY_ENTERPRISE_CALL); + boolean hasWorkCallProperty = primary.hasProperty(PROPERTY_ENTERPRISE_CALL); MultimediaData multimediaData = null; - if (mPrimary.getEnrichedCallSession() != null) { - multimediaData = mPrimary.getEnrichedCallSession().getMultimediaData(); + if (primary.getEnrichedCallSession() != null) { + multimediaData = primary.getEnrichedCallSession().getMultimediaData(); } - if (mPrimary.isConferenceCall()) { + if (primary.isConferenceCall()) { LogUtil.v( "CallCardPresenter.updatePrimaryDisplayInfo", "update primary display info for conference call."); - mInCallScreen.setPrimary( + inCallScreen.setPrimary( new PrimaryInfo( null /* number */, CallerInfoUtils.getConferenceString( - mContext, mPrimary.hasProperty(Details.PROPERTY_GENERIC_CONFERENCE)), + context, primary.hasProperty(Details.PROPERTY_GENERIC_CONFERENCE)), false /* nameIsNumber */, null /* location */, null /* label */, @@ -727,63 +727,63 @@ public class CallCardPresenter null /* contactInfoLookupKey */, null /* enrichedCallMultimediaData */, true /* showInCallButtonGrid */, - mPrimary.getNumberPresentation())); - } else if (mPrimaryContactInfo != null) { + primary.getNumberPresentation())); + } else if (primaryContactInfo != null) { LogUtil.v( "CallCardPresenter.updatePrimaryDisplayInfo", - "update primary display info for " + mPrimaryContactInfo); + "update primary display info for " + primaryContactInfo); - String name = getNameForCall(mPrimaryContactInfo); + String name = getNameForCall(primaryContactInfo); String number; - boolean isChildNumberShown = !TextUtils.isEmpty(mPrimary.getChildNumber()); - boolean isForwardedNumberShown = !TextUtils.isEmpty(mPrimary.getLastForwardedNumber()); - boolean isCallSubjectShown = shouldShowCallSubject(mPrimary); + boolean isChildNumberShown = !TextUtils.isEmpty(primary.getChildNumber()); + boolean isForwardedNumberShown = !TextUtils.isEmpty(primary.getLastForwardedNumber()); + boolean isCallSubjectShown = shouldShowCallSubject(primary); if (isCallSubjectShown) { number = null; } else if (isChildNumberShown) { - number = mContext.getString(R.string.child_number, mPrimary.getChildNumber()); + number = context.getString(R.string.child_number, primary.getChildNumber()); } else if (isForwardedNumberShown) { // Use last forwarded number instead of second line, if present. - number = mPrimary.getLastForwardedNumber(); + number = primary.getLastForwardedNumber(); } else { - number = mPrimaryContactInfo.number; + number = primaryContactInfo.number; } - boolean nameIsNumber = name != null && name.equals(mPrimaryContactInfo.number); + boolean nameIsNumber = name != null && name.equals(primaryContactInfo.number); // DialerCall with caller that is a work contact. - boolean isWorkContact = (mPrimaryContactInfo.userType == ContactsUtils.USER_TYPE_WORK); - mInCallScreen.setPrimary( + boolean isWorkContact = (primaryContactInfo.userType == ContactsUtils.USER_TYPE_WORK); + inCallScreen.setPrimary( new PrimaryInfo( number, - mPrimary.updateNameIfRestricted(name), + primary.updateNameIfRestricted(name), nameIsNumber, - shouldShowLocationAsLabel(nameIsNumber, mPrimaryContactInfo.shouldShowLocation) - ? mPrimaryContactInfo.location + shouldShowLocationAsLabel(nameIsNumber, primaryContactInfo.shouldShowLocation) + ? primaryContactInfo.location : null, - isChildNumberShown || isCallSubjectShown ? null : mPrimaryContactInfo.label, - mPrimaryContactInfo.photo, - mPrimaryContactInfo.photoType, - mPrimaryContactInfo.isSipCall, + isChildNumberShown || isCallSubjectShown ? null : primaryContactInfo.label, + primaryContactInfo.photo, + primaryContactInfo.photoType, + primaryContactInfo.isSipCall, showContactPhoto, hasWorkCallProperty || isWorkContact, - mPrimary.isSpam(), - mPrimaryContactInfo.isLocalContact(), - mPrimary.answeringDisconnectsForegroundVideoCall(), + primary.isSpam(), + primaryContactInfo.isLocalContact(), + primary.answeringDisconnectsForegroundVideoCall(), shouldShowLocation(), - mPrimaryContactInfo.lookupKey, + primaryContactInfo.lookupKey, multimediaData, true /* showInCallButtonGrid */, - mPrimary.getNumberPresentation())); + primary.getNumberPresentation())); } else { // Clear the primary display info. - mInCallScreen.setPrimary(PrimaryInfo.createEmptyPrimaryInfo()); + inCallScreen.setPrimary(PrimaryInfo.createEmptyPrimaryInfo()); } if (isInCallScreenReady) { - mInCallScreen.showLocationUi(getLocationFragment()); + inCallScreen.showLocationUi(getLocationFragment()); } else { LogUtil.i("CallCardPresenter.updatePrimaryDisplayInfo", "UI not ready, not showing location"); } @@ -805,11 +805,11 @@ public class CallCardPresenter return null; } LogUtil.i("CallCardPresenter.getLocationFragment", "returning location fragment"); - return callLocation.getLocationFragment(mContext); + return callLocation.getLocationFragment(context); } private boolean shouldShowLocation() { - if (!ConfigProviderBindings.get(mContext) + if (!ConfigProviderBindings.get(context) .getBoolean(CONFIG_ENABLE_EMERGENCY_LOCATION, CONFIG_ENABLE_EMERGENCY_LOCATION_DEFAULT)) { LogUtil.i("CallCardPresenter.getLocationFragment", "disabled by config."); return false; @@ -826,15 +826,15 @@ public class CallCardPresenter LogUtil.i("CallCardPresenter.getLocationFragment", "low battery."); return false; } - if (ActivityCompat.isInMultiWindowMode(mInCallScreen.getInCallScreenFragment().getActivity())) { + if (ActivityCompat.isInMultiWindowMode(inCallScreen.getInCallScreenFragment().getActivity())) { LogUtil.i("CallCardPresenter.getLocationFragment", "in multi-window mode"); return false; } - if (mPrimary.isVideoCall()) { + if (primary.isVideoCall()) { LogUtil.i("CallCardPresenter.getLocationFragment", "emergency video calls not supported"); return false; } - if (!callLocation.canGetLocation(mContext)) { + if (!callLocation.canGetLocation(context)) { LogUtil.i("CallCardPresenter.getLocationFragment", "can't get current location"); return false; } @@ -842,13 +842,13 @@ public class CallCardPresenter } private boolean isPotentialEmergencyCall() { - if (isOutgoingEmergencyCall(mPrimary)) { + if (isOutgoingEmergencyCall(primary)) { LogUtil.i("CallCardPresenter.shouldShowLocation", "new emergency call"); return true; - } else if (isIncomingEmergencyCall(mPrimary)) { + } else if (isIncomingEmergencyCall(primary)) { LogUtil.i("CallCardPresenter.shouldShowLocation", "potential emergency callback"); return true; - } else if (isIncomingEmergencyCall(mSecondary)) { + } else if (isIncomingEmergencyCall(secondary)) { LogUtil.i("CallCardPresenter.shouldShowLocation", "has potential emergency callback"); return true; } @@ -864,13 +864,13 @@ public class CallCardPresenter } private boolean hasLocationPermission() { - return ContextCompat.checkSelfPermission(mContext, Manifest.permission.ACCESS_FINE_LOCATION) + return ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED; } private boolean isBatteryTooLowForEmergencyLocation() { Intent batteryStatus = - mContext.registerReceiver(null, new IntentFilter(Intent.ACTION_BATTERY_CHANGED)); + context.registerReceiver(null, new IntentFilter(Intent.ACTION_BATTERY_CHANGED)); int status = batteryStatus.getIntExtra(BatteryManager.EXTRA_STATUS, -1); if (status == BatteryManager.BATTERY_STATUS_CHARGING || status == BatteryManager.BATTERY_STATUS_FULL) { @@ -881,7 +881,7 @@ public class CallCardPresenter int scale = batteryStatus.getIntExtra(BatteryManager.EXTRA_SCALE, -1); float batteryPercent = (100f * level) / scale; long threshold = - ConfigProviderBindings.get(mContext) + ConfigProviderBindings.get(context) .getLong( CONFIG_MIN_BATTERY_PERCENT_FOR_EMERGENCY_LOCATION, CONFIG_MIN_BATTERY_PERCENT_FOR_EMERGENCY_LOCATION_DEFAULT); @@ -892,60 +892,60 @@ public class CallCardPresenter } private void updateSecondaryDisplayInfo() { - if (mInCallScreen == null) { + if (inCallScreen == null) { return; } - if (mSecondary == null) { + if (secondary == null) { // Clear the secondary display info. - mInCallScreen.setSecondary(SecondaryInfo.createEmptySecondaryInfo(mIsFullscreen)); + inCallScreen.setSecondary(SecondaryInfo.createEmptySecondaryInfo(isFullscreen)); return; } - if (mSecondary.isMergeInProcess()) { + if (secondary.isMergeInProcess()) { LogUtil.i( "CallCardPresenter.updateSecondaryDisplayInfo", "secondary call is merge in process, clearing info"); - mInCallScreen.setSecondary(SecondaryInfo.createEmptySecondaryInfo(mIsFullscreen)); + inCallScreen.setSecondary(SecondaryInfo.createEmptySecondaryInfo(isFullscreen)); return; } - if (mSecondary.isConferenceCall()) { - mInCallScreen.setSecondary( + if (secondary.isConferenceCall()) { + inCallScreen.setSecondary( new SecondaryInfo( true /* show */, CallerInfoUtils.getConferenceString( - mContext, mSecondary.hasProperty(Details.PROPERTY_GENERIC_CONFERENCE)), + context, secondary.hasProperty(Details.PROPERTY_GENERIC_CONFERENCE)), false /* nameIsNumber */, null /* label */, - mSecondary.getCallProviderLabel(), + secondary.getCallProviderLabel(), true /* isConference */, - mSecondary.isVideoCall(), - mIsFullscreen)); - } else if (mSecondaryContactInfo != null) { - LogUtil.v("CallCardPresenter.updateSecondaryDisplayInfo", "" + mSecondaryContactInfo); - String name = getNameForCall(mSecondaryContactInfo); - boolean nameIsNumber = name != null && name.equals(mSecondaryContactInfo.number); - mInCallScreen.setSecondary( + secondary.isVideoCall(), + isFullscreen)); + } else if (secondaryContactInfo != null) { + LogUtil.v("CallCardPresenter.updateSecondaryDisplayInfo", "" + secondaryContactInfo); + String name = getNameForCall(secondaryContactInfo); + boolean nameIsNumber = name != null && name.equals(secondaryContactInfo.number); + inCallScreen.setSecondary( new SecondaryInfo( true /* show */, - mSecondary.updateNameIfRestricted(name), + secondary.updateNameIfRestricted(name), nameIsNumber, - mSecondaryContactInfo.label, - mSecondary.getCallProviderLabel(), + secondaryContactInfo.label, + secondary.getCallProviderLabel(), false /* isConference */, - mSecondary.isVideoCall(), - mIsFullscreen)); + secondary.isVideoCall(), + isFullscreen)); } else { // Clear the secondary display info. - mInCallScreen.setSecondary(SecondaryInfo.createEmptySecondaryInfo(mIsFullscreen)); + inCallScreen.setSecondary(SecondaryInfo.createEmptySecondaryInfo(isFullscreen)); } } /** Returns the gateway number for any existing outgoing call. */ private String getGatewayNumber() { if (hasOutgoingGatewayCall()) { - return DialerCall.getNumberFromHandle(mPrimary.getGatewayInfo().getGatewayAddress()); + return DialerCall.getNumberFromHandle(primary.getGatewayInfo().getGatewayAddress()); } return null; } @@ -955,35 +955,35 @@ public class CallCardPresenter * "calling via [Account/Google Voice]" for outgoing calls. */ private String getConnectionLabel() { - if (ContextCompat.checkSelfPermission(mContext, Manifest.permission.READ_PHONE_STATE) + if (ContextCompat.checkSelfPermission(context, Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) { return null; } - StatusHints statusHints = mPrimary.getStatusHints(); + StatusHints statusHints = primary.getStatusHints(); if (statusHints != null && !TextUtils.isEmpty(statusHints.getLabel())) { return statusHints.getLabel().toString(); } if (hasOutgoingGatewayCall() && getUi() != null) { // Return the label for the gateway app on outgoing calls. - final PackageManager pm = mContext.getPackageManager(); + final PackageManager pm = context.getPackageManager(); try { ApplicationInfo info = - pm.getApplicationInfo(mPrimary.getGatewayInfo().getGatewayProviderPackageName(), 0); + pm.getApplicationInfo(primary.getGatewayInfo().getGatewayProviderPackageName(), 0); return pm.getApplicationLabel(info).toString(); } catch (PackageManager.NameNotFoundException e) { LogUtil.e("CallCardPresenter.getConnectionLabel", "gateway Application Not Found.", e); return null; } } - return mPrimary.getCallProviderLabel(); + return primary.getCallProviderLabel(); } private Drawable getCallStateIcon() { // Return connection icon if one exists. - StatusHints statusHints = mPrimary.getStatusHints(); + StatusHints statusHints = primary.getStatusHints(); if (statusHints != null && statusHints.getIcon() != null) { - Drawable icon = statusHints.getIcon().loadDrawable(mContext); + Drawable icon = statusHints.getIcon().loadDrawable(context); if (icon != null) { return icon; } @@ -998,19 +998,19 @@ public class CallCardPresenter // TODO: mPrimary can be null because this is called from updatePrimaryDisplayInfo which // is also called after a contact search completes (call is not present yet). Split the // UI update so it can receive independent updates. - if (mPrimary == null) { + if (primary == null) { return false; } - return DialerCall.State.isDialing(mPrimary.getState()) - && mPrimary.getGatewayInfo() != null - && !mPrimary.getGatewayInfo().isEmpty(); + return DialerCall.State.isDialing(primary.getState()) + && primary.getGatewayInfo() != null + && !primary.getGatewayInfo().isEmpty(); } /** Gets the name to display for the call. */ private String getNameForCall(ContactCacheEntry contactInfo) { String preferredName = ContactDisplayUtils.getPreferredDisplayName( - contactInfo.namePrimary, contactInfo.nameAlternative, mContactsPreferences); + contactInfo.namePrimary, contactInfo.nameAlternative, contactsPreferences); if (TextUtils.isEmpty(preferredName)) { return contactInfo.number; } @@ -1019,30 +1019,30 @@ public class CallCardPresenter @Override public void onSecondaryInfoClicked() { - if (mSecondary == null) { + if (secondary == null) { LogUtil.e( "CallCardPresenter.onSecondaryInfoClicked", "secondary info clicked but no secondary call."); return; } - Logger.get(mContext) + Logger.get(context) .logCallImpression( DialerImpression.Type.IN_CALL_SWAP_SECONDARY_BUTTON_PRESSED, - mPrimary.getUniqueCallId(), - mPrimary.getTimeAddedMs()); + primary.getUniqueCallId(), + primary.getTimeAddedMs()); LogUtil.i( - "CallCardPresenter.onSecondaryInfoClicked", "swapping call to foreground: " + mSecondary); - mSecondary.unhold(); + "CallCardPresenter.onSecondaryInfoClicked", "swapping call to foreground: " + secondary); + secondary.unhold(); } @Override public void onEndCallClicked() { - LogUtil.i("CallCardPresenter.onEndCallClicked", "disconnecting call: " + mPrimary); - if (mPrimary != null) { - mPrimary.disconnect(); + LogUtil.i("CallCardPresenter.onEndCallClicked", "disconnecting call: " + primary); + if (primary != null) { + primary.disconnect(); } - PostCall.onDisconnectPressed(mContext); + PostCall.onDisconnectPressed(context); } /** @@ -1052,15 +1052,15 @@ public class CallCardPresenter */ @Override public void onFullscreenModeChanged(boolean isFullscreenMode) { - mIsFullscreen = isFullscreenMode; - if (mInCallScreen == null) { + isFullscreen = isFullscreenMode; + if (inCallScreen == null) { return; } maybeShowManageConferenceCallButton(); } private boolean isPrimaryCallActive() { - return mPrimary != null && mPrimary.getState() == DialerCall.State.ACTIVE; + return primary != null && primary.getState() == DialerCall.State.ACTIVE; } private boolean shouldShowEndCallButton(DialerCall primary, int callState) { @@ -1073,7 +1073,7 @@ public class CallCardPresenter || callState == DialerCall.State.INCOMING) { return false; } - if (mPrimary.getVideoTech().getSessionModificationState() + if (this.primary.getVideoTech().getSessionModificationState() == SessionModificationState.RECEIVED_UPGRADE_TO_VIDEO_REQUEST) { return false; } @@ -1128,11 +1128,11 @@ public class CallCardPresenter private void maybeSendAccessibilityEvent( InCallState oldState, final InCallState newState, boolean primaryChanged) { shouldSendAccessibilityEvent = false; - if (mContext == null) { + if (context == null) { return; } final AccessibilityManager am = - (AccessibilityManager) mContext.getSystemService(Context.ACCESSIBILITY_SERVICE); + (AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE); if (!am.isEnabled()) { return; } @@ -1161,8 +1161,8 @@ public class CallCardPresenter } boolean isIncomingOrWaiting = - mPrimary.getState() == DialerCall.State.INCOMING - || mPrimary.getState() == DialerCall.State.CALL_WAITING; + primary.getState() == DialerCall.State.INCOMING + || primary.getState() == DialerCall.State.CALL_WAITING; return isIncomingOrWaiting && !TextUtils.isEmpty(call.getCallSubject()) && call.getNumberPresentation() == TelecomManager.PRESENTATION_ALLOWED @@ -1184,30 +1184,30 @@ public class CallCardPresenter } private InCallScreen getUi() { - return mInCallScreen; + return inCallScreen; } public static class ContactLookupCallback implements ContactInfoCacheCallback { - private final WeakReference mCallCardPresenter; - private final boolean mIsPrimary; + private final WeakReference callCardPresenter; + private final boolean isPrimary; public ContactLookupCallback(CallCardPresenter callCardPresenter, boolean isPrimary) { - mCallCardPresenter = new WeakReference(callCardPresenter); - mIsPrimary = isPrimary; + this.callCardPresenter = new WeakReference(callCardPresenter); + this.isPrimary = isPrimary; } @Override public void onContactInfoComplete(String callId, ContactCacheEntry entry) { - CallCardPresenter presenter = mCallCardPresenter.get(); + CallCardPresenter presenter = callCardPresenter.get(); if (presenter != null) { - presenter.onContactInfoComplete(callId, entry, mIsPrimary); + presenter.onContactInfoComplete(callId, entry, isPrimary); } } @Override public void onImageLoadComplete(String callId, ContactCacheEntry entry) { - CallCardPresenter presenter = mCallCardPresenter.get(); + CallCardPresenter presenter = callCardPresenter.get(); if (presenter != null) { presenter.onImageLoadComplete(callId, entry); } -- cgit v1.2.3