android.content.IContentService

Here are the examples of the java api android.content.IContentService taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

19 Source : ContentShellCommand.java
with Apache License 2.0
from lulululbj

public clreplaced ContentShellCommand extends ShellCommand {

    final IContentService mInterface;

    ContentShellCommand(IContentService service) {
        mInterface = service;
    }

    @Override
    public int onCommand(String cmd) {
        if (cmd == null) {
            return handleDefaultCommands(cmd);
        }
        final PrintWriter pw = getOutPrintWriter();
        try {
            switch(cmd) {
                case "reset-today-stats":
                    return runResetTodayStats();
                default:
                    return handleDefaultCommands(cmd);
            }
        } catch (RemoteException e) {
            pw.println("Remote exception: " + e);
        }
        return -1;
    }

    private int runResetTodayStats() throws RemoteException {
        mInterface.resetTodayStats();
        return 0;
    }

    @Override
    public void onHelp() {
        final PrintWriter pw = getOutPrintWriter();
        pw.println("Content service commands:");
        pw.println("  help");
        pw.println("    Print this help text.");
        pw.println("");
        pw.println("  reset-today-stats");
        pw.println("    Reset 1-day sync stats.");
        pw.println();
    }
}