summaryrefslogtreecommitdiff
path: root/InCallUI/src/com/android/incallui
diff options
context:
space:
mode:
Diffstat (limited to 'InCallUI/src/com/android/incallui')
-rw-r--r--InCallUI/src/com/android/incallui/CallCardFragment.java21
-rw-r--r--InCallUI/src/com/android/incallui/CallCardPresenter.java10
-rw-r--r--InCallUI/src/com/android/incallui/DialpadFragment.java6
-rw-r--r--InCallUI/src/com/android/incallui/InCallActivity.java29
-rw-r--r--InCallUI/src/com/android/incallui/StatusBarNotifier.java4
-rw-r--r--InCallUI/src/com/android/incallui/VideoPauseController.java9
-rw-r--r--InCallUI/src/com/android/incallui/ringtone/DialerRingtoneManager.java15
7 files changed, 81 insertions, 13 deletions
diff --git a/InCallUI/src/com/android/incallui/CallCardFragment.java b/InCallUI/src/com/android/incallui/CallCardFragment.java
index 84a732ccc..785d3d3aa 100644
--- a/InCallUI/src/com/android/incallui/CallCardFragment.java
+++ b/InCallUI/src/com/android/incallui/CallCardFragment.java
@@ -649,6 +649,8 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
// height will be determined on layout.
if (isVisible) {
mSecondaryCallInfo.setVisibility(View.VISIBLE);
+ } else {
+ mSecondaryCallInfo.setVisibility(View.GONE);
}
updateFabPositionForSecondaryCallInfo();
@@ -667,6 +669,8 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
int secondaryHeight = mSecondaryCallInfo.getHeight();
if (isVisible) {
mSecondaryCallInfo.setVisibility(View.GONE);
+ } else {
+ mSecondaryCallInfo.setVisibility(View.VISIBLE);
}
Log.v(this, "setSecondaryInfoVisible: secondaryHeight = " + secondaryHeight);
@@ -1120,10 +1124,19 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
public void dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
if (event.getEventType() == AccessibilityEvent.TYPE_ANNOUNCEMENT) {
- dispatchPopulateAccessibilityEvent(event, mCallStateLabel);
- dispatchPopulateAccessibilityEvent(event, mPrimaryName);
- dispatchPopulateAccessibilityEvent(event, mCallTypeLabel);
- dispatchPopulateAccessibilityEvent(event, mPhoneNumber);
+ // Indicate this call is in active if no label is provided. The label is empty when
+ // the call is in active, not in other status such as onhold or dialing etc.
+ if (!mCallStateLabel.isShown() || TextUtils.isEmpty(mCallStateLabel.getText())) {
+ event.getText().add(
+ TextUtils.expandTemplate(
+ getResources().getText(R.string.accessibility_call_is_active),
+ mPrimaryName.getText()));
+ } else {
+ dispatchPopulateAccessibilityEvent(event, mCallStateLabel);
+ dispatchPopulateAccessibilityEvent(event, mPrimaryName);
+ dispatchPopulateAccessibilityEvent(event, mCallTypeLabel);
+ dispatchPopulateAccessibilityEvent(event, mPhoneNumber);
+ }
return;
}
dispatchPopulateAccessibilityEvent(event, mCallStateLabel);
diff --git a/InCallUI/src/com/android/incallui/CallCardPresenter.java b/InCallUI/src/com/android/incallui/CallCardPresenter.java
index e7ddd5a81..00835c8ce 100644
--- a/InCallUI/src/com/android/incallui/CallCardPresenter.java
+++ b/InCallUI/src/com/android/incallui/CallCardPresenter.java
@@ -337,7 +337,7 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
getUi().setEndCallButtonEnabled(shouldShowEndCallButton(mPrimary, callState),
callState != Call.State.INCOMING /* animate */);
- maybeSendAccessibilityEvent(oldState, newState);
+ maybeSendAccessibilityEvent(oldState, newState, primaryChanged);
}
@Override
@@ -1069,7 +1069,8 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
return true;
}
- private void maybeSendAccessibilityEvent(InCallState oldState, InCallState newState) {
+ private void maybeSendAccessibilityEvent(InCallState oldState, InCallState newState,
+ boolean primaryChanged) {
if (mContext == null) {
return;
}
@@ -1078,8 +1079,11 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
if (!am.isEnabled()) {
return;
}
+ // Announce the current call if it's new incoming/outgoing call or primary call is changed
+ // due to switching calls between two ongoing calls (one is on hold).
if ((oldState != InCallState.OUTGOING && newState == InCallState.OUTGOING)
- || (oldState != InCallState.INCOMING && newState == InCallState.INCOMING)) {
+ || (oldState != InCallState.INCOMING && newState == InCallState.INCOMING)
+ || primaryChanged) {
if (getUi() != null) {
getUi().sendAccessibilityAnnouncement();
}
diff --git a/InCallUI/src/com/android/incallui/DialpadFragment.java b/InCallUI/src/com/android/incallui/DialpadFragment.java
index ae66a491f..ad288bdc6 100644
--- a/InCallUI/src/com/android/incallui/DialpadFragment.java
+++ b/InCallUI/src/com/android/incallui/DialpadFragment.java
@@ -323,6 +323,9 @@ public class DialpadFragment extends BaseFragment<DialpadPresenter, DialpadPrese
}, ACCESSIBILITY_DTMF_STOP_DELAY_MILLIS);
}
}
+ if (v.getId() == R.id.dialpad_back) {
+ getActivity().onBackPressed();
+ }
}
@Override
@@ -437,6 +440,9 @@ public class DialpadFragment extends BaseFragment<DialpadPresenter, DialpadPrese
mDtmfDialerField.setElegantTextHeight(false);
configureKeypadListeners();
}
+ View backButton = mDialpadView.findViewById(R.id.dialpad_back);
+ backButton.setVisibility(View.VISIBLE);
+ backButton.setOnClickListener(this);
return parent;
}
diff --git a/InCallUI/src/com/android/incallui/InCallActivity.java b/InCallUI/src/com/android/incallui/InCallActivity.java
index 5cd21a555..eca79f8a7 100644
--- a/InCallUI/src/com/android/incallui/InCallActivity.java
+++ b/InCallUI/src/com/android/incallui/InCallActivity.java
@@ -88,6 +88,12 @@ public class InCallActivity extends TransactionSafeActivity implements FragmentD
private static final int DIALPAD_REQUEST_SHOW = 2;
private static final int DIALPAD_REQUEST_HIDE = 3;
+ /**
+ * This is used to relaunch the activity if resizing beyond which it needs to load different
+ * layout file.
+ */
+ private static final int SCREEN_HEIGHT_RESIZE_THRESHOLD = 500;
+
private CallButtonFragment mCallButtonFragment;
private CallCardFragment mCallCardFragment;
private AnswerFragment mAnswerFragment;
@@ -252,7 +258,7 @@ public class InCallActivity extends TransactionSafeActivity implements FragmentD
// setting activity should be last thing in setup process
InCallPresenter.getInstance().setActivity(this);
enableInCallOrientationEventListener(getRequestedOrientation() ==
- InCallOrientationEventListener.FULL_SENSOR_SCREEN_ORIENTATION);
+ InCallOrientationEventListener.FULL_SENSOR_SCREEN_ORIENTATION);
InCallPresenter.getInstance().onActivityStarted();
}
@@ -353,6 +359,27 @@ public class InCallActivity extends TransactionSafeActivity implements FragmentD
}
}
+ @Override
+ public void onConfigurationChanged(Configuration newConfig) {
+ super.onConfigurationChanged(newConfig);
+ Configuration oldConfig = getResources().getConfiguration();
+ Log.v(this, String.format(
+ "incallui config changed, screen size: w%ddp x h%ddp old:w%ddp x h%ddp",
+ newConfig.screenWidthDp, newConfig.screenHeightDp,
+ oldConfig.screenWidthDp, oldConfig.screenHeightDp));
+ // Recreate this activity if height is changing beyond the threshold to load different
+ // layout file.
+ if (oldConfig.screenHeightDp < SCREEN_HEIGHT_RESIZE_THRESHOLD &&
+ newConfig.screenHeightDp > SCREEN_HEIGHT_RESIZE_THRESHOLD ||
+ oldConfig.screenHeightDp > SCREEN_HEIGHT_RESIZE_THRESHOLD &&
+ newConfig.screenHeightDp < SCREEN_HEIGHT_RESIZE_THRESHOLD) {
+ Log.i(this, String.format(
+ "Recreate activity due to resize beyond threshold: %d dp",
+ SCREEN_HEIGHT_RESIZE_THRESHOLD));
+ recreate();
+ }
+ }
+
/**
* Returns true when the Activity is currently visible.
*/
diff --git a/InCallUI/src/com/android/incallui/StatusBarNotifier.java b/InCallUI/src/com/android/incallui/StatusBarNotifier.java
index 1a4ec0935..315c0d0ae 100644
--- a/InCallUI/src/com/android/incallui/StatusBarNotifier.java
+++ b/InCallUI/src/com/android/incallui/StatusBarNotifier.java
@@ -315,7 +315,9 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener,
audioAttributes.setContentType(AudioAttributes.CONTENT_TYPE_MUSIC);
audioAttributes.setUsage(AudioAttributes.USAGE_NOTIFICATION_RINGTONE);
notification.audioAttributes = audioAttributes.build();
- notification.vibrate = VIBRATE_PATTERN;
+ if (mDialerRingtoneManager.shouldVibrate(mContext.getContentResolver())) {
+ notification.vibrate = VIBRATE_PATTERN;
+ }
}
if (mDialerRingtoneManager.shouldPlayCallWaitingTone(callState)) {
Log.v(this, "Playing call waiting tone");
diff --git a/InCallUI/src/com/android/incallui/VideoPauseController.java b/InCallUI/src/com/android/incallui/VideoPauseController.java
index a529d20d3..01b6b0dea 100644
--- a/InCallUI/src/com/android/incallui/VideoPauseController.java
+++ b/InCallUI/src/com/android/incallui/VideoPauseController.java
@@ -23,6 +23,8 @@ import com.android.incallui.InCallPresenter.IncomingCallListener;
import com.android.incallui.InCallVideoCallCallbackNotifier.SessionModificationListener;
import com.google.common.base.Preconditions;
+import android.telecom.VideoProfile;
+
/**
* This class is responsible for generating video pause/resume requests when the InCall UI is sent
* to the background and subsequently brought back to the foreground.
@@ -192,10 +194,11 @@ class VideoPauseController implements InCallStateListener, IncomingCallListener
Preconditions.checkState(!areSame(call, mPrimaryCallContext));
final boolean canVideoPause = VideoUtils.canVideoPause(call);
- if ((isIncomingCall(mPrimaryCallContext) || isDialing(mPrimaryCallContext))
+ if ((isIncomingCall(mPrimaryCallContext) || isDialing(mPrimaryCallContext) ||
+ (call != null && VideoProfile.isPaused(call.getVideoState())))
&& canVideoPause && !mIsInBackground) {
- // Send resume request for the active call, if user rejects incoming call or ends
- // dialing call and UI is in the foreground.
+ // Send resume request for the active call, if user rejects incoming call, ends dialing
+ // call, or the call was previously in a paused state and UI is in the foreground.
sendRequest(call, true);
} else if (isIncomingCall(call) && canVideoPause(mPrimaryCallContext)) {
// Send pause request if there is an active video call, and we just received a new
diff --git a/InCallUI/src/com/android/incallui/ringtone/DialerRingtoneManager.java b/InCallUI/src/com/android/incallui/ringtone/DialerRingtoneManager.java
index 38b37a263..39844e5a2 100644
--- a/InCallUI/src/com/android/incallui/ringtone/DialerRingtoneManager.java
+++ b/InCallUI/src/com/android/incallui/ringtone/DialerRingtoneManager.java
@@ -18,7 +18,9 @@ package com.android.incallui.ringtone;
import com.google.common.base.Preconditions;
+import android.content.ContentResolver;
import android.net.Uri;
+import android.provider.Settings;
import android.support.annotation.Nullable;
import com.android.contacts.common.compat.CompatUtils;
@@ -37,7 +39,7 @@ public class DialerRingtoneManager {
* Flag used to determine if the Dialer is responsible for playing ringtones for incoming calls.
* Once we're ready to enable Dialer Ringing, these flags should be removed.
*/
- private static final boolean IS_DIALER_RINGING_ENABLED = true;
+ private static final boolean IS_DIALER_RINGING_ENABLED = false;
private Boolean mIsDialerRingingEnabledForTesting;
private final InCallTonePlayer mInCallTonePlayer;
@@ -70,6 +72,17 @@ public class DialerRingtoneManager {
}
/**
+ * Determines if an incoming call should vibrate as well as ring.
+ *
+ * @param resolver {@link ContentResolver} used to look up the
+ * {@link Settings.System#VIBRATE_WHEN_RINGING} setting.
+ * @return {@code true} if the call should vibrate, {@code false} otherwise.
+ */
+ public boolean shouldVibrate(ContentResolver resolver) {
+ return Settings.System.getInt(resolver, Settings.System.VIBRATE_WHEN_RINGING, 0) != 0;
+ }
+
+ /**
* The incoming callState is never set as {@link State#CALL_WAITING} because
* {@link Call#translateState(int)} doesn't account for that case, check for it here
*/