Android12 开机后桌面加载框的适配

发布于:2025-06-13 ⋅ 阅读:(13) ⋅ 点赞:(0)

在做A12竖屏转横屏适配屏幕时,开机后,桌面加载未完成时,加载框还是竖屏,怎样适配呢?

一 问题:

竖屏转横屏,开机进入桌面,桌面加载框未能适配屏幕,如图所示

二 解析:

查看日志,我们得出该类是FallbackHome类。位置位于Settings模块下(问题过去太久,日志找不到了)

三方案:

packages/apps/Settings/src/com/android/settings/FallbackHome.java

2575         <!-- Triggered when user-selected home app isn't encryption aware -->
2576         <activity android:name=".FallbackHome"
2577                   android:excludeFromRecents="true"
2578                   android:label=""
2579                   android:configChanges="mnc|mcc|keyboard|keyboardHidden|uiMode"
2580                   android:screenOrientation="nosensor"
2581                   android:taskAffinity="com.android.settings.FallbackHome"
2582                   android:exported="true"
2583                   android:theme="@style/FallbackHome">
2584             <intent-filter android:priority="-1000">
2585                 <action android:name="android.intent.action.MAIN" />
2586                 <category android:name="android.intent.category.HOME" />
2587                 <category android:name="android.intent.category.DEFAULT" />
2588             </intent-filter>
2589         </activity>

可以将android:screenOrientation="nosensor"改成android:screenOrientation="landscape" 

参考文章:

Android Framework 常见解决方案(24)屏蔽FallbackHome,去除 Android正在启动,直接进入Launcher

frameworks 之FallbackHome