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

Commit 40faf8dc authored by Jeff Sharkey's avatar Jeff Sharkey Committed by Android Git Automerger
Browse files

am e0475c82: Gracefully handle missing directories.

* commit 'e0475c82':
  Gracefully handle missing directories.
parents fa1225d0 e0475c82
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -175,8 +175,8 @@ public class NativeActivity extends Activity implements SurfaceHolder.Callback2,
                ? savedInstanceState.getByteArray(KEY_NATIVE_SAVED_STATE) : null;

        mNativeHandle = loadNativeCode(path, funcname, Looper.myQueue(),
                 getFilesDir().getAbsolutePath(), getObbDir().getAbsolutePath(),
                 getExternalFilesDir(null).getAbsolutePath(),
                getAbsolutePath(getFilesDir()), getAbsolutePath(getObbDir()),
                getAbsolutePath(getExternalFilesDir(null)),
                Build.VERSION.SDK_INT, getAssets(), nativeSavedState);

        if (mNativeHandle == 0) {
@@ -185,6 +185,10 @@ public class NativeActivity extends Activity implements SurfaceHolder.Callback2,
        super.onCreate(savedInstanceState);
    }

    private static String getAbsolutePath(File file) {
        return (file != null) ? file.getAbsolutePath() : null;
    }

    @Override
    protected void onDestroy() {
        mDestroyed = true;
+10 −6
Original line number Diff line number Diff line
@@ -306,19 +306,23 @@ loadNativeCode_native(JNIEnv* env, jobject clazz, jstring path, jstring funcName
        code->internalDataPath = code->internalDataPathObj.string();
        env->ReleaseStringUTFChars(internalDataDir, dirStr);
    
        if (externalDataDir != NULL) {
            dirStr = env->GetStringUTFChars(externalDataDir, NULL);
            code->externalDataPathObj = dirStr;
        code->externalDataPath = code->externalDataPathObj.string();
            env->ReleaseStringUTFChars(externalDataDir, dirStr);
        }
        code->externalDataPath = code->externalDataPathObj.string();

        code->sdkVersion = sdkVersion;
        
        code->assetManager = assetManagerForJavaObject(env, jAssetMgr);

        if (obbDir != NULL) {
            dirStr = env->GetStringUTFChars(obbDir, NULL);
            code->obbPathObj = dirStr;
        code->obbPath = code->obbPathObj.string();
            env->ReleaseStringUTFChars(obbDir, dirStr);
        }
        code->obbPath = code->obbPathObj.string();

        jbyte* rawSavedState = NULL;
        jsize rawSavedSize = 0;