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

Commit e4cfb749 authored by Shashi Kumar's avatar Shashi Kumar Committed by Gerrit Code Review
Browse files

frameworks/base: Fix for headset switch detect

- Headset Switch detect is not functional
- Headset driver on modem in 8x25 and 7x27A targets
  introduces a delay of 500ms before reporting headset
  events to application processor to avoid the problem
  of spurious interrupts being reported due to hardware
  limitation on these targets. Frameworks code in JB
  treats button release event received after 500ms after
  button press as long press event and generates WEBSEARCH
  event. Due to this all the events in 8x25 and 7x27A
  are interpreted as long press events.
- To avoid this problem increase the timeout to more than
  500ms by introducing headset hook delay property for
  these targets.

CRs-fixed: 387247
(cherry picked from commit 5878d849442af33378805f7b9964102119c2fc93)

Change-Id: I03a77666bb217168f7c362bd775dadfbe09fe638
parent 59e23c18
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
/*
 * Copyright (C) 2006 The Android Open Source Project
 * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
@@ -24,6 +25,7 @@ import android.os.RemoteException;
import android.provider.Settings;
import android.util.DisplayMetrics;
import android.util.SparseArray;
import android.os.SystemProperties;

/**
 * Contains methods to standard constants used in the UI for timeouts, sizes, and distances.
@@ -408,8 +410,13 @@ public class ViewConfiguration {
     * a long press
     */
    public static int getLongPressTimeout() {
        // Allow increase of timeout using property for targets which
        // may take more time than default timeout to report headset
        // events. The value will be Zero incase the property is not
        // defined for a particular target.
        int delay = SystemProperties.getInt("headset.hook.delay", 0);
        return AppGlobals.getIntCoreSetting(Settings.Secure.LONG_PRESS_TIMEOUT,
                DEFAULT_LONG_PRESS_TIMEOUT);
                                            DEFAULT_LONG_PRESS_TIMEOUT + delay);
    }

    /**