1/* 2 * Copyright (C) 2010 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; 18 19import android.content.Context; 20import android.util.Log; 21 22import com.android.server.SystemService; 23import com.android.server.wifi.util.WifiAsyncChannel; 24 25public final class WifiService extends SystemService { 26 27 private static final String TAG = "WifiService"; 28 final WifiServiceImpl mImpl; 29 30 public WifiService(Context context) { 31 super(context); 32 mImpl = new WifiServiceImpl(context, new WifiInjector(context), new WifiAsyncChannel(TAG)); 33 } 34 35 @Override 36 public void onStart() { 37 Log.i(TAG, "Registering " + Context.WIFI_SERVICE); 38 publishBinderService(Context.WIFI_SERVICE, mImpl); 39 } 40 41 @Override 42 public void onBootPhase(int phase) { 43 if (phase == SystemService.PHASE_SYSTEM_SERVICES_READY) { 44 mImpl.checkAndStartWifi(); 45 } 46 } 47 48 @Override 49 public void onSwitchUser(int userId) { 50 mImpl.handleUserSwitch(userId); 51 } 52 53 @Override 54 public void onUnlockUser(int userId) { 55 mImpl.handleUserUnlock(userId); 56 } 57 58 @Override 59 public void onStopUser(int userId) { 60 mImpl.handleUserStop(userId); 61 } 62} 63