yashsingh1/xdaforums huggingface dataset:
[Xposed Framework Modules] itandy:
Incomplete directory scan

I previously reported that your module doesn't scan media files in the external storage completely when the Directories option is selected. I've just retried using the latest 1.3.3 but found the same problem. Xposed log is also provided so you can take a look. Below is the list of folders with .scanMedia files.

shell@C5503:/sdcard $ find -name .scanMedia
find -name .scanMedia
./DCIM/100ANDRO/.scanMedia
./Ringtones/.scanMedia
./Alarms/.scanMedia
./Pictures/.scanMedia
./media/.scanMedia
shell@C5503:/sdcard $ cd /sdcard1
cd /sdcard1
shell@C5503:/sdcard1 $ find -name .scanMedia
find -name .scanMedia
./MusicFolders/.scanMedia
./Pictures/.scanMedia
./video/.scanMedia
./DCIM/.scanMedia
[Xposed Framework Modules] thomashofmann:
Please turn on Xposed Logging and Android Logging in XMSO app and the provide both logs here.
[Xposed Framework Modules] thomashofmann:
Is /storage/emulated/0 the same as /sdcard and /storage/sdcard1 same as /sdcard1? And what is /storage/usbdisk? I am a bit confused. The log shows:

XMSO: scan is called for directories [/storage/emulated/0, /storage/sdcard1, /storage/usbdisk] on volume external
[Xposed Framework Modules] :
I am unable to provide an Android logcat, as my device is an MTK device (continuous and a large amounts of logcat logs, not feasible to take down everything, as most of them are just useless)

I am, however, able to provide a log from the Xposed framework, and it is attached.
[Xposed Framework Modules] thomashofmann:
Thanks for the log. However I am unable to figure out why it "stops" or does not continue in Android folder. What is in there? Is ist possible to make a backup and try without that folder?
[Xposed Framework Modules] :
Backup? I'm not using this module to backup anything.

The folder contains this:

Android

|-data

| |-com.android.gallery3d

| |-com.google.android.music

|-.nomedia

I don't think there's any media at all, I've also tried to block the scan using .nomedia, but it doesn't seem to want to block. Is it possible to specifically block system/data folders in the module?
[Xposed Framework Modules] thomashofmann:
No I meant backup that data and then remove the directory and test again.

