diff --git a/core/java/android/widget/NumberPicker.java b/core/java/android/widget/NumberPicker.java index e836c0f4ab..ac21671720 100644 --- a/core/java/android/widget/NumberPicker.java +++ b/core/java/android/widget/NumberPicker.java @@ -1284,7 +1284,12 @@ public int getMinValue() { /** * Sets the min value of the picker. * - * @param minValue The min value. + * @param minValue The min value inclusive. + * + * Note: The length of the displayed values array + * set via {@link #setDisplayedValues(String[])} must be equal to the + * range of selectable numbers which is equal to + * {@link #getMaxValue()} - {@link #getMinValue()} + 1. */ public void setMinValue(int minValue) { if (mMinValue == minValue) { @@ -1317,7 +1322,12 @@ public int getMaxValue() { /** * Sets the max value of the picker. * - * @param maxValue The max value. + * @param maxValue The max value inclusive. + * + * Note: The length of the displayed values array + * set via {@link #setDisplayedValues(String[])} must be equal to the + * range of selectable numbers which is equal to + * {@link #getMaxValue()} - {@link #getMinValue()} + 1. */ public void setMaxValue(int maxValue) { if (mMaxValue == maxValue) { @@ -1351,6 +1361,10 @@ public String[] getDisplayedValues() { * Sets the values to be displayed. * * @param displayedValues The displayed values. + * + * Note: The length of the displayed values array + * must be equal to the range of selectable numbers which is equal to + * {@link #getMaxValue()} - {@link #getMinValue()} + 1. */ public void setDisplayedValues(String[] displayedValues) { if (mDisplayedValues == displayedValues) { @@ -1361,14 +1375,6 @@ public void setDisplayedValues(String[] displayedValues) { // Allow text entry rather than strictly numeric entry. mInputText.setRawInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS); - // Make sure the min, max, respect the size of the displayed - // values. This will take care of the current value as well. - if (getMinValue() >= displayedValues.length) { - setMinValue(0); - } - if (getMaxValue() >= displayedValues.length) { - setMaxValue(displayedValues.length); - } } else { mInputText.setRawInputType(InputType.TYPE_CLASS_NUMBER); } diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 32bbde6adb..8bbea69816 100755 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -1003,6 +1003,27 @@ where if the preferred is used we don't try the others. --> false + + + 0 + 250 + 250 + 250 + + + + + 0 + 250 + 250 + 250 + + false diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 20a065ae36..fb69272718 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -1525,6 +1525,8 @@ + + diff --git a/services/java/com/android/server/NotificationManagerService.java b/services/java/com/android/server/NotificationManagerService.java index f3a38f0c7c..70d37bfc82 100755 --- a/services/java/com/android/server/NotificationManagerService.java +++ b/services/java/com/android/server/NotificationManagerService.java @@ -101,6 +101,7 @@ public class NotificationManagerService extends INotificationManager.Stub private static final int SHORT_DELAY = 2000; // 2 seconds private static final long[] DEFAULT_VIBRATE_PATTERN = {0, 250, 250, 250}; + private static final int VIBRATE_PATTERN_MAXLEN = 8 * 2 + 1; // up to eight bumps private static final int DEFAULT_STREAM_TYPE = AudioManager.STREAM_NOTIFICATION; private static final boolean SCORE_ONGOING_HIGHER = false; @@ -125,6 +126,9 @@ public class NotificationManagerService extends INotificationManager.Stub private int mDefaultNotificationLedOn; private int mDefaultNotificationLedOff; + private long[] mDefaultVibrationPattern; + private long[] mFallbackVibrationPattern; + private boolean mSystemReady; private int mDisabledNotifications; @@ -596,6 +600,19 @@ public void update() { } } + static long[] getLongArray(Resources r, int resid, int maxlen, long[] def) { + int[] ar = r.getIntArray(resid); + if (ar == null) { + return def; + } + final int len = ar.length > maxlen ? maxlen : ar.length; + long[] out = new long[len]; + for (int i=0; i 1) { + // If you want your own vibration pattern, you need the VIBRATE permission + mVibrator.vibrate(notification.vibrate, + ((notification.flags & Notification.FLAG_INSISTENT) != 0) ? 0: -1); + } } }