Nextcloud-notes: Note content disappears on screen rotate.

Created on 28 Nov 2017  Â·  23Comments  Â·  Source: stefan-niedermann/nextcloud-notes

Hi,

As I mentioned in the title when I open a note when the phone is in portrait mode and rotate the phone to landscape the content disappears. The notes app is set to open the note in view mode by default, but I think it also happens in edit mode too, because I lost the content of a note and I think it was cased by this issue.

It's easy to reproduce:

  • put the phone in portrait mode
  • open a note
  • rotate the phone in landscape mode

As a simple fix, for me, it's enough to simply force the orientation to portrait by adding:
android:screenOrientation="portrait"

Thanks,
kukukk

Bug

Most helpful comment

Since it can cause data loss I think it can be considered quite a critical bug which should be addressed as soon as possible. Just my two cents...

All 23 comments

Yeah, this is a bad bug. Lost an important note to this. Can reproduce every time.

Protip: If this happens and your note disappears, select Cancel from the triple-dot dropdown menu to not have it save a blank note.

Yeah, this problem is a note killer. Debating just leaving my phone in portrait only mode.

Thanks for the tip @anoadragon453

Note that you can recover your note in Notes folder, by recovering an older file version (if your cloud installation versions files; it does by default). I also think (not sure now) you can Cancel note editing immediately after that happens to recover previous state. But it's really critical bug, this shouldn't happen for such app. :)

That's indeed a critical bug! Please give more details on how to reproduce this. This problem didn't happened for me, yet (I'm using the app on multiple devices).

  • does this happen always when rotating or is there a special situation required?
  • which Android app version do you use?
  • where did you installed this version?
  • which mobile device do you use?
  • which Android version runs on the device?
  • can you use LogCat (from Android SDK) in order to look for any interesting logs?
  • can you build and install the latest developer version from Git?
  • are there any other remarkable things?

It would be nice, if everybody who experiences this bug could post the individual answers. Maybe we can find some commons in order to find the bug's source and fix it.

Hi,

  • does this happen always when rotating or is there a special situation required?
    For me it always happens. To be sure I tried it again:

    • create a new notes
    • go back to notes list
    • wait to synchronise
    • open note
    • rotate the screen
    • the content disapppears
  • which Android app version do you use?
    v0.12.1

  • where did you installed this version?
    I think I installed it from FDroid

  • which mobile device do you use?
    Sony Xperia XZ1 Compact

  • which Android version runs on the device?
    Android 8.0.0, security patch level January 1, 2018

  • can you use LogCat (from Android SDK) in order to look for any interesting logs?
    I have AndroidStudio, so if you can't reproduce the bug I can try to have a look in logs.

  • can you build and install the latest developer version from Git?
    If you reeaaally can't reproduce the bug I can build and install the latest version :}

  • are there any other remarkable things?
    Nothing else.

Here is what I see in LogCat regarding to EditNoteActivity

02-01 20:28:18.264 29041-29041/? D/EditNoteActivity: Starting from Intent

02-01 20:28:18.278 1593-9918/? I/InputDispatcher: Focus entered window: Window{8df4680 u0 it.niedermann.owncloud.notes/it.niedermann.owncloud.notes.android.activity.EditNoteActivity}

02-01 20:28:18.300 1593-1662/? I/ActivityManager: Displayed it.niedermann.owncloud.notes/.android.activity.EditNoteActivity: +40ms

02-01 20:28:18.469 1593-1662/? I/Timeline: Timeline: Activity_windows_visible id: ActivityRecord{96e0b67 u0 it.niedermann.owncloud.notes/.android.activity.EditNoteActivity t4388} time:93172754 diff:205 start:lukewarm|top-activity batt:33|2 mw:off|1 mem:1509460|0|61|4|25 cpu:[1900800, 1900800, 1900800, 1900800, 2361600, 2361600, 2361600, 2361600]

02-01 20:28:21.602 29041-29041/? D/EditNoteActivity: Starting from SavedState

02-01 20:28:21.621 1593-3211/? I/InputDispatcher: Focus entered window: Window{ccf6598 u0 it.niedermann.owncloud.notes/it.niedermann.owncloud.notes.android.activity.EditNoteActivity}

I think the problem appears when "EditNoteActivity: Starting from SavedState". Probably the state is not properly saved. Maybe you should reload the whole notes from the database?

I have the same issue. Rotating from portrait to landscape while in edit mode caused contents of a note to disappear, and the entire file was replaced by the generic "New Note" title. Had to go into my backup system to recover. I've set the "Display mode for notes" to preview only for now as a workaround, reminds me to turn off auto rotate before editing.

App version 0.12.1 from Google Play Store.

Phone is a Pixel XL, stock Android 8.1.0 (Jan 5 security).

Building from latest git source and logcat... Would take time to set up for me. Let me know if truly needed.

Looks like this is an issue with Android 8 (Oreo). Does anyone has this issue on an earlier Android version?

Not able to reproduce on Android 7.1.2, but getting it on Android 8.1.0.

I can reproduce this (critical!) bug in the emulator using the image for API 26. However, currently I have only very limited time to investigate it. Does anybody knows about a change in Android 8.0 regarding saving the instance state of an activity or fragment? Maybe @stefan-niedermann or @dan0xii ?

Nothing heard about that. Providing 20,- € bounty for fix.

Maybe this diagram is helpful, it shows clearly, that the crash rate of the app increases starting with Android 8.1.0, so maybe 8.0.0 was not even affected? I assume the increase is caused by this bug because i have got several notifications (mostly via e-mail but also via github) about this issue.

grafik

Hmmm. I tried to reproduce this again, and now I found the following:

  • app version 0.12.1 on real device with Android 7.1: the problem doesn't appear.
  • app version 0.12.1 on Emulator with Android 8.0: the problem appears reproducibly.
  • app from current git master on emulator with Android 8.0: the problem doesn't appear.

I think I fixed that bug already with #299 (which was a big re-work of the edit note activity). In order to approve this theory, somebody with this problem on a real device should install the current developer version from git. Any volunteers? :smiley:

@stefan-niedermann The statistic is interesting. But maybe, there are other problems introduced with Android 8.1. This bug definitely happens already on Android 8.0.

I volunteer.
I have to mention that in the last few years I have not actively developed Android applications, so I may not succeed. But I will try.

Great! :smile:
Just install Android Studio (or update if already installed), clone this repository, connect you mobile phone, and press "run" in order to build and install the app on your device.

Sorry for the delay, but I was out for lunch :}

I can confirm that the problem is gone with the current git master. I tested it on 2 devices:

  • Sony Xperia XZ1 Compact running Android 8.0.0 (the one on which I encountered the problem)
  • Nexus 6P running Android 8.1.0

P.S.
Hmm... I found an another problem :} On my XZ1 Compact I'm not able to put on the screen the Note list widget. I can drag to the screen, select the location on the screen, but when I release it it just disappears. But it works on the Nexus 6P. The Single note widget works (on both).

P.P.S
I sent a new bug report about the Note list widget problem and I included the description how to fix it.

Thanks for testing!

@stefan-niedermann we need a new release (maybe after fixing #321) ;-)

@stefan-niedermann fixed some issues ... please release, soon 😆

Hello,

I have this bug also.

I write a note, let it save and then open it again. When the screen rotate I have an blank note.

My device:

Xperia XZ1
Android 8.0.0
note version 0.12.1
Nextcloud 12.05 and 13.0.0 RC4

@stefan-niedermann we need a new release (maybe after fixing #321) ;-)

321 should be fixed with #322, right? Well, i think we can make a new release, or does someone see a bug that should be fixed before?

321 should be fixed with #322, right?

yes

Well, i think we can make a new release, or does someone see a bug that should be fixed before?

Not necessarily. However, I appreciate it if someone else has time to fix some open issues 😉

Since it can cause data loss I think it can be considered quite a critical bug which should be addressed as soon as possible. Just my two cents...

App version 0.13.1 is now available on F-Droid. Since this version should fix this issue, I'm closing the issue. If somebody has still problems, please open a new issue for that.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pejakm picture pejakm  Â·  9Comments

chorus12 picture chorus12  Â·  8Comments

gsantner picture gsantner  Â·  9Comments

maenujem picture maenujem  Â·  7Comments

awolfman picture awolfman  Â·  6Comments