Android15 launcher3

修改布局查看device_profiles.xml ,根据不同的网格数加载

java 复制代码
packages/apps/Launcher3/res/xml/device_profiles.xml

<grid-option
    launcher:name="6_by_5"
    launcher:numRows="5"
    launcher:numColumns="6"
    launcher:numSearchContainerColumns="3"
    launcher:numExtendedHotseatIcons="6"
    launcher:numFolderRows="3"
    launcher:numFolderColumns="3"
    launcher:numHotseatIcons="6"
    launcher:numAllAppsColumns="6"
    launcher:isScalable="true"
    launcher:inlineNavButtonsEndSpacing="@dimen/taskbar_button_margin_6_5"
    launcher:devicePaddingId="@xml/paddings_6x5"
    launcher:dbFile="launcher_6_by_5.db"
    launcher:defaultLayoutId="@xml/default_workspace_6x5"
    launcher:deviceCategory="tablet" >

注意device下查看是否有相同的文件

如果需要显示 6*5 的布局需要将这个grid-option 对齐其他地方的文件,不然会不起作用。


上面的属性如 numRows numColumns 在attrs.xml定义  
packages/apps/Launcher3/res/values/attrs.xml
查看 <declare-styleable name="GridDisplayOption">



需要添加6列的Hotseat 不起作用,查看log发现LoaderCursor 有输出error
packages/apps/Launcher3/src/com/android/launcher3/model/LoaderCursor.java
if (item.screenId >= mIDP.numDatabaseHotseatIcons) {

    Log.e(TAG, "Error loading shortcut " + item
            + " into hotseat position screenId=" + item.screenId
            + ", position out of bounds: (0 to " + (mIDP.numDatabaseHotseatIcons - 1)
            + ")");
    return false;
}

//mIDP.numDatabaseHotseatIcons  这个位置一直输出 4,最后只加载4个图标,反追查搜索numDatabaseHotseatIcons 找到位置  InvariantDeviceProfile.java 



追查实例化过程可以查看 numDatabaseHotseatIcons 
packages/apps/Launcher3/src/com/android/launcher3/InvariantDeviceProfile.java
查看实例化方法 initGrid 和 GridOption

AllApp界面拦截apk

packages/apps/Launcher3/src/com/android/launcher3/model/LoaderTask.java

private List<LauncherActivityInfo> loadAllApps() {

......

for (int i = 0; i < apps.size(); i++) {

LauncherActivityInfo app = apps.get(i);

//add

if("com.xxx.packges".equals(apps.get(i).getApplicationInfo().packageName)) {

continue;

}

//add end

......

AppInfo appInfo = new AppInfo(app, mUserCache.getUserInfo(user),

ApiWrapper.INSTANCE.get(mApp.getContext()), mPmHelper, quietMode);

if (Flags.enableSupportForArchiving() && app.getApplicationInfo().isArchived) {

相关推荐
安东尼肉店6 小时前
Android compose屏幕适配终极解决方案
android
2501_916007476 小时前
HTTPS 抓包乱码怎么办?原因剖析、排查步骤与实战工具对策(HTTPS 抓包乱码、gzipbrotli、TLS 解密、iOS 抓包)
android·ios·小程序·https·uni-app·iphone·webview
feiyangqingyun7 小时前
基于Qt和FFmpeg的安卓监控模拟器/手机摄像头模拟成onvif和28181设备
android·qt·ffmpeg
用户20187928316711 小时前
ANR之RenderThread不可中断睡眠state=D
android
煤球王子11 小时前
简单学:Android14中的Bluetooth—PBAP下载
android
小趴菜822711 小时前
安卓接入Max广告源
android
齊家治國平天下11 小时前
Android 14 系统 ANR (Application Not Responding) 深度分析与解决指南
android·anr
ZHANG13HAO11 小时前
Android 13.0 Framework 实现应用通知使用权默认开启的技术指南
android
【ql君】qlexcel11 小时前
Android 安卓RIL介绍
android·安卓·ril
写点啥呢11 小时前
android12解决非CarProperty接口深色模式设置后开机无法保持
android·车机·aosp·深色模式·座舱