Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5a6b44c4 authored by Tucker Sylvestro's avatar Tucker Sylvestro Committed by Android (Google) Code Review
Browse files

Merge "DO NOT MERGE ANYWHERE Bluetooth native dumpsys logging support (3/4)"...

Merge "DO NOT MERGE ANYWHERE Bluetooth native dumpsys logging support (3/4)" into lmp-mr1-modular-dev
parents bd438742 a0eaaa2a
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -99,6 +99,6 @@ interface IBluetooth
    void getActivityEnergyInfoFromController();
    BluetoothActivityEnergyInfo reportActivityInfo();

    // for dumpsys support
    String dump();
    // For dumpsys support
    void dump(in ParcelFileDescriptor fd);
}
+14 −5
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
import android.os.ParcelFileDescriptor;
import android.os.Process;
import android.os.RemoteCallbackList;
import android.os.RemoteException;
@@ -51,6 +52,7 @@ import android.provider.Settings;
import android.util.Log;

import java.io.FileDescriptor;
import java.io.IOException;
import java.io.PrintWriter;

import java.util.HashMap;
@@ -1523,17 +1525,24 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
    public void dump(FileDescriptor fd, PrintWriter writer, String[] args) {
        mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, TAG);

        writer.println("Bluetooth Status");
        writer.println("  enabled: " + mEnable);
        writer.println("  state: " + mState);
        writer.println("  address: " + mAddress);
        writer.println("name: " + mName);
        writer.println("  name: " + mName + "\n");
        writer.flush();

        if (mBluetooth == null) {
            writer.println("Bluetooth Service not connected");
        } else {
            try {
                writer.println(mBluetooth.dump());
                ParcelFileDescriptor pfd = ParcelFileDescriptor.dup(fd);
                mBluetooth.dump(pfd);
                pfd.close();
            } catch (RemoteException re) {
                writer.println("RemoteException while calling Bluetooth Service");
            } catch (IOException re) {
                writer.println("IOException attempting to dup() fd");
            }
        }
    }