diff options
Diffstat (limited to 'configpanel')
7 files changed, 4 insertions, 135 deletions
diff --git a/configpanel/AndroidManifest.xml b/configpanel/AndroidManifest.xml index f62e7fc..4ee1dad 100644 --- a/configpanel/AndroidManifest.xml +++ b/configpanel/AndroidManifest.xml @@ -56,8 +56,6 @@ </intent-filter> </activity> - <activity android:name=".KeyHandler" /> - <receiver android:name=".Startup" > <intent-filter> <action android:name="lineageos.intent.action.INITIALIZE_LINEAGE_HARDWARE" /> diff --git a/configpanel/res/xml/button_panel.xml b/configpanel/res/xml/button_panel.xml index 43f4902..6e13cb6 100644 --- a/configpanel/res/xml/button_panel.xml +++ b/configpanel/res/xml/button_panel.xml @@ -17,21 +17,11 @@ --> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> - <SwitchPreference - android:key="button_swap" - android:title="@string/button_swap_title" - android:summary="@string/button_swap_summary" /> - <PreferenceCategory android:key="fp_key" android:title="@string/fingerprint_title" > <SwitchPreference - android:key="fp_home" - android:title="@string/fingerprint_as_home_title" - android:summary="@string/fingerprint_as_home_summary" /> - - <SwitchPreference android:key="fp_wakeup" android:title="@string/fingerprint_wakeup_title" android:summary="@string/fingerprint_wakeup_summary" /> diff --git a/configpanel/src/org/lineageos/settings/device/ButtonSettingsFragment.java b/configpanel/src/org/lineageos/settings/device/ButtonSettingsFragment.java index b951641..f446ef6 100644 --- a/configpanel/src/org/lineageos/settings/device/ButtonSettingsFragment.java +++ b/configpanel/src/org/lineageos/settings/device/ButtonSettingsFragment.java @@ -117,8 +117,7 @@ public class ButtonSettingsFragment extends PreferenceFragment } // Hide fingerprint features if the device doesn't support them - if (!FileUtils.fileExists(Constants.FP_HOME_KEY_NODE) && - !FileUtils.fileExists(Constants.FP_WAKEUP_NODE)) { + if (!FileUtils.fileExists(Constants.FP_WAKEUP_NODE)) { getPreferenceScreen().removePreference(fingerprintCategory); } } diff --git a/configpanel/src/org/lineageos/settings/device/ConfigPanelSearchIndexablesProvider.java b/configpanel/src/org/lineageos/settings/device/ConfigPanelSearchIndexablesProvider.java index c234791..7430226 100644 --- a/configpanel/src/org/lineageos/settings/device/ConfigPanelSearchIndexablesProvider.java +++ b/configpanel/src/org/lineageos/settings/device/ConfigPanelSearchIndexablesProvider.java @@ -83,9 +83,7 @@ public class ConfigPanelSearchIndexablesProvider extends SearchIndexablesProvide if (!PackageManagerUtils.isAppInstalled(context, "org.lineageos.pocketmode")) { keys.add(Constants.FP_POCKETMODE_KEY); } - if (!FileUtils.fileExists(Constants.FP_HOME_KEY_NODE) && - !FileUtils.fileExists(Constants.FP_WAKEUP_NODE)) { - keys.add(Constants.FP_HOME_KEY); + if (!FileUtils.fileExists(Constants.FP_WAKEUP_NODE)) { keys.add(Constants.FP_WAKEUP_KEY); } return keys; diff --git a/configpanel/src/org/lineageos/settings/device/Constants.java b/configpanel/src/org/lineageos/settings/device/Constants.java index b673946..f309406 100644 --- a/configpanel/src/org/lineageos/settings/device/Constants.java +++ b/configpanel/src/org/lineageos/settings/device/Constants.java @@ -28,18 +28,11 @@ public class Constants { public static final String CATEGORY_FP = "fp_key"; // Preference keys - public static final String BUTTON_SWAP_KEY = "button_swap"; - public static final String FP_HOME_KEY = "fp_home"; public static final String FP_POCKETMODE_KEY = "fp_pocketmode"; public static final String FP_WAKEUP_KEY = "fp_wakeup"; // Nodes - public static final String CYTTSP_BUTTON_SWAP_NODE = "/proc/buttons/reversed_keys_enable"; - public static final String FP_HOME_KEY_NODE = "/sys/devices/soc/soc:fpc_fpc1020/enable_key_events"; - public static final String FP_WAKEUP_NODE = "/sys/devices/soc/soc:fpc_fpc1020/enable_wakeup"; - public static final String TOUCHPANEL_BUTTON_SWAP_NODE = "/proc/touchpanel/reversed_keys_enable"; - public static final String VIRTUAL_KEYS_NODE = "/proc/touchpanel/capacitive_keys_enable"; - + public static final String FP_WAKEUP_NODE = "/sys/devices/soc/soc:fpc1020/enable_wakeup"; // Intents public static final String CUST_INTENT = "org.lineageos.settings.device.CUST_UPDATE"; public static final String CUST_INTENT_EXTRA = "pocketmode_service"; @@ -58,24 +51,12 @@ public class Constants { public static final Map<String, String[]> sNodeDependencyMap = new HashMap<>(); public static final String[] sButtonPrefKeys = { - BUTTON_SWAP_KEY, - FP_HOME_KEY, FP_WAKEUP_KEY }; static { - if (FileUtils.fileExists(Constants.CYTTSP_BUTTON_SWAP_NODE)) { - sBooleanNodePreferenceMap.put(BUTTON_SWAP_KEY, CYTTSP_BUTTON_SWAP_NODE); - } else if (FileUtils.fileExists(Constants.TOUCHPANEL_BUTTON_SWAP_NODE)) { - sBooleanNodePreferenceMap.put(BUTTON_SWAP_KEY, TOUCHPANEL_BUTTON_SWAP_NODE); - } - sBooleanNodePreferenceMap.put(FP_HOME_KEY, FP_HOME_KEY_NODE); sBooleanNodePreferenceMap.put(FP_WAKEUP_KEY, FP_WAKEUP_NODE); - sNodeDefaultMap.put(BUTTON_SWAP_KEY, false); - sNodeDefaultMap.put(FP_HOME_KEY, false); sNodeDefaultMap.put(FP_WAKEUP_KEY, true); - - sNodeDependencyMap.put(FP_HOME_KEY, new String[]{ VIRTUAL_KEYS_NODE, "1" }); } } diff --git a/configpanel/src/org/lineageos/settings/device/KeyHandler.java b/configpanel/src/org/lineageos/settings/device/KeyHandler.java deleted file mode 100644 index 247624b..0000000 --- a/configpanel/src/org/lineageos/settings/device/KeyHandler.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (C) 2017-2019 The LineageOS 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 org.lineageos.settings.device; - -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; -import android.os.UserHandle; -import android.provider.Settings; -import android.util.Log; -import android.view.KeyEvent; - -import com.android.internal.os.DeviceKeyHandler; - -import lineageos.providers.LineageSettings; - -import org.lineageos.internal.util.FileUtils; - -public class KeyHandler implements DeviceKeyHandler { - - private static final String TAG = KeyHandler.class.getSimpleName(); - - private static final String FP_HOME_NODE = "/sys/devices/soc/soc:fpc_fpc1020/enable_key_events"; - - private static boolean sScreenTurnedOn = true; - private static final boolean DEBUG = false; - - private final Context mContext; - - private final BroadcastReceiver mScreenStateReceiver = new BroadcastReceiver() { - @Override - public void onReceive(Context context, Intent intent) { - if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) { - sScreenTurnedOn = false; - } else if (intent.getAction().equals(Intent.ACTION_SCREEN_ON)) { - sScreenTurnedOn = true; - } - } - }; - - public KeyHandler(Context context) { - mContext = context; - - IntentFilter screenStateFilter = new IntentFilter(); - screenStateFilter.addAction(Intent.ACTION_SCREEN_OFF); - screenStateFilter.addAction(Intent.ACTION_SCREEN_ON); - mContext.registerReceiver(mScreenStateReceiver, screenStateFilter); - } - - public KeyEvent handleKeyEvent(KeyEvent event) { - boolean virtualKeysEnabled = LineageSettings.System.getIntForUser( - mContext.getContentResolver(), - LineageSettings.System.FORCE_SHOW_NAVBAR, 0, UserHandle.USER_CURRENT) != 0; - boolean fingerprintHomeButtonEnabled = FileUtils.isFileReadable(FP_HOME_NODE) && - FileUtils.readOneLine(FP_HOME_NODE).equals("1"); - - if (!hasSetupCompleted()) { - return event; - } - - if (event.getKeyCode() == KeyEvent.KEYCODE_HOME) { - if (event.getScanCode() == 96) { - if (DEBUG) Log.d(TAG, "Fingerprint home button tapped"); - return virtualKeysEnabled ? null : event; - } - if (event.getScanCode() == 102) { - if (DEBUG) Log.d(TAG, "Mechanical home button pressed"); - return sScreenTurnedOn && - (virtualKeysEnabled || fingerprintHomeButtonEnabled) ? null : event; - } - } - return event; - } - - private boolean hasSetupCompleted() { - return Settings.Secure.getInt(mContext.getContentResolver(), - Settings.Secure.USER_SETUP_COMPLETE, 0) != 0; - } -} diff --git a/configpanel/src/org/lineageos/settings/device/Startup.java b/configpanel/src/org/lineageos/settings/device/Startup.java index 4311cb5..2f3f8fd 100644 --- a/configpanel/src/org/lineageos/settings/device/Startup.java +++ b/configpanel/src/org/lineageos/settings/device/Startup.java @@ -70,10 +70,7 @@ public class Startup extends BroadcastReceiver { } static boolean hasButtonProcs() { - return (FileUtils.fileExists(Constants.CYTTSP_BUTTON_SWAP_NODE) || - FileUtils.fileExists(Constants.FP_HOME_KEY_NODE) || - FileUtils.fileExists(Constants.FP_WAKEUP_NODE) || - FileUtils.fileExists(Constants.TOUCHPANEL_BUTTON_SWAP_NODE)); + return (FileUtils.fileExists(Constants.FP_WAKEUP_NODE)); } private void disableComponent(Context context, String component) { |