Skip to content
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

App is laggy #125

Closed
pedrom34 opened this issue Jun 3, 2019 · 24 comments
Closed

App is laggy #125

pedrom34 opened this issue Jun 3, 2019 · 24 comments
Labels
bug A bug report

Comments

@pedrom34
Copy link

pedrom34 commented Jun 3, 2019

Hi,

Since I added a new 2FA code (17 in total), Aegis became very laggy... Scrolling, pressing on the three dots menu. When in settings or before unlocking the vault, everything is smooth, but when on the main screen, everything is lagging. I suspect it's related to the remaining time bar.
I don't really know if I'm clear, and I don't know how to show you this issue...

My device is a Lenovo MotoG5 Plus running Android 8.1.0 (1st of february for security updates).

@alexbakker
Copy link
Member

alexbakker commented Jun 3, 2019

Thanks for the report. I hadn't noticed this yet because I always use the compact view mode, but it looks like I experience a bit of lag with the normal view mode as well. I'll do some profiling.

@pedrom34
Copy link
Author

pedrom34 commented Jun 3, 2019

I'm in compact mode 😄

@michaelschattgen
Copy link
Member

Do you by any chance have custom images on your accounts? Do all the tokens have the same refresh time (eg. default 30 seconds)?

@pedrom34
Copy link
Author

pedrom34 commented Jun 3, 2019

Yes to both questions. I have a custom image for every account.

@pedrom34
Copy link
Author

pedrom34 commented Jun 3, 2019

I just tested without the custom images. It's smooth again 😞

But I like my custom images 😢

@michaelschattgen
Copy link
Member

Haha we understand! We will definitely fix this as soon as possible, thanks for your report.

@alexbakker
Copy link
Member

The lag I perceived appears to be caused by the margin hack we have to separate entries. If I remove it, the entry is list butter smooth for me, even with a bunch of icons.

android:layout_marginTop="20dp"

This still doesn't explain the lag you're experiencing with the rest of the activity though (like the menu in the action bar). I have not been able to reproduce that yet.

@michaelschattgen
Copy link
Member

michaelschattgen commented Jun 5, 2019

@pedrom34 do you have any accessibility services running on your phone? I've noticed that apps that are running as accessibility service drastically decrease the frame rate of your phone. Can you try to enable screen security in Aegis? This will prevent apps with accessibility services from accessing the content of Aegis which will hopefully increase the frame rate again.

Please let us know.

@pedrom34
Copy link
Author

pedrom34 commented Jun 6, 2019

@michaelschattgen Yes, I have some accessibility services (tasker for instance). But screen security was activated all along 😞

@alexbakker will it help you if I make a video of the lag I'm experiencing with another camera? I mean, recording my phone with it.

@michaelschattgen
Copy link
Member

Hmm we are doing our best to reproduce it but that seems to be quite difficult. Is it always this laggy or just sometimes? What are the accessibility services you have running?

If it isn't too much trouble, we would like to have a recording of it, yes.

If you don't like to answer this in public here on GitHub. You can always mail us at beemdevelopment@gmail.com.

@pedrom34
Copy link
Author

pedrom34 commented Jun 6, 2019

1/ It is always this laggy. It appeared to me when adding a new site, but I added custom icons at the same time.
2/ I checked the accessibility services running. I have Bouncer, Greenify, KP2A AutofillPlugin, Nova Launcher, Tasker. Only Bouncer, Greenify and KP2A are activated.

3/ I'll send you the video as soon as I get home.

@chiraag-nataraj
Copy link

@michaelschattgen I'm attempting to send you a recording right now. I have over 30 accounts, so I definitely see some lagging.

@pedrom34
Copy link
Author

pedrom34 commented Jun 6, 2019

I just sent you the video 😄

@rmunozrodriguez
Copy link

I also notice this lag, with or without images. I've 20 accounts added.

@alexbakker
Copy link
Member

@pedrom34 Thanks for the video. That's some pretty bizarre behavior. Scrolling lags, the progress bar lags, the menu lags and yet somehow moving entries is butter smooth.

If I turn on "Show surface updates" in developer options, my screen constantly flashes while on the entry list screen. Something is causing constant redraws of the entire surface of the app. It's very likely that this is the main cause of the lag you're experiencing. I'll investigate further tonight.

On a related note, @michaelschattgen also has a patch in the works that optimizes the use of bitmaps a bit, so that should also improve performance.

@michaelschattgen
Copy link
Member

@chiraag-nataraj we want to thank you as well for the video you've sent us. We think this lag is unacceptable and should be fixed as soon as possible.

