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();
    }


相关推荐
素师良码1 小时前
第5篇:显示驱动必备调试工具浅析
android
维克兜率天2 小时前
【维克】配对交易的季节性:哪些品种适合长拿?
android·开发语言·笔记·python·算法·kotlin·量化
墨天梦2 小时前
B06_XML控件布局与ViewBinding
android·kotlin
晚风叙码3 小时前
MySQL 表的操作:从建表到删表,一篇讲清楚
android·mysql·oracle
事圆则缓4 小时前
Android 性能优化常见工具与使用场景:从症状到证据的排查指南
android·性能优化
开开心心就好4 小时前
办公软件卸载不干净?专用工具一键清残留
java·前端·人工智能·智能手机·kafka·excel·memcache
avi91114 小时前
Unity 非后台,非自动构建,但统计报表 BuildReport ,构建自动化系统C#
android·webserver·ios打包·admin·c#后台·unity打包系统·unity自动构建
新鲜势力呀4 小时前
PHP 定时任务系统实战:从 Cron 混乱执行到任务调度中心 + Redis队列 + 失败重试
android·java·redis
YF02115 小时前
Android 16系统 如何修改 eth0 IP ?
android
其实防守也摸鱼5 小时前
渗透测试学习计划(全栈综合 · 零基础进阶)
android·数据库·学习·安全·oracle·自动化·学习方法