Fix a bug where updates of offers won't find existing offers

.equals() only work on cross-process Binder instances if casted to
a Binder instance first.

Bug: 184281544
Test: ConnectivityServiceTest. CTS test for this specific issue to come
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Merged-In: I7b9e0df21a3cca59659867a75792289ddee2f1d7
Change-Id: I7b9e0df21a3cca59659867a75792289ddee2f1d7
  (cherry-picked from ag/14125149)
This commit is contained in:
Chalard Jean
2021-04-08 17:37:36 +09:00
committed by Junyu Lai
parent 29cb06a3e0
commit 9f6d447a42
2 changed files with 2 additions and 2 deletions

View File

@@ -6698,7 +6698,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
@NonNull final INetworkOfferCallback callback) {
ensureRunningOnConnectivityServiceThread();
for (final NetworkOfferInfo noi : mNetworkOffers) {
if (noi.offer.callback.equals(callback)) return noi;
if (noi.offer.callback.asBinder().equals(callback.asBinder())) return noi;
}
return null;
}