androidloggingandroid-anr-dialoghuawei-mobile-services

Logs not showing in HUAWEI TIT_AL00


I am trying to debug an ANR in my app in HUAWEI TIT_AL00 device. After an action the device gets an ANR where others devices are working fine. This device doesn't show any of my logs. After searching about this I have found this resource. Now, I am using android.utils.Log.wtf() for getting the logs. As per my application flow, everything is running correctly,but instead changing my UI after running the code, it gets an ANR without showing anything in LogCat. Is there any way I get why is the device getting ANR? OS of this device is lolipop.

Update

I discovered that I was using a custom text view,

public class ScalableTextView extends TextView{
    float defaultTextSize = 0.0f;

    public ScalableTextView(Context context, AttributeSet attrs, int defStyle){
        super(context, attrs, defStyle);
        setSingleLine();
        setEllipsize(TextUtils.TruncateAt.END);
        defaultTextSize = getTextSize();
    }

    public ScalableTextView(Context context, AttributeSet attrs){
        super(context, attrs);
        setSingleLine();
        setEllipsize(TextUtils.TruncateAt.END);
        defaultTextSize = getTextSize();
    }

    public ScalableTextView(Context context){
        super(context);
        setSingleLine();
        setEllipsize(TextUtils.TruncateAt.END);
        defaultTextSize = getTextSize();
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec){
        setTextSize(TypedValue.COMPLEX_UNIT_PX, defaultTextSize);
        super.onMeasure(widthMeasureSpec, heightMeasureSpec);

        final Layout layout = getLayout();
        if (layout != null){
            final int lineCount = layout.getLineCount();
            if (lineCount > 0){
                int ellipsisCount = layout.getEllipsisCount(lineCount - 1);
                while (ellipsisCount > 0){
                    final float textSize = getTextSize();

                    // textSize is already expressed in pixels
                    setTextSize(TypedValue.COMPLEX_UNIT_PX, (textSize - 1));

                    super.onMeasure(widthMeasureSpec, heightMeasureSpec);
                    ellipsisCount = layout.getEllipsisCount(lineCount - 1);
                }
            }
        }
    }
}

I was setting "™" this in this textview and for this I was getting the ANR. But still not sure why the LogCat is not showing this and what exactly the exception is.


Solution

  • Huawei has a model-specific logging system and that needs to be turned on before debugging in order to get the application and system logs in your LogCat. Today I have tested in LUA-L21 following this and succeeded to get the logs.