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

Commit 0e8ae16f authored by Chih-Wei Huang's avatar Chih-Wei Huang Committed by Brian Carlstrom
Browse files

Fix incorrect odex path handling

It's wrong to just concatenate the apk_path and .odex.
The bug prevents the prebuilt odex being used since Kitkat.

The patch is copied from the code of JellyBean.

Change-Id: I0ce8a877e3df8ae1ab9a0e3aeeef2d5253efc223
parent 3f0d5669
Loading
Loading
Loading
Loading
+7 −3
Original line number Original line Diff line number Diff line
@@ -685,10 +685,14 @@ int dexopt(const char *apk_path, uid_t uid, int is_public,
    /* Before anything else: is there a .odex file?  If so, we have
    /* Before anything else: is there a .odex file?  If so, we have
     * precompiled the apk and there is nothing to do here.
     * precompiled the apk and there is nothing to do here.
     */
     */
    sprintf(out_path, "%s%s", apk_path, ".odex");
    strcpy(out_path, apk_path);
    end = strrchr(out_path, '.');
    if (end != NULL) {
        strcpy(end, ".odex");
        if (stat(out_path, &dex_stat) == 0) {
        if (stat(out_path, &dex_stat) == 0) {
            return 0;
            return 0;
        }
        }
    }


    if (create_cache_path(out_path, apk_path)) {
    if (create_cache_path(out_path, apk_path)) {
        return -1;
        return -1;