Bug 878533 - 3/3: fix Fennec build bustage. r=blassey

This commit is contained in:
Vicamo Yang 2014-08-28 11:00:03 +08:00
parent c811304686
commit 073dfd55f2
6 changed files with 31 additions and 23 deletions

View File

@ -2375,12 +2375,12 @@ public class GeckoAppShell
}
@WrapElementForJNI(stubName = "CreateMessageListWrapper")
public static void createMessageList(long aStartDate, long aEndDate, String[] aNumbers, int aNumbersCount, int aDeliveryState, boolean aReverse, int aRequestId) {
public static void createMessageList(long aStartDate, long aEndDate, String[] aNumbers, int aNumbersCount, String aDelivery, boolean aHasRead, boolean aRead, long aThreadId, boolean aReverse, int aRequestId) {
if (SmsManager.getInstance() == null) {
return;
}
SmsManager.getInstance().createMessageList(aStartDate, aEndDate, aNumbers, aNumbersCount, aDeliveryState, aReverse, aRequestId);
SmsManager.getInstance().createMessageList(aStartDate, aEndDate, aNumbers, aNumbersCount, aDelivery, aHasRead, aRead, aThreadId, aReverse, aRequestId);
}
@WrapElementForJNI(stubName = "GetNextMessageInListWrapper")

View File

@ -737,22 +737,22 @@ public class GeckoSmsManager
}
@Override
public void createMessageList(long aStartDate, long aEndDate, String[] aNumbers, int aNumbersCount, int aDeliveryState, boolean aReverse, int aRequestId) {
public void createMessageList(long aStartDate, long aEndDate, String[] aNumbers, int aNumbersCount, String aDelivery, boolean aHasRead, boolean aRead, long aThreadId, boolean aReverse, int aRequestId) {
class CreateMessageListRunnable implements Runnable {
private long mStartDate;
private long mEndDate;
private String[] mNumbers;
private int mNumbersCount;
private int mDeliveryState;
private String mDelivery;
private boolean mReverse;
private int mRequestId;
CreateMessageListRunnable(long aStartDate, long aEndDate, String[] aNumbers, int aNumbersCount, int aDeliveryState, boolean aReverse, int aRequestId) {
CreateMessageListRunnable(long aStartDate, long aEndDate, String[] aNumbers, int aNumbersCount, String aDelivery, boolean aHasRead, boolean aRead, long aThreadId, boolean aReverse, int aRequestId) {
mStartDate = aStartDate;
mEndDate = aEndDate;
mNumbers = aNumbers;
mNumbersCount = aNumbersCount;
mDeliveryState = aDeliveryState;
mDelivery = aDelivery;
mReverse = aReverse;
mRequestId = aRequestId;
}
@ -766,11 +766,11 @@ public class GeckoSmsManager
// TODO: should use the |selectionArgs| argument in |ContentResolver.query()|.
ArrayList<String> restrictions = new ArrayList<String>();
if (mStartDate != 0) {
if (mStartDate >= 0) {
restrictions.add("date >= " + mStartDate);
}
if (mEndDate != 0) {
if (mEndDate >= 0) {
restrictions.add("date <= " + mEndDate);
}
@ -785,11 +785,11 @@ public class GeckoSmsManager
restrictions.add(numberRestriction);
}
if (mDeliveryState == kDeliveryStateUnknown) {
if (mDelivery == null) {
restrictions.add("type IN ('" + kSmsTypeSentbox + "', '" + kSmsTypeInbox + "')");
} else if (mDeliveryState == kDeliveryStateSent) {
} else if (mDelivery == "sent") {
restrictions.add("type = " + kSmsTypeSentbox);
} else if (mDeliveryState == kDeliveryStateReceived) {
} else if (mDelivery == "received") {
restrictions.add("type = " + kSmsTypeInbox);
} else {
throw new UnexpectedDeliveryStateException();
@ -853,7 +853,7 @@ public class GeckoSmsManager
}
}
if (!SmsIOThread.getInstance().execute(new CreateMessageListRunnable(aStartDate, aEndDate, aNumbers, aNumbersCount, aDeliveryState, aReverse, aRequestId))) {
if (!SmsIOThread.getInstance().execute(new CreateMessageListRunnable(aStartDate, aEndDate, aNumbers, aNumbersCount, aDelivery, aHasRead, aRead, aThreadId, aReverse, aRequestId))) {
Log.e("GeckoSmsManager", "Failed to add CreateMessageListRunnable to the SmsIOThread");
notifyReadingMessageListFailed(kUnknownError, aRequestId);
}

View File

@ -28,7 +28,7 @@ interface ISmsManager
public void send(String aNumber, String aMessage, int aRequestId);
public void getMessage(int aMessageId, int aRequestId);
public void deleteMessage(int aMessageId, int aRequestId);
public void createMessageList(long aStartDate, long aEndDate, String[] aNumbers, int aNumbersCount, int aDeliveryState, boolean aReverse, int aRequestId);
public void createMessageList(long aStartDate, long aEndDate, String[] aNumbers, int aNumbersCount, String aDelivery, boolean aHasRead, boolean aRead, long aThreadId, boolean aReverse, int aRequestId);
public void getNextMessageInList(int aListId, int aRequestId);
public void clearMessageList(int aListId);
}

View File

@ -1161,9 +1161,14 @@ AndroidBridge::CreateMessageList(const dom::mobilemessage::SmsFilterData& aFilte
env->DeleteLocalRef(elem);
}
mozilla::widget::android::GeckoAppShell::CreateMessageListWrapper(aFilter.startDate(),
aFilter.endDate(), numbers, aFilter.numbers().Length(),
aFilter.delivery(), aReverse, requestId);
int64_t startDate = aFilter.hasStartDate() ? aFilter.startDate() : -1;
int64_t endDate = aFilter.hasEndDate() ? aFilter.endDate() : -1;
GeckoAppShell::CreateMessageListWrapper(startDate, endDate,
numbers, aFilter.numbers().Length(),
aFilter.delivery(),
aFilter.hasRead(), aFilter.read(),
aFilter.threadId(),
aReverse, requestId);
}
void

View File

@ -111,7 +111,7 @@ void GeckoAppShell::InitStubs(JNIEnv *jEnv) {
jCloseNotification = getStaticMethod("closeNotification", "(Ljava/lang/String;)V");
jConnectionGetMimeType = getStaticMethod("connectionGetMimeType", "(Ljava/net/URLConnection;)Ljava/lang/String;");
jCreateInputStream = getStaticMethod("createInputStream", "(Ljava/net/URLConnection;)Ljava/io/InputStream;");
jCreateMessageListWrapper = getStaticMethod("createMessageList", "(JJ[Ljava/lang/String;IIZI)V");
jCreateMessageListWrapper = getStaticMethod("createMessageList", "(JJ[Ljava/lang/String;ILjava/lang/String;ZZJZI)V");
jCreateShortcut = getStaticMethod("createShortcut", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V");
jDeleteMessageWrapper = getStaticMethod("deleteMessage", "(II)V");
jDisableBatteryNotifications = getStaticMethod("disableBatteryNotifications", "()V");
@ -335,21 +335,24 @@ jobject GeckoAppShell::CreateInputStream(jobject a0) {
return ret;
}
void GeckoAppShell::CreateMessageListWrapper(int64_t a0, int64_t a1, jobjectArray a2, int32_t a3, int32_t a4, bool a5, int32_t a6) {
void GeckoAppShell::CreateMessageListWrapper(int64_t a0, int64_t a1, jobjectArray a2, int32_t a3, const nsAString& a4, bool a5, bool a6, int64_t a7, bool a8, int32_t a9) {
JNIEnv *env = AndroidBridge::GetJNIEnv();
if (env->PushLocalFrame(1) != 0) {
if (env->PushLocalFrame(2) != 0) {
AndroidBridge::HandleUncaughtException(env);
MOZ_CRASH("Exception should have caused crash.");
}
jvalue args[7];
jvalue args[10];
args[0].j = a0;
args[1].j = a1;
args[2].l = a2;
args[3].i = a3;
args[4].i = a4;
args[4].l = AndroidBridge::NewJavaString(env, a4);
args[5].z = a5;
args[6].i = a6;
args[6].z = a6;
args[7].j = a7;
args[8].z = a8;
args[9].i = a9;
env->CallStaticVoidMethodA(mGeckoAppShellClass, jCreateMessageListWrapper, args);
AndroidBridge::HandleUncaughtException(env);

View File

@ -29,7 +29,7 @@ public:
static void CloseNotification(const nsAString& a0);
static jstring ConnectionGetMimeType(jobject a0);
static jobject CreateInputStream(jobject a0);
static void CreateMessageListWrapper(int64_t a0, int64_t a1, jobjectArray a2, int32_t a3, int32_t a4, bool a5, int32_t a6);
static void CreateMessageListWrapper(int64_t a0, int64_t a1, jobjectArray a2, int32_t a3, const nsAString& a4, bool a5, bool a6, int64_t a7, bool a8, int32_t a9);
static void CreateShortcut(const nsAString& a0, const nsAString& a1, const nsAString& a2);
static void DeleteMessageWrapper(int32_t a0, int32_t a1);
static void DisableBatteryNotifications();