1 /*
2  * Copyright (C) 2017 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.systemui.shared.recents;
18 
19 import android.graphics.Bitmap;
20 import android.graphics.Insets;
21 import android.graphics.Rect;
22 import android.os.Bundle;
23 import android.view.MotionEvent;
24 
25 import com.android.systemui.shared.recents.IPinnedStackAnimationListener;
26 import com.android.systemui.shared.recents.model.Task;
27 
28 /**
29  * Temporary callbacks into SystemUI.
30  * Next id = 27
31  */
32 interface ISystemUiProxy {
33 
34     /**
35      * Proxies SurfaceControl.screenshotToBuffer().
36      * @Removed
37      * GraphicBufferCompat screenshot(in Rect sourceCrop, int width, int height, int minLayer,
38      *             int maxLayer, boolean useIdentityTransform, int rotation) = 0;
39      */
40 
41     /**
42      * Begins screen pinning on the provided {@param taskId}.
43      */
startScreenPinning(int taskId)44     void startScreenPinning(int taskId) = 1;
45 
46     /**
47      * Notifies SystemUI that split screen has been invoked.
48      */
onSplitScreenInvoked()49     void onSplitScreenInvoked() = 5;
50 
51     /**
52      * Notifies SystemUI that Overview is shown.
53      */
onOverviewShown(boolean fromHome)54     void onOverviewShown(boolean fromHome) = 6;
55 
56     /**
57      * Get the secondary split screen app's rectangle when not minimized.
58      */
getNonMinimizedSplitScreenSecondaryBounds()59     Rect getNonMinimizedSplitScreenSecondaryBounds() = 7;
60 
61     /**
62      * Control the {@param alpha} of the back button in the navigation bar and {@param animate} if
63      * needed from current value
64      * @deprecated
65      */
setBackButtonAlpha(float alpha, boolean animate)66     void setBackButtonAlpha(float alpha, boolean animate) = 8;
67 
68     /**
69      * Control the {@param alpha} of the option nav bar button (back-button in 2 button mode
70      * and home bar in no-button mode) and {@param animate} if needed from current value
71      */
setNavBarButtonAlpha(float alpha, boolean animate)72     void setNavBarButtonAlpha(float alpha, boolean animate) = 19;
73 
74     /**
75      * Proxies motion events from the homescreen UI to the status bar. Only called when
76      * swipe down is detected on WORKSPACE. The sender guarantees the following order of events on
77      * the tracking pointer.
78      *
79      * Normal gesture: DOWN, MOVE/POINTER_DOWN/POINTER_UP)*, UP or CANCLE
80      */
81     void onStatusBarMotionEvent(in MotionEvent event) = 9;
82 
83     /**
84      * Proxies the assistant gesture's progress started from navigation bar.
85      */
onAssistantProgress(float progress)86     void onAssistantProgress(float progress) = 12;
87 
88     /**
89     * Proxies the assistant gesture fling velocity (in pixels per millisecond) upon completion.
90     * Velocity is 0 for drag gestures.
91     */
onAssistantGestureCompletion(float velocity)92     void onAssistantGestureCompletion(float velocity) = 18;
93 
94     /**
95      * Start the assistant.
96      */
97     void startAssistant(in Bundle bundle) = 13;
98 
99     /**
100      * Creates a new gesture monitor
101      */
monitorGestureInput(String name, int displayId)102     Bundle monitorGestureInput(String name, int displayId) = 14;
103 
104     /**
105      * Notifies that the accessibility button in the system's navigation area has been clicked
106      */
notifyAccessibilityButtonClicked(int displayId)107     void notifyAccessibilityButtonClicked(int displayId) = 15;
108 
109     /**
110      * Notifies that the accessibility button in the system's navigation area has been long clicked
111      */
notifyAccessibilityButtonLongClicked()112     void notifyAccessibilityButtonLongClicked() = 16;
113 
114     /**
115      * Ends the system screen pinning.
116      */
stopScreenPinning()117     void stopScreenPinning() = 17;
118 
119     /**
120      * Sets the shelf height and visibility.
121      */
setShelfHeight(boolean visible, int shelfHeight)122     void setShelfHeight(boolean visible, int shelfHeight) = 20;
123 
124     /**
125      * Handle the provided image as if it was a screenshot.
126      *
127      * Deprecated, use handleImageBundleAsScreenshot with image bundle and UserTask
128      * @deprecated
129      */
handleImageAsScreenshot(in Bitmap screenImage, in Rect locationInScreen, in Insets visibleInsets, int taskId)130     void handleImageAsScreenshot(in Bitmap screenImage, in Rect locationInScreen,
131               in Insets visibleInsets, int taskId) = 21;
132 
133     /**
134      * Sets the split-screen divider minimized state
135      */
setSplitScreenMinimized(boolean minimized)136     void setSplitScreenMinimized(boolean minimized) = 22;
137 
138     /*
139      * Notifies that the swipe-to-home (recents animation) is finished.
140      */
notifySwipeToHomeFinished()141     void notifySwipeToHomeFinished() = 23;
142 
143     /**
144      * Sets listener to get pinned stack animation callbacks.
145      */
146     void setPinnedStackAnimationListener(IPinnedStackAnimationListener listener) = 24;
147 
148     /**
149      * Notifies that quickstep will switch to a new task
150      * @param rotation indicates which Surface.Rotation the gesture was started in
151      */
onQuickSwitchToNewTask(int rotation)152     void onQuickSwitchToNewTask(int rotation) = 25;
153 
154     /**
155      * Handle the provided image as if it was a screenshot.
156      */
handleImageBundleAsScreenshot(in Bundle screenImageBundle, in Rect locationInScreen, in Insets visibleInsets, in Task.TaskKey task)157     void handleImageBundleAsScreenshot(in Bundle screenImageBundle, in Rect locationInScreen,
158               in Insets visibleInsets, in Task.TaskKey task) = 26;
159 }
160