android14 Launcher3 修改点简单记录

1.调整横屏模式下hotseat位置,由右侧调整为底部,并且解决allapps界面右侧空白问题
先使用dumpsys查看Launcher信息。
可以通过以下命令查找当前默认的Launcher。

adb shell cmd shortcut get-default-launcher
Launcher: ComponentInfo{com.android.launcher3/com.android.launcher3.uioverrides.QuickstepLauncher}
Success

进入对应的activity界面后,使用dumpsys 命令:adb shell dumpsys activity service com.android.launcher3
结果如下

SERVICE com.android.launcher3/com.android.quickstep.TouchInteractionService e6effd2 pid=3265 user=0
  Client:
    PluginManager:
      numEnabledPlugins=0
      numDisabledPlugins=0
      enabledPlugins=[]
      disabledPlugins=[]
    DeviceState:
      canStartSystemGesture=true
      systemUiFlags=268566528
      systemUiFlagsDesc=allow_gesture|awake
      assistantAvailable=false
      assistantDisabled=false
      isUserUnlocked=true
      isOneHandedModeEnabled=false
      isSwipeToNotificationEnabled=false
      deferredGestureRegion=Rect(10, 658 - 633, 720)
      exclusionRegion=Rect(0, 0 - 0, 0)
      pipIsActive=false
    RotationTouchHelper:
      currentActiveRotation=0
      displayRotation=0
    OrientationTouchTransformerState: 
      currentActiveRotation=0
      lastTouchedRegion=null
      multipleRegionsEnabled=false
      currentTouchableRotations=
      mNavBarGesturalHeight=62
      mNavBarLargerGesturalHeight=104
      mOneHandedModeRegion=RectF(0.0, 0.0, 0.0, 0.0)
    OverviewComponentObserver:
      isDefaultHome=true
      isHomeDisabled=false
      homeAndOverviewSame=true
      overviewIntent=Intent { act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10000000 pkg=com.android.launcher3 cmp=com.android.launcher3/.uioverrides.QuickstepLauncher }
      homeIntent=Intent { act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10000000 cmp=com.android.launcher3/.uioverrides.QuickstepLauncher }
    OverviewCommandHelper:
      mPendingCommands=0
      mTaskFocusIndexOverride=-1
    GestureState:
      gestureID=-1
      runningTask=null
      endTarget=null
      lastAppearedTaskTargetId=-1
      lastStartedTaskId=-1
      isRecentsAnimationRunning=false
    Input state:
      mInputMonitorCompat=null
      mInputEventReceiver=null
    DisplayController.Info:
      normalizedDisplayInfo=CachedDisplayInfo{size=Point(720, 720), cutout=Rect(0, 0 - 0, 0), rotation=0}
      rotation=0
      fontScale=1.0
      densityDpi=208
      navigationMode=THREE_BUTTONS
      currentSize=Point(720, 720)
      perDisplayBounds - CachedDisplayInfo{size=Point(720, 720), cutout=Rect(0, 0 - 0, 0), rotation=0}: [WindowBounds{bounds=Rect(0, 0 - 720, 720), insets=Rect(0, 31 - 0, 0), availableSize=Point(720, 689), rotationHint=0}, WindowBounds{bounds=Rect(0, 0 - 720, 720), insets=Rect(0, 36 - 62, 0), availableSize=Point(658, 684), rotationHint=1}, WindowBounds{bounds=Rect(0, 0 - 720, 720), insets=Rect(62, 36 - 0, 0), availableSize=Point(658, 684), rotationHint=2}, WindowBounds{bounds=Rect(0, 0 - 720, 720), insets=Rect(62, 36 - 0, 0), availableSize=Point(658, 684), rotationHint=3}]
    TouchState:
      createdOverviewActivity=com.android.launcher3.uioverrides.QuickstepLauncher@922531c
      resumed=true
      mConsumer=TYPE_NO_OP
    ActiveGestureErrorDetector:
    ActiveGestureLog history:
    RecentsModel:
      RecentTasksList:
        mChangeId=10
        mResultsUi=[id=-1, tasks=
        ]
        rawTasks=[
          t1: (id=9; package=com.android.gallery3d) t2: (id=-1; package=no package)
        ]
    ProtoTrace:
      file=/data/user/0/com.android.launcher3/files/launcher_trace.pb
    DeviceProfile:
        1 dp = 1.3000001 px
        isTablet:false
        isPhone:true
        transposeLayoutWithOrientation:true
        isGestureMode:false
        isLandscape:true
        isMultiWindowMode:false
        isTwoPanels:false
        windowX: 0.0px (0.0dp)
        windowY: 0.0px (0.0dp)
        widthPx: 720.0px (553.8462dp)
        heightPx: 720.0px (553.8462dp)
        availableWidthPx: 720.0px (553.8462dp)
        availableHeightPx: 689.0px (530.0dp)
        mInsets.left: 0.0px (0.0dp)
        mInsets.top: 31.0px (23.846155dp)
        mInsets.right: 0.0px (0.0dp)
        mInsets.bottom: 0.0px (0.0dp)
        aspectRatio:1.0
        isResponsiveGrid:false
        isScalableGrid:false
        inv.numRows: 4
        inv.numColumns: 4
        inv.numSearchContainerColumns: 4
        minCellSize: PointF(0.0, 0.0)dp
        cellWidthPx: 79.0px (60.769234dp)
        cellHeightPx: 111.0px (85.38462dp)
        getCellSize().x: 175.0px (134.61539dp)
        getCellSize().y: 128.0px (98.46154dp)
        cellLayoutBorderSpacePx Horizontal: 0.0px (0.0dp)
        cellLayoutBorderSpacePx Vertical: 0.0px (0.0dp)
        cellLayoutPaddingPx.left: 10.0px (7.692308dp)
        cellLayoutPaddingPx.top: 14.0px (10.769231dp)
        cellLayoutPaddingPx.right: 10.0px (7.692308dp)
        cellLayoutPaddingPx.bottom: 14.0px (10.769231dp)
        iconSizePx: 70.0px (53.846157dp)
        iconTextSizePx: 17.0px (13.076923dp)
        iconDrawablePaddingPx: 9.0px (6.923077dp)
        inv.numFolderRows: 3
        inv.numFolderColumns: 4
        folderCellWidthPx: 94.0px (72.30769dp)
    folderCellHeightPx: 109.0px (83.84615dp)
        folderChildIconSizePx: 70.0px (53.846157dp)
        folderChildTextSizePx: 17.0px (13.076923dp)
        folderChildDrawablePaddingPx: 5.0px (3.846154dp)
        folderCellLayoutBorderSpacePx: 0.0px (0.0dp)
        folderContentPaddingLeftRight: 10.0px (7.692308dp)
        folderTopPadding: 31.0px (23.846155dp)
        folderFooterHeight: 73.0px (56.153847dp)
        bottomSheetTopPadding: 45.0px (34.615387dp)
        bottomSheetOpenDuration: 267
        bottomSheetCloseDuration: 267
        bottomSheetWorkspaceScale: 1.0
        bottomSheetDepth: 0.0
        allAppsShiftRange: 390.0px (300.0dp)
        allAppsTopPadding: 0.0px (0.0dp)
        allAppsOpenDuration: 600
        allAppsCloseDuration: 300
        allAppsIconSizePx: 71.0px (54.615387dp)
        allAppsIconTextSizePx: 17.0px (13.076923dp)
        allAppsIconDrawablePaddingPx: 10.0px (7.692308dp)
        allAppsCellHeightPx: 156.0px (120.00001dp)
        allAppsCellWidthPx: 91.0px (70.0dp)
        allAppsBorderSpacePxX: 21.0px (16.153847dp)
        allAppsBorderSpacePxY: 21.0px (16.153847dp)
        numShownAllAppsColumns: 4
        allAppsLeftRightPadding: 10.0px (7.692308dp)
        allAppsLeftRightMargin: 0.0px (0.0dp)
        hotseatBarSizePx: 132.0px (101.53847dp)
        inv.hotseatColumnSpan: 4
        hotseatCellHeightPx: 79.0px (60.769234dp)
        hotseatBarBottomSpacePx: 62.0px (47.69231dp)
        hotseatBarSidePaddingStartPx: 0.0px (0.0dp)
        hotseatBarSidePaddingEndPx: 0.0px (0.0dp)
        hotseatBarEndOffset: 0.0px (0.0dp)
        hotseatQsbSpace: 0.0px (0.0dp)
        hotseatQsbHeight: 0.0px (0.0dp)
        springLoadedHotseatBarTopMarginPx: 99.0px (76.15385dp)
        getHotseatLayoutPadding(context).top: 0.0px (0.0dp)
        getHotseatLayoutPadding(context).bottom: 53.0px (40.769234dp)
        getHotseatLayoutPadding(context).left: 10.0px (7.692308dp)
        getHotseatLayoutPadding(context).right: 10.0px (7.692308dp)
        numShownHotseatIcons: 4
        hotseatBorderSpace: 0.0px (0.0dp)
        isQsbInline: false
        hotseatQsbWidth: 0.0px (0.0dp)
        isTaskbarPresent:false
        isTaskbarPresentInApps:false
        taskbarHeight: 78.0px (60.000004dp)
        stashedTaskbarHeight: 31.0px (23.846155dp)
        taskbarBottomMargin: 0.0px (0.0dp)
        taskbarIconSize: 63.0px (48.46154dp)
        desiredWorkspaceHorizontalMarginPx: 10.0px (7.692308dp)
        workspacePadding.left: 0.0px (0.0dp)
        workspacePadding.top: 0.0px (0.0dp)
        workspacePadding.right: 0.0px (0.0dp)
        workspacePadding.bottom: 149.0px (114.61539dp)
        iconScale: 1.0px (0.7692308dp)
        cellScaleToFit : 1.0px (0.7692308dp)
        extraSpace: 68.0px (52.307693dp)
        unscaled extraSpace: 68.0px (52.307693dp)
        maxEmptySpace: 0.0px (0.0dp)
        workspaceTopPadding: 0.0px (0.0dp)
        workspaceBottomPadding: 0.0px (0.0dp)
        overviewTaskMarginPx: 21.0px (16.153847dp)
        overviewTaskIconSizePx: 62.0px (47.69231dp)
        overviewTaskIconDrawableSizePx: 57.0px (43.846157dp)
        overviewTaskIconDrawableSizeGridPx: 0.0px (0.0dp)
        overviewTaskThumbnailTopMarginPx: 83.0px (63.846157dp)
        overviewActionsTopMarginPx: 31.0px (23.846155dp)
        overviewActionsHeight: 62.0px (47.69231dp)
        overviewActionsClaimedSpaceBelow: 0.0px (0.0dp)
        overviewActionsButtonSpacing: 47.0px (36.153847dp)
        overviewPageSpacing: 21.0px (16.153847dp)
        overviewRowSpacing: 0.0px (0.0dp)
        overviewGridSideMargin: 0.0px (0.0dp)
        dropTargetBarTopMarginPx: 42.0px (32.307693dp)
        dropTargetBarSizePx: 73.0px (56.153847dp)
        dropTargetBarBottomMarginPx: 21.0px (16.153847dp)
        getCellLayoutSpringLoadShrunkTop(): 167.0px (128.46155dp)
        getCellLayoutSpringLoadShrunkBottom(): 489.0px (376.15387dp)
        workspaceSpringLoadedMinNextPageVisiblePx: 31.0px (23.846155dp)
        getWorkspaceSpringLoadScale(): 0.5962963px (0.45868948dp)
        getCellLayoutHeight(): 540.0px (415.38464dp)
        getCellLayoutWidth(): 720.0px (553.8462dp)
    TaskbarManager:
        TaskbarActivityContext: null