@alexbakker I'm not sure the constant redraws are causing the lag we are dealing with. I've used similar apps with a timers/progressbars like Authy, Google Authenticator and even Instagram Stories (which has the same type of progressbar like ours). All these apps are making the screen flash in the same way Aegis does, although Aegis seems just a bit faster. We can debug this without the progressbar first, I don't think screen redraws should occur that way.

@onmyouji
Copy link

onmyouji commented Jun 7, 2019

Not sure if it's related, but on my phone the app is smooth the first time you open it. It only becomes laggy when you re-login to the app after hitting back.

I can reproduce it on my phone like this:

  1. Open Aegis app, type your password and login. App doesn't experience any lag.
  2. Hit back button on your phone, the app return to password prompt.
  3. Type your password. After you hit Unlock, "Unlocking the vault" loading animation appears, then the app will close down (this always happens)
  4. Open the app again, type your password. This time when you hit Unlock, you can access the app.
  5. Try to scroll, the app becomes laggy now.

Motorola Moto X (2nd Gen) - Android 6.0
Aegis 0.4.3, view mode: Normal
No custom icon

@alexbakker
Copy link
Member

alexbakker commented Jun 7, 2019

@michaelschattgen You're right. Turns out that option doesn't do what I thought it did.

@pedrom34
Copy link
Author

pedrom34 commented Jun 7, 2019

@michaelschattgen the app is still useable and awesome. I won't change it for anything...

It'd be great if you fix it, but I won't say it's unacceptable 😁

I'll be happy to help you with any report or tests you'd like me to do.

@troyengel
Copy link

Pixel 2, Android 9 - brand new user and had this happen almost right away using Normal mode. I imported my tokens from an andOTP backup (worked great!), fine tuned the names on some entries. Right when I clicked the 3-dot menu upper right to go to Settings was the 30-second refresh interval for the tokens -- the menu lag was horrendous as they all tried to refresh and the menu open at the same time.

I can recreate this at will -- on the main OTP token screen, watch the red bar until it's almost gone (not like one tick left, but like maybe a few ticks left) then press the 3-dot menu - lags like crazy. In the same ballpark, I can "see" the menu opening in micro-steps as the red bar is counting down, it feels like it's a synchronous flow and the menu redraws are stuck waiting on the next red bar redraw to happen before they can process. It's much better in Compact mode, but still laggy in the same place with the menu opening with the red bar, redraw-redraw-redraw is noticeable trying to show me the menu.

It appears that when the red bar is full, the redraws are faster and as it slowly disappears with time, the lag gets worse. I can basically get about 15 menu opens to test in the span on one red bar countdown, and the first menu redraw is snappy, the 15th is laggy. If I wait for the red bar to get half-way down then open, it's just as laggy as if I had opened it 7 more times first, so it's not the number of times opened, but when in the red bar countdown cycle you do open it - less red == more lag on menu redraw.

Hope some of this helps find the root cause!

@alexbakker alexbakker added the bug A bug report label Jun 22, 2019
@alexbakker
Copy link
Member

alexbakker commented Jun 22, 2019

Thank you all for the detailed reproduction steps. I'm finally able to reproduce at least part of this issue reliably. It turns out we were leaking some resources by not unregistering listeners when destroying the entry list view. The code refresh loop of the leaked view started running in a tight infinite loop, which causes a lot of lag in the main activity.

I'm working on a fix for that in this branch. I also built a debug APK and vault file to test with. This does not address the lag while scrolling yet, but hopefully it fixes the overall lag you guys are experiencing in the main activity.

@troyengel
Copy link

@alexbakker the debug build is looking great, it solves the menu lag using the same tests outlined above and feels really snappy (I loaded your sample data).

If it helps for the token list scrolling, when I'm in Normal mode and finger-flip-scroll really fast it fees good, responsive. When I'm in Compact mode is where I see it stutter, and it happens more on upwards fast-fling (subjective observation) than it does scrolling down. Maybe a clue, maybe not. :) Thanks!

@alexbakker
Copy link
Member

@troyengel

the debug build is looking great, it solves the menu lag using the same tests outlined above and feels really snappy (I loaded your sample data).

Perfect!

If it helps for the token list scrolling, when I'm in Normal mode and finger-flip-scroll really fast it fees good, responsive. When I'm in Compact mode is where I see it stutter, and it happens more on upwards fast-fling (subjective observation) than it does scrolling down. Maybe a clue, maybe not. :) Thanks!

That issue should be addressed by #143.

@alexbakker
Copy link
Member

The fix for this is included since version 1.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug report
Projects
None yet
Development

No branches or pull requests

7 participants