Miao Chou | 658bf2f | 2015-06-26 17:14:35 -0700 | [diff] [blame] | 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 | |
| 17 | package com.android.server; |
| 18 | |
| 19 | import android.bluetooth.BluetoothAdapter; |
| 20 | import android.content.Context; |
Miao Chou | 658bf2f | 2015-06-26 17:14:35 -0700 | [diff] [blame] | 21 | |
| 22 | class BluetoothService extends SystemService { |
Miao Chou | 658bf2f | 2015-06-26 17:14:35 -0700 | [diff] [blame] | 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() { |
Miao Chou | 658bf2f | 2015-06-26 17:14:35 -0700 | [diff] [blame] | 32 | } |
| 33 | |
| 34 | @Override |
| 35 | public void onBootPhase(int phase) { |
| 36 | if (phase == SystemService.PHASE_SYSTEM_SERVICES_READY) { |
Jeff Sharkey | aacb89e | 2016-03-05 14:42:58 -0700 | [diff] [blame] | 37 | publishBinderService(BluetoothAdapter.BLUETOOTH_MANAGER_SERVICE, |
| 38 | mBluetoothManagerService); |
Andre Eisenbach | 305fdab | 2015-11-11 21:43:26 -0800 | [diff] [blame] | 39 | } else if (phase == SystemService.PHASE_ACTIVITY_MANAGER_READY) { |
Miao Chou | 658bf2f | 2015-06-26 17:14:35 -0700 | [diff] [blame] | 40 | mBluetoothManagerService.handleOnBootPhase(); |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | @Override |
| 45 | public void onSwitchUser(int userHandle) { |
Miao Chou | 658bf2f | 2015-06-26 17:14:35 -0700 | [diff] [blame] | 46 | mBluetoothManagerService.handleOnSwitchUser(userHandle); |
| 47 | } |
Jeff Sharkey | aacb89e | 2016-03-05 14:42:58 -0700 | [diff] [blame] | 48 | |
| 49 | @Override |
| 50 | public void onUnlockUser(int userHandle) { |
| 51 | mBluetoothManagerService.handleOnUnlockUser(userHandle); |
| 52 | } |
Miao Chou | 658bf2f | 2015-06-26 17:14:35 -0700 | [diff] [blame] | 53 | } |