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

通过adb dump activity的configChanges配置

如题,本文介绍如何通过adb获取某个activity的configChanges配置信息。
参考部分资料:
https://blog.csdn.net/m0_51703524/article/details/122477760

1,dump获取configChanges整型值

adb shell dumpsys activity activities
输出如下,我们以Settings activity为例,可以看到configChanges=0x3:

ACTIVITY MANAGER ACTIVITIES (dumpsys activity activities)
Display #0 (activities from top to bottom):* Task{2ee653b #1100004 type=standard A=1101000:com.android.car.settings isResizeable=true minWidth=-1 minHeight=-1 U=11 visible=true visibleRequested=true mode=fullscreen translucent=false sz=1}mLastNonFullscreenBounds=Rect(995, 239 - 1510, 1154)isSleeping=falsetopResumedActivity=ActivityRecord{d79bd6c u11 com.android.car.settings/.Settings_Launcher_Homepage t1100004}* Hist  #0: ActivityRecord{d79bd6c u11 com.android.car.settings/.Settings_Launcher_Homepage t1100004}packageName=com.android.car.settings processName=com.android.car.settingslaunchedFromUid=0 launchedFromPackage=com.android.shell launchedFromFeature=null userId=11app=ProcessRecord{3d98359 17474:com.android.car.settings/u11s1000}Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10004000 pkg=com.android.car.settings cmp=com.android.car.settings/.Settings_Launcher_Homepage }rootOfTask=true task=Task{2ee653b #1100004 type=standard A=1101000:com.android.car.settings isResizeable=true minWidth=-1 minHeight=-1}taskAffinity=1101000:com.android.car.settingsmActivityComponent=com.android.car.settings/.common.CarSettingActivities$HomepageActivitybaseDir=/system/priv-app/CarSettings/CarSettings.apkdataDir=/data/user/11/com.android.car.settingsstateNotNeeded=false componentSpecified=false mActivityType=standardcompat={200dpi always-compat} theme=0x7f120142mLastReportedConfigurations:mGlobalConfig={1.0 ?mcc0mnc [en_US] ldltr sw1134dp w2003dp h1134dp 200dpi xlrg long hdr land car -touch -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 2504, 1418) mAppBounds=Rect(0, 0 - 2504, 1418) mMaxBounds=Rect(0, 0 - 2504, 1418) mDisplayRotation=ROTATION_0 mWindowingMode=fullscreen mActivityType=undefined mAlwaysOnTop=undefined mRotation=ROTATION_0} as.5 s.59 fontWeightAdjustment=0}mOverrideConfig={1.0 ?mcc0mnc [en_US] ldltr sw1134dp w2003dp h1134dp 200dpi xlrg long hdr land car -touch -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 2504, 1418) mAppBounds=Rect(0, 0 - 2504, 1418) mMaxBounds=Rect(0, 0 - 2504, 1418) mDisplayRotation=ROTATION_0 mWindowingMode=fullscreen mActivityType=standard mAlwaysOnTop=undefined mRotation=ROTATION_0} as.5 s.2 fontWeightAdjustment=0}mLastReportedActivityWindowInfo=ActivityWindowInfo{isEmbedded=false, taskBounds=Rect(0, 0 - 2504, 1418), taskFragmentBounds=Rect(0, 0 - 2504, 1418)}CurrentConfiguration={1.0 ?mcc0mnc [en_US] ldltr sw1134dp w2003dp h1134dp 200dpi xlrg long hdr land car -touch -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 2504, 1418) mAppBounds=Rect(0, 0 - 2504, 1418) mMaxBounds=Rect(0, 0 - 2504, 1418) mDisplayRotation=ROTATION_0 mWindowingMode=fullscreen mActivityType=standard mAlwaysOnTop=undefined mRotation=ROTATION_0} as.5 s.2 fontWeightAdjustment=0}RequestedOverrideConfiguration={0.0 ?mcc0mnc ?localeList ?layoutDir ?swdp ?wdp ?hdp ?density ?lsize ?long ?ldr ?wideColorGamut ?orien ?uimode ?night ?touch ?keyb/?/? ?nav/? winConfig={ mBounds=Rect(0, 0 - 0, 0) mAppBounds=null mMaxBounds=Rect(0, 0 - 0, 0) mDisplayRotation=undefined mWindowingMode=undefined mActivityType=standard mAlwaysOnTop=undefined mRotation=undefined} ?fontWeightAdjustment}taskDescription: label="null" icon=null iconResource=/0 iconFilename=null primaryColor=ff91cef5backgroundColor=ff181c1f statusBarColor=ff000000 navigationBarColor=808080backgroundColorFloating=ff181c1flaunchFailed=false launchCount=1 lastLaunchTime=-4s39msmHaveState=false mIcicle=nullstate=RESUMED delayedResume=false finishing=falsekeysPaused=false inHistory=true idle=trueoccludesParent=true noDisplay=false immersive=false launchMode=2mActivityType=standardmImeInsetsFrozenUntilStartInput=falsewindows=[Window{e951aaf u11 com.android.car.settings/com.android.car.settings.Settings_Launcher_Homepage}]windowType=2mOccludesParent=trueoverrideOrientation=SCREEN_ORIENTATION_UNSPECIFIEDrequestedOrientation=SCREEN_ORIENTATION_UNSPECIFIEDmVisibleRequested=true mVisible=true mClientVisible=true reportedDrawn=true reportedVisible=truemNumInterestingWindows=1 mNumDrawnWindows=1 allDrawn=true lastAllDrawn=true)startingData=null firstWindowDrawn=true mIsExiting=falsenowVisible=true lastVisibleTime=-3s316msconnections={ConnectionRecord{20ce848 u11 CR com.android.car/.CarService:@d162eb flags=0x1}, ConnectionRecord{b653965 u11 CR com.android.car/.CarService:@714025c flags=0x1}, ConnectionRecord{cb55873 u11 CR com.android.car/.CarService:@d501ce2 flags=0x1}}resizeMode=RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSIONmLastReportedMultiWindowMode=false mLastReportedPictureInPictureMode=falsesupportsSizeChanges=SIZE_CHANGES_UNSUPPORTED_METADATA**configChanges=0x3**neverSandboxDisplayApis=falsealwaysSandboxDisplayApis=falseisTransparentPolicyRunning=falseareBoundsLetterboxed=falseisLetterboxRunning=false

