[Galaxy S 4 Developer Discussion [Developers-Only]] 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 last download and enable

https://play.google.com/store/apps/d...HOm-sQSyqoCgCA

Even if multi window plus doesnt work. Keep it for now untill I can trace down a setting change.

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 :

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 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

#

#

# Turn off tiled rendering

#

debug.enabletr=false

#

#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

------- 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>

---- Capability. 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.

I have had a 90% success rate with connecting when I connect Right after restarting the phone.

Restart, and as soon as your lock screen comes up. Unlock your phone and connect to your dongle. Then you will have clean connects.

If ive helped you fix screen mirroring

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

PayPal: mreger444@gmail.com