Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Bug 787532 - Update Android HAL backend to take into account new scre…
Browse files Browse the repository at this point in the history
…en lock values. r=jlebar
  • Loading branch information
mounirlamouri committed Sep 11, 2012
1 parent 203d87d commit 8aefc62
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
15 changes: 13 additions & 2 deletions hal/android/AndroidHal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,19 @@ LockScreenOrientation(const ScreenOrientation& aOrientation)
return false;
}

bridge->LockScreenOrientation(aOrientation);
return true;
switch (aOrientation) {
// The Android backend only supports these orientations.
case eScreenOrientation_PortraitPrimary:
case eScreenOrientation_PortraitSecondary:
case eScreenOrientation_Portrait:
case eScreenOrientation_LandscapePrimary:
case eScreenOrientation_LandscapeSecondary:
case eScreenOrientation_Landscape:
bridge->LockScreenOrientation(aOrientation);
return true;
default:
return false;
}
}

void
Expand Down
6 changes: 4 additions & 2 deletions widget/gonk/OrientationObserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,10 @@ OrientationObserver::DisableAutoOrientation()
bool
OrientationObserver::LockScreenOrientation(ScreenOrientation aOrientation)
{
MOZ_ASSERT(eScreenOrientation_None < aOrientation &&
aOrientation < eScreenOrientation_EndGuard);
MOZ_ASSERT(aOrientation | (eScreenOrientation_PortraitPrimary |
eScreenOrientation_PortraitSecondary |
eScreenOrientation_LandscapePrimary |
eScreenOrientation_LandscapeSecondary));

// Enable/disable the observer depending on 1. multiple orientations
// allowed, and 2. observer enabled.
Expand Down

0 comments on commit 8aefc62

Please sign in to comment.