読者です 読者をやめる 読者になる 読者になる

のねのBlog

パソコンやソフト開発で起きた問題など書きます。よろしくお願いします。

android MultiWindowStateChangedEvent

Cross Reference: /frameworks/base/packages/SystemUI/src/com/android/systemui/recents/events/activity/MultiWindowStateChangedEvent.java

     25 public class MultiWindowStateChangedEvent extends EventBus.AnimatedEvent {
     26 
     27     public final boolean inMultiWindow;
     28     // This flag is only used when undocking a task
     29     public final boolean showDeferredAnimation;
     30     public final TaskStack stack;
     31 
     32     public MultiWindowStateChangedEvent(boolean inMultiWindow, boolean showDeferredAnimation,
     33             TaskStack stack) {
     34         this.inMultiWindow = inMultiWindow;
     35         this.showDeferredAnimation = showDeferredAnimation;
     36         this.stack = stack;
     37     }
     38 }
     39 

Cross Reference: /frameworks/base/packages/SystemUI/src/com/android/systemui/recents/views/SystemBarScrimViews.java

    155     public final void onBusEvent(MultiWindowStateChangedEvent event) {
    156         mHasDockedTasks = event.inMultiWindow;                         <==========
    157         animateScrimToCurrentNavBarState(event.stack.getStackTaskCount() > 0);
    158     }

Cross Reference: /frameworks/base/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java

    644     public final void onBusEvent(MultiWindowStateChangedEvent event) { <==========
    645         updateStack(event.stack, false /* setStackViewTasks */);
    646     }

Cross Reference: /frameworks/base/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java

   1990     public final void onBusEvent(final MultiWindowStateChangedEvent event) {
   1991         if (event.inMultiWindow || !event.showDeferredAnimation) {           <==========
   1992             setTasks(event.stack, true /* allowNotifyStackChanges */);
   1993         } else {
   1994             // Reset the launch state before handling the multiwindow change
   1995             RecentsActivityLaunchState launchState = Recents.getConfiguration().getLaunchState();
   1996             launchState.reset();
   1997 
   1998             // Defer until the next frame to ensure that we have received all the system insets, and
   1999             // initial layout updates
   2000             event.getAnimationTrigger().increment();
   2001             post(new Runnable() {
   2002                 @Override
   2003                 public void run() {
   2004                     // Scroll the stack to the front to see the undocked task
   2005                     mAnimationHelper.startNewStackScrollAnimation(event.stack,
   2006                             event.getAnimationTrigger());
   2007                     event.getAnimationTrigger().decrement();
   2008                 }
   2009             });
   2010         }
   2011     }

Cross Reference: /frameworks/base/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java

    461     @Override
    462     public void onMultiWindowModeChanged(boolean isInMultiWindowMode) {
    463         super.onMultiWindowModeChanged(isInMultiWindowMode);
    464 
    465         // Reload the task stack completely
    466         RecentsConfiguration config = Recents.getConfiguration();
    467         RecentsActivityLaunchState launchState = config.getLaunchState();
    468         RecentsTaskLoader loader = Recents.getTaskLoader();
    469         RecentsTaskLoadPlan loadPlan = loader.createLoadPlan(this);
    470         loader.preloadTasks(loadPlan, -1 /* runningTaskId */,
    471                 false /* includeFrontMostExcludedTask */);
    472 
    473         RecentsTaskLoadPlan.Options loadOpts = new RecentsTaskLoadPlan.Options();
    474         loadOpts.numVisibleTasks = launchState.launchedNumVisibleTasks;
    475         loadOpts.numVisibleTaskThumbnails = launchState.launchedNumVisibleThumbnails;
    476         loader.loadTasks(this, loadPlan, loadOpts);
    477 
    478         TaskStack stack = loadPlan.getTaskStack();
    479         int numStackTasks = stack.getStackTaskCount();
    480         boolean showDeferredAnimation = numStackTasks > 0;
    481 
    482         EventBus.getDefault().send(new ConfigurationChangedEvent(true /* fromMultiWindow */,
    483                 false /* fromDeviceOrientationChange */, false /* fromDisplayDensityChange */,
    484                 numStackTasks > 0));
    485         EventBus.getDefault().send(new MultiWindowStateChangedEvent(isInMultiWindowMode,
    486                 showDeferredAnimation, stack));
    487     }