summaryrefslogtreecommitdiffstats
path: root/src/com/android
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2010-07-21 21:26:57 +0100
committerBen Murdoch <benm@google.com>2010-07-21 21:31:58 +0100
commit039bd47edd231965abb2c8e9b2dd32308cddb74b (patch)
tree1251c55980909e97d56e20277cdc25c7e353f3dd /src/com/android
parent58008e25deb346bef221ba12d48cd72910fad2bf (diff)
downloadpackages_apps_Browser-039bd47edd231965abb2c8e9b2dd32308cddb74b.zip
packages_apps_Browser-039bd47edd231965abb2c8e9b2dd32308cddb74b.tar.gz
packages_apps_Browser-039bd47edd231965abb2c8e9b2dd32308cddb74b.tar.bz2
Add support for accept type="audio/*" and audio/*;capture=microphone in the Browser
file picker. Change-Id: Ie2da87381f020e2d66791e8214ff14dc4ed3b8da
Diffstat (limited to 'src/com/android')
-rw-r--r--src/com/android/browser/BrowserActivity.java24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java
index 6a7c79e..1c32ecd 100644
--- a/src/com/android/browser/BrowserActivity.java
+++ b/src/com/android/browser/BrowserActivity.java
@@ -2888,12 +2888,14 @@ public class BrowserActivity extends Activity
final String imageMimeType = "image/*";
final String videoMimeType = "video/*";
+ final String audioMimeType = "audio/*";
final String mediaSourceKey = "capture";
final String mediaSourceValueCamera = "camera";
final String mediaSourceValueFileSystem = "filesystem";
final String mediaSourceValueCamcorder = "camcorder";
+ final String mediaSourceValueMicrophone = "microphone";
- // media source can be 'gallery' or 'camera' or 'camcorder'
+ // media source can be 'filesystem' or 'camera' or 'camcorder' or 'microphone'.
String mediaSource = "";
// We add the camera intent if there was no accept type (or '*/*' or 'image/*').
@@ -2943,6 +2945,8 @@ public class BrowserActivity extends Activity
Intent camcorderIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
+ Intent soundRecIntent = new Intent(MediaStore.Audio.Media.RECORD_SOUND_ACTION);
+
if (mimeType.equals(imageMimeType)) {
i.setType(imageMimeType);
addCamcorderIntent = false;
@@ -2963,14 +2967,28 @@ public class BrowserActivity extends Activity
mCameraFilePath = null;
if (mediaSource.equals(mediaSourceValueCamcorder)) {
- // Specified 'video/*' and requested the camcorder, so go ahead and launch the camcorder
- // directly.
+ // Specified 'video/*' and requested the camcorder, so go ahead and launch the
+ // camcorder directly.
BrowserActivity.this.startActivityForResult(camcorderIntent, FILE_SELECTED);
return;
} else if (mediaSource.equals(mediaSourceValueFileSystem)) {
// Specified filesystem as the source, so don't want to consider the camcorder.
addCamcorderIntent = false;
}
+ } else if (mimeType.equals(audioMimeType)) {
+ i.setType(audioMimeType);
+ addCameraIntent = false;
+ addCamcorderIntent = false;
+ if (mediaSource.equals(mediaSourceValueMicrophone)) {
+ // Specified 'audio/*' and requested microphone, so go ahead and launch the sound
+ // recorder.
+ BrowserActivity.this.startActivityForResult(soundRecIntent, FILE_SELECTED);
+ return;
+ }
+ // On a default system, there is no single option to open an audio "gallery". Both the
+ // sound recorder and music browser respond to the OPENABLE/audio/* intent unlike the
+ // image/* and video/* OPENABLE intents where the image / video gallery are the only
+ // respondants (and so the user is not prompted by default).
} else {
i.setType("*/*");
}