I have a project that I'm migrating to API 33. I'm trying to detect non sdk api usage using this line:
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectNonSdkApiUsage().penaltyLog().build());
I'm receiving NonSdkApiUsedViolation in common places like:
setContentView(R.layout.main);
which gives:
StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z
or in lines like connection.getInputStream();
which gives
StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Ljava/net/Socket;->impl:Ljava/net/SocketImpl;
What is happening? Why these common lines give that error?