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; 216862101a7cca8132c0d58afd4a96d890d55e2d79Sohani Rao 22155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpandeimport com.android.server.SystemService; 23155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande 246862101a7cca8132c0d58afd4a96d890d55e2d79Sohani Rao/** 256862101a7cca8132c0d58afd4a96d890d55e2d79Sohani Rao * Wifi P2p Service class, instantiates P2p service 266862101a7cca8132c0d58afd4a96d890d55e2d79Sohani Rao * Overrides onStart() and onBootPhase() methods in 276862101a7cca8132c0d58afd4a96d890d55e2d79Sohani Rao * the super class. 286862101a7cca8132c0d58afd4a96d890d55e2d79Sohani Rao */ 29155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpandepublic final class WifiP2pService extends SystemService { 30155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande 31a02919e73b463000769d708fd34ff62b9a866f29Yuhao Zheng private static final String TAG = "WifiP2pService"; 328d4d3c2834917d7725385d31b821ab5a8e35d600Narayan Kamath final WifiP2pServiceImpl mImpl; 33155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande 348d4d3c2834917d7725385d31b821ab5a8e35d600Narayan Kamath public WifiP2pService(Context context) { 358d4d3c2834917d7725385d31b821ab5a8e35d600Narayan Kamath super(context); 36155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande mImpl = new WifiP2pServiceImpl(context); 37155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande } 38155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande 39155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande @Override 40155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande public void onStart() { 41a02919e73b463000769d708fd34ff62b9a866f29Yuhao Zheng Log.i(TAG, "Registering " + Context.WIFI_P2P_SERVICE); 42155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande publishBinderService(Context.WIFI_P2P_SERVICE, mImpl); 43155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande } 44155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande 45155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande @Override 46155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande public void onBootPhase(int phase) { 47155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande if (phase == SystemService.PHASE_SYSTEM_SERVICES_READY) { 48155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande mImpl.connectivityServiceReady(); 49155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande } 50155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande } 51155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande} 52