Search in sources :

Example 21 with PrintWriterPrinter

use of android.util.PrintWriterPrinter in project android_frameworks_base by DirtyUnicorns.

the class PackageManagerShellCommand method runQueryIntentActivities.

private int runQueryIntentActivities() {
    Intent intent;
    try {
        intent = parseIntentAndUser();
    } catch (URISyntaxException e) {
        throw new RuntimeException(e.getMessage(), e);
    }
    try {
        List<ResolveInfo> result = mInterface.queryIntentActivities(intent, null, 0, mTargetUser).getList();
        PrintWriter pw = getOutPrintWriter();
        if (result == null || result.size() <= 0) {
            pw.println("No activities found");
        } else {
            if (!mComponents) {
                pw.print(result.size());
                pw.println(" activities found:");
                PrintWriterPrinter pr = new PrintWriterPrinter(pw);
                for (int i = 0; i < result.size(); i++) {
                    pw.print("  Activity #");
                    pw.print(i);
                    pw.println(":");
                    printResolveInfo(pr, "    ", result.get(i), mBrief, mComponents);
                }
            } else {
                PrintWriterPrinter pr = new PrintWriterPrinter(pw);
                for (int i = 0; i < result.size(); i++) {
                    printResolveInfo(pr, "", result.get(i), mBrief, mComponents);
                }
            }
        }
    } catch (RemoteException e) {
        throw new RuntimeException("Failed calling service", e);
    }
    return 0;
}
Also used : ResolveInfo(android.content.pm.ResolveInfo) PrintWriterPrinter(android.util.PrintWriterPrinter) Intent(android.content.Intent) URISyntaxException(java.net.URISyntaxException) RemoteException(android.os.RemoteException) PrintWriter(java.io.PrintWriter)

Example 22 with PrintWriterPrinter

use of android.util.PrintWriterPrinter in project android_frameworks_base by DirtyUnicorns.

the class PackageManagerShellCommand method runQueryIntentServices.

private int runQueryIntentServices() {
    Intent intent;
    try {
        intent = parseIntentAndUser();
    } catch (URISyntaxException e) {
        throw new RuntimeException(e.getMessage(), e);
    }
    try {
        List<ResolveInfo> result = mInterface.queryIntentServices(intent, null, 0, mTargetUser).getList();
        PrintWriter pw = getOutPrintWriter();
        if (result == null || result.size() <= 0) {
            pw.println("No services found");
        } else {
            if (!mComponents) {
                pw.print(result.size());
                pw.println(" services found:");
                PrintWriterPrinter pr = new PrintWriterPrinter(pw);
                for (int i = 0; i < result.size(); i++) {
                    pw.print("  Service #");
                    pw.print(i);
                    pw.println(":");
                    printResolveInfo(pr, "    ", result.get(i), mBrief, mComponents);
                }
            } else {
                PrintWriterPrinter pr = new PrintWriterPrinter(pw);
                for (int i = 0; i < result.size(); i++) {
                    printResolveInfo(pr, "", result.get(i), mBrief, mComponents);
                }
            }
        }
    } catch (RemoteException e) {
        throw new RuntimeException("Failed calling service", e);
    }
    return 0;
}
Also used : ResolveInfo(android.content.pm.ResolveInfo) PrintWriterPrinter(android.util.PrintWriterPrinter) Intent(android.content.Intent) URISyntaxException(java.net.URISyntaxException) RemoteException(android.os.RemoteException) PrintWriter(java.io.PrintWriter)

Example 23 with PrintWriterPrinter

use of android.util.PrintWriterPrinter in project android_frameworks_base by DirtyUnicorns.

the class Activity method dumpInner.

void dumpInner(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) {
    writer.print(prefix);
    writer.print("Local Activity ");
    writer.print(Integer.toHexString(System.identityHashCode(this)));
    writer.println(" State:");
    String innerPrefix = prefix + "  ";
    writer.print(innerPrefix);
    writer.print("mResumed=");
    writer.print(mResumed);
    writer.print(" mStopped=");
    writer.print(mStopped);
    writer.print(" mFinished=");
    writer.println(mFinished);
    writer.print(innerPrefix);
    writer.print("mChangingConfigurations=");
    writer.println(mChangingConfigurations);
    writer.print(innerPrefix);
    writer.print("mCurrentConfig=");
    writer.println(mCurrentConfig);
    mFragments.dumpLoaders(innerPrefix, fd, writer, args);
    mFragments.getFragmentManager().dump(innerPrefix, fd, writer, args);
    if (mVoiceInteractor != null) {
        mVoiceInteractor.dump(innerPrefix, fd, writer, args);
    }
    if (getWindow() != null && getWindow().peekDecorView() != null && getWindow().peekDecorView().getViewRootImpl() != null) {
        getWindow().peekDecorView().getViewRootImpl().dump(prefix, fd, writer, args);
    }
    mHandler.getLooper().dump(new PrintWriterPrinter(writer), prefix);
}
Also used : PrintWriterPrinter(android.util.PrintWriterPrinter)

Example 24 with PrintWriterPrinter

use of android.util.PrintWriterPrinter in project android_frameworks_base by DirtyUnicorns.

the class CountryDetectorService method dump.

