Move EventLogTags.writeDeviceIdle calls outside synchronized block.
BUG: 31281543
Change-Id: I1cf5f80dda7ef0801a9fa9d0b5a5b207fc684cd5
diff --git a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
index ed63613..145bf1b 100644
--- a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
+++ b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
@@ -2215,23 +2215,23 @@
@Override
public void setDeviceIdleMode(boolean enabled) {
mContext.enforceCallingOrSelfPermission(MANAGE_NETWORK_POLICY, TAG);
-
Trace.traceBegin(Trace.TRACE_TAG_NETWORK, "setDeviceIdleMode");
try {
synchronized (mUidRulesFirstLock) {
- if (mDeviceIdleMode != enabled) {
- mDeviceIdleMode = enabled;
- if (mSystemReady) {
- // Device idle change means we need to rebuild rules for all
- // known apps, so do a global refresh.
- updateRulesForRestrictPowerUL();
- }
- if (enabled) {
- EventLogTags.writeDeviceIdleOnPhase("net");
- } else {
- EventLogTags.writeDeviceIdleOffPhase("net");
- }
+ if (mDeviceIdleMode == enabled) {
+ return;
}
+ mDeviceIdleMode = enabled;
+ if (mSystemReady) {
+ // Device idle change means we need to rebuild rules for all
+ // known apps, so do a global refresh.
+ updateRulesForRestrictPowerUL();
+ }
+ }
+ if (enabled) {
+ EventLogTags.writeDeviceIdleOnPhase("net");
+ } else {
+ EventLogTags.writeDeviceIdleOffPhase("net");
}
} finally {
Trace.traceEnd(Trace.TRACE_TAG_NETWORK);