[EXPERIMENTAL] Enable Mirroring from any device

Status
Not open for further replies.
Search This thread

r3pwn

Inactive Recognized Developer
Jul 11, 2012
1,749
2,052
r3pwn.com
Hello, fellow XDA members!
Some of you may have heard of me before, and for the ones that haven't, let this be a warm introduction.
After hearing of the new Chromecast app with Beta support for mirroring, I decided to see if it's possible to enable for all devices. Apparently it is! :D
I assumed that some devices just wouldn't stream well, so I decided to mark this as [EXPERIMENTAL]. Please note that I did not make the feature, just the method to enable it.
Please alsenote that you need the latest version of the Chromecast companion app and root access on your device (not your chromecast) for this to work properly. The mirroring functionality requires KitKat 4.4.2 or higher.

Please note that under certain circumstances, some Samsung tabs may bootloop due to this modification. To be safe, do not enable the second option unless you ABSOLUTELY need to.

If this worked for you and you want to send some money my way (Keep in mind that I didn't make the mirroring, only the hack to enable it), feel free to visit my PayPal donation link in my signature. :)


For those STILL having issues,
Check /system/lib/hw directory for the file "audio.r_submix.default.so".
If it doesn't exist, ask your device maintainer to add audio.r_submix.default to
the product_packages in the device.mk file. (You may not know what it means, but they will.)
EXAMPLE (Thanks, @runandhide05!):
http://review.teameos.org/#/c/389/

(Thanks, @hwong96.)

What exactly is required for this to work?
(This is the technical aspect of getting mirroring to work)

(Straight from Google)
* The WiFi radio must support WiFi P2P.
* The WiFi radio must support concurrent connections to the WiFi display and to an access point.
* The Audio Flinger audio_policy.conf file must specify a rule for the "r_submix" remote submix module. This module is used to record and stream system audio output to the WiFi display encoder in the media server.
* The remote submix module "audio.r_submix.default" must be installed on the device.
* The device must be provisioned with HDCP keys (for protected content).


LINK: (v7)
https://www.androidfilehost.com/?fid=95784891001616583

Here are all of the previous releases: http://www.androidfilehost.com/?a=show&w=files&flid=16506

Changelog:

v7
- Lollipop support
- Bug fixes
- This modification now works on ALL devices KitKat and up. (Including x86, hopefully)
- Mirroring might work better on Lollipop. We only learn by testing, right?

v6
- Bug fix with sqlite3

v5
- Added PurpleHoloLight Theme!
- Added an audio remote submix file check.

v4
- Fixed critical bugs

v3
- Added fix that may work for some
- Added " QuickSettings Mirror Tile" option

v2
- Added preinstalled sqlite3 binaries
- Fixed critical bugs

v1
- Initial release



Please note that I tried to provide a safe, universal fix, but unfortunately, this may STILL not work on some devices. If it does not work for you, let me know and I will try to fix it (again). :)
Please note that this has the potential to mess up audio on your device, but it creates a backup that you can restore from by "Disabling" the fix.


For the paranoid:
Source can be found here: https://github.com/r3pwn/MirrorEnabler

Tested Working:

