blob: dab6bb75c91ecf276f238db7b56c409277b8e305 [file] [log] [blame]
Jeff Brown46b9ac02010-04-22 18:58:52 -07001/*
2 * Copyright (C) 2010 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#ifndef _ANDROID_VIEW_KEYEVENT_H
18#define _ANDROID_VIEW_KEYEVENT_H
19
20#include "jni.h"
Jeff Brown1f245102010-11-18 20:53:46 -080021#include <utils/Errors.h>
22#include <utils/threads.h>
Jeff Brown46b9ac02010-04-22 18:58:52 -070023
24namespace android {
25
26class KeyEvent;
27
Jeff Brown1f245102010-11-18 20:53:46 -080028/* Obtains an instance of a DVM KeyEvent object as a copy of a native KeyEvent instance.
29 * Returns NULL on error. */
Jeff Brown46b9ac02010-04-22 18:58:52 -070030extern jobject android_view_KeyEvent_fromNative(JNIEnv* env, const KeyEvent* event);
31
Jeff Brown1f245102010-11-18 20:53:46 -080032/* Copies the contents of a DVM KeyEvent object to a native KeyEvent instance.
33 * Returns non-zero on error. */
34extern status_t android_view_KeyEvent_toNative(JNIEnv* env, jobject eventObj,
Jeff Brown46b9ac02010-04-22 18:58:52 -070035 KeyEvent* event);
36
Jeff Brown1f245102010-11-18 20:53:46 -080037/* Recycles a DVM KeyEvent object.
38 * Key events should only be recycled if they are owned by the system since user
39 * code expects them to be essentially immutable, "tracking" notwithstanding.
40 * Returns non-zero on error. */
41extern status_t android_view_KeyEvent_recycle(JNIEnv* env, jobject eventObj);
42
Jeff Brown46b9ac02010-04-22 18:58:52 -070043} // namespace android
44
Siarhei Vishniakou6a3346d2020-01-23 19:49:39 -060045#endif // _ANDROID_VIEW_KEYEVENT_H