Loading services/core/java/com/android/server/location/contexthub/ContextHubClientBroker.java +19 −26 Original line number Diff line number Diff line Loading @@ -185,8 +185,7 @@ public class ContextHubClientBroker extends IContextHubClient.Stub * True if {@link #mWakeLock} is open for acquisition. It is set to false after the client is * unregistered. */ @GuardedBy("mWakeLock") private boolean mIsWakelockUsable = true; private AtomicBoolean mIsWakelockUsable = new AtomicBoolean(true); /* * Internal interface used to invoke client callbacks. Loading Loading @@ -529,7 +528,7 @@ public class ContextHubClientBroker extends IContextHubClient.Stub @VisibleForTesting boolean isWakelockUsable() { synchronized (mWakeLock) { return mIsWakelockUsable; return mIsWakelockUsable.get(); } } Loading Loading @@ -1103,11 +1102,9 @@ public class ContextHubClientBroker extends IContextHubClient.Stub private void acquireWakeLock() { Binder.withCleanCallingIdentity( () -> { synchronized (mWakeLock) { if (mIsWakelockUsable) { if (mIsWakelockUsable.get()) { mWakeLock.acquire(WAKELOCK_TIMEOUT_MILLIS); } } }); } Loading @@ -1119,7 +1116,6 @@ public class ContextHubClientBroker extends IContextHubClient.Stub private void releaseWakeLock() { Binder.withCleanCallingIdentity( () -> { synchronized (mWakeLock) { if (mWakeLock.isHeld()) { try { mWakeLock.release(); Loading @@ -1127,7 +1123,6 @@ public class ContextHubClientBroker extends IContextHubClient.Stub Log.e(TAG, "Releasing the wakelock fails - ", e); } } } }); } Loading @@ -1139,8 +1134,7 @@ public class ContextHubClientBroker extends IContextHubClient.Stub private void releaseWakeLockOnExit() { Binder.withCleanCallingIdentity( () -> { synchronized (mWakeLock) { mIsWakelockUsable = false; mIsWakelockUsable.set(false); while (mWakeLock.isHeld()) { try { mWakeLock.release(); Loading @@ -1152,7 +1146,6 @@ public class ContextHubClientBroker extends IContextHubClient.Stub break; } } } }); } } Loading
services/core/java/com/android/server/location/contexthub/ContextHubClientBroker.java +19 −26 Original line number Diff line number Diff line Loading @@ -185,8 +185,7 @@ public class ContextHubClientBroker extends IContextHubClient.Stub * True if {@link #mWakeLock} is open for acquisition. It is set to false after the client is * unregistered. */ @GuardedBy("mWakeLock") private boolean mIsWakelockUsable = true; private AtomicBoolean mIsWakelockUsable = new AtomicBoolean(true); /* * Internal interface used to invoke client callbacks. Loading Loading @@ -529,7 +528,7 @@ public class ContextHubClientBroker extends IContextHubClient.Stub @VisibleForTesting boolean isWakelockUsable() { synchronized (mWakeLock) { return mIsWakelockUsable; return mIsWakelockUsable.get(); } } Loading Loading @@ -1103,11 +1102,9 @@ public class ContextHubClientBroker extends IContextHubClient.Stub private void acquireWakeLock() { Binder.withCleanCallingIdentity( () -> { synchronized (mWakeLock) { if (mIsWakelockUsable) { if (mIsWakelockUsable.get()) { mWakeLock.acquire(WAKELOCK_TIMEOUT_MILLIS); } } }); } Loading @@ -1119,7 +1116,6 @@ public class ContextHubClientBroker extends IContextHubClient.Stub private void releaseWakeLock() { Binder.withCleanCallingIdentity( () -> { synchronized (mWakeLock) { if (mWakeLock.isHeld()) { try { mWakeLock.release(); Loading @@ -1127,7 +1123,6 @@ public class ContextHubClientBroker extends IContextHubClient.Stub Log.e(TAG, "Releasing the wakelock fails - ", e); } } } }); } Loading @@ -1139,8 +1134,7 @@ public class ContextHubClientBroker extends IContextHubClient.Stub private void releaseWakeLockOnExit() { Binder.withCleanCallingIdentity( () -> { synchronized (mWakeLock) { mIsWakelockUsable = false; mIsWakelockUsable.set(false); while (mWakeLock.isHeld()) { try { mWakeLock.release(); Loading @@ -1152,7 +1146,6 @@ public class ContextHubClientBroker extends IContextHubClient.Stub break; } } } }); } }