Offset 1, 13 lines modifiedOffset 1, 11 lines modified
  
1 package·com.android.providers.media.scan;1 package·com.android.providers.media.scan;
  
2 import·android.os.OperationCanceledException;2 import·android.os.OperationCanceledException;
3 import·android.graphics.BitmapFactory; 
4 import·android.graphics.BitmapFactory$Options; 
5 import·android.os.Trace;3 import·android.os.Trace;
6 import·android.util.Pair;4 import·android.util.Pair;
7 import·java.io.IOException;5 import·java.io.IOException;
8 import·java.io.InputStream;6 import·java.io.InputStream;
9 import·com.android.providers.media.util.XmpInterface;7 import·com.android.providers.media.util.XmpInterface;
10 import·java.io.FileDescriptor;8 import·java.io.FileDescriptor;
11 import·com.android.providers.media.util.IsoInterface;9 import·com.android.providers.media.util.IsoInterface;
Offset 231, 15 lines modifiedOffset 229, 24 lines modified
231 ················return·Optional.of(dateTimeOriginal·+·Math.round((float)n·/·n5)·*·n4);229 ················return·Optional.of(dateTimeOriginal·+·Math.round((float)n·/·n5)·*·n4);
232 ············}230 ············}
233 ········}231 ········}
234 ········return·Optional.empty();232 ········return·Optional.empty();
235 ····}233 ····}
236 ····234 ····
237 ····static·Optional·parseOptionalImageResolution(final·MediaMetadataRetriever·mediaMetadataRetriever)·{235 ····static·Optional·parseOptionalImageResolution(final·MediaMetadataRetriever·mediaMetadataRetriever)·{
238 ········return·parseOptionalResolution(parseOptional((Object)mediaMetadataRetriever.extractMetadata(29)),·parseOptional((Object)mediaMetadataRetriever.extractMetadata(30)));236 ········final·Optional·optional·=·parseOptional(mediaMetadataRetriever.extractMetadata(29));
 237 ········final·Optional·optional2·=·parseOptional(mediaMetadataRetriever.extractMetadata(30));
 238 ········if·(optional.isPresent()·&&·optional2.isPresent())·{
 239 ············final·StringBuilder·sb·=·new·StringBuilder();
 240 ············sb.append(optional.get());
 241 ············sb.append("\u00d7");
 242 ············sb.append(optional2.get());
 243 ············return·Optional.of(sb.toString());
 244 ········}
 245 ········return·Optional.empty();
239 ····}246 ····}
240 ····247 ····
241 ····static·Optional·parseOptionalMimeType(String·s,·final·String·s2)·{248 ····static·Optional·parseOptionalMimeType(String·s,·final·String·s2)·{
242 ········if·(TextUtils.isEmpty((CharSequence)s2))·{249 ········if·(TextUtils.isEmpty((CharSequence)s2))·{
243 ············return·Optional.empty();250 ············return·Optional.empty();
244 ········}251 ········}
245 ········final·int·index·=·s2.indexOf(47);252 ········final·int·index·=·s2.indexOf(47);
Offset 307, 23 lines modifiedOffset 314, 21 lines modified
307 ········if·(n·!=·8)·{314 ········if·(n·!=·8)·{
308 ············return·Optional.empty();315 ············return·Optional.empty();
309 ········}316 ········}
310 ········return·Optional.of(270);317 ········return·Optional.of(270);
311 ····}318 ····}
312 ····319 ····
313 ····static·Optional·parseOptionalResolution(final·ExifInterface·exifInterface)·{320 ····static·Optional·parseOptionalResolution(final·ExifInterface·exifInterface)·{
314 ········return·parseOptionalResolution(parseOptionalOrZero((Object)exifInterface.getAttribute("ImageWidth")),·parseOptionalOrZero((Object)exifInterface.getAttribute("ImageLength")));321 ········final·Optional·optionalOrZero·=·parseOptionalOrZero(exifInterface.getAttribute("ImageWidth"));
315 ····}322 ········final·Optional·optionalOrZero2·=·parseOptionalOrZero(exifInterface.getAttribute("ImageLength"));
316 ····323 ········if·(optionalOrZero.isPresent()·&&·optionalOrZero2.isPresent())·{
317 ····private·static·Optional·parseOptionalResolution(final·Optional·optional,·final·Optional·optional2)·{ 
318 ········if·(optional.isPresent()·&&·optional2.isPresent())·{ 
319 ············final·StringBuilder·sb·=·new·StringBuilder();324 ············final·StringBuilder·sb·=·new·StringBuilder();
320 ············sb.append(optional.get());325 ············sb.append(optionalOrZero.get());
321 ············sb.append("\u00d7");326 ············sb.append("\u00d7");
322 ············sb.append(optional2.get());327 ············sb.append(optionalOrZero2.get());
323 ············return·Optional.of(sb.toString());328 ············return·Optional.of(sb.toString());
324 ········}329 ········}
325 ········return·Optional.empty();330 ········return·Optional.empty();
326 ····}331 ····}
327 ····332 ····
328 ····static·Optional·parseOptionalTrack(final·MediaMetadataRetriever·mediaMetadataRetriever)·{333 ····static·Optional·parseOptionalTrack(final·MediaMetadataRetriever·mediaMetadataRetriever)·{
329 ········final·Optional·optionalNumerator·=·parseOptionalNumerator(mediaMetadataRetriever.extractMetadata(14));334 ········final·Optional·optionalNumerator·=·parseOptionalNumerator(mediaMetadataRetriever.extractMetadata(14));
Offset 331, 15 lines modifiedOffset 336, 24 lines modified
331 ········if·(optionalNumerator.isPresent()·&&·optional.isPresent())·{336 ········if·(optionalNumerator.isPresent()·&&·optional.isPresent())·{
332 ············optional·=·Optional.of(optionalNumerator.get()·*·1000·+·(int)optional.get());337 ············optional·=·Optional.of(optionalNumerator.get()·*·1000·+·(int)optional.get());
333 ········}338 ········}
334 ········return·optional;339 ········return·optional;
335 ····}340 ····}
336 ····341 ····
337 ····static·Optional·parseOptionalVideoResolution(final·MediaMetadataRetriever·mediaMetadataRetriever)·{342 ····static·Optional·parseOptionalVideoResolution(final·MediaMetadataRetriever·mediaMetadataRetriever)·{
338 ········return·parseOptionalResolution(parseOptional((Object)mediaMetadataRetriever.extractMetadata(18)),·parseOptional((Object)mediaMetadataRetriever.extractMetadata(19)));343 ········final·Optional·optional·=·parseOptional(mediaMetadataRetriever.extractMetadata(18));
 344 ········final·Optional·optional2·=·parseOptional(mediaMetadataRetriever.extractMetadata(19));
 345 ········if·(optional.isPresent()·&&·optional2.isPresent())·{
 346 ············final·StringBuilder·sb·=·new·StringBuilder();
 347 ············sb.append(optional.get());
 348 ············sb.append("\u00d7");
 349 ············sb.append(optional2.get());
 350 ············return·Optional.of(sb.toString());
 351 ········}
 352 ········return·Optional.empty();
339 ····}353 ····}
340 ····354 ····
341 ····static·Optional·parseOptionalYear(final·String·s)·{355 ····static·Optional·parseOptionalYear(final·String·s)·{
342 ········final·Optional·optional·=·parseOptional(s);356 ········final·Optional·optional·=·parseOptional(s);
343 ········if·(!optional.isPresent())·{357 ········if·(!optional.isPresent())·{
344 ············return·Optional.empty();358 ············return·Optional.empty();
345 ········}359 ········}
Offset 496, 15 lines modifiedOffset 510, 17 lines modified
496 ········final·String·s3·=·"description";510 ········final·String·s3·=·"description";
497 ········n2·=·0;511 ········n2·=·0;
498 ········upsert.withValue(s3,·(Object)null);512 ········upsert.withValue(s3,·(Object)null);
499 ········try·{513 ········try·{
500 ············final·FileInputStream·fileInputStream·=·new·FileInputStream(file);514 ············final·FileInputStream·fileInputStream·=·new·FileInputStream(file);
501 ············try·{515 ············try·{
502 ················final·ExifInterface·exifInterface·=·new·ExifInterface((InputStream)fileInputStream);516 ················final·ExifInterface·exifInterface·=·new·ExifInterface((InputStream)fileInputStream);
503 ················withResolutionValues(upsert,·exifInterface,·file);517 ················withOptionalValue(upsert,·"width",·parseOptionalOrZero((Object)exifInterface.getAttribute("ImageWidth")));
 518 ················withOptionalValue(upsert,·"height",·parseOptionalOrZero((Object)exifInterface.getAttribute("ImageLength")));
 519 ················withOptionalValue(upsert,·"resolution",·parseOptionalResolution(exifInterface));
504 ················withOptionalValue(upsert,·"datetaken",·parseOptionalDateTaken(exifInterface,·lastModifiedTime(file,·basicFileAttributes)·*·1000L));520 ················withOptionalValue(upsert,·"datetaken",·parseOptionalDateTaken(exifInterface,·lastModifiedTime(file,·basicFileAttributes)·*·1000L));
505 ················withOptionalValue(upsert,·"orientation",·parseOptionalOrientation(exifInterface.getAttributeInt("Orientation",·0)));521 ················withOptionalValue(upsert,·"orientation",·parseOptionalOrientation(exifInterface.getAttributeInt("Orientation",·0)));
506 ················withOptionalValue(upsert,·s3,·parseOptional((Object)exifInterface.getAttribute("ImageDescription")));522 ················withOptionalValue(upsert,·s3,·parseOptional((Object)exifInterface.getAttribute("ImageDescription")));
507 ················withOptionalValue(upsert,·"exposure_time",·parseOptional((Object)exifInterface.getAttribute("ExposureTime")));523 ················withOptionalValue(upsert,·"exposure_time",·parseOptional((Object)exifInterface.getAttribute("ExposureTime")));
508 ················withOptionalValue(upsert,·"f_number",·parseOptional((Object)exifInterface.getAttribute("FNumber")));524 ················withOptionalValue(upsert,·"f_number",·parseOptional((Object)exifInterface.getAttribute("FNumber")));
509 ················withOptionalValue(upsert,·"iso",·parseOptional((Object)exifInterface.getAttribute("ISOSpeedRatings")));525 ················withOptionalValue(upsert,·"iso",·parseOptional((Object)exifInterface.getAttribute("ISOSpeedRatings")));
510 ················withOptionalValue(upsert,·"scene_capture_type",·parseOptional((Object)exifInterface.getAttribute("SceneCaptureType")));526 ················withOptionalValue(upsert,·"scene_capture_type",·parseOptional((Object)exifInterface.getAttribute("SceneCaptureType")));
Offset 660, 29 lines modifiedOffset 676, 14 lines modified
660 ················finally·{676 ················finally·{
661 ····················Trace.endSection();677 ····················Trace.endSection();
662 ················}678 ················}
663 ············}679 ············}
664 ········}680 ········}
665 ····}681 ····}
666 ····682 ····
667 ····private·static·void·withBitmapResolutionValues(final·ContentProviderOperation$Builder·contentProviderOperation$Builder,·final·File·file)·{ 
668 ········final·BitmapFactory$Options·bitmapFactory$Options·=·new·BitmapFactory$Options(); 
669 ········final·boolean·b·=·true; 
670 ········bitmapFactory$Options.inSampleSize·=·(b·?·1·:·0); 
671 ········bitmapFactory$Options.inJustDecodeBounds·=·b; 
672 ········bitmapFactory$Options.outWidth·=·0; 
673 ········bitmapFactory$Options.outHeight·=·0; 
674 ········BitmapFactory.decodeFile(file.getAbsolutePath(),·bitmapFactory$Options); 
675 ········final·Optional·optionalOrZero·=·parseOptionalOrZero(bitmapFactory$Options.outWidth); 
676 ········final·Optional·optionalOrZero2·=·parseOptionalOrZero(bitmapFactory$Options.outHeight); 
677 ········withOptionalValue(contentProviderOperation$Builder,·"width",·optionalOrZero); 
678 ········withOptionalValue(contentProviderOperation$Builder,·"height",·optionalOrZero2); 
679 ········withOptionalValue(contentProviderOperation$Builder,·"resolution",·parseOptionalResolution(optionalOrZero,·optionalOrZero2)); 
680 ····} 
681 ···· 
682 ····private·static·void·withGenericValues(final·ContentProviderOperation$Builder·contentProviderOperation$Builder,·final·File·file,·final·BasicFileAttributes·basicFileAttributes,·String·absolutePath,·final·Integer·n)·{683 ····private·static·void·withGenericValues(final·ContentProviderOperation$Builder·contentProviderOperation$Builder,·final·File·file,·final·BasicFileAttributes·basicFileAttributes,·String·absolutePath,·final·Integer·n)·{
683 ········withOptionalMimeTypeAndMediaType(contentProviderOperation$Builder,·Optional.ofNullable(absolutePath),·Optional.ofNullable(n));684 ········withOptionalMimeTypeAndMediaType(contentProviderOperation$Builder,·Optional.ofNullable(absolutePath),·Optional.ofNullable(n));
684 ········absolutePath·=·file.getAbsolutePath();685 ········absolutePath·=·file.getAbsolutePath();
685 ········contentProviderOperation$Builder.withValue("_data",·(Object)absolutePath);686 ········contentProviderOperation$Builder.withValue("_data",·(Object)absolutePath);
686 ········contentProviderOperation$Builder.withValue("_size",·(Object)basicFileAttributes.size());687 ········contentProviderOperation$Builder.withValue("_size",·(Object)basicFileAttributes.size());
687 ········contentProviderOperation$Builder.withValue("date_modified",·(Object)lastModifiedTime(file,·basicFileAttributes));688 ········contentProviderOperation$Builder.withValue("date_modified",·(Object)lastModifiedTime(file,·basicFileAttributes));
688 ········contentProviderOperation$Builder.withValue("datetaken",·(Object)null);689 ········contentProviderOperation$Builder.withValue("datetaken",·(Object)null);
Offset 729, 28 lines modifiedOffset 730, 14 lines modified
729 ····730 ····
730 ····private·static·void·withOptionalValue(final·ContentProviderOperation$Builder·contentProviderOperation$Builder,·final·String·s,·final·Optional·optional)·{731 ····private·static·void·withOptionalValue(final·ContentProviderOperation$Builder·contentProviderOperation$Builder,·final·String·s,·final·Optional·optional)·{
731 ········if·(optional.isPresent())·{732 ········if·(optional.isPresent())·{
732 ············contentProviderOperation$Builder.withValue(s,·optional.get());733 ············contentProviderOperation$Builder.withValue(s,·optional.get());
733 ········}734 ········}
734 ····}735 ····}
735 ····736 ····
736 ····private·static·void·withResolutionValues(final·ContentProviderOperation$Builder·contentProviderOperation$Builder,·final·ExifInterface·exifInterface,·final·File·file)·{ 
737 ········final·Optional·optionalOrZero·=·parseOptionalOrZero(exifInterface.getAttribute("ImageWidth")); 
738 ········final·Optional·optionalOrZero2·=·parseOptionalOrZero(exifInterface.getAttribute("ImageLength")); 
739 ········final·Optional·optionalResolution·=·parseOptionalResolution(optionalOrZero,·optionalOrZero2); 
740 ········if·(optionalResolution.isPresent())·{ 
741 ············withOptionalValue(contentProviderOperation$Builder,·"width",·optionalOrZero); 
742 ············withOptionalValue(contentProviderOperation$Builder,·"height",·optionalOrZero2); 
743 ············contentProviderOperation$Builder.withValue("resolution",·optionalResolution.get()); 
744 ········} 
745 ········else·{ 
746 ············withBitmapResolutionValues(contentProviderOperation$Builder,·file); 
747 ········} 
748 ····} 
749 ···· 
750 ····private·static·void·withRetrieverValues(final·ContentProviderOperation$Builder·contentProviderOperation$Builder,·final·MediaMetadataRetriever·mediaMetadataRetriever,·final·String·s)·{737 ····private·static·void·withRetrieverValues(final·ContentProviderOperation$Builder·contentProviderOperation$Builder,·final·MediaMetadataRetriever·mediaMetadataRetriever,·final·String·s)·{
751 ········withOptionalMimeTypeAndMediaType(contentProviderOperation$Builder,·parseOptionalMimeType(s,·mediaMetadataRetriever.extractMetadata(12)),·Optional.empty());738 ········withOptionalMimeTypeAndMediaType(contentProviderOperation$Builder,·parseOptionalMimeType(s,·mediaMetadataRetriever.extractMetadata(12)),·Optional.empty());
752 ········withOptionalValue(contentProviderOperation$Builder,·"datetaken",·parseOptionalDate(mediaMetadataRetriever.extractMetadata(5)));739 ········withOptionalValue(contentProviderOperation$Builder,·"datetaken",·parseOptionalDate(mediaMetadataRetriever.extractMetadata(5)));
753 ········withOptionalValue(contentProviderOperation$Builder,·"cd_track_number",·parseOptional((Object)mediaMetadataRetriever.extractMetadata(0)));740 ········withOptionalValue(contentProviderOperation$Builder,·"cd_track_number",·parseOptional((Object)mediaMetadataRetriever.extractMetadata(0)));
754 ········final·int·n·=·1;741 ········final·int·n·=·1;
755 ········withOptionalValue(contentProviderOperation$Builder,·"album",·parseOptional((Object)mediaMetadataRetriever.extractMetadata(n)));742 ········withOptionalValue(contentProviderOperation$Builder,·"album",·parseOptional((Object)mediaMetadataRetriever.extractMetadata(n)));
756 ········final·int·n2·=·2;743 ········final·int·n2·=·2;