[Galaxy S 4 General] xxjomamaxx:
so here's the deal. trying to start screen mirroring on a rooted device in most cases HDCP will fail to initialize, when this happens screen mirroring will connect then disconnect with an error.

after a lot of research, logging and testing on my device I have found a way to bypass HDCP and also bypass Samsung restriction on allowing screen mirroring without HDCP.

HDCP is not a requirement for screen mirroring but Samsung has programmed the s4 to fail if the HDCP connection is not initialized. I have found that when the phone speaks to the miracast dongle the phone is programmed to force the setting of "Display service Type = HDMI" instead of allowing it to connect as Type = Wifi.

when the phone forces type = HDMI it makes screen mirroring fail if HDCP fails, this is a basic and enforced protocol of HDMI, this results in screen mirroring shutting off if HDCP fails, I believe this is Samsung's attempt to stop people from rooting their phones and also to stop people from using non Samsung dongles.

some people have found ways around this by hacking the HDCP lib files, but in my case this was not possible because I own a Sgh-i337 on mf3 with a locked bootloader.

unfortunately I can't post pictures so I can post my screen mirroring logs, but heres an explanation as to how this was accomplished.

First was to quarantine all Samsung Apps & services that were related to screen mirroring, this was an attempt to get the system to fall back to the native screen mirroring services and not use samsung's implementation.

I locked up:

Com.sec.allsharecastplayer

Com.samsung.shareshot

Samsung watch on

Samsung briefing

Allshare.controlShareService

Allshare.fileShareService

Samsung context provider

All Knox

Samsung MDM app

Allshare.service.mediaShare

Samsung apps

Samsung apps UNA2

Samsung apps widget

Samsung link

Samsung push

next I tried to find out a way to edit the DisplayManagerService's forced type of HDMI to change it to Type = Wifi, unfortunately because I was on Mf3, this couldn't be done.

but I was able to force this option with a build prop edit and surprisingly after all this was done screen mirroring now works.

below I will post copies of my build prop and also the WFDConfig files from /system/ect

---- Build prop :

#

# system.prop for surf

#

rild.libpath=/system/lib/libril-qc-qmi-1.so

ro.sf.lcd_density=480

rild.libargs=-d /dev/smd0

persist.rild.nitz_plmn=

persist.rild.nitz_long_ons_0=

persist.rild.nitz_long_ons_1=

persist.rild.nitz_long_ons_2=

persist.rild.nitz_long_ons_3=

persist.rild.nitz_short_ons_0=

persist.rild.nitz_short_ons_1=

persist.rild.nitz_short_ons_2=

persist.rild.nitz_short_ons_3=

ril.subscription.types=NV,RUIM

DEVICE_PROVISIONED=1

debug.sf.hw=0

debug.composition.7x27A.type=mdp

debug.composition.7x25A.type=mdp

dalvik.vm.heapsize=24m

debug.composition.type=dyn

persist.hwc.mdpcomp.enable=false

service.camera.gpu.enable=0

Debug.Disable.HWC=1

debug.sf.disablehwc=1

ro.display.switch=0

#dyn

# system props for the cne module

#

persist.cne.feature=0

#

# system props for the MM modules

#

media.stagefright.enable-player=true

media.stagefright.enable-meta=true

media.stagefright.enable-scan=true

media.stagefright.enable-http=false

media.stagefright.enable-fma2dp=true

media.stagefright.enable-aac=true

media.stagefright.enable-qcp=true

media.enable-commonsource=true

media.stagefright.enable-rtsp=true

#

# system props for the LPA/TUNNEL

#

lpa.decode=true

tunnel.decode=true

lpa.use-stagefright=true

tunnel.audiovideo.decode=true

#

# system prop for opengles version

#

ro.opengles.version=131072

#

# system props for the data modules

#

ro.use_data_netmgrd=true

persist.data.ds_fmc_app.mode=0

#

# system props for IMS module

#

persist.ims.regmanager.mode=0

#

# system prop for requesting Master role in incoming Bluetooth connection.

#

ro.bluetooth.request.master=true

#

# system prop for Bluetooth FTP profile

#

ro.qualcomm.bluetooth.ftp=true

#

# system prop for Bluetooth SAP profile

#

ro.qualcomm.bluetooth.sap=true

