Loading android/app/src/com/android/bluetooth/hfpclient/HeadsetClientService.java +10 −9 Original line number Diff line number Diff line Loading @@ -64,10 +64,6 @@ public class HeadsetClientService extends ProfileService { public static final String HFP_CLIENT_STOP_TAG = "hfp_client_stop_tag"; static { NativeInterface.classInitNative(); } @Override public IProfileServiceBinder initBinder() { return new BluetoothHeadsetClientBinder(this); Loading @@ -78,8 +74,15 @@ public class HeadsetClientService extends ProfileService { if (DBG) { Log.d(TAG, "start()"); } if (sHeadsetClientService != null) { Log.w(TAG, "start(): start called without stop"); return false; } // Setup the JNI service NativeInterface.initializeNative(); mNativeInterface = new NativeInterface(); mNativeInterface.initializeNative(); mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); mSmFactory = new HeadsetClientStateMachineFactory(); Loading @@ -88,8 +91,6 @@ public class HeadsetClientService extends ProfileService { IntentFilter filter = new IntentFilter(AudioManager.VOLUME_CHANGED_ACTION); registerReceiver(mBroadcastReceiver, filter); mNativeInterface = new NativeInterface(); // Start the HfpClientConnectionService to create connection with telecom when HFP // connection is available. Intent startIntent = new Intent(this, HfpClientConnectionService.class); Loading Loading @@ -125,13 +126,13 @@ public class HeadsetClientService extends ProfileService { Intent stopIntent = new Intent(this, HfpClientConnectionService.class); stopIntent.putExtra(HFP_CLIENT_STOP_TAG, true); startService(stopIntent); mNativeInterface = null; // Stop the handler thread mSmThread.quit(); mSmThread = null; NativeInterface.cleanupNative(); mNativeInterface.cleanupNative(); mNativeInterface = null; return true; } Loading android/app/src/com/android/bluetooth/hfpclient/NativeInterface.java +6 −2 Original line number Diff line number Diff line Loading @@ -28,14 +28,18 @@ class NativeInterface { private static final String TAG = "NativeInterface"; private static final boolean DBG = false; static { classInitNative(); } NativeInterface() {} // Native methods that call into the JNI interface static native void classInitNative(); static native void initializeNative(); native void initializeNative(); static native void cleanupNative(); native void cleanupNative(); static native boolean connectNative(byte[] address); Loading Loading
android/app/src/com/android/bluetooth/hfpclient/HeadsetClientService.java +10 −9 Original line number Diff line number Diff line Loading @@ -64,10 +64,6 @@ public class HeadsetClientService extends ProfileService { public static final String HFP_CLIENT_STOP_TAG = "hfp_client_stop_tag"; static { NativeInterface.classInitNative(); } @Override public IProfileServiceBinder initBinder() { return new BluetoothHeadsetClientBinder(this); Loading @@ -78,8 +74,15 @@ public class HeadsetClientService extends ProfileService { if (DBG) { Log.d(TAG, "start()"); } if (sHeadsetClientService != null) { Log.w(TAG, "start(): start called without stop"); return false; } // Setup the JNI service NativeInterface.initializeNative(); mNativeInterface = new NativeInterface(); mNativeInterface.initializeNative(); mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); mSmFactory = new HeadsetClientStateMachineFactory(); Loading @@ -88,8 +91,6 @@ public class HeadsetClientService extends ProfileService { IntentFilter filter = new IntentFilter(AudioManager.VOLUME_CHANGED_ACTION); registerReceiver(mBroadcastReceiver, filter); mNativeInterface = new NativeInterface(); // Start the HfpClientConnectionService to create connection with telecom when HFP // connection is available. Intent startIntent = new Intent(this, HfpClientConnectionService.class); Loading Loading @@ -125,13 +126,13 @@ public class HeadsetClientService extends ProfileService { Intent stopIntent = new Intent(this, HfpClientConnectionService.class); stopIntent.putExtra(HFP_CLIENT_STOP_TAG, true); startService(stopIntent); mNativeInterface = null; // Stop the handler thread mSmThread.quit(); mSmThread = null; NativeInterface.cleanupNative(); mNativeInterface.cleanupNative(); mNativeInterface = null; return true; } Loading
android/app/src/com/android/bluetooth/hfpclient/NativeInterface.java +6 −2 Original line number Diff line number Diff line Loading @@ -28,14 +28,18 @@ class NativeInterface { private static final String TAG = "NativeInterface"; private static final boolean DBG = false; static { classInitNative(); } NativeInterface() {} // Native methods that call into the JNI interface static native void classInitNative(); static native void initializeNative(); native void initializeNative(); static native void cleanupNative(); native void cleanupNative(); static native boolean connectNative(byte[] address); Loading