Screenshot shown in Overview/Recents if screen-off with TextSecure in focus
When context switching from TextSecure by Overview/Recents or the home button, the system behaves as expected: a screenshot is not captured, and a blank window is displayed in Overview/Recents.
The issue occurs when TextSecure is in focus and the screen is shut off, either by power button or timeout. The screenshot then persists in Overview/Recents until TextSecure is dismissed from the list, even across reboots.
"Screen security" is enabled, and logs indicate both that FLAG_SUPPORTS_PROTECTED_BUFFERS is enabled on the display, and that the screen capture should have failed with W/SurfaceFlinger﹕ FB is protected: PERMISSION_DENIED.
Missing from the logs, however, is W/WindowManager﹕ Screenshot failure taking screenshot for... entry. The system still captures, caches, and displays a screenshot of TextSecure in Overview/Recents.
Device and software
- Google Nexus 5 D820
- Android 5.1 LMY47I stock; no superuser
- TextSecure (master 14 May [ab8593d], also release v2.9.3)
Steps to reproduce
- Ensure the "Screen security" setting is enabled in TextSecure
- Tap the Home button to get to the home screen
- Tap the Overview/Recents button; dismiss TextSecure if listed
- Launch TextSecure; navigate to any desired screen
- Press the power button to turn off the screen, or wait for screen timeout
- Press the power button to turn on the screen; authenticate if necessary
- Tap the Overview/Recents button
- Behold an allegedly secure window/protected framebuffer
Log: timeout
05-15 14:17:14.221 760-834/? I/PowerManagerService﹕ Going to sleep due to screen timeout (uid 1000)...
05-15 14:17:14.222 760-834/? I/PowerManagerService﹕ Sleeping (uid 1000)...
05-15 14:17:14.292 176-2247/? W/SurfaceFlinger﹕ FB is protected: PERMISSION_DENIED
05-15 14:17:14.305 188-915/? D/audio_hw_primary﹕ adev_set_parameters: enter: screen_state=off
05-15 14:17:14.306 1272-1272/? D/PhoneStatusBar﹕ disable: < expand ICONS* alerts SYSTEM_INFO* back home recent clock search >
05-15 14:17:14.339 760-1232/? E/WifiStateMachine﹕ cancelDelayedScan -> XXXX
05-15 14:17:14.340 760-1232/? E/native﹕ do suspend true
05-15 14:17:14.372 1272-1720/? D/BluetoothAdapter﹕ XXXX: getState() : mService = null. Returning STATE_OFF
05-15 14:17:14.372 1272-1720/? D/BluetoothAdapter﹕ XXXX: getState() : mService = null. Returning STATE_OFF
05-15 14:17:14.400 24473-24473/org.thoughtcrime.securesms W/KeyCachingService﹕ onStartCommand, org.thoughtcrime.securesms.service.action.ACTIVITY_STOP_EVENT
05-15 14:17:14.400 24473-24473/org.thoughtcrime.securesms W/KeyCachingService﹕ Decrementing activity count...
05-15 14:17:14.400 24473-24473/org.thoughtcrime.securesms W/MessageRetrievalService﹕ Active Count: 0
05-15 14:17:14.402 1272-1720/? D/BluetoothAdapter﹕ XXXX: getState() : mService = null. Returning STATE_OFF
05-15 14:17:14.402 1272-1720/? D/BluetoothAdapter﹕ XXXX: getState() : mService = null. Returning STATE_OFF
05-15 14:17:14.459 1272-1272/? D/PhoneStatusBar﹕ disable: < expand ICONS alerts SYSTEM_INFO back HOME* RECENT* clock SEARCH* >
05-15 14:17:14.766 760-832/? I/DisplayManagerService﹕ Display device changed: DisplayDeviceInfo{"기본으로 제공되는 화면": uniqueId="local:0", 1080 x 1920, 60.0 fps, supportedRefreshRates [60.0], density 480, 442.451 x 443.345 dpi, appVsyncOff 7500000, presDeadline 12666667, touch INTERNAL, rotation 0, type BUILT_IN, state OFF, FLAG_DEFAULT_DISPLAY, FLAG_ROTATES_WITH_CONTENT, FLAG_SECURE, FLAG_SUPPORTS_PROTECTED_BUFFERS}
05-15 14:17:14.766 176-176/? D/SurfaceFlinger﹕ Set power mode=0, type=0 flinger=0xb6082000
05-15 14:17:14.766 176-176/? D/qdhwcomposer﹕ hwc_blank: Blanking display: 0
05-15 14:17:14.767 760-760/? V/ActivityManager﹕ Display changed displayId=0
05-15 14:17:14.934 760-779/? I/art﹕ Explicit concurrent mark sweep GC freed 142150(6MB) AllocSpace objects, 38(1905KB) LOS objects, 31% free, 35MB/51MB, paused 1.549ms total 163.240ms
05-15 14:17:15.043 176-176/? D/qdhwcomposer﹕ hwc_blank: Done blanking display: 0
05-15 14:17:15.044 760-1249/? D/SurfaceControl﹕ Excessive delay in setPowerMode(): 277ms
05-15 14:17:15.044 1869-1880/? E/ANDR-PERF-LOCK﹕ Failed to apply optimization for resource: 4 level: 0
Log: power button
05-15 14:34:02.977 760-895/? I/PowerManagerService﹕ Going to sleep due to power button (uid 1000)...
05-15 14:34:02.978 760-834/? I/PowerManagerService﹕ Sleeping (uid 1000)...
05-15 14:34:02.985 188-915/? D/audio_hw_primary﹕ adev_set_parameters: enter: screen_state=off
05-15 14:34:03.000 176-472/? W/SurfaceFlinger﹕ FB is protected: PERMISSION_DENIED
05-15 14:34:03.004 760-1232/? E/WifiStateMachine﹕ cancelDelayedScan -> XXXX
05-15 14:34:03.006 760-1232/? E/native﹕ do suspend true
05-15 14:34:03.011 1272-1272/? D/PhoneStatusBar﹕ disable: < expand ICONS* alerts SYSTEM_INFO* back home recent clock search >
05-15 14:34:03.038 1272-1720/? D/BluetoothAdapter﹕ XXXX: getState() : mService = null. Returning STATE_OFF
05-15 14:34:03.038 1272-1720/? D/BluetoothAdapter﹕ XXXX: getState() : mService = null. Returning STATE_OFF
05-15 14:34:03.073 31294-31294/org.thoughtcrime.securesms W/KeyCachingService﹕ onStartCommand, org.thoughtcrime.securesms.service.action.ACTIVITY_STOP_EVENT
05-15 14:34:03.073 31294-31294/org.thoughtcrime.securesms W/KeyCachingService﹕ Decrementing activity count...
05-15 14:34:03.074 1272-1720/? D/BluetoothAdapter﹕ XXXX: getState() : mService = null. Returning STATE_OFF
05-15 14:34:03.074 1272-1720/? D/BluetoothAdapter﹕ XXXX: getState() : mService = null. Returning STATE_OFF
05-15 14:34:03.075 31294-31294/org.thoughtcrime.securesms W/MessageRetrievalService﹕ Active Count: 0
05-15 14:34:03.133 1272-1272/? D/PhoneStatusBar﹕ disable: < expand ICONS alerts SYSTEM_INFO back HOME* RECENT* clock SEARCH* >
05-15 14:34:03.452 760-832/? I/DisplayManagerService﹕ Display device changed: DisplayDeviceInfo{"기본으로 제공되는 화면": uniqueId="local:0", 1080 x 1920, 60.0 fps, supportedRefreshRates [60.0], density 480, 442.451 x 443.345 dpi, appVsyncOff 7500000, presDeadline 12666667, touch INTERNAL, rotation 0, type BUILT_IN, state OFF, FLAG_DEFAULT_DISPLAY, FLAG_ROTATES_WITH_CONTENT, FLAG_SECURE, FLAG_SUPPORTS_PROTECTED_BUFFERS}
05-15 14:34:03.452 176-176/? D/SurfaceFlinger﹕ Set power mode=0, type=0 flinger=0xb6082000
05-15 14:34:03.452 176-176/? D/qdhwcomposer﹕ hwc_blank: Blanking display: 0
05-15 14:34:03.452 760-760/? V/ActivityManager﹕ Display changed displayId=0
05-15 14:34:03.733 176-176/? D/qdhwcomposer﹕ hwc_blank: Done blanking display: 0
05-15 14:34:03.734 760-1249/? D/SurfaceControl﹕ Excessive delay in setPowerMode(): 282ms
05-15 14:34:03.734 1869-1880/? E/ANDR-PERF-LOCK﹕ Failed to apply optimization for resource: 4 level: 0
05-15 14:34:03.797 188-908/? D/audio_hw_primary﹕ disable_audio_route: reset and update mixer path: low-latency-playback
05-15 14:34:03.797 188-908/? D/audio_hw_primary﹕ disable_snd_device: snd_device(2: speaker)
Log: home button (screenshot NOT captured, note the W/WindowManager﹕ Screenshot failure... entry that is missing from the above two log captures)
05-15 15:02:13.558 760-841/? I/ActivityManager﹕ START u0 {act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10200000 cmp=com.google.android.googlequicksearchbox/com.google.android.launcher.GEL} from uid 1000 on display 0
05-15 15:02:13.562 175-2116/? W/SurfaceFlinger﹕ FB is protected: PERMISSION_DENIED
05-15 15:02:13.562 760-841/? W/WindowManager﹕ Screenshot failure taking screenshot for (1080x1920) to layer 21015
05-15 15:02:13.569 11784-11784/org.thoughtcrime.securesms W/KeyCachingService﹕ onStartCommand, org.thoughtcrime.securesms.service.action.ACTIVITY_STOP_EVENT
05-15 15:02:13.569 11784-11784/org.thoughtcrime.securesms W/KeyCachingService﹕ Decrementing activity count...
05-15 15:02:13.569 11784-11784/org.thoughtcrime.securesms W/MessageRetrievalService﹕ Active Count: 0
05-15 15:02:13.570 187-857/? D/audio_hw_primary﹕ out_set_parameters: enter: usecase(1: low-latency-playback) kvpairs: routing=2
05-15 15:02:13.577 1212-1212/? I/GEL﹕ handleIntent(Intent { act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10600000 cmp=com.google.android.googlequicksearchbox/com.google.android.launcher.GEL })
05-15 15:02:13.582 187-755/? D/audio_hw_primary﹕ select_devices: out_snd_device(2: speaker) in_snd_device(0: none)
05-15 15:02:13.582 187-755/? D/msm8974_platform﹕ platform_send_audio_calibration: sending audio calibration for snd_device(2) acdb_id(15)
05-15 15:02:13.582 187-755/? D/audio_hw_primary﹕ enable_snd_device: snd_device(2: speaker)
05-15 15:02:13.584 187-755/? D/audio_hw_primary﹕ enable_audio_route: apply and update mixer path: low-latency-playback
05-15 15:02:14.167 1212-1484/? W/OpenGLRenderer﹕ Incorrectly called buildLayer on View: aep, destroying layer...
05-15 15:02:14.167 1212-1484/? W/OpenGLRenderer﹕ Incorrectly called buildLayer on View: aep, destroying layer...
05-15 15:02:14.188 760-850/? E/WifiStateMachine﹕ WifiStateMachine CMD_START_SCAN source XXXX txSuccessRate=0.00 rxSuccessRate=0.00 targetRoamBSSID=XXXX RSSI=XXXX
05-15 15:02:14.188 760-850/? E/WifiStateMachine﹕ WifiStateMachine starting scan for "XXXX"
05-15 15:02:14.570 898-898/? W/ResourceType﹕ No package identifier when getting value for resource number 0x00000000
05-15 15:02:14.570 898-898/? W/PackageManager﹕ Failure retrieving resources for org.thoughtcrime.securesms: Resource ID #0x0
05-15 15:02:16.752 187-857/? D/audio_hw_primary﹕ disable_audio_route: reset and update mixer path: low-latency-playback
05-15 15:02:16.752 187-857/? D/audio_hw_primary﹕ disable_snd_device: snd_device(2: speaker)
@unrulygnu Sounds like an OS bug. We just set the flag on the window, what the ROM does with it is beyond our control.
I'm able to reproduce this (besides TS) on another app (KeePass2Android Offline) that also has a screen security feature.
Nexus 4, stock 5.1
closing as android bug
#5093 prompted me to give this another look, and according to comments in Android Issue 183486, we may have a bug on our side. I've tested a fix with no side-effects in Marshmallow, and I will reflash Lollipop later today to confirm that it resolves this issue on that platform.
Can we reopen this issue? @2-4601 ? EDIT: Sorry, please disregard. This is a framework bug (tested even with an empty project on Lollipop, changing order still results in screenshot on screen-off :disappointed: ).
ah, bummer Thanks for taking the time to investigate this again though. Wish you could be cloned!
I'd defer that power to you. Bug reports across the industry could bring tears of joy to all. :joy:
@2-4601 I don't have confirmation but since Signal is using fragments, I think is possible to use the onPause() or onStop() event to change to a blank fragment. Didn't try this approach, but I think it might work.