Remove broadcast trigger half sheet show code
Test: broadcast can trigger half sheet
Bug: 214495869
Change-Id: I32e7d9972d2ec553e38376052eafbf155de82fc9
diff --git a/nearby/service/java/com/android/server/nearby/fastpair/FastPairAdvHandler.java b/nearby/service/java/com/android/server/nearby/fastpair/FastPairAdvHandler.java
index 6538462..a792c0b 100644
--- a/nearby/service/java/com/android/server/nearby/fastpair/FastPairAdvHandler.java
+++ b/nearby/service/java/com/android/server/nearby/fastpair/FastPairAdvHandler.java
@@ -23,12 +23,14 @@
import com.android.server.nearby.common.locator.Locator;
import com.android.server.nearby.fastpair.halfsheet.FastPairHalfSheetManager;
+import com.android.server.nearby.provider.FastPairDataProvider;
import com.android.server.nearby.util.FastPairDecoder;
import com.android.server.nearby.util.Hex;
import com.google.protobuf.ByteString;
import service.proto.Cache;
+import service.proto.Rpcs;
/**
* Handler that handle fast pair related broadcast.
@@ -59,10 +61,12 @@
Log.d("FastPairService",
"On discovery model id" + Hex.bytesToStringLowercase(model));
// Use api to get anti spoofing key from model id.
+ Rpcs.GetObservedDeviceResponse response =
+ FastPairDataProvider.getInstance().loadFastPairDeviceMetadata(model);
+ ByteString publicKey = response.getDevice().getAntiSpoofingKeyPair().getPublicKey();
Locator.get(mContext, FastPairHalfSheetManager.class).showHalfSheet(
- Cache.ScanFastPairStoreItem.newBuilder()
- .setAddress(mBleAddress)
- .setAntiSpoofingPublicKey(ByteString.EMPTY)
+ Cache.ScanFastPairStoreItem.newBuilder().setAddress(mBleAddress)
+ .setAntiSpoofingPublicKey(publicKey)
.build());
}
}
diff --git a/nearby/service/java/com/android/server/nearby/fastpair/FastPairManager.java b/nearby/service/java/com/android/server/nearby/fastpair/FastPairManager.java
index 41b6da7..bc1603e 100644
--- a/nearby/service/java/com/android/server/nearby/fastpair/FastPairManager.java
+++ b/nearby/service/java/com/android/server/nearby/fastpair/FastPairManager.java
@@ -48,14 +48,10 @@
import com.android.server.nearby.fastpair.cache.DiscoveryItem;
import com.android.server.nearby.fastpair.cache.FastPairCacheManager;
import com.android.server.nearby.fastpair.footprint.FootprintsDeviceManager;
-import com.android.server.nearby.fastpair.halfsheet.FastPairHalfSheetManager;
import com.android.server.nearby.fastpair.pairinghandler.PairingProgressHandlerBase;
-import com.android.server.nearby.provider.FastPairDataProvider;
import com.android.server.nearby.util.FastPairDecoder;
import com.android.server.nearby.util.Hex;
-import com.google.protobuf.ByteString;
-
import java.security.GeneralSecurityException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executor;
@@ -65,7 +61,6 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
-import service.proto.Cache;
import service.proto.Rpcs;
/**
@@ -79,10 +74,6 @@
/** A notification ID which should be dismissed */
public static final String EXTRA_NOTIFICATION_ID = ACTION_PREFIX + "EXTRA_NOTIFICATION_ID";
public static final String ACTION_RESOURCES_APK = "android.nearby.SHOW_HALFSHEET";
- // Temp action deleted when the scanner is ready
- public static final String ACTION_START_PAIRING = "NEARBY_START_PAIRING";
- public static final String EXTRA_MODEL_ID = "MODELID";
- public static final String EXTRA_ADDRESS = "ADDRESS";
private static Executor sFastPairExecutor;
@@ -110,17 +101,6 @@
Log.d("FastPairService", " the nearby manager is null");
}
- } else if (intent.getAction().equals(ACTION_START_PAIRING)) {
- byte[] model = intent.getByteArrayExtra(EXTRA_MODEL_ID);
- String address = intent.getStringExtra(EXTRA_ADDRESS);
- Log.d("FastPairService", "start pair " + address);
- Rpcs.GetObservedDeviceResponse response =
- FastPairDataProvider.getInstance().loadFastPairDeviceMetadata(model);
- ByteString publicKey = response.getDevice().getAntiSpoofingKeyPair().getPublicKey();
- Locator.get(mLocatorContextWrapper, FastPairHalfSheetManager.class).showHalfSheet(
- Cache.ScanFastPairStoreItem.newBuilder().setAddress(address)
- .setAntiSpoofingPublicKey(publicKey)
- .build());
} else {
Log.d("FastPairService", " screen off");
}
@@ -166,7 +146,6 @@
public void initiate() {
mIntentFilter.addAction(Intent.ACTION_SCREEN_ON);
mIntentFilter.addAction(Intent.ACTION_SCREEN_OFF);
- mIntentFilter.addAction(ACTION_START_PAIRING);
mLocatorContextWrapper.getContext()
.registerReceiver(mScreenBroadcastReceiver, mIntentFilter);