Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5128eddf authored by Ravi Paluri's avatar Ravi Paluri
Browse files

IMS-VT: Handle InCallActivity destroy when low battery dialog is showing

Handle InCallActivity destroy 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.

Change-Id: I0ef5912e39586a601774d7ce450daeadd73d830a
CRs-Fixed: 1064492
parent 3698a104
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -366,6 +366,7 @@ public class InCallActivity extends TransactionSafeActivity implements FragmentD
    @Override
    protected void onDestroy() {
        Log.d(this, "onDestroy()...  this = " + this);
        InCallLowBatteryListener.getInstance().onDestroyInCallActivity();
        InCallPresenter.getInstance().unsetActivity(this);
        InCallPresenter.getInstance().updateIsChangingConfigurations();
        super.onDestroy();
+25 −1
Original line number Diff line number Diff line
@@ -170,6 +170,28 @@ public class InCallLowBatteryListener implements CallList.Listener, InCallDetail
        mLowBatteryMap.remove(call);
    }

    /**
      * 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.
     *
@@ -512,10 +534,12 @@ public class InCallLowBatteryListener implements CallList.Listener, InCallDetail
     * 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;
    }
}