History log of /packages/apps/Phone/src/com/android/phone/EmergencyCallHelper.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
c49d1c9004f3151d1cc5f31d6fc617bfc9603267 30-Apr-2012 Daisuke Miyakawa <dmiyakawa@google.com> Suppress debug logs

Because of remaining issues to be fixed, some are still remained.

Bug: 6201805
Change-Id: Ic5d9deb3775c59bbfb63f353fcebb5c24a18c7a3
/packages/apps/Phone/src/com/android/phone/EmergencyCallHelper.java
3426afaf85d33d454fad8d341a1a895fd7e21c10 30-Jul-2011 David Brown <dab@google.com> Fix "emergency call from airplane mode" sequence

If you dial an emergency number while the device is in airplane mode, the
device needs to first take you *out* of airplane mode, and then (once the
radio is powered up) actually make the call.

In gingerbread we did this using an invisible activity called
EmergencyCallHandler, but that's a bad design for a few reasons:
- Visible display glitches during the activity transitions
- Potential bugs if you interfere with the activity lifecycle (e.g. by
pausing the EmergencyCallHandler by pressing Power at just the right
point.)
- The code is overly complicated.

Instead, it's cleaner to implement this sequence without using activities
at all. Here's the new design:

- The whole sequence is run by a helper class called EmergencyCallHelper

- If you try to dial 911 while in airplane mode, the CallController
notices this, lazily creates an EmergencyCallHelper instance, and
starts the sequence

- Then, the EmergencyCallHelper runs the next steps:
- power on the radio
- listen for the service state change when the radio comes up
- then launch the emergency call
- Retry if the call fails with an OUT_OF_SERVICE error
- Retry if we've gone 5 seconds without any response from the radio
- Finally, clean up when the emergency call disconnects successfully

There's also a corresponding update to the in-call UI: the InCallScreen
now knows how to put up a progress dialog (i.e. a "spinner") while we're
waiting for the radio to come on. That's controlled by a new
"progressIndication" field of the InCallUiState.

TESTED (with hacked telephony layer that doesn't actually dial 911):

- Call 911 in normal mode
- Call 911 in airplane mode
- After 911-from-airplane-mode sequence, double-check no wake locks still held
- Confirm no cosmetic glitches

Also tested some corner cases:

- Tested retry logic by using a temporary hack to deliberately ignore
the "service state changed" event

- Tested the "too many retries" case (using a temporary hack to make
all calls fail); confirmed that we give up after 6 tries and display
an error message

- Do the whole "911 from airplane mode" sequence twice in a row (to make
sure it works even if the EmergencyCallHelper object has already been
instantiated)

- Manually turn screen off in the middle of the sequence, confirm that
doesn't disrupt the call

Bug: 4195290
Bug: 4194458

Change-Id: I209768ffdc6b3d2bd4efd04474eed630284ec551
/packages/apps/Phone/src/com/android/phone/EmergencyCallHelper.java