可以看到isLandscape:true,表示当前是横屏。当前屏幕分辨率是720x720,当前其实是横屏竖用了。
如果只想改allapps界面右侧空白问题,可以参考这个:Android12 Launcher3横屏模式下,去掉allapps列表右侧空白
14上应该是对应这个函数:

// vendor/mediatek/proprietary/packages/apps/Launcher3/src/com/android/launcher3/DeviceProfile.java
    private void updateHotseatSizes(int hotseatIconSizePx) {
        // Ensure there is enough space for folder icons, which have a slightly larger radius.
        hotseatCellHeightPx = (int) Math.ceil(hotseatIconSizePx * ICON_OVERLAP_FACTOR);

        if (isVerticalBarLayout()) {
            hotseatBarSizePx = hotseatIconSizePx + hotseatBarSidePaddingStartPx
                    + hotseatBarSidePaddingEndPx;
        } else if (isQsbInline) {
            hotseatBarSizePx = Math.max(hotseatIconSizePx, hotseatQsbVisualHeight)
                    + hotseatBarBottomSpacePx;
        } else {
            hotseatBarSizePx = hotseatIconSizePx
                    + hotseatQsbSpace
                    + hotseatQsbVisualHeight
                    + hotseatBarBottomSpacePx;
        }
    }

由于我是调整横屏模式下hotseat位置,由右侧调整为底部,并且解决allapps界面右侧空白问题所以修改点如下,直接修改isVerticalBarLayout返回false即可:

vendor/mediatek/proprietary/packages/apps/Launcher3/src/com/android/launcher3/DeviceProfile.java 
     public boolean isVerticalBarLayout() {
-        return isLandscape && transposeLayoutWithOrientation;
+        return false;
+        //return isLandscape && transposeLayoutWithOrientation;
     }

如果是带gms包的版本,那就修改
这个位置的packages/apps/Launcher3/src/com/android/launcher3/DeviceProfile.java

参考链接:
Android 11 Launcher3旋转Hotseat显示在底部
Android12 Launcher3横屏模式下,去掉allapps列表右侧空白

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容