Handle notifications and receiving push when locked.

This commit is contained in:
Moxie Marlinspike
2013-09-09 16:46:03 -07:00
parent 0dd36c64a4
commit 8f6590b738
9 changed files with 226 additions and 53 deletions

View File

@@ -71,6 +71,17 @@ public class IncomingPushMessage implements PushMessage, Parcelable {
this.timestamp = in.readLong();
}
public IncomingPushMessage(int type, String source,
List<String> destinations,
byte[] body, long timestamp)
{
this.type = type;
this.source = source;
this.destinations = destinations;
this.message = body;
this.timestamp = timestamp;
}
public long getTimestampMillis() {
return timestamp;
}

View File

@@ -13,6 +13,7 @@ import java.io.OutputStream;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
public class Util {
@@ -159,6 +160,22 @@ public class Util {
return result.toString();
}
public static List<String> split(String source, String delimiter) {
List<String> results = new LinkedList<String>();
if (isEmpty(source)) {
return results;
}
String[] elements = source.split(delimiter);
for (String element : elements) {
results.add(element);
}
return results;
}
public static SecureRandom getSecureRandom() {
try {
return SecureRandom.getInstance("SHA1PRNG");