• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2018 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.dock;
18 
19 /**
20  * Allows an app to handle dock events.
21  */
22 public interface DockManager {
23 
24     /**
25      * Uninitialized / undocking dock states.
26      */
27     int STATE_NONE = 0;
28     /**
29      * The state for docking
30      */
31     int STATE_DOCKED = 1;
32     /**
33      * The state for docking without showing UI.
34      */
35     int STATE_DOCKED_HIDE = 2;
36 
37     /**
38      * Indicates there's no alignment info. This could happen when the device is unable to decide
39      * its alignment condition.
40      */
41     int ALIGN_STATE_UNKNOWN = -1;
42 
43     /**
44      * Indicates there's no alignment issue.
45      */
46     int ALIGN_STATE_GOOD = 0;
47 
48     /**
49      * Indicates it's slightly not aligned with dock.
50      */
51     int ALIGN_STATE_POOR = 1;
52 
53     /**
54      * Indicates it's not aligned with dock.
55      */
56     int ALIGN_STATE_TERRIBLE = 2;
57 
58     /**
59      * Adds a dock event listener into manager.
60      *
61      * @param callback A {@link DockEventListener} which want to add
62      */
addListener(DockEventListener callback)63     void addListener(DockEventListener callback);
64 
65     /**
66      * Removes the added listener from dock manager
67      *
68      * @param callback A {@link DockEventListener} which want to remove
69      */
removeListener(DockEventListener callback)70     void removeListener(DockEventListener callback);
71 
72     /**
73      * Adds a alignment listener into manager.
74      *
75      * @param listener A {@link AlignmentStateListener} which want to add
76      */
addAlignmentStateListener(AlignmentStateListener listener)77     void addAlignmentStateListener(AlignmentStateListener listener);
78 
79     /**
80      * Removes the added alignment listener from dock manager.
81      *
82      * @param listener A {@link AlignmentStateListener} which want to remove
83      */
removeAlignmentStateListener(AlignmentStateListener listener)84     void removeAlignmentStateListener(AlignmentStateListener listener);
85 
86     /**
87     * Returns true if the device is in docking state.
88     */
isDocked()89     boolean isDocked();
90 
91     /**
92      * Returns true if it is hiding docking UI.
93      */
isHidden()94     boolean isHidden();
95 
96     /**
97      * Listens to dock events.
98      */
99     interface DockEventListener {
100         /**
101          * Override to handle dock events.
102          */
onEvent(int event)103         void onEvent(int event);
104     }
105 
106     /**
107      * Listens to dock alignment state changed.
108      */
109     interface AlignmentStateListener {
110         /**
111          * Override to handle alignment state changes.
112          */
onAlignmentStateChanged(int alignState)113         void onAlignmentStateChanged(int alignState);
114     }
115 }
116