diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2017-07-10 20:06:23 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2017-07-10 20:06:23 +0000 |
commit | c0be90957f657706ea8074ce15741a2a0db64d01 (patch) | |
tree | 7a12db7b53684f7fa64c583da1cae91ca0cfa2c3 | |
parent | ae2abae043faf461e27f78446046a873f27332bd (diff) | |
parent | 061b6eb8dac57aa9d28dfdd1f8853879a2274b17 (diff) |
Merge changes I0e1d8d98,I671105ec,I3fd72694,I2586f758,I07127554, ...
* changes:
Update REASON_IMS_ACCESS_BLOCKED definition to match framework change.
Use NOTIFICATION_INCOMING_CALL_QUIET when the in call UI is visible
Fix NPE crash when haning up conference call.
Automated g4 rollback of changelist 160696979.
Fix 2 NPEs in CallLogAdapter.
Fix concurrency issue in constructor.
Move voicemail notification dismissing to VisualVoicemailCallLogFragment
7 files changed, 34 insertions, 38 deletions
diff --git a/java/com/android/contacts/common/compat/telecom/TelecomManagerCompat.java b/java/com/android/contacts/common/compat/telecom/TelecomManagerCompat.java index e6f424788..172fb11e3 100644 --- a/java/com/android/contacts/common/compat/telecom/TelecomManagerCompat.java +++ b/java/com/android/contacts/common/compat/telecom/TelecomManagerCompat.java @@ -35,6 +35,11 @@ public class TelecomManagerCompat { public static final String EXTRA_HANDOVER_VIDEO_STATE = "android.telecom.extra.HANDOVER_VIDEO_STATE"; + // This is a hidden constant in android.telecom.DisconnectCause. Telecom sets this as a disconnect + // reason if it wants us to prompt the user that the video call is not available. + // TODO(wangqi): Reference it to constant in android.telecom.DisconnectCause. + public static final String REASON_IMS_ACCESS_BLOCKED = "REASON_IMS_ACCESS_BLOCKED"; + /** * Returns the current SIM call manager. Apps must be prepared for this method to return null, * indicating that there currently exists no registered SIM call manager. diff --git a/java/com/android/dialer/app/calllog/CallLogAdapter.java b/java/com/android/dialer/app/calllog/CallLogAdapter.java index c4156d5c6..4942184a2 100644 --- a/java/com/android/dialer/app/calllog/CallLogAdapter.java +++ b/java/com/android/dialer/app/calllog/CallLogAdapter.java @@ -368,7 +368,9 @@ public class CallLogAdapter extends GroupingListAdapter } expandViewHolderActions(viewHolder); - if (viewHolder.videoCallButtonView.getVisibility() == View.VISIBLE + if (viewHolder.videoCallButtonView != null + && viewHolder.videoCallButtonView.getVisibility() == View.VISIBLE + && LightbringerComponent.get(mActivity).getLightbringer().getPackageName() != null && LightbringerComponent.get(mActivity) .getLightbringer() .getPackageName() diff --git a/java/com/android/dialer/app/calllog/CallLogFragment.java b/java/com/android/dialer/app/calllog/CallLogFragment.java index aa765d90e..369fbbc91 100644 --- a/java/com/android/dialer/app/calllog/CallLogFragment.java +++ b/java/com/android/dialer/app/calllog/CallLogFragment.java @@ -20,7 +20,6 @@ import static android.Manifest.permission.READ_CALL_LOG; import android.app.Activity; import android.app.Fragment; -import android.app.KeyguardManager; import android.content.ContentResolver; import android.content.Context; import android.content.pm.PackageManager; @@ -114,7 +113,6 @@ public class CallLogFragment extends Fragment private CallLogQueryHandler mCallLogQueryHandler; private boolean mScrollToTop; private EmptyContentView mEmptyListView; - private KeyguardManager mKeyguardManager; private ContactInfoCache mContactInfoCache; private final OnContactInfoChangedListener mOnContactInfoChangedListener = new OnContactInfoChangedListener() { @@ -219,7 +217,6 @@ public class CallLogFragment extends Fragment final Activity activity = getActivity(); final ContentResolver resolver = activity.getContentResolver(); mCallLogQueryHandler = new CallLogQueryHandler(activity, resolver, this, mLogLimit); - mKeyguardManager = (KeyguardManager) activity.getSystemService(Context.KEYGUARD_SERVICE); if (PermissionsUtil.hasCallLogReadPermissions(getContext())) { resolver.registerContentObserver(CallLog.CONTENT_URI, true, mCallLogObserver); @@ -432,8 +429,6 @@ public class CallLogFragment extends Fragment @Override public void onStop() { - updateOnTransition(); - super.onStop(); mAdapter.onStop(); mContactInfoCache.stop(); @@ -516,9 +511,7 @@ public class CallLogFragment extends Fragment super.setMenuVisibility(menuVisible); if (mMenuVisible != menuVisible) { mMenuVisible = menuVisible; - if (!menuVisible) { - updateOnTransition(); - } else if (isResumed()) { + if (menuVisible && isResumed()) { refreshData(); } } @@ -536,7 +529,6 @@ public class CallLogFragment extends Fragment fetchCalls(); mCallLogQueryHandler.fetchVoicemailStatus(); mCallLogQueryHandler.fetchMissedCallsUnreadCount(); - updateOnTransition(); mRefreshDataRequired = false; } else { // Refresh the display of the existing data to update the timestamp text descriptions. @@ -544,23 +536,6 @@ public class CallLogFragment extends Fragment } } - /** - * Updates the voicemail notification state. - * - * <p>TODO: Move to CallLogActivity - */ - private void updateOnTransition() { - // We don't want to update any call data when keyguard is on because the user has likely not - // seen the new calls yet. - // This might be called before onCreate() and thus we need to check null explicitly. - if (mKeyguardManager != null - && !mKeyguardManager.inKeyguardRestrictedInputMode() - && mCallTypeFilter == Calls.VOICEMAIL_TYPE) { - LogUtil.i("CallLogFragment.updateOnTransition", "clearing all new voicemails"); - CallLogNotificationsService.markAllNewVoicemailsAsOld(getActivity()); - } - } - @Override public void onEmptyViewActionButtonClicked() { final Activity activity = getActivity(); diff --git a/java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java b/java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java index 893d6bed9..17018b38d 100644 --- a/java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java +++ b/java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java @@ -16,6 +16,7 @@ package com.android.dialer.app.calllog; +import android.app.KeyguardManager; import android.content.Intent; import android.database.ContentObserver; import android.media.AudioManager; @@ -132,7 +133,7 @@ public class VisualVoicemailCallLogFragment extends CallLogFragment { @Override public void onVisible() { - LogUtil.enterBlock("VisualVoicemailCallLogFragment.onPageSelected"); + LogUtil.enterBlock("VisualVoicemailCallLogFragment.onVisible"); super.onVisible(); if (getActivity() != null) { Intent intent = new Intent(VoicemailContract.ACTION_SYNC_VOICEMAIL); @@ -145,10 +146,15 @@ public class VisualVoicemailCallLogFragment extends CallLogFragment { @Override public void onNotVisible() { - LogUtil.enterBlock("VisualVoicemailCallLogFragment.onPageUnselected"); + LogUtil.enterBlock("VisualVoicemailCallLogFragment.onNotVisible"); super.onNotVisible(); if (getActivity() != null) { getActivity().setVolumeControlStream(AudioManager.USE_DEFAULT_STREAM_TYPE); + // onNotVisible will be called in the lock screen when the call ends + if (!getActivity().getSystemService(KeyguardManager.class).inKeyguardRestrictedInputMode()) { + LogUtil.i("VisualVoicemailCallLogFragment.onNotVisible", "clearing all new voicemails"); + CallLogNotificationsService.markAllNewVoicemailsAsOld(getActivity()); + } } } } diff --git a/java/com/android/incallui/StatusBarNotifier.java b/java/com/android/incallui/StatusBarNotifier.java index 458df5149..53017a10e 100644 --- a/java/com/android/incallui/StatusBarNotifier.java +++ b/java/com/android/incallui/StatusBarNotifier.java @@ -66,6 +66,7 @@ import com.android.contacts.common.preference.ContactsPreferences; import com.android.contacts.common.util.BitmapUtil; import com.android.contacts.common.util.ContactDisplayUtils; import com.android.dialer.common.LogUtil; +import com.android.dialer.configprovider.ConfigProviderBindings; import com.android.dialer.enrichedcall.EnrichedCallManager; import com.android.dialer.enrichedcall.Session; import com.android.dialer.multimedia.MultimediaData; @@ -308,11 +309,19 @@ public class StatusBarNotifier if (callState == DialerCall.State.INCOMING || callState == DialerCall.State.CALL_WAITING || isVideoUpgradeRequest) { - boolean alreadyActive = - callList.getActiveOrBackgroundCall() != null - && InCallPresenter.getInstance().isShowingInCallUi(); - notificationType = - alreadyActive ? NOTIFICATION_INCOMING_CALL_QUIET : NOTIFICATION_INCOMING_CALL; + if (ConfigProviderBindings.get(mContext) + .getBoolean("quiet_incoming_call_if_ui_showing", true)) { + notificationType = + InCallPresenter.getInstance().isShowingInCallUi() + ? NOTIFICATION_INCOMING_CALL_QUIET + : NOTIFICATION_INCOMING_CALL; + } else { + boolean alreadyActive = + callList.getActiveOrBackgroundCall() != null + && InCallPresenter.getInstance().isShowingInCallUi(); + notificationType = + alreadyActive ? NOTIFICATION_INCOMING_CALL_QUIET : NOTIFICATION_INCOMING_CALL; + } } else { notificationType = NOTIFICATION_IN_CALL; } diff --git a/java/com/android/incallui/disconnectdialog/EnableWifiCallingPrompt.java b/java/com/android/incallui/disconnectdialog/EnableWifiCallingPrompt.java index da0c9d6be..a0ca8cd04 100644 --- a/java/com/android/incallui/disconnectdialog/EnableWifiCallingPrompt.java +++ b/java/com/android/incallui/disconnectdialog/EnableWifiCallingPrompt.java @@ -41,7 +41,7 @@ public class EnableWifiCallingPrompt implements DisconnectDialog { @Override public boolean shouldShow(DisconnectCause disconnectCause) { String reason = disconnectCause.getReason(); - if (reason.startsWith(REASON_WIFI_ON_BUT_WFC_OFF)) { + if (reason != null && reason.startsWith(REASON_WIFI_ON_BUT_WFC_OFF)) { LogUtil.i( "EnableWifiCallingPrompt.shouldShowPrompt", "showing prompt for disconnect cause: %s", diff --git a/java/com/android/incallui/disconnectdialog/VideoCallNotAvailablePrompt.java b/java/com/android/incallui/disconnectdialog/VideoCallNotAvailablePrompt.java index 34db976b2..526d45ed7 100644 --- a/java/com/android/incallui/disconnectdialog/VideoCallNotAvailablePrompt.java +++ b/java/com/android/incallui/disconnectdialog/VideoCallNotAvailablePrompt.java @@ -24,6 +24,7 @@ import android.support.annotation.NonNull; import android.telecom.DisconnectCause; import android.telecom.PhoneAccountHandle; import android.util.Pair; +import com.android.contacts.common.compat.telecom.TelecomManagerCompat; import com.android.dialer.callintent.CallInitiationType; import com.android.dialer.callintent.CallIntentBuilder; import com.android.dialer.common.LogUtil; @@ -33,12 +34,10 @@ import com.android.incallui.call.DialerCall; /** Prompt user to make voice call if video call is not currently available. */ public class VideoCallNotAvailablePrompt implements DisconnectDialog { - private static final String REASON_IMS_ACCESS_BLOCKED = "IMS_ACCESS_BLOCKED"; - @Override public boolean shouldShow(DisconnectCause disconnectCause) { if (disconnectCause.getCode() == DisconnectCause.ERROR - && REASON_IMS_ACCESS_BLOCKED.equals(disconnectCause.getReason())) { + && TelecomManagerCompat.REASON_IMS_ACCESS_BLOCKED.equals(disconnectCause.getReason())) { LogUtil.i( "VideoCallNotAvailablePrompt.shouldShowPrompt", "showing prompt for disconnect cause: %s", |