Both dirs could contains a lot of media files of course so scanning could take its time. How long have you waited?
[Xposed Framework Modules] :
I have checked that there are no media files, and there are only small thumbnails in the gallery3d folder, and a .playmusicid file in the Google Play Music folder. It is probably created every bootup.
[Xposed Framework Modules] Spere:
So what are those thumbnails if not media?
[Xposed Framework Modules] :
They're some sort of compressed files or something, and cannot be opened as image files. Furthermore, there is already a .nomedia file, so the scanner shouldn't be scanning the folder.
[Xposed Framework Modules] :
Oh, I have removed that folder and now it's stuck on the folder data which only has a small xml file in it. It seems that the app itself doesn't scan sdcard1 for some reason (that's actually my internal storage)
[Xposed Framework Modules] thomashofmann:
That is strange. I wonder whether it works without the XMSO module. It could be stuck anywhere.
[Xposed Framework Modules] itandy:
Yes /storage/emulated/0 is /sdcard and /storage/sdcard1 is /sdcard1. /storage/usbdisk is the mount point when an external USB storage (e.g. flash drive) is inserted.
[Xposed Framework Modules] thomashofmann:
Version 1.3.4 uploaded

Version 1.3.4 uploaded.

The people having problems please turn on Xposed Log Debug and post the Xposed Log once more.
[Xposed Framework Modules] :
Well, I tried this module because my device is known for battery drain, and I think the mediascanner could be the main issue for that. It doesn't show in the battery stats though
[Xposed Framework Modules] itandy:
I've just tried again using the latest 1.3.4 with debug log as attached. Again only some of the media files are scanned successfully.

shell@C5503:/sdcard $ find -name .scanMedia
find -name .scanMedia
./DCIM/100ANDRO/.scanMedia
./Ringtones/.scanMedia
./Alarms/.scanMedia
./Pictures/.scanMedia
./media/.scanMedia
shell@C5503:/sdcard $ cd /sdcard1
cd /sdcard1
shell@C5503:/sdcard1 $ find -name .scanMedia
find -name .scanMedia
./MusicFolders/.scanMedia
./Pictures/.scanMedia
./video/.scanMedia
./DCIM/.scanMedia
[Xposed Framework Modules] thomashofmann:
Thanks I will investigate. I think it is caused by the Sony specific Media mounted event.
[Xposed Framework Modules] Droidphilev:
Hi,

regarding: "- Improved performance. By default XMSO will only look in top-level directories for .scanMedia files to decide which directories to scan (when restricting to certain directories). The "Performance" preference in XMSO settings app lets you change that to scan 2 levels deep in case you want to."

I use "directories" and "mediatypes". Now if i put .scanMedia in a toplevel folder and, let's say, .scanPictures in 2 of the 4 subfolders the other 2 folders will be completely ignored correct? (no marker files in them). This question is because i'm on 1.3 and i have a .scanMedia marker in every (sub)folder that needs to be scanned for the moment.
[Xposed Framework Modules] thomashofmann:
No it is different. The .scanMedia is there to tell the MediaScanner which directories to scan. If you were not using "directories" all directories would be scanned. If you add a .scanMedia file and enable "directories" it will only scan the directories were such a file exists AND its subdirectories. The subdirectories do not need any additional .scanMedia file. Subdirectories could have .noMedia files to exclude them -that is standard media scanner behavior. I think usually this won't be necessary. It is easy to structure the directory tree so that everything beneath a directory makes sense to be scanned.

Now, for the media type files: If you do not add a specific one all media types will be recognized and scanned. This is the same as if you would not enabled the "mediatyes" preference. You may add one or more of the mediatypes marker files: .scanPictures, .scanVideo, .scanMusic. These can be combined (e.g. if you want camera pictures and videos from a folder).

BUT if you have no marker file in a directory but one of the parent directories has one the ones from the parent directory (first found on the way up) will be used / in effect.

This way you actually do not need many marker files in most cases.

For example, I have a music dir on my external SD. It has .scanMedia and .scanMusic file. That is all. Every music file will be scanned in each (album) subdir and the album images will not be (because there is no .scanPictures).

Now, if I would like to see some of the album images I could add a .scanPictures in the subdirectory I wanted to have scanned for images also (which in fact does not need to be a leaf directory). So it is flexible without needed many marker file I think.
[Xposed Framework Modules] Droidphilev:
Hi,

Thanks for explaining the new way of working. I do have subfolders that need to be ignored. So the easiest way for me to goto the new version is: delete all .scanMedia in subfolders. Place a .scanMedia in the top folder and put a .noMedia in subfolders to be ignored.

I wasn't really aware of the fact that, with "mediatypes" enabled, everything in a folder is scanned when there's no marker file. Good to know ;)
[Xposed Framework Modules] bonny_k-9:
Here Xposed report
[Xposed Framework Modules] thomashofmann:
It is no new behavior in fact. The only thing I changed sometime around. 1.2 or so was that. scanMedia would also be found in non top level folders but it takes too much time so it's an option now with 1.3.4
[Xposed Framework Modules] thomashofmann:
Really can you give me an example?
[Xposed Framework Modules] Droidphilev:
Ok :)

I my folder called 'sounds' (all kinds of 'sounds' that is) i keep a folder with short notification tones that i don't really use. Other folders in "sounds" need to be scanned though.

I also have a folder called "graphics". In that folder there's a folder called wallpaper that needs to be scanned. The folder "icons" doesn't need to be scanned. It holds about 500 icons for use on navbars etc etc

Am i stupid? :)
[Xposed Framework Modules] thomashofmann:
No :)

I understand now. Please try whether or not .noMedia will be working for you. It should otherwise it is a bug.
[Xposed Framework Modules] Droidphilev:
At first sight it does seem to work without any problem. It seems it also scans for .noMedia from lowest to highest level. Also that works. I mean

Top folder: .scanMedia

- subfolderA: .noMedia

- subfolderB

- subfolderC

- subfolderD

B, C and D are ignored. Perfect.
[Xposed Framework Modules] Valiceemo:
This doesn't work on my device and causes android.processes.media to stop working.

Screenshot and log attached

Running CM11 snapshot M12 on LG D802
[Xposed Framework Modules] Dovidhalevi:
Will give this baby a try. Seems like a really useful idea!

