Loading services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +10 −9 Original line number Original line Diff line number Diff line Loading @@ -14699,24 +14699,25 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { private void sendNetworkLoggingNotificationLocked() { private void sendNetworkLoggingNotificationLocked() { ensureLocked(); ensureLocked(); final ActiveAdmin activeAdmin = getNetworkLoggingControllingAdminLocked(); // Send a network logging notification if the admin is a device owner, not profile owner. if (activeAdmin == null || !activeAdmin.isNetworkLoggingEnabled) { final ActiveAdmin deviceOwner = getDeviceOwnerAdminLocked(); if (deviceOwner == null || !deviceOwner.isNetworkLoggingEnabled) { return; return; } } if (activeAdmin.numNetworkLoggingNotifications if (deviceOwner.numNetworkLoggingNotifications >= ActiveAdmin.DEF_MAXIMUM_NETWORK_LOGGING_NOTIFICATIONS_SHOWN) { >= ActiveAdmin.DEF_MAXIMUM_NETWORK_LOGGING_NOTIFICATIONS_SHOWN) { return; return; } } final long now = System.currentTimeMillis(); final long now = System.currentTimeMillis(); if (now - activeAdmin.lastNetworkLoggingNotificationTimeMs < MS_PER_DAY) { if (now - deviceOwner.lastNetworkLoggingNotificationTimeMs < MS_PER_DAY) { return; return; } } activeAdmin.numNetworkLoggingNotifications++; deviceOwner.numNetworkLoggingNotifications++; if (activeAdmin.numNetworkLoggingNotifications if (deviceOwner.numNetworkLoggingNotifications >= ActiveAdmin.DEF_MAXIMUM_NETWORK_LOGGING_NOTIFICATIONS_SHOWN) { >= ActiveAdmin.DEF_MAXIMUM_NETWORK_LOGGING_NOTIFICATIONS_SHOWN) { activeAdmin.lastNetworkLoggingNotificationTimeMs = 0; deviceOwner.lastNetworkLoggingNotificationTimeMs = 0; } else { } else { activeAdmin.lastNetworkLoggingNotificationTimeMs = now; deviceOwner.lastNetworkLoggingNotificationTimeMs = now; } } final PackageManagerInternal pm = mInjector.getPackageManagerInternal(); final PackageManagerInternal pm = mInjector.getPackageManagerInternal(); final Intent intent = new Intent(DevicePolicyManager.ACTION_SHOW_DEVICE_MONITORING_DIALOG); final Intent intent = new Intent(DevicePolicyManager.ACTION_SHOW_DEVICE_MONITORING_DIALOG); Loading @@ -14736,7 +14737,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { .bigText(mContext.getString(R.string.network_logging_notification_text))) .bigText(mContext.getString(R.string.network_logging_notification_text))) .build(); .build(); mInjector.getNotificationManager().notify(SystemMessage.NOTE_NETWORK_LOGGING, notification); mInjector.getNotificationManager().notify(SystemMessage.NOTE_NETWORK_LOGGING, notification); saveSettingsLocked(activeAdmin.getUserHandle().getIdentifier()); saveSettingsLocked(deviceOwner.getUserHandle().getIdentifier()); } } /** /** Loading
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +10 −9 Original line number Original line Diff line number Diff line Loading @@ -14699,24 +14699,25 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { private void sendNetworkLoggingNotificationLocked() { private void sendNetworkLoggingNotificationLocked() { ensureLocked(); ensureLocked(); final ActiveAdmin activeAdmin = getNetworkLoggingControllingAdminLocked(); // Send a network logging notification if the admin is a device owner, not profile owner. if (activeAdmin == null || !activeAdmin.isNetworkLoggingEnabled) { final ActiveAdmin deviceOwner = getDeviceOwnerAdminLocked(); if (deviceOwner == null || !deviceOwner.isNetworkLoggingEnabled) { return; return; } } if (activeAdmin.numNetworkLoggingNotifications if (deviceOwner.numNetworkLoggingNotifications >= ActiveAdmin.DEF_MAXIMUM_NETWORK_LOGGING_NOTIFICATIONS_SHOWN) { >= ActiveAdmin.DEF_MAXIMUM_NETWORK_LOGGING_NOTIFICATIONS_SHOWN) { return; return; } } final long now = System.currentTimeMillis(); final long now = System.currentTimeMillis(); if (now - activeAdmin.lastNetworkLoggingNotificationTimeMs < MS_PER_DAY) { if (now - deviceOwner.lastNetworkLoggingNotificationTimeMs < MS_PER_DAY) { return; return; } } activeAdmin.numNetworkLoggingNotifications++; deviceOwner.numNetworkLoggingNotifications++; if (activeAdmin.numNetworkLoggingNotifications if (deviceOwner.numNetworkLoggingNotifications >= ActiveAdmin.DEF_MAXIMUM_NETWORK_LOGGING_NOTIFICATIONS_SHOWN) { >= ActiveAdmin.DEF_MAXIMUM_NETWORK_LOGGING_NOTIFICATIONS_SHOWN) { activeAdmin.lastNetworkLoggingNotificationTimeMs = 0; deviceOwner.lastNetworkLoggingNotificationTimeMs = 0; } else { } else { activeAdmin.lastNetworkLoggingNotificationTimeMs = now; deviceOwner.lastNetworkLoggingNotificationTimeMs = now; } } final PackageManagerInternal pm = mInjector.getPackageManagerInternal(); final PackageManagerInternal pm = mInjector.getPackageManagerInternal(); final Intent intent = new Intent(DevicePolicyManager.ACTION_SHOW_DEVICE_MONITORING_DIALOG); final Intent intent = new Intent(DevicePolicyManager.ACTION_SHOW_DEVICE_MONITORING_DIALOG); Loading @@ -14736,7 +14737,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { .bigText(mContext.getString(R.string.network_logging_notification_text))) .bigText(mContext.getString(R.string.network_logging_notification_text))) .build(); .build(); mInjector.getNotificationManager().notify(SystemMessage.NOTE_NETWORK_LOGGING, notification); mInjector.getNotificationManager().notify(SystemMessage.NOTE_NETWORK_LOGGING, notification); saveSettingsLocked(activeAdmin.getUserHandle().getIdentifier()); saveSettingsLocked(deviceOwner.getUserHandle().getIdentifier()); } } /** /**