MCPcopy Index your code
hub / github.com/callstack/agent-device / collectAndroidPackagePids

Function collectAndroidPackagePids

src/daemon/app-log-android.ts:138–155  ·  view source on GitHub ↗
(
  content: string,
  appBundleId: string,
  currentPid: string | null,
)

Source from the content-addressed store, hash-verified

136}
137
138function collectAndroidPackagePids(
139 content: string,
140 appBundleId: string,
141 currentPid: string | null,
142): string[] {
143 const pids = new Set<string>();
144 if (currentPid) {
145 pids.add(currentPid);
146 }
147 const lines = content.split('\n');
148 for (const line of lines) {
149 if (!line.includes(appBundleId)) continue;
150 for (const candidate of extractAndroidPidsFromPackageLine(line, appBundleId)) {
151 pids.add(candidate);
152 }
153 }
154 return [...pids];
155}
156
157function extractAndroidPidsFromPackageLine(line: string, appBundleId: string): string[] {
158 const escapedPackage = escapeRegExp(appBundleId);

Callers 1

Calls 1

Tested by

no test coverage detected