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

Commit c754dffe authored by Victor Chang's avatar Victor Chang Committed by Android (Google) Code Review
Browse files

Merge "Create a new device policy for controlling work contacts search"

parents 0ec43124 1060c618
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -5793,6 +5793,7 @@ package android.app.admin {
    method public boolean getCameraDisabled(android.content.ComponentName);
    method public java.lang.String getCertInstallerPackage(android.content.ComponentName) throws java.lang.SecurityException;
    method public boolean getCrossProfileCallerIdDisabled(android.content.ComponentName);
    method public boolean getCrossProfileContactsSearchDisabled(android.content.ComponentName);
    method public java.util.List<java.lang.String> getCrossProfileWidgetProviders(android.content.ComponentName);
    method public int getCurrentFailedPasswordAttempts();
    method public java.lang.String getDeviceOwnerLockScreenInfo();
@@ -5857,6 +5858,7 @@ package android.app.admin {
    method public void setCameraDisabled(android.content.ComponentName, boolean);
    method public void setCertInstallerPackage(android.content.ComponentName, java.lang.String) throws java.lang.SecurityException;
    method public void setCrossProfileCallerIdDisabled(android.content.ComponentName, boolean);
    method public void setCrossProfileContactsSearchDisabled(android.content.ComponentName, boolean);
    method public boolean setDeviceOwnerLockScreenInfo(android.content.ComponentName, java.lang.String);
    method public void setGlobalSetting(android.content.ComponentName, java.lang.String, java.lang.String);
    method public boolean setKeyguardDisabled(android.content.ComponentName, boolean);
+2 −0
Original line number Diff line number Diff line
@@ -5919,6 +5919,7 @@ package android.app.admin {
    method public boolean getCameraDisabled(android.content.ComponentName);
    method public java.lang.String getCertInstallerPackage(android.content.ComponentName) throws java.lang.SecurityException;
    method public boolean getCrossProfileCallerIdDisabled(android.content.ComponentName);
    method public boolean getCrossProfileContactsSearchDisabled(android.content.ComponentName);
    method public java.util.List<java.lang.String> getCrossProfileWidgetProviders(android.content.ComponentName);
    method public int getCurrentFailedPasswordAttempts();
    method public deprecated java.lang.String getDeviceInitializerApp();
@@ -5992,6 +5993,7 @@ package android.app.admin {
    method public void setCameraDisabled(android.content.ComponentName, boolean);
    method public void setCertInstallerPackage(android.content.ComponentName, java.lang.String) throws java.lang.SecurityException;
    method public void setCrossProfileCallerIdDisabled(android.content.ComponentName, boolean);
    method public void setCrossProfileContactsSearchDisabled(android.content.ComponentName, boolean);
    method public boolean setDeviceOwnerLockScreenInfo(android.content.ComponentName, java.lang.String);
    method public void setGlobalSetting(android.content.ComponentName, java.lang.String, java.lang.String);
    method public boolean setKeyguardDisabled(android.content.ComponentName, boolean);
+2 −0
Original line number Diff line number Diff line
@@ -5795,6 +5795,7 @@ package android.app.admin {
    method public boolean getCameraDisabled(android.content.ComponentName);
    method public java.lang.String getCertInstallerPackage(android.content.ComponentName) throws java.lang.SecurityException;
    method public boolean getCrossProfileCallerIdDisabled(android.content.ComponentName);
    method public boolean getCrossProfileContactsSearchDisabled(android.content.ComponentName);
    method public java.util.List<java.lang.String> getCrossProfileWidgetProviders(android.content.ComponentName);
    method public int getCurrentFailedPasswordAttempts();
    method public java.lang.String getDeviceOwnerLockScreenInfo();
@@ -5859,6 +5860,7 @@ package android.app.admin {
    method public void setCameraDisabled(android.content.ComponentName, boolean);
    method public void setCertInstallerPackage(android.content.ComponentName, java.lang.String) throws java.lang.SecurityException;
    method public void setCrossProfileCallerIdDisabled(android.content.ComponentName, boolean);
    method public void setCrossProfileContactsSearchDisabled(android.content.ComponentName, boolean);
    method public boolean setDeviceOwnerLockScreenInfo(android.content.ComponentName, java.lang.String);
    method public void setGlobalSetting(android.content.ComponentName, java.lang.String, java.lang.String);
    method public boolean setKeyguardDisabled(android.content.ComponentName, boolean);
+60 −0
Original line number Diff line number Diff line
@@ -3539,6 +3539,66 @@ public class DevicePolicyManager {
        return false;
    }

    /**
     * Called by a profile owner of a managed profile to set whether contacts search from
     * the managed profile will be shown in the parent profile, for incoming calls.
     *
     * <p>The calling device admin must be a profile owner. If it is not, a
     * security exception will be thrown.
     *
     * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
     * @param disabled If true contacts search in the managed profile is not displayed.
     */
    public void setCrossProfileContactsSearchDisabled(@NonNull ComponentName admin,
            boolean disabled) {
        if (mService != null) {
            try {
                mService.setCrossProfileContactsSearchDisabled(admin, disabled);
            } catch (RemoteException e) {
                Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e);
            }
        }
    }

    /**
     * Called by a profile owner of a managed profile to determine whether or not contacts search
     * has been disabled.
     *
     * <p>The calling device admin must be a profile owner. If it is not, a
     * security exception will be thrown.
     *
     * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
     */
    public boolean getCrossProfileContactsSearchDisabled(@NonNull ComponentName admin) {
        if (mService != null) {
            try {
                return mService.getCrossProfileContactsSearchDisabled(admin);
            } catch (RemoteException e) {
                Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e);
            }
        }
        return false;
    }


    /**
     * Determine whether or not contacts search has been disabled.
     *
     * @param userHandle The user for whom to check the contacts search permission
     * @hide
     */
    public boolean getCrossProfileContactsSearchDisabled(@NonNull UserHandle userHandle) {
        if (mService != null) {
            try {
                return mService
                        .getCrossProfileContactsSearchDisabledForUser(userHandle.getIdentifier());
            } catch (RemoteException e) {
                Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e);
            }
        }
        return false;
    }

    /**
     * Start Quick Contact on the managed profile for the user, if the policy allows.
     * @hide
+3 −0
Original line number Diff line number Diff line
@@ -202,6 +202,9 @@ interface IDevicePolicyManager {
    void setCrossProfileCallerIdDisabled(in ComponentName who, boolean disabled);
    boolean getCrossProfileCallerIdDisabled(in ComponentName who);
    boolean getCrossProfileCallerIdDisabledForUser(int userId);
    void setCrossProfileContactsSearchDisabled(in ComponentName who, boolean disabled);
    boolean getCrossProfileContactsSearchDisabled(in ComponentName who);
    boolean getCrossProfileContactsSearchDisabledForUser(int userId);
    void startManagedQuickContact(String lookupKey, long contactId, long directoryId, in Intent originalIntent);

    void setBluetoothContactSharingDisabled(in ComponentName who, boolean disabled);
Loading