So this received a mask (say portrait-primary | portrait-secondary) and we might be in portrait-secondary but the result will be portrait-primary as the method assumed that you can just return the first match. ie. the method doesn't return the correct result.

We need to simplify this patch. Like let the first version implement just the lock and unlock methods and then we can do the onorientationchange and orientation getter in a separate patch.

There are so many details here that gets lost in review due to the patch size.