Merge m-c to inbound.

This commit is contained in:
Ryan VanderMeulen 2013-04-16 08:05:10 -04:00
commit 031c884a96
13 changed files with 156 additions and 158 deletions

View File

@ -1,6 +1,6 @@
[{
"size": 621007059,
"digest": "7ab61ca7a6c25297bbe3ec8328b2a8b4298cb0656747292e86a8caeef08500f2c68c00b5be02f2d83afaa2ae2fb7240e4d8a321c786fd1b0d57aeaa6e257dad5",
"size": 634920651,
"digest": "731237d9fcd51637e1fdb7240f57d11f1bda18770025186c06ff72e960551c764bada3c43bae2347f716acd36492c2f4e6bb8eddd9ced7198cbcd8c994ea0705",
"algorithm": "sha512",
"filename": "emulator.zip"
}]

View File

@ -184,7 +184,7 @@ public:
* When two values are the same, we don't switch on/off bluetooth,
* but we still do ToggleBtAck task.
*/
if (mEnabled == gBluetoothService->IsEnabled()) {
if (mEnabled == gBluetoothService->IsEnabledInternal()) {
NS_WARNING("Bluetooth has already been enabled/disabled before.");
} else {
// Switch on/off bluetooth
@ -529,18 +529,7 @@ nsresult
BluetoothService::HandleStartupSettingsCheck(bool aEnable)
{
MOZ_ASSERT(NS_IsMainThread());
if (aEnable) {
return StartStopBluetooth(true);
}
/*
* Since BLUETOOTH_ENABLED_SETTING is false, we don't have to turn on
* bluetooth here, and set gToggleInProgress back to false.
*/
gToggleInProgress = false;
return NS_OK;
return StartStopBluetooth(aEnable);
}
nsresult

View File

@ -292,7 +292,7 @@ protected:
virtual nsresult
StartInternal() = 0;
/**
/**
* Platform specific startup functions go here. Usually deals with member
* variables, so not static. Guaranteed to be called outside of main thread.
*
@ -301,6 +301,15 @@ protected:
virtual nsresult
StopInternal() = 0;
/**
* Platform specific startup functions go here. Usually deals with member
* variables, so not static. Guaranteed to be called outside of main thread.
*
* @return true if Bluetooth is enabled, false otherwise
*/
virtual bool
IsEnabledInternal() = 0;
/**
* Called when XPCOM first creates this service.
*/

View File

@ -120,7 +120,7 @@ StartStopGonkBluetooth(bool aShouldEnable)
nsresult
BluetoothGonkService::StartInternal()
{
NS_ASSERTION(!NS_IsMainThread(), "This should not run on the main thread!");
MOZ_ASSERT(!NS_IsMainThread());
nsresult ret;
@ -136,7 +136,7 @@ BluetoothGonkService::StartInternal()
nsresult
BluetoothGonkService::StopInternal()
{
NS_ASSERTION(!NS_IsMainThread(), "This should not run on the main thread!");
MOZ_ASSERT(!NS_IsMainThread());
nsresult ret;
@ -149,3 +149,16 @@ BluetoothGonkService::StopInternal()
return StartStopGonkBluetooth(false);
}
bool
BluetoothGonkService::IsEnabledInternal()
{
MOZ_ASSERT(!NS_IsMainThread());
if (!EnsureBluetoothInit()) {
NS_ERROR("Failed to load bluedroid library.\n");
return false;
}
return (sBluedroidFunctions.bt_is_enabled() == 1);
}

View File

@ -35,23 +35,27 @@ BEGIN_BLUETOOTH_NAMESPACE
class BluetoothGonkService : public BluetoothDBusService
{
public:
/**
/**
* Set up variables and start the platform specific connection. Must
* be called from main thread.
* be called from non-main thread.
*
* @return NS_OK if connection starts successfully, NS_ERROR_FAILURE
* otherwise
* @return NS_OK if connection starts successfully, NS_ERROR_FAILURE otherwise
*/
virtual nsresult StartInternal();
/**
* Stop the platform specific connection. Must be called from main
* thread.
/**
* Stop the platform specific connection. Must be called from non-main thread.
*
* @return NS_OK if connection starts successfully, NS_ERROR_FAILURE
* otherwise
* @return NS_OK if connection starts successfully, NS_ERROR_FAILURE otherwise
*/
virtual nsresult StopInternal();
/**
* Get status of Bluetooth. Must be called from non-main thread.
*
* @return true if Bluetooth is enabled, false otherwise
*/
virtual bool IsEnabledInternal();
};
END_BLUETOOTH_NAMESPACE

View File

@ -361,6 +361,13 @@ BluetoothServiceChildProcess::StopInternal()
return NS_ERROR_FAILURE;
}
bool
BluetoothServiceChildProcess::IsEnabledInternal()
{
MOZ_NOT_REACHED("This should never be called!");
return false;
}
bool
BluetoothServiceChildProcess::IsConnected(uint16_t aProfileId)
{

View File

@ -163,6 +163,10 @@ private:
virtual nsresult
StopInternal() MOZ_OVERRIDE;
// This method should never be called.
virtual bool
IsEnabledInternal() MOZ_OVERRIDE;
// Should never be called from the child
virtual nsresult
GetDevicePropertiesInternal(const BluetoothSignal& aSignal) MOZ_OVERRIDE;

View File

@ -82,7 +82,7 @@ static Properties sDeviceProperties[] = {
{"Class", DBUS_TYPE_UINT32},
{"UUIDs", DBUS_TYPE_ARRAY},
{"Paired", DBUS_TYPE_BOOLEAN},
{"Connected", DBUS_TYPE_ARRAY},
{"Connected", DBUS_TYPE_BOOLEAN},
{"Trusted", DBUS_TYPE_BOOLEAN},
{"Blocked", DBUS_TYPE_BOOLEAN},
{"Alias", DBUS_TYPE_STRING},
@ -1030,7 +1030,7 @@ GetProperty(DBusMessageIter aIter, Properties* aPropertyTypes,
DBusMessageIter prop_val, array_val_iter;
char* property = NULL;
uint32_t array_type;
int i, type;
int i, expectedType, receivedType;
if (dbus_message_iter_get_arg_type(&aIter) != DBUS_TYPE_STRING) {
return false;
@ -1058,23 +1058,35 @@ GetProperty(DBusMessageIter aIter, Properties* aPropertyTypes,
*aPropIndex = i;
dbus_message_iter_recurse(&aIter, &prop_val);
type = aPropertyTypes[*aPropIndex].type;
expectedType = aPropertyTypes[*aPropIndex].type;
receivedType = dbus_message_iter_get_arg_type(&prop_val);
if (dbus_message_iter_get_arg_type(&prop_val) != type) {
/**
* Bug 857896. Since device property "Connected" could be a boolean value or
* an 2-byte array, we need to check the value type here and convert the
* first byte into a boolean manually.
*/
bool convert = false;
if (propertyName.EqualsLiteral("Connected") &&
receivedType == DBUS_TYPE_ARRAY) {
convert = true;
}
if ((receivedType != expectedType) && !convert) {
NS_WARNING("Iterator not type we expect!");
nsAutoCString str;
str += "Property Name: ;";
str += NS_ConvertUTF16toUTF8(propertyName);
str += " Property Type Expected: ;";
str += type;
str += " Property Type Received: ";
str += dbus_message_iter_get_arg_type(&prop_val);
nsCString str;
str.AppendLiteral("Property Name: ");
str.Append(NS_ConvertUTF16toUTF8(propertyName));
str.AppendLiteral(", Property Type Expected: ");
str.AppendInt(expectedType);
str.AppendLiteral(", Property Type Received: ");
str.AppendInt(receivedType);
NS_WARNING(str.get());
return false;
}
BluetoothValue propertyValue;
switch (type) {
switch (receivedType) {
case DBUS_TYPE_STRING:
case DBUS_TYPE_OBJECT_PATH:
const char* c;
@ -1124,6 +1136,14 @@ GetProperty(DBusMessageIter aIter, Properties* aPropertyTypes,
default:
NS_NOTREACHED("Cannot find dbus message type!");
}
if (convert) {
MOZ_ASSERT(propertyValue.type() == BluetoothValue::TArrayOfuint8_t);
bool b = propertyValue.get_ArrayOfuint8_t()[0];
propertyValue = BluetoothValue(b);
}
aProperties.AppendElement(BluetoothNamedValue(propertyName, propertyValue));
return true;
}
@ -1187,48 +1207,14 @@ UnpackAdapterPropertiesMessage(DBusMessage* aMsg, DBusError* aErr,
ArrayLength(sAdapterProperties));
}
bool
ReplaceConnectedType(Properties* sourceProperties,
Properties** destProperties,
int aPropertyTypeLen)
{
if (!IsDeviceConnectedTypeBoolean()) {
return false;
}
*destProperties = (Properties*)malloc(sizeof(Properties) * aPropertyTypeLen);
if (*destProperties) {
CopyProperties(sourceProperties, *destProperties, aPropertyTypeLen);
int index = GetPropertyIndex(*destProperties,
"Connected",
aPropertyTypeLen);
if (index >= 0) {
(*destProperties)[index].type = DBUS_TYPE_BOOLEAN;
return true;
} else {
free(*destProperties);
}
}
return false;
}
void
UnpackDevicePropertiesMessage(DBusMessage* aMsg, DBusError* aErr,
BluetoothValue& aValue,
nsAString& aErrorStr)
{
Properties* props = sDeviceProperties;
Properties* newProps;
bool replaced = ReplaceConnectedType(sDeviceProperties, &newProps,
ArrayLength(sDeviceProperties));
if (replaced) {
props = newProps;
}
UnpackPropertiesMessage(aMsg, aErr, aValue, aErrorStr,
props,
sDeviceProperties,
ArrayLength(sDeviceProperties));
if (replaced) {
free(newProps);
}
}
void
@ -1400,20 +1386,11 @@ EventFilter(DBusConnection* aConn, DBusMessage* aMsg, void* aData)
if (dbus_message_iter_next(&iter)) {
Properties* props = sDeviceProperties;
Properties* newProps;
bool replaced = ReplaceConnectedType(sDeviceProperties, &newProps,
ArrayLength(sDeviceProperties));
if (replaced) {
props = newProps;
}
ParseProperties(&iter,
v,
errorStr,
props,
ArrayLength(sDeviceProperties));
if (replaced) {
free(newProps);
}
if (v.type() == BluetoothValue::TArrayOfBluetoothNamedValue)
{
// The DBus DeviceFound message actually passes back a key value object
@ -1511,20 +1488,11 @@ EventFilter(DBusConnection* aConn, DBusMessage* aMsg, void* aData)
} else if (dbus_message_is_signal(aMsg, DBUS_DEVICE_IFACE,
"PropertyChanged")) {
Properties* props = sDeviceProperties;
Properties* newProps;
bool replaced = ReplaceConnectedType(sDeviceProperties, &newProps,
ArrayLength(sDeviceProperties));
if (replaced) {
props = newProps;
}
ParsePropertyChange(aMsg,
v,
errorStr,
props,
ArrayLength(sDeviceProperties));
if (replaced) {
free(newProps);
}
BluetoothNamedValue& property = v.get_ArrayOfBluetoothNamedValue()[0];
if (property.name().EqualsLiteral("Paired")) {
@ -1708,7 +1676,9 @@ BluetoothDBusService::StopInternal()
// If Bluetooth is turned off while connections exist, in order not to only
// disconnect with profile connections with low level ACL connections alive,
// we disconnect ACLs directly instead of closing each socket.
DisconnectAllAcls(sAdapterPath);
if (!sAdapterPath.IsEmpty()) {
DisconnectAllAcls(sAdapterPath);
}
if (!mConnection) {
StopDBus();
@ -1756,6 +1726,12 @@ BluetoothDBusService::StopInternal()
return NS_OK;
}
bool
BluetoothDBusService::IsEnabledInternal()
{
return mEnabled;
}
class DefaultAdapterPropertiesRunnable : public nsRunnable
{
public:

View File

@ -30,6 +30,8 @@ public:
virtual nsresult StopInternal();
virtual bool IsEnabledInternal();
virtual nsresult GetDefaultAdapterPathInternal(BluetoothReplyRunnable* aRunnable);
virtual nsresult GetPairedDevicePropertiesInternal(const nsTArray<nsString>& aDeviceAddresses,

View File

@ -594,7 +594,7 @@ skip-if(B2G) == 367247-l-scroll.html 367247-l-auto.html
== 367612-1e.html 367612-1-ref.html
== 367612-1f.html 367612-1-ref.html
!= 367612-1g.html 367612-1-ref.html
random-if(/^Windows\x20NT\x205\.1/.test(http.oscpu)) == 368020-1.html 368020-1-ref.html
skip-if(B2G) random-if(/^Windows\x20NT\x205\.1/.test(http.oscpu)) == 368020-1.html 368020-1-ref.html
== 368020-2.html 368020-2-ref.html
fails == 368020-3.html 368020-3-ref.html # bug 368085
fails == 368020-4.html 368020-4-ref.html # bug 368085
@ -1189,7 +1189,7 @@ test-pref(dom.use_xbl_scopes_for_remote_xul,false) != 449149-1b.html about:blank
== 455171-5.html 455171-5-ref.html
== 455280-1.xhtml 455280-1-ref.xhtml
skip-if(B2G) == 455826-1.html 455826-1-ref.html
fails-if(cocoaWidget) == 456147.xul 456147-ref.html # bug 458047
skip-if(B2G) fails-if(cocoaWidget) == 456147.xul 456147-ref.html # bug 458047
skip-if(B2G) fuzzy-if(/^Windows\x20NT\x206\.1/.test(http.oscpu),1,1) == 456219-1a.html 456219-1-ref.html # bug 853273
skip-if(B2G) fuzzy-if(/^Windows\x20NT\x206\.1/.test(http.oscpu),1,1) == 456219-1b.html 456219-1-ref.html # bug 853273
skip-if(B2G) fuzzy-if(/^Windows\x20NT\x206\.1/.test(http.oscpu),1,1) == 456219-1c.html 456219-1-ref.html # bug 853273

View File

@ -43,7 +43,7 @@ skip-if(B2G) asserts-if(cocoaWidget,0-2) == size-change-1.html size-change-1-ref
!= text-bidi-ltr-test.html text-bidi-ltr-notref.html # for bug 698185
== text-bidi-rtl-test.html text-bidi-rtl-ref.html
fails-if(B2G) != text-font-lang.html text-font-lang-notref.html
!= text-font-lang.html text-font-lang-notref.html
== text-measure.html text-measure-ref.html

View File

@ -50,7 +50,7 @@ skip-if(!(d2d||cocoaWidget)) random-if(d2d) != subpixel-glyphs-x-2a.html subpixe
skip-if(B2G) HTTP(..) == subpixel-glyphs-x-3a.html subpixel-glyphs-x-3b.html
# No platforms do subpixel positioning vertically
== subpixel-glyphs-y-1a.html subpixel-glyphs-y-1b.html
fuzzy-if(Android,231,603) == subpixel-lineheight-1a.html subpixel-lineheight-1b.html
fuzzy-if((Android||B2G),231,603) == subpixel-lineheight-1a.html subpixel-lineheight-1b.html
== swash-1.html swash-1-ref.html
HTTP(..) != synthetic-bold-metrics-01.html synthetic-bold-metrics-01-notref.html
HTTP(..) == synthetic-bold-papyrus-01.html synthetic-bold-papyrus-01-ref.html

View File

@ -3181,89 +3181,83 @@ pref("print.print_extra_margin", 0); // twips
pref("font.alias-list", "sans,sans-serif,serif,monospace");
// As we ship bundled Open Sans and Charis SIL Compact fonts on Android,
// but not on B2G/Gonk, we give them separate default font preferences.
// Gonk and Android ship different sets of fonts
#ifdef MOZ_WIDGET_GONK
// TODO: this block is initially a copy of the ANDROID prefs as they were
// prior to the switch to Open Sans and Charis SIL Compact (bug 831354).
// We should review these in the light of what's actually present on the Gonk platform;
// some entries could probably be cleaned up.
// TODO: some entries could probably be cleaned up.
// ar
pref("font.name.serif.el", "Droid Serif");
pref("font.name.sans-serif.el", "Droid Sans");
pref("font.name.monospace.el", "Droid Sans Mono");
pref("font.name-list.sans-serif.el", "Roboto, Droid Sans");
pref("font.name.sans-serif.el", "Roboto");
pref("font.name.monospace.el", "Source Code Pro");
pref("font.name.serif.he", "Droid Serif");
pref("font.name.sans-serif.he", "Droid Sans");
pref("font.name.monospace.he", "Droid Sans Mono");
pref("font.name-list.sans-serif.he", "Droid Sans Hebrew, Droid Sans");
pref("font.name.serif.he", "Charis SIL Compact");
pref("font.name.sans-serif.he", "Feura Sans");
pref("font.name.monospace.he", "Source Code Pro");
pref("font.name-list.sans-serif.he", "Droid Sans Hebrew, Feura Sans");
pref("font.name.serif.ja", "Droid Serif");
pref("font.name.sans-serif.ja", "Droid Sans");
pref("font.name.serif.ja", "Charis SIL Compact");
pref("font.name.sans-serif.ja", "Feura Sans");
pref("font.name.monospace.ja", "MotoyaLMaru");
pref("font.name-list.sans-serif.ja", "Roboto, Droid Sans, MotoyaLMaru, MotoyaLCedar, Droid Sans Japanese");
pref("font.name-list.monospace.ja", "MotoyaLMaru, MotoyaLCedar, Droid Sans Mono");
pref("font.name-list.sans-serif.ja", "Feura Sans, Roboto, MotoyaLMaru, MotoyaLCedar, Droid Sans Japanese");
pref("font.name-list.monospace.ja", "MotoyaLMaru, MotoyaLCedar, Source Code Pro");
pref("font.name.serif.ko", "Droid Serif");
pref("font.name.sans-serif.ko", "Droid Sans");
pref("font.name.monospace.ko", "Droid Sans Mono");
pref("font.name.serif.ko", "Charis SIL Compact");
pref("font.name.sans-serif.ko", "Feura Sans");
pref("font.name.monospace.ko", "Source Code Pro");
pref("font.name.serif.th", "Droid Serif");
pref("font.name.sans-serif.th", "Droid Sans");
pref("font.name.monospace.th", "Droid Sans Mono");
pref("font.name-list.sans-serif.th", "Droid Sans Thai, Droid Sans");
pref("font.name.serif.th", "Charis SIL Compact");
pref("font.name.sans-serif.th", "Feura Sans");
pref("font.name.monospace.th", "Source Code Pro");
pref("font.name-list.sans-serif.th", "Feura Sans, Droid Sans Thai");
pref("font.name.serif.tr", "Droid Serif");
pref("font.name.sans-serif.tr", "Droid Sans");
pref("font.name.monospace.tr", "Droid Sans Mono");
pref("font.name-list.sans-serif.tr", "Roboto, Droid Sans");
pref("font.name.serif.tr", "Charis SIL Compact");
pref("font.name.sans-serif.tr", "Feura Sans");
pref("font.name.monospace.tr", "Source Code Pro");
pref("font.name-list.sans-serif.tr", "Feura Sans, Roboto");
pref("font.name.serif.x-baltic", "Droid Serif");
pref("font.name.sans-serif.x-baltic", "Droid Sans");
pref("font.name.monospace.x-baltic", "Droid Sans Mono");
pref("font.name-list.sans-serif.x-baltic", "Roboto, Droid Sans");
pref("font.name.serif.x-baltic", "Charis SIL Compact");
pref("font.name.sans-serif.x-baltic", "Feura Sans");
pref("font.name.monospace.x-baltic", "Source Code Pro");
pref("font.name-list.sans-serif.x-baltic", "Feura Sans, Roboto");
pref("font.name.serif.x-central-euro", "Droid Serif");
pref("font.name.sans-serif.x-central-euro", "Droid Sans");
pref("font.name.monospace.x-central-euro", "Droid Sans Mono");
pref("font.name-list.sans-serif.x-central-euro", "Roboto, Droid Sans");
pref("font.name.serif.x-central-euro", "Charis SIL Compact");
pref("font.name.sans-serif.x-central-euro", "Feura Sans");
pref("font.name.monospace.x-central-euro", "Source Code Pro");
pref("font.name-list.sans-serif.x-central-euro", "Feura Sans, Roboto");
pref("font.name.serif.x-cyrillic", "Droid Serif");
pref("font.name.sans-serif.x-cyrillic", "Droid Sans");
pref("font.name.monospace.x-cyrillic", "Droid Sans Mono");
pref("font.name-list.sans-serif.x-cyrillic", "Roboto, Droid Sans");
pref("font.name.serif.x-cyrillic", "Charis SIL Compact");
pref("font.name.sans-serif.x-cyrillic", "Roboto");
pref("font.name.monospace.x-cyrillic", "Source Code Pro");
pref("font.name.serif.x-unicode", "Droid Serif");
pref("font.name.sans-serif.x-unicode", "Droid Sans");
pref("font.name.monospace.x-unicode", "Droid Sans Mono");
pref("font.name-list.sans-serif.x-unicode", "Roboto, Droid Sans");
pref("font.name.serif.x-unicode", "Charis SIL Compact");
pref("font.name.sans-serif.x-unicode", "Feura Sans");
pref("font.name.monospace.x-unicode", "Source Code Pro");
pref("font.name-list.sans-serif.x-unicode", "Feura Sans, Roboto");
pref("font.name.serif.x-user-def", "Droid Serif");
pref("font.name.sans-serif.x-user-def", "Droid Sans");
pref("font.name.monospace.x-user-def", "Droid Sans Mono");
pref("font.name-list.sans-serif.x-user-def", "Roboto, Droid Sans");
pref("font.name.serif.x-user-def", "Charis SIL Compact");
pref("font.name.sans-serif.x-user-def", "Feura Sans");
pref("font.name.monospace.x-user-def", "Source Code Pro");
pref("font.name-list.sans-serif.x-user-def", "Feura Sans, Roboto");
pref("font.name.serif.x-western", "Droid Serif");
pref("font.name.sans-serif.x-western", "Droid Sans");
pref("font.name.monospace.x-western", "Droid Sans Mono");
pref("font.name-list.sans-serif.x-western", "Roboto, Droid Sans");
pref("font.name.serif.x-western", "Charis SIL Compact");
pref("font.name.sans-serif.x-western", "Feura Sans");
pref("font.name.monospace.x-western", "Source Code Pro");
pref("font.name-list.sans-serif.x-western", "Feura Sans, Roboto");
pref("font.name.serif.zh-CN", "Droid Serif");
pref("font.name.sans-serif.zh-CN", "Droid Sans");
pref("font.name.monospace.zh-CN", "Droid Sans Mono");
pref("font.name.serif.zh-CN", "Charis SIL Compact");
pref("font.name.sans-serif.zh-CN", "Feura Sans");
pref("font.name.monospace.zh-CN", "Source Code Pro");
pref("font.name.serif.zh-HK", "Droid Serif");
pref("font.name.sans-serif.zh-HK", "Droid Sans");
pref("font.name.monospace.zh-HK", "Droid Sans Mono");
pref("font.name.serif.zh-HK", "Charis SIL Compact");
pref("font.name.sans-serif.zh-HK", "Feura Sans");
pref("font.name.monospace.zh-HK", "Source Code Pro");
pref("font.name.serif.zh-TW", "Droid Serif");
pref("font.name.sans-serif.zh-TW", "Droid Sans");
pref("font.name.monospace.zh-TW", "Droid Sans Mono");
pref("font.name.serif.zh-TW", "Charis SIL Compact");
pref("font.name.sans-serif.zh-TW", "Feura Sans");
pref("font.name.monospace.zh-TW", "Source Code Pro");
#else