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:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ public class NetworkOffer implements NetworkRanker.Scoreable {
|
||||
* @param previousOffer the previous offer
|
||||
*/
|
||||
public void migrateFrom(@NonNull final NetworkOffer previousOffer) {
|
||||
if (!callback.equals(previousOffer.callback)) {
|
||||
if (!callback.asBinder().equals(previousOffer.callback.asBinder())) {
|
||||
throw new IllegalArgumentException("Can only migrate from a previous version of"
|
||||
+ " the same offer");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user