#6289 closed defect (fixed)
Fix OnSharedPreferenceChangeListener
Reported by: | jwangenheim | Assignee: | jwangenheim |
---|---|---|---|
Priority: | P2 | Milestone: | Adblock-Plus-for-Samsung-Browser-1.1.3 |
Module: | Adblock-Plus-for-Samsung-Browser | Keywords: | |
Cc: | diegocarloslima, mario | Blocked By: | |
Blocking: | Platform: | Android | |
Ready: | yes | Confidential: | no |
Tester: | Unknown | Verified working: | no |
Review URL(s): |
Description
Environment
ABP/SI version 1.1.2
Samsung Galaxy S6
Android 6.0.1
How to reproduce
- Install the debug version of ABP/SI
- Open the LogCat view in Android Studio
- Finish the initialization and enable ABP content blocker in Samsung Internet (use about:contentblock)
- Check/uncheck the AcceptableAds option
Observed behaviour
No preference change is logged
Expected behaviour
A preference change should be logged
SharedPreferences keeps listeners in a WeakHashMap. This means it will become the target of garbage collection as soon as you leave the current scope. It will work at first, but eventually, will get garbage collected, removed from the WeakHashMap and stop working.
We should keep a reference to the listener in a field of our MainPreferences class.
Change History (5)
comment:1 Changed 13 months ago by jwangenheim
- Review URL(s) modified (diff)
- Status changed from new to reviewing
comment:2 Changed 13 months ago by jwangenheim
- Owner set to jwangenheim
comment:3 Changed 13 months ago by abpbot
comment:4 Changed 13 months ago by jwangenheim
- Resolution set to fixed
- Status changed from reviewing to closed
comment:5 Changed 13 months ago by mario
- Milestone set to Adblock-Plus-for-Samsung-Browser-1.1.3
Note: See
TracTickets for help on using
tickets.
A commit referencing this issue has landed:
Issue 6289 - Fix OnSharedPreferenceChangeListener