Loading core/java/android/app/admin/flags/flags.aconfig +11 −0 Original line number Diff line number Diff line Loading @@ -173,6 +173,17 @@ flag { bug: "322777918" } flag { name: "copy_account_with_retry_enabled" namespace: "enterprise" description: "Retry copy and remove account from personal to work profile in case of failure" bug: "329424312" metadata { purpose: PURPOSE_BUGFIX } } flag { name: "esim_management_ux_enabled" namespace: "enterprise" Loading services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +20 −2 Original line number Diff line number Diff line Loading @@ -888,6 +888,8 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { private static final String APPLICATION_EXEMPTIONS_FLAG = "application_exemptions"; private static final boolean DEFAULT_APPLICATION_EXEMPTIONS_FLAG = true; private static final int RETRY_COPY_ACCOUNT_ATTEMPTS = 3; /** * For apps targeting U+ * Enable multiple admins to coexist on the same device. Loading Loading @@ -21514,13 +21516,26 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { Slogf.w(LOG_TAG, "sourceUser and targetUser are the same, won't migrate account."); return; } if (Flags.copyAccountWithRetryEnabled()) { boolean copySucceeded = false; int retryAttemptsLeft = RETRY_COPY_ACCOUNT_ATTEMPTS; while (!copySucceeded && (retryAttemptsLeft > 0)) { Slogf.i(LOG_TAG, "Copying account. Attempts left : " + retryAttemptsLeft); copySucceeded = copyAccount(targetUser, sourceUser, accountToMigrate, callerPackage); retryAttemptsLeft--; } } else { copyAccount(targetUser, sourceUser, accountToMigrate, callerPackage); } if (!keepAccountMigrated) { removeAccount(accountToMigrate, sourceUserId); } } private void copyAccount( private boolean copyAccount( UserHandle targetUser, UserHandle sourceUser, Account accountToMigrate, String callerPackage) { final long startTime = SystemClock.elapsedRealtime(); Loading @@ -21538,6 +21553,8 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { DevicePolicyEnums.PLATFORM_PROVISIONING_COPY_ACCOUNT_MS, startTime, callerPackage); Slogf.i(LOG_TAG, "Copy account successful to " + targetUser); return true; } else { logCopyAccountStatus(COPY_ACCOUNT_FAILED, callerPackage); Slogf.e(LOG_TAG, "Failed to copy account to " + targetUser); Loading @@ -21550,6 +21567,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { logCopyAccountStatus(COPY_ACCOUNT_EXCEPTION, callerPackage); Slogf.e(LOG_TAG, "Exception copying account to " + targetUser, e); } return false; } private static void logCopyAccountStatus(@CopyAccountStatus int status, String callerPackage) { Loading
core/java/android/app/admin/flags/flags.aconfig +11 −0 Original line number Diff line number Diff line Loading @@ -173,6 +173,17 @@ flag { bug: "322777918" } flag { name: "copy_account_with_retry_enabled" namespace: "enterprise" description: "Retry copy and remove account from personal to work profile in case of failure" bug: "329424312" metadata { purpose: PURPOSE_BUGFIX } } flag { name: "esim_management_ux_enabled" namespace: "enterprise" Loading
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +20 −2 Original line number Diff line number Diff line Loading @@ -888,6 +888,8 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { private static final String APPLICATION_EXEMPTIONS_FLAG = "application_exemptions"; private static final boolean DEFAULT_APPLICATION_EXEMPTIONS_FLAG = true; private static final int RETRY_COPY_ACCOUNT_ATTEMPTS = 3; /** * For apps targeting U+ * Enable multiple admins to coexist on the same device. Loading Loading @@ -21514,13 +21516,26 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { Slogf.w(LOG_TAG, "sourceUser and targetUser are the same, won't migrate account."); return; } if (Flags.copyAccountWithRetryEnabled()) { boolean copySucceeded = false; int retryAttemptsLeft = RETRY_COPY_ACCOUNT_ATTEMPTS; while (!copySucceeded && (retryAttemptsLeft > 0)) { Slogf.i(LOG_TAG, "Copying account. Attempts left : " + retryAttemptsLeft); copySucceeded = copyAccount(targetUser, sourceUser, accountToMigrate, callerPackage); retryAttemptsLeft--; } } else { copyAccount(targetUser, sourceUser, accountToMigrate, callerPackage); } if (!keepAccountMigrated) { removeAccount(accountToMigrate, sourceUserId); } } private void copyAccount( private boolean copyAccount( UserHandle targetUser, UserHandle sourceUser, Account accountToMigrate, String callerPackage) { final long startTime = SystemClock.elapsedRealtime(); Loading @@ -21538,6 +21553,8 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { DevicePolicyEnums.PLATFORM_PROVISIONING_COPY_ACCOUNT_MS, startTime, callerPackage); Slogf.i(LOG_TAG, "Copy account successful to " + targetUser); return true; } else { logCopyAccountStatus(COPY_ACCOUNT_FAILED, callerPackage); Slogf.e(LOG_TAG, "Failed to copy account to " + targetUser); Loading @@ -21550,6 +21567,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { logCopyAccountStatus(COPY_ACCOUNT_EXCEPTION, callerPackage); Slogf.e(LOG_TAG, "Exception copying account to " + targetUser, e); } return false; } private static void logCopyAccountStatus(@CopyAccountStatus int status, String callerPackage) {