Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
Checking mergeability… Don't worry, you can still create the pull request.
  • 13 commits
  • 16 files changed
  • 0 commit comments
  • 4 contributors
Commits on Apr 11, 2013
@zivchang zivchang NFC module update
remove card emulator support
update API priviledge
8aaf3a8
@zivchang zivchang Merge pull request #209 from zivchang/next
NFC module update
9477376
@jacobchen jacobchen [bug fix] PTSDK-1514, check calling overlay window status when showin…
…g lock screen.
c2d441b
@zivchang zivchang Merge pull request #210 from jacobchen/next
[bug fix] PTSDK-1514, check calling overlay window status when showing l...
3593c04
@zivchang zivchang update BT, download, notification, power priviledge 0d0680e
@zivchang zivchang Merge pull request #211 from zhizhangchen/iframe-support
Supports binding objects into iframes  of an App recursively
7b403f2
@zivchang zivchang Merge pull request #212 from zivchang/next
update BT, download, notification, power priviledge
975d621
Commits on Apr 12, 2013
@zivchang zivchang rebase binding object into iframes recursively 272a1b0
@zivchang zivchang Merge pull request #213 from zivchang/next
rebase binding object into iframes recursively
85b1adb
Commits on Apr 16, 2013
@zivchang zivchang Application and NFC API update
support new API update
add ApplicationManager.getAppSharedURI()
add NFCManager.setExclusiveMode()
2f353fd
@zivchang zivchang Merge pull request #214 from zivchang/next
Application and NFC API update
eed2c71
@zhizhangchen Bind objects to newly added iframes in the Application
Conflicts:

	lib/ripple/bootstrap.js
