1 /*
2  * Copyright (C) 2017 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package com.android.documentsui.inspector;
17 
18 import android.media.ExifInterface;
19 import android.media.MediaMetadata;
20 import android.os.Bundle;
21 import android.provider.DocumentsContract;
22 
23 import com.android.documentsui.base.Shared;
24 
25 final class TestMetadata {
TestMetadata()26     private TestMetadata() {}
27 
populateExifData(Bundle container)28     static void populateExifData(Bundle container) {
29         Bundle data = new Bundle();
30         container.putBundle(DocumentsContract.METADATA_EXIF, data);
31 
32         data.putInt(ExifInterface.TAG_IMAGE_WIDTH, 3840);
33         data.putInt(ExifInterface.TAG_IMAGE_LENGTH, 2160);
34         data.putString(ExifInterface.TAG_DATETIME, "Jan 01, 1970, 12:16 AM");
35         data.putString(ExifInterface.TAG_GPS_LATITUDE, "33/1,59/1,4530/100");
36         data.putString(ExifInterface.TAG_GPS_LONGITUDE, "118/1,28/1,3124/100");
37         data.putString(ExifInterface.TAG_GPS_LATITUDE_REF, "N");
38         data.putString(ExifInterface.TAG_GPS_LONGITUDE_REF, "W");
39         data.putDouble(ExifInterface.TAG_GPS_ALTITUDE, 1244);
40         data.putString(ExifInterface.TAG_MAKE, "Google");
41         data.putString(ExifInterface.TAG_MODEL, "Pixel");
42         data.putDouble(ExifInterface.TAG_SHUTTER_SPEED_VALUE, 6.643);
43         data.putDouble(ExifInterface.TAG_APERTURE, 2.0);
44         data.putInt(ExifInterface.TAG_ISO_SPEED_RATINGS, 120);
45         data.putDouble(ExifInterface.TAG_FOCAL_LENGTH, 4.27);
46     }
47 
populateVideoData(Bundle container)48     static void populateVideoData(Bundle container) {
49         Bundle data = new Bundle();
50         container.putBundle(Shared.METADATA_KEY_VIDEO, data);
51 
52         // By convention we reuse exif tags for dimensions.
53         data.putInt(ExifInterface.TAG_IMAGE_WIDTH, 1920);
54         data.putInt(ExifInterface.TAG_IMAGE_LENGTH, 1080);
55         data.putInt(MediaMetadata.METADATA_KEY_DURATION, 72000);
56     }
57 
populateAudioData(Bundle container)58     static void populateAudioData(Bundle container) {
59         Bundle data = new Bundle();
60         container.putBundle(Shared.METADATA_KEY_AUDIO, data);
61 
62         data.putInt(MediaMetadata.METADATA_KEY_DURATION, 72000);
63         data.putString(MediaMetadata.METADATA_KEY_ARTIST, "artist");
64         data.putString(MediaMetadata.METADATA_KEY_COMPOSER, "composer");
65         data.putString(MediaMetadata.METADATA_KEY_ALBUM, "album");
66     }
67 }
68