d4rken-org / sdmaid

SD Maid is an Android app that helps you manage files and apps.
https://play.google.com/store/apps/details?id=eu.thedarken.sdm
1.51k stars 744 forks source link

App Cleaner - MIUI/Xiaomi Issue with App info/Accessability to clear cache #4923

Closed SkyDontFall closed 2 years ago

SkyDontFall commented 3 years ago

Phone - POCO X3 OS - Android 11 RKQ1.200826.002 MIUI 12 - 12.0.5 App version - 5.1.4 Unlocker version - 4.4.1

Issue - In the app info section, clearing cache automatically doesn't wor Recording - Video Recording

Side note - There are two versions of the app info in MIUI (could be something to look into) Accessed by SD Maid and any third party app trying to access the app info (tried it with Nova Launcher)

Accessed through the settings or recent apps screen

d4rken commented 3 years ago

Can you provide a debuglog? https://github.com/d4rken/sdmaid-public/wiki/Reporting-a-bug#debugrun-log

SkyDontFall commented 3 years ago

Here you go!

sdmaid_logfile_1623591512762.txt

d4rken commented 3 years ago

Thanks, but you need to record the log while reproducing the problem. The attached log only shows SD Maid being opened, afaict.

SkyDontFall commented 3 years ago

I'm sorry, I realise that now. I recorded logs again. Here you go. Hopefully, this helps. sdmaid_logfile_1624850507438.txt.zip

SkyDontFall commented 3 years ago

Is there anything else I need to provide or is this enough?

d4rken commented 3 years ago

I checked the log and SD Maid is trying to confirm that the current window is the right one, i.e. for Telegram Plus. SD Maid is trying to read the "Plus", but according to the log, the system says that the screen data has changed, but does not return any data to SD Maid.

Not sure if this can be fixed on my end :thinking:

SkyDontFall commented 3 years ago

Well, I messed up. Didn't mean to close it.

So, I use Bouncer to remove permissions. It works flawlessly. Could they be doing something differently?

SkyDontFall commented 3 years ago

Hi, I found another app where it actually works (only the app info cleaning)

1TapCleaner. I tried a lot of other apps and none of them had this feature.. Can you see what they are doing differently?

Here's a video showcasing that - https://media.discordapp.net/attachments/728207504881745983/875006714506788885/Screenrecorder-2021-08-11-18-18-16-659.mp4

d4rken commented 2 years ago

Looks like it also needs quite some time to get the screen info, but at least it can continue. I'll check if I can add some kind of refresh/requery mechanism on retry.

nattadasu commented 2 years ago

I have similar issue here, but seems SkyDontFall didn't enclose what happened to the UI.... Or I missed it.

Previously, the app work as intended. However, since I disabled MIUI optimization from developer menu, the accessibility layer of SD Maid didn't work properly (as I guessed the layout different).

The UI of setting options are exactly same as what the issuer provided.


Maybe as workaround, let the user to have button/icon to manually clear the cache, although it's tedious and sometime can be dangerous?

I'd prefer to enable manually the feature from setting to avoid any accident if you think this idea is good.

SkyDontFall commented 2 years ago

I have similar issue here, but seems SkyDontFall didn't enclose what happened to the UI.... Or I missed it.

Previously, the app work as intended. However, since I disabled MIUI optimization from developer menu, the accessibility layer of SD Maid didn't work properly (as I guessed the layout different).

You're right, I did disabled MIUI optimization.

d4rken commented 2 years ago

I finally think I got it. Something something "not seeing the forest for the trees".

The criterium for the primary second step (pressing on the bottom sheet Clear cache) checks:

            val windowCriteria = fun(node: AccessibilityNodeInfo): Boolean {
                if (node.packageName != SETTINGS_PKG) return false
                return node.crawl().map { it.node }.any { it.idMatches("miui:id/alertTitle") }
            }

This fails :disappointed: obviously "com.miui.securitycenter:id/alertTitle".idMatches("miui:id/alertTitle") I'll change that to idContains(":id/alertTitle")

Please report back after SD Maid v5.2.1

Relevant log displaying the issue for future reference:

