Thursday, September 27, 2018

How to Remove Direct Share from the Share Menu

Direct Share

Direct Share is one of those features that seems useful on the surface but actually ends up being annoying. It shows up whenever you open the share menu and places shortcuts to your contacts in other applications at the top. I’m sure many would agree that they don’t usually end up selecting one of their contacts directly in the share menu, and there’s also the fact that it causes the share menu to jump, which may make you miss your intended tap. If you’d rather do away with these contacts being suggested at all, you can disable them on both LG and Samsung phones without root, and on other phones via the Intent Firewall.

How to remove Direct Share on Android How to remove Direct Share on Android

How to remove Direct Share from the Share Menu on an LG or Samsung device

First and foremost, if you have an LG or Samsung device, then you’re in luck. Both OEMs have included ways to disable this feature in their device settings. On a Samsung phone, you simply need to go to your “Advanced features” section and disable “Direct share.” On an LG phone, go to the Networks tab, Share & connect, and, finally, Sharing panel. If you don’t have either of these devices, then read on.

How to remove Direct Share from the Share Menu via Root

We recommend using a root solution such as Magisk. You’ll also need a root-enabled file explorer. I personally recommend MiXplorer.

MiXplorer (Free, XDA Labs) →

Step 1 – Create an XML file

You’ll need to create an XML file, but the name doesn’t actually matter. The intent firewall will read any XML file regardless of its name. For simplicity’s sake, I have named mine “disable-direct-share.xml”. Paste the following into a text editor.

<rules>
  <service block="true" log="true">
    <intent-filter>
      <action name="android.service.chooser.ChooserTargetService" />
    </intent-filter>
  </service>
</rules>

Now save the text file and close it.

Step 2 – Move the file

This is the part which requires root, as we’ll have to directly modify /data by placing the file in /data/system/ifw. Simply copy it over into that folder and you’re done. You won’t even need to reboot.

Step 3 – Test it out!

That’s pretty much it. Simply try to share an item and you should notice that there are no longer any contacts being suggested for you to send items to.

The Intent Firewall – What we did

The Intent Firewall is a feature that was introduced in Android 4.4.2, however, has not officially been documented. As such, not only is it subject to change at any time, but it’s not an officially supported feature either. That doesn’t mean we can’t utilize it though, as all you need is root access. When we add a file to /data/system/ifw, the Intent Firewall will scan any .XML file it detects was modified in the folder and attempt to parse its rules. Valid rules will then be applied across the system. We leverage this to block broadcasts from the ChooserTargetService, which is responsible for sending out a broadcast to ask applications what to display under Direct Share. If the ChooserTargetService can’t broadcast that request, then the Direct Share menu can’t show up as no applications will respond. The Intent Firewall has a lot of other uses too and even had a user on GitHub utilize it in order to help prevent battery drainage thanks to the calling of unnecessary services.

Of course, if you have a Samsung or LG device then you shouldn’t do any of this and instead should look towards disabling the option which can be found in your Settings. The Intent Firewall isn’t documented by Google anywhere, which suggests that it is either unfinished or has been abandoned. There does not appear to be any occasion where the system makes use of it either. The Intent Firewall isn’t exactly the most robust solution to blocking intents and broadcasts, but it’s the only way to do it for now. It does the job, particularly well in this case, and possibly has other important uses down the line as well.


Source: REJH (StackExchange) Via: /u/ForbidReality (Reddit)

HostGator Web Hosting

0 comments:

Post a Comment