Closed Bug 1374959 Opened 8 years ago Closed 8 years ago

(photon) Support detecting Australis/Photon at runtime in Java frontend

Categories

(Firefox for Android Graveyard :: General, enhancement)

enhancement
Not set
normal

Tracking

(firefox56 fixed)

RESOLVED FIXED
Firefox 56
Tracking Status
firefox56 --- fixed

People

(Reporter: jwu, Assigned: jwu)

References

Details

Attachments

(1 file)

We would like to detect current skin is Australis or Photon at runtime, then we can do something like this: ``` if (isPhotonSkin()) { ... // Display Photon specific visual refresh. } else { ... // Execute original visual behavior. } ``` The benefit of this change is that we can keep single Java source for both Australis and Photon. This branch should only live in 56 and will be removed after Photon is ready. Also this detection method should be both work on mach and gradle: 1. for mach, we use `--enable-photon` to enable Photon, the Java source should also aware of this config, and 2. for gradle, we use ProductFlavor to switch Australis and Photon, the Java source should have same behavior according to it.
Assignee: nobody → topwu.tw
Comment on attachment 8879878 [details] Bug 1374959 - Support skin(Australis/Photon) detection at runtime. https://reviewboard.mozilla.org/r/151284/#review156150 We are eventually moving all of these into BuildConfig. Nick may has a plan for it. To me it's a work around for Photon. But we can use a follow up bug to remove it after above happend.
Attachment #8879878 - Flags: review?(cnevinchen) → review+
Comment on attachment 8879878 [details] Bug 1374959 - Support skin(Australis/Photon) detection at runtime. https://reviewboard.mozilla.org/r/151284/#review156250
Attachment #8879878 - Flags: review?(max) → review+
Comment on attachment 8879878 [details] Bug 1374959 - Support skin(Australis/Photon) detection at runtime. https://reviewboard.mozilla.org/r/151284/#review156276 I'm fine with this as is, but in general, we want to be strongly informed by what the Gradle standard is. In this case, `skin` is a Gradle `flavorDimension`, which turns up in the (Gradle-only) generated build configuration as a `String FLAVOR_skin`, like: ``` /** * Automatically generated file. DO NOT MODIFY */ package org.mozilla.gecko; public final class BuildConfig { public static final boolean DEBUG = false; public static final String APPLICATION_ID = "org.mozilla.fennec_nalexander"; public static final String BUILD_TYPE = "release"; public static final String FLAVOR = "officialAustralis"; public static final int VERSION_CODE = 2015495284; public static final String VERSION_NAME = "56.0a1"; public static final String FLAVOR_audience = "official"; public static final String FLAVOR_skin = "australis"; // Fields from default config. public static final String BUILD_DIR = "/Users/nalexander/Mozilla/gecko/objdir-droid-compile/gradle/build/mobile/android/app"; } ``` So the integers you defined are, in my opinion "better" -- but it'll be harder to get rid of `SkinConfig` and just switch on `BuildConfig.FLAVOR_skin` in the future. As I say, roll on -- but please figure out what Gradle does for these types of questions, or work with me to figure it out, so that we keep the path to "all Gradle, all the time" open.
Attachment #8879878 - Flags: review?(nalexander) → review+
Two reasons we choose this solution: 1. So far We still have to support both mach and gradle, but mach doesn't recognize BuildConfig and constant values in AppConstants don't change when we switch between different flavors. If we just have to support gradle in the future, BuildConig will be the best choice. 2. This runtime detection is just a workaround to support both Australis and Photon, `SkinConfig` should be removed ASAP when we don't have to support Australis. Use two simple Java files might cost least effort that I can think of.
Keywords: checkin-needed
Comment on attachment 8879878 [details] Bug 1374959 - Support skin(Australis/Photon) detection at runtime. https://reviewboard.mozilla.org/r/151284/#review156558
Attachment #8879878 - Flags: review?(walkingice0204) → review+
Pushed by ryanvm@gmail.com: https://hg.mozilla.org/integration/autoland/rev/62908c27accf Support skin(Australis/Photon) detection at runtime. r=maliu,nalexander,nechen,walkingice
Keywords: checkin-needed
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 56
No longer depends on: fennec-photon
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: