Join now - be part of our community!

Inotify and epoll mechanisms are partially broken

SOLVED
vaervo
Visitor

Inotify and epoll mechanisms are partially broken

Hello!

We’ve encountered a problem that is specific to Sony devices, when we have tested our products on Android OS 7.

Confirmed affected device: Sony Xperia Z5 Premium Dual E6883 (Android 7.1.1)

Problem description:
Inotify and epoll mechanisms are partially broken. No notifications appears when files on external sdcard are created/changed by pre-installed applications and also adb.
The android.os.FileObserver java class that is based on inotify mechanism does not receive notifications for changes that were done by pre-installed applications also

Sample that demonstrates an issue included below.

Steps to reproduce
1. Change folder address in MainActivity.java to address of your external sdcard
2. Compile, install and launch sample app
3. Open pre-installed browser
4. Download any file 
5. Copy downloaded file to the external sdcard and check that FileObserver onEvent callback is NOT called

We can also confirm that “stock” Android devices and / or Android OS system images of corresponding build versions (7.0.0, 7.1.0, 7.1.1) are not affected by this issue.
Many of them was re-checked by our R&D department testing team via emulator or directly on Google Nexus devices.

mObserver = new FileObserver(/*path to external sdcard*/) {
            @Override
            public void onEvent(int event, String path) {

                final int thisEvent = event;

                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        Toast.makeText(getApplicationContext(), String.format("%d", thisEvent), Toast.LENGTH_SHORT).show();
                    }
                });
                Log.i("ABC", String.format("%d, %s", event, path));
            }
        };

        mObserver.startWatching()  
1 ACCEPTED SOLUTION
2 REPLIES 2
profile.country.GB.title
Uliwooly
Expert