Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AppCleaner: Fix ACS automation not working on VIVO ROMs with Android 14 #1325

Merged
merged 1 commit into from
Jul 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import eu.darken.sdmse.automation.core.common.defaultWindowIntent
import eu.darken.sdmse.automation.core.common.getAospClearCacheClick
import eu.darken.sdmse.automation.core.common.getDefaultNodeRecovery
import eu.darken.sdmse.automation.core.common.getSysLocale
import eu.darken.sdmse.automation.core.common.idContains
import eu.darken.sdmse.automation.core.common.textMatchesAny
import eu.darken.sdmse.automation.core.common.windowCriteriaAppIdentifier
import eu.darken.sdmse.automation.core.specs.AutomationExplorer
Expand All @@ -36,7 +37,6 @@ import eu.darken.sdmse.common.pkgs.features.Installed
import eu.darken.sdmse.common.pkgs.toPkgId
import eu.darken.sdmse.common.progress.withProgress
import eu.darken.sdmse.main.core.GeneralSettings
import java.util.*
import javax.inject.Inject

@Reusable
Expand Down Expand Up @@ -102,17 +102,25 @@ class VivoSpecs @Inject constructor(
val clearCacheButtonLabels =
vivoLabels.getClearCacheDynamic() + vivoLabels.getClearCacheStatic(lang, script)

// 14: className=android.widget.TextView, text=Clear cache, isClickable=true, isEnabled=true, viewIdResourceName=com.android.settings:id/button, pkgName=com.android.settings
val buttonFilter = fun(node: AccessibilityNodeInfo): Boolean {
if (!node.isClickable) return false
return node.textMatchesAny(clearCacheButtonLabels)
val buttonFilter = when {
hasApiLevel(34) -> fun(node: AccessibilityNodeInfo): Boolean {
return node.idContains("id/vbutton_title") && node.textMatchesAny(clearCacheButtonLabels)
}

else -> fun(node: AccessibilityNodeInfo): Boolean {
return node.isClickable && node.textMatchesAny(clearCacheButtonLabels)
}
}

val step = StepProcessor.Step(
parentTag = tag,
label = R.string.appcleaner_automation_progress_find_clear_cache.toCaString(clearCacheButtonLabels),
windowNodeTest = windowCriteriaAppIdentifier(SETTINGS_PKG, ipcFunnel, pkg),
nodeTest = buttonFilter,
nodeMapping = when {
hasApiLevel(34) -> clickableParent()
else -> null
},
action = getAospClearCacheClick(pkg, tag)
)
stepper.withProgress(this) { process(step) }
Expand Down
Loading