Merge "Major fixes for in call to work with reverse number lookup." into klp-dev
diff --git a/InCallUI/res/layout/answer_fragment.xml b/InCallUI/res/layout/answer_fragment.xml
index 5f8c561..05e83de 100644
--- a/InCallUI/res/layout/answer_fragment.xml
+++ b/InCallUI/res/layout/answer_fragment.xml
@@ -19,16 +19,11 @@
<com.android.incallui.GlowPadWrapper
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:dc="http://schemas.android.com/apk/res-auto"
-
android:id="@+id/glow_pad_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginBottom="@dimen/glowpadview_margin_bottom"
android:focusable="true"
- android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
- android:gravity="center"
- android:layout_gravity="bottom|center_horizontal"
android:background="@android:color/black"
android:visibility="gone"
diff --git a/InCallUI/res/layout/incall_screen.xml b/InCallUI/res/layout/incall_screen.xml
index 25241ba..86f67c9 100644
--- a/InCallUI/res/layout/incall_screen.xml
+++ b/InCallUI/res/layout/incall_screen.xml
@@ -62,7 +62,9 @@
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
- android:gravity="center"
- android:layout_gravity="bottom|center_horizontal" />
+ android:gravity="top"
+ android:layout_gravity="bottom|center_horizontal"
+ android:layout_marginBottom="@dimen/glowpadview_margin_bottom"
+ android:visibility="gone" />
</FrameLayout>
diff --git a/InCallUI/res/values/dimens.xml b/InCallUI/res/values/dimens.xml
index c0a001c..1d94971 100644
--- a/InCallUI/res/values/dimens.xml
+++ b/InCallUI/res/values/dimens.xml
@@ -113,7 +113,7 @@
<!-- Default distance from each snap target that GlowPadView considers a "hit" -->
<dimen name="glowpadview_inner_radius">15dip</dimen>
- <dimen name="glowpadview_margin_bottom">-64dip</dimen>
+ <dimen name="glowpadview_margin_bottom">-48dip</dimen>
<dimen name="glowpadview_margin_right">0dip</dimen>
</resources>
diff --git a/InCallUI/src/com/android/incallui/CallCardFragment.java b/InCallUI/src/com/android/incallui/CallCardFragment.java
index d9712d1..2c0204c 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 @@
private View mProviderInfo;
private TextView mProviderLabel;
private TextView mProviderNumber;
+ private ViewGroup mSupplementaryInfoContainer;
// Secondary caller info
private ViewStub mSecondaryCallInfo;
@@ -102,6 +104,8 @@
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
@@ -226,9 +230,23 @@
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 4ce04d3..25113e8 100644
--- a/InCallUI/src/com/android/incallui/CallList.java
+++ b/InCallUI/src/com/android/incallui/CallList.java
@@ -38,7 +38,9 @@
*/
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;
@@ -318,7 +320,7 @@
// 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);
}
@@ -329,6 +331,32 @@
}
}
+ 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);
diff --git a/InCallUI/src/com/android/incallui/InCallPresenter.java b/InCallUI/src/com/android/incallui/InCallPresenter.java
index 3aa717c..11f9308 100644
--- a/InCallUI/src/com/android/incallui/InCallPresenter.java
+++ b/InCallUI/src/com/android/incallui/InCallPresenter.java
@@ -299,11 +299,20 @@
// The new state is the hidden state (no calls). Tear everything down.
if (mInCallActivity != null) {
- // Null out reference before we start end sequence
- InCallActivity temp = mInCallActivity;
- mInCallActivity = null;
-
- temp.finish();
+ if (mInCallActivity.isFinishing()) {
+ // Tear down process:
+ // When there are no more calls to handle, two things happen:
+ // 1. The binding connection with TeleService ends
+ // 2. InCallState changes to HIDDEN and we call activity.finish() here.
+ //
+ // Without the service connection, we will not get updates from the service
+ // and so will never get a new call to move out of the HIDDEN state. Since this
+ // code is called when we move from a different state into the HIDDEN state,
+ // it should never get hit twice. In case it does, log an error.
+ Log.e(this, "Attempting to finish incall activity twice.");
+ } else {
+ mInCallActivity.finish();
+ }
// blow away stale contact info so that we get fresh data on
// the next set of calls
diff --git a/InCallUI/src/com/android/incallui/ProximitySensor.java b/InCallUI/src/com/android/incallui/ProximitySensor.java
index fb8e468..0012e8a 100644
--- a/InCallUI/src/com/android/incallui/ProximitySensor.java
+++ b/InCallUI/src/com/android/incallui/ProximitySensor.java
@@ -165,17 +165,17 @@
* 4) If the slider is open(i.e. the hardkeyboard is *not* hidden)
*/
private void updateProximitySensorMode() {
- Log.v(this, "updateProximitySensorMode");
+ Log.i(this, "updateProximitySensorMode");
if (proximitySensorModeEnabled()) {
- Log.v(this, "keyboard open: ", mIsHardKeyboardOpen);
- Log.v(this, "dialpad visible: ", mDialpadVisible);
+ Log.i(this, "keyboard open: " + mIsHardKeyboardOpen);
+ Log.i(this, "dialpad visible: " + mDialpadVisible);
Log.v(this, "isOffhook: ", mIsPhoneOffhook);
synchronized (mProximityWakeLock) {
final int audioMode = mAudioModeProvider.getAudioMode();
- Log.v(this, "audioMode: ", AudioMode.toString(audioMode));
+ Log.i(this, "audioMode: " + AudioMode.toString(audioMode));
// turn proximity sensor off and turn screen on immediately if
// we are using a headset, the keyboard is open, or the device
@@ -190,7 +190,7 @@
// proximity sensor goes negative.
final boolean horizontal =
(mOrientation == AccelerometerListener.ORIENTATION_HORIZONTAL);
- Log.v(this, "horizontal: ", horizontal);
+ Log.i(this, "horizontal: " + horizontal);
screenOnImmediately |= !mUiShowing && horizontal;
// We do not keep the screen off when dialpad is visible, we are horizontal, and
@@ -202,6 +202,7 @@
Log.v(this, "screenonImmediately: ", screenOnImmediately);
if (mIsPhoneOffhook && !screenOnImmediately) {
+ Log.i(this, "turning on proximity sensor");
// Phone is in use! Arrange for the screen to turn off
// automatically when the sensor detects a close object.
if (!mProximityWakeLock.isHeld()) {
@@ -211,6 +212,7 @@
Log.v(this, "updateProximitySensorMode: lock already held.");
}
} else {
+ Log.i(this, "turning off proximity sensor");
// Phone is either idle, or ringing. We don't want any
// special proximity sensor behavior in either case.
if (mProximityWakeLock.isHeld()) {