signalapp / Signal-Android

A private messenger for Android.
https://signal.org
GNU Affero General Public License v3.0
25.71k stars 6.17k forks source link

Dynamic language issue after rotating screen #2815

Closed McLoo closed 6 years ago

McLoo commented 9 years ago

As no one wants this linked to his issue, here's a new one:

As mentioned in https://github.com/WhisperSystems/TextSecure/issues/2684#issuecomment-86957063 I noticed that too. Steps to reproduce:

agrajaghh commented 9 years ago

I'm experiencing this issue too, but couldn't reproduce this by just turning the screen off and wait :( Will try to remember how this happens...

McLoo commented 9 years ago

You need to reenter TS before it locks automatically

agrajaghh commented 9 years ago

I don't have a passphrase

McLoo commented 9 years ago

Same within a conversation, not only the list

McLoo commented 9 years ago

This can be reproduced by rotating the phone (orientation change enabled of course)

And seems to work with any language combination TS<->system

McLoo commented 9 years ago

unlocking:

    --------- beginning of /dev/log/system
04-07 08:29:16.479  30786-32419/org.thoughtcrime.securesms W/ShortcutBadger﹕ No support for: com.sonyericsson.home
04-07 08:29:16.579  30786-30786/org.thoughtcrime.securesms W/DynamicLanguage﹕ onCreate currentLocale: null
04-07 08:29:16.579  30786-30786/org.thoughtcrime.securesms W/DynamicLanguage﹕ onCreate getSelectedLocale: en
04-07 08:29:16.579  30786-30786/org.thoughtcrime.securesms W/DynamicLanguage﹕ onCreate getActivityLocale: en
04-07 08:29:16.579  30786-30786/org.thoughtcrime.securesms W/DynamicLanguage﹕ onCreate getConfiguration: en
04-07 08:29:16.599  30786-30786/org.thoughtcrime.securesms W/PassphraseRequiredActionBarActivity﹕ routeApplicationState(), state: 0
04-07 08:29:16.609  30786-30786/org.thoughtcrime.securesms W/PassphraseRequiredActionBarActivity﹕ initializeClearKeyReceiver()
04-07 08:29:16.929  30786-30786/org.thoughtcrime.securesms W/DirectoryRefreshListener﹕ Scheduling for: 1428390061897
04-07 08:29:17.019  30786-30786/org.thoughtcrime.securesms W/DynamicLanguage﹕ onResume currentLocale: en
04-07 08:29:17.019  30786-30786/org.thoughtcrime.securesms W/DynamicLanguage﹕ onResume getSelectedLocale: en
04-07 08:29:17.019  30786-30786/org.thoughtcrime.securesms W/DynamicLanguage﹕ onResume getActivityLocale: en
04-07 08:29:17.019  30786-30786/org.thoughtcrime.securesms W/DynamicLanguage﹕ onResume getConfiguration: en
04-07 08:29:17.299  30786-30786/org.thoughtcrime.securesms W/KeyCachingService﹕ onStartCommand, org.thoughtcrime.securesms.service.action.ACTIVITY_START_EVENT
04-07 08:29:17.299  30786-30786/org.thoughtcrime.securesms W/KeyCachingService﹕ Incrementing activity count...
04-07 08:29:17.309  30786-30786/org.thoughtcrime.securesms W/MessageRetrievalService﹕ Active Count: 1
04-07 08:29:17.859  30786-30786/org.thoughtcrime.securesms I/Choreographer﹕ Skipped 30 frames!  The application may be doing too much work on its main thread.
04-07 08:29:18.229  30786-30786/org.thoughtcrime.securesms D/dalvikvm﹕ GC_FOR_ALLOC freed 816K, 14% free 32886K/38052K, paused 29ms, total 29ms
04-07 08:29:18.499  30786-30786/org.thoughtcrime.securesms W/IInputConnectionWrapper﹕ beginBatchEdit on inactive InputConnection
04-07 08:29:18.509  30786-30786/org.thoughtcrime.securesms W/IInputConnectionWrapper﹕ endBatchEdit on inactive InputConnection
04-07 08:29:18.509  30786-30786/org.thoughtcrime.securesms I/Choreographer﹕ Skipped 33 frames!  The application may be doing too much work on its main thread.
04-07 08:29:19.529  30786-30786/org.thoughtcrime.securesms I/ActivityManager﹕ Timeline: Activity_idle id: android.os.BinderProxy@43aca3e0 time:166783942

then rotating:

no logcat when only rotating

but system locale is set afterwards - turning screen on:

04-07 08:32:36.909  30786-30786/org.thoughtcrime.securesms W/DynamicLanguage﹕ onResume currentLocale: en
04-07 08:32:36.909  30786-30786/org.thoughtcrime.securesms W/DynamicLanguage﹕ onResume getSelectedLocale: en
04-07 08:32:36.909  30786-30786/org.thoughtcrime.securesms W/DynamicLanguage﹕ onResume getActivityLocale: de_DE
04-07 08:32:36.909  30786-30786/org.thoughtcrime.securesms W/DynamicLanguage﹕ onResume getConfiguration: de_DE


issue behavior from the 1st post

having TS language e:


04-07 08:33:38.309  30786-30786/org.thoughtcrime.securesms W/DynamicLanguage﹕ onResume currentLocale: en
04-07 08:33:38.309  30786-30786/org.thoughtcrime.securesms W/DynamicLanguage﹕ onResume getSelectedLocale: en
04-07 08:33:38.309  30786-30786/org.thoughtcrime.securesms W/DynamicLanguage﹕ onResume getActivityLocale: en
04-07 08:33:38.309  30786-30786/org.thoughtcrime.securesms W/DynamicLanguage﹕ onResume getConfiguration: en
04-07 08:33:38.799  30786-30786/org.thoughtcrime.securesms W/KeyCachingService﹕ onStartCommand, org.thoughtcrime.securesms.service.action.ACTIVITY_START_EVENT
04-07 08:33:38.799  30786-30786/org.thoughtcrime.securesms W/KeyCachingService﹕ Incrementing activity count...
04-07 08:33:38.809  30786-30786/org.thoughtcrime.securesms W/MessageRetrievalService﹕ Active Count: 1
04-07 08:33:39.009  30786-30786/org.thoughtcrime.securesms I/ActivityManager﹕ Timeline: Activity_idle id: android.os.BinderProxy@439e02e8 time:167043420
04-07 08:33:39.179  30786-30786/org.thoughtcrime.securesms D/dalvikvm﹕ GC_FOR_ALLOC freed 761K, 12% free 33552K/38052K, paused 54ms, total 54ms
04-07 08:33:39.319   30786-2160/org.thoughtcrime.securesms W/MmsSmsDatabase﹕ Executing query: SELECT _id, body, type, thread_id, address, address_device_id, subject, date_sent, date_received, m_type, msg_box, status, part_count, ct_l, tr_id, m_size, exp, st, delivery_receipt_count, mismatched_identities, network_failures, transport_type FROM (SELECT DISTINCT date_sent * 1 AS date_sent, date * 1 AS date_received, _id, body, read, thread_id, type, address, address_device_id, subject, NULL AS m_type, NULL AS msg_box, status, NULL AS part_count, NULL AS ct_l, NULL AS tr_id, NULL AS m_size, NULL AS exp, NULL AS st, delivery_receipt_count, mismatched_identities, NULL AS network_failures, 'sms' AS transport_type FROM sms WHERE (thread_id = 219) UNION ALL SELECT DISTINCT date * 1000 AS date_sent, date_received * 1000 AS date_received, _id, body, read, thread_id, NULL AS type, address, address_device_id, NULL AS subject, m_type, msg_box, NULL AS status, part_count, ct_l, tr_id, m_size, exp, st, delivery_receipt_count, mismatched_identities, network_failures, 'mms' AS transport_type FROM mms WHERE (thread_id = 219) ORDER BY date_received DESC) LIMIT 1
04-07 08:33:50.379  30786-32442/org.thoughtcrime.securesms W/MessageRetrievalService﹕ Application level read timeout...
04-07 08:33:50.449  30786-32442/org.thoughtcrime.securesms W/MessageRetrievalService﹕ Network requirement: true, active activities: 1, push pending: 0
04-07 08:33:50.469  30786-32442/org.thoughtcrime.securesms W/MessageRetrievalService﹕ Reading message...
04-07 08:34:08.639  30786-30786/org.thoughtcrime.securesms W/KeyCachingService﹕ onStartCommand, org.thoughtcrime.securesms.service.action.ACTIVITY_STOP_EVENT
04-07 08:34:08.639  30786-30786/org.thoughtcrime.securesms W/KeyCachingService﹕ Decrementing activity count...
04-07 08:34:08.639  30786-30786/org.thoughtcrime.securesms W/KeyCachingService﹕ Starting timeout: 1200000
04-07 08:34:08.649  30786-30786/org.thoughtcrime.securesms W/MessageRetrievalService﹕ Active Count: 0
04-07 08:34:08.659  30786-30786/org.thoughtcrime.securesms W/IInputConnectionWrapper﹕ getExtractedText on inactive InputConnection
04-07 08:34:08.669  30786-30786/org.thoughtcrime.securesms W/IInputConnectionWrapper﹕ getTextBeforeCursor on inactive InputConnection
04-07 08:34:08.679  30786-30786/org.thoughtcrime.securesms W/IInputConnectionWrapper﹕ getSelectedText on inactive InputConnection
04-07 08:34:08.679  30786-30786/org.thoughtcrime.securesms W/IInputConnectionWrapper﹕ getTextAfterCursor on inactive InputConnection
04-07 08:34:28.319   30786-2951/org.thoughtcrime.securesms W/WebSocketConnection﹕ Sending keep alive...
04-07 08:34:28.439   30786-2950/org.thoughtcrime.securesms W/OkHttpClientWrapper﹕ onMessage: BINARY
04-07 08:34:28.439   30786-2950/org.thoughtcrime.securesms W/WebSocketConnection﹕ WSC onMessage()
04-07 08:34:28.439   30786-2950/org.thoughtcrime.securesms W/WebSocketConnection﹕ Message Type: 2
04-07 08:34:50.469  30786-32442/org.thoughtcrime.securesms W/MessageRetrievalService﹕ Application level read timeout...
04-07 08:34:50.549  30786-32442/org.thoughtcrime.securesms W/MessageRetrievalService﹕ Network requirement: true, active activities: 0, push pending: 0
04-07 08:34:50.549  30786-32442/org.thoughtcrime.securesms W/MessageRetrievalService﹕ Shutting down pipe...
04-07 08:34:50.549  30786-32442/org.thoughtcrime.securesms W/WebSocketConnection﹕ WSC disconnect()...
04-07 08:34:50.549  30786-32442/org.thoughtcrime.securesms W/OkHttpClientWrapper﹕ Calling disconnect()...
04-07 08:34:50.549  30786-32442/org.thoughtcrime.securesms W/MessageRetrievalService﹕ Looping...
04-07 08:34:50.549  30786-32442/org.thoughtcrime.securesms W/MessageRetrievalService﹕ Waiting for websocket state change....
04-07 08:34:50.569  30786-32442/org.thoughtcrime.securesms W/MessageRetrievalService﹕ Network requirement: true, active activities: 0, push pending: 0
04-07 08:34:50.669   30786-2950/org.thoughtcrime.securesms W/OkHttpClientWrapper﹕ onClose(1000, OK)
04-07 08:34:50.669   30786-2950/org.thoughtcrime.securesms W/WebSocketConnection﹕ onClose()...
04-07 08:35:23.319   30786-2951/org.thoughtcrime.securesms W/WebSocketConnection﹕ Sending keep alive...

Let phone lay around a few minutes, makes it system language. No rotating. Just turning screen on and wiping the lock away. The 3:21 minutes between the lines are log free - I just split them here.

04-07 08:38:44.959  30786-30786/org.thoughtcrime.securesms W/DynamicLanguage﹕ onResume currentLocale: en
04-07 08:38:44.969  30786-30786/org.thoughtcrime.securesms W/DynamicLanguage﹕ onResume getSelectedLocale: en
04-07 08:38:44.969  30786-30786/org.thoughtcrime.securesms W/DynamicLanguage﹕ onResume getActivityLocale: de_DE
04-07 08:38:44.969  30786-30786/org.thoughtcrime.securesms W/DynamicLanguage﹕ onResume getConfiguration: de_DE
04-07 08:38:45.589  30786-30786/org.thoughtcrime.securesms I/Choreographer﹕ Skipped 38 frames!  The application may be doing too much work on its main thread.
04-07 08:38:45.989  30786-30786/org.thoughtcrime.securesms W/KeyCachingService﹕ onStartCommand, org.thoughtcrime.securesms.service.action.ACTIVITY_START_EVENT
04-07 08:38:45.989  30786-30786/org.thoughtcrime.securesms W/KeyCachingService﹕ Incrementing activity count...
04-07 08:38:45.999  30786-30786/org.thoughtcrime.securesms W/MessageRetrievalService﹕ Active Count: 1
04-07 08:38:46.009  30786-30786/org.thoughtcrime.securesms I/ActivityManager﹕ Timeline: Activity_idle id: android.os.BinderProxy@439e02e8 time:167350422
04-07 08:38:46.029  30786-32442/org.thoughtcrime.securesms W/MessageRetrievalService﹕ Network requirement: true, active activities: 1, push pending: 0
04-07 08:38:46.039  30786-32442/org.thoughtcrime.securesms W/MessageRetrievalService﹕ Making websocket connection....
04-07 08:38:46.039  30786-32442/org.thoughtcrime.securesms W/WebSocketConnection﹕ WSC connect()...
04-07 08:38:46.039  30786-32442/org.thoughtcrime.securesms W/OkHttpClientWrapper﹕ Connecting to: wss://textsecure-service.whispersystems.org/v1/websocket/?login=%s&password=%s
04-07 08:38:46.049  30786-32442/org.thoughtcrime.securesms W/MessageRetrievalService﹕ Network requirement: true, active activities: 1, push pending: 0
04-07 08:38:46.059  30786-32442/org.thoughtcrime.securesms W/MessageRetrievalService﹕ Reading message...
04-07 08:38:48.979   30786-9030/org.thoughtcrime.securesms D/dalvikvm﹕ GC_FOR_ALLOC freed 1343K, 12% free 33550K/38052K, paused 39ms, total 40ms
04-07 08:38:49.329   30786-9030/org.thoughtcrime.securesms W/WebSocketConnection﹕ onConnected()
04-07 08:39:15.329  30786-30786/org.thoughtcrime.securesms W/KeyCachingService﹕ onStartCommand, org.thoughtcrime.securesms.service.action.ACTIVITY_STOP_EVENT
04-07 08:39:15.329  30786-30786/org.thoughtcrime.securesms W/KeyCachingService﹕ Decrementing activity count...
04-07 08:39:15.329  30786-30786/org.thoughtcrime.securesms W/KeyCachingService﹕ Starting timeout: 1200000
04-07 08:39:15.369  30786-30786/org.thoughtcrime.securesms W/MessageRetrievalService﹕ Active Count: 0
agrajaghh commented 9 years ago

yeah, with rotating I can reproduce this, good catch @McLoo. Android is a bitch...

rhodey commented 9 years ago

Adding the following lines to ApplicationContext.java seems to log every config change for all non-destroyed activities.

@Override
public void onConfigurationChanged(Configuration newConfig) {
  Log.d(getClass().getName(), "ON CONFIG CHANGED!!!");
  Log.d(getClass().getName(), "LOCALE >> " + newConfig.locale);
}

I think adding an onConfigurationChanged() callback to DynamicLanguage would be a pretty clean fix but I think it would also require that DynamicLanguage become partially static.

McLoo commented 9 years ago

@rhodey but there is no log output when changing back to the language set in TS settings. So only logs (changes config) when going to switch to system locale ?!

rhodey commented 9 years ago

@McLoo yes, the onConfigurationChanged callback only seems to be called as a result of configuration changes Android makes directly, and not by any calls we make to Context.getResources().updateConfiguration(), which I think actually makes it more useful for this situation.

rhodey commented 9 years ago

just checked out 2.9.3 (last RoutingActivity release) from 9b0cae1d4556a8532647a1d0e1b0258dc8db1929 and was surprised to find that this bug was present even back then. maybe this has always been around?

agrajaghh commented 9 years ago

yes its really old, I could never reproduce it, so i didn't create an issue... (and @McLoo reported it with 2.9.0 :stuck_out_tongue_winking_eye: )

automated-signal commented 6 years ago

GitHub Issue Cleanup: See #7598 for more information.