Advertisement
Guest User

git diff android-4.2_r1..android-4.2.1_r1

a guest
Nov 28th, 2012
409
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 11.13 KB | None | 0 0
  1. $ GIT_PAGER=cat repo forall -p -c git diff android-4.2_r1..android-4.2.1_r1
  2.  
  3. project build/
  4. diff --git a/core/build_id.mk b/core/build_id.mk
  5. index 0713d42..bebcbfa 100644
  6. --- a/core/build_id.mk
  7. +++ b/core/build_id.mk
  8. @@ -19,4 +19,4 @@
  9.  # (like "CRB01").  It must be a single word, and is
  10.  # capitalized by convention.
  11.  
  12. -export BUILD_ID=JOP40C
  13. +export BUILD_ID=JOP40D
  14. diff --git a/core/version_defaults.mk b/core/version_defaults.mk
  15. index 1162b78..fb1f361 100644
  16. --- a/core/version_defaults.mk
  17. +++ b/core/version_defaults.mk
  18. @@ -41,7 +41,7 @@ ifeq "" "$(PLATFORM_VERSION)"
  19.    # which is the version that we reveal to the end user.
  20.    # Update this value when the platform version changes (rather
  21.    # than overriding it somewhere else).  Can be an arbitrary string.
  22. -  PLATFORM_VERSION := 4.2
  23. +  PLATFORM_VERSION := 4.2.1
  24.  endif
  25.  
  26.  ifeq "" "$(PLATFORM_SDK_VERSION)"
  27.  
  28. project frameworks/base/
  29. diff --git a/core/java/android/widget/NumberPicker.java b/core/java/android/widget/NumberPicker.java
  30. index 4918e48..ac21671 100644
  31. --- a/core/java/android/widget/NumberPicker.java
  32. +++ b/core/java/android/widget/NumberPicker.java
  33. @@ -1284,7 +1284,12 @@ public class NumberPicker extends LinearLayout {
  34.      /**
  35.       * Sets the min value of the picker.
  36.       *
  37. -     * @param minValue The min value.
  38. +     * @param minValue The min value inclusive.
  39. +     *
  40. +     * <strong>Note:</strong> The length of the displayed values array
  41. +     * set via {@link #setDisplayedValues(String[])} must be equal to the
  42. +     * range of selectable numbers which is equal to
  43. +     * {@link #getMaxValue()} - {@link #getMinValue()} + 1.
  44.       */
  45.      public void setMinValue(int minValue) {
  46.          if (mMinValue == minValue) {
  47. @@ -1317,7 +1322,12 @@ public class NumberPicker extends LinearLayout {
  48.      /**
  49.       * Sets the max value of the picker.
  50.       *
  51. -     * @param maxValue The max value.
  52. +     * @param maxValue The max value inclusive.
  53. +     *
  54. +     * <strong>Note:</strong> The length of the displayed values array
  55. +     * set via {@link #setDisplayedValues(String[])} must be equal to the
  56. +     * range of selectable numbers which is equal to
  57. +     * {@link #getMaxValue()} - {@link #getMinValue()} + 1.
  58.       */
  59.      public void setMaxValue(int maxValue) {
  60.          if (mMaxValue == maxValue) {
  61. @@ -1351,6 +1361,10 @@ public class NumberPicker extends LinearLayout {
  62.       * Sets the values to be displayed.
  63.       *
  64.       * @param displayedValues The displayed values.
  65. +     *
  66. +     * <strong>Note:</strong> The length of the displayed values array
  67. +     * must be equal to the range of selectable numbers which is equal to
  68. +     * {@link #getMaxValue()} - {@link #getMinValue()} + 1.
  69.       */
  70.      public void setDisplayedValues(String[] displayedValues) {
  71.          if (mDisplayedValues == displayedValues) {
  72. @@ -1361,14 +1375,6 @@ public class NumberPicker extends LinearLayout {
  73.              // Allow text entry rather than strictly numeric entry.
  74.              mInputText.setRawInputType(InputType.TYPE_CLASS_TEXT
  75.                      | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
  76. -            // Make sure the min, max, respect the size of the displayed
  77. -            // values. This will take care of the current value as well.
  78. -            if (getMinValue() >= displayedValues.length) {
  79. -                setMinValue(0);
  80. -            }
  81. -            if (getMaxValue() >= displayedValues.length) {
  82. -                setMaxValue(displayedValues.length - 1);
  83. -            }
  84.          } else {
  85.              mInputText.setRawInputType(InputType.TYPE_CLASS_NUMBER);
  86.          }
  87. diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
  88. index 3b7d73a..f91df99 100755
  89. --- a/core/res/res/values/config.xml
  90. +++ b/core/res/res/values/config.xml
  91. @@ -1000,4 +1000,25 @@
  92.           provisioning on some carriers, working around a bug (7305641)
  93.           where if the preferred is used we don't try the others. -->
  94.      <bool name="config_dontPreferApn">false</bool>
  95. +
  96. +    <!-- Vibrator pattern to be used as the default for notifications
  97. +         that specify DEFAULT_VIBRATE.
  98. +     -->
  99. +    <integer-array name="config_defaultNotificationVibePattern">
  100. +        <item>0</item>
  101. +        <item>250</item>
  102. +        <item>250</item>
  103. +        <item>250</item>
  104. +    </integer-array>
  105. +
  106. +    <!-- Vibrator pattern to be used as the default for notifications
  107. +         that do not specify vibration but vibrate anyway because the device
  108. +         is in vibrate mode.
  109. +     -->
  110. +    <integer-array name="config_notificationFallbackVibePattern">
  111. +        <item>0</item>
  112. +        <item>250</item>
  113. +        <item>250</item>
  114. +        <item>250</item>
  115. +    </integer-array>
  116.  </resources>
  117. diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
  118. index 68a0289..6858732 100644
  119. --- a/core/res/res/values/symbols.xml
  120. +++ b/core/res/res/values/symbols.xml
  121. @@ -1525,6 +1525,8 @@
  122.    <java-symbol type="array" name="radioAttributes" />
  123.    <java-symbol type="array" name="config_oemUsbModeOverride" />
  124.    <java-symbol type="array" name="config_locationProviderPackageNames" />
  125. +  <java-symbol type="array" name="config_defaultNotificationVibePattern" />
  126. +  <java-symbol type="array" name="config_notificationFallbackVibePattern" />
  127.    <java-symbol type="bool" name="config_animateScreenLights" />
  128.    <java-symbol type="bool" name="config_automatic_brightness_available" />
  129.    <java-symbol type="bool" name="config_sf_limitedAlpha" />
  130. diff --git a/services/java/com/android/server/NotificationManagerService.java b/services/java/com/android/server/NotificationManagerService.java
  131. index f3a38f0..70d37bf 100755
  132. --- a/services/java/com/android/server/NotificationManagerService.java
  133. +++ b/services/java/com/android/server/NotificationManagerService.java
  134. @@ -101,6 +101,7 @@ public class NotificationManagerService extends INotificationManager.Stub
  135.      private static final int SHORT_DELAY = 2000; // 2 seconds
  136.  
  137.      private static final long[] DEFAULT_VIBRATE_PATTERN = {0, 250, 250, 250};
  138. +    private static final int VIBRATE_PATTERN_MAXLEN = 8 * 2 + 1; // up to eight bumps
  139.  
  140.      private static final int DEFAULT_STREAM_TYPE = AudioManager.STREAM_NOTIFICATION;
  141.      private static final boolean SCORE_ONGOING_HIGHER = false;
  142. @@ -125,6 +126,9 @@ public class NotificationManagerService extends INotificationManager.Stub
  143.      private int mDefaultNotificationLedOn;
  144.      private int mDefaultNotificationLedOff;
  145.  
  146. +    private long[] mDefaultVibrationPattern;
  147. +    private long[] mFallbackVibrationPattern;
  148. +
  149.      private boolean mSystemReady;
  150.      private int mDisabledNotifications;
  151.  
  152. @@ -596,6 +600,19 @@ public class NotificationManagerService extends INotificationManager.Stub
  153.          }
  154.      }
  155.  
  156. +    static long[] getLongArray(Resources r, int resid, int maxlen, long[] def) {
  157. +        int[] ar = r.getIntArray(resid);
  158. +        if (ar == null) {
  159. +            return def;
  160. +        }
  161. +        final int len = ar.length > maxlen ? maxlen : ar.length;
  162. +        long[] out = new long[len];
  163. +        for (int i=0; i<len; i++) {
  164. +            out[i] = ar[i];
  165. +        }
  166. +        return out;
  167. +    }
  168. +
  169.      NotificationManagerService(Context context, StatusBarManagerService statusBar,
  170.              LightsService lights)
  171.      {
  172. @@ -622,6 +639,16 @@ public class NotificationManagerService extends INotificationManager.Stub
  173.          mDefaultNotificationLedOff = resources.getInteger(
  174.                  com.android.internal.R.integer.config_defaultNotificationLedOff);
  175.  
  176. +        mDefaultVibrationPattern = getLongArray(resources,
  177. +                com.android.internal.R.array.config_defaultNotificationVibePattern,
  178. +                VIBRATE_PATTERN_MAXLEN,
  179. +                DEFAULT_VIBRATE_PATTERN);
  180. +
  181. +        mFallbackVibrationPattern = getLongArray(resources,
  182. +                com.android.internal.R.array.config_notificationFallbackVibePattern,
  183. +                VIBRATE_PATTERN_MAXLEN,
  184. +                DEFAULT_VIBRATE_PATTERN);
  185. +
  186.          // Don't start allowing notifications until the setup wizard has run once.
  187.          // After that, including subsequent boots, init with notifications turned on.
  188.          // This works on the first boot because the setup wizard will toggle this
  189. @@ -1086,24 +1113,40 @@ public class NotificationManagerService extends INotificationManager.Stub
  190.                  }
  191.  
  192.                  // vibrate
  193. +                // Does the notification want to specify its own vibration?
  194. +                final boolean hasCustomVibrate = notification.vibrate != null;
  195. +
  196.                  // new in 4.2: if there was supposed to be a sound and we're in vibrate mode,
  197. -                // we always vibrate, even if no vibration was specified
  198. +                // and no other vibration is specified, we apply the default vibration anyway
  199.                  final boolean convertSoundToVibration =
  200. -                           notification.vibrate == null
  201. +                           !hasCustomVibrate
  202.                          && (useDefaultSound || notification.sound != null)
  203.                          && (audioManager.getRingerMode() == AudioManager.RINGER_MODE_VIBRATE);
  204.  
  205. +                // The DEFAULT_VIBRATE flag trumps any custom vibration.
  206.                  final boolean useDefaultVibrate =
  207. -                    (notification.defaults & Notification.DEFAULT_VIBRATE) != 0
  208. -                    || convertSoundToVibration;
  209. +                        (notification.defaults & Notification.DEFAULT_VIBRATE) != 0;
  210.  
  211. -                if ((useDefaultVibrate || notification.vibrate != null)
  212. +                if ((useDefaultVibrate || convertSoundToVibration || hasCustomVibrate)
  213.                          && !(audioManager.getRingerMode() == AudioManager.RINGER_MODE_SILENT)) {
  214.                      mVibrateNotification = r;
  215.  
  216. -                    mVibrator.vibrate(useDefaultVibrate ? DEFAULT_VIBRATE_PATTERN
  217. -                                                        : notification.vibrate,
  218. -                              ((notification.flags & Notification.FLAG_INSISTENT) != 0) ? 0: -1);
  219. +                    if (useDefaultVibrate || convertSoundToVibration) {
  220. +                        // Escalate privileges so we can use the vibrator even if the notifying app
  221. +                        // does not have the VIBRATE permission.
  222. +                        long identity = Binder.clearCallingIdentity();
  223. +                        try {
  224. +                            mVibrator.vibrate(convertSoundToVibration ? mFallbackVibrationPattern
  225. +                                                                      : mDefaultVibrationPattern,
  226. +                                ((notification.flags & Notification.FLAG_INSISTENT) != 0) ? 0: -1);
  227. +                        } finally {
  228. +                            Binder.restoreCallingIdentity(identity);
  229. +                        }
  230. +                    } else if (notification.vibrate.length > 1) {
  231. +                        // If you want your own vibration pattern, you need the VIBRATE permission
  232. +                        mVibrator.vibrate(notification.vibrate,
  233. +                            ((notification.flags & Notification.FLAG_INSISTENT) != 0) ? 0: -1);
  234. +                    }
  235.                  }
  236.              }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement