From 3718dcb345e77e421ab18a760e48f0c3a760fcca Mon Sep 17 00:00:00 2001 From: Ihab Awad Date: Thu, 7 Aug 2014 19:48:36 -0700 Subject: Final structural tweaks to Telecomm API (3/8) Bug: 16416927 Bug: 16494880 Change-Id: If756941a5bdd25ff8ac633a56fe90c894d4a46a4 --- .../src/com/android/incallui/AnswerPresenter.java | 4 +- .../com/android/incallui/AudioModeProvider.java | 8 +-- InCallUI/src/com/android/incallui/Call.java | 12 ++-- .../com/android/incallui/CallButtonFragment.java | 33 +++++----- .../com/android/incallui/CallButtonPresenter.java | 76 +++++++++++----------- .../src/com/android/incallui/CallCardFragment.java | 8 +-- .../com/android/incallui/CallCardPresenter.java | 13 ++-- InCallUI/src/com/android/incallui/CallerInfo.java | 1 - .../src/com/android/incallui/CallerInfoUtils.java | 17 +++-- .../src/com/android/incallui/ContactInfoCache.java | 12 ++-- .../src/com/android/incallui/GlowPadWrapper.java | 6 +- InCallUI/src/com/android/incallui/InCallApp.java | 8 +-- .../src/com/android/incallui/InCallPresenter.java | 24 +++---- .../android/incallui/InCallVideoCallListener.java | 37 ++++++----- .../src/com/android/incallui/ProximitySensor.java | 11 ++-- .../src/com/android/incallui/TelecommAdapter.java | 6 +- .../com/android/incallui/VideoCallPresenter.java | 7 +- 17 files changed, 139 insertions(+), 144 deletions(-) (limited to 'InCallUI/src/com') diff --git a/InCallUI/src/com/android/incallui/AnswerPresenter.java b/InCallUI/src/com/android/incallui/AnswerPresenter.java index 0616b7e0a..5b4e39abd 100644 --- a/InCallUI/src/com/android/incallui/AnswerPresenter.java +++ b/InCallUI/src/com/android/incallui/AnswerPresenter.java @@ -16,8 +16,8 @@ package com.android.incallui; +import android.telecomm.PhoneCapabilities; import android.content.Context; -import android.telecomm.CallCapabilities; import java.util.List; @@ -98,7 +98,7 @@ public class AnswerPresenter extends Presenter final List textMsgs = CallList.getInstance().getTextResponses(call.getId()); getUi().showAnswerUi(true); - boolean withSms = call.can(CallCapabilities.RESPOND_VIA_TEXT) && textMsgs != null; + boolean withSms = call.can(PhoneCapabilities.RESPOND_VIA_TEXT) && textMsgs != null; if (call.isVideoCall()) { if (withSms) { getUi().showTargets(AnswerFragment.TARGET_SET_FOR_VIDEO_WITH_SMS); diff --git a/InCallUI/src/com/android/incallui/AudioModeProvider.java b/InCallUI/src/com/android/incallui/AudioModeProvider.java index 2b61642c8..31ce9ebd7 100644 --- a/InCallUI/src/com/android/incallui/AudioModeProvider.java +++ b/InCallUI/src/com/android/incallui/AudioModeProvider.java @@ -18,7 +18,7 @@ package com.android.incallui; import com.google.common.collect.Lists; -import android.telecomm.CallAudioState; +import android.telecomm.AudioState; import android.telecomm.Phone; import java.util.List; @@ -31,15 +31,15 @@ import java.util.List; static final int AUDIO_MODE_INVALID = 0; private static AudioModeProvider sAudioModeProvider = new AudioModeProvider(); - private int mAudioMode = CallAudioState.ROUTE_EARPIECE; + private int mAudioMode = AudioState.ROUTE_EARPIECE; private boolean mMuted = false; - private int mSupportedModes = CallAudioState.ROUTE_ALL; + private int mSupportedModes = AudioState.ROUTE_ALL; private final List mListeners = Lists.newArrayList(); private Phone mPhone; private Phone.Listener mPhoneListener = new Phone.Listener() { @Override - public void onAudioStateChanged(Phone phone, CallAudioState audioState) { + public void onAudioStateChanged(Phone phone, AudioState audioState) { onAudioModeChange(audioState.route, audioState.isMuted); onSupportedAudioModeChange(audioState.supportedRouteMask); } diff --git a/InCallUI/src/com/android/incallui/Call.java b/InCallUI/src/com/android/incallui/Call.java index 2a97a3f5e..01f2e8b30 100644 --- a/InCallUI/src/com/android/incallui/Call.java +++ b/InCallUI/src/com/android/incallui/Call.java @@ -17,11 +17,11 @@ package com.android.incallui; import android.net.Uri; -import android.telecomm.CallCapabilities; +import android.telecomm.PhoneCapabilities; import android.telecomm.GatewayInfo; import android.telecomm.InCallService.VideoCall; import android.telecomm.PhoneAccountHandle; -import android.telecomm.VideoCallProfile; +import android.telecomm.VideoProfile; import android.telephony.DisconnectCause; import java.util.ArrayList; @@ -307,12 +307,12 @@ public final class Call { /** Checks if the call supports the given set of capabilities supplied as a bit mask. */ public boolean can(int capabilities) { - if (CallCapabilities.MERGE_CALLS == (capabilities & CallCapabilities.MERGE_CALLS)) { + if (PhoneCapabilities.MERGE_CALLS == (capabilities & PhoneCapabilities.MERGE_CALLS)) { if (mTelecommCall.getConferenceableCalls().isEmpty()) { // Cannot merge calls if there are no calls to merge with. return false; } - capabilities &= ~CallCapabilities.MERGE_CALLS; + capabilities &= ~PhoneCapabilities.MERGE_CALLS; } return (capabilities == (capabilities & mTelecommCall.getDetails().getCallCapabilities())); } @@ -351,7 +351,7 @@ public final class Call { } public boolean isVideoCall() { - return VideoCallProfile.VideoState.isBidirectional(getVideoState()); + return VideoProfile.VideoState.isBidirectional(getVideoState()); } public void setSessionModificationState(int state) { @@ -383,7 +383,7 @@ public final class Call { return String.format(Locale.US, "[%s, %s, %s, children:%s, parent:%s, videoState:%d]", mId, State.toString(mState), - CallCapabilities.toString(mTelecommCall.getDetails().getCallCapabilities()), + PhoneCapabilities.toString(mTelecommCall.getDetails().getCallCapabilities()), mChildCallIds, mParentCallId, mTelecommCall.getDetails().getVideoState()); diff --git a/InCallUI/src/com/android/incallui/CallButtonFragment.java b/InCallUI/src/com/android/incallui/CallButtonFragment.java index 9c2703ca1..9b141dac1 100644 --- a/InCallUI/src/com/android/incallui/CallButtonFragment.java +++ b/InCallUI/src/com/android/incallui/CallButtonFragment.java @@ -19,13 +19,12 @@ package com.android.incallui; import android.graphics.drawable.LayerDrawable; import android.os.Bundle; -import android.telecomm.CallAudioState; +import android.telecomm.AudioState; import android.view.ContextThemeWrapper; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; -import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.CompoundButton; import android.widget.ImageButton; @@ -387,20 +386,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 = AudioState.ROUTE_WIRED_OR_EARPIECE; switch (item.getItemId()) { case R.id.audio_mode_speaker: - mode = CallAudioState.ROUTE_SPEAKER; + mode = AudioState.ROUTE_SPEAKER; break; case R.id.audio_mode_earpiece: case R.id.audio_mode_wired_headset: - // InCallCallAudioState.ROUTE_EARPIECE means either the handset earpiece, + // InCallAudioState.ROUTE_EARPIECE means either the handset earpiece, // or the wired headset (if connected.) - mode = CallAudioState.ROUTE_WIRED_OR_EARPIECE; + mode = AudioState.ROUTE_WIRED_OR_EARPIECE; break; case R.id.audio_mode_bluetooth: - mode = CallAudioState.ROUTE_BLUETOOTH; + mode = AudioState.ROUTE_BLUETOOTH; break; default: Log.e(this, "onMenuItemClick: unexpected View ID " + item.getItemId() @@ -429,9 +428,9 @@ public class CallButtonFragment */ private void onAudioButtonClicked() { Log.d(this, "onAudioButtonClicked: " + - CallAudioState.audioRouteToString(getPresenter().getSupportedAudio())); + AudioState.audioRouteToString(getPresenter().getSupportedAudio())); - if (isSupported(CallAudioState.ROUTE_BLUETOOTH)) { + if (isSupported(AudioState.ROUTE_BLUETOOTH)) { showAudioModePopup(); } else { getPresenter().toggleSpeakerphone(); @@ -461,8 +460,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(AudioState.ROUTE_BLUETOOTH); + final boolean speakerSupported = isSupported(AudioState.ROUTE_SPEAKER); boolean audioButtonEnabled = false; boolean audioButtonChecked = false; @@ -484,9 +483,9 @@ public class CallButtonFragment // btn_compound_background layer anyway.) // Update desired layers: - if (isAudio(CallAudioState.ROUTE_BLUETOOTH)) { + if (isAudio(AudioState.ROUTE_BLUETOOTH)) { showBluetoothIcon = true; - } else if (isAudio(CallAudioState.ROUTE_SPEAKER)) { + } else if (isAudio(AudioState.ROUTE_SPEAKER)) { showSpeakerphoneIcon = true; } else { showHandsetIcon = true; @@ -502,7 +501,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(AudioState.ROUTE_SPEAKER); // update desired layers: showToggleIndicator = true; @@ -572,7 +571,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(AudioState.ROUTE_SPEAKER)); // TODO: Show speakerItem as initially "selected" if // speaker is on. @@ -581,7 +580,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(AudioState.ROUTE_WIRED_HEADSET); earpieceItem.setVisible(!usingHeadset); earpieceItem.setEnabled(!usingHeadset); wiredHeadsetItem.setVisible(usingHeadset); @@ -591,7 +590,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(AudioState.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 38119b5e3..93548dd7a 100644 --- a/InCallUI/src/com/android/incallui/CallButtonPresenter.java +++ b/InCallUI/src/com/android/incallui/CallButtonPresenter.java @@ -16,10 +16,10 @@ package com.android.incallui; -import android.telecomm.CallAudioState; -import android.telecomm.CallCapabilities; +import android.telecomm.AudioState; import android.telecomm.InCallService.VideoCall; -import android.telecomm.VideoCallProfile; +import android.telecomm.PhoneCapabilities; +import android.telecomm.VideoProfile; import com.android.contacts.common.util.PhoneNumberHelper; import com.android.contacts.common.util.TelephonyManagerUtils; @@ -138,7 +138,7 @@ public class CallButtonPresenter extends Presenter } else { getUi().setCallState( callState, - VideoCallProfile.VideoState.AUDIO_ONLY, + VideoProfile.VideoState.AUDIO_ONLY, Call.SessionModificationState.NO_REQUEST, DisconnectCause.NOT_VALID, null, @@ -383,7 +384,7 @@ public class CallCardPresenter extends Presenter } private static boolean isGenericConference(Call call) { - return call != null && call.can(CallCapabilities.GENERIC_CONFERENCE); + return call != null && call.can(PhoneCapabilities.GENERIC_CONFERENCE); } private void updateContactEntry(ContactCacheEntry entry, boolean isPrimary, @@ -556,7 +557,7 @@ public class CallCardPresenter extends Presenter private Drawable getConnectionIcon() { StatusHints statusHints = mPrimary.getTelecommCall().getDetails().getStatusHints(); - if (statusHints != null && statusHints.getIconId() != 0) { + if (statusHints != null && statusHints.getIconResId() != 0) { Drawable icon = statusHints.getIcon(mContext); if (icon != null) { return icon; @@ -566,7 +567,7 @@ public class CallCardPresenter extends Presenter } private boolean hasOutgoingGatewayCall() { - // We only display the gateway information while DIALING so return false for any othe + // We only display the gateway information while STATE_DIALING so return false for any othe // call state. // TODO: mPrimary can be null because this is called from updatePrimaryDisplayInfo which // is also called after a contact search completes (call is not present yet). Split the diff --git a/InCallUI/src/com/android/incallui/CallerInfo.java b/InCallUI/src/com/android/incallui/CallerInfo.java index 8f68cf807..044bdba65 100644 --- a/InCallUI/src/com/android/incallui/CallerInfo.java +++ b/InCallUI/src/com/android/incallui/CallerInfo.java @@ -28,7 +28,6 @@ import android.provider.ContactsContract.Contacts; import android.provider.ContactsContract.Data; import android.provider.ContactsContract.PhoneLookup; import android.provider.ContactsContract.RawContacts; -import android.telecomm.CallPropertyPresentation; import android.telephony.PhoneNumberUtils; import android.text.TextUtils; diff --git a/InCallUI/src/com/android/incallui/CallerInfoUtils.java b/InCallUI/src/com/android/incallui/CallerInfoUtils.java index 52646ec27..9745c18e7 100644 --- a/InCallUI/src/com/android/incallui/CallerInfoUtils.java +++ b/InCallUI/src/com/android/incallui/CallerInfoUtils.java @@ -1,11 +1,10 @@ package com.android.incallui; import android.content.Context; -import android.content.Intent; import android.content.Loader; import android.content.Loader.OnLoadCompleteListener; import android.net.Uri; -import android.telecomm.CallPropertyPresentation; +import android.telecomm.PropertyPresentation; import android.text.TextUtils; import android.util.Log; @@ -42,7 +41,7 @@ public class CallerInfoUtils { // TODO: Have phoneapp send a Uri when it knows the contact that triggered this call. - if (info.numberPresentation == CallPropertyPresentation.ALLOWED) { + if (info.numberPresentation == PropertyPresentation.ALLOWED) { // Start the query with the number provided from the call. Log.d(TAG, "==> Actually starting CallerInfoAsyncQuery.startQuery()..."); CallerInfoAsyncQuery.startQuery(QUERY_TOKEN, context, number, listener, call); @@ -99,9 +98,9 @@ public class CallerInfoUtils { final String[] absentNumberValues = context.getResources().getStringArray(R.array.absent_num); if (Arrays.asList(absentNumberValues).contains(number) - && presentation == CallPropertyPresentation.ALLOWED) { + && presentation == PropertyPresentation.ALLOWED) { number = context.getString(R.string.unknown); - ci.numberPresentation = CallPropertyPresentation.UNKNOWN; + ci.numberPresentation = PropertyPresentation.UNKNOWN; } // Check for other special "corner cases" for CNAP and fix them similarly. Corner @@ -109,16 +108,16 @@ public class CallerInfoUtils { // if we think we have an allowed presentation, or if the CallerInfo presentation doesn't // match the presentation passed in for verification (meaning we changed it previously // because it's a corner case and we're being called from a different entry point). - if (ci.numberPresentation == CallPropertyPresentation.ALLOWED + if (ci.numberPresentation == PropertyPresentation.ALLOWED || (ci.numberPresentation != presentation - && presentation == CallPropertyPresentation.ALLOWED)) { + && presentation == PropertyPresentation.ALLOWED)) { // For all special strings, change number & numberPrentation. if (isCnapSpecialCaseRestricted(number)) { number = context.getString(R.string.private_num); - ci.numberPresentation = CallPropertyPresentation.RESTRICTED; + ci.numberPresentation = PropertyPresentation.RESTRICTED; } else if (isCnapSpecialCaseUnknown(number)) { number = context.getString(R.string.unknown); - ci.numberPresentation = CallPropertyPresentation.UNKNOWN; + ci.numberPresentation = PropertyPresentation.UNKNOWN; } Log.d(TAG, "SpecialCnap: number=" + toLogSafePhoneNumber(number) + "; presentation now=" + ci.numberPresentation); diff --git a/InCallUI/src/com/android/incallui/ContactInfoCache.java b/InCallUI/src/com/android/incallui/ContactInfoCache.java index d02c8c837..d81acb2d9 100644 --- a/InCallUI/src/com/android/incallui/ContactInfoCache.java +++ b/InCallUI/src/com/android/incallui/ContactInfoCache.java @@ -24,7 +24,7 @@ import android.net.Uri; import android.os.Looper; import android.provider.ContactsContract.Contacts; import android.provider.ContactsContract.CommonDataKinds.Phone; -import android.telecomm.CallPropertyPresentation; +import android.telecomm.PropertyPresentation; import android.text.TextUtils; import com.android.contacts.common.util.PhoneNumberHelper; @@ -153,7 +153,7 @@ public class ContactInfoCache implements ContactsAsyncHelper.OnImageLoadComplete int presentationMode = call.getNumberPresentation(); if (callerInfo.contactExists || callerInfo.isEmergencyNumber() || callerInfo.isVoiceMailNumber()) { - presentationMode = CallPropertyPresentation.ALLOWED; + presentationMode = PropertyPresentation.ALLOWED; } final ContactCacheEntry cacheEntry = buildEntry(mContext, callId, @@ -385,7 +385,7 @@ public class ContactInfoCache implements ContactsAsyncHelper.OnImageLoadComplete // (or potentially some other default based on the presentation.) displayName = getPresentationString(context, presentation); Log.d(TAG, " ==> no name *or* number! displayName = " + displayName); - } else if (presentation != CallPropertyPresentation.ALLOWED) { + } else if (presentation != PropertyPresentation.ALLOWED) { // This case should never happen since the network should never send a phone # // AND a restricted presentation. However we leave it here in case of weird // network behavior @@ -422,7 +422,7 @@ public class ContactInfoCache implements ContactsAsyncHelper.OnImageLoadComplete } else { // We do have a valid "name" in the CallerInfo. Display that // in the "name" slot, and the phone number in the "number" slot. - if (presentation != CallPropertyPresentation.ALLOWED) { + if (presentation != PropertyPresentation.ALLOWED) { // This case should never happen since the network should never send a name // AND a restricted presentation. However we leave it here in case of weird // network behavior @@ -475,9 +475,9 @@ public class ContactInfoCache implements ContactsAsyncHelper.OnImageLoadComplete */ private static String getPresentationString(Context context, int presentation) { String name = context.getString(R.string.unknown); - if (presentation == CallPropertyPresentation.RESTRICTED) { + if (presentation == PropertyPresentation.RESTRICTED) { name = context.getString(R.string.private_num); - } else if (presentation == CallPropertyPresentation.PAYPHONE) { + } else if (presentation == PropertyPresentation.PAYPHONE) { name = context.getString(R.string.payphone); } return name; diff --git a/InCallUI/src/com/android/incallui/GlowPadWrapper.java b/InCallUI/src/com/android/incallui/GlowPadWrapper.java index 1617d06bc..1a14f0b84 100644 --- a/InCallUI/src/com/android/incallui/GlowPadWrapper.java +++ b/InCallUI/src/com/android/incallui/GlowPadWrapper.java @@ -19,7 +19,7 @@ package com.android.incallui; import android.content.Context; import android.os.Handler; import android.os.Message; -import android.telecomm.VideoCallProfile; +import android.telecomm.VideoProfile; import android.util.AttributeSet; import android.view.View; @@ -112,7 +112,7 @@ public class GlowPadWrapper extends GlowPadView implements GlowPadView.OnTrigger final int resId = getResourceIdForTarget(target); switch (resId) { case R.drawable.ic_lockscreen_answer: - mAnswerListener.onAnswer(VideoCallProfile.VideoState.AUDIO_ONLY, getContext()); + mAnswerListener.onAnswer(VideoProfile.VideoState.AUDIO_ONLY, getContext()); mTargetTriggered = true; break; case R.drawable.ic_lockscreen_decline: @@ -124,7 +124,7 @@ public class GlowPadWrapper extends GlowPadView implements GlowPadView.OnTrigger mTargetTriggered = true; break; case R.drawable.ic_videocam: - mAnswerListener.onAnswer(VideoCallProfile.VideoState.BIDIRECTIONAL, getContext()); + mAnswerListener.onAnswer(VideoProfile.VideoState.BIDIRECTIONAL, getContext()); mTargetTriggered = true; break; case R.drawable.ic_toolbar_video_off: diff --git a/InCallUI/src/com/android/incallui/InCallApp.java b/InCallUI/src/com/android/incallui/InCallApp.java index 78faf1f2b..d645ca110 100644 --- a/InCallUI/src/com/android/incallui/InCallApp.java +++ b/InCallUI/src/com/android/incallui/InCallApp.java @@ -21,7 +21,7 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.res.Configuration; -import android.telecomm.VideoCallProfile; +import android.telecomm.VideoProfile; /** * Top-level Application class for the InCall app. @@ -31,7 +31,7 @@ public class InCallApp extends Application { /** * Intent Action used for hanging up the current call from Notification bar. This will * choose first ringing call, first active call, or first background call (typically in - * HOLDING state). + * STATE_HOLDING state). */ public static final String ACTION_DECLINE_INCOMING_CALL = "com.android.incallui.ACTION_DECLINE_INCOMING_CALL"; @@ -72,10 +72,10 @@ public class InCallApp extends Application { // TODO: Commands of this nature should exist in the CallList. if (action.equals(ACTION_ANSWER_VIDEO_INCOMING_CALL)) { InCallPresenter.getInstance().answerIncomingCall( - context, VideoCallProfile.VideoState.BIDIRECTIONAL); + context, VideoProfile.VideoState.BIDIRECTIONAL); } else if (action.equals(ACTION_ANSWER_VOICE_INCOMING_CALL)) { InCallPresenter.getInstance().answerIncomingCall( - context, VideoCallProfile.VideoState.AUDIO_ONLY); + context, VideoProfile.VideoState.AUDIO_ONLY); } else if (action.equals(ACTION_DECLINE_INCOMING_CALL)) { InCallPresenter.getInstance().declineIncomingCall(context); } else if (action.equals(ACTION_HANG_UP_ONGOING_CALL)) { diff --git a/InCallUI/src/com/android/incallui/InCallPresenter.java b/InCallUI/src/com/android/incallui/InCallPresenter.java index 79085acfe..66890eb8c 100644 --- a/InCallUI/src/com/android/incallui/InCallPresenter.java +++ b/InCallUI/src/com/android/incallui/InCallPresenter.java @@ -20,10 +20,10 @@ import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.content.pm.ActivityInfo; -import android.telecomm.CallCapabilities; +import android.telecomm.PhoneCapabilities; import android.telecomm.Phone; import android.telecomm.PhoneAccountHandle; -import android.telecomm.VideoCallProfile; +import android.telecomm.VideoProfile; import android.text.TextUtils; import android.view.Surface; import android.view.View; @@ -534,8 +534,8 @@ public class InCallPresenter implements CallList.Listener, InCallPhoneListener { Call call = mCallList.getVideoUpgradeRequestCall(); if (call != null) { - VideoCallProfile videoProfile = - new VideoCallProfile(VideoCallProfile.VideoState.BIDIRECTIONAL); + VideoProfile videoProfile = + new VideoProfile(VideoProfile.VideoState.BIDIRECTIONAL); call.getVideoCall().sendSessionModifyResponse(videoProfile); call.setSessionModificationState(Call.SessionModificationState.NO_REQUEST); } @@ -550,8 +550,8 @@ public class InCallPresenter implements CallList.Listener, InCallPhoneListener { Call call = mCallList.getVideoUpgradeRequestCall(); if (call != null) { - VideoCallProfile videoProfile = - new VideoCallProfile(VideoCallProfile.VideoState.AUDIO_ONLY); + VideoProfile videoProfile = + new VideoProfile(VideoProfile.VideoState.AUDIO_ONLY); call.getVideoCall().sendSessionModifyResponse(videoProfile); call.setSessionModificationState(Call.SessionModificationState.NO_REQUEST); } @@ -639,20 +639,20 @@ public class InCallPresenter implements CallList.Listener, InCallPhoneListener { // (1) Attempt to answer a call if (incomingCall != null) { TelecommAdapter.getInstance().answerCall( - incomingCall.getId(), VideoCallProfile.VideoState.AUDIO_ONLY); + incomingCall.getId(), VideoProfile.VideoState.AUDIO_ONLY); return true; } /** - * ACTIVE CALL + * STATE_ACTIVE CALL */ final Call activeCall = calls.getActiveCall(); if (activeCall != null) { // TODO: This logic is repeated from CallButtonPresenter.java. We should // consolidate this logic. - final boolean isGeneric = activeCall.can(CallCapabilities.GENERIC_CONFERENCE); - final boolean canMerge = activeCall.can(CallCapabilities.MERGE_CALLS); - final boolean canSwap = activeCall.can(CallCapabilities.SWAP_CALLS); + final boolean isGeneric = activeCall.can(PhoneCapabilities.GENERIC_CONFERENCE); + final boolean canMerge = activeCall.can(PhoneCapabilities.MERGE_CALLS); + final boolean canSwap = activeCall.can(PhoneCapabilities.SWAP_CALLS); Log.v(this, "activeCall: " + activeCall + ", isGeneric: " + isGeneric + ", canMerge: " + canMerge + ", canSwap: " + canSwap); @@ -682,7 +682,7 @@ public class InCallPresenter implements CallList.Listener, InCallPhoneListener { if (heldCall != null) { // We have a hold call so presumeable it will always support HOLD...but // there is no harm in double checking. - final boolean canHold = heldCall.can(CallCapabilities.HOLD); + final boolean canHold = heldCall.can(PhoneCapabilities.HOLD); Log.v(this, "heldCall: " + heldCall + ", canHold: " + canHold); diff --git a/InCallUI/src/com/android/incallui/InCallVideoCallListener.java b/InCallUI/src/com/android/incallui/InCallVideoCallListener.java index a3ebf78e0..62817d29c 100644 --- a/InCallUI/src/com/android/incallui/InCallVideoCallListener.java +++ b/InCallUI/src/com/android/incallui/InCallVideoCallListener.java @@ -16,9 +16,10 @@ package com.android.incallui; -import android.telecomm.CallCameraCapabilities; +import android.telecomm.CameraCapabilities; +import android.telecomm.Connection; import android.telecomm.InCallService.VideoCall; -import android.telecomm.VideoCallProfile; +import android.telecomm.VideoProfile; /** * Implements the InCallUI Video Call Listener. @@ -42,18 +43,18 @@ public class InCallVideoCallListener extends VideoCall.Listener { /** * Handles an incoming session modification request. * - * @param videoCallProfile The requested video call profile. + * @param videoProfile The requested video call profile. */ @Override - public void onSessionModifyRequestReceived(VideoCallProfile videoCallProfile) { + public void onSessionModifyRequestReceived(VideoProfile videoProfile) { int previousVideoState = mCall.getVideoState(); - int newVideoState = videoCallProfile.getVideoState(); + int newVideoState = videoProfile.getVideoState(); - boolean wasVideoCall = VideoCallProfile.VideoState.isBidirectional(previousVideoState); - boolean isVideoCall = VideoCallProfile.VideoState.isBidirectional(newVideoState); + boolean wasVideoCall = VideoProfile.VideoState.isBidirectional(previousVideoState); + boolean isVideoCall = VideoProfile.VideoState.isBidirectional(newVideoState); - boolean wasPaused = VideoCallProfile.VideoState.isPaused(previousVideoState); - boolean isPaused = VideoCallProfile.VideoState.isPaused(newVideoState); + boolean wasPaused = VideoProfile.VideoState.isPaused(previousVideoState); + boolean isPaused = VideoProfile.VideoState.isPaused(newVideoState); // Check for upgrades to video and downgrades to audio. if (!wasVideoCall && isVideoCall) { @@ -70,23 +71,23 @@ public class InCallVideoCallListener extends VideoCall.Listener { * Handles a session modification response. * * @param status Status of the session modify request. Valid values are - * {@link VideoCall#SESSION_MODIFY_REQUEST_SUCCESS}, - * {@link VideoCall#SESSION_MODIFY_REQUEST_FAIL}, - * {@link VideoCall#SESSION_MODIFY_REQUEST_INVALID} + * {@link Connection.VideoProvider#SESSION_MODIFY_REQUEST_SUCCESS}, + * {@link Connection.VideoProvider#SESSION_MODIFY_REQUEST_FAIL}, + * {@link Connection.VideoProvider#SESSION_MODIFY_REQUEST_INVALID} * @param requestedProfile * @param responseProfile The actual profile changes made by the peer device. */ @Override public void onSessionModifyResponseReceived( - int status, VideoCallProfile requestedProfile, VideoCallProfile responseProfile) { + int status, VideoProfile requestedProfile, VideoProfile responseProfile) { boolean modifySucceeded = requestedProfile.getVideoState() == responseProfile.getVideoState(); boolean isVideoCall = - VideoCallProfile.VideoState.isBidirectional(responseProfile.getVideoState()); + VideoProfile.VideoState.isBidirectional(responseProfile.getVideoState()); if (modifySucceeded && isVideoCall) { InCallVideoCallListenerNotifier.getInstance().upgradeToVideoSuccess(mCall); - } else if (!modifySucceeded || status != VideoCall.SESSION_MODIFY_REQUEST_SUCCESS) { + } else if (!modifySucceeded || status != Connection.VideoProvider.SESSION_MODIFY_REQUEST_SUCCESS) { InCallVideoCallListenerNotifier.getInstance().upgradeToVideoFail(mCall); } } @@ -125,11 +126,11 @@ public class InCallVideoCallListener extends VideoCall.Listener { * Handles changes to the camera capabilities. No implementation as the in-call UI does not * make use of camera capabilities. * - * @param callCameraCapabilities The changed camera capabilities. + * @param cameraCapabilities The changed camera capabilities. */ @Override - public void onCameraCapabilitiesChanged(CallCameraCapabilities callCameraCapabilities) { + public void onCameraCapabilitiesChanged(CameraCapabilities cameraCapabilities) { InCallVideoCallListenerNotifier.getInstance().cameraDimensionsChanged( - mCall, callCameraCapabilities.getWidth(), callCameraCapabilities.getHeight()); + mCall, cameraCapabilities.getWidth(), cameraCapabilities.getHeight()); } } diff --git a/InCallUI/src/com/android/incallui/ProximitySensor.java b/InCallUI/src/com/android/incallui/ProximitySensor.java index 6f69096a6..02de4fd22 100644 --- a/InCallUI/src/com/android/incallui/ProximitySensor.java +++ b/InCallUI/src/com/android/incallui/ProximitySensor.java @@ -19,8 +19,7 @@ package com.android.incallui; import android.content.Context; import android.content.res.Configuration; import android.os.PowerManager; - -import android.telecomm.CallAudioState; +import android.telecomm.AudioState; import com.android.incallui.AudioModeProvider.AudioModeListener; import com.android.incallui.InCallPresenter.InCallState; @@ -177,9 +176,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 = (AudioState.ROUTE_WIRED_HEADSET == audioMode + || AudioState.ROUTE_SPEAKER == audioMode + || AudioState.ROUTE_BLUETOOTH == audioMode || mIsHardKeyboardOpen); // We do not keep the screen off when the user is outside in-call screen and we are @@ -203,7 +202,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", AudioState.audioRouteToString(audioMode)) .toString()); if (mIsPhoneOffhook && !screenOnImmediately) { diff --git a/InCallUI/src/com/android/incallui/TelecommAdapter.java b/InCallUI/src/com/android/incallui/TelecommAdapter.java index 324fda568..22aff11a9 100644 --- a/InCallUI/src/com/android/incallui/TelecommAdapter.java +++ b/InCallUI/src/com/android/incallui/TelecommAdapter.java @@ -158,11 +158,7 @@ final class TelecommAdapter implements InCallPhoneListener { } void swap(String callId) { - if (mPhone != null) { - getTelecommCallById(callId).swapWithBackgroundCall(); - } else { - Log.e(this, "error swapWithBackgroundCall, mAdapter is null."); - } + // TODO: Remove (obsolete) } void addCall() { diff --git a/InCallUI/src/com/android/incallui/VideoCallPresenter.java b/InCallUI/src/com/android/incallui/VideoCallPresenter.java index 73947e521..dbbf0387d 100644 --- a/InCallUI/src/com/android/incallui/VideoCallPresenter.java +++ b/InCallUI/src/com/android/incallui/VideoCallPresenter.java @@ -19,7 +19,8 @@ package com.android.incallui; import android.content.Context; import android.content.res.Configuration; import android.os.Handler; -import android.telecomm.CallAudioState; +import android.telecomm.AudioState; +import android.telecomm.CameraCapabilities; import android.telecomm.InCallService.VideoCall; import android.view.Surface; @@ -45,7 +46,7 @@ import java.util.Objects; *
  • {@code VideoCallPresenter} creates and informs telephony of the display surface.
  • *
  • {@code VideoCallPresenter} creates the preview surface.
  • *
  • {@code VideoCallPresenter} informs telephony of the currently selected camera.
  • - *
  • Telephony layer sends {@link android.telecomm.CallCameraCapabilities}, including the + *
  • Telephony layer sends {@link CameraCapabilities}, including the * dimensions of the video for the current camera.
  • *
  • {@code VideoCallPresenter} adjusts size of the preview surface to match the aspect * ratio of the camera.
  • @@ -427,7 +428,7 @@ public class VideoCallPresenter extends Presenter