5
votes

I develop Android app, which uses ciphered obb file. This obb file consists of 3 files (I created it with jobb tool). On the most devices all is ok, but on the three devices there is ERROR_COULD_NOT_MOUNT. And I don't understand how to fix it. I want to distribute app without any errors :) Please, help me to do it! :)

That I have tryed: 1) Unmount and mount obb file; 2) Create obb file from the folder without "read-only" attribute. But all of it won't work.

Steps to reproduce the problem (including sample code if appropriate). 1) Create folder, put into it 3 different files. 2) Create obb file from the folder from step 1. 3) Try to mount this file from the app (sample code below).

 

    final File mainFile = new File(Environment.getExternalStorageDirectory() + "/Android/obb/" + packageName + "/"
                    + "main." + versionCode + "." + packageName + ".obb");
    OnObbStateChangeListener listener = new OnObbStateChangeListener() {
        @Override
        public void onObbStateChange(String path, int state) {
            super.onObbStateChange(path, state);
            if (state == OnObbStateChangeListener.MOUNTED) {
                doNextSteps();
            } else if (state ==    OnObbStateChangeListener.ERROR_COULD_NOT_MOUNT) {
                Toast.makeText(getApplicationContext(), "ERROR_COULD_NOT_MOUNT", Toast.LENGTH_LONG).show();
            } 
         }
    };

    if (!storageManager.isObbMounted(mainFile.getAbsolutePath())) {
        storageManager.unmountObb(mainFile.getAbsolutePath(), true, listener);
        storageManager.mountObb(mainFile.getAbsolutePath(), "password_string", listener);
    } else {
        doNextSteps();
    }

What happened. I have "ERROR_COULD_NOT_MOUNT" error on the following devices: 1) HTC PJ401 One S; 2) Samsung GT-I9505 Galaxy S IV; 3) Samsung SM-N9005 Galaxy Note 3. But on Samsung SM-N900T Galaxy Note 3 and Samsung GT-I9500 Galaxy S IV all is ok.

2

2 Answers

2
votes

So, after all my investigations I can say. All I can to do is workaround. And I have created one file from the these 3 files by

copy /B file1+file2+file3 result_file.obb

And then I use this file as non-ciphered obb. After all this manipulations all works well.

2
votes

I find the reason for some obb file could not be mounted. There a random solt when make obb file, an hashkey generated by PBKDF2WithHmacSHA1. the hashkey from bytes convert to hex string has a bug. I submit a patch to project : platform/framwork/base.

https://android-review.googlesource.com/#/c/230280/

I modified the jobb tool. Add check the hashkey to skip the wrong key generated. Before the Android merge the patch, you can use this patch. This patch also fix the dump files bug.

https://android-review.googlesource.com/#/c/231431/