| 719 | |
| 720 | virtual rdcstr GetHomeFolder() override { return ""; } |
| 721 | virtual rdcarray<PathEntry> ListFolder(const rdcstr &path) override |
| 722 | { |
| 723 | if(path.empty() || (path[0] == '/' && path.size() == 1)) |
| 724 | { |
| 725 | SCOPED_TIMER("Fetching android packages and activities"); |
| 726 | |
| 727 | rdcstr adbStdout = Android::ListPackages(m_deviceID, "-3").strStdout; |
| 728 | |
| 729 | rdcarray<rdcstr> lines; |
| 730 | split(adbStdout, lines, '\n'); |
| 731 | for(rdcstr &line : lines) |
| 732 | while(!line.empty() && isspace(line.back())) |
| 733 | line.pop_back(); |
| 734 | |
| 735 | rdcarray<PathEntry> packages; |
| 736 | for(const rdcstr &line : lines) |
| 737 | { |
| 738 | // hide our own internal packages |
| 739 | if(strstr(line.c_str(), "package:org.renderdoc.")) |
| 740 | continue; |
| 741 | |
| 742 | if(!strncmp(line.c_str(), "package:", 8)) |
| 743 | { |
| 744 | PathEntry pkg; |
| 745 | pkg.filename = line.substr(8).trimmed(); |
| 746 | pkg.size = 0; |
| 747 | pkg.lastmod = 0; |
| 748 | pkg.flags = PathProperty::Directory; |
| 749 | |
| 750 | packages.push_back(pkg); |
| 751 | } |
| 752 | } |
| 753 | |
| 754 | // also fetch the system packages but mark them as hidden folders |
| 755 | adbStdout = Android::ListPackages(m_deviceID, "-s").strStdout; |
| 756 | |
| 757 | split(adbStdout, lines, '\n'); |
| 758 | for(rdcstr &line : lines) |
| 759 | while(!line.empty() && isspace(line.back())) |
| 760 | line.pop_back(); |
| 761 | |
| 762 | for(const rdcstr &line : lines) |
| 763 | { |
| 764 | if(!strncmp(line.c_str(), "package:", 8)) |
| 765 | { |
| 766 | PathEntry pkg; |
| 767 | pkg.filename = line.substr(8).trimmed(); |
| 768 | pkg.size = 0; |
| 769 | pkg.lastmod = 0; |
| 770 | pkg.flags = PathProperty::Directory | PathProperty::Hidden; |
| 771 | |
| 772 | packages.push_back(pkg); |
| 773 | } |
| 774 | } |
| 775 | |
| 776 | // Android is a completely garbage platform, and the command below can take several orders of |
| 777 | // magnitude more time than is reasonable and hit the remote server timeout. To give the best |
| 778 | // chance of that not happening, we ping before and after running it. |
nothing calls this directly
no test coverage detected