Firefox v35.0.1 with Flash Enabled

Search This thread

AAccount

Senior Member
Sep 8, 2010
1,005
1,909
It's me from the development section. I noticed a little while back that starting firefox 29, our device is explicitly blacklisted from mozilla not to use the flash plugin. Regardless of whether you're on kitkat or not and whether you installed flash or not firefox will check to see if you're using a tegra2 (and surprise) tegra3 device. If you have one of these, firefox goes out of its way to make sure you don't use flash. In place, it has a cheesy "we're sorry" message. On most kitkat roms flash will not work because you need to compile the rom with -DNEEDS_VECTORIMPL_SYMBOLS . However, this flag is automatically used for our tablet to get the camera driver to load. It would seem like a no-brainer to use flash on our tablet then.

Here's the code that disables flash for us: firefox-source/mobile/android/base/GeckoAppShell.java
Code:
        // An awful hack to detect Tegra devices. Easiest way to do it without spinning up a EGL context.
        [B]boolean[/B] isTegra = (new File("/system/lib/hw/[B]gralloc.tegra.so[/B]")).exists() ||
                          (new File("/system/lib/hw/[B]gralloc.tegra3.so[/B]")).exists();
        if (isTegra) {
            // [COLOR="Red"][B]disable Flash[/B][/COLOR] on Tegra ICS with CM9 and other custom firmware (bug 736421)
            File vfile = new File("/proc/version");
            FileReader vreader = null; ...etc

Not feeling like recompiling firefox fore just those few lines I decided to use apktool to try and remove this function. The smali apktool produces, barely resembles the java code. I think I've managed to bypass the tegra check with this "v2" hack method:
/smali/org/mozilla/gecko/GeckoAppShell.smali
Code:
[Daniel@Daniel5 fennec]$ diff GeckoAppShell.smali.orig GeckoAppShell.smali
4166,4188c4166
<     new-instance v1, Ljava/io/File;
< 
<     const-string v4, "/system/lib/hw/gralloc.tegra.so"
< 
<     invoke-direct {v1, v4}, Ljava/io/File;-><init>(Ljava/lang/String;)V
< 
<     invoke-virtual {v1}, Ljava/io/File;->exists()Z
< 
<     move-result v1
< 
<     [B]if-nez v1, :cond_0[/B]
< 
<     new-instance v1, Ljava/io/File;
< 
<     const-string v4, "/system/lib/hw/gralloc.tegra3.so"
< 
<     invoke-direct {v1, v4}, Ljava/io/File;-><init>(Ljava/lang/String;)V
< 
<     invoke-virtual {v1}, Ljava/io/File;->exists()Z
< 
<     move-result v1
< 
<     [B]if-eqz v1, :cond_2[/B]
---
> 	goto :[B]cond_2[/B]

Here's how I think the new hack works as it does according to the screenshot. I think the first 6 lines check for the tegra2 display driver file. The 6th line says that "if the check returned a non zero value skip to condition 0". I can only assume that a non zero check would indicate the file was found. It's skipping straight to "condition 0" because the original java code had the check for the tegra2 and tegra3 driver in a logical OR. In this case, if the first half of the OR is true, there's no use to check the second half since a minimum of 1 of the halves must be true.

The second half is when the tegra2 driver hasn't been found it will try for the tegra3. **Note these lines are NOT executed if the tegra2 driver was found because of the jump to condition_0 which bypasses these lines.** However, at the end is an interesting "if the result of the search is zero, skip to condition 2". I'm assuming that if both checks failed then condition 2 must be what comes after the "if (isTegra)" in the java code. condition_2 likely skips past the body of that if staement. In that case, I'll have firefox skip right to the chase and directly go to condition 2 without checking. I consider this a more clean hack that removes the check altogether. While not poetic it's efficient.

As to why we shouldn't just stick to firefox 28.0.1... security issues! Each new version of firefox patches up security holes in the previous versions. As much as we like to poke fun at Internet Explorer for swiss cheese security (among other things...), we wouldn't be any better using an old firefox.

Download v30 here
Download v31 here
Download v32 here
Download v32.0.1 here
Download v32.0.3 here

**New**: just pick up your updates from the android file host link.

Screenshot to prove that it works below :cyclops: :
 

Attachments

  • Screenshot_2014-09-11-18-21-48.jpg
    Screenshot_2014-09-11-18-21-48.jpg
    176.6 KB · Views: 755
Last edited:

AAccount

Senior Member
Sep 8, 2010
1,005
1,909
I uploaded the new firefox v31. You must uninstall firefox v30 first since I used a different signing key. I'll stick with the new one for now since I lost the one I used for firefox 30.

Here's the old hack method:

Code:
    .line 1860
    new-instance v1, Ljava/io/File;

    const-string v4, "/system/lib/hw/[B]dont.be.mean.to.tegra2[/B]"

    invoke-direct {v1, v4}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    invoke-virtual {v1}, Ljava/io/File;->exists()Z

    move-User Nameresult v1

    if-nez v1, :cond_0

    new-instance v1, Ljava/io/File;

    const-string v4, "/system/lib/hw/[B]dont.be.mean.to.tegra3[/B]"

    invoke-direct {v1, v4}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    invoke-virtual {v1}, Ljava/io/File;->exists()Z

    move-result v1

It simply changes which files are used to confirm a tegra2 or tegra3 board. The file name changes were intended to be poetic.
 
Last edited:
  • Like
Reactions: Lucas Kado

AAccount

Senior Member
Sep 8, 2010
1,005
1,909
All right everyone. V32 is up. Sorry for the wait. As usual, it uses the same hack mentioned in the first post.
 

AAccount

Senior Member
Sep 8, 2010
1,005
1,909
To those who keep up to date on the thread by new post notifications: firefox v32.0.1 is out. This uses a newer cleaner hack. The new hack is described in the first post. It took me a good 45 mins to come up with that simple solution.

The old hack is still explained in the second post for those who are curious of the difference.
 
Last edited:
  • Like
Reactions: spamam1

SystemDoctor

Senior Member
Apr 30, 2013
309
71
Manila
Is flash automatically enabled after I install this on my tab that already has flash installed or do I need to enable it manually?

Sent from my new ZenFone 5
 

AAccount

Senior Member
Sep 8, 2010
1,005
1,909
It's back guys. Firefox with flash unblocked for v33. I had a few issues with apktool but I'm using a workaround for that. You MUST uninstall the old firefox first for reasons I don't know.

There's a surprise youtube mod yt-sig.apk. It WILL crash play service whenever you watch a video or exit one. That shouldn't be too bad. You can always hit ok. I wouldn't bother trying it if you're on a kitkat rom but if you're on a lollipop rom it may complement the latest dev advances nicely. Let's say if you like it, keep it to yourself. It goes without saying you've gotta uninstall the stock youtube app and may never update it. I probably won't update it because there's little functional changes with each youtube app update.
 

AAccount

Senior Member
Sep 8, 2010
1,005
1,909
Firefox unblocked v34 is up. Unfortunately you have to uninstall v33 first before installing v34. Apktool can no longer rebuild the whole apk. It can still recompile the smali so I just swap out the mozilla supplied classes.dex in the apk for my modified one.

You can still use flash in lollipop.
 

gazleyp

Senior Member
May 1, 2009
180
58
Manchester
Thanks for both apps can't get yt to install even after removed stock one and flash does not always seem to work
 

AAccount

Senior Member
Sep 8, 2010
1,005
1,909
Thanks for both apps can't get yt to install even after removed stock one and flash does not always seem to work

After removing the stock one, try doing adb install and copy the error message to here. For flash make sure you're using this firefox and not the official one. With the newer omni roms I make (latest and 2nd latest) flash should be way more responsive. I uploaded a screen shot to show it in action on a relatively recent omni build of lollipop.

----------------------------------------------------------Added-----------------------------------------------------------
Anyways the new v35.0.1 is up.
 

Attachments

  • Screenshot_2015-02-07-03-40-12.jpg
    Screenshot_2015-02-07-03-40-12.jpg
    239.8 KB · Views: 231
Last edited:
  • Like
Reactions: gazleyp

Top Liked Posts

  • There are no posts matching your filters.
  • 12
    It's me from the development section. I noticed a little while back that starting firefox 29, our device is explicitly blacklisted from mozilla not to use the flash plugin. Regardless of whether you're on kitkat or not and whether you installed flash or not firefox will check to see if you're using a tegra2 (and surprise) tegra3 device. If you have one of these, firefox goes out of its way to make sure you don't use flash. In place, it has a cheesy "we're sorry" message. On most kitkat roms flash will not work because you need to compile the rom with -DNEEDS_VECTORIMPL_SYMBOLS . However, this flag is automatically used for our tablet to get the camera driver to load. It would seem like a no-brainer to use flash on our tablet then.

    Here's the code that disables flash for us: firefox-source/mobile/android/base/GeckoAppShell.java
    Code:
            // An awful hack to detect Tegra devices. Easiest way to do it without spinning up a EGL context.
            [B]boolean[/B] isTegra = (new File("/system/lib/hw/[B]gralloc.tegra.so[/B]")).exists() ||
                              (new File("/system/lib/hw/[B]gralloc.tegra3.so[/B]")).exists();
            if (isTegra) {
                // [COLOR="Red"][B]disable Flash[/B][/COLOR] on Tegra ICS with CM9 and other custom firmware (bug 736421)
                File vfile = new File("/proc/version");
                FileReader vreader = null; ...etc

    Not feeling like recompiling firefox fore just those few lines I decided to use apktool to try and remove this function. The smali apktool produces, barely resembles the java code. I think I've managed to bypass the tegra check with this "v2" hack method:
    /smali/org/mozilla/gecko/GeckoAppShell.smali
    Code:
    [Daniel@Daniel5 fennec]$ diff GeckoAppShell.smali.orig GeckoAppShell.smali
    4166,4188c4166
    <     new-instance v1, Ljava/io/File;
    < 
    <     const-string v4, "/system/lib/hw/gralloc.tegra.so"
    < 
    <     invoke-direct {v1, v4}, Ljava/io/File;-><init>(Ljava/lang/String;)V
    < 
    <     invoke-virtual {v1}, Ljava/io/File;->exists()Z
    < 
    <     move-result v1
    < 
    <     [B]if-nez v1, :cond_0[/B]
    < 
    <     new-instance v1, Ljava/io/File;
    < 
    <     const-string v4, "/system/lib/hw/gralloc.tegra3.so"
    < 
    <     invoke-direct {v1, v4}, Ljava/io/File;-><init>(Ljava/lang/String;)V
    < 
    <     invoke-virtual {v1}, Ljava/io/File;->exists()Z
    < 
    <     move-result v1
    < 
    <     [B]if-eqz v1, :cond_2[/B]
    ---
    > 	goto :[B]cond_2[/B]

    Here's how I think the new hack works as it does according to the screenshot. I think the first 6 lines check for the tegra2 display driver file. The 6th line says that "if the check returned a non zero value skip to condition 0". I can only assume that a non zero check would indicate the file was found. It's skipping straight to "condition 0" because the original java code had the check for the tegra2 and tegra3 driver in a logical OR. In this case, if the first half of the OR is true, there's no use to check the second half since a minimum of 1 of the halves must be true.

    The second half is when the tegra2 driver hasn't been found it will try for the tegra3. **Note these lines are NOT executed if the tegra2 driver was found because of the jump to condition_0 which bypasses these lines.** However, at the end is an interesting "if the result of the search is zero, skip to condition 2". I'm assuming that if both checks failed then condition 2 must be what comes after the "if (isTegra)" in the java code. condition_2 likely skips past the body of that if staement. In that case, I'll have firefox skip right to the chase and directly go to condition 2 without checking. I consider this a more clean hack that removes the check altogether. While not poetic it's efficient.

    As to why we shouldn't just stick to firefox 28.0.1... security issues! Each new version of firefox patches up security holes in the previous versions. As much as we like to poke fun at Internet Explorer for swiss cheese security (among other things...), we wouldn't be any better using an old firefox.

    Download v30 here
    Download v31 here
    Download v32 here
    Download v32.0.1 here
    Download v32.0.3 here

    **New**: just pick up your updates from the android file host link.

    Screenshot to prove that it works below :cyclops: :
    3
    Firefox unblocked v34 is up. Unfortunately you have to uninstall v33 first before installing v34. Apktool can no longer rebuild the whole apk. It can still recompile the smali so I just swap out the mozilla supplied classes.dex in the apk for my modified one.

    You can still use flash in lollipop.
    3
    Firefox v35 unblocked is up.
    3
    Firefox v32.0.3 is up. Uses the v2 hack.
    2
    Hello,

    Are you planning on updating your mod for Firefox 32?
    Yeah. Sometime next week.

    Sent from my GT-I9300