am b5f67e7f: Add device specific keypress vibration duration database

* commit 'b5f67e7faf498eac634be0cfd2b8d4ac7e9a3b76':
  Add device specific keypress vibration duration database
main
Tadashi G. Takaoka 2013-05-13 03:04:02 -07:00 committed by Android Git Automerger
commit f6b5484dcb
2 changed files with 33 additions and 15 deletions

View File

@ -21,13 +21,32 @@
<!-- Build condition,duration_in_milliseconds -->
<string-array name="keypress_vibration_durations" translatable="false">
<!-- Nexus S -->
<item>HARDWARE=herring,5</item>
<item>MODEL=Nexus S:BRAND=google,5</item>
<!-- Galaxy Nexus -->
<item>HARDWARE=tuna,5</item>
<item>MODEL=Galaxy Nexus:BRAND=google,5</item>
<!-- Nexus 4 -->
<item>HARDWARE=mako,5</item>
<item>MODEL=Nexus 4:BRAND=google,8</item>
<!-- Nexus 10 -->
<item>HARDWARE=manta,16</item>
<item>MODEL=Nexus 10:BRAND=google,16</item>
<!-- Samsung Galaxy SII -->
<item>MODEL=GT-I(9100[GMPT]?|9108|9210T?):MANUFACTURER=samsung,8</item>
<item>MODEL=SGH-(I9[27]7R?|I927|T989D?):MANUFACTURER=samsung,8</item>
<item>MODEL=SHW-M250[KLS]?|SPH-D710|SCH-R760:MANUFACTURER=samsung,8</item>
<item>MODEL=ISW11SC|SC-02C:MANUFACTURER=samsung,8</item>
<!-- Samsung Galaxy SIII -->
<item>MODEL=(SAMSUNG-)?GT-I(930[05][NT]?|9308):MANUFACTURER=samsung,8</item>
<item>MODEL=(SAMSUNG-)?SGH-(T999[V]?|I747[M]?|N064|N035):MANUFACTURER=samsung,8</item>
<item>MODEL=(SAMSUNG-)?SCH-(J021|R530|I535|I939):MANUFACTURER=samsung,8</item>
<item>MODEL=(SAMSUNG-)?(SCL21|SC-06D|SC-03E]):MANUFACTURER=samsung,8</item>
<item>MODEL=(SAMSUNG-)?(SHV-210[KLS]?|SPH-L710):MANUFACTURER=samsung,8</item>
<!-- LG Optimus G -->
<item>MODEL=LG-E97[013]|LS970|L-01E:MANUFACTURER=LGE,15</item>
<!-- HTC One X -->
<item>MODEL=HTC One X:MANUFACTURER=HTC,15</item>
<!-- Motorola Razor M -->
<item>MODEL=XT907:MANUFACTURER=motorola,30</item>
<!-- Sony Xperia Z -->
<item>MODEL=C6603:MANUFACTURER=Sony,35</item>
<!-- Default value for unknown device -->
<item>,20</item>
</string-array>

View File

@ -30,7 +30,6 @@ import java.util.HashMap;
public final class ResourceUtils {
private static final String TAG = ResourceUtils.class.getSimpleName();
private static final boolean DEBUG = false;
public static final float UNDEFINED_RATIO = -1.0f;
public static final int UNDEFINED_DIMENSION = -1;
@ -45,6 +44,7 @@ public final class ResourceUtils {
private static final String[] BUILD_KEYS_AND_VALUES = {
"HARDWARE", Build.HARDWARE,
"MODEL", Build.MODEL,
"BRAND", Build.BRAND,
"MANUFACTURER", Build.MANUFACTURER
};
private static final HashMap<String, String> sBuildKeyValues;
@ -75,12 +75,10 @@ public final class ResourceUtils {
final String overrideValue = findConstantForKeyValuePairs(sBuildKeyValues, overrideArray);
// The overrideValue might be an empty string.
if (overrideValue != null) {
if (DEBUG) {
Log.d(TAG, "Find override value:"
+ " resource="+ res.getResourceEntryName(overrideResId)
+ " build=" + sBuildKeyValuesDebugString
+ " override=" + overrideValue);
}
Log.i(TAG, "Find override value:"
+ " resource="+ res.getResourceEntryName(overrideResId)
+ " build=" + sBuildKeyValuesDebugString
+ " override=" + overrideValue);
sDeviceOverrideValueMap.put(key, overrideValue);
return overrideValue;
}
@ -91,10 +89,11 @@ public final class ResourceUtils {
Log.w(TAG, "Couldn't find override value nor default value:"
+ " resource="+ res.getResourceEntryName(overrideResId)
+ " build=" + sBuildKeyValuesDebugString);
} else if (DEBUG) {
Log.d(TAG, "Found default value:"
+ " resource="+ res.getResourceEntryName(overrideResId)
+ " build=" + sBuildKeyValuesDebugString + " default=" + defaultValue);
} else {
Log.i(TAG, "Found default value:"
+ " resource="+ res.getResourceEntryName(overrideResId)
+ " build=" + sBuildKeyValuesDebugString
+ " default=" + defaultValue);
}
sDeviceOverrideValueMap.put(key, defaultValue);
return defaultValue;