summaryrefslogtreecommitdiffstats
path: root/tools/validatekeymaps
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@google.com>2013-08-28 09:44:17 -0700
committerMike Lockwood <lockwood@google.com>2013-08-28 09:44:17 -0700
commit9f6a119c8aa276432ece4fe2118bd8a3c9b1067e (patch)
tree1391656f9ad624aa99d4c7d2880d38121801a424 /tools/validatekeymaps
parent647b6f5ed276bf93d95e5801e5e8af2802ef5fbb (diff)
downloadframeworks_base-9f6a119c8aa276432ece4fe2118bd8a3c9b1067e.zip
frameworks_base-9f6a119c8aa276432ece4fe2118bd8a3c9b1067e.tar.gz
frameworks_base-9f6a119c8aa276432ece4fe2118bd8a3c9b1067e.tar.bz2
Move frameworks/base/tools/ to frameworks/tools/
Change-Id: I3ffafdab27cc4aca256c3a5806b630795b75d5c8
Diffstat (limited to 'tools/validatekeymaps')
-rw-r--r--tools/validatekeymaps/Android.mk33
-rw-r--r--tools/validatekeymaps/Main.cpp147
2 files changed, 0 insertions, 180 deletions
diff --git a/tools/validatekeymaps/Android.mk b/tools/validatekeymaps/Android.mk
deleted file mode 100644
index 9af721d..0000000
--- a/tools/validatekeymaps/Android.mk
+++ /dev/null
@@ -1,33 +0,0 @@
-#
-# Copyright 2010 The Android Open Source Project
-#
-# Keymap validation tool.
-#
-
-# This tool is prebuilt if we're doing an app-only build.
-ifeq ($(TARGET_BUILD_APPS),)
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := \
- Main.cpp
-
-LOCAL_CFLAGS := -Wall -Werror
-
-LOCAL_STATIC_LIBRARIES := \
- libinput \
- libutils \
- libcutils \
- liblog
-
-ifeq ($(HOST_OS),linux)
-LOCAL_LDLIBS += -ldl -lpthread
-endif
-
-LOCAL_MODULE := validatekeymaps
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_HOST_EXECUTABLE)
-
-endif # TARGET_BUILD_APPS
diff --git a/tools/validatekeymaps/Main.cpp b/tools/validatekeymaps/Main.cpp
deleted file mode 100644
index 5b45c55..0000000
--- a/tools/validatekeymaps/Main.cpp
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <input/KeyCharacterMap.h>
-#include <input/KeyLayoutMap.h>
-#include <input/VirtualKeyMap.h>
-#include <utils/PropertyMap.h>
-#include <utils/String8.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-using namespace android;
-
-static const char* gProgName = "validatekeymaps";
-
-enum FileType {
- FILETYPE_UNKNOWN,
- FILETYPE_KEYLAYOUT,
- FILETYPE_KEYCHARACTERMAP,
- FILETYPE_VIRTUALKEYDEFINITION,
- FILETYPE_INPUTDEVICECONFIGURATION,
-};
-
-
-static void usage() {
- fprintf(stderr, "Keymap Validation Tool\n\n");
- fprintf(stderr, "Usage:\n");
- fprintf(stderr,
- " %s [*.kl] [*.kcm] [*.idc] [virtualkeys.*] [...]\n"
- " Validates the specified key layouts, key character maps, \n"
- " input device configurations, or virtual key definitions.\n\n",
- gProgName);
-}
-
-static FileType getFileType(const char* filename) {
- const char *extension = strrchr(filename, '.');
- if (extension) {
- if (strcmp(extension, ".kl") == 0) {
- return FILETYPE_KEYLAYOUT;
- }
- if (strcmp(extension, ".kcm") == 0) {
- return FILETYPE_KEYCHARACTERMAP;
- }
- if (strcmp(extension, ".idc") == 0) {
- return FILETYPE_INPUTDEVICECONFIGURATION;
- }
- }
-
- if (strstr(filename, "virtualkeys.")) {
- return FILETYPE_VIRTUALKEYDEFINITION;
- }
-
- return FILETYPE_UNKNOWN;
-}
-
-static bool validateFile(const char* filename) {
- fprintf(stdout, "Validating file '%s'...\n", filename);
-
- FileType fileType = getFileType(filename);
- switch (fileType) {
- case FILETYPE_UNKNOWN:
- fprintf(stderr, "Supported file types: *.kl, *.kcm, virtualkeys.*\n\n");
- return false;
-
- case FILETYPE_KEYLAYOUT: {
- sp<KeyLayoutMap> map;
- status_t status = KeyLayoutMap::load(String8(filename), &map);
- if (status) {
- fprintf(stderr, "Error %d parsing key layout file.\n\n", status);
- return false;
- }
- break;
- }
-
- case FILETYPE_KEYCHARACTERMAP: {
- sp<KeyCharacterMap> map;
- status_t status = KeyCharacterMap::load(String8(filename),
- KeyCharacterMap::FORMAT_ANY, &map);
- if (status) {
- fprintf(stderr, "Error %d parsing key character map file.\n\n", status);
- return false;
- }
- break;
- }
-
- case FILETYPE_INPUTDEVICECONFIGURATION: {
- PropertyMap* map;
- status_t status = PropertyMap::load(String8(filename), &map);
- if (status) {
- fprintf(stderr, "Error %d parsing input device configuration file.\n\n", status);
- return false;
- }
- delete map;
- break;
- }
-
- case FILETYPE_VIRTUALKEYDEFINITION: {
- VirtualKeyMap* map;
- status_t status = VirtualKeyMap::load(String8(filename), &map);
- if (status) {
- fprintf(stderr, "Error %d parsing virtual key definition file.\n\n", status);
- return false;
- }
- delete map;
- break;
- }
- }
-
- fputs("No errors.\n\n", stdout);
- return true;
-}
-
-int main(int argc, const char** argv) {
- if (argc < 2) {
- usage();
- return 1;
- }
-
- int result = 0;
- for (int i = 1; i < argc; i++) {
- if (!validateFile(argv[i])) {
- result = 1;
- }
- }
-
- if (result) {
- fputs("Failed!\n", stderr);
- } else {
- fputs("Success.\n", stdout);
- }
- return result;
-}