-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Camera Uploads] Sync/Upload for older file, which waits for WiFi too #2679
Conversation
Btw, I've seen sometime a lot of
In my point of view this complete class can be removed because with Android O implicit Intents are no more working. In my tests I never run into this |
Hi @hannesa2 , thanks for this contribution, we will have a look at it.
Are you sure? Implicit intents are widely used to invoke other apps on the device able to perform actions when our app is not able to perform them, I can still use them even in Android 10, e.g. opening a text editor from a file browser. Anyway, we will recheck what |
Switch off/on Wifi and look for |
Sorry. Is there any Play Store beta program I can join to test this fix? |
I'm not sure if owncloud has something like this. At least I see no branch/tag upload mechanism doing it. That's why I made my own "pre-deployment" with a deterministic build. Owncloud has no such deterministic build. If you are interested here it is https://github.com/hannesa2/owncloud-android/releases |
Thanks for pointing me to the apk. I've downloaded and installed it (I had to uninstall play store apk first), but I can't pass login page... After introducing my owncloud url and credentials, app crashes and any further try to open it crashes directly. Any idea? Can I install debug apk and provide you any log? |
ownCloud Android app is suscribed to the beta program of App Store. Right now, we do not have an active beta (latest release is an official one). If you are interested in beta testing, please suscribe the beta program of Google Play, and you will be notified in he moment we release a new one. |
I started to handle this, and some questions about the problem come to my head:
Does your fix make the pending stuff to be retried? @hannesa2 |
720ec29
to
221d246
Compare
@jesmrec all right ! |
I can confirm I'm using @hannesa2 release with no further issues. All my files are being uploaded, with only wifi checked. Well, I must say something weird happens when owncloud is uploading a file and you lose wifi... but I assume it should be treated as a separate issue. |
ok, we will move it forward in terms of code review & QA (CC @abelgardep @davigonz)
yes, please. Create a new issue including as many details as posible. Thanks a lot!! |
I will do as soon as I have those details. I must see if I can replicate it each time, or it happens only sometimes. |
@pequesan you should see the reason here #2440 (comment) |
Thanks. But I haven't been able to reproduce the issue... I tried with some files, but rock solid at the moment, which is good news. :) I'm running Owncloud hannesa2 apk in both my wife and my Google Pixel at home, so I'll be able to catch the problem, if any. |
Sorry to use this issue to ask this but... Where should I add a feature request? I'm not familiar with Github, sorry. |
@pequesan What's about to simply create an issue ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
``
@@ -290,8 +289,7 @@ public int onStartCommand(Intent intent, int flags, int startId) { | |||
KEY_REQUESTED_FROM_WIFI_BACK_EVENT, false | |||
); | |||
|
|||
if ((isCameraUploadFile || isAvailableOfflineFile || isRequestedFromWifiBackEvent) && | |||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { | |||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check was included to fix a problem with notifications here: #2453 (comment) . But if everything is working, we can move this forward @jesmrec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we'd remove that line, the problem you mention will arise again, causing a regression. We must avoid this. CC @hannesa2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@abelgardep , @jesmrec This if block is just to
startForeground(141, mNotificationBuilder.build());
nothing else. And because of this if condition it was crashing. This startForeground()
needs nothing else
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We were checking isCameraUploadFile || isAvailableOfflineFile || isRequestedFromWifiBackEvent
conditions to execute startForeground(141, mNotificationBuilder.build())
because it needs to be called within five seconds after calling startForegroundService
from TransferRequester for those cases (cameraUploads, available offline and requestdFromWifiBackEvent), otherwise, the app will crash.
But you're also right, we should call startForeground()
after calling startService() from TransferRequester to make FileUploader service run in foreground. Otherwise, the app could fail if the system decides to kill FileUploader (it does not usually happen though). Could you tell me in which scenario is the previous code crashing for you?
What really concerns me most is the duplicated notification that appears when trying your solution, and we had to fix it in #2453 (comment) . Besides, we are also able to show a notification even when calling startService()
in a normal upload. It seems that many changes have happened here in the Android code itself.
Could you have a look at the problem with duplicated notifications that seems to happen when applying your changes? Thanks
Well, FYI I'm running @hannesa2 apk with this fix, and I would say that I don't have double notifications. But It's true that from Android 9, notification system has changed a lot. I'm using Android 10 in a Pixel 4. |
Like @pequesan already wrote, I never observed a double notification too. @davigonz Summarize: @davigonz |
Ok, you talked about those crashes before and I asked you the steps to reproduce, could you give me those steps? Thanks
I've just tried this PR code and reproduced the double notification in a Google Pixel 2 with Android 10
The problem with notifications is something that appears with your solution (this PR), I tried it in master and there's no additional notification. As we usually do with the rest of contributions and even with our own PRs, if something is broken, it should be fixed by the developer who included the new code. Otherwise, all the developers would have to finish the code developed by other people. Anyway, I can help you if there's any blocker. |
[FIXED] Double notification when uploading a file
Current: two notifications for uploads Pixel 2 Android 10 |
Since the double notification and the lost uploads are different features, we should keep the checks
in order to avoid regressions, and testing separately both things: this PR for the camera upload stuff, and the other thing, wherever you want (new issue or PR). Agreed? @abelgardep @davigonz @hannesa2 |
@jesmrec Sorry, it will crash, when we keep these if conditions #2679 (comment) |
@hannesa2 steps to reproduce the crash? android version? |
I've been diving in the uploads and camera uploads code and it seems there was a case missing in FileUploader.java for scheduling automatic retries for uploads that should wait for wifi to be uploaded when the user selects Only wifi. We were only scheduling automatic retries for uploads that were already launched and failed because lack of wifi connection, which is not the same. I've just pushed a commit with that missing case so we don't need to retry all the failed uploads from The automatic retries of failed uploads are handled by RetryUploadJobService.java but only work for Lollipop devices or above, the same task is handled by @jesmrec this is ready to QA, can you please recheck if everything work as expected and see if the crashes that @hannesa2 says appear? I'm not able to reproduce any crash with the latest changes I pushed |
I see, I've to make a complete report for each detected crash. Reintroduce --> You will see probable a crash because of missing foreground-something |
thanks @hannesa2. This is the same when you go to the doctor... telling him "i feel bad" is not enough. He needs to know where does it hurt ;) |
QA. Catching events of wifi connection to upload from the camera:
|
(2)Look at these steps:
Current: pending uploads are not retried till you open the uploads view and retry them manually. Huawei P20Lite & Xiaomi MiA2 |
I also notice ANR events when camera uploads take some time (not when only one upload is done). This is also reproducible in 2.13.1, so i will open a new issue with this -> #2724 |
About report (2): i noticed different behaviours in different devices, so it needs more info and research. Since this problem is not a new one (no regression), i will open in a new issue as soon as i gather more info about it. In the same path, i will open an issue with #2679 (comment) if i reproduce it. But this PR fixes at least the retry problem under "only wifi". So, we can move forward. |
159ebc4
to
6b516b3
Compare
Does this "merge" means that next official release will address this delayed wifi upload issue? Did you manage to fix it while not reintroducing the double notification glitch? |
@pequesan Yes to both questions |
That's great! Thx |
During sync, only newer files are handled, but files which were not uploaded because of missing and required WiFi are postponed currently for ever.
My mobile becomes wet and I missed a lot of pictures from the last year, because of this bug. 👎
I hope this bugfix is working like expected, please give it a try. At least my tests were positive
BUGS & IMPROVEMENTS: