Hey folks,
You're probably all used to this pattern:
if (Build.VERSION.SDK_INT >= 11) {
window.getDecorView().setSystemUiVisibility(fullscreen ? 1
: 0);
}
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
Telemetry.sendUIEvent(TelemetryContract.Event.ACTION,
TelemetryContract.Method.CONTEXT_MENU, "subscribe");
}
to have different code run on different Android releases.
We're working in Bug 1039789 towards having different APKs serving different
device classes. That includes filtering on different Android OS releases.
When we build an APK that targets, say, only API 9, we can know *at compile
time* whether many of these conditions are true -- the APK cannot possibly be
installed on a device outside the supported APK range, so we don't even need to
do the runtime check. That allows javac and ProGuard to delete dead code, which
is a good thing.
In Bug 1042383 I just introduced AppConstants.Versions to do just that. This
includes flags for every kind of version check we have in the codebase, phrased
idiomatically. Use these instead of the above:
if (Versions.feature11Plus) {
if (Versions.preHC) {
I already fixed up existing uses*, so just remember these for new code!
Let me know if you have any questions.
Thanks,
-R
* (AppConstants is currently built in a later tier than utils/, so that
directory hasn't been fixed up. Later!)
_______________________________________________
mobile-firefox-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/mobile-firefox-dev