Garfield Tan | 73007b6 | 2019-08-29 17:28:41 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2019 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 | #include "InputTarget.h" |
| 18 | |
| 19 | #include <android-base/stringprintf.h> |
| 20 | #include <inttypes.h> |
| 21 | #include <string> |
| 22 | |
| 23 | using android::base::StringPrintf; |
| 24 | |
| 25 | namespace android::inputdispatcher { |
| 26 | |
| 27 | std::string dispatchModeToString(int32_t dispatchMode) { |
| 28 | switch (dispatchMode) { |
| 29 | case InputTarget::FLAG_DISPATCH_AS_IS: |
| 30 | return "DISPATCH_AS_IS"; |
| 31 | case InputTarget::FLAG_DISPATCH_AS_OUTSIDE: |
| 32 | return "DISPATCH_AS_OUTSIDE"; |
| 33 | case InputTarget::FLAG_DISPATCH_AS_HOVER_ENTER: |
| 34 | return "DISPATCH_AS_HOVER_ENTER"; |
| 35 | case InputTarget::FLAG_DISPATCH_AS_HOVER_EXIT: |
| 36 | return "DISPATCH_AS_HOVER_EXIT"; |
| 37 | case InputTarget::FLAG_DISPATCH_AS_SLIPPERY_EXIT: |
| 38 | return "DISPATCH_AS_SLIPPERY_EXIT"; |
| 39 | case InputTarget::FLAG_DISPATCH_AS_SLIPPERY_ENTER: |
| 40 | return "DISPATCH_AS_SLIPPERY_ENTER"; |
| 41 | } |
| 42 | return StringPrintf("%" PRId32, dispatchMode); |
| 43 | } |
| 44 | |
| 45 | } // namespace android::inputdispatcher |