Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 1 | /* |
| 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 Hackborn | 87bba1e | 2010-02-26 17:25:54 -0800 | [diff] [blame] | 17 | package android.app.admin; |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 18 | |
| 19 | import org.xmlpull.v1.XmlPullParserException; |
| 20 | |
| 21 | import android.annotation.SdkConstant; |
| 22 | import android.annotation.SdkConstant.SdkConstantType; |
| 23 | import android.content.ComponentName; |
| 24 | import android.content.Context; |
| 25 | import android.content.pm.ActivityInfo; |
| 26 | import android.content.pm.PackageManager; |
| 27 | import android.content.pm.ResolveInfo; |
| 28 | import android.os.Handler; |
Dianne Hackborn | 8ea138c | 2010-01-26 18:01:04 -0800 | [diff] [blame] | 29 | import android.os.RemoteCallback; |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 30 | import android.os.RemoteException; |
| 31 | import android.os.ServiceManager; |
| 32 | import android.util.Log; |
| 33 | |
| 34 | import java.io.IOException; |
Dianne Hackborn | d47c6ed | 2010-01-27 16:21:20 -0800 | [diff] [blame] | 35 | import java.util.List; |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 36 | |
| 37 | /** |
| 38 | * Public interface for managing policies enforced on a device. Most clients |
Dianne Hackborn | ef6b22f | 2010-02-16 20:38:49 -0800 | [diff] [blame] | 39 | * of this class must have published a {@link DeviceAdminReceiver} that the user |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 40 | * has currently enabled. |
| 41 | */ |
| 42 | public class DevicePolicyManager { |
| 43 | private static String TAG = "DevicePolicyManager"; |
| 44 | private static boolean DEBUG = false; |
| 45 | private static boolean localLOGV = DEBUG || android.util.Config.LOGV; |
| 46 | |
| 47 | private final Context mContext; |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 48 | private final IDevicePolicyManager mService; |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 49 | |
Dianne Hackborn | 8ea138c | 2010-01-26 18:01:04 -0800 | [diff] [blame] | 50 | private final Handler mHandler; |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 51 | |
Dianne Hackborn | 21f1bd1 | 2010-02-19 17:02:21 -0800 | [diff] [blame] | 52 | private DevicePolicyManager(Context context, Handler handler) { |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 53 | mContext = context; |
| 54 | mHandler = handler; |
| 55 | mService = IDevicePolicyManager.Stub.asInterface( |
| 56 | ServiceManager.getService(Context.DEVICE_POLICY_SERVICE)); |
| 57 | } |
| 58 | |
Dianne Hackborn | 87bba1e | 2010-02-26 17:25:54 -0800 | [diff] [blame] | 59 | /** @hide */ |
| 60 | public static DevicePolicyManager create(Context context, Handler handler) { |
Dianne Hackborn | 21f1bd1 | 2010-02-19 17:02:21 -0800 | [diff] [blame] | 61 | DevicePolicyManager me = new DevicePolicyManager(context, handler); |
| 62 | return me.mService != null ? me : null; |
| 63 | } |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 64 | |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 65 | /** |
| 66 | * Activity action: ask the user to add a new device administrator to the system. |
| 67 | * The desired policy is the ComponentName of the policy in the |
| 68 | * {@link #EXTRA_DEVICE_ADMIN} extra field. This will invoke a UI to |
| 69 | * bring the user through adding the device administrator to the system (or |
| 70 | * allowing them to reject it). |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 71 | * |
Dianne Hackborn | 8ea138c | 2010-01-26 18:01:04 -0800 | [diff] [blame] | 72 | * <p>You can optionally include the {@link #EXTRA_ADD_EXPLANATION} |
| 73 | * field to provide the user with additional explanation (in addition |
| 74 | * to your component's description) about what is being added. |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 75 | */ |
| 76 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 77 | public static final String ACTION_ADD_DEVICE_ADMIN |
| 78 | = "android.app.action.ADD_DEVICE_ADMIN"; |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 79 | |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 80 | /** |
Jim Miller | 284b62e | 2010-06-08 14:27:42 -0700 | [diff] [blame] | 81 | * Activity action: send when any policy admin changes a policy. |
| 82 | * This is generally used to find out when a new policy is in effect. |
| 83 | * |
| 84 | * @hide |
| 85 | */ |
| 86 | public static final String ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED |
| 87 | = "android.app.action.DEVICE_POLICY_MANAGER_STATE_CHANGED"; |
| 88 | |
| 89 | /** |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 90 | * The ComponentName of the administrator component. |
| 91 | * |
| 92 | * @see #ACTION_ADD_DEVICE_ADMIN |
| 93 | */ |
| 94 | public static final String EXTRA_DEVICE_ADMIN = "android.app.extra.DEVICE_ADMIN"; |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 95 | |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 96 | /** |
Dianne Hackborn | 8ea138c | 2010-01-26 18:01:04 -0800 | [diff] [blame] | 97 | * An optional CharSequence providing additional explanation for why the |
| 98 | * admin is being added. |
| 99 | * |
| 100 | * @see #ACTION_ADD_DEVICE_ADMIN |
| 101 | */ |
| 102 | public static final String EXTRA_ADD_EXPLANATION = "android.app.extra.ADD_EXPLANATION"; |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 103 | |
Dianne Hackborn | 8ea138c | 2010-01-26 18:01:04 -0800 | [diff] [blame] | 104 | /** |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 105 | * Activity action: have the user enter a new password. This activity should |
| 106 | * be launched after using {@link #setPasswordQuality(ComponentName, int)}, |
| 107 | * or {@link #setPasswordMinimumLength(ComponentName, int)} to have the user |
| 108 | * enter a new password that meets the current requirements. You can use |
| 109 | * {@link #isActivePasswordSufficient()} to determine whether you need to |
| 110 | * have the user select a new password in order to meet the current |
| 111 | * constraints. Upon being resumed from this activity, you can check the new |
| 112 | * password characteristics to see if they are sufficient. |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 113 | */ |
| 114 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 115 | public static final String ACTION_SET_NEW_PASSWORD |
| 116 | = "android.app.action.SET_NEW_PASSWORD"; |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 117 | |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 118 | /** |
| 119 | * Return true if the given administrator component is currently |
| 120 | * active (enabled) in the system. |
| 121 | */ |
| 122 | public boolean isAdminActive(ComponentName who) { |
| 123 | if (mService != null) { |
| 124 | try { |
Dianne Hackborn | d47c6ed | 2010-01-27 16:21:20 -0800 | [diff] [blame] | 125 | return mService.isAdminActive(who); |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 126 | } catch (RemoteException e) { |
| 127 | Log.w(TAG, "Failed talking with device policy service", e); |
| 128 | } |
| 129 | } |
| 130 | return false; |
| 131 | } |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 132 | |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 133 | /** |
Dianne Hackborn | d47c6ed | 2010-01-27 16:21:20 -0800 | [diff] [blame] | 134 | * Return a list of all currently active device administrator's component |
| 135 | * names. Note that if there are no administrators than null may be |
| 136 | * returned. |
| 137 | */ |
| 138 | public List<ComponentName> getActiveAdmins() { |
| 139 | if (mService != null) { |
| 140 | try { |
| 141 | return mService.getActiveAdmins(); |
| 142 | } catch (RemoteException e) { |
| 143 | Log.w(TAG, "Failed talking with device policy service", e); |
| 144 | } |
| 145 | } |
| 146 | return null; |
| 147 | } |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 148 | |
Dianne Hackborn | d47c6ed | 2010-01-27 16:21:20 -0800 | [diff] [blame] | 149 | /** |
Dianne Hackborn | 21f1bd1 | 2010-02-19 17:02:21 -0800 | [diff] [blame] | 150 | * @hide |
| 151 | */ |
| 152 | public boolean packageHasActiveAdmins(String packageName) { |
| 153 | if (mService != null) { |
| 154 | try { |
| 155 | return mService.packageHasActiveAdmins(packageName); |
| 156 | } catch (RemoteException e) { |
| 157 | Log.w(TAG, "Failed talking with device policy service", e); |
| 158 | } |
| 159 | } |
| 160 | return false; |
| 161 | } |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 162 | |
Dianne Hackborn | 21f1bd1 | 2010-02-19 17:02:21 -0800 | [diff] [blame] | 163 | /** |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 164 | * Remove a current administration component. This can only be called |
| 165 | * by the application that owns the administration component; if you |
| 166 | * try to remove someone else's component, a security exception will be |
| 167 | * thrown. |
| 168 | */ |
| 169 | public void removeActiveAdmin(ComponentName who) { |
| 170 | if (mService != null) { |
| 171 | try { |
| 172 | mService.removeActiveAdmin(who); |
| 173 | } catch (RemoteException e) { |
| 174 | Log.w(TAG, "Failed talking with device policy service", e); |
| 175 | } |
| 176 | } |
| 177 | } |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 178 | |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 179 | /** |
Dianne Hackborn | 9327f4f | 2010-01-29 10:38:29 -0800 | [diff] [blame] | 180 | * Constant for {@link #setPasswordQuality}: the policy has no requirements |
| 181 | * for the password. Note that quality constants are ordered so that higher |
Dianne Hackborn | df83afa | 2010-01-20 13:37:26 -0800 | [diff] [blame] | 182 | * values are more restrictive. |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 183 | */ |
Dianne Hackborn | 9327f4f | 2010-01-29 10:38:29 -0800 | [diff] [blame] | 184 | public static final int PASSWORD_QUALITY_UNSPECIFIED = 0; |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 185 | |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 186 | /** |
Dianne Hackborn | 9327f4f | 2010-01-29 10:38:29 -0800 | [diff] [blame] | 187 | * Constant for {@link #setPasswordQuality}: the policy requires some kind |
| 188 | * of password, but doesn't care what it is. Note that quality constants |
Dianne Hackborn | df83afa | 2010-01-20 13:37:26 -0800 | [diff] [blame] | 189 | * are ordered so that higher values are more restrictive. |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 190 | */ |
Dianne Hackborn | 9327f4f | 2010-01-29 10:38:29 -0800 | [diff] [blame] | 191 | public static final int PASSWORD_QUALITY_SOMETHING = 0x10000; |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 192 | |
Dianne Hackborn | df83afa | 2010-01-20 13:37:26 -0800 | [diff] [blame] | 193 | /** |
Dianne Hackborn | 9327f4f | 2010-01-29 10:38:29 -0800 | [diff] [blame] | 194 | * Constant for {@link #setPasswordQuality}: the user must have entered a |
| 195 | * password containing at least numeric characters. Note that quality |
| 196 | * constants are ordered so that higher values are more restrictive. |
Dianne Hackborn | df83afa | 2010-01-20 13:37:26 -0800 | [diff] [blame] | 197 | */ |
Dianne Hackborn | 9327f4f | 2010-01-29 10:38:29 -0800 | [diff] [blame] | 198 | public static final int PASSWORD_QUALITY_NUMERIC = 0x20000; |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 199 | |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 200 | /** |
Dianne Hackborn | 9327f4f | 2010-01-29 10:38:29 -0800 | [diff] [blame] | 201 | * Constant for {@link #setPasswordQuality}: the user must have entered a |
Dianne Hackborn | 85f2c9c | 2010-03-22 11:12:48 -0700 | [diff] [blame] | 202 | * password containing at least alphabetic (or other symbol) characters. |
| 203 | * Note that quality constants are ordered so that higher values are more |
| 204 | * restrictive. |
| 205 | */ |
| 206 | public static final int PASSWORD_QUALITY_ALPHABETIC = 0x40000; |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 207 | |
Dianne Hackborn | 85f2c9c | 2010-03-22 11:12:48 -0700 | [diff] [blame] | 208 | /** |
| 209 | * Constant for {@link #setPasswordQuality}: the user must have entered a |
Dianne Hackborn | 9327f4f | 2010-01-29 10:38:29 -0800 | [diff] [blame] | 210 | * password containing at least <em>both></em> numeric <em>and</em> |
Dianne Hackborn | 85f2c9c | 2010-03-22 11:12:48 -0700 | [diff] [blame] | 211 | * alphabetic (or other symbol) characters. Note that quality constants are |
Dianne Hackborn | 9327f4f | 2010-01-29 10:38:29 -0800 | [diff] [blame] | 212 | * ordered so that higher values are more restrictive. |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 213 | */ |
Dianne Hackborn | 85f2c9c | 2010-03-22 11:12:48 -0700 | [diff] [blame] | 214 | public static final int PASSWORD_QUALITY_ALPHANUMERIC = 0x50000; |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 215 | |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 216 | /** |
Konstantin Lopyrev | a15dcfa | 2010-05-24 17:10:56 -0700 | [diff] [blame] | 217 | * Constant for {@link #setPasswordQuality}: the user must have entered a |
Konstantin Lopyrev | c857740 | 2010-06-04 17:15:02 -0700 | [diff] [blame^] | 218 | * password containing at least a letter, a numerical digit and a special |
| 219 | * symbol, by default. With this password quality, passwords can be |
| 220 | * restricted to contain various sets of characters, like at least an |
| 221 | * uppercase letter, etc. These are specified using various methods, |
| 222 | * like {@link #setPasswordMinimumLowerCase(ComponentName, int)}. Note |
| 223 | * that quality constants are ordered so that higher values are more |
| 224 | * restrictive. |
Konstantin Lopyrev | a15dcfa | 2010-05-24 17:10:56 -0700 | [diff] [blame] | 225 | */ |
| 226 | public static final int PASSWORD_QUALITY_COMPLEX = 0x60000; |
| 227 | |
| 228 | /** |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 229 | * Called by an application that is administering the device to set the |
| 230 | * password restrictions it is imposing. After setting this, the user |
| 231 | * will not be able to enter a new password that is not at least as |
| 232 | * restrictive as what has been set. Note that the current password |
| 233 | * will remain until the user has set a new one, so the change does not |
| 234 | * take place immediately. To prompt the user for a new password, use |
| 235 | * {@link #ACTION_SET_NEW_PASSWORD} after setting this value. |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 236 | * |
Dianne Hackborn | 9327f4f | 2010-01-29 10:38:29 -0800 | [diff] [blame] | 237 | * <p>Quality constants are ordered so that higher values are more restrictive; |
| 238 | * thus the highest requested quality constant (between the policy set here, |
Dianne Hackborn | df83afa | 2010-01-20 13:37:26 -0800 | [diff] [blame] | 239 | * the user's preference, and any other considerations) is the one that |
| 240 | * is in effect. |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 241 | * |
Dianne Hackborn | 8aa2e89 | 2010-01-22 11:31:30 -0800 | [diff] [blame] | 242 | * <p>The calling device admin must have requested |
| 243 | * {@link DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD} to be able to call |
| 244 | * this method; if it has not, a security exception will be thrown. |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 245 | * |
Dianne Hackborn | ef6b22f | 2010-02-16 20:38:49 -0800 | [diff] [blame] | 246 | * @param admin Which {@link DeviceAdminReceiver} this request is associated with. |
Dianne Hackborn | 9327f4f | 2010-01-29 10:38:29 -0800 | [diff] [blame] | 247 | * @param quality The new desired quality. One of |
| 248 | * {@link #PASSWORD_QUALITY_UNSPECIFIED}, {@link #PASSWORD_QUALITY_SOMETHING}, |
Dianne Hackborn | 85f2c9c | 2010-03-22 11:12:48 -0700 | [diff] [blame] | 249 | * {@link #PASSWORD_QUALITY_NUMERIC}, {@link #PASSWORD_QUALITY_ALPHABETIC}, |
Konstantin Lopyrev | a15dcfa | 2010-05-24 17:10:56 -0700 | [diff] [blame] | 250 | * {@link #PASSWORD_QUALITY_ALPHANUMERIC} or {@link #PASSWORD_QUALITY_COMPLEX}. |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 251 | */ |
Dianne Hackborn | 9327f4f | 2010-01-29 10:38:29 -0800 | [diff] [blame] | 252 | public void setPasswordQuality(ComponentName admin, int quality) { |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 253 | if (mService != null) { |
| 254 | try { |
Dianne Hackborn | 9327f4f | 2010-01-29 10:38:29 -0800 | [diff] [blame] | 255 | mService.setPasswordQuality(admin, quality); |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 256 | } catch (RemoteException e) { |
| 257 | Log.w(TAG, "Failed talking with device policy service", e); |
| 258 | } |
| 259 | } |
| 260 | } |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 261 | |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 262 | /** |
Dianne Hackborn | 9327f4f | 2010-01-29 10:38:29 -0800 | [diff] [blame] | 263 | * Retrieve the current minimum password quality for all admins |
Dianne Hackborn | 254cb44 | 2010-01-27 19:23:59 -0800 | [diff] [blame] | 264 | * or a particular one. |
| 265 | * @param admin The name of the admin component to check, or null to aggregate |
| 266 | * all admins. |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 267 | */ |
Dianne Hackborn | 9327f4f | 2010-01-29 10:38:29 -0800 | [diff] [blame] | 268 | public int getPasswordQuality(ComponentName admin) { |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 269 | if (mService != null) { |
| 270 | try { |
Dianne Hackborn | 9327f4f | 2010-01-29 10:38:29 -0800 | [diff] [blame] | 271 | return mService.getPasswordQuality(admin); |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 272 | } catch (RemoteException e) { |
| 273 | Log.w(TAG, "Failed talking with device policy service", e); |
| 274 | } |
| 275 | } |
Dianne Hackborn | 9327f4f | 2010-01-29 10:38:29 -0800 | [diff] [blame] | 276 | return PASSWORD_QUALITY_UNSPECIFIED; |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 277 | } |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 278 | |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 279 | /** |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 280 | * Called by an application that is administering the device to set the |
| 281 | * minimum allowed password length. After setting this, the user |
| 282 | * will not be able to enter a new password that is not at least as |
| 283 | * restrictive as what has been set. Note that the current password |
| 284 | * will remain until the user has set a new one, so the change does not |
| 285 | * take place immediately. To prompt the user for a new password, use |
| 286 | * {@link #ACTION_SET_NEW_PASSWORD} after setting this value. This |
| 287 | * constraint is only imposed if the administrator has also requested either |
Konstantin Lopyrev | a15dcfa | 2010-05-24 17:10:56 -0700 | [diff] [blame] | 288 | * {@link #PASSWORD_QUALITY_NUMERIC}, {@link #PASSWORD_QUALITY_ALPHABETIC} |
| 289 | * {@link #PASSWORD_QUALITY_ALPHANUMERIC}, or {@link #PASSWORD_QUALITY_COMPLEX} |
Dianne Hackborn | 9327f4f | 2010-01-29 10:38:29 -0800 | [diff] [blame] | 290 | * with {@link #setPasswordQuality}. |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 291 | * |
Dianne Hackborn | 8aa2e89 | 2010-01-22 11:31:30 -0800 | [diff] [blame] | 292 | * <p>The calling device admin must have requested |
| 293 | * {@link DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD} to be able to call |
| 294 | * this method; if it has not, a security exception will be thrown. |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 295 | * |
Dianne Hackborn | ef6b22f | 2010-02-16 20:38:49 -0800 | [diff] [blame] | 296 | * @param admin Which {@link DeviceAdminReceiver} this request is associated with. |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 297 | * @param length The new desired minimum password length. A value of 0 |
| 298 | * means there is no restriction. |
| 299 | */ |
Dianne Hackborn | 254cb44 | 2010-01-27 19:23:59 -0800 | [diff] [blame] | 300 | public void setPasswordMinimumLength(ComponentName admin, int length) { |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 301 | if (mService != null) { |
| 302 | try { |
Dianne Hackborn | 254cb44 | 2010-01-27 19:23:59 -0800 | [diff] [blame] | 303 | mService.setPasswordMinimumLength(admin, length); |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 304 | } catch (RemoteException e) { |
| 305 | Log.w(TAG, "Failed talking with device policy service", e); |
| 306 | } |
| 307 | } |
| 308 | } |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 309 | |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 310 | /** |
Dianne Hackborn | 254cb44 | 2010-01-27 19:23:59 -0800 | [diff] [blame] | 311 | * Retrieve the current minimum password length for all admins |
| 312 | * or a particular one. |
| 313 | * @param admin The name of the admin component to check, or null to aggregate |
| 314 | * all admins. |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 315 | */ |
Dianne Hackborn | 254cb44 | 2010-01-27 19:23:59 -0800 | [diff] [blame] | 316 | public int getPasswordMinimumLength(ComponentName admin) { |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 317 | if (mService != null) { |
| 318 | try { |
Dianne Hackborn | 254cb44 | 2010-01-27 19:23:59 -0800 | [diff] [blame] | 319 | return mService.getPasswordMinimumLength(admin); |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 320 | } catch (RemoteException e) { |
| 321 | Log.w(TAG, "Failed talking with device policy service", e); |
| 322 | } |
| 323 | } |
| 324 | return 0; |
| 325 | } |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 326 | |
Konstantin Lopyrev | a15dcfa | 2010-05-24 17:10:56 -0700 | [diff] [blame] | 327 | /** |
| 328 | * Called by an application that is administering the device to set the |
| 329 | * minimum number of upper case letters required in the password. After |
| 330 | * setting this, the user will not be able to enter a new password that is |
| 331 | * not at least as restrictive as what has been set. Note that the current |
| 332 | * password will remain until the user has set a new one, so the change does |
| 333 | * not take place immediately. To prompt the user for a new password, use |
| 334 | * {@link #ACTION_SET_NEW_PASSWORD} after setting this value. This |
| 335 | * constraint is only imposed if the administrator has also requested |
Konstantin Lopyrev | c857740 | 2010-06-04 17:15:02 -0700 | [diff] [blame^] | 336 | * {@link #PASSWORD_QUALITY_COMPLEX} with {@link #setPasswordQuality}. The |
| 337 | * default value is 0. |
Konstantin Lopyrev | a15dcfa | 2010-05-24 17:10:56 -0700 | [diff] [blame] | 338 | * <p> |
| 339 | * The calling device admin must have requested |
| 340 | * {@link DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD} to be able to call |
| 341 | * this method; if it has not, a security exception will be thrown. |
| 342 | * |
| 343 | * @param admin Which {@link DeviceAdminReceiver} this request is associated |
| 344 | * with. |
| 345 | * @param length The new desired minimum number of upper case letters |
| 346 | * required in the password. A value of 0 means there is no |
| 347 | * restriction. |
| 348 | */ |
| 349 | public void setPasswordMinimumUpperCase(ComponentName admin, int length) { |
| 350 | if (mService != null) { |
| 351 | try { |
| 352 | mService.setPasswordMinimumUpperCase(admin, length); |
| 353 | } catch (RemoteException e) { |
| 354 | Log.w(TAG, "Failed talking with device policy service", e); |
| 355 | } |
| 356 | } |
| 357 | } |
| 358 | |
| 359 | /** |
| 360 | * Retrieve the current number of upper case letters required in the |
Konstantin Lopyrev | c857740 | 2010-06-04 17:15:02 -0700 | [diff] [blame^] | 361 | * password for all admins or a particular one. This is the same value as |
| 362 | * set by {#link {@link #setPasswordMinimumUpperCase(ComponentName, int)} |
| 363 | * and only applies when the password quality is |
| 364 | * {@link #PASSWORD_QUALITY_COMPLEX}. |
Konstantin Lopyrev | a15dcfa | 2010-05-24 17:10:56 -0700 | [diff] [blame] | 365 | * |
| 366 | * @param admin The name of the admin component to check, or null to |
| 367 | * aggregate all admins. |
| 368 | * @return The minimum number of upper case letters required in the |
| 369 | * password. |
| 370 | */ |
| 371 | public int getPasswordMinimumUpperCase(ComponentName admin) { |
| 372 | if (mService != null) { |
| 373 | try { |
| 374 | return mService.getPasswordMinimumUpperCase(admin); |
| 375 | } catch (RemoteException e) { |
| 376 | Log.w(TAG, "Failed talking with device policy service", e); |
| 377 | } |
| 378 | } |
| 379 | return 0; |
| 380 | } |
| 381 | |
| 382 | /** |
| 383 | * Called by an application that is administering the device to set the |
| 384 | * minimum number of lower case letters required in the password. After |
| 385 | * setting this, the user will not be able to enter a new password that is |
| 386 | * not at least as restrictive as what has been set. Note that the current |
| 387 | * password will remain until the user has set a new one, so the change does |
| 388 | * not take place immediately. To prompt the user for a new password, use |
| 389 | * {@link #ACTION_SET_NEW_PASSWORD} after setting this value. This |
| 390 | * constraint is only imposed if the administrator has also requested |
Konstantin Lopyrev | c857740 | 2010-06-04 17:15:02 -0700 | [diff] [blame^] | 391 | * {@link #PASSWORD_QUALITY_COMPLEX} with {@link #setPasswordQuality}. The |
| 392 | * default value is 0. |
Konstantin Lopyrev | a15dcfa | 2010-05-24 17:10:56 -0700 | [diff] [blame] | 393 | * <p> |
| 394 | * The calling device admin must have requested |
| 395 | * {@link DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD} to be able to call |
| 396 | * this method; if it has not, a security exception will be thrown. |
| 397 | * |
| 398 | * @param admin Which {@link DeviceAdminReceiver} this request is associated |
| 399 | * with. |
| 400 | * @param length The new desired minimum number of lower case letters |
| 401 | * required in the password. A value of 0 means there is no |
| 402 | * restriction. |
| 403 | */ |
| 404 | public void setPasswordMinimumLowerCase(ComponentName admin, int length) { |
| 405 | if (mService != null) { |
| 406 | try { |
| 407 | mService.setPasswordMinimumLowerCase(admin, length); |
| 408 | } catch (RemoteException e) { |
| 409 | Log.w(TAG, "Failed talking with device policy service", e); |
| 410 | } |
| 411 | } |
| 412 | } |
| 413 | |
| 414 | /** |
| 415 | * Retrieve the current number of lower case letters required in the |
Konstantin Lopyrev | c857740 | 2010-06-04 17:15:02 -0700 | [diff] [blame^] | 416 | * password for all admins or a particular one. This is the same value as |
| 417 | * set by {#link {@link #setPasswordMinimumLowerCase(ComponentName, int)} |
| 418 | * and only applies when the password quality is |
| 419 | * {@link #PASSWORD_QUALITY_COMPLEX}. |
Konstantin Lopyrev | a15dcfa | 2010-05-24 17:10:56 -0700 | [diff] [blame] | 420 | * |
| 421 | * @param admin The name of the admin component to check, or null to |
| 422 | * aggregate all admins. |
| 423 | * @return The minimum number of lower case letters required in the |
| 424 | * password. |
| 425 | */ |
| 426 | public int getPasswordMinimumLowerCase(ComponentName admin) { |
| 427 | if (mService != null) { |
| 428 | try { |
| 429 | return mService.getPasswordMinimumLowerCase(admin); |
| 430 | } catch (RemoteException e) { |
| 431 | Log.w(TAG, "Failed talking with device policy service", e); |
| 432 | } |
| 433 | } |
| 434 | return 0; |
| 435 | } |
| 436 | |
| 437 | /** |
| 438 | * Called by an application that is administering the device to set the |
| 439 | * minimum number of letters required in the password. After setting this, |
| 440 | * the user will not be able to enter a new password that is not at least as |
| 441 | * restrictive as what has been set. Note that the current password will |
| 442 | * remain until the user has set a new one, so the change does not take |
| 443 | * place immediately. To prompt the user for a new password, use |
| 444 | * {@link #ACTION_SET_NEW_PASSWORD} after setting this value. This |
| 445 | * constraint is only imposed if the administrator has also requested |
Konstantin Lopyrev | c857740 | 2010-06-04 17:15:02 -0700 | [diff] [blame^] | 446 | * {@link #PASSWORD_QUALITY_COMPLEX} with {@link #setPasswordQuality}. The |
| 447 | * default value is 1. |
Konstantin Lopyrev | a15dcfa | 2010-05-24 17:10:56 -0700 | [diff] [blame] | 448 | * <p> |
| 449 | * The calling device admin must have requested |
| 450 | * {@link DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD} to be able to call |
| 451 | * this method; if it has not, a security exception will be thrown. |
| 452 | * |
| 453 | * @param admin Which {@link DeviceAdminReceiver} this request is associated |
| 454 | * with. |
| 455 | * @param length The new desired minimum number of letters required in the |
| 456 | * password. A value of 0 means there is no restriction. |
| 457 | */ |
| 458 | public void setPasswordMinimumLetters(ComponentName admin, int length) { |
| 459 | if (mService != null) { |
| 460 | try { |
| 461 | mService.setPasswordMinimumLetters(admin, length); |
| 462 | } catch (RemoteException e) { |
| 463 | Log.w(TAG, "Failed talking with device policy service", e); |
| 464 | } |
| 465 | } |
| 466 | } |
| 467 | |
| 468 | /** |
| 469 | * Retrieve the current number of letters required in the password for all |
Konstantin Lopyrev | c857740 | 2010-06-04 17:15:02 -0700 | [diff] [blame^] | 470 | * admins or a particular one. This is the same value as |
| 471 | * set by {#link {@link #setPasswordMinimumLetters(ComponentName, int)} |
| 472 | * and only applies when the password quality is |
| 473 | * {@link #PASSWORD_QUALITY_COMPLEX}. |
Konstantin Lopyrev | a15dcfa | 2010-05-24 17:10:56 -0700 | [diff] [blame] | 474 | * |
| 475 | * @param admin The name of the admin component to check, or null to |
| 476 | * aggregate all admins. |
| 477 | * @return The minimum number of letters required in the password. |
| 478 | */ |
| 479 | public int getPasswordMinimumLetters(ComponentName admin) { |
| 480 | if (mService != null) { |
| 481 | try { |
| 482 | return mService.getPasswordMinimumLetters(admin); |
| 483 | } catch (RemoteException e) { |
| 484 | Log.w(TAG, "Failed talking with device policy service", e); |
| 485 | } |
| 486 | } |
| 487 | return 0; |
| 488 | } |
| 489 | |
| 490 | /** |
| 491 | * Called by an application that is administering the device to set the |
| 492 | * minimum number of numerical digits required in the password. After |
| 493 | * setting this, the user will not be able to enter a new password that is |
| 494 | * not at least as restrictive as what has been set. Note that the current |
| 495 | * password will remain until the user has set a new one, so the change does |
| 496 | * not take place immediately. To prompt the user for a new password, use |
| 497 | * {@link #ACTION_SET_NEW_PASSWORD} after setting this value. This |
| 498 | * constraint is only imposed if the administrator has also requested |
Konstantin Lopyrev | c857740 | 2010-06-04 17:15:02 -0700 | [diff] [blame^] | 499 | * {@link #PASSWORD_QUALITY_COMPLEX} with {@link #setPasswordQuality}. The |
| 500 | * default value is 1. |
Konstantin Lopyrev | a15dcfa | 2010-05-24 17:10:56 -0700 | [diff] [blame] | 501 | * <p> |
| 502 | * The calling device admin must have requested |
| 503 | * {@link DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD} to be able to call |
| 504 | * this method; if it has not, a security exception will be thrown. |
| 505 | * |
| 506 | * @param admin Which {@link DeviceAdminReceiver} this request is associated |
| 507 | * with. |
| 508 | * @param length The new desired minimum number of numerical digits required |
| 509 | * in the password. A value of 0 means there is no restriction. |
| 510 | */ |
| 511 | public void setPasswordMinimumNumeric(ComponentName admin, int length) { |
| 512 | if (mService != null) { |
| 513 | try { |
| 514 | mService.setPasswordMinimumNumeric(admin, length); |
| 515 | } catch (RemoteException e) { |
| 516 | Log.w(TAG, "Failed talking with device policy service", e); |
| 517 | } |
| 518 | } |
| 519 | } |
| 520 | |
| 521 | /** |
| 522 | * Retrieve the current number of numerical digits required in the password |
Konstantin Lopyrev | c857740 | 2010-06-04 17:15:02 -0700 | [diff] [blame^] | 523 | * for all admins or a particular one. This is the same value as |
| 524 | * set by {#link {@link #setPasswordMinimumNumeric(ComponentName, int)} |
| 525 | * and only applies when the password quality is |
| 526 | * {@link #PASSWORD_QUALITY_COMPLEX}. |
Konstantin Lopyrev | a15dcfa | 2010-05-24 17:10:56 -0700 | [diff] [blame] | 527 | * |
| 528 | * @param admin The name of the admin component to check, or null to |
| 529 | * aggregate all admins. |
| 530 | * @return The minimum number of numerical digits required in the password. |
| 531 | */ |
| 532 | public int getPasswordMinimumNumeric(ComponentName admin) { |
| 533 | if (mService != null) { |
| 534 | try { |
| 535 | return mService.getPasswordMinimumNumeric(admin); |
| 536 | } catch (RemoteException e) { |
| 537 | Log.w(TAG, "Failed talking with device policy service", e); |
| 538 | } |
| 539 | } |
| 540 | return 0; |
| 541 | } |
| 542 | |
| 543 | /** |
| 544 | * Called by an application that is administering the device to set the |
| 545 | * minimum number of symbols required in the password. After setting this, |
| 546 | * the user will not be able to enter a new password that is not at least as |
| 547 | * restrictive as what has been set. Note that the current password will |
| 548 | * remain until the user has set a new one, so the change does not take |
| 549 | * place immediately. To prompt the user for a new password, use |
| 550 | * {@link #ACTION_SET_NEW_PASSWORD} after setting this value. This |
| 551 | * constraint is only imposed if the administrator has also requested |
Konstantin Lopyrev | c857740 | 2010-06-04 17:15:02 -0700 | [diff] [blame^] | 552 | * {@link #PASSWORD_QUALITY_COMPLEX} with {@link #setPasswordQuality}. The |
| 553 | * default value is 1. |
Konstantin Lopyrev | a15dcfa | 2010-05-24 17:10:56 -0700 | [diff] [blame] | 554 | * <p> |
| 555 | * The calling device admin must have requested |
| 556 | * {@link DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD} to be able to call |
| 557 | * this method; if it has not, a security exception will be thrown. |
| 558 | * |
| 559 | * @param admin Which {@link DeviceAdminReceiver} this request is associated |
| 560 | * with. |
| 561 | * @param length The new desired minimum number of symbols required in the |
| 562 | * password. A value of 0 means there is no restriction. |
| 563 | */ |
| 564 | public void setPasswordMinimumSymbols(ComponentName admin, int length) { |
| 565 | if (mService != null) { |
| 566 | try { |
| 567 | mService.setPasswordMinimumSymbols(admin, length); |
| 568 | } catch (RemoteException e) { |
| 569 | Log.w(TAG, "Failed talking with device policy service", e); |
| 570 | } |
| 571 | } |
| 572 | } |
| 573 | |
| 574 | /** |
| 575 | * Retrieve the current number of symbols required in the password for all |
Konstantin Lopyrev | c857740 | 2010-06-04 17:15:02 -0700 | [diff] [blame^] | 576 | * admins or a particular one. This is the same value as |
| 577 | * set by {#link {@link #setPasswordMinimumSymbols(ComponentName, int)} |
| 578 | * and only applies when the password quality is |
| 579 | * {@link #PASSWORD_QUALITY_COMPLEX}. |
Konstantin Lopyrev | a15dcfa | 2010-05-24 17:10:56 -0700 | [diff] [blame] | 580 | * |
| 581 | * @param admin The name of the admin component to check, or null to |
| 582 | * aggregate all admins. |
| 583 | * @return The minimum number of symbols required in the password. |
| 584 | */ |
| 585 | public int getPasswordMinimumSymbols(ComponentName admin) { |
| 586 | if (mService != null) { |
| 587 | try { |
| 588 | return mService.getPasswordMinimumSymbols(admin); |
| 589 | } catch (RemoteException e) { |
| 590 | Log.w(TAG, "Failed talking with device policy service", e); |
| 591 | } |
| 592 | } |
| 593 | return 0; |
| 594 | } |
| 595 | |
Konstantin Lopyrev | c857740 | 2010-06-04 17:15:02 -0700 | [diff] [blame^] | 596 | /** |
| 597 | * Called by an application that is administering the device to set the |
| 598 | * minimum number of non-letter characters (numerical digits or symbols) |
| 599 | * required in the password. After setting this, the user will not be able |
| 600 | * to enter a new password that is not at least as restrictive as what has |
| 601 | * been set. Note that the current password will remain until the user has |
| 602 | * set a new one, so the change does not take place immediately. To prompt |
| 603 | * the user for a new password, use {@link #ACTION_SET_NEW_PASSWORD} after |
| 604 | * setting this value. This constraint is only imposed if the administrator |
| 605 | * has also requested {@link #PASSWORD_QUALITY_COMPLEX} with |
| 606 | * {@link #setPasswordQuality}. The default value is 0. |
| 607 | * <p> |
| 608 | * The calling device admin must have requested |
| 609 | * {@link DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD} to be able to call |
| 610 | * this method; if it has not, a security exception will be thrown. |
| 611 | * |
| 612 | * @param admin Which {@link DeviceAdminReceiver} this request is associated |
| 613 | * with. |
| 614 | * @param length The new desired minimum number of letters required in the |
| 615 | * password. A value of 0 means there is no restriction. |
| 616 | */ |
| 617 | public void setPasswordMinimumNonLetter(ComponentName admin, int length) { |
| 618 | if (mService != null) { |
| 619 | try { |
| 620 | mService.setPasswordMinimumNonLetter(admin, length); |
| 621 | } catch (RemoteException e) { |
| 622 | Log.w(TAG, "Failed talking with device policy service", e); |
| 623 | } |
| 624 | } |
| 625 | } |
| 626 | |
| 627 | /** |
| 628 | * Retrieve the current number of non-letter characters required in the |
| 629 | * password for all admins or a particular one. This is the same value as |
| 630 | * set by {#link {@link #setPasswordMinimumNonLetter(ComponentName, int)} |
| 631 | * and only applies when the password quality is |
| 632 | * {@link #PASSWORD_QUALITY_COMPLEX}. |
| 633 | * |
| 634 | * @param admin The name of the admin component to check, or null to |
| 635 | * aggregate all admins. |
| 636 | * @return The minimum number of letters required in the password. |
| 637 | */ |
| 638 | public int getPasswordMinimumNonLetter(ComponentName admin) { |
| 639 | if (mService != null) { |
| 640 | try { |
| 641 | return mService.getPasswordMinimumNonLetter(admin); |
| 642 | } catch (RemoteException e) { |
| 643 | Log.w(TAG, "Failed talking with device policy service", e); |
| 644 | } |
| 645 | } |
| 646 | return 0; |
| 647 | } |
| 648 | |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 649 | /** |
| 650 | * Called by an application that is administering the device to set the length |
| 651 | * of the password history. After setting this, the user will not be able to |
| 652 | * enter a new password that is the same as any password in the history. Note |
| 653 | * that the current password will remain until the user has set a new one, so |
| 654 | * the change does not take place immediately. To prompt the user for a new |
| 655 | * password, use {@link #ACTION_SET_NEW_PASSWORD} after setting this value. |
| 656 | * This constraint is only imposed if the administrator has also requested |
| 657 | * either {@link #PASSWORD_QUALITY_NUMERIC}, |
| 658 | * {@link #PASSWORD_QUALITY_ALPHABETIC}, or |
| 659 | * {@link #PASSWORD_QUALITY_ALPHANUMERIC} with {@link #setPasswordQuality}. |
| 660 | * |
| 661 | * <p> |
| 662 | * The calling device admin must have requested |
| 663 | * {@link DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD} to be able to call this |
| 664 | * method; if it has not, a security exception will be thrown. |
| 665 | * |
| 666 | * @param admin Which {@link DeviceAdminReceiver} this request is associated |
| 667 | * with. |
| 668 | * @param length The new desired length of password history. A value of 0 |
| 669 | * means there is no restriction. |
| 670 | */ |
| 671 | public void setPasswordHistoryLength(ComponentName admin, int length) { |
| 672 | if (mService != null) { |
| 673 | try { |
| 674 | mService.setPasswordHistoryLength(admin, length); |
| 675 | } catch (RemoteException e) { |
| 676 | Log.w(TAG, "Failed talking with device policy service", e); |
| 677 | } |
| 678 | } |
| 679 | } |
| 680 | |
| 681 | /** |
| 682 | * Retrieve the current password history length for all admins |
| 683 | * or a particular one. |
| 684 | * @param admin The name of the admin component to check, or null to aggregate |
| 685 | * all admins. |
| 686 | * @return The length of the password history |
| 687 | */ |
| 688 | public int getPasswordHistoryLength(ComponentName admin) { |
| 689 | if (mService != null) { |
| 690 | try { |
| 691 | return mService.getPasswordHistoryLength(admin); |
| 692 | } catch (RemoteException e) { |
| 693 | Log.w(TAG, "Failed talking with device policy service", e); |
| 694 | } |
| 695 | } |
| 696 | return 0; |
| 697 | } |
| 698 | |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 699 | /** |
Dianne Hackborn | 254cb44 | 2010-01-27 19:23:59 -0800 | [diff] [blame] | 700 | * Return the maximum password length that the device supports for a |
Dianne Hackborn | 9327f4f | 2010-01-29 10:38:29 -0800 | [diff] [blame] | 701 | * particular password quality. |
Dianne Hackborn | 364f6e3 | 2010-01-29 17:38:20 -0800 | [diff] [blame] | 702 | * @param quality The quality being interrogated. |
Dianne Hackborn | 254cb44 | 2010-01-27 19:23:59 -0800 | [diff] [blame] | 703 | * @return Returns the maximum length that the user can enter. |
| 704 | */ |
Dianne Hackborn | 9327f4f | 2010-01-29 10:38:29 -0800 | [diff] [blame] | 705 | public int getPasswordMaximumLength(int quality) { |
Dianne Hackborn | 254cb44 | 2010-01-27 19:23:59 -0800 | [diff] [blame] | 706 | // Kind-of arbitrary. |
| 707 | return 16; |
| 708 | } |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 709 | |
Dianne Hackborn | 254cb44 | 2010-01-27 19:23:59 -0800 | [diff] [blame] | 710 | /** |
Dianne Hackborn | df83afa | 2010-01-20 13:37:26 -0800 | [diff] [blame] | 711 | * Determine whether the current password the user has set is sufficient |
Dianne Hackborn | 9327f4f | 2010-01-29 10:38:29 -0800 | [diff] [blame] | 712 | * to meet the policy requirements (quality, minimum length) that have been |
Dianne Hackborn | df83afa | 2010-01-20 13:37:26 -0800 | [diff] [blame] | 713 | * requested. |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 714 | * |
Dianne Hackborn | 8aa2e89 | 2010-01-22 11:31:30 -0800 | [diff] [blame] | 715 | * <p>The calling device admin must have requested |
| 716 | * {@link DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD} to be able to call |
| 717 | * this method; if it has not, a security exception will be thrown. |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 718 | * |
Dianne Hackborn | df83afa | 2010-01-20 13:37:26 -0800 | [diff] [blame] | 719 | * @return Returns true if the password meets the current requirements, |
| 720 | * else false. |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 721 | */ |
Dianne Hackborn | df83afa | 2010-01-20 13:37:26 -0800 | [diff] [blame] | 722 | public boolean isActivePasswordSufficient() { |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 723 | if (mService != null) { |
| 724 | try { |
Dianne Hackborn | df83afa | 2010-01-20 13:37:26 -0800 | [diff] [blame] | 725 | return mService.isActivePasswordSufficient(); |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 726 | } catch (RemoteException e) { |
| 727 | Log.w(TAG, "Failed talking with device policy service", e); |
| 728 | } |
| 729 | } |
Dianne Hackborn | df83afa | 2010-01-20 13:37:26 -0800 | [diff] [blame] | 730 | return false; |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 731 | } |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 732 | |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 733 | /** |
| 734 | * Retrieve the number of times the user has failed at entering a |
| 735 | * password since that last successful password entry. |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 736 | * |
Dianne Hackborn | 8aa2e89 | 2010-01-22 11:31:30 -0800 | [diff] [blame] | 737 | * <p>The calling device admin must have requested |
| 738 | * {@link DeviceAdminInfo#USES_POLICY_WATCH_LOGIN} to be able to call |
| 739 | * this method; if it has not, a security exception will be thrown. |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 740 | */ |
| 741 | public int getCurrentFailedPasswordAttempts() { |
| 742 | if (mService != null) { |
| 743 | try { |
| 744 | return mService.getCurrentFailedPasswordAttempts(); |
| 745 | } catch (RemoteException e) { |
| 746 | Log.w(TAG, "Failed talking with device policy service", e); |
| 747 | } |
| 748 | } |
| 749 | return -1; |
| 750 | } |
Dianne Hackborn | df83afa | 2010-01-20 13:37:26 -0800 | [diff] [blame] | 751 | |
| 752 | /** |
Andrew Stadler | 88209d1 | 2010-02-08 22:59:36 -0800 | [diff] [blame] | 753 | * Setting this to a value greater than zero enables a built-in policy |
| 754 | * that will perform a device wipe after too many incorrect |
| 755 | * device-unlock passwords have been entered. This built-in policy combines |
| 756 | * watching for failed passwords and wiping the device, and requires |
| 757 | * that you request both {@link DeviceAdminInfo#USES_POLICY_WATCH_LOGIN} and |
Dianne Hackborn | 8ea138c | 2010-01-26 18:01:04 -0800 | [diff] [blame] | 758 | * {@link DeviceAdminInfo#USES_POLICY_WIPE_DATA}}. |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 759 | * |
Andrew Stadler | 88209d1 | 2010-02-08 22:59:36 -0800 | [diff] [blame] | 760 | * <p>To implement any other policy (e.g. wiping data for a particular |
| 761 | * application only, erasing or revoking credentials, or reporting the |
| 762 | * failure to a server), you should implement |
Dianne Hackborn | ef6b22f | 2010-02-16 20:38:49 -0800 | [diff] [blame] | 763 | * {@link DeviceAdminReceiver#onPasswordFailed(Context, android.content.Intent)} |
Andrew Stadler | 88209d1 | 2010-02-08 22:59:36 -0800 | [diff] [blame] | 764 | * instead. Do not use this API, because if the maximum count is reached, |
| 765 | * the device will be wiped immediately, and your callback will not be invoked. |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 766 | * |
Dianne Hackborn | ef6b22f | 2010-02-16 20:38:49 -0800 | [diff] [blame] | 767 | * @param admin Which {@link DeviceAdminReceiver} this request is associated with. |
Dianne Hackborn | 8ea138c | 2010-01-26 18:01:04 -0800 | [diff] [blame] | 768 | * @param num The number of failed password attempts at which point the |
| 769 | * device will wipe its data. |
| 770 | */ |
| 771 | public void setMaximumFailedPasswordsForWipe(ComponentName admin, int num) { |
| 772 | if (mService != null) { |
| 773 | try { |
| 774 | mService.setMaximumFailedPasswordsForWipe(admin, num); |
| 775 | } catch (RemoteException e) { |
| 776 | Log.w(TAG, "Failed talking with device policy service", e); |
| 777 | } |
| 778 | } |
| 779 | } |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 780 | |
Dianne Hackborn | 8ea138c | 2010-01-26 18:01:04 -0800 | [diff] [blame] | 781 | /** |
Dianne Hackborn | 254cb44 | 2010-01-27 19:23:59 -0800 | [diff] [blame] | 782 | * Retrieve the current maximum number of login attempts that are allowed |
| 783 | * before the device wipes itself, for all admins |
| 784 | * or a particular one. |
| 785 | * @param admin The name of the admin component to check, or null to aggregate |
| 786 | * all admins. |
| 787 | */ |
| 788 | public int getMaximumFailedPasswordsForWipe(ComponentName admin) { |
| 789 | if (mService != null) { |
| 790 | try { |
| 791 | return mService.getMaximumFailedPasswordsForWipe(admin); |
| 792 | } catch (RemoteException e) { |
| 793 | Log.w(TAG, "Failed talking with device policy service", e); |
| 794 | } |
| 795 | } |
| 796 | return 0; |
| 797 | } |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 798 | |
Dianne Hackborn | 254cb44 | 2010-01-27 19:23:59 -0800 | [diff] [blame] | 799 | /** |
Dianne Hackborn | 87bba1e | 2010-02-26 17:25:54 -0800 | [diff] [blame] | 800 | * Flag for {@link #resetPassword}: don't allow other admins to change |
| 801 | * the password again until the user has entered it. |
| 802 | */ |
| 803 | public static final int RESET_PASSWORD_REQUIRE_ENTRY = 0x0001; |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 804 | |
Dianne Hackborn | 87bba1e | 2010-02-26 17:25:54 -0800 | [diff] [blame] | 805 | /** |
Dianne Hackborn | ef6b22f | 2010-02-16 20:38:49 -0800 | [diff] [blame] | 806 | * Force a new device unlock password (the password needed to access the |
| 807 | * entire device, not for individual accounts) on the user. This takes |
| 808 | * effect immediately. |
Dianne Hackborn | 9327f4f | 2010-01-29 10:38:29 -0800 | [diff] [blame] | 809 | * The given password must be sufficient for the |
| 810 | * current password quality and length constraints as returned by |
| 811 | * {@link #getPasswordQuality(ComponentName)} and |
| 812 | * {@link #getPasswordMinimumLength(ComponentName)}; if it does not meet |
| 813 | * these constraints, then it will be rejected and false returned. Note |
| 814 | * that the password may be a stronger quality (containing alphanumeric |
| 815 | * characters when the requested quality is only numeric), in which case |
| 816 | * the currently active quality will be increased to match. |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 817 | * |
Dianne Hackborn | 8aa2e89 | 2010-01-22 11:31:30 -0800 | [diff] [blame] | 818 | * <p>The calling device admin must have requested |
| 819 | * {@link DeviceAdminInfo#USES_POLICY_RESET_PASSWORD} to be able to call |
| 820 | * this method; if it has not, a security exception will be thrown. |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 821 | * |
Dianne Hackborn | df83afa | 2010-01-20 13:37:26 -0800 | [diff] [blame] | 822 | * @param password The new password for the user. |
Dianne Hackborn | 87bba1e | 2010-02-26 17:25:54 -0800 | [diff] [blame] | 823 | * @param flags May be 0 or {@link #RESET_PASSWORD_REQUIRE_ENTRY}. |
Dianne Hackborn | df83afa | 2010-01-20 13:37:26 -0800 | [diff] [blame] | 824 | * @return Returns true if the password was applied, or false if it is |
| 825 | * not acceptable for the current constraints. |
| 826 | */ |
Dianne Hackborn | 87bba1e | 2010-02-26 17:25:54 -0800 | [diff] [blame] | 827 | public boolean resetPassword(String password, int flags) { |
Dianne Hackborn | df83afa | 2010-01-20 13:37:26 -0800 | [diff] [blame] | 828 | if (mService != null) { |
| 829 | try { |
Dianne Hackborn | 87bba1e | 2010-02-26 17:25:54 -0800 | [diff] [blame] | 830 | return mService.resetPassword(password, flags); |
Dianne Hackborn | df83afa | 2010-01-20 13:37:26 -0800 | [diff] [blame] | 831 | } catch (RemoteException e) { |
| 832 | Log.w(TAG, "Failed talking with device policy service", e); |
| 833 | } |
| 834 | } |
| 835 | return false; |
| 836 | } |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 837 | |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 838 | /** |
| 839 | * Called by an application that is administering the device to set the |
| 840 | * maximum time for user activity until the device will lock. This limits |
| 841 | * the length that the user can set. It takes effect immediately. |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 842 | * |
Dianne Hackborn | 8aa2e89 | 2010-01-22 11:31:30 -0800 | [diff] [blame] | 843 | * <p>The calling device admin must have requested |
Dianne Hackborn | 315ada7 | 2010-02-11 12:14:08 -0800 | [diff] [blame] | 844 | * {@link DeviceAdminInfo#USES_POLICY_FORCE_LOCK} to be able to call |
Dianne Hackborn | 8aa2e89 | 2010-01-22 11:31:30 -0800 | [diff] [blame] | 845 | * this method; if it has not, a security exception will be thrown. |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 846 | * |
Dianne Hackborn | ef6b22f | 2010-02-16 20:38:49 -0800 | [diff] [blame] | 847 | * @param admin Which {@link DeviceAdminReceiver} this request is associated with. |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 848 | * @param timeMs The new desired maximum time to lock in milliseconds. |
| 849 | * A value of 0 means there is no restriction. |
| 850 | */ |
| 851 | public void setMaximumTimeToLock(ComponentName admin, long timeMs) { |
| 852 | if (mService != null) { |
| 853 | try { |
| 854 | mService.setMaximumTimeToLock(admin, timeMs); |
| 855 | } catch (RemoteException e) { |
| 856 | Log.w(TAG, "Failed talking with device policy service", e); |
| 857 | } |
| 858 | } |
| 859 | } |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 860 | |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 861 | /** |
Dianne Hackborn | 254cb44 | 2010-01-27 19:23:59 -0800 | [diff] [blame] | 862 | * Retrieve the current maximum time to unlock for all admins |
| 863 | * or a particular one. |
| 864 | * @param admin The name of the admin component to check, or null to aggregate |
| 865 | * all admins. |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 866 | */ |
Dianne Hackborn | 254cb44 | 2010-01-27 19:23:59 -0800 | [diff] [blame] | 867 | public long getMaximumTimeToLock(ComponentName admin) { |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 868 | if (mService != null) { |
| 869 | try { |
Dianne Hackborn | 254cb44 | 2010-01-27 19:23:59 -0800 | [diff] [blame] | 870 | return mService.getMaximumTimeToLock(admin); |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 871 | } catch (RemoteException e) { |
| 872 | Log.w(TAG, "Failed talking with device policy service", e); |
| 873 | } |
| 874 | } |
| 875 | return 0; |
| 876 | } |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 877 | |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 878 | /** |
Dianne Hackborn | df83afa | 2010-01-20 13:37:26 -0800 | [diff] [blame] | 879 | * Make the device lock immediately, as if the lock screen timeout has |
| 880 | * expired at the point of this call. |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 881 | * |
Dianne Hackborn | 8aa2e89 | 2010-01-22 11:31:30 -0800 | [diff] [blame] | 882 | * <p>The calling device admin must have requested |
| 883 | * {@link DeviceAdminInfo#USES_POLICY_FORCE_LOCK} to be able to call |
| 884 | * this method; if it has not, a security exception will be thrown. |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 885 | */ |
Dianne Hackborn | df83afa | 2010-01-20 13:37:26 -0800 | [diff] [blame] | 886 | public void lockNow() { |
| 887 | if (mService != null) { |
| 888 | try { |
| 889 | mService.lockNow(); |
| 890 | } catch (RemoteException e) { |
| 891 | Log.w(TAG, "Failed talking with device policy service", e); |
| 892 | } |
| 893 | } |
| 894 | } |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 895 | |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 896 | /** |
| 897 | * Ask the user date be wiped. This will cause the device to reboot, |
Dianne Hackborn | df83afa | 2010-01-20 13:37:26 -0800 | [diff] [blame] | 898 | * erasing all user data while next booting up. External storage such |
| 899 | * as SD cards will not be erased. |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 900 | * |
Dianne Hackborn | 8aa2e89 | 2010-01-22 11:31:30 -0800 | [diff] [blame] | 901 | * <p>The calling device admin must have requested |
| 902 | * {@link DeviceAdminInfo#USES_POLICY_WIPE_DATA} to be able to call |
| 903 | * this method; if it has not, a security exception will be thrown. |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 904 | * |
Dianne Hackborn | df83afa | 2010-01-20 13:37:26 -0800 | [diff] [blame] | 905 | * @param flags Bit mask of additional options: currently must be 0. |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 906 | */ |
| 907 | public void wipeData(int flags) { |
| 908 | if (mService != null) { |
| 909 | try { |
| 910 | mService.wipeData(flags); |
| 911 | } catch (RemoteException e) { |
| 912 | Log.w(TAG, "Failed talking with device policy service", e); |
| 913 | } |
| 914 | } |
| 915 | } |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 916 | |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 917 | /** |
| 918 | * @hide |
| 919 | */ |
| 920 | public void setActiveAdmin(ComponentName policyReceiver) { |
| 921 | if (mService != null) { |
| 922 | try { |
| 923 | mService.setActiveAdmin(policyReceiver); |
| 924 | } catch (RemoteException e) { |
| 925 | Log.w(TAG, "Failed talking with device policy service", e); |
| 926 | } |
| 927 | } |
| 928 | } |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 929 | |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 930 | /** |
| 931 | * @hide |
| 932 | */ |
Dianne Hackborn | d47c6ed | 2010-01-27 16:21:20 -0800 | [diff] [blame] | 933 | public DeviceAdminInfo getAdminInfo(ComponentName cn) { |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 934 | ActivityInfo ai; |
| 935 | try { |
| 936 | ai = mContext.getPackageManager().getReceiverInfo(cn, |
| 937 | PackageManager.GET_META_DATA); |
| 938 | } catch (PackageManager.NameNotFoundException e) { |
| 939 | Log.w(TAG, "Unable to retrieve device policy " + cn, e); |
| 940 | return null; |
| 941 | } |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 942 | |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 943 | ResolveInfo ri = new ResolveInfo(); |
| 944 | ri.activityInfo = ai; |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 945 | |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 946 | try { |
| 947 | return new DeviceAdminInfo(mContext, ri); |
| 948 | } catch (XmlPullParserException e) { |
| 949 | Log.w(TAG, "Unable to parse device policy " + cn, e); |
| 950 | return null; |
| 951 | } catch (IOException e) { |
| 952 | Log.w(TAG, "Unable to parse device policy " + cn, e); |
| 953 | return null; |
| 954 | } |
| 955 | } |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 956 | |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 957 | /** |
| 958 | * @hide |
| 959 | */ |
Dianne Hackborn | 8ea138c | 2010-01-26 18:01:04 -0800 | [diff] [blame] | 960 | public void getRemoveWarning(ComponentName admin, RemoteCallback result) { |
| 961 | if (mService != null) { |
| 962 | try { |
| 963 | mService.getRemoveWarning(admin, result); |
| 964 | } catch (RemoteException e) { |
| 965 | Log.w(TAG, "Failed talking with device policy service", e); |
| 966 | } |
| 967 | } |
| 968 | } |
| 969 | |
| 970 | /** |
| 971 | * @hide |
| 972 | */ |
Konstantin Lopyrev | a15dcfa | 2010-05-24 17:10:56 -0700 | [diff] [blame] | 973 | public void setActivePasswordState(int quality, int length, int letters, int uppercase, |
Konstantin Lopyrev | c857740 | 2010-06-04 17:15:02 -0700 | [diff] [blame^] | 974 | int lowercase, int numbers, int symbols, int nonletter) { |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 975 | if (mService != null) { |
| 976 | try { |
Konstantin Lopyrev | a15dcfa | 2010-05-24 17:10:56 -0700 | [diff] [blame] | 977 | mService.setActivePasswordState(quality, length, letters, uppercase, lowercase, |
Konstantin Lopyrev | c857740 | 2010-06-04 17:15:02 -0700 | [diff] [blame^] | 978 | numbers, symbols, nonletter); |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 979 | } catch (RemoteException e) { |
| 980 | Log.w(TAG, "Failed talking with device policy service", e); |
| 981 | } |
| 982 | } |
| 983 | } |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 984 | |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 985 | /** |
| 986 | * @hide |
| 987 | */ |
| 988 | public void reportFailedPasswordAttempt() { |
| 989 | if (mService != null) { |
| 990 | try { |
| 991 | mService.reportFailedPasswordAttempt(); |
| 992 | } catch (RemoteException e) { |
| 993 | Log.w(TAG, "Failed talking with device policy service", e); |
| 994 | } |
| 995 | } |
| 996 | } |
Konstantin Lopyrev | 3255823 | 2010-05-20 16:18:05 -0700 | [diff] [blame] | 997 | |
Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 998 | /** |
| 999 | * @hide |
| 1000 | */ |
| 1001 | public void reportSuccessfulPasswordAttempt() { |
| 1002 | if (mService != null) { |
| 1003 | try { |
| 1004 | mService.reportSuccessfulPasswordAttempt(); |
| 1005 | } catch (RemoteException e) { |
| 1006 | Log.w(TAG, "Failed talking with device policy service", e); |
| 1007 | } |
| 1008 | } |
| 1009 | } |
| 1010 | } |