mirror of
https://github.com/oxen-io/session-android.git
synced 2025-06-09 19:28:35 +00:00
Fix performance issue with large number of notifications.
Constructing the notification would call KeyCachingService#isLocked() many times in a loop. This call is slow, because when the device isn't locked, it would construct the master secret each time, which can take 50+ ms. Do that twice in a loop a hundred times, and it adds up. This simplified #isLocked to avoid the unnecessary master secret generation.
This commit is contained in:
parent
7e0de29dd7
commit
207dd23c86
@ -79,7 +79,7 @@ public class KeyCachingService extends Service {
|
||||
public KeyCachingService() {}
|
||||
|
||||
public static synchronized boolean isLocked(Context context) {
|
||||
return getMasterSecret(context) == null;
|
||||
return masterSecret == null && (!TextSecurePreferences.isPasswordDisabled(context) || TextSecurePreferences.isScreenLockEnabled(context));
|
||||
}
|
||||
|
||||
public static synchronized @Nullable MasterSecret getMasterSecret(Context context) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user