From fc35f82082d03afc84bc4db2c3903b53f2475dc1 Mon Sep 17 00:00:00 2001 From: Alex Johnston Date: Wed, 28 Apr 2021 10:59:29 +0100 Subject: [PATCH] Disable security and network logging COPE * When the COPE work profile is removed, security and network logging should be stopped and removed. Manual testing * Set up device in COPE mode * Enable network logging and security logging using TestDPC * Add debugger breakpoint in DPMS.wipeData * Select 'Remove work profile' in TestDPC * Verify DPMS SecurityLogMonitor has been stopped * Verify DPMS NetworkLogger is null Bug: 182453624 Test: manual testing Change-Id: I62df832023f12620e936b49240ecdb1cc2a722f5 --- .../server/devicepolicy/DevicePolicyManagerService.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java index 6283b4e56402a..2b786e1ec72f6 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -869,6 +869,12 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { synchronized (getLockObject()) { // Check whether the user is affiliated, *before* removing its data. boolean isRemovedUserAffiliated = isUserAffiliatedWithDeviceLocked(userHandle); + if (isProfileOwnerOfOrganizationOwnedDevice(userHandle)) { + // Disable network and security logging + mInjector.securityLogSetLoggingEnabledProperty(false); + mSecurityLogMonitor.stop(); + setNetworkLoggingActiveInternal(false); + } removeUserData(userHandle); if (!isRemovedUserAffiliated) { // We discard the logs when unaffiliated users are deleted (so that the