-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
更新可以在kaios运行的版本
- Loading branch information
Showing
12 changed files
with
463 additions
and
15 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
DumbPipe.registerOpener("echo", function(message, sender) { | ||
sender(message); | ||
}); | ||
|
||
// Generate faked location data for tests | ||
LocationProvider.AVAILABLE = 1; | ||
DumbPipe.registerOpener("locationprovider", function(message, sender) { | ||
return function(message) { | ||
switch (message.type) { | ||
case "requestData": | ||
sender({ | ||
type: "data", | ||
position: { | ||
timestamp: Date.now(), | ||
latitude: 45, | ||
longitude: -122, | ||
altitude: 500, | ||
horizontalAccuracy: 200, | ||
verticalAccuracy: 10, | ||
speed: 90, | ||
course: 2 | ||
}, | ||
state: LocationProvider.AVAILABLE | ||
}); | ||
break; | ||
} | ||
}; | ||
}); | ||
|
||
var backgroundChecks = 0; | ||
|
||
DumbPipe.registerOpener("backgroundCheck", function() { | ||
backgroundChecks++; | ||
}); | ||
|
||
DumbPipe.registerOpener("getBackgroundChecks", function(message, sender) { | ||
sender(backgroundChecks); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | ||
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */ | ||
|
||
var lastSMSNumber = null; | ||
var lastSMSBody = null; | ||
var lastAddContactParams = null; | ||
|
||
DumbPipe.registerOpener("lastSMSNumber", function(message, sender) { | ||
sender(lastSMSNumber); | ||
}); | ||
|
||
DumbPipe.registerOpener("lastSMSBody", function(message, sender) { | ||
sender(lastSMSBody); | ||
}); | ||
|
||
DumbPipe.registerOpener("lastAddContactParams", function(message, sender) { | ||
sender(lastAddContactParams); | ||
}); | ||
|
||
function MozActivity(obj) { | ||
if (obj.name === "new") { | ||
switch (obj.data.type) { | ||
case "websms/sms": | ||
lastSMSNumber = obj.data.number; | ||
lastSMSBody = obj.data.body; | ||
break; | ||
|
||
case "webcontacts/contact": | ||
lastAddContactParams = obj.data.params; | ||
|
||
break; | ||
|
||
default: | ||
throw new Error("MozActivity with type " + obj.data.type + " not supported"); | ||
} | ||
|
||
nextTickBeforeEvents((function() { | ||
this.onsuccess(); | ||
}).bind(this)); | ||
|
||
} else { | ||
throw new Error("MozActivity " + obj.name + " not supported"); | ||
} | ||
} | ||
|
||
var messageHandlers = {}; | ||
navigator.mozSetMessageHandler = function(name, func) { | ||
messageHandlers[name] = func; | ||
} | ||
|
||
DumbPipe.registerOpener("callShareActivityMessageHandler", function(message, sender) { | ||
var activity = { | ||
source: { | ||
name: "share", | ||
data: { | ||
"type": "image/*", | ||
"number": 1, | ||
"blobs": [ new Blob([]) ], | ||
"filenames": ["j2mesharetestimage" + message.num + ".jpg"], | ||
"filepaths": ["/sdcard/DCIM/100MZLLA/j2mesharetestimage" + message.num + ".jpg"] | ||
}, | ||
}, | ||
}; | ||
messageHandlers["activity"](activity); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | ||
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */ | ||
|
||
Native["javax/wireless/messaging/SendSMSTest.getNumber.()Ljava/lang/String;"] = function(addr) { | ||
asyncImpl("Ljava/lang/String;", new Promise(function(resolve, reject) { | ||
var sender = DumbPipe.open("lastSMSNumber", {}, function(lastSMSNumber) { | ||
DumbPipe.close(sender); | ||
resolve(J2ME.newString(lastSMSNumber)); | ||
}); | ||
})); | ||
}; | ||
|
||
Native["javax/wireless/messaging/SendSMSTest.getBody.()Ljava/lang/String;"] = function(addr) { | ||
asyncImpl("Ljava/lang/String;", new Promise(function(resolve, reject) { | ||
var sender = DumbPipe.open("lastSMSBody", {}, function(lastSMSBody) { | ||
DumbPipe.close(sender); | ||
resolve(J2ME.newString(lastSMSBody)); | ||
}); | ||
})); | ||
}; | ||
|
||
Native["com/sun/midp/midlet/AddContactTest.getNumber.()Ljava/lang/String;"] = function(addr) { | ||
asyncImpl("Ljava/lang/String;", new Promise(function(resolve, reject) { | ||
var sender = DumbPipe.open("lastAddContactParams", {}, function(lastAddContactParams) { | ||
DumbPipe.close(sender); | ||
resolve(J2ME.newString(lastAddContactParams.tel)); | ||
}); | ||
})); | ||
}; | ||
|
||
Native["com/sun/midp/midlet/AddContactTest.hasNumber.()Z"] = function(addr) { | ||
asyncImpl("Z", new Promise(function(resolve, reject) { | ||
var sender = DumbPipe.open("lastAddContactParams", {}, function(lastAddContactParams) { | ||
DumbPipe.close(sender); | ||
resolve(lastAddContactParams.tel ? 1 : 0); | ||
}); | ||
})); | ||
}; |
Oops, something went wrong.