Merge m-c to inbound, a=merge

This commit is contained in:
Wes Kocher 2015-10-02 13:43:19 -07:00
commit ee952246ce
44 changed files with 505 additions and 327 deletions

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="9a682cb7bc8b7fde624a9b2b3c2d64415a08b04b"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="f3d9981dccfa4dfdfcb865d95fdcfb85e4077e1e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7e0fe55ac52323eace5a6119ab2b911fc4f64495"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="9a682cb7bc8b7fde624a9b2b3c2d64415a08b04b"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="f3d9981dccfa4dfdfcb865d95fdcfb85e4077e1e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7e0fe55ac52323eace5a6119ab2b911fc4f64495"/>

View File

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="9a682cb7bc8b7fde624a9b2b3c2d64415a08b04b"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="f3d9981dccfa4dfdfcb865d95fdcfb85e4077e1e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7e0fe55ac52323eace5a6119ab2b911fc4f64495"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="27eb2f04e149fc2c9976d881b1b5984bbe7ee089"/>

View File

@ -17,7 +17,7 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="9a682cb7bc8b7fde624a9b2b3c2d64415a08b04b"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="f3d9981dccfa4dfdfcb865d95fdcfb85e4077e1e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7e0fe55ac52323eace5a6119ab2b911fc4f64495"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="58909a53f638af022ab09f7a8f6976b0cae8f133"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="f004530b30a63c08a16d82536858600446b2abf5"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="9a682cb7bc8b7fde624a9b2b3c2d64415a08b04b"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="f3d9981dccfa4dfdfcb865d95fdcfb85e4077e1e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7e0fe55ac52323eace5a6119ab2b911fc4f64495"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
@ -128,7 +128,7 @@
<!-- Emulator specific things -->
<project name="device/generic/armv7-a-neon" path="device/generic/armv7-a-neon" revision="72ffdf71c68a96309212eb13d63560d66db14c9e"/>
<project name="device_generic_goldfish" path="device/generic/goldfish" remote="b2g" revision="8d4018ebd33ac3f1a043b2d54bc578028656a659"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="e002268b30ce69725e60fdc827a19d729cce7396"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="b2773dbc3cb24e70cff2b05522e9c959250400ac"/>
<project name="platform/external/libnfc-nci" path="external/libnfc-nci" revision="f37bd545063039e30a92f2550ae78c0e6e4e2d08"/>
<project name="platform_external_wpa_supplicant_8" path="external/wpa_supplicant_8" remote="b2g" revision="0c6a6547cd1fd302fa2b0f6e375654df36bf0ec4"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="7132bc11fbc68acfebcd509095562ca04fad5584"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="c9d4fe680662ee44a4bdea42ae00366f5df399cf">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="9a682cb7bc8b7fde624a9b2b3c2d64415a08b04b"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="f3d9981dccfa4dfdfcb865d95fdcfb85e4077e1e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7e0fe55ac52323eace5a6119ab2b911fc4f64495"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>

View File

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="9a682cb7bc8b7fde624a9b2b3c2d64415a08b04b"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="f3d9981dccfa4dfdfcb865d95fdcfb85e4077e1e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7e0fe55ac52323eace5a6119ab2b911fc4f64495"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="27eb2f04e149fc2c9976d881b1b5984bbe7ee089"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="9a682cb7bc8b7fde624a9b2b3c2d64415a08b04b"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="f3d9981dccfa4dfdfcb865d95fdcfb85e4077e1e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7e0fe55ac52323eace5a6119ab2b911fc4f64495"/>

View File

@ -1,9 +1,9 @@
{
"git": {
"git_revision": "9a682cb7bc8b7fde624a9b2b3c2d64415a08b04b",
"git_revision": "f3d9981dccfa4dfdfcb865d95fdcfb85e4077e1e",
"remote": "https://git.mozilla.org/releases/gaia.git",
"branch": ""
},
"revision": "73f844def0a5b0a7e077b68e5e16ffd6753129da",
"revision": "ad7f7540499e0cf54ddd5cf41ff39886cf63acfb",
"repo_path": "integration/gaia-central"
}

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="9a682cb7bc8b7fde624a9b2b3c2d64415a08b04b"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="f3d9981dccfa4dfdfcb865d95fdcfb85e4077e1e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7e0fe55ac52323eace5a6119ab2b911fc4f64495"/>

View File

@ -18,7 +18,7 @@
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="9a682cb7bc8b7fde624a9b2b3c2d64415a08b04b"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="f3d9981dccfa4dfdfcb865d95fdcfb85e4077e1e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7e0fe55ac52323eace5a6119ab2b911fc4f64495"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="58909a53f638af022ab09f7a8f6976b0cae8f133"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="f004530b30a63c08a16d82536858600446b2abf5"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="c9d4fe680662ee44a4bdea42ae00366f5df399cf">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="9a682cb7bc8b7fde624a9b2b3c2d64415a08b04b"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="f3d9981dccfa4dfdfcb865d95fdcfb85e4077e1e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7e0fe55ac52323eace5a6119ab2b911fc4f64495"/>

View File

@ -60,13 +60,13 @@ var LoopUI;
*/
promiseDocumentVisible(aDocument) {
if (!aDocument.hidden) {
return Promise.resolve();
return Promise.resolve(aDocument);
}
return new Promise((resolve) => {
aDocument.addEventListener("visibilitychange", function onVisibilityChanged() {
aDocument.removeEventListener("visibilitychange", onVisibilityChanged);
resolve();
resolve(aDocument);
});
});
},
@ -81,6 +81,15 @@ var LoopUI;
* @return {Promise}
*/
togglePanel: function(event, tabId = null) {
if (!this.panel) {
// We're on the hidden window! What fun!
let obs = win => {
Services.obs.removeObserver(obs, "browser-delayed-startup-finished");
win.LoopUI.togglePanel(event, tabId);
};
Services.obs.addObserver(obs, "browser-delayed-startup-finished", false);
return OpenBrowserWindow();
}
if (this.panel.state == "open") {
return new Promise(resolve => {
this.panel.hidePopup();
@ -88,7 +97,12 @@ var LoopUI;
});
}
return this.openCallPanel(event, tabId);
return this.openCallPanel(event, tabId).then(doc => {
let fm = Services.focus;
fm.moveFocus(doc.defaultView, null, fm.MOVEFOCUS_FIRST, fm.FLAG_NOSCROLL);
}).catch(err => {
Cu.reportError(x);
});
},
/**
@ -130,14 +144,14 @@ var LoopUI;
let documentDOMLoaded = () => {
iframe.removeEventListener("DOMContentLoaded", documentDOMLoaded, true);
this.injectLoopAPI(iframe.contentWindow);
iframe.contentWindow.addEventListener("loopPanelInitialized", function loopPanelInitialized() {
this.injectLoopAPI(iframe.contentWindow);
iframe.contentWindow.addEventListener("loopPanelInitialized", function loopPanelInitialized() {
iframe.contentWindow.removeEventListener("loopPanelInitialized",
loopPanelInitialized);
loopPanelInitialized);
showTab();
});
};
iframe.addEventListener("DOMContentLoaded", documentDOMLoaded, true);
});
};
iframe.addEventListener("DOMContentLoaded", documentDOMLoaded, true);
};
// Used to clear the temporary "login" state from the button.
@ -153,7 +167,9 @@ var LoopUI;
return;
}
this.PanelFrame.showPopup(window, event ? event.target : this.toolbarButton.node,
let anchor = event ? event.target : this.toolbarButton.anchor;
this.PanelFrame.showPopup(window, anchor,
"loop", null, "about:looppanel",
// Loop wants a fixed size for the panel. This also stops it dynamically resizing.
{ width: 330, height: 410 },

View File

@ -507,6 +507,12 @@
label="&webapps.label;"
accesskey="&webapps.accesskey;"
oncommand="BrowserOpenApps();"/>
<menuitem id="menu_openLoop"
label="&loopMenuItem.label;"
accesskey = "&loopMenuItem.accesskey;"
oncommand="LoopUI.togglePanel();"/>
#ifdef MOZ_SERVICES_SYNC
<!-- only one of sync-setup, sync-syncnowitem or sync-reauthitem will be showing at once -->
<menuitem id="sync-setup"

View File

@ -1847,7 +1847,10 @@
// If we open a new tab with the newtab URL in the default
// userContext, check if there is a preloaded browser ready.
if (aURI == BROWSER_NEW_TAB_URL && !aUserContextId) {
// Private windows are not included because both the label and the
// icon for the tab would be set incorrectly (see bug 1195981).
if (aURI == BROWSER_NEW_TAB_URL && !aUserContextId &&
!PrivateBrowsingUtils.isWindowPrivate(window)) {
b = this._getPreloadedBrowser();
usingPreloadedContent = !!b;
}

View File

@ -313,6 +313,7 @@ p {
border-radius: 2px;
border-bottom-right-radius: 0;
border-top-right-radius: 0;
line-height: 0.9rem;
}
/* Alerts/Notifications */

