Merge "Fix potential race condition problem" am: 91a15e8ad9 am: 1e5e9923e6 am: b61ce03d57

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2278342

Change-Id: I312a9ecebe183204ed433a2881adff6edefc7ee5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot
2022-12-19 09:04:04 +00:00
committed by Automerger Merge Worker

View File

@@ -4251,8 +4251,8 @@ public final class PowerManagerService extends SystemService
}
private boolean forceSuspendInternal(int uid) {
try {
synchronized (mLock) {
synchronized (mLock) {
try {
mForceSuspendActive = true;
// Place the system in an non-interactive state
for (int idx = 0; idx < mPowerGroups.size(); idx++) {
@@ -4262,16 +4262,14 @@ public final class PowerManagerService extends SystemService
// Disable all the partial wake locks as well
updateWakeLockDisabledStatesLocked();
}
Slog.i(TAG, "Force-Suspending (uid " + uid + ")...");
boolean success = mNativeWrapper.nativeForceSuspend();
if (!success) {
Slog.i(TAG, "Force-Suspending failed in native.");
}
return success;
} finally {
synchronized (mLock) {
Slog.i(TAG, "Force-Suspending (uid " + uid + ")...");
boolean success = mNativeWrapper.nativeForceSuspend();
if (!success) {
Slog.i(TAG, "Force-Suspending failed in native.");
}
return success;
} finally {
mForceSuspendActive = false;
// Re-enable wake locks once again.
updateWakeLockDisabledStatesLocked();