#

# system prop for Bluetooth Auto connect for remote initated connections

#

ro.bluetooth.remote.autoconnect=true

#

#system property for Bluetooth discoverability timeout in seconds

#0: Always discoverable

#debug.bt.discoverable_time=0

#

# System prop to disable strict mode flash on display

#

persist.sys.strictmode.visual=false

#

# System prop to enable/disable OMH. Enabled by default

#

persist.omh.enabled=1

#System prop to enable ehrpd capability

ro.config.ehrpd=true

# System property for cabl

ro.qualcomm.cabl=0

#

#System prop to determine availability of

#analog fm path

#

ro.fm.analogpath.supported=true

#

#System property for FM transmitter

#

ro.fm.transmitter=false

#

#System property for single instance recording

#

ro.fm.mulinst.recording.support=false

#

#System property for msm

#

ro.hw_plat=7x27a

#

# system props for SD card emulation of emmc partition

#

ro.emmc.sdcard.partition=18

#

# system property to enforce Phone Mode view

#

ro.screen.layout=normal

#

# Turn off tiled rendering

#

debug.enabletr=false

#

#System prop for setting the pixel format

#

ro.staticwallpaper.pixelformat=RGB_565

#

#System prop for disabling the meta data mode for encoder

#

debug.camcorder.disablemeta=1

#

# Simulate sdcard on /data/media

#

persist.fuse_sdcard=true

#

# System prop for using landscape preview layout in camera

#

debug.camera.landscape=true

#

# System prop for capping scroll velocity

#

ro.max.fling_velocity=8000

#

#system prop for Bluetooth hci transport

#

ro.qualcomm.bt.hci_transport=smd

#

#property to enable user to access Google WFD settings.

#

persist.debug.wfd.enable=1

debug.wfd.enable=1

ext_only.debug=1

persist.sys.ext_only.debug=1

persist.sys.hwc.ext_only.debug=1

persist.sys.hwc.disable=1

#property to choose between virtual/external wfd display

#

persist.sys.wfd.virtual=0

#

# System prop for Tvout/HDMI

#

persist.sys.camera.transform=0

persist.sys.camera.connect=0

persist.sys.videomode=1

ro.hdmi.enable=false

# System proverty for sys info indication

persist.radio.add_power_save=1

# System property for Default Brightness

ro.lcd_min_brightness=10

ro.lcd_brightness=143

# Keep SIM state on LPM mode

persist.radio.apm_sim_not_pwdn=1

# use se table when search list

persist.radio.use_se_table_only=1

# System prop for PLMN

persist.radio.fill_eons=1

#

# ADDITIONAL_BUILD_PROPERTIES

#

dalvik.vm.heapstartsize=8m

dalvik.vm.heapgrowthlimit=128m

dalvik.vm.heapsize=512m

dalvik.vm.heaputilization=0.25

dalvik.vm.heapidealfree=8388608

dalvik.vm.heapconcurrentstart=2097152

ro.vendor.extension_library=/system/lib/libqc-opt.so

dalvik.vm.heaptargetutilization=0.75

dalvik.vm.heapminfree=512k

dalvik.vm.heapmaxfree=8m

ro.hwui.texture_cache_size=48

ro.hwui.layer_cache_size=32

ro.hwui.path_cache_size=8

ro.hwui.shape_cache_size=2

ro.hwui.gradient_cache_size=1

ro.hwui.drop_shadow_cache_size=4

ro.hwui.texture_cache_flush_rate=0.5

ro.hwui.text_small_cache_width=1024

ro.hwui.text_small_cache_height=512

ro.hwui.text_large_cache_width=2048

ro.hwui.text_large_cache_height=1024

ro.sec.fle.encryption=true

ro.hdcp2.rx=tz

ro.secwvk=144

ro.crypto.support=recovery_mount|others

ro.config.alarm_alert=Alarm_Morning_flower.ogg

ro.config.ringtone=ATT_Firefly_Default.ogg

ro.config.notification_sound=Whisper.ogg

ro.monkey=0

ro.error.receiver.default=com.samsung.receiver.error

keyguard.no_require_sim=true

ro.com.android.dateformat=MM-dd-yyyy

ro.carrier=unknown

ro.ril.hsxpa=1

ro.ril.gprsclass=10

