Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f9bcdc06 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix command line tool to set the right privacy enum."

parents ada267a3 b8344dc7
Loading
Loading
Loading
Loading
+13 −3
Original line number Diff line number Diff line
@@ -148,9 +148,19 @@ find_section(const char* name)
static int
get_dest(const char* arg)
{
    if (strcmp(arg, "LOCAL") == 0) return 0;
    if (strcmp(arg, "EXPLICIT") == 0) return 1;
    if (strcmp(arg, "AUTOMATIC") == 0) return 2;
    if (strcmp(arg, "L") == 0
        || strcmp(arg, "LOCAL") == 0) {
      return DEST_LOCAL;
    }
    if (strcmp(arg, "E") == 0
        || strcmp(arg, "EXPLICIT") == 0) {
      return DEST_EXPLICIT;
    }
    if (strcmp(arg, "A") == 0
        || strcmp(arg, "AUTO") == 0
        || strcmp(arg, "AUTOMATIC") == 0) {
      return DEST_AUTOMATIC;
    }
    return -1; // return the default value
}

+8 −2
Original line number Diff line number Diff line
@@ -67,8 +67,14 @@ PrivacySpec::RequireAll() const { return dest == android::os::DEST_LOCAL; }

PrivacySpec new_spec_from_args(int dest)
{
  if (dest < 0) return PrivacySpec();
    switch (dest) {
        case android::os::DEST_AUTOMATIC:
        case android::os::DEST_EXPLICIT:
        case android::os::DEST_LOCAL:
            return PrivacySpec(dest);
        default:
            return PrivacySpec();
    }
}

PrivacySpec get_default_dropbox_spec() { return PrivacySpec(android::os::DEST_AUTOMATIC); }
 No newline at end of file
+10 −2
Original line number Diff line number Diff line
@@ -452,9 +452,10 @@ main(int argc, char** argv)
    bool adbIncidentWorkaround = true;
    pid_t childPid = -1;
    vector<string> sections;
    const char* privacy = NULL;

    int opt;
    while ((opt = getopt(argc, argv, "bhi:o:s:tw")) != -1) {
    while ((opt = getopt(argc, argv, "bhi:o:s:twp:")) != -1) {
        switch (opt) {
            case 'b':
                outputFormat = OUTPUT_PROTO;
@@ -477,6 +478,9 @@ main(int argc, char** argv)
            case 'w':
                adbIncidentWorkaround = false;
                break;
            case 'p':
                privacy = optarg;
                break;
            default:
                usage(stderr);
                return 1;
@@ -526,7 +530,7 @@ main(int argc, char** argv)
            }

            // TODO: This is what the real implementation will be...
            char const** args = (char const**)malloc(sizeof(char*) * (6 + sections.size()));
            char const** args = (char const**)malloc(sizeof(char*) * (8 + sections.size()));
            int argpos = 0;
            args[argpos++] = "adb";
            if (adbSerial != NULL) {
@@ -535,6 +539,10 @@ main(int argc, char** argv)
            }
            args[argpos++] = "shell";
            args[argpos++] = "incident";
            if (privacy != NULL) {
                args[argpos++] = "-p";
                args[argpos++] = privacy;
            }
            for (vector<string>::const_iterator it=sections.begin(); it!=sections.end(); it++) {
                args[argpos++] = it->c_str();
            }