当前位置: 首页 > news >正文

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.语言模式切换英文,查看界面显示
2. 重启车机
预期结果: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

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

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

相关文章:

  • 【GPU】什么是 NVLink?
  • 4G铁路工控机在高铁信号控制中的关键作用
  • 【SpringBoot3】SpringBoot项目Web拦截器使用
  • 小程序 -- uni-app开发微信小程序环境搭建(HBuilder X+微信开发者工具)
  • C++性能分析工具
  • 基于遗传算法的IEEE33节点配电网重构程序
  • 网络安全 信息安全 计算机系统安全
  • while……else
  • Spark-TTS:基于大模型的文本语音合成工具
  • 数据库批处理
  • UE5中UBlueprintFunctionLibrary类详解
  • 时态--02--⼀般将来时
  • tiktok web登录 分析
  • Resnet到底在解决一个什么问题呢?
  • c3p0连接池
  • Unity Dots从入门到精通 Mono和Dots通讯
  • 论文阅读笔记——π0: A Vision-Language-Action Flow Model for General Robot Control
  • 【GPT入门】第14课 openai调用高德地图案例实现多轮会话与多轮接口调用
  • ai之qwq 32B部署在 linux 与拓展使用在web参考
  • 【编译器】VSCODE搭建ESP32-C3
  • 特朗普与普京通话前夕,英美法德意领导人通话讨论俄乌问题
  • 媒体报道一民企投资400万运营出租车4年未获批,广西隆林县回应
  • 19国入境团抵沪并游玩,老外震惊:“怎么能有这么多人?”
  • 15年全程免费,内蒙古准格尔旗实现幼儿园到高中0学费
  • “先增聘再离任”又添一例,景顺长城基金经理鲍无可官宣辞职
  • 俄乌直接谈判结束,乌称“毫无成果”