| 1 | /* |
| 2 | * Copyright (C) 2020 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.wm.shell.onehanded; |
| 18 | |
| 19 | import android.os.SystemProperties; |
| 20 | |
| 21 | import com.android.wm.shell.common.annotations.ExternalThread; |
| 22 | |
| 23 | /** |
| 24 | * Interface to engage one handed feature. |
| 25 | */ |
| 26 | @ExternalThread |
| 27 | public interface OneHanded { |
| 28 | |
| 29 | boolean sIsSupportOneHandedMode = SystemProperties.getBoolean( |
| 30 | OneHandedController.SUPPORT_ONE_HANDED_MODE, false); |
| 31 | |
| 32 | /** |
| 33 | * Enters one handed mode. |
| 34 | */ |
| 35 | void startOneHanded(); |
| 36 | |
| 37 | /** |
| 38 | * Exits one handed mode. |
| 39 | */ |
| 40 | void stopOneHanded(); |
| 41 | |
| 42 | /** |
| 43 | * Exits one handed mode with {@link OneHandedUiEventLogger}. |
| 44 | */ |
| 45 | void stopOneHanded(int uiEvent); |
| 46 | |
| 47 | /** |
| 48 | * Sets one handed feature temporary locked in enabled or disabled state, this won't change |
| 49 | * settings configuration. |
| 50 | * |
| 51 | * @param locked locked function in disabled(can not trigger) or enabled state. |
| 52 | * @param enabled function in disabled(can not trigger) or enabled state. |
| 53 | */ |
| 54 | void setLockedDisabled(boolean locked, boolean enabled); |
| 55 | |
| 56 | /** |
| 57 | * Registers callback to notify WMShell when user tap shortcut to expand notification. |
| 58 | */ |
| 59 | void registerEventCallback(OneHandedEventCallback callback); |
| 60 | |
| 61 | /** |
| 62 | * Registers callback to be notified after {@link OneHandedDisplayAreaOrganizer} |
| 63 | * transition start or finish |
| 64 | */ |
| 65 | void registerTransitionCallback(OneHandedTransitionCallback callback); |
| 66 | } |