mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 836770 - Don't change persist.sys.usb.config if it already has the correct value (ADB) r=fabrice
This commit is contained in:
parent
8fb050f647
commit
7939acff1b
@ -207,11 +207,25 @@ SettingsListener.observe('devtools.debugger.remote-enabled', false, function(val
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
// Configure adb.
|
||||
try {
|
||||
let current = libcutils.property_get("persist.sys.usb.config");
|
||||
let prefix = current.replace(/,adb/, "");
|
||||
libcutils.property_set("persist.sys.usb.config",
|
||||
prefix + (value ? ",adb" : ""));
|
||||
current = libcutils.property_get("persist.sys.usb.config");
|
||||
let currentConfig = libcutils.property_get("persist.sys.usb.config");
|
||||
let configFuncs = currentConfig.split(",");
|
||||
let adbIndex = configFuncs.indexOf("adb");
|
||||
|
||||
if (value) {
|
||||
// Add adb to the list of functions, if not already present
|
||||
if (adbIndex < 0) {
|
||||
configFuncs.push("adb");
|
||||
}
|
||||
} else {
|
||||
// Remove adb from the list of functions, if present
|
||||
if (adbIndex >= 0) {
|
||||
configFuncs.splice(adbIndex,1);
|
||||
}
|
||||
}
|
||||
let newConfig = configFuncs.join(",");
|
||||
if (newConfig != currentConfig) {
|
||||
libcutils.property_set("persist.sys.usb.config", newConfig);
|
||||
}
|
||||
} catch(e) {
|
||||
dump("Error configuring adb: " + e);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user