Cleanup BusinessLogicPreparer to match changes made in o-mr1.

Test: make cts
Bug: 77496522
Change-Id: Iea733eb6858deb560f173c8ff71363102ae40bbf
(cherry picked from commit d1c275b657f180945d39b79377e428b983a530f8)
(cherry picked from commit dc79c653acefe54b43df2cca241ddec26d2d1d9e)
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 d54d1e7..f7ea5c4 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
@@ -69,8 +69,6 @@
     private static final String FILE_EXT = ".bl";
     /* Default amount of time to attempt connection to the business logic service, in seconds */
     private static final int DEFAULT_CONNECTION_TIME = 10;
-    /* URI of api scope to use when retrieving business logic rules */
-    private static final String APE_API_SCOPE = "https://www.googleapis.com/auth/androidPartner";
     /* Dynamic config constants */
     private static final String DYNAMIC_CONFIG_FEATURES_KEY = "business_logic_device_features";
     private static final String DYNAMIC_CONFIG_PROPERTIES_KEY = "business_logic_device_properties";
@@ -87,6 +85,11 @@
             "the business logic service.", mandatory = true)
     private String mApiKey;
 
+    @Option(name = "business-logic-api-scope", description = "The URI of api scope to use when " +
+            "retrieving business logic rules.")
+    /* URI of api scope to use when retrieving business logic rules */
+    private  String mApiScope;
+
     @Option(name = "cleanup", description = "Whether to remove config files from the test " +
             "target after test completion.")
     private boolean mCleanup = true;
@@ -295,9 +298,13 @@
             CLog.d("Environment variable APE_API_KEY not set.");
             return null;
         }
+        if (Strings.isNullOrEmpty(mApiScope)) {
+            CLog.d("API scope not set, use flag --business-logic-api-scope.");
+            return null;
+        }
         try {
             Credential credential = GoogleCredential.fromStream(new FileInputStream(keyFilePath))
-                    .createScoped(Collections.singleton(APE_API_SCOPE));
+                    .createScoped(Collections.singleton(mApiScope));
             credential.refreshToken();
             return credential.getAccessToken();
         } catch (FileNotFoundException e) {
diff --git a/common/util/src/com/android/compatibility/common/util/BusinessLogic.java b/common/util/src/com/android/compatibility/common/util/BusinessLogic.java
index 26fae1e..b87a250 100644
--- a/common/util/src/com/android/compatibility/common/util/BusinessLogic.java
+++ b/common/util/src/com/android/compatibility/common/util/BusinessLogic.java
@@ -92,7 +92,7 @@
             case NOT_AUTHORIZED:
                 return "service account is not authorized to access information for this device. "
                         + "Please verify device properties are set correctly and account "
-                        + "permissions are configured in Google's systems.";
+                        + "permissions are configured to the Business Logic Api.";
             default:
                 return "something went wrong, please try again.";
         }