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

Commit 57dacb7e authored by Sander Alewijnse's avatar Sander Alewijnse Committed by Android (Google) Code Review
Browse files

Merge "Group account management methods and add some comments."

parents 92c6d71d 650c3341
Loading
Loading
Loading
Loading
+24 −21
Original line number Diff line number Diff line
@@ -2068,46 +2068,49 @@ public class DevicePolicyManager {
    }

    /**
     * Called by a profile owner to disable account management for a specific type of account.
     *
     * <p>The calling device admin must be a profile owner. If it is not, a
     * security exception will be thrown.
     * Called by profile or device owner to re-enable system apps by intent that were disabled
     * by default when the managed profile was created. This should only be called from a profile
     * or device owner running within a managed profile.
     *
     * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
     * @param accountType For which account management is disabled or enabled.
     * @param disabled The boolean indicating that account management will be disabled (true) or
     * enabled (false).
     * @param intent An intent matching the app(s) to be installed. All apps that resolve for this
     *               intent will be re-enabled in the current profile.
     * @return int The number of activities that matched the intent and were installed.
     */
    public void setAccountManagementDisabled(ComponentName admin, String accountType,
            boolean disabled) {
    public int enableSystemApp(ComponentName admin, Intent intent) {
        if (mService != null) {
            try {
                mService.setAccountManagementDisabled(admin, accountType, disabled);
                return mService.enableSystemAppWithIntent(admin, intent);
            } catch (RemoteException e) {
                Log.w(TAG, "Failed talking with device policy service", e);
                Log.w(TAG, "Failed to install packages matching filter: " + intent);
            }
        }
        return 0;
    }

    /**
     * Called by profile or device owner to re-enable system apps by intent that were disabled
     * by default when the managed profile was created. This should only be called from a profile
     * or device owner running within a managed profile.
     * Called by a profile owner to disable account management for a specific type of account.
     *
     * <p>The calling device admin must be a profile owner. If it is not, a
     * security exception will be thrown.
     *
     * <p>When account management is disabled for an account type, adding or removing an account
     * of that type will not be possible.
     *
     * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
     * @param intent An intent matching the app(s) to be installed. All apps that resolve for this
     *               intent will be re-enabled in the current profile.
     * @return int The number of activities that matched the intent and were installed.
     * @param accountType For which account management is disabled or enabled.
     * @param disabled The boolean indicating that account management will be disabled (true) or
     * enabled (false).
     */
    public int enableSystemApp(ComponentName admin, Intent intent) {
    public void setAccountManagementDisabled(ComponentName admin, String accountType,
            boolean disabled) {
        if (mService != null) {
            try {
                return mService.enableSystemAppWithIntent(admin, intent);
                mService.setAccountManagementDisabled(admin, accountType, disabled);
            } catch (RemoteException e) {
                Log.w(TAG, "Failed to install packages matching filter: " + intent);
                Log.w(TAG, "Failed talking with device policy service", e);
            }
        }
        return 0;
    }

    /**