merge b2g-inbound to mozilla-central a=merge
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Mon, 21 Jul 2014 12:59:29 +0200
changeset 195321 42c6a5418370d37323bc45c3d9fb355fb87ce0ad
parent 195311 e743fd8c57ed991b7a701f45199cb40cb0a0b806 (current diff)
parent 195320 9ac01e056b7c38bf46b0d61ae68afaea75225640 (diff)
child 195322 0dc711216018402d12be9d38eaec9bd7763914d8
push id46575
push userkwierso@gmail.com
push dateTue, 22 Jul 2014 00:35:21 +0000
treeherdermozilla-inbound@fee5c4bdd713 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone33.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
merge b2g-inbound to mozilla-central a=merge
--- a/b2g/config/emulator-ics/sources.xml
+++ b/b2g/config/emulator-ics/sources.xml
@@ -14,17 +14,17 @@
   <!--original fetch url was git://github.com/apitrace/-->
   <remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
   <default remote="caf" revision="refs/tags/android-4.0.4_r2.1" sync-j="4"/>
   <!-- Gonk specific things and forks -->
   <project name="platform_build" path="build" remote="b2g" revision="0d616942c300d9fb142483210f1dda9096c9a9fc">
     <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="1c9eb3d16167c2e5a9f7789eb46ee17830e6054e"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="0114839afc44aa98ae87db91004835f16a49dcab"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7f792d756385bb894fba7645da59c67fe2c804bf"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cd88d860656c31c7da7bb310d6a160d0011b0961"/>
   <project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="227354333a185180b85471f2cc6abfb029e44718"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="dc5ca96695cab87b4c2fcd7c9f046ae3415a70a5"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="8b04b5aca4b0a894de40f4d53ae9750222d349a8"/>
   <!-- Stock Android things -->
   <project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
--- a/b2g/config/emulator-jb/sources.xml
+++ b/b2g/config/emulator-jb/sources.xml
@@ -12,17 +12,17 @@
   <!--original fetch url was https://git.mozilla.org/releases-->
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <!-- B2G specific things. -->
   <project name="platform_build" path="build" remote="b2g" revision="cc67f31dc638c0b7edba3cf7e3d87cadf0ed52bf">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
-  <project name="gaia" path="gaia" remote="mozillaorg" revision="1c9eb3d16167c2e5a9f7789eb46ee17830e6054e"/>
+  <project name="gaia" path="gaia" remote="mozillaorg" revision="0114839afc44aa98ae87db91004835f16a49dcab"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7f792d756385bb894fba7645da59c67fe2c804bf"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="dc5ca96695cab87b4c2fcd7c9f046ae3415a70a5"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="8b04b5aca4b0a894de40f4d53ae9750222d349a8"/>
   <project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
   <project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
   <!-- Stock Android things -->
   <project groups="linux" name="platform/prebuilts/clang/linux-x86/3.1" path="prebuilts/clang/linux-x86/3.1" revision="5c45f43419d5582949284eee9cef0c43d866e03b"/>
   <project groups="linux" name="platform/prebuilts/clang/linux-x86/3.2" path="prebuilts/clang/linux-x86/3.2" revision="3748b4168e7bd8d46457d4b6786003bc6a5223ce"/>
--- a/b2g/config/emulator-kk/sources.xml
+++ b/b2g/config/emulator-kk/sources.xml
@@ -10,17 +10,17 @@
   <!--original fetch url was git://codeaurora.org/-->
   <remote fetch="https://git.mozilla.org/external/caf" name="caf"/>
   <!--original fetch url was https://git.mozilla.org/releases-->
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <!-- B2G specific things. -->
   <project name="platform_build" path="build" remote="b2g" revision="276ce45e78b09c4a4ee643646f691d22804754c1">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
