From 607bdaefa337b73aed8d2ad7ac9439009a5522d1 Mon Sep 17 00:00:00 2001 From: Phil Tunstall Date: Fri, 27 Jul 2012 12:02:38 +0100 Subject: Settings: Forward port Hardware key custom rebinding (2/2) Settings for rebinding the actions performed on the following key press events: Home long-press, menu press, menu long-press, search press, search long-press, app-switch press and app-switch long-press. The available actions are: Nothing, open/close menu, recent apps switcher, search assistant, voice search and in-app search. Devices with a key configuration other than home, back, menu and search need to set config_deviceHardwareKeys in an overlay to have the correct preferences show up. Change-Id: Id04a598aeb9829d7971dedbd171a61999ce2f919 --- .../android/settings/cyanogenmod/SystemSettings.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/com/android/settings/cyanogenmod/SystemSettings.java') diff --git a/src/com/android/settings/cyanogenmod/SystemSettings.java b/src/com/android/settings/cyanogenmod/SystemSettings.java index 586ef07..703a10d 100644 --- a/src/com/android/settings/cyanogenmod/SystemSettings.java +++ b/src/com/android/settings/cyanogenmod/SystemSettings.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 CyanogenMod + * 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. @@ -16,9 +16,13 @@ package com.android.settings.cyanogenmod; +import android.content.Context; import android.os.Bundle; +import android.os.RemoteException; +import android.os.ServiceManager; import android.preference.PreferenceScreen; import android.provider.Settings; +import android.view.IWindowManager; import com.android.settings.R; import com.android.settings.SettingsPreferenceFragment; @@ -28,6 +32,7 @@ public class SystemSettings extends SettingsPreferenceFragment { private static final String KEY_NOTIFICATION_PULSE = "notification_pulse"; private static final String KEY_BATTERY_LIGHT = "battery_light"; + private static final String KEY_HARDWARE_KEYS = "hardware_keys"; private PreferenceScreen mNotificationPulse; private PreferenceScreen mBatteryPulse; @@ -55,6 +60,17 @@ public class SystemSettings extends SettingsPreferenceFragment { updateBatteryPulseDescription(); } } + + // Only show the hardware keys config on a device that does not have a navbar + IWindowManager windowManager = IWindowManager.Stub.asInterface( + ServiceManager.getService(Context.WINDOW_SERVICE)); + try { + if (windowManager.hasNavigationBar()) { + getPreferenceScreen().removePreference(findPreference(KEY_HARDWARE_KEYS)); + } + } catch (RemoteException e) { + // Do nothing + } } private void updateLightPulseDescription() { -- cgit v1.1