UserManager.java revision 1a447535cef7e3739d5f763dfe13e568568b9789
1/*
2 * Copyright (C) 2012 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 */
16package android.os;
17
18import android.app.ActivityManagerNative;
19import android.content.Context;
20import android.content.pm.UserInfo;
21import android.content.res.Resources;
22import android.graphics.Bitmap;
23import android.util.Log;
24
25import com.android.internal.R;
26
27import java.util.List;
28
29/**
30 * Manages users and user details on a multi-user system.
31 */
32public class UserManager {
33
34    private static String TAG = "UserManager";
35    private final IUserManager mService;
36    private final Context mContext;
37
38    /**
39     * Key for user restrictions. Specifies if a user is disallowed from adding and removing
40     * accounts.
41     * The default value is <code>false</code>.
42     * <p/>
43     * Type: Boolean
44     * @see #setUserRestrictions(Bundle)
45     * @see #getUserRestrictions()
46     */
47    public static final String DISALLOW_MODIFY_ACCOUNTS = "no_modify_accounts";
48
49    /**
50     * Key for user restrictions. Specifies if a user is disallowed from changing Wi-Fi
51     * access points.
52     * The default value is <code>false</code>.
53     * <p/>
54     * Type: Boolean
55     * @see #setUserRestrictions(Bundle)
56     * @see #getUserRestrictions()
57     */
58    public static final String DISALLOW_CONFIG_WIFI = "no_config_wifi";
59
60    /**
61     * Key for user restrictions. Specifies if a user is disallowed from installing applications.
62     * The default value is <code>false</code>.
63     * <p/>
64     * Type: Boolean
65     * @see #setUserRestrictions(Bundle)
66     * @see #getUserRestrictions()
67     */
68    public static final String DISALLOW_INSTALL_APPS = "no_install_apps";
69
70    /**
71     * Key for user restrictions. Specifies if a user is disallowed from uninstalling applications.
72     * The default value is <code>false</code>.
73     * <p/>
74     * Type: Boolean
75     * @see #setUserRestrictions(Bundle)
76     * @see #getUserRestrictions()
77     */
78    public static final String DISALLOW_UNINSTALL_APPS = "no_uninstall_apps";
79
80    /**
81     * Key for user restrictions. Specifies if a user is disallowed from toggling location sharing.
82     * The default value is <code>false</code>.
83     * <p/>
84     * Type: Boolean
85     * @see #setUserRestrictions(Bundle)
86     * @see #getUserRestrictions()
87     */
88
89    public static final String DISALLOW_SHARE_LOCATION = "no_share_location";
90
91    /**
92     * Key for user restrictions. Specifies if a user is disallowed from enabling the
93     * "Unknown Sources" setting, that allows installation of apps from unknown sources.
94     * The default value is <code>false</code>.
95     * <p/>
96     * Type: Boolean
97     * @see #setUserRestrictions(Bundle)
98     * @see #getUserRestrictions()
99     */
100    public static final String DISALLOW_INSTALL_UNKNOWN_SOURCES = "no_install_unknown_sources";
101
102    /**
103     * Key for user restrictions. Specifies if a user is disallowed from configuring bluetooth.
104     * The default value is <code>false</code>.
105     * <p/>
106     * Type: Boolean
107     * @see #setUserRestrictions(Bundle)
108     * @see #getUserRestrictions()
109     */
110    public static final String DISALLOW_CONFIG_BLUETOOTH = "no_config_bluetooth";
111
112    /**
113     * Key for user restrictions. Specifies if a user is disallowed from transferring files over
114     * USB. The default value is <code>false</code>.
115     * <p/>
116     * Type: Boolean
117     * @see #setUserRestrictions(Bundle)
118     * @see #getUserRestrictions()
119     */
120    public static final String DISALLOW_USB_FILE_TRANSFER = "no_usb_file_transfer";
121
122    /**
123     * Key for user restrictions. Specifies if a user is disallowed from configuring user
124     * credentials. The default value is <code>false</code>.
125     * <p/>
126     * Type: Boolean
127     * @see #setUserRestrictions(Bundle)
128     * @see #getUserRestrictions()
129     */
130    public static final String DISALLOW_CONFIG_CREDENTIALS = "no_config_credentials";
131
132    /**
133     * Key for user restrictions. Specifies if a user is disallowed from removing users.
134     * The default value is <code>false</code>.
135     * <p/>
136     * Type: Boolean
137     * @see #setUserRestrictions(Bundle)
138     * @see #getUserRestrictions()
139     */
140    public static final String DISALLOW_REMOVE_USER = "no_remove_user";
141
142    /** @hide */
143    public static final int PIN_VERIFICATION_FAILED_INCORRECT = -3;
144    /** @hide */
145    public static final int PIN_VERIFICATION_FAILED_NOT_SET = -2;
146    /** @hide */
147    public static final int PIN_VERIFICATION_SUCCESS = -1;
148
149    private static UserManager sInstance = null;
150
151    /** @hide */
152    public synchronized static UserManager get(Context context) {
153        if (sInstance == null) {
154            sInstance = (UserManager) context.getSystemService(Context.USER_SERVICE);
155        }
156        return sInstance;
157    }
158
159    /** @hide */
160    public UserManager(Context context, IUserManager service) {
161        mService = service;
162        mContext = context;
163    }
164
165    /**
166     * Returns whether the system supports multiple users.
167     * @return true if multiple users can be created by user, false if it is a single user device.
168     * @hide
169     */
170    public static boolean supportsMultipleUsers() {
171        return getMaxSupportedUsers() > 1
172                && SystemProperties.getBoolean("fw.show_multiuserui",
173                Resources.getSystem().getBoolean(R.bool.config_enableMultiUserUI));
174    }
175
176    /**
177     * Returns the user handle for the user that this application is running for.
178     * @return the user handle of the user making this call.
179     * @hide
180     */
181    public int getUserHandle() {
182        return UserHandle.myUserId();
183    }
184
185    /**
186     * Returns the user name of the user making this call.  This call is only
187     * available to applications on the system image; it requires the
188     * MANAGE_USERS permission.
189     * @return the user name
190     */
191    public String getUserName() {
192        try {
193            return mService.getUserInfo(getUserHandle()).name;
194        } catch (RemoteException re) {
195            Log.w(TAG, "Could not get user name", re);
196            return "";
197        }
198    }
199
200   /**
201     * Used to determine whether the user making this call is subject to
202     * teleportations.
203     * @return whether the user making this call is a goat
204     */
205    public boolean isUserAGoat() {
206        return false;
207    }
208
209    /**
210     * Used to check if the user making this call is linked to another user. Linked users may have
211     * a reduced number of available apps, app restrictions and account restrictions.
212     * @return whether the user making this call is a linked user
213     * @hide
214     */
215    public boolean isLinkedUser() {
216        try {
217            return mService.isRestricted();
218        } catch (RemoteException re) {
219            Log.w(TAG, "Could not check if user is limited ", re);
220            return false;
221        }
222    }
223
224    /**
225     * Return whether the given user is actively running.  This means that
226     * the user is in the "started" state, not "stopped" -- it is currently
227     * allowed to run code through scheduled alarms, receiving broadcasts,
228     * etc.  A started user may be either the current foreground user or a
229     * background user; the result here does not distinguish between the two.
230     * @param user The user to retrieve the running state for.
231     */
232    public boolean isUserRunning(UserHandle user) {
233        try {
234            return ActivityManagerNative.getDefault().isUserRunning(
235                    user.getIdentifier(), false);
236        } catch (RemoteException e) {
237            return false;
238        }
239    }
240
241    /**
242     * Return whether the given user is actively running <em>or</em> stopping.
243     * This is like {@link #isUserRunning(UserHandle)}, but will also return
244     * true if the user had been running but is in the process of being stopped
245     * (but is not yet fully stopped, and still running some code).
246     * @param user The user to retrieve the running state for.
247     */
248    public boolean isUserRunningOrStopping(UserHandle user) {
249        try {
250            return ActivityManagerNative.getDefault().isUserRunning(
251                    user.getIdentifier(), true);
252        } catch (RemoteException e) {
253            return false;
254        }
255    }
256
257    /**
258     * Returns the UserInfo object describing a specific user.
259     * Requires {@link android.Manifest.permission#MANAGE_USERS} permission.
260     * @param userHandle the user handle of the user whose information is being requested.
261     * @return the UserInfo object for a specific user.
262     * @hide
263     */
264    public UserInfo getUserInfo(int userHandle) {
265        try {
266            return mService.getUserInfo(userHandle);
267        } catch (RemoteException re) {
268            Log.w(TAG, "Could not get user info", re);
269            return null;
270        }
271    }
272
273    /**
274     * Returns the user-wide restrictions imposed on this user.
275     * @return a Bundle containing all the restrictions.
276     */
277    public Bundle getUserRestrictions() {
278        return getUserRestrictions(Process.myUserHandle());
279    }
280
281    /**
282     * Returns the user-wide restrictions imposed on the user specified by <code>userHandle</code>.
283     * @param userHandle the UserHandle of the user for whom to retrieve the restrictions.
284     * @return a Bundle containing all the restrictions.
285     */
286    public Bundle getUserRestrictions(UserHandle userHandle) {
287        try {
288            return mService.getUserRestrictions(userHandle.getIdentifier());
289        } catch (RemoteException re) {
290            Log.w(TAG, "Could not get user restrictions", re);
291            return Bundle.EMPTY;
292        }
293    }
294
295    /**
296     * Sets all the user-wide restrictions for this user.
297     * Requires the MANAGE_USERS permission.
298     * @param restrictions the Bundle containing all the restrictions.
299     */
300    public void setUserRestrictions(Bundle restrictions) {
301        setUserRestrictions(restrictions, Process.myUserHandle());
302    }
303
304    /**
305     * Sets all the user-wide restrictions for the specified user.
306     * Requires the MANAGE_USERS permission.
307     * @param restrictions the Bundle containing all the restrictions.
308     * @param userHandle the UserHandle of the user for whom to set the restrictions.
309     */
310    public void setUserRestrictions(Bundle restrictions, UserHandle userHandle) {
311        try {
312            mService.setUserRestrictions(restrictions, userHandle.getIdentifier());
313        } catch (RemoteException re) {
314            Log.w(TAG, "Could not set user restrictions", re);
315        }
316    }
317
318    /**
319     * Sets the value of a specific restriction.
320     * Requires the MANAGE_USERS permission.
321     * @param key the key of the restriction
322     * @param value the value for the restriction
323     */
324    public void setUserRestriction(String key, boolean value) {
325        Bundle bundle = getUserRestrictions();
326        bundle.putBoolean(key, value);
327        setUserRestrictions(bundle);
328    }
329
330    /**
331     * @hide
332     * Sets the value of a specific restriction on a specific user.
333     * Requires the {@link android.Manifest.permission#MANAGE_USERS} permission.
334     * @param key the key of the restriction
335     * @param value the value for the restriction
336     * @param userHandle the user whose restriction is to be changed.
337     */
338    public void setUserRestriction(String key, boolean value, UserHandle userHandle) {
339        Bundle bundle = getUserRestrictions(userHandle);
340        bundle.putBoolean(key, value);
341        setUserRestrictions(bundle, userHandle);
342    }
343
344    /**
345     * @hide
346     * Returns whether the current user has been disallowed from performing certain actions
347     * or setting certain settings.
348     * @param restrictionKey the string key representing the restriction
349     */
350    public boolean hasUserRestriction(String restrictionKey) {
351        return hasUserRestriction(restrictionKey, Process.myUserHandle());
352    }
353
354    /**
355     * @hide
356     * Returns whether the given user has been disallowed from performing certain actions
357     * or setting certain settings.
358     * @param restrictionKey the string key representing the restriction
359     * @param userHandle the UserHandle of the user for whom to retrieve the restrictions.
360     */
361    public boolean hasUserRestriction(String restrictionKey, UserHandle userHandle) {
362        return getUserRestrictions(userHandle).getBoolean(restrictionKey, false);
363    }
364
365    /**
366     * Return the serial number for a user.  This is a device-unique
367     * number assigned to that user; if the user is deleted and then a new
368     * user created, the new users will not be given the same serial number.
369     * @param user The user whose serial number is to be retrieved.
370     * @return The serial number of the given user; returns -1 if the
371     * given UserHandle does not exist.
372     * @see #getUserForSerialNumber(long)
373     */
374    public long getSerialNumberForUser(UserHandle user) {
375        return getUserSerialNumber(user.getIdentifier());
376    }
377
378    /**
379     * Return the user associated with a serial number previously
380     * returned by {@link #getSerialNumberForUser(UserHandle)}.
381     * @param serialNumber The serial number of the user that is being
382     * retrieved.
383     * @return Return the user associated with the serial number, or null
384     * if there is not one.
385     * @see #getSerialNumberForUser(UserHandle)
386     */
387    public UserHandle getUserForSerialNumber(long serialNumber) {
388        int ident = getUserHandle((int)serialNumber);
389        return ident >= 0 ? new UserHandle(ident) : null;
390    }
391
392    /**
393     * Creates a user with the specified name and options.
394     * Requires {@link android.Manifest.permission#MANAGE_USERS} permission.
395     *
396     * @param name the user's name
397     * @param flags flags that identify the type of user and other properties.
398     * @see UserInfo
399     *
400     * @return the UserInfo object for the created user, or null if the user could not be created.
401     * @hide
402     */
403    public UserInfo createUser(String name, int flags) {
404        try {
405            return mService.createUser(name, flags);
406        } catch (RemoteException re) {
407            Log.w(TAG, "Could not create a user", re);
408            return null;
409        }
410    }
411
412    /**
413     * Creates a user with the specified name and options.
414     * Requires {@link android.Manifest.permission#MANAGE_USERS} permission.
415     *
416     * @param name the user's name
417     * @param flags flags that identify the type of user and other properties.
418     * @see UserInfo
419     * @param relatedUserId new user will be related to this user id.
420     *
421     * @return the UserInfo object for the created user, or null if the user could not be created.
422     * @hide
423     */
424    public UserInfo createRelatedUser(String name, int flags, int relatedUserId) {
425        try {
426            return mService.createRelatedUser(name, flags, relatedUserId);
427        } catch (RemoteException re) {
428            Log.w(TAG, "Could not create a user", re);
429            return null;
430        }
431    }
432
433    /**
434     * Return the number of users currently created on the device.
435     */
436    public int getUserCount() {
437        List<UserInfo> users = getUsers();
438        return users != null ? users.size() : 1;
439    }
440
441    /**
442     * Returns information for all users on this device.
443     * Requires {@link android.Manifest.permission#MANAGE_USERS} permission.
444     * @return the list of users that were created.
445     * @hide
446     */
447    public List<UserInfo> getUsers() {
448        try {
449            return mService.getUsers(false);
450        } catch (RemoteException re) {
451            Log.w(TAG, "Could not get user list", re);
452            return null;
453        }
454    }
455
456    /**
457     * Returns information for all users related to userId
458     * Requires {@link android.Manifest.permission#MANAGE_USERS} permission.
459     * @param userHandle users related to this user id will be returned.
460     * @return the list of related users.
461     * @hide
462     */
463    public List<UserInfo> getRelatedUsers(int userHandle) {
464        try {
465            return mService.getRelatedUsers(userHandle);
466        } catch (RemoteException re) {
467            Log.w(TAG, "Could not get user list", re);
468            return null;
469        }
470    }
471
472    /**
473     * Returns information for all users on this device.
474     * Requires {@link android.Manifest.permission#MANAGE_USERS} permission.
475     * @param excludeDying specify if the list should exclude users being removed.
476     * @return the list of users that were created.
477     * @hide
478     */
479    public List<UserInfo> getUsers(boolean excludeDying) {
480        try {
481            return mService.getUsers(excludeDying);
482        } catch (RemoteException re) {
483            Log.w(TAG, "Could not get user list", re);
484            return null;
485        }
486    }
487
488    /**
489     * Removes a user and all associated data.
490     * Requires {@link android.Manifest.permission#MANAGE_USERS} permission.
491     * @param userHandle the integer handle of the user, where 0 is the primary user.
492     * @hide
493     */
494    public boolean removeUser(int userHandle) {
495        try {
496            return mService.removeUser(userHandle);
497        } catch (RemoteException re) {
498            Log.w(TAG, "Could not remove user ", re);
499            return false;
500        }
501    }
502
503    /**
504     * Updates the user's name.
505     * Requires {@link android.Manifest.permission#MANAGE_USERS} permission.
506     *
507     * @param userHandle the user's integer handle
508     * @param name the new name for the user
509     * @hide
510     */
511    public void setUserName(int userHandle, String name) {
512        try {
513            mService.setUserName(userHandle, name);
514        } catch (RemoteException re) {
515            Log.w(TAG, "Could not set the user name ", re);
516        }
517    }
518
519    /**
520     * Sets the user's photo.
521     * @param userHandle the user for whom to change the photo.
522     * @param icon the bitmap to set as the photo.
523     * @hide
524     */
525    public void setUserIcon(int userHandle, Bitmap icon) {
526        try {
527            mService.setUserIcon(userHandle, icon);
528        } catch (RemoteException re) {
529            Log.w(TAG, "Could not set the user icon ", re);
530        }
531    }
532
533    /**
534     * Returns a file descriptor for the user's photo. PNG data can be read from this file.
535     * @param userHandle the user whose photo we want to read.
536     * @return a {@link Bitmap} of the user's photo, or null if there's no photo.
537     * @hide
538     */
539    public Bitmap getUserIcon(int userHandle) {
540        try {
541            return mService.getUserIcon(userHandle);
542        } catch (RemoteException re) {
543            Log.w(TAG, "Could not get the user icon ", re);
544            return null;
545        }
546    }
547
548    /**
549     * Enable or disable the use of a guest account. If disabled, the existing guest account
550     * will be wiped.
551     * Requires {@link android.Manifest.permission#MANAGE_USERS} permission.
552     * @param enable whether to enable a guest account.
553     * @hide
554     */
555    public void setGuestEnabled(boolean enable) {
556        try {
557            mService.setGuestEnabled(enable);
558        } catch (RemoteException re) {
559            Log.w(TAG, "Could not change guest account availability to " + enable);
560        }
561    }
562
563    /**
564     * Checks if a guest user is enabled for this device.
565     * Requires {@link android.Manifest.permission#MANAGE_USERS} permission.
566     * @return whether a guest user is enabled
567     * @hide
568     */
569    public boolean isGuestEnabled() {
570        try {
571            return mService.isGuestEnabled();
572        } catch (RemoteException re) {
573            Log.w(TAG, "Could not retrieve guest enabled state");
574            return false;
575        }
576    }
577
578    /**
579     * Wipes all the data for a user, but doesn't remove the user.
580     * Requires {@link android.Manifest.permission#MANAGE_USERS} permission.
581     * @param userHandle
582     * @hide
583     */
584    public void wipeUser(int userHandle) {
585        try {
586            mService.wipeUser(userHandle);
587        } catch (RemoteException re) {
588            Log.w(TAG, "Could not wipe user " + userHandle);
589        }
590    }
591
592    /**
593     * Returns the maximum number of users that can be created on this device. A return value
594     * of 1 means that it is a single user device.
595     * @hide
596     * @return a value greater than or equal to 1
597     */
598    public static int getMaxSupportedUsers() {
599        // Don't allow multiple users on certain builds
600        if (android.os.Build.ID.startsWith("JVP")) return 1;
601        return SystemProperties.getInt("fw.max_users",
602                Resources.getSystem().getInteger(R.integer.config_multiuserMaximumUsers));
603    }
604
605    /**
606     * Returns true if the user switcher should be shown, this will be if there
607     * are multiple users that aren't managed profiles.
608     * @hide
609     * @return true if user switcher should be shown.
610     */
611    public boolean isUserSwitcherEnabled() {
612        List<UserInfo> users = getUsers(true);
613        if (users == null) {
614           return false;
615        }
616        int switchableUserCount = 0;
617        for (UserInfo user : users) {
618            if (user.supportsSwitchTo()) {
619                ++switchableUserCount;
620            }
621        }
622        return switchableUserCount > 1;
623    }
624
625    /**
626     * Returns a serial number on this device for a given userHandle. User handles can be recycled
627     * when deleting and creating users, but serial numbers are not reused until the device is wiped.
628     * @param userHandle
629     * @return a serial number associated with that user, or -1 if the userHandle is not valid.
630     * @hide
631     */
632    public int getUserSerialNumber(int userHandle) {
633        try {
634            return mService.getUserSerialNumber(userHandle);
635        } catch (RemoteException re) {
636            Log.w(TAG, "Could not get serial number for user " + userHandle);
637        }
638        return -1;
639    }
640
641    /**
642     * Returns a userHandle on this device for a given user serial number. User handles can be
643     * recycled when deleting and creating users, but serial numbers are not reused until the device
644     * is wiped.
645     * @param userSerialNumber
646     * @return the userHandle associated with that user serial number, or -1 if the serial number
647     * is not valid.
648     * @hide
649     */
650    public int getUserHandle(int userSerialNumber) {
651        try {
652            return mService.getUserHandle(userSerialNumber);
653        } catch (RemoteException re) {
654            Log.w(TAG, "Could not get userHandle for user " + userSerialNumber);
655        }
656        return -1;
657    }
658
659    /**
660     * Returns a Bundle containing any saved application restrictions for this user, for the
661     * given package name. Only an application with this package name can call this method.
662     * @param packageName the package name of the calling application
663     * @return a Bundle with the restrictions as key/value pairs, or null if there are no
664     * saved restrictions. The values can be of type Boolean, String or String[], depending
665     * on the restriction type, as defined by the application.
666     */
667    public Bundle getApplicationRestrictions(String packageName) {
668        try {
669            return mService.getApplicationRestrictions(packageName);
670        } catch (RemoteException re) {
671            Log.w(TAG, "Could not get application restrictions for package " + packageName);
672        }
673        return null;
674    }
675
676    /**
677     * @hide
678     */
679    public Bundle getApplicationRestrictions(String packageName, UserHandle user) {
680        try {
681            return mService.getApplicationRestrictionsForUser(packageName, user.getIdentifier());
682        } catch (RemoteException re) {
683            Log.w(TAG, "Could not get application restrictions for user " + user.getIdentifier());
684        }
685        return null;
686    }
687
688    /**
689     * @hide
690     */
691    public void setApplicationRestrictions(String packageName, Bundle restrictions,
692            UserHandle user) {
693        try {
694            mService.setApplicationRestrictions(packageName, restrictions, user.getIdentifier());
695        } catch (RemoteException re) {
696            Log.w(TAG, "Could not set application restrictions for user " + user.getIdentifier());
697        }
698    }
699
700    /**
701     * Sets a new challenge PIN for restrictions. This is only for use by pre-installed
702     * apps and requires the MANAGE_USERS permission.
703     * @param newPin the PIN to use for challenge dialogs.
704     * @return Returns true if the challenge PIN was set successfully.
705     */
706    public boolean setRestrictionsChallenge(String newPin) {
707        try {
708            return mService.setRestrictionsChallenge(newPin);
709        } catch (RemoteException re) {
710            Log.w(TAG, "Could not change restrictions pin");
711        }
712        return false;
713    }
714
715    /**
716     * @hide
717     * @param pin The PIN to verify, or null to get the number of milliseconds to wait for before
718     * allowing the user to enter the PIN.
719     * @return Returns a positive number (including zero) for how many milliseconds before
720     * you can accept another PIN, when the input is null or the input doesn't match the saved PIN.
721     * Returns {@link #PIN_VERIFICATION_SUCCESS} if the input matches the saved PIN. Returns
722     * {@link #PIN_VERIFICATION_FAILED_NOT_SET} if there is no PIN set.
723     */
724    public int checkRestrictionsChallenge(String pin) {
725        try {
726            return mService.checkRestrictionsChallenge(pin);
727        } catch (RemoteException re) {
728            Log.w(TAG, "Could not check restrictions pin");
729        }
730        return PIN_VERIFICATION_FAILED_INCORRECT;
731    }
732
733    /**
734     * @hide
735     * Checks whether the user has restrictions that are PIN-protected. An application that
736     * participates in restrictions can check if the owner has requested a PIN challenge for
737     * any restricted operations. If there is a PIN in effect, the application should launch
738     * the PIN challenge activity {@link android.content.Intent#ACTION_RESTRICTIONS_CHALLENGE}.
739     * @see android.content.Intent#ACTION_RESTRICTIONS_CHALLENGE
740     * @return whether a restrictions PIN is in effect.
741     */
742    public boolean hasRestrictionsChallenge() {
743        try {
744            return mService.hasRestrictionsChallenge();
745        } catch (RemoteException re) {
746            Log.w(TAG, "Could not change restrictions pin");
747        }
748        return false;
749    }
750
751    /** @hide */
752    public void removeRestrictions() {
753        try {
754            mService.removeRestrictions();
755        } catch (RemoteException re) {
756            Log.w(TAG, "Could not change restrictions pin");
757        }
758    }
759}
760