Some of us will slog through the entire directory structure and add .scanMedia and .noMedia et al files, but as long as there is the module, it may as well have a UI to take care of it! Could have a directory tree as main pane with options shown on tapped folders, or start with a blacklist/whitelist scheme. A whole lot quicker to set up and need not be large or complicated.
[Xposed Framework Modules] thomashofmann:
Which version of XMSO is that.? You should not get this error as it has already been fixed.
[Xposed Framework Modules] Valiceemo:
Version 1.3.4 downloaded via the xposed installer.
[Xposed Framework Modules] sssmmt:
I'm getting the same error, android.media crashes on every boot up and when I plug an OTG drive. I'm on LG G2 D802, AOSP Mahdi 4.4.4 final. Using the latest experimental build (1.3.4)
[Xposed Framework Modules] Valiceemo:
I tried 'downgrading' to stable version 1.3 and still get the crash. I'd love to see a fix for this. Is the module being actively developed?
[Xposed Framework Modules] thomashofmann:
Yes it is. The problem is that there are differences between ROMs and these are problematic since the module touches internals. Providing both logcat and xposed log with debug option tuned on in xmso is the only way to have a chance of knowing what causes the FCs.
[Xposed Framework Modules] thomashofmann:
This does not look like a complete log. Did you remove something?
[Xposed Framework Modules] Valiceemo:
I'm not too familiar with logcats. I have downloaded a log cat app. Not sure how (or what) exactly to give you to help?

Not knowingly no.

I cleared the log then tried the media scanner. Saved the log and posted here?
[Xposed Framework Modules] thomashofmann:
Please do the following:

Start the XMSO settings app, set the following preferences:

Repetitive Scans: checked

Service Importance: checked

Thread Priority: checked

Directories: checked

Performance: unchecked

Media Types: checked

Run automatically: checked

Result Notifications: checked

Android Logging: checked

Xposed Log: checked

Xposed Log Debug Level: checked

Xposed Log Verbose Level: unchecked

Then go to Xposed Intaller Logs section and clear the log.

Now reboot the device.

After about 15 minutes go to Xposed Intaller Logs section get the log and post it here as file.

I will need to automate capturing logcat as this poses a problem for some users but this will take a while.
[Xposed Framework Modules] Valiceemo:
No problem. I'll post back in 20 minutes.
[Xposed Framework Modules] Valiceemo:
OK,

here is the xposed log file.

Looking forward to a fix
[Xposed Framework Modules] Dovidhalevi:
Notification Behavior:

When the media scanner runs at bootup, I get a notification "scanning sdcard0." After it concludes, I then have two notifications with illegible contents. Click on either brings a browser to paypal.

1. I would like useful information in the notification. And I only need one.

2. On conclusion, would want to see something like "# folders canned, # media files found, total time #.###" or such.

3. I will gladly contribute once I decide to continue using the program. With "default" operation, gives me nothing. As I suggested, some UI to set up beneficial options would make the module more valuable. Using most of the file managers out there would be exceedingly tedious and error-prone. Unless one has a humongous media collection or is experiencing spurious multiple scanner runs, the module will not gain much battery life without very detailed configuration if at all.

4. Paypal is not the ideal mechanism for contributions. Maybe install module and use Play for this. XGels dev TheKnut was through all this and switched to Play. Maybe contact him on this. One needs to track contributing users if only to avoid nagging them.
[Xposed Framework Modules] leonmorlando:
After first reboot with default settings, I am unable to see any files via MTP/USB connection to PC. Any way to fix this?
[Xposed Framework Modules] thomashofmann:
Thanks for your feedback. Let me explain:

1. Yes of course I want useful information too. You can expand the notification to see details. There are two because media scanner will scan "internal" (i.e. system partition) and "external" (all other like internal SD and if you have external SD) volumes. The internal one I might omit in the future as it is always very fast scanning internal volume.

2. Currently only time values are part of the expanded notification. It might be possible to have the other information you mentioned in the future.

3. Yes I agree some way to configure the directories and media types from withing the settings app would be good. I did not have time for this yet.

4. I understand what you are saying. I will consider Play but I think there is not any real nagging going on except for the default action on the notification maybe.

