Search in sources :

Example 1 with PrintStreamPrinter

use of android.util.PrintStreamPrinter in project android_frameworks_base by ParanoidAndroid.

the class Ime method runList.

/**
     * Execute the list sub-command.
     */
private void runList() {
    String opt;
    boolean all = false;
    boolean brief = false;
    while ((opt = nextOption()) != null) {
        if (opt.equals("-a")) {
            all = true;
        } else if (opt.equals("-s")) {
            brief = true;
        } else {
            System.err.println("Error: Unknown option: " + opt);
            showUsage();
            return;
        }
    }
    List<InputMethodInfo> methods;
    if (!all) {
        try {
            methods = mImm.getEnabledInputMethodList();
        } catch (RemoteException e) {
            System.err.println(e.toString());
            System.err.println(IMM_NOT_RUNNING_ERR);
            return;
        }
    } else {
        try {
            methods = mImm.getInputMethodList();
        } catch (RemoteException e) {
            System.err.println(e.toString());
            System.err.println(IMM_NOT_RUNNING_ERR);
            return;
        }
    }
    if (methods != null) {
        Printer pr = new PrintStreamPrinter(System.out);
        for (int i = 0; i < methods.size(); i++) {
            InputMethodInfo imi = methods.get(i);
            if (brief) {
                System.out.println(imi.getId());
            } else {
                System.out.println(imi.getId() + ":");
                imi.dump(pr, "  ");
            }
        }
    }
}
Also used : PrintStreamPrinter(android.util.PrintStreamPrinter) RemoteException(android.os.RemoteException) PrintStreamPrinter(android.util.PrintStreamPrinter) Printer(android.util.Printer) InputMethodInfo(android.view.inputmethod.InputMethodInfo)

Example 2 with PrintStreamPrinter

use of android.util.PrintStreamPrinter in project android_frameworks_base by ResurrectionRemix.

the class Ime method runList.

/**
     * Execute the list sub-command.
     */
private void runList() {
    String opt;
    boolean all = false;
    boolean brief = false;
    while ((opt = nextOption()) != null) {
        if (opt.equals("-a")) {
            all = true;
        } else if (opt.equals("-s")) {
            brief = true;
        } else {
            System.err.println("Error: Unknown option: " + opt);
            showUsage();
            return;
        }
    }
    List<InputMethodInfo> methods;
    if (!all) {
        try {
            methods = mImm.getEnabledInputMethodList();
        } catch (RemoteException e) {
            System.err.println(e.toString());
            System.err.println(IMM_NOT_RUNNING_ERR);
            return;
        }
    } else {
        try {
            methods = mImm.getInputMethodList();
        } catch (RemoteException e) {
            System.err.println(e.toString());
            System.err.println(IMM_NOT_RUNNING_ERR);
            return;
        }
    }
    if (methods != null) {
        Printer pr = new PrintStreamPrinter(System.out);
        for (int i = 0; i < methods.size(); i++) {
            InputMethodInfo imi = methods.get(i);
            if (brief) {
                System.out.println(imi.getId());
            } else {
                System.out.println(imi.getId() + ":");
                imi.dump(pr, "  ");
            }
        }
    }
}
Also used : PrintStreamPrinter(android.util.PrintStreamPrinter) RemoteException(android.os.RemoteException) PrintStreamPrinter(android.util.PrintStreamPrinter) Printer(android.util.Printer) InputMethodInfo(android.view.inputmethod.InputMethodInfo)

Example 3 with PrintStreamPrinter

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

the class PackageManagerService method setLastChosenActivity.

