Remove client-side BL auth validation, host-side

Also remove option to enable/disable conditional logic from BL preparer

bug:126442904
Test: run gts -m GtsPlacementTestCases (rm auth file first)
Change-Id: I81535aae3bff494d0fe57324a8eed3a11d335a5c
diff --git a/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/targetprep/BusinessLogicPreparer.java b/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/targetprep/BusinessLogicPreparer.java
index e038884..c24b439 100644
--- a/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/targetprep/BusinessLogicPreparer.java
+++ b/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/targetprep/BusinessLogicPreparer.java
@@ -92,8 +92,6 @@
             "business_logic_extended_device_info";
     private static final String DYNAMIC_CONFIG_CONDITIONAL_TESTS_ENABLED_KEY =
             "conditional_business_logic_tests_enabled";
-    /* Format used to append the enabled attribute to the serialized business logic string. */
-    private static final String ENABLED_ATTRIBUTE_SNIPPET = ", \"%s\":%s }";
 
     @Option(name = "business-logic-url", description = "The URL to use when accessing the " +
             "business logic service, parameters not included", mandatory = true)
@@ -120,10 +118,6 @@
             "suite invocation if retrieval of business logic fails.")
     private boolean mIgnoreFailure = false;
 
-    @Option(name="conditional-business-logic-tests-enabled",
-            description="Setting to true will ensure the device specific tests are executed.")
-    private boolean mConditionalTestsEnabled = false;
-
     @Option(name = "business-logic-connection-time", description = "Amount of time to attempt " +
             "connection to the business logic service, in seconds.")
     private int mMaxConnectionTime = DEFAULT_CONNECTION_TIME;
@@ -151,7 +145,6 @@
                 && System.currentTimeMillis() < (start + (mMaxConnectionTime * 1000))) {
             try {
                 businessLogicString = doPost(baseUrl, requestParams);
-                businessLogicString = addRuntimeConfig(businessLogicString, buildInfo);
             } catch (IOException e) {
                 // ignore, re-attempt connection with remaining time
                 CLog.d("BusinessLogic connection failure message: %s\nRetrying...", e.getMessage());
@@ -331,37 +324,6 @@
     }
 
     /**
-     * Append runtime configuration attributes to the end of the Json string.
-     * Determine if conditional tests should execute and add the value to the serialized business
-     * logic settings.
-     */
-    private String addRuntimeConfig(String businessLogicString, IBuildInfo buildInfo) {
-        int indexOfClosingParen = businessLogicString.lastIndexOf("}");
-        // Replace the closing paren with th enabled flag and closing paren. ex
-        // { "a":4 } -> {"a":4, "enabled":true }
-        return businessLogicString.substring(0, indexOfClosingParen) +
-                String.format(ENABLED_ATTRIBUTE_SNIPPET,
-                        BusinessLogicFactory.CONDITIONAL_TESTS_ENABLED,
-                        shouldExecuteConditionalTests(buildInfo));
-    }
-
-    /**
-     * Execute device specific test if enabled in config or through the command line.
-     * Otherwise skip all conditional tests.
-     */
-    private boolean shouldExecuteConditionalTests(IBuildInfo buildInfo) {
-        boolean enabledInConfig = false;
-        try {
-            String enabledInConfigValue = DynamicConfigFileReader.getValueFromConfig(
-                    buildInfo, getSuiteName(), DYNAMIC_CONFIG_CONDITIONAL_TESTS_ENABLED_KEY);
-            enabledInConfig = Boolean.parseBoolean(enabledInConfigValue);
-        } catch (XmlPullParserException | IOException e) {
-            CLog.e("Failed to pull business logic features from dynamic config");
-        }
-        return enabledInConfig || mConditionalTestsEnabled;
-    }
-
-    /**
      * Read the string from the business logic cache, handling the following cases with a null
      * return value:
      * - The cached file does not exist
diff --git a/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/testtype/BusinessLogicHostTestBase.java b/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/testtype/BusinessLogicHostTestBase.java
index 46ca0e5..ed6e7bc 100644
--- a/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/testtype/BusinessLogicHostTestBase.java
+++ b/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/testtype/BusinessLogicHostTestBase.java
@@ -51,7 +51,6 @@
     @Before
     public void handleBusinessLogic() {
         loadBusinessLogic();
-        ensureAuthenticated();
         executeBusinessLogic();
     }
 
@@ -82,27 +81,6 @@
         }
     }
 
-    protected void ensureAuthenticated() {
-        if (!mCanReadBusinessLogic) {
-            // super class handles the condition that the service is unavailable.
-            return;
-        }
-
-        if (!mBusinessLogic.mConditionalTestsEnabled) {
-            skipTest("Execution of device specific tests is not enabled. "
-                    + "Enable with '--conditional-business-logic-tests-enabled'");
-        }
-
-        if (mBusinessLogic.isAuthorized()) {
-            // Run test as normal.
-            return;
-        }
-        String message = mBusinessLogic.getAuthenticationStatusMessage();
-
-        // Fail test since request was not authorized.
-        failTest(String.format("Unable to execute because %s.", message));
-    }
-
     public static void skipTest(String message) {
         assumeTrue(message, false);
     }