@@ -42,6 +42,12 @@ export class AndroidApplicationManager extends ApplicationManagerBase {
4242 super ( $logger , $hooksService , $deviceLogProvider ) ;
4343 }
4444
45+ /**
46+ * Lists the identifiers of all packages installed on the device.
47+ * Falls back to listing packages per user when the plain listing yields
48+ * nothing, which happens on devices where shell cannot access every user.
49+ * @returns {Promise<string[]> } Unique package identifiers across all users.
50+ */
4551 public async getInstalledApplications ( ) : Promise < string [ ] > {
4652 if ( ! this . listPackagesPerUser ) {
4753 const packages = this . parsePackageList (
@@ -74,6 +80,11 @@ export class AndroidApplicationManager extends ApplicationManagerBase {
7480 return _ . uniq ( packages ) ;
7581 }
7682
83+ /**
84+ * Extracts package identifiers from `pm list packages` output.
85+ * @param {string } output Raw shell output, one `package:<id>` line per package.
86+ * @returns {string[] } The package identifiers, in output order.
87+ */
7788 private parsePackageList ( output : string ) : string [ ] {
7889 const regex = / p a c k a g e : ( .+ ) / ;
7990 return ( output || "" )
@@ -85,6 +96,10 @@ export class AndroidApplicationManager extends ApplicationManagerBase {
8596 . filter ( ( parsedPackage : string ) => parsedPackage !== null ) ;
8697 }
8798
99+ /**
100+ * Lists the ids of all Android users on the device via `pm list users`.
101+ * @returns {Promise<string[]> } User ids as printed by the device, e.g. ["0", "150"].
102+ */
88103 private async getUserIds ( ) : Promise < string [ ] > {
89104 const output : string =
90105 ( await this . adb . executeShellCommand ( [ "pm" , "list" , "users" ] ) ) || "" ;
0 commit comments