Loading src/com/android/server/telecom/CallAudioManager.java +17 −1 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ final class CallAudioManager extends CallsManagerListenerBase private boolean mIsTonePlaying; private boolean mWasSpeakerOn; private int mMostRecentlyUsedMode = AudioManager.MODE_IN_CALL; private Call mCallToSpeedUpMTAudio = null; CallAudioManager(Context context, StatusBarNotifier statusBarNotifier, WiredHeadsetManager wiredHeadsetManager) { Loading Loading @@ -106,6 +107,12 @@ final class CallAudioManager extends CallsManagerListenerBase } setSystemAudioState(false /* isMute */, route, mAudioState.getSupportedRouteMask()); if (call.can(android.telecom.Call.Details.CAPABILITY_SPEED_UP_MT_AUDIO)) { Log.v(this, "Speed up audio setup for IMS MT call."); mCallToSpeedUpMTAudio = call; updateAudioStreamAndMode(); } } @Override Loading Loading @@ -284,6 +291,10 @@ final class CallAudioManager extends CallsManagerListenerBase boolean wasNotVoiceCall = mAudioFocusStreamType != AudioManager.STREAM_VOICE_CALL; updateAudioStreamAndMode(); if (call != null && call.getState() == CallState.ACTIVE && call == mCallToSpeedUpMTAudio) { mCallToSpeedUpMTAudio = null; } // If we transition from not voice call to voice call, we need to set an initial state. if (wasNotVoiceCall && mAudioFocusStreamType == AudioManager.STREAM_VOICE_CALL) { setInitialAudioState(call, true /* force */); Loading Loading @@ -363,7 +374,11 @@ final class CallAudioManager extends CallsManagerListenerBase Call foregroundCall = getForegroundCall(); Call waitingForAccountSelectionCall = CallsManager.getInstance().getFirstCallWithState(CallState.PRE_DIAL_WAIT); if (foregroundCall != null && waitingForAccountSelectionCall == null) { Call call = CallsManager.getInstance().getForegroundCall(); if (foregroundCall == null && call != null && call == mCallToSpeedUpMTAudio) { requestAudioFocusAndSetMode(AudioManager.STREAM_VOICE_CALL, AudioManager.MODE_IN_CALL); } else if (foregroundCall != null && waitingForAccountSelectionCall == null) { // In the case where there is a call that is waiting for account selection, // this will fall back to abandonAudioFocus() below, which temporarily exits // the in-call audio mode. This is to allow TalkBack to speak the "Call with" Loading Loading @@ -414,6 +429,7 @@ final class CallAudioManager extends CallsManagerListenerBase Log.v(this, "abandoning audio focus"); mAudioManager.abandonAudioFocusForCall(); mAudioFocusStreamType = STREAM_NONE; mCallToSpeedUpMTAudio = null; } } Loading src/com/android/server/telecom/CallsManager.java +8 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.os.Message; import android.os.SystemProperties; import android.os.Trace; import android.provider.CallLog.Calls; import android.provider.Settings; import android.telecom.AudioState; import android.telecom.CallState; import android.telecom.Conference; Loading Loading @@ -1186,6 +1187,13 @@ public final class CallsManager extends Call.ListenerBase { * Returns true if telecom supports adding another top-level call. */ boolean canAddCall() { boolean isDeviceProvisioned = Settings.Global.getInt(mContext.getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 0) != 0; if (!isDeviceProvisioned) { Log.d(TAG, "Device not provisioned, canAddCall is false."); return false; } if (getFirstCallWithState(OUTGOING_CALL_STATES) != null) { return false; } Loading src/com/android/server/telecom/TelecomService.java +14 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,8 @@ import android.telephony.SubscriptionManager; import android.telephony.TelephonyManager; import android.text.TextUtils; import android.util.EventLog; // TODO: Needed for move to system service: import com.android.internal.R; import com.android.internal.telecom.ITelecomService; import com.android.internal.util.IndentingPrintWriter; Loading Loading @@ -668,6 +670,7 @@ public class TelecomService extends Service { mAppOpsManager.checkPackage( Binder.getCallingUid(), phoneAccountHandle.getComponentName().getPackageName()); enforcePhoneAccountIsRegistered(phoneAccountHandle); // Make sure it doesn't cross the UserHandle boundary enforceUserHandleMatchesCaller(phoneAccountHandle); Loading @@ -693,6 +696,7 @@ public class TelecomService extends Service { mAppOpsManager.checkPackage( Binder.getCallingUid(), phoneAccountHandle.getComponentName().getPackageName()); enforcePhoneAccountIsRegistered(phoneAccountHandle); // Make sure it doesn't cross the UserHandle boundary enforceUserHandleMatchesCaller(phoneAccountHandle); Loading Loading @@ -874,6 +878,16 @@ public class TelecomService extends Service { return false; } // Enforce that the PhoneAccountHandle being passed in is registered to a valid PhoneAccount. private void enforcePhoneAccountIsRegistered(PhoneAccountHandle phoneAccountHandle) { PhoneAccount phoneAccount = mPhoneAccountRegistrar.getPhoneAccount(phoneAccountHandle); if(phoneAccount == null) { EventLog.writeEvent(0x534e4554, "26864502", Binder.getCallingUid(), "R"); throw new SecurityException("This PhoneAccountHandle is not registered to a valid " + "PhoneAccount!"); } } private void enforcePhoneAccountModificationForPackage(String packageName) { // TODO: Use a new telecomm permission for this instead of reusing modify. Loading Loading
src/com/android/server/telecom/CallAudioManager.java +17 −1 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ final class CallAudioManager extends CallsManagerListenerBase private boolean mIsTonePlaying; private boolean mWasSpeakerOn; private int mMostRecentlyUsedMode = AudioManager.MODE_IN_CALL; private Call mCallToSpeedUpMTAudio = null; CallAudioManager(Context context, StatusBarNotifier statusBarNotifier, WiredHeadsetManager wiredHeadsetManager) { Loading Loading @@ -106,6 +107,12 @@ final class CallAudioManager extends CallsManagerListenerBase } setSystemAudioState(false /* isMute */, route, mAudioState.getSupportedRouteMask()); if (call.can(android.telecom.Call.Details.CAPABILITY_SPEED_UP_MT_AUDIO)) { Log.v(this, "Speed up audio setup for IMS MT call."); mCallToSpeedUpMTAudio = call; updateAudioStreamAndMode(); } } @Override Loading Loading @@ -284,6 +291,10 @@ final class CallAudioManager extends CallsManagerListenerBase boolean wasNotVoiceCall = mAudioFocusStreamType != AudioManager.STREAM_VOICE_CALL; updateAudioStreamAndMode(); if (call != null && call.getState() == CallState.ACTIVE && call == mCallToSpeedUpMTAudio) { mCallToSpeedUpMTAudio = null; } // If we transition from not voice call to voice call, we need to set an initial state. if (wasNotVoiceCall && mAudioFocusStreamType == AudioManager.STREAM_VOICE_CALL) { setInitialAudioState(call, true /* force */); Loading Loading @@ -363,7 +374,11 @@ final class CallAudioManager extends CallsManagerListenerBase Call foregroundCall = getForegroundCall(); Call waitingForAccountSelectionCall = CallsManager.getInstance().getFirstCallWithState(CallState.PRE_DIAL_WAIT); if (foregroundCall != null && waitingForAccountSelectionCall == null) { Call call = CallsManager.getInstance().getForegroundCall(); if (foregroundCall == null && call != null && call == mCallToSpeedUpMTAudio) { requestAudioFocusAndSetMode(AudioManager.STREAM_VOICE_CALL, AudioManager.MODE_IN_CALL); } else if (foregroundCall != null && waitingForAccountSelectionCall == null) { // In the case where there is a call that is waiting for account selection, // this will fall back to abandonAudioFocus() below, which temporarily exits // the in-call audio mode. This is to allow TalkBack to speak the "Call with" Loading Loading @@ -414,6 +429,7 @@ final class CallAudioManager extends CallsManagerListenerBase Log.v(this, "abandoning audio focus"); mAudioManager.abandonAudioFocusForCall(); mAudioFocusStreamType = STREAM_NONE; mCallToSpeedUpMTAudio = null; } } Loading
src/com/android/server/telecom/CallsManager.java +8 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.os.Message; import android.os.SystemProperties; import android.os.Trace; import android.provider.CallLog.Calls; import android.provider.Settings; import android.telecom.AudioState; import android.telecom.CallState; import android.telecom.Conference; Loading Loading @@ -1186,6 +1187,13 @@ public final class CallsManager extends Call.ListenerBase { * Returns true if telecom supports adding another top-level call. */ boolean canAddCall() { boolean isDeviceProvisioned = Settings.Global.getInt(mContext.getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 0) != 0; if (!isDeviceProvisioned) { Log.d(TAG, "Device not provisioned, canAddCall is false."); return false; } if (getFirstCallWithState(OUTGOING_CALL_STATES) != null) { return false; } Loading
src/com/android/server/telecom/TelecomService.java +14 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,8 @@ import android.telephony.SubscriptionManager; import android.telephony.TelephonyManager; import android.text.TextUtils; import android.util.EventLog; // TODO: Needed for move to system service: import com.android.internal.R; import com.android.internal.telecom.ITelecomService; import com.android.internal.util.IndentingPrintWriter; Loading Loading @@ -668,6 +670,7 @@ public class TelecomService extends Service { mAppOpsManager.checkPackage( Binder.getCallingUid(), phoneAccountHandle.getComponentName().getPackageName()); enforcePhoneAccountIsRegistered(phoneAccountHandle); // Make sure it doesn't cross the UserHandle boundary enforceUserHandleMatchesCaller(phoneAccountHandle); Loading @@ -693,6 +696,7 @@ public class TelecomService extends Service { mAppOpsManager.checkPackage( Binder.getCallingUid(), phoneAccountHandle.getComponentName().getPackageName()); enforcePhoneAccountIsRegistered(phoneAccountHandle); // Make sure it doesn't cross the UserHandle boundary enforceUserHandleMatchesCaller(phoneAccountHandle); Loading Loading @@ -874,6 +878,16 @@ public class TelecomService extends Service { return false; } // Enforce that the PhoneAccountHandle being passed in is registered to a valid PhoneAccount. private void enforcePhoneAccountIsRegistered(PhoneAccountHandle phoneAccountHandle) { PhoneAccount phoneAccount = mPhoneAccountRegistrar.getPhoneAccount(phoneAccountHandle); if(phoneAccount == null) { EventLog.writeEvent(0x534e4554, "26864502", Binder.getCallingUid(), "R"); throw new SecurityException("This PhoneAccountHandle is not registered to a valid " + "PhoneAccount!"); } } private void enforcePhoneAccountModificationForPackage(String packageName) { // TODO: Use a new telecomm permission for this instead of reusing modify. Loading