From ee0c837117620b28b630c7b7e692714d301b790b Mon Sep 17 00:00:00 2001 From: Jigar Thakkar Date: Thu, 23 Mar 2023 15:14:53 +0000 Subject: [PATCH] Fix user starts by using startProfile We used ActivityManager.startUserInBackground earlier to start the clone user. As per the changes done recently (b/267800984), UserVisibilityMediator now marks all the profiles/users started usign startUserInBackground as startedInvisible. This results in the apps not being able to launch on clone profile without a device restart. To fix this, in this change we move to using ActivityManager.startProfile to start the clone-user. Test: Tested on device by creating clone profile through settings app Bug: 268011720 Change-Id: I4a594cd4d10cfbd7459b04baa45719885decf87e --- .../applications/manageapplications/CloneBackend.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/com/android/settings/applications/manageapplications/CloneBackend.java b/src/com/android/settings/applications/manageapplications/CloneBackend.java index 588d8349605..568631ec460 100644 --- a/src/com/android/settings/applications/manageapplications/CloneBackend.java +++ b/src/com/android/settings/applications/manageapplications/CloneBackend.java @@ -104,7 +104,7 @@ public class CloneBackend { new HashSet<>()); } catch (Exception e) { if (ManageApplications.DEBUG) { - Log.e("ankita", "Error occurred creating clone user" + e.getMessage()); + Log.e(TAG, "Error occurred creating clone user" + e.getMessage()); } return ERROR_CREATING_CLONE_USER; } @@ -125,7 +125,7 @@ public class CloneBackend { if (newlyCreated) { IActivityManager am = ActivityManagerNative.getDefault(); try { - am.startUserInBackground(mCloneUserId); + am.startProfile(mCloneUserId); } catch (RemoteException e) { if (ManageApplications.DEBUG) { Log.e(TAG, "Error starting clone user " + e.getMessage());