diff options
author | Santos Cordon <santoscordon@google.com> | 2013-08-27 16:34:06 -0700 |
---|---|---|
committer | Santos Cordon <santoscordon@google.com> | 2013-08-27 16:34:06 -0700 |
commit | 152ac3957d014793d954b057e1b04859bb16a1dc (patch) | |
tree | 22c3e9ab924d30430c48914353a6c26bc5c05d1b /InCallUI | |
parent | 6002b83345c66319a8839912b326a0f84d7a1d9a (diff) |
Adding different timeouts for CALL_ENDED screen.
Different call disconnections require different timeouts for the call
end screen. This change adds them as they existed before the split.
0ms for incoming rejected/missed calls
200ms for locally ended calls (user hits disconnect)
2000ms for normally ended calls (terminated by other end)
5000ms for everything else (errors, etc).
bug: 10414373
Change-Id: Ie9624bd3af5f6d4f58010360701c31efafcf1fb2
Diffstat (limited to 'InCallUI')
-rw-r--r-- | InCallUI/src/com/android/incallui/CallCardFragment.java | 18 | ||||
-rw-r--r-- | InCallUI/src/com/android/incallui/CallList.java | 32 |
2 files changed, 48 insertions, 2 deletions
diff --git a/InCallUI/src/com/android/incallui/CallCardFragment.java b/InCallUI/src/com/android/incallui/CallCardFragment.java index b77dc4cde..be1c51421 100644 --- a/InCallUI/src/com/android/incallui/CallCardFragment.java +++ b/InCallUI/src/com/android/incallui/CallCardFragment.java @@ -16,6 +16,7 @@ package com.android.incallui; +import android.animation.LayoutTransition; import android.content.Context; import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; @@ -49,6 +50,7 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr private View mProviderInfo; private TextView mProviderLabel; private TextView mProviderNumber; + private ViewGroup mSupplementaryInfoContainer; // Secondary caller info private ViewStub mSecondaryCallInfo; @@ -99,6 +101,8 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr mProviderInfo = view.findViewById(R.id.providerInfo); mProviderLabel = (TextView) view.findViewById(R.id.providerLabel); mProviderNumber = (TextView) view.findViewById(R.id.providerAddress); + mSupplementaryInfoContainer = + (ViewGroup) view.findViewById(R.id.supplementary_info_container); } @Override @@ -208,9 +212,23 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr Log.v(this, "bluetooth on ", bluetoothOn); if (!TextUtils.isEmpty(callStateLabel)) { + // There are cases where we totally skip the animation + final boolean skipAnimation = (state == Call.State.DIALING + || state == Call.State.DISCONNECTED); + + LayoutTransition transition = null; + if (skipAnimation) { + transition = mSupplementaryInfoContainer.getLayoutTransition(); + mSupplementaryInfoContainer.setLayoutTransition(null); + } + mCallStateLabel.setVisibility(View.VISIBLE); mCallStateLabel.setText(callStateLabel); + if (skipAnimation) { + mSupplementaryInfoContainer.setLayoutTransition(transition); + } + if (Call.State.INCOMING == state) { setBluetoothOn(bluetoothOn); } diff --git a/InCallUI/src/com/android/incallui/CallList.java b/InCallUI/src/com/android/incallui/CallList.java index 7890b997a..200f10f41 100644 --- a/InCallUI/src/com/android/incallui/CallList.java +++ b/InCallUI/src/com/android/incallui/CallList.java @@ -38,7 +38,9 @@ import java.util.Set; */ public class CallList { - private static final int DISCONNECTED_CALL_TIMEOUT_MS = 2000; + private static final int DISCONNECTED_CALL_SHORT_TIMEOUT_MS = 200; + private static final int DISCONNECTED_CALL_MEDIUM_TIMEOUT_MS = 2000; + private static final int DISCONNECTED_CALL_LONG_TIMEOUT_MS = 5000; private static final int EVENT_DISCONNECTED_TIMEOUT = 1; @@ -264,7 +266,7 @@ public class CallList { // Set up a timer to destroy the call after X seconds. final Message msg = mHandler.obtainMessage(EVENT_DISCONNECTED_TIMEOUT, call); - mHandler.sendMessageDelayed(msg, DISCONNECTED_CALL_TIMEOUT_MS); + mHandler.sendMessageDelayed(msg, getDelayForDisconnect(call)); mCallMap.put(id, call); } @@ -275,6 +277,32 @@ public class CallList { } } + private int getDelayForDisconnect(Call call) { + Preconditions.checkState(call.getState() == Call.State.DISCONNECTED); + + + final Call.DisconnectCause cause = call.getDisconnectCause(); + final int delay; + switch (cause) { + case LOCAL: + delay = DISCONNECTED_CALL_SHORT_TIMEOUT_MS; + break; + case NORMAL: + delay = DISCONNECTED_CALL_MEDIUM_TIMEOUT_MS; + break; + case INCOMING_REJECTED: + case INCOMING_MISSED: + // no delay for missed/rejected incoming calls + delay = 0; + break; + default: + delay = DISCONNECTED_CALL_LONG_TIMEOUT_MS; + break; + } + + return delay; + } + private void updateCallTextMap(Call call, List<String> textResponses) { Preconditions.checkNotNull(call); |