Add generic error code dialogs for failed calls.

This change listens for disconnected calls and if the disconnection
cause matches a set of predefined causes, we show a dialog to the user.

New dialog messages:
- You can\'t make outgoing calls while call barring is on.
- All calls are restricted by access control.
- Emergency calls are restricted by access control.
- Normal calls are restricted by access control.
- Outgoing calls are restricted by FDN.

Several changes were necessary to support this:
1) Dialog code (InCallActivity.java)
2) Notifications for a new disconnect (CallList.java)
   - previously we sent a large update for ondisconnect, now we just
     send the notice for that particular call.  InCallPresenter was
     written so that the same thing that used to happen still happens.
3) Check if we need to show a disconnect dialog when the UI comes up.
   - I found that FDN disconnection happens so quickly that the
     disconnect came before the UI was up, so this was necessary.
     (InCallPresenter.setActivity())
4) CallCard should be initialized with disconnecting/disconnecting calls.
   - Call Card presenter intializes itself when it starts up using live
   calls, but as with the FDN case above, a disconnected call should be
   used if no live calls exist. (CallList.getFirstCall())
5) If a dialog is up while an incoming call comes up, dismiss it
   automatically so that users can see incoming UI.
   - (InCallPresenter.startOrFinishUi())
6) Keep the UI up as long as there is a dialog for the incoming call.
   - Previously, UI would come down once all calls were shut down but
   in the case of present dialogs, we want it to stay up.
   (InCallActivity.finish())
   - When the dialog is dismissed, check if we want to tear down UI.
   (InCallActivity.onDialogDismissed())
7) Only tear down UI once we are in the NO_CALL state.
   - We used to tear down when the activity was null (closed) and the
   service was disconnected. This is problematic because a call that
   immediately disconnects (like FDN errors) would shut down the service
   before the UI had a chance to come up. We added a check to the
   conditional for the state NO_CALL before shutting down.
   (InCallPresenter.attemptCleanup()).

bug: 10680210
Change-Id: I1fd33dd53dc0eec5a02b7a940cfd018cec3d20c0
4 files changed
tree: 22ecd3d50053702e84483a8f45234007e858ec2b
  1. InCallUI/