mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-15 14:30:47 +00:00
Bug 858689 - Sending an SMS fails on Android. r=mounir
This commit is contained in:
parent
9b3c9bf246
commit
dee3a4a2f3
@ -58,8 +58,6 @@ class AndroidRefable {
|
|||||||
// This isn't in AndroidBridge.h because including StrongPointer.h there is gross
|
// This isn't in AndroidBridge.h because including StrongPointer.h there is gross
|
||||||
static android::sp<AndroidRefable> (*android_SurfaceTexture_getNativeWindow)(JNIEnv* env, jobject surfaceTexture) = nullptr;
|
static android::sp<AndroidRefable> (*android_SurfaceTexture_getNativeWindow)(JNIEnv* env, jobject surfaceTexture) = nullptr;
|
||||||
|
|
||||||
/* static */ StaticAutoPtr<nsTArray<nsCOMPtr<nsIMobileMessageCallback> > > AndroidBridge::sSmsRequests;
|
|
||||||
|
|
||||||
void
|
void
|
||||||
AndroidBridge::ConstructBridge(JNIEnv *jEnv,
|
AndroidBridge::ConstructBridge(JNIEnv *jEnv,
|
||||||
jclass jGeckoAppShellClass)
|
jclass jGeckoAppShellClass)
|
||||||
@ -1773,21 +1771,16 @@ AndroidBridge::QueueSmsRequest(nsIMobileMessageCallback* aRequest, uint32_t* aRe
|
|||||||
MOZ_ASSERT(NS_IsMainThread(), "Wrong thread!");
|
MOZ_ASSERT(NS_IsMainThread(), "Wrong thread!");
|
||||||
MOZ_ASSERT(aRequest && aRequestIdOut);
|
MOZ_ASSERT(aRequest && aRequestIdOut);
|
||||||
|
|
||||||
if (!sSmsRequests) {
|
const uint32_t length = mSmsRequests.Length();
|
||||||
// Probably shutting down.
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const uint32_t length = sSmsRequests->Length();
|
|
||||||
for (uint32_t i = 0; i < length; i++) {
|
for (uint32_t i = 0; i < length; i++) {
|
||||||
if (!(*sSmsRequests)[i]) {
|
if (!(mSmsRequests)[i]) {
|
||||||
(*sSmsRequests)[i] = aRequest;
|
(mSmsRequests)[i] = aRequest;
|
||||||
*aRequestIdOut = i;
|
*aRequestIdOut = i;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sSmsRequests->AppendElement(aRequest);
|
mSmsRequests.AppendElement(aRequest);
|
||||||
|
|
||||||
// After AppendElement(), previous `length` points to the new tail element.
|
// After AppendElement(), previous `length` points to the new tail element.
|
||||||
*aRequestIdOut = length;
|
*aRequestIdOut = length;
|
||||||
@ -1799,17 +1792,12 @@ AndroidBridge::DequeueSmsRequest(uint32_t aRequestId)
|
|||||||
{
|
{
|
||||||
MOZ_ASSERT(NS_IsMainThread(), "Wrong thread!");
|
MOZ_ASSERT(NS_IsMainThread(), "Wrong thread!");
|
||||||
|
|
||||||
if (!sSmsRequests) {
|
MOZ_ASSERT(aRequestId < mSmsRequests.Length());
|
||||||
// Probably shutting down.
|
if (aRequestId >= mSmsRequests.Length()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
MOZ_ASSERT(aRequestId < sSmsRequests->Length());
|
return mSmsRequests[aRequestId].forget();
|
||||||
if (aRequestId >= sSmsRequests->Length()) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (*sSmsRequests)[aRequestId].forget();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -367,7 +367,7 @@ public:
|
|||||||
nsACString & aResult);
|
nsACString & aResult);
|
||||||
protected:
|
protected:
|
||||||
static AndroidBridge *sBridge;
|
static AndroidBridge *sBridge;
|
||||||
static StaticAutoPtr<nsTArray<nsCOMPtr<nsIMobileMessageCallback> > > sSmsRequests;
|
nsTArray<nsCOMPtr<nsIMobileMessageCallback> > mSmsRequests;
|
||||||
|
|
||||||
// the global JavaVM
|
// the global JavaVM
|
||||||
JavaVM *mJavaVM;
|
JavaVM *mJavaVM;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user