(Aside from the officially supported devices)
Amazon Kindle Fire HD 8.9"
Amazon Kindle Fire HD 7" (BeanStalk ROM only)
ASUS PadFone X
ASUS PadFone 2
Nook HD+ (as of v4) (ROM MUST HAVE APPLIED FIX, CHECK ABOVE)
Droid RAZR MAXX HD
Droid RAZR M
Sony Xperia Z
Sony Xperia Z Ultra
Sony Xperia Z1
Sony Xperia Z1 Tablet
Sony Xperia Z1 Compact
Sony Xperia Z2
Sony Xperia Z2 Tablet
Sony Xperia ZL
Huawei Honor 3C
HTC One M8 (Including GPE)
HTC Droid DNA (as of v4) (ROM MUST HAVE APPLIED FIX, CHECK ABOVE IN RED)
Motorola Moto X
Motorola Moto X (2014)
Motorola Moto G
Motorola Moto G (2014)
Samsung Galaxy S II (as of v4) (ROM MUST HAVE APPLIED FIX, CHECK ABOVE)
Samsung Galaxy S III (as of v4) (ROM MUST HAVE APPLIED FIX, CHECK ABOVE)
Samsung Galaxy S IV Mini
Samsung Galaxy Note II (as of v4) (ROM MUST HAVE APPLIED FIX, CHECK ABOVE IN RED)
Samsung Note 8 Tab
Samsung Note 10.1 Tab
Samsung Note Pro 12.2 Tab
Samsung Galaxy Tab 2 (as of v4) (ROM MUST HAVE APPLIED FIX, CHECK ABOVE)
Samsung Galaxy Tab Pro 8.4
Samsung Galaxy Tab S 10.5
Samsung Galaxy Tab 4
Nexus 7 2012
Galaxy Nexus (as of v4) (ROM MUST HAVE APPLIED FIX, CHECK ABOVE IN RED)
Oppo Find 7
Oppo Find 7a
OnePlus One
LG GPad 8.3 (ONLY ON V6)
LG G2 Mini (ONLY ON V6)
LG Optimus G (ONLY ON V6)
LG G Flex (ONLY ON V6)
Xiaomi Mi2
Sero 7 Pro (as of v4) (ROM MUST HAVE APPLIED FIX, CHECK ABOVE)
And possibly your smartphone/tablet! Test it out and let me know!


Tested Not Working:

HTC EVO 3D
Droid 4
Samsung Galaxy S I
Most older devices
Devices with a Tegra SoC (not sure why)


TO THOSE WITH PLAY SERVICES FORCE CLOSE:
A fix is out (v4). Thank these guys:
@alex3305
@pabx
@mattgyver83

ROMs that allow Screen Mirroring


To enable Chromecast Mirroring on a TouchWiz ROM, follow the guide below:
(For SAMSUNG Devices ONLY!)
Go to system/etc/wfdconfig.xml
Find the following lines:*

Code:
1*(Change this 1 to a 0 and reboot)
WFD_HDCP_2_1 
6789
0 


0

For those with audio issues after applying the Force-Close Fix:

DISABLE THE SECOND OPTION IN MIRRORENABLER FIRST!
I'll explain it in a way so you can edit the audio_policy.conf file yourself. The audio_policy.conf file is unique to each model in a manufacturer's lineup and between manufacturers. That is due to the different audio hardware installed on the device. It is more prevalent in older devices, not so much in newer devices. The force close fix option #2 in MirrorEnabler is more of a generic fix.

If you are up to the challenge, here are the steps to edit your own audio_policy.conf file-
1. If you applied option #2 in MirrorEnabler, de-select and reboot device to reset the manufacturer audio_policy.conf file.
2. Make a backup of the manufacturer's audio_policy.conf file in the event you need to restore it.
3. Open your audio_policy.conf file.
4. Open the this pdf file and copy the red highlighted words from the global configuration section. Paste into your global configuration section as shown. Make sure to include the pipe.
5. Copy the r_submix section highlighted in red and paste into your file as shown. You should have 4 }s at the end. Sampling rate should be 48000.
6. Save your file.
7. Reboot.

Use MirrorEnabler without selecting option #2. You no longer need it if you edit your own audio_policy.conf file.

You now have your device manufacturer's audio_policy.conf file with the audio.r_submix module added. You still need to make sure the audio.r_submix.default.so is baked into the rom. Look in /system/lib/hw. On newer devices look in /system/lib for libaudio.r_submix.default.so.

Not much more I can say.
 
Last edited:

r3pwn

Inactive Recognized Developer
Jul 11, 2012
1,749
2,052
r3pwn.com
My S3 running quantum makes the attempt but then it said "Google services has stopped" then just says disconnecting.

AT&T Samsung Galaxy S III
Sounds like it *might* be a hardware limitation. I don't know how to help, sorry. :(
Does it still have to be running at least 4.4.1?


Sent from my iPhone using Tapatalk
I have honestly no idea. All of my android devices are running KitKat, so I wouldn't even be able to test. My guess is probably, but you can feel free to go ahead and give it a shot.
 

dsEVOlve

Senior Member
Sep 2, 2010
382
108
Just tested on Verizon M8 running Skyfall ROM (almost stock) and works pretty well. There was a little lag in places but not bad for an "experimental" workaround.

