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

Commit 6d2beef6 authored by Makoto Onuki's avatar Makoto Onuki Committed by Android (Google) Code Review
Browse files

Merge "Add DPM.getUserRestrictions()"

parents 86cd001e 3a3092fa
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -5730,6 +5730,7 @@ package android.app.admin {
    method public int getStorageEncryptionStatus();
    method public android.app.admin.SystemUpdatePolicy getSystemUpdatePolicy();
    method public java.util.List<android.os.PersistableBundle> getTrustAgentConfiguration(android.content.ComponentName, android.content.ComponentName);
    method public android.os.Bundle getUserRestrictions(android.content.ComponentName);
    method public boolean hasCaCertInstalled(android.content.ComponentName, byte[]);
    method public boolean hasGrantedPolicy(android.content.ComponentName, int);
    method public boolean installCaCert(android.content.ComponentName, byte[]);
+1 −0
Original line number Diff line number Diff line
@@ -5860,6 +5860,7 @@ package android.app.admin {
    method public int getStorageEncryptionStatus();
    method public android.app.admin.SystemUpdatePolicy getSystemUpdatePolicy();
    method public java.util.List<android.os.PersistableBundle> getTrustAgentConfiguration(android.content.ComponentName, android.content.ComponentName);
    method public android.os.Bundle getUserRestrictions(android.content.ComponentName);
    method public boolean hasCaCertInstalled(android.content.ComponentName, byte[]);
    method public boolean hasGrantedPolicy(android.content.ComponentName, int);
    method public boolean installCaCert(android.content.ComponentName, byte[]);
+22 −0
Original line number Diff line number Diff line
@@ -3636,6 +3636,28 @@ public class DevicePolicyManager {
        }
    }

    /**
     * Called by a profile or device owner to get user restrictions set with
     * {@link #addUserRestriction(ComponentName, String)}.
     * <p>
     * The target user may have more restrictions set by the system or other device owner / profile
     * owner.  To get all the user restrictions currently set, use
     * {@link UserManager#getUserRestrictions()}.
     *
     * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
     */
    public Bundle getUserRestrictions(@NonNull ComponentName admin) {
        Bundle ret = null;
        if (mService != null) {
            try {
                ret = mService.getUserRestrictions(admin);
            } catch (RemoteException e) {
                Log.w(TAG, "Failed talking with device policy service", e);
            }
        }
        return ret == null ? new Bundle() : ret;
    }

    /**
     * Called by profile or device owners to hide or unhide packages. When a package is hidden it
     * is unavailable for use, but the data and actual package file remain.
+1 −0
Original line number Diff line number Diff line
@@ -147,6 +147,7 @@ interface IDevicePolicyManager {
    ComponentName getRestrictionsProvider(int userHandle);

    void setUserRestriction(in ComponentName who, in String key, boolean enable);
    Bundle getUserRestrictions(in ComponentName who);
    void addCrossProfileIntentFilter(in ComponentName admin, in IntentFilter filter, int flags);
    void clearCrossProfileIntentFilters(in ComponentName admin);

+10 −0
Original line number Diff line number Diff line
@@ -5644,6 +5644,16 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
        }
    }

    @Override
    public Bundle getUserRestrictions(ComponentName who) {
        Preconditions.checkNotNull(who, "ComponentName is null");
        synchronized (this) {
            final ActiveAdmin activeAdmin =
                    getActiveAdminForCallerLocked(who, DeviceAdminInfo.USES_POLICY_PROFILE_OWNER);
            return activeAdmin.userRestrictions;
        }
    }

    @Override
    public boolean setApplicationHidden(ComponentName who, String packageName,
            boolean hidden) {
Loading