diff options
author | Guang Zhu <guangzhu@google.com> | 2015-09-15 10:58:20 -0700 |
---|---|---|
committer | Guang Zhu <guangzhu@google.com> | 2015-09-15 10:58:20 -0700 |
commit | 5144b04a4e8e7ade27888374e4fd79c210e06f5d (patch) | |
tree | 992fa42292e65c9cf4d04a6b435477e5314921c7 /src/com/android/tradefed/targetprep | |
parent | 0c18641ba7671841fb83fad319439b3047db5dd8 (diff) | |
download | tradefederation-5144b04a4e8e7ade27888374e4fd79c210e06f5d.tar.gz |
restore binary compatibility in TestAppInstallSetup
restores the protected method getLocalPathForFilename since there're
subclasses outside TF repository overriding this method.
Bug: 24092894
Change-Id: I4af187369b69e235df1ede8faa4339ed7a33b18c
Diffstat (limited to 'src/com/android/tradefed/targetprep')
-rw-r--r-- | src/com/android/tradefed/targetprep/TestAppInstallSetup.java | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/src/com/android/tradefed/targetprep/TestAppInstallSetup.java b/src/com/android/tradefed/targetprep/TestAppInstallSetup.java index 8ced4cfc6..0dc3c4e3c 100644 --- a/src/com/android/tradefed/targetprep/TestAppInstallSetup.java +++ b/src/com/android/tradefed/targetprep/TestAppInstallSetup.java @@ -92,6 +92,25 @@ public class TestAppInstallSetup implements ITargetCleaner, IAbiReceiver { } /** + * Resolve the actual apk path based on testing artifact information inside build info. + * + * @param buildInfo build artifact information + * @param apkFileName filename of the apk to install + * @return a {@link File} representing the physical apk file on host or {@code null} if the + * file does not exist. + */ + protected File getLocalPathForFilename(IBuildInfo buildInfo, String apkFileName) + throws TargetSetupError { + try { + return BuildTestsZipUtils.getApkFile(buildInfo, apkFileName, mAltDirs, mAltDirBehavior, + false /* use resource as fallback */, + null /* device signing key */); + } catch (IOException ioe) { + throw new TargetSetupError("failed to resolve apk path", ioe); + } + } + + /** * {@inheritDoc} */ @Override @@ -105,21 +124,7 @@ public class TestAppInstallSetup implements ITargetCleaner, IAbiReceiver { mPackagesInstalled = new ArrayList<>(); } for (String testAppName : mTestFileNames) { - File testAppFile = null; - try { - testAppFile = BuildTestsZipUtils.getApkFile(buildInfo, testAppName, - mAltDirs, mAltDirBehavior, - false /* use resource as fallback */, null /* device signing key*/); - } catch (IOException ioe) { - CLog.e("IOException while looking up apk"); - CLog.e(ioe); - // will throw exception below since testAppFile will be null - } - if (testAppFile == null) { - throw new TargetSetupError( - String.format("Could not find test app %s directory in extracted tests.zip", - testAppName)); - } + File testAppFile = getLocalPathForFilename(buildInfo, testAppName); // resolve abi flags if (mAbi != null && mForceAbi != null) { throw new IllegalStateException("cannot specify both abi flags"); |