merge b2g-inbound to mozilla-central a=merge

This commit is contained in:
Carsten "Tomcat" Book 2015-01-09 14:08:02 +01:00
Родитель 4149a976d9 3b9995d7ea
Коммит 91c096e3f5
31 изменённых файлов: 271 добавлений и 106 удалений

Просмотреть файл

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="e0c735ec89df011ea7dd435087a9045ecff9ff9e">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="5f0dd37917c4a6d8fa8724715d4d3797419f9013"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="d102cc0a7a1f346531553bec64588eea9e4594eb"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="cd63c7ae655ee08ffac32ce36a188f8fefc4b272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
@ -23,7 +23,7 @@
<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="ef5d837b06c473b4e7139a6e13550cfd602aba88"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="34ea6163f9f0e0122fb0bb03607eccdca31ced7a"/>
<!-- Stock Android things -->
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/>

Просмотреть файл

@ -19,13 +19,13 @@
<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="5f0dd37917c4a6d8fa8724715d4d3797419f9013"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="d102cc0a7a1f346531553bec64588eea9e4594eb"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="cd63c7ae655ee08ffac32ce36a188f8fefc4b272"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d5d3f93914558b6f168447b805cd799c8233e300"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="6fa7a4936414ceb4055fd27f7a30e76790f834fb"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="ef5d837b06c473b4e7139a6e13550cfd602aba88"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="34ea6163f9f0e0122fb0bb03607eccdca31ced7a"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
<project name="platform_bionic" path="bionic" remote="b2g" revision="e2b3733ba3fa5e3f404e983d2e4142b1f6b1b846"/>

Просмотреть файл

@ -17,10 +17,10 @@
</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="5f0dd37917c4a6d8fa8724715d4d3797419f9013"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="d102cc0a7a1f346531553bec64588eea9e4594eb"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="cd63c7ae655ee08ffac32ce36a188f8fefc4b272"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="ef5d837b06c473b4e7139a6e13550cfd602aba88"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="34ea6163f9f0e0122fb0bb03607eccdca31ced7a"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<!-- Stock Android things -->

Просмотреть файл

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="e0c735ec89df011ea7dd435087a9045ecff9ff9e">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="5f0dd37917c4a6d8fa8724715d4d3797419f9013"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="d102cc0a7a1f346531553bec64588eea9e4594eb"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="cd63c7ae655ee08ffac32ce36a188f8fefc4b272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
@ -23,7 +23,7 @@
<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="ef5d837b06c473b4e7139a6e13550cfd602aba88"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="34ea6163f9f0e0122fb0bb03607eccdca31ced7a"/>
<!-- Stock Android things -->
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="f92a936f2aa97526d4593386754bdbf02db07a12"/>
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="6e47ff2790f5656b5b074407829ceecf3e6188c4"/>

Просмотреть файл

@ -19,13 +19,13 @@
<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="5f0dd37917c4a6d8fa8724715d4d3797419f9013"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="d102cc0a7a1f346531553bec64588eea9e4594eb"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="cd63c7ae655ee08ffac32ce36a188f8fefc4b272"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d5d3f93914558b6f168447b805cd799c8233e300"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="6fa7a4936414ceb4055fd27f7a30e76790f834fb"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="ef5d837b06c473b4e7139a6e13550cfd602aba88"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="34ea6163f9f0e0122fb0bb03607eccdca31ced7a"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
<project name="platform_bionic" path="bionic" remote="b2g" revision="e2b3733ba3fa5e3f404e983d2e4142b1f6b1b846"/>

Просмотреть файл

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="e0c735ec89df011ea7dd435087a9045ecff9ff9e">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="5f0dd37917c4a6d8fa8724715d4d3797419f9013"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="d102cc0a7a1f346531553bec64588eea9e4594eb"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="cd63c7ae655ee08ffac32ce36a188f8fefc4b272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
@ -23,7 +23,7 @@
<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="ef5d837b06c473b4e7139a6e13550cfd602aba88"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="34ea6163f9f0e0122fb0bb03607eccdca31ced7a"/>
<!-- Stock Android things -->
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/>

Просмотреть файл

