Граф коммитов

112 Коммитов

Автор SHA1 Сообщение Дата
Makoto Kato 3493d2727e Bug 1753574 - hal::LockOrientation can return error status. r=smaug,geckoview-reviewers,agi,calu
From https://w3c.github.io/screen-orientation/#apply-an-orientation-lock

> 7.2. Apply an orientation lock
>
> The steps to apply an orientation lock to a Document using orientation are as
> follows:
>
>  1. If the user agent does not support locking the screen orientation, return
>     a promise rejected with a "NotSupportedError" DOMException and abort
>     these steps.

So if orientation controller delegate isn't set, we should throw
`NotSupportedError`.  But, actually, we throws `AbortError`, so this isn't
correct.

To return any DOM error from platform implementation of
`screen.orientation.lock`, I would like to change return value to
`GenericPromise`'s.

Differential Revision: https://phabricator.services.mozilla.com/D137970
2022-03-02 03:48:14 +00:00
Emilio Cobos Álvarez 28290f66db Bug 1754858 - Simplify screen orientation API implementation. r=smaug,m_kato,geckoview-reviewers
Make the ScreenOrientation part of the screen struct, as it should. Stop
using HAL to propagate just screen orientation updates, use the more
general screen manager.

Instead of HAL observers, add a simple observer service notification,
and clean a bunch of the code.

This will simplify bug 1754802 a bit, and is generally simpler.
Shouldn't change behavior. I've tested the events and some common
orientation locking use cases like Youtube, and they behave the same.

Differential Revision: https://phabricator.services.mozilla.com/D138477
2022-02-15 20:22:54 +00:00
Emilio Cobos Álvarez 51f5539b57 Bug 1754813 - Make Hal::ScreenOrientation an enum class. r=gsvelto,m_kato,geckoview-reviewers
This adds proper IPC validation too.

Differential Revision: https://phabricator.services.mozilla.com/D138461
2022-02-14 07:51:06 +00:00
Makoto Kato f8c3f43487 Bug 1747677 - Add utility method to convert to ScreenConfiguration. r=gsvelto,geckoview-reviewers,calu
Gecko uses the redundant code from nsIScreen to SCreenConfiguration. So we
should add a convert method for newer platform implementations.

Differential Revision: https://phabricator.services.mozilla.com/D134698
2021-12-30 05:09:40 +00:00
Cathy Lu 8348b23f54 Bug 1697647 - Add screen orientation lock api r=ipc-reviewers,mccr8,agi,smaug,jonalmeida
Previously, the screenOrientation.lock API was for Fennec and not supported for Fenix and multi-process use. The overall idea is to now allow apps to use the API through a delegate and make asynchronous calls to LockDeviceOrientation. This required replacing the existing code that returned a default false bool to calls that perform the requested orientation change and instead return a promise that contained either an allow or deny value.

Returning a promise instead of a bool involved changing the API calls from the C++ side to Java. The new general control flow of screenOrientation lock follows: an app calls C++ ScreenOrientation.lock() which eventually dispatches LockOrientationTask to resolve the pending orientation promise. Hal.cpp sends an IPC call to the content process and RecvLockScreenOrientation retrieves the current instance of geckoRuntime and calls the java side LockScreenOrientation. Apps must create a delegate and override onOrientationLock to set the requested orientation. In geckoview's testing, this is done with the android API setRequestedOrientation. Once a device orientation change has been triggered, native OnOrientationChange calls to NotifyScreenConfigurationChange, which notifies all observers and dispatches a change event to resolve the pending orientation promise.

Testing:
I used a demo on the GeckoView Example (https://usefulangle.com/demos/105/screen.html) to test locking to landscape orientation. This required a change to the GVE to show the app from recreating the whole thing on orientation change. In the example AndroidManifest xml file, `orientation` prevents restart when orientation changes.

The Junit/Kotlin tests were to verify that the expected orientation delegate was called with the expected new orientation value, in an orientation change, if the new orientation was the same as the current, and if the pre-lock conditions such as being fullscreen were not met.

A static preference `dom.screenorientation.allow-lock` was added to the dom group, since it affects the ui dom) and is currently turned off. C++ can access it through its mirrored variable dom_screenorientation_allow_lock (same name but with underscores). The junit tests turn the preference on and test the lock feature.

