Fix LockdownVpnTracker deadlock when resetting legacy Always-On VPN

When resetting legacy Always-On VPN, the intent is handled by
main thread. And it will also initialize VPN shutdown process,
which will cause networkInfo changed event on
ConnectivityService internal thread. These two events need to
hold their corresponding lock and ask for the other one, which
causes the deadlock.

This patch move the event handling to the same thread to prevent
such deadlock, and cleanup some unused variables.

Change-Id: I5b656c0d0381acb4e33409a11f502db9b180296c
Fix: 139122208
Test: atest FrameworksNetTests, manual test
This commit is contained in:
junyulai
2019-08-30 16:44:45 +08:00
parent 1ef61592b8
commit 2bdd029792

View File

@@ -4550,7 +4550,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
Slog.w(TAG, "VPN for user " + user + " not ready yet. Skipping lockdown");
return false;
}
setLockdownTracker(new LockdownVpnTracker(mContext, mNMS, this, vpn, profile));
setLockdownTracker(new LockdownVpnTracker(mContext, this, mHandler, vpn, profile));
} else {
setLockdownTracker(null);
}