V/AppCleaner:ACS:CrawlerHelp: crawl():0: className=android.widget.FrameLayout, text=null, isClickable=false, isEnabled=true, viewIdResourceName=null, pkgName=com.miui.securitycenter
V/AppCleaner:ACS:CrawlerHelp: crawl():-1: className=android.widget.LinearLayout, text=null, isClickable=false, isEnabled=true, viewIdResourceName=null, pkgName=com.miui.securitycenter
V/AppCleaner:ACS:CrawlerHelp: crawl():--2: className=android.widget.FrameLayout, text=null, isClickable=false, isEnabled=true, viewIdResourceName=null, pkgName=com.miui.securitycenter
V/AppCleaner:ACS:CrawlerHelp: crawl():---3: className=android.widget.LinearLayout, text=null, isClickable=false, isEnabled=true, viewIdResourceName=com.miui.securitycenter:id/action_bar_root, pkgName=com.miui.securitycenter
V/AppCleaner:ACS:CrawlerHelp: crawl():----4: className=android.widget.FrameLayout, text=null, isClickable=false, isEnabled=true, viewIdResourceName=android:id/content, pkgName=com.miui.securitycenter
V/AppCleaner:ACS:CrawlerHelp: crawl():-----5: className=android.widget.FrameLayout, text=null, isClickable=false, isEnabled=true, viewIdResourceName=com.miui.securitycenter:id/dialog_root_view, pkgName=com.miui.securitycenter
V/AppCleaner:ACS:CrawlerHelp: crawl():------6: className=android.view.View, text=null, isClickable=true, isEnabled=true, viewIdResourceName=com.miui.securitycenter:id/dialog_dim_bg, pkgName=com.miui.securitycenter
V/AppCleaner:ACS:CrawlerHelp: crawl():------6: className=android.widget.LinearLayout, text=null, isClickable=true, isEnabled=true, viewIdResourceName=com.miui.securitycenter:id/parentPanel, pkgName=com.miui.securitycenter
V/AppCleaner:ACS:CrawlerHelp: crawl():-------7: className=android.widget.FrameLayout, text=null, isClickable=false, isEnabled=true, viewIdResourceName=com.miui.securitycenter:id/topPanel, pkgName=com.miui.securitycenter
V/AppCleaner:ACS:CrawlerHelp: crawl():--------8: className=android.widget.TextView, text=Daten löschen, isClickable=false, isEnabled=true, viewIdResourceName=com.miui.securitycenter:id/alertTitle, pkgName=com.miui.securitycenter
V/AppCleaner:ACS:CrawlerHelp: crawl():-------7: className=android.widget.LinearLayout, text=null, isClickable=false, isEnabled=true, viewIdResourceName=com.miui.securitycenter:id/contentPanel, pkgName=com.miui.securitycenter
V/AppCleaner:ACS:CrawlerHelp: crawl():--------8: className=android.widget.ListView, text=null, isClickable=false, isEnabled=true, viewIdResourceName=com.miui.securitycenter:id/select_dialog_listview, pkgName=com.miui.securitycenter
V/AppCleaner:ACS:CrawlerHelp: crawl():---------9: className=android.widget.TextView, text=Alle Daten löschen, isClickable=true, isEnabled=true, viewIdResourceName=android:id/text1, pkgName=com.miui.securitycenter
V/AppCleaner:ACS:CrawlerHelp: crawl():---------9: className=android.widget.TextView, text=Cache löschen, isClickable=true, isEnabled=true, viewIdResourceName=android:id/text1, pkgName=com.miui.securitycenter
V/AppCleaner:ACS:CrawlerHelp: crawl():-------7: className=android.widget.LinearLayout, text=null, isClickable=false, isEnabled=true, viewIdResourceName=com.miui.securitycenter:id/buttonPanel, pkgName=com.miui.securitycenter
V/AppCleaner:ACS:CrawlerHelp: crawl():--------8: className=android.widget.LinearLayout, text=null, isClickable=false, isEnabled=true, viewIdResourceName=com.miui.securitycenter:id/buttonGroup, pkgName=com.miui.securitycenter
V/AppCleaner:ACS:CrawlerHelp: crawl():---------9: className=android.widget.Button, text=Abbruch, isClickable=true, isEnabled=true, viewIdResourceName=android:id/button3, pkgName=com.miui.securitycenter
D/ACC:ACCrawler: No valid root-node found: eu.thedarken.sdm.accessibility.core.crawler.CrawlerException: Not a viable root window: android.view.accessibility.AccessibilityNodeInfo@80006ce5; boundsInParent: Rect(0, 0 - 1080, 2340); boundsInScreen: Rect(0, 0 - 1080, 2340); packageName: com.miui.securitycenter; className: android.widget.FrameLayout; text: null; error: null; maxTextLength: -1; stateDescription: null; contentDescription: null; tooltipText: null; viewIdResName: null; checkable: false; checked: false; focusable: false; focused: false; selected: false; clickable: false; longClickable: false; contextClickable: false; enabled: true; password: false; scrollable: false; importantForAccessibility: true; visible: true; actions: [AccessibilityAction: ACTION_SELECT - null, AccessibilityAction: ACTION_CLEAR_SELECTION - null, AccessibilityAction: ACTION_ACCESSIBILITY_FOCUS - null, AccessibilityAction: ACTION_SHOW_ON_SCREEN - null] (spec=Spec(parent=AppCleaner:ACS:MIUI12Specs, label=Find & click 'Clear Cache' entry in bottom sheet (targets=[Cache löschen]), pkg=com.google.android.apps.messaging))
D/ACC:ACCrawler: Failed Spec(parent=AppCleaner:ACS:MIUI12Specs, label=Find & click 'Clear Cache' entry in bottom sheet (targets=[Cache löschen]), pkg=com.google.android.apps.messaging), retrying: eu.thedarken.sdm.accessibility.core.crawler.CrawlerException: Not a viable root window: android.view.accessibility.AccessibilityNodeInfo@80006ce5; boundsInParent: Rect(0, 0 - 1080, 2340); boundsInScreen: Rect(0, 0 - 1080, 2340); packageName: com.miui.securitycenter; className: android.widget.FrameLayout; text: null; error: null; maxTextLength: -1; stateDescription: null; contentDescription: null; tooltipText: null; viewIdResName: null; checkable: false; checked: false; focusable: false; focused: false; selected: false; clickable: false; longClickable: false; contextClickable: false; enabled: true; password: false; scrollable: false; importantForAccessibility: true; visible: true; actions: [AccessibilityAction: ACTION_SELECT - null, AccessibilityAction: ACTION_CLEAR_SELECTION - null, AccessibilityAction: ACTION_ACCESSIBILITY_FOCUS - null, AccessibilityAction: ACTION_SHOW_ON_SCREEN - null] (spec=Spec(parent=AppCleaner:ACS:MIUI12Specs, label=Find & click 'Clear Cache' entry in bottom sheet (targets=[Cache löschen]), pkg=com.google.android.apps.messaging))