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 
21 package com.android.bluetooth.btservice;
22 
23 import android.app.Application;
24 import android.util.Log;
25 
26 public 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 {
Log.d(TAG,"Loading JNI Library")33         if (DBG) Log.d(TAG,"Loading JNI Library");
34         System.loadLibrary("bluetooth_jni");
35     }
36 
AdapterApp()37     public AdapterApp() {
38         super();
39         if (DBG) {
40             synchronized (AdapterApp.class) {
41                 sRefCount++;
42                 Log.d(TAG, "REFCOUNT: Constructed "+ this + " Instance Count = " + sRefCount);
43             }
44         }
45     }
46 
47     @Override
onCreate()48     public void onCreate() {
49         super.onCreate();
50         if (DBG) Log.d(TAG, "onCreate");
51         Config.init(this);
52     }
53 
54     @Override
finalize()55     protected void finalize() {
56         if (DBG) {
57             synchronized (AdapterApp.class) {
58                 sRefCount--;
59                 Log.d(TAG, "REFCOUNT: Finalized: " + this +", Instance Count = " + sRefCount);
60             }
61         }
62     }
63 }
64