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 * A rudimentary fake for DockManager. 21 */ 22 public class DockManagerFake implements DockManager { 23 DockEventListener mCallback; 24 AlignmentStateListener mAlignmentListener; 25 private boolean mDocked; 26 27 @Override addListener(DockEventListener callback)28 public void addListener(DockEventListener callback) { 29 this.mCallback = callback; 30 } 31 32 @Override removeListener(DockEventListener callback)33 public void removeListener(DockEventListener callback) { 34 this.mCallback = null; 35 } 36 37 @Override addAlignmentStateListener(AlignmentStateListener listener)38 public void addAlignmentStateListener(AlignmentStateListener listener) { 39 mAlignmentListener = listener; 40 } 41 42 @Override removeAlignmentStateListener(AlignmentStateListener listener)43 public void removeAlignmentStateListener(AlignmentStateListener listener) { 44 mAlignmentListener = listener; 45 } 46 47 @Override isDocked()48 public boolean isDocked() { 49 return mDocked; 50 } 51 52 /** Sets the docked state */ setIsDocked(boolean docked)53 public void setIsDocked(boolean docked) { 54 mDocked = docked; 55 } 56 57 @Override isHidden()58 public boolean isHidden() { 59 return false; 60 } 61 62 /** Notifies callbacks of dock state change */ setDockEvent(int event)63 public void setDockEvent(int event) { 64 mCallback.onEvent(event); 65 } 66 } 67