86276ae
@zhizhangchen [Emulator Bridge] Only cache the device window and route onmessage to it a1cf471
View
62 lib/ripple/bootstrap.js
@@ -14,10 +14,20 @@
* limitations under the License.
*/
var _console = require('ripple/console'),
+ utils = require('ripple/utils'),
ui = require('ripple/ui'),
db = require('ripple/db'),
_CURRENT_URL = "current-url";
+var _srcChangedObserver = new WebKitMutationObserver(function (mutations) {
+ utils.forEach(mutations, function (mutation) {
+ _bindObjectsToFrame(mutation.target);
+ });
+ });
+
+function _observeIframeAdded(doc) {
+ doc._iframeAddedObserver.observe(doc, {childList: true, subtree: true});
+}
function _bindObjects(win, doc) {
if (!win.tinyHippos) {
@@ -29,13 +39,22 @@ function _bindObjects(win, doc) {
require('ripple/resizer').init(win, doc);
win.addEventListener("DOMContentLoaded", function () {
var iframes = $(this.document).find("iframe");
+ // Observe iframe added event so that we can bind objects to newly added iframes
+ if (!this.document._iframeAddedObserver) {
+ this.document._iframeAddedObserver = new WebKitMutationObserver(function (mutations) {
+ utils.forEach(mutations, function (mutation) {
+ for ( var i = 0; i < mutation.addedNodes.length; i ++ ) {
+ var node = mutation.addedNodes[i];
+ if (node.tagName.toUpperCase() === "IFRAME") {
+ _bindObjectsToFrame(node);
+ }
+ }
+ });
+ })
+ _observeIframeAdded(this.document);
+ }
iframes.each(function (){
_bindObjectsToFrame(this);
- // Make sure to bind objects again when src of an iframe changes
- var observer = new WebKitMutationObserver(function (mutations) {
- _bindObjectsToFrame(mutations[0].target);
- })
- observer.observe(this, {attributes: true, attributeFilter: ["src"]});
})
});
@@ -43,28 +62,39 @@ function _bindObjects(win, doc) {
}
}
+function _beforeLoad () {
+ this._bound = false;
+ _bindObjects(this.contentWindow, this.contentDocument);
+ this._intervalId = window.setInterval(function () {
+ if (this._bound) {
+ window.clearInterval(this._intervalId);
+ } else {
+ _bindObjects(this.contentWindow, this.contentDocument);
+ }
+ }.bind(this), 1);
+}
+
function _bindObjectsToFrame (frame) {
- frame.addEventListener("beforeload", function () {
- frame._bound = false;
- _bindObjects(frame.contentWindow, frame.contentDocument);
- var id = window.setInterval(function () {
- if (frame.contentWindow._bound) {
- window.clearInterval(id);
- } else {
- _bindObjects(frame.contentWindow, frame.contentDocument);
- }
- }, 1);
- });
+ _srcChangedObserver.observe(frame, {attributes: true, attributeFilter: ["src"]});
+ frame.addEventListener("beforeload", _beforeLoad);
// beforeload event of an iframe will not be triggered unless we detach and
// then attach the iframe to the dom tree
var parentNode = frame.parentNode;
var nextNode = frame.nextNode;
if (parentNode) {
+ // Disable iframe added observer to avoid infinite loop of binding objects
+ if (frame.ownerDocument && frame.ownerDocument._iframeAddedObserver) {
+ frame.ownerDocument._iframeAddedObserver.disconnect();
+ }
parentNode.removeChild(frame);
if (nextNode)
nextNode.insertBefore(frame);
else
parentNode.appendChild(frame);
+
+ if (frame.ownerDocument && frame.ownerDocument._iframeAddedObserver) {
+ _observeIframeAdded(frame.ownerDocument);
+ }
}
}
View
22 lib/ripple/documentEventListener.js
@@ -18,7 +18,8 @@ var event = require('ripple/event'),
constants = require('ripple/constants'),
deviceSettings = require('ripple/deviceSettings'),
ui = require('ripple/ui'),
- _self;
+ _self,
+ _ComWinShow = false;
function _bind(name, win) {
var _listeners = [];
@@ -56,6 +57,10 @@ function _bind(name, win) {
};
}
+function _isComWinSHow() {
+ return _ComWinShow;
+}
+
_self = {
mask: function (frame, doc) {
/*
@@ -116,10 +121,23 @@ _self = {
};
event.on("LockScreenChanged", function (on) {
- _lockScreen(on);
+ if (_isComWinSHow() === false) {
+ _lockScreen(on);
+ }
+ else {
+ if (on === true) {
+ ui.hideOverlay("communication-window");
+ _lockScreen(on);
+ }
+ else {
+ _lockScreen(on);
+ ui.showOverlay("communication-window");
+ }
+ }
});
event.on("CommWinShow", function (status) {
+ _ComWinShow = status;
if (_isLockScreenOn() === true) {
if (status === false) {
_lockScreen(true);
View
21 lib/ripple/emulatorBridge.js
@@ -69,9 +69,19 @@ function _marshalScreen(win) {
module.exports = {
link: function (win, doc) {
- _win = win;
- _doc = doc;
- _xhr = win.XMLHttpRequest;
+ // Only cache the device window and route onmessage to it
+ if (win.parent.parent === win.parent &&
+ win.frameElement.getAttribute('id') === 'document') {
+ _win = win;
+ _doc = doc;
+ _xhr = win.XMLHttpRequest;
+
+ window.onmessage = function (e) {
+ if (typeof win.onmessage === 'function') {
+ win.onmessage(e);
+ }
+ };
+ }
require('ripple/widgetConfig').initialize();
@@ -83,11 +93,6 @@ module.exports = {
marshal(window.tinyHippos, "tinyHippos");
marshal(window.XMLHttpRequest, "XMLHttpRequest");
- window.onmessage = function (e) {
- if (typeof win.onmessage === 'function') {
- win.onmessage(e);
- }
- };
if (currentPlatform.initialize) {
currentPlatform.initialize(win);
View
1  lib/ripple/platform/tizen/2.0/NDEFMessage.js
@@ -15,6 +15,7 @@
*/
module.exports = function (ndefRecords) {
+ //TODO: NDEFMessage doesn't support rawData constructor
var _self,
_ndefRecords = ndefRecords || [],
space = " ",
View
21 lib/ripple/platform/tizen/2.0/application.js
@@ -56,6 +56,7 @@ function _setupCurrentApp() {
categories: [],
installDate: new Date(),
size: 1024,
+ sharedURI: "/usr/local/share/",
operation: "",
appControl: {
uri: "",
@@ -433,6 +434,25 @@ _self = function () {
return certs;
}
+ function getAppSharedURI(id) {
+ var appId;
+
+ if (id === null || id === undefined) {
+ appId = _data.activeApp.appId;
+ return _data.applications[appId].sharedURI;
+ }
+
+ if (id && (typeof id !== "string")) {
+ throw new WebAPIError(errorcode.TYPE_MISMATCH_ERR);
+ }
+
+ if (!_data.applications[id]) {
+ throw new WebAPIError(errorcode.NOT_FOUND_ERR);
+ }
+
+ return _data.applications[id].sharedURI;
+ }
+
function addAppInfoEventListener(eventCallback) {
var handle;
@@ -485,6 +505,7 @@ _self = function () {
getAppsInfo : getAppsInfo,
getAppInfo : getAppInfo,
getAppCerts : getAppCerts,
+ getAppSharedURI: getAppSharedURI,
addAppInfoEventListener : addAppInfoEventListener,
removeAppInfoEventListener : removeAppInfoEventListener,
handleSubFeatures : handleSubFeatures
View
3  lib/ripple/platform/tizen/2.0/bluetooth.js
@@ -43,7 +43,8 @@ var utils = require('ripple/utils'),
localServices : {},
},
_security = {
- "http://tizen.org/privilege/bluetooth.admin": ["setName", "setPowered", "setVisible"],
+ "http://tizen.org/privilege/bluetoothmanager": ["setVisible"],
+ "http://tizen.org/privilege/bluetooth.admin": ["setName", "setPowered"],
"http://tizen.org/privilege/bluetooth.gap": ["getDefaultAdapter", "discoverDevices", "stopDiscovery", "getKnownDevices", "getDevice", "createBonding", "destroyBonding", "hasService"],
"http://tizen.org/privilege/bluetooth.spp": ["registerRFCOMMServiceByUUID", "connectToServiceByUUID", "writeData", "readData", "close", "unregister"],
all: true
View
67 lib/ripple/platform/tizen/2.0/download.js
@@ -14,6 +14,7 @@
* limitations under the License.
*/
var db = require('ripple/db'),
+ utils = require('ripple/utils'),
event = require('ripple/event'),
errorcode = require('ripple/platform/tizen/2.0/errorcode'),
filesystem = require('ripple/platform/tizen/2.0/filesystem'),
@@ -27,6 +28,10 @@ var db = require('ripple/db'),
COMPLETED: "COMPLETED",
FAILED: "FAILED"
},
+ _security = {
+ "http://tizen.org/privilege/download": ["start"],
+ all: true
+ },
DB_DOWNLOAD_KEY = "tizen1-db-download",
DownloadItem, _isInitialized = false, INTERVAL = 1000,
_downloads = [], _resources = [], _self;
@@ -182,8 +187,11 @@ DownloadItem = function (download, callback) {
return _self;
};
-_self = {
- start: function (downloadRequest, downloadCallback) {
+_self = function () {
+ function start(downloadRequest, downloadCallback) {
+ if (!_security.all && !_security.start) {
+ throw new WebAPIError(errorcode.SECURITY_ERR);
+ }
var downloadObj, fileSize, increment, receivedSize = 0, intervalId;
_checkDownloadParamters(downloadRequest, downloadCallback);
@@ -213,9 +221,9 @@ _self = {
}, INTERVAL);
downloadObj.intervalId = intervalId;
return downloadObj.id;
- },
+ }
- cancel: function (downloadId) {
+ function cancel(downloadId) {
var downloadObj = _getDownloadObjById(downloadId);
clearInterval(downloadObj.intervalId);
if (downloadObj.state !== DownloadState.DOWNLOADING) {
@@ -224,9 +232,9 @@ _self = {
}
downloadObj.state = DownloadState.CANCELED;
_exec(downloadObj.callback, 'oncanceled', downloadObj.id);
- },
+ }
- pause: function (downloadId) {
+ function pause(downloadId) {
var downloadObj = _getDownloadObjById(downloadId);
clearInterval(downloadObj.intervalId);
if (downloadObj.state !== DownloadState.DOWNLOADING) {
@@ -235,9 +243,9 @@ _self = {
}
downloadObj.state = DownloadState.PAUSED;
_exec(downloadObj.callback, 'onpaused', downloadObj.id);
- },
+ }
- resume: function (downloadId) {
+ function resume(downloadId) {
var downloadObj, fileSize, receivedSize, increment, intervalId;
downloadObj = _getDownloadObjById(downloadId);
@@ -265,26 +273,26 @@ _self = {
}
}, INTERVAL);
downloadObj.intervalId = intervalId;
- },
+ }
- getState: function (downloadId) {
+ function getState(downloadId) {
var downloadObj = _getDownloadObjById(downloadId);
return downloadObj.state;
- },
+ }
- getDownloadRequest: function (downloadId) {
+ function getDownloadRequest(downloadId) {
var req, downloadObj;
downloadObj = _getDownloadObjById(downloadId);
req = new DownloadRequest(downloadObj.url, downloadObj.destination, downloadObj.fileName);
return req;
- },
+ }
- getMIMEType: function (downloadId) {
+ function getMIMEType(downloadId) {
var downloadObj = _getDownloadObjById(downloadId);
return downloadObj.MIMEType;
- },
+ }
- setListener: function (downloadId, callback) {
+ function setListener(downloadId, callback) {
var downloadObj = _getDownloadObjById(downloadId);
if (callback !== undefined && callback !== null &&
(typeof callback.onprogress !== 'function' ||
@@ -296,6 +304,33 @@ _self = {
}
downloadObj.callback = callback;
}
+
+ function handleSubFeatures(subFeatures) {
+ for (var subFeature in subFeatures) {
+ if (_security[subFeature].length === 0) {
+ _security.all = true;
+ return;
+ }
+ _security.all = false;
+ utils.forEach(_security[subFeature], function (method) {
+ _security[method] = true;
+ });
+ }
+ }
+
+ var download = {
+ start: start,
+ cancel: cancel,
+ pause: pause,
+ resume: resume,
+ getState: getState,
+ getDownloadRequest: getDownloadRequest,
+ getMIMEType: getMIMEType,
+ setListener: setListener,
+ handleSubFeatures : handleSubFeatures
+ };
+
+ return download;
};
event.on('downloadResourceChanged', function () {
View
57 lib/ripple/platform/tizen/2.0/nfc.js
@@ -48,11 +48,10 @@ var db = require('ripple/db'),
connectedState : false
},
_security = {
- "http://tizen.org/privilege/nfc.common": ["getDefaultAdapter", "getCachedMessage"],
- "http://tizen.org/privilege/nfc.admin": ["setPowered", "setCardEmulation"],
+ "http://tizen.org/privilege/nfc.admin": ["setPowered"],
+ "http://tizen.org/privilege/nfc.common": ["getDefaultAdapter", "setExclusiveMode", "getCachedMessage", "toByte"],
+ "http://tizen.org/privilege/nfc.p2p": ["setPeerListener", "unsetPeerListener", "setReceiveNDEFListener", "unsetReceiveNDEFListener", "sendNDEF"],
"http://tizen.org/privilege/nfc.tag": ["setTagListener", "unsetTagListener", "readNDEF", "writeNDEF", "transceive"],
- "http://tizen.org/privilege/nfc.p2p": ["setPeerListener", "unsetPeerListener", "sendNDEF"],
- "http://tizen.org/privilege/nfc.cardemulation": ["setCardEmulationChangeListener", "unsetCardEmulationChangeListener"],
all: true
},
_self;
@@ -71,6 +70,7 @@ function _validateCallbackType(onSuccess) {
}
_self = function () {
+ var nfc, _exclusiveMode = false;
function getDefaultAdapter() {
if (!_security.all && !_security.getDefaultAdapter) {
throw new WebAPIError(errorcode.SECURITY_ERR);
@@ -86,6 +86,28 @@ _self = function () {
return _data.nfcAdapter;
}
+ /* API Description:
+ * If it gets priority and it is in foreground, system doesn't
+ * send app controls that are usually sent when detecting NFC Tag
+ * or receiving NDEF Message from the connected NFC peer-to-peer target
+ *
+ * Implementation detail:
+ * due to simulator only support single running instance and doesn't have
+ * other app controls which be called by design. we just put some system
+ * exclusive mode info on the 'System Summary' panel
+ */
+ function setExclusiveMode(mode) {
+ if (!_security.all && !_security.setExclusiveMode) {
+ throw new WebAPIError(errorcode.SECURITY_ERR);
+ }
+
+ if (typeof mode !== "boolean") {
+ throw new WebAPIError(errorcode.TYPE_MISMATCH_ERR);
+ }
+ _exclusiveMode = mode;
+ jQuery("#NFCExclusiveModeValue").text(_exclusiveMode);
+ }
+
function handleSubFeatures(subFeatures) {
for (var subFeature in subFeatures) {
if (_security[subFeature].length === 0) {
@@ -99,8 +121,9 @@ _self = function () {
}
}
- var nfc = {
+ nfc = {
getDefaultAdapter: getDefaultAdapter,
+ setExclusiveMode: setExclusiveMode,
handleSubFeatures: handleSubFeatures
};
@@ -185,10 +208,10 @@ NFCAdapter = function () {
}
});
event.on("nfc-peer-sending-ndef", function () {
- var _records = [], rec, _ndef;
+ var _records = [], rec, _ndef, i;
if (isPeerConnected) {
peer = db.retrieveObject(_NFC_PEER);
- for(i in peer.ndef.records) {
+ for (i in peer.ndef.records) {
rec = peer.ndef.records[i];
_records.push(new NDEFRecord(rec.tnf, rec.type, rec.payload, rec.id));
}
@@ -266,7 +289,7 @@ NFCAdapter = function () {
successCallback();
}
}
-
+/*
function setCardEmulation(_seType, successCallback, errorCallback) {
var originalType;
if (!_security.all && !_security.setCardEmulation) {
@@ -296,7 +319,6 @@ NFCAdapter = function () {
successCallback();
}
}
-
function setCardEmulationChangeListener(changeCallback) {
if (!_security.all && !_security.setCardEmulationChangeListener) {
throw new WebAPIError(errorcode.SECURITY_ERR);
@@ -319,6 +341,7 @@ NFCAdapter = function () {
_data.listener.onCardEmulationChanged = null;
}
+*/
// Registers a callback function to invoke when NFC tag is detected.
function setTagListener(detectCallback, tagFilter) {
@@ -390,9 +413,9 @@ NFCAdapter = function () {
nfcAdapter = {
setPowered : setPowered,
- setCardEmulation: setCardEmulation,
- setCardEmulationChangeListener: setCardEmulationChangeListener,
- unsetCardEmulationChangeListener: unsetCardEmulationChangeListener,
+ //setCardEmulation: setCardEmulation,
+ //setCardEmulationChangeListener: setCardEmulationChangeListener,
+ //unsetCardEmulationChangeListener: unsetCardEmulationChangeListener,
setTagListener : setTagListener,
setPeerListener : setPeerListener,
unsetTagListener : unsetTagListener,
@@ -506,6 +529,7 @@ NFCTag = function (type, isSupportedNDEF, ndefSize, properties, isConnected, nde
}
// Formats the detected tag that can store NDEF messages.
+ /*
function formatNDEF(successCallback, errorCallback, key) {
tizen1_utils.validateCallbackType(successCallback, errorCallback);
@@ -524,12 +548,13 @@ NFCTag = function (type, isSupportedNDEF, ndefSize, properties, isConnected, nde
successCallback();
}
+ */
nfcTag = {
readNDEF : readNDEF,
writeNDEF : writeNDEF,
transceive : transceive,
- formatNDEF : formatNDEF
+ //formatNDEF : formatNDEF
};
nfcTag.__defineGetter__("type", function () {
@@ -562,6 +587,9 @@ NFCPeer = function (isConnected) {
// Registers a callback function to be invoked when NDEF message is received from NFC peer-to-peer target connected.
function setReceiveNDEFListener(successCallback, errorCallback) {
+ if (!_security.all && !_security.setReceiveNDEFListener) {
+ throw new WebAPIError(errorcode.SECURITY_ERR);
+ }
function _setReceiveNDEFListener() {
if (!isConnected) {
if (errorCallback) {
@@ -577,6 +605,9 @@ NFCPeer = function (isConnected) {
// Unregisters the listener for receiving NDEFMessage from NFC peer-to-peer target connected.
function unsetReceiveNDEFListener() {
+ if (!_security.all && !_security.unsetReceiveNDEFListener) {
+ throw new WebAPIError(errorcode.SECURITY_ERR);
+ }
_data.listener.onNDEFReceived = null;
}
View
8 lib/ripple/platform/tizen/2.0/notification.js
@@ -21,7 +21,7 @@ var db = require('ripple/db'),
WebAPIError = require('ripple/platform/tizen/2.0/WebAPIError'),
_notificationStack,
_security = {
- "http://tizen.org/privilege/notification": ["post", "update", "remove", "removeAll", "get", "getAll"],
+ "http://tizen.org/privilege/notification": ["post", "update", "remove", "removeAll"],
all: true
},
_self;
@@ -120,9 +120,6 @@ _self = function () {
}
function get(id) {
- if (!_security.all && !_security.get) {
- throw new WebAPIError(errorcode.SECURITY_ERR);
- }
if (typeof id !== "string") {
throw (new WebAPIError(errorcode.TYPE_MISMATCH_ERR));
}
@@ -136,9 +133,6 @@ _self = function () {
function getAll() {
var notifications = [];
- if (!_security.all && !_security.getAll) {
- throw new WebAPIError(errorcode.SECURITY_ERR);
- }
utils.forEach(_notificationStack, function (item) {
notifications.push(utils.copy(item));
});
View
86 lib/ripple/platform/tizen/2.0/power.js
@@ -14,6 +14,7 @@
* limitations under the License.
*/
var event = require('ripple/event'),
+ utils = require('ripple/utils'),
constants = require('ripple/constants'),
deviceSettings = require('ripple/deviceSettings'),
errorcode = require('ripple/platform/tizen/2.0/errorcode'),
@@ -29,6 +30,10 @@ var event = require('ripple/event'),
_isScreenOn = true,
_normalBrightness,
_minimal_screen_state = null,
+ _security = {
+ "http://tizen.org/privilege/power": ["request", "setScreenBrightness", "turnScreenOn", "turnScreenOff"],
+ all: true
+ },
_self;
/**initialize**/
@@ -74,8 +79,11 @@ function triggerListenerCB(stateObj) {
}
}
-_self = {
- request: function (resource, state) {
+_self = function () {
+ function request(resource, state) {
+ if (!_security.all && !_security.request) {
+ throw new WebAPIError(errorcode.SECURITY_ERR);
+ }
if (typeof resource !== 'string' || typeof state !== 'string') {
throw new WebAPIError(errorcode.TYPE_MISMATCH_ERR);
}
@@ -105,9 +113,9 @@ _self = {
default:
break;
}
- },
+ }
- release: function (resource) {
+ function release(resource) {
switch (resource) {
case "SCREEN" :
if (_isScreenResourceOccupied) {
@@ -129,24 +137,27 @@ _self = {
throw (new WebAPIError(errorcode.TYPE_MISMATCH_ERR));
}
}
- },
+ }
- setScreenStateChangeListener: function (listener) {
+ function setScreenStateChangeListener(listener) {
tizen1_utils.validateArgumentType(listener, "function",
new WebAPIError(errorcode.TYPE_MISMATCH_ERR));
_listeners.push(listener);
- },
+ }
- unsetScreenStateChangeListener: function () {
+ function unsetScreenStateChangeListener() {
_listeners = [];
- },
+ }
- getScreenBrightness: function () {
+ function getScreenBrightness() {
var brightness = deviceSettings.retrieve("DISPLAY.brightness");
return brightness;
- },
+ }
- setScreenBrightness: function (brightness) {
+ function setScreenBrightness(brightness) {
+ if (!_security.all && !_security.setScreenBrightness) {
+ throw new WebAPIError(errorcode.SECURITY_ERR);
+ }
if (typeof brightness !== 'number') {
throw new WebAPIError(errorcode.TYPE_MISMATCH_ERR);
}
@@ -161,13 +172,13 @@ _self = {
event.trigger("DisplayBrightnessChangedByPower", [brightness]);
updateResourceState();
triggerListenerCB(ScreenState);
- },
+ }
- isScreenOn: function () {
+ function isScreenOn() {
return _isScreenOn;
- },
+ }
- restoreScreenBrightness: function () {
+ function restoreScreenBrightness() {
if (_isScreenResourceOccupied) {
_isScreenResourceOccupied = false;
deviceSettings.persist("DISPLAY.brightness", _originalBrightness);
@@ -175,10 +186,13 @@ _self = {
updateResourceState();
triggerListenerCB(ScreenState);
}
- },
+ }
- turnScreenOn: function () {
+ function turnScreenOn() {
var brightness, value, flag = false;
+ if (!_security.all && !_security.turnScreenOn) {
+ throw new WebAPIError(errorcode.SECURITY_ERR);
+ }
brightness = deviceSettings.retrieve("DISPLAY.brightness");
switch (_minimal_screen_state) {
case "SCREEN_DIM":
@@ -219,11 +233,43 @@ _self = {
triggerListenerCB(ScreenState);
}
_isScreenOn = true;
- },
+ }
- turnScreenOff: function () {
+ function turnScreenOff() {
+ if (!_security.all && !_security.turnScreenOff) {
+ throw new WebAPIError(errorcode.SECURITY_ERR);
+ }
_isScreenOn = false;
}
+
+ function handleSubFeatures(subFeatures) {
+ for (var subFeature in subFeatures) {
+ if (_security[subFeature].length === 0) {
+ _security.all = true;
+ return;
+ }
+ _security.all = false;
+ utils.forEach(_security[subFeature], function (method) {
+ _security[method] = true;
+ });
+ }
+ }
+
+ var power = {
+ request: request,
+ release: release,
+ setScreenStateChangeListener: setScreenStateChangeListener,
+ unsetScreenStateChangeListener: unsetScreenStateChangeListener,
+ getScreenBrightness: getScreenBrightness,
+ setScreenBrightness: setScreenBrightness,
+ isScreenOn: isScreenOn,
+ restoreScreenBrightness: restoreScreenBrightness,
+ turnScreenOn: turnScreenOn,
+ turnScreenOff: turnScreenOff,
+ handleSubFeatures : handleSubFeatures
+ };
+
+ return power;
};
initState();
View
10 lib/ripple/platform/tizen/2.0/spec.js
@@ -81,7 +81,8 @@ module.exports = {
},
download: {
path: "tizen/2.0/download",
- feature: "http://tizen.org/privilege/download"
+ feature: "http://tizen.org/privilege/download",
+ handleSubfeatures: true
},
DownloadRequest: {
path: "tizen/2.0/DownloadRequest",
@@ -110,7 +111,7 @@ module.exports = {
},
bluetooth: {
path: "tizen/2.0/bluetooth",
- feature: "http://tizen.org/privilege/bluetooth.admin|http://tizen.org/privilege/bluetooth.gap|http://tizen.org/privilege/bluetooth.spp",
+ feature: "http://tizen.org/privilege/bluetoothmanager|http://tizen.org/privilege/bluetooth.admin|http://tizen.org/privilege/bluetooth.gap|http://tizen.org/privilege/bluetooth.spp",
handleSubfeatures: true
},
contact: {
@@ -200,7 +201,7 @@ module.exports = {
},
nfc: {
path: "tizen/2.0/nfc",
- feature: "http://tizen.org/privilege/nfc.common|http://tizen.org/privilege/nfc.admin|http://tizen.org/privilege/nfc.tag|http://tizen.org/privilege/nfc.p2p|http://tizen.org/privilege/nfc.cardemulation",
+ feature: "http://tizen.org/privilege/nfc.common|http://tizen.org/privilege/nfc.admin|http://tizen.org/privilege/nfc.tag|http://tizen.org/privilege/nfc.p2p",
handleSubfeatures: true
},
NDEFMessage: {
@@ -242,7 +243,8 @@ module.exports = {
},
power: {
path: "tizen/2.0/power",
- feature: "http://tizen.org/privilege/power"
+ feature: "http://tizen.org/privilege/power",
+ handleSubfeatures: true
},
networkbearerselection: {
path: "tizen/2.0/networkbearerselection",
View
3  lib/ripple/platform/tizen/2.0/spec/config.js
@@ -703,11 +703,10 @@ module.exports = {
"http://tizen.org/privilege/callhistory.read", "http://tizen.org/privilege/callhistory.write",
"http://tizen.org/privilege/messaging.send",
"http://tizen.org/privilege/messaging.read", "http://tizen.org/privilege/messaging.write",
- "http://tizen.org/privilege/bluetooth.admin",
+ "http://tizen.org/privilege/bluetoothmanager", "http://tizen.org/privilege/bluetooth.admin",
"http://tizen.org/privilege/bluetooth.gap", "http://tizen.org/privilege/bluetooth.spp",
"http://tizen.org/privilege/nfc.common", "http://tizen.org/privilege/nfc.admin",
"http://tizen.org/privilege/nfc.tag", "http://tizen.org/privilege/nfc.p2p",
- "http://tizen.org/privilege/nfc.cardemulation",
"http://tizen.org/privilege/content.read", "http://tizen.org/privilege/content.write",
"http://tizen.org/privilege/systeminfo",
"http://tizen.org/privilege/setting",
View
4 lib/ripple/ui.js
@@ -282,12 +282,12 @@ function _db_upgrade_for_release() {
var version = db.retrieve(constants.RELEASE_VERSION);
// version: 20121115 is the first release version
- if (version === null || version === undefined || Number(version) < 20130411) {
+ if (version === null || version === undefined || Number(version) < 20130417) {
db.remove(constants.COMMON.APPLICATION_STATE + "tizen");
db.remove(constants.COMMON.APPLICATION_STATE + "cordova");
db.remove("tizen1-db-application");
db.remove("tizen-db-package");
- version = 20130411;
+ version = 20130417;
db.save(constants.RELEASE_VERSION, version);
}
}
View
8 lib/ripple/ui/plugins/application.js
@@ -33,6 +33,7 @@ var event = require('ripple/event'),
categories: ["media"],
size: 5120,
packageId: "TEST_APP_ID",
+ sharedURI: "/usr/local/share/viewer",
operation: "http://tizen.org/appcontrol/operation/view",
appControl: {
uri: "http://tizen.org/appcontrol/uri/view",
@@ -52,6 +53,7 @@ var event = require('ripple/event'),
categories: ["media"],
size: 2048,
packageId: "TEST_APP_ID",
+ sharedURI: "/usr/local/share/player",
operation: "http://tizen.org/appcontrol/operation/play",
appControl: {
uri: "http://tizen.org/appcontrol/uri/play",
@@ -71,6 +73,7 @@ var event = require('ripple/event'),
categories: ["media"],
size: 3094,
packageId: "EXAMPLE_ID",
+ sharedURI: "/usr/local/share/dummy",
operation: "http://tizen.org/appcontrol/operation/dummy",
appControl: {
uri: "http://tizen.org/appcontrol/uri/dummy",
@@ -90,6 +93,7 @@ var event = require('ripple/event'),
categories: ["dialer"],
size: 2048,
packageId: "SAMPLE_ID",
+ sharedURI: "/usr/local/share/dialer",
operation: "http://tizen.org/appcontrol/operation/call",
appControl: {
uri: "http://tizen.org/appcontrol/uri/call",
@@ -109,6 +113,7 @@ var event = require('ripple/event'),
categories: ["message"],
size: 2048,
packageId: "SAMPLE_ID",
+ sharedURI: "/usr/local/share/sender",
operation: "http://tizen.org/appcontrol/operation/send_text",
appControl: {
uri: "http://tizen.org/appcontrol/uri/send_text",
@@ -131,6 +136,7 @@ var event = require('ripple/event'),
installDate: new Date(),
size: 2048,
packageId: "SAMPLE_ID",
+ sharedURI: "/usr/local/share/dialer",
operation: "http://tizen.org/appcontrol/operation/call",
appControl: {
uri: "http://tizen.org/appcontrol/uri/call",
@@ -151,6 +157,7 @@ var event = require('ripple/event'),
installDate: new Date(),
size: 2048,
packageId: "SAMPLE_ID",
+ sharedURI: "/usr/local/share/sender",
operation: "http://tizen.org/appcontrol/operation/send_text",
appControl: {
uri: "http://tizen.org/appcontrol/uri/send_text",
@@ -191,6 +198,7 @@ function _loadInstalledAppList() {
.replace(/#InstallDate/, item.installDate)
.replace(/#Size/, item.size)
.replace(/#PackageID/, item.packageId)
+ .replace(/#SharedURI/, item.sharedURI)
.replace(/#Operation/, item.operation)
.replace(/#URI/, item.appControl.uri)
.replace(/#MIME/, item.appControl.mime)
View
1  lib/ripple/ui/plugins/information.js
@@ -75,6 +75,7 @@ function _updateInformationView() {
infoList.push("<section><div style=\"clear:both;\"></div><div id=\"systemSummaryLockScreenContainer\" style=\"width:320px; height:20px; overflow:hidden; white-space: nowrap; text-overflow: ellipsis;\" ><label class=\"ui-text-label\">Lock Screen Image: </label><span>" + _systemSettings["LOCK_SCREEN"] + "</span></div></section>");
infoList.push("<section><div style=\"clear:both;\"></div><div id=\"systemSummaryInComingCallContainer\" style=\"width:320px; height:20px; overflow:hidden; white-space: nowrap; text-overflow: ellipsis;\" ><label class=\"ui-text-label\">Incoming Call Number: </label><span>" + _systemSettings["INCOMING_CALL"] + "</span></div></section>");
infoList.push("<section><div style=\"clear:both;\"></div><div id=\"systemSummaryNotiEMailContainer\" style=\"width:320px; height:20px; overflow:hidden; white-space: nowrap; text-overflow: ellipsis;\" ><label class=\"ui-text-label\">Notification Email: </label><span>" + _systemSettings["NOTIFICATION_EMAIL"] + "</span></div></section>");
+ infoList.push("<section><div style=\"clear:both;\"></div><div id=\"NFCExclusiveModeContainer\" style=\"width:320px; height:20px; overflow:hidden; white-space: nowrap; text-overflow: ellipsis;\" ><label class=\"ui-text-label\">NFC Exclusive Mode: </label><span id=\"NFCExclusiveModeValue\">false</span></div></section>");
infoPane.innerHTML = infoList.join("");
// Make tooltip if it needed
View
4 lib/ripple/ui/plugins/package/panel.html
@@ -204,6 +204,10 @@ <h3 class="config-accordion-node-title ui-text-pass">
<td><label class="ui-text-label">Package ID</label></td>
<td>#PackageID</td>
</tr>
+ <tr>
+ <td><label class="ui-text-label">Shared URI</label></td>
+ <td>#SharedURI</td>
+ </tr>
<tr><td colspan="2"><hr></td></tr>
</table>
<h3>Binding Control Operation</h3>

No commit comments for this range

Something went wrong with that request. Please try again.