blob: c89396bc13e8861c211693e783f27e0dbfa6224d [file] [log] [blame]
Dianne Hackbornd6847842010-01-12 18:14:19 -08001/*
2 * Copyright (C) 2010 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Dianne Hackborn87bba1e2010-02-26 17:25:54 -080017package android.app.admin;
Dianne Hackbornd6847842010-01-12 18:14:19 -080018
19import org.xmlpull.v1.XmlPullParserException;
20
21import android.annotation.SdkConstant;
22import android.annotation.SdkConstant.SdkConstantType;
23import android.content.ComponentName;
24import android.content.Context;
25import android.content.pm.ActivityInfo;
26import android.content.pm.PackageManager;
27import android.content.pm.ResolveInfo;
28import android.os.Handler;
Dianne Hackborn8ea138c2010-01-26 18:01:04 -080029import android.os.RemoteCallback;
Dianne Hackbornd6847842010-01-12 18:14:19 -080030import android.os.RemoteException;
31import android.os.ServiceManager;
32import android.util.Log;
33
34import java.io.IOException;
Oscar Montemayor69238c62010-08-03 10:51:06 -070035import java.net.InetSocketAddress;
36import java.net.Proxy;
Dianne Hackbornd47c6ed2010-01-27 16:21:20 -080037import java.util.List;
Dianne Hackbornd6847842010-01-12 18:14:19 -080038
39/**
40 * Public interface for managing policies enforced on a device. Most clients
Dianne Hackbornef6b22f2010-02-16 20:38:49 -080041 * of this class must have published a {@link DeviceAdminReceiver} that the user
Dianne Hackbornd6847842010-01-12 18:14:19 -080042 * has currently enabled.
43 */
44public class DevicePolicyManager {
45 private static String TAG = "DevicePolicyManager";
Dianne Hackbornd6847842010-01-12 18:14:19 -080046
47 private final Context mContext;
Dianne Hackbornd6847842010-01-12 18:14:19 -080048 private final IDevicePolicyManager mService;
Konstantin Lopyrev32558232010-05-20 16:18:05 -070049
Dianne Hackborn21f1bd12010-02-19 17:02:21 -080050 private DevicePolicyManager(Context context, Handler handler) {
Dianne Hackbornd6847842010-01-12 18:14:19 -080051 mContext = context;
Dianne Hackbornd6847842010-01-12 18:14:19 -080052 mService = IDevicePolicyManager.Stub.asInterface(
53 ServiceManager.getService(Context.DEVICE_POLICY_SERVICE));
54 }
55
Dianne Hackborn87bba1e2010-02-26 17:25:54 -080056 /** @hide */
57 public static DevicePolicyManager create(Context context, Handler handler) {
Dianne Hackborn21f1bd12010-02-19 17:02:21 -080058 DevicePolicyManager me = new DevicePolicyManager(context, handler);
59 return me.mService != null ? me : null;
60 }
Konstantin Lopyrev32558232010-05-20 16:18:05 -070061
Dianne Hackbornd6847842010-01-12 18:14:19 -080062 /**
63 * Activity action: ask the user to add a new device administrator to the system.
64 * The desired policy is the ComponentName of the policy in the
65 * {@link #EXTRA_DEVICE_ADMIN} extra field. This will invoke a UI to
66 * bring the user through adding the device administrator to the system (or
67 * allowing them to reject it).
Konstantin Lopyrev32558232010-05-20 16:18:05 -070068 *
Dianne Hackborn8ea138c2010-01-26 18:01:04 -080069 * <p>You can optionally include the {@link #EXTRA_ADD_EXPLANATION}
70 * field to provide the user with additional explanation (in addition
71 * to your component's description) about what is being added.
Andy Stadlerc25f70a2010-12-08 15:56:45 -080072 *
73 * <p>If your administrator is already active, this will ordinarily return immediately (without
74 * user intervention). However, if your administrator has been updated and is requesting
75 * additional uses-policy flags, the user will be presented with the new list. New policies
76 * will not be available to the updated administrator until the user has accepted the new list.
Dianne Hackbornd6847842010-01-12 18:14:19 -080077 */
78 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
79 public static final String ACTION_ADD_DEVICE_ADMIN
80 = "android.app.action.ADD_DEVICE_ADMIN";
Konstantin Lopyrev32558232010-05-20 16:18:05 -070081
Dianne Hackbornd6847842010-01-12 18:14:19 -080082 /**
Jim Miller284b62e2010-06-08 14:27:42 -070083 * Activity action: send when any policy admin changes a policy.
84 * This is generally used to find out when a new policy is in effect.
Jim Miller3e5d3fd2011-09-02 17:30:35 -070085 *
Jim Miller284b62e2010-06-08 14:27:42 -070086 * @hide
87 */
88 public static final String ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED
89 = "android.app.action.DEVICE_POLICY_MANAGER_STATE_CHANGED";
90
91 /**
Dianne Hackbornd6847842010-01-12 18:14:19 -080092 * The ComponentName of the administrator component.
93 *
94 * @see #ACTION_ADD_DEVICE_ADMIN
95 */
96 public static final String EXTRA_DEVICE_ADMIN = "android.app.extra.DEVICE_ADMIN";
Konstantin Lopyrev32558232010-05-20 16:18:05 -070097
Dianne Hackbornd6847842010-01-12 18:14:19 -080098 /**
Dianne Hackborn8ea138c2010-01-26 18:01:04 -080099 * An optional CharSequence providing additional explanation for why the
100 * admin is being added.
101 *
102 * @see #ACTION_ADD_DEVICE_ADMIN
103 */
104 public static final String EXTRA_ADD_EXPLANATION = "android.app.extra.ADD_EXPLANATION";
Konstantin Lopyrev32558232010-05-20 16:18:05 -0700105
Dianne Hackborn8ea138c2010-01-26 18:01:04 -0800106 /**
Konstantin Lopyrev32558232010-05-20 16:18:05 -0700107 * Activity action: have the user enter a new password. This activity should
108 * be launched after using {@link #setPasswordQuality(ComponentName, int)},
109 * or {@link #setPasswordMinimumLength(ComponentName, int)} to have the user
110 * enter a new password that meets the current requirements. You can use
111 * {@link #isActivePasswordSufficient()} to determine whether you need to
112 * have the user select a new password in order to meet the current
113 * constraints. Upon being resumed from this activity, you can check the new
114 * password characteristics to see if they are sufficient.
Dianne Hackbornd6847842010-01-12 18:14:19 -0800115 */
116 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
117 public static final String ACTION_SET_NEW_PASSWORD
118 = "android.app.action.SET_NEW_PASSWORD";
Konstantin Lopyrev32558232010-05-20 16:18:05 -0700119
Dianne Hackbornd6847842010-01-12 18:14:19 -0800120 /**
121 * Return true if the given administrator component is currently
122 * active (enabled) in the system.
123 */
124 public boolean isAdminActive(ComponentName who) {
125 if (mService != null) {
126 try {
Dianne Hackbornd47c6ed2010-01-27 16:21:20 -0800127 return mService.isAdminActive(who);
Dianne Hackbornd6847842010-01-12 18:14:19 -0800128 } catch (RemoteException e) {
129 Log.w(TAG, "Failed talking with device policy service", e);
130 }
131 }
132 return false;
133 }
Konstantin Lopyrev32558232010-05-20 16:18:05 -0700134
Dianne Hackbornd6847842010-01-12 18:14:19 -0800135 /**
Dianne Hackbornd47c6ed2010-01-27 16:21:20 -0800136 * Return a list of all currently active device administrator's component
137 * names. Note that if there are no administrators than null may be
138 * returned.
139 */
140 public List<ComponentName> getActiveAdmins() {
141 if (mService != null) {
142 try {
143 return mService.getActiveAdmins();
144 } catch (RemoteException e) {
145 Log.w(TAG, "Failed talking with device policy service", e);
146 }
147 }
148 return null;
149 }
Konstantin Lopyrev32558232010-05-20 16:18:05 -0700150
Dianne Hackbornd47c6ed2010-01-27 16:21:20 -0800151 /**
Dianne Hackborn21f1bd12010-02-19 17:02:21 -0800152 * @hide
153 */
154 public boolean packageHasActiveAdmins(String packageName) {
155 if (mService != null) {
156 try {
157 return mService.packageHasActiveAdmins(packageName);
158 } catch (RemoteException e) {
159 Log.w(TAG, "Failed talking with device policy service", e);
160 }
161 }
162 return false;
163 }
Konstantin Lopyrev32558232010-05-20 16:18:05 -0700164
Dianne Hackborn21f1bd12010-02-19 17:02:21 -0800165 /**
Dianne Hackbornd6847842010-01-12 18:14:19 -0800166 * Remove a current administration component. This can only be called
167 * by the application that owns the administration component; if you
168 * try to remove someone else's component, a security exception will be
169 * thrown.
170 */
171 public void removeActiveAdmin(ComponentName who) {
172 if (mService != null) {
173 try {
174 mService.removeActiveAdmin(who);
175 } catch (RemoteException e) {
176 Log.w(TAG, "Failed talking with device policy service", e);
177 }
178 }
179 }
Konstantin Lopyrev32558232010-05-20 16:18:05 -0700180
Dianne Hackbornd6847842010-01-12 18:14:19 -0800181 /**
Andy Stadlerc25f70a2010-12-08 15:56:45 -0800182 * Returns true if an administrator has been granted a particular device policy. This can
183 * be used to check if the administrator was activated under an earlier set of policies,
184 * but requires additional policies after an upgrade.
185 *
186 * @param admin Which {@link DeviceAdminReceiver} this request is associated with. Must be
187 * an active administrator, or an exception will be thrown.
188 * @param usesPolicy Which uses-policy to check, as defined in {@link DeviceAdminInfo}.
189 */
190 public boolean hasGrantedPolicy(ComponentName admin, int usesPolicy) {
191 if (mService != null) {
192 try {
193 return mService.hasGrantedPolicy(admin, usesPolicy);
194 } catch (RemoteException e) {
195 Log.w(TAG, "Failed talking with device policy service", e);
196 }
197 }
198 return false;
199 }
200
201 /**
Dianne Hackborn9327f4f2010-01-29 10:38:29 -0800202 * Constant for {@link #setPasswordQuality}: the policy has no requirements
203 * for the password. Note that quality constants are ordered so that higher
Dianne Hackborndf83afa2010-01-20 13:37:26 -0800204 * values are more restrictive.
Dianne Hackbornd6847842010-01-12 18:14:19 -0800205 */
Dianne Hackborn9327f4f2010-01-29 10:38:29 -0800206 public static final int PASSWORD_QUALITY_UNSPECIFIED = 0;
Konstantin Lopyrev32558232010-05-20 16:18:05 -0700207
Dianne Hackbornd6847842010-01-12 18:14:19 -0800208 /**
Jim Miller3e5d3fd2011-09-02 17:30:35 -0700209 * Constant for {@link #setPasswordQuality}: the policy allows for low-security biometric
210 * recognition technology. This implies technologies that can recognize the identity of
211 * an individual to about a 3 digit PIN (false detection is less than 1 in 1,000).
212 * Note that quality constants are ordered so that higher values are more restrictive.
213 */
214 public static final int PASSWORD_QUALITY_BIOMETRIC_WEAK = 0x8000;
215
216 /**
Dianne Hackborn9327f4f2010-01-29 10:38:29 -0800217 * Constant for {@link #setPasswordQuality}: the policy requires some kind
218 * of password, but doesn't care what it is. Note that quality constants
Dianne Hackborndf83afa2010-01-20 13:37:26 -0800219 * are ordered so that higher values are more restrictive.
Dianne Hackbornd6847842010-01-12 18:14:19 -0800220 */
Dianne Hackborn9327f4f2010-01-29 10:38:29 -0800221 public static final int PASSWORD_QUALITY_SOMETHING = 0x10000;
Konstantin Lopyrev32558232010-05-20 16:18:05 -0700222
Dianne Hackborndf83afa2010-01-20 13:37:26 -0800223 /**
Dianne Hackborn9327f4f2010-01-29 10:38:29 -0800224 * Constant for {@link #setPasswordQuality}: the user must have entered a
225 * password containing at least numeric characters. Note that quality
226 * constants are ordered so that higher values are more restrictive.
Dianne Hackborndf83afa2010-01-20 13:37:26 -0800227 */
Dianne Hackborn9327f4f2010-01-29 10:38:29 -0800228 public static final int PASSWORD_QUALITY_NUMERIC = 0x20000;
Konstantin Lopyrev32558232010-05-20 16:18:05 -0700229
Dianne Hackbornd6847842010-01-12 18:14:19 -0800230 /**
Dianne Hackborn9327f4f2010-01-29 10:38:29 -0800231 * Constant for {@link #setPasswordQuality}: the user must have entered a
Dianne Hackborn85f2c9c2010-03-22 11:12:48 -0700232 * password containing at least alphabetic (or other symbol) characters.
233 * Note that quality constants are ordered so that higher values are more
234 * restrictive.
235 */
236 public static final int PASSWORD_QUALITY_ALPHABETIC = 0x40000;
Konstantin Lopyrev32558232010-05-20 16:18:05 -0700237
Dianne Hackborn85f2c9c2010-03-22 11:12:48 -0700238 /**
239 * Constant for {@link #setPasswordQuality}: the user must have entered a
Dianne Hackborn9327f4f2010-01-29 10:38:29 -0800240 * password containing at least <em>both></em> numeric <em>and</em>
Dianne Hackborn85f2c9c2010-03-22 11:12:48 -0700241 * alphabetic (or other symbol) characters. Note that quality constants are
Dianne Hackborn9327f4f2010-01-29 10:38:29 -0800242 * ordered so that higher values are more restrictive.
Dianne Hackbornd6847842010-01-12 18:14:19 -0800243 */
Dianne Hackborn85f2c9c2010-03-22 11:12:48 -0700244 public static final int PASSWORD_QUALITY_ALPHANUMERIC = 0x50000;
Konstantin Lopyrev32558232010-05-20 16:18:05 -0700245
Dianne Hackbornd6847842010-01-12 18:14:19 -0800246 /**
Konstantin Lopyreva15dcfa2010-05-24 17:10:56 -0700247 * Constant for {@link #setPasswordQuality}: the user must have entered a
Konstantin Lopyrevc8577402010-06-04 17:15:02 -0700248 * password containing at least a letter, a numerical digit and a special
249 * symbol, by default. With this password quality, passwords can be
250 * restricted to contain various sets of characters, like at least an
251 * uppercase letter, etc. These are specified using various methods,
252 * like {@link #setPasswordMinimumLowerCase(ComponentName, int)}. Note
253 * that quality constants are ordered so that higher values are more
254 * restrictive.
Konstantin Lopyreva15dcfa2010-05-24 17:10:56 -0700255 */
256 public static final int PASSWORD_QUALITY_COMPLEX = 0x60000;
257
258 /**
Dianne Hackbornd6847842010-01-12 18:14:19 -0800259 * Called by an application that is administering the device to set the
260 * password restrictions it is imposing. After setting this, the user
261 * will not be able to enter a new password that is not at least as
262 * restrictive as what has been set. Note that the current password
263 * will remain until the user has set a new one, so the change does not
264 * take place immediately. To prompt the user for a new password, use
265 * {@link #ACTION_SET_NEW_PASSWORD} after setting this value.
Konstantin Lopyrev32558232010-05-20 16:18:05 -0700266 *
Dianne Hackborn9327f4f2010-01-29 10:38:29 -0800267 * <p>Quality constants are ordered so that higher values are more restrictive;
268 * thus the highest requested quality constant (between the policy set here,
Dianne Hackborndf83afa2010-01-20 13:37:26 -0800269 * the user's preference, and any other considerations) is the one that
270 * is in effect.
Konstantin Lopyrev32558232010-05-20 16:18:05 -0700271 *
Dianne Hackborn8aa2e892010-01-22 11:31:30 -0800272 * <p>The calling device admin must have requested
273 * {@link DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD} to be able to call
274 * this method; if it has not, a security exception will be thrown.
Konstantin Lopyrev32558232010-05-20 16:18:05 -0700275 *
Dianne Hackbornef6b22f2010-02-16 20:38:49 -0800276 * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
Dianne Hackborn9327f4f2010-01-29 10:38:29 -0800277 * @param quality The new desired quality. One of
278 * {@link #PASSWORD_QUALITY_UNSPECIFIED}, {@link #PASSWORD_QUALITY_SOMETHING},
Dianne Hackborn85f2c9c2010-03-22 11:12:48 -0700279 * {@link #PASSWORD_QUALITY_NUMERIC}, {@link #PASSWORD_QUALITY_ALPHABETIC},
Konstantin Lopyreva15dcfa2010-05-24 17:10:56 -0700280 * {@link #PASSWORD_QUALITY_ALPHANUMERIC} or {@link #PASSWORD_QUALITY_COMPLEX}.
Dianne Hackbornd6847842010-01-12 18:14:19 -0800281 */
Dianne Hackborn9327f4f2010-01-29 10:38:29 -0800282 public void setPasswordQuality(ComponentName admin, int quality) {
Dianne Hackbornd6847842010-01-12 18:14:19 -0800283 if (mService != null) {
284 try {
Dianne Hackborn9327f4f2010-01-29 10:38:29 -0800285 mService.setPasswordQuality(admin, quality);
Dianne Hackbornd6847842010-01-12 18:14:19 -0800286 } catch (RemoteException e) {
287 Log.w(TAG, "Failed talking with device policy service", e);
288 }
289 }
290 }
Konstantin Lopyrev32558232010-05-20 16:18:05 -0700291
Dianne Hackbornd6847842010-01-12 18:14:19 -0800292 /**
Dianne Hackborn9327f4f2010-01-29 10:38:29 -0800293 * Retrieve the current minimum password quality for all admins
Dianne Hackborn254cb442010-01-27 19:23:59 -0800294 * or a particular one.
295 * @param admin The name of the admin component to check, or null to aggregate
296 * all admins.
Dianne Hackbornd6847842010-01-12 18:14:19 -0800297 */
Dianne Hackborn9327f4f2010-01-29 10:38:29 -0800298 public int getPasswordQuality(ComponentName admin) {
Dianne Hackbornd6847842010-01-12 18:14:19 -0800299 if (mService != null) {
300 try {
Dianne Hackborn9327f4f2010-01-29 10:38:29 -0800301 return mService.getPasswordQuality(admin);
Dianne Hackbornd6847842010-01-12 18:14:19 -0800302 } catch (RemoteException e) {
303 Log.w(TAG, "Failed talking with device policy service", e);
304 }
305 }
Dianne Hackborn9327f4f2010-01-29 10:38:29 -0800306 return PASSWORD_QUALITY_UNSPECIFIED;
Dianne Hackbornd6847842010-01-12 18:14:19 -0800307 }
Konstantin Lopyrev32558232010-05-20 16:18:05 -0700308
Dianne Hackbornd6847842010-01-12 18:14:19 -0800309 /**
Dianne Hackbornd6847842010-01-12 18:14:19 -0800310 * Called by an application that is administering the device to set the
311 * minimum allowed password length. After setting this, the user
312 * will not be able to enter a new password that is not at least as
313 * restrictive as what has been set. Note that the current password
314 * will remain until the user has set a new one, so the change does not
315 * take place immediately. To prompt the user for a new password, use
316 * {@link #ACTION_SET_NEW_PASSWORD} after setting this value. This
317 * constraint is only imposed if the administrator has also requested either
Konstantin Lopyreva15dcfa2010-05-24 17:10:56 -0700318 * {@link #PASSWORD_QUALITY_NUMERIC}, {@link #PASSWORD_QUALITY_ALPHABETIC}
319 * {@link #PASSWORD_QUALITY_ALPHANUMERIC}, or {@link #PASSWORD_QUALITY_COMPLEX}
Dianne Hackborn9327f4f2010-01-29 10:38:29 -0800320 * with {@link #setPasswordQuality}.
Konstantin Lopyrev32558232010-05-20 16:18:05 -0700321 *
Dianne Hackborn8aa2e892010-01-22 11:31:30 -0800322 * <p>The calling device admin must have requested
323 * {@link DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD} to be able to call
324 * this method; if it has not, a security exception will be thrown.
Konstantin Lopyrev32558232010-05-20 16:18:05 -0700325 *
Dianne Hackbornef6b22f2010-02-16 20:38:49 -0800326 * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
Dianne Hackbornd6847842010-01-12 18:14:19 -0800327 * @param length The new desired minimum password length. A value of 0
328 * means there is no restriction.
329 */
Dianne Hackborn254cb442010-01-27 19:23:59 -0800330 public void setPasswordMinimumLength(ComponentName admin, int length) {
Dianne Hackbornd6847842010-01-12 18:14:19 -0800331 if (mService != null) {
332 try {
Dianne Hackborn254cb442010-01-27 19:23:59 -0800333 mService.setPasswordMinimumLength(admin, length);
Dianne Hackbornd6847842010-01-12 18:14:19 -0800334 } catch (RemoteException e) {
335 Log.w(TAG, "Failed talking with device policy service", e);
336 }
337 }
338 }
Konstantin Lopyrev32558232010-05-20 16:18:05 -0700339
Dianne Hackbornd6847842010-01-12 18:14:19 -0800340 /**
Dianne Hackborn254cb442010-01-27 19:23:59 -0800341 * Retrieve the current minimum password length for all admins
342 * or a particular one.
343 * @param admin The name of the admin component to check, or null to aggregate
344 * all admins.
Dianne Hackbornd6847842010-01-12 18:14:19 -0800345 */
Dianne Hackborn254cb442010-01-27 19:23:59 -0800346 public int getPasswordMinimumLength(ComponentName admin) {
Dianne Hackbornd6847842010-01-12 18:14:19 -0800347 if (mService != null) {
348 try {
Dianne Hackborn254cb442010-01-27 19:23:59 -0800349 return mService.getPasswordMinimumLength(admin);
Dianne Hackbornd6847842010-01-12 18:14:19 -0800350 } catch (RemoteException e) {
351 Log.w(TAG, "Failed talking with device policy service", e);
352 }
353 }
354 return 0;
355 }
Konstantin Lopyrev32558232010-05-20 16:18:05 -0700356
Konstantin Lopyreva15dcfa2010-05-24 17:10:56 -0700357 /**
358 * Called by an application that is administering the device to set the
359 * minimum number of upper case letters required in the password. After
360 * setting this, the user will not be able to enter a new password that is
361 * not at least as restrictive as what has been set. Note that the current
362 * password will remain until the user has set a new one, so the change does
363 * not take place immediately. To prompt the user for a new password, use
364 * {@link #ACTION_SET_NEW_PASSWORD} after setting this value. This
365 * constraint is only imposed if the administrator has also requested
Konstantin Lopyrevc8577402010-06-04 17:15:02 -0700366 * {@link #PASSWORD_QUALITY_COMPLEX} with {@link #setPasswordQuality}. The
367 * default value is 0.
Konstantin Lopyreva15dcfa2010-05-24 17:10:56 -0700368 * <p>
369 * The calling device admin must have requested
370 * {@link DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD} to be able to call
371 * this method; if it has not, a security exception will be thrown.
372 *
373 * @param admin Which {@link DeviceAdminReceiver} this request is associated
374 * with.
375 * @param length The new desired minimum number of upper case letters
376 * required in the password. A value of 0 means there is no
377 * restriction.
378 */
379 public void setPasswordMinimumUpperCase(ComponentName admin, int length) {
380 if (mService != null) {
381 try {
382 mService.setPasswordMinimumUpperCase(admin, length);
383 } catch (RemoteException e) {
384 Log.w(TAG, "Failed talking with device policy service", e);
385 }
386 }
387 }
388
389 /**
390 * Retrieve the current number of upper case letters required in the
Konstantin Lopyrevc8577402010-06-04 17:15:02 -0700391 * password for all admins or a particular one. This is the same value as
392 * set by {#link {@link #setPasswordMinimumUpperCase(ComponentName, int)}
393 * and only applies when the password quality is
394 * {@link #PASSWORD_QUALITY_COMPLEX}.
Konstantin Lopyreva15dcfa2010-05-24 17:10:56 -0700395 *
396 * @param admin The name of the admin component to check, or null to
397 * aggregate all admins.
398 * @return The minimum number of upper case letters required in the
399 * password.
400 */
401 public int getPasswordMinimumUpperCase(ComponentName admin) {
402 if (mService != null) {
403 try {
404 return mService.getPasswordMinimumUpperCase(admin);
405 } catch (RemoteException e) {
406 Log.w(TAG, "Failed talking with device policy service", e);
407 }
408 }
409 return 0;
410 }
411
412 /**
413 * Called by an application that is administering the device to set the
414 * minimum number of lower case letters required in the password. After
415 * setting this, the user will not be able to enter a new password that is
416 * not at least as restrictive as what has been set. Note that the current
417 * password will remain until the user has set a new one, so the change does
418 * not take place immediately. To prompt the user for a new password, use
419 * {@link #ACTION_SET_NEW_PASSWORD} after setting this value. This
420 * constraint is only imposed if the administrator has also requested
Konstantin Lopyrevc8577402010-06-04 17:15:02 -0700421 * {@link #PASSWORD_QUALITY_COMPLEX} with {@link #setPasswordQuality}. The
422 * default value is 0.
Konstantin Lopyreva15dcfa2010-05-24 17:10:56 -0700423 * <p>
424 * The calling device admin must have requested
425 * {@link DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD} to be able to call
426 * this method; if it has not, a security exception will be thrown.
427 *
428 * @param admin Which {@link DeviceAdminReceiver} this request is associated
429 * with.
430 * @param length The new desired minimum number of lower case letters
431 * required in the password. A value of 0 means there is no
432 * restriction.
433 */
434 public void setPasswordMinimumLowerCase(ComponentName admin, int length) {
435 if (mService != null) {
436 try {
437 mService.setPasswordMinimumLowerCase(admin, length);
438 } catch (RemoteException e) {
439 Log.w(TAG, "Failed talking with device policy service", e);
440 }
441 }
442 }
443
444 /**
445 * Retrieve the current number of lower case letters required in the
Konstantin Lopyrevc8577402010-06-04 17:15:02 -0700446 * password for all admins or a particular one. This is the same value as
447 * set by {#link {@link #setPasswordMinimumLowerCase(ComponentName, int)}
448 * and only applies when the password quality is
449 * {@link #PASSWORD_QUALITY_COMPLEX}.
Konstantin Lopyreva15dcfa2010-05-24 17:10:56 -0700450 *
451 * @param admin The name of the admin component to check, or null to
452 * aggregate all admins.
453 * @return The minimum number of lower case letters required in the
454 * password.
455 */
456 public int getPasswordMinimumLowerCase(ComponentName admin) {
457 if (mService != null) {
458 try {
459 return mService.getPasswordMinimumLowerCase(admin);
460 } catch (RemoteException e) {
461 Log.w(TAG, "Failed talking with device policy service", e);
462 }
463 }
464 return 0;
465 }
466
467 /**
468 * Called by an application that is administering the device to set the
469 * minimum number of letters required in the password. After setting this,
470 * the user will not be able to enter a new password that is not at least as
471 * restrictive as what has been set. Note that the current password will
472 * remain until the user has set a new one, so the change does not take
473 * place immediately. To prompt the user for a new password, use
474 * {@link #ACTION_SET_NEW_PASSWORD} after setting this value. This
475 * constraint is only imposed if the administrator has also requested
Konstantin Lopyrevc8577402010-06-04 17:15:02 -0700476 * {@link #PASSWORD_QUALITY_COMPLEX} with {@link #setPasswordQuality}. The
477 * default value is 1.
Konstantin Lopyreva15dcfa2010-05-24 17:10:56 -0700478 * <p>
479 * The calling device admin must have requested
480 * {@link DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD} to be able to call
481 * this method; if it has not, a security exception will be thrown.
482 *
483 * @param admin Which {@link DeviceAdminReceiver} this request is associated
484 * with.
485 * @param length The new desired minimum number of letters required in the
486 * password. A value of 0 means there is no restriction.
487 */
488 public void setPasswordMinimumLetters(ComponentName admin, int length) {
489 if (mService != null) {
490 try {
491 mService.setPasswordMinimumLetters(admin, length);
492 } catch (RemoteException e) {
493 Log.w(TAG, "Failed talking with device policy service", e);
494 }
495 }
496 }
497
498 /**
499 * Retrieve the current number of letters required in the password for all
Konstantin Lopyrevc8577402010-06-04 17:15:02 -0700500 * admins or a particular one. This is the same value as
501 * set by {#link {@link #setPasswordMinimumLetters(ComponentName, int)}
502 * and only applies when the password quality is
503 * {@link #PASSWORD_QUALITY_COMPLEX}.
Konstantin Lopyreva15dcfa2010-05-24 17:10:56 -0700504 *
505 * @param admin The name of the admin component to check, or null to
506 * aggregate all admins.
507 * @return The minimum number of letters required in the password.
508 */
509 public int getPasswordMinimumLetters(ComponentName admin) {
510 if (mService != null) {
511 try {
512 return mService.getPasswordMinimumLetters(admin);
513 } catch (RemoteException e) {
514 Log.w(TAG, "Failed talking with device policy service", e);
515 }
516 }
517 return 0;
518 }
519
520 /**
521 * Called by an application that is administering the device to set the
522 * minimum number of numerical digits required in the password. After
523 * setting this, the user will not be able to enter a new password that is
524 * not at least as restrictive as what has been set. Note that the current
525 * password will remain until the user has set a new one, so the change does
526 * not take place immediately. To prompt the user for a new password, use
527 * {@link #ACTION_SET_NEW_PASSWORD} after setting this value. This
528 * constraint is only imposed if the administrator has also requested
Konstantin Lopyrevc8577402010-06-04 17:15:02 -0700529 * {@link #PASSWORD_QUALITY_COMPLEX} with {@link #setPasswordQuality}. The
530 * default value is 1.
Konstantin Lopyreva15dcfa2010-05-24 17:10:56 -0700531 * <p>
532 * The calling device admin must have requested
533 * {@link DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD} to be able to call
534 * this method; if it has not, a security exception will be thrown.
535 *
536 * @param admin Which {@link DeviceAdminReceiver} this request is associated
537 * with.
538 * @param length The new desired minimum number of numerical digits required
539 * in the password. A value of 0 means there is no restriction.
540 */
541 public void setPasswordMinimumNumeric(ComponentName admin, int length) {
542 if (mService != null) {
543 try {
544 mService.setPasswordMinimumNumeric(admin, length);
545 } catch (RemoteException e) {
546 Log.w(TAG, "Failed talking with device policy service", e);
547 }
548 }
549 }
550
551 /**
552 * Retrieve the current number of numerical digits required in the password
Konstantin Lopyrevc8577402010-06-04 17:15:02 -0700553 * for all admins or a particular one. This is the same value as
554 * set by {#link {@link #setPasswordMinimumNumeric(ComponentName, int)}
555 * and only applies when the password quality is
556 * {@link #PASSWORD_QUALITY_COMPLEX}.
Konstantin Lopyreva15dcfa2010-05-24 17:10:56 -0700557 *
558 * @param admin The name of the admin component to check, or null to
559 * aggregate all admins.
560 * @return The minimum number of numerical digits required in the password.
561 */
562 public int getPasswordMinimumNumeric(ComponentName admin) {
563 if (mService != null) {
564 try {
565 return mService.getPasswordMinimumNumeric(admin);
566 } catch (RemoteException e) {
567 Log.w(TAG, "Failed talking with device policy service", e);
568 }
569 }
570 return 0;
571 }
572
573 /**
574 * Called by an application that is administering the device to set the
575 * minimum number of symbols required in the password. After setting this,
576 * the user will not be able to enter a new password that is not at least as
577 * restrictive as what has been set. Note that the current password will
578 * remain until the user has set a new one, so the change does not take
579 * place immediately. To prompt the user for a new password, use
580 * {@link #ACTION_SET_NEW_PASSWORD} after setting this value. This
581 * constraint is only imposed if the administrator has also requested
Konstantin Lopyrevc8577402010-06-04 17:15:02 -0700582 * {@link #PASSWORD_QUALITY_COMPLEX} with {@link #setPasswordQuality}. The
583 * default value is 1.
Konstantin Lopyreva15dcfa2010-05-24 17:10:56 -0700584 * <p>
585 * The calling device admin must have requested
586 * {@link DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD} to be able to call
587 * this method; if it has not, a security exception will be thrown.
588 *
589 * @param admin Which {@link DeviceAdminReceiver} this request is associated
590 * with.
591 * @param length The new desired minimum number of symbols required in the
592 * password. A value of 0 means there is no restriction.
593 */
594 public void setPasswordMinimumSymbols(ComponentName admin, int length) {
595 if (mService != null) {
596 try {
597 mService.setPasswordMinimumSymbols(admin, length);
598 } catch (RemoteException e) {
599 Log.w(TAG, "Failed talking with device policy service", e);
600 }
601 }
602 }
603
604 /**
605 * Retrieve the current number of symbols required in the password for all
Konstantin Lopyrevc8577402010-06-04 17:15:02 -0700606 * admins or a particular one. This is the same value as
607 * set by {#link {@link #setPasswordMinimumSymbols(ComponentName, int)}
608 * and only applies when the password quality is
609 * {@link #PASSWORD_QUALITY_COMPLEX}.
Konstantin Lopyreva15dcfa2010-05-24 17:10:56 -0700610 *
611 * @param admin The name of the admin component to check, or null to
612 * aggregate all admins.
613 * @return The minimum number of symbols required in the password.
614 */
615 public int getPasswordMinimumSymbols(ComponentName admin) {
616 if (mService != null) {
617 try {
618 return mService.getPasswordMinimumSymbols(admin);
619 } catch (RemoteException e) {
620 Log.w(TAG, "Failed talking with device policy service", e);
621 }
622 }
623 return 0;
624 }
625
Konstantin Lopyrevc8577402010-06-04 17:15:02 -0700626 /**
627 * Called by an application that is administering the device to set the
628 * minimum number of non-letter characters (numerical digits or symbols)
629 * required in the password. After setting this, the user will not be able
630 * to enter a new password that is not at least as restrictive as what has
631 * been set. Note that the current password will remain until the user has
632 * set a new one, so the change does not take place immediately. To prompt
633 * the user for a new password, use {@link #ACTION_SET_NEW_PASSWORD} after
634 * setting this value. This constraint is only imposed if the administrator
635 * has also requested {@link #PASSWORD_QUALITY_COMPLEX} with
636 * {@link #setPasswordQuality}. The default value is 0.
637 * <p>
638 * The calling device admin must have requested
639 * {@link DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD} to be able to call
640 * this method; if it has not, a security exception will be thrown.
641 *
642 * @param admin Which {@link DeviceAdminReceiver} this request is associated
643 * with.
644 * @param length The new desired minimum number of letters required in the
645 * password. A value of 0 means there is no restriction.
646 */
647 public void setPasswordMinimumNonLetter(ComponentName admin, int length) {
648 if (mService != null) {
649 try {
650 mService.setPasswordMinimumNonLetter(admin, length);
651 } catch (RemoteException e) {
652 Log.w(TAG, "Failed talking with device policy service", e);
653 }
654 }
655 }
656
657 /**
658 * Retrieve the current number of non-letter characters required in the
659 * password for all admins or a particular one. This is the same value as
660 * set by {#link {@link #setPasswordMinimumNonLetter(ComponentName, int)}
661 * and only applies when the password quality is
662 * {@link #PASSWORD_QUALITY_COMPLEX}.
663 *
664 * @param admin The name of the admin component to check, or null to
665 * aggregate all admins.
666 * @return The minimum number of letters required in the password.
667 */
668 public int getPasswordMinimumNonLetter(ComponentName admin) {
669 if (mService != null) {
670 try {
671 return mService.getPasswordMinimumNonLetter(admin);
672 } catch (RemoteException e) {
673 Log.w(TAG, "Failed talking with device policy service", e);
674 }
675 }
676 return 0;
677 }
678
Konstantin Lopyrev32558232010-05-20 16:18:05 -0700679 /**
680 * Called by an application that is administering the device to set the length
681 * of the password history. After setting this, the user will not be able to
682 * enter a new password that is the same as any password in the history. Note
683 * that the current password will remain until the user has set a new one, so
684 * the change does not take place immediately. To prompt the user for a new
685 * password, use {@link #ACTION_SET_NEW_PASSWORD} after setting this value.
686 * This constraint is only imposed if the administrator has also requested
687 * either {@link #PASSWORD_QUALITY_NUMERIC},
688 * {@link #PASSWORD_QUALITY_ALPHABETIC}, or
689 * {@link #PASSWORD_QUALITY_ALPHANUMERIC} with {@link #setPasswordQuality}.
690 *
691 * <p>
692 * The calling device admin must have requested
693 * {@link DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD} to be able to call this
694 * method; if it has not, a security exception will be thrown.
695 *
696 * @param admin Which {@link DeviceAdminReceiver} this request is associated
697 * with.
698 * @param length The new desired length of password history. A value of 0
699 * means there is no restriction.
700 */
701 public void setPasswordHistoryLength(ComponentName admin, int length) {
702 if (mService != null) {
703 try {
704 mService.setPasswordHistoryLength(admin, length);
705 } catch (RemoteException e) {
706 Log.w(TAG, "Failed talking with device policy service", e);
707 }
708 }
709 }
710
711 /**
Jim Millera4e28d12010-11-08 16:15:47 -0800712 * Called by a device admin to set the password expiration timeout. Calling this method
713 * will restart the countdown for password expiration for the given admin, as will changing
714 * the device password (for all admins).
715 *
716 * <p>The provided timeout is the time delta in ms and will be added to the current time.
717 * For example, to have the password expire 5 days from now, timeout would be
718 * 5 * 86400 * 1000 = 432000000 ms for timeout.
719 *
720 * <p>To disable password expiration, a value of 0 may be used for timeout.
721 *
Jim Millera4e28d12010-11-08 16:15:47 -0800722 * <p>The calling device admin must have requested
723 * {@link DeviceAdminInfo#USES_POLICY_EXPIRE_PASSWORD} to be able to call this
724 * method; if it has not, a security exception will be thrown.
725 *
726 * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
727 * @param timeout The limit (in ms) that a password can remain in effect. A value of 0
728 * means there is no restriction (unlimited).
729 */
730 public void setPasswordExpirationTimeout(ComponentName admin, long timeout) {
731 if (mService != null) {
732 try {
733 mService.setPasswordExpirationTimeout(admin, timeout);
734 } catch (RemoteException e) {
735 Log.w(TAG, "Failed talking with device policy service", e);
736 }
737 }
738 }
739
740 /**
Jim Miller6b857682011-02-16 16:27:41 -0800741 * Get the password expiration timeout for the given admin. The expiration timeout is the
742 * recurring expiration timeout provided in the call to
743 * {@link #setPasswordExpirationTimeout(ComponentName, long)} for the given admin or the
744 * aggregate of all policy administrators if admin is null.
Jim Millera4e28d12010-11-08 16:15:47 -0800745 *
746 * @param admin The name of the admin component to check, or null to aggregate all admins.
747 * @return The timeout for the given admin or the minimum of all timeouts
748 */
749 public long getPasswordExpirationTimeout(ComponentName admin) {
750 if (mService != null) {
751 try {
752 return mService.getPasswordExpirationTimeout(admin);
753 } catch (RemoteException e) {
754 Log.w(TAG, "Failed talking with device policy service", e);
755 }
756 }
757 return 0;
758 }
759
760 /**
761 * Get the current password expiration time for the given admin or an aggregate of
Jim Miller6b857682011-02-16 16:27:41 -0800762 * all admins if admin is null. If the password is expired, this will return the time since
763 * the password expired as a negative number. If admin is null, then a composite of all
764 * expiration timeouts is returned - which will be the minimum of all timeouts.
Jim Millera4e28d12010-11-08 16:15:47 -0800765 *
766 * @param admin The name of the admin component to check, or null to aggregate all admins.
767 * @return The password expiration time, in ms.
768 */
769 public long getPasswordExpiration(ComponentName admin) {
770 if (mService != null) {
771 try {
772 return mService.getPasswordExpiration(admin);
773 } catch (RemoteException e) {
774 Log.w(TAG, "Failed talking with device policy service", e);
775 }
776 }
777 return 0;
778 }
779
780 /**
Konstantin Lopyrev32558232010-05-20 16:18:05 -0700781 * Retrieve the current password history length for all admins
782 * or a particular one.
783 * @param admin The name of the admin component to check, or null to aggregate
784 * all admins.
785 * @return The length of the password history
786 */
787 public int getPasswordHistoryLength(ComponentName admin) {
788 if (mService != null) {
789 try {
790 return mService.getPasswordHistoryLength(admin);
791 } catch (RemoteException e) {
792 Log.w(TAG, "Failed talking with device policy service", e);
793 }
794 }
795 return 0;
796 }
797
Dianne Hackbornd6847842010-01-12 18:14:19 -0800798 /**
Dianne Hackborn254cb442010-01-27 19:23:59 -0800799 * Return the maximum password length that the device supports for a
Dianne Hackborn9327f4f2010-01-29 10:38:29 -0800800 * particular password quality.
Dianne Hackborn364f6e32010-01-29 17:38:20 -0800801 * @param quality The quality being interrogated.
Dianne Hackborn254cb442010-01-27 19:23:59 -0800802 * @return Returns the maximum length that the user can enter.
803 */
Dianne Hackborn9327f4f2010-01-29 10:38:29 -0800804 public int getPasswordMaximumLength(int quality) {
Dianne Hackborn254cb442010-01-27 19:23:59 -0800805 // Kind-of arbitrary.
806 return 16;
807 }
Konstantin Lopyrev32558232010-05-20 16:18:05 -0700808
Dianne Hackborn254cb442010-01-27 19:23:59 -0800809 /**
Dianne Hackborndf83afa2010-01-20 13:37:26 -0800810 * Determine whether the current password the user has set is sufficient
Dianne Hackborn9327f4f2010-01-29 10:38:29 -0800811 * to meet the policy requirements (quality, minimum length) that have been
Dianne Hackborndf83afa2010-01-20 13:37:26 -0800812 * requested.
Konstantin Lopyrev32558232010-05-20 16:18:05 -0700813 *
Dianne Hackborn8aa2e892010-01-22 11:31:30 -0800814 * <p>The calling device admin must have requested
815 * {@link DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD} to be able to call
816 * this method; if it has not, a security exception will be thrown.
Konstantin Lopyrev32558232010-05-20 16:18:05 -0700817 *
Dianne Hackborndf83afa2010-01-20 13:37:26 -0800818 * @return Returns true if the password meets the current requirements,
819 * else false.
Dianne Hackbornd6847842010-01-12 18:14:19 -0800820 */
Dianne Hackborndf83afa2010-01-20 13:37:26 -0800821 public boolean isActivePasswordSufficient() {
Dianne Hackbornd6847842010-01-12 18:14:19 -0800822 if (mService != null) {
823 try {
Dianne Hackborndf83afa2010-01-20 13:37:26 -0800824 return mService.isActivePasswordSufficient();
Dianne Hackbornd6847842010-01-12 18:14:19 -0800825 } catch (RemoteException e) {
826 Log.w(TAG, "Failed talking with device policy service", e);
827 }
828 }
Dianne Hackborndf83afa2010-01-20 13:37:26 -0800829 return false;
Dianne Hackbornd6847842010-01-12 18:14:19 -0800830 }
Konstantin Lopyrev32558232010-05-20 16:18:05 -0700831
Dianne Hackbornd6847842010-01-12 18:14:19 -0800832 /**
833 * Retrieve the number of times the user has failed at entering a
834 * password since that last successful password entry.
Konstantin Lopyrev32558232010-05-20 16:18:05 -0700835 *
Dianne Hackborn8aa2e892010-01-22 11:31:30 -0800836 * <p>The calling device admin must have requested
837 * {@link DeviceAdminInfo#USES_POLICY_WATCH_LOGIN} to be able to call
838 * this method; if it has not, a security exception will be thrown.
Dianne Hackbornd6847842010-01-12 18:14:19 -0800839 */
840 public int getCurrentFailedPasswordAttempts() {
841 if (mService != null) {
842 try {
843 return mService.getCurrentFailedPasswordAttempts();
844 } catch (RemoteException e) {
845 Log.w(TAG, "Failed talking with device policy service", e);
846 }
847 }
848 return -1;
849 }
Dianne Hackborndf83afa2010-01-20 13:37:26 -0800850
851 /**
Andrew Stadler88209d12010-02-08 22:59:36 -0800852 * Setting this to a value greater than zero enables a built-in policy
853 * that will perform a device wipe after too many incorrect
854 * device-unlock passwords have been entered. This built-in policy combines
855 * watching for failed passwords and wiping the device, and requires
856 * that you request both {@link DeviceAdminInfo#USES_POLICY_WATCH_LOGIN} and
Dianne Hackborn8ea138c2010-01-26 18:01:04 -0800857 * {@link DeviceAdminInfo#USES_POLICY_WIPE_DATA}}.
Konstantin Lopyrev32558232010-05-20 16:18:05 -0700858 *
Andrew Stadler88209d12010-02-08 22:59:36 -0800859 * <p>To implement any other policy (e.g. wiping data for a particular
860 * application only, erasing or revoking credentials, or reporting the
861 * failure to a server), you should implement
Dianne Hackbornef6b22f2010-02-16 20:38:49 -0800862 * {@link DeviceAdminReceiver#onPasswordFailed(Context, android.content.Intent)}
Andrew Stadler88209d12010-02-08 22:59:36 -0800863 * instead. Do not use this API, because if the maximum count is reached,
864 * the device will be wiped immediately, and your callback will not be invoked.
Konstantin Lopyrev32558232010-05-20 16:18:05 -0700865 *
Dianne Hackbornef6b22f2010-02-16 20:38:49 -0800866 * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
Dianne Hackborn8ea138c2010-01-26 18:01:04 -0800867 * @param num The number of failed password attempts at which point the
868 * device will wipe its data.
869 */
870 public void setMaximumFailedPasswordsForWipe(ComponentName admin, int num) {
871 if (mService != null) {
872 try {
873 mService.setMaximumFailedPasswordsForWipe(admin, num);
874 } catch (RemoteException e) {
875 Log.w(TAG, "Failed talking with device policy service", e);
876 }
877 }
878 }
Konstantin Lopyrev32558232010-05-20 16:18:05 -0700879
Dianne Hackborn8ea138c2010-01-26 18:01:04 -0800880 /**
Dianne Hackborn254cb442010-01-27 19:23:59 -0800881 * Retrieve the current maximum number of login attempts that are allowed
882 * before the device wipes itself, for all admins
883 * or a particular one.
884 * @param admin The name of the admin component to check, or null to aggregate
885 * all admins.
886 */
887 public int getMaximumFailedPasswordsForWipe(ComponentName admin) {
888 if (mService != null) {
889 try {
890 return mService.getMaximumFailedPasswordsForWipe(admin);
891 } catch (RemoteException e) {
892 Log.w(TAG, "Failed talking with device policy service", e);
893 }
894 }
895 return 0;
896 }
Konstantin Lopyrev32558232010-05-20 16:18:05 -0700897
Dianne Hackborn254cb442010-01-27 19:23:59 -0800898 /**
Dianne Hackborn87bba1e2010-02-26 17:25:54 -0800899 * Flag for {@link #resetPassword}: don't allow other admins to change
900 * the password again until the user has entered it.
901 */
902 public static final int RESET_PASSWORD_REQUIRE_ENTRY = 0x0001;
Konstantin Lopyrev32558232010-05-20 16:18:05 -0700903
Dianne Hackborn87bba1e2010-02-26 17:25:54 -0800904 /**
Dianne Hackbornef6b22f2010-02-16 20:38:49 -0800905 * Force a new device unlock password (the password needed to access the
906 * entire device, not for individual accounts) on the user. This takes
907 * effect immediately.
Dianne Hackborn9327f4f2010-01-29 10:38:29 -0800908 * The given password must be sufficient for the
909 * current password quality and length constraints as returned by
910 * {@link #getPasswordQuality(ComponentName)} and
911 * {@link #getPasswordMinimumLength(ComponentName)}; if it does not meet
912 * these constraints, then it will be rejected and false returned. Note
913 * that the password may be a stronger quality (containing alphanumeric
914 * characters when the requested quality is only numeric), in which case
915 * the currently active quality will be increased to match.
Konstantin Lopyrev32558232010-05-20 16:18:05 -0700916 *
Dianne Hackborn8aa2e892010-01-22 11:31:30 -0800917 * <p>The calling device admin must have requested
918 * {@link DeviceAdminInfo#USES_POLICY_RESET_PASSWORD} to be able to call
919 * this method; if it has not, a security exception will be thrown.
Konstantin Lopyrev32558232010-05-20 16:18:05 -0700920 *
Dianne Hackborndf83afa2010-01-20 13:37:26 -0800921 * @param password The new password for the user.
Dianne Hackborn87bba1e2010-02-26 17:25:54 -0800922 * @param flags May be 0 or {@link #RESET_PASSWORD_REQUIRE_ENTRY}.
Dianne Hackborndf83afa2010-01-20 13:37:26 -0800923 * @return Returns true if the password was applied, or false if it is
924 * not acceptable for the current constraints.
925 */
Dianne Hackborn87bba1e2010-02-26 17:25:54 -0800926 public boolean resetPassword(String password, int flags) {
Dianne Hackborndf83afa2010-01-20 13:37:26 -0800927 if (mService != null) {
928 try {
Dianne Hackborn87bba1e2010-02-26 17:25:54 -0800929 return mService.resetPassword(password, flags);
Dianne Hackborndf83afa2010-01-20 13:37:26 -0800930 } catch (RemoteException e) {
931 Log.w(TAG, "Failed talking with device policy service", e);
932 }
933 }
934 return false;
935 }
Konstantin Lopyrev32558232010-05-20 16:18:05 -0700936
Dianne Hackbornd6847842010-01-12 18:14:19 -0800937 /**
938 * Called by an application that is administering the device to set the
939 * maximum time for user activity until the device will lock. This limits
940 * the length that the user can set. It takes effect immediately.
Konstantin Lopyrev32558232010-05-20 16:18:05 -0700941 *
Dianne Hackborn8aa2e892010-01-22 11:31:30 -0800942 * <p>The calling device admin must have requested
Dianne Hackborn315ada72010-02-11 12:14:08 -0800943 * {@link DeviceAdminInfo#USES_POLICY_FORCE_LOCK} to be able to call
Dianne Hackborn8aa2e892010-01-22 11:31:30 -0800944 * this method; if it has not, a security exception will be thrown.
Konstantin Lopyrev32558232010-05-20 16:18:05 -0700945 *
Dianne Hackbornef6b22f2010-02-16 20:38:49 -0800946 * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
Dianne Hackbornd6847842010-01-12 18:14:19 -0800947 * @param timeMs The new desired maximum time to lock in milliseconds.
948 * A value of 0 means there is no restriction.
949 */
950 public void setMaximumTimeToLock(ComponentName admin, long timeMs) {
951 if (mService != null) {
952 try {
953 mService.setMaximumTimeToLock(admin, timeMs);
954 } catch (RemoteException e) {
955 Log.w(TAG, "Failed talking with device policy service", e);
956 }
957 }
958 }
Konstantin Lopyrev32558232010-05-20 16:18:05 -0700959
Dianne Hackbornd6847842010-01-12 18:14:19 -0800960 /**
Dianne Hackborn254cb442010-01-27 19:23:59 -0800961 * Retrieve the current maximum time to unlock for all admins
962 * or a particular one.
963 * @param admin The name of the admin component to check, or null to aggregate
964 * all admins.
Dianne Hackbornd6847842010-01-12 18:14:19 -0800965 */
Dianne Hackborn254cb442010-01-27 19:23:59 -0800966 public long getMaximumTimeToLock(ComponentName admin) {
Dianne Hackbornd6847842010-01-12 18:14:19 -0800967 if (mService != null) {
968 try {
Dianne Hackborn254cb442010-01-27 19:23:59 -0800969 return mService.getMaximumTimeToLock(admin);
Dianne Hackbornd6847842010-01-12 18:14:19 -0800970 } catch (RemoteException e) {
971 Log.w(TAG, "Failed talking with device policy service", e);
972 }
973 }
974 return 0;
975 }
Konstantin Lopyrev32558232010-05-20 16:18:05 -0700976
Dianne Hackbornd6847842010-01-12 18:14:19 -0800977 /**
Dianne Hackborndf83afa2010-01-20 13:37:26 -0800978 * Make the device lock immediately, as if the lock screen timeout has
979 * expired at the point of this call.
Konstantin Lopyrev32558232010-05-20 16:18:05 -0700980 *
Dianne Hackborn8aa2e892010-01-22 11:31:30 -0800981 * <p>The calling device admin must have requested
982 * {@link DeviceAdminInfo#USES_POLICY_FORCE_LOCK} to be able to call
983 * this method; if it has not, a security exception will be thrown.
Dianne Hackbornd6847842010-01-12 18:14:19 -0800984 */
Dianne Hackborndf83afa2010-01-20 13:37:26 -0800985 public void lockNow() {
986 if (mService != null) {
987 try {
988 mService.lockNow();
989 } catch (RemoteException e) {
990 Log.w(TAG, "Failed talking with device policy service", e);
991 }
992 }
993 }
Konstantin Lopyrev32558232010-05-20 16:18:05 -0700994
Dianne Hackbornd6847842010-01-12 18:14:19 -0800995 /**
Dianne Hackborn42499172010-10-15 18:45:07 -0700996 * Flag for {@link #wipeData(int)}: also erase the device's external
997 * storage.
998 */
999 public static final int WIPE_EXTERNAL_STORAGE = 0x0001;
1000
1001 /**
Dianne Hackbornd6847842010-01-12 18:14:19 -08001002 * Ask the user date be wiped. This will cause the device to reboot,
Dianne Hackborndf83afa2010-01-20 13:37:26 -08001003 * erasing all user data while next booting up. External storage such
1004 * as SD cards will not be erased.
Konstantin Lopyrev32558232010-05-20 16:18:05 -07001005 *
Dianne Hackborn8aa2e892010-01-22 11:31:30 -08001006 * <p>The calling device admin must have requested
1007 * {@link DeviceAdminInfo#USES_POLICY_WIPE_DATA} to be able to call
1008 * this method; if it has not, a security exception will be thrown.
Konstantin Lopyrev32558232010-05-20 16:18:05 -07001009 *
Dianne Hackborndf83afa2010-01-20 13:37:26 -08001010 * @param flags Bit mask of additional options: currently must be 0.
Dianne Hackbornd6847842010-01-12 18:14:19 -08001011 */
1012 public void wipeData(int flags) {
1013 if (mService != null) {
1014 try {
1015 mService.wipeData(flags);
1016 } catch (RemoteException e) {
1017 Log.w(TAG, "Failed talking with device policy service", e);
1018 }
1019 }
1020 }
Konstantin Lopyrev32558232010-05-20 16:18:05 -07001021
Dianne Hackbornd6847842010-01-12 18:14:19 -08001022 /**
Oscar Montemayor69238c62010-08-03 10:51:06 -07001023 * Called by an application that is administering the device to set the
1024 * global proxy and exclusion list.
1025 * <p>
1026 * The calling device admin must have requested
1027 * {@link DeviceAdminInfo#USES_POLICY_SETS_GLOBAL_PROXY} to be able to call
1028 * this method; if it has not, a security exception will be thrown.
1029 * Only the first device admin can set the proxy. If a second admin attempts
1030 * to set the proxy, the {@link ComponentName} of the admin originally setting the
1031 * proxy will be returned. If successful in setting the proxy, null will
1032 * be returned.
1033 * The method can be called repeatedly by the device admin alrady setting the
1034 * proxy to update the proxy and exclusion list.
1035 *
1036 * @param admin Which {@link DeviceAdminReceiver} this request is associated
1037 * with.
1038 * @param proxySpec the global proxy desired. Must be an HTTP Proxy.
1039 * Pass Proxy.NO_PROXY to reset the proxy.
1040 * @param exclusionList a list of domains to be excluded from the global proxy.
Oscar Montemayor69238c62010-08-03 10:51:06 -07001041 * @return returns null if the proxy was successfully set, or a {@link ComponentName}
1042 * of the device admin that sets thew proxy otherwise.
Andy Stadlerd2672722011-02-16 10:53:33 -08001043 * @hide
Oscar Montemayor69238c62010-08-03 10:51:06 -07001044 */
1045 public ComponentName setGlobalProxy(ComponentName admin, Proxy proxySpec,
1046 List<String> exclusionList ) {
1047 if (proxySpec == null) {
1048 throw new NullPointerException();
1049 }
1050 if (mService != null) {
1051 try {
1052 String hostSpec;
1053 String exclSpec;
1054 if (proxySpec.equals(Proxy.NO_PROXY)) {
1055 hostSpec = null;
1056 exclSpec = null;
1057 } else {
1058 if (!proxySpec.type().equals(Proxy.Type.HTTP)) {
1059 throw new IllegalArgumentException();
1060 }
1061 InetSocketAddress sa = (InetSocketAddress)proxySpec.address();
1062 String hostName = sa.getHostName();
1063 int port = sa.getPort();
1064 StringBuilder hostBuilder = new StringBuilder();
1065 hostSpec = hostBuilder.append(hostName)
1066 .append(":").append(Integer.toString(port)).toString();
1067 if (exclusionList == null) {
1068 exclSpec = "";
1069 } else {
1070 StringBuilder listBuilder = new StringBuilder();
1071 boolean firstDomain = true;
1072 for (String exclDomain : exclusionList) {
1073 if (!firstDomain) {
1074 listBuilder = listBuilder.append(",");
1075 } else {
1076 firstDomain = false;
1077 }
1078 listBuilder = listBuilder.append(exclDomain.trim());
1079 }
1080 exclSpec = listBuilder.toString();
1081 }
1082 android.net.Proxy.validate(hostName, Integer.toString(port), exclSpec);
1083 }
1084 return mService.setGlobalProxy(admin, hostSpec, exclSpec);
1085 } catch (RemoteException e) {
1086 Log.w(TAG, "Failed talking with device policy service", e);
1087 }
1088 }
1089 return null;
1090 }
1091
1092 /**
1093 * Returns the component name setting the global proxy.
1094 * @return ComponentName object of the device admin that set the global proxy, or
1095 * null if no admin has set the proxy.
Andy Stadlerd2672722011-02-16 10:53:33 -08001096 * @hide
Oscar Montemayor69238c62010-08-03 10:51:06 -07001097 */
1098 public ComponentName getGlobalProxyAdmin() {
1099 if (mService != null) {
1100 try {
1101 return mService.getGlobalProxyAdmin();
1102 } catch (RemoteException e) {
1103 Log.w(TAG, "Failed talking with device policy service", e);
1104 }
1105 }
1106 return null;
1107 }
1108
1109 /**
Andy Stadler22dbfda2011-01-17 12:47:31 -08001110 * Result code for {@link #setStorageEncryption} and {@link #getStorageEncryptionStatus}:
Andy Stadler7b0f8f02011-01-12 14:59:52 -08001111 * indicating that encryption is not supported.
1112 */
1113 public static final int ENCRYPTION_STATUS_UNSUPPORTED = 0;
1114
1115 /**
Andy Stadler22dbfda2011-01-17 12:47:31 -08001116 * Result code for {@link #setStorageEncryption} and {@link #getStorageEncryptionStatus}:
Andy Stadler7b0f8f02011-01-12 14:59:52 -08001117 * indicating that encryption is supported, but is not currently active.
1118 */
1119 public static final int ENCRYPTION_STATUS_INACTIVE = 1;
1120
1121 /**
Andy Stadler22dbfda2011-01-17 12:47:31 -08001122 * Result code for {@link #setStorageEncryption} and {@link #getStorageEncryptionStatus}:
Andy Stadler7b0f8f02011-01-12 14:59:52 -08001123 * indicating that encryption is not currently active, but is currently
1124 * being activated. This is only reported by devices that support
1125 * encryption of data and only when the storage is currently
1126 * undergoing a process of becoming encrypted. A device that must reboot and/or wipe data
1127 * to become encrypted will never return this value.
1128 */
Andy Stadler22dbfda2011-01-17 12:47:31 -08001129 public static final int ENCRYPTION_STATUS_ACTIVATING = 2;
Andy Stadler7b0f8f02011-01-12 14:59:52 -08001130
1131 /**
Andy Stadler22dbfda2011-01-17 12:47:31 -08001132 * Result code for {@link #setStorageEncryption} and {@link #getStorageEncryptionStatus}:
Andy Stadler7b0f8f02011-01-12 14:59:52 -08001133 * indicating that encryption is active.
1134 */
Andy Stadler22dbfda2011-01-17 12:47:31 -08001135 public static final int ENCRYPTION_STATUS_ACTIVE = 3;
Andy Stadler7b0f8f02011-01-12 14:59:52 -08001136
1137 /**
1138 * Activity action: begin the process of encrypting data on the device. This activity should
1139 * be launched after using {@link #setStorageEncryption} to request encryption be activated.
1140 * After resuming from this activity, use {@link #getStorageEncryption}
1141 * to check encryption status. However, on some devices this activity may never return, as
1142 * it may trigger a reboot and in some cases a complete data wipe of the device.
1143 */
1144 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1145 public static final String ACTION_START_ENCRYPTION
1146 = "android.app.action.START_ENCRYPTION";
1147
1148 /**
1149 * Called by an application that is administering the device to
Andy Stadler22dbfda2011-01-17 12:47:31 -08001150 * request that the storage system be encrypted.
Andy Stadler7b0f8f02011-01-12 14:59:52 -08001151 *
1152 * <p>When multiple device administrators attempt to control device
1153 * encryption, the most secure, supported setting will always be
1154 * used. If any device administrator requests device encryption,
1155 * it will be enabled; Conversely, if a device administrator
1156 * attempts to disable device encryption while another
1157 * device administrator has enabled it, the call to disable will
1158 * fail (most commonly returning {@link #ENCRYPTION_STATUS_ACTIVE}).
1159 *
1160 * <p>This policy controls encryption of the secure (application data) storage area. Data
Andy Stadler50c294f2011-03-07 19:13:42 -08001161 * written to other storage areas may or may not be encrypted, and this policy does not require
1162 * or control the encryption of any other storage areas.
1163 * There is one exception: If {@link android.os.Environment#isExternalStorageEmulated()} is
1164 * {@code true}, then the directory returned by
1165 * {@link android.os.Environment#getExternalStorageDirectory()} must be written to disk
1166 * within the encrypted storage area.
Andy Stadler7b0f8f02011-01-12 14:59:52 -08001167 *
1168 * <p>Important Note: On some devices, it is possible to encrypt storage without requiring
1169 * the user to create a device PIN or Password. In this case, the storage is encrypted, but
1170 * the encryption key may not be fully secured. For maximum security, the administrator should
1171 * also require (and check for) a pattern, PIN, or password.
1172 *
1173 * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
1174 * @param encrypt true to request encryption, false to release any previous request
Andy Stadler22dbfda2011-01-17 12:47:31 -08001175 * @return the new request status (for all active admins) - will be one of
1176 * {@link #ENCRYPTION_STATUS_UNSUPPORTED}, {@link #ENCRYPTION_STATUS_INACTIVE}, or
1177 * {@link #ENCRYPTION_STATUS_ACTIVE}. This is the value of the requests; Use
1178 * {@link #getStorageEncryptionStatus()} to query the actual device state.
Andy Stadler7b0f8f02011-01-12 14:59:52 -08001179 */
1180 public int setStorageEncryption(ComponentName admin, boolean encrypt) {
1181 if (mService != null) {
1182 try {
1183 return mService.setStorageEncryption(admin, encrypt);
1184 } catch (RemoteException e) {
1185 Log.w(TAG, "Failed talking with device policy service", e);
1186 }
1187 }
1188 return ENCRYPTION_STATUS_UNSUPPORTED;
1189 }
1190
1191 /**
1192 * Called by an application that is administering the device to
Andy Stadler22dbfda2011-01-17 12:47:31 -08001193 * determine the requested setting for secure storage.
Andy Stadler7b0f8f02011-01-12 14:59:52 -08001194 *
Andy Stadler22dbfda2011-01-17 12:47:31 -08001195 * @param admin Which {@link DeviceAdminReceiver} this request is associated with. If null,
1196 * this will return the requested encryption setting as an aggregate of all active
1197 * administrators.
1198 * @return true if the admin(s) are requesting encryption, false if not.
Andy Stadler7b0f8f02011-01-12 14:59:52 -08001199 */
Andy Stadler22dbfda2011-01-17 12:47:31 -08001200 public boolean getStorageEncryption(ComponentName admin) {
Andy Stadler7b0f8f02011-01-12 14:59:52 -08001201 if (mService != null) {
1202 try {
1203 return mService.getStorageEncryption(admin);
1204 } catch (RemoteException e) {
1205 Log.w(TAG, "Failed talking with device policy service", e);
1206 }
1207 }
Andy Stadler22dbfda2011-01-17 12:47:31 -08001208 return false;
1209 }
1210
1211 /**
1212 * Called by an application that is administering the device to
1213 * determine the current encryption status of the device.
1214 *
1215 * Depending on the returned status code, the caller may proceed in different
1216 * ways. If the result is {@link #ENCRYPTION_STATUS_UNSUPPORTED}, the
1217 * storage system does not support encryption. If the
1218 * result is {@link #ENCRYPTION_STATUS_INACTIVE}, use {@link
1219 * #ACTION_START_ENCRYPTION} to begin the process of encrypting or decrypting the
1220 * storage. If the result is {@link #ENCRYPTION_STATUS_ACTIVATING} or
1221 * {@link #ENCRYPTION_STATUS_ACTIVE}, no further action is required.
1222 *
1223 * @return current status of encryption. The value will be one of
1224 * {@link #ENCRYPTION_STATUS_UNSUPPORTED}, {@link #ENCRYPTION_STATUS_INACTIVE},
1225 * {@link #ENCRYPTION_STATUS_ACTIVATING}, or{@link #ENCRYPTION_STATUS_ACTIVE}.
1226 */
1227 public int getStorageEncryptionStatus() {
1228 if (mService != null) {
1229 try {
1230 return mService.getStorageEncryptionStatus();
1231 } catch (RemoteException e) {
1232 Log.w(TAG, "Failed talking with device policy service", e);
1233 }
1234 }
Andy Stadler7b0f8f02011-01-12 14:59:52 -08001235 return ENCRYPTION_STATUS_UNSUPPORTED;
1236 }
1237
1238 /**
Ben Komalo2447edd2011-05-09 16:05:33 -07001239 * Called by an application that is administering the device to disable all cameras
1240 * on the device. After setting this, no applications will be able to access any cameras
1241 * on the device.
1242 *
1243 * <p>The calling device admin must have requested
1244 * {@link DeviceAdminInfo#USES_POLICY_DISABLE_CAMERA} to be able to call
1245 * this method; if it has not, a security exception will be thrown.
1246 *
1247 * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
1248 * @param disabled Whether or not the camera should be disabled.
1249 */
1250 public void setCameraDisabled(ComponentName admin, boolean disabled) {
1251 if (mService != null) {
1252 try {
1253 mService.setCameraDisabled(admin, disabled);
1254 } catch (RemoteException e) {
1255 Log.w(TAG, "Failed talking with device policy service", e);
1256 }
1257 }
1258 }
1259
1260 /**
1261 * Determine whether or not the device's cameras have been disabled either by the current
1262 * admin, if specified, or all admins.
1263 * @param admin The name of the admin component to check, or null to check if any admins
1264 * have disabled the camera
1265 */
1266 public boolean getCameraDisabled(ComponentName admin) {
1267 if (mService != null) {
1268 try {
1269 return mService.getCameraDisabled(admin);
1270 } catch (RemoteException e) {
1271 Log.w(TAG, "Failed talking with device policy service", e);
1272 }
1273 }
1274 return false;
1275 }
1276
1277 /**
Dianne Hackbornd6847842010-01-12 18:14:19 -08001278 * @hide
1279 */
Andy Stadlerc25f70a2010-12-08 15:56:45 -08001280 public void setActiveAdmin(ComponentName policyReceiver, boolean refreshing) {
Dianne Hackbornd6847842010-01-12 18:14:19 -08001281 if (mService != null) {
1282 try {
Andy Stadlerc25f70a2010-12-08 15:56:45 -08001283 mService.setActiveAdmin(policyReceiver, refreshing);
Dianne Hackbornd6847842010-01-12 18:14:19 -08001284 } catch (RemoteException e) {
1285 Log.w(TAG, "Failed talking with device policy service", e);
1286 }
1287 }
1288 }
Konstantin Lopyrev32558232010-05-20 16:18:05 -07001289
Dianne Hackbornd6847842010-01-12 18:14:19 -08001290 /**
Andy Stadlerc25f70a2010-12-08 15:56:45 -08001291 * Returns the DeviceAdminInfo as defined by the administrator's package info & meta-data
Dianne Hackbornd6847842010-01-12 18:14:19 -08001292 * @hide
1293 */
Dianne Hackbornd47c6ed2010-01-27 16:21:20 -08001294 public DeviceAdminInfo getAdminInfo(ComponentName cn) {
Dianne Hackbornd6847842010-01-12 18:14:19 -08001295 ActivityInfo ai;
1296 try {
1297 ai = mContext.getPackageManager().getReceiverInfo(cn,
1298 PackageManager.GET_META_DATA);
1299 } catch (PackageManager.NameNotFoundException e) {
1300 Log.w(TAG, "Unable to retrieve device policy " + cn, e);
1301 return null;
1302 }
Konstantin Lopyrev32558232010-05-20 16:18:05 -07001303
Dianne Hackbornd6847842010-01-12 18:14:19 -08001304 ResolveInfo ri = new ResolveInfo();
1305 ri.activityInfo = ai;
Konstantin Lopyrev32558232010-05-20 16:18:05 -07001306
Dianne Hackbornd6847842010-01-12 18:14:19 -08001307 try {
1308 return new DeviceAdminInfo(mContext, ri);
1309 } catch (XmlPullParserException e) {
1310 Log.w(TAG, "Unable to parse device policy " + cn, e);
1311 return null;
1312 } catch (IOException e) {
1313 Log.w(TAG, "Unable to parse device policy " + cn, e);
1314 return null;
1315 }
1316 }
Konstantin Lopyrev32558232010-05-20 16:18:05 -07001317
Dianne Hackbornd6847842010-01-12 18:14:19 -08001318 /**
1319 * @hide
1320 */
Dianne Hackborn8ea138c2010-01-26 18:01:04 -08001321 public void getRemoveWarning(ComponentName admin, RemoteCallback result) {
1322 if (mService != null) {
1323 try {
1324 mService.getRemoveWarning(admin, result);
1325 } catch (RemoteException e) {
1326 Log.w(TAG, "Failed talking with device policy service", e);
1327 }
1328 }
1329 }
1330
1331 /**
1332 * @hide
1333 */
Konstantin Lopyreva15dcfa2010-05-24 17:10:56 -07001334 public void setActivePasswordState(int quality, int length, int letters, int uppercase,
Konstantin Lopyrevc8577402010-06-04 17:15:02 -07001335 int lowercase, int numbers, int symbols, int nonletter) {
Dianne Hackbornd6847842010-01-12 18:14:19 -08001336 if (mService != null) {
1337 try {
Konstantin Lopyreva15dcfa2010-05-24 17:10:56 -07001338 mService.setActivePasswordState(quality, length, letters, uppercase, lowercase,
Konstantin Lopyrevc8577402010-06-04 17:15:02 -07001339 numbers, symbols, nonletter);
Dianne Hackbornd6847842010-01-12 18:14:19 -08001340 } catch (RemoteException e) {
1341 Log.w(TAG, "Failed talking with device policy service", e);
1342 }
1343 }
1344 }
Konstantin Lopyrev32558232010-05-20 16:18:05 -07001345
Dianne Hackbornd6847842010-01-12 18:14:19 -08001346 /**
1347 * @hide
1348 */
1349 public void reportFailedPasswordAttempt() {
1350 if (mService != null) {
1351 try {
1352 mService.reportFailedPasswordAttempt();
1353 } catch (RemoteException e) {
1354 Log.w(TAG, "Failed talking with device policy service", e);
1355 }
1356 }
1357 }
Konstantin Lopyrev32558232010-05-20 16:18:05 -07001358
Dianne Hackbornd6847842010-01-12 18:14:19 -08001359 /**
1360 * @hide
1361 */
1362 public void reportSuccessfulPasswordAttempt() {
1363 if (mService != null) {
1364 try {
1365 mService.reportSuccessfulPasswordAttempt();
1366 } catch (RemoteException e) {
1367 Log.w(TAG, "Failed talking with device policy service", e);
1368 }
1369 }
1370 }
Oscar Montemayor69238c62010-08-03 10:51:06 -07001371
Dianne Hackbornd6847842010-01-12 18:14:19 -08001372}