1155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande/*
2155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * Copyright (C) 2011 The Android Open Source Project
3155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande *
4155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * Licensed under the Apache License, Version 2.0 (the "License");
5155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * you may not use this file except in compliance with the License.
6155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * You may obtain a copy of the License at
7155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande *
8155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande *      http://www.apache.org/licenses/LICENSE-2.0
9155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande *
10155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * Unless required by applicable law or agreed to in writing, software
11155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * distributed under the License is distributed on an "AS IS" BASIS,
12155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * See the License for the specific language governing permissions and
14155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * limitations under the License.
15155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande */
16155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande
17155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpandepackage com.android.server.wifi.p2p;
18155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande
19155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpandeimport android.content.Context;
20155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpandeimport android.util.Log;
21155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpandeimport com.android.server.SystemService;
22155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande
23155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpandepublic final class WifiP2pService extends SystemService {
24155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande
25a02919e73b463000769d708fd34ff62b9a866f29Yuhao Zheng    private static final String TAG = "WifiP2pService";
268d4d3c2834917d7725385d31b821ab5a8e35d600Narayan Kamath    final WifiP2pServiceImpl mImpl;
27155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande
288d4d3c2834917d7725385d31b821ab5a8e35d600Narayan Kamath    public WifiP2pService(Context context) {
298d4d3c2834917d7725385d31b821ab5a8e35d600Narayan Kamath        super(context);
30155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande        mImpl = new WifiP2pServiceImpl(context);
31155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande    }
32155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande
33155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande    @Override
34155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande    public void onStart() {
35a02919e73b463000769d708fd34ff62b9a866f29Yuhao Zheng        Log.i(TAG, "Registering " + Context.WIFI_P2P_SERVICE);
36155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande        publishBinderService(Context.WIFI_P2P_SERVICE, mImpl);
37155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande    }
38155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande
39155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande    @Override
40155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande    public void onBootPhase(int phase) {
41155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande        if (phase == SystemService.PHASE_SYSTEM_SERVICES_READY) {
42155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande            mImpl.connectivityServiceReady();
43155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande        }
44155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande    }
45155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande}
46