The launcher desktop stays in the default main interface when you start it for the first time (it will not jump to the secondary page)

packages/apps/Launcher3/src/com/android/launcher3/Launcher.java

method

public void bindItems(finalList<ItemInfo> items, final boolean forceAnimateIcons) {

int currentScreenId =mWorkspace.getScreenIdForPageIndex(mWorkspace.getNextPage());
           final int newScreenIndex =mWorkspace.getPageIndexForScreenId(newItemsScreenId);
           final Runnable startBounceAnimRunnable = anim::start;
 
           if (newItemsScreenId != currentScreenId) {
                // We post the animationslightly delayed to prevent slowdowns
                // when we are loading rightafter we return to launcher.
                mWorkspace.postDelayed(newRunnable() {
                    public void run() {
                        if (mWorkspace != null){
                           AbstractFloatingView.closeAllOpenViews(Launcher.this, false);
 
                            /*/tyd.yantao20230201 avoid first load not in homePage
                            mWorkspace.snapToPage(newScreenIndex);
                            //*/
                           mWorkspace.postDelayed(startBounceAnimRunnable,
                                   NEW_APPS_ANIMATION_DELAY);
                        }
                    }
                }, NEW_APPS_PAGE_MOVE_DELAY);

At this time, it is to enter this if (newItemsScreenId != currentScreenId) {, normally this should not be done, so mWorkspace.snapToPage(newScreenIndex); is executed later, this is in the delay thread, so it will go to the main interface first Go to the subpage later

Guess you like

Origin blog.csdn.net/youthking1314/article/details/128913908