Loading android/app/jni/com_android_bluetooth_btservice_AdapterService.cpp +12 −0 Original line number Diff line number Diff line Loading @@ -1214,6 +1214,17 @@ static int readEnergyInfo() return result; } static void dumpNative(JNIEnv *env, jobject obj, jobject fdObj) { ALOGV("%s()", __FUNCTION__); if (!sBluetoothInterface) return; int fd = jniGetFDFromFileDescriptor(env, fdObj); if (fd < 0) return; sBluetoothInterface->dump(fd); } static JNINativeMethod sMethods[] = { /* name, signature, funcPtr */ {"classInitNative", "()V", (void *) classInitNative}, Loading Loading @@ -1242,6 +1253,7 @@ static JNINativeMethod sMethods[] = { {"configHciSnoopLogNative", "(Z)Z", (void*) configHciSnoopLogNative}, {"alarmFiredNative", "()V", (void *) alarmFiredNative}, {"readEnergyInfo", "()I", (void*) readEnergyInfo}, {"dumpNative", "(Ljava/io/FileDescriptor;)V", (void*) dumpNative}, }; int register_com_android_bluetooth_btservice_AdapterService(JNIEnv* env) Loading android/app/src/com/android/bluetooth/btservice/AdapterService.java +35 −15 Original line number Diff line number Diff line Loading @@ -66,6 +66,7 @@ import com.android.bluetooth.btservice.RemoteDevices.DeviceProperties; import com.android.internal.R; import java.io.FileDescriptor; import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; Loading Loading @@ -1141,12 +1142,10 @@ public class AdapterService extends Service { return service.reportActivityInfo(); } public String dump() { public void dump(ParcelFileDescriptor fd) { AdapterService service = getService(); if (service == null) { return "AdapterService is null"; } return service.dump(); if (service == null) return; service.dump(fd.getFileDescriptor()); } }; Loading Loading @@ -1730,16 +1729,6 @@ public class AdapterService extends Service { return info; } private String dump() { StringBuilder sb = new StringBuilder(); synchronized (mProfiles) { for (ProfileService profile : mProfiles) { profile.dump(sb); } } return sb.toString(); } private static int convertScanModeToHal(int mode) { switch (mode) { case BluetoothAdapter.SCAN_MODE_NONE: Loading Loading @@ -1857,6 +1846,36 @@ public class AdapterService extends Service { } } private void dump(FileDescriptor fd) { // Collect profile information StringBuilder sb = new StringBuilder(); synchronized (mProfiles) { for (ProfileService profile : mProfiles) { profile.dump(sb); } } // Dump Java based profiles first FileWriter fw = null; try { fw = new FileWriter(fd); fw.write(sb.toString()); } catch (IOException ex) { errorLog("IOException writing profile status!"); } finally { if (fw != null) { try { fw.close(); } catch (IOException ex) { debugLog("IOException closing a file after writing the profile status"); } } } // Add native logs dumpNative(fd); } private void debugLog(String msg) { if (DBG) Log.d(TAG +"(" +hashCode()+")", msg); } Loading Loading @@ -1911,6 +1930,7 @@ public class AdapterService extends Service { /*package*/ native boolean configHciSnoopLogNative(boolean enable); private native void alarmFiredNative(); private native void dumpNative(FileDescriptor fd); protected void finalize() { cleanup(); Loading android/app/src/com/android/bluetooth/btservice/ProfileService.java +1 −1 Original line number Diff line number Diff line Loading @@ -161,7 +161,7 @@ public abstract class ProfileService extends Service { // for dumpsys support public void dump(StringBuilder sb) { sb.append("Profile: " + mName + "\n"); sb.append("\nProfile: " + mName + "\n"); } // with indenting for subclasses Loading Loading
android/app/jni/com_android_bluetooth_btservice_AdapterService.cpp +12 −0 Original line number Diff line number Diff line Loading @@ -1214,6 +1214,17 @@ static int readEnergyInfo() return result; } static void dumpNative(JNIEnv *env, jobject obj, jobject fdObj) { ALOGV("%s()", __FUNCTION__); if (!sBluetoothInterface) return; int fd = jniGetFDFromFileDescriptor(env, fdObj); if (fd < 0) return; sBluetoothInterface->dump(fd); } static JNINativeMethod sMethods[] = { /* name, signature, funcPtr */ {"classInitNative", "()V", (void *) classInitNative}, Loading Loading @@ -1242,6 +1253,7 @@ static JNINativeMethod sMethods[] = { {"configHciSnoopLogNative", "(Z)Z", (void*) configHciSnoopLogNative}, {"alarmFiredNative", "()V", (void *) alarmFiredNative}, {"readEnergyInfo", "()I", (void*) readEnergyInfo}, {"dumpNative", "(Ljava/io/FileDescriptor;)V", (void*) dumpNative}, }; int register_com_android_bluetooth_btservice_AdapterService(JNIEnv* env) Loading
android/app/src/com/android/bluetooth/btservice/AdapterService.java +35 −15 Original line number Diff line number Diff line Loading @@ -66,6 +66,7 @@ import com.android.bluetooth.btservice.RemoteDevices.DeviceProperties; import com.android.internal.R; import java.io.FileDescriptor; import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; Loading Loading @@ -1141,12 +1142,10 @@ public class AdapterService extends Service { return service.reportActivityInfo(); } public String dump() { public void dump(ParcelFileDescriptor fd) { AdapterService service = getService(); if (service == null) { return "AdapterService is null"; } return service.dump(); if (service == null) return; service.dump(fd.getFileDescriptor()); } }; Loading Loading @@ -1730,16 +1729,6 @@ public class AdapterService extends Service { return info; } private String dump() { StringBuilder sb = new StringBuilder(); synchronized (mProfiles) { for (ProfileService profile : mProfiles) { profile.dump(sb); } } return sb.toString(); } private static int convertScanModeToHal(int mode) { switch (mode) { case BluetoothAdapter.SCAN_MODE_NONE: Loading Loading @@ -1857,6 +1846,36 @@ public class AdapterService extends Service { } } private void dump(FileDescriptor fd) { // Collect profile information StringBuilder sb = new StringBuilder(); synchronized (mProfiles) { for (ProfileService profile : mProfiles) { profile.dump(sb); } } // Dump Java based profiles first FileWriter fw = null; try { fw = new FileWriter(fd); fw.write(sb.toString()); } catch (IOException ex) { errorLog("IOException writing profile status!"); } finally { if (fw != null) { try { fw.close(); } catch (IOException ex) { debugLog("IOException closing a file after writing the profile status"); } } } // Add native logs dumpNative(fd); } private void debugLog(String msg) { if (DBG) Log.d(TAG +"(" +hashCode()+")", msg); } Loading Loading @@ -1911,6 +1930,7 @@ public class AdapterService extends Service { /*package*/ native boolean configHciSnoopLogNative(boolean enable); private native void alarmFiredNative(); private native void dumpNative(FileDescriptor fd); protected void finalize() { cleanup(); Loading
android/app/src/com/android/bluetooth/btservice/ProfileService.java +1 −1 Original line number Diff line number Diff line Loading @@ -161,7 +161,7 @@ public abstract class ProfileService extends Service { // for dumpsys support public void dump(StringBuilder sb) { sb.append("Profile: " + mName + "\n"); sb.append("\nProfile: " + mName + "\n"); } // with indenting for subclasses Loading