WifiP2pService.java revision a98acb37d4c6bf43d61b676817a5f839e11641e6
1/*
2 * Copyright (C) 2011 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.wifi.p2p;
18
19import android.content.Context;
20import android.util.Log;
21
22import com.android.server.SystemService;
23
24/**
25 * Wifi P2p Service class, instantiates P2p service
26 * Overrides onStart() and onBootPhase() methods in
27 * the super class.
28 */
29public final class WifiP2pService extends SystemService {
30
31    private static final String TAG = "WifiP2pService";
32    final WifiP2pServiceImpl mImpl;
33
34    public WifiP2pService(Context context) {
35        super(context);
36        mImpl = new WifiP2pServiceImpl(context);
37    }
38
39    @Override
40    public void onStart() {
41        Log.i(TAG, "Registering " + Context.WIFI_P2P_SERVICE);
42        publishBinderService(Context.WIFI_P2P_SERVICE, mImpl);
43    }
44
45    @Override
46    public void onBootPhase(int phase) {
47        if (phase == SystemService.PHASE_SYSTEM_SERVICES_READY) {
48            mImpl.connectivityServiceReady();
49        }
50    }
51}
52