Delete onFlyCompress message from logcat

I am using YuvImage to compress the android.hardware.Camera channel in jpeg. Since then, I continue to see skia onFlyCompress in logcat, which completely pollutes it. Is there any way to disable this message? I know that I can filter the output of logcat, but this means that this happens everywhere all the time, which is not a fix, but a workaround. I just donโ€™t want these messages to be printed at all

+15
source share
2 answers

You can (I'm not sure) YuvImage subclass of the YuvImage class that prints the log, and override the method of this class that prints the log, and simply copy all the code for this method except Log.d() or Log.v() or Log.w() , ... the code of the overridden method.

Look at the following answer too:

How to enable / disable log levels in Android?

+1
source

Short answer

Try to reach your goal using the intercept method .

You can connect the android.util.log methods using the XPposed Framework on ROOTed devices.

Detailed methods

  1. Use the XPposed Framework to connect android.util.Log methods.
  2. In the interception method, check if the skia onFlyCompress message contains skia onFlyCompress .
  3. If then call setResult(null); so that he does not print a log message.

Although these methods can only be used on root devices, I hope that my answer will help at least some users who can use root devices.

(Hmm, because no clients will block log messages, so all you have to do is just the root of the local device only and install an automatic filtering application that uses the Exposure framework.)

To see an example of blocking a method from executing the rest of its code: This answer (especially the last paragraph) contains several examples of using the Xposed platform. As you can see, the codes are very short (no more than 40 lines).

I will implement some codes if necessary / considered potentially useful.

Code example

Since someone voted for me, I assume that someone liked my suggestions. Therefore, I am posting some codes.

 import android.util.*; import de.robv.android.xposed.*; import de.robv.android.xposed.callbacks.XC_LoadPackage.*; import static de.robv.android.xposed.XposedHelpers.findAndHookMethod; public class LogFilterApp implements IXposedHookLoadPackage { private String TAG="LogFilter"; public void handleLoadPackage(final LoadPackageParam lpparam) throws Throwable { XposedBridge.log("Package name: " + lpparam.packageName); try { findAndHookMethod("android.util.Log", lpparam.classLoader, "i", String.class, String.class, new XC_MethodHook() { @Override protected void beforeHookedMethod(MethodHookParam param) throws Throwable { //do something before if(((String)(param.args[1])).indexOf("skia onFlyCompress")>=0) { param.setResult(null); } } }); } catch (XposedHelpers.ClassNotFoundError e) { XposedBridge.log("ClassNotFoundError"); } catch (NoSuchMethodError e) { XposedBridge.log("NoSuchMethodError"); } } } } } 

Code Link: This XDA Stream

Install XPposed Framework

XPposed Dev Tutorial

+1
source

Source: https://habr.com/ru/post/1266394/


All Articles