diff options
author | Adnan Begovic <adnan@cyngn.com> | 2015-07-02 14:12:27 -0700 |
---|---|---|
committer | Adnan Begovic <adnan@cyngn.com> | 2015-07-06 11:19:30 -0700 |
commit | 89cfa6d5cf7d2a1e65c821924b03f26a2e8829dc (patch) | |
tree | 814216cac53810b6c4b118a3a280d90b29464a6f | |
parent | 284c2035106c85ec3601f85b2887eaf6044501be (diff) | |
download | packages_apps_InCallUI-89cfa6d5cf7d2a1e65c821924b03f26a2e8829dc.tar.gz packages_apps_InCallUI-89cfa6d5cf7d2a1e65c821924b03f26a2e8829dc.tar.bz2 packages_apps_InCallUI-89cfa6d5cf7d2a1e65c821924b03f26a2e8829dc.zip |
InCallUI: Unbreak heads-up disabled incoming call.
If we're explicitely clearing the task, then InCallUI
doesn't show up when heads up is disabled -- causing a
very disorienting experience.
Change-Id: I875f0d5917c284b71dd20f439e97af1943857317
(cherry picked from commit e99ddf86379bb09b91d7ee9d829513ade16fd492)
-rw-r--r-- | src/com/android/incallui/InCallActivity.java | 10 | ||||
-rw-r--r-- | src/com/android/incallui/InCallPresenter.java | 9 |
2 files changed, 15 insertions, 4 deletions
diff --git a/src/com/android/incallui/InCallActivity.java b/src/com/android/incallui/InCallActivity.java index 6d4733da..280dab17 100644 --- a/src/com/android/incallui/InCallActivity.java +++ b/src/com/android/incallui/InCallActivity.java @@ -247,8 +247,14 @@ public class InCallActivity extends Activity { mIsForegroundActivity = true; - InCallPresenter.getInstance().setThemeColors(); - InCallPresenter.getInstance().onUiShowing(true); + // This is misleading. InCallActivity is actually in the foreground, + // however the presenter is currently tearing down and considers + // that the InCallActivity is not started. So to subvert an NPE, + // check for both conditions since we might be out of sync. + if (InCallPresenter.getInstance().isShowingInCallUi()) { + InCallPresenter.getInstance().setThemeColors(); + InCallPresenter.getInstance().onUiShowing(true); + } if (mShowDialpadRequested) { mCallButtonFragment.displayDialpad(true /* show */, diff --git a/src/com/android/incallui/InCallPresenter.java b/src/com/android/incallui/InCallPresenter.java index 7ca624a9..aaf0f12e 100644 --- a/src/com/android/incallui/InCallPresenter.java +++ b/src/com/android/incallui/InCallPresenter.java @@ -641,6 +641,12 @@ public class InCallPresenter implements CallList.Listener, } public void cancelAccountSelection() { + // By the time we receive this intent, we could be shut down and call list + // could be null. Bail in those cases. + if (mCallList == null) { + return; + } + mAccountSelectionCancelled = true; Call call = mCallList.getWaitingForAccountCall(); if (call != null) { @@ -1360,10 +1366,9 @@ public class InCallPresenter implements CallList.Listener, boolean showCircularReveal, boolean newTask) { final Intent intent = new Intent(Intent.ACTION_MAIN, null); intent.setFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS - | Intent.FLAG_ACTIVITY_NO_USER_ACTION | Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); + | Intent.FLAG_ACTIVITY_NO_USER_ACTION); if (newTask) { intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); } intent.setClass(mContext, InCallActivity.class); |