-  <project name="gaia" path="gaia" remote="mozillaorg" revision="1c9eb3d16167c2e5a9f7789eb46ee17830e6054e"/>
+  <project name="gaia" path="gaia" remote="mozillaorg" revision="0114839afc44aa98ae87db91004835f16a49dcab"/>
   <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7f792d756385bb894fba7645da59c67fe2c804bf"/>
   <project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="dc5ca96695cab87b4c2fcd7c9f046ae3415a70a5"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
   <project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="8b04b5aca4b0a894de40f4d53ae9750222d349a8"/>
--- a/b2g/config/emulator/sources.xml
+++ b/b2g/config/emulator/sources.xml
@@ -14,17 +14,17 @@
   <!--original fetch url was git://github.com/apitrace/-->
   <remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
   <default remote="caf" revision="refs/tags/android-4.0.4_r2.1" sync-j="4"/>
   <!-- Gonk specific things and forks -->
   <project name="platform_build" path="build" remote="b2g" revision="0d616942c300d9fb142483210f1dda9096c9a9fc">
     <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="1c9eb3d16167c2e5a9f7789eb46ee17830e6054e"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="0114839afc44aa98ae87db91004835f16a49dcab"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7f792d756385bb894fba7645da59c67fe2c804bf"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cd88d860656c31c7da7bb310d6a160d0011b0961"/>
   <project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="227354333a185180b85471f2cc6abfb029e44718"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="dc5ca96695cab87b4c2fcd7c9f046ae3415a70a5"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="8b04b5aca4b0a894de40f4d53ae9750222d349a8"/>
   <!-- Stock Android things -->
   <project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
--- a/b2g/config/flame/sources.xml
+++ b/b2g/config/flame/sources.xml
@@ -12,17 +12,17 @@
   <!--original fetch url was https://git.mozilla.org/releases-->
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <!-- B2G specific things. -->
   <project name="platform_build" path="build" remote="b2g" revision="cc67f31dc638c0b7edba3cf7e3d87cadf0ed52bf">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
   <project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
   <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
-  <project name="gaia" path="gaia" remote="mozillaorg" revision="1c9eb3d16167c2e5a9f7789eb46ee17830e6054e"/>
+  <project name="gaia" path="gaia" remote="mozillaorg" revision="0114839afc44aa98ae87db91004835f16a49dcab"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7f792d756385bb894fba7645da59c67fe2c804bf"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="dc5ca96695cab87b4c2fcd7c9f046ae3415a70a5"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="8b04b5aca4b0a894de40f4d53ae9750222d349a8"/>
   <project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
   <project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
   <!-- Stock Android things -->
   <project groups="linux" name="platform/prebuilts/clang/linux-x86/3.1" path="prebuilts/clang/linux-x86/3.1" revision="e95b4ce22c825da44d14299e1190ea39a5260bde"/>
   <project groups="linux" name="platform/prebuilts/clang/linux-x86/3.2" path="prebuilts/clang/linux-x86/3.2" revision="471afab478649078ad7c75ec6b252481a59e19b8"/>
--- a/b2g/config/gaia.json
+++ b/b2g/config/gaia.json
@@ -1,9 +1,9 @@
 {
     "git": {
         "git_revision": "", 
         "remote": "", 
         "branch": ""
     }, 
-    "revision": "cea1598e51f188fe8c48196cbb2c73aacbf3b1dc", 
+    "revision": "3112418e17e7f0b56dddb38316f6a448ec9c1e2a", 
     "repo_path": "/integration/gaia-central"
 }
--- a/b2g/config/hamachi/sources.xml
+++ b/b2g/config/hamachi/sources.xml
@@ -12,17 +12,17 @@
   <!--original fetch url was git://github.com/apitrace/-->
   <remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
   <default remote="caf" revision="b2g/ics_strawberry" sync-j="4"/>
   <!-- Gonk specific things and forks -->
   <project name="platform_build" path="build" remote="b2g" revision="0d616942c300d9fb142483210f1dda9096c9a9fc">
     <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="1c9eb3d16167c2e5a9f7789eb46ee17830e6054e"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="0114839afc44aa98ae87db91004835f16a49dcab"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7f792d756385bb894fba7645da59c67fe2c804bf"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="dc5ca96695cab87b4c2fcd7c9f046ae3415a70a5"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="8b04b5aca4b0a894de40f4d53ae9750222d349a8"/>
   <!-- Stock Android things -->
   <project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
   <project name="platform/bionic" path="bionic" revision="d2eb6c7b6e1bc7643c17df2d9d9bcb1704d0b9ab"/>