2,计算configChanges配置

configChanges=0x3是通过一些常量值进行按位逻辑或(|)运算,得到的一个组合值。
常量的定义在sourceCode/frameworks/base/core/res/res/values/attrs_manifest.xml
所以通过计算得知,Settings activity的configChanges=0x3就是mcc|mnc的组合配置。

    <attr name="configChanges"><!-- The IMSI MCC has changed, that is a SIM has been detected andupdated the Mobile Country Code. By default from Android O, wedon't recreate the activity even the app doesn't specify mcc inconfigChanges. If the app wants to recreate the activity, specifymcc in recreateOnConfigChanges. --><flag name="mcc" value="0x0001" /><!-- The IMSI MNC has changed, that is a SIM has been detected andupdated the Mobile Network Code. By default from Android O, wedon't recreate the activity even the app doesn't specify mnc inconfigChanges. If the app wants to recreate the acvitity, specifymnc in recreateOnConfigChanges. --><flag name="mnc" value="0x0002" /><!-- The locale has changed, that is the user has selected a newlanguage that text should be displayed in. --><flag name="locale" value="0x0004" /><!-- The touchscreen has changed.  Should never normally happen. --><flag name="touchscreen" value="0x0008" /><!-- The keyboard type has changed, for example the user has pluggedin an external keyboard. --><flag name="keyboard" value="0x0010" /><!-- The keyboard or navigation accessibility has changed, for examplethe user has slid the keyboard out to expose it.  Note thatdespite its name, this applied to any accessibility: keyboardor navigation. --><flag name="keyboardHidden" value="0x0020" /><!-- The navigation type has changed.  Should never normally happen. --><flag name="navigation" value="0x0040" /><!-- The screen orientation has changed, that is the user hasrotated the device. --><flag name="orientation" value="0x0080" /><!-- The screen layout has changed.  This might be caused by adifferent display being activated. --><flag name="screenLayout" value="0x0100" /><!-- The global user interface mode has changed.  For example,going in or out of car mode, night mode changing, etc. --><flag name="uiMode" value="0x0200" /><!-- The current available screen size has changed.  If applications don'ttarget at least {@link android.os.Build.VERSION_CODES#HONEYCOMB_MR2}then the activity will always handle this itself (the changewill not result in a restart).  This represents a change in thecurrently available size, so will change when the user switchesbetween landscape and portrait. --><flag name="screenSize" value="0x0400" /><!-- The physical screen size has changed.  If applications don'ttarget at least {@link android.os.Build.VERSION_CODES#HONEYCOMB_MR2}then the activity will always handle this itself (the changewill not result in a restart).  This represents a change in sizeregardless of orientation, so will only change when the actualphysical screen size has changed such as switching to an externaldisplay. --><flag name="smallestScreenSize" value="0x0800" /><!-- The display density has changed. This might be caused by the userspecifying a different display scale, or it might be caused by adifferent display being activated. --><flag name="density" value="0x1000" /><!-- The layout direction has changed. For example going from LTR to RTL. --><flag name="layoutDirection" value="0x2000" /><!-- The color mode of the screen has changed (color gamut or dynamic range). --><flag name="colorMode" value="0x4000" /><!-- The grammatical gender has changed, for example the user set the grammatical genderfrom the UI. --><flag name="grammaticalGender" value="0x8000" /><!-- The font scaling factor has changed, that is the user hasselected a new global font size. --><flag name="fontScale" value="0x40000000" /><!-- The font weight adjustment value has changed. Used to reflect the user increasing fontweight. --><flag name="fontWeightAdjustment" value="0x10000000" /><!-- The assets paths have changed. For example a runtime overlay is installed and enabled.Corresponds to {@link android.content.pm.ActivityInfo#CONFIG_ASSETS_PATHS}. --><flag name="assetsPaths" value="0x80000000" /><!-- This is probably not the flag you want, the resources compiler supports a lessdangerous version of it, 'allKnown', that only suppresses all currently existingconfiguration change restarts depending on your target SDK rather than whatever thelatest SDK supports, allowing the application to work with resources on future Platformversions.Activity doesn't use Android Resources at all and doesn't need to be restarted on anyconfiguration changes. This overrides all other flags, and this is recommended to beused individually. Corresponds to{@link android.content.pm.ActivityInfo#CONFIG_RESOURCES_UNUSED}. --><flag name="resourcesUnused" value="0x8000000" /></attr>

文章转载自:

http://ArBIIRxb.Lxjcr.cn
http://WY8jZL1S.Lxjcr.cn
http://llk5xd5D.Lxjcr.cn
http://W8jSxccy.Lxjcr.cn
http://NdyhMQy3.Lxjcr.cn
http://SJ7AeGCI.Lxjcr.cn
http://gLvG4aXF.Lxjcr.cn
http://9ciZgcvH.Lxjcr.cn
http://ZD3jHmD1.Lxjcr.cn
http://rIFjgF8D.Lxjcr.cn
http://zaczJdzX.Lxjcr.cn
http://bSsDnR2U.Lxjcr.cn
http://7Y8zqY7N.Lxjcr.cn
http://xWwtO0yh.Lxjcr.cn
http://0xsO9AlC.Lxjcr.cn
http://ZspkCGlG.Lxjcr.cn
http://Sj8olLcx.Lxjcr.cn
http://RA3kqyhu.Lxjcr.cn
http://kwliENJN.Lxjcr.cn
http://BwQntTRe.Lxjcr.cn
http://VpJUR1aD.Lxjcr.cn
http://l8h5wv7Q.Lxjcr.cn
http://wH6DspYK.Lxjcr.cn
http://NGYiWJ5k.Lxjcr.cn
http://A7B2S7m5.Lxjcr.cn
http://ntnovHAn.Lxjcr.cn
http://4FCCbmdP.Lxjcr.cn
http://mwhl6n52.Lxjcr.cn
http://hxo21OkA.Lxjcr.cn
http://viNFrN0R.Lxjcr.cn
http://www.dtcms.com/a/385914.html

相关文章:

  • 智能语音机器人如何提升语音交互机器人的交互能力?
  • 一文读懂Docker:从入门到实践
  • 控制IP端口访问的方法
  • VS2017 下openssl-1.1.1+ libwebsockets-4.0.0 编译
  • 从 “无感服务” 到 “情感连接”:智慧园区如何用科技重构企业归属感
  • 封装形成用助焊剂:电子制造“隐形桥梁”的技术突围与全球产业重构
  • 3dsMax 2026 .NET Core 8 转型下的Maxscript脚本开发:动态编译模块的重构策略与兼容性升级路径
  • 高并发异步处理实战指南与性能优化策略
  • React18学习笔记(二) React的状态管理工具--Redux,案例--移动端外卖平台
  • ReactJS + DynamoDB 性能优化方案
  • Next.js与React服务端渲染演进全解析
  • C++ `std::future` 与 `std::promise` 超全解析笔记
  • VScode插件Remote-SSH
  • 挣脱网络桎梏:CapsWriter-Offline+cpolar,让高效输入不受网络牵绊
  • Qt地图软件开发/GIS软件开发组件/修改天地图支持21级别/离线瓦片地图
  • Kafka 跨集群地理复制(Geo-Replication)
  • ​​[硬件电路-235]:双极型三极管、MOS场效应管、IGBT管异同比较
  • Spark专题-第二部分:Spark SQL 入门(1)-Spark SQL 简介
  • Spark源码学习分享之submit提交流程(1)
  • 5、二叉树-小堆
  • 技术奇点爆发周:2025 年 9 月科技突破全景扫描
  • 从Dubbo到SpringCloud Alibaba:大型项目迁移的实战手册(含成本分析与踩坑全记录)(一)
  • 【算法】C语言多组输入输出模板
  • 测试 Docker 的实时恢复功能
  • 系统中间件与云虚拟化-serverless-基于阿里云函数计算的云工作流CloudFlow设计与体验
  • springboot netty 客户端网络编程入门与实战
  • TCP/IP模型
  • 智慧用电安全管理系统的核心优势
  • flutter结合NestedScrollView+TabBar实现嵌套滚动
  • 基于定制开发开源AI智能名片S2B2C商城小程序的社群团购线上平台搭建研究