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

Commit eb4cc492 authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

Protect system services with DUMP permission.

Change-Id: I5e53859f8b8e5473e54eca43ebd7de841f1a05ff
parent 7725180c
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -588,6 +588,8 @@ public class BluetoothA2dpService extends IBluetoothA2dp.Stub {

    @Override
    protected synchronized void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
        mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, TAG);

        if (mAudioDevices.isEmpty()) return;
        pw.println("Cached audio devices:");
        for (BluetoothDevice device : mAudioDevices.keySet()) {
+2 −0
Original line number Diff line number Diff line
@@ -1775,6 +1775,8 @@ public class BluetoothService extends IBluetooth.Stub {

    @Override
    protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
        mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, TAG);

        if (getBluetoothStateInternal() != BluetoothAdapter.STATE_ON) {
            return;
        }
+2 −0
Original line number Diff line number Diff line
@@ -169,6 +169,8 @@ public class DreamManagerService
    
    @Override
    protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
        mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, TAG);

        pw.println("Dreamland:");
        pw.print("  component="); pw.println(mCurrentDreamComponent);
        pw.print("  token="); pw.println(mCurrentDreamToken);
+2 −0
Original line number Diff line number Diff line
@@ -4085,6 +4085,8 @@ public class AudioService extends IAudioService.Stub {

    @Override
    protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
        mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, TAG);

        // TODO probably a lot more to do here than just the audio focus and remote control stacks
        dumpFocusStack(pw);
        dumpRCStack(pw);
+0 −8
Original line number Diff line number Diff line
@@ -111,14 +111,6 @@ public class SystemUIService extends Service {

    @Override
    protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
        if (checkCallingOrSelfPermission(android.Manifest.permission.DUMP)
                != PackageManager.PERMISSION_GRANTED) {
            pw.println("Permission Denial: can't dump StatusBar from from pid="
                    + Binder.getCallingPid()
                    + ", uid=" + Binder.getCallingUid());
            return;
        }

        if (args == null || args.length == 0) {
            for (SystemUI ui: mServices) {
                pw.println("dumping service: " + ui.getClass().getName());
Loading