@Override
public void setLastChosenActivity(Intent intent, String resolvedType, int flags, IntentFilter filter, int match, ComponentName activity) {
    final int userId = UserHandle.getCallingUserId();
    if (DEBUG_PREFERRED) {
        Log.v(TAG, "setLastChosenActivity intent=" + intent + " resolvedType=" + resolvedType + " flags=" + flags + " filter=" + filter + " match=" + match + " activity=" + activity);
        filter.dump(new PrintStreamPrinter(System.out), "    ");
    }
    intent.setComponent(null);
    final List<ResolveInfo> query = queryIntentActivitiesInternal(intent, resolvedType, flags, userId);
    // Find any earlier preferred or last chosen entries and nuke them
    findPreferredActivity(intent, resolvedType, flags, query, 0, false, true, false, userId);
    // Add the new activity as the last chosen for this filter
    addPreferredActivityInternal(filter, match, null, activity, false, userId, "Setting last chosen");
}
Also used : EphemeralResolveInfo(android.content.pm.EphemeralResolveInfo) ResolveInfo(android.content.pm.ResolveInfo) PrintStreamPrinter(android.util.PrintStreamPrinter)

Example 4 with PrintStreamPrinter

use of android.util.PrintStreamPrinter in project platform_frameworks_base by android.

the class Ime method runList.

/**
     * Execute the list sub-command.
     */
private void runList() {
    String opt;
    boolean all = false;
    boolean brief = false;
    while ((opt = nextOption()) != null) {
        if (opt.equals("-a")) {
            all = true;
        } else if (opt.equals("-s")) {
            brief = true;
        } else {
            System.err.println("Error: Unknown option: " + opt);
            showUsage();
            return;
        }
    }
    List<InputMethodInfo> methods;
    if (!all) {
        try {
            methods = mImm.getEnabledInputMethodList();
        } catch (RemoteException e) {
            System.err.println(e.toString());
            System.err.println(IMM_NOT_RUNNING_ERR);
            return;
        }
    } else {
        try {
            methods = mImm.getInputMethodList();
        } catch (RemoteException e) {
            System.err.println(e.toString());
            System.err.println(IMM_NOT_RUNNING_ERR);
            return;
        }
    }
    if (methods != null) {
        Printer pr = new PrintStreamPrinter(System.out);
        for (int i = 0; i < methods.size(); i++) {
            InputMethodInfo imi = methods.get(i);
            if (brief) {
                System.out.println(imi.getId());
            } else {
                System.out.println(imi.getId() + ":");
                imi.dump(pr, "  ");
            }
        }
    }
}
Also used : PrintStreamPrinter(android.util.PrintStreamPrinter) RemoteException(android.os.RemoteException) PrintStreamPrinter(android.util.PrintStreamPrinter) Printer(android.util.Printer) InputMethodInfo(android.view.inputmethod.InputMethodInfo)

Example 5 with PrintStreamPrinter

use of android.util.PrintStreamPrinter in project platform_frameworks_base by android.

the class PackageManagerService method setLastChosenActivity.

@Override
public void setLastChosenActivity(Intent intent, String resolvedType, int flags, IntentFilter filter, int match, ComponentName activity) {
    final int userId = UserHandle.getCallingUserId();
    if (DEBUG_PREFERRED) {
        Log.v(TAG, "setLastChosenActivity intent=" + intent + " resolvedType=" + resolvedType + " flags=" + flags + " filter=" + filter + " match=" + match + " activity=" + activity);
        filter.dump(new PrintStreamPrinter(System.out), "    ");
    }
    intent.setComponent(null);
    final List<ResolveInfo> query = queryIntentActivitiesInternal(intent, resolvedType, flags, userId);
    // Find any earlier preferred or last chosen entries and nuke them
    findPreferredActivity(intent, resolvedType, flags, query, 0, false, true, false, userId);
    // Add the new activity as the last chosen for this filter
    addPreferredActivityInternal(filter, match, null, activity, false, userId, "Setting last chosen");
}
Also used : EphemeralResolveInfo(android.content.pm.EphemeralResolveInfo) ResolveInfo(android.content.pm.ResolveInfo) PrintStreamPrinter(android.util.PrintStreamPrinter)

Aggregations

PrintStreamPrinter (android.util.PrintStreamPrinter)8 RemoteException (android.os.RemoteException)6 Printer (android.util.Printer)6 InputMethodInfo (android.view.inputmethod.InputMethodInfo)6 EphemeralResolveInfo (android.content.pm.EphemeralResolveInfo)2 ResolveInfo (android.content.pm.ResolveInfo)2