From 54d068ec6af0ee6d261a135400efe6816c6f5ffe Mon Sep 17 00:00:00 2001 From: Svetoslav Ganov Date: Wed, 2 Mar 2011 12:58:40 -0800 Subject: Add system wide management of core settings bug:3505060 Since we want to have some settings that are used very frequently by many applications (long-press timeout is one example) these should be managed efficiently to reduce lookups from different processes because in the case of a cache miss a disk I/O is performed. Now the system manages such core settings and propagates them to the application processes. Change-Id: Ie793211baf8770f2181ac8ba9d7c2609dfaa32a7 --- core/java/android/view/ViewConfiguration.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'core/java/android/view/ViewConfiguration.java') diff --git a/core/java/android/view/ViewConfiguration.java b/core/java/android/view/ViewConfiguration.java index cc4e89cce417..d95c5b0cd775 100644 --- a/core/java/android/view/ViewConfiguration.java +++ b/core/java/android/view/ViewConfiguration.java @@ -16,8 +16,11 @@ package android.view; +import android.app.AppGlobals; import android.content.Context; import android.content.res.Configuration; +import android.os.Bundle; +import android.provider.Settings; import android.util.DisplayMetrics; import android.util.SparseArray; @@ -74,7 +77,7 @@ public class ViewConfiguration { * Defines the duration in milliseconds before a press turns into * a long press */ - private static final int LONG_PRESS_TIMEOUT = 500; + private static final int DEFAULTLONG_PRESS_TIMEOUT = 500; /** * Defines the duration in milliseconds a user needs to hold down the @@ -320,15 +323,16 @@ public class ViewConfiguration { public static int getPressedStateDuration() { return PRESSED_STATE_DURATION; } - + /** * @return the duration in milliseconds before a press turns into * a long press */ public static int getLongPressTimeout() { - return LONG_PRESS_TIMEOUT; + return AppGlobals.getIntCoreSetting(Settings.Secure.LONG_PRESS_TIMEOUT, + DEFAULTLONG_PRESS_TIMEOUT); } - + /** * @return the duration in milliseconds we will wait to see if a touch event * is a tap or a scroll. If the user does not move within this interval, it is -- cgit v1.2.3