@ -17,10 +17,10 @@
</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="5f0dd37917c4a6d8fa8724715d4d3797419f9013"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="d102cc0a7a1f346531553bec64588eea9e4594eb"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="cd63c7ae655ee08ffac32ce36a188f8fefc4b272"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="ef5d837b06c473b4e7139a6e13550cfd602aba88"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="34ea6163f9f0e0122fb0bb03607eccdca31ced7a"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<!-- Stock Android things -->

Просмотреть файл

@ -4,6 +4,6 @@
"remote": "",
"branch": ""
},
"revision": "85bbbd703dba85b58c5b9d5902bc784c9f763c1d",
"revision": "de2fb8cf47d91fa533d1228d31aeddae9d968b1e",
"repo_path": "integration/gaia-central"
}

Просмотреть файл

@ -17,11 +17,11 @@
<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="5f0dd37917c4a6d8fa8724715d4d3797419f9013"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="d102cc0a7a1f346531553bec64588eea9e4594eb"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="cd63c7ae655ee08ffac32ce36a188f8fefc4b272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="ef5d837b06c473b4e7139a6e13550cfd602aba88"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="34ea6163f9f0e0122fb0bb03607eccdca31ced7a"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
<project name="platform/bionic" path="bionic" revision="d2eb6c7b6e1bc7643c17df2d9d9bcb1704d0b9ab"/>

Просмотреть файл

@ -15,7 +15,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="5f0dd37917c4a6d8fa8724715d4d3797419f9013"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="d102cc0a7a1f346531553bec64588eea9e4594eb"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="cd63c7ae655ee08ffac32ce36a188f8fefc4b272"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>

Просмотреть файл

@ -17,10 +17,10 @@
</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="5f0dd37917c4a6d8fa8724715d4d3797419f9013"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="d102cc0a7a1f346531553bec64588eea9e4594eb"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="cd63c7ae655ee08ffac32ce36a188f8fefc4b272"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="ef5d837b06c473b4e7139a6e13550cfd602aba88"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="34ea6163f9f0e0122fb0bb03607eccdca31ced7a"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<!-- Stock Android things -->

Просмотреть файл

@ -17,12 +17,12 @@
<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="5f0dd37917c4a6d8fa8724715d4d3797419f9013"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="d102cc0a7a1f346531553bec64588eea9e4594eb"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="cd63c7ae655ee08ffac32ce36a188f8fefc4b272"/>
<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="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="ef5d837b06c473b4e7139a6e13550cfd602aba88"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="34ea6163f9f0e0122fb0bb03607eccdca31ced7a"/>
<project name="gonk-patches" path="patches" remote="b2g" revision="223a2421006e8f5da33f516f6891c87cae86b0f6"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>

Просмотреть файл

