diff options
author | Yorke Lee <yorkelee@google.com> | 2015-05-14 15:09:38 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-05-14 15:09:38 +0000 |
commit | d161a613e80ec5aace826ca195d5138ea30f4456 (patch) | |
tree | 0f3f9ac7bff9168a7091aa98daca6985edcbb400 /InCallUI | |
parent | 3bd33d916de77233d01b6ffb3f5cec17a3a23ea2 (diff) | |
parent | 5341e489d4d8c32e5da21ecd01f215423aa06bae (diff) |
am bb4c573f: Merge "Rename AudioState to CallAudioState" into mnc-dev
* commit 'bb4c573f102d86d79ed943d21e0a8d28d3ea0f84':
Rename AudioState to CallAudioState
Diffstat (limited to 'InCallUI')
6 files changed, 42 insertions, 41 deletions
diff --git a/InCallUI/src/com/android/incallui/AudioModeProvider.java b/InCallUI/src/com/android/incallui/AudioModeProvider.java index dab35d6cf..e7ffecca7 100644 --- a/InCallUI/src/com/android/incallui/AudioModeProvider.java +++ b/InCallUI/src/com/android/incallui/AudioModeProvider.java @@ -16,7 +16,7 @@ package com.android.incallui; -import android.telecom.AudioState; +import android.telecom.CallAudioState; import com.google.common.collect.Lists; @@ -30,17 +30,17 @@ public class AudioModeProvider { static final int AUDIO_MODE_INVALID = 0; private static AudioModeProvider sAudioModeProvider = new AudioModeProvider(); - private int mAudioMode = AudioState.ROUTE_EARPIECE; + private int mAudioMode = CallAudioState.ROUTE_EARPIECE; private boolean mMuted = false; - private int mSupportedModes = AudioState.ROUTE_EARPIECE | AudioState.ROUTE_BLUETOOTH | - AudioState.ROUTE_WIRED_HEADSET | AudioState.ROUTE_SPEAKER; + private int mSupportedModes = CallAudioState.ROUTE_EARPIECE | CallAudioState.ROUTE_BLUETOOTH | + CallAudioState.ROUTE_WIRED_HEADSET | CallAudioState.ROUTE_SPEAKER; private final List<AudioModeListener> mListeners = Lists.newArrayList(); public static AudioModeProvider getInstance() { return sAudioModeProvider; } - public void onAudioStateChanged(AudioState audioState) { + public void onAudioStateChanged(CallAudioState audioState) { onAudioModeChange(audioState.getRoute(), audioState.isMuted()); onSupportedAudioModeChange(audioState.getSupportedRouteMask()); } diff --git a/InCallUI/src/com/android/incallui/CallButtonFragment.java b/InCallUI/src/com/android/incallui/CallButtonFragment.java index 9def35694..0987cacc8 100644 --- a/InCallUI/src/com/android/incallui/CallButtonFragment.java +++ b/InCallUI/src/com/android/incallui/CallButtonFragment.java @@ -27,7 +27,7 @@ import android.graphics.drawable.GradientDrawable; import android.graphics.drawable.RippleDrawable; import android.graphics.drawable.StateListDrawable; import android.os.Bundle; -import android.telecom.AudioState; +import android.telecom.CallAudioState; import android.util.SparseIntArray; import android.view.ContextThemeWrapper; import android.view.HapticFeedbackConstants; @@ -514,20 +514,20 @@ public class CallButtonFragment Log.d(this, " id: " + item.getItemId()); Log.d(this, " title: '" + item.getTitle() + "'"); - int mode = AudioState.ROUTE_WIRED_OR_EARPIECE; + int mode = CallAudioState.ROUTE_WIRED_OR_EARPIECE; switch (item.getItemId()) { case R.id.audio_mode_speaker: - mode = AudioState.ROUTE_SPEAKER; + mode = CallAudioState.ROUTE_SPEAKER; break; case R.id.audio_mode_earpiece: case R.id.audio_mode_wired_headset: - // InCallAudioState.ROUTE_EARPIECE means either the handset earpiece, + // InCallCallAudioState.ROUTE_EARPIECE means either the handset earpiece, // or the wired headset (if connected.) - mode = AudioState.ROUTE_WIRED_OR_EARPIECE; + mode = CallAudioState.ROUTE_WIRED_OR_EARPIECE; break; case R.id.audio_mode_bluetooth: - mode = AudioState.ROUTE_BLUETOOTH; + mode = CallAudioState.ROUTE_BLUETOOTH; break; default: Log.e(this, "onMenuItemClick: unexpected View ID " + item.getItemId() @@ -557,9 +557,9 @@ public class CallButtonFragment */ private void onAudioButtonClicked() { Log.d(this, "onAudioButtonClicked: " + - AudioState.audioRouteToString(getPresenter().getSupportedAudio())); + CallAudioState.audioRouteToString(getPresenter().getSupportedAudio())); - if (isSupported(AudioState.ROUTE_BLUETOOTH)) { + if (isSupported(CallAudioState.ROUTE_BLUETOOTH)) { showAudioModePopup(); } else { getPresenter().toggleSpeakerphone(); @@ -594,8 +594,8 @@ public class CallButtonFragment * are visible based on the supported audio formats. */ private void updateAudioButtons(int supportedModes) { - final boolean bluetoothSupported = isSupported(AudioState.ROUTE_BLUETOOTH); - final boolean speakerSupported = isSupported(AudioState.ROUTE_SPEAKER); + final boolean bluetoothSupported = isSupported(CallAudioState.ROUTE_BLUETOOTH); + final boolean speakerSupported = isSupported(CallAudioState.ROUTE_SPEAKER); boolean audioButtonEnabled = false; boolean audioButtonChecked = false; @@ -615,9 +615,9 @@ public class CallButtonFragment showMoreIndicator = true; // Update desired layers: - if (isAudio(AudioState.ROUTE_BLUETOOTH)) { + if (isAudio(CallAudioState.ROUTE_BLUETOOTH)) { showBluetoothIcon = true; - } else if (isAudio(AudioState.ROUTE_SPEAKER)) { + } else if (isAudio(CallAudioState.ROUTE_SPEAKER)) { showSpeakerphoneIcon = true; } else { showHandsetIcon = true; @@ -636,7 +636,7 @@ public class CallButtonFragment // The audio button *is* a toggle in this state, and indicated the // current state of the speakerphone. - audioButtonChecked = isAudio(AudioState.ROUTE_SPEAKER); + audioButtonChecked = isAudio(CallAudioState.ROUTE_SPEAKER); mAudioButton.setSelected(audioButtonChecked); // update desired layers: @@ -697,20 +697,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(AudioState.ROUTE_BLUETOOTH)) { + if (!isSupported(CallAudioState.ROUTE_BLUETOOTH)) { stringId = R.string.audio_mode_speaker; } else { switch (mode) { - case AudioState.ROUTE_EARPIECE: + case CallAudioState.ROUTE_EARPIECE: stringId = R.string.audio_mode_earpiece; break; - case AudioState.ROUTE_BLUETOOTH: + case CallAudioState.ROUTE_BLUETOOTH: stringId = R.string.audio_mode_bluetooth; break; - case AudioState.ROUTE_WIRED_HEADSET: + case CallAudioState.ROUTE_WIRED_HEADSET: stringId = R.string.audio_mode_wired_headset; break; - case AudioState.ROUTE_SPEAKER: + case CallAudioState.ROUTE_SPEAKER: stringId = R.string.audio_mode_speaker; break; } @@ -740,7 +740,7 @@ public class CallButtonFragment // See comments below for the exact logic. final MenuItem speakerItem = menu.findItem(R.id.audio_mode_speaker); - speakerItem.setEnabled(isSupported(AudioState.ROUTE_SPEAKER)); + speakerItem.setEnabled(isSupported(CallAudioState.ROUTE_SPEAKER)); // TODO: Show speakerItem as initially "selected" if // speaker is on. @@ -749,7 +749,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(AudioState.ROUTE_WIRED_HEADSET); + final boolean usingHeadset = isSupported(CallAudioState.ROUTE_WIRED_HEADSET); earpieceItem.setVisible(!usingHeadset); earpieceItem.setEnabled(!usingHeadset); wiredHeadsetItem.setVisible(usingHeadset); @@ -759,7 +759,7 @@ public class CallButtonFragment // bluetoothIndicatorOn are both false. final MenuItem bluetoothItem = menu.findItem(R.id.audio_mode_bluetooth); - bluetoothItem.setEnabled(isSupported(AudioState.ROUTE_BLUETOOTH)); + bluetoothItem.setEnabled(isSupported(CallAudioState.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 d3614789f..4fc60cac8 100644 --- a/InCallUI/src/com/android/incallui/CallButtonPresenter.java +++ b/InCallUI/src/com/android/incallui/CallButtonPresenter.java @@ -20,7 +20,7 @@ import static com.android.incallui.CallButtonFragment.Buttons.*; import android.content.Context; import android.os.Bundle; -import android.telecom.AudioState; +import android.telecom.CallAudioState; import android.telecom.InCallService.VideoCall; import android.telecom.VideoProfile; @@ -176,7 +176,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: " + AudioState.audioRouteToString(mode)); + Log.d(this, "Sending new Audio Mode: " + CallAudioState.audioRouteToString(mode)); TelecomAdapter.getInstance().setAudioRoute(mode); } @@ -185,7 +185,7 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto */ public void toggleSpeakerphone() { // this function should not be called if bluetooth is available - if (0 != (AudioState.ROUTE_BLUETOOTH & getSupportedAudio())) { + if (0 != (CallAudioState.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."); @@ -193,11 +193,11 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto return; } - int newMode = AudioState.ROUTE_SPEAKER; + int newMode = CallAudioState.ROUTE_SPEAKER; // if speakerphone is already on, change to wired/earpiece - if (getAudioMode() == AudioState.ROUTE_SPEAKER) { - newMode = AudioState.ROUTE_WIRED_OR_EARPIECE; + if (getAudioMode() == CallAudioState.ROUTE_SPEAKER) { + newMode = CallAudioState.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 bbd1db0f7..1db703da8 100644 --- a/InCallUI/src/com/android/incallui/InCallServiceImpl.java +++ b/InCallUI/src/com/android/incallui/InCallServiceImpl.java @@ -21,6 +21,7 @@ import android.content.Intent; import android.os.IBinder; import android.telecom.AudioState; import android.telecom.Call; +import android.telecom.CallAudioState; import android.telecom.InCallService; /** @@ -32,7 +33,7 @@ import android.telecom.InCallService; public class InCallServiceImpl extends InCallService { @Override - public void onAudioStateChanged(AudioState audioState) { + public void onCallAudioStateChanged(CallAudioState audioState) { AudioModeProvider.getInstance().onAudioStateChanged(audioState); } diff --git a/InCallUI/src/com/android/incallui/ProximitySensor.java b/InCallUI/src/com/android/incallui/ProximitySensor.java index 7732c63b6..05a86d35c 100644 --- a/InCallUI/src/com/android/incallui/ProximitySensor.java +++ b/InCallUI/src/com/android/incallui/ProximitySensor.java @@ -19,7 +19,7 @@ package com.android.incallui; import android.content.Context; import android.content.res.Configuration; import android.os.PowerManager; -import android.telecom.AudioState; +import android.telecom.CallAudioState; import com.android.incallui.AudioModeProvider.AudioModeListener; import com.android.incallui.InCallPresenter.InCallState; @@ -210,9 +210,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 = (AudioState.ROUTE_WIRED_HEADSET == audioMode - || AudioState.ROUTE_SPEAKER == audioMode - || AudioState.ROUTE_BLUETOOTH == audioMode + boolean screenOnImmediately = (CallAudioState.ROUTE_WIRED_HEADSET == audioMode + || CallAudioState.ROUTE_SPEAKER == audioMode + || CallAudioState.ROUTE_BLUETOOTH == audioMode || mIsHardKeyboardOpen); // We do not keep the screen off when the user is outside in-call screen and we are @@ -236,7 +236,7 @@ public class ProximitySensor implements AccelerometerListener.OrientationListene .add("offhook", mIsPhoneOffhook ? 1 : 0) .add("hor", horizontal ? 1 : 0) .add("ui", mUiShowing ? 1 : 0) - .add("aud", AudioState.audioRouteToString(audioMode)) + .add("aud", CallAudioState.audioRouteToString(audioMode)) .toString()); if (mIsPhoneOffhook && !screenOnImmediately) { diff --git a/InCallUI/src/com/android/incallui/VideoCallPresenter.java b/InCallUI/src/com/android/incallui/VideoCallPresenter.java index c37a62140..ed7edf93c 100644 --- a/InCallUI/src/com/android/incallui/VideoCallPresenter.java +++ b/InCallUI/src/com/android/incallui/VideoCallPresenter.java @@ -25,7 +25,7 @@ import android.os.AsyncTask; import android.os.Handler; import android.os.Looper; import android.provider.ContactsContract; -import android.telecom.AudioState; +import android.telecom.CallAudioState; import android.telecom.Connection; import android.telecom.InCallService.VideoCall; import android.telecom.VideoProfile; @@ -712,12 +712,12 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi // Set audio mode to speaker if enableSpeaker is true and bluetooth or headset are not // connected and it's a video call. if (!isAudioRouteEnabled(currentAudioMode, - AudioState.ROUTE_BLUETOOTH | AudioState.ROUTE_WIRED_HEADSET) && + CallAudioState.ROUTE_BLUETOOTH | CallAudioState.ROUTE_WIRED_HEADSET) && !isPrevAudioModeValid && enableSpeaker && CallUtils.isVideoCall(mPrimaryCall)) { sPrevVideoAudioMode = currentAudioMode; Log.d(this, "Routing audio to speaker"); - telecomAdapter.setAudioRoute(AudioState.ROUTE_SPEAKER); + telecomAdapter.setAudioRoute(CallAudioState.ROUTE_SPEAKER); } } |