Reference:
Orientation constant values:
    C++
        1 ScreenOrientation_PortraitPrimary); - vertical with button at bottom
        2 ScreenOrientation_PortraitSecondary); - vertical with button at top
        4 ScreenOrientation_LandscapePrimary); - horizational w button right
        8 ScreenOrientation_LandscapeSecondary); - horization button left
        16 ScreenOrientation_Default);
    Java
        1 GeckoScreenOrientation.ScreenOrientation.PORTRAIT_PRIMARY.value
        2 GeckoScreenOrientation.ScreenOrientation.PORTRAIT_SECONDARY.value
        4 GeckoScreenOrientation.ScreenOrientation.LANDSCAPE_PRIMARY.value
        8 GeckoScreenOrientation.ScreenOrientation.LANDSCAPE_SECONDARY.value

    Java public API
        0 ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
        1 Activitynfo.SCREEN_ORIENTATION_PORTRAIT

    Android
        1 ORIENTATION_PORTRAIT
        2 ORIENTATION_LANDSCAPE

Differential Revision: https://phabricator.services.mozilla.com/D129427
2021-12-06 13:58:37 +00:00
Butkovits Atila cd8a98f0df Backed out changeset 05897abf2c4e (bug 1697647) for causing failures at lock-sandboxed-iframe.html. CLOSED TREE 2021-12-04 04:32:48 +02:00
Cathy Lu 3e9924d513 Bug 1697647 - Add screen orientation lock api r=ipc-reviewers,mccr8,agi,smaug,jonalmeida
Previously, the screenOrientation.lock API was for Fennec and not supported for Fenix and multi-process use. The overall idea is to now allow apps to use the API through a delegate and make asynchronous calls to LockDeviceOrientation. This required replacing the existing code that returned a default false bool to calls that perform the requested orientation change and instead return a promise that contained either an allow or deny value.

Returning a promise instead of a bool involved changing the API calls from the C++ side to Java. The new general control flow of screenOrientation lock follows: an app calls C++ ScreenOrientation.lock() which eventually dispatches LockOrientationTask to resolve the pending orientation promise. Hal.cpp sends an IPC call to the content process and RecvLockScreenOrientation retrieves the current instance of geckoRuntime and calls the java side LockScreenOrientation. Apps must create a delegate and override onOrientationLock to set the requested orientation. In geckoview's testing, this is done with the android API setRequestedOrientation. Once a device orientation change has been triggered, native OnOrientationChange calls to NotifyScreenConfigurationChange, which notifies all observers and dispatches a change event to resolve the pending orientation promise.

Testing:
I used a demo on the GeckoView Example (https://usefulangle.com/demos/105/screen.html) to test locking to landscape orientation. This required a change to the GVE to show the app from recreating the whole thing on orientation change. In the example AndroidManifest xml file, `orientation` prevents restart when orientation changes.

The Junit/Kotlin tests were to verify that the expected orientation delegate was called with the expected new orientation value, in an orientation change, if the new orientation was the same as the current, and if the pre-lock conditions such as being fullscreen were not met.

A static preference `dom.screenorientation.allow-lock` was added to the dom group, since it affects the ui dom) and is currently turned off. C++ can access it through its mirrored variable dom_screenorientation_allow_lock (same name but with underscores). The junit tests turn the preference on and test the lock feature.

