From f8741721fe0e888e99c57993272bbcb458b43568 Mon Sep 17 00:00:00 2001 From: Yorke Lee Date: Mon, 21 Jul 2014 11:37:53 -0700 Subject: Fix white text in audio mode popup (1/2) Bug: 15643498 Change-Id: I3d9205eb99b42b95e6a05d07039995277f8e29c6 --- res/values/styles.xml | 5 +++++ src/com/android/incallui/CallButtonFragment.java | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/res/values/styles.xml b/res/values/styles.xml index 85a75dd1..b2231da6 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -124,5 +124,10 @@ @color/incall_dialpad_touch_tint @color/incall_call_banner_text_color @color/actionbar_background_color_dark + @style/InCallPopupMenuStyle + + + diff --git a/src/com/android/incallui/CallButtonFragment.java b/src/com/android/incallui/CallButtonFragment.java index 93bb0014..077c8124 100644 --- a/src/com/android/incallui/CallButtonFragment.java +++ b/src/com/android/incallui/CallButtonFragment.java @@ -18,6 +18,7 @@ package com.android.incallui; import android.graphics.drawable.LayerDrawable; import android.os.Bundle; +import android.view.ContextThemeWrapper; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; @@ -492,7 +493,9 @@ public class CallButtonFragment private void showAudioModePopup() { Log.d(this, "showAudioPopup()..."); - mAudioModePopup = new PopupMenu(getView().getContext(), mAudioButton /* anchorView */); + final ContextThemeWrapper contextWrapper = new ContextThemeWrapper(getActivity(), + R.style.InCallPopupMenuStyle); + mAudioModePopup = new PopupMenu(contextWrapper, mAudioButton /* anchorView */); mAudioModePopup.getMenuInflater().inflate(R.menu.incall_audio_mode_menu, mAudioModePopup.getMenu()); mAudioModePopup.setOnMenuItemClickListener(this); -- cgit v1.2.3 From 3c52fae6fc9ac6ee46da8868cf53fd9b336b73d8 Mon Sep 17 00:00:00 2001 From: Jay Shrauner Date: Thu, 14 Aug 2014 09:59:37 -0700 Subject: Prevent ConcurrentModificationExceptions Switch from HashSets to Sets backed by ConcurrentHashMaps, and from ArrayLists to CopyOnWriteArrayLists, to prevent exceptions when listeners remove themselves in their callback while iterating through the set or list. Bug:17030803 Change-Id: I99511e56d77526796679e2840437d0ea47062830 --- src/com/android/incallui/InCallPresenter.java | 51 +++++++++++++++++---------- 1 file changed, 33 insertions(+), 18 deletions(-) diff --git a/src/com/android/incallui/InCallPresenter.java b/src/com/android/incallui/InCallPresenter.java index 66890eb8..23775212 100644 --- a/src/com/android/incallui/InCallPresenter.java +++ b/src/com/android/incallui/InCallPresenter.java @@ -29,13 +29,13 @@ import android.view.Surface; import android.view.View; import com.google.common.base.Preconditions; -import com.google.common.collect.Lists; -import com.google.common.collect.Sets; -import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.Locale; import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.CopyOnWriteArrayList; /** * Takes updates from the CallList and notifies the InCallActivity (UI) @@ -50,11 +50,21 @@ public class InCallPresenter implements CallList.Listener, InCallPhoneListener { private static InCallPresenter sInCallPresenter; - private final Set mListeners = Sets.newHashSet(); - private final ArrayList mIncomingCallListeners = Lists.newArrayList(); - private final Set mDetailsListeners = Sets.newHashSet(); - private final Set mOrientationListeners = Sets.newHashSet(); - private final Set mInCallEventListeners = Sets.newHashSet(); + /** + * 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 = Collections.newSetFromMap( + new ConcurrentHashMap(8, 0.9f, 1)); + private final List mIncomingCallListeners = + new CopyOnWriteArrayList(); + private final Set mDetailsListeners = Collections.newSetFromMap( + new ConcurrentHashMap(8, 0.9f, 1)); + private final Set mOrientationListeners = Collections.newSetFromMap( + new ConcurrentHashMap(8, 0.9f, 1)); + private final Set mInCallEventListeners = Collections.newSetFromMap( + new ConcurrentHashMap(8, 0.9f, 1)); private AudioModeProvider mAudioModeProvider; private StatusBarNotifier mStatusBarNotifier; @@ -400,8 +410,9 @@ public class InCallPresenter implements CallList.Listener, InCallPhoneListener { } public void removeIncomingCallListener(IncomingCallListener listener) { - Preconditions.checkNotNull(listener); - mIncomingCallListeners.remove(listener); + if (listener != null) { + mIncomingCallListeners.remove(listener); + } } public void addListener(InCallStateListener listener) { @@ -410,8 +421,9 @@ public class InCallPresenter implements CallList.Listener, InCallPhoneListener { } public void removeListener(InCallStateListener listener) { - Preconditions.checkNotNull(listener); - mListeners.remove(listener); + if (listener != null) { + mListeners.remove(listener); + } } public void addDetailsListener(InCallDetailsListener listener) { @@ -420,8 +432,9 @@ public class InCallPresenter implements CallList.Listener, InCallPhoneListener { } public void removeDetailsListener(InCallDetailsListener listener) { - Preconditions.checkNotNull(listener); - mDetailsListeners.remove(listener); + if (listener != null) { + mDetailsListeners.remove(listener); + } } public void addOrientationListener(InCallOrientationListener listener) { @@ -430,8 +443,9 @@ public class InCallPresenter implements CallList.Listener, InCallPhoneListener { } public void removeOrientationListener(InCallOrientationListener listener) { - Preconditions.checkNotNull(listener); - mOrientationListeners.remove(listener); + if (listener != null) { + mOrientationListeners.remove(listener); + } } public void addInCallEventListener(InCallEventListener listener) { @@ -440,8 +454,9 @@ public class InCallPresenter implements CallList.Listener, InCallPhoneListener { } public void removeInCallEventListener(InCallEventListener listener) { - Preconditions.checkNotNull(listener); - mInCallEventListeners.remove(listener); + if (listener != null) { + mInCallEventListeners.remove(listener); + } } public ProximitySensor getProximitySensor() { -- cgit v1.2.3 From 8162c6f98d3bd03e62e3ee5d9ee9024432ad038f Mon Sep 17 00:00:00 2001 From: Santos Cordon Date: Fri, 15 Aug 2014 15:57:23 -0700 Subject: Do not show error for a canceled call. Bug: 17067923 Change-Id: I89bcd3fd743da544957bc2af59126edf5a44548b --- src/com/android/incallui/CallList.java | 3 ++- src/com/android/incallui/InCallActivity.java | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/com/android/incallui/CallList.java b/src/com/android/incallui/CallList.java index 66103e6f..59ac076d 100644 --- a/src/com/android/incallui/CallList.java +++ b/src/com/android/incallui/CallList.java @@ -429,7 +429,8 @@ public class CallList implements InCallPhoneListener { break; case DisconnectCause.INCOMING_REJECTED: case DisconnectCause.INCOMING_MISSED: - // no delay for missed/rejected incoming calls + case DisconnectCause.OUTGOING_CANCELED: + // no delay for missed/rejected incoming calls and canceled outgoing calls. delay = 0; break; default: diff --git a/src/com/android/incallui/InCallActivity.java b/src/com/android/incallui/InCallActivity.java index 1f7db588..679c87c8 100644 --- a/src/com/android/incallui/InCallActivity.java +++ b/src/com/android/incallui/InCallActivity.java @@ -657,12 +657,17 @@ public class InCallActivity extends Activity { case DisconnectCause.CS_RESTRICTED_NORMAL: return R.string.callFailed_dsac_restricted_normal; case DisconnectCause.OUTGOING_FAILURE: - case DisconnectCause.OUTGOING_CANCELED: // We couldn't successfully place the call; there was some // failure in the telephony layer. // TODO: Need UI spec for this failure case; for now just // show a generic error. return R.string.incall_error_call_failed; + case DisconnectCause.OUTGOING_CANCELED: + // We don't want to show any dialog for the canceled case since the call was + // either canceled by the user explicitly (end-call button pushed immediately) + // or some other app canceled the call and immediately issued a new CALL to + // replace it. + return INVALID_RES_ID; case DisconnectCause.POWER_OFF: // Radio is explictly powered off, presumably because the // device is in airplane mode. -- cgit v1.2.3 From c4765665825941ebc9d3e6f5eb30d0926fea0c16 Mon Sep 17 00:00:00 2001 From: Santos Cordon Date: Thu, 14 Aug 2014 01:53:44 -0700 Subject: Fix parentID for conference call support. Bug:16844332 Bug:16449372 Change-Id: I815df3aa8c2cf9db5dd20d670a64e3fd59493f56 --- src/com/android/incallui/Call.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/com/android/incallui/Call.java b/src/com/android/incallui/Call.java index 01f2e8b3..075ec981 100644 --- a/src/com/android/incallui/Call.java +++ b/src/com/android/incallui/Call.java @@ -169,7 +169,6 @@ public final class Call { private final String mId; private int mState = State.INVALID; private int mDisconnectCause; - private String mParentCallId; private int mSessionModificationState; private final List mChildCallIds = new ArrayList<>(); @@ -205,11 +204,6 @@ public final class Call { setState(translateState(mTelecommCall.getState())); setDisconnectCause(mTelecommCall.getDetails().getDisconnectCauseCode()); - if (mTelecommCall.getParent() != null) { - mParentCallId = CallList.getInstance().getCallByTelecommCall( - mTelecommCall.getParent()).getId(); - } - if (mTelecommCall.getVideoCall() != null) { if (mVideoCallListener == null) { mVideoCallListener = new InCallVideoCallListener(this); @@ -264,7 +258,7 @@ public final class Call { } public int getState() { - if (mParentCallId != null) { + if (mTelecommCall.getParent() != null) { return State.CONFERENCED; } else { return mState; @@ -343,7 +337,11 @@ public final class Call { } public String getParentId() { - return mParentCallId; + android.telecomm.Call parentCall = mTelecommCall.getParent(); + if (parentCall != null) { + return CallList.getInstance().getCallByTelecommCall(parentCall).getId(); + } + return null; } public int getVideoState() { @@ -385,7 +383,7 @@ public final class Call { State.toString(mState), PhoneCapabilities.toString(mTelecommCall.getDetails().getCallCapabilities()), mChildCallIds, - mParentCallId, + getParentId(), mTelecommCall.getDetails().getVideoState()); } } -- cgit v1.2.3 From 559cb22211f49ee66dd8f5382eaefffef855da82 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Tue, 26 Aug 2014 10:13:33 -0700 Subject: Null protect maybeShowConferenceCallButton. Bug: 17274805 Change-Id: Id25b325e9d59b63632eb55c514af409555707b9d --- src/com/android/incallui/CallCardPresenter.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/com/android/incallui/CallCardPresenter.java b/src/com/android/incallui/CallCardPresenter.java index b746267e..c37aaec7 100644 --- a/src/com/android/incallui/CallCardPresenter.java +++ b/src/com/android/incallui/CallCardPresenter.java @@ -299,6 +299,11 @@ public class CallCardPresenter extends Presenter * buttons in the {@link CallButtonFragment}. */ private void maybeShowManageConferenceCallButton() { + if (mPrimary == null) { + getUi().showManageConferenceCallButton(false); + return; + } + final boolean isGenericConference = mPrimary.can(PhoneCapabilities.GENERIC_CONFERENCE); getUi().showManageConferenceCallButton(mPrimary.isConferenceCall() && !isGenericConference); } -- cgit v1.2.3 From 54d5038cbfd8f59e878370e47ada910638b2b83c Mon Sep 17 00:00:00 2001 From: Tyler Gunn Date: Tue, 2 Sep 2014 12:08:25 -0700 Subject: Fixing NPE in InCallCameraManager. 1. Changed InCallCameraManager to check for null context before getting the CAMERA_SERVICE. 2. Added try/catch around getSystemService call to ensure failures don't crash InCall UI. 3. Changed so that the InCallCameraManager is lazy loaded, only when it is actually used (previously it was initialized on InCall startup). Bug: 17355717 Change-Id: Ie5debaece1e5dca4d3c5b6a586a188f518696ab8 --- src/com/android/incallui/CallButtonPresenter.java | 12 ++++++------ src/com/android/incallui/InCallCameraManager.java | 18 ++++++++++++++++-- src/com/android/incallui/VideoCallPresenter.java | 13 +++---------- 3 files changed, 25 insertions(+), 18 deletions(-) diff --git a/src/com/android/incallui/CallButtonPresenter.java b/src/com/android/incallui/CallButtonPresenter.java index 8a5170c8..1f7a36fe 100644 --- a/src/com/android/incallui/CallButtonPresenter.java +++ b/src/com/android/incallui/CallButtonPresenter.java @@ -41,7 +41,6 @@ public class CallButtonPresenter extends Presenter Date: Tue, 2 Sep 2014 17:08:48 -0700 Subject: Do not request prox sensor ON without an ongoing call. Bug: 17323179 Change-Id: I34afc5e42ba1d5b559626b7d52b41e96af95b4f9 --- src/com/android/incallui/CallList.java | 8 ++++++++ src/com/android/incallui/ProximitySensor.java | 7 ++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/com/android/incallui/CallList.java b/src/com/android/incallui/CallList.java index 0908b56a..7f76cd5d 100644 --- a/src/com/android/incallui/CallList.java +++ b/src/com/android/incallui/CallList.java @@ -282,6 +282,14 @@ public class CallList implements InCallPhoneListener { return result; } + public boolean hasLiveCall() { + Call call = getFirstCall(); + if (call == null) { + return false; + } + return call != getDisconnectingCall() && call != getDisconnectedCall(); + } + /** * Returns the first call found in the call map with the specified call modification state. * @param state The session modification state to search for. diff --git a/src/com/android/incallui/ProximitySensor.java b/src/com/android/incallui/ProximitySensor.java index 02de4fd2..5bde190c 100644 --- a/src/com/android/incallui/ProximitySensor.java +++ b/src/com/android/incallui/ProximitySensor.java @@ -81,9 +81,10 @@ public class ProximitySensor implements AccelerometerListener.OrientationListene @Override public void onStateChange(InCallState oldState, InCallState newState, CallList callList) { // We ignore incoming state because we do not want to enable proximity - // sensor during incoming call screen - boolean isOffhook = (InCallState.INCALL == newState - || InCallState.OUTGOING == newState); + // sensor during incoming call screen. We check hasLiveCall() because a disconnected call + // can also put the in-call screen in the INCALL state. + boolean hasOngoingCall = InCallState.INCALL == newState && callList.hasLiveCall(); + boolean isOffhook = (InCallState.OUTGOING == newState) || hasOngoingCall; if (isOffhook != mIsPhoneOffhook) { mIsPhoneOffhook = isOffhook; -- cgit v1.2.3 From bcd7512c3b40375ebf85863775dd766d8ff536d8 Mon Sep 17 00:00:00 2001 From: Yorke Lee Date: Fri, 14 Nov 2014 11:51:22 -0800 Subject: Removed unused VideoCallFragment Bug: 18373617 Change-Id: Iae8cdd1f73de5f9824aff9d57fcf33b924527607 --- res/layout-land/call_card_content.xml | 7 ------- res/layout/call_card_content.xml | 7 ------- 2 files changed, 14 deletions(-) diff --git a/res/layout-land/call_card_content.xml b/res/layout-land/call_card_content.xml index 0bb45a24..496b6b39 100644 --- a/res/layout-land/call_card_content.xml +++ b/res/layout-land/call_card_content.xml @@ -71,13 +71,6 @@ android:layout_height="wrap_content" android:layout_alignTop="@id/photo" /> - - - -