summaryrefslogtreecommitdiff
path: root/InCallUI
diff options
context:
space:
mode:
Diffstat (limited to 'InCallUI')
-rw-r--r--InCallUI/res/layout/call_button_fragment.xml2
-rw-r--r--InCallUI/res/values/strings.xml6
-rw-r--r--InCallUI/src/com/android/incallui/CallButtonFragment.java21
-rw-r--r--InCallUI/src/com/android/incallui/CallButtonPresenter.java4
-rw-r--r--InCallUI/src/com/android/incallui/CallerInfoAsyncQuery.java2
-rw-r--r--InCallUI/src/com/android/incallui/StatusBarNotifier.java7
-rw-r--r--InCallUI/src/com/android/incallui/VideoCallFragment.java3
-rw-r--r--InCallUI/src/com/android/incallui/VideoCallPresenter.java48
-rw-r--r--InCallUI/src/com/android/incallui/VideoUtils.java8
9 files changed, 63 insertions, 38 deletions
diff --git a/InCallUI/res/layout/call_button_fragment.xml b/InCallUI/res/layout/call_button_fragment.xml
index 6dbfbf73a..802e3de62 100644
--- a/InCallUI/res/layout/call_button_fragment.xml
+++ b/InCallUI/res/layout/call_button_fragment.xml
@@ -126,7 +126,7 @@
<ToggleButton android:id="@+id/pauseVideoButton"
style="@style/InCallCompoundButton"
android:background="@drawable/btn_compound_video_off"
- android:contentDescription="@string/onscreenPauseVideoText"
+ android:contentDescription="@string/onscreenTurnOffCameraText"
android:visibility="gone" />
<!-- "Change to audio call" for video calls. -->
diff --git a/InCallUI/res/values/strings.xml b/InCallUI/res/values/strings.xml
index 57a1b5389..7701cdb2d 100644
--- a/InCallUI/res/values/strings.xml
+++ b/InCallUI/res/values/strings.xml
@@ -313,8 +313,10 @@
<!-- Text for the onscreen "Switch camera" button. When clicked, this switches the user's camera
for video calling between the front-facing camera and the back-facing camera. -->
<string name="onscreenSwitchCameraText">Switch camera</string>
- <!-- Text for the onscreen "Pause video" button. -->
- <string name="onscreenPauseVideoText">Pause video</string>
+ <!-- Text for the onscreen "turn on camera" button. -->
+ <string name="onscreenTurnOnCameraText">Turn on camera</string>
+ <!-- Text for the onscreen "turn off camera" button. -->
+ <string name="onscreenTurnOffCameraText">Turn off camera</string>
<!-- Text for the onscreen overflow button, to see additional actions which can be done. -->
<string name="onscreenOverflowText">More options</string>
diff --git a/InCallUI/src/com/android/incallui/CallButtonFragment.java b/InCallUI/src/com/android/incallui/CallButtonFragment.java
index 5a25b6a7b..6b633eaf3 100644
--- a/InCallUI/src/com/android/incallui/CallButtonFragment.java
+++ b/InCallUI/src/com/android/incallui/CallButtonFragment.java
@@ -65,7 +65,6 @@ public class CallButtonFragment
implements CallButtonPresenter.CallButtonUi, OnMenuItemClickListener, OnDismissListener,
View.OnClickListener {
- private static final int INVALID_INDEX = -1;
private int mButtonMaxVisible;
// The button is currently visible in the UI
private static final int BUTTON_VISIBLE = 1;
@@ -182,7 +181,7 @@ public class CallButtonFragment
super.onActivityCreated(savedInstanceState);
// set the buttons
- updateAudioButtons(getPresenter().getSupportedAudio());
+ updateAudioButtons();
}
@Override
@@ -425,8 +424,14 @@ public class CallButtonFragment
}
@Override
- public void setVideoPaused(boolean isPaused) {
- mPauseVideoButton.setSelected(isPaused);
+ public void setVideoPaused(boolean isVideoPaused) {
+ mPauseVideoButton.setSelected(isVideoPaused);
+
+ if (isVideoPaused) {
+ mPauseVideoButton.setContentDescription(getText(R.string.onscreenTurnOnCameraText));
+ } else {
+ mPauseVideoButton.setContentDescription(getText(R.string.onscreenTurnOffCameraText));
+ }
}
@Override
@@ -505,7 +510,7 @@ public class CallButtonFragment
@Override
public void setAudio(int mode) {
- updateAudioButtons(getPresenter().getSupportedAudio());
+ updateAudioButtons();
refreshAudioModePopup();
if (mPrevAudioMode != mode) {
@@ -516,7 +521,7 @@ public class CallButtonFragment
@Override
public void setSupportedAudio(int modeMask) {
- updateAudioButtons(modeMask);
+ updateAudioButtons();
refreshAudioModePopup();
}
@@ -555,7 +560,7 @@ public class CallButtonFragment
public void onDismiss(PopupMenu menu) {
Log.d(this, "- onDismiss: " + menu);
mAudioModePopupVisible = false;
- updateAudioButtons(getPresenter().getSupportedAudio());
+ updateAudioButtons();
}
/**
@@ -600,7 +605,7 @@ public class CallButtonFragment
* Updates the audio button so that the appriopriate visual layers
* are visible based on the supported audio formats.
*/
- private void updateAudioButtons(int supportedModes) {
+ private void updateAudioButtons() {
final boolean bluetoothSupported = isSupported(CallAudioState.ROUTE_BLUETOOTH);
final boolean speakerSupported = isSupported(CallAudioState.ROUTE_SPEAKER);
diff --git a/InCallUI/src/com/android/incallui/CallButtonPresenter.java b/InCallUI/src/com/android/incallui/CallButtonPresenter.java
index e8c2d4b13..df1cd6645 100644
--- a/InCallUI/src/com/android/incallui/CallButtonPresenter.java
+++ b/InCallUI/src/com/android/incallui/CallButtonPresenter.java
@@ -366,7 +366,6 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto
private void updateButtonsState(Call call) {
Log.v(this, "updateButtonsState");
final CallButtonUi ui = getUi();
-
final boolean isVideo = VideoUtils.isVideoCall(call);
// Common functionality (audio, hold, etc).
@@ -398,6 +397,9 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto
ui.showButton(BUTTON_DOWNGRADE_TO_AUDIO, showDowngradeToAudio);
ui.showButton(BUTTON_SWITCH_CAMERA, isVideo);
ui.showButton(BUTTON_PAUSE_VIDEO, isVideo);
+ if (isVideo) {
+ getUi().setVideoPaused(!VideoUtils.isTransmissionEnabled(call));
+ }
ui.showButton(BUTTON_DIALPAD, true);
ui.showButton(BUTTON_MERGE, showMerge);
diff --git a/InCallUI/src/com/android/incallui/CallerInfoAsyncQuery.java b/InCallUI/src/com/android/incallui/CallerInfoAsyncQuery.java
index 2839fbbf0..f7f0cbb5d 100644
--- a/InCallUI/src/com/android/incallui/CallerInfoAsyncQuery.java
+++ b/InCallUI/src/com/android/incallui/CallerInfoAsyncQuery.java
@@ -473,7 +473,7 @@ public class CallerInfoAsyncQuery {
int idIndex = cursor.getColumnIndex(Directory._ID);
while (cursor.moveToNext()) {
long id = cursor.getLong(idIndex);
- if (DirectoryCompat.isRemoteDirectory(id)) {
+ if (DirectoryCompat.isRemoteDirectoryId(id)) {
results.add(id);
}
}
diff --git a/InCallUI/src/com/android/incallui/StatusBarNotifier.java b/InCallUI/src/com/android/incallui/StatusBarNotifier.java
index 7d212aa8e..a61620317 100644
--- a/InCallUI/src/com/android/incallui/StatusBarNotifier.java
+++ b/InCallUI/src/com/android/incallui/StatusBarNotifier.java
@@ -247,8 +247,11 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener,
getContentString(call, contactInfo.userType);
final String contentTitle = getContentTitle(contactInfo, call);
+ final boolean isVideoUpgradeRequest = call.getSessionModificationState()
+ == Call.SessionModificationState.RECEIVED_UPGRADE_TO_VIDEO_REQUEST;
final int notificationType;
- if (callState == Call.State.INCOMING || callState == Call.State.CALL_WAITING) {
+ if (callState == Call.State.INCOMING || callState == Call.State.CALL_WAITING
+ || isVideoUpgradeRequest) {
notificationType = NOTIFICATION_INCOMING_CALL;
} else {
notificationType = NOTIFICATION_IN_CALL;
@@ -301,8 +304,6 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener,
builder.setLargeIcon(largeIcon);
builder.setColor(mContext.getResources().getColor(R.color.dialer_theme_color));
- final boolean isVideoUpgradeRequest = call.getSessionModificationState()
- == Call.SessionModificationState.RECEIVED_UPGRADE_TO_VIDEO_REQUEST;
if (isVideoUpgradeRequest) {
builder.setUsesChronometer(false);
addDismissUpgradeRequestAction(builder);
diff --git a/InCallUI/src/com/android/incallui/VideoCallFragment.java b/InCallUI/src/com/android/incallui/VideoCallFragment.java
index cb8c6449b..2e65f81b4 100644
--- a/InCallUI/src/com/android/incallui/VideoCallFragment.java
+++ b/InCallUI/src/com/android/incallui/VideoCallFragment.java
@@ -499,6 +499,7 @@ public class VideoCallFragment extends BaseFragment<VideoCallPresenter,
public void onPause() {
super.onPause();
Log.d(this, "onPause:");
+ getPresenter().cancelAutoFullScreen();
}
@Override
@@ -549,6 +550,7 @@ public class VideoCallFragment extends BaseFragment<VideoCallPresenter,
* Hides and shows the incoming video view and changes the outgoing video view's state based on
* whether outgoing view is enabled or not.
*/
+ @Override
public void showVideoViews(boolean previewPaused, boolean showIncoming) {
inflateVideoUi(true);
@@ -567,6 +569,7 @@ public class VideoCallFragment extends BaseFragment<VideoCallPresenter,
/**
* Hide all video views.
*/
+ @Override
public void hideVideoUi() {
inflateVideoUi(false);
}
diff --git a/InCallUI/src/com/android/incallui/VideoCallPresenter.java b/InCallUI/src/com/android/incallui/VideoCallPresenter.java
index 9a33d80eb..7617608d1 100644
--- a/InCallUI/src/com/android/incallui/VideoCallPresenter.java
+++ b/InCallUI/src/com/android/incallui/VideoCallPresenter.java
@@ -81,7 +81,9 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
private Runnable mAutoFullscreenRunnable = new Runnable() {
@Override
public void run() {
- if (mAutoFullScreenPending && !InCallPresenter.getInstance().isDialpadVisible()) {
+ if (mAutoFullScreenPending && !InCallPresenter.getInstance().isDialpadVisible()
+ && mIsVideoMode) {
+
Log.v(this, "Automatically entering fullscreen mode.");
InCallPresenter.getInstance().setFullScreen(true);
mAutoFullScreenPending = false;
@@ -258,6 +260,8 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
return;
}
+ cancelAutoFullScreen();
+
InCallPresenter.getInstance().removeListener(this);
InCallPresenter.getInstance().removeDetailsListener(this);
InCallPresenter.getInstance().removeIncomingCallListener(this);
@@ -495,7 +499,7 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
updateCameraSelection(call);
if (isVideoCall) {
- enterVideoMode(call);
+ adjustVideoMode(call);
} else if (isVideoMode()) {
exitVideoMode();
}
@@ -555,7 +559,7 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
Log.d(this, "onPrimaryCallChanged: Entering video mode...");
updateCameraSelection(newPrimaryCall);
- enterVideoMode(newPrimaryCall);
+ adjustVideoMode(newPrimaryCall);
}
}
@@ -630,7 +634,7 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
* Handles a change to the video call. Sets the surfaces on the previous call to null and sets
* the surfaces on the new video call accordingly.
*
- * @param videoCall The new video call.
+ * @param call The new video call.
*/
private void changeVideoCall(Call call) {
final VideoCall videoCall = call.getTelecomCall().getVideoCall();
@@ -651,13 +655,13 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
}
if (VideoUtils.isVideoCall(call) && hasChanged) {
- enterVideoMode(call);
+ adjustVideoMode(call);
}
}
private static boolean isCameraRequired(int videoState) {
- return VideoProfile.isBidirectional(videoState) ||
- VideoProfile.isTransmissionEnabled(videoState);
+ return VideoProfile.isBidirectional(videoState)
+ || VideoProfile.isTransmissionEnabled(videoState);
}
private boolean isCameraRequired() {
@@ -665,14 +669,16 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
}
/**
- * Enters video mode by showing the video surfaces and making other adjustments (eg. audio).
+ * Adjusts the current video mode by setting up the preview and display surfaces as necessary.
+ * Expected to be called whenever the video state associated with a call changes (e.g. a user
+ * turns their camera on or off) to ensure the correct surfaces are shown/hidden.
* TODO(vt): Need to adjust size and orientation of preview surface here.
*/
- private void enterVideoMode(Call call) {
+ private void adjustVideoMode(Call call) {
VideoCall videoCall = call.getVideoCall();
int newVideoState = call.getVideoState();
- Log.d(this, "enterVideoMode videoCall= " + videoCall + " videoState: " + newVideoState);
+ Log.d(this, "adjustVideoMode videoCall= " + videoCall + " videoState: " + newVideoState);
VideoCallUi ui = getUi();
if (ui == null) {
Log.e(this, "Error VideoCallUi is null so returning");
@@ -692,16 +698,15 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
videoCall.setDeviceOrientation(mDeviceOrientation);
enableCamera(videoCall, isCameraRequired(newVideoState));
}
+ int previousVideoState = mCurrentVideoState;
mCurrentVideoState = newVideoState;
-
mIsVideoMode = true;
- maybeAutoEnterFullscreen(call);
- }
-
- private static boolean isSpeakerEnabledForVideoCalls() {
- // TODO: Make this a carrier configurable setting. For now this is always true. b/20090407
- return true;
+ // adjustVideoMode may be called if we are already in a 1-way video state. In this case
+ // we do not want to trigger auto-fullscreen mode.
+ if (!VideoUtils.isVideoCall(previousVideoState) && VideoUtils.isVideoCall(newVideoState)) {
+ maybeAutoEnterFullscreen(call);
+ }
}
private void enableCamera(VideoCall videoCall, boolean isCameraRequired) {
@@ -1068,6 +1073,8 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
* 2. Call is not active
* 3. Call is not video call
* 4. Already in fullscreen mode
+ * 5. The current video state is not bi-directional (if the remote party stops transmitting,
+ * the user's contact photo would dominate in fullscreen mode).
*
* @param call The current call.
*/
@@ -1079,7 +1086,8 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
if (call == null || (
call != null && (call.getState() != Call.State.ACTIVE ||
!VideoUtils.isVideoCall(call)) ||
- InCallPresenter.getInstance().isFullscreen())) {
+ InCallPresenter.getInstance().isFullscreen()) ||
+ !VideoUtils.isBidirectionalVideoCall(call)) {
// Ensure any previously scheduled attempt to enter fullscreen is cancelled.
cancelAutoFullScreen();
return;
@@ -1106,10 +1114,6 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
mAutoFullScreenPending = false;
}
- private static boolean isAudioRouteEnabled(int audioRoute, int audioRouteMask) {
- return ((audioRoute & audioRouteMask) != 0);
- }
-
private static void updateCameraSelection(Call call) {
Log.d(TAG, "updateCameraSelection: call=" + call);
Log.d(TAG, "updateCameraSelection: call=" + toSimpleString(call));
diff --git a/InCallUI/src/com/android/incallui/VideoUtils.java b/InCallUI/src/com/android/incallui/VideoUtils.java
index 8641d60ec..a2eb8bcf2 100644
--- a/InCallUI/src/com/android/incallui/VideoUtils.java
+++ b/InCallUI/src/com/android/incallui/VideoUtils.java
@@ -45,6 +45,14 @@ public class VideoUtils {
return VideoProfile.isBidirectional(call.getVideoState());
}
+ public static boolean isTransmissionEnabled(Call call) {
+ if (!CompatUtils.isVideoCompatible()) {
+ return false;
+ }
+
+ return VideoProfile.isTransmissionEnabled(call.getVideoState());
+ }
+
public static boolean isIncomingVideoCall(Call call) {
if (!VideoUtils.isVideoCall(call)) {
return false;