Loading core/java/android/provider/MediaStore.java +11 −0 Original line number Diff line number Diff line Loading @@ -283,6 +283,17 @@ public final class MediaStore { */ public static final String IS_DRM = "is_drm"; /** * The width of the image/video in pixels. * @hide */ public static final String WIDTH = "width"; /** * The height of the image/video in pixels. * @hide */ public static final String HEIGHT = "height"; } /** Loading media/java/android/media/MediaScanner.java +25 −0 Original line number Diff line number Diff line Loading @@ -470,6 +470,8 @@ public class MediaScanner private int mCompilation; private boolean mIsDrm; private boolean mNoMedia; // flag to suppress file from appearing in media tables private int mWidth; private int mHeight; public FileCacheEntry beginFile(String path, String mimeType, long lastModified, long fileSize, boolean isDirectory, boolean noMedia) { Loading Loading @@ -545,6 +547,8 @@ public class MediaScanner mWriter = null; mCompilation = 0; mIsDrm = false; mWidth = 0; mHeight = 0; return entry; } Loading Loading @@ -583,6 +587,10 @@ public class MediaScanner processFile(path, mimeType, this); } if (MediaFile.isImageFileType(mFileType)) { processImageFile(path); } result = endFile(entry, ringtones, notifications, alarms, music, podcasts); } } Loading Loading @@ -697,6 +705,18 @@ public class MediaScanner return genreTagValue; } private void processImageFile(String path) { try { mBitmapOptions.outWidth = 0; mBitmapOptions.outHeight = 0; BitmapFactory.decodeFile(path, mBitmapOptions); mWidth = mBitmapOptions.outWidth; mHeight = mBitmapOptions.outHeight; } catch (Throwable th) { // ignore; } } public void setMimeType(String mimeType) { if ("audio/mp4".equals(mMimeType) && mimeType.startsWith("video")) { Loading Loading @@ -725,6 +745,11 @@ public class MediaScanner map.put(MediaStore.MediaColumns.MIME_TYPE, mMimeType); map.put(MediaStore.MediaColumns.IS_DRM, mIsDrm); if (mWidth > 0 && mHeight > 0) { map.put(MediaStore.MediaColumns.WIDTH, mWidth); map.put(MediaStore.MediaColumns.HEIGHT, mHeight); } if (!mNoMedia) { if (MediaFile.isVideoFileType(mFileType)) { map.put(Video.Media.ARTIST, (mArtist != null && mArtist.length() > 0 Loading Loading
core/java/android/provider/MediaStore.java +11 −0 Original line number Diff line number Diff line Loading @@ -283,6 +283,17 @@ public final class MediaStore { */ public static final String IS_DRM = "is_drm"; /** * The width of the image/video in pixels. * @hide */ public static final String WIDTH = "width"; /** * The height of the image/video in pixels. * @hide */ public static final String HEIGHT = "height"; } /** Loading
media/java/android/media/MediaScanner.java +25 −0 Original line number Diff line number Diff line Loading @@ -470,6 +470,8 @@ public class MediaScanner private int mCompilation; private boolean mIsDrm; private boolean mNoMedia; // flag to suppress file from appearing in media tables private int mWidth; private int mHeight; public FileCacheEntry beginFile(String path, String mimeType, long lastModified, long fileSize, boolean isDirectory, boolean noMedia) { Loading Loading @@ -545,6 +547,8 @@ public class MediaScanner mWriter = null; mCompilation = 0; mIsDrm = false; mWidth = 0; mHeight = 0; return entry; } Loading Loading @@ -583,6 +587,10 @@ public class MediaScanner processFile(path, mimeType, this); } if (MediaFile.isImageFileType(mFileType)) { processImageFile(path); } result = endFile(entry, ringtones, notifications, alarms, music, podcasts); } } Loading Loading @@ -697,6 +705,18 @@ public class MediaScanner return genreTagValue; } private void processImageFile(String path) { try { mBitmapOptions.outWidth = 0; mBitmapOptions.outHeight = 0; BitmapFactory.decodeFile(path, mBitmapOptions); mWidth = mBitmapOptions.outWidth; mHeight = mBitmapOptions.outHeight; } catch (Throwable th) { // ignore; } } public void setMimeType(String mimeType) { if ("audio/mp4".equals(mMimeType) && mimeType.startsWith("video")) { Loading Loading @@ -725,6 +745,11 @@ public class MediaScanner map.put(MediaStore.MediaColumns.MIME_TYPE, mMimeType); map.put(MediaStore.MediaColumns.IS_DRM, mIsDrm); if (mWidth > 0 && mHeight > 0) { map.put(MediaStore.MediaColumns.WIDTH, mWidth); map.put(MediaStore.MediaColumns.HEIGHT, mHeight); } if (!mNoMedia) { if (MediaFile.isVideoFileType(mFileType)) { map.put(Video.Media.ARTIST, (mArtist != null && mArtist.length() > 0 Loading