Search in sources :

Example 26 with TransferPipe

use of com.android.internal.os.TransferPipe in project android_frameworks_base by ResurrectionRemix.

the class ActiveServices method dumpService.

/**
     * Invokes IApplicationThread.dumpService() on the thread of the specified service if
     * there is a thread associated with the service.
     */
private void dumpService(String prefix, FileDescriptor fd, PrintWriter pw, final ServiceRecord r, String[] args, boolean dumpAll) {
    String innerPrefix = prefix + "  ";
    synchronized (mAm) {
        pw.print(prefix);
        pw.print("SERVICE ");
        pw.print(r.shortName);
        pw.print(" ");
        pw.print(Integer.toHexString(System.identityHashCode(r)));
        pw.print(" pid=");
        if (r.app != null)
            pw.println(r.app.pid);
        else
            pw.println("(not running)");
        if (dumpAll) {
            r.dump(pw, innerPrefix);
        }
    }
    if (r.app != null && r.app.thread != null) {
        pw.print(prefix);
        pw.println("  Client:");
        pw.flush();
        try {
            TransferPipe tp = new TransferPipe();
            try {
                r.app.thread.dumpService(tp.getWriteFd().getFileDescriptor(), r, args);
                tp.setBufferPrefix(prefix + "    ");
                tp.go(fd);
            } finally {
                tp.kill();
            }
        } catch (IOException e) {
            pw.println(prefix + "    Failure while dumping the service: " + e);
        } catch (RemoteException e) {
            pw.println(prefix + "    Got a RemoteException while dumping the service");
        }
    }
}
Also used : IOException(java.io.IOException) RemoteException(android.os.RemoteException) TransferPipe(com.android.internal.os.TransferPipe)

Example 27 with TransferPipe

use of com.android.internal.os.TransferPipe in project android_frameworks_base by ResurrectionRemix.

the class ActivityManager method dumpService.

private static void dumpService(PrintWriter pw, FileDescriptor fd, String name, String[] args) {
    pw.print("DUMP OF SERVICE ");
    pw.print(name);
    pw.println(":");
    IBinder service = ServiceManager.checkService(name);
    if (service == null) {
        pw.println("  (Service not found)");
        return;
    }
    TransferPipe tp = null;
    try {
        pw.flush();
        tp = new TransferPipe();
        tp.setBufferPrefix("  ");
        service.dumpAsync(tp.getWriteFd().getFileDescriptor(), args);
        tp.go(fd, 10000);
    } catch (Throwable e) {
        if (tp != null) {
            tp.kill();
        }
        pw.println("Failure dumping service:");
        e.printStackTrace(pw);
    }
}
Also used : IBinder(android.os.IBinder) TransferPipe(com.android.internal.os.TransferPipe)

Example 28 with TransferPipe

use of com.android.internal.os.TransferPipe in project android_frameworks_base by crdroidandroid.

the class ActiveServices method dumpService.

/**
     * Invokes IApplicationThread.dumpService() on the thread of the specified service if
     * there is a thread associated with the service.
     */
private void dumpService(String prefix, FileDescriptor fd, PrintWriter pw, final ServiceRecord r, String[] args, boolean dumpAll) {
    String innerPrefix = prefix + "  ";
    synchronized (mAm) {
        pw.print(prefix);
        pw.print("SERVICE ");
        pw.print(r.shortName);
        pw.print(" ");
        pw.print(Integer.toHexString(System.identityHashCode(r)));
        pw.print(" pid=");
        if (r.app != null)
            pw.println(r.app.pid);
        else
            pw.println("(not running)");
        if (dumpAll) {
            r.dump(pw, innerPrefix);
        }
    }
    if (r.app != null && r.app.thread != null) {
        pw.print(prefix);
        pw.println("  Client:");
        pw.flush();
        try {
            TransferPipe tp = new TransferPipe();
            try {
                r.app.thread.dumpService(tp.getWriteFd().getFileDescriptor(), r, args);
                tp.setBufferPrefix(prefix + "    ");
                tp.go(fd);
            } finally {
                tp.kill();
            }
        } catch (IOException e) {
            pw.println(prefix + "    Failure while dumping the service: " + e);
        } catch (RemoteException e) {
            pw.println(prefix + "    Got a RemoteException while dumping the service");
        }
    }
}
Also used : IOException(java.io.IOException) RemoteException(android.os.RemoteException) TransferPipe(com.android.internal.os.TransferPipe)

Aggregations

TransferPipe (com.android.internal.os.TransferPipe)28 RemoteException (android.os.RemoteException)23 IOException (java.io.IOException)23 IBinder (android.os.IBinder)5 Point (android.graphics.Point)4 FastPrintWriter (com.android.internal.util.FastPrintWriter)2 FileOutputStream (java.io.FileOutputStream)2 PrintWriter (java.io.PrintWriter)2