So thanks again.
[Xposed Framework Modules] thomashofmann:
Yes, this can happens on some ROMs, on others it does not. Currently if you need to see everything using MTP then I would advise you to not use the module. I will need to figure out how this can be improved for the ROMs that are affected.

You should at least see the files that were scanned (the once that appear in the Gallery for example).
[Xposed Framework Modules] Portovelo:
:(

dont trigger a scan wherever i want, in my motorola razr i rom stock jelly bean 4.1.2, just in the star

:confused::confused::confused::confused:
[Xposed Framework Modules] NeriL:
I'm still on sony stock GB rom and I can print documents (native on KK+), freeze apps (native on ICS+), use xposed framework backport (ICS+), use ADB via WiFi (native on CM roms).. Mediascanner is on all android versions, but this module is only compatible with JB+..

I don't understand developers

(If you are about to reply "buy a new phone", my answer is "I don't need a new phone, I want my actual phone to work better")
[Xposed Framework Modules] Portgas D. Ace:
Have a look :

http://www.xda-developers.com/android/android-platform-stats-dec-2014/

Most developers, who make their own apps will focus on the platforms which are mostly used on todays Android devices. With GB only running on less than 10% of devices, it is quite clear, why most developers focus on JB+ devices. Nevertheless, as fas as I know, for GB devices there is only an experimental version of xposed framework available. Thus most devs might say "why developing a module for a framework which might be buggy?". Just my two cents.
[Xposed Framework Modules] NeriL:
I'll try to make a short answer so we don't spam on this thread..

To make an app, developers need apis, and essential apis seem to exist on GB+..

Xposed backport isn't buggy! I'm using 11 modules and I'm having no bugs..

BTW, is there any other way to change media scanner behavior?

Sent from NeriL.device using NeriL.preferredApp
[Xposed Framework Modules] thomashofmann:
Yes APIs are needed and are more or less the same on all devices. When it comes down to changing things in the framework things are a little bit different because these APIs are not public and every vendor makes some changes. So it is already difficult to support as many as possible Kitkat devices.

Then, one needs to test the module on the device to make sure it works. For this a developer needs a device with the appropriate ROM. The media scanner hasn't changed much since Gingerbread so supporting Gingerbread would be possible but it is not on my priority list.
[Xposed Framework Modules] drsood:
Is there an intent/shortcut for triggering the 'trigger media scanner' for use with tasker?

Thanks
[Xposed Framework Modules] Portgas D. Ace:
+1
[Xposed Framework Modules] Zeuszoos:
Thomas, thank you for writing this mod! But pls allow me to explain why I'm not using it and to pls offer a humble suggestion.

Your mod offers more features/benefits than an app I found in Google Play. However, one thing it does that I really like and which makes my life easier and saves scanning time (it doesn't have to scan all storage looking for a file to see if it should scan each folder or not), is that in its settings, it lets you specify ("Add" button, then browse and select folder) which folders to scan, by selecting and saving within the app which folders to scan.

This way, it doesn't even bother looking at any other folders and no "scan" files are necessary within those folders.

But I have to run it manually every time and it doesn't have any of the other way cool features that yours has.

Would you consider doing something like that in yours, please?

I am not a programmer by any means, so please forgive my ignorance. It just seemed to me like that would be the best of both in the same, one (yours) app.

Or is my complete ignorance now totally obvious? :)
[Xposed Framework Modules] Dovidhalevi:
Something else that might be done:

A calibrate function -- this would do a total scan, picking up which directories have media files and which do not. This information would be saved (appropriate .hasMedia, .noMeida placed) and would regulate future scans.

This information might optionally be picked up from current mediastore.
[Xposed Framework Modules] Valiceemo:
+1

---------- Post added at 16:06 ---------- Previous post was at 16:04 ----------

So I've switched roms away from CM11 and have now installed this module again. And to be honest I'm not sure if it is working correct?

When I boot I get 2 notifications? Is this correct?

And the time it says is 00:01...? Really?

And if I change some files on my sdcard the changes aren't reflected in the gallery app for example?

CloudyG3 rom
[Xposed Framework Modules] thomashofmann:
The one second scan time probably is for the internal volume. Expand the second notification to see the time for the external volume. What do you mean by changing some files and changes not being reflected?
[Xposed Framework Modules] NeriL:
I'll just wait.. If sometime you decide to backport this module, I would be glad to help!

Is there any other way to manually change Media Scanner behaviour? I've googled it but I can't find it

Thanks for your reply! =)
[Xposed Framework Modules] Valiceemo:
If I delete some photos using a file explorer they still appear in my gallery app.
[Xposed Framework Modules] leolawliet:
Asking for donations too obtrusively, right in my notifications..
[Xposed Framework Modules] thomashofmann:
If you configured XMSO to not scan that folder and you did not delete the old media contents this would be the result. If a folder is not scanned deletions won't be reflected. If the old content is still in the media store it will still show in Gallery. Maybe you can explain in more detail how you configured scanning behavior?
[Xposed Framework Modules] Droidphilev:
Ok, i understand that .scanmedia can be used together with, for example, .scanvideo inside the same directory. Thanks for the help.
[Xposed Framework Modules] Gamer-king:
+1
[Xposed Framework Modules] 089man:
+1

