Skip to content

Commit 657968a

Browse files
committed
UI test automation service should not be auto reconnected.
1. Since adb is restarted on user switch it makes no sense to try to reconnect the ui automation service since it will be killed on a user switch. Disabling touch exploration on UI automation service connect since it can explicitly put the device in this state if needed. bug:6967373 Change-Id: I8cfde74f28f3f03d4ccf24746d43b8178ae2b5ef
1 parent 9371a0a commit 657968a

File tree

1 file changed

+10
-28
lines changed

1 file changed

+10
-28
lines changed

services/java/com/android/server/accessibility/AccessibilityManagerService.java

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@
7979

8080
import com.android.internal.R;
8181
import com.android.internal.content.PackageMonitor;
82-
import com.android.internal.os.SomeArgs;
8382
import com.android.internal.statusbar.IStatusBarService;
8483

8584
import org.xmlpull.v1.XmlPullParserException;
@@ -472,13 +471,18 @@ public void registerUiTestAutomationService(IAccessibilityServiceClient serviceC
472471
// If necessary enable accessibility and announce that.
473472
if (!userState.mIsAccessibilityEnabled) {
474473
userState.mIsAccessibilityEnabled = true;
475-
scheduleSendStateToClientsLocked(userState);
476474
}
475+
// No touch exploration.
476+
userState.mIsTouchExplorationEnabled = false;
477+
478+
// Hook the automation service up.
479+
mUiAutomationService = new Service(mCurrentUserId, componentName,
480+
accessibilityServiceInfo, true);
481+
mUiAutomationService.onServiceConnected(componentName, serviceClient.asBinder());
482+
483+
updateInputFilterLocked(userState);
484+
scheduleSendStateToClientsLocked(userState);
477485
}
478-
// Hook the automation service up.
479-
mUiAutomationService = new Service(mCurrentUserId, componentName,
480-
accessibilityServiceInfo, true);
481-
mUiAutomationService.onServiceConnected(componentName, serviceClient.asBinder());
482486
}
483487

484488
public void unregisterUiTestAutomationService(IAccessibilityServiceClient serviceClient) {
@@ -591,16 +595,6 @@ private void switchUser(int userId) {
591595
// Recreate the internal state for the new user.
592596
mMainHandler.obtainMessage(MainHandler.MSG_SEND_RECREATE_INTERNAL_STATE,
593597
mCurrentUserId, 0).sendToTarget();
594-
595-
// Re-register the test automation service after the new state is recreated.
596-
if (mUiAutomationService != null) {
597-
unregisterUiTestAutomationService(mUiAutomationService.mServiceInterface);
598-
SomeArgs args = SomeArgs.obtain();
599-
args.arg1 = mUiAutomationService.mServiceInterface;
600-
args.arg2 = mUiAutomationService.mAccessibilityServiceInfo;
601-
mMainHandler.obtainMessage(MainHandler.MSG_REGISTER_UI_TEST_AUTOMATION_SERVICE,
602-
args).sendToTarget();
603-
}
604598
}
605599
}
606600

@@ -1166,7 +1160,6 @@ private final class MainHandler extends Handler {
11661160
public static final int MSG_SEND_STATE_TO_CLIENTS = 2;
11671161
public static final int MSG_SEND_CLEARED_STATE_TO_CLIENTS_FOR_USER = 3;
11681162
public static final int MSG_SEND_RECREATE_INTERNAL_STATE = 4;
1169-
public static final int MSG_REGISTER_UI_TEST_AUTOMATION_SERVICE = 5;
11701163

11711164
public MainHandler(Looper looper) {
11721165
super(looper);
@@ -1202,17 +1195,6 @@ public void handleMessage(Message msg) {
12021195
recreateInternalStateLocked(userState);
12031196
}
12041197
} break;
1205-
case MSG_REGISTER_UI_TEST_AUTOMATION_SERVICE: {
1206-
SomeArgs args = (SomeArgs) msg.obj;
1207-
try {
1208-
IAccessibilityServiceClient client =
1209-
(IAccessibilityServiceClient) args.arg1;
1210-
AccessibilityServiceInfo info = (AccessibilityServiceInfo) args.arg2;
1211-
registerUiTestAutomationService(client, info);
1212-
} finally {
1213-
args.recycle();
1214-
}
1215-
} break;
12161198
}
12171199
}
12181200

0 commit comments

Comments
 (0)