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

Commit dd231a16 authored by Benjamin Franz's avatar Benjamin Franz Committed by Android (Google) Code Review
Browse files

Merge "Add policy to set the organization name"

parents cab2e5d1 3e8a7090
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -5824,6 +5824,7 @@ package android.app.admin {
    method public int getMaximumFailedPasswordsForWipe(android.content.ComponentName);
    method public long getMaximumTimeToLock(android.content.ComponentName);
    method public int getOrganizationColor(android.content.ComponentName);
    method public java.lang.String getOrganizationName(android.content.ComponentName);
    method public boolean getPackageSuspended(android.content.ComponentName, java.lang.String);
    method public android.app.admin.DevicePolicyManager getParentProfileInstance(android.content.ComponentName);
    method public long getPasswordExpiration(android.content.ComponentName);
@@ -5893,6 +5894,7 @@ package android.app.admin {
    method public void setMaximumFailedPasswordsForWipe(android.content.ComponentName, int);
    method public void setMaximumTimeToLock(android.content.ComponentName, long);
    method public void setOrganizationColor(android.content.ComponentName, int);
    method public void setOrganizationName(android.content.ComponentName, java.lang.String);
    method public boolean setPackageSuspended(android.content.ComponentName, java.lang.String, boolean);
    method public void setPasswordExpirationTimeout(android.content.ComponentName, long);
    method public void setPasswordHistoryLength(android.content.ComponentName, int);
+2 −0
Original line number Diff line number Diff line
@@ -5964,6 +5964,7 @@ package android.app.admin {
    method public int getMaximumFailedPasswordsForWipe(android.content.ComponentName);
    method public long getMaximumTimeToLock(android.content.ComponentName);
    method public int getOrganizationColor(android.content.ComponentName);
    method public java.lang.String getOrganizationName(android.content.ComponentName);
    method public boolean getPackageSuspended(android.content.ComponentName, java.lang.String);
    method public android.app.admin.DevicePolicyManager getParentProfileInstance(android.content.ComponentName);
    method public long getPasswordExpiration(android.content.ComponentName);
@@ -6039,6 +6040,7 @@ package android.app.admin {
    method public void setMaximumFailedPasswordsForWipe(android.content.ComponentName, int);
    method public void setMaximumTimeToLock(android.content.ComponentName, long);
    method public void setOrganizationColor(android.content.ComponentName, int);
    method public void setOrganizationName(android.content.ComponentName, java.lang.String);
    method public boolean setPackageSuspended(android.content.ComponentName, java.lang.String, boolean);
    method public void setPasswordExpirationTimeout(android.content.ComponentName, long);
    method public void setPasswordHistoryLength(android.content.ComponentName, int);
+2 −0
Original line number Diff line number Diff line
@@ -5826,6 +5826,7 @@ package android.app.admin {
    method public int getMaximumFailedPasswordsForWipe(android.content.ComponentName);
    method public long getMaximumTimeToLock(android.content.ComponentName);
    method public int getOrganizationColor(android.content.ComponentName);
    method public java.lang.String getOrganizationName(android.content.ComponentName);
    method public boolean getPackageSuspended(android.content.ComponentName, java.lang.String);
    method public android.app.admin.DevicePolicyManager getParentProfileInstance(android.content.ComponentName);
    method public long getPasswordExpiration(android.content.ComponentName);
@@ -5895,6 +5896,7 @@ package android.app.admin {
    method public void setMaximumFailedPasswordsForWipe(android.content.ComponentName, int);
    method public void setMaximumTimeToLock(android.content.ComponentName, long);
    method public void setOrganizationColor(android.content.ComponentName, int);
    method public void setOrganizationName(android.content.ComponentName, java.lang.String);
    method public boolean setPackageSuspended(android.content.ComponentName, java.lang.String, boolean);
    method public void setPasswordExpirationTimeout(android.content.ComponentName, long);
    method public void setPasswordHistoryLength(android.content.ComponentName, int);
+64 −0
Original line number Diff line number Diff line
@@ -3346,6 +3346,10 @@ public class DevicePolicyManager {
     * <p>If the device owner information contains only whitespaces then the message on the lock
     * screen will be blank and the user will not be allowed to change it.
     *
     * <p>If the device owner information needs to be localized, it is the responsibility of the
     * {@link DeviceAdminReceiver} to listen to the {@link Intent#ACTION_LOCALE_CHANGED} broadcast
     * and set a new version of this string accordingly.
     *
     * @param admin The name of the admin component to check.
     * @param info Device owner information which will be displayed instead of the user
     * owner info.
@@ -5211,6 +5215,10 @@ public class DevicePolicyManager {
     *  for support."
     * If the message is longer than 200 characters it may be truncated.
     *
     * <p>If the short support message needs to be localized, it is the responsibility of the
     * {@link DeviceAdminReceiver} to listen to the {@link Intent#ACTION_LOCALE_CHANGED} broadcast
     * and set a new version of this string accordingly.
     *
     * @see #setLongSupportMessage
     *
     * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
@@ -5250,6 +5258,10 @@ public class DevicePolicyManager {
     * Called by a device admin to set the long support message. This will
     * be displayed to the user in the device administators settings screen.
     *
     * <p>If the long support message needs to be localized, it is the responsibility of the
     * {@link DeviceAdminReceiver} to listen to the {@link Intent#ACTION_LOCALE_CHANGED} broadcast
     * and set a new version of this string accordingly.
     *
     * @see #setShortSupportMessage
     *
     * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
@@ -5413,6 +5425,58 @@ public class DevicePolicyManager {
        }
    }

    /**
     * Called by a profile owner of a managed profile to set the name of the organization under
     * management.
     *
     * <p>If the organization name needs to be localized, it is the responsibility of the
     * {@link DeviceAdminReceiver} to listen to the {@link Intent#ACTION_LOCALE_CHANGED} broadcast
     * and set a new version of this string accordingly.
     *
     * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
     * @param title The organization name or {@code null} to clear a previously set name.
     */
    public void setOrganizationName(@NonNull ComponentName admin, @Nullable String title) {
        try {
            mService.setOrganizationName(admin, title);
        } catch (RemoteException re) {
            Log.w(TAG, REMOTE_EXCEPTION_MESSAGE);
        }
    }

    /**
     * Called by a profile owner of a managed profile to retrieve the name of the organization
     * under management.
     *
     * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
     * @return The organization name or {@code null} if none is set.
     */
    public String getOrganizationName(@NonNull ComponentName admin) {
        try {
            return mService.getOrganizationName(admin);
        } catch (RemoteException re) {
            Log.w(TAG, REMOTE_EXCEPTION_MESSAGE);
            return null;
        }
    }

    /**
     * Retrieve the default title message used in the confirm credentials screen for a given user.
     *
     * @param userHandle The user id of the user we're interested in.
     * @return The organization name or {@code null} if none is set.
     *
     * @hide
     */
    public String getOrganizationNameForUser(int userHandle) {
        try {
            return mService.getOrganizationNameForUser(userHandle);
        } catch (RemoteException re) {
            Log.w(TAG, REMOTE_EXCEPTION_MESSAGE);
            return null;
        }
    }

    /**
     * @return the {@link UserProvisioningState} for the current user - for unmanaged users will
     *         return {@link #STATE_USER_UNMANAGED}
+4 −0
Original line number Diff line number Diff line
@@ -276,6 +276,10 @@ interface IDevicePolicyManager {
    int getOrganizationColor(in ComponentName admin);
    int getOrganizationColorForUser(int userHandle);

    void setOrganizationName(in ComponentName admin, in String title);
    String getOrganizationName(in ComponentName admin);
    String getOrganizationNameForUser(int userHandle);

    int getUserProvisioningState();
    void setUserProvisioningState(int state, int userHandle);

Loading