From ca665ed83fdf512d08b4e486e0803f6af17d0680 Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Sat, 5 Dec 2026 18:55:37 +0800 Subject: [PATCH] refactor(adb): share parsed package fields (#17036) --- src/adb/AdbShellOutput.ts | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/src/adb/AdbShellOutput.ts b/src/adb/AdbShellOutput.ts index ac0cf5b3b96..d004b5ff0af 100644 --- a/src/adb/AdbShellOutput.ts +++ b/src/adb/AdbShellOutput.ts @@ -320,15 +320,18 @@ export const parseWindowFocusOutput = ( }; }; -export interface AdbPackageDetails { - readonly versionName: string | null; +interface ParsedPackageFields { + versionName: string | null; /** Signed 64-bit long version code exactly as Package Manager prints it. */ - readonly versionCode: string | null; - readonly firstInstallTime: string | null; - readonly lastUpdateTime: string | null; - readonly installerPackageName: string | null; - readonly userId: number | null; - readonly pkgFlags: string | null; + versionCode: string | null; + firstInstallTime: string | null; + lastUpdateTime: string | null; + installerPackageName: string | null; + userId: number | null; + pkgFlags: string | null; +} + +export interface AdbPackageDetails extends Readonly { readonly requestedPermissions: number | null; readonly numericIssues: AdbPackageNumericIssues; } @@ -354,15 +357,7 @@ const absentInstallerOrName = (value: string): string | null => export const parseDumpsysPackageOutput = ( stdout: string, ): AdbPackageDetails => { - const details: { - versionName: string | null; - versionCode: string | null; - firstInstallTime: string | null; - lastUpdateTime: string | null; - installerPackageName: string | null; - userId: number | null; - pkgFlags: string | null; - } = { + const details: ParsedPackageFields = { versionName: null, versionCode: null, firstInstallTime: null,