Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fdd9ce35 authored by Alexander Hofbauer's avatar Alexander Hofbauer
Browse files

This reverts two wrong patch sets fix attempts.

Trying to fix my stupid mistakes.
Reverted commits:

*) 5e228486:
   Fix InputReader test

*) 8f2303e5:
   add missing file for "Iec99d52f: Load a device specific key handler"

*) 2ee7ed47:
   InputManager: Add system setting to define keyboard locales

*) cf02764d:
   Load a device specific key handler

Change-Id: Ibdaa8d52054c830a4e3659bf356cc2df71342eb3
parent 8f2303e5
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -2008,13 +2008,6 @@ public final class Settings {
         */
        public static final String SHOW_TOUCHES = "show_touches";

        /**
         * The keylayout that will be used by EventHub instead of the default
         * one.
	 * @hide
         */
        public static final String KEYLAYOUT_OVERRIDES = "keylayout";

        /**
         * Log raw orientation data from {@link WindowOrientationListener} for use with the
         * orientationplot.py tool.
@@ -2472,7 +2465,6 @@ public final class Settings {
            QUIET_HOURS_MUTE,
            QUIET_HOURS_STILL,
            QUIET_HOURS_DIM,
            KEYLAYOUT_OVERRIDES,
        };

        // Settings moved to Settings.Secure
+0 −21
Original line number Diff line number Diff line
/*
 * Copyright (C) 2012 The CyanogenMod 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.
 */

package com.android.internal.os;

import android.view.KeyEvent;

public interface DeviceKeyHandler {
    public static final int KEYEVENT_CAUGHT = -1;
    public static final int KEYEVENT_UNCAUGHT = 0;

    public int handleKeyEvent(KeyEvent event);
}
+0 −6
Original line number Diff line number Diff line
@@ -792,10 +792,4 @@

    <!-- True if the Sym key should open the InputMethodPicker (default) -->
    <bool name="config_symKeyShowsImePicker">true</bool>

    <!-- Path to the library that contains the device key handler -->
    <string name="config_deviceKeyHandlerLib"></string>

    <!-- Name of the device key handler -->
    <string name="config_deviceKeyHandlerClass"></string>
</resources>
+0 −45
Original line number Diff line number Diff line
@@ -28,7 +28,6 @@ import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.ServiceConnection;
@@ -66,8 +65,6 @@ import com.android.internal.telephony.ITelephony;
import com.android.internal.view.BaseInputHandler;
import com.android.internal.widget.PointerLocationView;

import dalvik.system.DexClassLoader;

import android.util.DisplayMetrics;
import android.util.EventLog;
import android.util.Log;
@@ -146,9 +143,6 @@ import java.io.FileDescriptor;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;

@@ -261,9 +255,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                KeyEvent.KEYCODE_CALCULATOR, Intent.CATEGORY_APP_CALCULATOR);
    }

    Object mDeviceKeyHandler = null;
    Method mDeviceKeyHandlerMethod = null;

    /**
     * Lock protecting internal state.  Must not call out into window
     * manager with lock held.  (This lock will be acquired in places
@@ -939,32 +930,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        } else {
            screenTurnedOff(WindowManagerPolicy.OFF_BECAUSE_OF_USER);
        }

        String deviceKeyHandlerLib = mContext.getResources().getString(
                com.android.internal.R.string.config_deviceKeyHandlerLib);

        String deviceKeyHandlerClass = mContext.getResources().getString(
                com.android.internal.R.string.config_deviceKeyHandlerClass);

        if (!deviceKeyHandlerLib.equals("") && !deviceKeyHandlerClass.equals("")) {
            DexClassLoader loader =  new DexClassLoader(deviceKeyHandlerLib,
                    new ContextWrapper(mContext).getCacheDir().getAbsolutePath(),
                    null,
                    ClassLoader.getSystemClassLoader());
            try {
                Class<?> klass = loader.loadClass(deviceKeyHandlerClass);
                Constructor<?> constructor = klass.getConstructor(Context.class);
                mDeviceKeyHandler = constructor.newInstance(mContext);
                mDeviceKeyHandlerMethod = klass.getDeclaredMethod(
                        "handleKeyEvent", KeyEvent.class);

                Log.d(TAG, "Loaded device key handler");
            } catch (Exception e) {
                Slog.d(TAG, "Could not get device key Handler "
                        + deviceKeyHandlerClass + " from class "
                        + deviceKeyHandlerLib, e);
            }
        }
    }

    public void setInitialDisplaySize(int width, int height) {
@@ -1863,16 +1828,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            showOrHideRecentAppsDialog(RECENT_APPS_BEHAVIOR_DISMISS_AND_SWITCH);
        }

        if (mDeviceKeyHandler != null && mDeviceKeyHandlerMethod != null) {
            try {
                Integer ret = (Integer) mDeviceKeyHandlerMethod.invoke(
                        mDeviceKeyHandler, event);
                return ret;
            } catch (Exception e) {
                Slog.d(TAG, "Could not invoke device key handler", e);
            }
        }

        // Let the application handle the key.
        return 0;
    }
+0 −14
Original line number Diff line number Diff line
@@ -1016,16 +1016,6 @@ status_t EventHub::openDeviceLocked(const char *devicePath) {
    // We need to do this for joysticks too because the key layout may specify axes.
    status_t keyMapStatus = NAME_NOT_FOUND;
    if (device->classes & (INPUT_DEVICE_CLASS_KEYBOARD | INPUT_DEVICE_CLASS_JOYSTICK)) {
        String8 layout;
        if (mOrKeyLayouts.tryGetProperty(device->identifier.name, layout)) {
            LOGI("Replacing key layout and character map of %s with %s",
                    device->identifier.name.string(), layout.string());
            if (!device->configuration) {
                device->configuration = new PropertyMap();
            }
            device->configuration->addProperty(String8("keyboard.layout"), layout);
            device->configuration->addProperty(String8("keyboard.characterMap"), layout);
        }
        // Load the keymap for the device.
        keyMapStatus = loadKeyMapLocked(device);
    }
@@ -1343,9 +1333,5 @@ void EventHub::monitor() {
    mLock.unlock();
}

void EventHub::setKeyLayout(const char* deviceName, const char* keyLayout) {
    mOrKeyLayouts.addProperty(String8(deviceName), String8(keyLayout));
}


}; // namespace android
Loading