Add back "setFastPairScanEnabled" RPC method for e2e tests.

This change add back "setFastPairScanEnabled" RPC method in the
test snippet which is required to the test scripts. Due to the
@hide notation , ProGuard shrink out the
NearbyManager.setFastPairScanEnabled method, we directly use
Settings.Secure.putInt to manipulate FastPairScan setting as
a workaround.

Bug: 227513829
Bug: 228406038
Test: atest -v CtsNearbyMultiDevicesTestSuite
Reason for revert: Makes e2e tests working and pass
Partial Reverted Changes:
I4bdf8653d:Remove fast pair scan API
Ignore-AOSP-First: nearby_not_in_aosp_yet
Change-Id: I205f805dad2ca0ba92b8325dcc75bc62f74e76cb

Change-Id: I90e2c294cde7fb65d8fc326e85cd93232a84c4cc
diff --git a/nearby/tests/multidevices/clients/src/android/nearby/multidevices/fastpair/seeker/FastPairSeekerSnippet.kt b/nearby/tests/multidevices/clients/src/android/nearby/multidevices/fastpair/seeker/FastPairSeekerSnippet.kt
index 89f666f..bfb7a50 100644
--- a/nearby/tests/multidevices/clients/src/android/nearby/multidevices/fastpair/seeker/FastPairSeekerSnippet.kt
+++ b/nearby/tests/multidevices/clients/src/android/nearby/multidevices/fastpair/seeker/FastPairSeekerSnippet.kt
@@ -28,6 +28,7 @@
 import android.nearby.multidevices.fastpair.seeker.ui.CheckNearbyHalfSheetUiTest
 import android.nearby.multidevices.fastpair.seeker.ui.DismissNearbyHalfSheetUiTest
 import android.nearby.multidevices.fastpair.seeker.ui.PairByNearbyHalfSheetUiTest
+import android.provider.Settings
 import androidx.test.core.app.ApplicationProvider
 import com.google.android.mobly.snippet.Snippet
 import com.google.android.mobly.snippet.rpc.AsyncRpc
@@ -126,6 +127,18 @@
         return fastPairTestDataManager.testDataCache.dumpAccountKeyDeviceMetadataListAsJson()
     }
 
+    /** Writes into {@link Settings} whether Fast Pair scan is enabled.
+     *
+     * @param enable whether the Fast Pair scan should be enabled.
+     */
+    @Rpc(description = "Writes into Settings whether Fast Pair scan is enabled.")
+    fun setFastPairScanEnabled(enable: Boolean) {
+        Log.i("Writes into Settings whether Fast Pair scan is enabled.")
+        // TODO(b/228406038): Change back to use NearbyManager.setFastPairScanEnabled once un-hide.
+        val resolver = appContext.contentResolver
+        Settings.Secure.putInt(resolver, "fast_pair_scan_enabled", if (enable) 1 else 0)
+    }
+
     /** Dismisses the half sheet UI if showed. */
     @Rpc(description = "Dismisses the half sheet UI if showed.")
     fun dismissHalfSheet() {
diff --git a/nearby/tests/multidevices/clients/test_service/fastpair_seeker_data_provider/Android.bp b/nearby/tests/multidevices/clients/test_service/fastpair_seeker_data_provider/Android.bp
index 1fcee37..328751a 100644
--- a/nearby/tests/multidevices/clients/test_service/fastpair_seeker_data_provider/Android.bp
+++ b/nearby/tests/multidevices/clients/test_service/fastpair_seeker_data_provider/Android.bp
@@ -21,7 +21,7 @@
     srcs: ["shared/**/*.kt"],
     sdk_version: "test_current",
     static_libs: [
-        // TODO(b/227513829): Remove "framework-nearby-static" once Fast Pair system APIs add back.
+        // TODO(b/228406038): Remove "framework-nearby-static" once Fast Pair system APIs add back.
         "framework-nearby-static",
         "guava",
         "gson-prebuilt-jar",
diff --git a/nearby/tests/multidevices/host/Android.bp b/nearby/tests/multidevices/host/Android.bp
index 933cae9..ff795e8 100644
--- a/nearby/tests/multidevices/host/Android.bp
+++ b/nearby/tests/multidevices/host/Android.bp
@@ -17,6 +17,7 @@
 }
 
 // Run the tests: atest -v CtsNearbyMultiDevicesTestSuite
+// Check go/run-nearby-mainline-e2e for more details.
 python_test_host {
     name: "CtsNearbyMultiDevicesTestSuite",
     main: "suite_main.py",