View File

@ -430,16 +430,11 @@ html[dir="rtl"] .room-failure > .settings-control {
.screen-share-menu.dropdown-menu,
.settings-menu.dropdown-menu {
left: auto;
bottom: 3.1rem;
}
.screen-share-menu.dropdown-menu {
/*offset dropdown menu to be above menu button*/
right: 40px;
}
.settings-menu.dropdown-menu {
left: auto;
/*offset dropdown menu to be above menu button*/
right: 14px;
}

View File

@ -338,7 +338,10 @@ loop.store = loop.store || {};
}
this._endSession();
this.setStoreState({callState: CALL_STATES.FINISHED});
this.setStoreState({
callState: this._storeState.callState === CALL_STATES.ONGOING ?
CALL_STATES.FINISHED : CALL_STATES.CLOSE
});
},
/**

View File

@ -163,7 +163,7 @@ loop.shared.views = (function(_, mozL10n) {
React.createElement("div", null,
React.createElement("button", {className: screenShareClasses,
onClick: this.handleClick,
ref: "menu-button",
ref: "anchor",
title: this._getTitle()},
isActive ? null : React.createElement("span", {className: "chevron"})
),

View File

@ -163,7 +163,7 @@ loop.shared.views = (function(_, mozL10n) {
<div>
<button className={screenShareClasses}
onClick={this.handleClick}
ref="menu-button"
ref="anchor"
title={this._getTitle()}>
{isActive ? null : <span className="chevron"/>}
</button>

View File

@ -777,12 +777,22 @@ describe("loop.store.ConversationStore", function () {
sinon.assert.calledOnce(wsHangupSpy);
});
it("should set the callState to finished", function() {
it("should set the callState to finished for ongoing call state", function() {
store.hangupCall(new sharedActions.HangupCall());
expect(store.getStoreState("callState")).eql(CALL_STATES.FINISHED);
});
it("should set the callState to CLOSE for non-ongoing call state", function() {
store.setStoreState({
callState: CALL_STATES.CONNECTING
});
store.hangupCall(new sharedActions.HangupCall());
expect(store.getStoreState("callState")).eql(CALL_STATES.CLOSE);
});
it("should release mozLoop callsData", function() {
store.hangupCall(new sharedActions.HangupCall());

View File

@ -229,6 +229,8 @@ These should match what Safari and other Apple applications use on OS X Lion. --
<!ENTITY addons.commandkey "A">
<!ENTITY webapps.label "Apps">
<!ENTITY webapps.accesskey "p">
<!ENTITY loopMenuItem.label "Start a conversation…">
<!ENTITY loopMenuItem.accesskey "t">
<!ENTITY webDeveloperMenu.label "Web Developer">
<!ENTITY webDeveloperMenu.accesskey "W">

View File

@ -49,12 +49,6 @@ import org.apache.commons.net.ftp.FTP;
import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPFile;
import org.apache.commons.net.ftp.FTPReply;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import com.mozilla.SUTAgentAndroid.R;
import com.mozilla.SUTAgentAndroid.SUTAgentAndroid;
@ -2964,53 +2958,6 @@ private void CancelNotification()
return(sRet);
}
public String GetInternetData(String sHost, String sPort, String sURL)
{
String sRet = "";
String sNewURL = "";
HttpClient httpClient = new DefaultHttpClient();
try
{
sNewURL = "http://" + sHost + ((sPort.length() > 0) ? (":" + sPort) : "") + sURL;
HttpGet request = new HttpGet(sNewURL);
HttpResponse response = httpClient.execute(request);
int status = response.getStatusLine().getStatusCode();
// we assume that the response body contains the error message
if (status != HttpStatus.SC_OK)
{
ByteArrayOutputStream ostream = new ByteArrayOutputStream();
response.getEntity().writeTo(ostream);
Log.e("HTTP CLIENT", ostream.toString());
}
else
{
InputStream content = response.getEntity().getContent();
byte [] data = new byte [2048];
int nRead = content.read(data);
sRet = new String(data, 0, nRead);
content.close(); // this will also close the connection
}
}
catch (IllegalArgumentException e)
{
sRet = e.getLocalizedMessage();
e.printStackTrace();
}
catch (ClientProtocolException e)
{
sRet = e.getLocalizedMessage();
e.printStackTrace();
}
catch (IOException e)
{
sRet = e.getLocalizedMessage();
e.printStackTrace();
}
return(sRet);
}
public String GetTimeZone()
{
String sRet = "";

View File

@ -9,7 +9,6 @@ import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.InetAddress;
import org.apache.http.conn.util.InetAddressUtils;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.net.UnknownHostException;
@ -19,6 +18,7 @@ import java.util.Date;
import java.util.Enumeration;
import java.util.Formatter;
import java.util.List;
import java.util.regex.Pattern;
import java.util.Timer;
import com.mozilla.SUTAgentAndroid.service.ASMozStub;
@ -56,6 +56,8 @@ public class SUTAgentAndroid extends Activity
{
final Handler mHandler = new Handler();
private static final Pattern IPV4_PATTERN = Pattern.compile("^(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)(\\.(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)){3}$");
public static final int START_PRG = 1959;
MenuItem mExitMenuItem;
Timer timer = null;
@ -810,6 +812,10 @@ public class SUTAgentAndroid extends Activity
return sHWID;
}
public static boolean isIPv4Address(final String input) {
return IPV4_PATTERN.matcher(input).matches();
}
public static InetAddress getLocalInetAddress() throws SocketException
{
for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();)
@ -818,7 +824,7 @@ public class SUTAgentAndroid extends Activity
for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements();)
{
InetAddress inetAddress = enumIpAddr.nextElement();
if (!inetAddress.isLoopbackAddress() && InetAddressUtils.isIPv4Address(inetAddress.getHostAddress()))
if (!inetAddress.isLoopbackAddress() && isIPv4Address(inetAddress.getHostAddress()))
{
return inetAddress;
}

View File

@ -105,7 +105,7 @@ BluetoothDaemonCoreModule::GetAdapterPropertiesCmd(
}
nsresult
BluetoothDaemonCoreModule::GetAdapterPropertyCmd(const nsAString& aName,
BluetoothDaemonCoreModule::GetAdapterPropertyCmd(BluetoothPropertyType aType,
BluetoothResultHandler* aRes)
{
MOZ_ASSERT(NS_IsMainThread());
@ -114,8 +114,7 @@ BluetoothDaemonCoreModule::GetAdapterPropertyCmd(const nsAString& aName,
new DaemonSocketPDU(SERVICE_ID, OPCODE_GET_ADAPTER_PROPERTY,
0));
nsresult rv = PackPDU(
PackConversion<const nsAString, BluetoothPropertyType>(aName), *pdu);
nsresult rv = PackPDU(aType, *pdu);
if (NS_FAILED(rv)) {
return rv;
}
@ -129,7 +128,7 @@ BluetoothDaemonCoreModule::GetAdapterPropertyCmd(const nsAString& aName,
nsresult
BluetoothDaemonCoreModule::SetAdapterPropertyCmd(
const BluetoothNamedValue& aProperty, BluetoothResultHandler* aRes)
const BluetoothProperty& aProperty, BluetoothResultHandler* aRes)
{
MOZ_ASSERT(NS_IsMainThread());
@ -174,7 +173,7 @@ BluetoothDaemonCoreModule::GetRemoteDevicePropertiesCmd(
nsresult
BluetoothDaemonCoreModule::GetRemoteDevicePropertyCmd(
const BluetoothAddress& aRemoteAddr,
const nsAString& aName,
BluetoothPropertyType aType,
BluetoothResultHandler* aRes)
{
MOZ_ASSERT(NS_IsMainThread());
@ -183,9 +182,7 @@ BluetoothDaemonCoreModule::GetRemoteDevicePropertyCmd(
new DaemonSocketPDU(SERVICE_ID, OPCODE_GET_REMOTE_DEVICE_PROPERTY,
0));
nsresult rv = PackPDU(
aRemoteAddr,
PackConversion<nsAString, BluetoothPropertyType>(aName), *pdu);
nsresult rv = PackPDU(aRemoteAddr, aType, *pdu);
if (NS_FAILED(rv)) {
return rv;
}
@ -200,7 +197,7 @@ BluetoothDaemonCoreModule::GetRemoteDevicePropertyCmd(
nsresult
BluetoothDaemonCoreModule::SetRemoteDevicePropertyCmd(
const BluetoothAddress& aRemoteAddr,
const BluetoothNamedValue& aProperty,
const BluetoothProperty& aProperty,
BluetoothResultHandler* aRes)
{
MOZ_ASSERT(NS_IsMainThread());
@ -373,7 +370,7 @@ BluetoothDaemonCoreModule::CancelBondCmd(const BluetoothAddress& aBdAddr,
nsresult
BluetoothDaemonCoreModule::PinReplyCmd(const BluetoothAddress& aBdAddr,
bool aAccept,
const nsAString& aPinCode,
const BluetoothPinCode& aPinCode,
BluetoothResultHandler* aRes)
{
MOZ_ASSERT(NS_IsMainThread());
@ -382,10 +379,7 @@ BluetoothDaemonCoreModule::PinReplyCmd(const BluetoothAddress& aBdAddr,
new DaemonSocketPDU(SERVICE_ID, OPCODE_PIN_REPLY,
0));
nsresult rv = PackPDU(
aBdAddr,
aAccept,
PackConversion<nsAString, BluetoothPinCode>(aPinCode), *pdu);
nsresult rv = PackPDU(aBdAddr, aAccept, aPinCode, *pdu);
if (NS_FAILED(rv)) {
return rv;
}
@ -961,7 +955,8 @@ public:
{ }
nsresult
operator () (BluetoothAddress& aArg1, nsString& aArg2, uint32_t& aArg3) const
operator () (BluetoothAddress& aArg1, BluetoothRemoteName& aArg2,
uint32_t& aArg3) const
{
DaemonSocketPDU& pdu = GetPDU();
@ -972,8 +967,7 @@ public:
}
/* Read remote name */
rv = UnpackPDU(
pdu, UnpackConversion<BluetoothRemoteName, nsAString>(aArg2));
rv = UnpackPDU(pdu, aArg2);
if (NS_FAILED(rv)) {
return rv;
}
@ -1007,8 +1001,9 @@ public:
{ }
nsresult
operator () (BluetoothAddress& aArg1, nsString& aArg2, uint32_t& aArg3,
BluetoothSspVariant& aArg4, uint32_t& aArg5) const
operator () (BluetoothAddress& aArg1, BluetoothRemoteName& aArg2,
uint32_t& aArg3, BluetoothSspVariant& aArg4,
uint32_t& aArg5) const
{
DaemonSocketPDU& pdu = GetPDU();
@ -1019,8 +1014,7 @@ public:
}
/* Read remote name */
rv = UnpackPDU(
pdu, UnpackConversion<BluetoothRemoteName, nsAString>(aArg2));
rv = UnpackPDU(pdu, aArg2);
if (NS_FAILED(rv)) {
return rv;
}
@ -1113,7 +1107,7 @@ public:
nsresult
operator () (BluetoothStatus& aArg1, BluetoothAddress& aArg2,
bool& aArg3) const
BluetoothAclState& aArg3) const
{
DaemonSocketPDU& pdu = GetPDU();
@ -1130,8 +1124,7 @@ public:
}
/* Read ACL state */
rv = UnpackPDU(
pdu, UnpackConversion<BluetoothAclState, bool>(aArg3));
rv = UnpackPDU(pdu, aArg3);
if (NS_FAILED(rv)) {
return rv;
}

