mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-04 19:33:18 +00:00
Bug 1415929 - [1.0] Move Android app data directory out of setting to an environment variable. r=snorp
This commit is contained in:
parent
e1c8aba28f
commit
41e3646a3a
@ -6,7 +6,6 @@
|
||||
|
||||
package org.mozilla.gecko;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URLConnection;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@ -477,16 +476,6 @@ public class GeckoSession implements Parcelable {
|
||||
preload(appContext, /* geckoArgs */ null, multiprocess);
|
||||
}
|
||||
|
||||
if (mSettings.getString(GeckoSessionSettings.DATA_DIR) == null) {
|
||||
final File dataDir = new File(appContext.getApplicationInfo().dataDir);
|
||||
try {
|
||||
mSettings.setString(GeckoSessionSettings.DATA_DIR,
|
||||
dataDir.getCanonicalPath());
|
||||
} catch (final java.io.IOException e) {
|
||||
Log.e(LOGTAG, "Failed to resolve app data directory");
|
||||
}
|
||||
}
|
||||
|
||||
final String chromeUri = mSettings.getString(GeckoSessionSettings.CHROME_URI);
|
||||
final int screenId = mSettings.getInt(GeckoSessionSettings.SCREEN_ID);
|
||||
final boolean isPrivate = mSettings.getBoolean(GeckoSessionSettings.USE_PRIVATE_MODE);
|
||||
|
@ -84,12 +84,6 @@ public final class GeckoSessionSettings implements Parcelable {
|
||||
public static final Key<Boolean> USE_REMOTE_DEBUGGER =
|
||||
new Key<Boolean>("useRemoteDebugger");
|
||||
|
||||
public static final Key<String> DEBUGGER_SOCKET_DIR =
|
||||
new Key<String>("debuggerSocketDir");
|
||||
|
||||
/* package */ static final Key<String> DATA_DIR =
|
||||
new Key<String>("dataDir", /* initOnly */ true, /* values */ null);
|
||||
|
||||
private final GeckoSession mSession;
|
||||
private final GeckoBundle mBundle;
|
||||
|
||||
@ -108,7 +102,6 @@ public final class GeckoSessionSettings implements Parcelable {
|
||||
mBundle.putBoolean(USE_MULTIPROCESS.name, true);
|
||||
mBundle.putInt(DISPLAY_MODE.name, DISPLAY_MODE_BROWSER);
|
||||
mBundle.putBoolean(USE_REMOTE_DEBUGGER.name, false);
|
||||
mBundle.putString(DEBUGGER_SOCKET_DIR.name, null);
|
||||
}
|
||||
|
||||
/* package */ GeckoSessionSettings(final GeckoSessionSettings settings,
|
||||
|
@ -125,6 +125,13 @@ public final class GeckoLoader {
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
final File dataDir = new File(context.getApplicationInfo().dataDir);
|
||||
putenv("MOZ_ANDROID_DATA_DIR=" + dataDir.getCanonicalPath());
|
||||
} catch (final java.io.IOException e) {
|
||||
Log.e(LOGTAG, "Failed to resolve app data directory");
|
||||
}
|
||||
|
||||
putenv("MOZ_ANDROID_PACKAGE_NAME=" + context.getPackageName());
|
||||
|
||||
setupDownloadEnvironment(context);
|
||||
|
@ -50,15 +50,23 @@ class GeckoViewRemoteDebugger extends GeckoViewModule {
|
||||
"resource://gre/modules/dbg-browser-actors.js");
|
||||
DebuggerServer.allowChromeProcess = true;
|
||||
}
|
||||
this._isEnabled = true;
|
||||
this._usbDebugger.stop();
|
||||
|
||||
let windowId = this.window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils)
|
||||
.outerWindowID;
|
||||
let portOrPath = (this.settings.debuggerSocketDir || this.settings.dataDir) +
|
||||
"/firefox-debugger-socket-" +
|
||||
windowId;
|
||||
let env = Cc["@mozilla.org/process/environment;1"]
|
||||
.getService(Ci.nsIEnvironment);
|
||||
let dataDir = env.get("MOZ_ANDROID_DATA_DIR");
|
||||
|
||||
if (!dataDir) {
|
||||
debug("Missing env MOZ_ANDROID_DATA_DIR - aborting debugger server start");
|
||||
return;
|
||||
}
|
||||
|
||||
this._isEnabled = true;
|
||||
this._usbDebugger.stop();
|
||||
|
||||
let portOrPath = dataDir + "/firefox-debugger-socket-" + windowId;
|
||||
this._usbDebugger.start(portOrPath);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user