summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2024-06-14 21:09:23 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2024-06-14 21:09:23 +0000
commit6870708b4bfdef3813d343958ae20df9c5ae45c9 (patch)
tree9ac59b7318af6e02ac417ba905d1ec6cc13a2f3c
parent53c30ba0a22f81399c7d4b03b85ed4f2bc9f74dc (diff)
parentf28f9e3ea83a52586ed074dc242a80ce388bfc2d (diff)
Merge "Fix NPE in UiAutomationManager" into main
-rw-r--r--services/accessibility/java/com/android/server/accessibility/UiAutomationManager.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/services/accessibility/java/com/android/server/accessibility/UiAutomationManager.java b/services/accessibility/java/com/android/server/accessibility/UiAutomationManager.java
index f69104db7c10..3b9340b2402b 100644
--- a/services/accessibility/java/com/android/server/accessibility/UiAutomationManager.java
+++ b/services/accessibility/java/com/android/server/accessibility/UiAutomationManager.java
@@ -274,8 +274,10 @@ class UiAutomationManager {
mMainHandler.post(() -> {
try {
final IAccessibilityServiceClient serviceInterface;
+ final UiAutomationService uiAutomationService;
synchronized (mLock) {
serviceInterface = mServiceInterface;
+ uiAutomationService = mUiAutomationService;
if (serviceInterface == null) {
mService = null;
} else {
@@ -286,8 +288,8 @@ class UiAutomationManager {
// If the serviceInterface is null, the UiAutomation has been shut down on
// another thread.
if (serviceInterface != null) {
- if (Flags.addWindowTokenWithoutLock()) {
- mUiAutomationService.addWindowTokensForAllDisplays();
+ if (Flags.addWindowTokenWithoutLock() && uiAutomationService != null) {
+ uiAutomationService.addWindowTokensForAllDisplays();
}
if (mTrace.isA11yTracingEnabledForTypes(
AccessibilityTrace.FLAGS_ACCESSIBILITY_SERVICE_CLIENT)) {