class UserBackupManagerService {

    static UserBackupManagerService createAndInitializeService(
            @UserIdInt int userId,
            Context context,
            Trampoline trampoline,
            Set<ComponentName> transportWhitelist) {
        String currentTransport =
                Settings.Secure.getStringForUser(
                        context.getContentResolver(), Settings.Secure.BACKUP_TRANSPORT, userId);
        if (TextUtils.isEmpty(currentTransport)) {
            currentTransport = null;
        }

        if (DEBUG) {
            Slog.v(TAG, "Starting with transport " + currentTransport);
        }
        TransportManager transportManager =
                new TransportManager(userId, context, transportWhitelist, currentTransport);

        File baseStateDir = UserBackupManagerFiles.getBaseStateDir(userId);
        File dataDir = UserBackupManagerFiles.getDataDir(userId);

        HandlerThread userBackupThread =
                new HandlerThread("backup-" + userId, Process.THREAD_PRIORITY_BACKGROUND);
        userBackupThread.start();
        if (DEBUG) {
            Slog.d(TAG, "Started thread " + userBackupThread.getName() + " for user " + userId);
        }

        return createAndInitializeService(
                userId,
                context,
                trampoline,
                userBackupThread,
                baseStateDir,
                dataDir,
                transportManager);
    }

    private  UserBackupManagerService(
            @UserIdInt int userId,
            Context context,
            Trampoline parent,
            HandlerThread userBackupThread,
            File baseStateDir,
            File dataDir,
            TransportManager transportManager);

}