diff --git a/lib/units/device/plugins/screen/stream.js b/lib/units/device/plugins/screen/stream.js index 2c6a8083..6452c654 100644 --- a/lib/units/device/plugins/screen/stream.js +++ b/lib/units/device/plugins/screen/stream.js @@ -389,6 +389,17 @@ module.exports = syrup.serial() frameProducer.updateRotation(newRotation) }) + frameProducer.on('start', function() { + var message = util.format( + 'start %s' + , JSON.stringify(frameProducer.banner) + ) + + broadcastSet.values().forEach(function(ws) { + ws.send(message) + }) + }) + frameProducer.on('readable', function next() { var frame if ((frame = frameProducer.nextFrame())) { diff --git a/lib/units/device/plugins/screen/util/banner.js b/lib/units/device/plugins/screen/util/banner.js index 9d8ce27b..d63cfc3c 100644 --- a/lib/units/device/plugins/screen/util/banner.js +++ b/lib/units/device/plugins/screen/util/banner.js @@ -16,7 +16,11 @@ module.exports.read = function parseBanner(out) { , virtualWidth: 0 , virtualHeight: 0 , orientation: 0 - , quirks: 0 + , quirks: { + dumb: false + , alwaysUpright: false + , tear: false + } } tryRead = function() { @@ -78,7 +82,9 @@ module.exports.read = function parseBanner(out) { break case 23: // quirks - banner.quirks = chunk[cursor] + banner.quirks.dumb = (chunk[cursor] & 1) === 1 + banner.quirks.alwaysUpright = (chunk[cursor] & 2) === 2 + banner.quirks.tear = (chunk[cursor] & 4) === 4 break } diff --git a/res/app/components/stf/screen/screen-directive.js b/res/app/components/stf/screen/screen-directive.js index 358b07ae..e475fa44 100644 --- a/res/app/components/stf/screen/screen-directive.js +++ b/res/app/components/stf/screen/screen-directive.js @@ -73,6 +73,7 @@ module.exports = function DeviceScreenDirective( ws.onopen = function openListener() { var canvas = element.find('canvas')[0] , g = canvas.getContext('2d') + , positioner = element.find('div')[0] function vendorBackingStorePixelRatio(g) { return g.webkitBackingStorePixelRatio || @@ -206,6 +207,12 @@ module.exports = function DeviceScreenDirective( var cachedImageWidth = 0 , cachedImageHeight = 0 , cssRotation = 0 + , alwaysUpright = false + + function applyQuirks(banner) { + element[0].classList.toggle( + 'quirk-always-upright', alwaysUpright = banner.quirks.alwaysUpright) + } function hasImageAreaChanged(img) { return cachedScreen.bounds.w !== screen.bounds.w || @@ -247,7 +254,7 @@ module.exports = function DeviceScreenDirective( canvasAspect = canvas.width / canvas.height - if (isRotated()) { + if (isRotated() && !alwaysUpright) { canvasAspect = img.height / img.width element[0].classList.add('rotated') } @@ -256,14 +263,21 @@ module.exports = function DeviceScreenDirective( element[0].classList.remove('rotated') } + if (alwaysUpright) { + // If the screen image is always in upright position (but we + // still want the rotation animation), we need to cancel out + // the rotation by using another rotation. + positioner.style[cssTransform] = 'rotate(' + -cssRotation + 'deg)' + } + maybeFlipLetterbox() } return function messageListener(message) { - if (shouldUpdateScreen()) { - screen.rotation = device.display.rotation + screen.rotation = device.display.rotation - if (message.data instanceof Blob) { + if (message.data instanceof Blob) { + if (shouldUpdateScreen()) { if (scope.displayError) { scope.$apply(function () { scope.displayError = false @@ -313,15 +327,14 @@ module.exports = function DeviceScreenDirective( var url = URL.createObjectURL(blob) img.src = url } - else { - switch (message.data) { - case 'secure_on': - scope.$apply(function () { - scope.displayError = 'secure' - }) - break - } - } + } + else if (/^start /.test(message.data)) { + applyQuirks(JSON.parse(message.data.substr('start '.length))) + } + else if (message.data === 'secure_on') { + scope.$apply(function () { + scope.displayError = 'secure' + }) } } })() diff --git a/res/app/control-panes/device-control/device-control.css b/res/app/control-panes/device-control/device-control.css index 82b7a23f..ea5d6b04 100644 --- a/res/app/control-panes/device-control/device-control.css +++ b/res/app/control-panes/device-control/device-control.css @@ -36,6 +36,7 @@ device-screen .positioner { left: 0; margin: auto; pointer-events: none; + transform: rotate(0deg); } device-screen canvas.screen { diff --git a/vendor/minicap/shared/android-17/armeabi-v7a/minicap.so b/vendor/minicap/shared/android-17/armeabi-v7a/minicap.so index 915db1ba..55693545 100755 Binary files a/vendor/minicap/shared/android-17/armeabi-v7a/minicap.so and b/vendor/minicap/shared/android-17/armeabi-v7a/minicap.so differ diff --git a/vendor/minicap/shared/android-17/x86/minicap.so b/vendor/minicap/shared/android-17/x86/minicap.so index 6c0c850c..1d466781 100755 Binary files a/vendor/minicap/shared/android-17/x86/minicap.so and b/vendor/minicap/shared/android-17/x86/minicap.so differ diff --git a/vendor/minicap/shared/android-18/armeabi-v7a/minicap.so b/vendor/minicap/shared/android-18/armeabi-v7a/minicap.so index 222e5afe..7d1dcb56 100755 Binary files a/vendor/minicap/shared/android-18/armeabi-v7a/minicap.so and b/vendor/minicap/shared/android-18/armeabi-v7a/minicap.so differ diff --git a/vendor/minicap/shared/android-18/x86/minicap.so b/vendor/minicap/shared/android-18/x86/minicap.so index 1bff4f31..ab4ac408 100755 Binary files a/vendor/minicap/shared/android-18/x86/minicap.so and b/vendor/minicap/shared/android-18/x86/minicap.so differ diff --git a/vendor/minicap/shared/android-19/armeabi-v7a/minicap.so b/vendor/minicap/shared/android-19/armeabi-v7a/minicap.so index eb4fae82..57b78a2a 100755 Binary files a/vendor/minicap/shared/android-19/armeabi-v7a/minicap.so and b/vendor/minicap/shared/android-19/armeabi-v7a/minicap.so differ diff --git a/vendor/minicap/shared/android-19/x86/minicap.so b/vendor/minicap/shared/android-19/x86/minicap.so index db06375a..665d4f57 100755 Binary files a/vendor/minicap/shared/android-19/x86/minicap.so and b/vendor/minicap/shared/android-19/x86/minicap.so differ diff --git a/vendor/minicap/shared/android-21/arm64-v8a/minicap.so b/vendor/minicap/shared/android-21/arm64-v8a/minicap.so index 7297418b..22a91a49 100755 Binary files a/vendor/minicap/shared/android-21/arm64-v8a/minicap.so and b/vendor/minicap/shared/android-21/arm64-v8a/minicap.so differ diff --git a/vendor/minicap/shared/android-21/armeabi-v7a/minicap.so b/vendor/minicap/shared/android-21/armeabi-v7a/minicap.so index 0bea4543..b8bd9fe0 100755 Binary files a/vendor/minicap/shared/android-21/armeabi-v7a/minicap.so and b/vendor/minicap/shared/android-21/armeabi-v7a/minicap.so differ diff --git a/vendor/minicap/shared/android-21/x86/minicap.so b/vendor/minicap/shared/android-21/x86/minicap.so index 56d0bf88..b3a12760 100755 Binary files a/vendor/minicap/shared/android-21/x86/minicap.so and b/vendor/minicap/shared/android-21/x86/minicap.so differ diff --git a/vendor/minicap/shared/android-21/x86_64/minicap.so b/vendor/minicap/shared/android-21/x86_64/minicap.so index ffe5c18d..270321a1 100755 Binary files a/vendor/minicap/shared/android-21/x86_64/minicap.so and b/vendor/minicap/shared/android-21/x86_64/minicap.so differ diff --git a/vendor/minicap/shared/android-22/arm64-v8a/minicap.so b/vendor/minicap/shared/android-22/arm64-v8a/minicap.so index 1d8b7388..1436a0ed 100755 Binary files a/vendor/minicap/shared/android-22/arm64-v8a/minicap.so and b/vendor/minicap/shared/android-22/arm64-v8a/minicap.so differ diff --git a/vendor/minicap/shared/android-22/armeabi-v7a/minicap.so b/vendor/minicap/shared/android-22/armeabi-v7a/minicap.so index a753b219..91fb8cb4 100755 Binary files a/vendor/minicap/shared/android-22/armeabi-v7a/minicap.so and b/vendor/minicap/shared/android-22/armeabi-v7a/minicap.so differ diff --git a/vendor/minicap/shared/android-22/x86/minicap.so b/vendor/minicap/shared/android-22/x86/minicap.so index 0b11f797..39e6c16c 100755 Binary files a/vendor/minicap/shared/android-22/x86/minicap.so and b/vendor/minicap/shared/android-22/x86/minicap.so differ diff --git a/vendor/minicap/shared/android-22/x86_64/minicap.so b/vendor/minicap/shared/android-22/x86_64/minicap.so index 79f39a78..fef1a989 100755 Binary files a/vendor/minicap/shared/android-22/x86_64/minicap.so and b/vendor/minicap/shared/android-22/x86_64/minicap.so differ