Thanks!
 
  • Like
Reactions: r3pwn

bjcoenen

Senior Member
Feb 13, 2011
91
80
Wisconsin
You are a god

HEY MAN YOU JUST MADE MY YEAR. I have been stuck on terrible TouchWiz Stock Roms on my Galaxy Note 2 for the past 1.5 years because I use my screen mirroring with allshare cast dongle a lot. I have been trying EVERYTHING to get screen mirroring or cast screen to work on this device for over a year. When I heard it worked on the CCast I pulled out my Nexus 7 2013 and it instantly work perfectly. I was so bummed when I saw the Note 2 was not on the list of supported devices. I just installed your app then the sqlite binary from the playstore and used that to install the binary. Then enabled your app, launched chromecast and am now mirroring my screen FLAWLESSLY on my US Cellular SCH-R950 t0lteusc Note 2 using stock rooted deodexed 4.4.2 TW rom and latest agni-kernel. YOU ARE THE MAN. Seriously, thank you so much. Seriously. You have freed me from the samsung prison.
 

r3pwn

Inactive Recognized Developer
Jul 11, 2012
1,749
2,052
r3pwn.com
HEY MAN YOU JUST MADE MY YEAR. I have been stuck on terrible TouchWiz Stock Roms on my Galaxy Note 2 for the past 1.5 years because I use my screen mirroring with allshare cast dongle a lot. I have been trying EVERYTHING to get screen mirroring or cast screen to work on this device for over a year. When I heard it worked on the CCast I pulled out my Nexus 7 2013 and it instantly work perfectly. I was so bummed when I saw the Note 2 was not on the list of supported devices. I just installed your app then the sqlite binary from the playstore and used that to install the binary. Then enabled your app, launched chromecast and am now mirroring my screen FLAWLESSLY on my US Cellular SCH-R950 t0lteusc Note 2 using stock rooted deodexed 4.4.2 TW rom and latest agni-kernel. YOU ARE THE MAN. Seriously, thank you so much. Seriously. You have freed me from the samsung prison.
Thank you for your enthusiasm! :)
I went ahead and added the Note 2 to the OP.
EDIT: Perfect timing, too!
epumepez.jpg
 
Last edited:

bhiga

Inactive Recognized Contributor
Oct 13, 2010
2,501
1,018
Great find!!

AT&T Samsung Galaxy S3, KitKat 4.4.2 stock rooted.
Works, but with no audio.

Overall performance is pretty good. It seems just a tiny bit slower than AllShare Cast (to AllShare Wireless Hub), I'd say 0.5 sec lag on Chromecast vs 0.5 sec lag on AllShare Cast.

Video playback of local content using the stock video player seems very comparable to AllShare Cast - in fact, I can barely tell the difference aside from the lack of audio on Chromecast playback. I wouldn't be surprised if they share the same base with just slight tweaks.

Chromecast seems to be a bit more tolerant of other network operations compared to AllShare Cast.

I'm very impressed by the quality of mirroring. If the audio worked, I'd be very tempted to use Chromecast mirroring over AllShare Cast.
 
  • Like
Reactions: r3pwn

AMNB

New member
May 10, 2014
2
1
I have just test it with Galaxy S4 running CyanogenMod 11 M8 the video is perfect but the sound something wrong with it like a baby sound :laugh:
 
  • Like
Reactions: r3pwn

Idan73

Senior Member
Jul 19, 2010
2,770
749
Working on note 8 wifi tab. A bit slower than sgs5 and LG g2. Otherwise perfect ?. Not really for games, because of that lag, but great for just general stuff.

Sent from my SM-G900W8
 
  • Like
Reactions: r3pwn

joethc

Senior Member
Apr 21, 2007
110
38
I was super excited to see this ....Note 2 running todays Omnirom 4.4.4 and the latest pa gapps....google play services FC's no luck for me....I reflashed to disable koush's (useless for note2) mirror and xposed....still no luck. tempted to flash stock
 
Status
Not open for further replies.

