Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 184d5742 authored by Alex Johnston's avatar Alex Johnston Committed by Android (Google) Code Review
Browse files

Merge "Remove profile owner network logging notification" into sc-dev

parents 47f60213 10f5e299
Loading
Loading
Loading
Loading
+10 −9
Original line number Original line Diff line number Diff line
@@ -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);
@@ -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());
    }
    }
    /**
    /**