diff options
author | Santos Cordon <santoscordon@google.com> | 2013-08-05 09:42:04 -0700 |
---|---|---|
committer | Santos Cordon <santoscordon@google.com> | 2013-08-05 15:36:15 -0700 |
commit | 1b60e8c70bdcbf07c3efab310790134ecf81d4fd (patch) | |
tree | 53a677be4d17034d2907f06fc4b26571cdb947f9 /InCallUI/src/com/android/incallui/CallList.java | |
parent | 258eb86d9f64ebebee4ec4e39af385364ca0c071 (diff) |
Notifications in Phone (part 1)
- Added StatusBarNotification class to handle notifications
- StatusBarNotification has tons of copied comments from
NotificationMgr.java. Also has minimal code to make the notification
pop up (without call-specific data).
- Moved the UI start-up code from InCallPresenter to
StatusBarNotification. Incoming phone calls need to display an alert
above immersive (fullscreen) foreground activities and the way to do
that is through notifications. The old phone app did the same
thing...finally bringing over that functionality.
Change-Id: I3324503e0d7bb1de00d8e7fab72d4b40519491dd
Diffstat (limited to 'InCallUI/src/com/android/incallui/CallList.java')
-rw-r--r-- | InCallUI/src/com/android/incallui/CallList.java | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/InCallUI/src/com/android/incallui/CallList.java b/InCallUI/src/com/android/incallui/CallList.java index 17e719e7c..c16c53df0 100644 --- a/InCallUI/src/com/android/incallui/CallList.java +++ b/InCallUI/src/com/android/incallui/CallList.java @@ -128,8 +128,25 @@ public class CallList { return getFirstCallWithState(Call.State.ONHOLD); } + public Call getSecondBackgroundCall() { + return getCallWithState(Call.State.ONHOLD, 1); + } + + public Call getActiveOrBackgroundCall() { + Call call = getActiveCall(); + if (call == null) { + call = getBackgroundCall(); + } + return call; + } + public Call getIncomingCall() { - return getFirstCallWithState(Call.State.INCOMING); + Call call = getFirstCallWithState(Call.State.INCOMING); + if (call == null) { + call = getFirstCallWithState(Call.State.CALL_WAITING); + } + + return call; } public boolean existsLiveCall() { @@ -145,11 +162,24 @@ public class CallList { * Returns first call found in the call map with the specified state. */ public Call getFirstCallWithState(int state) { + return getCallWithState(state, 0); + } + + /** + * Returns the [position]th call found in the call map with the specified state. + * TODO(klp): Improve this logic to sort by call time. + */ + public Call getCallWithState(int state, int positionToFind) { Call retval = null; + int position = 0; for (Call call : mCallMap.values()) { if (call.getState() == state) { - retval = call; - break; + if (position >= positionToFind) { + retval = call; + break; + } else { + position++; + } } } |