Reference:
Orientation constant values:
    C++
        1 ScreenOrientation_PortraitPrimary); - vertical with button at bottom
        2 ScreenOrientation_PortraitSecondary); - vertical with button at top
        4 ScreenOrientation_LandscapePrimary); - horizational w button right
        8 ScreenOrientation_LandscapeSecondary); - horization button left
        16 ScreenOrientation_Default);
    Java
        1 GeckoScreenOrientation.ScreenOrientation.PORTRAIT_PRIMARY.value
        2 GeckoScreenOrientation.ScreenOrientation.PORTRAIT_SECONDARY.value
        4 GeckoScreenOrientation.ScreenOrientation.LANDSCAPE_PRIMARY.value
        8 GeckoScreenOrientation.ScreenOrientation.LANDSCAPE_SECONDARY.value

    Java public API
        0 ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
        1 Activitynfo.SCREEN_ORIENTATION_PORTRAIT

    Android
        1 ORIENTATION_PORTRAIT
        2 ORIENTATION_LANDSCAPE

Differential Revision: https://phabricator.services.mozilla.com/D129427
2021-12-03 23:49:25 +00:00
criss daea1328b7 Backed out changeset 9c623cac6b96 (bug 1697647) for causing mozlint failures. CLOSED TREE 2021-12-04 01:34:21 +02:00
Cathy Lu 1e4d05e6fd Bug 1697647 - Add screen orientation lock api r=ipc-reviewers,mccr8,agi,smaug,jonalmeida
Previously, the screenOrientation.lock API was for Fennec and not supported for Fenix and multi-process use. The overall idea is to now allow apps to use the API through a delegate and make asynchronous calls to LockDeviceOrientation. This required replacing the existing code that returned a default false bool to calls that perform the requested orientation change and instead return a promise that contained either an allow or deny value.

Returning a promise instead of a bool involved changing the API calls from the C++ side to Java. The new general control flow of screenOrientation lock follows: an app calls C++ ScreenOrientation.lock() which eventually dispatches LockOrientationTask to resolve the pending orientation promise. Hal.cpp sends an IPC call to the content process and RecvLockScreenOrientation retrieves the current instance of geckoRuntime and calls the java side LockScreenOrientation. Apps must create a delegate and override onOrientationLock to set the requested orientation. In geckoview's testing, this is done with the android API setRequestedOrientation. Once a device orientation change has been triggered, native OnOrientationChange calls to NotifyScreenConfigurationChange, which notifies all observers and dispatches a change event to resolve the pending orientation promise.

Testing:
I used a demo on the GeckoView Example (https://usefulangle.com/demos/105/screen.html) to test locking to landscape orientation. This required a change to the GVE to show the app from recreating the whole thing on orientation change. In the example AndroidManifest xml file, `orientation` prevents restart when orientation changes.

The Junit/Kotlin tests were to verify that the expected orientation delegate was called with the expected new orientation value, in an orientation change, if the new orientation was the same as the current, and if the pre-lock conditions such as being fullscreen were not met.

A static preference `dom.screenorientation.allow-lock` was added to the dom group, since it affects the ui dom) and is currently turned off. C++ can access it through its mirrored variable dom_screenorientation_allow_lock (same name but with underscores). The junit tests turn the preference on and test the lock feature.

Reference:
Orientation constant values:
    C++
        1 ScreenOrientation_PortraitPrimary); - vertical with button at bottom
        2 ScreenOrientation_PortraitSecondary); - vertical with button at top
        4 ScreenOrientation_LandscapePrimary); - horizational w button right
        8 ScreenOrientation_LandscapeSecondary); - horization button left
        16 ScreenOrientation_Default);
    Java
        1 GeckoScreenOrientation.ScreenOrientation.PORTRAIT_PRIMARY.value
        2 GeckoScreenOrientation.ScreenOrientation.PORTRAIT_SECONDARY.value
        4 GeckoScreenOrientation.ScreenOrientation.LANDSCAPE_PRIMARY.value
        8 GeckoScreenOrientation.ScreenOrientation.LANDSCAPE_SECONDARY.value

    Java public API
        0 ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
        1 Activitynfo.SCREEN_ORIENTATION_PORTRAIT

    Android
        1 ORIENTATION_PORTRAIT
        2 ORIENTATION_LANDSCAPE

