Push: improve Push history screen, log and stored data (#4601)

* Add adb tools to help with doze mode and app standby

* Add info about the device state when an error occurs in push.

* Keep more events in the DB.

* Push history: add confirmation dialog when resetting the data

* Push history: add a filter to see only the errors

* Update screenshots

* Push history: print out invalid/ignored data received.

* Increase log level for push, to make such log more visible.
It also appears that sometimes Timber.d are not present in the rageshakes.

* Log priority

* Do not include device state for invalid/ignored event.

* Fix tests.

* Fix format issue.

* Fix mistake in code blocks and do not filter when not necessary.

* Improve formatting and add missing unit test.

* Reduce nesting of blocks.

---------

Co-authored-by: ElementBot <android@element.io>
This commit is contained in:
Benoit Marty
2025-04-16 16:37:32 +02:00
committed by GitHub
parent 505d0b411d
commit f916e4e3d4
30 changed files with 388 additions and 58 deletions

View File

@@ -0,0 +1,18 @@
#!/usr/bin/env bash
# Copyright 2025 New Vector Ltd.
#
# SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
# Please see LICENSE files in the repository root for full details.
# Ref: https://developer.android.com/training/monitoring-device-state/doze-standby#testing_your_app_with_app_standby
echo " => Standby OFF"
set -x
package_name="io.element.android.x.debug"
adb shell dumpsys battery reset
adb shell am set-inactive "${package_name}" false
adb shell am get-inactive "${package_name}"
tools/adb/print_device_state.sh

16
tools/adb/disable_doze_mode.sh Executable file
View File

@@ -0,0 +1,16 @@
#!/usr/bin/env bash
# Copyright 2025 New Vector Ltd.
#
# SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
# Please see LICENSE files in the repository root for full details.
# Ref: https://developer.android.com/training/monitoring-device-state/doze-standby#testing_doze
echo " => Disable doze mode"
set -x
adb shell dumpsys deviceidle unforce
adb shell dumpsys battery reset
tools/adb/print_device_state.sh

18
tools/adb/enable_app_standby.sh Executable file
View File

@@ -0,0 +1,18 @@
#!/usr/bin/env bash
# Copyright 2025 New Vector Ltd.
#
# SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
# Please see LICENSE files in the repository root for full details.
# Ref: https://developer.android.com/training/monitoring-device-state/doze-standby#testing_your_app_with_app_standby
echo " => Standby ON"
set -x
package_name="io.element.android.x.debug"
adb shell dumpsys battery unplug
adb shell am set-inactive "${package_name}" true
adb shell am get-inactive "${package_name}"
tools/adb/print_device_state.sh

16
tools/adb/enable_doze_mode.sh Executable file
View File

@@ -0,0 +1,16 @@
#!/usr/bin/env bash
# Copyright 2025 New Vector Ltd.
#
# SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
# Please see LICENSE files in the repository root for full details.
# Ref: https://developer.android.com/training/monitoring-device-state/doze-standby#testing_doze
echo " => Enable doze mode"
set -x
adb shell dumpsys battery unplug
adb shell dumpsys deviceidle force-idle
tools/adb/print_device_state.sh

18
tools/adb/print_device_state.sh Executable file
View File

@@ -0,0 +1,18 @@
#!/usr/bin/env bash
# Copyright 2025 New Vector Ltd.
#
# SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
# Please see LICENSE files in the repository root for full details.
# Ref: https://developer.android.com/training/monitoring-device-state/doze-standby#testing_doze
echo " => Device state"
set -x
adb shell dumpsys deviceidle get light
adb shell dumpsys deviceidle get deep
adb shell dumpsys deviceidle get force
adb shell dumpsys deviceidle get screen
adb shell dumpsys deviceidle get charging
adb shell dumpsys deviceidle get network