R项目手势导航操作出现No focusable windows

ANR  no focus window
log输出
09-22 23:46:03.075  1758  3460 I WindowManager:  activity:ActivityRecord{46ce519 u0 com.xxxx.launcher/com.android.quickstep.recents_ui_overrides.src.com.android.launcher3.uioverrides.QuickstepLauncher t18997} focusedApp:ActivityRecord{9bf121f u0 com.android.settings/.Settings t19001} 1
///activity代表DisplayContent. mFindFocusedWindow中的 w.mActivityRecord,而 focusedApp则为mFocusedApp
当focus与front两个window不一致时则会输出如下log,将 mTmpWindow = null,findFocusedWindow返回为null,即focus window为null,没有获取焦点的界面。
09-22 23:46:03.075  1758  3460 V WindowManager: findFocusedWindow: Reached focused app=ActivityRecord{9bf121f u0 com.android.settings/.Settings t19001}

09-22 23:46:03.075  1758  3460 V WindowManager: findFocusedWindow: No focusable windows.
继而findFocusedWindowIfNeeded输出为null即 updateFocusedWindowLocked中的newFocus为null,
则问题在于 mFocusedApp不等于w.mActivityRecord,需要查找设置focus app的地方。

frameworks/base/services/core/java/com/android/server/wm/RecentsAnimationController.java
private final IRecentsAnimationController mController = new IRecentsAnimationController.Stub() {


        @Override
        public void finish(boolean moveHomeToTop, boolean sendUserLeaveHint) {
           //结束动画
           mCallbacks.onAnimationFinished(moveHomeToTop? REORDER_MOVE_TO_TOP: REORDER_MOVE_TO_ORIGINAL_POSITION, sendUserLeaveHint);
        }   
}

/frameworks/base/services/core/java/com/android/server/wm/RecentsAnimation.java
      @Override
      public void onAnimationFinished(@RecentsAnimationController.ReorderMode int reorderMode,
              boolean sendUserLeaveHint) {
          finishAnimation(reorderMode, sendUserLeaveHint);
      }
     private void finishAnimation(@RecentsAnimationController.ReorderMode int reorderMode,
              boolean sendUserLeaveHint) {
              //结束动画,将目标activity的task移动到前台
                            targetStack.moveTaskToFront(targetActivity.getTask(),
                                    true /* noAnimation */, null /* activityOptions */,
                                    targetActivity.appTimeTracker,
                                    "RecentsAnimation.onAnimationFinished()");              
              
    }
/frameworks/base/services/core/java/com/android/server/wm/ActivityStack.java 
     final void moveTaskToFront(Task tr, boolean noAnimation, ActivityOptions options,
              AppTimeTracker timeTracker, boolean deferResume, String reason)  -->
      if (DEBUG_SWITCH) Slog.v(TAG_SWITCH, "moveTaskToFront: " + tr);
frameworks/base/services/core/java/com/android/server/wm/ActivityRecord.java
boolean moveFocusableActivityToTop(String reason) --->

frameworks/base/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
void setResumedActivityUncheckLocked(ActivityRecord r, String reason)--->

/frameworks/base/services/core/java/com/android/server/wm/DisplayContent.java 
void setFocusedApp(ActivityRecord r, boolean moveFocusNow) ---->setFocusedApp(ActivityRecord newFocus) 

 

你可能感兴趣的:(R项目手势导航操作出现No focusable windows)