Bug 742790 - Part 4/5: Android implementation, r=mounir,blassey
This commit is contained in:
@@ -92,15 +92,15 @@ public class GeckoAppShell
|
||||
public static native void notifySmsReceived(String aSender, String aBody, long aTimestamp);
|
||||
public static native int saveMessageInSentbox(String aReceiver, String aBody, long aTimestamp);
|
||||
public static native void notifySmsSent(int aId, String aReceiver, String aBody, long aTimestamp, int aRequestId, long aProcessId);
|
||||
public static native void notifySmsDelivered(int aId, String aReceiver, String aBody, long aTimestamp);
|
||||
public static native void notifySmsDelivery(int aId, int aDeliveryStatus, String aReceiver, String aBody, long aTimestamp);
|
||||
public static native void notifySmsSendFailed(int aError, int aRequestId, long aProcessId);
|
||||
public static native void notifyGetSms(int aId, String aReceiver, String aSender, String aBody, long aTimestamp, int aRequestId, long aProcessId);
|
||||
public static native void notifyGetSms(int aId, int aDeliveryStatus, String aReceiver, String aSender, String aBody, long aTimestamp, int aRequestId, long aProcessId);
|
||||
public static native void notifyGetSmsFailed(int aError, int aRequestId, long aProcessId);
|
||||
public static native void notifySmsDeleted(boolean aDeleted, int aRequestId, long aProcessId);
|
||||
public static native void notifySmsDeleteFailed(int aError, int aRequestId, long aProcessId);
|
||||
public static native void notifyNoMessageInList(int aRequestId, long aProcessId);
|
||||
public static native void notifyListCreated(int aListId, int aMessageId, String aReceiver, String aSender, String aBody, long aTimestamp, int aRequestId, long aProcessId);
|
||||
public static native void notifyGotNextMessage(int aMessageId, String aReceiver, String aSender, String aBody, long aTimestamp, int aRequestId, long aProcessId);
|
||||
public static native void notifyListCreated(int aListId, int aMessageId, int aDeliveryStatus, String aReceiver, String aSender, String aBody, long aTimestamp, int aRequestId, long aProcessId);
|
||||
public static native void notifyGotNextMessage(int aMessageId, int aDeliveryStatus, String aReceiver, String aSender, String aBody, long aTimestamp, int aRequestId, long aProcessId);
|
||||
public static native void notifyReadingMessageListFailed(int aError, int aRequestId, long aProcessId);
|
||||
public static native void onSurfaceTextureFrameAvailable(Object surfaceTexture, int id);
|
||||
|
||||
|
||||
@@ -314,7 +314,7 @@ public class GeckoSmsManager
|
||||
private final static int kSmsTypeSentbox = 2;
|
||||
|
||||
/*
|
||||
* Keep the following error codes in syng with |DeliveryState| in:
|
||||
* Keep the following state codes in syng with |DeliveryState| in:
|
||||
* dom/sms/src/Types.h
|
||||
*/
|
||||
private final static int kDeliveryStateSent = 0;
|
||||
@@ -322,7 +322,25 @@ public class GeckoSmsManager
|
||||
private final static int kDeliveryStateUnknown = 2;
|
||||
private final static int kDeliveryStateEndGuard = 3;
|
||||
|
||||
private final static String[] kRequiredMessageRows = new String[] { "_id", "address", "body", "date", "type" };
|
||||
/*
|
||||
* Keep the following status codes in sync with |DeliveryStatus| in:
|
||||
* dom/sms/src/Types.h
|
||||
*/
|
||||
private final static int kDeliveryStatusNotApplicable = 0;
|
||||
private final static int kDeliveryStatusSuccess = 1;
|
||||
private final static int kDeliveryStatusPending = 2;
|
||||
private final static int kDeliveryStatusError = 3;
|
||||
|
||||
/*
|
||||
* android.provider.Telephony.Sms.STATUS_*. Duplicated because they're not
|
||||
* part of Android public API.
|
||||
*/
|
||||
private final static int kInternalDeliveryStatusNone = -1;
|
||||
private final static int kInternalDeliveryStatusComplete = 0;
|
||||
private final static int kInternalDeliveryStatusPending = 32;
|
||||
private final static int kInternalDeliveryStatusFailed = 64;
|
||||
|
||||
private final static String[] kRequiredMessageRows = new String[] { "_id", "address", "body", "date", "type", "status" };
|
||||
|
||||
public GeckoSmsManager() {
|
||||
SmsIOThread.getInstance().start();
|
||||
@@ -420,9 +438,12 @@ public class GeckoSmsManager
|
||||
bundle.getLong("processId"));
|
||||
Log.i("GeckoSmsManager", "SMS sending failed!");
|
||||
} else {
|
||||
// It seems unlikely to get a result code for a failure to deliver.
|
||||
// Even if, we don't want to do anything with this.
|
||||
Log.e("GeckoSmsManager", "SMS failed to be delivered... is that even possible?");
|
||||
GeckoAppShell.notifySmsDelivery(envelope.getMessageId(),
|
||||
kDeliveryStatusError,
|
||||
bundle.getString("number"),
|
||||
bundle.getString("message"),
|
||||
envelope.getMessageTimestamp());
|
||||
Log.i("GeckoSmsManager", "SMS delivery failed!");
|
||||
}
|
||||
} else {
|
||||
if (part == Envelope.SubParts.SENT_PART) {
|
||||
@@ -441,10 +462,11 @@ public class GeckoSmsManager
|
||||
|
||||
Log.i("GeckoSmsManager", "SMS sending was successfull!");
|
||||
} else {
|
||||
GeckoAppShell.notifySmsDelivered(envelope.getMessageId(),
|
||||
bundle.getString("number"),
|
||||
bundle.getString("message"),
|
||||
envelope.getMessageTimestamp());
|
||||
GeckoAppShell.notifySmsDelivery(envelope.getMessageId(),
|
||||
kDeliveryStatusSuccess,
|
||||
bundle.getString("number"),
|
||||
bundle.getString("message"),
|
||||
envelope.getMessageTimestamp());
|
||||
Log.i("GeckoSmsManager", "SMS succesfully delivered!");
|
||||
}
|
||||
}
|
||||
@@ -555,6 +577,8 @@ public class GeckoSmsManager
|
||||
values.put("address", aRecipient);
|
||||
values.put("body", aBody);
|
||||
values.put("date", aDate);
|
||||
// Always 'PENDING' because we always request status report.
|
||||
values.put("status", kInternalDeliveryStatusPending);
|
||||
|
||||
ContentResolver cr = GeckoApp.mAppContext.getContentResolver();
|
||||
Uri uri = cr.insert(kSmsSentContentUri, values);
|
||||
@@ -613,18 +637,22 @@ public class GeckoSmsManager
|
||||
}
|
||||
|
||||
int type = cursor.getInt(cursor.getColumnIndex("type"));
|
||||
int deliveryStatus;
|
||||
String sender = "";
|
||||
String receiver = "";
|
||||
|
||||
if (type == kSmsTypeInbox) {
|
||||
deliveryStatus = kDeliveryStatusSuccess;
|
||||
sender = cursor.getString(cursor.getColumnIndex("address"));
|
||||
} else if (type == kSmsTypeSentbox) {
|
||||
deliveryStatus = getGeckoDeliveryStatus(cursor.getInt(cursor.getColumnIndex("status")));
|
||||
receiver = cursor.getString(cursor.getColumnIndex("address"));
|
||||
} else {
|
||||
throw new InvalidTypeException();
|
||||
}
|
||||
|
||||
GeckoAppShell.notifyGetSms(cursor.getInt(cursor.getColumnIndex("_id")),
|
||||
deliveryStatus,
|
||||
receiver, sender,
|
||||
cursor.getString(cursor.getColumnIndex("body")),
|
||||
cursor.getLong(cursor.getColumnIndex("date")),
|
||||
@@ -778,12 +806,15 @@ public class GeckoSmsManager
|
||||
cursor.moveToFirst();
|
||||
|
||||
int type = cursor.getInt(cursor.getColumnIndex("type"));
|
||||
int deliveryStatus;
|
||||
String sender = "";
|
||||
String receiver = "";
|
||||
|
||||
if (type == kSmsTypeInbox) {
|
||||
deliveryStatus = kDeliveryStatusSuccess;
|
||||
sender = cursor.getString(cursor.getColumnIndex("address"));
|
||||
} else if (type == kSmsTypeSentbox) {
|
||||
deliveryStatus = getGeckoDeliveryStatus(cursor.getInt(cursor.getColumnIndex("status")));
|
||||
receiver = cursor.getString(cursor.getColumnIndex("address"));
|
||||
} else {
|
||||
throw new UnexpectedDeliveryStateException();
|
||||
@@ -793,6 +824,7 @@ public class GeckoSmsManager
|
||||
closeCursor = false;
|
||||
GeckoAppShell.notifyListCreated(listId,
|
||||
cursor.getInt(cursor.getColumnIndex("_id")),
|
||||
deliveryStatus,
|
||||
receiver, sender,
|
||||
cursor.getString(cursor.getColumnIndex("body")),
|
||||
cursor.getLong(cursor.getColumnIndex("date")),
|
||||
@@ -844,12 +876,15 @@ public class GeckoSmsManager
|
||||
}
|
||||
|
||||
int type = cursor.getInt(cursor.getColumnIndex("type"));
|
||||
int deliveryStatus;
|
||||
String sender = "";
|
||||
String receiver = "";
|
||||
|
||||
if (type == kSmsTypeInbox) {
|
||||
deliveryStatus = kDeliveryStatusSuccess;
|
||||
sender = cursor.getString(cursor.getColumnIndex("address"));
|
||||
} else if (type == kSmsTypeSentbox) {
|
||||
deliveryStatus = getGeckoDeliveryStatus(cursor.getInt(cursor.getColumnIndex("status")));
|
||||
receiver = cursor.getString(cursor.getColumnIndex("address"));
|
||||
} else {
|
||||
throw new UnexpectedDeliveryStateException();
|
||||
@@ -857,6 +892,7 @@ public class GeckoSmsManager
|
||||
|
||||
int listId = MessagesListManager.getInstance().add(cursor);
|
||||
GeckoAppShell.notifyGotNextMessage(cursor.getInt(cursor.getColumnIndex("_id")),
|
||||
deliveryStatus,
|
||||
receiver, sender,
|
||||
cursor.getString(cursor.getColumnIndex("body")),
|
||||
cursor.getLong(cursor.getColumnIndex("date")),
|
||||
@@ -890,6 +926,19 @@ public class GeckoSmsManager
|
||||
MessagesListManager.getInstance().clear();
|
||||
}
|
||||
|
||||
private int getGeckoDeliveryStatus(int aDeliveryStatus) {
|
||||
if (aDeliveryStatus == kInternalDeliveryStatusNone) {
|
||||
return kDeliveryStatusNotApplicable;
|
||||
}
|
||||
if (aDeliveryStatus >= kInternalDeliveryStatusFailed) {
|
||||
return kDeliveryStatusError;
|
||||
}
|
||||
if (aDeliveryStatus >= kInternalDeliveryStatusPending) {
|
||||
return kDeliveryStatusPending;
|
||||
}
|
||||
return kDeliveryStatusSuccess;
|
||||
}
|
||||
|
||||
class IdTooHighException extends Exception {
|
||||
private static final long serialVersionUID = 395697882128640L;
|
||||
}
|
||||
|
||||
@@ -234,15 +234,15 @@ public class GeckoAppShell
|
||||
public static native void notifySmsReceived(String aSender, String aBody, long aTimestamp);
|
||||
public static native int saveMessageInSentbox(String aReceiver, String aBody, long aTimestamp);
|
||||
public static native void notifySmsSent(int aId, String aReceiver, String aBody, long aTimestamp, int aRequestId, long aProcessId);
|
||||
public static native void notifySmsDelivered(int aId, String aReceiver, String aBody, long aTimestamp);
|
||||
public static native void notifySmsDelivery(int aId, int aDeliveryStatus, String aReceiver, String aBody, long aTimestamp);
|
||||
public static native void notifySmsSendFailed(int aError, int aRequestId, long aProcessId);
|
||||
public static native void notifyGetSms(int aId, String aReceiver, String aSender, String aBody, long aTimestamp, int aRequestId, long aProcessId);
|
||||
public static native void notifyGetSms(int aId, int aDeliveryStatus, String aReceiver, String aSender, String aBody, long aTimestamp, int aRequestId, long aProcessId);
|
||||
public static native void notifyGetSmsFailed(int aError, int aRequestId, long aProcessId);
|
||||
public static native void notifySmsDeleted(boolean aDeleted, int aRequestId, long aProcessId);
|
||||
public static native void notifySmsDeleteFailed(int aError, int aRequestId, long aProcessId);
|
||||
public static native void notifyNoMessageInList(int aRequestId, long aProcessId);
|
||||
public static native void notifyListCreated(int aListId, int aMessageId, String aReceiver, String aSender, String aBody, long aTimestamp, int aRequestId, long aProcessId);
|
||||
public static native void notifyGotNextMessage(int aMessageId, String aReceiver, String aSender, String aBody, long aTimestamp, int aRequestId, long aProcessId);
|
||||
public static native void notifyListCreated(int aListId, int aMessageId, int aDeliveryStatus, String aReceiver, String aSender, String aBody, long aTimestamp, int aRequestId, long aProcessId);
|
||||
public static native void notifyGotNextMessage(int aMessageId, int aDeliveryStatus, String aReceiver, String aSender, String aBody, long aTimestamp, int aRequestId, long aProcessId);
|
||||
public static native void notifyReadingMessageListFailed(int aError, int aRequestId, long aProcessId);
|
||||
|
||||
public static native void scheduleComposite();
|
||||
|
||||
@@ -307,7 +307,7 @@ public class GeckoSmsManager
|
||||
private final static int kSmsTypeSentbox = 2;
|
||||
|
||||
/*
|
||||
* Keep the following error codes in syng with |DeliveryState| in:
|
||||
* Keep the following state codes in syng with |DeliveryState| in:
|
||||
* dom/sms/src/Types.h
|
||||
*/
|
||||
private final static int kDeliveryStateSent = 0;
|
||||
@@ -315,7 +315,25 @@ public class GeckoSmsManager
|
||||
private final static int kDeliveryStateUnknown = 2;
|
||||
private final static int kDeliveryStateEndGuard = 3;
|
||||
|
||||
private final static String[] kRequiredMessageRows = new String[] { "_id", "address", "body", "date", "type" };
|
||||
/*
|
||||
* Keep the following status codes in sync with |DeliveryStatus| in:
|
||||
* dom/sms/src/Types.h
|
||||
*/
|
||||
private final static int kDeliveryStatusNotApplicable = 0;
|
||||
private final static int kDeliveryStatusSuccess = 1;
|
||||
private final static int kDeliveryStatusPending = 2;
|
||||
private final static int kDeliveryStatusError = 3;
|
||||
|
||||
/*
|
||||
* android.provider.Telephony.Sms.STATUS_*. Duplicated because they're not
|
||||
* part of Android public API.
|
||||
*/
|
||||
private final static int kInternalDeliveryStatusNone = -1;
|
||||
private final static int kInternalDeliveryStatusComplete = 0;
|
||||
private final static int kInternalDeliveryStatusPending = 32;
|
||||
private final static int kInternalDeliveryStatusFailed = 64;
|
||||
|
||||
private final static String[] kRequiredMessageRows = new String[] { "_id", "address", "body", "date", "type", "status" };
|
||||
|
||||
public GeckoSmsManager() {
|
||||
SmsIOThread.getInstance().start();
|
||||
@@ -413,9 +431,12 @@ public class GeckoSmsManager
|
||||
bundle.getLong("processId"));
|
||||
Log.i("GeckoSmsManager", "SMS sending failed!");
|
||||
} else {
|
||||
// It seems unlikely to get a result code for a failure to deliver.
|
||||
// Even if, we don't want to do anything with this.
|
||||
Log.e("GeckoSmsManager", "SMS failed to be delivered... is that even possible?");
|
||||
GeckoAppShell.notifySmsDelivery(envelope.getMessageId(),
|
||||
kDeliveryStatusError,
|
||||
bundle.getString("number"),
|
||||
bundle.getString("message"),
|
||||
envelope.getMessageTimestamp());
|
||||
Log.i("GeckoSmsManager", "SMS delivery failed!");
|
||||
}
|
||||
} else {
|
||||
if (part == Envelope.SubParts.SENT_PART) {
|
||||
@@ -434,10 +455,11 @@ public class GeckoSmsManager
|
||||
|
||||
Log.i("GeckoSmsManager", "SMS sending was successfull!");
|
||||
} else {
|
||||
GeckoAppShell.notifySmsDelivered(envelope.getMessageId(),
|
||||
bundle.getString("number"),
|
||||
bundle.getString("message"),
|
||||
envelope.getMessageTimestamp());
|
||||
GeckoAppShell.notifySmsDelivery(envelope.getMessageId(),
|
||||
kDeliveryStatusSuccess,
|
||||
bundle.getString("number"),
|
||||
bundle.getString("message"),
|
||||
envelope.getMessageTimestamp());
|
||||
Log.i("GeckoSmsManager", "SMS successfully delivered!");
|
||||
}
|
||||
}
|
||||
@@ -548,6 +570,8 @@ public class GeckoSmsManager
|
||||
values.put("address", aRecipient);
|
||||
values.put("body", aBody);
|
||||
values.put("date", aDate);
|
||||
// Always 'PENDING' because we always request status report.
|
||||
values.put("status", kInternalDeliveryStatusPending);
|
||||
|
||||
ContentResolver cr = GeckoApp.mAppContext.getContentResolver();
|
||||
Uri uri = cr.insert(kSmsSentContentUri, values);
|
||||
@@ -606,18 +630,22 @@ public class GeckoSmsManager
|
||||
}
|
||||
|
||||
int type = cursor.getInt(cursor.getColumnIndex("type"));
|
||||
int deliveryStatus;
|
||||
String sender = "";
|
||||
String receiver = "";
|
||||
|
||||
if (type == kSmsTypeInbox) {
|
||||
deliveryStatus = kDeliveryStatusSuccess;
|
||||
sender = cursor.getString(cursor.getColumnIndex("address"));
|
||||
} else if (type == kSmsTypeSentbox) {
|
||||
deliveryStatus = getGeckoDeliveryStatus(cursor.getInt(cursor.getColumnIndex("status")));
|
||||
receiver = cursor.getString(cursor.getColumnIndex("address"));
|
||||
} else {
|
||||
throw new InvalidTypeException();
|
||||
}
|
||||
|
||||
GeckoAppShell.notifyGetSms(cursor.getInt(cursor.getColumnIndex("_id")),
|
||||
deliveryStatus,
|
||||
receiver, sender,
|
||||
cursor.getString(cursor.getColumnIndex("body")),
|
||||
cursor.getLong(cursor.getColumnIndex("date")),
|
||||
@@ -771,12 +799,15 @@ public class GeckoSmsManager
|
||||
cursor.moveToFirst();
|
||||
|
||||
int type = cursor.getInt(cursor.getColumnIndex("type"));
|
||||
int deliveryStatus;
|
||||
String sender = "";
|
||||
String receiver = "";
|
||||
|
||||
if (type == kSmsTypeInbox) {
|
||||
deliveryStatus = kDeliveryStatusSuccess;
|
||||
sender = cursor.getString(cursor.getColumnIndex("address"));
|
||||
} else if (type == kSmsTypeSentbox) {
|
||||
deliveryStatus = getGeckoDeliveryStatus(cursor.getInt(cursor.getColumnIndex("status")));
|
||||
receiver = cursor.getString(cursor.getColumnIndex("address"));
|
||||
} else {
|
||||
throw new UnexpectedDeliveryStateException();
|
||||
@@ -786,6 +817,7 @@ public class GeckoSmsManager
|
||||
closeCursor = false;
|
||||
GeckoAppShell.notifyListCreated(listId,
|
||||
cursor.getInt(cursor.getColumnIndex("_id")),
|
||||
deliveryStatus,
|
||||
receiver, sender,
|
||||
cursor.getString(cursor.getColumnIndex("body")),
|
||||
cursor.getLong(cursor.getColumnIndex("date")),
|
||||
@@ -837,12 +869,15 @@ public class GeckoSmsManager
|
||||
}
|
||||
|
||||
int type = cursor.getInt(cursor.getColumnIndex("type"));
|
||||
int deliveryStatus;
|
||||
String sender = "";
|
||||
String receiver = "";
|
||||
|
||||
if (type == kSmsTypeInbox) {
|
||||
deliveryStatus = kDeliveryStatusSuccess;
|
||||
sender = cursor.getString(cursor.getColumnIndex("address"));
|
||||
} else if (type == kSmsTypeSentbox) {
|
||||
deliveryStatus = getGeckoDeliveryStatus(cursor.getInt(cursor.getColumnIndex("status")));
|
||||
receiver = cursor.getString(cursor.getColumnIndex("address"));
|
||||
} else {
|
||||
throw new UnexpectedDeliveryStateException();
|
||||
@@ -850,6 +885,7 @@ public class GeckoSmsManager
|
||||
|
||||
int listId = MessagesListManager.getInstance().add(cursor);
|
||||
GeckoAppShell.notifyGotNextMessage(cursor.getInt(cursor.getColumnIndex("_id")),
|
||||
deliveryStatus,
|
||||
receiver, sender,
|
||||
cursor.getString(cursor.getColumnIndex("body")),
|
||||
cursor.getLong(cursor.getColumnIndex("date")),
|
||||
@@ -883,6 +919,19 @@ public class GeckoSmsManager
|
||||
MessagesListManager.getInstance().clear();
|
||||
}
|
||||
|
||||
private int getGeckoDeliveryStatus(int aDeliveryStatus) {
|
||||
if (aDeliveryStatus == kInternalDeliveryStatusNone) {
|
||||
return kDeliveryStatusNotApplicable;
|
||||
}
|
||||
if (aDeliveryStatus >= kInternalDeliveryStatusFailed) {
|
||||
return kDeliveryStatusError;
|
||||
}
|
||||
if (aDeliveryStatus >= kInternalDeliveryStatusPending) {
|
||||
return kDeliveryStatusPending;
|
||||
}
|
||||
return kDeliveryStatusSuccess;
|
||||
}
|
||||
|
||||
class IdTooHighException extends Exception {
|
||||
private static final long serialVersionUID = 29935575131092050L;
|
||||
}
|
||||
|
||||
@@ -288,6 +288,24 @@ Java_org_mozilla_gecko_GeckoAppShell_ ## name(JNIEnv *jenv, jclass jc, type1 one
|
||||
return f_ ## name(jenv, jc, one, two, three, four, five, six, seven, eight); \
|
||||
}
|
||||
|
||||
#define SHELL_WRAPPER9_WITH_RETURN(name, return_type, type1, type2, type3, type4, type5, type6, type7, type8, type9) \
|
||||
typedef return_type (*name ## _t)(JNIEnv *, jclass, type1 one, type2 two, type3 three, type4 four, type5 five, type6 six, type7 seven, type8 eight, type9 nine); \
|
||||
static name ## _t f_ ## name; \
|
||||
extern "C" NS_EXPORT return_type JNICALL \
|
||||
Java_org_mozilla_gecko_GeckoAppShell_ ## name(JNIEnv *jenv, jclass jc, type1 one, type2 two, type3 three, type4 four, type5 five, type6 six, type7 seven, type8 eight, type9 nine) \
|
||||
{ \
|
||||
return f_ ## name(jenv, jc, one, two, three, four, five, six, seven, eight, nine); \
|
||||
}
|
||||
|
||||
#define SHELL_WRAPPER9(name,type1,type2,type3,type4,type5,type6,type7,type8, type9) \
|
||||
typedef void (*name ## _t)(JNIEnv *, jclass, type1 one, type2 two, type3 three, type4 four, type5 five, type6 six, type7 seven, type8 eight, type9 nine); \
|
||||
static name ## _t f_ ## name; \
|
||||
extern "C" NS_EXPORT void JNICALL \
|
||||
Java_org_mozilla_gecko_GeckoAppShell_ ## name(JNIEnv *jenv, jclass jc, type1 one, type2 two, type3 three, type4 four, type5 five, type6 six, type7 seven, type8 eight, type9 nine) \
|
||||
{ \
|
||||
f_ ## name(jenv, jc, one, two, three, four, five, six, seven, eight, nine); \
|
||||
}
|
||||
|
||||
SHELL_WRAPPER0(nativeInit)
|
||||
SHELL_WRAPPER1(notifyGeckoOfEvent, jobject)
|
||||
SHELL_WRAPPER0(processNextNativeEvent)
|
||||
@@ -309,15 +327,15 @@ SHELL_WRAPPER2(scheduleResumeComposition, jint, jint)
|
||||
SHELL_WRAPPER0_WITH_RETURN(computeRenderIntegrity, jfloat)
|
||||
SHELL_WRAPPER3_WITH_RETURN(saveMessageInSentbox, jint, jstring, jstring, jlong)
|
||||
SHELL_WRAPPER6(notifySmsSent, jint, jstring, jstring, jlong, jint, jlong)
|
||||
SHELL_WRAPPER4(notifySmsDelivered, jint, jstring, jstring, jlong)
|
||||
SHELL_WRAPPER5(notifySmsDelivery, jint, jint, jstring, jstring, jlong)
|
||||
SHELL_WRAPPER3(notifySmsSendFailed, jint, jint, jlong)
|
||||
SHELL_WRAPPER7(notifyGetSms, jint, jstring, jstring, jstring, jlong, jint, jlong)
|
||||
SHELL_WRAPPER8(notifyGetSms, jint, jint, jstring, jstring, jstring, jlong, jint, jlong)
|
||||
SHELL_WRAPPER3(notifyGetSmsFailed, jint, jint, jlong)
|
||||
SHELL_WRAPPER3(notifySmsDeleted, jboolean, jint, jlong)
|
||||
SHELL_WRAPPER3(notifySmsDeleteFailed, jint, jint, jlong)
|
||||
SHELL_WRAPPER2(notifyNoMessageInList, jint, jlong)
|
||||
SHELL_WRAPPER8(notifyListCreated, jint, jint, jstring, jstring, jstring, jlong, jint, jlong)
|
||||
SHELL_WRAPPER7(notifyGotNextMessage, jint, jstring, jstring, jstring, jlong, jint, jlong)
|
||||
SHELL_WRAPPER9(notifyListCreated, jint, jint, jint, jstring, jstring, jstring, jlong, jint, jlong)
|
||||
SHELL_WRAPPER8(notifyGotNextMessage, jint, jint, jstring, jstring, jstring, jlong, jint, jlong)
|
||||
SHELL_WRAPPER3(notifyReadingMessageListFailed, jint, jint, jlong)
|
||||
SHELL_WRAPPER2(notifyFilePickerResult, jstring, jlong)
|
||||
SHELL_WRAPPER1_WITH_RETURN(getSurfaceBits, jobject, jobject)
|
||||
@@ -733,7 +751,7 @@ loadGeckoLibs(const char *apkName)
|
||||
GETFUNC(computeRenderIntegrity);
|
||||
GETFUNC(saveMessageInSentbox);
|
||||
GETFUNC(notifySmsSent);
|
||||
GETFUNC(notifySmsDelivered);
|
||||
GETFUNC(notifySmsDelivery);
|
||||
GETFUNC(notifySmsSendFailed);
|
||||
GETFUNC(notifyGetSms);
|
||||
GETFUNC(notifyGetSmsFailed);
|
||||
|
||||
@@ -209,7 +209,8 @@ Java_org_mozilla_gecko_GeckoAppShell_notifySmsReceived(JNIEnv* jenv, jclass,
|
||||
SmsMessageData mMessageData;
|
||||
};
|
||||
|
||||
SmsMessageData message(0, eDeliveryState_Received, nsJNIString(aSender, jenv), EmptyString(),
|
||||
SmsMessageData message(0, eDeliveryState_Received, eDeliveryStatus_Success,
|
||||
nsJNIString(aSender, jenv), EmptyString(),
|
||||
nsJNIString(aBody, jenv), aTimestamp, false);
|
||||
|
||||
nsCOMPtr<nsIRunnable> runnable = new NotifySmsReceivedRunnable(message);
|
||||
@@ -294,8 +295,8 @@ Java_org_mozilla_gecko_GeckoAppShell_notifySmsSent(JNIEnv* jenv, jclass,
|
||||
uint64_t mProcessId;
|
||||
};
|
||||
|
||||
SmsMessageData message(aId, eDeliveryState_Sent, EmptyString(),
|
||||
nsJNIString(aReceiver, jenv),
|
||||
SmsMessageData message(aId, eDeliveryState_Sent, eDeliveryStatus_Pending,
|
||||
EmptyString(), nsJNIString(aReceiver, jenv),
|
||||
nsJNIString(aBody, jenv), aTimestamp, true);
|
||||
|
||||
nsCOMPtr<nsIRunnable> runnable = new NotifySmsSentRunnable(message, aRequestId, aProcessId);
|
||||
@@ -303,11 +304,12 @@ Java_org_mozilla_gecko_GeckoAppShell_notifySmsSent(JNIEnv* jenv, jclass,
|
||||
}
|
||||
|
||||
NS_EXPORT void JNICALL
|
||||
Java_org_mozilla_gecko_GeckoAppShell_notifySmsDelivered(JNIEnv* jenv, jclass,
|
||||
jint aId,
|
||||
jstring aReceiver,
|
||||
jstring aBody,
|
||||
jlong aTimestamp)
|
||||
Java_org_mozilla_gecko_GeckoAppShell_notifySmsDelivery(JNIEnv* jenv, jclass,
|
||||
jint aId,
|
||||
jint aDeliveryStatus,
|
||||
jstring aReceiver,
|
||||
jstring aBody,
|
||||
jlong aTimestamp)
|
||||
{
|
||||
class NotifySmsDeliveredRunnable : public nsRunnable {
|
||||
public:
|
||||
@@ -322,7 +324,10 @@ Java_org_mozilla_gecko_GeckoAppShell_notifySmsDelivered(JNIEnv* jenv, jclass,
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMMozSmsMessage> message = new SmsMessage(mMessageData);
|
||||
obs->NotifyObservers(message, kSmsDeliveredObserverTopic, nullptr);
|
||||
const char* topic = (mMessageData.deliveryStatus() == eDeliveryStatus_Success)
|
||||
? kSmsDeliverySuccessObserverTopic
|
||||
: kSmsDeliveryErrorObserverTopic;
|
||||
obs->NotifyObservers(message, topic, nullptr);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -331,8 +336,9 @@ Java_org_mozilla_gecko_GeckoAppShell_notifySmsDelivered(JNIEnv* jenv, jclass,
|
||||
SmsMessageData mMessageData;
|
||||
};
|
||||
|
||||
SmsMessageData message(aId, eDeliveryState_Sent, EmptyString(),
|
||||
nsJNIString(aReceiver, jenv),
|
||||
SmsMessageData message(aId, eDeliveryState_Sent,
|
||||
static_cast<DeliveryStatus>(aDeliveryStatus),
|
||||
EmptyString(), nsJNIString(aReceiver, jenv),
|
||||
nsJNIString(aBody, jenv), aTimestamp, true);
|
||||
|
||||
nsCOMPtr<nsIRunnable> runnable = new NotifySmsDeliveredRunnable(message);
|
||||
@@ -391,6 +397,7 @@ Java_org_mozilla_gecko_GeckoAppShell_notifySmsSendFailed(JNIEnv* jenv, jclass,
|
||||
NS_EXPORT void JNICALL
|
||||
Java_org_mozilla_gecko_GeckoAppShell_notifyGetSms(JNIEnv* jenv, jclass,
|
||||
jint aId,
|
||||
jint aDeliveryStatus,
|
||||
jstring aReceiver,
|
||||
jstring aSender,
|
||||
jstring aBody,
|
||||
@@ -440,7 +447,9 @@ Java_org_mozilla_gecko_GeckoAppShell_notifyGetSms(JNIEnv* jenv, jclass,
|
||||
: eDeliveryState_Sent;
|
||||
|
||||
// TODO Need to add the message `read` parameter value. Bug 748391
|
||||
SmsMessageData message(aId, state, nsJNIString(aSender, jenv), receiver,
|
||||
SmsMessageData message(aId, state,
|
||||
static_cast<DeliveryStatus>(aDeliveryStatus),
|
||||
nsJNIString(aSender, jenv), receiver,
|
||||
nsJNIString(aBody, jenv), aTimestamp, true);
|
||||
|
||||
nsCOMPtr<nsIRunnable> runnable = new NotifyGetSmsRunnable(message, aRequestId, aProcessId);
|
||||
@@ -640,6 +649,7 @@ NS_EXPORT void JNICALL
|
||||
Java_org_mozilla_gecko_GeckoAppShell_notifyListCreated(JNIEnv* jenv, jclass,
|
||||
jint aListId,
|
||||
jint aMessageId,
|
||||
jint aDeliveryStatus,
|
||||
jstring aReceiver,
|
||||
jstring aSender,
|
||||
jstring aBody,
|
||||
@@ -696,8 +706,10 @@ Java_org_mozilla_gecko_GeckoAppShell_notifyListCreated(JNIEnv* jenv, jclass,
|
||||
: eDeliveryState_Sent;
|
||||
|
||||
// TODO Need to add the message `read` parameter value. Bug 748391
|
||||
SmsMessageData message(aMessageId, state, nsJNIString(aSender, jenv),
|
||||
receiver, nsJNIString(aBody, jenv), aTimestamp, true);
|
||||
SmsMessageData message(aMessageId, state,
|
||||
static_cast<DeliveryStatus>(aDeliveryStatus),
|
||||
nsJNIString(aSender, jenv), receiver,
|
||||
nsJNIString(aBody, jenv), aTimestamp, true);
|
||||
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
new NotifyCreateMessageListRunnable(aListId, message, aRequestId, aProcessId);
|
||||
@@ -707,6 +719,7 @@ Java_org_mozilla_gecko_GeckoAppShell_notifyListCreated(JNIEnv* jenv, jclass,
|
||||
NS_EXPORT void JNICALL
|
||||
Java_org_mozilla_gecko_GeckoAppShell_notifyGotNextMessage(JNIEnv* jenv, jclass,
|
||||
jint aMessageId,
|
||||
jint aDeliveryStatus,
|
||||
jstring aReceiver,
|
||||
jstring aSender,
|
||||
jstring aBody,
|
||||
@@ -757,8 +770,10 @@ Java_org_mozilla_gecko_GeckoAppShell_notifyGotNextMessage(JNIEnv* jenv, jclass,
|
||||
: eDeliveryState_Sent;
|
||||
|
||||
// TODO Need to add the message `read` parameter value. Bug 748391
|
||||
SmsMessageData message(aMessageId, state, nsJNIString(aSender, jenv),
|
||||
receiver, nsJNIString(aBody, jenv), aTimestamp, true);
|
||||
SmsMessageData message(aMessageId, state,
|
||||
static_cast<DeliveryStatus>(aDeliveryStatus),
|
||||
nsJNIString(aSender, jenv), receiver,
|
||||
nsJNIString(aBody, jenv), aTimestamp, true);
|
||||
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
new NotifyGotNextMessageRunnable(message, aRequestId, aProcessId);
|
||||
|
||||
Reference in New Issue
Block a user