1/*
2 * Copyright (C) 2015 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.server;
18
19import android.bluetooth.BluetoothAdapter;
20import android.content.Context;
21
22class BluetoothService extends SystemService {
23    private BluetoothManagerService mBluetoothManagerService;
24
25    public BluetoothService(Context context) {
26        super(context);
27        mBluetoothManagerService = new BluetoothManagerService(context);
28    }
29
30    @Override
31    public void onStart() {
32    }
33
34    @Override
35    public void onBootPhase(int phase) {
36        if (phase == SystemService.PHASE_SYSTEM_SERVICES_READY) {
37            publishBinderService(BluetoothAdapter.BLUETOOTH_MANAGER_SERVICE,
38                    mBluetoothManagerService);
39        } else if (phase == SystemService.PHASE_ACTIVITY_MANAGER_READY) {
40            mBluetoothManagerService.handleOnBootPhase();
41        }
42    }
43
44    @Override
45    public void onSwitchUser(int userHandle) {
46        mBluetoothManagerService.handleOnSwitchUser(userHandle);
47    }
48
49    @Override
50    public void onUnlockUser(int userHandle) {
51        mBluetoothManagerService.handleOnUnlockUser(userHandle);
52    }
53}
54