diff options
author | jdesprez <jdesprez@google.com> | 2017-07-13 02:50:46 -0700 |
---|---|---|
committer | jdesprez <jdesprez@google.com> | 2017-07-17 07:07:56 -0700 |
commit | 636ffd4315f6748b9331b88a741ae3fd7c296547 (patch) | |
tree | 120b3fe4c7f9ead19ad1f4b55642de7c3bc28194 /src/com/android/tradefed/targetprep | |
parent | b27935e046e4d91439897e6fc963efb2f86546d2 (diff) | |
download | tradefederation-636ffd4315f6748b9331b88a741ae3fd7c296547.tar.gz |
Move pre flasher check
Make pre flasher check a possible implementation only.
Test: unit tests
Bug: 63627003
Change-Id: I97201077b4acd8d95b31ccb8c73927d56be09ff8
Diffstat (limited to 'src/com/android/tradefed/targetprep')
-rw-r--r-- | src/com/android/tradefed/targetprep/DeviceFlashPreparer.java | 49 |
1 files changed, 10 insertions, 39 deletions
diff --git a/src/com/android/tradefed/targetprep/DeviceFlashPreparer.java b/src/com/android/tradefed/targetprep/DeviceFlashPreparer.java index 38c1cda9f..f691e702b 100644 --- a/src/com/android/tradefed/targetprep/DeviceFlashPreparer.java +++ b/src/com/android/tradefed/targetprep/DeviceFlashPreparer.java @@ -30,8 +30,6 @@ import com.android.tradefed.targetprep.IDeviceFlasher.UserDataFlashOption; import com.android.tradefed.util.IRunUtil; import com.android.tradefed.util.RunUtil; -import com.google.common.annotations.VisibleForTesting; - import java.util.ArrayList; import java.util.Collection; import java.util.concurrent.Semaphore; @@ -64,12 +62,6 @@ public abstract class DeviceFlashPreparer implements ITargetCleaner { "specify if system should always be flashed even if already running desired build.") private boolean mForceSystemFlash = false; - @Option( - name = "skip-pre-flash-product-check", - description = "Specify if device product type should be checked before flashing" - ) - private boolean mSkipPreFlashProductType = true; - /* * A temporary workaround for special builds. Should be removed after changes from build team. * Bug: 18078421 @@ -124,15 +116,6 @@ public abstract class DeviceFlashPreparer implements ITargetCleaner { } /** - * Sets the skipPreFlashProductType flag. - * <p/> - * Exposed for unit testing - */ - void setSkipPreFlashProductType(boolean skipPreFlashProductType) { - mSkipPreFlashProductType = skipPreFlashProductType; - } - - /** * Gets the interval between device boot poll attempts. * <p/> * Exposed for unit testing @@ -320,29 +303,17 @@ public abstract class DeviceFlashPreparer implements ITargetCleaner { } } - /** Check the device allocated against the build to ensure this is compatible to be flashed. */ - @VisibleForTesting - void checkDeviceProductType(ITestDevice device, IDeviceBuildInfo deviceBuild) + /** + * Possible check before flashing to ensure the device is as expected compare to the build info. + * + * @param device the {@link ITestDevice} to flash. + * @param deviceBuild the {@link IDeviceBuildInfo} used to flash. + * @throws BuildError + * @throws DeviceNotAvailableException + */ + protected void checkDeviceProductType(ITestDevice device, IDeviceBuildInfo deviceBuild) throws BuildError, DeviceNotAvailableException { - if (mSkipPreFlashProductType) { - CLog.d("Skipping pre flash device product check."); - return; - } - String buildFlavor = deviceBuild.getBuildFlavor(); - String deviceTypeFromBuild = buildFlavor; - // handle a case where build flavor format is not really quite as expected. - // <'device board'>-<user|userdebug> - if (buildFlavor.indexOf("-") != -1) { - deviceTypeFromBuild = buildFlavor.substring(0, buildFlavor.indexOf("-")); - } - String deviceProduct = device.getProductType(); // ro.hardware of the device - if (!deviceTypeFromBuild.equals(deviceProduct)) { - throw new BuildError( - String.format( - "Device allocated is a '%s' while build is meant for a '%s'", - deviceProduct, deviceTypeFromBuild), - device.getDeviceDescriptor()); - } + // empty of purpose } /** |