packages/apps/Launcher3/src/com/android/launcher3/Launcher.java
方法
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);
就此时是走进这个 if (newItemsScreenId != currentScreenId) {,正常来说应该不走这个,所以后面就执行了mWorkspace.snapToPage(newScreenIndex);,这个是在延迟线程里,所以会先到主界面过一会转到副页