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

Commit 49e9bfc3 authored by Vitor Carvalho's avatar Vitor Carvalho Committed by Android (Google) Code Review
Browse files

Merge "Replace usage of DPM supervision methods in UsageStatsService with...

Merge "Replace usage of DPM supervision methods in UsageStatsService with calls to SupervisionManagerInternal. Part 2." into main
parents 5e15c151 b8de10f1
Loading
Loading
Loading
Loading
+12 −4
Original line number Diff line number Diff line
@@ -1869,10 +1869,18 @@ public class UsageStatsService extends SystemService implements
    }

    private boolean shouldDeleteObsoleteData(UserHandle userHandle) {
        if (android.app.supervision.flags.Flags.deprecateDpmSupervisionApis()) {
            final SupervisionManagerInternal smInternal = getSupervisionManagerInternal();
            // If supervision is not enabled for the given user, obsolete data should be deleted.
            return smInternal == null
                    || !smInternal.isSupervisionEnabledForUser(userHandle.getIdentifier());
        } else {
            final DevicePolicyManagerInternal dpmInternal = getDpmInternal();
            // If a profile owner is not defined for the given user, obsolete data should be deleted
            return dpmInternal == null
                || dpmInternal.getProfileOwnerOrDeviceOwnerSupervisionComponent(userHandle) == null;
                    || dpmInternal.getProfileOwnerOrDeviceOwnerSupervisionComponent(userHandle)
                            == null;
        }
    }

    private String buildFullToken(String packageName, String token) {