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


相关推荐
一起搞IT吧1 小时前
Android功耗系列专题理论之十六:功耗不同阶段&不同模块分析说明
android·c++·智能手机·性能优化
Greenland_121 小时前
Android Java使用Glide无法生成GlideApp
android·java·glide
耶叶1 小时前
Android开发:用户注册和登录的数据库代码详细解释
android·数据库·kotlin
常利兵1 小时前
打造Android网络框架:为请求铺就高速路
android·网络·php
艾莉丝努力练剑2 小时前
【MYSQL】MYSQL学习的一大重点:MYSQL数据类型
android·linux·数据库·人工智能·学习·mysql·网络安全
pangares2 小时前
MySQL中between and的基本用法
android·数据库·mysql
Godspeed Zhao2 小时前
现代智能汽车系统——其他总线0
汽车
亚历克斯神3 小时前
Flutter for OpenHarmony: Flutter 三方库 mongo_dart 助力鸿蒙应用直连 NoSQL 数据库构建高效的数据流转系统(纯 Dart 驱动方案)
android·数据库·flutter·华为·nosql·harmonyos
冰语竹4 小时前
Android学习之线性布局。
android
民乐团扒谱机4 小时前
【读论文】基于学习的利用内置加速度计的实用智能手机窃听技术
深度学习·网络安全·智能手机·加速度计·窃听技术·运动传感器