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

Commit 67be01bf authored by Alex Johnston's avatar Alex Johnston Committed by Automerger Merge Worker
Browse files

Merge "Remove profile owner network logging notification" into sc-dev am: 184d5742

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

Change-Id: I88498c6aee072b5171ff6f880eb9cff4aa164847
parents b644c820 184d5742
Loading
Loading
Loading
Loading
+10 −9
Original line number Original line Diff line number Diff line
@@ -14707,24 +14707,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);
@@ -14744,7 +14745,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());
    }
    }
    /**
    /**