Merge "Clear binder identity during network logging notification processing" into sc-dev am: 5002d71146

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

Change-Id: I2b24ae14aa47a68e0332a181505da9de27f64689
This commit is contained in:
TreeHugger Robot
2021-07-13 16:01:15 +00:00
committed by Automerger Merge Worker

View File

@@ -14991,9 +14991,9 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
} }
private void setNetworkLoggingActiveInternal(boolean active) { private void setNetworkLoggingActiveInternal(boolean active) {
final boolean[] shouldSendNotification = new boolean[] {false};
synchronized (getLockObject()) {
mInjector.binderWithCleanCallingIdentity(() -> { mInjector.binderWithCleanCallingIdentity(() -> {
boolean shouldSendNotification = false;
synchronized (getLockObject()) {
if (active) { if (active) {
if (mNetworkLogger == null) { if (mNetworkLogger == null) {
final int affectedUserId = getNetworkLoggingAffectedUser(); final int affectedUserId = getNetworkLoggingAffectedUser();
@@ -15008,7 +15008,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
+ " service not being available yet."); + " service not being available yet.");
} }
maybePauseDeviceWideLoggingLocked(); maybePauseDeviceWideLoggingLocked();
shouldSendNotification[0] = shouldSendNetworkLoggingNotificationLocked(); shouldSendNotification = shouldSendNetworkLoggingNotificationLocked();
} else { } else {
if (mNetworkLogger != null && !mNetworkLogger.stopNetworkLogging()) { if (mNetworkLogger != null && !mNetworkLogger.stopNetworkLogging()) {
Slogf.wtf(LOG_TAG, "Network logging could not be stopped due to the logging" Slogf.wtf(LOG_TAG, "Network logging could not be stopped due to the logging"
@@ -15016,15 +15016,15 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
} }
mNetworkLogger = null; mNetworkLogger = null;
} }
});
} }
if (active) { if (active) {
if (shouldSendNotification[0]) { if (shouldSendNotification) {
sendNetworkLoggingNotification(); sendNetworkLoggingNotification();
} }
} else { } else {
mInjector.getNotificationManager().cancel(SystemMessage.NOTE_NETWORK_LOGGING); mInjector.getNotificationManager().cancel(SystemMessage.NOTE_NETWORK_LOGGING);
} }
});
} }
private @UserIdInt int getNetworkLoggingAffectedUser() { private @UserIdInt int getNetworkLoggingAffectedUser() {