Android Configuration相关问题如何定位分析(中英文切换、黑夜白天模式等)

Android Configuration相关问题如何定位分析(中英文切换、黑夜白天模式等).

Configuration的常见问题场景:

  • app的size position不正确
  • 中英文显示不正确
  • 白天黑夜模式不正确

Configuration信息如下:

复制代码
mFullConfiguration={1.0 ?mcc?mnc [en_GB] ldltr sw960dp w1707dp h795dp 240dpi xlrg long land car finger -keyb/v/h -nav/h 
	 	winConfig={ mBounds=Rect(0, 0 - 2560, 1440) mAppBounds=Rect(0, 0 - 2560, 1312) 
		mMaxBounds=Rect(0, 0 - 2560, 1440) mDisplayRotation=ROTATION_0 
		mWindowingMode=fullscreen mDisplayWindowingMode=fullscreen mActivityType=undefined 
		mAlwaysOnTop=undefined mRotation=ROTATION_0} s.767 fontWeightAdjustment=0}

本文重点讲解Configuration问题的分析手段,并结合真实案例进行定位分析。

1. 问题描述

前置条件:车辆电源模式为ON

操作步骤:

1.语言模式切换英文,查看界面显示

  1. 重启车机

预期结果:1.界面显示英文

实际结果:1.语言模式显示中文,界面显示英文

2.分析过程以及常用的debug手段

(1) adb shell dumpsys window w > ws.log

从dump WMS可以看出,系统侧的configuration是英文,也就是正常的,但是app侧确实中文,那么说明是app侧的问题。

(2)config debug如何开启config log:定位系统侧问题的手段

1. ActivityThread.java

public static final boolean DEBUG_CONFIGURATION = true;

2. WindowManagerDebugConfig.java

static final boolean DEBUG_CONFIGURATION = true;

(3)分析app调用的接口,然后针对性的在framewrok加log和堆栈信息debug:定位app侧问题的手段

Resources.java

java 复制代码
    /**
     * Return the current configuration that is in effect for this resource 
     * object.  The returned object should be treated as read-only.
     * 
     * @return The resource's current configuration. 
     */
    public Configuration getConfiguration() {
        Log.w("config200", "Resources, getConfiguration " + mResourcesImpl.getConfiguration());
        if (mResourcesImpl.getConfiguration() != null && mResourcesImpl.getConfiguration().toString().contains("zh_CN]")) {
            Log.w("config200", "Resources, getConfiguration ", new Throwable("xxxx"));
        }
        return mResourcesImpl.getConfiguration();
    }


相关推荐
平头哥AI7 小时前
Day 22 _ 包装错误别丢链_%w、errors.Is 与 errors.As
android·服务器·学习·golang·go
聚美智数8 小时前
图片广告检测-图片审核-图片广告识别-图像广告检测
android
工业机器人视觉检测设备8 小时前
工序全流程自动化升级!云汇智能打造汽车天窗多机器人集成产线
机器人·自动化·汽车
早睡早起身体好12311 小时前
用 XGrammar 约束大模型工具调用:解决参数为空的问题
android·人工智能·神经网络·机器学习·自然语言处理·vllm
提升汽车音响好物12 小时前
斯巴鲁森林人音响升级记录:江门汇声的前后声场与低频搭配
汽车·音频
大佐不会说日语~12 小时前
Android 16 下 uni-app APP 提示“网络连接失败”的排障与修复
android·uni-app
2501_9151063214 小时前
苹果App Store上架费用及流程全面解析
android·ios·小程序·https·uni-app·iphone·webview
当下新鲜事14 小时前
高压线束绝缘层在线测径为何成为新能源汽车线束制造的关键工序?简博斯JG-L系列测径仪解析
人工智能·汽车·制造
zsmydz88815 小时前
新能源汽车TBOX(车载远程信息处理系统)的国家标准体系
汽车·汽车tbox·4g车载tbox·新能源汽车tbox
YF021115 小时前
Android 16系统App开机自启动方案
android