ro.adb.qemud=1

ro.setupwizard.mode=DISABLED

ro.com.google.apphider=off

ro.com.google.clientidbase=android-samsung

ro.com.google.clientidbase.ms=android-att-us

ro.com.google.clientidbase.am=android-att-us

ro.com.google.clientidbase.yt=android-samsung

ro.com.google.clientidbase.gmm=android-samsung

ro.com.google.gmsversion=4.2_r2

ro.kernel.qemu=0

ro.build.selinux=1

ro.config.tima=1

net.bt.name=Android

dalvik.vm.stack-trace-file=/data/anr/traces.txt

ro.qc.sdk.izat.premium_enabled=0

persist.gps.qc_nlp_in_use=0

--- WFDConfig. Xml

<WFDConfig>

<Capability>

<AudioLPCM>

<Name>LPCM</Name>

<Valid>1</Valid>

<Channels>2</Channels>

<SamplingFreq>48000</SamplingFreq>

<Latency>33</Latency>

</AudioLPCM>

<AudioAAC>

<Name>AAC</Name>

<Valid>1</Valid>

<Channels>2</Channels>

<SamplingFreq>48000</SamplingFreq>

<Latency>0</Latency>

</AudioAAC>

<AudioAC3>

<Name>AC3</Name>

<Valid>0</Valid>

<Channels>0</Channels>

<SamplingFreq>0</SamplingFreq>

<Latency>0</Latency>

</AudioAC3>

<VideoHeader>

<VideoMethod>1</VideoMethod>

<PreferredDisplaySupport>0</PreferredDisplaySupport>

<H264Profiles>1</H264Profiles>

<Valid>1</Valid>

</VideoHeader>

<CBP>

<VideoCodec>

<Profile>1</Profile>

<Level>1</Level>

<HorizontalResolution>1280</HorizontalResolution>

<VerticalResolution>720</VerticalResolution>

<Latency>0</Latency>

<MinimumSliceSize>0</MinimumSliceSize>

<SliceEncodingParams>0</SliceEncodingParams>

<FrameRateControlSupp>1</FrameRateControlSupp>

<VideoFps>30</VideoFps>

</VideoCodec>

</CBP>

<StandbyResumeCapability>

<Valid>1</Valid>

</StandbyResumeCapability>

<!--

IDR interval is to trigger an IDR request from sink.

This can be applcable only to sink. IDRInterval is in msec

-->

<IDRRequest>

<Valid>0</Valid>

<IDRInterval>0</IDRInterval>

</IDRRequest>

<AVFormatChange>

<Valid>0</Valid>

<AVInterval>0</AVInterval>

</AVFormatChange>

<!--

Frame skipping interval is in the scale of 500 msec/half second.

FrameInterval can be between 1 to 7, according to the WFD spec.

-->

<FrameSkipping>

<Valid>0</Valid>

<FrameInterval>0</FrameInterval>

</FrameSkipping>

<ContentProtection>

<HDCPValid>0</HDCPValid>

<Version>WFD_HDCP_2_1</Version> <!-- Valid values WFD_HDCP_2_0 and WFD_HDCP_2_1 -->

<CPPort>6789</CPPort>

<EncryptAudio>0</EncryptAudio> <!-- Valid values 0 / 1 to indicate Audio encryption or not -->

</ContentProtection>

<RTPDumpEnable>

<Valid>0</Valid>

</RTPDumpEnable>

<BufferCtrlEnable>

<Valid>1</Valid>

</BufferCtrlEnable>

<UIBC>

<UIBCValid>1</UIBCValid> <!-- 0/1 UIBC supported or not -->

<InputCategory>

<Generic>1</Generic>	<!-- 0/1 - support generic or not -->

</InputCategory>

<InputEvents>

<GenericInputEvents>

<Mouse>1</Mouse>	<!-- 0/1 for all Input Event Types -->

<Keyboard>1</Keyboard>

<SingleTouch>1</SingleTouch>

<MultiTouch>1</MultiTouch>

<JoyStick>0</JoyStick>

<Camera>0</Camera>

<Gesture>0</Gesture>

<RemoteControl>1</RemoteControl>

</GenericInputEvents>

</InputEvents>

<TcpPort>4321</TcpPort>

</UIBC>

</Capability>

