19ff7d2235427b211344fa58b608424805a21aa24Peng Xu/*
29ff7d2235427b211344fa58b608424805a21aa24Peng Xu * Copyright (C) 2016 The Android Open Source Project
39ff7d2235427b211344fa58b608424805a21aa24Peng Xu *
49ff7d2235427b211344fa58b608424805a21aa24Peng Xu * Licensed under the Apache License, Version 2.0 (the "License");
59ff7d2235427b211344fa58b608424805a21aa24Peng Xu * you may not use this file except in compliance with the License.
69ff7d2235427b211344fa58b608424805a21aa24Peng Xu * You may obtain a copy of the License at
79ff7d2235427b211344fa58b608424805a21aa24Peng Xu *
89ff7d2235427b211344fa58b608424805a21aa24Peng Xu *      http://www.apache.org/licenses/LICENSE-2.0
99ff7d2235427b211344fa58b608424805a21aa24Peng Xu *
109ff7d2235427b211344fa58b608424805a21aa24Peng Xu * Unless required by applicable law or agreed to in writing, software
119ff7d2235427b211344fa58b608424805a21aa24Peng Xu * distributed under the License is distributed on an "AS IS" BASIS,
129ff7d2235427b211344fa58b608424805a21aa24Peng Xu * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
139ff7d2235427b211344fa58b608424805a21aa24Peng Xu * See the License for the specific language governing permissions and
149ff7d2235427b211344fa58b608424805a21aa24Peng Xu * limitations under the License.
159ff7d2235427b211344fa58b608424805a21aa24Peng Xu */
169ff7d2235427b211344fa58b608424805a21aa24Peng Xu
179ff7d2235427b211344fa58b608424805a21aa24Peng Xupackage com.android.server;
189ff7d2235427b211344fa58b608424805a21aa24Peng Xu
199ff7d2235427b211344fa58b608424805a21aa24Peng Xuimport android.hardware.location.ContextHubService;
209ff7d2235427b211344fa58b608424805a21aa24Peng Xuimport android.content.Context;
219ff7d2235427b211344fa58b608424805a21aa24Peng Xuimport android.util.Log;
229ff7d2235427b211344fa58b608424805a21aa24Peng Xu
239ff7d2235427b211344fa58b608424805a21aa24Peng Xuclass ContextHubSystemService extends SystemService {
249ff7d2235427b211344fa58b608424805a21aa24Peng Xu    private static final String TAG = "ContextHubSystemService";
259ff7d2235427b211344fa58b608424805a21aa24Peng Xu    private final ContextHubService mContextHubService;
269ff7d2235427b211344fa58b608424805a21aa24Peng Xu
279ff7d2235427b211344fa58b608424805a21aa24Peng Xu    public ContextHubSystemService(Context context) {
289ff7d2235427b211344fa58b608424805a21aa24Peng Xu        super(context);
299ff7d2235427b211344fa58b608424805a21aa24Peng Xu        mContextHubService = new ContextHubService(context);
309ff7d2235427b211344fa58b608424805a21aa24Peng Xu    }
319ff7d2235427b211344fa58b608424805a21aa24Peng Xu
329ff7d2235427b211344fa58b608424805a21aa24Peng Xu    @Override
339ff7d2235427b211344fa58b608424805a21aa24Peng Xu    public void onStart() {
349ff7d2235427b211344fa58b608424805a21aa24Peng Xu    }
359ff7d2235427b211344fa58b608424805a21aa24Peng Xu
369ff7d2235427b211344fa58b608424805a21aa24Peng Xu    @Override
379ff7d2235427b211344fa58b608424805a21aa24Peng Xu    public void onBootPhase(int phase) {
389ff7d2235427b211344fa58b608424805a21aa24Peng Xu        if (phase == SystemService.PHASE_SYSTEM_SERVICES_READY) {
399ff7d2235427b211344fa58b608424805a21aa24Peng Xu            Log.d(TAG, "onBootPhase: PHASE_SYSTEM_SERVICES_READY");
409ff7d2235427b211344fa58b608424805a21aa24Peng Xu            publishBinderService(ContextHubService.CONTEXTHUB_SERVICE, mContextHubService);
419ff7d2235427b211344fa58b608424805a21aa24Peng Xu        }
429ff7d2235427b211344fa58b608424805a21aa24Peng Xu    }
439ff7d2235427b211344fa58b608424805a21aa24Peng Xu}
44