Differential Revision: https://phabricator.services.mozilla.com/D129427
2021-12-03 22:35:22 +00:00
Andrew McCreight 9c9c36a9fa Bug 1710473 - Remove hal::SetProcessPrioritySupported(). r=gsvelto,geckoview-reviewers,aklotz
As far as I can see, all this does is protect the user from
running some useless code if they manually enable the priority
manager using a pref on an OS that doesn't support it. The
upside of allowing this is that it makes it possible to debug
the priority manager on OSX and Linux with just a pref flip.

Differential Revision: https://phabricator.services.mozilla.com/D114767
2021-05-10 19:59:24 +00:00
Andi-Bogdan Postelnicu d5cca8c6ff Bug 1683553 - Make `hal` buildable outside of `unified-build` environment. r=gsvelto
Differential Revision: https://phabricator.services.mozilla.com/D100210
2021-01-04 14:20:19 +00:00
Simon Giesecke 5c29aef8d0 Bug 1626570 - Improve handling of copying arrays in hal/. r=gsvelto
Differential Revision: https://phabricator.services.mozilla.com/D73637
2020-05-05 10:14:24 +00:00
Sylvestre Ledru e226046cb8 Bug 1547143 - Format the tree: Be prescriptive with the pointer style (left) r=Ehsan
# ignore-this-changeset

Depends on D28954

Differential Revision: https://phabricator.services.mozilla.com/D28956

--HG--
extra : moz-landing-system : lando
2019-05-01 08:47:10 +00:00
Tooru Fujisawa 7983faeb5d Bug 1511393 - Use c-basic-offset: 2 in Emacs mode line for C/C++ code. r=nbp 2018-12-01 04:52:05 +09:00
Benjamin Bouvier a7f1d173a0 Bug 1511383: Update vim modelines after clang-format; r=sylvestre
- modify line wrap up to 80 chars; (tw=80)
- modify size of tab to 2 chars everywhere; (sts=2, sw=2)

--HG--
extra : rebase_source : 7eedce0311b340c9a5a1265dc42d3121cc0f32a0
extra : amend_source : 9cb4ffdd5005f5c4c14172390dd00b04b2066cd7
2018-11-30 16:39:55 +01:00
Sylvestre Ledru 265e672179 Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
# ignore-this-changeset

--HG--
extra : amend_source : 4d301d3b0b8711c4692392aa76088ba7fd7d1022
2018-11-30 11:46:48 +01:00
Gabriele Svelto b605bebd6a Bug 1488401 - Remove the remnants of the DiskSpaceWatcher r=asuth,janv,smaug
Differential Revision: https://phabricator.services.mozilla.com/D4933

--HG--
extra : moz-landing-system : lando
2018-09-13 06:40:51 +00:00
Gabriele Svelto 6bddc0a55e Bug 1486772 - Refactor the screen-orientation types and headers r=smaug
This patch removes the 'ScreenOrientationInternal' type from
dom/base/ScreenOrientation.h and moves it into the
HalScreenConfiguration.h header, renaming it simply to 'ScreenOrientation'
in the process. This has several knock-off effects:

- It allows files that needed ScreenOrientationInternal to include a much
  smaller header than before

- It greatly reduces the number of headers pulled in when including Hal.h

- It clarifies the role of the type. The 'Internal' part in the name had
  nothing to do with it being part of the implementation. The type was public
  and called that way only to avoid clashing with the 'ScreenOrientation'
  class. Since we moved it into a different namespace it can be renamed
  safely.

- It allows a file that was manually re-declaring 'ScreenConfigurationInternal'
  type to use the original one

- Finally this fixes a few files which were missing headers they actually
  required but that would still build because unified compilation put them into
  units that already had those headers thanks to ScreenConfiguration.h

Differential Revision: https://phabricator.services.mozilla.com/D4458

--HG--
extra : moz-landing-system : lando
2018-08-29 20:54:56 +00:00
Gabriele Svelto a2444ee4e6 Bug 1465898 - Remove unused code for managing physical audio devices; r=agaynor
MozReview-Commit-ID: 7NsUfzJCUOB

