Commit Graph

16 Commits (e547c9331137329439c01aa654ef997e99e518c8)

Author SHA1 Message Date
Michael Comella 7c0d00c800 No issue: fix tests related to inline change.
The difficulty in mocking StrictMode.resetAfter is concerning.
I'm starting to second-guess whether or not making strict mode manager a class
was a good idea.
4 years ago
Michael Comella 7b5cd8c165 No issue: remove inline from StrictModeManager.resetAfter.
I believe this was a premature optimization: it's unclear that it would
actually improve performance and yet  we had to add several weird
workarounds to make it work that broke encapsulation. It's also
possible it would be worse for the APK size because of excessive
inlining.
4 years ago
Michael Comella 3e96f6b385 For #13959 - review: add clarifying comments. 4 years ago
Michael Comella 50959d997e For #13959: add marker when StrictMode is suppressed. 4 years ago
Michael Comella 3b5d6d58d9 For #13959: add MozillaStrictModeSuppression detekt check. 4 years ago
Michael Comella 4a4edeb184 For #13959: count StrictMode suppressions on startup. 4 years ago
Michael Comella f19c9920f9 For #13959: move resetAfter into StrictModeManager.
In a followup PR, we need to add state to strictModeManager (the
number of suppressions). This is much simpler to do when this is defined
as a class rather than an object. However, when this is defined as a
class, `resetAfter` needs access to the strictModeManager. Instead of
passing it in as an argument, it made sense to move this function onto
the strictModeManager instead.

Since folks are used to calling:
```
StrictMode.ThreadPolicy.allowThreadDiskReads().resetAfter
```

We're going to have to add a lint check to prevent them from doing that.
4 years ago
Michael Comella 6abeb2d9e7 For #13959: change StrictModeManager to class from object.
I originally tried to create this PR leaving this as an object to keep
the change simple but it wasn't worth it - once the object started to
keep state, we'd need to manually reset the state between runs. Also,
the tests were already getting hacky with static mocking so it was
easier to address some of those issues this way too.
4 years ago
Michael Comella a92356fe00 For #13959: comment about duplication in logic in StrictMode.
I had to drop a commit that addressed the issue because it was too hard
to fix.
4 years ago
Michael Comella 2c1befaa25 For #13959: rename to attachListenerToDisablePenaltyDeath for clarity. 4 years ago
Michael Comella c03c7ef793 For #13959: remove unused penaltyDialog parameter.
Additional branching introduces complexity so we should avoid it when
possible. This branch was also unused so it's more likely to have bugs
if we tried to use it after some refactor.
4 years ago
Michael Comella f05a542060 For #13959: always enable detectNonSdkApiUsage.
We don't use penalty death for the VM policy so we theoretically don't
need to disable this check if penalty death is enabled.
4 years ago
mcarare 79135b1df5 For #13943: Change strict mode penalty to penaltyDeath.
Also, keep dialogPenalty as replacement option for penaltyDeath.
4 years ago
Tiger Oakes 6bde0378a2
Add tests for StrictModeManager (#12013) 4 years ago
Sachin cd26ba9a9c
for #11364 added a exception list for manufacturers violating strict mode policies on startup (#11407)
for #11364 changed blackList -> exceptionList, added one plus to the list

change magic strings into const Val
4 years ago
Sachin 74948cb3f1
for #7225, Changed strictMode thread penalty to dialog on startup and back to logs after startup is done. (#10831)
for #7225, refactored and cleanup the branch.

for #7225, change strict mode policy only on main process.

for #7225, setting thread policy inside a seperate thread to keep it from getting overridden in activities.

for #7225 removed Handler().postAtFrontOfQueue as a solution due to unknown side effects. moved the enableStrictMode function to be static so we can reuse it.

for #7225 lint check

for #7225 created strict mode manager and moved enabledStrictMode function inside it.

for #7225 removed penalty death on network

for #7225 added allow disk access on thread for already existing violation


strict mode running in main process to see if it passes the gitlab check, will revert it if it doesnt

allowed diskread for super.onCreate for home activity

added comments for disk violation oncreate homeactivity

added fragment manager inside strictmode manager

allowed disk read for onboarding

allowed disk read for cachedTopSites
4 years ago