Home | History | Annotate | Download | only in dock
      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      * Add a dock event listener into manager
     39      *
     40      * @param callback A {@link DockEventListener} which want to add
     41      */
     42     void addListener(DockEventListener callback);
     43 
     44     /**
     45      * Remove the added listener from dock manager
     46      *
     47      * @param callback A {@link DockEventListener} which want to remove
     48      */
     49     void removeListener(DockEventListener callback);
     50 
     51     /**
     52     * Returns true if the device is in docking state.
     53     */
     54     boolean isDocked();
     55 
     56     /** Callback for receiving dock events */
     57     interface DockEventListener {
     58         /**
     59          * Override to handle dock events
     60          */
     61         void onEvent(int event);
     62     }
     63 }
     64