summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--InCallUI/src/com/android/incallui/AudioModeProvider.java17
-rw-r--r--InCallUI/src/com/android/incallui/CallButtonFragment.java55
-rw-r--r--InCallUI/src/com/android/incallui/CallButtonPresenter.java27
-rw-r--r--InCallUI/src/com/android/incallui/InCallServiceImpl.java5
-rw-r--r--InCallUI/src/com/android/incallui/ProximitySensor.java14
5 files changed, 70 insertions, 48 deletions
diff --git a/InCallUI/src/com/android/incallui/AudioModeProvider.java b/InCallUI/src/com/android/incallui/AudioModeProvider.java
index e7ffecca7..961fb11ff 100644
--- a/InCallUI/src/com/android/incallui/AudioModeProvider.java
+++ b/InCallUI/src/com/android/incallui/AudioModeProvider.java
@@ -16,10 +16,10 @@
package com.android.incallui;
-import android.telecom.CallAudioState;
-
import com.google.common.collect.Lists;
+import com.android.dialer.compat.CallAudioStateCompat;
+
import java.util.List;
/**
@@ -30,19 +30,20 @@ public class AudioModeProvider {
static final int AUDIO_MODE_INVALID = 0;
private static AudioModeProvider sAudioModeProvider = new AudioModeProvider();
- private int mAudioMode = CallAudioState.ROUTE_EARPIECE;
+ private int mAudioMode = CallAudioStateCompat.ROUTE_EARPIECE;
private boolean mMuted = false;
- private int mSupportedModes = CallAudioState.ROUTE_EARPIECE | CallAudioState.ROUTE_BLUETOOTH |
- CallAudioState.ROUTE_WIRED_HEADSET | CallAudioState.ROUTE_SPEAKER;
+ private int mSupportedModes = CallAudioStateCompat.ROUTE_EARPIECE
+ | CallAudioStateCompat.ROUTE_BLUETOOTH | CallAudioStateCompat.ROUTE_WIRED_HEADSET
+ | CallAudioStateCompat.ROUTE_SPEAKER;
private final List<AudioModeListener> mListeners = Lists.newArrayList();
public static AudioModeProvider getInstance() {
return sAudioModeProvider;
}
- public void onAudioStateChanged(CallAudioState audioState) {
- onAudioModeChange(audioState.getRoute(), audioState.isMuted());
- onSupportedAudioModeChange(audioState.getSupportedRouteMask());
+ public void onAudioStateChanged(boolean isMuted, int route, int supportedRouteMask) {
+ onAudioModeChange(route, isMuted);
+ onSupportedAudioModeChange(supportedRouteMask);
}
public void onAudioModeChange(int newMode, boolean muted) {
diff --git a/InCallUI/src/com/android/incallui/CallButtonFragment.java b/InCallUI/src/com/android/incallui/CallButtonFragment.java
index 1d32d8f1d..653847486 100644
--- a/InCallUI/src/com/android/incallui/CallButtonFragment.java
+++ b/InCallUI/src/com/android/incallui/CallButtonFragment.java
@@ -16,18 +16,28 @@
package com.android.incallui;
-import static com.android.incallui.CallButtonFragment.Buttons.*;
+import static com.android.incallui.CallButtonFragment.Buttons.BUTTON_ADD_CALL;
+import static com.android.incallui.CallButtonFragment.Buttons.BUTTON_AUDIO;
+import static com.android.incallui.CallButtonFragment.Buttons.BUTTON_COUNT;
+import static com.android.incallui.CallButtonFragment.Buttons.BUTTON_DIALPAD;
+import static com.android.incallui.CallButtonFragment.Buttons.BUTTON_HOLD;
+import static com.android.incallui.CallButtonFragment.Buttons.BUTTON_MANAGE_VIDEO_CONFERENCE;
+import static com.android.incallui.CallButtonFragment.Buttons.BUTTON_MERGE;
+import static com.android.incallui.CallButtonFragment.Buttons.BUTTON_MUTE;
+import static com.android.incallui.CallButtonFragment.Buttons.BUTTON_PAUSE_VIDEO;
+import static com.android.incallui.CallButtonFragment.Buttons.BUTTON_SWAP;
+import static com.android.incallui.CallButtonFragment.Buttons.BUTTON_SWITCH_CAMERA;
+import static com.android.incallui.CallButtonFragment.Buttons.BUTTON_UPGRADE_TO_VIDEO;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
-import android.graphics.drawable.LayerDrawable;
import android.graphics.drawable.GradientDrawable;
+import android.graphics.drawable.LayerDrawable;
import android.graphics.drawable.RippleDrawable;
import android.graphics.drawable.StateListDrawable;
import android.os.Bundle;
-import android.telecom.CallAudioState;
import android.util.SparseIntArray;
import android.view.ContextThemeWrapper;
import android.view.HapticFeedbackConstants;
@@ -43,6 +53,7 @@ import android.widget.PopupMenu.OnDismissListener;
import android.widget.PopupMenu.OnMenuItemClickListener;
import com.android.contacts.common.util.MaterialColorMapUtils.MaterialPalette;
+import com.android.dialer.compat.CallAudioStateCompat;
/**
* Fragment for call control buttons
@@ -516,20 +527,20 @@ public class CallButtonFragment
Log.d(this, " id: " + item.getItemId());
Log.d(this, " title: '" + item.getTitle() + "'");
- int mode = CallAudioState.ROUTE_WIRED_OR_EARPIECE;
+ int mode = CallAudioStateCompat.ROUTE_WIRED_OR_EARPIECE;
switch (item.getItemId()) {
case R.id.audio_mode_speaker:
- mode = CallAudioState.ROUTE_SPEAKER;
+ mode = CallAudioStateCompat.ROUTE_SPEAKER;
break;
case R.id.audio_mode_earpiece:
case R.id.audio_mode_wired_headset:
// InCallCallAudioState.ROUTE_EARPIECE means either the handset earpiece,
// or the wired headset (if connected.)
- mode = CallAudioState.ROUTE_WIRED_OR_EARPIECE;
+ mode = CallAudioStateCompat.ROUTE_WIRED_OR_EARPIECE;
break;
case R.id.audio_mode_bluetooth:
- mode = CallAudioState.ROUTE_BLUETOOTH;
+ mode = CallAudioStateCompat.ROUTE_BLUETOOTH;
break;
default:
Log.e(this, "onMenuItemClick: unexpected View ID " + item.getItemId()
@@ -559,9 +570,9 @@ public class CallButtonFragment
*/
private void onAudioButtonClicked() {
Log.d(this, "onAudioButtonClicked: " +
- CallAudioState.audioRouteToString(getPresenter().getSupportedAudio()));
+ CallAudioStateCompat.audioRouteToString(getPresenter().getSupportedAudio()));
- if (isSupported(CallAudioState.ROUTE_BLUETOOTH)) {
+ if (isSupported(CallAudioStateCompat.ROUTE_BLUETOOTH)) {
showAudioModePopup();
} else {
getPresenter().toggleSpeakerphone();
@@ -596,8 +607,8 @@ public class CallButtonFragment
* are visible based on the supported audio formats.
*/
private void updateAudioButtons(int supportedModes) {
- final boolean bluetoothSupported = isSupported(CallAudioState.ROUTE_BLUETOOTH);
- final boolean speakerSupported = isSupported(CallAudioState.ROUTE_SPEAKER);
+ final boolean bluetoothSupported = isSupported(CallAudioStateCompat.ROUTE_BLUETOOTH);
+ final boolean speakerSupported = isSupported(CallAudioStateCompat.ROUTE_SPEAKER);
boolean audioButtonEnabled = false;
boolean audioButtonChecked = false;
@@ -617,9 +628,9 @@ public class CallButtonFragment
showMoreIndicator = true;
// Update desired layers:
- if (isAudio(CallAudioState.ROUTE_BLUETOOTH)) {
+ if (isAudio(CallAudioStateCompat.ROUTE_BLUETOOTH)) {
showBluetoothIcon = true;
- } else if (isAudio(CallAudioState.ROUTE_SPEAKER)) {
+ } else if (isAudio(CallAudioStateCompat.ROUTE_SPEAKER)) {
showSpeakerphoneIcon = true;
} else {
showHandsetIcon = true;
@@ -638,7 +649,7 @@ public class CallButtonFragment
// The audio button *is* a toggle in this state, and indicated the
// current state of the speakerphone.
- audioButtonChecked = isAudio(CallAudioState.ROUTE_SPEAKER);
+ audioButtonChecked = isAudio(CallAudioStateCompat.ROUTE_SPEAKER);
mAudioButton.setSelected(audioButtonChecked);
// update desired layers:
@@ -699,20 +710,20 @@ public class CallButtonFragment
// If bluetooth is not supported, the audio buttion will toggle, so use the label "speaker".
// Otherwise, use the label of the currently selected audio mode.
- if (!isSupported(CallAudioState.ROUTE_BLUETOOTH)) {
+ if (!isSupported(CallAudioStateCompat.ROUTE_BLUETOOTH)) {
stringId = R.string.audio_mode_speaker;
} else {
switch (mode) {
- case CallAudioState.ROUTE_EARPIECE:
+ case CallAudioStateCompat.ROUTE_EARPIECE:
stringId = R.string.audio_mode_earpiece;
break;
- case CallAudioState.ROUTE_BLUETOOTH:
+ case CallAudioStateCompat.ROUTE_BLUETOOTH:
stringId = R.string.audio_mode_bluetooth;
break;
- case CallAudioState.ROUTE_WIRED_HEADSET:
+ case CallAudioStateCompat.ROUTE_WIRED_HEADSET:
stringId = R.string.audio_mode_wired_headset;
break;
- case CallAudioState.ROUTE_SPEAKER:
+ case CallAudioStateCompat.ROUTE_SPEAKER:
stringId = R.string.audio_mode_speaker;
break;
}
@@ -742,7 +753,7 @@ public class CallButtonFragment
// See comments below for the exact logic.
final MenuItem speakerItem = menu.findItem(R.id.audio_mode_speaker);
- speakerItem.setEnabled(isSupported(CallAudioState.ROUTE_SPEAKER));
+ speakerItem.setEnabled(isSupported(CallAudioStateCompat.ROUTE_SPEAKER));
// TODO: Show speakerItem as initially "selected" if
// speaker is on.
@@ -751,7 +762,7 @@ public class CallButtonFragment
final MenuItem earpieceItem = menu.findItem(R.id.audio_mode_earpiece);
final MenuItem wiredHeadsetItem = menu.findItem(R.id.audio_mode_wired_headset);
- final boolean usingHeadset = isSupported(CallAudioState.ROUTE_WIRED_HEADSET);
+ final boolean usingHeadset = isSupported(CallAudioStateCompat.ROUTE_WIRED_HEADSET);
earpieceItem.setVisible(!usingHeadset);
earpieceItem.setEnabled(!usingHeadset);
wiredHeadsetItem.setVisible(usingHeadset);
@@ -761,7 +772,7 @@ public class CallButtonFragment
// bluetoothIndicatorOn are both false.
final MenuItem bluetoothItem = menu.findItem(R.id.audio_mode_bluetooth);
- bluetoothItem.setEnabled(isSupported(CallAudioState.ROUTE_BLUETOOTH));
+ bluetoothItem.setEnabled(isSupported(CallAudioStateCompat.ROUTE_BLUETOOTH));
// TODO: Show bluetoothItem as initially "selected" if
// bluetoothIndicatorOn is true.
diff --git a/InCallUI/src/com/android/incallui/CallButtonPresenter.java b/InCallUI/src/com/android/incallui/CallButtonPresenter.java
index b0adafdb9..5375b5b5d 100644
--- a/InCallUI/src/com/android/incallui/CallButtonPresenter.java
+++ b/InCallUI/src/com/android/incallui/CallButtonPresenter.java
@@ -16,23 +16,30 @@
package com.android.incallui;
-import static com.android.incallui.CallButtonFragment.Buttons.*;
+import static com.android.incallui.CallButtonFragment.Buttons.BUTTON_ADD_CALL;
+import static com.android.incallui.CallButtonFragment.Buttons.BUTTON_AUDIO;
+import static com.android.incallui.CallButtonFragment.Buttons.BUTTON_DIALPAD;
+import static com.android.incallui.CallButtonFragment.Buttons.BUTTON_HOLD;
+import static com.android.incallui.CallButtonFragment.Buttons.BUTTON_MERGE;
+import static com.android.incallui.CallButtonFragment.Buttons.BUTTON_MUTE;
+import static com.android.incallui.CallButtonFragment.Buttons.BUTTON_PAUSE_VIDEO;
+import static com.android.incallui.CallButtonFragment.Buttons.BUTTON_SWAP;
+import static com.android.incallui.CallButtonFragment.Buttons.BUTTON_SWITCH_CAMERA;
+import static com.android.incallui.CallButtonFragment.Buttons.BUTTON_UPGRADE_TO_VIDEO;
import android.content.Context;
import android.os.Bundle;
-import android.telecom.CallAudioState;
import android.telecom.InCallService.VideoCall;
import android.telecom.VideoProfile;
+import com.android.dialer.compat.CallAudioStateCompat;
import com.android.incallui.AudioModeProvider.AudioModeListener;
import com.android.incallui.InCallCameraManager.Listener;
import com.android.incallui.InCallPresenter.CanAddCallListener;
+import com.android.incallui.InCallPresenter.InCallDetailsListener;
import com.android.incallui.InCallPresenter.InCallState;
import com.android.incallui.InCallPresenter.InCallStateListener;
import com.android.incallui.InCallPresenter.IncomingCallListener;
-import com.android.incallui.InCallPresenter.InCallDetailsListener;
-
-import java.util.Objects;
/**
* Logic for call buttons.
@@ -177,7 +184,7 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto
// an update for onAudioMode(). This will make UI response immediate
// if it turns out to be slow
- Log.d(this, "Sending new Audio Mode: " + CallAudioState.audioRouteToString(mode));
+ Log.d(this, "Sending new Audio Mode: " + CallAudioStateCompat.audioRouteToString(mode));
TelecomAdapter.getInstance().setAudioRoute(mode);
}
@@ -186,7 +193,7 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto
*/
public void toggleSpeakerphone() {
// this function should not be called if bluetooth is available
- if (0 != (CallAudioState.ROUTE_BLUETOOTH & getSupportedAudio())) {
+ if (0 != (CallAudioStateCompat.ROUTE_BLUETOOTH & getSupportedAudio())) {
// It's clear the UI is wrong, so update the supported mode once again.
Log.e(this, "toggling speakerphone not allowed when bluetooth supported.");
@@ -194,11 +201,11 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto
return;
}
- int newMode = CallAudioState.ROUTE_SPEAKER;
+ int newMode = CallAudioStateCompat.ROUTE_SPEAKER;
// if speakerphone is already on, change to wired/earpiece
- if (getAudioMode() == CallAudioState.ROUTE_SPEAKER) {
- newMode = CallAudioState.ROUTE_WIRED_OR_EARPIECE;
+ if (getAudioMode() == CallAudioStateCompat.ROUTE_SPEAKER) {
+ newMode = CallAudioStateCompat.ROUTE_WIRED_OR_EARPIECE;
}
setAudioMode(newMode);
diff --git a/InCallUI/src/com/android/incallui/InCallServiceImpl.java b/InCallUI/src/com/android/incallui/InCallServiceImpl.java
index 11202e7a3..3e4f71461 100644
--- a/InCallUI/src/com/android/incallui/InCallServiceImpl.java
+++ b/InCallUI/src/com/android/incallui/InCallServiceImpl.java
@@ -23,6 +23,7 @@ import android.telecom.Call;
import android.telecom.CallAudioState;
import android.telecom.InCallService;
+import com.android.dialer.compat.CallAudioStateCompat;
import com.android.dialer.database.FilteredNumberAsyncQueryHandler;
/**
@@ -33,9 +34,11 @@ import com.android.dialer.database.FilteredNumberAsyncQueryHandler;
*/
public class InCallServiceImpl extends InCallService {
+ // TODO CallAudioState backporting blocked by InCallService backporting
@Override
public void onCallAudioStateChanged(CallAudioState audioState) {
- AudioModeProvider.getInstance().onAudioStateChanged(audioState);
+ AudioModeProvider.getInstance().onAudioStateChanged(audioState.isMuted(),
+ audioState.getRoute(), audioState.getSupportedRouteMask());
}
@Override
diff --git a/InCallUI/src/com/android/incallui/ProximitySensor.java b/InCallUI/src/com/android/incallui/ProximitySensor.java
index 401ebd129..733a67d5d 100644
--- a/InCallUI/src/com/android/incallui/ProximitySensor.java
+++ b/InCallUI/src/com/android/incallui/ProximitySensor.java
@@ -16,20 +16,20 @@
package com.android.incallui;
+import com.google.common.base.Objects;
+
import android.content.Context;
import android.content.res.Configuration;
import android.hardware.display.DisplayManager;
import android.hardware.display.DisplayManager.DisplayListener;
import android.os.PowerManager;
-import android.telecom.CallAudioState;
import android.view.Display;
+import com.android.dialer.compat.CallAudioStateCompat;
import com.android.incallui.AudioModeProvider.AudioModeListener;
import com.android.incallui.InCallPresenter.InCallState;
import com.android.incallui.InCallPresenter.InCallStateListener;
-import com.google.common.base.Objects;
-
/**
* Class manages the proximity sensor for the in-call UI.
* We enable the proximity sensor while the user in a phone call. The Proximity sensor turns off
@@ -228,9 +228,9 @@ public class ProximitySensor implements AccelerometerListener.OrientationListene
// turn proximity sensor off and turn screen on immediately if
// we are using a headset, the keyboard is open, or the device
// is being held in a horizontal position.
- boolean screenOnImmediately = (CallAudioState.ROUTE_WIRED_HEADSET == audioMode
- || CallAudioState.ROUTE_SPEAKER == audioMode
- || CallAudioState.ROUTE_BLUETOOTH == audioMode
+ boolean screenOnImmediately = (CallAudioStateCompat.ROUTE_WIRED_HEADSET == audioMode
+ || CallAudioStateCompat.ROUTE_SPEAKER == audioMode
+ || CallAudioStateCompat.ROUTE_BLUETOOTH == audioMode
|| mIsHardKeyboardOpen);
// We do not keep the screen off when the user is outside in-call screen and we are
@@ -254,7 +254,7 @@ public class ProximitySensor implements AccelerometerListener.OrientationListene
.add("offhook", mIsPhoneOffhook ? 1 : 0)
.add("hor", horizontal ? 1 : 0)
.add("ui", mUiShowing ? 1 : 0)
- .add("aud", CallAudioState.audioRouteToString(audioMode))
+ .add("aud", CallAudioStateCompat.audioRouteToString(audioMode))
.toString());
if (mIsPhoneOffhook && !screenOnImmediately) {