@ -481,8 +481,8 @@ BluetoothOppManager::ConfirmReceivingFile(bool aConfirm)
if (success && mPutFinalFlag) {
mSuccessFlag = true;
RestoreReceivedFileAndNotify();
FileTransferComplete();
NotifyAboutFileChange();
}
ReplyToPut(mPutFinalFlag, success);
@ -551,7 +551,8 @@ BluetoothOppManager::AfterOppDisconnected()
mReadFileThread->Shutdown();
mReadFileThread = nullptr;
}
// Release the Mount lock if file transfer completed
// Release the mount lock if file transfer completed
if (mMountLock) {
// The mount lock will be implicitly unlocked
mMountLock = nullptr;
@ -559,8 +560,14 @@ BluetoothOppManager::AfterOppDisconnected()
}
void
BluetoothOppManager::RecoverFileName()
BluetoothOppManager::RestoreReceivedFileAndNotify()
{
// Remove the empty dummy file
if (mDummyDsFile && mDummyDsFile->mFile) {
mDummyDsFile->mFile->Remove(false);
mDummyDsFile = nullptr;
}
// Remove the trailing ".part" file name from mDsFile by two steps
// 1. mDsFile->SetPath() so that the notification sent to Gaia will carry
// correct information of the file.
@ -574,16 +581,9 @@ BluetoothOppManager::RecoverFileName()
mDsFile->SetPath(path);
mDsFile->mFile->RenameTo(nullptr, mFileName);
}
}
void
BluetoothOppManager::DeleteDummyFile()
{
// Remove the empty temp file
if (mDummyDsFile && mDummyDsFile->mFile) {
mDummyDsFile->mFile->Remove(false);
mDummyDsFile = nullptr;
}
// Notify about change of received file
NotifyAboutFileChange();
}
void
@ -599,7 +599,11 @@ BluetoothOppManager::DeleteReceivedFile()
mDsFile = nullptr;
}
DeleteDummyFile();
// Remove the empty dummy file
if (mDummyDsFile && mDummyDsFile->mFile) {
mDummyDsFile->mFile->Remove(false);
mDummyDsFile = nullptr;
}
}
bool
@ -956,12 +960,8 @@ BluetoothOppManager::ServerDataHandler(UnixSocketRawData* aMessage)
// Success to receive a file and notify completion
if (mPutFinalFlag) {
mSuccessFlag = true;
DeleteDummyFile();
RecoverFileName();
RestoreReceivedFileAndNotify();
FileTransferComplete();
NotifyAboutFileChange();
}
} else if (opCode == ObexRequestCode::Get ||
opCode == ObexRequestCode::GetFinal ||

Просмотреть файл

@ -85,8 +85,7 @@ private:
void ReceivingFileConfirmation();
bool CreateFile();
bool WriteToFile(const uint8_t* aData, int aDataLength);
void RecoverFileName();
void DeleteDummyFile();
void RestoreReceivedFileAndNotify();
void DeleteReceivedFile();
void ReplyToConnect();
void ReplyToDisconnectOrAbort();

Просмотреть файл

@ -503,8 +503,8 @@ BluetoothOppManager::ConfirmReceivingFile(bool aConfirm)
if (success && mPutFinalFlag) {
mSuccessFlag = true;
RestoreReceivedFileAndNotify();
FileTransferComplete();
NotifyAboutFileChange();
}
ReplyToPut(mPutFinalFlag, success);
@ -573,7 +573,8 @@ BluetoothOppManager::AfterOppDisconnected()
mReadFileThread->Shutdown();
mReadFileThread = nullptr;
}
// Release the Mount lock if file transfer completed
// Release the mount lock if file transfer completed
if (mMountLock) {
// The mount lock will be implicitly unlocked
mMountLock = nullptr;
@ -581,8 +582,14 @@ BluetoothOppManager::AfterOppDisconnected()
}
void
BluetoothOppManager::RecoverFileName()
BluetoothOppManager::RestoreReceivedFileAndNotify()
{
// Remove the empty dummy file
if (mDummyDsFile && mDummyDsFile->mFile) {
mDummyDsFile->mFile->Remove(false);
mDummyDsFile = nullptr;
}
// Remove the trailing ".part" file name from mDsFile by two steps
// 1. mDsFile->SetPath() so that the notification sent to Gaia will carry
// correct information of the file.
@ -596,16 +603,9 @@ BluetoothOppManager::RecoverFileName()
mDsFile->SetPath(path);
mDsFile->mFile->RenameTo(nullptr, mFileName);
}
}
void
BluetoothOppManager::DeleteDummyFile()
{
// Remove the empty temp file
if (mDummyDsFile && mDummyDsFile->mFile) {
mDummyDsFile->mFile->Remove(false);
mDummyDsFile = nullptr;
}
// Notify about change of received file
NotifyAboutFileChange();
}
void
@ -621,7 +621,11 @@ BluetoothOppManager::DeleteReceivedFile()
mDsFile = nullptr;
}
DeleteDummyFile();
// Remove the empty dummy file
if (mDummyDsFile && mDummyDsFile->mFile) {
mDummyDsFile->mFile->Remove(false);
mDummyDsFile = nullptr;
}
}
bool
@ -977,12 +981,8 @@ BluetoothOppManager::ServerDataHandler(UnixSocketRawData* aMessage)
// Success to receive a file and notify completion
if (mPutFinalFlag) {
mSuccessFlag = true;
DeleteDummyFile();
RecoverFileName();
RestoreReceivedFileAndNotify();
FileTransferComplete();
NotifyAboutFileChange();
}
} else if (opCode == ObexRequestCode::Get ||
opCode == ObexRequestCode::GetFinal ||

Просмотреть файл

@ -85,8 +85,7 @@ private:
void ReceivingFileConfirmation();
bool CreateFile();
bool WriteToFile(const uint8_t* aData, int aDataLength);
void RecoverFileName();
void DeleteDummyFile();
void RestoreReceivedFileAndNotify();
void DeleteReceivedFile();
void ReplyToConnect();
void ReplyToDisconnectOrAbort();

Просмотреть файл

@ -481,8 +481,8 @@ BluetoothOppManager::ConfirmReceivingFile(bool aConfirm)
if (success && mPutFinalFlag) {
mSuccessFlag = true;
RestoreReceivedFileAndNotify();
FileTransferComplete();
NotifyAboutFileChange();
}
ReplyToPut(mPutFinalFlag, success);
@ -551,7 +551,8 @@ BluetoothOppManager::AfterOppDisconnected()
mReadFileThread->Shutdown();
mReadFileThread = nullptr;
}
// Release the Mount lock if file transfer completed
// Release the mount lock if file transfer completed
if (mMountLock) {
// The mount lock will be implicitly unlocked
mMountLock = nullptr;
@ -559,8 +560,14 @@ BluetoothOppManager::AfterOppDisconnected()
}
void
BluetoothOppManager::RecoverFileName()
BluetoothOppManager::RestoreReceivedFileAndNotify()
{
// Remove the empty dummy file
if (mDummyDsFile && mDummyDsFile->mFile) {
mDummyDsFile->mFile->Remove(false);
mDummyDsFile = nullptr;
}
// Remove the trailing ".part" file name from mDsFile by two steps
// 1. mDsFile->SetPath() so that the notification sent to Gaia will carry
// correct information of the file.
@ -574,16 +581,9 @@ BluetoothOppManager::RecoverFileName()
mDsFile->SetPath(path);
mDsFile->mFile->RenameTo(nullptr, mFileName);
}
}
void
BluetoothOppManager::DeleteDummyFile()
{
// Remove the empty temp file
if (mDummyDsFile && mDummyDsFile->mFile) {
mDummyDsFile->mFile->Remove(false);
mDummyDsFile = nullptr;
}
// Notify about change of received file
NotifyAboutFileChange();
}
void
@ -599,7 +599,11 @@ BluetoothOppManager::DeleteReceivedFile()
mDsFile = nullptr;
}
DeleteDummyFile();
// Remove the empty dummy file
if (mDummyDsFile && mDummyDsFile->mFile) {
mDummyDsFile->mFile->Remove(false);
mDummyDsFile = nullptr;
}
}
bool
@ -956,12 +960,8 @@ BluetoothOppManager::ServerDataHandler(UnixSocketRawData* aMessage)
// Success to receive a file and notify completion
if (mPutFinalFlag) {
mSuccessFlag = true;
DeleteDummyFile();
RecoverFileName();
RestoreReceivedFileAndNotify();
FileTransferComplete();
NotifyAboutFileChange();
}
} else if (opCode == ObexRequestCode::Get ||
opCode == ObexRequestCode::GetFinal ||

Просмотреть файл

@ -85,8 +85,7 @@ private:
void ReceivingFileConfirmation();
bool CreateFile();
bool WriteToFile(const uint8_t* aData, int aDataLength);
void RecoverFileName();
void DeleteDummyFile();
void RestoreReceivedFileAndNotify();
void DeleteReceivedFile();
void ReplyToConnect();
void ReplyToDisconnectOrAbort();

Просмотреть файл

@ -503,8 +503,8 @@ BluetoothOppManager::ConfirmReceivingFile(bool aConfirm)
if (success && mPutFinalFlag) {
mSuccessFlag = true;
RestoreReceivedFileAndNotify();
FileTransferComplete();
NotifyAboutFileChange();
}
ReplyToPut(mPutFinalFlag, success);
@ -573,7 +573,8 @@ BluetoothOppManager::AfterOppDisconnected()
mReadFileThread->Shutdown();
mReadFileThread = nullptr;
}
// Release the Mount lock if file transfer completed
// Release the mount lock if file transfer completed
if (mMountLock) {
// The mount lock will be implicitly unlocked
mMountLock = nullptr;
@ -581,8 +582,14 @@ BluetoothOppManager::AfterOppDisconnected()
}
void
BluetoothOppManager::RecoverFileName()
BluetoothOppManager::RestoreReceivedFileAndNotify()
{
// Remove the empty dummy file
if (mDummyDsFile && mDummyDsFile->mFile) {
mDummyDsFile->mFile->Remove(false);
mDummyDsFile = nullptr;
}
// Remove the trailing ".part" file name from mDsFile by two steps
// 1. mDsFile->SetPath() so that the notification sent to Gaia will carry
// correct information of the file.
@ -596,16 +603,9 @@ BluetoothOppManager::RecoverFileName()
mDsFile->SetPath(path);
mDsFile->mFile->RenameTo(nullptr, mFileName);
}
}
void
BluetoothOppManager::DeleteDummyFile()
{
// Remove the empty temp file
if (mDummyDsFile && mDummyDsFile->mFile) {
mDummyDsFile->mFile->Remove(false);
mDummyDsFile = nullptr;
}
// Notify about change of received file
NotifyAboutFileChange();
}
void
@ -621,7 +621,11 @@ BluetoothOppManager::DeleteReceivedFile()
mDsFile = nullptr;
}
DeleteDummyFile();
// Remove the empty dummy file
if (mDummyDsFile && mDummyDsFile->mFile) {
mDummyDsFile->mFile->Remove(false);
mDummyDsFile = nullptr;
}
}
bool
@ -977,12 +981,8 @@ BluetoothOppManager::ServerDataHandler(UnixSocketRawData* aMessage)
// Success to receive a file and notify completion
if (mPutFinalFlag) {
mSuccessFlag = true;
DeleteDummyFile();
RecoverFileName();
RestoreReceivedFileAndNotify();
FileTransferComplete();
NotifyAboutFileChange();
}
} else if (opCode == ObexRequestCode::Get ||
opCode == ObexRequestCode::GetFinal ||

Просмотреть файл

@ -85,8 +85,7 @@ private:
void ReceivingFileConfirmation();
bool CreateFile();
bool WriteToFile(const uint8_t* aData, int aDataLength);
void RecoverFileName();
void DeleteDummyFile();
void RestoreReceivedFileAndNotify();
void DeleteReceivedFile();
void ReplyToConnect();
void ReplyToDisconnectOrAbort();

Просмотреть файл

@ -55,6 +55,7 @@ const NFC_IPC_MSG_NAMES = [
"NFC:WriteNDEFResponse",
"NFC:MakeReadOnlyResponse",
"NFC:FormatResponse",
"NFC:TransceiveResponse",
"NFC:ConnectResponse",
"NFC:CloseResponse",
"NFC:CheckP2PRegistrationResponse",
@ -174,6 +175,18 @@ NfcContentHelper.prototype = {
});
},
transceive: function transceive(sessionToken, technology, command, callback) {
let requestId = callback.getCallbackId();
this._requestMap[requestId] = callback;
cpmm.sendAsyncMessage("NFC:Transceive", {
requestId: requestId,
sessionToken: sessionToken,
technology: technology,
command: command
});
},
connect: function connect(techType, sessionToken, callback) {
let requestId = callback.getCallbackId();
this._requestMap[requestId] = callback;
@ -280,6 +293,9 @@ NfcContentHelper.prototype = {
case "NFC:CheckP2PRegistrationResponse":
this.handleCheckP2PRegistrationResponse(result);
break;
case "NFC:TransceiveResponse":
this.handleTransceiveResponse(result);
break;
case "NFC:ConnectResponse": // Fall through.
case "NFC:CloseResponse":
case "NFC:WriteNDEFResponse":
@ -394,6 +410,23 @@ NfcContentHelper.prototype = {
// The receiver must check the boolean mapped status code to handle.
callback.notifySuccessWithBoolean(!result.errorMsg);
},
handleTransceiveResponse: function handleTransceiveResponse(result) {
let requestId = result.requestId;
let callback = this._requestMap[requestId];
if (!callback) {
debug("not firing message handleTransceiveResponse for id: " + requestId);
return;
}
delete this._requestMap[requestId];
if (result.errorMsg) {
callback.notifyError(result.errorMsg);
return;
}
callback.notifySuccessWithByteArray(result.response);
},
};
function TagNDEFInfo(tagType, maxNDEFSize, isReadOnly, isFormatable) {

Просмотреть файл

@ -65,7 +65,8 @@ const NFC_IPC_MSG_ENTRIES = [
"NFC:Close",
"NFC:WriteNDEF",
"NFC:MakeReadOnly",
"NFC:Format"] },
"NFC:Format",
"NFC:Transceive"] },
{ permission: "nfc-share",
messages: ["NFC:SendFile",
@ -518,6 +519,7 @@ Nfc.prototype = {
case "ReadNDEFResponse":
case "MakeReadOnlyResponse":
case "FormatResponse":
case "TransceiveResponse":
case "WriteNDEFResponse":
this.sendNfcResponse(message);
break;
@ -574,6 +576,9 @@ Nfc.prototype = {
case "NFC:Format":
this.sendToNfcService("format", message.data);
break;
case "NFC:Transceive":
this.sendToNfcService("transceive", message.data);
break;
case "NFC:Connect":
this.sendToNfcService("connect", message.data);
break;

Просмотреть файл

@ -18,12 +18,14 @@ enum NfcRequest {
WriteNDEFReq,
MakeReadOnlyReq,
FormatReq,
TransceiveReq,
};
enum NfcResponse {
GeneralRsp = 1000,
ChangeRFStateRsp,
ReadNDEFRsp,
TransceiveRsp
};
enum NfcNotification {

Просмотреть файл

@ -22,6 +22,7 @@ static const char* kReadNDEFRequest = "readNDEF";
static const char* kWriteNDEFRequest = "writeNDEF";
static const char* kMakeReadOnlyRequest = "makeReadOnly";
static const char* kFormatRequest = "format";
static const char* kTransceiveRequest = "transceive";
static const char* kConnectRequest = "connect";
static const char* kCloseRequest = "close";
@ -30,6 +31,7 @@ static const char* kReadNDEFResponse = "ReadNDEFResponse";
static const char* kWriteNDEFResponse = "WriteNDEFResponse";
static const char* kMakeReadOnlyResponse = "MakeReadOnlyResponse";
static const char* kFormatResponse = "FormatResponse";
static const char* kTransceiveResponse = "TransceiveResponse";
static const char* kConnectResponse = "ConnectResponse";
static const char* kCloseResponse = "CloseResponse";
@ -58,6 +60,9 @@ NfcMessageHandler::Marshall(Parcel& aParcel, const CommandOptions& aOptions)
} else if (!strcmp(type, kFormatRequest)) {
result = FormatRequest(aParcel, aOptions);
mPendingReqQueue.AppendElement(NfcRequest::FormatReq);
} else if (!strcmp(type, kTransceiveRequest)) {
result = TransceiveRequest(aParcel, aOptions);
mPendingReqQueue.AppendElement(NfcRequest::TransceiveReq);
} else if (!strcmp(type, kConnectRequest)) {
result = ConnectRequest(aParcel, aOptions);
mPendingReqQueue.AppendElement(NfcRequest::ConnectReq);
@ -88,6 +93,9 @@ NfcMessageHandler::Unmarshall(const Parcel& aParcel, EventOptions& aOptions)
case NfcResponse::ReadNDEFRsp:
result = ReadNDEFResponse(aParcel, aOptions);
break;
case NfcResponse::TransceiveRsp:
result = TransceiveResponse(aParcel, aOptions);
break;
case NfcNotification::Initialized:
result = InitializeNotification(aParcel, aOptions);
break;
@ -196,6 +204,24 @@ NfcMessageHandler::ReadNDEFResponse(const Parcel& aParcel, EventOptions& aOption
return true;
}
bool
NfcMessageHandler::TransceiveResponse(const Parcel& aParcel, EventOptions& aOptions)
{
aOptions.mType = NS_ConvertUTF8toUTF16(kTransceiveResponse);
aOptions.mErrorCode = aParcel.readInt32();
aOptions.mSessionId = aParcel.readInt32();
NS_ENSURE_TRUE(!mRequestIdQueue.IsEmpty(), false);
aOptions.mRequestId = mRequestIdQueue[0];
mRequestIdQueue.RemoveElementAt(0);
if (aOptions.mErrorCode == NfcErrorCode::Success) {
ReadTransceiveResponse(aParcel, aOptions);
}
return true;
}
bool
NfcMessageHandler::WriteNDEFRequest(Parcel& aParcel, const CommandOptions& aOptions)
{
@ -225,6 +251,23 @@ NfcMessageHandler::FormatRequest(Parcel& aParcel, const CommandOptions& aOptions
return true;
}
bool
NfcMessageHandler::TransceiveRequest(Parcel& aParcel, const CommandOptions& aOptions)
{
aParcel.writeInt32(NfcRequest::TransceiveReq);
aParcel.writeInt32(aOptions.mSessionId);
aParcel.writeInt32(aOptions.mTechnology);
uint32_t length = aOptions.mCommand.Length();
aParcel.writeInt32(length);
void* data = aParcel.writeInplace(length);
memcpy(data, aOptions.mCommand.Elements(), length);
mRequestIdQueue.AppendElement(aOptions.mRequestId);
return true;
}
bool
NfcMessageHandler::ConnectRequest(Parcel& aParcel, const CommandOptions& aOptions)
{
@ -374,3 +417,14 @@ NfcMessageHandler::WriteNDEFMessage(Parcel& aParcel, const CommandOptions& aOpti
return true;
}
bool
NfcMessageHandler::ReadTransceiveResponse(const Parcel& aParcel, EventOptions& aOptions)
{
uint32_t length = aParcel.readInt32();
aOptions.mResponse.AppendElements(
static_cast<const uint8_t*>(aParcel.readInplace(length)), length);
return true;
}

Просмотреть файл

@ -32,6 +32,8 @@ private:
bool WriteNDEFRequest(android::Parcel& aParcel, const CommandOptions& options);
bool MakeReadOnlyRequest(android::Parcel& aParcel, const CommandOptions& options);
bool FormatRequest(android::Parcel& aParcel, const CommandOptions& options);
bool TransceiveRequest(android::Parcel& aParcel, const CommandOptions& options);
bool TransceiveResponse(const android::Parcel& aParcel, EventOptions& aOptions);
bool ConnectRequest(android::Parcel& aParcel, const CommandOptions& options);
bool CloseRequest(android::Parcel& aParcel, const CommandOptions& options);
@ -42,7 +44,7 @@ private:
bool ReadNDEFMessage(const android::Parcel& aParcel, EventOptions& aOptions);
bool WriteNDEFMessage(android::Parcel& aParcel, const CommandOptions& aOptions);
bool ReadTransceiveResponse(const android::Parcel& aParcel, EventOptions& aOptions);
private:
nsTArray<int32_t> mPendingReqQueue;
nsTArray<nsString> mRequestIdQueue;

Просмотреть файл

@ -38,6 +38,16 @@ struct CommandOptions
COPY_OPT_FIELD(mTechType, 0)
COPY_OPT_FIELD(mIsP2P, false)
mTechnology = aOther.mTechnology.WasPassed() ?
static_cast<int32_t>(aOther.mTechnology.Value()) :
-1;
if (aOther.mCommand.WasPassed()) {
dom::Uint8Array const & currentValue = aOther.mCommand.InternalValue();
currentValue.ComputeLengthAndData();
mCommand.AppendElements(currentValue.Data(), currentValue.Length());
}
if (!aOther.mRecords.WasPassed()) {
return;
}
@ -80,6 +90,8 @@ struct CommandOptions
int32_t mTechType;
bool mIsP2P;
nsTArray<NDEFRecordStruct> mRecords;
int32_t mTechnology;
nsTArray<uint8_t> mCommand;
};
struct EventOptions
@ -112,6 +124,7 @@ struct EventOptions
int32_t mOriginIndex;
nsTArray<uint8_t> mAid;
nsTArray<uint8_t> mPayload;
nsTArray<uint8_t> mResponse;
};
} // namespace mozilla

Просмотреть файл

@ -198,6 +198,12 @@ public:
event.mPayload.Value().Init(Uint8Array::Create(cx, mEvent.mPayload.Length(), mEvent.mPayload.Elements()));
}
if (mEvent.mResponse.Length() > 0) {
event.mResponse.Construct();
event.mResponse.Value().Init(
Uint8Array::Create(cx, mEvent.mResponse.Length(), mEvent.mResponse.Elements()));
}
#undef COPY_FIELD
#undef COPY_OPT_FIELD

Просмотреть файл

@ -86,7 +86,7 @@ interface nsINfcEventListener : nsISupports
void notifyRFStateChange(in DOMString rfState);
};
[scriptable, uuid(a8ef3590-d853-4766-b54a-a4547da4dde4)]
[scriptable, uuid(6c913015-9658-46a9-88d9-6ecfda2bd020)]
interface nsINfcRequestCallback : nsISupports
{
DOMString getCallbackId();
@ -97,10 +97,12 @@ interface nsINfcRequestCallback : nsISupports
void notifySuccessWithNDEFRecords(in nsIVariant records);
void notifySuccessWithByteArray(in nsIVariant array);
void notifyError(in DOMString errorMsg);
};
[scriptable, uuid(c5fdf956-735e-45d3-aa25-3a871bd3e2f8)]
[scriptable, uuid(0f8aae32-9920-491e-a197-8995941d54df)]
interface nsINfcContentHelper : nsISupports
{
void init(in nsIDOMWindow window);
@ -157,6 +159,27 @@ interface nsINfcContentHelper : nsISupports
void format(in DOMString sessionToken,
in nsINfcRequestCallback callback);
/**
* Send raw command to the tag and receive the response.
*
* @param sessionToken
* Current token
*
* @param technology
* Tag technology
*
* @param command
* Command to send
*
* @param callback
* Called when request is finished
*
*/
void transceive(in DOMString sessionToken,
in DOMString technology,
in nsIVariant command,
in nsINfcRequestCallback callback);
/**
* Enable I/O operations to the tag
*

Просмотреть файл

@ -74,6 +74,15 @@ NfcCallback.prototype = {
resolver.resolve(aRecords);
},
notifySuccessWithByteArray: function notifySuccessWithByteArray(aArray) {
let resolver = this.takePromiseResolver(atob(this._requestId));
if (!resolver) {
debug("can not find promise resolver for id: " + this._requestId);
return;
}
resolver.resolve(aArray);
},
notifyError: function notifyError(aErrorMsg) {
let resolver = this.takePromiseResolver(atob(this._requestId));
if (!resolver) {
@ -192,6 +201,16 @@ MozNFCTagImpl.prototype = {
return callback.promise;
},
transceive: function transceive(tech, cmd) {
if (this.isLost) {
throw new this._window.DOMError("InvalidStateError", "NFCTag object is invalid");
}
let callback = new NfcCallback(this._window);
this._nfcContentHelper.transceive(this.session, tech, cmd, callback);
return callback.promise;
},
notifyLost: function notifyLost() {
this.isLost = true;
},

Просмотреть файл

@ -109,4 +109,10 @@ partial interface MozNFCTag {
[ChromeOnly]
void notifyLost();
/**
* Send raw command to tag and receive the response.
*/
[ChromeOnly, Throws]
Promise<Uint8Array> transceive(NFCTechType tech, Uint8Array command);
};

Просмотреть файл

@ -21,6 +21,9 @@ dictionary NfcCommandOptions
boolean isP2P;
sequence<MozNDEFRecordOptions> records;
NFCTechType technology;
Uint8Array command;
};
dictionary NfcEventOptions
@ -51,4 +54,7 @@ dictionary NfcEventOptions
DOMString origin;
Uint8Array aid;
Uint8Array payload;
// Tag transceive response data
Uint8Array response;
};