1/*
2 * Copyright (C) 2012 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
17/**
18 * @hide
19 */
20
21package com.android.bluetooth.btservice;
22
23import android.app.Application;
24import android.util.Log;
25
26public class AdapterApp extends Application {
27    private static final String TAG = "BluetoothAdapterApp";
28    private static final boolean DBG = false;
29    //For Debugging only
30    private static int sRefCount = 0;
31
32    static {
33        if (DBG) {
34            Log.d(TAG, "Loading JNI Library");
35        }
36        System.loadLibrary("bluetooth_jni");
37    }
38
39    public AdapterApp() {
40        super();
41        if (DBG) {
42            synchronized (AdapterApp.class) {
43                sRefCount++;
44                Log.d(TAG, "REFCOUNT: Constructed " + this + " Instance Count = " + sRefCount);
45            }
46        }
47    }
48
49    @Override
50    public void onCreate() {
51        super.onCreate();
52        if (DBG) {
53            Log.d(TAG, "onCreate");
54        }
55        Config.init(this);
56    }
57
58    @Override
59    protected void finalize() {
60        if (DBG) {
61            synchronized (AdapterApp.class) {
62                sRefCount--;
63                Log.d(TAG, "REFCOUNT: Finalized: " + this + ", Instance Count = " + sRefCount);
64            }
65        }
66    }
67}
68