Skip to content

Conversation

@JorisBodin
Copy link
Member

@JorisBodin JorisBodin commented Jan 16, 2020

After talking with @tobiasKaminsky, we've decided to remove this finish()
Because "onResume" is called after requestPermissionsResult for PERMISSIONS_WRITE_EXTERNAL_STORAGE

#5213

@nextcloud-android-bot
Copy link
Collaborator

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/12311.apk

qrcode

To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.

@nextcloud-android-bot
Copy link
Collaborator

Codacy

340

Lint

TypemasterPR
Warnings7676
Errors00

SpotBugs (new)

Warning TypeNumber
Bad practice Warnings26
Correctness Warnings71
Internationalization Warnings13
Malicious code vulnerability Warnings5
Multithreaded correctness Warnings9
Performance Warnings107
Security Warnings44
Dodgy code Warnings138
Total413

SpotBugs (master)

Warning TypeNumber
Bad practice Warnings26
Correctness Warnings71
Internationalization Warnings13
Malicious code vulnerability Warnings5
Multithreaded correctness Warnings9
Performance Warnings107
Security Warnings44
Dodgy code Warnings138
Total413

@codecov
Copy link

codecov bot commented Jan 16, 2020

Codecov Report

Merging #5218 into master will increase coverage by 0.02%.
The diff coverage is n/a.

@@             Coverage Diff              @@
##             master    #5218      +/-   ##
============================================
+ Coverage     17.69%   17.71%   +0.02%     
  Complexity        3        3              
============================================
  Files           392      392              
  Lines         33140    33138       -2     
  Branches       4656     4655       -1     
============================================
+ Hits           5864     5872       +8     
+ Misses        26319    26308      -11     
- Partials        957      958       +1
Impacted Files Coverage Δ Complexity Δ
...com/owncloud/android/ui/activity/BaseActivity.java 38.46% <ø> (+0.82%) 0 <0> (ø) ⬇️
.../third_parties/daveKoeller/AlphanumComparator.java 80.95% <0%> (-1.2%) 0% <0%> (ø)
...ncloud/android/ui/fragment/OCFileListFragment.java 24.9% <0%> (-0.4%) 0% <0%> (ø)
...oud/android/ui/activity/SyncedFoldersActivity.java 26.81% <0%> (+0.5%) 0% <0%> (ø) ⬇️
...loud/android/datamodel/ThumbnailsCacheManager.java 32.84% <0%> (+0.54%) 0% <0%> (ø) ⬇️
.../java/com/owncloud/android/utils/DisplayUtils.java 25.73% <0%> (+0.84%) 0% <0%> (ø) ⬇️
...om/owncloud/android/utils/FileSortOrderByName.java 17.14% <0%> (+2.85%) 0% <0%> (ø) ⬇️
...ain/java/com/owncloud/android/ui/TextDrawable.java 81.48% <0%> (+7.4%) 0% <0%> (ø) ⬇️
...d/android/operations/GetCapabilitiesOperation.java 87.5% <0%> (+12.5%) 0% <0%> (ø) ⬇️
...m/nextcloud/client/account/UserAccountManager.java 33.33% <0%> (+33.33%) 0% <0%> (ø) ⬇️

@ezaquarii
Copy link
Collaborator

ezaquarii commented Jan 16, 2020

I tested account creation and login and I see no problem described in #5031 (comment). This is good, but it could as well be a race condition.

Please test the following scenarios:

  1. login
  2. adding new account

In both cases application should not display empty file list.

@mario
Copy link
Contributor

mario commented Jan 17, 2020

This is actually how it is for every permission request - the thing is that when you request permissions via requestPermissions the activity is paused. After answering, onResume gets called (again).

@mario
Copy link
Contributor

mario commented Jan 17, 2020

So, to summarize: I'd suggest setting up all the views and everything and then ask for permissions.

@JorisBodin
Copy link
Member Author

I tested login and adding new account. I have note empty files.

With finish()
withfinish

Wihout finish()
wihoutFinish

@JorisBodin
Copy link
Member Author

I encountered the problem without the finish. I had the request for authorization to write toi storage file on the login activity. So the activity that lists the files is launched while we are on that of login. Here is the problem. I'm watching this next week.

