Merge "IMS-VT: Handle InCallActivity destroy when low battery dialog is showing" into atel.lnx.2.0-dev
diff --git a/InCallUI/src/com/android/incallui/InCallActivity.java b/InCallUI/src/com/android/incallui/InCallActivity.java
index 56817d1..3956f04 100644
--- a/InCallUI/src/com/android/incallui/InCallActivity.java
+++ b/InCallUI/src/com/android/incallui/InCallActivity.java
@@ -366,6 +366,7 @@
@Override
protected void onDestroy() {
Log.d(this, "onDestroy()... this = " + this);
+ InCallLowBatteryListener.getInstance().onDestroyInCallActivity();
InCallPresenter.getInstance().unsetActivity(this);
InCallPresenter.getInstance().updateIsChangingConfigurations();
super.onDestroy();
diff --git a/InCallUI/src/com/android/incallui/InCallLowBatteryListener.java b/InCallUI/src/com/android/incallui/InCallLowBatteryListener.java
index 49349d2..95da595 100644
--- a/InCallUI/src/com/android/incallui/InCallLowBatteryListener.java
+++ b/InCallUI/src/com/android/incallui/InCallLowBatteryListener.java
@@ -171,6 +171,28 @@
}
/**
+ * This API handles InCallActivity destroy when low battery dialog is showing
+ */
+ public void onDestroyInCallActivity() {
+ if (dismissPendingDialogs()) {
+ Log.i(this, "onDestroyInCallActivity dismissed low battery dialog");
+
+ /* Activity is destroyed when low battery dialog is showing, possibly
+ by removing the activity from recent tasks list etc. Handle this by
+ dismissing the existing low battery dialog and marking the entry
+ against the call in low battery map that the low battery indication
+ needs to be reprocessed for eg. when user brings back the call to
+ foreground by pulling it from notification bar */
+ Call call = mPrimaryCallTracker.getPrimaryCall();
+ if (call == null) {
+ Log.w(this, "onDestroyInCallActivity call is null");
+ return;
+ }
+ mLowBatteryMap.replace(call, PROCESS_LOW_BATTERY);
+ }
+ }
+
+ /**
* This API conveys if incall experience is showing or not.
*
* @param showing TRUE if incall experience is showing else FALSE
@@ -512,10 +534,12 @@
* This method dismisses the low battery dialog and
* returns true if dialog is dimissed else false
*/
- public void dismissPendingDialogs() {
+ public boolean dismissPendingDialogs() {
if (isLowBatteryDialogShowing()) {
mAlert.dismiss();
mAlert = null;
+ return true;
}
+ return false;
}
}