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

Commit bc422156 authored by Irem Uguz's avatar Irem Uguz
Browse files

Reland "Add flag checks for DPM API calls"

This relands commit 63d15f25 which was reverted in commit 26c97275. The fix
ag/35145948 is added on the same topic and will be submittd together.

Bug: 439508098
Test: atest com.android.settings.enterprise.ActionDisabledByAdminDialogTest
Test: atest com.android.settings.accounts.ManagedProfileQuietModeEnablerTest
Change-Id: I3ced6038957dbfa908f6a9b0df866cc7dcfe9ad7
parent 26c97275
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -24,6 +24,10 @@ android_library {
    srcs: ["src/**/*.java"],
    resource_dirs: ["res"],

    static_libs: [
        "device_policy_aconfig_flags_java_export",
    ],

    libs: [
        "androidx.annotation_annotation",
    ],
+5 −2
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.settingslib;

import android.app.admin.DevicePolicyManager;
import android.app.admin.EnforcingAdmin;
import android.app.admin.flags.Flags;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
@@ -128,8 +129,10 @@ public class RestrictedLockUtils {
        if (admin != null) {
            // Although EXTRA_ENFORCING_ADMIN contains all info from other extras, we keep them
            // to provide backward compatibility.
            if (Flags.enforcingAdminExtraEnabled()) {
                intent.putExtra(DevicePolicyManager.EXTRA_ENFORCING_ADMIN, admin);
            if (admin.getComponentName() != null) {
            }
            if (Flags.enforcingAdminGetComponentNameEnabled() && admin.getComponentName() != null) {
                intent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN, admin.getComponentName());
            }
            intent.putExtra(Intent.EXTRA_USER, admin.getUserHandle());