From 6be7b335438916fe2501d2d4a0e8d0fe7ef465d3 Mon Sep 17 00:00:00 2001 From: Isaac Katzenelson Date: Tue, 24 Sep 2024 18:32:06 +0000 Subject: [PATCH] Revert "Run callback registration on the worker provided by the client." This reverts commit 1b917593dd7a42212e87ee8221b98f510f0b953e. Reason for revert: Causes NPE in internalRegisterCallback, probably a race condition. Bug: b/369292752 (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:673f9e5c8550e1205749ab8e8f4189e4778f6d03) Merged-In: Ic58e7eee51e0f3a15d62ca6e5db85f1b291bd865 Change-Id: Ic58e7eee51e0f3a15d62ca6e5db85f1b291bd865 --- .../app/SharedConnectivityManager.java | 28 +++++++------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/wifi/java/src/android/net/wifi/sharedconnectivity/app/SharedConnectivityManager.java b/wifi/java/src/android/net/wifi/sharedconnectivity/app/SharedConnectivityManager.java index fc4a909e761f..f68ae2c7e249 100644 --- a/wifi/java/src/android/net/wifi/sharedconnectivity/app/SharedConnectivityManager.java +++ b/wifi/java/src/android/net/wifi/sharedconnectivity/app/SharedConnectivityManager.java @@ -173,10 +173,6 @@ public class SharedConnectivityManager { } } } - - Executor getExecutor() { - return mExecutor; - } } private ISharedConnectivityService mService; @@ -192,7 +188,7 @@ public class SharedConnectivityManager { private final String mServicePackageName; private final String mIntentAction; private ServiceConnection mServiceConnection; - private final UserManager mUserManager; + private UserManager mUserManager; /** * Creates a new instance of {@link SharedConnectivityManager}. @@ -320,19 +316,15 @@ public class SharedConnectivityManager { private void registerCallbackInternal(SharedConnectivityClientCallback callback, SharedConnectivityCallbackProxy proxy) { - proxy.getExecutor().execute( - () -> { - try { - mService.registerCallback(proxy); - synchronized (mProxyDataLock) { - mProxyMap.put(callback, proxy); - } - } catch (RemoteException e) { - Log.e(TAG, "Exception in registerCallback", e); - callback.onRegisterCallbackFailed(e); - } - } - ); + try { + mService.registerCallback(proxy); + synchronized (mProxyDataLock) { + mProxyMap.put(callback, proxy); + } + } catch (RemoteException e) { + Log.e(TAG, "Exception in registerCallback", e); + callback.onRegisterCallbackFailed(e); + } } /**