Merge "Forces windows to draw the first time they show."
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index 042e1d8..1a3bcc4 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -199,24 +199,18 @@
     /**
      * Signature check result: this is returned by {@link #checkSignatures}
      * if neither of the two packages is signed.
-     *
-     * @deprecated It is not possible to install unsigned packages.
      */
     public static final int SIGNATURE_NEITHER_SIGNED = 1;
 
     /**
      * Signature check result: this is returned by {@link #checkSignatures}
      * if the first package is not signed but the second is.
-     *
-     * @deprecated It is not possible to install unsigned packages.
      */
     public static final int SIGNATURE_FIRST_NOT_SIGNED = -1;
 
     /**
      * Signature check result: this is returned by {@link #checkSignatures}
      * if the second package is not signed but the first is.
-     *
-     * @deprecated It is not possible to install unsigned packages.
      */
     public static final int SIGNATURE_SECOND_NOT_SIGNED = -2;
 
diff --git a/media/java/android/media/MediaRecorder.java b/media/java/android/media/MediaRecorder.java
index 19b0c17..4c43baa 100644
--- a/media/java/android/media/MediaRecorder.java
+++ b/media/java/android/media/MediaRecorder.java
@@ -277,11 +277,17 @@
         setVideoFrameRate(profile.videoFrameRate);
         setVideoSize(profile.videoFrameWidth, profile.videoFrameHeight);
         setVideoEncodingBitRate(profile.videoBitRate);
-        setAudioEncodingBitRate(profile.audioBitRate);
-        setAudioChannels(profile.audioChannels);
-        setAudioSamplingRate(profile.audioSampleRate);
         setVideoEncoder(profile.videoCodec);
-        setAudioEncoder(profile.audioCodec);
+        if (profile.quality >= CamcorderProfile.QUALITY_TIME_LAPSE_LOW &&
+             profile.quality <= CamcorderProfile.QUALITY_TIME_LAPSE_1080P) {
+            // Enable time lapse. Also don't set audio for time lapse.
+            setParameter(String.format("time-lapse-enable=1"));
+        } else {
+            setAudioEncodingBitRate(profile.audioBitRate);
+            setAudioChannels(profile.audioChannels);
+            setAudioSamplingRate(profile.audioSampleRate);
+            setAudioEncoder(profile.audioCodec);
+        }
     }
 
     /**
@@ -305,16 +311,24 @@
     }
 
     /**
-     * Enables time lapse capture and sets its parameters. This method should
-     * be called after setProfile().
+     * Set video frame capture rate. This can be used to set a different video frame capture
+     * rate than the recorded video's playback rate. Currently this works only for time lapse mode.
      *
-     * @param timeBetweenTimeLapseFrameCaptureMs time between two captures of time lapse frames.
+     * @param fps Rate at which frames should be captured in frames per second.
+     * The fps can go as low as desired. However the fastest fps will be limited by the hardware.
+     * For resolutions that can be captured by the video camera, the fastest fps can be computed using
+     * {@link android.hardware.Camera.Parameters#getPreviewFpsRange(int[])}. For higher
+     * resolutions the fastest fps may be more restrictive.
+     * Note that the recorder cannot guarantee that frames will be captured at the
+     * given rate due to camera/encoder limitations. However it tries to be as close as
+     * possible.
      * @hide
      */
-    public void enableTimeLapse(int timeBetweenTimeLapseFrameCaptureMs) {
-        setParameter(String.format("time-lapse-enable=1"));
+    public void setCaptureRate(double fps) {
+        double timeBetweenFrameCapture = 1 / fps;
+        int timeBetweenFrameCaptureMs = (int) (1000 * timeBetweenFrameCapture);
         setParameter(String.format("time-between-time-lapse-frame-capture=%d",
-                    timeBetweenTimeLapseFrameCaptureMs));
+                    timeBetweenFrameCaptureMs));
     }
 
     /**