From cab6935f7c42b32b128150ddbde818a902f1ca38 Mon Sep 17 00:00:00 2001 From: Santos Cordon Date: Mon, 19 Aug 2013 20:12:16 -0700 Subject: Support connecting and disconnecting from Phone app. Phone app now connects/disconnects from the UI when there are no active calls but UI did not previously support being disconnected. This change adds the following functionality to support dis/reconnection: - CallCommandClient now supports setting new ICallCommandService instances. - CallCommandClient now checks if mCommandService is null before executing a method. - CallHandlerService performs more careful ordered cleanup with destroyed including removing pending messages and clearing any existing calls from the call list. - InCallActivity now performs tearDown of the presenters with onDestroy instead of finish() to reduce NPE instances. - InCallActivity not notifies InCallPresenter when is finishes, and not just when it starts. - InCallPresenter tears itself down after two things happen: the UI is destroyed and the service is disconnected. - InCallPresenter now issues a full-screen restart of the UI if the UI was previously hidden (except for new outgoing calls). This allows the UI to come back to the foreground if it was in the foreground when the app went down. The above changes also now protect against the phone app crashing or the incall UI crashing. bug: 10363682 Change-Id: I9b785f906f29015827e8e53e64cd5f5c72cd7981 --- InCallUI/src/com/android/incallui/InCallActivity.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'InCallUI/src/com/android/incallui/InCallActivity.java') diff --git a/InCallUI/src/com/android/incallui/InCallActivity.java b/InCallUI/src/com/android/incallui/InCallActivity.java index e1a979693..5edfaa32a 100644 --- a/InCallUI/src/com/android/incallui/InCallActivity.java +++ b/InCallUI/src/com/android/incallui/InCallActivity.java @@ -88,6 +88,9 @@ public class InCallActivity extends Activity { @Override protected void onDestroy() { Logger.d(this, "onDestroy()... this = " + this); + + tearDownPresenters(); + super.onDestroy(); } @@ -116,13 +119,7 @@ public class InCallActivity extends Activity { @Override public void finish() { Logger.d(this, "finish()..."); - tearDownPresenters(); - super.finish(); - - // TODO(klp): Actually finish the activity for now. Revisit performance implications of - // this before launch. - // moveTaskToBack(true); } @Override @@ -299,11 +296,14 @@ public class InCallActivity extends Activity { } private void tearDownPresenters() { + Logger.d(this, "Tearing down presenters."); InCallPresenter mainPresenter = InCallPresenter.getInstance(); mainPresenter.removeListener(mCallButtonFragment.getPresenter()); mainPresenter.removeListener(mCallCardFragment.getPresenter()); mainPresenter.removeListener(mAnswerFragment.getPresenter()); + + mainPresenter.setActivity(null); } private void toast(String text) { -- cgit v1.2.3