DPC can be uninstalled in personal profile in New COPE

* For an organization-owned device, the DPC should be able to
  be uninstalled in the personal profile. Previously, the
  observed behaviour was that the uninstall button in the App
  Info Screen was being greyed out.
* This was because the previous logic did not allow for
  uninstalling any app which has a profile owner or device
  owner on *any* user.
* This CL updates this logic, such that, for non-system apps
  uninstalling is blocked only if the app has a profile owner
  or device owner for the current calling user.

Bug: 149381804
Test: Manual testing
      atest com.android.settings.applications.appinfo.AppButtonsPreferenceControllerTest
Change-Id: Ifaf03daa41724dbbd869c7e1371a77cc39d15ac7
diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java
index 315cba1..e8eb8ba 100644
--- a/src/com/android/settings/Utils.java
+++ b/src/com/android/settings/Utils.java
@@ -888,6 +888,27 @@
     }
 
     /**
+     * Return {@code true} if the supplied package is the device owner or profile owner of a
+     * given user.
+     *
+     * @param devicePolicyManager used to check whether it is device owner and profile owner app
+     * @param packageName         package to check about
+     * @param userId              the if of the relevant user
+     */
+    public static boolean isProfileOrDeviceOwner(DevicePolicyManager devicePolicyManager,
+            String packageName, int userId) {
+        if ((devicePolicyManager.getDeviceOwnerUserId() == userId)
+                && devicePolicyManager.isDeviceOwnerApp(packageName)) {
+            return true;
+        }
+        final ComponentName cn = devicePolicyManager.getProfileOwnerAsUser(userId);
+        if (cn != null && cn.getPackageName().equals(packageName)) {
+            return true;
+        }
+        return false;
+    }
+
+    /**
      * Return the resource id to represent the install status for an app
      */
     @StringRes