基于Android R版本分析
在Android R的move-stack接口中,我们发现在moveStackToTaskDisplayArea方法中,Android R相较于Android S缺少了一个stack.resumeNextFocusAfterReparent();
逻辑的调用,而这个逻辑的实现功能,就是恢复当前TaskDisplayArea中Top Task的生命周期状态和visible状态;
在resumeNextFocusAfterReparent()方法中执行了3个逻辑:
- adjustFocusToNextFocusableTask
- resumeFocusedStacksTopActivities
- ensureActivitiesVisible
resumeNextFocusAfterReparent
这个方法是Android R中缺省的一个方法,需要开发者自己在Task类中实现该方法的逻辑(参考Android S);
csharp
void resumeNextFocusAfterReparent() {
adjustFocusToNextFocusableTask("reparent", true /* allowFocusSelf */,
true /* moveDisplayToTop */);
mRootWindowContainer.resumeFocusedStacksTopActivities();
mRootWindowContainer.ensureActivitiesVisible(null /* starting */, 0 /* configChanges */,
!PRESERVE_WINDOWS);
}
上述方法中涉及到的三个方法都是Android R中已经存在的,可以直接调用即可;

adjustFocusToNextFocusableTask

resumeFocusedStacksTopActivities

ensureActivitiesVisible
