1155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande/* 2155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * Copyright (C) 2010 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; 18155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande 19155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpandeimport android.content.Context; 20155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpandeimport android.util.Log; 21bcdabb1fa1894fcca610692ec94459fe623afa74Bartosz Fabianowski 22155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpandeimport com.android.server.SystemService; 23f2fdf411925ad172b5e0b25b0c6df880256691d4Sohani Raoimport com.android.server.wifi.util.WifiAsyncChannel; 24155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande 25155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpandepublic final class WifiService extends SystemService { 26155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande 27155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande private static final String TAG = "WifiService"; 288d4d3c2834917d7725385d31b821ab5a8e35d600Narayan Kamath final WifiServiceImpl mImpl; 29155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande 308d4d3c2834917d7725385d31b821ab5a8e35d600Narayan Kamath public WifiService(Context context) { 318d4d3c2834917d7725385d31b821ab5a8e35d600Narayan Kamath super(context); 32f2fdf411925ad172b5e0b25b0c6df880256691d4Sohani Rao mImpl = new WifiServiceImpl(context, new WifiInjector(context), new WifiAsyncChannel(TAG)); 33155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande } 34155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande 35155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande @Override 36155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande public void onStart() { 37155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande Log.i(TAG, "Registering " + Context.WIFI_SERVICE); 38155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande publishBinderService(Context.WIFI_SERVICE, mImpl); 39155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande } 40155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande 41155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande @Override 42155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande public void onBootPhase(int phase) { 43155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande if (phase == SystemService.PHASE_SYSTEM_SERVICES_READY) { 44155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande mImpl.checkAndStartWifi(); 45155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande } 46155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande } 47bcdabb1fa1894fcca610692ec94459fe623afa74Bartosz Fabianowski 48bcdabb1fa1894fcca610692ec94459fe623afa74Bartosz Fabianowski @Override 49bcdabb1fa1894fcca610692ec94459fe623afa74Bartosz Fabianowski public void onSwitchUser(int userId) { 50bcdabb1fa1894fcca610692ec94459fe623afa74Bartosz Fabianowski mImpl.handleUserSwitch(userId); 51bcdabb1fa1894fcca610692ec94459fe623afa74Bartosz Fabianowski } 523bc487aa49deecbc358ee819e0dd4b2534412281Roshan Pius 533bc487aa49deecbc358ee819e0dd4b2534412281Roshan Pius @Override 543bc487aa49deecbc358ee819e0dd4b2534412281Roshan Pius public void onUnlockUser(int userId) { 553bc487aa49deecbc358ee819e0dd4b2534412281Roshan Pius mImpl.handleUserUnlock(userId); 563bc487aa49deecbc358ee819e0dd4b2534412281Roshan Pius } 573bc487aa49deecbc358ee819e0dd4b2534412281Roshan Pius 583bc487aa49deecbc358ee819e0dd4b2534412281Roshan Pius @Override 593bc487aa49deecbc358ee819e0dd4b2534412281Roshan Pius public void onStopUser(int userId) { 603bc487aa49deecbc358ee819e0dd4b2534412281Roshan Pius mImpl.handleUserStop(userId); 613bc487aa49deecbc358ee819e0dd4b2534412281Roshan Pius } 62155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande} 63