Bug 1321638 - Part 1: Remove "app.orientation.default". r=jchen
This was added for the Android Web App Runtime in
Bug 776600. If it
was ever used, it's definitely not now. In addition, fishing the
default orientation from Gecko prefs in a constructor that is
implicitly called from a static singleton initializer is unreliable,
so this probably was never robust. The comments on the ticket say as
much.
MozReview-Commit-ID: E8oz7JsB6oB
--- a/mobile/android/app/mobile.js
+++ b/mobile/android/app/mobile.js
@@ -730,20 +730,16 @@ pref("media.plugins.enabled", true);
// 0 = Let Stagefright choose hardware or software decoding (default)
// 8 = Force software decoding
// 16 = Force hardware decoding
pref("media.stagefright.omxcodec.flags", 0);
// Coalesce touch events to prevent them from flooding the event queue
pref("dom.event.touch.coalescing.enabled", false);
-// default orientation for the app, default to undefined
-// the java GeckoScreenOrientationListener needs this to be defined
-pref("app.orientation.default", "");
-
// On memory pressure, release dirty but unused pages held by jemalloc
// back to the system.
pref("memory.free_dirty_pages", true);
pref("layout.framevisibility.numscrollportwidths", 1);
pref("layout.framevisibility.numscrollportheights", 1);
pref("layers.enable-tiles", true);
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoScreenOrientation.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoScreenOrientation.java
@@ -51,41 +51,22 @@ public class GeckoScreenOrientation {
}
}
return NONE;
}
}
// Singleton instance.
private static GeckoScreenOrientation sInstance;
- // Default screen orientation, used for initialization and unlocking.
- private static final ScreenOrientation DEFAULT_SCREEN_ORIENTATION = ScreenOrientation.DEFAULT;
// Default rotation, used when device rotation is unknown.
private static final int DEFAULT_ROTATION = Surface.ROTATION_0;
- // Default orientation, used if screen orientation is unspecified.
- private ScreenOrientation mDefaultScreenOrientation;
// Last updated screen orientation.
private ScreenOrientation mScreenOrientation;
// Whether the update should notify Gecko about screen orientation changes.
private boolean mShouldNotify = true;
- // Configuration screen orientation preference path.
- private static final String DEFAULT_SCREEN_ORIENTATION_PREF = "app.orientation.default";
-
- public GeckoScreenOrientation() {
- PrefsHelper.getPref(DEFAULT_SCREEN_ORIENTATION_PREF, new PrefsHelper.PrefHandlerBase() {
- @Override public void prefValue(String pref, String value) {
- // Read and update the configuration default preference.
- mDefaultScreenOrientation = screenOrientationFromArrayString(value);
- setRequestedOrientation(mDefaultScreenOrientation);
- }
- });
-
- mDefaultScreenOrientation = DEFAULT_SCREEN_ORIENTATION;
- update();
- }
public static GeckoScreenOrientation getInstance() {
if (sInstance == null) {
sInstance = new GeckoScreenOrientation();
}
return sInstance;
}
@@ -320,20 +301,20 @@ public class GeckoScreenOrientation {
*
* @param aArray
* String containing comma-delimited strings.
*
* @return First parsed Gecko screen orientation.
*/
public static ScreenOrientation screenOrientationFromArrayString(String aArray) {
List<String> orientations = Arrays.asList(aArray.split(","));
- if (orientations.size() == 0) {
+ if ("".equals(aArray) || orientations.size() == 0) {
// If nothing is listed, return default.
Log.w(LOGTAG, "screenOrientationFromArrayString: no orientation in string");
- return DEFAULT_SCREEN_ORIENTATION;
+ return ScreenOrientation.DEFAULT;
}
// We don't support multiple orientations yet. To avoid developer
// confusion, just take the first one listed.
return screenOrientationFromString(orientations.get(0));
}
/*
@@ -356,17 +337,17 @@ public class GeckoScreenOrientation {
return ScreenOrientation.PORTRAIT_SECONDARY;
case "landscape-primary":
return ScreenOrientation.LANDSCAPE_PRIMARY;
case "landscape-secondary":
return ScreenOrientation.LANDSCAPE_SECONDARY;
}
Log.w(LOGTAG, "screenOrientationFromString: unknown orientation string: " + aStr);
- return DEFAULT_SCREEN_ORIENTATION;
+ return ScreenOrientation.DEFAULT;
}
/*
* Convert Gecko screen orientation to Android orientation.
*
* @param aScreenOrientation
* Gecko screen orientation.
* @return Android orientation. This conversion is lossy, the Android