Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5763c1f5 authored by Daisuke Miyakawa's avatar Daisuke Miyakawa Committed by Jean-Baptiste Queru
Browse files

Call register_localized_collators() with the current locale.

Make JNI function for setLocale() call register_localized_collators()
with the current locale, not previous one, every time it is possible.

This is a partial cherry-pick of b945639d

BUG: 2514026
Change-Id: I584f1f68814dc084e699714e9d14a034123b49da
parent 0ba2d478
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -262,7 +262,7 @@ static void native_setLocale(JNIEnv* env, jobject object, jstring localeString,
        goto done;
    }

    dbLocale = (rowCount >= 1) ? meta[1 * colCount + 0] : NULL;
    dbLocale = (rowCount >= 1) ? meta[colCount] : NULL;

    if (dbLocale != NULL && !strcmp(dbLocale, locale8)) {
        // database locale is the same as the desired locale; set up the collators and go
@@ -273,7 +273,8 @@ static void native_setLocale(JNIEnv* env, jobject object, jstring localeString,

    if ((flags & OPEN_READONLY)) {
        // read-only database, so we're going to have to put up with whatever we got
        err = register_localized_collators(handle, dbLocale ? dbLocale : locale8, UTF16_STORAGE);
        // For registering new index. Not for modifing the read-only database.
        err = register_localized_collators(handle, locale8, UTF16_STORAGE);
        if (err != SQLITE_OK) throw_sqlite3_exception(env, handle);
        goto done;
    }
@@ -286,7 +287,7 @@ static void native_setLocale(JNIEnv* env, jobject object, jstring localeString,
        goto done;
    }

    err = register_localized_collators(handle, dbLocale ? dbLocale : locale8, UTF16_STORAGE);
    err = register_localized_collators(handle, locale8, UTF16_STORAGE);
    if (err != SQLITE_OK) {
        LOGE("register_localized_collators() failed setting locale\n");
        throw_sqlite3_exception(env, handle);