@ezaquarii
Copy link
Collaborator

That doesn't seem right given that:

  1. this code path is hit only when there is no user
  2. without user you can't instantiate storage manager to access files

@JorisBodin JorisBodin changed the title Fix #5213 Fix #5213 app is excluded from recent/current apps Jan 20, 2020
@tobiasKaminsky
Copy link
Member

Hm.
This permission is not needed, if you

  • have new installation
  • login for very first time
  • browse files
  • download file

It is only needed, if you want to upload a file from external storage, eg. external sdcard.
So we maybe should delay this permission question to the point we open up "+" and select "upload files"?

@JorisBodin
Copy link
Member Author

JorisBodin commented Jan 22, 2020

That doesn't seem right given that:

  1. this code path is hit only when there is no user
  2. without user you can't instantiate storage manager to access files

Screenshot_1579688132

Just to let you know it can happen when the app is launched.

@tobiasKaminsky @ezaquarii
This finish prevents the execution of FileDisplayActivity. Otherwise we have requestWriteExternalStoreagePermission, which is called line 313.

And that's why the file list is not refreshed after the first login.

@JorisBodin
Copy link
Member Author

@ezaquarii
The problem is explained in more detail here: #4993

I think that adding this finish is not necessary (especially because it generates a bug). It is better to fix the problem at source, as described in this issue #4993

@tobiasKaminsky
Copy link
Member

@ezaquarii this bug prevents user from switching during login to another app, e.g. for generating one-time password.

As the only drawback right now might be that we get an empty list on first start, I am fine with this.

@JorisBodin can you then remove the accountHandling boolean es we this then do not need it.

How to proceed, we should discuss in #4993

@JorisBodin
Copy link
Member Author

@tobiasKaminsky if remove enableAccountHandling in baseActivity, accountManager.getCurrentAccount() is called.
So we go directly to the login view.

untitled

But it will have to be removed during the big correction of #4993

@tobiasKaminsky
Copy link
Member

ah true.
Then let us keep it for now and do it right with #4993.

@JorisBodin
Copy link
Member Author

@tobiasKaminsky So, do we merge it or do we close this MR?

@tobiasKaminsky
Copy link
Member

/backport to stable-3.10

@backportbot-nextcloud
Copy link

backport to stable-3.10 in #5324

tobiasKaminsky added a commit that referenced this pull request Jan 28, 2020
55c1a89 Merge pull request #5321 from nextcloud/dependabot/gradle/org.powermock-powermock-core-2.0.5
6fbf451 Merge pull request #5320 from nextcloud/dependabot/gradle/org.powermock-powermock-api-mockito2-2.0.5
c0991da Bump powermock-core from 2.0.4 to 2.0.5
a1f489a Bump powermock-api-mockito2 from 2.0.4 to 2.0.5
dd5c604 Merge pull request #5322 from nextcloud/dependabot/gradle/org.powermock-powermock-module-junit4-2.0.5
b53c96c Merge pull request #5218 from nextcloud/fix_multitask
fc68892 [tx-robot] updated from transifex
b0003f0 Bump powermock-module-junit4 from 2.0.4 to 2.0.5
a5acbbf [tx-robot] updated from transifex
01ba3be daily dev 20200125
tobiasKaminsky added a commit that referenced this pull request Jan 30, 2020
55c1a89 Merge pull request #5321 from nextcloud/dependabot/gradle/org.powermock-powermock-core-2.0.5
6fbf451 Merge pull request #5320 from nextcloud/dependabot/gradle/org.powermock-powermock-api-mockito2-2.0.5
c0991da Bump powermock-core from 2.0.4 to 2.0.5
a1f489a Bump powermock-api-mockito2 from 2.0.4 to 2.0.5
dd5c604 Merge pull request #5322 from nextcloud/dependabot/gradle/org.powermock-powermock-module-junit4-2.0.5
b53c96c Merge pull request #5218 from nextcloud/fix_multitask
fc68892 [tx-robot] updated from transifex
b0003f0 Bump powermock-module-junit4 from 2.0.4 to 2.0.5
a5acbbf [tx-robot] updated from transifex
01ba3be daily dev 20200125
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants