Loading android/app/src/com/android/bluetooth/btservice/AdapterService.java +0 −25 Original line number Diff line number Diff line Loading @@ -84,13 +84,9 @@ public class AdapterService extends Service { private static final String TAG = "BluetoothAdapterService"; private static final boolean DBG = true; private static final boolean VERBOSE = false; private static final boolean TRACE_REF = false; private static final int MIN_ADVT_INSTANCES_FOR_MA = 5; private static final int MIN_OFFLOADED_FILTERS = 10; private static final int MIN_OFFLOADED_SCAN_STORAGE_BYTES = 1024; //For Debugging only private static int sRefCount = 0; private long mBluetoothStartTime = 0; private final Object mEnergyInfoLock = new Object(); private int mStackReportedState; Loading Loading @@ -185,16 +181,6 @@ public class AdapterService extends Service { private ProfileObserver mProfileObserver; private PhonePolicy mPhonePolicy; public AdapterService() { super(); if (TRACE_REF) { synchronized (AdapterService.class) { sRefCount++; debugLog("AdapterService() - REFCOUNT: CREATED. INSTANCE_COUNT" + sRefCount); } } } public void addProfile(ProfileService profile) { synchronized (mProfiles) { if (!mProfiles.contains(profile)) { Loading Loading @@ -1686,7 +1672,6 @@ public class AdapterService extends Service { mQuietmode = quietMode; Message m = mAdapterStateMachine.obtainMessage(AdapterState.BLE_TURN_ON); mAdapterStateMachine.sendMessage(m); mBluetoothStartTime = System.currentTimeMillis(); return true; } Loading Loading @@ -2631,16 +2616,6 @@ public class AdapterService extends Service { private native void interopDatabaseAddNative(int feature, byte[] address, int length); @Override public void finalize() { if (TRACE_REF) { synchronized (AdapterService.class) { sRefCount--; debugLog("finalize() - REFCOUNT: FINALIZED. INSTANCE_COUNT= " + sRefCount); } } } // Returns if this is a mock object. This is currently used in testing so that we may not call // System.exit() while finalizing the object. Otherwise GC of mock objects unfortunately ends up // calling finalize() which in turn calls System.exit() and the process crashes. Loading android/app/src/com/android/bluetooth/btservice/ProfileService.java +0 −35 Original line number Diff line number Diff line Loading @@ -26,8 +26,6 @@ import android.util.Log; import com.android.bluetooth.Utils; import java.util.HashMap; /** * Base class for a background service that runs a Bluetooth profile */ Loading @@ -35,9 +33,6 @@ public abstract class ProfileService extends Service { private static final boolean DBG = false; private static final String TAG = "BluetoothProfileService"; //For Debugging only private static final HashMap<String, Integer> sReferenceCount = new HashMap<String, Integer>(); public static final String BLUETOOTH_ADMIN_PERM = android.Manifest.permission.BLUETOOTH_ADMIN; public static final String BLUETOOTH_PERM = android.Manifest.permission.BLUETOOTH; public static final String BLUETOOTH_PRIVILEGED = Loading Loading @@ -100,36 +95,6 @@ public abstract class ProfileService extends Service { protected ProfileService() { mName = getName(); if (DBG) { synchronized (sReferenceCount) { Integer refCount = sReferenceCount.get(mName); if (refCount == null) { refCount = 1; } else { refCount = refCount + 1; } sReferenceCount.put(mName, refCount); if (DBG) { log("REFCOUNT: CREATED. INSTANCE_COUNT=" + refCount); } } } } @Override protected void finalize() { if (DBG) { synchronized (sReferenceCount) { Integer refCount = sReferenceCount.get(mName); if (refCount != null) { refCount = refCount - 1; } else { refCount = 0; } sReferenceCount.put(mName, refCount); log("REFCOUNT: FINALIZED. INSTANCE_COUNT=" + refCount); } } } @Override Loading Loading
android/app/src/com/android/bluetooth/btservice/AdapterService.java +0 −25 Original line number Diff line number Diff line Loading @@ -84,13 +84,9 @@ public class AdapterService extends Service { private static final String TAG = "BluetoothAdapterService"; private static final boolean DBG = true; private static final boolean VERBOSE = false; private static final boolean TRACE_REF = false; private static final int MIN_ADVT_INSTANCES_FOR_MA = 5; private static final int MIN_OFFLOADED_FILTERS = 10; private static final int MIN_OFFLOADED_SCAN_STORAGE_BYTES = 1024; //For Debugging only private static int sRefCount = 0; private long mBluetoothStartTime = 0; private final Object mEnergyInfoLock = new Object(); private int mStackReportedState; Loading Loading @@ -185,16 +181,6 @@ public class AdapterService extends Service { private ProfileObserver mProfileObserver; private PhonePolicy mPhonePolicy; public AdapterService() { super(); if (TRACE_REF) { synchronized (AdapterService.class) { sRefCount++; debugLog("AdapterService() - REFCOUNT: CREATED. INSTANCE_COUNT" + sRefCount); } } } public void addProfile(ProfileService profile) { synchronized (mProfiles) { if (!mProfiles.contains(profile)) { Loading Loading @@ -1686,7 +1672,6 @@ public class AdapterService extends Service { mQuietmode = quietMode; Message m = mAdapterStateMachine.obtainMessage(AdapterState.BLE_TURN_ON); mAdapterStateMachine.sendMessage(m); mBluetoothStartTime = System.currentTimeMillis(); return true; } Loading Loading @@ -2631,16 +2616,6 @@ public class AdapterService extends Service { private native void interopDatabaseAddNative(int feature, byte[] address, int length); @Override public void finalize() { if (TRACE_REF) { synchronized (AdapterService.class) { sRefCount--; debugLog("finalize() - REFCOUNT: FINALIZED. INSTANCE_COUNT= " + sRefCount); } } } // Returns if this is a mock object. This is currently used in testing so that we may not call // System.exit() while finalizing the object. Otherwise GC of mock objects unfortunately ends up // calling finalize() which in turn calls System.exit() and the process crashes. Loading
android/app/src/com/android/bluetooth/btservice/ProfileService.java +0 −35 Original line number Diff line number Diff line Loading @@ -26,8 +26,6 @@ import android.util.Log; import com.android.bluetooth.Utils; import java.util.HashMap; /** * Base class for a background service that runs a Bluetooth profile */ Loading @@ -35,9 +33,6 @@ public abstract class ProfileService extends Service { private static final boolean DBG = false; private static final String TAG = "BluetoothProfileService"; //For Debugging only private static final HashMap<String, Integer> sReferenceCount = new HashMap<String, Integer>(); public static final String BLUETOOTH_ADMIN_PERM = android.Manifest.permission.BLUETOOTH_ADMIN; public static final String BLUETOOTH_PERM = android.Manifest.permission.BLUETOOTH; public static final String BLUETOOTH_PRIVILEGED = Loading Loading @@ -100,36 +95,6 @@ public abstract class ProfileService extends Service { protected ProfileService() { mName = getName(); if (DBG) { synchronized (sReferenceCount) { Integer refCount = sReferenceCount.get(mName); if (refCount == null) { refCount = 1; } else { refCount = refCount + 1; } sReferenceCount.put(mName, refCount); if (DBG) { log("REFCOUNT: CREATED. INSTANCE_COUNT=" + refCount); } } } } @Override protected void finalize() { if (DBG) { synchronized (sReferenceCount) { Integer refCount = sReferenceCount.get(mName); if (refCount != null) { refCount = refCount - 1; } else { refCount = 0; } sReferenceCount.put(mName, refCount); log("REFCOUNT: FINALIZED. INSTANCE_COUNT=" + refCount); } } } @Override Loading