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

Commit ca8f7fb2 authored by Chen Chen's avatar Chen Chen
Browse files

Bluetooth updateability: Move BluetoothPhoneService out from Telecom

Bug: 147244266
Test: Fully test hfp manually, and run BluetoothInCallServiceTest
Change-Id: Id16ddd7a1beff9278ac816059d354b60de51aee5
parent df68d921
Loading
Loading
Loading
Loading
+0 −13
Original line number Diff line number Diff line
@@ -36,19 +36,6 @@ public class BluetoothHeadsetProxy {
        mBluetoothHeadset = headset;
    }

    public void clccResponse(int index, int direction, int status, int mode, boolean mpty,
            String number, int type) {

        mBluetoothHeadset.clccResponse(index, direction, status, mode, mpty, number, type);
    }

    public void phoneStateChanged(int numActive, int numHeld, int callState, String number,
            int type, String name) {

        mBluetoothHeadset.phoneStateChanged(numActive, numHeld, callState, number, type,
            name);
    }

    public List<BluetoothDevice> getConnectedDevices() {
        return mBluetoothHeadset.getConnectedDevices();
    }
+0 −932

File deleted.

Preview size limit exceeded, changes collapsed.

+0 −10
Original line number Diff line number Diff line
@@ -26,7 +26,6 @@ import com.android.server.telecom.ui.AudioProcessingNotification;
import com.android.server.telecom.ui.DisconnectedCallNotifier;
import com.android.server.telecom.ui.IncomingCallNotifier;
import com.android.server.telecom.ui.MissedCallNotifierImpl.MissedCallNotifierImplFactory;
import com.android.server.telecom.BluetoothPhoneServiceImpl.BluetoothPhoneServiceImplFactory;
import com.android.server.telecom.CallAudioManager.AudioServiceFactory;
import com.android.server.telecom.DefaultDialerCache.DefaultDialerManagerAdapter;
import com.android.server.telecom.ui.ToastFactory;
@@ -115,7 +114,6 @@ public class TelecomSystem {
    private final CallsManager mCallsManager;
    private final RespondViaSmsManager mRespondViaSmsManager;
    private final Context mContext;
    private final BluetoothPhoneServiceImpl mBluetoothPhoneServiceImpl;
    private final CallIntentProcessor mCallIntentProcessor;
    private final TelecomBroadcastIntentProcessor mTelecomBroadcastIntentProcessor;
    private final TelecomServiceImpl mTelecomServiceImpl;
@@ -192,8 +190,6 @@ public class TelecomSystem {
            ProximitySensorManagerFactory proximitySensorManagerFactory,
            InCallWakeLockControllerFactory inCallWakeLockControllerFactory,
            AudioServiceFactory audioServiceFactory,
            BluetoothPhoneServiceImplFactory
                    bluetoothPhoneServiceImplFactory,
            ConnectionServiceFocusManager.ConnectionServiceFocusManagerFactory
                    connectionServiceFocusManagerFactory,
            Timeouts.Adapter timeoutsAdapter,
@@ -350,8 +346,6 @@ public class TelecomSystem {
            mCallsManager.onUserSwitch(currentUserHandle);
        }

        mBluetoothPhoneServiceImpl = bluetoothPhoneServiceImplFactory.makeBluetoothPhoneServiceImpl(
                mContext, mLock, mCallsManager, mPhoneAccountRegistrar);
        mCallIntentProcessor = new CallIntentProcessor(mContext, mCallsManager, defaultDialerCache);
        mTelecomBroadcastIntentProcessor = new TelecomBroadcastIntentProcessor(
                mContext, mCallsManager);
@@ -389,10 +383,6 @@ public class TelecomSystem {
        return mCallsManager;
    }

    public BluetoothPhoneServiceImpl getBluetoothPhoneServiceImpl() {
        return mBluetoothPhoneServiceImpl;
    }

    public CallIntentProcessor getCallIntentProcessor() {
        return mCallIntentProcessor;
    }
+0 −42
Original line number Diff line number Diff line
/*
 * Copyright (C) 2014 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.server.telecom.components;

import com.android.server.telecom.TelecomSystem;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;

/**
 * Bluetooth headset manager for Telecom. This class shares the call state with the bluetooth device
 * and accepts call-related commands to perform on behalf of the BT device.
 */
public final class BluetoothPhoneService extends Service implements TelecomSystem.Component {

    @Override
    public IBinder onBind(Intent intent) {
        synchronized (getTelecomSystem().getLock()) {
            return getTelecomSystem().getBluetoothPhoneServiceImpl().getBinder();
        }
    }

    @Override
    public TelecomSystem getTelecomSystem() {
        return TelecomSystem.getInstance();
    }
}
+0 −17
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ package com.android.server.telecom.components;

import android.app.Service;
import android.app.role.RoleManager;
import android.bluetooth.BluetoothAdapter;
import android.content.Context;
import android.content.Intent;
import android.media.IAudioService;
@@ -35,8 +34,6 @@ import com.android.internal.telecom.IInternalServiceRetriever;
import com.android.internal.telecom.ITelecomLoader;
import com.android.internal.telecom.ITelecomService;
import com.android.server.telecom.AsyncRingtonePlayer;
import com.android.server.telecom.BluetoothAdapterProxy;
import com.android.server.telecom.BluetoothPhoneServiceImpl;
import com.android.server.telecom.CallAudioModeStateMachine;
import com.android.server.telecom.CallAudioRouteStateMachine;
import com.android.server.telecom.CallerInfoAsyncQueryFactory;
@@ -172,17 +169,6 @@ public class TelecomService extends Service implements TelecomSystem.Component {
                                            ServiceManager.getService(Context.AUDIO_SERVICE));
                                }
                            },
                            new BluetoothPhoneServiceImpl.BluetoothPhoneServiceImplFactory() {
                                @Override
                                public BluetoothPhoneServiceImpl makeBluetoothPhoneServiceImpl(
                                        Context context, TelecomSystem.SyncRoot lock,
                                        CallsManager callsManager,
                                        PhoneAccountRegistrar phoneAccountRegistrar) {
                                    return new BluetoothPhoneServiceImpl(context, lock,
                                            callsManager, new BluetoothAdapterProxy(),
                                            phoneAccountRegistrar);
                                }
                            },
                            ConnectionServiceFocusManager::new,
                            new Timeouts.Adapter(),
                            new AsyncRingtonePlayer(),
@@ -207,9 +193,6 @@ public class TelecomService extends Service implements TelecomSystem.Component {
                            new ContactsAsyncHelper.Factory(),
                            internalServiceRetriever.getDeviceIdleController()));
        }
        if (BluetoothAdapter.getDefaultAdapter() != null) {
            context.startService(new Intent(context, BluetoothPhoneService.class));
        }
    }

    @Override
Loading