Merge "Remove an NPE in tearDown" into main

This commit is contained in:
Jean Chalard
2023-10-05 02:44:59 +00:00
committed by Gerrit Code Review

View File

@@ -198,7 +198,8 @@ public abstract class AbstractRestrictBackgroundNetworkTestCase {
protected void tearDown() throws Exception {
executeShellCommand("cmd netpolicy stop-watching");
mServiceClient.unbind();
if (mLock.isHeld()) mLock.release();
final PowerManager.WakeLock lock = mLock;
if (null != lock && lock.isHeld()) lock.release();
}
protected int getUid(String packageName) throws Exception {