Merge "Add additional APIs supported work on the parent DPM instance"

This commit is contained in:
Esteban Talavera
2016-01-25 15:19:06 +00:00
committed by Android (Google) Code Review
4 changed files with 605 additions and 543 deletions

View File

@ -89,22 +89,25 @@ public class DevicePolicyManager {
private final Context mContext; private final Context mContext;
private final IDevicePolicyManager mService; private final IDevicePolicyManager mService;
private boolean mParentInstance; private final boolean mParentInstance;
private static final String REMOTE_EXCEPTION_MESSAGE = private static final String REMOTE_EXCEPTION_MESSAGE =
"Failed to talk with device policy manager service"; "Failed to talk with device policy manager service";
private DevicePolicyManager(Context context, boolean parentInstance) { private DevicePolicyManager(Context context, boolean parentInstance) {
this(context, IDevicePolicyManager.Stub.asInterface( this(context,
ServiceManager.getService(Context.DEVICE_POLICY_SERVICE))); IDevicePolicyManager.Stub.asInterface(
mParentInstance = parentInstance; ServiceManager.getService(Context.DEVICE_POLICY_SERVICE)),
parentInstance);
} }
/** @hide */ /** @hide */
@VisibleForTesting @VisibleForTesting
protected DevicePolicyManager(Context context, IDevicePolicyManager service) { protected DevicePolicyManager(
Context context, IDevicePolicyManager service, boolean parentInstance) {
mContext = context; mContext = context;
mService = service; mService = service;
mParentInstance = parentInstance;
} }
/** @hide */ /** @hide */
@ -1146,7 +1149,7 @@ public class DevicePolicyManager {
public void setPasswordMinimumLength(@NonNull ComponentName admin, int length) { public void setPasswordMinimumLength(@NonNull ComponentName admin, int length) {
if (mService != null) { if (mService != null) {
try { try {
mService.setPasswordMinimumLength(admin, length); mService.setPasswordMinimumLength(admin, length, mParentInstance);
} catch (RemoteException e) { } catch (RemoteException e) {
Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e); Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e);
} }
@ -1167,7 +1170,7 @@ public class DevicePolicyManager {
public int getPasswordMinimumLength(@Nullable ComponentName admin, int userHandle) { public int getPasswordMinimumLength(@Nullable ComponentName admin, int userHandle) {
if (mService != null) { if (mService != null) {
try { try {
return mService.getPasswordMinimumLength(admin, userHandle); return mService.getPasswordMinimumLength(admin, userHandle, mParentInstance);
} catch (RemoteException e) { } catch (RemoteException e) {
Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e); Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e);
} }
@ -1200,7 +1203,7 @@ public class DevicePolicyManager {
public void setPasswordMinimumUpperCase(@NonNull ComponentName admin, int length) { public void setPasswordMinimumUpperCase(@NonNull ComponentName admin, int length) {
if (mService != null) { if (mService != null) {
try { try {
mService.setPasswordMinimumUpperCase(admin, length); mService.setPasswordMinimumUpperCase(admin, length, mParentInstance);
} catch (RemoteException e) { } catch (RemoteException e) {
Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e); Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e);
} }
@ -1228,7 +1231,7 @@ public class DevicePolicyManager {
public int getPasswordMinimumUpperCase(@Nullable ComponentName admin, int userHandle) { public int getPasswordMinimumUpperCase(@Nullable ComponentName admin, int userHandle) {
if (mService != null) { if (mService != null) {
try { try {
return mService.getPasswordMinimumUpperCase(admin, userHandle); return mService.getPasswordMinimumUpperCase(admin, userHandle, mParentInstance);
} catch (RemoteException e) { } catch (RemoteException e) {
Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e); Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e);
} }
@ -1261,7 +1264,7 @@ public class DevicePolicyManager {
public void setPasswordMinimumLowerCase(@NonNull ComponentName admin, int length) { public void setPasswordMinimumLowerCase(@NonNull ComponentName admin, int length) {
if (mService != null) { if (mService != null) {
try { try {
mService.setPasswordMinimumLowerCase(admin, length); mService.setPasswordMinimumLowerCase(admin, length, mParentInstance);
} catch (RemoteException e) { } catch (RemoteException e) {
Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e); Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e);
} }
@ -1289,7 +1292,7 @@ public class DevicePolicyManager {
public int getPasswordMinimumLowerCase(@Nullable ComponentName admin, int userHandle) { public int getPasswordMinimumLowerCase(@Nullable ComponentName admin, int userHandle) {
if (mService != null) { if (mService != null) {
try { try {
return mService.getPasswordMinimumLowerCase(admin, userHandle); return mService.getPasswordMinimumLowerCase(admin, userHandle, mParentInstance);
} catch (RemoteException e) { } catch (RemoteException e) {
Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e); Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e);
} }
@ -1321,7 +1324,7 @@ public class DevicePolicyManager {
public void setPasswordMinimumLetters(@NonNull ComponentName admin, int length) { public void setPasswordMinimumLetters(@NonNull ComponentName admin, int length) {
if (mService != null) { if (mService != null) {
try { try {
mService.setPasswordMinimumLetters(admin, length); mService.setPasswordMinimumLetters(admin, length, mParentInstance);
} catch (RemoteException e) { } catch (RemoteException e) {
Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e); Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e);
} }
@ -1347,7 +1350,7 @@ public class DevicePolicyManager {
public int getPasswordMinimumLetters(@Nullable ComponentName admin, int userHandle) { public int getPasswordMinimumLetters(@Nullable ComponentName admin, int userHandle) {
if (mService != null) { if (mService != null) {
try { try {
return mService.getPasswordMinimumLetters(admin, userHandle); return mService.getPasswordMinimumLetters(admin, userHandle, mParentInstance);
} catch (RemoteException e) { } catch (RemoteException e) {
Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e); Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e);
} }
@ -1379,7 +1382,7 @@ public class DevicePolicyManager {
public void setPasswordMinimumNumeric(@NonNull ComponentName admin, int length) { public void setPasswordMinimumNumeric(@NonNull ComponentName admin, int length) {
if (mService != null) { if (mService != null) {
try { try {
mService.setPasswordMinimumNumeric(admin, length); mService.setPasswordMinimumNumeric(admin, length, mParentInstance);
} catch (RemoteException e) { } catch (RemoteException e) {
Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e); Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e);
} }
@ -1406,7 +1409,7 @@ public class DevicePolicyManager {
public int getPasswordMinimumNumeric(@Nullable ComponentName admin, int userHandle) { public int getPasswordMinimumNumeric(@Nullable ComponentName admin, int userHandle) {
if (mService != null) { if (mService != null) {
try { try {
return mService.getPasswordMinimumNumeric(admin, userHandle); return mService.getPasswordMinimumNumeric(admin, userHandle, mParentInstance);
} catch (RemoteException e) { } catch (RemoteException e) {
Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e); Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e);
} }
@ -1438,7 +1441,7 @@ public class DevicePolicyManager {
public void setPasswordMinimumSymbols(@NonNull ComponentName admin, int length) { public void setPasswordMinimumSymbols(@NonNull ComponentName admin, int length) {
if (mService != null) { if (mService != null) {
try { try {
mService.setPasswordMinimumSymbols(admin, length); mService.setPasswordMinimumSymbols(admin, length, mParentInstance);
} catch (RemoteException e) { } catch (RemoteException e) {
Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e); Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e);
} }
@ -1464,7 +1467,7 @@ public class DevicePolicyManager {
public int getPasswordMinimumSymbols(@Nullable ComponentName admin, int userHandle) { public int getPasswordMinimumSymbols(@Nullable ComponentName admin, int userHandle) {
if (mService != null) { if (mService != null) {
try { try {
return mService.getPasswordMinimumSymbols(admin, userHandle); return mService.getPasswordMinimumSymbols(admin, userHandle, mParentInstance);
} catch (RemoteException e) { } catch (RemoteException e) {
Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e); Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e);
} }
@ -1496,7 +1499,7 @@ public class DevicePolicyManager {
public void setPasswordMinimumNonLetter(@NonNull ComponentName admin, int length) { public void setPasswordMinimumNonLetter(@NonNull ComponentName admin, int length) {
if (mService != null) { if (mService != null) {
try { try {
mService.setPasswordMinimumNonLetter(admin, length); mService.setPasswordMinimumNonLetter(admin, length, mParentInstance);
} catch (RemoteException e) { } catch (RemoteException e) {
Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e); Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e);
} }
@ -1523,7 +1526,7 @@ public class DevicePolicyManager {
public int getPasswordMinimumNonLetter(@Nullable ComponentName admin, int userHandle) { public int getPasswordMinimumNonLetter(@Nullable ComponentName admin, int userHandle) {
if (mService != null) { if (mService != null) {
try { try {
return mService.getPasswordMinimumNonLetter(admin, userHandle); return mService.getPasswordMinimumNonLetter(admin, userHandle, mParentInstance);
} catch (RemoteException e) { } catch (RemoteException e) {
Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e); Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e);
} }
@ -1556,7 +1559,7 @@ public class DevicePolicyManager {
public void setPasswordHistoryLength(@NonNull ComponentName admin, int length) { public void setPasswordHistoryLength(@NonNull ComponentName admin, int length) {
if (mService != null) { if (mService != null) {
try { try {
mService.setPasswordHistoryLength(admin, length); mService.setPasswordHistoryLength(admin, length, mParentInstance);
} catch (RemoteException e) { } catch (RemoteException e) {
Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e); Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e);
} }
@ -1588,7 +1591,7 @@ public class DevicePolicyManager {
public void setPasswordExpirationTimeout(@NonNull ComponentName admin, long timeout) { public void setPasswordExpirationTimeout(@NonNull ComponentName admin, long timeout) {
if (mService != null) { if (mService != null) {
try { try {
mService.setPasswordExpirationTimeout(admin, timeout); mService.setPasswordExpirationTimeout(admin, timeout, mParentInstance);
} catch (RemoteException e) { } catch (RemoteException e) {
Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e); Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e);
} }
@ -1607,7 +1610,7 @@ public class DevicePolicyManager {
public long getPasswordExpirationTimeout(@Nullable ComponentName admin) { public long getPasswordExpirationTimeout(@Nullable ComponentName admin) {
if (mService != null) { if (mService != null) {
try { try {
return mService.getPasswordExpirationTimeout(admin, myUserId()); return mService.getPasswordExpirationTimeout(admin, myUserId(), mParentInstance);
} catch (RemoteException e) { } catch (RemoteException e) {
Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e); Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e);
} }
@ -1628,7 +1631,7 @@ public class DevicePolicyManager {
public long getPasswordExpiration(@Nullable ComponentName admin) { public long getPasswordExpiration(@Nullable ComponentName admin) {
if (mService != null) { if (mService != null) {
try { try {
return mService.getPasswordExpiration(admin, myUserId()); return mService.getPasswordExpiration(admin, myUserId(), mParentInstance);
} catch (RemoteException e) { } catch (RemoteException e) {
Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e); Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e);
} }
@ -1651,7 +1654,7 @@ public class DevicePolicyManager {
public int getPasswordHistoryLength(@Nullable ComponentName admin, int userHandle) { public int getPasswordHistoryLength(@Nullable ComponentName admin, int userHandle) {
if (mService != null) { if (mService != null) {
try { try {
return mService.getPasswordHistoryLength(admin, userHandle); return mService.getPasswordHistoryLength(admin, userHandle, mParentInstance);
} catch (RemoteException e) { } catch (RemoteException e) {
Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e); Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e);
} }
@ -1703,7 +1706,7 @@ public class DevicePolicyManager {
public int getCurrentFailedPasswordAttempts() { public int getCurrentFailedPasswordAttempts() {
if (mService != null) { if (mService != null) {
try { try {
return mService.getCurrentFailedPasswordAttempts(myUserId()); return mService.getCurrentFailedPasswordAttempts(myUserId(), mParentInstance);
} catch (RemoteException e) { } catch (RemoteException e) {
Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e); Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e);
} }
@ -1750,7 +1753,7 @@ public class DevicePolicyManager {
public void setMaximumFailedPasswordsForWipe(@NonNull ComponentName admin, int num) { public void setMaximumFailedPasswordsForWipe(@NonNull ComponentName admin, int num) {
if (mService != null) { if (mService != null) {
try { try {
mService.setMaximumFailedPasswordsForWipe(admin, num); mService.setMaximumFailedPasswordsForWipe(admin, num, mParentInstance);
} catch (RemoteException e) { } catch (RemoteException e) {
Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e); Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e);
} }
@ -1772,7 +1775,8 @@ public class DevicePolicyManager {
public int getMaximumFailedPasswordsForWipe(@Nullable ComponentName admin, int userHandle) { public int getMaximumFailedPasswordsForWipe(@Nullable ComponentName admin, int userHandle) {
if (mService != null) { if (mService != null) {
try { try {
return mService.getMaximumFailedPasswordsForWipe(admin, userHandle); return mService.getMaximumFailedPasswordsForWipe(
admin, userHandle, mParentInstance);
} catch (RemoteException e) { } catch (RemoteException e) {
Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e); Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e);
} }
@ -1790,7 +1794,8 @@ public class DevicePolicyManager {
public int getProfileWithMinimumFailedPasswordsForWipe(int userHandle) { public int getProfileWithMinimumFailedPasswordsForWipe(int userHandle) {
if (mService != null) { if (mService != null) {
try { try {
return mService.getProfileWithMinimumFailedPasswordsForWipe(userHandle); return mService.getProfileWithMinimumFailedPasswordsForWipe(
userHandle, mParentInstance);
} catch (RemoteException e) { } catch (RemoteException e) {
Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e); Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e);
} }
@ -1882,7 +1887,7 @@ public class DevicePolicyManager {
public void setMaximumTimeToLock(@NonNull ComponentName admin, long timeMs) { public void setMaximumTimeToLock(@NonNull ComponentName admin, long timeMs) {
if (mService != null) { if (mService != null) {
try { try {
mService.setMaximumTimeToLock(admin, timeMs); mService.setMaximumTimeToLock(admin, timeMs, mParentInstance);
} catch (RemoteException e) { } catch (RemoteException e) {
Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e); Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e);
} }
@ -1905,7 +1910,7 @@ public class DevicePolicyManager {
public long getMaximumTimeToLock(@Nullable ComponentName admin, int userHandle) { public long getMaximumTimeToLock(@Nullable ComponentName admin, int userHandle) {
if (mService != null) { if (mService != null) {
try { try {
return mService.getMaximumTimeToLock(admin, userHandle); return mService.getMaximumTimeToLock(admin, userHandle, mParentInstance);
} catch (RemoteException e) { } catch (RemoteException e) {
Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e); Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e);
} }
@ -1924,7 +1929,7 @@ public class DevicePolicyManager {
public void lockNow() { public void lockNow() {
if (mService != null) { if (mService != null) {
try { try {
mService.lockNow(); mService.lockNow(mParentInstance);
} catch (RemoteException e) { } catch (RemoteException e) {
Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e); Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e);
} }
@ -2721,7 +2726,7 @@ public class DevicePolicyManager {
public void setKeyguardDisabledFeatures(@NonNull ComponentName admin, int which) { public void setKeyguardDisabledFeatures(@NonNull ComponentName admin, int which) {
if (mService != null) { if (mService != null) {
try { try {
mService.setKeyguardDisabledFeatures(admin, which); mService.setKeyguardDisabledFeatures(admin, which, mParentInstance);
} catch (RemoteException e) { } catch (RemoteException e) {
Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e); Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e);
} }
@ -2731,8 +2736,8 @@ public class DevicePolicyManager {
/** /**
* Determine whether or not features have been disabled in keyguard either by the calling * Determine whether or not features have been disabled in keyguard either by the calling
* admin, if specified, or all admins. * admin, if specified, or all admins.
* @param admin The name of the admin component to check, or {@code null} to check whether any admins * @param admin The name of the admin component to check, or {@code null} to check whether any
* have disabled features in keyguard. * admins have disabled features in keyguard.
* @return bitfield of flags. See {@link #setKeyguardDisabledFeatures(ComponentName, int)} * @return bitfield of flags. See {@link #setKeyguardDisabledFeatures(ComponentName, int)}
* for a list. * for a list.
*/ */
@ -2744,7 +2749,7 @@ public class DevicePolicyManager {
public int getKeyguardDisabledFeatures(@Nullable ComponentName admin, int userHandle) { public int getKeyguardDisabledFeatures(@Nullable ComponentName admin, int userHandle) {
if (mService != null) { if (mService != null) {
try { try {
return mService.getKeyguardDisabledFeatures(admin, userHandle); return mService.getKeyguardDisabledFeatures(admin, userHandle, mParentInstance);
} catch (RemoteException e) { } catch (RemoteException e) {
Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e); Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e);
} }
@ -4667,7 +4672,8 @@ public class DevicePolicyManager {
* @see #addCrossProfileWidgetProvider(android.content.ComponentName, String) * @see #addCrossProfileWidgetProvider(android.content.ComponentName, String)
* @see #getCrossProfileWidgetProviders(android.content.ComponentName) * @see #getCrossProfileWidgetProviders(android.content.ComponentName)
*/ */
public boolean removeCrossProfileWidgetProvider(@NonNull ComponentName admin, String packageName) { public boolean removeCrossProfileWidgetProvider(
@NonNull ComponentName admin, String packageName) {
if (mService != null) { if (mService != null) {
try { try {
return mService.removeCrossProfileWidgetProvider(admin, packageName); return mService.removeCrossProfileWidgetProvider(admin, packageName);
@ -5126,7 +5132,8 @@ public class DevicePolicyManager {
} }
/** /**
* Obtains a {@link DevicePolicyManager} whose calls act on the parent profile. * Called by the profile owner of a managed profile to obtain a {@link DevicePolicyManager}
* whose calls act on the parent profile.
* *
* <p> Note only some methods will work on the parent Manager. * <p> Note only some methods will work on the parent Manager.
* *

View File

@ -38,48 +38,48 @@ interface IDevicePolicyManager {
void setPasswordQuality(in ComponentName who, int quality, boolean parent); void setPasswordQuality(in ComponentName who, int quality, boolean parent);
int getPasswordQuality(in ComponentName who, int userHandle, boolean parent); int getPasswordQuality(in ComponentName who, int userHandle, boolean parent);
void setPasswordMinimumLength(in ComponentName who, int length); void setPasswordMinimumLength(in ComponentName who, int length, boolean parent);
int getPasswordMinimumLength(in ComponentName who, int userHandle); int getPasswordMinimumLength(in ComponentName who, int userHandle, boolean parent);
void setPasswordMinimumUpperCase(in ComponentName who, int length); void setPasswordMinimumUpperCase(in ComponentName who, int length, boolean parent);
int getPasswordMinimumUpperCase(in ComponentName who, int userHandle); int getPasswordMinimumUpperCase(in ComponentName who, int userHandle, boolean parent);
void setPasswordMinimumLowerCase(in ComponentName who, int length); void setPasswordMinimumLowerCase(in ComponentName who, int length, boolean parent);
int getPasswordMinimumLowerCase(in ComponentName who, int userHandle); int getPasswordMinimumLowerCase(in ComponentName who, int userHandle, boolean parent);
void setPasswordMinimumLetters(in ComponentName who, int length); void setPasswordMinimumLetters(in ComponentName who, int length, boolean parent);
int getPasswordMinimumLetters(in ComponentName who, int userHandle); int getPasswordMinimumLetters(in ComponentName who, int userHandle, boolean parent);
void setPasswordMinimumNumeric(in ComponentName who, int length); void setPasswordMinimumNumeric(in ComponentName who, int length, boolean parent);
int getPasswordMinimumNumeric(in ComponentName who, int userHandle); int getPasswordMinimumNumeric(in ComponentName who, int userHandle, boolean parent);
void setPasswordMinimumSymbols(in ComponentName who, int length); void setPasswordMinimumSymbols(in ComponentName who, int length, boolean parent);
int getPasswordMinimumSymbols(in ComponentName who, int userHandle); int getPasswordMinimumSymbols(in ComponentName who, int userHandle, boolean parent);
void setPasswordMinimumNonLetter(in ComponentName who, int length); void setPasswordMinimumNonLetter(in ComponentName who, int length, boolean parent);
int getPasswordMinimumNonLetter(in ComponentName who, int userHandle); int getPasswordMinimumNonLetter(in ComponentName who, int userHandle, boolean parent);
void setPasswordHistoryLength(in ComponentName who, int length); void setPasswordHistoryLength(in ComponentName who, int length, boolean parent);
int getPasswordHistoryLength(in ComponentName who, int userHandle); int getPasswordHistoryLength(in ComponentName who, int userHandle, boolean parent);
void setPasswordExpirationTimeout(in ComponentName who, long expiration); void setPasswordExpirationTimeout(in ComponentName who, long expiration, boolean parent);
long getPasswordExpirationTimeout(in ComponentName who, int userHandle); long getPasswordExpirationTimeout(in ComponentName who, int userHandle, boolean parent);
long getPasswordExpiration(in ComponentName who, int userHandle); long getPasswordExpiration(in ComponentName who, int userHandle, boolean parent);
boolean isActivePasswordSufficient(int userHandle, boolean parent); boolean isActivePasswordSufficient(int userHandle, boolean parent);
int getCurrentFailedPasswordAttempts(int userHandle); int getCurrentFailedPasswordAttempts(int userHandle, boolean parent);
int getProfileWithMinimumFailedPasswordsForWipe(int userHandle); int getProfileWithMinimumFailedPasswordsForWipe(int userHandle, boolean parent);
void setMaximumFailedPasswordsForWipe(in ComponentName admin, int num); void setMaximumFailedPasswordsForWipe(in ComponentName admin, int num, boolean parent);
int getMaximumFailedPasswordsForWipe(in ComponentName admin, int userHandle); int getMaximumFailedPasswordsForWipe(in ComponentName admin, int userHandle, boolean parent);
boolean resetPassword(String password, int flags); boolean resetPassword(String password, int flags);
void setMaximumTimeToLock(in ComponentName who, long timeMs); void setMaximumTimeToLock(in ComponentName who, long timeMs, boolean parent);
long getMaximumTimeToLock(in ComponentName who, int userHandle); long getMaximumTimeToLock(in ComponentName who, int userHandle, boolean parent);
void lockNow(); void lockNow(boolean parent);
void wipeData(int flags); void wipeData(int flags);
@ -99,8 +99,8 @@ interface IDevicePolicyManager {
void setScreenCaptureDisabled(in ComponentName who, boolean disabled); void setScreenCaptureDisabled(in ComponentName who, boolean disabled);
boolean getScreenCaptureDisabled(in ComponentName who, int userHandle); boolean getScreenCaptureDisabled(in ComponentName who, int userHandle);
void setKeyguardDisabledFeatures(in ComponentName who, int which); void setKeyguardDisabledFeatures(in ComponentName who, int which, boolean parent);
int getKeyguardDisabledFeatures(in ComponentName who, int userHandle); int getKeyguardDisabledFeatures(in ComponentName who, int userHandle, boolean parent);
void setActiveAdmin(in ComponentName policyReceiver, boolean refreshing, int userHandle); void setActiveAdmin(in ComponentName policyReceiver, boolean refreshing, int userHandle);
boolean isAdminActive(in ComponentName policyReceiver, int userHandle); boolean isAdminActive(in ComponentName policyReceiver, int userHandle);

View File

@ -26,7 +26,7 @@ public class DevicePolicyManagerTestable extends DevicePolicyManager {
public DevicePolicyManagerTestable(DpmMockContext context, public DevicePolicyManagerTestable(DpmMockContext context,
DevicePolicyManagerServiceTestable dpms) { DevicePolicyManagerServiceTestable dpms) {
super(context, dpms); super(context, dpms, /* parentInstance = */ false);
this.dpms = dpms; this.dpms = dpms;
} }