Merge "API polish in DPM for organization color and name methods" into nyc-dev

This commit is contained in:
Michal Karpinski
2016-04-13 13:28:06 +00:00
committed by Android (Google) Code Review
6 changed files with 27 additions and 22 deletions

View File

@@ -5901,7 +5901,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 java.lang.CharSequence getOrganizationName(android.content.ComponentName);
method public android.app.admin.DevicePolicyManager getParentProfileInstance(android.content.ComponentName);
method public long getPasswordExpiration(android.content.ComponentName);
method public long getPasswordExpirationTimeout(android.content.ComponentName);
@@ -5976,7 +5976,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 void setOrganizationName(android.content.ComponentName, java.lang.CharSequence);
method public java.lang.String[] setPackagesSuspended(android.content.ComponentName, java.lang.String[], boolean);
method public void setPasswordExpirationTimeout(android.content.ComponentName, long);
method public void setPasswordHistoryLength(android.content.ComponentName, int);

View File

@@ -6044,7 +6044,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 java.lang.CharSequence getOrganizationName(android.content.ComponentName);
method public android.app.admin.DevicePolicyManager getParentProfileInstance(android.content.ComponentName);
method public long getPasswordExpiration(android.content.ComponentName);
method public long getPasswordExpirationTimeout(android.content.ComponentName);
@@ -6126,7 +6126,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 void setOrganizationName(android.content.ComponentName, java.lang.CharSequence);
method public java.lang.String[] setPackagesSuspended(android.content.ComponentName, java.lang.String[], boolean);
method public void setPasswordExpirationTimeout(android.content.ComponentName, long);
method public void setPasswordHistoryLength(android.content.ComponentName, int);

View File

@@ -5905,7 +5905,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 java.lang.CharSequence getOrganizationName(android.content.ComponentName);
method public android.app.admin.DevicePolicyManager getParentProfileInstance(android.content.ComponentName);
method public long getPasswordExpiration(android.content.ComponentName);
method public long getPasswordExpirationTimeout(android.content.ComponentName);
@@ -5980,7 +5980,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 void setOrganizationName(android.content.ComponentName, java.lang.CharSequence);
method public java.lang.String[] setPackagesSuspended(android.content.ComponentName, java.lang.String[], boolean);
method public void setPasswordExpirationTimeout(android.content.ComponentName, long);
method public void setPasswordHistoryLength(android.content.ComponentName, int);

View File

@@ -6050,11 +6050,13 @@ public class DevicePolicyManager {
* {@link android.app.KeyguardManager#createConfirmDeviceCredentialIntent}.
*
* @param admin Which {@link DeviceAdminReceiver} this request is associated with.
* @param color The 32bit representation of the color to be used.
* @param color The 24bit (0xRRGGBB) representation of the color to be used.
* @throws SecurityException if {@code admin} is not a profile owner.
*/
public void setOrganizationColor(@NonNull ComponentName admin, int color) {
try {
// always enforce alpha channel to have 100% opacity
color |= 0xFF000000;
mService.setOrganizationColor(admin, color);
} catch (RemoteException re) {
throw re.rethrowFromSystemServer();
@@ -6066,7 +6068,7 @@ public class DevicePolicyManager {
*
* Sets the color used for customization.
*
* @param color The 32bit representation of the color to be used.
* @param color The 24bit (0xRRGGBB) representation of the color to be used.
* @param userId which user to set the color to.
* @RequiresPermission(allOf = {
* Manifest.permission.MANAGE_USERS,
@@ -6074,6 +6076,8 @@ public class DevicePolicyManager {
*/
public void setOrganizationColorForUser(@ColorInt int color, @UserIdInt int userId) {
try {
// always enforce alpha channel to have 100% opacity
color |= 0xFF000000;
mService.setOrganizationColorForUser(color, userId);
} catch (RemoteException re) {
throw re.rethrowFromSystemServer();
@@ -6085,10 +6089,10 @@ public class DevicePolicyManager {
* This color is used as background color of the confirm credentials screen for that user.
*
* @param admin Which {@link DeviceAdminReceiver} this request is associated with.
* @return The 32bit representation of the color to be used.
* @return The 24bit (0xRRGGBB) representation of the color to be used.
* @throws SecurityException if {@code admin} is not a profile owner.
*/
public int getOrganizationColor(@NonNull ComponentName admin) {
public @ColorInt int getOrganizationColor(@NonNull ComponentName admin) {
try {
return mService.getOrganizationColor(admin);
} catch (RemoteException re) {
@@ -6101,9 +6105,9 @@ public class DevicePolicyManager {
* Retrieve the customization color for a given user.
*
* @param userHandle The user id of the user we're interested in.
* @return The 32bit representation of the color to be used.
* @return The 24bit (0xRRGGBB) representation of the color to be used.
*/
public int getOrganizationColorForUser(int userHandle) {
public @ColorInt int getOrganizationColorForUser(int userHandle) {
try {
return mService.getOrganizationColorForUser(userHandle);
} catch (RemoteException re) {
@@ -6123,7 +6127,7 @@ public class DevicePolicyManager {
* @param title The organization name or {@code null} to clear a previously set name.
* @throws SecurityException if {@code admin} is not a profile owner.
*/
public void setOrganizationName(@NonNull ComponentName admin, @Nullable String title) {
public void setOrganizationName(@NonNull ComponentName admin, @Nullable CharSequence title) {
try {
mService.setOrganizationName(admin, title);
} catch (RemoteException re) {
@@ -6139,7 +6143,7 @@ public class DevicePolicyManager {
* @return The organization name or {@code null} if none is set.
* @throws SecurityException if {@code admin} is not a profile owner.
*/
public String getOrganizationName(@NonNull ComponentName admin) {
public CharSequence getOrganizationName(@NonNull ComponentName admin) {
try {
return mService.getOrganizationName(admin);
} catch (RemoteException re) {
@@ -6155,7 +6159,7 @@ public class DevicePolicyManager {
*
* @hide
*/
public String getOrganizationNameForUser(int userHandle) {
public CharSequence getOrganizationNameForUser(int userHandle) {
try {
return mService.getOrganizationNameForUser(userHandle);
} catch (RemoteException re) {

View File

@@ -284,9 +284,9 @@ 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);
void setOrganizationName(in ComponentName admin, in CharSequence title);
CharSequence getOrganizationName(in ComponentName admin);
CharSequence getOrganizationNameForUser(int userHandle);
int getUserProvisioningState();
void setUserProvisioningState(int state, int userHandle);

View File

@@ -8660,7 +8660,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
}
@Override
public void setOrganizationName(@NonNull ComponentName who, String text) {
public void setOrganizationName(@NonNull ComponentName who, CharSequence text) {
if (!mHasFeature) {
return;
}
@@ -8671,14 +8671,15 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
ActiveAdmin admin = getActiveAdminForCallerLocked(who,
DeviceAdminInfo.USES_POLICY_PROFILE_OWNER);
if (!TextUtils.equals(admin.organizationName, text)) {
admin.organizationName = TextUtils.nullIfEmpty(text);
admin.organizationName = (text == null || text.length() == 0)
? null : text.toString();
saveSettingsLocked(userHandle);
}
}
}
@Override
public String getOrganizationName(@NonNull ComponentName who) {
public CharSequence getOrganizationName(@NonNull ComponentName who) {
if (!mHasFeature) {
return null;
}
@@ -8692,7 +8693,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
}
@Override
public String getOrganizationNameForUser(int userHandle) {
public CharSequence getOrganizationNameForUser(int userHandle) {
if (!mHasFeature) {
return null;
}