Handle 'slice' apks with many apks in the shell pm path.

This commit is contained in:
Baldur Karlsson
2018-03-12 13:05:56 +00:00
parent 68a3f3a31f
commit dd1d7bd2ba
+9
View File
@@ -110,6 +110,15 @@ std::string GetPathForPackage(const std::string &deviceID, const std::string &pa
{
std::string pkgPath = trim(adbExecCommand(deviceID, "shell pm path " + packageName).strStdout);
// if there are multiple slices, the path will be returned on many lines. Take only the first
// line, assuming all of the apks are in the same directory
if(pkgPath.find("\n") != std::string::npos)
{
std::vector<std::string> lines;
split(pkgPath, lines, '\n');
pkgPath = lines[0];
}
if(pkgPath.empty() || pkgPath.find("package:") != 0 || pkgPath.find("base.apk") == std::string::npos)
return pkgPath;