Offset 1, 18 lines modifiedOffset 1, 16 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·java.io.FileNotFoundException; 
4 import·android.graphics.BitmapFactory; 
5 import·android.graphics.BitmapFactory$Options; 
6 import·android.os.Trace;3 import·android.os.Trace;
7 import·android.util.Pair;4 import·android.util.Pair;
8 import·java.io.IOException;5 import·java.io.IOException;
9 import·java.io.InputStream;6 import·java.io.InputStream;
 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;
12 import·java.io.FileInputStream;10 import·java.io.FileInputStream;
13 import·java.util.Locale;11 import·java.util.Locale;
14 import·java.util.Objects;12 import·java.util.Objects;
15 import·com.android.providers.media.util.MimeUtils;13 import·com.android.providers.media.util.MimeUtils;
16 import·java.util.regex.Matcher;14 import·java.util.regex.Matcher;
Offset 21, 58 lines modifiedOffset 19, 53 lines modified
21 import·android.media.ExifInterface;19 import·android.media.ExifInterface;
22 import·java.text.ParseException;20 import·java.text.ParseException;
23 import·android.text.TextUtils;21 import·android.text.TextUtils;
24 import·android.net.Uri;22 import·android.net.Uri;
25 import·android.content.ContentUris;23 import·android.content.ContentUris;
26 import·android.content.ContentProviderOperation;24 import·android.content.ContentProviderOperation;
27 import·android.provider.MediaStore$Files;25 import·android.provider.MediaStore$Files;
28 import·com.android.providers.media.util.XmpInterface; 
29 import·android.os.Build;26 import·android.os.Build;
30 import·com.android.providers.media.util.FileUtils;27 import·com.android.providers.media.util.FileUtils;
31 import·java.util.Optional;28 import·java.util.Optional;
32 import·android.content.ContentProviderOperation$Builder;29 import·android.content.ContentProviderOperation$Builder;
33 import·java.nio.file.attribute.BasicFileAttributes;30 import·java.nio.file.attribute.BasicFileAttributes;
34 import·java.io.File;31 import·java.io.File;
 32 import·android.os.CancellationSignal;
35 import·java.util.Iterator;33 import·java.util.Iterator;
36 import·android.drm.DrmSupportInfo;34 import·android.drm.DrmSupportInfo;
37 import·java.util.ArrayList; 
38 import·android.util.ArraySet;35 import·android.util.ArraySet;
39 import·android.os.Environment;36 import·android.os.Environment;
40 import·java.util.TimeZone;37 import·java.util.TimeZone;
41 import·android.util.Log;38 import·android.util.Log;
42 import·java.util.Set;39 import·java.util.Set;
43 import·android.drm.DrmManagerClient;40 import·android.drm.DrmManagerClient;
44 import·java.util.Map;41 import·java.util.Map;
45 import·android.content.Context;42 import·android.content.Context;
46 import·java.util.List; 
47 import·java.text.SimpleDateFormat;43 import·java.text.SimpleDateFormat;
48 import·android.util.ArrayMap;44 import·android.util.ArrayMap;
49 import·java.util.regex.Pattern;45 import·java.util.regex.Pattern;
  
