Changing the process to create a new user

Creating a method to run in background the process to create a new user, and making the user check and change the UI in the main thread.

Also deleted the message of created user from the handler.

Bug:246906179
Test: Manual test and unit test fixed
Change-Id: Ifb3687937987f04165fd2e099d4334c7571bb034
This commit is contained in:
Jackson Michael
2022-11-11 17:22:34 +00:00
parent 7c056d00ac
commit e55a53b067
2 changed files with 29 additions and 53 deletions

View File

@@ -35,7 +35,6 @@ import androidx.test.platform.app.InstrumentationRegistry;
import com.android.settings.Settings;
import com.android.settings.testutils.AdbUtils;
import com.android.settings.testutils.UiUtils;
import com.android.settingslib.utils.ThreadUtils;
import org.junit.After;
import org.junit.Before;
@@ -87,8 +86,7 @@ public class UserSettingsComponentTest {
((FragmentActivity) activity).getSupportFragmentManager().getFragments().get(0);
UserSettings us = (UserSettings) f;
Log.d(TAG, "Start to add user :" + randomUserName);
ThreadUtils.postOnBackgroundThread(
us.new AddUserNowImpl(USER_TYPE_RESTRICTED_PROFILE, randomUserName));
us.createUser(USER_TYPE_RESTRICTED_PROFILE, randomUserName);
});
assertThat(