• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2020 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.wm.shell.legacysplitscreen;
18 
19 import android.graphics.Rect;
20 import android.window.WindowContainerToken;
21 
22 import com.android.wm.shell.common.annotations.ExternalThread;
23 
24 import java.io.PrintWriter;
25 import java.util.function.BiConsumer;
26 import java.util.function.Consumer;
27 
28 /**
29  * Interface to engage split screen feature.
30  */
31 @ExternalThread
32 public interface LegacySplitScreen {
33     /** Called when keyguard showing state changed. */
onKeyguardVisibilityChanged(boolean isShowing)34     void onKeyguardVisibilityChanged(boolean isShowing);
35 
36     /** Returns {@link DividerView}. */
getDividerView()37     DividerView getDividerView();
38 
39     /** Returns {@code true} if one of the split screen is in minimized mode. */
isMinimized()40     boolean isMinimized();
41 
42     /** Returns {@code true} if the home stack is resizable. */
isHomeStackResizable()43     boolean isHomeStackResizable();
44 
45     /** Returns {@code true} if the divider is visible. */
isDividerVisible()46     boolean isDividerVisible();
47 
48     /** Switch to minimized state if appropriate. */
setMinimized(boolean minimized)49     void setMinimized(boolean minimized);
50 
51     /** Called when there's a task undocking. */
onUndockingTask()52     void onUndockingTask();
53 
54     /** Called when app transition finished. */
onAppTransitionFinished()55     void onAppTransitionFinished();
56 
57     /** Dumps current status of Split Screen. */
dump(PrintWriter pw)58     void dump(PrintWriter pw);
59 
60     /** Registers listener that gets called whenever the existence of the divider changes. */
registerInSplitScreenListener(Consumer<Boolean> listener)61     void registerInSplitScreenListener(Consumer<Boolean> listener);
62 
63     /** Unregisters listener that gets called whenever the existence of the divider changes. */
unregisterInSplitScreenListener(Consumer<Boolean> listener)64     void unregisterInSplitScreenListener(Consumer<Boolean> listener);
65 
66     /** Registers listener that gets called whenever the split screen bounds changes. */
registerBoundsChangeListener(BiConsumer<Rect, Rect> listener)67     void registerBoundsChangeListener(BiConsumer<Rect, Rect> listener);
68 
69     /** @return the container token for the secondary split root task. */
getSecondaryRoot()70     WindowContainerToken getSecondaryRoot();
71 
72     /**
73      * Splits the primary task if feasible, this is to preserve legacy way to toggle split screen.
74      * Like triggering split screen through long pressing recents app button or through
75      * {@link android.accessibilityservice.AccessibilityService#GLOBAL_ACTION_TOGGLE_SPLIT_SCREEN}.
76      *
77      * @return {@code true} if it successes to split the primary task.
78      */
splitPrimaryTask()79     boolean splitPrimaryTask();
80 
81     /**
82      * Exits the split to make the primary task fullscreen.
83      */
dismissSplitToPrimaryTask()84     void dismissSplitToPrimaryTask();
85 }
86