Top Liked Posts

  • There are no posts matching your filters.
  • 505
    Hello, fellow XDA members!
    Some of you may have heard of me before, and for the ones that haven't, let this be a warm introduction.
    After hearing of the new Chromecast app with Beta support for mirroring, I decided to see if it's possible to enable for all devices. Apparently it is! :D
    I assumed that some devices just wouldn't stream well, so I decided to mark this as [EXPERIMENTAL]. Please note that I did not make the feature, just the method to enable it.
    Please alsenote that you need the latest version of the Chromecast companion app and root access on your device (not your chromecast) for this to work properly. The mirroring functionality requires KitKat 4.4.2 or higher.

    Please note that under certain circumstances, some Samsung tabs may bootloop due to this modification. To be safe, do not enable the second option unless you ABSOLUTELY need to.

    If this worked for you and you want to send some money my way (Keep in mind that I didn't make the mirroring, only the hack to enable it), feel free to visit my PayPal donation link in my signature. :)


    For those STILL having issues,
    Check /system/lib/hw directory for the file "audio.r_submix.default.so".
    If it doesn't exist, ask your device maintainer to add audio.r_submix.default to
    the product_packages in the device.mk file. (You may not know what it means, but they will.)
    EXAMPLE (Thanks, @runandhide05!):
    http://review.teameos.org/#/c/389/

    (Thanks, @hwong96.)

    What exactly is required for this to work?
    (This is the technical aspect of getting mirroring to work)

    (Straight from Google)
    * The WiFi radio must support WiFi P2P.
    * The WiFi radio must support concurrent connections to the WiFi display and to an access point.
    * The Audio Flinger audio_policy.conf file must specify a rule for the "r_submix" remote submix module. This module is used to record and stream system audio output to the WiFi display encoder in the media server.
    * The remote submix module "audio.r_submix.default" must be installed on the device.
    * The device must be provisioned with HDCP keys (for protected content).


    LINK: (v7)
    https://www.androidfilehost.com/?fid=95784891001616583

    Here are all of the previous releases: http://www.androidfilehost.com/?a=show&w=files&flid=16506

    Changelog:

    v7
    - Lollipop support
    - Bug fixes
    - This modification now works on ALL devices KitKat and up. (Including x86, hopefully)
    - Mirroring might work better on Lollipop. We only learn by testing, right?

    v6
    - Bug fix with sqlite3

    v5
    - Added PurpleHoloLight Theme!
    - Added an audio remote submix file check.

    v4
    - Fixed critical bugs

    v3
    - Added fix that may work for some
    - Added " QuickSettings Mirror Tile" option

    v2
    - Added preinstalled sqlite3 binaries
    - Fixed critical bugs

    v1
    - Initial release



    Please note that I tried to provide a safe, universal fix, but unfortunately, this may STILL not work on some devices. If it does not work for you, let me know and I will try to fix it (again). :)
    Please note that this has the potential to mess up audio on your device, but it creates a backup that you can restore from by "Disabling" the fix.


    For the paranoid:
    Source can be found here: https://github.com/r3pwn/MirrorEnabler

    Tested Working:

    (Aside from the officially supported devices)
    Amazon Kindle Fire HD 8.9"
    Amazon Kindle Fire HD 7" (BeanStalk ROM only)
    ASUS PadFone X
    ASUS PadFone 2
    Nook HD+ (as of v4) (ROM MUST HAVE APPLIED FIX, CHECK ABOVE)
    Droid RAZR MAXX HD
    Droid RAZR M
    Sony Xperia Z
    Sony Xperia Z Ultra
    Sony Xperia Z1
    Sony Xperia Z1 Tablet
    Sony Xperia Z1 Compact
    Sony Xperia Z2
    Sony Xperia Z2 Tablet
    Sony Xperia ZL
    Huawei Honor 3C
    HTC One M8 (Including GPE)
    HTC Droid DNA (as of v4) (ROM MUST HAVE APPLIED FIX, CHECK ABOVE IN RED)
    Motorola Moto X
    Motorola Moto X (2014)
    Motorola Moto G
    Motorola Moto G (2014)
    Samsung Galaxy S II (as of v4) (ROM MUST HAVE APPLIED FIX, CHECK ABOVE)
    Samsung Galaxy S III (as of v4) (ROM MUST HAVE APPLIED FIX, CHECK ABOVE)
    Samsung Galaxy S IV Mini
    Samsung Galaxy Note II (as of v4) (ROM MUST HAVE APPLIED FIX, CHECK ABOVE IN RED)
    Samsung Note 8 Tab
    Samsung Note 10.1 Tab
    Samsung Note Pro 12.2 Tab
    Samsung Galaxy Tab 2 (as of v4) (ROM MUST HAVE APPLIED FIX, CHECK ABOVE)
    Samsung Galaxy Tab Pro 8.4
    Samsung Galaxy Tab S 10.5
    Samsung Galaxy Tab 4
    Nexus 7 2012
    Galaxy Nexus (as of v4) (ROM MUST HAVE APPLIED FIX, CHECK ABOVE IN RED)
    Oppo Find 7
    Oppo Find 7a
    OnePlus One
    LG GPad 8.3 (ONLY ON V6)
    LG G2 Mini (ONLY ON V6)
    LG Optimus G (ONLY ON V6)
    LG G Flex (ONLY ON V6)
    Xiaomi Mi2
    Sero 7 Pro (as of v4) (ROM MUST HAVE APPLIED FIX, CHECK ABOVE)
    And possibly your smartphone/tablet! Test it out and let me know!


    Tested Not Working:

    HTC EVO 3D
    Droid 4
    Samsung Galaxy S I
    Most older devices
    Devices with a Tegra SoC (not sure why)


    TO THOSE WITH PLAY SERVICES FORCE CLOSE:
    A fix is out (v4). Thank these guys:
    @alex3305
    @pabx
    @mattgyver83

    ROMs that allow Screen Mirroring


    To enable Chromecast Mirroring on a TouchWiz ROM, follow the guide below:
    (For SAMSUNG Devices ONLY!)
    Go to system/etc/wfdconfig.xml
    Find the following lines:*

    Code:
    1*(Change this 1 to a 0 and reboot)
    WFD_HDCP_2_1 
    6789
    0 
    
    
    0

    For those with audio issues after applying the Force-Close Fix:

    DISABLE THE SECOND OPTION IN MIRRORENABLER FIRST!
    I'll explain it in a way so you can edit the audio_policy.conf file yourself. The audio_policy.conf file is unique to each model in a manufacturer's lineup and between manufacturers. That is due to the different audio hardware installed on the device. It is more prevalent in older devices, not so much in newer devices. The force close fix option #2 in MirrorEnabler is more of a generic fix.

    If you are up to the challenge, here are the steps to edit your own audio_policy.conf file-
    1. If you applied option #2 in MirrorEnabler, de-select and reboot device to reset the manufacturer audio_policy.conf file.
    2. Make a backup of the manufacturer's audio_policy.conf file in the event you need to restore it.
    3. Open your audio_policy.conf file.
    4. Open the this pdf file and copy the red highlighted words from the global configuration section. Paste into your global configuration section as shown. Make sure to include the pipe.
    5. Copy the r_submix section highlighted in red and paste into your file as shown. You should have 4 }s at the end. Sampling rate should be 48000.
    6. Save your file.
    7. Reboot.

    Use MirrorEnabler without selecting option #2. You no longer need it if you edit your own audio_policy.conf file.

    You now have your device manufacturer's audio_policy.conf file with the audio.r_submix module added. You still need to make sure the audio.r_submix.default.so is baked into the rom. Look in /system/lib/hw. On newer devices look in /system/lib for libaudio.r_submix.default.so.

    Not much more I can say.
    77
    NOOOOO!!!!!!!! Well, anyways, it was fun! It was good getting to meet and help each and every one of you! Happy Holidays! In order to preserve the research that everyone contributed and in order to end this thread on a happy note, I declare this thread locked. Sweet dreams, #MirrorEnabler. May you rest in peace. :)
    21
    Can you stream properly? If so, please be sure to hit that thanks button and tell all of your buddies!
    10
    For the curious: a fix is incoming soon(v3), it will not work on the HTC One M8 on stock (it will work on CM). It fixes the Google Play Services Force Close issues once and for all!
    Oh, it might also have a little surprise. :) Stay tuned.
    8
    Unfortunately, it seems, even after all of the logcats and testers (thank you, by the way), fixing the Play Services force-close is beyond my current knowledge. To those with the Play Services force-close, I apologize for the inconvenience and hope you all get it resolved. :)