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

Commit d5926266 authored by Nicolas Prévot's avatar Nicolas Prévot Committed by Android (Google) Code Review
Browse files

Merge "Add method to tell the dpc if provisioning is allowed."

parents 0c084183 07387fed
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -5742,6 +5742,7 @@ package android.app.admin {
    method public boolean isLockTaskPermitted(java.lang.String);
    method public boolean isMasterVolumeMuted(android.content.ComponentName);
    method public boolean isProfileOwnerApp(java.lang.String);
    method public boolean isProvisioningAllowed(java.lang.String);
    method public boolean isUninstallBlocked(android.content.ComponentName, java.lang.String);
    method public void lockNow();
    method public void removeActiveAdmin(android.content.ComponentName);
+1 −0
Original line number Diff line number Diff line
@@ -5872,6 +5872,7 @@ package android.app.admin {
    method public boolean isLockTaskPermitted(java.lang.String);
    method public boolean isMasterVolumeMuted(android.content.ComponentName);
    method public boolean isProfileOwnerApp(java.lang.String);
    method public boolean isProvisioningAllowed(java.lang.String);
    method public boolean isUninstallBlocked(android.content.ComponentName, java.lang.String);
    method public void lockNow();
    method public void notifyPendingSystemUpdate(long);
+19 −0
Original line number Diff line number Diff line
@@ -4321,4 +4321,23 @@ public class DevicePolicyManager {
            return PERMISSION_GRANT_STATE_DEFAULT;
        }
    }

    /**
     * Returns if provisioning a managed profile or device is possible or not.
     * @param action One of {@link #ACTION_PROVISION_MANAGED_DEVICE},
     * {@link #ACTION_PROVISION_MANAGED_PROFILE}.
     * Note that even if this method returns true, there is a slight possibility that the
     * provisioning will not be allowed when it is actually initiated because some event has
     * happened in between.
     * @return if provisioning a managed profile or device is possible or not.
     * @throws IllegalArgumentException if the supplied action is not valid.
     */
    public boolean isProvisioningAllowed(String action) {
        try {
            return mService.isProvisioningAllowed(action);
        } catch (RemoteException re) {
            Log.w(TAG, "Failed talking with device policy service", re);
            return false;
        }
    }
}
+1 −0
Original line number Diff line number Diff line
@@ -228,4 +228,5 @@ interface IDevicePolicyManager {
    boolean setPermissionGrantState(in ComponentName admin, String packageName,
            String permission, int grantState);
    int getPermissionGrantState(in ComponentName admin, String packageName, String permission);
    boolean isProvisioningAllowed(String action);
}
+1 −1
Original line number Diff line number Diff line
@@ -44,7 +44,7 @@ interface IUserManager {
    UserInfo getPrimaryUser();
    List<UserInfo> getUsers(boolean excludeDying);
    List<UserInfo> getProfiles(int userHandle, boolean enabledOnly);
    boolean canAddMoreManagedProfiles(int userId);
    boolean canAddMoreManagedProfiles(int userId, boolean allowedToRemoveOne);
    UserInfo getProfileParent(int userHandle);
    boolean isSameProfileGroup(int userId, int otherUserId);
    UserInfo getUserInfo(int userHandle);
Loading