Search in sources :

Example 21 with InstrumentationInfo

use of android.content.pm.InstrumentationInfo in project android_frameworks_base by ResurrectionRemix.

the class PackageManagerShellCommand method runListInstrumentation.

private int runListInstrumentation() throws RemoteException {
    final PrintWriter pw = getOutPrintWriter();
    boolean showSourceDir = false;
    String targetPackage = null;
    try {
        String opt;
        while ((opt = getNextArg()) != null) {
            switch(opt) {
                case "-f":
                    showSourceDir = true;
                    break;
                default:
                    if (opt.charAt(0) != '-') {
                        targetPackage = opt;
                    } else {
                        pw.println("Error: Unknown option: " + opt);
                        return -1;
                    }
                    break;
            }
        }
    } catch (RuntimeException ex) {
        pw.println("Error: " + ex.toString());
        return -1;
    }
    final List<InstrumentationInfo> list = mInterface.queryInstrumentation(targetPackage, 0).getList();
    // sort by target package
    Collections.sort(list, new Comparator<InstrumentationInfo>() {

        public int compare(InstrumentationInfo o1, InstrumentationInfo o2) {
            return o1.targetPackage.compareTo(o2.targetPackage);
        }
    });
    final int count = (list != null) ? list.size() : 0;
    for (int p = 0; p < count; p++) {
        final InstrumentationInfo ii = list.get(p);
        pw.print("instrumentation:");
        if (showSourceDir) {
            pw.print(ii.sourceDir);
            pw.print("=");
        }
        final ComponentName cn = new ComponentName(ii.packageName, ii.name);
        pw.print(cn.flattenToShortString());
        pw.print(" (target=");
        pw.print(ii.targetPackage);
        pw.println(")");
    }
    return 0;
}
Also used : InstrumentationInfo(android.content.pm.InstrumentationInfo) ComponentName(android.content.ComponentName) PrintWriter(java.io.PrintWriter)

Example 22 with InstrumentationInfo

use of android.content.pm.InstrumentationInfo in project android_frameworks_base by crdroidandroid.

the class PackageManagerShellCommand method runListInstrumentation.

private int runListInstrumentation() throws RemoteException {
    final PrintWriter pw = getOutPrintWriter();
    boolean showSourceDir = false;
    String targetPackage = null;
    try {
        String opt;
        while ((opt = getNextArg()) != null) {
            switch(opt) {
                case "-f":
                    showSourceDir = true;
                    break;
                default:
                    if (opt.charAt(0) != '-') {
                        targetPackage = opt;
                    } else {
                        pw.println("Error: Unknown option: " + opt);
                        return -1;
                    }
                    break;
            }
        }
    } catch (RuntimeException ex) {
        pw.println("Error: " + ex.toString());
        return -1;
    }
    final List<InstrumentationInfo> list = mInterface.queryInstrumentation(targetPackage, 0).getList();
    // sort by target package
    Collections.sort(list, new Comparator<InstrumentationInfo>() {

        public int compare(InstrumentationInfo o1, InstrumentationInfo o2) {
            return o1.targetPackage.compareTo(o2.targetPackage);
        }
    });
    final int count = (list != null) ? list.size() : 0;
    for (int p = 0; p < count; p++) {
        final InstrumentationInfo ii = list.get(p);
        pw.print("instrumentation:");
        if (showSourceDir) {
            pw.print(ii.sourceDir);
            pw.print("=");
        }
        final ComponentName cn = new ComponentName(ii.packageName, ii.name);
        pw.print(cn.flattenToShortString());
        pw.print(" (target=");
        pw.print(ii.targetPackage);
        pw.println(")");
    }
    return 0;
}
Also used : InstrumentationInfo(android.content.pm.InstrumentationInfo) ComponentName(android.content.ComponentName) PrintWriter(java.io.PrintWriter)

Aggregations

InstrumentationInfo (android.content.pm.InstrumentationInfo)22 ComponentName (android.content.ComponentName)17 ApplicationInfo (android.content.pm.ApplicationInfo)11 IPackageManager (android.content.pm.IPackageManager)11 PackageManager (android.content.pm.PackageManager)11 NameNotFoundException (android.content.pm.PackageManager.NameNotFoundException)11 RemoteException (android.os.RemoteException)11 Configuration (android.content.res.Configuration)7 IConnectivityManager (android.net.IConnectivityManager)7 IBinder (android.os.IBinder)7 AndroidRuntimeException (android.util.AndroidRuntimeException)7 File (java.io.File)7 IOException (java.io.IOException)7 StrictMode (android.os.StrictMode)6 IInstrumentationWatcher (android.app.IInstrumentationWatcher)5 UiAutomationConnection (android.app.UiAutomationConnection)5 Context (android.content.Context)5 ProxyInfo (android.net.ProxyInfo)5 Bundle (android.os.Bundle)5 TransactionTooLargeException (android.os.TransactionTooLargeException)5