blob: 42e065a113e60c1ac7f0fd03bd0682b3f61ec4d7 [file] [log] [blame]
TYM Tsai2fc027d2018-12-04 19:28:19 +08001/*
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
17package com.android.systemui.dock;
18
19/**
Jerry Chang4bbf1592019-11-15 06:52:54 +080020 * Allows an app to handle dock events.
TYM Tsai2fc027d2018-12-04 19:28:19 +080021 */
22public interface DockManager {
23
24 /**
Jerry Chang4bbf1592019-11-15 06:52:54 +080025 * Uninitialized / undocking dock states.
TYM Tsai2fc027d2018-12-04 19:28:19 +080026 */
27 int STATE_NONE = 0;
28 /**
29 * The state for docking
30 */
Jerry Chang5d3eb4472018-12-21 11:49:06 +080031 int STATE_DOCKED = 1;
TYM Tsai2fc027d2018-12-04 19:28:19 +080032 /**
Jerry Chang4bbf1592019-11-15 06:52:54 +080033 * The state for docking without showing UI.
TYM Tsai2fc027d2018-12-04 19:28:19 +080034 */
Jerry Chang5d3eb4472018-12-21 11:49:06 +080035 int STATE_DOCKED_HIDE = 2;
TYM Tsai2fc027d2018-12-04 19:28:19 +080036
37 /**
Jerry Chang4bbf1592019-11-15 06:52:54 +080038 * Indicates there's no alignment issue.
39 */
40 int ALIGN_STATE_GOOD = 0;
41
42 /**
43 * Indicates it's slightly not aligned with dock. Normally combines with slow charging issue.
44 */
45 int ALIGN_STATE_POOR = 1;
46
47 /**
48 * Indicates it's not aligned with dock. Normally combines with not charging issue.
49 */
50 int ALIGN_STATE_TERRIBLE = 2;
51
52 /**
53 * Adds a dock event listener into manager.
TYM Tsai2fc027d2018-12-04 19:28:19 +080054 *
Jerry Chang5d3eb4472018-12-21 11:49:06 +080055 * @param callback A {@link DockEventListener} which want to add
TYM Tsai2fc027d2018-12-04 19:28:19 +080056 */
57 void addListener(DockEventListener callback);
58
59 /**
Jerry Chang4bbf1592019-11-15 06:52:54 +080060 * Removes the added listener from dock manager
TYM Tsai2fc027d2018-12-04 19:28:19 +080061 *
TYM Tsai2d236902018-12-27 16:46:06 +080062 * @param callback A {@link DockEventListener} which want to remove
TYM Tsai2fc027d2018-12-04 19:28:19 +080063 */
64 void removeListener(DockEventListener callback);
65
lpeter8a5f4702019-01-18 16:53:07 +080066 /**
Jerry Chang4bbf1592019-11-15 06:52:54 +080067 * Adds a alignment listener into manager.
68 *
69 * @param listener A {@link AlignmentStateListener} which want to add
70 */
71 void addAlignmentStateListener(AlignmentStateListener listener);
72
73 /**
74 * Removes the added alignment listener from dock manager.
75 *
76 * @param listener A {@link AlignmentStateListener} which want to remove
77 */
78 void removeAlignmentStateListener(AlignmentStateListener listener);
79
80 /**
lpeter8a5f4702019-01-18 16:53:07 +080081 * Returns true if the device is in docking state.
82 */
83 boolean isDocked();
84
Jerry Chang4bbf1592019-11-15 06:52:54 +080085 /**
86 * Listens to dock events.
87 */
TYM Tsai2fc027d2018-12-04 19:28:19 +080088 interface DockEventListener {
89 /**
Jerry Chang4bbf1592019-11-15 06:52:54 +080090 * Override to handle dock events.
TYM Tsai2fc027d2018-12-04 19:28:19 +080091 */
92 void onEvent(int event);
93 }
Jerry Chang4bbf1592019-11-15 06:52:54 +080094
95 /**
96 * Listens to dock alignment state changed.
97 */
98 interface AlignmentStateListener {
99 /**
100 * Override to handle alignment state changes.
101 */
102 void onAlignmentStateChanged(int alignState);
103 }
TYM Tsai2fc027d2018-12-04 19:28:19 +0800104}