Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extra blocking via PM #205

Closed
HanabishiRecca opened this issue Dec 28, 2020 · 15 comments
Closed

Extra blocking via PM #205

HanabishiRecca opened this issue Dec 28, 2020 · 15 comments
Labels
Feature New feature or request Priority: 3

Comments

@HanabishiRecca
Copy link

It will be good to add true blocking mode with root. Which actually disables activities/services/intents in the system.
Like it's done in MyAndroidTools, LuckyPatcher etc. (After using this tools such components appear in AppManager as disabled.)

@HanabishiRecca HanabishiRecca added Priority: 3 Feature New feature or request labels Dec 28, 2020
@MuntashirAkon MuntashirAkon added the Status: Rejected This will not be worked on label Dec 28, 2020
@MuntashirAkon
Copy link
Owner

It will be good to add true blocking mode with root.

Assuming you're talking about pm or Shizuku mode, Intent Firewall is actually far more better than the one you're proposing. See FAQ.

@HanabishiRecca
Copy link
Author

Thanks for clarifying 😅

@HanabishiRecca
Copy link
Author

@MuntashirAkon hello again. That's the thing why I asked about blocking. Now I collected some data. Seems like IFW not always can block an intent.

For example, I'm blocking this:

am

The app still shows ads:

l2sd-ad

But when I'm disabling this intent via e.g. MAT (pm method I suppose):

mat

Intent doesn't work and ad disappears:

l2sd-noad

Am I get something wrong? Can you test this too?

@MuntashirAkon
Copy link
Owner

Am I get something wrong? Can you test this too?

I can't seem to reproduce it. After you apply blocking via IFW, you may have to restart the application or invalidate cache. When you block using pm method, this is done by default. The ad might appear because it was stored in the cache or memory.

@HanabishiRecca
Copy link
Author

Tried to even reboot the whole device. Also when I enabling intent back in MAT, ad is also immediately turns back. Regardless it's still blocked in AM.

@MuntashirAkon
Copy link
Owner

Also when I enabling intent back in MAT, ad is also immediately turns back. Regardless it's still blocked in AM.

That not an issue as described in the FAQ.

Tried to even reboot the whole device.

Check if the blocking is really applied by visiting /data/system/ifw/<your package>.xml

You've also failed to mention the AM version you're currently using.

@HanabishiRecca
Copy link
Author

HanabishiRecca commented Jan 2, 2021

That not an issue as described in the FAQ.

I mean AM block doesn't work even after pm block.

Check if the blocking is really applied by visiting /data/system/ifw/.xml
You've also failed to mention the AM version you're currently using.

Sure. Latest AM Pre-release 2.5.21.
/data/system/ifw/com.buak.Link2SD.xml file is present and have a such content:

<rules>
<activity block="true" log="false">
  <component-filter name="com.buak.Link2SD/com.google.android.gms.ads.AdActivity"/>
</activity>
</rules>

Btw there are no any mentions of IntentFirewall or ifw_intent_matched events in the logcat. So I suppose this rules just don't work for some reason. And I found a clue here:

This directory is often /data/system/ifw/, but not always.
you can find the correct directory using the getSystemSecureDirectory() method

But in your app as I can see the path is hardcoded:

static final String SYSTEM_RULES_PATH = "/data/system/ifw/";

Maybe my firmware just has the different IFW folder path?

@HanabishiRecca
Copy link
Author

HanabishiRecca commented Jan 2, 2021

Hmm, seems like no. Some rules are definitely working. I can block app main activity and it won't launch.
Also I enabled IFW logging and confirmed that

I ifw_intent_matched: [0,com.buak.Link2SD/.Link2SD,10109,1,NULL,android.intent.action.MAIN,NULL,NULL,270532608]

But no matches for ads intent. Very weird 🙃


Fixed path maybe still need to be replaced by the function? Just as an compatibility improvement feature. I can create a new issue for it.

@MuntashirAkon
Copy link
Owner

Fixed path maybe still need to be replaced by the function?

Documentation on Android source suggests that either /data/system/ifw (currently used) or /data/secure/system/ifw (used up to Android M) path can be used.

What's the Android version that you're using?

But no matches for ads intent. Very weird 🙃

There could be other unknown factors at play here. But I can't seem to reproduce it on my device. Advertising doesn't seem to be working at all. Can you try an app called Call Meter 3G so that we can both be on the same page. If the findings are indeed correct, then it will be a very good finding.

@HanabishiRecca
Copy link
Author

HanabishiRecca commented Jan 3, 2021

What's the Android version that you're using?

10 (Q). LineageOS 17.1 (official for my device), so the system is very close to AOSP.

Can you try an app called Call Meter 3G so that we can both be on the same page.

Ok. Blocking the ad here also doesn't work.

cm

cm1

@MuntashirAkon
Copy link
Owner

MuntashirAkon commented Jan 3, 2021

Ok. Blocking the ad here also doesn't work.

There must be some reason behind this (my suspect is IPC). Anyway, I think it's safe to conclude that it's better to disable these components using both IFW and PackageManager at the same time. So they will remain blocked in case the app enables them. Another idea would be to run a job service now and then to ensure that the components blocked in AM are actually blocked.

@MuntashirAkon MuntashirAkon reopened this Jan 3, 2021
@HanabishiRecca
Copy link
Author

Anyway, I think it's safe to conclude that it's better to disable these components using both IFW and PackageManager at the same time.

Yes. Really not much of existing apps re-enabling intents. Also being visually in sync with other blocking tools is good too.

@HanabishiRecca HanabishiRecca changed the title True blocking mode with root Extra blocking via PM Jan 3, 2021
@MuntashirAkon
Copy link
Owner

It's definitely something to do with IPC. I've set SELinux to permissive and IFW isn't working even after I've set it to enforcing again. I'll file a report in the Google Bug Tracker (although there's hardly any chance that this issue will be addressed). They've also neglected my other issue on app ops. They only like the easy-to-fix bugs.

@MuntashirAkon MuntashirAkon removed the Status: Rejected This will not be worked on label Jan 3, 2021
@MuntashirAkon
Copy link
Owner

Really not much of existing apps re-enabling intents.

People usually blocks components from the dodgy apps, not just from the innocent-looking apps containing AdActivity.

Anyway, thank you for your detailed investigations on this matter. This issue is now closed via 4732500 and 58ca805. Job service is related to #61 and will be addressed there.

@HanabishiRecca
Copy link
Author

Anyway, thank you for your detailed investigations on this matter. This issue is now closed via 4732500 and 58ca805.

My respect, sir!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New feature or request Priority: 3
Projects
None yet
Development

No branches or pull requests

2 participants