---- Compatibility. Xml

<Capability>

<AudioLPCM>

<Name>LPCM</Name>

<Valid>1</Valid>

<Channels>2</Channels>

<SamplingFreq>48000</SamplingFreq>

<Latency>33</Latency>

</AudioLPCM>

<AudioAAC>

<Name>AAC</Name>

<Valid>1</Valid>

<Channels>2</Channels>

<SamplingFreq>48000</SamplingFreq>

<Latency>0</Latency>

</AudioAAC>

<AudioAC3>

<Name>AC3</Name>

<Valid>0</Valid>

<Channels>0</Channels>

<SamplingFreq>0</SamplingFreq>

<Latency>0</Latency>

</AudioAC3>

<VideoHeader>

<VideoMethod>1</VideoMethod>

<PreferredDisplaySupport>0</PreferredDisplaySupport>

<H264Profiles>1</H264Profiles>

<Valid>1</Valid>

</VideoHeader>

<CBP>

<VideoCodec>

<Profile>1</Profile>

<Level>1</Level>

<HorizontalResolution>1280</HorizontalResolution>

<VerticalResolution>720</VerticalResolution>

<Latency>0</Latency>

<MinimumSliceSize>0</MinimumSliceSize>

<SliceEncodingParams>0</SliceEncodingParams>

<FrameRateControlSupp>1</FrameRateControlSupp>

<VideoFps>30</VideoFps>

</VideoCodec>

</CBP>

<CHP>

<VideoCodec>

<Profile>2</Profile>

<Level>1</Level>

<HorizontalResolution>800</HorizontalResolution>

<VerticalResolution>480</VerticalResolution>

<Latency>0</Latency>

<MinimumSliceSize>0</MinimumSliceSize>

<SliceEncodingParams>0</SliceEncodingParams>

<FrameRateControlSupp>1</FrameRateControlSupp>

<VideoFps>30</VideoFps>

</VideoCodec>

</CHP>

<StandbyResumeCapability>

<Valid>1</Valid>

</StandbyResumeCapability>

<!--

IDR interval is to trigger an IDR request from sink.

This can be applcable only to sink. IDRInterval is in msec

-->

<IDRRequest>

<Valid>0</Valid>

<IDRInterval>0</IDRInterval>

</IDRRequest>

<AVFormatChange>

<Valid>0</Valid>

<AVInterval>0</AVInterval>

</AVFormatChange>

<!--

Frame skipping interval is in the scale of 500 msec/half second.

FrameInterval can be between 1 to 7, according to the WFD spec.

-->

<FrameSkipping>

<Valid>0</Valid>

<FrameInterval>0</FrameInterval>

</FrameSkipping>

<ContentProtection>

<HDCPValid>0</HDCPValid>

<Version>WFD_HDCP_2_1</Version> <!-- Valid values WFD_HDCP_2_0 and WFD_HDCP_2_1 -->

<CPPort>6789</CPPort>

</ContentProtection>

<RTPPortType>

<ConnectionType>0</ConnectionType> <!-- 0 - UDP ,1 - TCP -->

</RTPPortType>

<RTPDumpEnable>

<Valid>0</Valid> <!-- Enable RTP Dump Valid = 1 or Valid = 0-->

</RTPDumpEnable>

<UIBC>

<UIBCValid>0</UIBCValid> <!-- 0/1 UIBC supported or not -->

<InputCategory>

<Generic>1</Generic>	<!-- 0/1 - support generic or not -->

</InputCategory>

<InputEvents>

<GenericInputEvents>

<Mouse>1</Mouse>	<!-- 0/1 for all Input Event Types -->

<Keyboard>1</Keyboard>

<SingleTouch>1</SingleTouch>

<MultiTouch>1</MultiTouch>

<JoyStick>1</JoyStick>

<Camera>0</Camera>

<Gesture>0</Gesture>

<RemoteControl>1</RemoteControl>

</GenericInputEvents>

</InputEvents>

<TcpPort>4321</TcpPort>

</UIBC>

</Capability>

I claim no responsibility for you changing files on your own phone, this fixed took me about a month of constant work and if you change the wrong files it may brick your phone.

If ive helped you fix screen mirroring

And you would like to thank me.... buy me a coffee

PayPal: mreger444@gmail.com