--HG--
extra : source : bea8ba41a74d40bff06be7e7be923e0604ea6f47
2018-06-04 22:28:09 +02:00
Ryan Hunt 3ad8329892 Bug 1455408 - Remove thread priority suppport from HAL as it isn't used any longer. r=gsvelto
MozReview-Commit-ID: KJ2byDuYWr9

--HG--
extra : rebase_source : 448a6f729d35cd758dc8ebe282dc1ca2e38c9272
extra : histedit_source : ff09a1bc358a7a94c3223fbaec7e366493e47cb5
2018-04-19 14:48:02 -05:00
Makoto Kato 6b0532c81c Bug 1447873 - Remove Time API backend in hal. r=gsvelto
Time API is already removed, so hal backend is unnecessary now.

MozReview-Commit-ID: 8R2VRYIX9Vs

--HG--
extra : rebase_source : 4e927dcf0f0d2a3ae802332fff438985b0be14f1
2018-03-22 10:46:42 +09:00
Milan Sreckovic b600182b11 Bug 1423552: Use BaseRect access methods instead of member variables in hal/ r=gsvelto
MozReview-Commit-ID: 625X8dMPL2n

--HG--
extra : rebase_source : ff2be1a73fe9bd0bead68078baa8fe4898a803c1
2018-01-10 11:17:58 -05:00
Nicholas Nethercote 96045fda51 Bug 1382955 (part 3) - Remove a bunch of unused HAL stuff. r=gsvelto,kanru. 2017-08-02 10:09:32 +10:00
Nicholas Nethercote a6f655a6c9 Bug 1382955 (part 2) - Remove nsIPowerManagerService::{powerOff,reboot,restart} and related things. r=gsvelto. 2017-08-02 10:09:26 +10:00
Nicholas Nethercote f5c5231809 Bug 1382955 (part 1) - Remove MozPowerManager and related things. r=bz,gsvelto.
This includes the FactoryReset stuff.
2017-08-02 10:04:36 +10:00
Sylvestre Ledru 4e9cf83ee8 Bug 1378712 - Remove all trailing whitespaces r=Ehsan
MozReview-Commit-ID: Kdz2xtTF9EG

--HG--
extra : rebase_source : 7235b3802f25bab29a8c6ba40a181a722f3df0ce
2017-07-06 14:00:35 +02:00
Andrea Marchesini 44e8750e68 Bug 1366356 - Decrease the process priority of content processes that are not running a foreground tab - part 2 - enabled if the platform specific code is ready, r=smaug 2017-06-07 09:59:00 +02:00
Andrea Marchesini 9efa4e6493 Bug 1368029 - Remove LRU priority support from ProcessPriorityManager, r=gsvelto 2017-05-26 17:50:17 +02:00
Makoto Kato 5d1c119c16 Bug 1350169 - Part 2. Remove Alarm API backend from HAL. r=gsvelto
By bug 130884, we removed alarm API, so we should remove alarm backend from HAL.

MozReview-Commit-ID: EBiMJSUfUHu

--HG--
extra : rebase_source : d8c7b3592377702e789ccb1402124f1ecf2cdc01
2017-03-24 10:45:10 +09:00
Ehsan Akhgari 48c08aeda9 Bug 1342636 - Part 1: Factor out the fallback screen configuration code into a shared header; r=kanru 2017-03-10 21:28:57 -05:00
Tom Tromey 5f8f360823 Bug 1060419 - make log_print use Printf.h, r=froydnj
MozReview-Commit-ID: BIZ1GQEZ1vs

--HG--
extra : rebase_source : 2f1f0aa12493c44f352d9a7e8683e7bb72d2d75b
2016-12-15 20:16:31 -07:00
Michelangelo De Simone baf56b1218 Bug 1315798 - Remove FMRADIO support from HAL. r=mds
MozReview-Commit-ID: E6KGgMd8Cfg

