| 148 | } |
| 149 | |
| 150 | rdcstr GetPathForPackage(const rdcstr &deviceID, const rdcstr &packageName) |
| 151 | { |
| 152 | rdcstr pkgPath = adbExecCommand(deviceID, "shell pm path " + packageName).strStdout.trimmed(); |
| 153 | |
| 154 | // if there are multiple slices, the path will be returned on many lines. Take only the first |
| 155 | // line, assuming all of the apks are in the same directory |
| 156 | if(pkgPath.find("\n") >= 0) |
| 157 | { |
| 158 | rdcarray<rdcstr> lines; |
| 159 | split(pkgPath, lines, '\n'); |
| 160 | pkgPath = lines[0].trimmed(); |
| 161 | } |
| 162 | |
| 163 | if(pkgPath.empty() || pkgPath.find("package:") != 0 || pkgPath.find("base.apk") == -1) |
| 164 | return pkgPath; |
| 165 | |
| 166 | pkgPath.erase(0, strlen("package:")); |
| 167 | pkgPath.erase(pkgPath.size() - strlen("base.apk"), ~0U); |
| 168 | |
| 169 | return pkgPath; |
| 170 | } |
| 171 | |
| 172 | bool IsSupported(rdcstr deviceID) |
| 173 | { |