@SuppressWarnings("unused")
@Override
protected void dump(FileDescriptor fd, PrintWriter fout, String[] args) {
    mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, TAG);
    if (!DEBUG)
        return;
    try {
        final Printer p = new PrintWriterPrinter(fout);
        p.println("CountryDetectorService state:");
        p.println("  Number of listeners=" + mReceivers.keySet().size());
        if (mCountryDetector == null) {
            p.println("  ComprehensiveCountryDetector not initialized");
        } else {
            p.println("  " + mCountryDetector.toString());
        }
    } catch (Exception e) {
        Slog.e(TAG, "Failed to dump CountryDetectorService: ", e);
    }
}
Also used : PrintWriterPrinter(android.util.PrintWriterPrinter) PrintWriterPrinter(android.util.PrintWriterPrinter) Printer(android.util.Printer) RemoteException(android.os.RemoteException)

Example 25 with PrintWriterPrinter

use of android.util.PrintWriterPrinter in project android_frameworks_base by DirtyUnicorns.

the class InputMethodManagerService method dump.

@Override
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
    if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.DUMP) != PackageManager.PERMISSION_GRANTED) {
        pw.println("Permission Denial: can't dump InputMethodManager from from pid=" + Binder.getCallingPid() + ", uid=" + Binder.getCallingUid());
        return;
    }
    IInputMethod method;
    ClientState client;
    ClientState focusedWindowClient;
    final Printer p = new PrintWriterPrinter(pw);
    synchronized (mMethodMap) {
        p.println("Current Input Method Manager state:");
        int N = mMethodList.size();
        p.println("  Input Methods:");
        for (int i = 0; i < N; i++) {
            InputMethodInfo info = mMethodList.get(i);
            p.println("  InputMethod #" + i + ":");
            info.dump(p, "    ");
        }
        p.println("  Clients:");
        for (ClientState ci : mClients.values()) {
            p.println("  Client " + ci + ":");
            p.println("    client=" + ci.client);
            p.println("    inputContext=" + ci.inputContext);
            p.println("    sessionRequested=" + ci.sessionRequested);
            p.println("    curSession=" + ci.curSession);
        }
        p.println("  mCurMethodId=" + mCurMethodId);
        client = mCurClient;
        p.println("  mCurClient=" + client + " mCurSeq=" + mCurSeq);
        p.println("  mCurFocusedWindow=" + mCurFocusedWindow);
        focusedWindowClient = mCurFocusedWindowClient;
        p.println("  mCurFocusedWindowClient=" + focusedWindowClient);
        p.println("  mCurId=" + mCurId + " mHaveConnect=" + mHaveConnection + " mBoundToMethod=" + mBoundToMethod);
        p.println("  mCurToken=" + mCurToken);
        p.println("  mCurIntent=" + mCurIntent);
        method = mCurMethod;
        p.println("  mCurMethod=" + mCurMethod);
        p.println("  mEnabledSession=" + mEnabledSession);
        p.println("  mImeWindowVis=" + imeWindowStatusToString(mImeWindowVis));
        p.println("  mShowRequested=" + mShowRequested + " mShowExplicitlyRequested=" + mShowExplicitlyRequested + " mShowForced=" + mShowForced + " mInputShown=" + mInputShown);
        p.println("  mCurUserActionNotificationSequenceNumber=" + mCurUserActionNotificationSequenceNumber);
        p.println("  mSystemReady=" + mSystemReady + " mInteractive=" + mIsInteractive);
        p.println("  mSettingsObserver=" + mSettingsObserver);
        p.println("  mSwitchingController:");
        mSwitchingController.dump(p);
        p.println("  mSettings:");
        mSettings.dumpLocked(p, "    ");
    }
    p.println(" ");
    if (client != null) {
        pw.flush();
        try {
            client.client.asBinder().dump(fd, args);
        } catch (RemoteException e) {
            p.println("Input method client dead: " + e);
        }
    } else {
        p.println("No input method client.");
    }
    if (focusedWindowClient != null && client != focusedWindowClient) {
        p.println(" ");
        p.println("Warning: Current input method client doesn't match the last focused. " + "window.");
        p.println("Dumping input method client in the last focused window just in case.");
        p.println(" ");
        pw.flush();
        try {
            focusedWindowClient.client.asBinder().dump(fd, args);
        } catch (RemoteException e) {
            p.println("Input method client in focused window dead: " + e);
        }
    }
    p.println(" ");
    if (method != null) {
        pw.flush();
        try {
            method.asBinder().dump(fd, args);
        } catch (RemoteException e) {
            p.println("Input method service dead: " + e);
        }
    } else {
        p.println("No input method service.");
    }
}
Also used : PrintWriterPrinter(android.util.PrintWriterPrinter) IInputMethod(com.android.internal.view.IInputMethod) Printer(android.util.Printer) PrintWriterPrinter(android.util.PrintWriterPrinter) RemoteException(android.os.RemoteException) InputMethodInfo(android.view.inputmethod.InputMethodInfo)

Aggregations

PrintWriterPrinter (android.util.PrintWriterPrinter)109 Printer (android.util.Printer)47 RemoteException (android.os.RemoteException)28 ResolveInfo (android.content.pm.ResolveInfo)22 Intent (android.content.Intent)20 PrintWriter (java.io.PrintWriter)16 URISyntaxException (java.net.URISyntaxException)16 Bundle (android.os.Bundle)10 ArrayMap (android.util.ArrayMap)7 LogPrinter (android.util.LogPrinter)7 HashMap (java.util.HashMap)7 InputMethodInfo (android.view.inputmethod.InputMethodInfo)6 IInputMethod (com.android.internal.view.IInputMethod)6 Date (java.util.Date)6 Map (java.util.Map)6 MutableInt (android.util.MutableInt)5 ArrayList (java.util.ArrayList)5 PendingIntent (android.app.PendingIntent)4 Iterator (java.util.Iterator)4 Point (android.graphics.Point)2