Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 44ff5531 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add a lock around the wificond death handler and teardownInterfaces in...

Merge "Add a lock around the wificond death handler and teardownInterfaces in WifiNl80211Manager." into main
parents 896d010d e87e9302
Loading
Loading
Loading
Loading
+29 −24
Original line number Diff line number Diff line
@@ -113,6 +113,7 @@ public class WifiNl80211Manager {
    private HashMap<String, IPnoScanEvent> mPnoScanEventHandlers = new HashMap<>();
    private HashMap<String, IApInterfaceEventCallback> mApInterfaceListeners = new HashMap<>();
    private Runnable mDeathEventHandler;
    private Object mLock = new Object();
    /**
     * Ensures that no more than one sendMgmtFrame operation runs concurrently.
     */
@@ -625,6 +626,7 @@ public class WifiNl80211Manager {
    @VisibleForTesting
    public void binderDied() {
        mEventHandler.post(() -> {
            synchronized (mLock) {
                Log.e(TAG, "Wificond died!");
                clearState();
                // Invalidate the global wificond handle on death. Will be refreshed
@@ -633,6 +635,7 @@ public class WifiNl80211Manager {
                if (mDeathEventHandler != null) {
                    mDeathEventHandler.run();
                }
            }
        });
    }

@@ -867,8 +870,9 @@ public class WifiNl80211Manager {
    * @return Returns true on success.
    */
    public boolean tearDownInterfaces() {
        synchronized (mLock) {
            Log.d(TAG, "tearing down interfaces in wificond");
        // Explicitly refresh the wificodn handler because |tearDownInterfaces()|
            // Explicitly refresh the wificond handler because |tearDownInterfaces()|
            // could be used to cleanup before we setup any interfaces.
            if (!retrieveWificondAndRegisterForDeath()) {
                return false;
@@ -888,6 +892,7 @@ public class WifiNl80211Manager {

            return false;
        }
    }

    /** Helper function to look up the interface handle using name */
    private IClientInterface getClientInterface(@NonNull String ifaceName) {