diff options
author | Nancy Chen <nancychen@google.com> | 2016-02-04 17:47:33 -0800 |
---|---|---|
committer | Usman Abdullah <uabdullah@google.com> | 2016-04-20 18:31:31 +0000 |
commit | 435f5f690dfa576d08539a5987c52d0d23540327 (patch) | |
tree | 49f1eab6a9dd03a10017d0134fd89dc7e29fa347 | |
parent | d0db4f8941e13766b78c90432b92b4eaccf71e2c (diff) |
[DO NOT MERGE] Fix NPE caused by misplaced parenthesis.
In onStateChange, this branch of logic should be not be followed if mPrimary
is null.
Bug: 27045730
Change-Id: Ia948313d4886475dd5966b209c19696cb594ed59
(cherry picked from commit 89fa1dbb7e73766647a9de92da1b8164aa71471e)
(cherry picked from commit 6e01a29e201837a6084e156aee7edcd21e46c8bc)
-rw-r--r-- | InCallUI/src/com/android/incallui/CallCardPresenter.java | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/InCallUI/src/com/android/incallui/CallCardPresenter.java b/InCallUI/src/com/android/incallui/CallCardPresenter.java index 3e3926ba9..d0762fdd0 100644 --- a/InCallUI/src/com/android/incallui/CallCardPresenter.java +++ b/InCallUI/src/com/android/incallui/CallCardPresenter.java @@ -249,7 +249,6 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> Call.areSameNumber(mPrimary, primary)); final boolean secondaryChanged = !(Call.areSame(mSecondary, secondary) && Call.areSameNumber(mSecondary, secondary)); - final boolean shouldShowCallSubject = shouldShowCallSubject(mPrimary); mSecondary = secondary; Call previousPrimary = mPrimary; @@ -262,9 +261,8 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> // Refresh primary call information if either: // 1. Primary call changed. // 2. The call's ability to manage conference has changed. - if (mPrimary != null && (primaryChanged || - ui.isManageConferenceVisible() != shouldShowManageConference()) || - ui.isCallSubjectVisible() != shouldShowCallSubject) { + // 3. The call subject should be shown or hidden. + if (shouldRefreshPrimaryInfo(primaryChanged, ui, shouldShowCallSubject(mPrimary))) { // primary call has changed if (previousPrimary != null) { //clear progess spinner (if any) related to previous primary call @@ -402,6 +400,16 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> updatePrimaryDisplayInfo(); } + private boolean shouldRefreshPrimaryInfo(boolean primaryChanged, CallCardUi ui, + boolean shouldShowCallSubject) { + if (mPrimary == null) { + return false; + } + return primaryChanged || + ui.isManageConferenceVisible() != shouldShowManageConference() || + ui.isCallSubjectVisible() != shouldShowCallSubject; + } + private String getSubscriptionNumber() { // If it's an emergency call, and they're not populating the callback number, // then try to fall back to the phone sub info (to hopefully get the SIM's |