android-strictmode

Filter Android StrictMode violations by duration

回眸只為那壹抹淺笑 提交于 2019-12-01 21:24:22
Is there a way to filter StrictMode violations based on duration? It's getting a bit annoying having these StrictMode policy violation; ~duration=6 ms: android.os.StrictMode$StrictModeDiskWriteViolation: policy=31 violation=1 poisoning my logcat. I think StrictMode is a useful feature, but I'd like to deal only with violations with a duration greater than, let's say, 50 ms, in the first development phase. The StrictMode API does not support filtering by duration. But you can easily do so by filtering StrictMode's log reports: A. Configure StrictMode to write errors to log: public void onCreate

Android P (API 28) - What does the StrictMode policy violation “SmartSelectionEventTracker$SelectionEvent;->selectionAction” mean?

爱⌒轻易说出口 提交于 2019-12-01 15:13:52
I am using the StrictMode in order to find non-SDK usages: if (BuildConfig.DEBUG && Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder() .detectNonSdkApiUsage() .penaltyLog() .build()); } Now I am getting a policy violation: D/StrictMode: StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Landroid/view/textclassifier/logging/ SmartSelectionEventTracker$SelectionEvent;->selectionAction(IIILandroid/view/textclassifier/TextClassification;)Landroid/view/textclassifier/logging/ SmartSelectionEventTracker$SelectionEvent;

Android P (API 28) - What does the StrictMode policy violation “SmartSelectionEventTracker$SelectionEvent;->selectionAction” mean?

≡放荡痞女 提交于 2019-12-01 14:05:56
问题 I am using the StrictMode in order to find non-SDK usages: if (BuildConfig.DEBUG && Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder() .detectNonSdkApiUsage() .penaltyLog() .build()); } Now I am getting a policy violation: D/StrictMode: StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Landroid/view/textclassifier/logging/ SmartSelectionEventTracker$SelectionEvent;->selectionAction(IIILandroid/view/textclassifier

Gingerbread emulator instance is much more sluggish than Froyo and below. Why?

你。 提交于 2019-11-30 03:49:07
I'm not sure if anyone else noticed it, but the Gingerbread emulator runs like a dog, with both scrolling, navigating, interaction - all taking much longer and being much choppier. I even got an ANR in the browser when I tried to use it: http://www.androidpolice.com/2010/12/06/walkthrough-and-hands-on-with-the-gingerbread-ui-the-new-gingerbread-keyboard-in-all-its-sexiness/ (see towards the bottom). I've just read about the new StrictMode at http://android-developers.blogspot.com/2010/12/new-gingerbread-api-strictmode.html and about all the performance improvements in Gbread, but my experience

Finding what violated StrictMode policy

故事扮演 提交于 2019-11-30 02:08:56
I've enabled StrictMode in my app and it's causing a few crashes as expected. How can I find out where in my code I'm violating these policies? This is the stack trace: E/AndroidRuntime(19523): FATAL EXCEPTION: main E/AndroidRuntime(19523): android.os.StrictMode$StrictModeViolation: policy=95 violation=2 E/AndroidRuntime(19523): at android.os.StrictMode.executeDeathPenalty(StrictMode.java:1326) E/AndroidRuntime(19523): at android.os.StrictMode.access$1300(StrictMode.java:111) E/AndroidRuntime(19523): at android.os.StrictMode$AndroidBlockGuardPolicy.handleViolation(StrictMode.java:1319) E

Android StrictMode InstanceCountViolation

可紊 提交于 2019-11-29 20:16:09
I am running my app with StrictMode activated in development as documented here StrictMode for lower platform versions and noticed an error message that I do not know what to think about nor can I find any reference. I get a android.os.StrictMode$InstanceCountViolation with values for instances and limit e.g. instances=3; limit=2 Now I am wondering: A) how is the limit calculated B) how can such a violation actually happen and then I would look into evasive actions. Any ideas? TWiStErRob It's all in the code The key is StrictMode.sExpectedActivityInstanceCount and

Android StrictMode and heap dumps

我的梦境 提交于 2019-11-29 07:35:49
When Android's StrictMode detects a leaked object (e.g. activity) violation, it would be helpful if I could capture a heap dump at that moment in time. There's no obvious way, however, to configure it to do this. Does anyone know of some trick that can be used to achieve it, e.g. a way to convince the system to run a particular piece of code just prior to the death penalty being invoked? I don't think StrictMode throws an exception, so I can't use the trick described here: Is there a way to have an Android process produce a heap dump on an OutOfMemoryError? Jules No exception, but StrictMode

Gingerbread emulator instance is much more sluggish than Froyo and below. Why?

江枫思渺然 提交于 2019-11-29 01:21:30
问题 I'm not sure if anyone else noticed it, but the Gingerbread emulator runs like a dog, with both scrolling, navigating, interaction - all taking much longer and being much choppier. I even got an ANR in the browser when I tried to use it: http://www.androidpolice.com/2010/12/06/walkthrough-and-hands-on-with-the-gingerbread-ui-the-new-gingerbread-keyboard-in-all-its-sexiness/ (see towards the bottom). I've just read about the new StrictMode at http://android-developers.blogspot.com/2010/12/new

Android Honeycomb: NetworkOnMainThreadException even when using AsyncTask and no strict mode?

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-28 07:34:07
I run into a NetworkOnMainThreadException with my Android 3.0 app. Searching for a solution I found this , but if I understand this correctly, default setting would be that the strict mode is turned off. Also, all my network access is in an AsyncTask , so I don't see the point in this Exception anyway. So, I'm quite desperate now what I should do to prevent this... Kind regards, jellyfish Edit: This blog entry says that AsyncTask should be enough, but at least clarifies the StrictMode point. Solution: I turned off the StrictMode (its probably better to keep some settings but I couldn't be

Strict mode in android 2.2

爱⌒轻易说出口 提交于 2019-11-27 22:37:37
I have target sdk set as 3.2 and min sdk as 2.2, how can I use strictmode in my application, as I understand it is introduced but cannot really understand how to start using it. My suggestion is two-fold: First, add some baseline StrictMode code to your Application 's onCreate() . This lets you apply StrictMode to your entire app in an easy fashion (though you could put this code anywhere for more specific testing). There's good sample code in the StrictMode docs. Second, detect the version of the SDK before trying to use StrictMode. This way, you only use StrictMode in API versions 9 or above