--- a/b2g/config/helix/sources.xml
+++ b/b2g/config/helix/sources.xml
@@ -10,17 +10,17 @@
   <!--original fetch url was https://git.mozilla.org/releases-->
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <default remote="caf" revision="b2g/ics_strawberry" sync-j="4"/>
   <!-- Gonk specific things and forks -->
   <project name="platform_build" path="build" remote="b2g" revision="0d616942c300d9fb142483210f1dda9096c9a9fc">
     <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="1c9eb3d16167c2e5a9f7789eb46ee17830e6054e"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="0114839afc44aa98ae87db91004835f16a49dcab"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7f792d756385bb894fba7645da59c67fe2c804bf"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="dc5ca96695cab87b4c2fcd7c9f046ae3415a70a5"/>
   <project name="gonk-patches" path="patches" remote="b2g" revision="223a2421006e8f5da33f516f6891c87cae86b0f6"/>
   <!-- Stock Android things -->
   <project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
   <project name="platform/bionic" path="bionic" revision="d2eb6c7b6e1bc7643c17df2d9d9bcb1704d0b9ab"/>
--- a/b2g/config/nexus-4/sources.xml
+++ b/b2g/config/nexus-4/sources.xml
@@ -12,17 +12,17 @@
   <!--original fetch url was https://git.mozilla.org/releases-->
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <!-- B2G specific things. -->
   <project name="platform_build" path="build" remote="b2g" revision="cc67f31dc638c0b7edba3cf7e3d87cadf0ed52bf">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
-  <project name="gaia" path="gaia" remote="mozillaorg" revision="1c9eb3d16167c2e5a9f7789eb46ee17830e6054e"/>
+  <project name="gaia" path="gaia" remote="mozillaorg" revision="0114839afc44aa98ae87db91004835f16a49dcab"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7f792d756385bb894fba7645da59c67fe2c804bf"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="dc5ca96695cab87b4c2fcd7c9f046ae3415a70a5"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="8b04b5aca4b0a894de40f4d53ae9750222d349a8"/>
   <project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
   <project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
   <!-- Stock Android things -->
   <project groups="linux" name="platform/prebuilts/clang/linux-x86/3.1" path="prebuilts/clang/linux-x86/3.1" revision="5c45f43419d5582949284eee9cef0c43d866e03b"/>
   <project groups="linux" name="platform/prebuilts/clang/linux-x86/3.2" path="prebuilts/clang/linux-x86/3.2" revision="3748b4168e7bd8d46457d4b6786003bc6a5223ce"/>
--- a/b2g/config/wasabi/sources.xml
+++ b/b2g/config/wasabi/sources.xml
@@ -12,17 +12,17 @@
   <!--original fetch url was git://github.com/apitrace/-->
   <remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
   <default remote="caf" revision="ics_chocolate_rb4.2" sync-j="4"/>
   <!-- Gonk specific things and forks -->
   <project name="platform_build" path="build" remote="b2g" revision="0d616942c300d9fb142483210f1dda9096c9a9fc">
     <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="1c9eb3d16167c2e5a9f7789eb46ee17830e6054e"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="0114839afc44aa98ae87db91004835f16a49dcab"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7f792d756385bb894fba7645da59c67fe2c804bf"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="dc5ca96695cab87b4c2fcd7c9f046ae3415a70a5"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="8b04b5aca4b0a894de40f4d53ae9750222d349a8"/>
   <project name="gonk-patches" path="patches" remote="b2g" revision="223a2421006e8f5da33f516f6891c87cae86b0f6"/>
   <!-- Stock Android things -->
   <project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
