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

Commit edb20ac7 authored by Kristian Monsen's avatar Kristian Monsen
Browse files

Adding a way for native code to get the apps data directory

Change-Id: I9da5376a202cb2d24c2125352efeb9bffcfe357b
parent f6e39bbf
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -72,6 +72,8 @@ class BrowserFrame extends Handler {
    // queue has been cleared,they are ignored.
    private boolean mBlockMessages = false;

    private static String sDataDirectory = "";

    // Is this frame the main frame?
    private boolean mIsMainFrame;

@@ -224,6 +226,11 @@ class BrowserFrame extends Handler {
        AssetManager am = context.getAssets();
        nativeCreateFrame(w, am, proxy.getBackForwardList());

        if (sDataDirectory.length() == 0) {
            String dir = appContext.getFilesDir().getAbsolutePath();
            sDataDirectory =  dir.substring(0, dir.lastIndexOf('/'));
        }

        if (DebugFlags.BROWSER_FRAME) {
            Log.v(LOGTAG, "BrowserFrame constructor: this=" + this);
        }
@@ -616,6 +623,14 @@ class BrowserFrame extends Handler {
        return size;
    }

    /**
     * Called by JNI. Gets the applications data directory
     * @return String The applications data directory
     */
    private static String getDataDirectory() {
        return sDataDirectory;
    }

    /**
     * Start loading a resource.
     * @param loaderHandle The native ResourceLoader that is the target of the