Loading AndroidManifest.xml +2 −14 Original line number Diff line number Diff line Loading @@ -178,20 +178,8 @@ </intent-filter> </activity-alias> <receiver android:name="TelecomBroadcastReceiver" android:exported="false"> <intent-filter> <action android:name="com.android.server.telecom.ACTION_CALL_BACK_FROM_NOTIFICATION" /> <action android:name="com.android.server.telecom.ACTION_CALL_BACK_FROM_NOTIFICATION" /> <action android:name="com.android.server.telecom.ACTION_SEND_SMS_FROM_NOTIFICATION" /> </intent-filter> </receiver> <receiver android:name="PhoneAccountBroadcastReceiver"> <intent-filter> <action android:name="android.intent.action.PACKAGE_FULLY_REMOVED" /> <data android:scheme="package" /> </intent-filter> </receiver> <!-- Note: Broadcast receivers are now set up in TelecomApp as a step in the transition to running under the system process. --> <activity android:name=".RespondViaSmsSettings$Settings" android:label="@string/respond_via_sms_setting_title" Loading src/com/android/server/telecom/AsyncRingtonePlayer.java +12 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.server.telecom; import android.content.Context; import android.media.AudioManager; import android.media.Ringtone; import android.media.RingtoneManager; Loading @@ -25,7 +26,7 @@ import android.os.HandlerThread; import android.os.Message; import android.provider.Settings; import com.google.common.base.Preconditions; import com.android.internal.util.Preconditions; /** * Plays the default ringtone. Uses {@link Ringtone} in a separate thread so that this class can be Loading @@ -46,6 +47,15 @@ class AsyncRingtonePlayer { /** The current ringtone. Only used by the ringtone thread. */ private Ringtone mRingtone; /** * The context. */ private final Context mContext; AsyncRingtonePlayer(Context context) { mContext = context; } /** Plays the ringtone. */ void play(Uri ringtone) { Log.d(this, "Posting play."); Loading Loading @@ -185,7 +195,7 @@ class AsyncRingtonePlayer { ringtoneUri = Settings.System.DEFAULT_RINGTONE_URI; } Ringtone ringtone = RingtoneManager.getRingtone(TelecomApp.getInstance(), ringtoneUri); Ringtone ringtone = RingtoneManager.getRingtone(mContext, ringtoneUri); ringtone.setStreamType(AudioManager.STREAM_RING); return ringtone; } Loading src/com/android/server/telecom/Call.java +30 −10 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.server.telecom; import android.content.Context; import android.graphics.Bitmap; import android.graphics.drawable.Drawable; import android.net.Uri; Loading Loading @@ -44,7 +45,7 @@ import com.android.internal.telephony.CallerInfoAsyncQuery.OnQueryCompleteListen import com.android.internal.telephony.SmsApplication; import com.android.server.telecom.ContactsAsyncHelper.OnImageLoadCompleteListener; import com.google.common.base.Preconditions; import com.android.internal.util.Preconditions; import java.util.ArrayList; import java.util.Collections; Loading Loading @@ -275,10 +276,13 @@ final class Call implements CreateConnectionResponse { private boolean mIsVoipAudioMode; private StatusHints mStatusHints; private final ConnectionServiceRepository mRepository; private final Context mContext; /** * Persists the specified parameters and initializes the new instance. * * @param context The context. * @param repository The connection service repository. * @param handle The handle to dial. * @param gatewayInfo Gateway information to use for the call. * @param connectionManagerPhoneAccountHandle Account to use for the service managing the call. Loading @@ -289,6 +293,7 @@ final class Call implements CreateConnectionResponse { * @param isIncoming True if this is an incoming call. */ Call( Context context, ConnectionServiceRepository repository, Uri handle, GatewayInfo gatewayInfo, Loading @@ -297,6 +302,7 @@ final class Call implements CreateConnectionResponse { boolean isIncoming, boolean isConference) { mState = isConference ? CallState.ACTIVE : CallState.NEW; mContext = context; mRepository = repository; setHandle(handle); setHandle(handle, TelecomManager.PRESENTATION_ALLOWED); Loading Loading @@ -384,8 +390,8 @@ final class Call implements CreateConnectionResponse { if (!Objects.equals(handle, mHandle) || presentation != mHandlePresentation) { mHandle = handle; mHandlePresentation = presentation; mIsEmergencyCall = mHandle != null && PhoneNumberUtils.isLocalEmergencyNumber( TelecomApp.getInstance(), mHandle.getSchemeSpecificPart()); mIsEmergencyCall = mHandle != null && PhoneNumberUtils.isLocalEmergencyNumber(mContext, mHandle.getSchemeSpecificPart()); startCallerInfoLookup(); for (Listener l : mListeners) { l.onHandleChanged(this); Loading Loading @@ -543,6 +549,15 @@ final class Call implements CreateConnectionResponse { return mConnectionService; } /** * Retrieves the {@link Context} for the call. * * @return The {@link Context}. */ Context getContext() { return mContext; } void setConnectionService(ConnectionServiceWrapper service) { Preconditions.checkNotNull(service); Loading Loading @@ -597,10 +612,13 @@ final class Call implements CreateConnectionResponse { /** * Starts the create connection sequence. Upon completion, there should exist an active * connection through a connection service (or the call will have failed). * * @param phoneAccountRegistrar The phone account registrar. */ void startCreateConnection() { void startCreateConnection(PhoneAccountRegistrar phoneAccountRegistrar) { Preconditions.checkState(mCreateConnectionProcessor == null); mCreateConnectionProcessor = new CreateConnectionProcessor(this, mRepository, this); mCreateConnectionProcessor = new CreateConnectionProcessor(this, mRepository, this, phoneAccountRegistrar, mContext); mCreateConnectionProcessor.process(); } Loading Loading @@ -635,7 +653,8 @@ final class Call implements CreateConnectionResponse { // Timeout the direct-to-voicemail lookup execution so that we dont wait too long before // showing the user the incoming call screen. mHandler.postDelayed(mDirectToVoicemailRunnable, Timeouts.getDirectToVoicemailMillis()); mHandler.postDelayed(mDirectToVoicemailRunnable, Timeouts.getDirectToVoicemailMillis( mContext.getContentResolver())); } else { for (Listener l : mListeners) { l.onSuccessfulOutgoingCall(this, Loading Loading @@ -955,7 +974,7 @@ final class Call implements CreateConnectionResponse { } // Is there a valid SMS application on the phone? if (SmsApplication.getDefaultRespondViaMessageApplication(TelecomApp.getInstance(), if (SmsApplication.getDefaultRespondViaMessageApplication(mContext, true /*updateIfNeeded*/) == null) { return false; } Loading Loading @@ -1015,7 +1034,7 @@ final class Call implements CreateConnectionResponse { Log.v(this, "Looking up information for: %s.", Log.piiHandle(number)); CallerInfoAsyncQuery.startQuery( mQueryToken, TelecomApp.getInstance(), mContext, number, sCallerInfoQueryListener, this); Loading @@ -1041,7 +1060,7 @@ final class Call implements CreateConnectionResponse { mCallerInfo.contactDisplayPhotoUri, this); ContactsAsyncHelper.startObtainPhotoAsync( token, TelecomApp.getInstance(), mContext, mCallerInfo.contactDisplayPhotoUri, sPhotoLoadListener, this); Loading Loading @@ -1100,7 +1119,8 @@ final class Call implements CreateConnectionResponse { Log.w(Call.this, "Error obtaining canned SMS responses: %d %s", code, msg); } } }, mContext ); } else { Log.d(this, "maybeLoadCannedSmsResponses: doing nothing"); Loading src/com/android/server/telecom/CallActivity.java +3 −1 Original line number Diff line number Diff line Loading @@ -32,6 +32,8 @@ import android.telephony.PhoneNumberUtils; import android.text.TextUtils; import android.widget.Toast; // TODO: Needed for move to system service: import com.android.internal.R; /** * Activity that handles system CALL actions and forwards them to {@link CallsManager}. * Handles all three CALL action types: CALL, CALL_PRIVILEGED, and CALL_EMERGENCY. Loading Loading @@ -159,7 +161,7 @@ public class CallActivity extends Activity { setResult(RESULT_CANCELED); } else { NewOutgoingCallIntentBroadcaster broadcaster = new NewOutgoingCallIntentBroadcaster( mCallsManager, call, intent, isDefaultDialer()); this, mCallsManager, call, intent, isDefaultDialer()); final int result = broadcaster.processIntent(); final boolean success = result == DisconnectCause.NOT_DISCONNECTED; Loading src/com/android/server/telecom/CallAudioManager.java +1 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ import android.media.AudioManager; import android.telecom.AudioState; import android.telecom.CallState; import com.google.common.base.Preconditions; import com.android.internal.util.Preconditions; import java.util.Objects; Loading Loading
AndroidManifest.xml +2 −14 Original line number Diff line number Diff line Loading @@ -178,20 +178,8 @@ </intent-filter> </activity-alias> <receiver android:name="TelecomBroadcastReceiver" android:exported="false"> <intent-filter> <action android:name="com.android.server.telecom.ACTION_CALL_BACK_FROM_NOTIFICATION" /> <action android:name="com.android.server.telecom.ACTION_CALL_BACK_FROM_NOTIFICATION" /> <action android:name="com.android.server.telecom.ACTION_SEND_SMS_FROM_NOTIFICATION" /> </intent-filter> </receiver> <receiver android:name="PhoneAccountBroadcastReceiver"> <intent-filter> <action android:name="android.intent.action.PACKAGE_FULLY_REMOVED" /> <data android:scheme="package" /> </intent-filter> </receiver> <!-- Note: Broadcast receivers are now set up in TelecomApp as a step in the transition to running under the system process. --> <activity android:name=".RespondViaSmsSettings$Settings" android:label="@string/respond_via_sms_setting_title" Loading
src/com/android/server/telecom/AsyncRingtonePlayer.java +12 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.server.telecom; import android.content.Context; import android.media.AudioManager; import android.media.Ringtone; import android.media.RingtoneManager; Loading @@ -25,7 +26,7 @@ import android.os.HandlerThread; import android.os.Message; import android.provider.Settings; import com.google.common.base.Preconditions; import com.android.internal.util.Preconditions; /** * Plays the default ringtone. Uses {@link Ringtone} in a separate thread so that this class can be Loading @@ -46,6 +47,15 @@ class AsyncRingtonePlayer { /** The current ringtone. Only used by the ringtone thread. */ private Ringtone mRingtone; /** * The context. */ private final Context mContext; AsyncRingtonePlayer(Context context) { mContext = context; } /** Plays the ringtone. */ void play(Uri ringtone) { Log.d(this, "Posting play."); Loading Loading @@ -185,7 +195,7 @@ class AsyncRingtonePlayer { ringtoneUri = Settings.System.DEFAULT_RINGTONE_URI; } Ringtone ringtone = RingtoneManager.getRingtone(TelecomApp.getInstance(), ringtoneUri); Ringtone ringtone = RingtoneManager.getRingtone(mContext, ringtoneUri); ringtone.setStreamType(AudioManager.STREAM_RING); return ringtone; } Loading
src/com/android/server/telecom/Call.java +30 −10 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.server.telecom; import android.content.Context; import android.graphics.Bitmap; import android.graphics.drawable.Drawable; import android.net.Uri; Loading Loading @@ -44,7 +45,7 @@ import com.android.internal.telephony.CallerInfoAsyncQuery.OnQueryCompleteListen import com.android.internal.telephony.SmsApplication; import com.android.server.telecom.ContactsAsyncHelper.OnImageLoadCompleteListener; import com.google.common.base.Preconditions; import com.android.internal.util.Preconditions; import java.util.ArrayList; import java.util.Collections; Loading Loading @@ -275,10 +276,13 @@ final class Call implements CreateConnectionResponse { private boolean mIsVoipAudioMode; private StatusHints mStatusHints; private final ConnectionServiceRepository mRepository; private final Context mContext; /** * Persists the specified parameters and initializes the new instance. * * @param context The context. * @param repository The connection service repository. * @param handle The handle to dial. * @param gatewayInfo Gateway information to use for the call. * @param connectionManagerPhoneAccountHandle Account to use for the service managing the call. Loading @@ -289,6 +293,7 @@ final class Call implements CreateConnectionResponse { * @param isIncoming True if this is an incoming call. */ Call( Context context, ConnectionServiceRepository repository, Uri handle, GatewayInfo gatewayInfo, Loading @@ -297,6 +302,7 @@ final class Call implements CreateConnectionResponse { boolean isIncoming, boolean isConference) { mState = isConference ? CallState.ACTIVE : CallState.NEW; mContext = context; mRepository = repository; setHandle(handle); setHandle(handle, TelecomManager.PRESENTATION_ALLOWED); Loading Loading @@ -384,8 +390,8 @@ final class Call implements CreateConnectionResponse { if (!Objects.equals(handle, mHandle) || presentation != mHandlePresentation) { mHandle = handle; mHandlePresentation = presentation; mIsEmergencyCall = mHandle != null && PhoneNumberUtils.isLocalEmergencyNumber( TelecomApp.getInstance(), mHandle.getSchemeSpecificPart()); mIsEmergencyCall = mHandle != null && PhoneNumberUtils.isLocalEmergencyNumber(mContext, mHandle.getSchemeSpecificPart()); startCallerInfoLookup(); for (Listener l : mListeners) { l.onHandleChanged(this); Loading Loading @@ -543,6 +549,15 @@ final class Call implements CreateConnectionResponse { return mConnectionService; } /** * Retrieves the {@link Context} for the call. * * @return The {@link Context}. */ Context getContext() { return mContext; } void setConnectionService(ConnectionServiceWrapper service) { Preconditions.checkNotNull(service); Loading Loading @@ -597,10 +612,13 @@ final class Call implements CreateConnectionResponse { /** * Starts the create connection sequence. Upon completion, there should exist an active * connection through a connection service (or the call will have failed). * * @param phoneAccountRegistrar The phone account registrar. */ void startCreateConnection() { void startCreateConnection(PhoneAccountRegistrar phoneAccountRegistrar) { Preconditions.checkState(mCreateConnectionProcessor == null); mCreateConnectionProcessor = new CreateConnectionProcessor(this, mRepository, this); mCreateConnectionProcessor = new CreateConnectionProcessor(this, mRepository, this, phoneAccountRegistrar, mContext); mCreateConnectionProcessor.process(); } Loading Loading @@ -635,7 +653,8 @@ final class Call implements CreateConnectionResponse { // Timeout the direct-to-voicemail lookup execution so that we dont wait too long before // showing the user the incoming call screen. mHandler.postDelayed(mDirectToVoicemailRunnable, Timeouts.getDirectToVoicemailMillis()); mHandler.postDelayed(mDirectToVoicemailRunnable, Timeouts.getDirectToVoicemailMillis( mContext.getContentResolver())); } else { for (Listener l : mListeners) { l.onSuccessfulOutgoingCall(this, Loading Loading @@ -955,7 +974,7 @@ final class Call implements CreateConnectionResponse { } // Is there a valid SMS application on the phone? if (SmsApplication.getDefaultRespondViaMessageApplication(TelecomApp.getInstance(), if (SmsApplication.getDefaultRespondViaMessageApplication(mContext, true /*updateIfNeeded*/) == null) { return false; } Loading Loading @@ -1015,7 +1034,7 @@ final class Call implements CreateConnectionResponse { Log.v(this, "Looking up information for: %s.", Log.piiHandle(number)); CallerInfoAsyncQuery.startQuery( mQueryToken, TelecomApp.getInstance(), mContext, number, sCallerInfoQueryListener, this); Loading @@ -1041,7 +1060,7 @@ final class Call implements CreateConnectionResponse { mCallerInfo.contactDisplayPhotoUri, this); ContactsAsyncHelper.startObtainPhotoAsync( token, TelecomApp.getInstance(), mContext, mCallerInfo.contactDisplayPhotoUri, sPhotoLoadListener, this); Loading Loading @@ -1100,7 +1119,8 @@ final class Call implements CreateConnectionResponse { Log.w(Call.this, "Error obtaining canned SMS responses: %d %s", code, msg); } } }, mContext ); } else { Log.d(this, "maybeLoadCannedSmsResponses: doing nothing"); Loading
src/com/android/server/telecom/CallActivity.java +3 −1 Original line number Diff line number Diff line Loading @@ -32,6 +32,8 @@ import android.telephony.PhoneNumberUtils; import android.text.TextUtils; import android.widget.Toast; // TODO: Needed for move to system service: import com.android.internal.R; /** * Activity that handles system CALL actions and forwards them to {@link CallsManager}. * Handles all three CALL action types: CALL, CALL_PRIVILEGED, and CALL_EMERGENCY. Loading Loading @@ -159,7 +161,7 @@ public class CallActivity extends Activity { setResult(RESULT_CANCELED); } else { NewOutgoingCallIntentBroadcaster broadcaster = new NewOutgoingCallIntentBroadcaster( mCallsManager, call, intent, isDefaultDialer()); this, mCallsManager, call, intent, isDefaultDialer()); final int result = broadcaster.processIntent(); final boolean success = result == DisconnectCause.NOT_DISCONNECTED; Loading
src/com/android/server/telecom/CallAudioManager.java +1 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ import android.media.AudioManager; import android.telecom.AudioState; import android.telecom.CallState; import com.google.common.base.Preconditions; import com.android.internal.util.Preconditions; import java.util.Objects; Loading