--- a/dom/bluetooth2/BluetoothAdapter.cpp
+++ b/dom/bluetooth2/BluetoothAdapter.cpp
@@ -814,31 +814,30 @@ BluetoothAdapter::EnableDisable(bool aEn
     // Disable local adapter
     BT_ENSURE_TRUE_REJECT(mState == BluetoothAdapterState::Enabled,
                           NS_ERROR_DOM_INVALID_STATE_ERR);
     methodName.AssignLiteral("Disable");
     mState = BluetoothAdapterState::Disabling;
   }
 
   // Notify applications of adapter state change to Enabling/Disabling
-  nsTArray<nsString> types;
-  BT_APPEND_ENUM_STRING(types,
-                        BluetoothAdapterAttribute,
-                        BluetoothAdapterAttribute::State);
-  DispatchAttributeEvent(types);
+  HandleAdapterStateChanged();
 
   // Wrap runnable to handle result
   nsRefPtr<BluetoothReplyRunnable> result =
     new BluetoothVoidReplyRunnable(nullptr, /* DOMRequest */
                                    promise,
                                    methodName);
 
   if(NS_FAILED(bs->EnableDisable(aEnable, result))) {
+    // Restore mState and notify applications of adapter state change
     mState = aEnable ? BluetoothAdapterState::Disabled
                      : BluetoothAdapterState::Enabled;
+    HandleAdapterStateChanged();
+
     promise->MaybeReject(NS_ERROR_DOM_OPERATION_ERR);
   }
 
   return promise.forget();
 }
 
 already_AddRefed<Promise>
 BluetoothAdapter::Enable(ErrorResult& aRv)
@@ -890,16 +889,26 @@ BluetoothAdapter::IsAdapterAttributeChan
       return mDiscovering != aValue.get_bool();
     default:
       BT_WARNING("Type %d is not handled", uint32_t(aType));
       return false;
   }
 }
 
 void
+BluetoothAdapter::HandleAdapterStateChanged()
+{
+  nsTArray<nsString> types;
+  BT_APPEND_ENUM_STRING(types,
+                        BluetoothAdapterAttribute,
+                        BluetoothAdapterAttribute::State);
+  DispatchAttributeEvent(types);
+}
+
+void
 BluetoothAdapter::HandlePropertyChanged(const BluetoothValue& aValue)
 {
   MOZ_ASSERT(aValue.type() == BluetoothValue::TArrayOfBluetoothNamedValue);
 
   const InfallibleTArray<BluetoothNamedValue>& arr =
     aValue.get_ArrayOfBluetoothNamedValue();
 
   nsTArray<nsString> types;
--- a/dom/bluetooth2/BluetoothAdapter.h
+++ b/dom/bluetooth2/BluetoothAdapter.h
@@ -188,16 +188,17 @@ private:
 
   void Root();
 
   already_AddRefed<mozilla::dom::DOMRequest>
     PairUnpair(bool aPair, const nsAString& aDeviceAddress, ErrorResult& aRv);
 
   bool IsAdapterAttributeChanged(BluetoothAdapterAttribute aType,
                                  const BluetoothValue& aValue);
+  void HandleAdapterStateChanged();
   void HandlePropertyChanged(const BluetoothValue& aValue);
   void DispatchAttributeEvent(const nsTArray<nsString>& aTypes);
   BluetoothAdapterAttribute
     ConvertStringToAdapterAttribute(const nsAString& aString);
 
   JS::Heap<JSObject*> mJsUuids;
   JS::Heap<JSObject*> mJsDeviceAddresses;
   nsRefPtr<BluetoothDiscoveryHandle> mDiscoveryHandleInUse;
--- a/dom/system/gonk/MozMtpCommon.h
+++ b/dom/system/gonk/MozMtpCommon.h
@@ -23,22 +23,24 @@
 #define END_MTP_NAMESPACE \
   } /* namespace mtp */ } /* namespace system */ } /* namespace mozilla */
 #define USING_MTP_NAMESPACE \
   using namespace mozilla::system::mtp;
 
 namespace android {
   class MOZ_EXPORT MtpServer;
   class MOZ_EXPORT MtpStorage;
+  class MOZ_EXPORT MtpStringBuffer;
   class MOZ_EXPORT MtpDatabase;
   class MOZ_EXPORT MtpDataPacket;
   class MOZ_EXPORT MtpProperty;
 }
 
 #include <mtp.h>
 #include <MtpDatabase.h>
 #include <MtpObjectInfo.h>
 #include <MtpProperty.h>
 #include <MtpServer.h>
 #include <MtpStorage.h>
