Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4a968a18 authored by Tyler Gunn's avatar Tyler Gunn Committed by Android Git Automerger
Browse files

am ce1a21ef: Merge "Preparatory work to move Telecom to system service." into lmp-dev

* commit 'ce1a21ef':
  Preparatory work to move Telecom to system service.
parents c95ebde4 ce1a21ef
Loading
Loading
Loading
Loading
+2 −14
Original line number Diff line number Diff line
@@ -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"
+12 −2
Original line number Diff line number Diff line
@@ -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;
@@ -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
@@ -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.");
@@ -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;
    }
+30 −10
Original line number Diff line number Diff line
@@ -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;
@@ -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;
@@ -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.
@@ -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,
@@ -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);
@@ -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);
@@ -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);

@@ -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();
    }

@@ -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,
@@ -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;
        }
@@ -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);
@@ -1041,7 +1060,7 @@ final class Call implements CreateConnectionResponse {
                        mCallerInfo.contactDisplayPhotoUri, this);
                ContactsAsyncHelper.startObtainPhotoAsync(
                        token,
                        TelecomApp.getInstance(),
                        mContext,
                        mCallerInfo.contactDisplayPhotoUri,
                        sPhotoLoadListener,
                        this);
@@ -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");
+3 −1
Original line number Diff line number Diff line
@@ -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.
@@ -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;

+1 −1
Original line number Diff line number Diff line
@@ -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