50 public·class·ModernMediaScanner·implements·MediaScanner46 public·class·ModernMediaScanner·implements·MediaScanner
51 {47 {
52 ····private·static·final·int·BATCH_SIZE·=·32;48 ····private·static·final·int·BATCH_SIZE·=·32;
53 ····private·static·final·boolean·LOGD·=·false;49 ····private·static·final·boolean·LOGD·=·false;
54 ····private·static·final·boolean·LOGV·=·false;50 ····private·static·final·boolean·LOGV·=·false;
55 ····private·static·final·boolean·LOGW·=·false;51 ····private·static·final·boolean·LOGW·=·false;
56 ····private·static·final·int·MAX_EXCLUDE_DIRS·=·450; 
57 ····private·static·final·int·MAX_XMP_SIZE_BYTES·=·1048576; 
58 ····private·static·final·Pattern·PATTERN_ALBUM_ART;52 ····private·static·final·Pattern·PATTERN_ALBUM_ART;
59 ····private·static·final·Pattern·PATTERN_INVISIBLE;53 ····private·static·final·Pattern·PATTERN_INVISIBLE;
60 ····private·static·final·Pattern·PATTERN_VISIBLE;54 ····private·static·final·Pattern·PATTERN_VISIBLE;
61 ····private·static·final·Pattern·PATTERN_YEAR;55 ····private·static·final·Pattern·PATTERN_YEAR;
62 ····private·static·final·String·TAG·=·"ModernMediaScanner";56 ····private·static·final·String·TAG·=·"ModernMediaScanner";
63 ····private·static·ArrayMap·sAudioTypes;57 ····private·static·ArrayMap·sAudioTypes;
64 ····private·static·final·SimpleDateFormat·sDateFormat;58 ····private·static·final·SimpleDateFormat·sDateFormat;
65 ····private·final·List·mActiveScans; 
66 ····private·final·Context·mContext;59 ····private·final·Context·mContext;
67 ····private·final·Map·mDirectoryLocks;60 ····private·final·Map·mDirectoryLocks;
68 ····private·final·DrmManagerClient·mDrmClient;61 ····private·final·DrmManagerClient·mDrmClient;
69 ····private·final·Set·mDrmMimeTypes;62 ····private·final·Set·mDrmMimeTypes;
70 ····private·final·Set·mPendingCleanDirectories;63 ····private·final·ArrayMap·mSignals;
71 ····64 ····
72 ····static·{65 ····static·{
73 ········final·String·s·=·"ModernMediaScanner";66 ········final·String·s·=·"ModernMediaScanner";
74 ········(sDateFormat·=·new·SimpleDateFormat("yyyyMMdd'T'HHmmss")).setTimeZone(TimeZone.getTimeZone("UTC"));67 ········(sDateFormat·=·new·SimpleDateFormat("yyyyMMdd'T'HHmmss")).setTimeZone(TimeZone.getTimeZone("UTC"));
75 ········PATTERN_VISIBLE·=·Pattern.compile("(?i)^/storage/[^/]+(?:/[0-9]+)?(?:/Android/sandbox/([^/]+))?$");68 ········PATTERN_VISIBLE·=·Pattern.compile("(?i)^/storage/[^/]+(?:/[0-9]+)?(?:/Android/sandbox/([^/]+))?$");
76 ········PATTERN_INVISIBLE·=·Pattern.compile("(?i)^/storage/[^/]+(?:/[0-9]+)?(?:/Android/sandbox/([^/]+))?/(?:(?:Android/(?:data|obb)$)|(?:(?:Movies|Music|Pictures)/.thumbnails$))");69 ········PATTERN_INVISIBLE·=·Pattern.compile("(?i)^/storage/[^/]+(?:/[0-9]+)?(?:/Android/sandbox/([^/]+))?/(?:(?:Android/(?:data|obb)$)|(?:(?:Movies|Music|Pictures)/.thumbnails$))");
77 ········PATTERN_YEAR·=·Pattern.compile("([1-9][0-9][0-9][0-9])");70 ········PATTERN_YEAR·=·Pattern.compile("([1-9][0-9][0-9][0-9])");
Offset 82, 46 lines modifiedOffset 75, 50 lines modified
82 ········ModernMediaScanner.sAudioTypes.put((Object)Environment.DIRECTORY_ALARMS,·(Object)"is_alarm");75 ········ModernMediaScanner.sAudioTypes.put((Object)Environment.DIRECTORY_ALARMS,·(Object)"is_alarm");
83 ········ModernMediaScanner.sAudioTypes.put((Object)Environment.DIRECTORY_PODCASTS,·(Object)"is_podcast");76 ········ModernMediaScanner.sAudioTypes.put((Object)Environment.DIRECTORY_PODCASTS,·(Object)"is_podcast");
84 ········ModernMediaScanner.sAudioTypes.put((Object)Environment.DIRECTORY_AUDIOBOOKS,·(Object)"is_audiobook");77 ········ModernMediaScanner.sAudioTypes.put((Object)Environment.DIRECTORY_AUDIOBOOKS,·(Object)"is_audiobook");
85 ········ModernMediaScanner.sAudioTypes.put((Object)Environment.DIRECTORY_MUSIC,·(Object)"is_music");78 ········ModernMediaScanner.sAudioTypes.put((Object)Environment.DIRECTORY_MUSIC,·(Object)"is_music");
86 ····}79 ····}
87 ····80 ····
88 ····public·ModernMediaScanner(final·Context·mContext)·{81 ····public·ModernMediaScanner(final·Context·mContext)·{
89 ········this.mPendingCleanDirectories·=·(Set)new·ArraySet();82 ········this.mSignals·=·new·ArrayMap();
90 ········this.mActiveScans·=·new·ArrayList(); 
91 ········this.mDirectoryLocks·=·(Map)new·ArrayMap();83 ········this.mDirectoryLocks·=·(Map)new·ArrayMap();
92 ········this.mDrmMimeTypes·=·(Set)new·ArraySet();84 ········this.mDrmMimeTypes·=·(Set)new·ArraySet();
93 ········this.mContext·=·mContext;85 ········this.mContext·=·mContext;
94 ········final·DrmManagerClient·mDrmClient·=·new·DrmManagerClient(mContext);86 ········final·DrmManagerClient·mDrmClient·=·new·DrmManagerClient(mContext);
95 ········this.mDrmClient·=·mDrmClient;87 ········this.mDrmClient·=·mDrmClient;
96 ········final·Iterator·iterator·=·mDrmClient.getAvailableDrmSupportInfo().iterator();88 ········final·Iterator·iterator·=·mDrmClient.getAvailableDrmSupportInfo().iterator();
97 ········while·(iterator.hasNext())·{89 ········while·(iterator.hasNext())·{
98 ············final·Iterator·mimeTypeIterator·=·((DrmSupportInfo)iterator.next()).getMimeTypeIterator();90 ············final·Iterator·mimeTypeIterator·=·((DrmSupportInfo)iterator.next()).getMimeTypeIterator();
99 ············while·(mimeTypeIterator.hasNext())·{91 ············while·(mimeTypeIterator.hasNext())·{
100 ················this.mDrmMimeTypes.add(mimeTypeIterator.next());92 ················this.mDrmMimeTypes.add(mimeTypeIterator.next());
101 ············}93 ············}
102 ········}94 ········}
103 ····}95 ····}
104 ····96 ····
105 ····private·void·addActiveScan(final·ModernMediaScanner$Scan·modernMediaScanner$Scan)·{ 
106 ········synchronized·(this.mActiveScans)·{ 
107 ············this.mActiveScans.add(modernMediaScanner$Scan); 
108 ········} 
109 ····} 
110 ···· 
111 ····private·static·Optional·firstPresent(final·Optional...·array)·{97 ····private·static·Optional·firstPresent(final·Optional...·array)·{
112 ········for·(int·length·=·array.length,·i·=·0;·i·<·length;·++i)·{98 ········for·(int·length·=·array.length,·i·=·0;·i·<·length;·++i)·{
113 ············final·Optional·optional·=·array[i];99 ············final·Optional·optional·=·array[i];
114 ············if·(optional.isPresent())·{100 ············if·(optional.isPresent())·{
115 ················return·optional;101 ················return·optional;
116 ············}102 ············}
117 ········}103 ········}
118 ········return·Optional.empty();104 ········return·Optional.empty();
119 ····}105 ····}
120 ····106 ····
 107 ····private·CancellationSignal·getOrCreateSignal(final·String·s)·{
 108 ········synchronized·(this.mSignals)·{
 109 ············CancellationSignal·cancellationSignal·=·(CancellationSignal)this.mSignals.get((Object)s);
 110 ············if·(cancellationSignal·==·null)·{
 111 ················cancellationSignal·=·new·CancellationSignal();
 112 ················this.mSignals.put((Object)s,·(Object)cancellationSignal);
 113 ············}
 114 ············return·cancellationSignal;
 115 ········}
 116 ····}
 117 ····
121 ····static·boolean·isFileAlbumArt(final·File·file)·{118 ····static·boolean·isFileAlbumArt(final·File·file)·{
122 ········return·ModernMediaScanner.PATTERN_ALBUM_ART.matcher(file.getName()).matches();119 ········return·ModernMediaScanner.PATTERN_ALBUM_ART.matcher(file.getName()).matches();
123 ····}120 ····}
124 ····121 ····
125 ····static·boolean·isZero(final·String·s)·{122 ····static·boolean·isZero(final·String·s)·{
126 ········if·(s.length()·==·0)·{123 ········if·(s.length()·==·0)·{
127 ············return·false;124 ············return·false;
Offset 150, 22 lines modifiedOffset 147, 14 lines modified
150 ············sb.append(file);147 ············sb.append(file);
151 ············sb.append(":·");148 ············sb.append(":·");
152 ············sb.append(ex);149 ············sb.append(ex);
153 ············Log.w("ModernMediaScanner",·sb.toString());150 ············Log.w("ModernMediaScanner",·sb.toString());
154 ········}151 ········}
155 ····}152 ····}
156 ····153 ····
157 ····private·static·byte[]·maybeTruncateXmp(final·XmpInterface·xmpInterface)·{ 
158 ········byte[]·redactedXmp·=·xmpInterface.getRedactedXmp(); 
159 ········if·(redactedXmp.length·>·1048576)·{ 
160 ············redactedXmp·=·new·byte[0]; 
161 ········} 
162 ········return·redactedXmp; 
163 ····} 
164 ···· 
165 ····private·static·ContentProviderOperation$Builder·newUpsert(final·String·s,·final·long·n)·{154 ····private·static·ContentProviderOperation$Builder·newUpsert(final·String·s,·final·long·n)·{
166 ········final·Uri·contentUri·=·MediaStore$Files.getContentUri(s);155 ········final·Uri·contentUri·=·MediaStore$Files.getContentUri(s);
167 ········final·long·n2·=·lcmp(n,·(long)(-1));156 ········final·long·n2·=·lcmp(n,·(long)(-1));
168 ········final·int·n3·=·1;157 ········final·int·n3·=·1;
169 ········if·(n2·==·0)·{158 ········if·(n2·==·0)·{
170 ············return·ContentProviderOperation.newInsert(contentUri).withExceptionAllowed((boolean)(n3·!=·0));159 ············return·ContentProviderOperation.newInsert(contentUri).withExceptionAllowed((boolean)(n3·!=·0));
171 ········}160 ········}
Offset 240, 15 lines modifiedOffset 229, 24 lines modified
240 ················return·Optional.of(dateTimeOriginal·+·Math.round((float)n·/·n5)·*·n4);229 ················return·Optional.of(dateTimeOriginal·+·Math.round((float)n·/·n5)·*·n4);
241 ············}230 ············}
242 ········}231 ········}
243 ········return·Optional.empty();232 ········return·Optional.empty();
244 ····}233 ····}
245 ····234 ····
246 ····static·Optional·parseOptionalImageResolution(final·MediaMetadataRetriever·mediaMetadataRetriever)·{235 ····static·Optional·parseOptionalImageResolution(final·MediaMetadataRetriever·mediaMetadataRetriever)·{
247 ········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();
248 ····}246 ····}
249 ····247 ····
250 ····static·Optional·parseOptionalMimeType(String·s,·final·String·s2)·{248 ····static·Optional·parseOptionalMimeType(String·s,·final·String·s2)·{
251 ········if·(TextUtils.isEmpty((CharSequence)s2))·{249 ········if·(TextUtils.isEmpty((CharSequence)s2))·{
252 ············return·Optional.empty();250 ············return·Optional.empty();
253 ········}251 ········}
254 ········final·int·index·=·s2.indexOf(47);252 ········final·int·index·=·s2.indexOf(47);
Offset 316, 23 lines modifiedOffset 314, 21 lines modified
316 ········if·(n·!=·8)·{314 ········if·(n·!=·8)·{
317 ············return·Optional.empty();315 ············return·Optional.empty();
318 ········}316 ········}
319 ········return·Optional.of(270);317 ········return·Optional.of(270);
320 ····}318 ····}
321 ····319 ····
322 ····static·Optional·parseOptionalResolution(final·ExifInterface·exifInterface)·{320 ····static·Optional·parseOptionalResolution(final·ExifInterface·exifInterface)·{
323 ········return·parseOptionalResolution(parseOptionalOrZero((Object)exifInterface.getAttribute("ImageWidth")),·parseOptionalOrZero((Object)exifInterface.getAttribute("ImageLength")));321 ········final·Optional·optionalOrZero·=·parseOptionalOrZero(exifInterface.getAttribute("ImageWidth"));
324 ····}322 ········final·Optional·optionalOrZero2·=·parseOptionalOrZero(exifInterface.getAttribute("ImageLength"));
325 ····323 ········if·(optionalOrZero.isPresent()·&&·optionalOrZero2.isPresent())·{
326 ····private·static·Optional·parseOptionalResolution(final·Optional·optional,·final·Optional·optional2)·{ 
327 ········if·(optional.isPresent()·&&·optional2.isPresent())·{ 
328 ············final·StringBuilder·sb·=·new·StringBuilder();324 ············final·StringBuilder·sb·=·new·StringBuilder();
329 ············sb.append(optional.get());325 ············sb.append(optionalOrZero.get());
330 ············sb.append("\u00d7");326 ············sb.append("\u00d7");
331 ············sb.append(optional2.get());327 ············sb.append(optionalOrZero2.get());
332 ············return·Optional.of(sb.toString());328 ············return·Optional.of(sb.toString());
333 ········}329 ········}
334 ········return·Optional.empty();330 ········return·Optional.empty();
335 ····}331 ····}
336 ····332 ····
337 ····static·Optional·parseOptionalTrack(final·MediaMetadataRetriever·mediaMetadataRetriever)·{333 ····static·Optional·parseOptionalTrack(final·MediaMetadataRetriever·mediaMetadataRetriever)·{
338 ········final·Optional·optionalNumerator·=·parseOptionalNumerator(mediaMetadataRetriever.extractMetadata(14));334 ········final·Optional·optionalNumerator·=·parseOptionalNumerator(mediaMetadataRetriever.extractMetadata(14));
Offset 340, 35 lines modifiedOffset 336, 38 lines modified
340 ········if·(optionalNumerator.isPresent()·&&·optional.isPresent())·{336 ········if·(optionalNumerator.isPresent()·&&·optional.isPresent())·{
341 ············optional·=·Optional.of(optionalNumerator.get()·*·1000·+·(int)optional.get());337 ············optional·=·Optional.of(optionalNumerator.get()·*·1000·+·(int)optional.get());
342 ········}338 ········}
343 ········return·optional;339 ········return·optional;
344 ····}340 ····}
345 ····341 ····
346 ····static·Optional·parseOptionalVideoResolution(final·MediaMetadataRetriever·mediaMetadataRetriever)·{342 ····static·Optional·parseOptionalVideoResolution(final·MediaMetadataRetriever·mediaMetadataRetriever)·{
347 ········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();
348 ····}353 ····}
349 ····354 ····
350 ····static·Optional·parseOptionalYear(final·String·s)·{355 ····static·Optional·parseOptionalYear(final·String·s)·{
351 ········final·Optional·optional·=·parseOptional(s);356 ········final·Optional·optional·=·parseOptional(s);
352 ········if·(!optional.isPresent())·{357 ········if·(!optional.isPresent())·{
353 ············return·Optional.empty();358 ············return·Optional.empty();
354 ········}359 ········}
355 ········final·Matcher·matcher·=·ModernMediaScanner.PATTERN_YEAR.matcher(optional.get());360 ········final·Matcher·matcher·=·ModernMediaScanner.PATTERN_YEAR.matcher(optional.get());
356 ········if·(matcher.find())·{361 ········if·(matcher.find())·{
357 ············return·Optional.of(Integer.parseInt(matcher.group(1)));362 ············return·Optional.of(Integer.parseInt(matcher.group(1)));
358 ········}363 ········}
359 ········return·Optional.empty();364 ········return·Optional.empty();
360 ····}365 ····}
361 ····366 ····
362 ····private·void·removeActiveScan(final·ModernMediaScanner$Scan·modernMediaScanner$Scan)·{ 
363 ········synchronized·(this.mActiveScans)·{ 
364 ············this.mActiveScans.remove(modernMediaScanner$Scan); 
365 ········} 
366 ····} 
367 ···· 
368 ····private·static·int·resolveMediaTypeFromFilePath(final·File·file,·final·String·s,·final·boolean·b)·{367 ····private·static·int·resolveMediaTypeFromFilePath(final·File·file,·final·String·s,·final·boolean·b)·{
369 ········int·resolveMediaType·=·MimeUtils.resolveMediaType(s);368 ········int·resolveMediaType·=·MimeUtils.resolveMediaType(s);
370 ········int·n·=·0;369 ········int·n·=·0;
371 ········if·(b·||·FileUtils.isFileHidden(file))·{370 ········if·(b·||·FileUtils.isFileHidden(file))·{
372 ············resolveMediaType·=·0;371 ············resolveMediaType·=·0;
373 ········}372 ········}
374 ········if·(resolveMediaType·!=·1·||·!isFileAlbumArt(file))·{373 ········if·(resolveMediaType·!=·1·||·!isFileAlbumArt(file))·{
Offset 511, 15 lines modifiedOffset 510, 17 lines modified
511 ········final·String·s3·=·"description";510 ········final·String·s3·=·"description";
512 ········n2·=·0;511 ········n2·=·0;
513 ········upsert.withValue(s3,·(Object)null);512 ········upsert.withValue(s3,·(Object)null);
514 ········try·{513 ········try·{
515 ············final·FileInputStream·fileInputStream·=·new·FileInputStream(file);514 ············final·FileInputStream·fileInputStream·=·new·FileInputStream(file);
516 ············try·{515 ············try·{
517 ················final·ExifInterface·exifInterface·=·new·ExifInterface((InputStream)fileInputStream);516 ················final·ExifInterface·exifInterface·=·new·ExifInterface((InputStream)fileInputStream);
518 ················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));
519 ················withOptionalValue(upsert,·"datetaken",·parseOptionalDateTaken(exifInterface,·lastModifiedTime(file,·basicFileAttributes)·*·1000L));520 ················withOptionalValue(upsert,·"datetaken",·parseOptionalDateTaken(exifInterface,·lastModifiedTime(file,·basicFileAttributes)·*·1000L));
520 ················withOptionalValue(upsert,·"orientation",·parseOptionalOrientation(exifInterface.getAttributeInt("Orientation",·0)));521 ················withOptionalValue(upsert,·"orientation",·parseOptionalOrientation(exifInterface.getAttributeInt("Orientation",·0)));
521 ················withOptionalValue(upsert,·s3,·parseOptional((Object)exifInterface.getAttribute("ImageDescription")));522 ················withOptionalValue(upsert,·s3,·parseOptional((Object)exifInterface.getAttribute("ImageDescription")));
522 ················withOptionalValue(upsert,·"exposure_time",·parseOptional((Object)exifInterface.getAttribute("ExposureTime")));523 ················withOptionalValue(upsert,·"exposure_time",·parseOptional((Object)exifInterface.getAttribute("ExposureTime")));
523 ················withOptionalValue(upsert,·"f_number",·parseOptional((Object)exifInterface.getAttribute("FNumber")));524 ················withOptionalValue(upsert,·"f_number",·parseOptional((Object)exifInterface.getAttribute("FNumber")));
524 ················withOptionalValue(upsert,·"iso",·parseOptional((Object)exifInterface.getAttribute("ISOSpeedRatings")));525 ················withOptionalValue(upsert,·"iso",·parseOptional((Object)exifInterface.getAttribute("ISOSpeedRatings")));
525 ················withOptionalValue(upsert,·"scene_capture_type",·parseOptional((Object)exifInterface.getAttribute("SceneCaptureType")));526 ················withOptionalValue(upsert,·"scene_capture_type",·parseOptional((Object)exifInterface.getAttribute("SceneCaptureType")));
Offset 675, 29 lines modifiedOffset 676, 14 lines modified
675 ················finally·{676 ················finally·{
676 ····················Trace.endSection();677 ····················Trace.endSection();
677 ················}678 ················}
678 ············}679 ············}
679 ········}680 ········}
680 ····}681 ····}
681 ····682 ····
682 ····private·static·void·withBitmapResolutionValues(final·ContentProviderOperation$Builder·contentProviderOperation$Builder,·final·File·file)·{ 
683 ········final·BitmapFactory$Options·bitmapFactory$Options·=·new·BitmapFactory$Options(); 
684 ········final·boolean·b·=·true; 
685 ········bitmapFactory$Options.inSampleSize·=·(b·?·1·:·0); 
686 ········bitmapFactory$Options.inJustDecodeBounds·=·b; 
687 ········bitmapFactory$Options.outWidth·=·0; 
688 ········bitmapFactory$Options.outHeight·=·0; 
689 ········BitmapFactory.decodeFile(file.getAbsolutePath(),·bitmapFactory$Options); 
690 ········final·Optional·optionalOrZero·=·parseOptionalOrZero(bitmapFactory$Options.outWidth); 
691 ········final·Optional·optionalOrZero2·=·parseOptionalOrZero(bitmapFactory$Options.outHeight); 
692 ········withOptionalValue(contentProviderOperation$Builder,·"width",·optionalOrZero); 
693 ········withOptionalValue(contentProviderOperation$Builder,·"height",·optionalOrZero2); 
694 ········withOptionalValue(contentProviderOperation$Builder,·"resolution",·parseOptionalResolution(optionalOrZero,·optionalOrZero2)); 
695 ····} 
696 ···· 
697 ····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)·{
698 ········withOptionalMimeTypeAndMediaType(contentProviderOperation$Builder,·Optional.ofNullable(absolutePath),·Optional.ofNullable(n));684 ········withOptionalMimeTypeAndMediaType(contentProviderOperation$Builder,·Optional.ofNullable(absolutePath),·Optional.ofNullable(n));
699 ········absolutePath·=·file.getAbsolutePath();685 ········absolutePath·=·file.getAbsolutePath();
700 ········contentProviderOperation$Builder.withValue("_data",·(Object)absolutePath);686 ········contentProviderOperation$Builder.withValue("_data",·(Object)absolutePath);
701 ········contentProviderOperation$Builder.withValue("_size",·(Object)basicFileAttributes.size());687 ········contentProviderOperation$Builder.withValue("_size",·(Object)basicFileAttributes.size());
702 ········contentProviderOperation$Builder.withValue("date_modified",·(Object)lastModifiedTime(file,·basicFileAttributes));688 ········contentProviderOperation$Builder.withValue("date_modified",·(Object)lastModifiedTime(file,·basicFileAttributes));
703 ········contentProviderOperation$Builder.withValue("datetaken",·(Object)null);689 ········contentProviderOperation$Builder.withValue("datetaken",·(Object)null);
Offset 744, 28 lines modifiedOffset 730, 14 lines modified
744 ····730 ····
745 ····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)·{
746 ········if·(optional.isPresent())·{732 ········if·(optional.isPresent())·{
747 ············contentProviderOperation$Builder.withValue(s,·optional.get());733 ············contentProviderOperation$Builder.withValue(s,·optional.get());
748 ········}734 ········}
749 ····}735 ····}
750 ····736 ····
751 ····private·static·void·withResolutionValues(final·ContentProviderOperation$Builder·contentProviderOperation$Builder,·final·ExifInterface·exifInterface,·final·File·file)·{ 
752 ········final·Optional·optionalOrZero·=·parseOptionalOrZero(exifInterface.getAttribute("ImageWidth")); 
753 ········final·Optional·optionalOrZero2·=·parseOptionalOrZero(exifInterface.getAttribute("ImageLength")); 
754 ········final·Optional·optionalResolution·=·parseOptionalResolution(optionalOrZero,·optionalOrZero2); 
755 ········if·(optionalResolution.isPresent())·{ 
756 ············withOptionalValue(contentProviderOperation$Builder,·"width",·optionalOrZero); 
757 ············withOptionalValue(contentProviderOperation$Builder,·"height",·optionalOrZero2); 
758 ············contentProviderOperation$Builder.withValue("resolution",·optionalResolution.get()); 
759 ········} 
760 ········else·{ 
761 ············withBitmapResolutionValues(contentProviderOperation$Builder,·file); 
762 ········} 
763 ····} 
764 ···· 
765 ····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)·{
766 ········withOptionalMimeTypeAndMediaType(contentProviderOperation$Builder,·parseOptionalMimeType(s,·mediaMetadataRetriever.extractMetadata(12)),·Optional.empty());738 ········withOptionalMimeTypeAndMediaType(contentProviderOperation$Builder,·parseOptionalMimeType(s,·mediaMetadataRetriever.extractMetadata(12)),·Optional.empty());
767 ········withOptionalValue(contentProviderOperation$Builder,·"datetaken",·parseOptionalDate(mediaMetadataRetriever.extractMetadata(5)));739 ········withOptionalValue(contentProviderOperation$Builder,·"datetaken",·parseOptionalDate(mediaMetadataRetriever.extractMetadata(5)));
768 ········withOptionalValue(contentProviderOperation$Builder,·"cd_track_number",·parseOptional((Object)mediaMetadataRetriever.extractMetadata(0)));740 ········withOptionalValue(contentProviderOperation$Builder,·"cd_track_number",·parseOptional((Object)mediaMetadataRetriever.extractMetadata(0)));
769 ········final·int·n·=·1;741 ········final·int·n·=·1;
770 ········withOptionalValue(contentProviderOperation$Builder,·"album",·parseOptional((Object)mediaMetadataRetriever.extractMetadata(n)));742 ········withOptionalValue(contentProviderOperation$Builder,·"album",·parseOptional((Object)mediaMetadataRetriever.extractMetadata(n)));
771 ········final·int·n2·=·2;743 ········final·int·n2·=·2;
Offset 793, 44 lines modifiedOffset 765, 26 lines modified
793 ········withOptionalMimeTypeAndMediaType(contentProviderOperation$Builder,·parseOptionalMimeType(s,·xmpInterface.getFormat()),·Optional.empty());765 ········withOptionalMimeTypeAndMediaType(contentProviderOperation$Builder,·parseOptionalMimeType(s,·xmpInterface.getFormat()),·Optional.empty());
794 ········s·=·xmpInterface.getDocumentId();766 ········s·=·xmpInterface.getDocumentId();
795 ········contentProviderOperation$Builder.withValue("document_id",·(Object)s);767 ········contentProviderOperation$Builder.withValue("document_id",·(Object)s);
796 ········s·=·xmpInterface.getInstanceId();768 ········s·=·xmpInterface.getInstanceId();
797 ········contentProviderOperation$Builder.withValue("instance_id",·(Object)s);769 ········contentProviderOperation$Builder.withValue("instance_id",·(Object)s);
798 ········s·=·xmpInterface.getOriginalDocumentId();770 ········s·=·xmpInterface.getOriginalDocumentId();
799 ········contentProviderOperation$Builder.withValue("original_document_id",·(Object)s);771 ········contentProviderOperation$Builder.withValue("original_document_id",·(Object)s);
800 ········contentProviderOperation$Builder.withValue("xmp",·(Object)maybeTruncateXmp(xmpInterface));772 ········contentProviderOperation$Builder.withValue("xmp",·(Object)xmpInterface.getRedactedXmp());
801 ····}773 ····}
802 ····774 ····
803 ····public·Context·getContext()·{775 ····public·Context·getContext()·{
804 ········return·this.mContext;776 ········return·this.mContext;
805 ····}777 ····}
806 ····778 ····
807 ····public·void·onDetachVolume(final·String·s)·{779 ····public·void·onDetachVolume(final·String·s)·{
808 ········synchronized·(this.mActiveScans)·{780 ········synchronized·(this.mSignals)·{
809 ············for·(final·ModernMediaScanner$Scan·modernMediaScanner$Scan·:·this.mActiveScans)·{781 ············final·CancellationSignal·cancellationSignal·=·(CancellationSignal)this.mSignals.remove((Object)s);
810 ················if·(s.equals(ModernMediaScanner$Scan.access$000(modernMediaScanner$Scan)))·{782 ············if·(cancellationSignal·!=·null)·{
811 ····················ModernMediaScanner$Scan.access$100(modernMediaScanner$Scan).cancel();783 ················cancellationSignal.cancel();
812 ················} 
813 ············} 
814 ········} 
815 ····} 
816 ···· 
817 ····public·void·onDirectoryDirty(final·File·file)·{ 
818 ········synchronized·(this.mPendingCleanDirectories)·{ 
819 ············this.mPendingCleanDirectories.remove(file.getPath()); 
820 ············FileUtils.setDirectoryDirty(file,·true); 
821 ········} 
822 ····} 
823 ···· 
824 ····public·void·onIdleScanStopped()·{ 
825 ········synchronized·(this.mActiveScans)·{ 
826 ············for·(final·ModernMediaScanner$Scan·modernMediaScanner$Scan·:·this.mActiveScans)·{ 
827 ················if·(ModernMediaScanner$Scan.access$200(modernMediaScanner$Scan)·==·3)·{ 
828 ····················ModernMediaScanner$Scan.access$100(modernMediaScanner$Scan).cancel(); 
829 ················} 
830 ············}784 ············}
831 ········}785 ········}
832 ····}786 ····}
833 ····787 ····
834 ····public·void·scanDirectory(final·File·file,·final·int·n)·{788 ····public·void·scanDirectory(final·File·file,·final·int·n)·{
835 ········try·{789 ········try·{
836 ············final·ModernMediaScanner$Scan·modernMediaScanner$Scan·=·new·ModernMediaScanner$Scan(this,·file,·n,·(String)null);790 ············final·ModernMediaScanner$Scan·modernMediaScanner$Scan·=·new·ModernMediaScanner$Scan(this,·file,·n,·(String)null);
Offset 845, 20 lines modifiedOffset 799, 15 lines modified
845 ················finally·{799 ················finally·{
846 ····················final·Throwable·t;800 ····················final·Throwable·t;
847 ····················final·Throwable·t2;801 ····················final·Throwable·t2;
848 ····················t.addSuppressed(t2);802 ····················t.addSuppressed(t2);
849 ················}803 ················}
850 ············}804 ············}
851 ········}805 ········}
852 ········catch·(FileNotFoundException·ex)·{806 ········catch·(OperationCanceledException·ex)·{}
853 ············Log.e("ModernMediaScanner",·"Couldn't·find·directory·to·scan",·(Throwable)ex); 
854 ········} 
855 ········catch·(OperationCanceledException·ex2)·{ 
856 ············goto·Label_0056; 
857 ········} 
858 ····}807 ····}
859 ····808 ····
860 ····public·Uri·scanFile(final·File·file,·final·int·n)·{809 ····public·Uri·scanFile(final·File·file,·final·int·n)·{
861 ········return·this.scanFile(file,·n,·null);810 ········return·this.scanFile(file,·n,·null);
862 ····}811 ····}
863 ····812 ····
864 ····public·Uri·scanFile(final·File·file,·final·int·n,·final·String·s)·{813 ····public·Uri·scanFile(final·File·file,·final·int·n,·final·String·s)·{
Offset 876, 16 lines modifiedOffset 825, 14 lines modified
876 ················}825 ················}
877 ················finally·{826 ················finally·{
878 ····················final·Throwable·t;827 ····················final·Throwable·t;
879 ····················final·Throwable·t2;828 ····················final·Throwable·t2;
880 ····················t.addSuppressed(t2);829 ····················t.addSuppressed(t2);
881 ················}830 ················}
882 ············}831 ············}
 832 ············return·null;
883 ········}833 ········}
884 ········catch·(FileNotFoundException·ex)·{834 ········catch·(OperationCanceledException·ex)·{
885 ············Log.e("ModernMediaScanner",·"Couldn't·find·file·to·scan",·(Throwable)ex);835 ············return·null;
886 ········} 
887 ········catch·(OperationCanceledException·ex2)·{ 
888 ············goto·Label_0066; 
889 ········}836 ········}
890 ····}837 ····}
891 }838 }