View File

@ -79,21 +79,21 @@ public:
nsresult GetAdapterPropertiesCmd(BluetoothResultHandler* aRes);
nsresult GetAdapterPropertyCmd(const nsAString& aName,
nsresult GetAdapterPropertyCmd(BluetoothPropertyType aType,
BluetoothResultHandler* aRes);
nsresult SetAdapterPropertyCmd(const BluetoothNamedValue& aProperty,
nsresult SetAdapterPropertyCmd(const BluetoothProperty& aProperty,
BluetoothResultHandler* aRes);
nsresult GetRemoteDevicePropertiesCmd(const BluetoothAddress& aRemoteAddr,
BluetoothResultHandler* aRes);
nsresult GetRemoteDevicePropertyCmd(const BluetoothAddress& aRemoteAddr,
const nsAString& aName,
BluetoothPropertyType aType,
BluetoothResultHandler* aRes);
nsresult SetRemoteDevicePropertyCmd(const BluetoothAddress& aRemoteAddr,
const BluetoothNamedValue& aProperty,
const BluetoothProperty& aProperty,
BluetoothResultHandler* aRes);
nsresult GetRemoteServiceRecordCmd(const BluetoothAddress& aRemoteAddr,
@ -118,7 +118,7 @@ public:
BluetoothResultHandler* aRes);
nsresult PinReplyCmd(const BluetoothAddress& aBdAddr, bool aAccept,
const nsAString& aPinCode,
const BluetoothPinCode& aPinCode,
BluetoothResultHandler* aRes);
nsresult SspReplyCmd(const BluetoothAddress& aBdAddr,
@ -266,13 +266,16 @@ private:
DiscoveryStateChangedNotification;
typedef mozilla::ipc::DaemonNotificationRunnable3<
NotificationHandlerWrapper, void, BluetoothAddress, nsString, uint32_t,
const BluetoothAddress&, const nsAString&>
NotificationHandlerWrapper, void,
BluetoothAddress, BluetoothRemoteName, uint32_t,
const BluetoothAddress&, const BluetoothRemoteName&>
PinRequestNotification;
typedef mozilla::ipc::DaemonNotificationRunnable5<
NotificationHandlerWrapper, void, BluetoothAddress, nsString, uint32_t,
BluetoothSspVariant, uint32_t, const BluetoothAddress&, const nsAString&>
NotificationHandlerWrapper, void,
BluetoothAddress, BluetoothRemoteName, uint32_t, BluetoothSspVariant,
uint32_t,
const BluetoothAddress&, const BluetoothRemoteName&>
SspRequestNotification;
typedef mozilla::ipc::DaemonNotificationRunnable3<
@ -281,7 +284,8 @@ private:
BondStateChangedNotification;
typedef mozilla::ipc::DaemonNotificationRunnable3<
NotificationHandlerWrapper, void, BluetoothStatus, BluetoothAddress, bool,
NotificationHandlerWrapper, void,
BluetoothStatus, BluetoothAddress, BluetoothAclState,
BluetoothStatus, const BluetoothAddress&>
AclStateChangedNotification;

View File

@ -513,71 +513,6 @@ Convert(int32_t aIn, BluetoothGattStatus& aOut)
return NS_OK;
}
nsresult
Convert(const nsAString& aIn, BluetoothPinCode& aOut)
{
if (MOZ_HAL_IPC_CONVERT_WARN_IF(
aIn.Length() > MOZ_ARRAY_LENGTH(aOut.mPinCode), nsAString,
BluetoothPinCode)) {
return NS_ERROR_ILLEGAL_VALUE;
}
NS_ConvertUTF16toUTF8 pinCodeUTF8(aIn);
const char* str = pinCodeUTF8.get();
nsAString::size_type i;
// Fill pin into aOut
for (i = 0; i < aIn.Length(); ++i, ++str) {
aOut.mPinCode[i] = static_cast<uint8_t>(*str);
}
// Clear remaining bytes in aOut
size_t ntrailing = (MOZ_ARRAY_LENGTH(aOut.mPinCode) - aIn.Length()) *
sizeof(aOut.mPinCode[0]);
memset(aOut.mPinCode + aIn.Length(), 0, ntrailing);
aOut.mLength = aIn.Length();
return NS_OK;
}
nsresult
Convert(const nsAString& aIn, BluetoothPropertyType& aOut)
{
if (aIn.EqualsLiteral("Name")) {
aOut = PROPERTY_BDNAME;
} else if (aIn.EqualsLiteral("Discoverable")) {
aOut = PROPERTY_ADAPTER_SCAN_MODE;
} else if (aIn.EqualsLiteral("DiscoverableTimeout")) {
aOut = PROPERTY_ADAPTER_DISCOVERY_TIMEOUT;
} else if (MOZ_HAL_IPC_CONVERT_WARN_IF(
false, nsAString, BluetoothPropertyType)) {
BT_LOGR("Invalid property name: %s", NS_ConvertUTF16toUTF8(aIn).get());
aOut = static_cast<BluetoothPropertyType>(0); // silences compiler warning
return NS_ERROR_ILLEGAL_VALUE;
}
return NS_OK;
}
nsresult
Convert(const nsAString& aIn, BluetoothServiceName& aOut)
{
NS_ConvertUTF16toUTF8 serviceNameUTF8(aIn);
const char* str = serviceNameUTF8.get();
size_t len = strlen(str);
if (MOZ_HAL_IPC_CONVERT_WARN_IF(
len > sizeof(aOut.mName), nsAString, BluetoothServiceName)) {
return NS_ERROR_ILLEGAL_VALUE;
}
memcpy(aOut.mName, str, len);
memset(aOut.mName + len, 0, sizeof(aOut.mName) - len);
return NS_OK;
}
nsresult
Convert(nsresult aIn, BluetoothStatus& aOut)
{
@ -591,21 +526,6 @@ Convert(nsresult aIn, BluetoothStatus& aOut)
return NS_OK;
}
nsresult
Convert(BluetoothAclState aIn, bool& aOut)
{
static const bool sBool[] = {
[ACL_STATE_CONNECTED] = true,
[ACL_STATE_DISCONNECTED] = false
};
if (MOZ_HAL_IPC_CONVERT_WARN_IF(
aIn >= MOZ_ARRAY_LENGTH(sBool), BluetoothAclState, bool)) {
return NS_ERROR_ILLEGAL_VALUE;
}
aOut = sBool[aIn];
return NS_OK;
}
nsresult
Convert(const BluetoothAttributeHandle& aIn, int32_t& aOut)
{
@ -904,18 +824,6 @@ Convert(BluetoothPropertyType aIn, uint8_t& aOut)
return NS_OK;
}
nsresult
Convert(const BluetoothRemoteName& aIn, nsAString& aOut)
{
const char* name = reinterpret_cast<const char*>(aIn.mName);
// We construct an nsCString here because the string
// returned from the PDU is not 0-terminated.
aOut = NS_ConvertUTF8toUTF16(
nsCString(name, strnlen(name, sizeof(aIn.mName))));
return NS_OK;
}
nsresult
Convert(BluetoothScanMode aIn, int32_t& aOut)
{
@ -1293,37 +1201,42 @@ PackPDU(const BluetoothHandsfreeWbsConfig& aIn, DaemonSocketPDU& aPDU)
}
nsresult
PackPDU(const BluetoothNamedValue& aIn, DaemonSocketPDU& aPDU)
PackPDU(const BluetoothProperty& aIn, DaemonSocketPDU& aPDU)
{
nsresult rv = PackPDU(
PackConversion<nsString, BluetoothPropertyType>(aIn.name()), aPDU);
nsresult rv = PackPDU(aIn.mType, aPDU);
if (NS_FAILED(rv)) {
return rv;
}
if (aIn.value().type() == BluetoothValue::Tuint32_t) {
// Set discoverable timeout
rv = PackPDU(static_cast<uint16_t>(sizeof(uint32_t)),
aIn.value().get_uint32_t(), aPDU);
} else if (aIn.value().type() == BluetoothValue::TnsString) {
// Set name
const nsCString value =
NS_ConvertUTF16toUTF8(aIn.value().get_nsString());
switch (aIn.mType) {
case PROPERTY_BDNAME:
/* fall through */
case PROPERTY_REMOTE_FRIENDLY_NAME: {
NS_ConvertUTF16toUTF8 stringUTF8(aIn.mString);
rv = PackPDU(PackConversion<size_t, uint16_t>(value.Length()),
PackArray<uint8_t>(
reinterpret_cast<const uint8_t*>(value.get()),
value.Length()),
aPDU);
} else if (aIn.value().type() == BluetoothValue::Tbool) {
// Set scan mode
bool value = aIn.value().get_bool();
rv = PackPDU(static_cast<uint16_t>(sizeof(int32_t)),
PackConversion<bool, BluetoothScanMode>(value), aPDU);
} else if (MOZ_HAL_IPC_PACK_WARN_IF(true, BluetoothNamedValue)) {
BT_LOGR("Invalid property value type");
rv = NS_ERROR_ILLEGAL_VALUE;
rv = PackPDU(PackConversion<size_t, uint16_t>(stringUTF8.Length()),
PackArray<uint8_t>(
reinterpret_cast<const uint8_t*>(stringUTF8.get()),
stringUTF8.Length()),
aPDU);
}
break;
case PROPERTY_CLASS_OF_DEVICE:
/* fall through */
case PROPERTY_ADAPTER_DISCOVERY_TIMEOUT:
rv = PackPDU(PackConversion<size_t, uint16_t>(sizeof(aIn.mUint32)),
aIn.mUint32,
aPDU);
break;
case PROPERTY_ADAPTER_SCAN_MODE:
/* |mScanMode| is sent as signed int of 4 bytes */
rv = PackPDU(PackConversion<size_t, uint16_t>(sizeof(int32_t)),
aIn.mScanMode,
aPDU);
break;
default:
NS_NOTREACHED("Invalid property for packing");
return NS_ERROR_ILLEGAL_VALUE;
}
return rv;
}
@ -1357,7 +1270,15 @@ PackPDU(BluetoothScanMode aIn, DaemonSocketPDU& aPDU)
nsresult
PackPDU(const BluetoothServiceName& aIn, DaemonSocketPDU& aPDU)
{
return PackPDU(PackArray<uint8_t>(aIn.mName, sizeof(aIn.mName)), aPDU);
static const uint8_t sTerminator = '\0';
nsresult rv =
PackPDU(PackArray<uint8_t>(aIn.mName, sizeof(aIn.mName)), aPDU);
if (NS_FAILED(rv)) {
return rv;
}
/* The PDU requries one additional byte for \0 termination */
return aPDU.Write(sTerminator);
}
nsresult

View File

@ -27,11 +27,6 @@ using namespace mozilla::ipc::DaemonSocketPDUHelpers;
// Helper structures
//
enum BluetoothAclState {
ACL_STATE_CONNECTED,
ACL_STATE_DISCONNECTED
};
struct BluetoothAvrcpAttributeTextPairs {
BluetoothAvrcpAttributeTextPairs(const uint8_t* aAttr,
const char** aText,
@ -108,19 +103,6 @@ struct BluetoothConfigurationParameter {
nsAutoArrayPtr<uint8_t> mValue;
};
struct BluetoothPinCode {
uint8_t mPinCode[16];
uint8_t mLength;
};
struct BluetoothRemoteName {
uint8_t mName[249];
};
struct BluetoothServiceName {
uint8_t mName[256];
};
//
// Conversion
//
@ -200,18 +182,6 @@ Convert(int32_t aIn, BluetoothAttributeHandle& aOut);
nsresult
Convert(int32_t aIn, BluetoothGattStatus& aOut);
nsresult
Convert(const nsAString& aIn, BluetoothPinCode& aOut);
nsresult
Convert(const nsAString& aIn, BluetoothPropertyType& aOut);
nsresult
Convert(const nsAString& aIn, BluetoothServiceName& aOut);
nsresult
Convert(BluetoothAclState aIn, bool& aOut);
nsresult
Convert(const BluetoothAttributeHandle& aIn, int32_t& aOut);
@ -263,9 +233,6 @@ Convert(BluetoothHandsfreeWbsConfig aIn, uint8_t& aOut);
nsresult
Convert(BluetoothPropertyType aIn, uint8_t& aOut);
nsresult
Convert(const BluetoothRemoteName& aIn, nsAString& aOut);
nsresult
Convert(BluetoothScanMode aIn, uint8_t& aOut);
@ -357,7 +324,7 @@ nsresult
PackPDU(const BluetoothHandsfreeWbsConfig& aIn, DaemonSocketPDU& aPDU);
nsresult
PackPDU(const BluetoothNamedValue& aIn, DaemonSocketPDU& aPDU);
PackPDU(const BluetoothProperty& aIn, DaemonSocketPDU& aPDU);
nsresult
PackPDU(const BluetoothPinCode& aIn, DaemonSocketPDU& aPDU);
@ -481,7 +448,17 @@ UnpackPDU(DaemonSocketPDU& aPDU, BluetoothRemoteInfo& aOut);
inline nsresult
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothRemoteName& aOut)
{
return aPDU.Read(aOut.mName, sizeof(aOut.mName));
nsresult rv = aPDU.Read(aOut.mName, sizeof(aOut.mName));
if (NS_FAILED(rv)) {
return rv;
}
/* The PDU stores one extra byte for the trailing \0 character. We
* consume the byte, but don't store the character.
*/
if (!aPDU.Consume(1)) {
return NS_ERROR_OUT_OF_MEMORY;
}
return NS_OK;
}
nsresult

View File

@ -642,11 +642,11 @@ BluetoothDaemonInterface::GetAdapterProperties(BluetoothResultHandler* aRes)
}
void
BluetoothDaemonInterface::GetAdapterProperty(const nsAString& aName,
BluetoothDaemonInterface::GetAdapterProperty(BluetoothPropertyType aType,
BluetoothResultHandler* aRes)
{
nsresult rv = static_cast<BluetoothDaemonCoreModule*>
(mProtocol)->GetAdapterPropertyCmd(aName, aRes);
(mProtocol)->GetAdapterPropertyCmd(aType, aRes);
if (NS_FAILED(rv)) {
DispatchError(aRes, rv);
}
@ -654,7 +654,7 @@ BluetoothDaemonInterface::GetAdapterProperty(const nsAString& aName,
void
BluetoothDaemonInterface::SetAdapterProperty(
const BluetoothNamedValue& aProperty, BluetoothResultHandler* aRes)
const BluetoothProperty& aProperty, BluetoothResultHandler* aRes)
{
nsresult rv = static_cast<BluetoothDaemonCoreModule*>
(mProtocol)->SetAdapterPropertyCmd(aProperty, aRes);
@ -678,11 +678,11 @@ BluetoothDaemonInterface::GetRemoteDeviceProperties(
void
BluetoothDaemonInterface::GetRemoteDeviceProperty(
const BluetoothAddress& aRemoteAddr, const nsAString& aName,
const BluetoothAddress& aRemoteAddr, BluetoothPropertyType aType,
BluetoothResultHandler* aRes)
{
nsresult rv = static_cast<BluetoothDaemonCoreModule*>
(mProtocol)->GetRemoteDevicePropertyCmd(aRemoteAddr, aName, aRes);
(mProtocol)->GetRemoteDevicePropertyCmd(aRemoteAddr, aType, aRes);
if (NS_FAILED(rv)) {
DispatchError(aRes, rv);
}
@ -690,7 +690,7 @@ BluetoothDaemonInterface::GetRemoteDeviceProperty(
void
BluetoothDaemonInterface::SetRemoteDeviceProperty(
const BluetoothAddress& aRemoteAddr, const BluetoothNamedValue& aProperty,
const BluetoothAddress& aRemoteAddr, const BluetoothProperty& aProperty,
BluetoothResultHandler* aRes)
{
nsresult rv = static_cast<BluetoothDaemonCoreModule*>
@ -797,7 +797,7 @@ BluetoothDaemonInterface::GetConnectionState(const BluetoothAddress& aBdAddr,
void
BluetoothDaemonInterface::PinReply(const BluetoothAddress& aBdAddr,
bool aAccept,
const nsAString& aPinCode,
const BluetoothPinCode& aPinCode,
BluetoothResultHandler* aRes)
{
nsresult rv = static_cast<BluetoothDaemonCoreModule*>

View File

@ -55,9 +55,9 @@ public:
/* Adapter Properties */
void GetAdapterProperties(BluetoothResultHandler* aRes) override;
void GetAdapterProperty(const nsAString& aName,
void GetAdapterProperty(BluetoothPropertyType aType,
BluetoothResultHandler* aRes) override;
void SetAdapterProperty(const BluetoothNamedValue& aProperty,
void SetAdapterProperty(const BluetoothProperty& aProperty,
BluetoothResultHandler* aRes) override;
/* Remote Device Properties */
@ -65,10 +65,10 @@ public:
void GetRemoteDeviceProperties(const BluetoothAddress& aRemoteAddr,
BluetoothResultHandler* aRes) override;
void GetRemoteDeviceProperty(const BluetoothAddress& aRemoteAddr,
const nsAString& aName,
BluetoothPropertyType aType,
BluetoothResultHandler* aRes) override;
void SetRemoteDeviceProperty(const BluetoothAddress& aRemoteAddr,
const BluetoothNamedValue& aProperty,
const BluetoothProperty& aProperty,
BluetoothResultHandler* aRes) override;
/* Remote Services */
@ -102,7 +102,7 @@ public:
/* Authentication */
void PinReply(const BluetoothAddress& aBdAddr, bool aAccept,
const nsAString& aPinCode,
const BluetoothPinCode& aPinCode,
BluetoothResultHandler* aRes) override;
void SspReply(const BluetoothAddress& aBdAddr,

View File

@ -24,7 +24,7 @@ const int BluetoothDaemonSocketModule::MAX_NUM_CLIENTS = 1;
nsresult
BluetoothDaemonSocketModule::ListenCmd(BluetoothSocketType aType,
const nsAString& aServiceName,
const BluetoothServiceName& aServiceName,
const BluetoothUuid& aServiceUuid,
int aChannel, bool aEncrypt,
bool aAuth,
@ -38,7 +38,7 @@ BluetoothDaemonSocketModule::ListenCmd(BluetoothSocketType aType,
nsresult rv = PackPDU(
aType,
PackConversion<nsAString, BluetoothServiceName>(aServiceName),
aServiceName,
aServiceUuid,
PackConversion<int, int32_t>(aChannel),
SocketFlags(aEncrypt, aAuth), *pdu);
@ -306,7 +306,7 @@ BluetoothDaemonSocketInterface::~BluetoothDaemonSocketInterface()
void
BluetoothDaemonSocketInterface::Listen(BluetoothSocketType aType,
const nsAString& aServiceName,
const BluetoothServiceName& aServiceName,
const BluetoothUuid& aServiceUuid,
int aChannel, bool aEncrypt,
bool aAuth,

View File

@ -39,7 +39,7 @@ public:
//
nsresult ListenCmd(BluetoothSocketType aType,
const nsAString& aServiceName,
const BluetoothServiceName& aServiceName,
const BluetoothUuid& aServiceUuid,
int aChannel, bool aEncrypt, bool aAuth,
BluetoothSocketResultHandler* aRes);
@ -112,7 +112,7 @@ public:
~BluetoothDaemonSocketInterface();
void Listen(BluetoothSocketType aType,
const nsAString& aServiceName,
const BluetoothServiceName& aServiceName,
const BluetoothUuid& aServiceUuid,
int aChannel, bool aEncrypt, bool aAuth,
BluetoothSocketResultHandler* aRes) override;

View File

@ -1046,8 +1046,16 @@ BluetoothServiceBluedroid::SetProperty(BluetoothObjectType aType,
ENSURE_BLUETOOTH_IS_READY(aRunnable, NS_OK);
BluetoothProperty property;
nsresult rv = NamedValueToProperty(aValue, property);
if (NS_FAILED(rv)) {
DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
return rv;
}
mSetAdapterPropertyRunnables.AppendElement(aRunnable);
sBtInterface->SetAdapterProperty(aValue,
sBtInterface->SetAdapterProperty(
property,
new DispatchReplyErrorResultHandler(mSetAdapterPropertyRunnables,
aRunnable));
@ -1347,7 +1355,14 @@ BluetoothServiceBluedroid::PinReplyInternal(
return;
}
sBtInterface->PinReply(address, aAccept, aPinCode,
BluetoothPinCode pinCode;
rv = StringToPinCode(aPinCode, pinCode);
if (NS_FAILED(rv)) {
DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
return;
}
sBtInterface->PinReply(address, aAccept, pinCode,
new PinReplyResultHandler(aRunnable));
}
@ -1940,7 +1955,7 @@ BluetoothServiceBluedroid::AdapterStateChangedNotification(bool aState)
// be connectable and non-discoverable.
NS_ENSURE_TRUE_VOID(sBtInterface);
sBtInterface->SetAdapterProperty(
BluetoothNamedValue(NS_ConvertUTF8toUTF16("Discoverable"), false),
BluetoothProperty(PROPERTY_ADAPTER_SCAN_MODE, SCAN_MODE_CONNECTABLE),
new SetAdapterPropertyDiscoverableResultHandler());
// Trigger OPP & PBAP managers to listen
@ -2286,7 +2301,8 @@ BluetoothServiceBluedroid::DiscoveryStateChangedNotification(bool aState)
void
BluetoothServiceBluedroid::PinRequestNotification(
const BluetoothAddress& aRemoteBdAddr, const nsAString& aBdName, uint32_t aCod)
const BluetoothAddress& aRemoteBdAddr, const BluetoothRemoteName& aBdName,
uint32_t aCod)
{
MOZ_ASSERT(NS_IsMainThread());
@ -2297,7 +2313,9 @@ BluetoothServiceBluedroid::PinRequestNotification(
nsAutoString bdAddr;
AddressToString(aRemoteBdAddr, bdAddr);
nsString bdName(aBdName);
nsAutoString bdName;
RemoteNameToString(aBdName, bdName);
if (bdName.IsEmpty()) {
mDeviceNameMap.Get(aRemoteBdAddr, &bdName);
} else {
@ -2318,7 +2336,7 @@ BluetoothServiceBluedroid::PinRequestNotification(
void
BluetoothServiceBluedroid::SspRequestNotification(
const BluetoothAddress& aRemoteBdAddr, const nsAString& aBdName,
const BluetoothAddress& aRemoteBdAddr, const BluetoothRemoteName& aBdName,
uint32_t aCod, BluetoothSspVariant aPairingVariant, uint32_t aPassKey)
{
MOZ_ASSERT(NS_IsMainThread());
@ -2330,7 +2348,9 @@ BluetoothServiceBluedroid::SspRequestNotification(
nsAutoString bdAddr;
AddressToString(aRemoteBdAddr, bdAddr);
nsString bdName(aBdName);
nsAutoString bdName;
RemoteNameToString(aBdName, bdName);
if (bdName.IsEmpty()) {
mDeviceNameMap.Get(aRemoteBdAddr, &bdName);
} else {
@ -2460,7 +2480,8 @@ BluetoothServiceBluedroid::BondStateChangedNotification(
void
BluetoothServiceBluedroid::AclStateChangedNotification(
BluetoothStatus aStatus, const BluetoothAddress& aRemoteBdAddr, bool aState)
BluetoothStatus aStatus, const BluetoothAddress& aRemoteBdAddr,
BluetoothAclState aState)
{
MOZ_ASSERT(NS_IsMainThread());

View File

@ -398,10 +398,10 @@ public:
virtual void DiscoveryStateChangedNotification(bool aState) override;
virtual void PinRequestNotification(const BluetoothAddress& aRemoteBdAddr,
const nsAString& aBdName,
const BluetoothRemoteName& aBdName,
uint32_t aCod) override;
virtual void SspRequestNotification(const BluetoothAddress& aRemoteBdAddr,
const nsAString& aBdName,
const BluetoothRemoteName& aBdName,
uint32_t aCod,
BluetoothSspVariant aPairingVariant,
uint32_t aPasskey) override;
@ -411,7 +411,7 @@ public:
BluetoothBondState aState) override;
virtual void AclStateChangedNotification(
BluetoothStatus aStatus, const BluetoothAddress& aRemoteBdAddr,
bool aState) override;
BluetoothAclState aState) override;
virtual void DutModeRecvNotification(uint16_t aOpcode,
const uint8_t* aBuf,

View File

@ -732,6 +732,12 @@ BluetoothSocket::Listen(const nsAString& aServiceName,
{
MOZ_ASSERT(!mImpl);
BluetoothServiceName serviceName;
nsresult rv = StringToServiceName(aServiceName, serviceName);
if (NS_FAILED(rv)) {
return rv;
}
SetConnectionStatus(SOCKET_LISTENING);
mImpl = new DroidSocketImpl(aConsumerLoop, aIOLoop, this);
@ -741,7 +747,7 @@ BluetoothSocket::Listen(const nsAString& aServiceName,
sBluetoothSocketInterface->Listen(
aType,
aServiceName, aServiceUuid, aChannel,
serviceName, aServiceUuid, aChannel,
aEncrypt, aAuth, res);
return NS_OK;

View File

@ -312,6 +312,11 @@ enum BluetoothStatus {
NUM_STATUS
};
enum BluetoothAclState {
ACL_STATE_CONNECTED,
ACL_STATE_DISCONNECTED
};
enum BluetoothBondState {
BOND_STATE_NONE,
BOND_STATE_BONDING,
@ -492,6 +497,15 @@ struct BluetoothUuid {
}
};
struct BluetoothPinCode {
uint8_t mPinCode[16]; /* not \0-terminated */
uint8_t mLength;
};
struct BluetoothServiceName {
uint8_t mName[255]; /* not \0-terminated */
};
struct BluetoothServiceRecord {
BluetoothUuid mUuid;
uint16_t mChannel;
@ -504,6 +518,10 @@ struct BluetoothRemoteInfo {
int mManufacturer;
};
struct BluetoothRemoteName {
uint8_t mName[248]; /* not \0-terminated */
};
struct BluetoothProperty {
/* Type */
BluetoothPropertyType mType;
@ -542,6 +560,68 @@ struct BluetoothProperty {
/* PROPERTY_REMOTE_VERSION_INFO */
BluetoothRemoteInfo mRemoteInfo;
BluetoothProperty()
: mType(PROPERTY_UNKNOWN)
{ }
explicit BluetoothProperty(BluetoothPropertyType aType,
const BluetoothAddress& aBdAddress)
: mType(aType)
, mBdAddress(aBdAddress)
{ }
explicit BluetoothProperty(BluetoothPropertyType aType,
const nsAString& aString)
: mType(aType)
, mString(aString)
{ }
explicit BluetoothProperty(BluetoothPropertyType aType,
const nsTArray<BluetoothUuid>& aUuidArray)
: mType(aType)
, mUuidArray(aUuidArray)
{ }
explicit BluetoothProperty(BluetoothPropertyType aType,
const nsTArray<BluetoothAddress>& aBdAddressArray)
: mType(aType)
, mBdAddressArray(aBdAddressArray)
{ }
explicit BluetoothProperty(BluetoothPropertyType aType, uint32_t aUint32)
: mType(aType)
, mUint32(aUint32)
{ }
explicit BluetoothProperty(BluetoothPropertyType aType, int32_t aInt32)
: mType(aType)
, mInt32(aInt32)
{ }
explicit BluetoothProperty(BluetoothPropertyType aType,
BluetoothTypeOfDevice aTypeOfDevice)
: mType(aType)
, mTypeOfDevice(aTypeOfDevice)
{ }
explicit BluetoothProperty(BluetoothPropertyType aType,
const BluetoothServiceRecord& aServiceRecord)
: mType(aType)
, mServiceRecord(aServiceRecord)
{ }
explicit BluetoothProperty(BluetoothPropertyType aType,
BluetoothScanMode aScanMode)
: mType(aType)
, mScanMode(aScanMode)
{ }
explicit BluetoothProperty(BluetoothPropertyType aType,
const BluetoothRemoteInfo& aRemoteInfo)
: mType(aType)
, mRemoteInfo(aRemoteInfo)
{ }
};
enum BluetoothSocketType {

View File

@ -876,13 +876,13 @@ BluetoothNotificationHandler::DiscoveryStateChangedNotification(bool aState)
void
BluetoothNotificationHandler::PinRequestNotification(
const BluetoothAddress& aRemoteBdAddr, const nsAString& aBdName,
const BluetoothAddress& aRemoteBdAddr, const BluetoothRemoteName& aBdName,
uint32_t aCod)
{ }
void
BluetoothNotificationHandler::SspRequestNotification(
const BluetoothAddress& aRemoteBdAddr, const nsAString& aBdName,
const BluetoothAddress& aRemoteBdAddr, const BluetoothRemoteName& aBdName,
uint32_t aCod, BluetoothSspVariant aPairingVariant, uint32_t aPassKey)
{ }
@ -894,7 +894,8 @@ BluetoothNotificationHandler::BondStateChangedNotification(
void
BluetoothNotificationHandler::AclStateChangedNotification(
BluetoothStatus aStatus, const BluetoothAddress& aRemoteBdAddr, bool aState)
BluetoothStatus aStatus, const BluetoothAddress& aRemoteBdAddr,
BluetoothAclState aState)
{ }
void

View File

@ -56,7 +56,7 @@ public:
// Init and Cleanup is handled by BluetoothInterface
virtual void Listen(BluetoothSocketType aType,
const nsAString& aServiceName,
const BluetoothServiceName& aServiceName,
const BluetoothUuid& aServiceUuid,
int aChannel, bool aEncrypt, bool aAuth,
BluetoothSocketResultHandler* aRes) = 0;
@ -949,10 +949,10 @@ public:
virtual void DiscoveryStateChangedNotification(bool aState);
virtual void PinRequestNotification(const BluetoothAddress& aRemoteBdAddr,
const nsAString& aBdName,
const BluetoothRemoteName& aBdName,
uint32_t aCod);
virtual void SspRequestNotification(const BluetoothAddress& aRemoteBdAddr,
const nsAString& aBdName,
const BluetoothRemoteName& aBdName,
uint32_t aCod,
BluetoothSspVariant aPairingVariant,
uint32_t aPassKey);
@ -962,7 +962,7 @@ public:
BluetoothBondState aState);
virtual void AclStateChangedNotification(
BluetoothStatus aStatus, const BluetoothAddress& aRemoteBdAddr,
bool aState);
BluetoothAclState aState);
virtual void DutModeRecvNotification(uint16_t aOpcode,
const uint8_t* aBuf, uint8_t aLen);
@ -1038,9 +1038,9 @@ public:
/* Adapter Properties */
virtual void GetAdapterProperties(BluetoothResultHandler* aRes) = 0;
virtual void GetAdapterProperty(const nsAString& aName,
virtual void GetAdapterProperty(BluetoothPropertyType,
BluetoothResultHandler* aRes) = 0;
virtual void SetAdapterProperty(const BluetoothNamedValue& aProperty,
virtual void SetAdapterProperty(const BluetoothProperty& aProperty,
BluetoothResultHandler* aRes) = 0;
/* Remote Device Properties */
@ -1048,10 +1048,10 @@ public:
virtual void GetRemoteDeviceProperties(const BluetoothAddress& aRemoteAddr,
BluetoothResultHandler* aRes) = 0;
virtual void GetRemoteDeviceProperty(const BluetoothAddress& aRemoteAddr,
const nsAString& aName,
BluetoothPropertyType aType,
BluetoothResultHandler* aRes) = 0;
virtual void SetRemoteDeviceProperty(const BluetoothAddress& aRemoteAddr,
const BluetoothNamedValue& aProperty,
const BluetoothProperty& aProperty,
BluetoothResultHandler* aRes) = 0;
/* Remote Services */
@ -1085,7 +1085,7 @@ public:
/* Authentication */
virtual void PinReply(const BluetoothAddress& aBdAddr, bool aAccept,
const nsAString& aPinCode,
const BluetoothPinCode& aPinCode,
BluetoothResultHandler* aRes) = 0;
virtual void SspReply(const BluetoothAddress& aBdAddr,

View File

@ -61,6 +61,126 @@ StringToAddress(const nsAString& aString, BluetoothAddress& aAddress)
return NS_OK;
}
nsresult
StringToPinCode(const nsAString& aString, BluetoothPinCode& aPinCode)
{
NS_ConvertUTF16toUTF8 stringUTF8(aString);
auto len = stringUTF8.Length();
if (len > sizeof(aPinCode.mPinCode)) {
BT_LOGR("Service-name string too long");
return NS_ERROR_ILLEGAL_VALUE;
}
auto str = stringUTF8.get();
memcpy(aPinCode.mPinCode, str, len);
memset(aPinCode.mPinCode + len, 0, sizeof(aPinCode.mPinCode) - len);
aPinCode.mLength = len;
return NS_OK;
}
nsresult
StringToPropertyType(const nsAString& aString, BluetoothPropertyType& aType)
{
if (aString.EqualsLiteral("Name")) {
aType = PROPERTY_BDNAME;
} else if (aString.EqualsLiteral("Discoverable")) {
aType = PROPERTY_ADAPTER_SCAN_MODE;
} else if (aString.EqualsLiteral("DiscoverableTimeout")) {
aType = PROPERTY_ADAPTER_DISCOVERY_TIMEOUT;
} else {
BT_LOGR("Invalid property name: %s", NS_ConvertUTF16toUTF8(aString).get());
aType = PROPERTY_UNKNOWN; // silences compiler warning
return NS_ERROR_ILLEGAL_VALUE;
}
return NS_OK;
}
nsresult
NamedValueToProperty(const BluetoothNamedValue& aValue,
BluetoothProperty& aProperty)
{
nsresult rv = StringToPropertyType(aValue.name(), aProperty.mType);
if (NS_FAILED(rv)) {
return rv;
}
switch (aProperty.mType) {
case PROPERTY_BDNAME:
if (aValue.value().type() != BluetoothValue::TnsString) {
BT_LOGR("Bluetooth property value is not a string");
return NS_ERROR_ILLEGAL_VALUE;
}
// Set name
aProperty.mString = aValue.value().get_nsString();
break;
case PROPERTY_ADAPTER_SCAN_MODE:
if (aValue.value().type() != BluetoothValue::Tbool) {
BT_LOGR("Bluetooth property value is not a boolean");
return NS_ERROR_ILLEGAL_VALUE;
}
// Set scan mode
if (aValue.value().get_bool()) {
aProperty.mScanMode = SCAN_MODE_CONNECTABLE_DISCOVERABLE;
} else {
aProperty.mScanMode = SCAN_MODE_CONNECTABLE;
}
break;
case PROPERTY_ADAPTER_DISCOVERY_TIMEOUT:
if (aValue.value().type() != BluetoothValue::Tuint32_t) {
BT_LOGR("Bluetooth property value is not an unsigned integer");
return NS_ERROR_ILLEGAL_VALUE;
}
// Set discoverable timeout
aProperty.mUint32 = aValue.value().get_uint32_t();
break;
default:
BT_LOGR("Invalid property value type");
return NS_ERROR_ILLEGAL_VALUE;
}
return NS_OK;
}
void
RemoteNameToString(const BluetoothRemoteName& aRemoteName, nsAString& aString)
{
auto name = reinterpret_cast<const char*>(aRemoteName.mName);
/* The content in |BluetoothRemoteName| is not a C string and not
* terminated by \0. We use |strnlen| to limit its length.
*/
aString =
NS_ConvertUTF8toUTF16(name, strnlen(name, sizeof(aRemoteName.mName)));
}
nsresult
StringToServiceName(const nsAString& aString,
BluetoothServiceName& aServiceName)
{
NS_ConvertUTF16toUTF8 serviceNameUTF8(aString);
auto len = serviceNameUTF8.Length();
if (len > sizeof(aServiceName.mName)) {
BT_LOGR("Service-name string too long");
return NS_ERROR_ILLEGAL_VALUE;
}
auto str = serviceNameUTF8.get();
memcpy(aServiceName.mName, str, len);
memset(aServiceName.mName + len, 0, sizeof(aServiceName.mName) - len);
return NS_OK;
}
void
UuidToString(const BluetoothUuid& aUuid, nsAString& aString)
{

View File

@ -33,6 +33,43 @@ AddressToString(const BluetoothAddress& aAddress, nsAString& aString);
nsresult
StringToAddress(const nsAString& aString, BluetoothAddress& aAddress);
//
// Pin code/string conversion
//
nsresult
StringToPinCode(const nsAString& aString, BluetoothPinCode& aPinCode);
//
// Property type/string conversion
//
nsresult
StringToPropertyType(const nsAString& aString, BluetoothPropertyType& aType);
//
// Property conversion
//
nsresult
NamedValueToProperty(const BluetoothNamedValue& aIn,
BluetoothProperty& aProperty);
//
// Remote name/string conversion
//
void
RemoteNameToString(const BluetoothRemoteName& aRemoteName, nsAString& aString);
//
// Service name/string conversion
//
nsresult
StringToServiceName(const nsAString& aString,
BluetoothServiceName& aServiceName);
//
// BluetoothUuid <-> uuid string conversion
//

View File

@ -150,6 +150,9 @@ public class PostSearchFragment extends Fragment {
return false;
}
// We are suppressing the 'deprecation' warning because the new method is only available starting with API
// level 23 and that's much higher than our current minSdkLevel (1208580).
@SuppressWarnings("deprecation")
@Override
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
Log.e(LOG_TAG, "Error loading search results: " + description);

View File

@ -14,10 +14,6 @@ import android.util.Log;
import com.jayway.android.robotium.solo.Solo;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.mozilla.gecko.Actions;
import org.mozilla.gecko.AppConstants;
import org.mozilla.gecko.Assert;
@ -32,6 +28,8 @@ import org.mozilla.gecko.GeckoAppShell;
import org.mozilla.gecko.GeckoEvent;
import org.mozilla.gecko.updater.UpdateServiceHelper;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Map;
@SuppressWarnings("unchecked")
@ -236,15 +234,21 @@ public abstract class BaseRobocopTest extends ActivityInstrumentationTestCase2<A
// those are managed by Fennec's proxy settings.
final String rawUrl = ((String) mConfig.get("rawhost")).replaceAll("(/$)", "");
HttpURLConnection urlConnection = null;
try {
final HttpClient httpclient = new DefaultHttpClient();
final HttpResponse response = httpclient.execute(new HttpGet(rawUrl));
final int statusCode = response.getStatusLine().getStatusCode();
urlConnection = (HttpURLConnection) new URL(rawUrl).openConnection();
final int statusCode = urlConnection.getResponseCode();
if (200 != statusCode) {
throw new IllegalStateException("Status code: " + statusCode);
}
} catch (Exception e) {
mAsserter.ok(false, "Robocop tests on your device need network/wifi access to reach: [" + rawUrl + "].", e.toString());
} finally {
if (urlConnection != null) {
urlConnection.disconnect();
}
}
}

View File

@ -172,9 +172,9 @@ public class testImportFromAndroid extends AboutHomeTest {
Cursor cursor = null;
try {
if (data.equals("history")) {
cursor = Browser.getAllVisitedUrls(resolver);
cursor = getAllVisitedUrls(resolver);
} else if (data.equals("bookmarks")) {
cursor = Browser.getAllBookmarks(resolver);
cursor = getAllBookmarks(resolver);
}
if (cursor != null) {
cursor.moveToFirst();
@ -205,6 +205,23 @@ public class testImportFromAndroid extends AboutHomeTest {
}
}
private static Cursor getAllVisitedUrls(ContentResolver resolver) {
final Uri authorityUri = Uri.parse("content://com.android.browser");
final Uri contentUri = Uri.withAppendedPath(authorityUri, "combined");
return resolver.query(contentUri,
new String[] { "url" }, null, null,
"created ASC");
}
private static Cursor getAllBookmarks(ContentResolver resolver) {
final Uri bookmarksUri = Uri.parse("content://browser/bookmarks");
return resolver.query(bookmarksUri,
new String[] { "url" },
"folder = 0", null, null);
}
@Override
public void tearDown() throws Exception {
deleteImportedData();

View File

@ -31,6 +31,11 @@ if [ 0$B2G_DEBUG -ne 0 ]; then
debug_flag='--debug'
fi
if ! aws --output=text s3 ls s3://b2g-phone-backups/; then
echo "[aws:error] Failed to connect to AWS! Are the AWS credentials ok?"
exit 1
fi
backup_file=$(aws --output=text s3 ls s3://b2g-phone-backups/$TARGET/ | tail -1 | awk '{print $NF}')
if echo $backup_file | grep '\.tar\.bz2'; then