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

Commit 3551a50d authored by Myles Watson's avatar Myles Watson
Browse files

OPP: Add dumpsys output

Dump the size and direction for recent shares.

Profile: BluetoothOppService
  Shares:
    12.20@15:24:25: -> 27/27B
    12.20@15:42:00: <- 1647024/1647024B
    12.20@16:12:54: <- 1116437/1116437B
    12.21@07:24:38: <- 1752058B/3067823

Test: adb shell dumpsys bluetooth_manager
Change-Id: Ia87638d50de69a8cda4ca65d0fb3fc9710ec94e9
parent 7c156f68
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -63,7 +63,10 @@ import com.android.bluetooth.sdp.SdpManager;
import com.google.android.collect.Lists;

import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Locale;

import javax.obex.ObexTransport;

@@ -233,6 +236,21 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti
        }
    }

    @Override
    public void dump(StringBuilder sb) {
        super.dump(sb);
        if (mShares.size() > 0) {
            println(sb, "Shares:");
            for (BluetoothOppShareInfo info : mShares) {
                String dir = info.mDirection == BluetoothShare.DIRECTION_OUTBOUND ? "->" : "<-";
                SimpleDateFormat format = new SimpleDateFormat("MM'.'dd'@'HH':'mm':'ss", Locale.US);
                Date date = new Date(info.mTimestamp);
                println(sb, "  " + format.format(date) + ": " + dir + " " + info.mCurrentBytes + "/"
                        + info.mTotalBytes + "B ");
            }
        }
    }

    private static final int START_LISTENER = 1;

    private static final int MEDIA_SCANNED = 2;