16654f5c903de510a70f9e72cd5ad7837b615d93ffredc/* 2ede67c26e7b2564ea35db6d9b3027a269c150e13Zhihai Xu * Copyright (C) 2012 The Android Open Source Project 3ede67c26e7b2564ea35db6d9b3027a269c150e13Zhihai Xu * 4ede67c26e7b2564ea35db6d9b3027a269c150e13Zhihai Xu * Licensed under the Apache License, Version 2.0 (the "License"); 5ede67c26e7b2564ea35db6d9b3027a269c150e13Zhihai Xu * you may not use this file except in compliance with the License. 6ede67c26e7b2564ea35db6d9b3027a269c150e13Zhihai Xu * You may obtain a copy of the License at 7ede67c26e7b2564ea35db6d9b3027a269c150e13Zhihai Xu * 8ede67c26e7b2564ea35db6d9b3027a269c150e13Zhihai Xu * http://www.apache.org/licenses/LICENSE-2.0 9ede67c26e7b2564ea35db6d9b3027a269c150e13Zhihai Xu * 10ede67c26e7b2564ea35db6d9b3027a269c150e13Zhihai Xu * Unless required by applicable law or agreed to in writing, software 11ede67c26e7b2564ea35db6d9b3027a269c150e13Zhihai Xu * distributed under the License is distributed on an "AS IS" BASIS, 12ede67c26e7b2564ea35db6d9b3027a269c150e13Zhihai Xu * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13ede67c26e7b2564ea35db6d9b3027a269c150e13Zhihai Xu * See the License for the specific language governing permissions and 14ede67c26e7b2564ea35db6d9b3027a269c150e13Zhihai Xu * limitations under the License. 156654f5c903de510a70f9e72cd5ad7837b615d93ffredc */ 166654f5c903de510a70f9e72cd5ad7837b615d93ffredc 176654f5c903de510a70f9e72cd5ad7837b615d93ffredc/** 186654f5c903de510a70f9e72cd5ad7837b615d93ffredc * @hide 196654f5c903de510a70f9e72cd5ad7837b615d93ffredc */ 206654f5c903de510a70f9e72cd5ad7837b615d93ffredc 216654f5c903de510a70f9e72cd5ad7837b615d93ffredcpackage com.android.bluetooth.btservice; 226654f5c903de510a70f9e72cd5ad7837b615d93ffredc 236654f5c903de510a70f9e72cd5ad7837b615d93ffredcimport android.app.Application; 246654f5c903de510a70f9e72cd5ad7837b615d93ffredcimport android.util.Log; 256654f5c903de510a70f9e72cd5ad7837b615d93ffredc 266654f5c903de510a70f9e72cd5ad7837b615d93ffredcpublic class AdapterApp extends Application { 276654f5c903de510a70f9e72cd5ad7837b615d93ffredc private static final String TAG = "BluetoothAdapterApp"; 28fd1da115cbf09b7dd9bca3c7d3a4fb816a835dc5Matthew Xie private static final boolean DBG = false; 2974ae04c73312403e89db0f8e9bd9601d403b4783fredc //For Debugging only 3074ae04c73312403e89db0f8e9bd9601d403b4783fredc private static int sRefCount=0; 316654f5c903de510a70f9e72cd5ad7837b615d93ffredc 3231ba132491053bc86d419a7d51fc04af3299c076fredc static { 3331ba132491053bc86d419a7d51fc04af3299c076fredc if (DBG) Log.d(TAG,"Loading JNI Library"); 3431ba132491053bc86d419a7d51fc04af3299c076fredc System.loadLibrary("bluetooth_jni"); 3531ba132491053bc86d419a7d51fc04af3299c076fredc } 366654f5c903de510a70f9e72cd5ad7837b615d93ffredc 3774ae04c73312403e89db0f8e9bd9601d403b4783fredc public AdapterApp() { 3874ae04c73312403e89db0f8e9bd9601d403b4783fredc super(); 3974ae04c73312403e89db0f8e9bd9601d403b4783fredc if (DBG) { 4074ae04c73312403e89db0f8e9bd9601d403b4783fredc synchronized (AdapterApp.class) { 4174ae04c73312403e89db0f8e9bd9601d403b4783fredc sRefCount++; 4274ae04c73312403e89db0f8e9bd9601d403b4783fredc Log.d(TAG, "REFCOUNT: Constructed "+ this + " Instance Count = " + sRefCount); 4374ae04c73312403e89db0f8e9bd9601d403b4783fredc } 4474ae04c73312403e89db0f8e9bd9601d403b4783fredc } 4574ae04c73312403e89db0f8e9bd9601d403b4783fredc } 4674ae04c73312403e89db0f8e9bd9601d403b4783fredc 476654f5c903de510a70f9e72cd5ad7837b615d93ffredc @Override 486654f5c903de510a70f9e72cd5ad7837b615d93ffredc public void onCreate() { 496654f5c903de510a70f9e72cd5ad7837b615d93ffredc super.onCreate(); 506654f5c903de510a70f9e72cd5ad7837b615d93ffredc if (DBG) Log.d(TAG, "onCreate"); 51a7e8ef3f77ac74449f817f36f570a3545285be85fredc Config.init(this); 526654f5c903de510a70f9e72cd5ad7837b615d93ffredc } 536654f5c903de510a70f9e72cd5ad7837b615d93ffredc 546654f5c903de510a70f9e72cd5ad7837b615d93ffredc @Override 5574ae04c73312403e89db0f8e9bd9601d403b4783fredc protected void finalize() { 5674ae04c73312403e89db0f8e9bd9601d403b4783fredc if (DBG) { 5774ae04c73312403e89db0f8e9bd9601d403b4783fredc synchronized (AdapterApp.class) { 5874ae04c73312403e89db0f8e9bd9601d403b4783fredc sRefCount--; 5974ae04c73312403e89db0f8e9bd9601d403b4783fredc Log.d(TAG, "REFCOUNT: Finalized: " + this +", Instance Count = " + sRefCount); 6074ae04c73312403e89db0f8e9bd9601d403b4783fredc } 6174ae04c73312403e89db0f8e9bd9601d403b4783fredc } 626654f5c903de510a70f9e72cd5ad7837b615d93ffredc } 636654f5c903de510a70f9e72cd5ad7837b615d93ffredc} 64