Home
last modified time | relevance | path

Searched refs:userId (Results 1 – 25 of 137) sorted by relevance

123456

/cts/hostsidetests/backup/src/android/cts/backup/
DBaseMultiUserBackupHostSideTest.java106 String userId = output.substring(output.lastIndexOf(" ")).trim(); in createProfileUser() local
107 return Integer.parseInt(userId); in createProfileUser()
115 void startUser(int userId) throws DeviceNotAvailableException { in startUser() argument
116 boolean startSuccessful = mDevice.startUser(userId, /* wait for RUNNING_UNLOCKED */ true); in startUser()
119 mDevice.setSetting(userId, "secure", USER_SETUP_COMPLETE_SETTING, "1"); in startUser()
123 void startUserAndInitializeForBackup(int userId) in startUserAndInitializeForBackup() argument
126 mBackupUtils.activateBackupForUser(true, userId); in startUserAndInitializeForBackup()
128 startUser(userId); in startUserAndInitializeForBackup()
130 mBackupUtils.waitUntilBackupServiceIsRunning(userId); in startUserAndInitializeForBackup()
132 mBackupUtils.enableBackupForUser(true, userId); in startUserAndInitializeForBackup()
[all …]
/cts/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/
DBaseDevicePolicyTest.java274 protected void waitForUserUnlock(int userId) throws Exception { in waitForUserUnlock() argument
276 String.format("am get-started-user-state %d", userId), in waitForUserUnlock()
307 protected void installAppAsUser(String appFileName, int userId) throws FileNotFoundException, in installAppAsUser() argument
309 installAppAsUser(appFileName, true, userId); in installAppAsUser()
312 protected void installAppAsUser(String appFileName, boolean grantPermissions, int userId) in installAppAsUser() argument
314 installAppAsUser(appFileName, grantPermissions, /* dontKillApp */ false, userId); in installAppAsUser()
318 boolean dontKillApp, int userId) in installAppAsUser() argument
320 CLog.e("Installing app %s for user %d", appFileName, userId); in installAppAsUser()
328 buildHelper.getTestFile(appFileName), true, grantPermissions, userId, in installAppAsUser()
330 assertNull("Failed to install " + appFileName + " for user " + userId + ": " + result, in installAppAsUser()
[all …]
DEphemeralUserTest.java44 int userId = createUser(FLAG_EPHEMERAL); in testCreateEphemeralUser() local
45 int flags = getUserFlags(userId); in testCreateEphemeralUser()
52 int userId = createUser(); in testCreateLongLivedUser() local
53 int flags = getUserFlags(userId); in testCreateLongLivedUser()
62 int userId = createUser(FLAG_EPHEMERAL); in testRemoveEphemeralOnStop() local
63 startUser(userId); in testRemoveEphemeralOnStop()
64 assertTrue("ephemeral user must exists after start", listUsers().contains(userId)); in testRemoveEphemeralOnStop()
65 stopUser(userId); in testRemoveEphemeralOnStop()
66 assertFalse("ephemeral user must be removed after stop", listUsers().contains(userId)); in testRemoveEphemeralOnStop()
76 int userId = createUser(FLAG_GUEST); in testEphemeralGuestFeature() local
[all …]
DDeviceOwnerTest.java116 final int userId = createUser(); in testRemoteBugreportWithTwoUsers() local
121 removeUser(userId); in testRemoteBugreportWithTwoUsers()
377 final int userId = createUser(); in testNetworkLoggingWithTwoUsers() local
384 removeUser(userId); in testNetworkLoggingWithTwoUsers()
690 final int userId = createAffiliatedSecondaryUser(); in testPackageInstallCache_multiUser() local
703 "testInstallExistingPackage", userId); in testPackageInstallCache_multiUser()
709 "testPackageUninstall", userId); in testPackageInstallCache_multiUser()
713 "testPackageInstall", userId); in testPackageInstallCache_multiUser()
727 "testPackageUninstall", userId); in testPackageInstallCache_multiUser()
731 "testInstallExistingPackage", userId); in testPackageInstallCache_multiUser()
[all …]
DUserRestrictionsTest.java81 @Nullable String method, int userId) throws DeviceNotAvailableException { in runTests() argument
82 runDeviceTestsAsUser(DEVICE_ADMIN_PKG, "." + className, method, userId); in runTests()
85 private void runTests(@Nonnull String className, int userId) in runTests() argument
87 runTests(className, null, userId); in runTests()
270 private void setPoAsUser(int userId) throws Exception { in setPoAsUser() argument
272 /* dontKillApp= */ true, userId); in setPoAsUser()
275 userId, /* expectFailure */ false)); in setPoAsUser()
277 if (userId == mDeviceOwnerUserId) { in setPoAsUser()
309 for (int userId : usersToCheck) { in setAndCheckProfileGlobalRestriction()
310 runGlobalRestrictionsTest(ENSURE_GLOBAL_RESTRICTIONS_TEST, userId); in setAndCheckProfileGlobalRestriction()
[all …]
DMixedDeviceOwnerTest.java94 final int userId = createSecondaryUserAsProfileOwner(); in testLockTask_unaffiliatedUser() local
99 userId); in testLockTask_unaffiliatedUser()
101 setUserAsAffiliatedUserToPrimary(userId); in testLockTask_unaffiliatedUser()
106 userId); in testLockTask_unaffiliatedUser()
354 final int userId = createUser(); in testSecurityLoggingWithTwoUsers() local
364 removeUser(userId); in testSecurityLoggingWithTwoUsers()
408 int userId = mDeviceOwnerUserId; in runSecurityLoggingTests() local
411 runDeviceTestsAsUser(packageName, testClassName, "testEnablingSecurityLogging", userId); in runSecurityLoggingTests()
414 waitForUserUnlock(userId); in runSecurityLoggingTests()
417 runDeviceTestsAsUser(packageName, testClassName, "testGenerateLogs", userId); in runSecurityLoggingTests()
[all …]
/cts/hostsidetests/multiuser/src/android/host/multiuser/
DEphemeralTest.java104 final int userId = createUser(); in testRemoveUserOrSetEphemeral_nonRunningUserRemoved() local
106 executeRemoveUserOrSetEphemeralAdbCommand(userId); in testRemoveUserOrSetEphemeral_nonRunningUserRemoved()
108 assertUserNotPresent(userId); in testRemoveUserOrSetEphemeral_nonRunningUserRemoved()
121 final int userId = createUser(); in testRemoveUserOrSetEphemeral_currentUserSetEphemeral_removeAfterSwitch() local
123 assertSwitchToNewUser(userId); in testRemoveUserOrSetEphemeral_currentUserSetEphemeral_removeAfterSwitch()
124 executeRemoveUserOrSetEphemeralAdbCommand(userId); in testRemoveUserOrSetEphemeral_currentUserSetEphemeral_removeAfterSwitch()
125 assertUserEphemeral(userId); in testRemoveUserOrSetEphemeral_currentUserSetEphemeral_removeAfterSwitch()
127 assertSwitchToUser(userId, mInitialUserId); in testRemoveUserOrSetEphemeral_currentUserSetEphemeral_removeAfterSwitch()
128 waitForUserRemove(userId); in testRemoveUserOrSetEphemeral_currentUserSetEphemeral_removeAfterSwitch()
129 assertUserNotPresent(userId); in testRemoveUserOrSetEphemeral_currentUserSetEphemeral_removeAfterSwitch()
[all …]
DCreateUsersNoAppCrashesTest.java43 int userId = getDevice().createUser( in testCanCreateGuestUser() local
47 assertSwitchToNewUser(userId); in testCanCreateGuestUser()
48 assertSwitchToUser(userId, mInitialUserId); in testCanCreateGuestUser()
54 int userId = getDevice().createUser( in testCanCreateSecondaryUser() local
58 assertSwitchToNewUser(userId); in testCanCreateSecondaryUser()
59 assertSwitchToUser(userId, mInitialUserId); in testCanCreateSecondaryUser()
DBaseMultiUserTest.java105 protected int createRestrictedProfile(int userId) in createRestrictedProfile() argument
107 final String command = "pm create-user --profileOf " + userId + " --restricted " in createRestrictedProfile()
131 for (int userId : getDevice().listUsers()) { in getGuestUser()
132 if ((getDevice().getUserFlags(userId) & FLAG_GUEST) != 0) { in getGuestUser()
133 return userId; in getGuestUser()
172 protected void assertUserNotPresent(int userId) throws Exception { in assertUserNotPresent() argument
173 assertWithMessage("User ID %s should not be present", userId) in assertUserNotPresent()
174 .that(getDevice().listUsers()).doesNotContain(userId); in assertUserNotPresent()
177 protected void assertUserPresent(int userId) throws Exception { in assertUserPresent() argument
178 assertWithMessage("User ID %s should be present", userId) in assertUserPresent()
[all …]
/cts/hostsidetests/inputmethodservice/hostside/src/android/inputmethodservice/cts/hostside/
DMultiUserTest.java99 userId -> shell(ShellCommandUtils.uninstallPackage(Ime1Constants.PACKAGE, userId))); in setUp()
117 for (int userId : newUsers) { in tearDown()
118 if (!mOriginalUsers.contains(userId)) { in tearDown()
119 getDevice().removeUser(userId); in tearDown()
288 private void switchUser(int userId) throws Exception { in switchUser() argument
289 getDevice().switchUser(userId); in switchUser()
307 if (userId == lastSwitchUserId) { in switchUser()
325 private void installPossibleInstantPackage(String apkFileName, int userId, boolean instant) in installPossibleInstantPackage() argument
328 installPackageAsUser(apkFileName, true, userId, "-r", "--instant"); in installPossibleInstantPackage()
330 installPackageAsUser(apkFileName, true, userId, "-r"); in installPossibleInstantPackage()
[all …]
/cts/hostsidetests/appsecurity/src/android/appsecurity/cts/
DPackageVisibilityTest.java84 int userId = mUsers[1]; in testUninstalledPackageVisibility() local
85 assertTrue(userId > 0); in testUninstalledPackageVisibility()
86 getDevice().startUser(userId); in testUninstalledPackageVisibility()
87 installTestAppForUser(TEST_APK, userId); in testUninstalledPackageVisibility()
103 assertFalse(isAppVisibleForUser(TINY_PKG, userId, MATCH_NORMAL)); in testUninstalledPackageVisibility()
104 assertFalse(isAppVisibleForUser(TINY_PKG, userId, MATCH_UNINSTALLED)); in testUninstalledPackageVisibility()
108 ".PackageAccessTest", "testPackageAccess_notInOtherUser", userId); in testUninstalledPackageVisibility() local
110 ".PackageAccessTest", "testPackageAccess_notInOtherUserUninstalled", userId); in testUninstalledPackageVisibility() local
113 ".PackageAccessTest", "testPackageAccess_getPackagesCantSeeTiny", userId); in testUninstalledPackageVisibility() local
118 installTestAppForUser(TINY_APK, userId); in testUninstalledPackageVisibility()
[all …]
DBaseAppSecurityTest.java53 protected void installTestAppForUser(String apk, int userId) throws Exception { in installTestAppForUser() argument
54 installTestAppForUser(apk, false, userId); in installTestAppForUser()
57 protected void installTestAppForUser(String apk, boolean instant, int userId) throws Exception { in installTestAppForUser() argument
58 if (userId < 0) { in installTestAppForUser()
59 userId = mPrimaryUserId; in installTestAppForUser()
64 .forUser(userId) in installTestAppForUser()
82 protected boolean isAppVisibleForUser(String packageName, int userId, in isAppVisibleForUser() argument
84 String command = "cmd package list packages --user " + userId; in isAppVisibleForUser()
/cts/hostsidetests/inputmethodservice/common/src/android/inputmethodservice/cts/common/test/
DShellCommandUtils.java40 public static String getCurrentIme(int userId) { in getCurrentIme() argument
41 return String.format("settings --user %d get %s", userId, SETTING_DEFAULT_IME); in getCurrentIme()
50 public static String setCurrentImeSync(String imeId, int userId) { in setCurrentImeSync() argument
51 return String.format("ime set --user %d %s", userId, imeId); in setCurrentImeSync()
58 public static String getEnabledImes(int userId) { in getEnabledImes() argument
59 return String.format("ime list -s --user %d", userId); in getEnabledImes()
66 public static String getAvailableImes(int userId) { in getAvailableImes() argument
67 return String.format("ime list -s -a --user %d", userId); in getAvailableImes()
80 public static String enableIme(String imeId, int userId) { in enableIme() argument
81 return String.format("ime enable --user %d %s", userId, imeId); in enableIme()
[all …]
/cts/hostsidetests/packagemanager/multiuser/src/com/android/tests/packagemanager/multiuser/host/
DPackageManagerMultiUserTestBase.java60 for (int userId : mCreatedUsers) { in tearDown()
61 removeUser(userId); in tearDown()
67 @Nullable String testMethodName, int userId, in runDeviceTestAsUser() argument
79 userId, in runDeviceTestAsUser() local
88 protected void runDeviceTestAsUser(String testMethodName, int userId, in runDeviceTestAsUser() argument
91 runDeviceTestAsUser(TEST_PACKAGE, TEST_CLASS, testMethodName, userId, params); in runDeviceTestAsUser()
104 int userId = Integer.parseInt(tokens[tokens.length - 1]); in createUser() local
105 mCreatedUsers.add(userId); in createUser()
107 setupUser(userId); in createUser()
108 return userId; in createUser()
[all …]
/cts/hostsidetests/car/src/android/car/cts/
DCarHostJUnit4TestCase.java119 for (int userId : mUsersToBeRemoved) { in restoreUsersState()
120 removeUser(userId); in restoreUsersState()
244 public UserInfo getUserInfo(int userId) throws Exception { in getUserInfo() argument
246 .filter((u) -> u.id == userId)) in getUserInfo()
291 int userId = executeAndParseCommand(CREATE_USER_OUTPUT_PATTERN, in createUser() local
296 markUserForRemovalAfterTest(userId); in createUser()
297 return userId; in createUser()
303 protected void markUserForRemovalAfterTest(int userId) { in markUserForRemovalAfterTest() argument
304 mUsersToBeRemoved.add(userId); in markUserForRemovalAfterTest()
310 protected void waitForUserInitialized(int userId) throws Exception { in waitForUserInitialized() argument
[all …]
DPreCreateUsersHostTest.java206 private void assertHasPreCreatedUser(int userId) throws Exception { in assertHasPreCreatedUser() argument
208 CLog.d("assertHasPreCreatedUser(%d): pool=%s", userId, existingIds); in assertHasPreCreatedUser()
209 assertWithMessage("pre-created user not found").that(existingIds).contains(userId); in assertHasPreCreatedUser()
221 int userId = INVALID_USER_ID; in preCreateUser()
224 userId = Integer.parseInt(output.substring(output.lastIndexOf(" ")).trim()); in preCreateUser()
225 CLog.i("Pre-created user with id %d; waiting until it's initialized", userId); in preCreateUser()
226 markUserForRemovalAfterTest(userId); in preCreateUser()
227 waitForUserInitialized(userId); in preCreateUser()
228 assertHasPreCreatedUser(userId); in preCreateUser()
229 waitUntilUserDataIsPersisted(userId); in preCreateUser()
[all …]
/cts/hostsidetests/media/src/android/media/cts/
DBaseMultiUserTest.java106 for (int userId : getDevice().listUsers()) { in tearDown()
107 if (!mExistingUsers.contains(userId)) { in tearDown()
108 removeUser(userId); in tearDown()
128 protected void installAppAsUser(String appFileName, int userId, boolean asInstantApp) in installAppAsUser() argument
130 CLog.d("Installing app " + appFileName + " for user " + userId); in installAppAsUser()
136 userId, in installAppAsUser()
139 assertNull("Failed to install " + appFileName + " for user " + userId + ": " + result, in installAppAsUser()
150 int userId = Integer.parseInt(tokens[tokens.length-1]); in createAndStartUser() local
153 getDevice().startUser(userId); in createAndStartUser()
154 return userId; in createAndStartUser()
[all …]
/cts/hostsidetests/webkit/src/com/android/cts/webkit/
DWebViewHostSideMultipleProfileTest.java100 private void installTestApkForUser(int userId) throws DeviceNotAvailableException { in installTestApkForUser() argument
108 String output = mDevice.installPackageForUser(file, true, false, userId); in installTestApkForUser()
110 stopAndRemoveUser(userId); in installTestApkForUser()
114 stopAndRemoveUser(userId); in installTestApkForUser()
138 private void startUser(int userId) throws DeviceNotAvailableException { in startUser() argument
139 if (!mDevice.startUser(userId)) { in startUser()
140 mDevice.removeUser(userId); in startUser()
141 Assert.fail("Failed to start user " + userId); in startUser()
145 private void switchUser(int userId) throws DeviceNotAvailableException { in switchUser() argument
146 if (!mDevice.switchUser(userId)) { in switchUser()
[all …]
/cts/tests/translation/src/android/translation/cts/
DHelper.java70 final int userId = UserHandle.myUserId(); in setTemporaryTranslationService() local
71 runShellCommand("cmd translation set temporary-service %d %s 12000", userId, service); in setTemporaryTranslationService()
78 final int userId = UserHandle.myUserId(); in resetTemporaryTranslationService() local
79 Log.d(TAG, "Resetting back user " + userId + " to default translation service"); in resetTemporaryTranslationService()
80 runShellCommand("cmd translation set temporary-service %d", userId); in resetTemporaryTranslationService()
90 final int userId = UserHandle.myUserId(); in setTemporaryContentCaptureService() local
91 runShellCommand("cmd content_capture set temporary-service %d %s 12000", userId, service); in setTemporaryContentCaptureService()
98 final int userId = UserHandle.myUserId(); in resetTemporaryContentCaptureService() local
99 Log.d(TAG, "Resetting back user " + userId + " to default service"); in resetTemporaryContentCaptureService()
100 runShellCommand("cmd content_capture set temporary-service %d", userId); in resetTemporaryContentCaptureService()
[all …]
/cts/hostsidetests/appbinding/hostside/src/com/android/cts/appbinding/
DAppBindingHostTest.java78 private void installAppAsUser(String appFileName, boolean grantPermissions, int userId) in installAppAsUser() argument
80 CLog.d("Installing app " + appFileName + " for user " + userId); in installAppAsUser()
83 buildHelper.getTestFile(appFileName), true, grantPermissions, userId, "-t"); in installAppAsUser()
84 assertNull("Failed to install " + appFileName + " for user " + userId + ": " + result, in installAppAsUser()
178 private void setSmsApp(String pkg, int userId) throws Exception { in setSmsApp() argument
179 runCommand("cmd role add-role-holder --user " + userId + " android.app.role.SMS " + pkg); in setSmsApp()
229 String serviceClass, int userId) throws Throwable { in installAndCheckBound() argument
231 installAppAsUser(apk, true, userId); in installAndCheckBound()
234 setSmsApp(packageName, userId); in installAndCheckBound()
236 checkBound(packageName, serviceClass, userId); in installAndCheckBound()
[all …]
/cts/tests/tests/content/src/android/content/om/cts/
DOverlayManagerTest.java61 int userId = UserHandle.myUserId(); in testSetEnabled() local
62 UserHandle user = UserHandle.of(userId); in testSetEnabled()
63 verify(mMockService, times(0)).setEnabled(packageName, true, userId); in testSetEnabled()
67 verify(mMockService, times(1)).setEnabled(packageName, true, userId); in testSetEnabled()
73 int userId = UserHandle.myUserId(); in testSetEnabledExclusiveInCategory() local
74 UserHandle user = UserHandle.of(userId); in testSetEnabledExclusiveInCategory()
75 verify(mMockService, times(0)).setEnabledExclusiveInCategory(packageName, userId); in testSetEnabledExclusiveInCategory()
79 verify(mMockService, times(1)).setEnabledExclusiveInCategory(packageName, userId); in testSetEnabledExclusiveInCategory()
85 int userId = UserHandle.myUserId(); in testGetOverlayInfosForTarget() local
86 UserHandle user = UserHandle.of(userId); in testGetOverlayInfosForTarget()
[all …]
/cts/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/
DHeadlessSystemUserTest.java71 final int userId = user.id; in testProfileOwnerIsSetOnNewUser() local
75 Context newUserContext = mContext.createContextAsUser(UserHandle.of(userId), in testProfileOwnerIsSetOnNewUser()
79 eventually(() -> assertProfileOwner(newUserDpm.getProfileOwner(), userId)); in testProfileOwnerIsSetOnNewUser() local
83 final int userId = user.id; in testProfileOwnerIsSetOnNewUser() local
84 Log.d(TAG, "Removing user " + userId); in testProfileOwnerIsSetOnNewUser()
86 () -> mUserManager.removeUser(userId)); in testProfileOwnerIsSetOnNewUser()
87 assertWithMessage("user %s removed", userId).that(removed).isTrue(); in testProfileOwnerIsSetOnNewUser()
92 private void assertProfileOwner(ComponentName admin, @UserIdInt int userId) { in assertProfileOwner() argument
93 assertWithMessage("Component %s is profile owner for user %s", admin, userId) in assertProfileOwner()
/cts/hostsidetests/accounts/src/android/host/accounts/
DBaseMultiUserTest.java95 protected int createRestrictedProfile(int userId) in createRestrictedProfile() argument
97 return createUser("--profileOf " + userId + " --restricted"); in createRestrictedProfile()
104 protected int createProfile(int userId) in createProfile() argument
106 return createUser("--profileOf " + userId + " --managed"); in createProfile()
145 for (int userId : mDevice.listUsers()) { in getGuestUser()
146 if ((mDevice.getUserFlags(userId) & FLAG_GUEST) != 0) { in getGuestUser()
147 return userId; in getGuestUser()
158 for (int userId : getDevice().listUsers()) { in removeTestUsers()
159 if (!mFixedUsers.contains(userId)) { in removeTestUsers()
160 getDevice().removeUser(userId); in removeTestUsers()
/cts/hostsidetests/numberblocking/src/com/android/cts/numberblocking/hostside/
DNumberBlockingTest.java148 protected void startUserAndWait(int userId) throws Exception { in startUserAndWait() argument
149 getDevice().startUser(userId); in startUserAndWait()
154 final String command = String.format("am get-started-user-state %d", userId); in startUserAndWait()
167 fail("User state of " + userId + " was '" + output + "' rather than " + desiredState); in startUserAndWait()
175 private void installTestAppForUser(int userId) throws Exception { in installTestAppForUser() argument
176 LogUtil.CLog.logAndDisplay(Log.LogLevel.INFO, "Installing test app for user: " + userId); in installTestAppForUser()
182 testAppFile, true /*reinstall*/, userId); in installTestAppForUser()
202 private void runTestAsUser(String className, String methodName, int userId) throws Exception { in runTestAsUser() argument
204 className, methodName, userId); in runTestAsUser()
213 getDevice().runInstrumentationTestsAsUser(testRunner, userId, listener); in runTestAsUser()
[all …]
/cts/hostsidetests/appsearch/src/android/appsearch/cts/
DAppSearchHostTestBase.java42 protected void runDeviceTestAsUserInPkgA(@Nonnull String testMethod, int userId) in runDeviceTestAsUserInPkgA() argument
45 runDeviceTests(getDevice(), TARGET_PKG_A, TEST_CLASS_A, testMethod, userId, in runDeviceTestAsUserInPkgA() local
49 protected void runDeviceTestAsUserInPkgA(@Nonnull String testMethod, int userId, in runDeviceTestAsUserInPkgA() argument
55 .setUserId(userId); in runDeviceTestAsUserInPkgA()
63 protected void runStorageAugmenterDeviceTestAsUserInPkgA(@Nonnull String testMethod, int userId) in runStorageAugmenterDeviceTestAsUserInPkgA() argument
67 testMethod, userId, DEFAULT_INSTRUMENTATION_TIMEOUT_MS)).isTrue(); in runStorageAugmenterDeviceTestAsUserInPkgA() local
70 protected void runDeviceTestAsUserInPkgB(@Nonnull String testMethod, int userId) in runDeviceTestAsUserInPkgB() argument
73 runDeviceTests(getDevice(), TARGET_PKG_B, TEST_CLASS_B, testMethod, userId, in runDeviceTestAsUserInPkgB() local

123456