diff options
Diffstat (limited to 'java/com/android/incallui/CallCardPresenter.java')
-rw-r--r-- | java/com/android/incallui/CallCardPresenter.java | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/java/com/android/incallui/CallCardPresenter.java b/java/com/android/incallui/CallCardPresenter.java index f3c2af6c7..eb5221669 100644 --- a/java/com/android/incallui/CallCardPresenter.java +++ b/java/com/android/incallui/CallCardPresenter.java @@ -212,7 +212,7 @@ public class CallCardPresenter // Showing the location may have been skipped if the UI wasn't ready during previous layout. if (shouldShowLocation()) { - updatePrimaryDisplayInfo(); + mInCallScreen.showLocationUi(getLocationFragment()); // Log location impressions if (!hasLocationPermission()) { @@ -801,40 +801,47 @@ public class CallCardPresenter } private Fragment getLocationFragment() { + if (!shouldShowLocation()) { + return null; + } + LogUtil.i("CallCardPresenter.getLocationFragment", "returning location fragment"); + return callLocation.getLocationFragment(mContext); + } + + private boolean shouldShowLocation() { if (!ConfigProviderBindings.get(mContext) .getBoolean(CONFIG_ENABLE_EMERGENCY_LOCATION, CONFIG_ENABLE_EMERGENCY_LOCATION_DEFAULT)) { LogUtil.i("CallCardPresenter.getLocationFragment", "disabled by config."); - return null; + return false; } - if (!shouldShowLocation()) { + if (!isPotentialEmergencyCall()) { LogUtil.i("CallCardPresenter.getLocationFragment", "shouldn't show location"); - return null; + return false; } if (!hasLocationPermission()) { LogUtil.i("CallCardPresenter.getLocationFragment", "no location permission."); - return null; + return false; } if (isBatteryTooLowForEmergencyLocation()) { LogUtil.i("CallCardPresenter.getLocationFragment", "low battery."); - return null; + return false; } if (ActivityCompat.isInMultiWindowMode(mInCallScreen.getInCallScreenFragment().getActivity())) { LogUtil.i("CallCardPresenter.getLocationFragment", "in multi-window mode"); - return null; + return false; } if (mPrimary.isVideoCall()) { LogUtil.i("CallCardPresenter.getLocationFragment", "emergency video calls not supported"); - return null; + return false; } if (!callLocation.canGetLocation(mContext)) { LogUtil.i("CallCardPresenter.getLocationFragment", "can't get current location"); - return null; + return false; } - LogUtil.i("CallCardPresenter.getLocationFragment", "returning location fragment"); - return callLocation.getLocationFragment(mContext); + return true; } - private boolean shouldShowLocation() { + private boolean isPotentialEmergencyCall() { if (isOutgoingEmergencyCall(mPrimary)) { LogUtil.i("CallCardPresenter.shouldShowLocation", "new emergency call"); return true; |