diff --git a/b2g/app/Makefile.in b/b2g/app/Makefile.in index 3433a394adb7..3427021a2a85 100644 --- a/b2g/app/Makefile.in +++ b/b2g/app/Makefile.in @@ -20,7 +20,7 @@ LIBS += \ $(DEPTH)/widget/gonk/libdisplay/$(LIB_PREFIX)display.$(LIB_SUFFIX) \ $(MOZ_ZLIB_LIBS) \ $(NULL) -ifeq ($(ANDROID_VERSION),$(findstring $(ANDROID_VERSION),17 18)) +ifeq ($(ANDROID_VERSION),$(findstring $(ANDROID_VERSION),17 18 19)) LIBS += \ -lgui \ -lsuspend \ diff --git a/b2g/components/DirectoryProvider.js b/b2g/components/DirectoryProvider.js index 56afee171f4b..3e9f81eca680 100644 --- a/b2g/components/DirectoryProvider.js +++ b/b2g/components/DirectoryProvider.js @@ -86,13 +86,15 @@ DirectoryProvider.prototype = { // getUpdateDir will set persistent to false since it may toggle between // /data/local/ and /mnt/sdcard based on free space and/or availability // of the sdcard. - return this.getUpdateDir(persistent, UPDATES_DIR); + // before download, check if free space is 2.1 times of update.mar + return this.getUpdateDir(persistent, UPDATES_DIR, 2.1); } if (prop == XRE_OS_UPDATE_APPLY_TO_DIR) { // getUpdateDir will set persistent to false since it may toggle between // /data/local/ and /mnt/sdcard based on free space and/or availability // of the sdcard. - return this.getUpdateDir(persistent, FOTA_DIR); + // before apply, check if free space is 1.1 times of update.mar + return this.getUpdateDir(persistent, FOTA_DIR, 1.1); } #else // In desktop builds, coreAppsDir is the same as the profile directory. @@ -171,7 +173,7 @@ DirectoryProvider.prototype = { return null; }, - getUpdateDir: function dp_getUpdateDir(persistent, subdir) { + getUpdateDir: function dp_getUpdateDir(persistent, subdir, multiple) { let defaultUpdateDir = this.getDefaultUpdateDir(); persistent.value = false; @@ -189,7 +191,7 @@ DirectoryProvider.prototype = { return defaultUpdateDir; } - let requiredSpace = selectedPatch.size * 2; + let requiredSpace = selectedPatch.size * multiple; let updateDir = this.findUpdateDirWithFreeSpace(requiredSpace, subdir); if (updateDir) { return updateDir; diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index d31f332aaf50..c3a4805915eb 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "458c7c1031a8ee2666b8b4c62301bacd74833332", + "revision": "449764bc60bafa78cec7aa6cad0d65e558ab7473", "repo_path": "/integration/gaia-central" } diff --git a/configure.in b/configure.in index 8ff642535ff4..098d2dfc02ee 100644 --- a/configure.in +++ b/configure.in @@ -245,6 +245,11 @@ if test -n "$gonkdir" ; then MOZ_B2G_CAMERA=1 MOZ_OMX_DECODER=1 AC_SUBST(MOZ_OMX_DECODER) + ;; + 19) + GONK_INCLUDES="-I$gonkdir/frameworks/native/include" + MOZ_NFC=1 + ;; *) AC_MSG_ERROR([Unsupported platform version: $ANDROID_VERSION]) diff --git a/content/media/encoder/fmp4_muxer/ISOMediaBoxes.cpp b/content/media/encoder/fmp4_muxer/ISOMediaBoxes.cpp index d96176620edb..9347f8405063 100644 --- a/content/media/encoder/fmp4_muxer/ISOMediaBoxes.cpp +++ b/content/media/encoder/fmp4_muxer/ISOMediaBoxes.cpp @@ -324,10 +324,13 @@ MovieFragmentBox::MovieFragmentBox(uint32_t aType, ISOControl* aControl) , mTrackType(aType) { boxes.AppendElement(new MovieFragmentHeaderBox(mTrackType, aControl)); + + // Always adds flags_data_offset_present in each TrackFragmentBox, Android + // parser requires this flag to calculate the correct bitstream offset. if (mTrackType & Audio_Track) { boxes.AppendElement( new TrackFragmentBox(Audio_Track, - flags_sample_size_present, + flags_sample_size_present | flags_data_offset_present, aControl)); } if (mTrackType & Video_Track) { diff --git a/dom/browser-element/BrowserElementChildPreload.js b/dom/browser-element/BrowserElementChildPreload.js index 1a53176fb5b4..8b95926d68fc 100644 --- a/dom/browser-element/BrowserElementChildPreload.js +++ b/dom/browser-element/BrowserElementChildPreload.js @@ -688,10 +688,11 @@ BrowserElementChild.prototype = { let self = this; let maxWidth = data.json.args.width; let maxHeight = data.json.args.height; + let mimeType = data.json.args.mimeType; let domRequestID = data.json.id; let takeScreenshotClosure = function() { - self._takeScreenshot(maxWidth, maxHeight, domRequestID); + self._takeScreenshot(maxWidth, maxHeight, mimeType, domRequestID); }; let maxDelayMS = 2000; @@ -712,7 +713,7 @@ BrowserElementChild.prototype = { * the desired maxWidth and maxHeight, and given the DOMRequest ID associated * with the request from the parent. */ - _takeScreenshot: function(maxWidth, maxHeight, domRequestID) { + _takeScreenshot: function(maxWidth, maxHeight, mimeType, domRequestID) { // You can think of the screenshotting algorithm as carrying out the // following steps: // @@ -728,10 +729,14 @@ BrowserElementChild.prototype = { // - Crop the viewport so its width is no larger than maxWidth and its // height is no larger than maxHeight. // + // - Set mozOpaque to true and background color to solid white + // if we are taking a JPEG screenshot, keep transparent if otherwise. + // // - Return a screenshot of the page's viewport scaled and cropped per // above. debug("Taking a screenshot: maxWidth=" + maxWidth + ", maxHeight=" + maxHeight + + ", mimeType=" + mimeType + ", domRequestID=" + domRequestID + "."); if (!content) { @@ -749,19 +754,22 @@ BrowserElementChild.prototype = { let canvasWidth = Math.min(maxWidth, Math.round(content.innerWidth * scale)); let canvasHeight = Math.min(maxHeight, Math.round(content.innerHeight * scale)); + let transparent = (mimeType !== 'image/jpeg'); + var canvas = content.document .createElementNS("http://www.w3.org/1999/xhtml", "canvas"); - canvas.mozOpaque = true; + if (!transparent) + canvas.mozOpaque = true; canvas.width = canvasWidth; canvas.height = canvasHeight; var ctx = canvas.getContext("2d"); ctx.scale(scale, scale); ctx.drawWindow(content, 0, 0, content.innerWidth, content.innerHeight, - "rgb(255,255,255)"); + transparent ? "rgba(255,255,255,0)" : "rgb(255,255,255)"); - // Take a JPEG screenshot to hack around the fact that we can't specify - // opaque PNG. This requires us to unpremultiply the alpha channel, which + // Take a JPEG screenshot by default instead of PNG with alpha channel. + // This requires us to unpremultiply the alpha channel, which // is expensive on ARM processors because they lack a hardware integer // division instruction. canvas.toBlob(function(blob) { @@ -769,7 +777,7 @@ BrowserElementChild.prototype = { id: domRequestID, successRv: blob }); - }, 'image/jpeg'); + }, mimeType); }, _recvFireCtxCallback: function(data) { diff --git a/dom/browser-element/BrowserElementParent.jsm b/dom/browser-element/BrowserElementParent.jsm index 4d6995c5f0e4..53606634a4e6 100644 --- a/dom/browser-element/BrowserElementParent.jsm +++ b/dom/browser-element/BrowserElementParent.jsm @@ -547,16 +547,19 @@ BrowserElementParent.prototype = { return this._sendDOMRequest('purge-history'); }, - _getScreenshot: function(_width, _height) { + _getScreenshot: function(_width, _height, _mimeType) { let width = parseInt(_width); let height = parseInt(_height); + let mimeType = (typeof _mimeType === 'string') ? + _mimeType.trim().toLowerCase() : 'image/jpeg'; if (isNaN(width) || isNaN(height) || width < 0 || height < 0) { throw Components.Exception("Invalid argument", Cr.NS_ERROR_INVALID_ARG); } return this._sendDOMRequest('get-screenshot', - {width: width, height: height}); + {width: width, height: height, + mimeType: mimeType}); }, _recvNextPaint: function(data) { diff --git a/dom/browser-element/mochitest/browserElement_GetScreenshot.js b/dom/browser-element/mochitest/browserElement_GetScreenshot.js index c29dabc5eb8a..fc7c94a35220 100644 --- a/dom/browser-element/mochitest/browserElement_GetScreenshot.js +++ b/dom/browser-element/mochitest/browserElement_GetScreenshot.js @@ -15,20 +15,30 @@ function runTest() { iframe1.src = 'data:text/html,' + 'hello'; - var screenshotArrayBuffers = []; + var screenshotImageDatas = []; var numLoaded = 0; - function screenshotTaken(screenshotArrayBuffer) { - screenshotArrayBuffers.push(screenshotArrayBuffer); - if (screenshotArrayBuffers.length === 1) { + function screenshotTaken(screenshotImageData) { + screenshotImageDatas.push(screenshotImageData); + if (screenshotImageDatas.length === 1) { ok(true, 'Got initial non blank screenshot'); - iframe1.src = 'data:text/html,' + - 'hello'; - // Wait until screenshotArrayBuffer !== screenshotArrayBuffers[0]. - waitForScreenshot(function(screenshotArrayBuffer) { - var view1 = new Int8Array(screenshotArrayBuffer); - var view2 = new Int8Array(screenshotArrayBuffers[0]); + var view = screenshotImageData.data; + if (view[3] !== 255) { + ok(false, 'The first pixel of initial screenshot is not opaque'); + SimpleTest.finish(); + return; + } + ok(true, 'Verified the first pixel of initial screenshot is opaque'); + + iframe1.src = 'data:text/html,' + + 'hello'; + + // Wait until screenshotImageData !== screenshotImageDatas[0]. + waitForScreenshot(function(screenshotImageData) { + var view1 = screenshotImageData.data; + var view2 = screenshotImageDatas[0].data; + if (view1.length != view2.length) { return true; } @@ -40,51 +50,101 @@ function runTest() { } return false; - }); + }, 'image/png'); } - else if (screenshotArrayBuffers.length === 2) { + else if (screenshotImageDatas.length === 2) { ok(true, 'Got updated screenshot after source page changed'); + + var view = screenshotImageData.data; + if (view[3] !== 0) { + // The case here will always fail when oop'd on Firefox Desktop, + // but not on B2G Emulator + // See https://bugzil.la/878003#c20 + + var isB2G = (navigator.platform === ''); + info('navigator.platform: ' + navigator.platform); + if (!isB2G && browserElementTestHelpers.getOOPByDefaultPref()) { + todo(false, 'The first pixel of updated screenshot is not transparent'); + } else { + ok(false, 'The first pixel of updated screenshot is not transparent'); + } + SimpleTest.finish(); + return; + } + + ok(true, 'Verified the first pixel of updated screenshot is transparent'); SimpleTest.finish(); } } // We continually take screenshots until we get one that we are // happy with. - function waitForScreenshot(filter) { - function gotScreenshotArrayBuffer() { - // |this| is the FileReader whose result contains the screenshot as an - // ArrayBuffer. + function waitForScreenshot(filter, mimeType) { + function gotImage(e) { + // |this| is the Image. + + URL.revokeObjectURL(this.src); + + if (e.type === 'error' || !this.width || !this.height) { + tryAgain(); - if (filter(this.result)) { - screenshotTaken(this.result); return; } + + var canvas = document.createElement('canvas'); + canvas.width = canvas.height = 1000; + var ctx = canvas.getContext('2d'); + ctx.drawImage(this, 0, 0); + var imageData = ctx.getImageData(0, 0, 1000, 1000); + + if (filter(imageData)) { + screenshotTaken(imageData); + return; + } + tryAgain(); + } + + function tryAgain() { if (--attempts === 0) { ok(false, 'Timed out waiting for correct screenshot'); SimpleTest.finish(); } else { setTimeout(function() { - iframe1.getScreenshot(1000, 1000).onsuccess = getScreenshotArrayBuffer; + iframe1.getScreenshot(1000, 1000, mimeType).onsuccess = + getScreenshotImageData; }, 200); } } - function getScreenshotArrayBuffer(e) { - var fr = new FileReader(); - fr.onloadend = gotScreenshotArrayBuffer; - fr.readAsArrayBuffer(e.target.result); + function getScreenshotImageData(e) { + var blob = e.target.result; + if (blob.type !== mimeType) { + ok(false, 'MIME type of screenshot taken incorrect'); + SimpleTest.finish(); + } + + if (blob.size === 0) { + tryAgain(); + + return; + } + + var img = new Image(); + img.src = URL.createObjectURL(blob); + img.onload = img.onerror = gotImage; } var attempts = 10; - iframe1.getScreenshot(1000, 1000).onsuccess = getScreenshotArrayBuffer; + iframe1.getScreenshot(1000, 1000, mimeType).onsuccess = + getScreenshotImageData; } function iframeLoadedHandler() { numLoaded++; if (numLoaded === 2) { - waitForScreenshot(function(screenshotArrayBuffer) { - return screenshotArrayBuffer.byteLength != 0; - }); + waitForScreenshot(function(screenshotImageData) { + return true; + }, 'image/jpeg'); } } diff --git a/dom/browser-element/mochitest/test_browserElement_oop_GetScreenshot.html b/dom/browser-element/mochitest/test_browserElement_oop_GetScreenshot.html index ec5b5c15ee1c..81d3e1993146 100644 --- a/dom/browser-element/mochitest/test_browserElement_oop_GetScreenshot.html +++ b/dom/browser-element/mochitest/test_browserElement_oop_GetScreenshot.html @@ -11,6 +11,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=753595 Mozilla Bug 753595 +Mozilla Bug 878003 diff --git a/dom/network/src/NetworkStatsService.jsm b/dom/network/src/NetworkStatsService.jsm index 91ef2847f1aa..c57e15b0531d 100644 --- a/dom/network/src/NetworkStatsService.jsm +++ b/dom/network/src/NetworkStatsService.jsm @@ -428,19 +428,26 @@ this.NetworkStatsService = { debug("clear stats for network " + network.id + " of type " + network.type); if (!this._networks[netId]) { - let error = "Invalid networkType"; - let result = null; - - // Check if network is valid but has not established a connection yet. + // Check if network is valid but has not established a connection yet. If it is not + // found in RIL networks, it can be a SIM network used in the past having sample + // in the database. let rilNetworks = this.getRilNetworks(); - if (rilNetworks[netId]) { - error = null; - result = true; - } + if (!rilNetworks[netId]) { + // Check if it is available in the DB. + this._db.isNetworkAvailable(network, function(aError, aResult) { + if (aResult) { + this._db.clearInterfaceStats(network, function onDBCleared(aError, aResult) { + mm.sendAsyncMessage("NetworkStats:Clear:Return", + { id: msg.id, error: aError, result: aResult }); + }); + return; + } - mm.sendAsyncMessage("NetworkStats:Clear:Return", - { id: msg.id, error: error, result: result }); - return; + mm.sendAsyncMessage("NetworkStats:Clear:Return", + { id: msg.id, error: "Invalid networkType", result: null }); + }); + return; + } } this._db.clearInterfaceStats(network, function onDBCleared(aError, aResult) { diff --git a/dom/system/gonk/RadioInterfaceLayer.js b/dom/system/gonk/RadioInterfaceLayer.js index 368ca1db3373..ef563bdddf22 100644 --- a/dom/system/gonk/RadioInterfaceLayer.js +++ b/dom/system/gonk/RadioInterfaceLayer.js @@ -694,7 +694,27 @@ function RadioInterfaceLayer() { let options = { debug: debugPref, cellBroadcastDisabled: false, - clirMode: RIL.CLIR_DEFAULT + clirMode: RIL.CLIR_DEFAULT, + quirks: { + callstateExtraUint32: + libcutils.property_get("ro.moz.ril.callstate_extra_int", "false") === "true", + v5Legacy: + libcutils.property_get("ro.moz.ril.v5_legacy", "true") === "true", + requestUseDialEmergencyCall: + libcutils.property_get("ro.moz.ril.dial_emergency_call", "false") === "true", + simAppStateExtraFields: + libcutils.property_get("ro.moz.ril.simstate_extra_field", "false") === "true", + extraUint2ndCall: + libcutils.property_get("ro.moz.ril.extra_int_2nd_call", "false") == "true", + haveQueryIccLockRetryCount: + libcutils.property_get("ro.moz.ril.query_icc_count", "false") == "true", + sendStkProfileDownload: + libcutils.property_get("ro.moz.ril.send_stk_profile_dl", "false") == "true", + dataRegistrationOnDemand: + libcutils.property_get("ro.moz.ril.data_reg_on_demand", "false") == "true" + }, + rilEmergencyNumbers: libcutils.property_get("ril.ecclist") || + libcutils.property_get("ro.ril.ecclist") }; try { diff --git a/dom/system/gonk/ril_worker.js b/dom/system/gonk/ril_worker.js index 6ed8d89cd38f..c5ad538ab6e8 100644 --- a/dom/system/gonk/ril_worker.js +++ b/dom/system/gonk/ril_worker.js @@ -38,7 +38,7 @@ "use strict"; -importScripts("ril_consts.js", "systemlibs.js"); +importScripts("ril_consts.js"); importScripts("resource://gre/modules/workers/require.js"); // set to true in ril_consts.js to see debug messages @@ -53,6 +53,7 @@ if (!this.debug) { }; } +let RIL_EMERGENCY_NUMBERS; const DEFAULT_EMERGENCY_NUMBERS = ["112", "911"]; // Timeout value for emergency callback mode. @@ -74,23 +75,22 @@ const MMI_MAX_LENGTH_SHORT_CODE = 2; const MMI_END_OF_USSD = "#"; -let RILQUIRKS_CALLSTATE_EXTRA_UINT32 = libcutils.property_get("ro.moz.ril.callstate_extra_int", "false") === "true"; +let RILQUIRKS_CALLSTATE_EXTRA_UINT32; // This may change at runtime since in RIL v6 and later, we get the version // number via the UNSOLICITED_RIL_CONNECTED parcel. -let RILQUIRKS_V5_LEGACY = libcutils.property_get("ro.moz.ril.v5_legacy", "true") === "true"; -let RILQUIRKS_REQUEST_USE_DIAL_EMERGENCY_CALL = libcutils.property_get("ro.moz.ril.dial_emergency_call", "false") === "true"; -let RILQUIRKS_SIM_APP_STATE_EXTRA_FIELDS = libcutils.property_get("ro.moz.ril.simstate_extra_field", "false") === "true"; +let RILQUIRKS_V5_LEGACY; +let RILQUIRKS_REQUEST_USE_DIAL_EMERGENCY_CALL; +let RILQUIRKS_SIM_APP_STATE_EXTRA_FIELDS; // Needed for call-waiting on Peak device -let RILQUIRKS_EXTRA_UINT32_2ND_CALL = libcutils.property_get("ro.moz.ril.extra_int_2nd_call", "false") == "true"; +let RILQUIRKS_EXTRA_UINT32_2ND_CALL; // On the emulator we support querying the number of lock retries -let RILQUIRKS_HAVE_QUERY_ICC_LOCK_RETRY_COUNT = libcutils.property_get("ro.moz.ril.query_icc_count", "false") == "true"; +let RILQUIRKS_HAVE_QUERY_ICC_LOCK_RETRY_COUNT; // Ril quirk to Send STK Profile Download -let RILQUIRKS_SEND_STK_PROFILE_DOWNLOAD = libcutils.property_get("ro.moz.ril.send_stk_profile_dl", "false") == "true"; +let RILQUIRKS_SEND_STK_PROFILE_DOWNLOAD; // Ril quirk to attach data registration on demand. -let RILQUIRKS_DATA_REGISTRATION_ON_DEMAND = - libcutils.property_get("ro.moz.ril.data_reg_on_demand", "false") == "true"; +let RILQUIRKS_DATA_REGISTRATION_ON_DEMAND; // Marker object. let PENDING_NETWORK_TYPE = {}; @@ -111,7 +111,7 @@ let Buf = { // Maps tokens we send out with requests to the request type, so that // when we get a response parcel back, we know what request it was for. - this.mTokenRequestMap = {}; + this.mTokenRequestMap = new Map(); }, /** @@ -125,7 +125,7 @@ let Buf = { let token = this.readInt32(); let error = this.readInt32(); - options = this.mTokenRequestMap[token]; + options = this.mTokenRequestMap.get(token); if (!options) { if (DEBUG) { debug("Suspicious uninvited request found: " + token + ". Ignored!"); @@ -133,7 +133,7 @@ let Buf = { return; } - delete this.mTokenRequestMap[token]; + this.mTokenRequestMap.delete(token); request_type = options.rilRequestType; options.rilRequestError = error; @@ -174,7 +174,7 @@ let Buf = { } options.rilRequestType = type; options.rilRequestError = null; - this.mTokenRequestMap[this.mToken] = options; + this.mTokenRequestMap.set(this.mToken, options); this.mToken++; return this.mToken; }, @@ -2912,12 +2912,8 @@ let RIL = { * The number to look up. */ _isEmergencyNumber: function(number) { - // Check read-write ecclist property first. - let numbers = libcutils.property_get("ril.ecclist"); - if (!numbers) { - // Then read-only ecclist property since others RIL only uses this. - numbers = libcutils.property_get("ro.ril.ecclist"); - } + // Check ril provided numbers first. + let numbers = RIL_EMERGENCY_NUMBERS; if (numbers) { numbers = numbers.split(","); @@ -3585,11 +3581,8 @@ let RIL = { } // Set flag for outgoing emergency call. - if (newCall.isOutgoing && this._isEmergencyNumber(newCall.number)) { - newCall.isEmergency = true; - } else { - newCall.isEmergency = false; - } + newCall.isEmergency = newCall.isOutgoing && + this._isEmergencyNumber(newCall.number); // Add to our map. if (newCall.isMpty) { @@ -4962,6 +4955,16 @@ let RIL = { CLIENT_ID = options.clientId; this.cellBroadcastDisabled = options.cellBroadcastDisabled; this.clirMode = options.clirMode; + RIL_EMERGENCY_NUMBERS = options.rilEmergencyNumbers; + let quirks = options.quirks; + RILQUIRKS_CALLSTATE_EXTRA_UINT32 = quirks.callstateExtraUint32; + RILQUIRKS_V5_LEGACY = quirks.v5Legacy; + RILQUIRKS_REQUEST_USE_DIAL_EMERGENCY_CALL = quirks.requestUseDialEmergencyCall; + RILQUIRKS_SIM_APP_STATE_EXTRA_FIELDS = quirks.simAppStateExtraFields; + RILQUIRKS_EXTRA_UINT32_2ND_CALL = quirks.extraUint2ndCall; + RILQUIRKS_HAVE_QUERY_ICC_LOCK_RETRY_COUNT = quirks.haveQueryIccLockRetryCount; + RILQUIRKS_SEND_STK_PROFILE_DOWNLOAD = quirks.sendStkProfileDownload; + RILQUIRKS_DATA_REGISTRATION_ON_DEMAND = quirks.dataRegistrationOnDemand; } }; diff --git a/dom/wifi/WifiCommand.jsm b/dom/wifi/WifiCommand.jsm index b57cb2621b83..b7a550566e6a 100644 --- a/dom/wifi/WifiCommand.jsm +++ b/dom/wifi/WifiCommand.jsm @@ -310,11 +310,16 @@ this.WifiCommand = function(aControlMessage, aInterface) { doBooleanCommand("BLACKLIST clear", "OK", callback); }; - command.setSuspendOptimizations = function (enabled, callback) { + command.setSuspendOptimizationsICS = function (enabled, callback) { doBooleanCommand("DRIVER SETSUSPENDOPT " + (enabled ? 0 : 1), "OK", callback); }; + command.setSuspendOptimizationsJB = function (enabled, callback) { + doBooleanCommand("DRIVER SETSUSPENDMODE " + (enabled ? 1 : 0), + "OK", callback); + }; + command.connectToSupplicant = function(callback) { voidControlMessage("connect_to_supplicant", callback); }; diff --git a/dom/wifi/WifiWorker.js b/dom/wifi/WifiWorker.js index a4bd519b1675..57e58a20584e 100644 --- a/dom/wifi/WifiWorker.js +++ b/dom/wifi/WifiWorker.js @@ -1156,7 +1156,9 @@ var WifiManager = (function() { manager.getHttpProxyNetwork = getHttpProxyNetwork; manager.setHttpProxy = setHttpProxy; manager.configureHttpProxy = configureHttpProxy; - manager.setSuspendOptimizations = wifiCommand.setSuspendOptimizations; + manager.setSuspendOptimizations = (sdkVersion >= 16) + ? wifiCommand.setSuspendOptimizationsJB + : wifiCommand.setSuspendOptimizationsICS; manager.setStaticIpMode = setStaticIpMode; manager.getRssiApprox = wifiCommand.getRssiApprox; manager.getLinkSpeed = wifiCommand.getLinkSpeed; diff --git a/gfx/layers/ipc/ShadowLayerUtilsGralloc.cpp b/gfx/layers/ipc/ShadowLayerUtilsGralloc.cpp index 09565a1f9f22..46e5a5c56a17 100644 --- a/gfx/layers/ipc/ShadowLayerUtilsGralloc.cpp +++ b/gfx/layers/ipc/ShadowLayerUtilsGralloc.cpp @@ -44,13 +44,33 @@ void ParamTraits::Write(Message* aMsg, const paramType& aParam) { +#if ANDROID_VERSION >= 19 + sp flattenable = aParam.mGraphicBuffer; +#else Flattenable *flattenable = aParam.mGraphicBuffer.get(); +#endif size_t nbytes = flattenable->getFlattenedSize(); size_t nfds = flattenable->getFdCount(); char data[nbytes]; int fds[nfds]; + +#if ANDROID_VERSION >= 19 + // Make a copy of "data" and "fds" for flatten() to avoid casting problem + void *pdata = (void *)data; + int *pfds = fds; + + flattenable->flatten(pdata, nbytes, pfds, nfds); + + // In Kitkat, flatten() will change the value of nbytes and nfds, which dues + // to multiple parcelable object consumption. The actual size and fd count + // which returned by getFlattenedSize() and getFdCount() are not changed. + // So we change nbytes and nfds back by call corresponding calls. + nbytes = flattenable->getFlattenedSize(); + nfds = flattenable->getFdCount(); +#else flattenable->flatten(data, nbytes, fds, nfds); +#endif aMsg->WriteSize(nbytes); aMsg->WriteSize(nfds); @@ -96,9 +116,17 @@ ParamTraits::Read(const Message* aMsg, } sp buffer(new GraphicBuffer()); +#if ANDROID_VERSION >= 19 + // Make a copy of "data" and "fds" for unflatten() to avoid casting problem + void const *pdata = (void const *)data; + int const *pfds = fds; + + if (NO_ERROR == buffer->unflatten(pdata, nbytes, pfds, nfds)) { +#else Flattenable *flattenable = buffer.get(); if (NO_ERROR == flattenable->unflatten(data, nbytes, fds, nfds)) { +#endif aResult->mGraphicBuffer = buffer; return true; } @@ -128,8 +156,6 @@ ImageFormatForPixelFormat(android::PixelFormat aFormat) return gfxImageFormatRGB24; case PIXEL_FORMAT_RGB_565: return gfxImageFormatRGB16_565; - case PIXEL_FORMAT_A_8: - return gfxImageFormatA8; default: MOZ_CRASH("Unknown gralloc pixel format"); } @@ -146,8 +172,6 @@ PixelFormatForImageFormat(gfxImageFormat aFormat) return android::PIXEL_FORMAT_RGBX_8888; case gfxImageFormatRGB16_565: return android::PIXEL_FORMAT_RGB_565; - case gfxImageFormatA8: - return android::PIXEL_FORMAT_A_8; default: MOZ_CRASH("Unknown gralloc pixel format"); } @@ -168,8 +192,6 @@ BytesPerPixelForPixelFormat(android::PixelFormat aFormat) case PIXEL_FORMAT_RGBA_5551: case PIXEL_FORMAT_RGBA_4444: return 2; - case PIXEL_FORMAT_A_8: - return 1; default: return 0; } diff --git a/gfx/layers/opengl/GrallocTextureClient.cpp b/gfx/layers/opengl/GrallocTextureClient.cpp index 6cf7148bf0c5..fc004d092ee6 100644 --- a/gfx/layers/opengl/GrallocTextureClient.cpp +++ b/gfx/layers/opengl/GrallocTextureClient.cpp @@ -229,9 +229,6 @@ GrallocTextureClientOGL::AllocateForSurface(gfx::IntSize aSize, case gfx::SurfaceFormat::R5G6B5: format = android::PIXEL_FORMAT_RGB_565; break; - case gfx::SurfaceFormat::A8: - format = android::PIXEL_FORMAT_A_8; - break; default: NS_WARNING("Unsupported surface format"); return false; diff --git a/gfx/layers/opengl/GrallocTextureHost.cpp b/gfx/layers/opengl/GrallocTextureHost.cpp index 355343bdc2ac..ddb00f8e7282 100644 --- a/gfx/layers/opengl/GrallocTextureHost.cpp +++ b/gfx/layers/opengl/GrallocTextureHost.cpp @@ -31,8 +31,6 @@ SurfaceFormatForAndroidPixelFormat(android::PixelFormat aFormat, return swapRB ? gfx::SurfaceFormat::B8G8R8X8 : gfx::SurfaceFormat::R8G8B8X8; case android::PIXEL_FORMAT_RGB_565: return gfx::SurfaceFormat::R5G6B5; - case android::PIXEL_FORMAT_A_8: - return gfx::SurfaceFormat::A8; case HAL_PIXEL_FORMAT_YCbCr_422_SP: case HAL_PIXEL_FORMAT_YCrCb_420_SP: case HAL_PIXEL_FORMAT_YCbCr_422_I: @@ -71,7 +69,6 @@ TextureTargetForAndroidPixelFormat(android::PixelFormat aFormat) case android::PIXEL_FORMAT_RGBA_8888: case android::PIXEL_FORMAT_RGBX_8888: case android::PIXEL_FORMAT_RGB_565: - case android::PIXEL_FORMAT_A_8: return LOCAL_GL_TEXTURE_2D; default: if (aFormat >= 0x100 && aFormat <= 0x1FF) { diff --git a/gfx/layers/opengl/TextureHostOGL.cpp b/gfx/layers/opengl/TextureHostOGL.cpp index 8cc150a8562f..2ed8cadadac9 100644 --- a/gfx/layers/opengl/TextureHostOGL.cpp +++ b/gfx/layers/opengl/TextureHostOGL.cpp @@ -1262,8 +1262,6 @@ Deprecated_SurfaceFormatForAndroidPixelFormat(android::PixelFormat aFormat, return swapRB ? SurfaceFormat::B8G8R8X8 : SurfaceFormat::R8G8B8X8; case android::PIXEL_FORMAT_RGB_565: return SurfaceFormat::R5G6B5; - case android::PIXEL_FORMAT_A_8: - return SurfaceFormat::A8; case HAL_PIXEL_FORMAT_YCbCr_422_SP: case HAL_PIXEL_FORMAT_YCrCb_420_SP: case HAL_PIXEL_FORMAT_YCbCr_422_I: @@ -1301,7 +1299,6 @@ Deprecated_TextureTargetForAndroidPixelFormat(android::PixelFormat aFormat) case android::PIXEL_FORMAT_RGBA_8888: case android::PIXEL_FORMAT_RGBX_8888: case android::PIXEL_FORMAT_RGB_565: - case android::PIXEL_FORMAT_A_8: return LOCAL_GL_TEXTURE_2D; default: if (aFormat >= 0x100 && aFormat <= 0x1FF) { diff --git a/js/src/jit/LinearScan.cpp b/js/src/jit/LinearScan.cpp index ab621ecdff36..69ee0e6028be 100644 --- a/js/src/jit/LinearScan.cpp +++ b/js/src/jit/LinearScan.cpp @@ -592,8 +592,6 @@ LinearScanAllocator::populateSafepoints() if (payloadAlloc->isArgument() && (!payload->canonicalSpill() || payload->canonicalSpill() == payloadAlloc)) { - JS_ASSERT(typeAlloc->isArgument()); - JS_ASSERT(!type->canonicalSpill() || type->canonicalSpill() == typeAlloc); continue; } diff --git a/netwerk/protocol/rtsp/rtsp/RTSPSource.cpp b/netwerk/protocol/rtsp/rtsp/RTSPSource.cpp index 13b233a21823..42751d09cfec 100644 --- a/netwerk/protocol/rtsp/rtsp/RTSPSource.cpp +++ b/netwerk/protocol/rtsp/rtsp/RTSPSource.cpp @@ -602,7 +602,6 @@ void RTSPSource::onDisconnected(const sp &msg) { void RTSPSource::finishDisconnectIfPossible() { if (mState != DISCONNECTED) { mHandler->disconnect(); - return; } (new AMessage)->postReply(mDisconnectReplyID); diff --git a/testing/mochitest/b2g.json b/testing/mochitest/b2g.json index 103d0a7aa544..542dd9c9d2c5 100644 --- a/testing/mochitest/b2g.json +++ b/testing/mochitest/b2g.json @@ -239,7 +239,7 @@ "content/events/test/test_bug574663.html":"", "content/events/test/test_bug607464.html":"", "content/events/test/test_wheel_default_action.html":"", - "content/base/test/test_bug682592.html":"", + "content/base/test/test_bug682592.html":"", "content/html/document/test/test_bug369370.html":"", "content/svg/content/test/test_text_selection.html":"Mouse selection not workin on b2g", "content/svg/content/test/test_SVGAnimatedImageSMILDisabled.html":"", @@ -260,8 +260,9 @@ "docshell/test/navigation/test_reserved.html":"", "docshell/test/test_bug413310.html":"", - "dom/imptests/html/webgl":"", + "dom/imptests/html/webgl":"", "dom/battery/test/test_battery_basics.html":"", + "dom/browser-element/mochitest/test_browserElement_inproc_Alert.html":"", "dom/browser-element/mochitest/test_browserElement_inproc_AppFramePermission.html":"", "dom/browser-element/mochitest/test_browserElement_inproc_AppWindowNamespace.html":"", @@ -269,7 +270,32 @@ "dom/browser-element/mochitest/test_browserElement_inproc_BrowserWindowNamespace.html":"", "dom/browser-element/mochitest/test_browserElement_inproc_CloseApp.html":"", "dom/browser-element/mochitest/test_browserElement_inproc_CloseFromOpener.html":"", - "dom/browser-element/":"", + "dom/browser-element/mochitest/test_browserElement_inproc_ErrorSecurity.html":"", + "dom/browser-element/mochitest/test_browserElement_inproc_FrameWrongURI.html":"", + "dom/browser-element/mochitest/test_browserElement_inproc_KeyEvents.html":"", + "dom/browser-element/mochitest/test_browserElement_inproc_OpenMixedProcess.html":"", + "dom/browser-element/mochitest/test_browserElement_inproc_OpenNamed.html":"", + "dom/browser-element/mochitest/test_browserElement_inproc_OpenWindow.html":"", + "dom/browser-element/mochitest/test_browserElement_inproc_OpenWindowDifferentOrigin.html":"", + "dom/browser-element/mochitest/test_browserElement_inproc_OpenWindowInFrame.html":"", + "dom/browser-element/mochitest/test_browserElement_inproc_OpenWindowRejected.html":"", + "dom/browser-element/mochitest/test_browserElement_inproc_SecurityChange.html":"", + "dom/browser-element/mochitest/test_browserElement_inproc_TargetBlank.html":"", + + "dom/browser-element/mochitest/test_browserElement_oop_AppFramePermission.html":"", + "dom/browser-element/mochitest/test_browserElement_oop_AppWindowNamespace.html":"", + "dom/browser-element/mochitest/test_browserElement_oop_Auth.html":"", + "dom/browser-element/mochitest/test_browserElement_oop_BrowserWindowNamespace.html":"", + "dom/browser-element/mochitest/test_browserElement_oop_ErrorSecurity.html":"", + "dom/browser-element/mochitest/test_browserElement_oop_FrameWrongURI.html":"", + "dom/browser-element/mochitest/test_browserElement_oop_OpenMixedProcess.html":"", + "dom/browser-element/mochitest/test_browserElement_oop_OpenNamed.html":"", + "dom/browser-element/mochitest/test_browserElement_oop_OpenWindow.html":"", + "dom/browser-element/mochitest/test_browserElement_oop_OpenWindowDifferentOrigin.html":"", + "dom/browser-element/mochitest/test_browserElement_oop_OpenWindowInFrame.html":"", + "dom/browser-element/mochitest/test_browserElement_oop_OpenWindowRejected.html":"", + "dom/browser-element/mochitest/test_browserElement_oop_SecurityChange.html":"", + "dom/browser-element/mochitest/test_browserElement_oop_TargetBlank.html":"", "dom/file/test/test_progress_events.html":"All of these fail fairly regularly with: UnknownError: The operation failed for reasons unrelated to the database itself and not covered by any other error code. at http://mochi.test:8888/tests/dom/file/test/helpers.js:126", "dom/file/test/test_request_readyState.html":"", diff --git a/toolkit/xre/nsUpdateDriver.cpp b/toolkit/xre/nsUpdateDriver.cpp index 6388d29056ac..3fd83bfa8256 100644 --- a/toolkit/xre/nsUpdateDriver.cpp +++ b/toolkit/xre/nsUpdateDriver.cpp @@ -606,9 +606,12 @@ GetOSApplyToDir(nsACString& applyToDir) NS_ASSERTION(ds, "Can't get directory service"); nsCOMPtr osApplyToDir; - DebugOnly rv = ds->Get(XRE_OS_UPDATE_APPLY_TO_DIR, NS_GET_IID(nsIFile), + nsresult rv = ds->Get(XRE_OS_UPDATE_APPLY_TO_DIR, NS_GET_IID(nsIFile), getter_AddRefs(osApplyToDir)); - NS_ASSERTION(NS_SUCCEEDED(rv), "Can't get the OS applyTo dir"); + if (NS_FAILED(rv)) { + LOG(("Can't get the OS applyTo dir")); + return rv; + } return osApplyToDir->GetNativePath(applyToDir); } @@ -1115,14 +1118,20 @@ nsUpdateProcessor::ProcessUpdate(nsIUpdate* aUpdate) // This needs to be done on the main thread, so we pass it along in // BackgroundThreadInfo nsresult rv = GetOSApplyToDir(osApplyToDir); - NS_ASSERTION(NS_SUCCEEDED(rv), "Can't get the OS apply to dir"); + if (NS_FAILED(rv)) { + LOG(("Can't get the OS apply to dir")); + return rv; + } SetOSApplyToDir(aUpdate, osApplyToDir); mInfo.mIsOSUpdate = true; rv = NS_NewNativeLocalFile(osApplyToDir, false, getter_AddRefs(mInfo.mOSApplyToDir)); - NS_ASSERTION(NS_SUCCEEDED(rv), "Can't create nsIFile for OS apply to dir"); + if (NS_FAILED(rv)) { + LOG(("Can't create nsIFile for OS apply to dir")); + return rv; + } } #endif diff --git a/widget/gonk/libdisplay/FramebufferSurface.cpp b/widget/gonk/libdisplay/FramebufferSurface.cpp index 99dbfbb30446..c302edb13bba 100644 --- a/widget/gonk/libdisplay/FramebufferSurface.cpp +++ b/widget/gonk/libdisplay/FramebufferSurface.cpp @@ -49,30 +49,44 @@ namespace android { * This implements the (main) framebuffer management. This class * was adapted from the version in SurfaceFlinger */ - -FramebufferSurface::FramebufferSurface(int disp, uint32_t width, uint32_t height, uint32_t format, sp& alloc) : - ConsumerBase(new BufferQueue(true, alloc)), +FramebufferSurface::FramebufferSurface(int disp, uint32_t width, uint32_t height, uint32_t format, + sp& bq) : +#if ANDROID_VERSION >= 19 + ConsumerBase(bq, true), +#else + ConsumerBase(bq), +#endif mDisplayType(disp), mCurrentBufferSlot(-1), mCurrentBuffer(0), lastHandle(0) { mName = "FramebufferSurface"; - mBufferQueue->setConsumerName(mName); - mBufferQueue->setConsumerUsageBits(GRALLOC_USAGE_HW_FB | - GRALLOC_USAGE_HW_RENDER | - GRALLOC_USAGE_HW_COMPOSER); - mBufferQueue->setDefaultBufferFormat(format); - mBufferQueue->setDefaultBufferSize(width, height); - mBufferQueue->setSynchronousMode(true); - mBufferQueue->setDefaultMaxBufferCount(NUM_FRAMEBUFFER_SURFACE_BUFFERS); + +#if ANDROID_VERSION >= 19 + sp consumer = mConsumer; +#else + sp consumer = mBufferQueue; + consumer->setSynchronousMode(true); +#endif + consumer->setConsumerName(mName); + consumer->setConsumerUsageBits(GRALLOC_USAGE_HW_FB | + GRALLOC_USAGE_HW_RENDER | + GRALLOC_USAGE_HW_COMPOSER); + consumer->setDefaultBufferFormat(format); + consumer->setDefaultBufferSize(width, height); + consumer->setDefaultMaxBufferCount(NUM_FRAMEBUFFER_SURFACE_BUFFERS); } status_t FramebufferSurface::nextBuffer(sp& outBuffer, sp& outFence) { Mutex::Autolock lock(mMutex); BufferQueue::BufferItem item; +#if ANDROID_VERSION >= 19 + status_t err = acquireBufferLocked(&item, 0); +#else status_t err = acquireBufferLocked(&item); +#endif if (err == BufferQueue::NO_BUFFER_AVAILABLE) { outBuffer = mCurrentBuffer; return NO_ERROR; @@ -92,8 +106,13 @@ status_t FramebufferSurface::nextBuffer(sp& outBuffer, sp& if (mCurrentBufferSlot != BufferQueue::INVALID_BUFFER_SLOT && item.mBuf != mCurrentBufferSlot) { // Release the previous buffer. +#if ANDROID_VERSION >= 19 + err = releaseBufferLocked(mCurrentBufferSlot, mCurrentBuffer, + EGL_NO_DISPLAY, EGL_NO_SYNC_KHR); +#else err = releaseBufferLocked(mCurrentBufferSlot, EGL_NO_DISPLAY, EGL_NO_SYNC_KHR); +#endif if (err != NO_ERROR && err != BufferQueue::STALE_BUFFER_SLOT) { ALOGE("error releasing buffer: %s (%d)", strerror(-err), err); return err; @@ -136,7 +155,11 @@ status_t FramebufferSurface::setReleaseFenceFd(int fenceFd) { if (fenceFd >= 0) { sp fence(new Fence(fenceFd)); if (mCurrentBufferSlot != BufferQueue::INVALID_BUFFER_SLOT) { +#if ANDROID_VERSION >= 19 + status_t err = addReleaseFence(mCurrentBufferSlot, mCurrentBuffer, fence); +#else status_t err = addReleaseFence(mCurrentBufferSlot, fence); +#endif ALOGE_IF(err, "setReleaseFenceFd: failed to add the fence: %s (%d)", strerror(-err), err); } @@ -158,6 +181,10 @@ void FramebufferSurface::dump(String8& result) { ConsumerBase::dump(result); } +void FramebufferSurface::dump(String8& result, const char* prefix) { + ConsumerBase::dump(result); +} + // ---------------------------------------------------------------------------- }; // namespace android // ---------------------------------------------------------------------------- diff --git a/widget/gonk/libdisplay/FramebufferSurface.h b/widget/gonk/libdisplay/FramebufferSurface.h index 38db7952eeab..22a28d747f4a 100644 --- a/widget/gonk/libdisplay/FramebufferSurface.h +++ b/widget/gonk/libdisplay/FramebufferSurface.h @@ -34,13 +34,14 @@ class HWComposer; class FramebufferSurface : public ConsumerBase { public: - FramebufferSurface(int disp, uint32_t width, uint32_t height, uint32_t format, sp& alloc); + FramebufferSurface(int disp, uint32_t width, uint32_t height, uint32_t format, sp& bq); bool isUpdateOnDemand() const { return false; } status_t setUpdateRectangle(const Rect& updateRect); status_t compositionComplete(); virtual void dump(String8& result); + virtual void dump(String8& result, const char* prefix); // setReleaseFenceFd stores a fence file descriptor that will signal when the // current buffer is no longer being read. This fence will be returned to diff --git a/widget/gonk/libdisplay/GonkDisplayJB.cpp b/widget/gonk/libdisplay/GonkDisplayJB.cpp index 7ab251af0587..74c471261783 100644 --- a/widget/gonk/libdisplay/GonkDisplayJB.cpp +++ b/widget/gonk/libdisplay/GonkDisplayJB.cpp @@ -114,12 +114,17 @@ GonkDisplayJB::GonkDisplayJB() mBootAnimBuffer = mAlloc->createGraphicBuffer(mWidth, mHeight, surfaceformat, usage, &error); } - mFBSurface = new FramebufferSurface(0, mWidth, mHeight, surfaceformat, mAlloc); +#if ANDROID_VERSION >= 19 + sp bq = new BufferQueue(mAlloc); +#else + sp bq = new BufferQueue(true, mAlloc); +#endif + mFBSurface = new FramebufferSurface(0, mWidth, mHeight, surfaceformat, bq); #if ANDROID_VERSION == 17 sp stc = new SurfaceTextureClient(static_cast >(mFBSurface->getBufferQueue())); #else - sp stc = new Surface(static_cast >(mFBSurface->getBufferQueue())); + sp stc = new Surface(static_cast >(bq)); #endif mSTClient = stc;