Bug 766904 - Make sure unlockOrientation() is a no-op if the orientation wasn't locked. r=blassey

This commit is contained in:
Mounir Lamouri 2012-06-22 10:55:17 +02:00
parent fb4c641aae
commit 94eb49d211

View File

@ -36,6 +36,8 @@ public class GeckoScreenOrientationListener
static public final short eScreenOrientation_LandscapeSecondary = 8;
static public final short eScreenOrientation_Landscape = 12;
static private final short kDefaultScreenOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
private short mOrientation;
private OrientationEventListenerImpl mListener = null;
@ -150,6 +152,7 @@ public class GeckoScreenOrientationListener
break;
default:
Log.e(LOGTAG, "Unexpected value received! (" + aOrientation + ")");
return;
}
GeckoApp.mAppContext.setRequestedOrientation(orientation);
@ -157,7 +160,11 @@ public class GeckoScreenOrientationListener
}
public void unlockScreenOrientation() {
GeckoApp.mAppContext.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
if (GeckoApp.mAppContext.getRequestedOrientation() == kDefaultScreenOrientation) {
return;
}
GeckoApp.mAppContext.setRequestedOrientation(kDefaultScreenOrientation);
updateScreenOrientation();
}
}