8+ Years Mobile Experience | KMP , CMP | Flutter | IOS | Python, Django, Flask | Contributor on StackOverFlow & GitHub | Love to meet and follow people
StrictMode is a developer tool which detects things you might be doing by accident and brings them to your attention so you can fix them.
StrictMode.ThreadPolicy among others can detect:
- slow (blocking) operations on UI thread (detectCustomSlowCalls())
- blocking disc reads/writes on UI thread (detectDiskReads()/detectDiskWrites())
- mismatches between defined resource types and getter calls (detectResourceMismatches())
StrictMode.VmPolicy among others can detect:
- leaks of Activity subclasses (detectActivityLeaks())
- when an SQLiteCursor or other SQLite object is finalized without having been closed. (detectLeakedSqlLiteObjects())
- when your app is blocked from launching a background activity or a PendingIntent created by your app cannot be launched (detectBlockedBackgroundActivityLaunch())
- when the calling application exposes a file:// Uri to another app (detectFileUriExposure())
- attempts to invoke a method on a Context that is not suited for such operation (detectIncorrectContextUse())
For both of them, we can specify a penalty:
- penaltyLog() - Logs detected violations to the system log.
- penaltyDeath() - Crashes the whole process on violation.
- penaltyDialog() - Shows an annoying dialog to the developer on detected violations, rate-limited to be only a little annoying.
- penaltyDropBox() - Enables detected violations log a stacktrace and timing data to the DropBox on policy violation.
- penaltyFlashScreen() - Flashes the screen during a violation.
- penaltyListener(…) - Set specific listener on violation.
Men can stay up til 2 a.m., wake up at 6, be in debt, broke, alone, and still have faith that one day, everything will work out. It's called being a man.
they say the human brain lives for seven minutes after death, replaying its best memories… this is the memory that’s gonna play in my head for those seven minutes.