Bug 912898 - B2G: Don't kill adb (or lock the screen) if a debugger client is connected r=past

This commit is contained in:
Fabrice Desré 2013-09-07 16:28:51 -07:00
parent 0f45803eae
commit a1fd669571
3 changed files with 31 additions and 2 deletions

View File

@ -314,8 +314,15 @@ let AdbController = {
}
return;
}
// Check if we have a remote debugging session going on. If so, we won't
// disable adb even if the screen is locked.
let isDebugging = Object.keys(DebuggerServer._connections).length > 0;
debug("isDebugging=" + isDebugging);
let enableAdb = this.remoteDebuggerEnabled &&
!(this.lockEnabled && this.locked);
(!(this.lockEnabled && this.locked) || isDebugging);
let useDisableAdbTimer = true;
try {
if (Services.prefs.getBoolPref("marionette.defaultPrefs.enabled")) {
@ -366,7 +373,7 @@ let AdbController = {
}
}
if (useDisableAdbTimer) {
if (enableAdb) {
if (enableAdb && !isDebugging) {
this.startDisableAdbTimer();
} else {
this.stopDisableAdbTimer();

View File

@ -1025,6 +1025,10 @@ let RemoteDebugger = {
DebuggerServer.addActors('chrome://browser/content/dbg-browser-actors.js');
DebuggerServer.addActors("resource://gre/modules/devtools/server/actors/webapps.js");
DebuggerServer.registerModule("devtools/server/actors/device");
DebuggerServer.onConnectionChange = function(what) {
AdbController.updateState();
}
}
let port = Services.prefs.getIntPref('devtools.debugger.remote-port') || 6000;

View File

@ -177,6 +177,19 @@ var DebuggerServer = {
*/
chromeWindowType: null,
/**
* Set that to a function that will be called anytime a new connection
* is opened or one is closed.
*/
onConnectionChange: null,
_fireConnectionChange: function(aWhat) {
if (this.onConnectionChange &&
typeof this.onConnectionChange === "function") {
this.onConnectionChange(aWhat);
}
},
/**
* Prompt the user to accept or decline the incoming connection. This is the
* default implementation that products embedding the debugger server may
@ -275,6 +288,9 @@ var DebuggerServer = {
delete this._allowConnection;
this._transportInitialized = false;
this._initialized = false;
this._fireConnectionChange("closed");
dumpn("Debugger server is shut down.");
},
@ -546,6 +562,7 @@ var DebuggerServer = {
}
aTransport.ready();
this._fireConnectionChange("opened");
return conn;
},
@ -554,6 +571,7 @@ var DebuggerServer = {
*/
_connectionClosed: function DS_connectionClosed(aConnection) {
delete this._connections[aConnection.prefix];
this._fireConnectionChange("closed");
},
// DebuggerServer extension API.