blob: 40048d9154debe4790de40bb2d49ba8664ff2eb3 [file] [log] [blame]
Amith Yamasani258848d2012-08-10 17:06:33 -07001/*
2**
3** Copyright 2012, The Android Open Source Project
4**
5** Licensed under the Apache License, Version 2.0 (the "License");
6** you may not use this file except in compliance with the License.
7** You may obtain a copy of the License at
8**
9** http://www.apache.org/licenses/LICENSE-2.0
10**
11** Unless required by applicable law or agreed to in writing, software
12** distributed under the License is distributed on an "AS IS" BASIS,
13** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14** See the License for the specific language governing permissions and
15** limitations under the License.
16*/
17
18package android.os;
19
Amith Yamasanie4cf7342012-12-17 11:12:09 -080020import android.os.Bundle;
Christopher Tate65fb2e42019-10-11 17:00:23 -070021import android.os.IUserRestrictionsListener;
Amith Yamasani12747872015-12-07 14:19:49 -080022import android.os.PersistableBundle;
Pavel Grafov6a40f092016-10-25 15:46:51 +010023import android.os.UserManager;
Amith Yamasani258848d2012-08-10 17:06:33 -070024import android.content.pm.UserInfo;
Benjamin Franzf02420c2016-04-04 18:52:21 +010025import android.content.IntentSender;
Amith Yamasanidf2e92a2013-03-01 17:04:38 -080026import android.content.RestrictionEntry;
Amith Yamasanie928d7d2012-09-17 21:46:51 -070027import android.graphics.Bitmap;
Adrian Roos1bdff912015-02-17 15:51:35 +010028import android.os.ParcelFileDescriptor;
Amith Yamasani258848d2012-08-10 17:06:33 -070029
30/**
31 * {@hide}
32 */
33interface IUserManager {
Andres Moralesc5548c02015-08-05 10:23:12 -070034
35 /*
36 * DO NOT MOVE - UserManager.h depends on the ordering of this function.
37 */
Bookatz029832a2019-10-04 16:50:22 -070038 int getCredentialOwnerProfile(int userId);
39 int getProfileParentId(int userId);
Jakub Pawlowski0f1f5b72017-11-15 14:50:43 -080040 /*
41 * END OF DO NOT MOVE
42 */
Andres Moralesc5548c02015-08-05 10:23:12 -070043
Bookatz029832a2019-10-04 16:50:22 -070044 UserInfo createUser(in String name, in String userType, int flags);
45 UserInfo preCreateUser(in String userType);
46 UserInfo createProfileForUser(in String name, in String userType, int flags, int userId,
Sudheer Shanka7cb54a32016-09-16 12:59:05 -070047 in String[] disallowedPackages);
Amith Yamasani12747872015-12-07 14:19:49 -080048 UserInfo createRestrictedProfile(String name, int parentUserHandle);
Bookatz029832a2019-10-04 16:50:22 -070049 void setUserEnabled(int userId);
jovanakf24ad492018-05-18 12:15:59 -070050 void setUserAdmin(int userId);
Bookatz029832a2019-10-04 16:50:22 -070051 void evictCredentialEncryptionKey(int userId);
52 boolean removeUser(int userId);
53 boolean removeUserEvenWhenDisallowed(int userId);
54 void setUserName(int userId, String name);
55 void setUserIcon(int userId, in Bitmap icon);
56 ParcelFileDescriptor getUserIcon(int userId);
Xiaohui Chen70f6c382015-04-28 14:21:43 -070057 UserInfo getPrimaryUser();
Felipe Leme09a7f2d2019-10-02 16:27:46 -070058 List<UserInfo> getUsers(boolean excludePartial, boolean excludeDying, boolean excludePreCreated);
Bookatz029832a2019-10-04 16:50:22 -070059 List<UserInfo> getProfiles(int userId, boolean enabledOnly);
Fyodor Kupolov7f98aa42016-04-07 14:56:25 -070060 int[] getProfileIds(int userId, boolean enabledOnly);
Bookatz029832a2019-10-04 16:50:22 -070061 boolean canAddMoreProfilesToUser(in String userType, int userId, boolean allowedToRemoveOne);
62 boolean canAddMoreManagedProfiles(int userId, boolean allowedToRemoveOne);
63 UserInfo getProfileParent(int userId);
64 boolean isSameProfileGroup(int userId, int otherUserHandle);
65 String getUserTypeForUser(int userId);
Andrei Onea24ec3212019-03-15 17:35:05 +000066 @UnsupportedAppUsage
Bookatz029832a2019-10-04 16:50:22 -070067 UserInfo getUserInfo(int userId);
68 String getUserAccount(int userId);
69 void setUserAccount(int userId, String accountName);
70 long getUserCreationTime(int userId);
Amith Yamasani71e6c692013-03-24 17:39:28 -070071 boolean isRestricted();
Bookatz029832a2019-10-04 16:50:22 -070072 boolean canHaveRestrictedProfile(int userId);
73 int getUserSerialNumber(int userId);
Amith Yamasani2a003292012-08-14 18:25:45 -070074 int getUserHandle(int userSerialNumber);
Bookatz029832a2019-10-04 16:50:22 -070075 int getUserRestrictionSource(String restrictionKey, int userId);
76 List<UserManager.EnforcingUser> getUserRestrictionSources(String restrictionKey, int userId);
77 Bundle getUserRestrictions(int userId);
78 boolean hasBaseUserRestriction(String restrictionKey, int userId);
79 boolean hasUserRestriction(in String restrictionKey, int userId);
Makoto Onukiacc50462018-02-14 14:13:49 -080080 boolean hasUserRestrictionOnAnyUser(in String restrictionKey);
Christopher Tate65fb2e42019-10-11 17:00:23 -070081 boolean isSettingRestrictedForUser(in String setting, int userId, in String value, int callingUid);
82 void addUserRestrictionsListener(IUserRestrictionsListener listener);
Bookatz029832a2019-10-04 16:50:22 -070083 void setUserRestriction(String key, boolean value, int userId);
84 void setApplicationRestrictions(in String packageName, in Bundle restrictions, int userId);
Amith Yamasani7e99bc02013-04-16 18:24:51 -070085 Bundle getApplicationRestrictions(in String packageName);
Bookatz029832a2019-10-04 16:50:22 -070086 Bundle getApplicationRestrictionsForUser(in String packageName, int userId);
Amith Yamasanie4afaa32014-06-30 14:55:07 +053087 void setDefaultGuestRestrictions(in Bundle restrictions);
88 Bundle getDefaultGuestRestrictions();
Bookatz029832a2019-10-04 16:50:22 -070089 boolean markGuestForDeletion(int userId);
90 boolean isQuietModeEnabled(int userId);
91 void setSeedAccountData(int userId, in String accountName,
Amith Yamasani12747872015-12-07 14:19:49 -080092 in String accountType, in PersistableBundle accountOptions, boolean persist);
93 String getSeedAccountName();
94 String getSeedAccountType();
95 PersistableBundle getSeedAccountOptions();
96 void clearSeedAccountData();
97 boolean someUserHasSeedAccount(in String accountName, in String accountType);
Bookatz029832a2019-10-04 16:50:22 -070098 boolean isProfile(int userId);
Tony Mak8673b282016-03-21 21:10:59 +000099 boolean isManagedProfile(int userId);
Amith Yamasani1c41dc82016-06-28 16:13:15 -0700100 boolean isDemoUser(int userId);
Felipe Lemec1ca4412019-09-11 09:23:26 -0700101 boolean isPreCreated(int userId);
Bookatz029832a2019-10-04 16:50:22 -0700102 UserInfo createProfileForUserEvenWhenDisallowed(in String name, in String userType, int flags,
103 int userId, in String[] disallowedPackages);
Fyodor Kupolovc413f702016-10-06 17:11:14 -0700104 boolean isUserUnlockingOrUnlocked(int userId);
Bookatz029832a2019-10-04 16:50:22 -0700105 int getUserIconBadgeResId(int userId);
106 int getUserBadgeResId(int userId);
107 int getUserBadgeNoBackgroundResId(int userId);
108 int getUserBadgeLabelResId(int userId);
109 int getUserBadgeColorResId(int userId);
110 boolean hasBadge(int userId);
Fyodor Kupolov2e7e0962016-12-01 18:09:17 -0800111 boolean isUserUnlocked(int userId);
112 boolean isUserRunning(int userId);
Bookatz029832a2019-10-04 16:50:22 -0700113 boolean isUserNameSet(int userId);
Fyodor Kupolovca177562017-11-09 17:43:01 -0800114 boolean hasRestrictedProfiles();
Bookatz029832a2019-10-04 16:50:22 -0700115 boolean requestQuietModeEnabled(String callingPackage, boolean enableQuietMode, int userId, in IntentSender target);
Bookatzcde3d922019-03-08 14:30:00 -0800116 String getUserName();
Makoto Onuki73dded22017-12-20 13:14:48 +0900117 long getUserStartRealtime();
118 long getUserUnlockRealtime();
Amith Yamasani258848d2012-08-10 17:06:33 -0700119}