Limit grantTrust() duration to DevicePolicy-imposed limit.
Fixes bug 17046034
Change-Id: I5c512c2d05e7e0ed81eaf0dcafacc6f62a5c5937
diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java
index 41bbb87..a16cd7f 100644
--- a/core/java/android/app/admin/DevicePolicyManager.java
+++ b/core/java/android/app/admin/DevicePolicyManager.java
@@ -1374,7 +1374,7 @@
* @param admin The name of the admin component to check, or null to aggregate
* all admins.
* @return time in milliseconds for the given admin or the minimum value (strictest) of
- * all admins if admin is null.
+ * all admins if admin is null. Returns 0 if there are no restrictions.
*/
public long getMaximumTimeToLock(ComponentName admin) {
return getMaximumTimeToLock(admin, UserHandle.myUserId());