Fix CTS CrossProfileAppsHostSideTest related to multi-user

1. setUp() in CrossProfileAppsHostSideTest creates a profile user
   and then creates another user in case of multi-user support device(max user >1)

2. However, the another user is not created in max user 2 because the number
of max user was already made with the user count 2(Owner user(default) +
profile user)

3. As a result, all the test cases in CrossProfileAppsHostSideTest fail in max user 2

Test: run CTS testPrimaryUserToSecondaryUser
Bug:130766246
Change-Id: I4b277f5716511f62b1c5765d9b80df82f7f7b59a
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/CrossProfileAppsHostSideTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/CrossProfileAppsHostSideTest.java
index 8a6f4da..81bc6c1 100644
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/CrossProfileAppsHostSideTest.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/CrossProfileAppsHostSideTest.java
@@ -22,6 +22,7 @@
     private int mProfileId;
     private int mSecondaryUserId;
     private boolean mHasManagedUserFeature;
+    private boolean mCanTestMultiUser;
 
     @Override
     protected void setUp() throws Exception {
@@ -34,9 +35,10 @@
             createAndStartManagedProfile();
             installRequiredApps(mProfileId);
         }
-        if (mSupportsMultiUser) {
+        if (canCreateAdditionalUsers(1)) {
             mSecondaryUserId = createUser();
             installRequiredApps(mSecondaryUserId);
+            mCanTestMultiUser = true;
         }
     }
 
@@ -65,14 +67,14 @@
     }
 
     public void testPrimaryUserToSecondaryUser() throws Exception {
-        if (!mSupportsMultiUser) {
+        if (!mCanTestMultiUser) {
             return;
         }
         verifyCrossProfileAppsApi(mPrimaryUserId, mSecondaryUserId, NON_TARGET_USER_TEST_CLASS);
     }
 
     public void testSecondaryUserToManagedProfile() throws Exception {
-        if (!mSupportsMultiUser || !mHasManagedUserFeature) {
+        if (!mCanTestMultiUser || !mHasManagedUserFeature) {
             return;
         }
         verifyCrossProfileAppsApi(mSecondaryUserId, mProfileId, NON_TARGET_USER_TEST_CLASS);
@@ -80,7 +82,7 @@
     }
 
     public void testManagedProfileToSecondaryUser() throws Exception {
-        if (!mSupportsMultiUser || !mHasManagedUserFeature) {
+        if (!mCanTestMultiUser || !mHasManagedUserFeature) {
             return;
         }
         verifyCrossProfileAppsApi(mProfileId, mSecondaryUserId, NON_TARGET_USER_TEST_CLASS);