Mike Lockwood | 94afecf | 2012-10-24 10:45:23 -0700 | [diff] [blame] | 1 | /* |
Mathias Agopian | 002e1e5 | 2013-05-06 20:20:50 -0700 | [diff] [blame] | 2 | * Copyright 2013 The Android Open Source Project |
Mike Lockwood | 94afecf | 2012-10-24 10:45:23 -0700 | [diff] [blame] | 3 | * |
Mathias Agopian | 002e1e5 | 2013-05-06 20:20:50 -0700 | [diff] [blame] | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
Mike Lockwood | 94afecf | 2012-10-24 10:45:23 -0700 | [diff] [blame] | 15 | */ |
Mathias Agopian | 002e1e5 | 2013-05-06 20:20:50 -0700 | [diff] [blame] | 16 | |
Mike Lockwood | 94afecf | 2012-10-24 10:45:23 -0700 | [diff] [blame] | 17 | #include <binder/Parcel.h> |
| 18 | #include <binder/ProcessState.h> |
| 19 | #include <binder/IServiceManager.h> |
Mathias Agopian | 002e1e5 | 2013-05-06 20:20:50 -0700 | [diff] [blame] | 20 | #include <binder/TextOutput.h> |
Marco Nelissen | b9ec70e | 2018-06-07 11:31:03 -0700 | [diff] [blame] | 21 | #include <cutils/ashmem.h> |
Mike Lockwood | 94afecf | 2012-10-24 10:45:23 -0700 | [diff] [blame] | 22 | |
| 23 | #include <getopt.h> |
| 24 | #include <stdlib.h> |
| 25 | #include <stdio.h> |
| 26 | #include <string.h> |
| 27 | #include <unistd.h> |
Marco Nelissen | b9ec70e | 2018-06-07 11:31:03 -0700 | [diff] [blame] | 28 | #include <sys/mman.h> |
Mike Lockwood | 94afecf | 2012-10-24 10:45:23 -0700 | [diff] [blame] | 29 | #include <sys/time.h> |
Marco Nelissen | b9ec70e | 2018-06-07 11:31:03 -0700 | [diff] [blame] | 30 | #include <sys/types.h> |
| 31 | #include <sys/stat.h> |
| 32 | #include <fcntl.h> |
Mike Lockwood | 94afecf | 2012-10-24 10:45:23 -0700 | [diff] [blame] | 33 | |
| 34 | using namespace android; |
| 35 | |
| 36 | void writeString16(Parcel& parcel, const char* string) |
| 37 | { |
Yi Kong | 19d5c00 | 2018-07-20 13:39:55 -0700 | [diff] [blame] | 38 | if (string != nullptr) |
Mike Lockwood | 94afecf | 2012-10-24 10:45:23 -0700 | [diff] [blame] | 39 | { |
| 40 | parcel.writeString16(String16(string)); |
| 41 | } |
| 42 | else |
| 43 | { |
| 44 | parcel.writeInt32(-1); |
| 45 | } |
| 46 | } |
| 47 | |
Mike Lockwood | 94afecf | 2012-10-24 10:45:23 -0700 | [diff] [blame] | 48 | int main(int argc, char* const argv[]) |
| 49 | { |
Mike Lockwood | 94afecf | 2012-10-24 10:45:23 -0700 | [diff] [blame] | 50 | bool wantsUsage = false; |
| 51 | int result = 0; |
Marco Nelissen | 07e95a8 | 2019-07-16 08:50:21 -0700 | [diff] [blame] | 52 | |
Tony Guo | 51cbe7e | 2021-10-15 14:00:07 +0800 | [diff] [blame] | 53 | /* Strip path off the program name. */ |
| 54 | char* prog_name = basename(argv[0]); |
| 55 | |
Mike Lockwood | 94afecf | 2012-10-24 10:45:23 -0700 | [diff] [blame] | 56 | while (1) { |
Martijn Coenen | 3def1f2 | 2017-04-07 10:46:57 -0700 | [diff] [blame] | 57 | int ic = getopt(argc, argv, "h?"); |
Mike Lockwood | 94afecf | 2012-10-24 10:45:23 -0700 | [diff] [blame] | 58 | if (ic < 0) |
| 59 | break; |
| 60 | |
| 61 | switch (ic) { |
| 62 | case 'h': |
| 63 | case '?': |
| 64 | wantsUsage = true; |
| 65 | break; |
| 66 | default: |
Tony Guo | 51cbe7e | 2021-10-15 14:00:07 +0800 | [diff] [blame] | 67 | aerr << prog_name << ": Unknown option -" << ic << endl; |
Mike Lockwood | 94afecf | 2012-10-24 10:45:23 -0700 | [diff] [blame] | 68 | wantsUsage = true; |
| 69 | result = 10; |
| 70 | break; |
| 71 | } |
| 72 | } |
Martijn Coenen | 3def1f2 | 2017-04-07 10:46:57 -0700 | [diff] [blame] | 73 | #ifdef VENDORSERVICES |
| 74 | ProcessState::initWithDriver("/dev/vndbinder"); |
| 75 | #endif |
Yifan Hong | 86cf053 | 2021-06-16 22:56:50 -0700 | [diff] [blame] | 76 | #ifndef __ANDROID__ |
| 77 | setDefaultServiceManager(createRpcDelegateServiceManager({.maxOutgoingThreads = 1})); |
| 78 | #endif |
Martijn Coenen | d6480ca | 2017-04-05 14:16:12 -0700 | [diff] [blame] | 79 | sp<IServiceManager> sm = defaultServiceManager(); |
| 80 | fflush(stdout); |
Yi Kong | 19d5c00 | 2018-07-20 13:39:55 -0700 | [diff] [blame] | 81 | if (sm == nullptr) { |
Tony Guo | 51cbe7e | 2021-10-15 14:00:07 +0800 | [diff] [blame] | 82 | aerr << prog_name << ": Unable to get default service manager!" << endl; |
Martijn Coenen | d6480ca | 2017-04-05 14:16:12 -0700 | [diff] [blame] | 83 | return 20; |
| 84 | } |
Marco Nelissen | 07e95a8 | 2019-07-16 08:50:21 -0700 | [diff] [blame] | 85 | |
Mike Lockwood | 94afecf | 2012-10-24 10:45:23 -0700 | [diff] [blame] | 86 | if (optind >= argc) { |
| 87 | wantsUsage = true; |
| 88 | } else if (!wantsUsage) { |
| 89 | if (strcmp(argv[optind], "check") == 0) { |
| 90 | optind++; |
| 91 | if (optind < argc) { |
| 92 | sp<IBinder> service = sm->checkService(String16(argv[optind])); |
| 93 | aout << "Service " << argv[optind] << |
Yi Kong | 19d5c00 | 2018-07-20 13:39:55 -0700 | [diff] [blame] | 94 | (service == nullptr ? ": not found" : ": found") << endl; |
Mike Lockwood | 94afecf | 2012-10-24 10:45:23 -0700 | [diff] [blame] | 95 | } else { |
Tony Guo | 51cbe7e | 2021-10-15 14:00:07 +0800 | [diff] [blame] | 96 | aerr << prog_name << ": No service specified for check" << endl; |
Mike Lockwood | 94afecf | 2012-10-24 10:45:23 -0700 | [diff] [blame] | 97 | wantsUsage = true; |
| 98 | result = 10; |
| 99 | } |
| 100 | } |
| 101 | else if (strcmp(argv[optind], "list") == 0) { |
| 102 | Vector<String16> services = sm->listServices(); |
| 103 | aout << "Found " << services.size() << " services:" << endl; |
| 104 | for (unsigned i = 0; i < services.size(); i++) { |
| 105 | String16 name = services[i]; |
| 106 | sp<IBinder> service = sm->checkService(name); |
Marco Nelissen | 07e95a8 | 2019-07-16 08:50:21 -0700 | [diff] [blame] | 107 | aout << i |
Steven Moreland | 619b935 | 2021-10-28 15:54:59 -0700 | [diff] [blame^] | 108 | << "\t" << name |
| 109 | << ": [" << (service ? service->getInterfaceDescriptor() : String16()) << "]" |
Mike Lockwood | 94afecf | 2012-10-24 10:45:23 -0700 | [diff] [blame] | 110 | << endl; |
| 111 | } |
| 112 | } else if (strcmp(argv[optind], "call") == 0) { |
| 113 | optind++; |
| 114 | if (optind+1 < argc) { |
| 115 | int serviceArg = optind; |
| 116 | sp<IBinder> service = sm->checkService(String16(argv[optind++])); |
Steven Moreland | 619b935 | 2021-10-28 15:54:59 -0700 | [diff] [blame^] | 117 | String16 ifName = (service ? service->getInterfaceDescriptor() : String16()); |
Mike Lockwood | 94afecf | 2012-10-24 10:45:23 -0700 | [diff] [blame] | 118 | int32_t code = atoi(argv[optind++]); |
Yi Kong | 19d5c00 | 2018-07-20 13:39:55 -0700 | [diff] [blame] | 119 | if (service != nullptr && ifName.size() > 0) { |
Mike Lockwood | 94afecf | 2012-10-24 10:45:23 -0700 | [diff] [blame] | 120 | Parcel data, reply; |
Yifan Hong | 86cf053 | 2021-06-16 22:56:50 -0700 | [diff] [blame] | 121 | data.markForBinder(service); |
Mike Lockwood | 94afecf | 2012-10-24 10:45:23 -0700 | [diff] [blame] | 122 | |
| 123 | // the interface name is first |
| 124 | data.writeInterfaceToken(ifName); |
| 125 | |
| 126 | // then the rest of the call arguments |
| 127 | while (optind < argc) { |
| 128 | if (strcmp(argv[optind], "i32") == 0) { |
| 129 | optind++; |
| 130 | if (optind >= argc) { |
Tony Guo | 51cbe7e | 2021-10-15 14:00:07 +0800 | [diff] [blame] | 131 | aerr << prog_name << ": no integer supplied for 'i32'" << endl; |
Mike Lockwood | 94afecf | 2012-10-24 10:45:23 -0700 | [diff] [blame] | 132 | wantsUsage = true; |
| 133 | result = 10; |
| 134 | break; |
| 135 | } |
| 136 | data.writeInt32(atoi(argv[optind++])); |
Jeff Brown | d46898f | 2015-04-06 19:42:43 -0700 | [diff] [blame] | 137 | } else if (strcmp(argv[optind], "i64") == 0) { |
| 138 | optind++; |
| 139 | if (optind >= argc) { |
Tony Guo | 51cbe7e | 2021-10-15 14:00:07 +0800 | [diff] [blame] | 140 | aerr << prog_name << ": no integer supplied for 'i64'" << endl; |
Jeff Brown | d46898f | 2015-04-06 19:42:43 -0700 | [diff] [blame] | 141 | wantsUsage = true; |
| 142 | result = 10; |
| 143 | break; |
| 144 | } |
| 145 | data.writeInt64(atoll(argv[optind++])); |
Mike Lockwood | 94afecf | 2012-10-24 10:45:23 -0700 | [diff] [blame] | 146 | } else if (strcmp(argv[optind], "s16") == 0) { |
| 147 | optind++; |
| 148 | if (optind >= argc) { |
Tony Guo | 51cbe7e | 2021-10-15 14:00:07 +0800 | [diff] [blame] | 149 | aerr << prog_name << ": no string supplied for 's16'" << endl; |
Mike Lockwood | 94afecf | 2012-10-24 10:45:23 -0700 | [diff] [blame] | 150 | wantsUsage = true; |
| 151 | result = 10; |
| 152 | break; |
| 153 | } |
| 154 | data.writeString16(String16(argv[optind++])); |
Jeff Brown | d46898f | 2015-04-06 19:42:43 -0700 | [diff] [blame] | 155 | } else if (strcmp(argv[optind], "f") == 0) { |
| 156 | optind++; |
| 157 | if (optind >= argc) { |
Tony Guo | 51cbe7e | 2021-10-15 14:00:07 +0800 | [diff] [blame] | 158 | aerr << prog_name << ": no number supplied for 'f'" << endl; |
Jeff Brown | d46898f | 2015-04-06 19:42:43 -0700 | [diff] [blame] | 159 | wantsUsage = true; |
| 160 | result = 10; |
| 161 | break; |
| 162 | } |
| 163 | data.writeFloat(atof(argv[optind++])); |
| 164 | } else if (strcmp(argv[optind], "d") == 0) { |
| 165 | optind++; |
| 166 | if (optind >= argc) { |
Tony Guo | 51cbe7e | 2021-10-15 14:00:07 +0800 | [diff] [blame] | 167 | aerr << prog_name << ": no number supplied for 'd'" << endl; |
Jeff Brown | d46898f | 2015-04-06 19:42:43 -0700 | [diff] [blame] | 168 | wantsUsage = true; |
| 169 | result = 10; |
| 170 | break; |
| 171 | } |
| 172 | data.writeDouble(atof(argv[optind++])); |
Mike Lockwood | 94afecf | 2012-10-24 10:45:23 -0700 | [diff] [blame] | 173 | } else if (strcmp(argv[optind], "null") == 0) { |
| 174 | optind++; |
Yi Kong | 19d5c00 | 2018-07-20 13:39:55 -0700 | [diff] [blame] | 175 | data.writeStrongBinder(nullptr); |
Marco Nelissen | b9ec70e | 2018-06-07 11:31:03 -0700 | [diff] [blame] | 176 | } else if (strcmp(argv[optind], "fd") == 0) { |
| 177 | optind++; |
| 178 | if (optind >= argc) { |
Tony Guo | 51cbe7e | 2021-10-15 14:00:07 +0800 | [diff] [blame] | 179 | aerr << prog_name << ": no path supplied for 'fd'" << endl; |
Marco Nelissen | b9ec70e | 2018-06-07 11:31:03 -0700 | [diff] [blame] | 180 | wantsUsage = true; |
| 181 | result = 10; |
| 182 | break; |
| 183 | } |
| 184 | const char *path = argv[optind++]; |
| 185 | int fd = open(path, O_RDONLY); |
| 186 | if (fd < 0) { |
Tony Guo | 51cbe7e | 2021-10-15 14:00:07 +0800 | [diff] [blame] | 187 | aerr << prog_name << ": could not open '" << path << "'" << endl; |
Marco Nelissen | b9ec70e | 2018-06-07 11:31:03 -0700 | [diff] [blame] | 188 | wantsUsage = true; |
| 189 | result = 10; |
| 190 | break; |
| 191 | } |
| 192 | data.writeFileDescriptor(fd, true /* take ownership */); |
| 193 | } else if (strcmp(argv[optind], "afd") == 0) { |
| 194 | optind++; |
| 195 | if (optind >= argc) { |
Tony Guo | 51cbe7e | 2021-10-15 14:00:07 +0800 | [diff] [blame] | 196 | aerr << prog_name << ": no path supplied for 'afd'" << endl; |
Marco Nelissen | b9ec70e | 2018-06-07 11:31:03 -0700 | [diff] [blame] | 197 | wantsUsage = true; |
| 198 | result = 10; |
| 199 | break; |
| 200 | } |
| 201 | const char *path = argv[optind++]; |
| 202 | int fd = open(path, O_RDONLY); |
| 203 | struct stat statbuf; |
| 204 | if (fd < 0 || fstat(fd, &statbuf) != 0) { |
Tony Guo | 51cbe7e | 2021-10-15 14:00:07 +0800 | [diff] [blame] | 205 | aerr << prog_name << ": could not open or stat" |
| 206 | << " '" << path << "'" << endl; |
Marco Nelissen | b9ec70e | 2018-06-07 11:31:03 -0700 | [diff] [blame] | 207 | wantsUsage = true; |
| 208 | result = 10; |
| 209 | break; |
| 210 | } |
| 211 | int afd = ashmem_create_region("test", statbuf.st_size); |
| 212 | void* ptr = mmap(NULL, statbuf.st_size, |
| 213 | PROT_READ | PROT_WRITE, MAP_SHARED, afd, 0); |
Yifan Hong | 86cf053 | 2021-06-16 22:56:50 -0700 | [diff] [blame] | 214 | (void)read(fd, ptr, statbuf.st_size); |
Marco Nelissen | b9ec70e | 2018-06-07 11:31:03 -0700 | [diff] [blame] | 215 | close(fd); |
| 216 | data.writeFileDescriptor(afd, true /* take ownership */); |
| 217 | } else if (strcmp(argv[optind], "nfd") == 0) { |
| 218 | optind++; |
| 219 | if (optind >= argc) { |
Tony Guo | 51cbe7e | 2021-10-15 14:00:07 +0800 | [diff] [blame] | 220 | aerr << prog_name << ": no file descriptor supplied for" |
| 221 | << " 'nfd'" << endl; |
Marco Nelissen | b9ec70e | 2018-06-07 11:31:03 -0700 | [diff] [blame] | 222 | wantsUsage = true; |
| 223 | result = 10; |
| 224 | break; |
| 225 | } |
| 226 | data.writeFileDescriptor( |
| 227 | atoi(argv[optind++]), true /* take ownership */); |
| 228 | |
Mike Lockwood | 94afecf | 2012-10-24 10:45:23 -0700 | [diff] [blame] | 229 | } else if (strcmp(argv[optind], "intent") == 0) { |
Marco Nelissen | 07e95a8 | 2019-07-16 08:50:21 -0700 | [diff] [blame] | 230 | |
| 231 | char* action = nullptr; |
| 232 | char* dataArg = nullptr; |
| 233 | char* type = nullptr; |
| 234 | int launchFlags = 0; |
| 235 | char* component = nullptr; |
| 236 | int categoryCount = 0; |
| 237 | char* categories[16]; |
| 238 | |
| 239 | char* context1 = nullptr; |
| 240 | |
Mike Lockwood | 94afecf | 2012-10-24 10:45:23 -0700 | [diff] [blame] | 241 | optind++; |
Marco Nelissen | 07e95a8 | 2019-07-16 08:50:21 -0700 | [diff] [blame] | 242 | |
| 243 | while (optind < argc) |
| 244 | { |
| 245 | char* key = strtok_r(argv[optind], "=", &context1); |
| 246 | char* value = strtok_r(nullptr, "=", &context1); |
| 247 | |
Mike Lockwood | 94afecf | 2012-10-24 10:45:23 -0700 | [diff] [blame] | 248 | // we have reached the end of the XXX=XXX args. |
Yi Kong | 19d5c00 | 2018-07-20 13:39:55 -0700 | [diff] [blame] | 249 | if (key == nullptr) break; |
Marco Nelissen | 07e95a8 | 2019-07-16 08:50:21 -0700 | [diff] [blame] | 250 | |
| 251 | if (strcmp(key, "action") == 0) |
| 252 | { |
| 253 | action = value; |
| 254 | } |
| 255 | else if (strcmp(key, "data") == 0) |
| 256 | { |
| 257 | dataArg = value; |
| 258 | } |
| 259 | else if (strcmp(key, "type") == 0) |
| 260 | { |
| 261 | type = value; |
| 262 | } |
| 263 | else if (strcmp(key, "launchFlags") == 0) |
| 264 | { |
| 265 | launchFlags = atoi(value); |
| 266 | } |
| 267 | else if (strcmp(key, "component") == 0) |
| 268 | { |
| 269 | component = value; |
| 270 | } |
| 271 | else if (strcmp(key, "categories") == 0) |
| 272 | { |
| 273 | char* context2 = nullptr; |
Marco Nelissen | 07e95a8 | 2019-07-16 08:50:21 -0700 | [diff] [blame] | 274 | categories[categoryCount] = strtok_r(value, ",", &context2); |
| 275 | |
| 276 | while (categories[categoryCount] != nullptr) |
| 277 | { |
| 278 | categoryCount++; |
| 279 | categories[categoryCount] = strtok_r(nullptr, ",", &context2); |
| 280 | } |
| 281 | } |
| 282 | |
Mike Lockwood | 94afecf | 2012-10-24 10:45:23 -0700 | [diff] [blame] | 283 | optind++; |
Marco Nelissen | 07e95a8 | 2019-07-16 08:50:21 -0700 | [diff] [blame] | 284 | } |
| 285 | |
Mike Lockwood | 94afecf | 2012-10-24 10:45:23 -0700 | [diff] [blame] | 286 | writeString16(data, action); |
| 287 | writeString16(data, dataArg); |
| 288 | writeString16(data, type); |
Marco Nelissen | 07e95a8 | 2019-07-16 08:50:21 -0700 | [diff] [blame] | 289 | data.writeInt32(launchFlags); |
Mike Lockwood | 94afecf | 2012-10-24 10:45:23 -0700 | [diff] [blame] | 290 | writeString16(data, component); |
Marco Nelissen | 07e95a8 | 2019-07-16 08:50:21 -0700 | [diff] [blame] | 291 | |
Mike Lockwood | 94afecf | 2012-10-24 10:45:23 -0700 | [diff] [blame] | 292 | if (categoryCount > 0) |
| 293 | { |
| 294 | data.writeInt32(categoryCount); |
| 295 | for (int i = 0 ; i < categoryCount ; i++) |
| 296 | { |
| 297 | writeString16(data, categories[i]); |
| 298 | } |
| 299 | } |
| 300 | else |
| 301 | { |
| 302 | data.writeInt32(0); |
Marco Nelissen | 07e95a8 | 2019-07-16 08:50:21 -0700 | [diff] [blame] | 303 | } |
| 304 | |
Mike Lockwood | 94afecf | 2012-10-24 10:45:23 -0700 | [diff] [blame] | 305 | // for now just set the extra field to be null. |
Marco Nelissen | 07e95a8 | 2019-07-16 08:50:21 -0700 | [diff] [blame] | 306 | data.writeInt32(-1); |
Mike Lockwood | 94afecf | 2012-10-24 10:45:23 -0700 | [diff] [blame] | 307 | } else { |
Tony Guo | 51cbe7e | 2021-10-15 14:00:07 +0800 | [diff] [blame] | 308 | aerr << prog_name << ": unknown option " << argv[optind] << endl; |
Mike Lockwood | 94afecf | 2012-10-24 10:45:23 -0700 | [diff] [blame] | 309 | wantsUsage = true; |
| 310 | result = 10; |
| 311 | break; |
| 312 | } |
| 313 | } |
Marco Nelissen | 07e95a8 | 2019-07-16 08:50:21 -0700 | [diff] [blame] | 314 | |
Mike Lockwood | 94afecf | 2012-10-24 10:45:23 -0700 | [diff] [blame] | 315 | service->transact(code, data, &reply); |
| 316 | aout << "Result: " << reply << endl; |
| 317 | } else { |
Tony Guo | 51cbe7e | 2021-10-15 14:00:07 +0800 | [diff] [blame] | 318 | aerr << prog_name << ": Service " << argv[serviceArg] |
Mike Lockwood | 94afecf | 2012-10-24 10:45:23 -0700 | [diff] [blame] | 319 | << " does not exist" << endl; |
| 320 | result = 10; |
| 321 | } |
| 322 | } else { |
| 323 | if (optind < argc) { |
Tony Guo | 51cbe7e | 2021-10-15 14:00:07 +0800 | [diff] [blame] | 324 | aerr << prog_name << ": No service specified for call" << endl; |
Mike Lockwood | 94afecf | 2012-10-24 10:45:23 -0700 | [diff] [blame] | 325 | } else { |
Tony Guo | 51cbe7e | 2021-10-15 14:00:07 +0800 | [diff] [blame] | 326 | aerr << prog_name << ": No code specified for call" << endl; |
Mike Lockwood | 94afecf | 2012-10-24 10:45:23 -0700 | [diff] [blame] | 327 | } |
| 328 | wantsUsage = true; |
| 329 | result = 10; |
| 330 | } |
| 331 | } else { |
Tony Guo | 51cbe7e | 2021-10-15 14:00:07 +0800 | [diff] [blame] | 332 | aerr << prog_name << ": Unknown command " << argv[optind] << endl; |
Mike Lockwood | 94afecf | 2012-10-24 10:45:23 -0700 | [diff] [blame] | 333 | wantsUsage = true; |
| 334 | result = 10; |
| 335 | } |
| 336 | } |
Marco Nelissen | 07e95a8 | 2019-07-16 08:50:21 -0700 | [diff] [blame] | 337 | |
Mike Lockwood | 94afecf | 2012-10-24 10:45:23 -0700 | [diff] [blame] | 338 | if (wantsUsage) { |
Tony Guo | 51cbe7e | 2021-10-15 14:00:07 +0800 | [diff] [blame] | 339 | aout << "Usage: " << prog_name << " [-h|-?]\n" |
| 340 | " " << prog_name << " list\n" |
| 341 | " " << prog_name << " check SERVICE\n" |
| 342 | " " << prog_name << " call SERVICE CODE [i32 N | i64 N | f N | d N | s16 STR" |
| 343 | " | null | fd f | nfd n | afd f ] ...\n" |
Mike Lockwood | 94afecf | 2012-10-24 10:45:23 -0700 | [diff] [blame] | 344 | "Options:\n" |
Jeff Brown | d46898f | 2015-04-06 19:42:43 -0700 | [diff] [blame] | 345 | " i32: Write the 32-bit integer N into the send parcel.\n" |
| 346 | " i64: Write the 64-bit integer N into the send parcel.\n" |
Tony Guo | 51cbe7e | 2021-10-15 14:00:07 +0800 | [diff] [blame] | 347 | " f: Write the 32-bit single-precision number N into the send parcel.\n" |
| 348 | " d: Write the 64-bit double-precision number N into the send parcel.\n" |
Marco Nelissen | b9ec70e | 2018-06-07 11:31:03 -0700 | [diff] [blame] | 349 | " s16: Write the UTF-16 string STR into the send parcel.\n" |
| 350 | " null: Write a null binder into the send parcel.\n" |
Tony Guo | 51cbe7e | 2021-10-15 14:00:07 +0800 | [diff] [blame] | 351 | " fd: Write a file descriptor for the file f into the send parcel.\n" |
| 352 | " nfd: Write the file descriptor n into the send parcel.\n" |
| 353 | " afd: Write an ashmem file descriptor for a region containing the data from\n" |
| 354 | " file f into the send parcel.\n"; |
| 355 | // " intent: Write an Intent into the send parcel. ARGS can be\n" |
Mike Lockwood | 94afecf | 2012-10-24 10:45:23 -0700 | [diff] [blame] | 356 | // " action=STR data=STR type=STR launchFlags=INT component=STR categories=STR[,STR,...]\n"; |
| 357 | return result; |
| 358 | } |
Marco Nelissen | 07e95a8 | 2019-07-16 08:50:21 -0700 | [diff] [blame] | 359 | |
Mike Lockwood | 94afecf | 2012-10-24 10:45:23 -0700 | [diff] [blame] | 360 | return result; |
| 361 | } |
| 362 | |