I9100 Tapatalk 4, Spirit-Rom 4.4. 4
[Xposed Framework Modules] thomashofmann:
Since repo is down I uploaded to OP.
[Xposed Framework Modules] stiggerby:
Same here, error 404 everywhere
[Xposed Framework Modules] IceXcube84:
Thank you so much :)
[Xposed Framework Modules] GermainZ:
http://xdaforums.com/showpost.php?p=56794649&postcount=2
[Xposed Framework Modules] Publiuss:
Hi

This module is a quite neat idea!

But I have issues, looks like it does not work :(

Logs following.

Loaded preferences for com.thomashofmann.xposed.mediascanneroptimizer: {pref_prevent_repetetive_scans_state=true, pref_run_media_scanner_as_foreground_service_state=true, pref_restrict_directories_to_scan_state=false, pref_log_to_xposed_log_state=true, pref_show_results_state=true, pref_logging_enabled_state=false, pref_restrict_to_certain_media_types_state=false, pref_run_media_scanner_with_background_thread_priority_state=true}
init Logger with tag XMSO
...
XMSO: Going to hook application com.android.providers.media in PID 1.263
XMSO: Setting up hook to capture first Context from init method
XMSO: Hooking android.app.ContextImpl#init
XMSO: Trying to hook method init for superclass class android.content.Context
XMSO: Trying to hook method init for superclass class java.lang.Object
java.lang.NoSuchMethodError: init
at com.thomashofmann.xposed.lib.XposedModule.findAndHookMethodInClassHierarchy(XposedModule.java:283)
at com.thomashofmann.xposed.lib.XposedModule.findAndHookMethodInClassHierarchy(XposedModule.java:279)
at com.thomashofmann.xposed.lib.XposedModule.findAndHookMethodInClassHierarchy(XposedModule.java:279)
at com.thomashofmann.xposed.lib.XposedModule.hookMethod(XposedModule.java:262)
at com.thomashofmann.xposed.lib.XposedModule.hookFirstContextImplInit(XposedModule.java:228)
at com.thomashofmann.xposed.lib.XposedModule.captureApplicationContext(XposedModule.java:185)
at com.thomashofmann.xposed.lib.XposedModule.handleLoadPackage(XposedModule.java:334)
at de.robv.android.xposed.IXposedHookLoadPackage$Wrapper.handleLoadPackage(IXposedHookLoadPackage.java:20)
at de.robv.android.xposed.callbacks.XC_LoadPackage.call(XC_LoadPackage.java:34)
at de.robv.android.xposed.callbacks.XCallback.callAll(XCallback.java:70)
at de.robv.android.xposed.XposedBridge$1.beforeHookedMethod(XposedBridge.java:208)
at de.robv.android.xposed.XposedBridge.handleHookedMethod(XposedBridge.java:611)
at android.app.ActivityThread.handleBindApplication(Native Method)
at android.app.ActivityThread.access$1500(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1265)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5158)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:732)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:566)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:132)
at dalvik.system.NativeStart.main(Native Method)

SGS2+ Spirit Rom 4.4.4
[Xposed Framework Modules] thomashofmann:
Yes that is a problem, could you please tell me what version of Android you are using exactly. Just for your information I am on Android 4.4.2 Samsung S4.
[Xposed Framework Modules] Publiuss:
Hi

I edited the post later...

I'm on 4.4.4, (Spirit is a CM-like Rom).