Log failures to unlinkToDeath wakelocks.

Some wakelocks are throwing an exception when unlinking. This should be
impossible, so start catching and logging failures as WTFs so they get
uploaded when it happens again.

Fixes: 182841946
Bug: 180891878
Test: N/A
Change-Id: I9e7a0aa745852178cbfd793451e150e34e7b5488
This commit is contained in:
Michael Wright
2021-07-12 14:27:25 +01:00
parent 77a21b7099
commit ec4306ac39

View File

@@ -129,6 +129,7 @@ import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.Objects;
/**
@@ -1490,7 +1491,11 @@ public final class PowerManagerService extends SystemService
mRequestWaitForNegativeProximity = true;
}
wakeLock.mLock.unlinkToDeath(wakeLock, 0);
try {
wakeLock.mLock.unlinkToDeath(wakeLock, 0);
} catch (NoSuchElementException e) {
Slog.wtf(TAG, "Failed to unlink wakelock", e);
}
removeWakeLockLocked(wakeLock, index);
}
}