Make the universal export work on the older Android devices

Summary: On older Android devices (API 24) `-printf ` is not available

Reviewed By: lblasa

Differential Revision: D40980640

fbshipit-source-id: d1a1bcadc496deaf3d514c1e45b2e0104a937b18
This commit is contained in:
Andrey Goncharov
2022-11-04 08:23:44 -07:00
committed by Facebook GitHub Bot
parent 26241cf5c0
commit 2c767e1920

View File

@@ -310,11 +310,11 @@ export default class AndroidDevice
const appsCommandsResults = await Promise.all( const appsCommandsResults = await Promise.all(
appIds.map(async (appId): Promise<DeviceDebugData | undefined> => { appIds.map(async (appId): Promise<DeviceDebugData | undefined> => {
const sonarDirFileNames = await executeCommandAsApp( const sonarDirFilePaths = await executeCommandAsApp(
this.adb, this.adb,
this.info.serial, this.info.serial,
appId, appId,
`find /data/data/${appId}/files/sonar -type f -printf "%f\n"`, `find /data/data/${appId}/files/sonar -type f`,
) )
.then((output) => { .then((output) => {
if (output.includes('No such file or directory')) { if (output.includes('No such file or directory')) {
@@ -343,14 +343,13 @@ export default class AndroidDevice
); );
}); });
if (!sonarDirFileNames) { if (!sonarDirFilePaths) {
return; return;
} }
const sonarDirContentPromises = sonarDirFileNames.map( const sonarDirContentPromises = sonarDirFilePaths.map(
async (fileName) => { async (filePath) => {
const filePath = `/data/data/${appId}/files/sonar/${fileName}`; if (filePath.endsWith('pem')) {
if (fileName.endsWith('pem')) {
return { return {
path: filePath, path: filePath,
data: '===SECURE_CONTENT===', data: '===SECURE_CONTENT===',