+#include <MtpStringBuffer.h>
 #include <MtpTypes.h>
 
 #endif // mozilla_system_mtpcommon_h__
--- a/dom/system/gonk/MozMtpDatabase.cpp
+++ b/dom/system/gonk/MozMtpDatabase.cpp
@@ -24,16 +24,17 @@ MOZ_TYPE_SPECIFIC_SCOPED_POINTER_TEMPLAT
 
 BEGIN_MTP_NAMESPACE
 
 static const char *
 ObjectPropertyAsStr(MtpObjectProperty aProperty)
 {
   switch (aProperty) {
     case MTP_PROPERTY_STORAGE_ID:       return "MTP_PROPERTY_STORAGE_ID";
+    case MTP_PROPERTY_OBJECT_FILE_NAME: return "MTP_PROPERTY_OBJECT_FILE_NAME";
     case MTP_PROPERTY_OBJECT_FORMAT:    return "MTP_PROPERTY_OBJECT_FORMAT";
     case MTP_PROPERTY_OBJECT_SIZE:      return "MTP_PROPERTY_OBJECT_SIZE";
     case MTP_PROPERTY_WIDTH:            return "MTP_PROPERTY_WIDTH";
     case MTP_PROPERTY_HEIGHT:           return "MTP_PROPERTY_HEIGHT";
     case MTP_PROPERTY_IMAGE_BIT_DEPTH:  return "MTP_PROPERTY_IMAGE_BIT_DEPTH";
     case MTP_PROPERTY_DISPLAY_NAME:     return "MTP_PROPERTY_DISPLAY_NAME";
   }
   return "MTP_PROPERTY_???";
@@ -97,16 +98,32 @@ MozMtpDatabase::BaseName(const nsCString
   if (file) {
     nsCString leafName;
     file->GetNativeLeafName(leafName);
     return leafName;
   }
   return path;
 }
 
+static nsCString
+GetPathWithoutFileName(const nsCString& aFullPath)
+{
+  nsCString path;
+
+  int32_t offset = aFullPath.RFindChar('/');
+  if (offset != kNotFound) {
+    // The trailing slash will be as part of 'path'
+    path = StringHead(aFullPath, offset + 1);
+  }
+
+  MTP_LOG("returning '%s'", path.get());
+
+  return path;
+}
+
 void
 MozMtpDatabase::ParseDirectory(const char *aDir, MtpObjectHandle aParent)
 {
   ScopedCloseDir dir;
 
   if (!(dir = PR_OpenDir(aDir))) {
     MTP_ERR("Unable to open directory '%s'", aDir);
     return;
@@ -348,24 +365,94 @@ MozMtpDatabase::getObjectPropertyValue(M
     default:
       MTP_LOG("Invalid Property: 0x%08x", aProperty);
       return MTP_RESPONSE_INVALID_OBJECT_PROP_CODE;
   }
 
   return MTP_RESPONSE_OK;
 }
 
+static int
+GetTypeOfObjectProp(MtpObjectProperty aProperty)
+{
+  struct PropertyTableEntry {
+    MtpObjectProperty property;
+    int type;
+  };
+
+  static const PropertyTableEntry kObjectPropertyTable[] = {
+    {MTP_PROPERTY_STORAGE_ID,        MTP_TYPE_UINT32  },
+    {MTP_PROPERTY_OBJECT_FORMAT,     MTP_TYPE_UINT16  },
+    {MTP_PROPERTY_PROTECTION_STATUS, MTP_TYPE_UINT16  },
+    {MTP_PROPERTY_OBJECT_SIZE,       MTP_TYPE_UINT64  },
+    {MTP_PROPERTY_OBJECT_FILE_NAME,  MTP_TYPE_STR     },
+    {MTP_PROPERTY_DATE_MODIFIED,     MTP_TYPE_STR     },
+    {MTP_PROPERTY_PARENT_OBJECT,     MTP_TYPE_UINT32  },
+    {MTP_PROPERTY_DISPLAY_NAME,      MTP_TYPE_STR     },
+    {MTP_PROPERTY_DATE_ADDED,        MTP_TYPE_STR     },
+  };
+
+  int count = sizeof(kObjectPropertyTable) / sizeof(kObjectPropertyTable[0]);
+  const PropertyTableEntry* entryProp = kObjectPropertyTable;
+  int type = 0;
+
+  for (int i = 0; i < count; ++i, ++entryProp) {
+    if (entryProp->property == aProperty) {
+      type = entryProp->type;
+      break;
+    }
+  }
+
+  return type;
+}
+
 //virtual
 MtpResponseCode
 MozMtpDatabase::setObjectPropertyValue(MtpObjectHandle aHandle,
                                      MtpObjectProperty aProperty,
                                      MtpDataPacket& aPacket)
 {
-  MTP_LOG("Handle: 0x%08x (NOT SUPPORTED)", aHandle);
-  return MTP_RESPONSE_OPERATION_NOT_SUPPORTED;
+  MTP_LOG("Handle: 0x%08x Property: 0x%08x", aHandle, aProperty);
+
+  // Only support file name change
+  if (aProperty != MTP_PROPERTY_OBJECT_FILE_NAME) {
+    MTP_ERR("property 0x%x not supported", aProperty);
+    return  MTP_RESPONSE_OBJECT_PROP_NOT_SUPPORTED;
+  }
+
+  if (GetTypeOfObjectProp(aProperty) != MTP_TYPE_STR) {
+    MTP_ERR("property type 0x%x not supported", GetTypeOfObjectProp(aProperty));
+    return MTP_RESPONSE_GENERAL_ERROR;
+  }
+
+  RefPtr<DbEntry> entry = GetEntry(aHandle);
+  if (!entry) {
+    MTP_ERR("Invalid Handle: 0x%08x", aHandle);
+    return MTP_RESPONSE_INVALID_OBJECT_HANDLE;
+  }
+
+  MtpStringBuffer buf;
+  aPacket.getString(buf);
+
+  nsDependentCString newFileName(buf);
+  nsCString newFileFullPath(GetPathWithoutFileName(entry->mPath) + newFileName);
+
+  if (PR_Rename(entry->mPath.get(), newFileFullPath.get()) != PR_SUCCESS) {
+    MTP_ERR("Failed to rename '%s' to '%s'",
+            entry->mPath.get(), newFileFullPath.get());
+    return MTP_RESPONSE_GENERAL_ERROR;
+  }
+
+  MTP_LOG("renamed '%s' to '%s'", entry->mPath.get(), newFileFullPath.get());
+
+  entry->mPath = newFileFullPath;
+  entry->mObjectName = BaseName(entry->mPath);
+  entry->mDisplayName = entry->mObjectName;
+
+  return MTP_RESPONSE_OK;
 }
 
 //virtual
 MtpResponseCode
 MozMtpDatabase::getDevicePropertyValue(MtpDeviceProperty aProperty,
                                      MtpDataPacket& aPacket)
 {
   MTP_LOG("(GENERAL ERROR)");
@@ -630,17 +717,23 @@ MozMtpDatabase::getObjectInfo(MtpObjectH
   }
 
   MTP_LOG("Handle: 0x%08x Display:'%s' Object:'%s'", aHandle, entry->mDisplayName.get(), entry->mObjectName.get());
 
   aInfo.mHandle = aHandle;
   aInfo.mStorageID = entry->mStorageID;
   aInfo.mFormat = entry->mObjectFormat;
   aInfo.mProtectionStatus = 0x0;
-  aInfo.mCompressedSize = 0;
+
+  if (entry->mObjectSize > 0xFFFFFFFFuLL) {
+    aInfo.mCompressedSize = 0xFFFFFFFFuLL;
+  } else {
+    aInfo.mCompressedSize = entry->mObjectSize;
+  }
+
   aInfo.mThumbFormat = entry->mObjectFormat;
   aInfo.mThumbCompressedSize = 20*20*4;
   aInfo.mThumbPixWidth = 20;
   aInfo.mThumbPixHeight  =20;
   aInfo.mImagePixWidth = 20;
   aInfo.mImagePixHeight = 20;
   aInfo.mImagePixDepth = 4;
   aInfo.mParent = entry->mParent;
@@ -743,28 +836,46 @@ MozMtpDatabase::setObjectReferences(MtpO
 
 //virtual
 MtpProperty*
 MozMtpDatabase::getObjectPropertyDesc(MtpObjectProperty aProperty,
                                       MtpObjectFormat aFormat)
 {
   MTP_LOG("Property: %s 0x%08x", ObjectPropertyAsStr(aProperty), aProperty);
 
-  // TODO: Perhaps Filesize should be 64-bit?
-
   MtpProperty* result = nullptr;
   switch (aProperty)
   {
-    case MTP_PROPERTY_STORAGE_ID:       result = new MtpProperty(aProperty, MTP_TYPE_UINT32); break;
-    case MTP_PROPERTY_OBJECT_FORMAT:    result = new MtpProperty(aProperty, MTP_TYPE_UINT32); break;
-    case MTP_PROPERTY_OBJECT_SIZE:      result = new MtpProperty(aProperty, MTP_TYPE_UINT32); break;
-    case MTP_PROPERTY_WIDTH:            result = new MtpProperty(aProperty, MTP_TYPE_UINT32); break;
-    case MTP_PROPERTY_HEIGHT:           result = new MtpProperty(aProperty, MTP_TYPE_UINT32); break;
-    case MTP_PROPERTY_IMAGE_BIT_DEPTH:  result = new MtpProperty(aProperty, MTP_TYPE_UINT32); break;
-    case MTP_PROPERTY_DISPLAY_NAME:     result = new MtpProperty(aProperty, MTP_TYPE_STR); break;
+    case MTP_PROPERTY_PROTECTION_STATUS:
+      result = new MtpProperty(aProperty, MTP_TYPE_UINT16);
+      break;
+    case MTP_PROPERTY_OBJECT_FORMAT:
+      result = new MtpProperty(aProperty, MTP_TYPE_UINT16, false, aFormat);
+      break;
+    case MTP_PROPERTY_STORAGE_ID:
+    case MTP_PROPERTY_PARENT_OBJECT:
+    case MTP_PROPERTY_WIDTH:
+    case MTP_PROPERTY_HEIGHT:
+    case MTP_PROPERTY_IMAGE_BIT_DEPTH:
+      result = new MtpProperty(aProperty, MTP_TYPE_UINT32);
+      break;
+    case MTP_PROPERTY_OBJECT_SIZE:
+      result = new MtpProperty(aProperty, MTP_TYPE_UINT64);
+      break;
+    case MTP_PROPERTY_DISPLAY_NAME:
+      result = new MtpProperty(aProperty, MTP_TYPE_STR);
+      break;
+    case MTP_PROPERTY_OBJECT_FILE_NAME:
+      result = new MtpProperty(aProperty, MTP_TYPE_STR, true);
+      break;
+    case MTP_PROPERTY_DATE_MODIFIED:
+    case MTP_PROPERTY_DATE_ADDED:
+      result = new MtpProperty(aProperty, MTP_TYPE_STR);
+      result->setFormDateTime();
+      break;
     default:
       break;
   }
 
   return result;
 }
 
 //virtual