AdapterApp.java revision fd1da115cbf09b7dd9bca3c7d3a4fb816a835dc5
1/*
2 * Copyright (C) 2012 Google Inc.
3 */
4
5/**
6 * @hide
7 */
8
9package com.android.bluetooth.btservice;
10
11import android.app.Application;
12import android.util.Log;
13
14public class AdapterApp extends Application {
15    private static final String TAG = "BluetoothAdapterApp";
16    private static final boolean DBG = false;
17    //For Debugging only
18    private static int sRefCount=0;
19
20    static {
21        if (DBG) Log.d(TAG,"Loading JNI Library");
22        System.loadLibrary("bluetooth_jni");
23    }
24
25    public AdapterApp() {
26        super();
27        if (DBG) {
28            synchronized (AdapterApp.class) {
29                sRefCount++;
30                Log.d(TAG, "REFCOUNT: Constructed "+ this + " Instance Count = " + sRefCount);
31            }
32        }
33    }
34
35    @Override
36    public void onCreate() {
37        super.onCreate();
38        if (DBG) Log.d(TAG, "onCreate");
39        Config.init(this);
40    }
41
42    @Override
43    protected void finalize() {
44        if (DBG) {
45            synchronized (AdapterApp.class) {
46                sRefCount--;
47                Log.d(TAG, "REFCOUNT: Finalized: " + this +", Instance Count = " + sRefCount);
48            }
49        }
50    }
51}
52