--HG--
extra : rebase_source : 8d2117367c70ba8e30cc210805135e52dc9ff27b
2016-11-07 14:09:57 -08:00
Ehsan Akhgari d05eb37eea Bug 1299493 - Remove Navigator.get/hasFeature(); r=baku 2016-08-31 18:02:46 -04:00
Thomas Zimmermann 27283de2b8 Bug 1232687: Add system-service interface to HAL, r=gsvelto
The new HAL interface allows for starting, stopping, and querying
the status of system services. How these operations are performed
depends on the underlying system.

The current implementation for Gonk already contains a workaround
from Bluetooth, where quickly restarted system services require a
cool-down time between retrys.
2016-01-04 16:08:21 +01:00
William Chen 6d6411c090 Bug 1131470 - Part 2: Update screen configuration HAL to report orientation angle. r=snorp,mwu
--HG--
extra : rebase_source : c6eb4dd4f54b1e9db7e7d2c39e535ba4bcd8af1f
2015-08-18 14:55:15 -07:00
William Chen 3c9928ced9 Bug 1131470 - Part 1: Rename existing use of ScreenOrientation to ScreenOrientationInternal. r=baku
--HG--
extra : rebase_source : 72e978d48e8356da9e8c66adfa0a97983034aa5a
2015-08-18 14:55:09 -07:00
Birunthan Mohanathas a8939590de Bug 1182996 - Fix and add missing namespace comments. rs=ehsan
The bulk of this commit was generated by running:

  run-clang-tidy.py \
    -checks='-*,llvm-namespace-comment' \
    -header-filter=^/.../mozilla-central/.* \
    -fix
2015-07-13 08:25:42 -07:00
Sotaro Ikeda e2d6f1ea99 Bug 1091037 - Raise ImageBridge thread priority r=gsvelto,nical 2015-05-07 06:53:47 -07:00
Kyle Machulis 358e55b5b7 Bug 852944 - Gamepad API IPC; r=ted, r=baku
--HG--
extra : rebase_source : 34ca0c1e1b7fcc312b5d7c97d5bd2086af2bc7ce
2015-04-23 15:05:29 -07:00
Gabriele Svelto 243ffd8828 Bug 892371 - Adjust oom_score_adj values for foreground processes according to an LRU policy. r=dhylands, r=khuey 2015-02-25 09:37:38 +01:00
Gabriele Svelto 1f8afa872a Bug 1119277 - Remove the process CPU priority parameter and simplify all the associated code. r=khuey, r=dhylands 2015-02-26 12:43:22 +01:00
Michael Wu 9ebcb66989 Bug 1075727 - Return success/failure in hal::EnableRDS, r=dhylands 2014-10-14 15:16:22 -04:00
Michael Wu 846b6645bf Bug 1041085 - FM RDS support in HAL, r=dhylands 2014-06-26 05:07:23 -04:00
Michael Wu 610334f023 Backed out changeset d1ad5d5bc00f (Bug 1041085) for red 2014-09-30 13:43:22 -04:00
Michael Wu 86e3b61ea2 Bug 1041085 - FM RDS support in HAL, r=dhylands 2014-06-26 05:07:23 -04:00
Gabriele Svelto eee9e26b8b Bug 1047277 - Hide HAL's logging macros from the public headers and convert all components to use them. r=dhylands 2014-09-24 15:23:18 +02:00
Fabrice Desré bb4f218464 Bug 1037212 - [Flame] Phone is not completely erased when a ringtone is set from the Music App r=dougt,dhylands,khuey 2014-07-17 18:30:47 -07:00
Kershaw Chang 83e7e18fc5 Bug 964154 - To Detect Whether Headset Event is Came from Input Dev or /sys Node in Runtime Not by Property. r=dhylands 2014-07-01 19:52:00 +02:00
Kilik Kuo 7fde2154a4 Bug 1017463 - Remove SetLight / GetLight from PHal.ipdl. r=dhylands 2014-06-11 18:17:23 +08:00
Sean Lin 08364d3403 Bug 911242 - [LED] De-couple the control of screen backlight and keyboard backlight. r=dhylands, sr=sicking 2014-05-30 11:11:23 +08:00