Merge "Add features to allow filtering logging based on interfaces." into sc-v2-dev am: d6cc13a99c
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14703957 Change-Id: Ie4ee53a44fd26de19867252d81c222e1654f9db1
This commit is contained in:
216
core/java/android/accessibilityservice/AccessibilityTrace.java
Normal file
216
core/java/android/accessibilityservice/AccessibilityTrace.java
Normal file
@@ -0,0 +1,216 @@
|
||||
/**
|
||||
* Copyright (C) 2021 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package android.accessibilityservice;
|
||||
|
||||
import java.util.AbstractMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Interface to log accessibility trace.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public interface AccessibilityTrace {
|
||||
String NAME_ACCESSIBILITY_SERVICE_CONNECTION = "IAccessibilityServiceConnection";
|
||||
String NAME_ACCESSIBILITY_SERVICE_CLIENT = "IAccessibilityServiceClient";
|
||||
String NAME_ACCESSIBILITY_MANAGER = "IAccessibilityManager";
|
||||
String NAME_ACCESSIBILITY_MANAGER_CLIENT = "IAccessibilityManagerClient";
|
||||
String NAME_ACCESSIBILITY_INTERACTION_CONNECTION = "IAccessibilityInteractionConnection";
|
||||
String NAME_ACCESSIBILITY_INTERACTION_CONNECTION_CALLBACK =
|
||||
"IAccessibilityInteractionConnectionCallback";
|
||||
String NAME_REMOTE_MAGNIFICATION_ANIMATION_CALLBACK = "IRemoteMagnificationAnimationCallback";
|
||||
String NAME_WINDOW_MAGNIFICATION_CONNECTION = "IWindowMagnificationConnection";
|
||||
String NAME_WINDOW_MAGNIFICATION_CONNECTION_CALLBACK = "IWindowMagnificationConnectionCallback";
|
||||
String NAME_WINDOW_MANAGER_INTERNAL = "WindowManagerInternal";
|
||||
String NAME_WINDOWS_FOR_ACCESSIBILITY_CALLBACK = "WindowsForAccessibilityCallback";
|
||||
String NAME_MAGNIFICATION_CALLBACK = "MagnificationCallbacks";
|
||||
String NAME_INPUT_FILTER = "InputFilter";
|
||||
String NAME_GESTURE = "Gesture";
|
||||
String NAME_ACCESSIBILITY_SERVICE = "AccessibilityService";
|
||||
String NAME_PACKAGE_BROADCAST_RECEIVER = "PMBroadcastReceiver";
|
||||
String NAME_USER_BROADCAST_RECEIVER = "UserBroadcastReceiver";
|
||||
String NAME_FINGERPRINT = "FingerprintGesture";
|
||||
String NAME_ACCESSIBILITY_INTERACTION_CLIENT = "AccessibilityInteractionClient";
|
||||
|
||||
String NAME_ALL_LOGGINGS = "AllLoggings";
|
||||
String NAME_NONE = "None";
|
||||
|
||||
long FLAGS_ACCESSIBILITY_SERVICE_CONNECTION = 0x0000000000000001L;
|
||||
long FLAGS_ACCESSIBILITY_SERVICE_CLIENT = 0x0000000000000002L;
|
||||
long FLAGS_ACCESSIBILITY_MANAGER = 0x0000000000000004L;
|
||||
long FLAGS_ACCESSIBILITY_MANAGER_CLIENT = 0x0000000000000008L;
|
||||
long FLAGS_ACCESSIBILITY_INTERACTION_CONNECTION = 0x0000000000000010L;
|
||||
long FLAGS_ACCESSIBILITY_INTERACTION_CONNECTION_CALLBACK = 0x0000000000000020L;
|
||||
long FLAGS_REMOTE_MAGNIFICATION_ANIMATION_CALLBACK = 0x0000000000000040L;
|
||||
long FLAGS_WINDOW_MAGNIFICATION_CONNECTION = 0x0000000000000080L;
|
||||
long FLAGS_WINDOW_MAGNIFICATION_CONNECTION_CALLBACK = 0x0000000000000100L;
|
||||
long FLAGS_WINDOW_MANAGER_INTERNAL = 0x0000000000000200L;
|
||||
long FLAGS_WINDOWS_FOR_ACCESSIBILITY_CALLBACK = 0x0000000000000400L;
|
||||
long FLAGS_MAGNIFICATION_CALLBACK = 0x0000000000000800L;
|
||||
long FLAGS_INPUT_FILTER = 0x0000000000001000L;
|
||||
long FLAGS_GESTURE = 0x0000000000002000L;
|
||||
long FLAGS_ACCESSIBILITY_SERVICE = 0x0000000000004000L;
|
||||
long FLAGS_PACKAGE_BROADCAST_RECEIVER = 0x0000000000008000L;
|
||||
long FLAGS_USER_BROADCAST_RECEIVER = 0x0000000000010000L;
|
||||
long FLAGS_FINGERPRINT = 0x0000000000020000L;
|
||||
long FLAGS_ACCESSIBILITY_INTERACTION_CLIENT = 0x0000000000040000L;
|
||||
|
||||
long FLAGS_LOGGING_NONE = 0x0000000000000000L;
|
||||
long FLAGS_LOGGING_ALL = 0xFFFFFFFFFFFFFFFFL;
|
||||
|
||||
long FLAGS_ACCESSIBILITY_MANAGER_CLIENT_STATES = FLAGS_ACCESSIBILITY_INTERACTION_CLIENT
|
||||
| FLAGS_ACCESSIBILITY_SERVICE
|
||||
| FLAGS_ACCESSIBILITY_INTERACTION_CONNECTION
|
||||
| FLAGS_ACCESSIBILITY_INTERACTION_CONNECTION_CALLBACK;
|
||||
|
||||
Map<String, Long> sNamesToFlags = Map.ofEntries(
|
||||
new AbstractMap.SimpleEntry<String, Long>(
|
||||
NAME_ACCESSIBILITY_SERVICE_CONNECTION, FLAGS_ACCESSIBILITY_SERVICE_CONNECTION),
|
||||
new AbstractMap.SimpleEntry<String, Long>(
|
||||
NAME_ACCESSIBILITY_SERVICE_CLIENT, FLAGS_ACCESSIBILITY_SERVICE_CLIENT),
|
||||
new AbstractMap.SimpleEntry<String, Long>(
|
||||
NAME_ACCESSIBILITY_MANAGER, FLAGS_ACCESSIBILITY_MANAGER),
|
||||
new AbstractMap.SimpleEntry<String, Long>(
|
||||
NAME_ACCESSIBILITY_MANAGER_CLIENT, FLAGS_ACCESSIBILITY_MANAGER_CLIENT),
|
||||
new AbstractMap.SimpleEntry<String, Long>(
|
||||
NAME_ACCESSIBILITY_INTERACTION_CONNECTION,
|
||||
FLAGS_ACCESSIBILITY_INTERACTION_CONNECTION),
|
||||
new AbstractMap.SimpleEntry<String, Long>(
|
||||
NAME_ACCESSIBILITY_INTERACTION_CONNECTION_CALLBACK,
|
||||
FLAGS_ACCESSIBILITY_INTERACTION_CONNECTION_CALLBACK),
|
||||
new AbstractMap.SimpleEntry<String, Long>(
|
||||
NAME_REMOTE_MAGNIFICATION_ANIMATION_CALLBACK,
|
||||
FLAGS_REMOTE_MAGNIFICATION_ANIMATION_CALLBACK),
|
||||
new AbstractMap.SimpleEntry<String, Long>(
|
||||
NAME_WINDOW_MAGNIFICATION_CONNECTION, FLAGS_WINDOW_MAGNIFICATION_CONNECTION),
|
||||
new AbstractMap.SimpleEntry<String, Long>(
|
||||
NAME_WINDOW_MAGNIFICATION_CONNECTION_CALLBACK,
|
||||
FLAGS_WINDOW_MAGNIFICATION_CONNECTION_CALLBACK),
|
||||
new AbstractMap.SimpleEntry<String, Long>(
|
||||
NAME_WINDOW_MANAGER_INTERNAL, FLAGS_WINDOW_MANAGER_INTERNAL),
|
||||
new AbstractMap.SimpleEntry<String, Long>(
|
||||
NAME_WINDOWS_FOR_ACCESSIBILITY_CALLBACK,
|
||||
FLAGS_WINDOWS_FOR_ACCESSIBILITY_CALLBACK),
|
||||
new AbstractMap.SimpleEntry<String, Long>(
|
||||
NAME_MAGNIFICATION_CALLBACK, FLAGS_MAGNIFICATION_CALLBACK),
|
||||
new AbstractMap.SimpleEntry<String, Long>(NAME_INPUT_FILTER, FLAGS_INPUT_FILTER),
|
||||
new AbstractMap.SimpleEntry<String, Long>(NAME_GESTURE, FLAGS_GESTURE),
|
||||
new AbstractMap.SimpleEntry<String, Long>(
|
||||
NAME_ACCESSIBILITY_SERVICE, FLAGS_ACCESSIBILITY_SERVICE),
|
||||
new AbstractMap.SimpleEntry<String, Long>(
|
||||
NAME_PACKAGE_BROADCAST_RECEIVER, FLAGS_PACKAGE_BROADCAST_RECEIVER),
|
||||
new AbstractMap.SimpleEntry<String, Long>(
|
||||
NAME_USER_BROADCAST_RECEIVER, FLAGS_USER_BROADCAST_RECEIVER),
|
||||
new AbstractMap.SimpleEntry<String, Long>(NAME_FINGERPRINT, FLAGS_FINGERPRINT),
|
||||
new AbstractMap.SimpleEntry<String, Long>(
|
||||
NAME_ACCESSIBILITY_INTERACTION_CLIENT, FLAGS_ACCESSIBILITY_INTERACTION_CLIENT),
|
||||
new AbstractMap.SimpleEntry<String, Long>(NAME_NONE, FLAGS_LOGGING_NONE),
|
||||
new AbstractMap.SimpleEntry<String, Long>(NAME_ALL_LOGGINGS, FLAGS_LOGGING_ALL));
|
||||
|
||||
/**
|
||||
* Get the flags of the logging types by the given names.
|
||||
* The names list contains logging type names in lower case.
|
||||
*/
|
||||
static long getLoggingFlagsFromNames(List<String> names) {
|
||||
long types = FLAGS_LOGGING_NONE;
|
||||
for (String name : names) {
|
||||
long flag = sNamesToFlags.get(name);
|
||||
types |= flag;
|
||||
}
|
||||
return types;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of the names of logging types by the given flags.
|
||||
*/
|
||||
static List<String> getNamesOfLoggingTypes(long flags) {
|
||||
List<String> list = new ArrayList<String>();
|
||||
|
||||
for (Map.Entry<String, Long> entry : sNamesToFlags.entrySet()) {
|
||||
if ((entry.getValue() & flags) != FLAGS_LOGGING_NONE) {
|
||||
list.add(entry.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the trace is enabled for any logging type.
|
||||
*/
|
||||
boolean isA11yTracingEnabled();
|
||||
|
||||
/**
|
||||
* Whether the trace is enabled for any of the given logging type.
|
||||
*/
|
||||
boolean isA11yTracingEnabledForTypes(long typeIdFlags);
|
||||
|
||||
/**
|
||||
* Get trace state to be sent to AccessibilityManager.
|
||||
*/
|
||||
int getTraceStateForAccessibilityManagerClientState();
|
||||
|
||||
/**
|
||||
* Start tracing for the given logging types.
|
||||
*/
|
||||
void startTrace(long flagss);
|
||||
|
||||
/**
|
||||
* Stop tracing.
|
||||
*/
|
||||
void stopTrace();
|
||||
|
||||
/**
|
||||
* Log one trace entry.
|
||||
* @param where A string to identify this log entry, which can be used to search through the
|
||||
* tracing file.
|
||||
* @param loggingFlags Flags to identify which logging types this entry belongs to. This
|
||||
* can be used to filter the log entries when generating tracing file.
|
||||
*/
|
||||
void logTrace(String where, long loggingFlags);
|
||||
|
||||
/**
|
||||
* Log one trace entry.
|
||||
* @param where A string to identify this log entry, which can be used to filter/search
|
||||
* through the tracing file.
|
||||
* @param loggingFlags Flags to identify which logging types this entry belongs to. This
|
||||
* can be used to filter the log entries when generating tracing file.
|
||||
* @param callingParams The parameters for the method to be logged.
|
||||
*/
|
||||
void logTrace(String where, long loggingFlags, String callingParams);
|
||||
|
||||
/**
|
||||
* Log one trace entry. Accessibility services using AccessibilityInteractionClient to
|
||||
* make screen content related requests use this API to log entry when receive callback.
|
||||
* @param timestamp The timestamp when a callback is received.
|
||||
* @param where A string to identify this log entry, which can be used to filter/search
|
||||
* through the tracing file.
|
||||
* @param loggingFlags Flags to identify which logging types this entry belongs to. This
|
||||
* can be used to filter the log entries when generating tracing file.
|
||||
* @param callingParams The parameters for the callback.
|
||||
* @param processId The process id of the calling component.
|
||||
* @param threadId The threadId of the calling component.
|
||||
* @param callingUid The calling uid of the callback.
|
||||
* @param callStack The call stack of the callback.
|
||||
* @param ignoreStackElements ignore these call stack element
|
||||
*/
|
||||
void logTrace(long timestamp, String where, long loggingFlags, String callingParams,
|
||||
int processId, long threadId, int callingUid, StackTraceElement[] callStack,
|
||||
Set<String> ignoreStackElements);
|
||||
}
|
||||
@@ -118,6 +118,6 @@ interface IAccessibilityServiceConnection {
|
||||
|
||||
void setFocusAppearance(int strokeWidth, int color);
|
||||
|
||||
oneway void logTrace(long timestamp, String where, String callingParams, int processId,
|
||||
long threadId, int callingUid, in Bundle serializedCallingStackInBundle);
|
||||
oneway void logTrace(long timestamp, String where, long loggingTypes, String callingParams,
|
||||
int processId, long threadId, int callingUid, in Bundle serializedCallingStackInBundle);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
|
||||
package android.view.accessibility;
|
||||
|
||||
import static android.accessibilityservice.AccessibilityTrace.FLAGS_ACCESSIBILITY_INTERACTION_CLIENT;
|
||||
import static android.accessibilityservice.AccessibilityTrace.FLAGS_ACCESSIBILITY_INTERACTION_CONNECTION_CALLBACK;
|
||||
|
||||
import android.accessibilityservice.IAccessibilityServiceConnection;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
@@ -86,6 +89,7 @@ public final class AccessibilityInteractionClient
|
||||
public static final int NO_ID = -1;
|
||||
|
||||
public static final String CALL_STACK = "call_stack";
|
||||
public static final String IGNORE_CALL_STACK = "ignore_call_stack";
|
||||
|
||||
private static final String LOG_TAG = "AccessibilityInteractionClient";
|
||||
|
||||
@@ -121,6 +125,12 @@ public final class AccessibilityInteractionClient
|
||||
|
||||
private volatile int mInteractionId = -1;
|
||||
private volatile int mCallingUid = Process.INVALID_UID;
|
||||
// call stack for IAccessibilityInteractionConnectionCallback APIs. These callback APIs are
|
||||
// shared by multiple requests APIs in IAccessibilityServiceConnection. To correctly log the
|
||||
// request API which triggers the callback, we log trace entries for callback after the
|
||||
// request API thread waiting for the callback returns. To log the correct callback stack in
|
||||
// the request API thread, we save the callback stack in this member variables.
|
||||
private List<StackTraceElement> mCallStackOfCallback;
|
||||
|
||||
private AccessibilityNodeInfo mFindAccessibilityNodeInfoResult;
|
||||
|
||||
@@ -307,18 +317,30 @@ public final class AccessibilityInteractionClient
|
||||
if (DEBUG) {
|
||||
Log.i(LOG_TAG, "Window cache hit");
|
||||
}
|
||||
if (shouldTraceClient()) {
|
||||
logTraceClient(connection, "getWindow cache",
|
||||
"connectionId=" + connectionId + ";accessibilityWindowId="
|
||||
+ accessibilityWindowId + ";bypassCache=false");
|
||||
}
|
||||
return window;
|
||||
}
|
||||
if (DEBUG) {
|
||||
Log.i(LOG_TAG, "Window cache miss");
|
||||
}
|
||||
}
|
||||
|
||||
final long identityToken = Binder.clearCallingIdentity();
|
||||
try {
|
||||
window = connection.getWindow(accessibilityWindowId);
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(identityToken);
|
||||
}
|
||||
if (shouldTraceClient()) {
|
||||
logTraceClient(connection, "getWindow", "connectionId=" + connectionId
|
||||
+ ";accessibilityWindowId=" + accessibilityWindowId + ";bypassCache="
|
||||
+ bypassCache);
|
||||
}
|
||||
|
||||
if (window != null) {
|
||||
if (!bypassCache) {
|
||||
sAccessibilityCache.addWindow(window);
|
||||
@@ -368,6 +390,10 @@ public final class AccessibilityInteractionClient
|
||||
if (DEBUG) {
|
||||
Log.i(LOG_TAG, "Windows cache hit");
|
||||
}
|
||||
if (shouldTraceClient()) {
|
||||
logTraceClient(
|
||||
connection, "getWindows cache", "connectionId=" + connectionId);
|
||||
}
|
||||
return windows;
|
||||
}
|
||||
if (DEBUG) {
|
||||
@@ -379,6 +405,9 @@ public final class AccessibilityInteractionClient
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(identityToken);
|
||||
}
|
||||
if (shouldTraceClient()) {
|
||||
logTraceClient(connection, "getWindows", "connectionId=" + connectionId);
|
||||
}
|
||||
if (windows != null) {
|
||||
sAccessibilityCache.setWindowsOnAllDisplays(windows);
|
||||
return windows;
|
||||
@@ -472,6 +501,15 @@ public final class AccessibilityInteractionClient
|
||||
Log.i(LOG_TAG, "Node cache hit for "
|
||||
+ idToString(accessibilityWindowId, accessibilityNodeId));
|
||||
}
|
||||
if (shouldTraceClient()) {
|
||||
logTraceClient(connection,
|
||||
"findAccessibilityNodeInfoByAccessibilityId cache",
|
||||
"connectionId=" + connectionId + ";accessibilityWindowId="
|
||||
+ accessibilityWindowId + ";accessibilityNodeId="
|
||||
+ accessibilityNodeId + ";bypassCache=" + bypassCache
|
||||
+ ";prefetchFlags=" + prefetchFlags + ";arguments="
|
||||
+ arguments);
|
||||
}
|
||||
return cachedInfo;
|
||||
}
|
||||
if (DEBUG) {
|
||||
@@ -488,6 +526,14 @@ public final class AccessibilityInteractionClient
|
||||
prefetchFlags &= ~AccessibilityNodeInfo.FLAG_PREFETCH_MASK;
|
||||
}
|
||||
final int interactionId = mInteractionIdCounter.getAndIncrement();
|
||||
if (shouldTraceClient()) {
|
||||
logTraceClient(connection, "findAccessibilityNodeInfoByAccessibilityId",
|
||||
"InteractionId:" + interactionId + "connectionId=" + connectionId
|
||||
+ ";accessibilityWindowId=" + accessibilityWindowId
|
||||
+ ";accessibilityNodeId=" + accessibilityNodeId + ";bypassCache="
|
||||
+ bypassCache + ";prefetchFlags=" + prefetchFlags + ";arguments="
|
||||
+ arguments);
|
||||
}
|
||||
final String[] packageNames;
|
||||
final long identityToken = Binder.clearCallingIdentity();
|
||||
try {
|
||||
@@ -500,16 +546,10 @@ public final class AccessibilityInteractionClient
|
||||
if (packageNames != null) {
|
||||
AccessibilityNodeInfo info =
|
||||
getFindAccessibilityNodeInfoResultAndClear(interactionId);
|
||||
if (mAccessibilityManager != null
|
||||
&& mAccessibilityManager.isAccessibilityTracingEnabled()) {
|
||||
logTrace(connection, "findAccessibilityNodeInfoByAccessibilityId",
|
||||
"InteractionId:" + interactionId + ";Result: " + info
|
||||
+ ";connectionId=" + connectionId
|
||||
+ ";accessibilityWindowId="
|
||||
+ accessibilityWindowId + ";accessibilityNodeId="
|
||||
+ accessibilityNodeId + ";bypassCache=" + bypassCache
|
||||
+ ";prefetchFlags=" + prefetchFlags
|
||||
+ ";arguments=" + arguments);
|
||||
if (shouldTraceCallback()) {
|
||||
logTraceCallback(connection, "findAccessibilityNodeInfoByAccessibilityId",
|
||||
"InteractionId:" + interactionId + ";connectionId="
|
||||
+ connectionId + ";Result: " + info);
|
||||
}
|
||||
if ((prefetchFlags & AccessibilityNodeInfo.FLAG_PREFETCH_MASK) != 0
|
||||
&& info != null) {
|
||||
@@ -571,6 +611,14 @@ public final class AccessibilityInteractionClient
|
||||
final String[] packageNames;
|
||||
final long identityToken = Binder.clearCallingIdentity();
|
||||
try {
|
||||
if (shouldTraceClient()) {
|
||||
logTraceClient(connection, "findAccessibilityNodeInfosByViewId",
|
||||
"InteractionId=" + interactionId + ";connectionId=" + connectionId
|
||||
+ ";accessibilityWindowId=" + accessibilityWindowId
|
||||
+ ";accessibilityNodeId=" + accessibilityNodeId + ";viewId="
|
||||
+ viewId);
|
||||
}
|
||||
|
||||
packageNames = connection.findAccessibilityNodeInfosByViewId(
|
||||
accessibilityWindowId, accessibilityNodeId, viewId, interactionId, this,
|
||||
Thread.currentThread().getId());
|
||||
@@ -581,13 +629,10 @@ public final class AccessibilityInteractionClient
|
||||
if (packageNames != null) {
|
||||
List<AccessibilityNodeInfo> infos = getFindAccessibilityNodeInfosResultAndClear(
|
||||
interactionId);
|
||||
if (mAccessibilityManager != null
|
||||
&& mAccessibilityManager.isAccessibilityTracingEnabled()) {
|
||||
logTrace(connection, "findAccessibilityNodeInfosByViewId", "InteractionId="
|
||||
+ interactionId + ":Result: " + infos + ";connectionId="
|
||||
+ connectionId + ";accessibilityWindowId=" + accessibilityWindowId
|
||||
+ ";accessibilityNodeId=" + accessibilityNodeId + ";viewId="
|
||||
+ viewId);
|
||||
if (shouldTraceCallback()) {
|
||||
logTraceCallback(connection, "findAccessibilityNodeInfosByViewId",
|
||||
"InteractionId=" + interactionId + ";connectionId=" + connectionId
|
||||
+ ":Result: " + infos);
|
||||
}
|
||||
if (infos != null) {
|
||||
finalizeAndCacheAccessibilityNodeInfos(infos, connectionId,
|
||||
@@ -630,6 +675,12 @@ public final class AccessibilityInteractionClient
|
||||
IAccessibilityServiceConnection connection = getConnection(connectionId);
|
||||
if (connection != null) {
|
||||
final int interactionId = mInteractionIdCounter.getAndIncrement();
|
||||
if (shouldTraceClient()) {
|
||||
logTraceClient(connection, "findAccessibilityNodeInfosByText",
|
||||
"InteractionId:" + interactionId + "connectionId=" + connectionId
|
||||
+ ";accessibilityWindowId=" + accessibilityWindowId
|
||||
+ ";accessibilityNodeId=" + accessibilityNodeId + ";text=" + text);
|
||||
}
|
||||
final String[] packageNames;
|
||||
final long identityToken = Binder.clearCallingIdentity();
|
||||
try {
|
||||
@@ -643,12 +694,10 @@ public final class AccessibilityInteractionClient
|
||||
if (packageNames != null) {
|
||||
List<AccessibilityNodeInfo> infos = getFindAccessibilityNodeInfosResultAndClear(
|
||||
interactionId);
|
||||
if (mAccessibilityManager != null
|
||||
&& mAccessibilityManager.isAccessibilityTracingEnabled()) {
|
||||
logTrace(connection, "findAccessibilityNodeInfosByText", "InteractionId="
|
||||
+ interactionId + ":Result: " + infos + ";connectionId="
|
||||
+ connectionId + ";accessibilityWindowId=" + accessibilityWindowId
|
||||
+ ";accessibilityNodeId=" + accessibilityNodeId + ";text=" + text);
|
||||
if (shouldTraceCallback()) {
|
||||
logTraceCallback(connection, "findAccessibilityNodeInfosByText",
|
||||
"InteractionId=" + interactionId + ";connectionId=" + connectionId
|
||||
+ ";Result: " + infos);
|
||||
}
|
||||
if (infos != null) {
|
||||
finalizeAndCacheAccessibilityNodeInfos(infos, connectionId,
|
||||
@@ -690,6 +739,13 @@ public final class AccessibilityInteractionClient
|
||||
IAccessibilityServiceConnection connection = getConnection(connectionId);
|
||||
if (connection != null) {
|
||||
final int interactionId = mInteractionIdCounter.getAndIncrement();
|
||||
if (shouldTraceClient()) {
|
||||
logTraceClient(connection, "findFocus",
|
||||
"InteractionId:" + interactionId + "connectionId=" + connectionId
|
||||
+ ";accessibilityWindowId=" + accessibilityWindowId
|
||||
+ ";accessibilityNodeId=" + accessibilityNodeId + ";focusType="
|
||||
+ focusType);
|
||||
}
|
||||
final String[] packageNames;
|
||||
final long identityToken = Binder.clearCallingIdentity();
|
||||
try {
|
||||
@@ -703,13 +759,9 @@ public final class AccessibilityInteractionClient
|
||||
if (packageNames != null) {
|
||||
AccessibilityNodeInfo info = getFindAccessibilityNodeInfoResultAndClear(
|
||||
interactionId);
|
||||
if (mAccessibilityManager != null
|
||||
&& mAccessibilityManager.isAccessibilityTracingEnabled()) {
|
||||
logTrace(connection, "findFocus", "InteractionId=" + interactionId
|
||||
+ ":Result: " + info + ";connectionId=" + connectionId
|
||||
+ ";accessibilityWindowId=" + accessibilityWindowId
|
||||
+ ";accessibilityNodeId=" + accessibilityNodeId + ";focusType="
|
||||
+ focusType);
|
||||
if (shouldTraceCallback()) {
|
||||
logTraceCallback(connection, "findFocus", "InteractionId=" + interactionId
|
||||
+ ";connectionId=" + connectionId + ";Result:" + info);
|
||||
}
|
||||
finalizeAndCacheAccessibilityNodeInfo(info, connectionId, false, packageNames);
|
||||
return info;
|
||||
@@ -747,6 +799,13 @@ public final class AccessibilityInteractionClient
|
||||
IAccessibilityServiceConnection connection = getConnection(connectionId);
|
||||
if (connection != null) {
|
||||
final int interactionId = mInteractionIdCounter.getAndIncrement();
|
||||
if (shouldTraceClient()) {
|
||||
logTraceClient(connection, "focusSearch",
|
||||
"InteractionId:" + interactionId + "connectionId=" + connectionId
|
||||
+ ";accessibilityWindowId=" + accessibilityWindowId
|
||||
+ ";accessibilityNodeId=" + accessibilityNodeId + ";direction="
|
||||
+ direction);
|
||||
}
|
||||
final String[] packageNames;
|
||||
final long identityToken = Binder.clearCallingIdentity();
|
||||
try {
|
||||
@@ -761,13 +820,9 @@ public final class AccessibilityInteractionClient
|
||||
AccessibilityNodeInfo info = getFindAccessibilityNodeInfoResultAndClear(
|
||||
interactionId);
|
||||
finalizeAndCacheAccessibilityNodeInfo(info, connectionId, false, packageNames);
|
||||
if (mAccessibilityManager != null
|
||||
&& mAccessibilityManager.isAccessibilityTracingEnabled()) {
|
||||
logTrace(connection, "focusSearch", "InteractionId=" + interactionId
|
||||
+ ":Result: " + info + ";connectionId=" + connectionId
|
||||
+ ";accessibilityWindowId=" + accessibilityWindowId
|
||||
+ ";accessibilityNodeId=" + accessibilityNodeId + ";direction="
|
||||
+ direction);
|
||||
if (shouldTraceCallback()) {
|
||||
logTraceCallback(connection, "focusSearch", "InteractionId=" + interactionId
|
||||
+ ";connectionId=" + connectionId + ";Result:" + info);
|
||||
}
|
||||
return info;
|
||||
}
|
||||
@@ -803,6 +858,13 @@ public final class AccessibilityInteractionClient
|
||||
IAccessibilityServiceConnection connection = getConnection(connectionId);
|
||||
if (connection != null) {
|
||||
final int interactionId = mInteractionIdCounter.getAndIncrement();
|
||||
if (shouldTraceClient()) {
|
||||
logTraceClient(connection, "performAccessibilityAction",
|
||||
"InteractionId:" + interactionId + "connectionId=" + connectionId
|
||||
+ ";accessibilityWindowId=" + accessibilityWindowId
|
||||
+ ";accessibilityNodeId=" + accessibilityNodeId + ";action=" + action
|
||||
+ ";arguments=" + arguments);
|
||||
}
|
||||
final boolean success;
|
||||
final long identityToken = Binder.clearCallingIdentity();
|
||||
try {
|
||||
@@ -816,13 +878,10 @@ public final class AccessibilityInteractionClient
|
||||
if (success) {
|
||||
final boolean result =
|
||||
getPerformAccessibilityActionResultAndClear(interactionId);
|
||||
if (mAccessibilityManager != null
|
||||
&& mAccessibilityManager.isAccessibilityTracingEnabled()) {
|
||||
logTrace(connection, "performAccessibilityAction", "InteractionId="
|
||||
+ interactionId + ":Result: " + result + ";connectionId="
|
||||
+ connectionId + ";accessibilityWindowId=" + accessibilityWindowId
|
||||
+ ";accessibilityNodeId=" + accessibilityNodeId + ";action="
|
||||
+ action + ";arguments=" + arguments);
|
||||
if (shouldTraceCallback()) {
|
||||
logTraceCallback(connection, "performAccessibilityAction",
|
||||
"InteractionId=" + interactionId + ";connectionId=" + connectionId
|
||||
+ ";Result: " + result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -883,6 +942,8 @@ public final class AccessibilityInteractionClient
|
||||
mFindAccessibilityNodeInfoResult = info;
|
||||
mInteractionId = interactionId;
|
||||
mCallingUid = Binder.getCallingUid();
|
||||
mCallStackOfCallback = new ArrayList<StackTraceElement>(
|
||||
Arrays.asList(Thread.currentThread().getStackTrace()));
|
||||
}
|
||||
mInstanceLock.notifyAll();
|
||||
}
|
||||
@@ -933,6 +994,8 @@ public final class AccessibilityInteractionClient
|
||||
}
|
||||
mInteractionId = interactionId;
|
||||
mCallingUid = Binder.getCallingUid();
|
||||
mCallStackOfCallback = new ArrayList<StackTraceElement>(
|
||||
Arrays.asList(Thread.currentThread().getStackTrace()));
|
||||
}
|
||||
mInstanceLock.notifyAll();
|
||||
}
|
||||
@@ -972,13 +1035,15 @@ public final class AccessibilityInteractionClient
|
||||
finalizeAndCacheAccessibilityNodeInfos(
|
||||
infos, connectionIdWaitingForPrefetchResultCopy, false,
|
||||
packageNamesForNextPrefetchResultCopy);
|
||||
if (mAccessibilityManager != null
|
||||
&& mAccessibilityManager.isAccessibilityTracingEnabled()) {
|
||||
if (shouldTraceCallback()) {
|
||||
logTrace(getConnection(connectionIdWaitingForPrefetchResultCopy),
|
||||
"setPrefetchAccessibilityNodeInfoResult",
|
||||
"InteractionId:" + interactionId + ";Result: " + infos
|
||||
+ ";connectionId=" + connectionIdWaitingForPrefetchResultCopy,
|
||||
Binder.getCallingUid());
|
||||
"InteractionId:" + interactionId + ";connectionId="
|
||||
+ connectionIdWaitingForPrefetchResultCopy + ";Result: " + infos,
|
||||
Binder.getCallingUid(),
|
||||
Arrays.asList(Thread.currentThread().getStackTrace()),
|
||||
new HashSet<String>(Arrays.asList("getStackTrace")),
|
||||
FLAGS_ACCESSIBILITY_INTERACTION_CONNECTION_CALLBACK);
|
||||
}
|
||||
} else if (DEBUG) {
|
||||
Log.w(LOG_TAG, "Prefetching for interaction with id " + interactionId + " dropped "
|
||||
@@ -1010,6 +1075,8 @@ public final class AccessibilityInteractionClient
|
||||
mPerformAccessibilityActionResult = succeeded;
|
||||
mInteractionId = interactionId;
|
||||
mCallingUid = Binder.getCallingUid();
|
||||
mCallStackOfCallback = new ArrayList<StackTraceElement>(
|
||||
Arrays.asList(Thread.currentThread().getStackTrace()));
|
||||
}
|
||||
mInstanceLock.notifyAll();
|
||||
}
|
||||
@@ -1219,24 +1286,45 @@ public final class AccessibilityInteractionClient
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean shouldTraceClient() {
|
||||
return (mAccessibilityManager != null)
|
||||
&& mAccessibilityManager.isA11yInteractionClientTraceEnabled();
|
||||
}
|
||||
|
||||
private boolean shouldTraceCallback() {
|
||||
return (mAccessibilityManager != null)
|
||||
&& mAccessibilityManager.isA11yInteractionConnectionCBTraceEnabled();
|
||||
}
|
||||
|
||||
private void logTrace(
|
||||
IAccessibilityServiceConnection connection, String method, String params,
|
||||
int callingUid) {
|
||||
int callingUid, List<StackTraceElement> callStack, HashSet<String> ignoreSet,
|
||||
long logTypes) {
|
||||
try {
|
||||
Bundle b = new Bundle();
|
||||
ArrayList<StackTraceElement> callStack = new ArrayList<StackTraceElement>(
|
||||
Arrays.asList(Thread.currentThread().getStackTrace()));
|
||||
b.putSerializable(CALL_STACK, callStack);
|
||||
b.putSerializable(CALL_STACK, new ArrayList<StackTraceElement>(callStack));
|
||||
if (ignoreSet != null) {
|
||||
b.putSerializable(IGNORE_CALL_STACK, ignoreSet);
|
||||
}
|
||||
connection.logTrace(SystemClock.elapsedRealtimeNanos(),
|
||||
LOG_TAG + ".callback for " + method, params, Process.myPid(),
|
||||
Thread.currentThread().getId(), callingUid, b);
|
||||
LOG_TAG + "." + method,
|
||||
logTypes, params, Process.myPid(), Thread.currentThread().getId(),
|
||||
callingUid, b);
|
||||
} catch (RemoteException e) {
|
||||
Log.e(LOG_TAG, "Failed to log trace. " + e);
|
||||
}
|
||||
}
|
||||
|
||||
private void logTrace(
|
||||
private void logTraceCallback(
|
||||
IAccessibilityServiceConnection connection, String method, String params) {
|
||||
logTrace(connection, method, params, mCallingUid);
|
||||
logTrace(connection, method + " callback", params, mCallingUid, mCallStackOfCallback,
|
||||
new HashSet<String>(Arrays.asList("getStackTrace")),
|
||||
FLAGS_ACCESSIBILITY_INTERACTION_CONNECTION_CALLBACK);
|
||||
}
|
||||
|
||||
private void logTraceClient(
|
||||
IAccessibilityServiceConnection connection, String method, String params) {
|
||||
logTrace(connection, method, params, Binder.getCallingUid(),
|
||||
Collections.emptyList(), null, FLAGS_ACCESSIBILITY_INTERACTION_CLIENT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,7 +111,13 @@ public final class AccessibilityManager {
|
||||
public static final int STATE_FLAG_REQUEST_MULTI_FINGER_GESTURES = 0x00000010;
|
||||
|
||||
/** @hide */
|
||||
public static final int STATE_FLAG_ACCESSIBILITY_TRACING_ENABLED = 0x00000020;
|
||||
public static final int STATE_FLAG_TRACE_A11Y_INTERACTION_CONNECTION_ENABLED = 0x00000100;
|
||||
/** @hide */
|
||||
public static final int STATE_FLAG_TRACE_A11Y_INTERACTION_CONNECTION_CB_ENABLED = 0x00000200;
|
||||
/** @hide */
|
||||
public static final int STATE_FLAG_TRACE_A11Y_INTERACTION_CLIENT_ENABLED = 0x00000400;
|
||||
/** @hide */
|
||||
public static final int STATE_FLAG_TRACE_A11Y_SERVICE_ENABLED = 0x00000800;
|
||||
|
||||
/** @hide */
|
||||
public static final int DALTONIZER_DISABLED = -1;
|
||||
@@ -235,8 +241,8 @@ public final class AccessibilityManager {
|
||||
@UnsupportedAppUsage(trackingBug = 123768939L)
|
||||
boolean mIsHighTextContrastEnabled;
|
||||
|
||||
// Whether accessibility tracing is enabled or not
|
||||
boolean mIsAccessibilityTracingEnabled = false;
|
||||
// accessibility tracing state
|
||||
int mAccessibilityTracingState = 0;
|
||||
|
||||
AccessibilityPolicy mAccessibilityPolicy;
|
||||
|
||||
@@ -1010,13 +1016,50 @@ public final class AccessibilityManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets accessibility tracing enabled state.
|
||||
* Gets accessibility interaction connection tracing enabled state.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public boolean isAccessibilityTracingEnabled() {
|
||||
public boolean isA11yInteractionConnectionTraceEnabled() {
|
||||
synchronized (mLock) {
|
||||
return mIsAccessibilityTracingEnabled;
|
||||
return ((mAccessibilityTracingState
|
||||
& STATE_FLAG_TRACE_A11Y_INTERACTION_CONNECTION_ENABLED) != 0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets accessibility interaction connection callback tracing enabled state.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public boolean isA11yInteractionConnectionCBTraceEnabled() {
|
||||
synchronized (mLock) {
|
||||
return ((mAccessibilityTracingState
|
||||
& STATE_FLAG_TRACE_A11Y_INTERACTION_CONNECTION_CB_ENABLED) != 0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets accessibility interaction client tracing enabled state.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public boolean isA11yInteractionClientTraceEnabled() {
|
||||
synchronized (mLock) {
|
||||
return ((mAccessibilityTracingState
|
||||
& STATE_FLAG_TRACE_A11Y_INTERACTION_CLIENT_ENABLED) != 0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets accessibility service tracing enabled state.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public boolean isA11yServiceTraceEnabled() {
|
||||
synchronized (mLock) {
|
||||
return ((mAccessibilityTracingState
|
||||
& STATE_FLAG_TRACE_A11Y_SERVICE_ENABLED) != 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1214,8 +1257,6 @@ public final class AccessibilityManager {
|
||||
(stateFlags & STATE_FLAG_TOUCH_EXPLORATION_ENABLED) != 0;
|
||||
final boolean highTextContrastEnabled =
|
||||
(stateFlags & STATE_FLAG_HIGH_TEXT_CONTRAST_ENABLED) != 0;
|
||||
final boolean accessibilityTracingEnabled =
|
||||
(stateFlags & STATE_FLAG_ACCESSIBILITY_TRACING_ENABLED) != 0;
|
||||
|
||||
final boolean wasEnabled = isEnabled();
|
||||
final boolean wasTouchExplorationEnabled = mIsTouchExplorationEnabled;
|
||||
@@ -1238,7 +1279,7 @@ public final class AccessibilityManager {
|
||||
notifyHighTextContrastStateChanged();
|
||||
}
|
||||
|
||||
updateAccessibilityTracingState(accessibilityTracingEnabled);
|
||||
updateAccessibilityTracingState(stateFlags);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1696,11 +1737,11 @@ public final class AccessibilityManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Update mIsAccessibilityTracingEnabled.
|
||||
* Update mAccessibilityTracingState.
|
||||
*/
|
||||
private void updateAccessibilityTracingState(boolean enabled) {
|
||||
private void updateAccessibilityTracingState(int stateFlag) {
|
||||
synchronized (mLock) {
|
||||
mIsAccessibilityTracingEnabled = enabled;
|
||||
mAccessibilityTracingState = stateFlag;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -46,17 +46,17 @@ message AccessibilityTraceProto {
|
||||
/* required: elapsed realtime in nanos since boot of when this entry was logged */
|
||||
optional fixed64 elapsed_realtime_nanos = 1;
|
||||
optional string calendar_time = 2;
|
||||
|
||||
optional string process_name = 3;
|
||||
optional string thread_id_name = 4;
|
||||
repeated string logging_type = 3;
|
||||
optional string process_name = 4;
|
||||
optional string thread_id_name = 5;
|
||||
|
||||
/* where the trace originated */
|
||||
optional string where = 5;
|
||||
optional string where = 6;
|
||||
|
||||
optional string calling_pkg = 6;
|
||||
optional string calling_params = 7;
|
||||
optional string calling_stacks = 8;
|
||||
optional string calling_pkg = 7;
|
||||
optional string calling_params = 8;
|
||||
optional string calling_stacks = 9;
|
||||
|
||||
optional AccessibilityDumpProto accessibility_service = 9;
|
||||
optional com.android.server.wm.WindowManagerServiceDumpProto window_manager_service = 10;
|
||||
optional AccessibilityDumpProto accessibility_service = 10;
|
||||
optional com.android.server.wm.WindowManagerServiceDumpProto window_manager_service = 11;
|
||||
}
|
||||
|
||||
@@ -166,4 +166,7 @@ public class AccessibilityServiceConnectionImpl extends IAccessibilityServiceCon
|
||||
|
||||
public void logTrace(long timestamp, String where, String callingParams, int processId,
|
||||
long threadId, int callingUid, Bundle callingStack) {}
|
||||
|
||||
public void logTrace(long timestamp, String where, long loggingTypes, String callingParams,
|
||||
int processId, long threadId, int callingUid, Bundle serializedCallingStackInBundle) {}
|
||||
}
|
||||
|
||||
@@ -21,8 +21,13 @@ import static android.accessibilityservice.AccessibilityService.KEY_ACCESSIBILIT
|
||||
import static android.accessibilityservice.AccessibilityService.KEY_ACCESSIBILITY_SCREENSHOT_STATUS;
|
||||
import static android.accessibilityservice.AccessibilityService.KEY_ACCESSIBILITY_SCREENSHOT_TIMESTAMP;
|
||||
import static android.accessibilityservice.AccessibilityServiceInfo.DEFAULT;
|
||||
import static android.accessibilityservice.AccessibilityTrace.FLAGS_ACCESSIBILITY_INTERACTION_CONNECTION;
|
||||
import static android.accessibilityservice.AccessibilityTrace.FLAGS_ACCESSIBILITY_SERVICE_CLIENT;
|
||||
import static android.accessibilityservice.AccessibilityTrace.FLAGS_ACCESSIBILITY_SERVICE_CONNECTION;
|
||||
import static android.accessibilityservice.AccessibilityTrace.FLAGS_WINDOW_MANAGER_INTERNAL;
|
||||
import static android.view.WindowManager.LayoutParams.TYPE_ACCESSIBILITY_OVERLAY;
|
||||
import static android.view.accessibility.AccessibilityInteractionClient.CALL_STACK;
|
||||
import static android.view.accessibility.AccessibilityInteractionClient.IGNORE_CALL_STACK;
|
||||
import static android.view.accessibility.AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS;
|
||||
import static android.view.accessibility.AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS;
|
||||
import static android.view.accessibility.AccessibilityNodeInfo.ACTION_CLICK;
|
||||
@@ -31,6 +36,7 @@ import static android.view.accessibility.AccessibilityNodeInfo.ACTION_LONG_CLICK
|
||||
import android.accessibilityservice.AccessibilityGestureEvent;
|
||||
import android.accessibilityservice.AccessibilityService;
|
||||
import android.accessibilityservice.AccessibilityServiceInfo;
|
||||
import android.accessibilityservice.AccessibilityTrace;
|
||||
import android.accessibilityservice.IAccessibilityServiceClient;
|
||||
import android.accessibilityservice.IAccessibilityServiceConnection;
|
||||
import android.annotation.NonNull;
|
||||
@@ -103,10 +109,9 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
|
||||
FingerprintGestureDispatcher.FingerprintGestureClient {
|
||||
private static final boolean DEBUG = false;
|
||||
private static final String LOG_TAG = "AbstractAccessibilityServiceConnection";
|
||||
private static final String TRACE_A11Y_SERVICE_CONNECTION =
|
||||
LOG_TAG + ".IAccessibilityServiceConnection";
|
||||
private static final String TRACE_A11Y_SERVICE_CLIENT =
|
||||
LOG_TAG + ".IAccessibilityServiceClient";
|
||||
private static final String TRACE_SVC_CONN = LOG_TAG + ".IAccessibilityServiceConnection";
|
||||
private static final String TRACE_SVC_CLIENT = LOG_TAG + ".IAccessibilityServiceClient";
|
||||
private static final String TRACE_WM = "WindowManagerInternal";
|
||||
private static final int WAIT_WINDOWS_TIMEOUT_MILLIS = 5000;
|
||||
|
||||
protected static final String TAKE_SCREENSHOT = "takeScreenshot";
|
||||
@@ -298,9 +303,8 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
if (mTrace.isA11yTracingEnabled()) {
|
||||
mTrace.logTrace(TRACE_A11Y_SERVICE_CLIENT + ".onKeyEvent",
|
||||
keyEvent + ", " + sequenceNumber);
|
||||
if (svcClientTracingEnabled()) {
|
||||
logTraceSvcClient("onKeyEvent", keyEvent + ", " + sequenceNumber);
|
||||
}
|
||||
mServiceInterface.onKeyEvent(keyEvent, sequenceNumber);
|
||||
} catch (RemoteException e) {
|
||||
@@ -365,17 +369,16 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
|
||||
|
||||
@Override
|
||||
public void setOnKeyEventResult(boolean handled, int sequence) {
|
||||
if (mTrace.isA11yTracingEnabled()) {
|
||||
mTrace.logTrace(TRACE_A11Y_SERVICE_CONNECTION + ".setOnKeyEventResult",
|
||||
"handled=" + handled + ";sequence=" + sequence);
|
||||
if (svcConnTracingEnabled()) {
|
||||
logTraceSvcConn("setOnKeyEventResult", "handled=" + handled + ";sequence=" + sequence);
|
||||
}
|
||||
mSystemSupport.getKeyEventDispatcher().setOnKeyEventResult(this, handled, sequence);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccessibilityServiceInfo getServiceInfo() {
|
||||
if (mTrace.isA11yTracingEnabled()) {
|
||||
mTrace.logTrace(TRACE_A11Y_SERVICE_CONNECTION + ".getServiceInfo");
|
||||
if (svcConnTracingEnabled()) {
|
||||
logTraceSvcConn("getServiceInfo", "");
|
||||
}
|
||||
synchronized (mLock) {
|
||||
return mAccessibilityServiceInfo;
|
||||
@@ -393,8 +396,8 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
|
||||
|
||||
@Override
|
||||
public void setServiceInfo(AccessibilityServiceInfo info) {
|
||||
if (mTrace.isA11yTracingEnabled()) {
|
||||
mTrace.logTrace(TRACE_A11Y_SERVICE_CONNECTION + ".setServiceInfo", "info=" + info);
|
||||
if (svcConnTracingEnabled()) {
|
||||
logTraceSvcConn("setServiceInfo", "info=" + info);
|
||||
}
|
||||
final long identity = Binder.clearCallingIdentity();
|
||||
try {
|
||||
@@ -421,8 +424,8 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
|
||||
@Nullable
|
||||
@Override
|
||||
public AccessibilityWindowInfo.WindowListSparseArray getWindows() {
|
||||
if (mTrace.isA11yTracingEnabled()) {
|
||||
mTrace.logTrace(TRACE_A11Y_SERVICE_CONNECTION + ".getWindows");
|
||||
if (svcConnTracingEnabled()) {
|
||||
logTraceSvcConn("getWindows", "");
|
||||
}
|
||||
synchronized (mLock) {
|
||||
if (!hasRightsToCurrentUserLocked()) {
|
||||
@@ -458,8 +461,8 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
|
||||
|
||||
@Override
|
||||
public AccessibilityWindowInfo getWindow(int windowId) {
|
||||
if (mTrace.isA11yTracingEnabled()) {
|
||||
mTrace.logTrace(TRACE_A11Y_SERVICE_CONNECTION + ".getWindow", "windowId=" + windowId);
|
||||
if (svcConnTracingEnabled()) {
|
||||
logTraceSvcConn("getWindow", "windowId=" + windowId);
|
||||
}
|
||||
synchronized (mLock) {
|
||||
int displayId = Display.INVALID_DISPLAY;
|
||||
@@ -496,8 +499,8 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
|
||||
long accessibilityNodeId, String viewIdResName, int interactionId,
|
||||
IAccessibilityInteractionConnectionCallback callback, long interrogatingTid)
|
||||
throws RemoteException {
|
||||
if (mTrace.isA11yTracingEnabled()) {
|
||||
mTrace.logTrace(TRACE_A11Y_SERVICE_CONNECTION + ".findAccessibilityNodeInfosByViewId",
|
||||
if (svcConnTracingEnabled()) {
|
||||
logTraceSvcConn("findAccessibilityNodeInfosByViewId",
|
||||
"accessibilityWindowId=" + accessibilityWindowId + ";accessibilityNodeId="
|
||||
+ accessibilityNodeId + ";viewIdResName=" + viewIdResName + ";interactionId="
|
||||
+ interactionId + ";callback=" + callback + ";interrogatingTid="
|
||||
@@ -539,6 +542,12 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
|
||||
callback = replaceCallbackIfNeeded(callback, resolvedWindowId, interactionId,
|
||||
interrogatingPid, interrogatingTid);
|
||||
final long identityToken = Binder.clearCallingIdentity();
|
||||
if (intConnTracingEnabled()) {
|
||||
logTraceIntConn("findAccessibilityNodeInfosByViewId",
|
||||
accessibilityNodeId + ";" + viewIdResName + ";" + partialInteractiveRegion + ";"
|
||||
+ interactionId + ";" + callback + ";" + mFetchFlags + ";" + interrogatingPid
|
||||
+ ";" + interrogatingTid + ";" + spec);
|
||||
}
|
||||
try {
|
||||
connection.getRemote().findAccessibilityNodeInfosByViewId(accessibilityNodeId,
|
||||
viewIdResName, partialInteractiveRegion, interactionId, callback, mFetchFlags,
|
||||
@@ -564,8 +573,8 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
|
||||
long accessibilityNodeId, String text, int interactionId,
|
||||
IAccessibilityInteractionConnectionCallback callback, long interrogatingTid)
|
||||
throws RemoteException {
|
||||
if (mTrace.isA11yTracingEnabled()) {
|
||||
mTrace.logTrace(TRACE_A11Y_SERVICE_CONNECTION + ".findAccessibilityNodeInfosByText",
|
||||
if (svcConnTracingEnabled()) {
|
||||
logTraceSvcConn("findAccessibilityNodeInfosByText",
|
||||
"accessibilityWindowId=" + accessibilityWindowId + ";accessibilityNodeId="
|
||||
+ accessibilityNodeId + ";text=" + text + ";interactionId=" + interactionId
|
||||
+ ";callback=" + callback + ";interrogatingTid=" + interrogatingTid);
|
||||
@@ -606,6 +615,12 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
|
||||
callback = replaceCallbackIfNeeded(callback, resolvedWindowId, interactionId,
|
||||
interrogatingPid, interrogatingTid);
|
||||
final long identityToken = Binder.clearCallingIdentity();
|
||||
if (intConnTracingEnabled()) {
|
||||
logTraceIntConn("findAccessibilityNodeInfosByText",
|
||||
accessibilityNodeId + ";" + text + ";" + partialInteractiveRegion + ";"
|
||||
+ interactionId + ";" + callback + ";" + mFetchFlags + ";" + interrogatingPid
|
||||
+ ";" + interrogatingTid + ";" + spec);
|
||||
}
|
||||
try {
|
||||
connection.getRemote().findAccessibilityNodeInfosByText(accessibilityNodeId,
|
||||
text, partialInteractiveRegion, interactionId, callback, mFetchFlags,
|
||||
@@ -631,13 +646,12 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
|
||||
int accessibilityWindowId, long accessibilityNodeId, int interactionId,
|
||||
IAccessibilityInteractionConnectionCallback callback, int flags,
|
||||
long interrogatingTid, Bundle arguments) throws RemoteException {
|
||||
if (mTrace.isA11yTracingEnabled()) {
|
||||
mTrace.logTrace(
|
||||
TRACE_A11Y_SERVICE_CONNECTION + ".findAccessibilityNodeInfoByAccessibilityId",
|
||||
if (svcConnTracingEnabled()) {
|
||||
logTraceSvcConn("findAccessibilityNodeInfoByAccessibilityId",
|
||||
"accessibilityWindowId=" + accessibilityWindowId + ";accessibilityNodeId="
|
||||
+ accessibilityNodeId + ";interactionId=" + interactionId + ";callback="
|
||||
+ callback + ";flags=" + flags + ";interrogatingTid=" + interrogatingTid
|
||||
+ ";arguments=" + arguments);
|
||||
+ accessibilityNodeId + ";interactionId=" + interactionId + ";callback="
|
||||
+ callback + ";flags=" + flags + ";interrogatingTid=" + interrogatingTid
|
||||
+ ";arguments=" + arguments);
|
||||
}
|
||||
final int resolvedWindowId;
|
||||
RemoteAccessibilityConnection connection;
|
||||
@@ -675,6 +689,12 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
|
||||
callback = replaceCallbackIfNeeded(callback, resolvedWindowId, interactionId,
|
||||
interrogatingPid, interrogatingTid);
|
||||
final long identityToken = Binder.clearCallingIdentity();
|
||||
if (intConnTracingEnabled()) {
|
||||
logTraceIntConn("findAccessibilityNodeInfoByAccessibilityId",
|
||||
accessibilityNodeId + ";" + partialInteractiveRegion + ";" + interactionId + ";"
|
||||
+ callback + ";" + (mFetchFlags | flags) + ";" + interrogatingPid + ";"
|
||||
+ interrogatingTid + ";" + spec + ";" + arguments);
|
||||
}
|
||||
try {
|
||||
connection.getRemote().findAccessibilityNodeInfoByAccessibilityId(
|
||||
accessibilityNodeId, partialInteractiveRegion, interactionId, callback,
|
||||
@@ -700,12 +720,12 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
|
||||
int focusType, int interactionId,
|
||||
IAccessibilityInteractionConnectionCallback callback, long interrogatingTid)
|
||||
throws RemoteException {
|
||||
if (mTrace.isA11yTracingEnabled()) {
|
||||
mTrace.logTrace(TRACE_A11Y_SERVICE_CONNECTION + ".findFocus",
|
||||
if (svcConnTracingEnabled()) {
|
||||
logTraceSvcConn("findFocus",
|
||||
"accessibilityWindowId=" + accessibilityWindowId + ";accessibilityNodeId="
|
||||
+ accessibilityNodeId + ";focusType=" + focusType + ";interactionId="
|
||||
+ interactionId + ";callback=" + callback + ";interrogatingTid="
|
||||
+ interrogatingTid);
|
||||
+ accessibilityNodeId + ";focusType=" + focusType + ";interactionId="
|
||||
+ interactionId + ";callback=" + callback + ";interrogatingTid="
|
||||
+ interrogatingTid);
|
||||
}
|
||||
final int resolvedWindowId;
|
||||
RemoteAccessibilityConnection connection;
|
||||
@@ -743,6 +763,12 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
|
||||
callback = replaceCallbackIfNeeded(callback, resolvedWindowId, interactionId,
|
||||
interrogatingPid, interrogatingTid);
|
||||
final long identityToken = Binder.clearCallingIdentity();
|
||||
if (intConnTracingEnabled()) {
|
||||
logTraceIntConn("findFocus",
|
||||
accessibilityNodeId + ";" + focusType + ";" + partialInteractiveRegion + ";"
|
||||
+ interactionId + ";" + callback + ";" + mFetchFlags + ";" + interrogatingPid
|
||||
+ ";" + interrogatingTid + ";" + spec);
|
||||
}
|
||||
try {
|
||||
connection.getRemote().findFocus(accessibilityNodeId, focusType,
|
||||
partialInteractiveRegion, interactionId, callback, mFetchFlags,
|
||||
@@ -768,12 +794,12 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
|
||||
int direction, int interactionId,
|
||||
IAccessibilityInteractionConnectionCallback callback, long interrogatingTid)
|
||||
throws RemoteException {
|
||||
if (mTrace.isA11yTracingEnabled()) {
|
||||
mTrace.logTrace(TRACE_A11Y_SERVICE_CONNECTION + ".focusSearch",
|
||||
if (svcConnTracingEnabled()) {
|
||||
logTraceSvcConn("focusSearch",
|
||||
"accessibilityWindowId=" + accessibilityWindowId + ";accessibilityNodeId="
|
||||
+ accessibilityNodeId + ";direction=" + direction + ";interactionId="
|
||||
+ interactionId + ";callback=" + callback + ";interrogatingTid="
|
||||
+ interrogatingTid);
|
||||
+ accessibilityNodeId + ";direction=" + direction + ";interactionId="
|
||||
+ interactionId + ";callback=" + callback + ";interrogatingTid="
|
||||
+ interrogatingTid);
|
||||
}
|
||||
final int resolvedWindowId;
|
||||
RemoteAccessibilityConnection connection;
|
||||
@@ -810,6 +836,12 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
|
||||
callback = replaceCallbackIfNeeded(callback, resolvedWindowId, interactionId,
|
||||
interrogatingPid, interrogatingTid);
|
||||
final long identityToken = Binder.clearCallingIdentity();
|
||||
if (intConnTracingEnabled()) {
|
||||
logTraceIntConn("focusSearch",
|
||||
accessibilityNodeId + ";" + direction + ";" + partialInteractiveRegion
|
||||
+ ";" + interactionId + ";" + callback + ";" + mFetchFlags + ";"
|
||||
+ interrogatingPid + ";" + interrogatingTid + ";" + spec);
|
||||
}
|
||||
try {
|
||||
connection.getRemote().focusSearch(accessibilityNodeId, direction,
|
||||
partialInteractiveRegion, interactionId, callback, mFetchFlags,
|
||||
@@ -832,17 +864,17 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
|
||||
|
||||
@Override
|
||||
public void sendGesture(int sequence, ParceledListSlice gestureSteps) {
|
||||
if (mTrace.isA11yTracingEnabled()) {
|
||||
mTrace.logTrace(TRACE_A11Y_SERVICE_CONNECTION + ".sendGesture",
|
||||
"sequence=" + sequence + ";gestureSteps=" + gestureSteps);
|
||||
if (svcConnTracingEnabled()) {
|
||||
logTraceSvcConn(
|
||||
"sendGesture", "sequence=" + sequence + ";gestureSteps=" + gestureSteps);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispatchGesture(int sequence, ParceledListSlice gestureSteps, int displayId) {
|
||||
if (mTrace.isA11yTracingEnabled()) {
|
||||
mTrace.logTrace(TRACE_A11Y_SERVICE_CONNECTION + ".dispatchGesture", "sequence="
|
||||
+ sequence + ";gestureSteps=" + gestureSteps + ";displayId=" + displayId);
|
||||
if (svcConnTracingEnabled()) {
|
||||
logTraceSvcConn("dispatchGesture", "sequence=" + sequence + ";gestureSteps="
|
||||
+ gestureSteps + ";displayId=" + displayId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -851,12 +883,12 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
|
||||
long accessibilityNodeId, int action, Bundle arguments, int interactionId,
|
||||
IAccessibilityInteractionConnectionCallback callback, long interrogatingTid)
|
||||
throws RemoteException {
|
||||
if (mTrace.isA11yTracingEnabled()) {
|
||||
mTrace.logTrace(TRACE_A11Y_SERVICE_CONNECTION + ".performAccessibilityAction",
|
||||
if (svcConnTracingEnabled()) {
|
||||
logTraceSvcConn("performAccessibilityAction",
|
||||
"accessibilityWindowId=" + accessibilityWindowId + ";accessibilityNodeId="
|
||||
+ accessibilityNodeId + ";action=" + action + ";arguments=" + arguments
|
||||
+ ";interactionId=" + interactionId + ";callback=" + callback
|
||||
+ ";interrogatingTid=" + interrogatingTid);
|
||||
+ accessibilityNodeId + ";action=" + action + ";arguments=" + arguments
|
||||
+ ";interactionId=" + interactionId + ";callback=" + callback
|
||||
+ ";interrogatingTid=" + interrogatingTid);
|
||||
}
|
||||
final int resolvedWindowId;
|
||||
synchronized (mLock) {
|
||||
@@ -879,9 +911,8 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
|
||||
|
||||
@Override
|
||||
public boolean performGlobalAction(int action) {
|
||||
if (mTrace.isA11yTracingEnabled()) {
|
||||
mTrace.logTrace(TRACE_A11Y_SERVICE_CONNECTION + ".performGlobalAction",
|
||||
"action=" + action);
|
||||
if (svcConnTracingEnabled()) {
|
||||
logTraceSvcConn("performGlobalAction", "action=" + action);
|
||||
}
|
||||
synchronized (mLock) {
|
||||
if (!hasRightsToCurrentUserLocked()) {
|
||||
@@ -893,8 +924,8 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
|
||||
|
||||
@Override
|
||||
public @NonNull List<AccessibilityNodeInfo.AccessibilityAction> getSystemActions() {
|
||||
if (mTrace.isA11yTracingEnabled()) {
|
||||
mTrace.logTrace(TRACE_A11Y_SERVICE_CONNECTION + ".getSystemActions");
|
||||
if (svcConnTracingEnabled()) {
|
||||
logTraceSvcConn("getSystemActions", "");
|
||||
}
|
||||
synchronized (mLock) {
|
||||
if (!hasRightsToCurrentUserLocked()) {
|
||||
@@ -906,9 +937,8 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
|
||||
|
||||
@Override
|
||||
public boolean isFingerprintGestureDetectionAvailable() {
|
||||
if (mTrace.isA11yTracingEnabled()) {
|
||||
mTrace.logTrace(
|
||||
TRACE_A11Y_SERVICE_CONNECTION + ".isFingerprintGestureDetectionAvailable");
|
||||
if (svcConnTracingEnabled()) {
|
||||
logTraceSvcConn("isFingerprintGestureDetectionAvailable", "");
|
||||
}
|
||||
if (!mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FINGERPRINT)) {
|
||||
return false;
|
||||
@@ -923,9 +953,8 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
|
||||
|
||||
@Override
|
||||
public float getMagnificationScale(int displayId) {
|
||||
if (mTrace.isA11yTracingEnabled()) {
|
||||
mTrace.logTrace(TRACE_A11Y_SERVICE_CONNECTION + ".getMagnificationScale",
|
||||
"displayId=" + displayId);
|
||||
if (svcConnTracingEnabled()) {
|
||||
logTraceSvcConn("getMagnificationScale", "displayId=" + displayId);
|
||||
}
|
||||
synchronized (mLock) {
|
||||
if (!hasRightsToCurrentUserLocked()) {
|
||||
@@ -942,9 +971,8 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
|
||||
|
||||
@Override
|
||||
public Region getMagnificationRegion(int displayId) {
|
||||
if (mTrace.isA11yTracingEnabled()) {
|
||||
mTrace.logTrace(TRACE_A11Y_SERVICE_CONNECTION + ".getMagnificationRegion",
|
||||
"displayId=" + displayId);
|
||||
if (svcConnTracingEnabled()) {
|
||||
logTraceSvcConn("getMagnificationRegion", "displayId=" + displayId);
|
||||
}
|
||||
synchronized (mLock) {
|
||||
final Region region = Region.obtain();
|
||||
@@ -970,9 +998,8 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
|
||||
|
||||
@Override
|
||||
public float getMagnificationCenterX(int displayId) {
|
||||
if (mTrace.isA11yTracingEnabled()) {
|
||||
mTrace.logTrace(TRACE_A11Y_SERVICE_CONNECTION + ".getMagnificationCenterX",
|
||||
"displayId=" + displayId);
|
||||
if (svcConnTracingEnabled()) {
|
||||
logTraceSvcConn("getMagnificationCenterX", "displayId=" + displayId);
|
||||
}
|
||||
synchronized (mLock) {
|
||||
if (!hasRightsToCurrentUserLocked()) {
|
||||
@@ -996,9 +1023,8 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
|
||||
|
||||
@Override
|
||||
public float getMagnificationCenterY(int displayId) {
|
||||
if (mTrace.isA11yTracingEnabled()) {
|
||||
mTrace.logTrace(TRACE_A11Y_SERVICE_CONNECTION + ".getMagnificationCenterY",
|
||||
"displayId=" + displayId);
|
||||
if (svcConnTracingEnabled()) {
|
||||
logTraceSvcConn("getMagnificationCenterY", "displayId=" + displayId);
|
||||
}
|
||||
synchronized (mLock) {
|
||||
if (!hasRightsToCurrentUserLocked()) {
|
||||
@@ -1032,9 +1058,8 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
|
||||
|
||||
@Override
|
||||
public boolean resetMagnification(int displayId, boolean animate) {
|
||||
if (mTrace.isA11yTracingEnabled()) {
|
||||
mTrace.logTrace(TRACE_A11Y_SERVICE_CONNECTION + ".resetMagnification",
|
||||
"displayId=" + displayId + ";animate=" + animate);
|
||||
if (svcConnTracingEnabled()) {
|
||||
logTraceSvcConn("resetMagnification", "displayId=" + displayId + ";animate=" + animate);
|
||||
}
|
||||
synchronized (mLock) {
|
||||
if (!hasRightsToCurrentUserLocked()) {
|
||||
@@ -1058,10 +1083,10 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
|
||||
@Override
|
||||
public boolean setMagnificationScaleAndCenter(int displayId, float scale, float centerX,
|
||||
float centerY, boolean animate) {
|
||||
if (mTrace.isA11yTracingEnabled()) {
|
||||
mTrace.logTrace(TRACE_A11Y_SERVICE_CONNECTION + ".setMagnificationScaleAndCenter",
|
||||
if (svcConnTracingEnabled()) {
|
||||
logTraceSvcConn("setMagnificationScaleAndCenter",
|
||||
"displayId=" + displayId + ";scale=" + scale + ";centerX=" + centerX
|
||||
+ ";centerY=" + centerY + ";animate=" + animate);
|
||||
+ ";centerY=" + centerY + ";animate=" + animate);
|
||||
}
|
||||
synchronized (mLock) {
|
||||
if (!hasRightsToCurrentUserLocked()) {
|
||||
@@ -1087,8 +1112,8 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
|
||||
|
||||
@Override
|
||||
public void setMagnificationCallbackEnabled(int displayId, boolean enabled) {
|
||||
if (mTrace.isA11yTracingEnabled()) {
|
||||
mTrace.logTrace(TRACE_A11Y_SERVICE_CONNECTION + ".setMagnificationCallbackEnabled",
|
||||
if (svcConnTracingEnabled()) {
|
||||
logTraceSvcConn("setMagnificationCallbackEnabled",
|
||||
"displayId=" + displayId + ";enabled=" + enabled);
|
||||
}
|
||||
mInvocationHandler.setMagnificationCallbackEnabled(displayId, enabled);
|
||||
@@ -1100,18 +1125,16 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
|
||||
|
||||
@Override
|
||||
public void setSoftKeyboardCallbackEnabled(boolean enabled) {
|
||||
if (mTrace.isA11yTracingEnabled()) {
|
||||
mTrace.logTrace(TRACE_A11Y_SERVICE_CONNECTION + ".setSoftKeyboardCallbackEnabled",
|
||||
"enabled=" + enabled);
|
||||
if (svcConnTracingEnabled()) {
|
||||
logTraceSvcConn("setSoftKeyboardCallbackEnabled", "enabled=" + enabled);
|
||||
}
|
||||
mInvocationHandler.setSoftKeyboardCallbackEnabled(enabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void takeScreenshot(int displayId, RemoteCallback callback) {
|
||||
if (mTrace.isA11yTracingEnabled()) {
|
||||
mTrace.logTrace(TRACE_A11Y_SERVICE_CONNECTION + ".takeScreenshot",
|
||||
"displayId=" + displayId + ";callback=" + callback);
|
||||
if (svcConnTracingEnabled()) {
|
||||
logTraceSvcConn("takeScreenshot", "displayId=" + displayId + ";callback=" + callback);
|
||||
}
|
||||
final long currentTimestamp = SystemClock.uptimeMillis();
|
||||
if (mRequestTakeScreenshotTimestampMs != 0
|
||||
@@ -1237,6 +1260,10 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
|
||||
final long identity = Binder.clearCallingIdentity();
|
||||
try {
|
||||
final IBinder overlayWindowToken = new Binder();
|
||||
if (wmTracingEnabled()) {
|
||||
logTraceWM("addWindowToken",
|
||||
overlayWindowToken + ";TYPE_ACCESSIBILITY_OVERLAY;" + displayId + ";null");
|
||||
}
|
||||
mWindowManagerService.addWindowToken(overlayWindowToken, TYPE_ACCESSIBILITY_OVERLAY,
|
||||
displayId, null /* options */);
|
||||
synchronized (mLock) {
|
||||
@@ -1263,6 +1290,10 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
|
||||
*/
|
||||
public void onDisplayRemoved(int displayId) {
|
||||
final long identity = Binder.clearCallingIdentity();
|
||||
if (wmTracingEnabled()) {
|
||||
logTraceWM(
|
||||
"addWindowToken", mOverlayWindowTokens.get(displayId) + ";true;" + displayId);
|
||||
}
|
||||
try {
|
||||
mWindowManagerService.removeWindowToken(mOverlayWindowTokens.get(displayId), true,
|
||||
displayId);
|
||||
@@ -1282,9 +1313,8 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
|
||||
*/
|
||||
@Override
|
||||
public IBinder getOverlayWindowToken(int displayId) {
|
||||
if (mTrace.isA11yTracingEnabled()) {
|
||||
mTrace.logTrace(TRACE_A11Y_SERVICE_CONNECTION + ".getOverlayWindowToken",
|
||||
"displayId=" + displayId);
|
||||
if (svcConnTracingEnabled()) {
|
||||
logTraceSvcConn("getOverlayWindowToken", "displayId=" + displayId);
|
||||
}
|
||||
synchronized (mLock) {
|
||||
return mOverlayWindowTokens.get(displayId);
|
||||
@@ -1299,9 +1329,8 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
|
||||
*/
|
||||
@Override
|
||||
public int getWindowIdForLeashToken(@NonNull IBinder token) {
|
||||
if (mTrace.isA11yTracingEnabled()) {
|
||||
mTrace.logTrace(TRACE_A11Y_SERVICE_CONNECTION + ".getWindowIdForLeashToken",
|
||||
"token=" + token);
|
||||
if (svcConnTracingEnabled()) {
|
||||
logTraceSvcConn("getWindowIdForLeashToken", "token=" + token);
|
||||
}
|
||||
synchronized (mLock) {
|
||||
return mA11yWindowManager.getWindowIdLocked(token);
|
||||
@@ -1314,8 +1343,8 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
|
||||
// Clear the proxy in the other process so this
|
||||
// IAccessibilityServiceConnection can be garbage collected.
|
||||
if (mServiceInterface != null) {
|
||||
if (mTrace.isA11yTracingEnabled()) {
|
||||
mTrace.logTrace(TRACE_A11Y_SERVICE_CLIENT + ".init", "null, " + mId + ", null");
|
||||
if (svcClientTracingEnabled()) {
|
||||
logTraceSvcClient("init", "null, " + mId + ", null");
|
||||
}
|
||||
mServiceInterface.init(null, mId, null);
|
||||
}
|
||||
@@ -1465,9 +1494,8 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
|
||||
}
|
||||
|
||||
try {
|
||||
if (mTrace.isA11yTracingEnabled()) {
|
||||
mTrace.logTrace(TRACE_A11Y_SERVICE_CLIENT + ".onAccessibilityEvent",
|
||||
event + ";" + serviceWantsEvent);
|
||||
if (svcClientTracingEnabled()) {
|
||||
logTraceSvcClient("onAccessibilityEvent", event + ";" + serviceWantsEvent);
|
||||
}
|
||||
listener.onAccessibilityEvent(event, serviceWantsEvent);
|
||||
if (DEBUG) {
|
||||
@@ -1522,9 +1550,9 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
|
||||
final IAccessibilityServiceClient listener = getServiceInterfaceSafely();
|
||||
if (listener != null) {
|
||||
try {
|
||||
if (mTrace.isA11yTracingEnabled()) {
|
||||
mTrace.logTrace(TRACE_A11Y_SERVICE_CLIENT + ".onMagnificationChanged", displayId
|
||||
+ ", " + region + ", " + scale + ", " + centerX + ", " + centerY);
|
||||
if (svcClientTracingEnabled()) {
|
||||
logTraceSvcClient("onMagnificationChanged", displayId + ", " + region + ", "
|
||||
+ scale + ", " + centerX + ", " + centerY);
|
||||
}
|
||||
listener.onMagnificationChanged(displayId, region, scale, centerX, centerY);
|
||||
} catch (RemoteException re) {
|
||||
@@ -1541,9 +1569,8 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
|
||||
final IAccessibilityServiceClient listener = getServiceInterfaceSafely();
|
||||
if (listener != null) {
|
||||
try {
|
||||
if (mTrace.isA11yTracingEnabled()) {
|
||||
mTrace.logTrace(TRACE_A11Y_SERVICE_CLIENT + ".onSoftKeyboardShowModeChanged",
|
||||
String.valueOf(showState));
|
||||
if (svcClientTracingEnabled()) {
|
||||
logTraceSvcClient("onSoftKeyboardShowModeChanged", String.valueOf(showState));
|
||||
}
|
||||
listener.onSoftKeyboardShowModeChanged(showState);
|
||||
} catch (RemoteException re) {
|
||||
@@ -1557,9 +1584,8 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
|
||||
final IAccessibilityServiceClient listener = getServiceInterfaceSafely();
|
||||
if (listener != null) {
|
||||
try {
|
||||
if (mTrace.isA11yTracingEnabled()) {
|
||||
mTrace.logTrace(TRACE_A11Y_SERVICE_CLIENT + ".onAccessibilityButtonClicked",
|
||||
String.valueOf(displayId));
|
||||
if (svcClientTracingEnabled()) {
|
||||
logTraceSvcClient("onAccessibilityButtonClicked", String.valueOf(displayId));
|
||||
}
|
||||
listener.onAccessibilityButtonClicked(displayId);
|
||||
} catch (RemoteException re) {
|
||||
@@ -1579,9 +1605,8 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
|
||||
final IAccessibilityServiceClient listener = getServiceInterfaceSafely();
|
||||
if (listener != null) {
|
||||
try {
|
||||
if (mTrace.isA11yTracingEnabled()) {
|
||||
mTrace.logTrace(
|
||||
TRACE_A11Y_SERVICE_CLIENT + ".onAccessibilityButtonAvailabilityChanged",
|
||||
if (svcClientTracingEnabled()) {
|
||||
logTraceSvcClient("onAccessibilityButtonAvailabilityChanged",
|
||||
String.valueOf(available));
|
||||
}
|
||||
listener.onAccessibilityButtonAvailabilityChanged(available);
|
||||
@@ -1597,9 +1622,8 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
|
||||
final IAccessibilityServiceClient listener = getServiceInterfaceSafely();
|
||||
if (listener != null) {
|
||||
try {
|
||||
if (mTrace.isA11yTracingEnabled()) {
|
||||
mTrace.logTrace(TRACE_A11Y_SERVICE_CLIENT + ".onGesture",
|
||||
gestureInfo.toString());
|
||||
if (svcClientTracingEnabled()) {
|
||||
logTraceSvcClient("onGesture", gestureInfo.toString());
|
||||
}
|
||||
listener.onGesture(gestureInfo);
|
||||
} catch (RemoteException re) {
|
||||
@@ -1613,8 +1637,8 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
|
||||
final IAccessibilityServiceClient listener = getServiceInterfaceSafely();
|
||||
if (listener != null) {
|
||||
try {
|
||||
if (mTrace.isA11yTracingEnabled()) {
|
||||
mTrace.logTrace(TRACE_A11Y_SERVICE_CLIENT + ".onSystemActionsChanged");
|
||||
if (svcClientTracingEnabled()) {
|
||||
logTraceSvcClient("onSystemActionsChanged", "");
|
||||
}
|
||||
listener.onSystemActionsChanged();
|
||||
} catch (RemoteException re) {
|
||||
@@ -1628,8 +1652,8 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
|
||||
final IAccessibilityServiceClient listener = getServiceInterfaceSafely();
|
||||
if (listener != null) {
|
||||
try {
|
||||
if (mTrace.isA11yTracingEnabled()) {
|
||||
mTrace.logTrace(TRACE_A11Y_SERVICE_CLIENT + ".clearAccessibilityCache");
|
||||
if (svcClientTracingEnabled()) {
|
||||
logTraceSvcClient("clearAccessibilityCache", "");
|
||||
}
|
||||
listener.clearAccessibilityCache();
|
||||
} catch (RemoteException re) {
|
||||
@@ -1747,6 +1771,12 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
|
||||
LocalServices.getService(ActivityTaskManagerInternal.class)
|
||||
.setFocusedActivity(activityToken);
|
||||
}
|
||||
if (intConnTracingEnabled()) {
|
||||
logTraceIntConn("performAccessibilityAction",
|
||||
accessibilityNodeId + ";" + action + ";" + arguments + ";" + interactionId
|
||||
+ ";" + callback + ";" + mFetchFlags + ";" + interrogatingPid + ";"
|
||||
+ interrogatingTid);
|
||||
}
|
||||
connection.getRemote().performAccessibilityAction(accessibilityNodeId, action,
|
||||
arguments, interactionId, callback, fetchFlags, interrogatingPid,
|
||||
interrogatingTid);
|
||||
@@ -1957,8 +1987,8 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
|
||||
|
||||
@Override
|
||||
public void setGestureDetectionPassthroughRegion(int displayId, Region region) {
|
||||
if (mTrace.isA11yTracingEnabled()) {
|
||||
mTrace.logTrace(TRACE_A11Y_SERVICE_CONNECTION + ".setGestureDetectionPassthroughRegion",
|
||||
if (svcConnTracingEnabled()) {
|
||||
logTraceSvcConn("setGestureDetectionPassthroughRegion",
|
||||
"displayId=" + displayId + ";region=" + region);
|
||||
}
|
||||
mSystemSupport.setGestureDetectionPassthroughRegion(displayId, region);
|
||||
@@ -1966,8 +1996,8 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
|
||||
|
||||
@Override
|
||||
public void setTouchExplorationPassthroughRegion(int displayId, Region region) {
|
||||
if (mTrace.isA11yTracingEnabled()) {
|
||||
mTrace.logTrace(TRACE_A11Y_SERVICE_CONNECTION + ".setTouchExplorationPassthroughRegion",
|
||||
if (svcConnTracingEnabled()) {
|
||||
logTraceSvcConn("setTouchExplorationPassthroughRegion",
|
||||
"displayId=" + displayId + ";region=" + region);
|
||||
}
|
||||
mSystemSupport.setTouchExplorationPassthroughRegion(displayId, region);
|
||||
@@ -1975,20 +2005,56 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
|
||||
|
||||
@Override
|
||||
public void setFocusAppearance(int strokeWidth, int color) {
|
||||
if (mTrace.isA11yTracingEnabled()) {
|
||||
mTrace.logTrace(TRACE_A11Y_SERVICE_CONNECTION + ".setFocusAppearance",
|
||||
"strokeWidth=" + strokeWidth + ";color=" + color);
|
||||
if (svcConnTracingEnabled()) {
|
||||
logTraceSvcConn("setFocusAppearance", "strokeWidth=" + strokeWidth + ";color=" + color);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logTrace(long timestamp, String where, String callingParams, int processId,
|
||||
long threadId, int callingUid, Bundle callingStack) {
|
||||
if (mTrace.isA11yTracingEnabled()) {
|
||||
public void logTrace(long timestamp, String where, long loggingTypes, String callingParams,
|
||||
int processId, long threadId, int callingUid, Bundle callingStack) {
|
||||
if (mTrace.isA11yTracingEnabledForTypes(loggingTypes)) {
|
||||
ArrayList<StackTraceElement> list =
|
||||
(ArrayList<StackTraceElement>) callingStack.getSerializable(CALL_STACK);
|
||||
mTrace.logTrace(timestamp, where, callingParams, processId, threadId, callingUid,
|
||||
list.toArray(new StackTraceElement[list.size()]));
|
||||
HashSet<String> ignoreList =
|
||||
(HashSet<String>) callingStack.getSerializable(IGNORE_CALL_STACK);
|
||||
mTrace.logTrace(timestamp, where, loggingTypes, callingParams, processId, threadId,
|
||||
callingUid, list.toArray(new StackTraceElement[list.size()]), ignoreList);
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean svcClientTracingEnabled() {
|
||||
return mTrace.isA11yTracingEnabledForTypes(FLAGS_ACCESSIBILITY_SERVICE_CLIENT);
|
||||
}
|
||||
|
||||
protected void logTraceSvcClient(String methodName, String params) {
|
||||
mTrace.logTrace(TRACE_SVC_CLIENT + "." + methodName,
|
||||
FLAGS_ACCESSIBILITY_SERVICE_CLIENT, params);
|
||||
}
|
||||
|
||||
protected boolean svcConnTracingEnabled() {
|
||||
return mTrace.isA11yTracingEnabledForTypes(FLAGS_ACCESSIBILITY_SERVICE_CONNECTION);
|
||||
}
|
||||
|
||||
protected void logTraceSvcConn(String methodName, String params) {
|
||||
mTrace.logTrace(TRACE_SVC_CONN + "." + methodName,
|
||||
FLAGS_ACCESSIBILITY_SERVICE_CONNECTION, params);
|
||||
}
|
||||
|
||||
protected boolean intConnTracingEnabled() {
|
||||
return mTrace.isA11yTracingEnabledForTypes(FLAGS_ACCESSIBILITY_INTERACTION_CONNECTION);
|
||||
}
|
||||
|
||||
protected void logTraceIntConn(String methodName, String params) {
|
||||
mTrace.logTrace(LOG_TAG + "." + methodName,
|
||||
FLAGS_ACCESSIBILITY_INTERACTION_CONNECTION, params);
|
||||
}
|
||||
|
||||
protected boolean wmTracingEnabled() {
|
||||
return mTrace.isA11yTracingEnabledForTypes(FLAGS_WINDOW_MANAGER_INTERNAL);
|
||||
}
|
||||
|
||||
protected void logTraceWM(String methodName, String params) {
|
||||
mTrace.logTrace(TRACE_WM + "." + methodName, FLAGS_WINDOW_MANAGER_INTERNAL, params);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.android.server.accessibility;
|
||||
import static android.view.WindowManager.LayoutParams.TYPE_ACCESSIBILITY_MAGNIFICATION_OVERLAY;
|
||||
import static android.view.WindowManager.LayoutParams.TYPE_MAGNIFICATION_OVERLAY;
|
||||
|
||||
import android.accessibilityservice.AccessibilityTrace;
|
||||
import android.annotation.MainThread;
|
||||
import android.content.Context;
|
||||
import android.graphics.Region;
|
||||
@@ -224,7 +225,12 @@ class AccessibilityInputFilter extends InputFilter implements EventStreamTransfo
|
||||
Slog.d(TAG, "Received event: " + event + ", policyFlags=0x"
|
||||
+ Integer.toHexString(policyFlags));
|
||||
}
|
||||
|
||||
if (mAms.getTraceManager().isA11yTracingEnabledForTypes(
|
||||
AccessibilityTrace.FLAGS_INPUT_FILTER)) {
|
||||
mAms.getTraceManager().logTrace(TAG + ".onInputEvent",
|
||||
AccessibilityTrace.FLAGS_INPUT_FILTER,
|
||||
"event=" + event + ";policyFlags=" + policyFlags);
|
||||
}
|
||||
if (mEventHandler.size() == 0) {
|
||||
if (DEBUG) Slog.d(TAG, "No mEventHandler for event " + event);
|
||||
super.onInputEvent(event, policyFlags);
|
||||
@@ -424,7 +430,8 @@ class AccessibilityInputFilter extends InputFilter implements EventStreamTransfo
|
||||
final ArrayList<Display> displaysList = mAms.getValidDisplayList();
|
||||
|
||||
if ((mEnabledFeatures & FLAG_FEATURE_AUTOCLICK) != 0) {
|
||||
mAutoclickController = new AutoclickController(mContext, mUserId);
|
||||
mAutoclickController = new AutoclickController(
|
||||
mContext, mUserId, mAms.getTraceManager());
|
||||
addFirstEventHandlerForAllDisplays(displaysList, mAutoclickController);
|
||||
}
|
||||
|
||||
@@ -462,7 +469,7 @@ class AccessibilityInputFilter extends InputFilter implements EventStreamTransfo
|
||||
|
||||
if ((mEnabledFeatures & FLAG_FEATURE_INJECT_MOTION_EVENTS) != 0) {
|
||||
MotionEventInjector injector = new MotionEventInjector(
|
||||
mContext.getMainLooper());
|
||||
mContext.getMainLooper(), mAms.getTraceManager());
|
||||
addFirstEventHandler(displayId, injector);
|
||||
mMotionEventInjectors.put(displayId, injector);
|
||||
}
|
||||
@@ -563,15 +570,15 @@ class AccessibilityInputFilter extends InputFilter implements EventStreamTransfo
|
||||
final Context uiContext = displayContext.createWindowContext(
|
||||
TYPE_ACCESSIBILITY_MAGNIFICATION_OVERLAY, null /* options */);
|
||||
magnificationGestureHandler = new WindowMagnificationGestureHandler(uiContext,
|
||||
mAms.getWindowMagnificationMgr(), mAms.getMagnificationController(),
|
||||
detectControlGestures, triggerable,
|
||||
mAms.getWindowMagnificationMgr(), mAms.getTraceManager(),
|
||||
mAms.getMagnificationController(), detectControlGestures, triggerable,
|
||||
displayId);
|
||||
} else {
|
||||
final Context uiContext = displayContext.createWindowContext(
|
||||
TYPE_MAGNIFICATION_OVERLAY, null /* options */);
|
||||
magnificationGestureHandler = new FullScreenMagnificationGestureHandler(uiContext,
|
||||
mAms.getFullScreenMagnificationController(), mAms.getMagnificationController(),
|
||||
detectControlGestures, triggerable,
|
||||
mAms.getFullScreenMagnificationController(), mAms.getTraceManager(),
|
||||
mAms.getMagnificationController(), detectControlGestures, triggerable,
|
||||
new WindowMagnificationPromptController(displayContext, mUserId), displayId);
|
||||
}
|
||||
return magnificationGestureHandler;
|
||||
|
||||
@@ -16,6 +16,15 @@
|
||||
|
||||
package com.android.server.accessibility;
|
||||
|
||||
import static android.accessibilityservice.AccessibilityTrace.FLAGS_ACCESSIBILITY_MANAGER;
|
||||
import static android.accessibilityservice.AccessibilityTrace.FLAGS_ACCESSIBILITY_MANAGER_CLIENT;
|
||||
import static android.accessibilityservice.AccessibilityTrace.FLAGS_ACCESSIBILITY_SERVICE_CLIENT;
|
||||
import static android.accessibilityservice.AccessibilityTrace.FLAGS_FINGERPRINT;
|
||||
import static android.accessibilityservice.AccessibilityTrace.FLAGS_INPUT_FILTER;
|
||||
import static android.accessibilityservice.AccessibilityTrace.FLAGS_PACKAGE_BROADCAST_RECEIVER;
|
||||
import static android.accessibilityservice.AccessibilityTrace.FLAGS_USER_BROADCAST_RECEIVER;
|
||||
import static android.accessibilityservice.AccessibilityTrace.FLAGS_WINDOW_MAGNIFICATION_CONNECTION;
|
||||
import static android.accessibilityservice.AccessibilityTrace.FLAGS_WINDOW_MANAGER_INTERNAL;
|
||||
import static android.provider.Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_NAVBAR_ENABLED;
|
||||
import static android.view.accessibility.AccessibilityManager.ACCESSIBILITY_BUTTON;
|
||||
import static android.view.accessibility.AccessibilityManager.ACCESSIBILITY_SHORTCUT_KEY;
|
||||
@@ -289,8 +298,8 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
mContext = context;
|
||||
mPowerManager = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
|
||||
mWindowManagerService = LocalServices.getService(WindowManagerInternal.class);
|
||||
mTraceManager = new AccessibilityTraceManager(
|
||||
mWindowManagerService.getAccessibilityController(), this);
|
||||
mTraceManager = AccessibilityTraceManager.getInstance(
|
||||
mWindowManagerService.getAccessibilityController(), this, mLock);
|
||||
mMainHandler = new MainHandler(mContext.getMainLooper());
|
||||
mActivityTaskManagerService = LocalServices.getService(ActivityTaskManagerInternal.class);
|
||||
mPackageManager = packageManager;
|
||||
@@ -311,8 +320,8 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
mContext = context;
|
||||
mPowerManager = context.getSystemService(PowerManager.class);
|
||||
mWindowManagerService = LocalServices.getService(WindowManagerInternal.class);
|
||||
mTraceManager = new AccessibilityTraceManager(
|
||||
mWindowManagerService.getAccessibilityController(), this);
|
||||
mTraceManager = AccessibilityTraceManager.getInstance(
|
||||
mWindowManagerService.getAccessibilityController(), this, mLock);
|
||||
mMainHandler = new MainHandler(mContext.getMainLooper());
|
||||
mActivityTaskManagerService = LocalServices.getService(ActivityTaskManagerInternal.class);
|
||||
mPackageManager = mContext.getPackageManager();
|
||||
@@ -324,7 +333,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
mSecurityPolicy = new AccessibilitySecurityPolicy(policyWarningUIController, mContext,
|
||||
this);
|
||||
mA11yWindowManager = new AccessibilityWindowManager(mLock, mMainHandler,
|
||||
mWindowManagerService, this, mSecurityPolicy, this);
|
||||
mWindowManagerService, this, mSecurityPolicy, this, mTraceManager);
|
||||
mA11yDisplayListener = new AccessibilityDisplayListener(mContext, mMainHandler);
|
||||
mMagnificationController = new MagnificationController(this, mLock, mContext);
|
||||
init();
|
||||
@@ -339,26 +348,16 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
|
||||
@Override
|
||||
public int getCurrentUserIdLocked() {
|
||||
if (mTraceManager.isA11yTracingEnabled()) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".getCurrentUserIdLocked");
|
||||
}
|
||||
return mCurrentUserId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAccessibilityButtonShown() {
|
||||
if (mTraceManager.isA11yTracingEnabled()) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".isAccessibilityButtonShown");
|
||||
}
|
||||
return mIsAccessibilityButtonShown;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onServiceInfoChangedLocked(AccessibilityUserState userState) {
|
||||
if (mTraceManager.isA11yTracingEnabled()) {
|
||||
mTraceManager.logTrace(
|
||||
LOG_TAG + ".onServiceInfoChangedLocked", "userState=" + userState);
|
||||
}
|
||||
mSecurityPolicy.onBoundServicesChangedLocked(userState.mUserId,
|
||||
userState.mBoundServices);
|
||||
scheduleNotifyClientsOfServicesStateChangeLocked(userState);
|
||||
@@ -424,8 +423,9 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
PackageMonitor monitor = new PackageMonitor() {
|
||||
@Override
|
||||
public void onSomePackagesChanged() {
|
||||
if (mTraceManager.isA11yTracingEnabled()) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".PM.onSomePackagesChanged");
|
||||
if (mTraceManager.isA11yTracingEnabledForTypes(FLAGS_PACKAGE_BROADCAST_RECEIVER)) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".PM.onSomePackagesChanged",
|
||||
FLAGS_PACKAGE_BROADCAST_RECEIVER);
|
||||
}
|
||||
|
||||
synchronized (mLock) {
|
||||
@@ -452,8 +452,9 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
// mBindingServices in binderDied() during updating. Remove services from this
|
||||
// package from mBindingServices, and then update the user state to re-bind new
|
||||
// versions of them.
|
||||
if (mTraceManager.isA11yTracingEnabled()) {
|
||||
if (mTraceManager.isA11yTracingEnabledForTypes(FLAGS_PACKAGE_BROADCAST_RECEIVER)) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".PM.onPackageUpdateFinished",
|
||||
FLAGS_PACKAGE_BROADCAST_RECEIVER,
|
||||
"packageName=" + packageName + ";uid=" + uid);
|
||||
}
|
||||
synchronized (mLock) {
|
||||
@@ -485,8 +486,9 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
|
||||
@Override
|
||||
public void onPackageRemoved(String packageName, int uid) {
|
||||
if (mTraceManager.isA11yTracingEnabled()) {
|
||||
if (mTraceManager.isA11yTracingEnabledForTypes(FLAGS_PACKAGE_BROADCAST_RECEIVER)) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".PM.onPackageRemoved",
|
||||
FLAGS_PACKAGE_BROADCAST_RECEIVER,
|
||||
"packageName=" + packageName + ";uid=" + uid);
|
||||
}
|
||||
|
||||
@@ -529,8 +531,9 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
@Override
|
||||
public boolean onHandleForceStop(Intent intent, String[] packages,
|
||||
int uid, boolean doit) {
|
||||
if (mTraceManager.isA11yTracingEnabled()) {
|
||||
if (mTraceManager.isA11yTracingEnabledForTypes(FLAGS_PACKAGE_BROADCAST_RECEIVER)) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".PM.onHandleForceStop",
|
||||
FLAGS_PACKAGE_BROADCAST_RECEIVER,
|
||||
"intent=" + intent + ";packages=" + packages + ";uid=" + uid
|
||||
+ ";doit=" + doit);
|
||||
}
|
||||
@@ -580,8 +583,8 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
mContext.registerReceiverAsUser(new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (mTraceManager.isA11yTracingEnabled()) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".BR.onReceive",
|
||||
if (mTraceManager.isA11yTracingEnabledForTypes(FLAGS_USER_BROADCAST_RECEIVER)) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".BR.onReceive", FLAGS_USER_BROADCAST_RECEIVER,
|
||||
"context=" + context + ";intent=" + intent);
|
||||
}
|
||||
|
||||
@@ -668,8 +671,8 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
|
||||
@Override
|
||||
public long addClient(IAccessibilityManagerClient callback, int userId) {
|
||||
if (mTraceManager.isA11yTracingEnabled()) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".addClient",
|
||||
if (mTraceManager.isA11yTracingEnabledForTypes(FLAGS_ACCESSIBILITY_MANAGER)) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".addClient", FLAGS_ACCESSIBILITY_MANAGER,
|
||||
"callback=" + callback + ";userId=" + userId);
|
||||
}
|
||||
|
||||
@@ -711,8 +714,8 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
|
||||
@Override
|
||||
public void sendAccessibilityEvent(AccessibilityEvent event, int userId) {
|
||||
if (mTraceManager.isA11yTracingEnabled()) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".sendAccessibilityEvent",
|
||||
if (mTraceManager.isA11yTracingEnabledForTypes(FLAGS_ACCESSIBILITY_MANAGER)) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".sendAccessibilityEvent", FLAGS_ACCESSIBILITY_MANAGER,
|
||||
"event=" + event + ";userId=" + userId);
|
||||
}
|
||||
boolean dispatchEvent = false;
|
||||
@@ -775,6 +778,10 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
}
|
||||
}
|
||||
if (shouldComputeWindows) {
|
||||
if (mTraceManager.isA11yTracingEnabledForTypes(FLAGS_WINDOW_MANAGER_INTERNAL)) {
|
||||
mTraceManager.logTrace("WindowManagerInternal.computeWindowsForAccessibility",
|
||||
FLAGS_WINDOW_MANAGER_INTERNAL, "display=" + displayId);
|
||||
}
|
||||
final WindowManagerInternal wm = LocalServices.getService(
|
||||
WindowManagerInternal.class);
|
||||
wm.computeWindowsForAccessibility(displayId);
|
||||
@@ -807,9 +814,9 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
*/
|
||||
@Override
|
||||
public void registerSystemAction(RemoteAction action, int actionId) {
|
||||
if (mTraceManager.isA11yTracingEnabled()) {
|
||||
if (mTraceManager.isA11yTracingEnabledForTypes(FLAGS_ACCESSIBILITY_MANAGER)) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".registerSystemAction",
|
||||
"action=" + action + ";actionId=" + actionId);
|
||||
FLAGS_ACCESSIBILITY_MANAGER, "action=" + action + ";actionId=" + actionId);
|
||||
}
|
||||
mSecurityPolicy.enforceCallingOrSelfPermission(Manifest.permission.MANAGE_ACCESSIBILITY);
|
||||
getSystemActionPerformer().registerSystemAction(actionId, action);
|
||||
@@ -822,8 +829,9 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
*/
|
||||
@Override
|
||||
public void unregisterSystemAction(int actionId) {
|
||||
if (mTraceManager.isA11yTracingEnabled()) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".unregisterSystemAction", "actionId=" + actionId);
|
||||
if (mTraceManager.isA11yTracingEnabledForTypes(FLAGS_ACCESSIBILITY_MANAGER)) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".unregisterSystemAction",
|
||||
FLAGS_ACCESSIBILITY_MANAGER, "actionId=" + actionId);
|
||||
}
|
||||
mSecurityPolicy.enforceCallingOrSelfPermission(Manifest.permission.MANAGE_ACCESSIBILITY);
|
||||
getSystemActionPerformer().unregisterSystemAction(actionId);
|
||||
@@ -839,9 +847,9 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
|
||||
@Override
|
||||
public List<AccessibilityServiceInfo> getInstalledAccessibilityServiceList(int userId) {
|
||||
if (mTraceManager.isA11yTracingEnabled()) {
|
||||
if (mTraceManager.isA11yTracingEnabledForTypes(FLAGS_ACCESSIBILITY_MANAGER)) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".getInstalledAccessibilityServiceList",
|
||||
"userId=" + userId);
|
||||
FLAGS_ACCESSIBILITY_MANAGER, "userId=" + userId);
|
||||
}
|
||||
|
||||
synchronized (mLock) {
|
||||
@@ -861,8 +869,9 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
@Override
|
||||
public List<AccessibilityServiceInfo> getEnabledAccessibilityServiceList(int feedbackType,
|
||||
int userId) {
|
||||
if (mTraceManager.isA11yTracingEnabled()) {
|
||||
if (mTraceManager.isA11yTracingEnabledForTypes(FLAGS_ACCESSIBILITY_MANAGER)) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".getEnabledAccessibilityServiceList",
|
||||
FLAGS_ACCESSIBILITY_MANAGER,
|
||||
"feedbackType=" + feedbackType + ";userId=" + userId);
|
||||
}
|
||||
|
||||
@@ -894,8 +903,9 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
|
||||
@Override
|
||||
public void interrupt(int userId) {
|
||||
if (mTraceManager.isA11yTracingEnabled()) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".interrupt", "userId=" + userId);
|
||||
if (mTraceManager.isA11yTracingEnabledForTypes(FLAGS_ACCESSIBILITY_MANAGER)) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".interrupt",
|
||||
FLAGS_ACCESSIBILITY_MANAGER, "userId=" + userId);
|
||||
}
|
||||
|
||||
List<IAccessibilityServiceClient> interfacesToInterrupt;
|
||||
@@ -924,8 +934,10 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
}
|
||||
for (int i = 0, count = interfacesToInterrupt.size(); i < count; i++) {
|
||||
try {
|
||||
if (mTraceManager.isA11yTracingEnabled()) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".IAccessibilityServiceClient.onInterrupt");
|
||||
if (mTraceManager.isA11yTracingEnabledForTypes(
|
||||
FLAGS_ACCESSIBILITY_SERVICE_CLIENT)) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".IAccessibilityServiceClient.onInterrupt",
|
||||
FLAGS_ACCESSIBILITY_SERVICE_CLIENT);
|
||||
}
|
||||
interfacesToInterrupt.get(i).onInterrupt();
|
||||
} catch (RemoteException re) {
|
||||
@@ -939,8 +951,9 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
public int addAccessibilityInteractionConnection(IWindow windowToken, IBinder leashToken,
|
||||
IAccessibilityInteractionConnection connection, String packageName,
|
||||
int userId) throws RemoteException {
|
||||
if (mTraceManager.isA11yTracingEnabled()) {
|
||||
if (mTraceManager.isA11yTracingEnabledForTypes(FLAGS_ACCESSIBILITY_MANAGER)) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".addAccessibilityInteractionConnection",
|
||||
FLAGS_ACCESSIBILITY_MANAGER,
|
||||
"windowToken=" + windowToken + "leashToken=" + leashToken + ";connection="
|
||||
+ connection + "; packageName=" + packageName + ";userId=" + userId);
|
||||
}
|
||||
@@ -951,9 +964,9 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
|
||||
@Override
|
||||
public void removeAccessibilityInteractionConnection(IWindow window) {
|
||||
if (mTraceManager.isA11yTracingEnabled()) {
|
||||
if (mTraceManager.isA11yTracingEnabledForTypes(FLAGS_ACCESSIBILITY_MANAGER)) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".removeAccessibilityInteractionConnection",
|
||||
"window=" + window);
|
||||
FLAGS_ACCESSIBILITY_MANAGER, "window=" + window);
|
||||
}
|
||||
mA11yWindowManager.removeAccessibilityInteractionConnection(window);
|
||||
}
|
||||
@@ -961,9 +974,9 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
@Override
|
||||
public void setPictureInPictureActionReplacingConnection(
|
||||
IAccessibilityInteractionConnection connection) throws RemoteException {
|
||||
if (mTraceManager.isA11yTracingEnabled()) {
|
||||
if (mTraceManager.isA11yTracingEnabledForTypes(FLAGS_ACCESSIBILITY_MANAGER)) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".setPictureInPictureActionReplacingConnection",
|
||||
"connection=" + connection);
|
||||
FLAGS_ACCESSIBILITY_MANAGER, "connection=" + connection);
|
||||
}
|
||||
mSecurityPolicy.enforceCallingPermission(Manifest.permission.MODIFY_ACCESSIBILITY_DATA,
|
||||
SET_PIP_ACTION_REPLACEMENT);
|
||||
@@ -975,10 +988,11 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
IAccessibilityServiceClient serviceClient,
|
||||
AccessibilityServiceInfo accessibilityServiceInfo,
|
||||
int flags) {
|
||||
if (mTraceManager.isA11yTracingEnabled()) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".registerUiTestAutomationService", "owner=" + owner
|
||||
+ ";serviceClient=" + serviceClient + ";accessibilityServiceInfo="
|
||||
+ accessibilityServiceInfo + ";flags=" + flags);
|
||||
if (mTraceManager.isA11yTracingEnabledForTypes(FLAGS_ACCESSIBILITY_MANAGER)) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".registerUiTestAutomationService",
|
||||
FLAGS_ACCESSIBILITY_MANAGER,
|
||||
"owner=" + owner + ";serviceClient=" + serviceClient
|
||||
+ ";accessibilityServiceInfo=" + accessibilityServiceInfo + ";flags=" + flags);
|
||||
}
|
||||
|
||||
mSecurityPolicy.enforceCallingPermission(Manifest.permission.RETRIEVE_WINDOW_CONTENT,
|
||||
@@ -995,9 +1009,9 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
|
||||
@Override
|
||||
public void unregisterUiTestAutomationService(IAccessibilityServiceClient serviceClient) {
|
||||
if (mTraceManager.isA11yTracingEnabled()) {
|
||||
if (mTraceManager.isA11yTracingEnabledForTypes(FLAGS_ACCESSIBILITY_MANAGER)) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".unregisterUiTestAutomationService",
|
||||
"serviceClient=" + serviceClient);
|
||||
FLAGS_ACCESSIBILITY_MANAGER, "serviceClient=" + serviceClient);
|
||||
}
|
||||
synchronized (mLock) {
|
||||
mUiAutomationManager.unregisterUiTestAutomationServiceLocked(serviceClient);
|
||||
@@ -1007,15 +1021,20 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
@Override
|
||||
public void temporaryEnableAccessibilityStateUntilKeyguardRemoved(
|
||||
ComponentName service, boolean touchExplorationEnabled) {
|
||||
if (mTraceManager.isA11yTracingEnabled()) {
|
||||
if (mTraceManager.isA11yTracingEnabledForTypes(FLAGS_ACCESSIBILITY_MANAGER)) {
|
||||
mTraceManager.logTrace(
|
||||
LOG_TAG + ".temporaryEnableAccessibilityStateUntilKeyguardRemoved",
|
||||
FLAGS_ACCESSIBILITY_MANAGER,
|
||||
"service=" + service + ";touchExplorationEnabled=" + touchExplorationEnabled);
|
||||
}
|
||||
|
||||
mSecurityPolicy.enforceCallingPermission(
|
||||
Manifest.permission.TEMPORARY_ENABLE_ACCESSIBILITY,
|
||||
TEMPORARY_ENABLE_ACCESSIBILITY_UNTIL_KEYGUARD_REMOVED);
|
||||
if (mTraceManager.isA11yTracingEnabledForTypes(FLAGS_WINDOW_MANAGER_INTERNAL)) {
|
||||
mTraceManager.logTrace("WindowManagerInternal.isKeyguardLocked",
|
||||
FLAGS_WINDOW_MANAGER_INTERNAL);
|
||||
}
|
||||
if (!mWindowManagerService.isKeyguardLocked()) {
|
||||
return;
|
||||
}
|
||||
@@ -1041,9 +1060,9 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
|
||||
@Override
|
||||
public IBinder getWindowToken(int windowId, int userId) {
|
||||
if (mTraceManager.isA11yTracingEnabled()) {
|
||||
if (mTraceManager.isA11yTracingEnabledForTypes(FLAGS_ACCESSIBILITY_MANAGER)) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".getWindowToken",
|
||||
"windowId=" + windowId + ";userId=" + userId);
|
||||
FLAGS_ACCESSIBILITY_MANAGER, "windowId=" + windowId + ";userId=" + userId);
|
||||
}
|
||||
|
||||
mSecurityPolicy.enforceCallingPermission(
|
||||
@@ -1085,8 +1104,9 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
*/
|
||||
@Override
|
||||
public void notifyAccessibilityButtonClicked(int displayId, String targetName) {
|
||||
if (mTraceManager.isA11yTracingEnabled()) {
|
||||
if (mTraceManager.isA11yTracingEnabledForTypes(FLAGS_ACCESSIBILITY_MANAGER)) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".notifyAccessibilityButtonClicked",
|
||||
FLAGS_ACCESSIBILITY_MANAGER,
|
||||
"displayId=" + displayId + ";targetName=" + targetName);
|
||||
}
|
||||
|
||||
@@ -1115,9 +1135,9 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
*/
|
||||
@Override
|
||||
public void notifyAccessibilityButtonVisibilityChanged(boolean shown) {
|
||||
if (mTraceManager.isA11yTracingEnabled()) {
|
||||
if (mTraceManager.isA11yTracingEnabledForTypes(FLAGS_ACCESSIBILITY_MANAGER)) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".notifyAccessibilityButtonVisibilityChanged",
|
||||
"shown=" + shown);
|
||||
FLAGS_ACCESSIBILITY_MANAGER, "shown=" + shown);
|
||||
}
|
||||
|
||||
mSecurityPolicy.enforceCallingOrSelfPermission(
|
||||
@@ -1148,10 +1168,6 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
*/
|
||||
@Override
|
||||
public void onSystemActionsChanged() {
|
||||
if (mTraceManager.isA11yTracingEnabled()) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".onSystemActionsChanged");
|
||||
}
|
||||
|
||||
synchronized (mLock) {
|
||||
AccessibilityUserState state = getCurrentUserStateLocked();
|
||||
notifySystemActionsChangedLocked(state);
|
||||
@@ -1214,11 +1230,6 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
|
||||
@Override
|
||||
public @Nullable MotionEventInjector getMotionEventInjectorForDisplayLocked(int displayId) {
|
||||
if (mTraceManager.isA11yTracingEnabled()) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".getMotionEventInjectorForDisplayLocked",
|
||||
"displayId=" + displayId);
|
||||
}
|
||||
|
||||
final long endMillis = SystemClock.uptimeMillis() + WAIT_MOTION_INJECTOR_TIMEOUT_MILLIS;
|
||||
MotionEventInjector motionEventInjector = null;
|
||||
while ((mMotionEventInjectors == null) && (SystemClock.uptimeMillis() < endMillis)) {
|
||||
@@ -1281,6 +1292,10 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
synchronized (mLock) {
|
||||
token = getWindowToken(windowId, mCurrentUserId);
|
||||
}
|
||||
if (mTraceManager.isA11yTracingEnabledForTypes(FLAGS_WINDOW_MANAGER_INTERNAL)) {
|
||||
mTraceManager.logTrace("WindowManagerInternal.getWindowFrame",
|
||||
FLAGS_WINDOW_MANAGER_INTERNAL, "token=" + token + ";outBounds=" + outBounds);
|
||||
}
|
||||
mWindowManagerService.getWindowFrame(token, outBounds);
|
||||
if (!outBounds.isEmpty()) {
|
||||
return true;
|
||||
@@ -1429,7 +1444,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
private int getClientStateLocked(AccessibilityUserState userState) {
|
||||
return userState.getClientStateLocked(
|
||||
mUiAutomationManager.isUiAutomationRunningLocked(),
|
||||
mTraceManager.isA11yTracingEnabled());
|
||||
mTraceManager.getTraceStateForAccessibilityManagerClientState());
|
||||
}
|
||||
|
||||
private InteractionBridge getInteractionBridge() {
|
||||
@@ -1639,6 +1654,10 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
}
|
||||
|
||||
private void updateRelevantEventsLocked(AccessibilityUserState userState) {
|
||||
if (mTraceManager.isA11yTracingEnabledForTypes(FLAGS_ACCESSIBILITY_SERVICE_CLIENT)) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".updateRelevantEventsLocked",
|
||||
FLAGS_ACCESSIBILITY_SERVICE_CLIENT, "userState=" + userState);
|
||||
}
|
||||
mMainHandler.post(() -> {
|
||||
broadcastToClients(userState, ignoreRemoteException(client -> {
|
||||
int relevantEventTypes;
|
||||
@@ -1788,12 +1807,6 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
@Override
|
||||
public void persistComponentNamesToSettingLocked(String settingName,
|
||||
Set<ComponentName> componentNames, int userId) {
|
||||
if (mTraceManager.isA11yTracingEnabled()) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".persistComponentNamesToSettingLocked",
|
||||
"settingName=" + settingName + ";componentNames=" + componentNames + ";userId="
|
||||
+ userId);
|
||||
}
|
||||
|
||||
persistColonDelimitedSetToSettingLocked(settingName, userId, componentNames,
|
||||
componentName -> componentName.flattenToShortString());
|
||||
}
|
||||
@@ -1918,7 +1931,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
}
|
||||
}
|
||||
|
||||
private void scheduleUpdateClientsIfNeededLocked(AccessibilityUserState userState) {
|
||||
void scheduleUpdateClientsIfNeededLocked(AccessibilityUserState userState) {
|
||||
final int clientState = getClientStateLocked(userState);
|
||||
if (userState.getLastSentClientStateLocked() != clientState
|
||||
&& (mGlobalClients.getRegisteredCallbackCount() > 0
|
||||
@@ -1941,6 +1954,10 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
|
||||
private void sendStateToClients(int clientState,
|
||||
RemoteCallbackList<IAccessibilityManagerClient> clients) {
|
||||
if (mTraceManager.isA11yTracingEnabledForTypes(FLAGS_ACCESSIBILITY_MANAGER_CLIENT)) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".sendStateToClients",
|
||||
FLAGS_ACCESSIBILITY_MANAGER_CLIENT, "clientState=" + clientState);
|
||||
}
|
||||
clients.broadcast(ignoreRemoteException(
|
||||
client -> client.setState(clientState)));
|
||||
}
|
||||
@@ -1961,6 +1978,10 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
|
||||
private void notifyClientsOfServicesStateChange(
|
||||
RemoteCallbackList<IAccessibilityManagerClient> clients, long uiTimeout) {
|
||||
if (mTraceManager.isA11yTracingEnabledForTypes(FLAGS_ACCESSIBILITY_MANAGER_CLIENT)) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".notifyClientsOfServicesStateChange",
|
||||
FLAGS_ACCESSIBILITY_MANAGER_CLIENT, "uiTimeout=" + uiTimeout);
|
||||
}
|
||||
clients.broadcast(ignoreRemoteException(
|
||||
client -> client.notifyServicesStateChanged(uiTimeout)));
|
||||
}
|
||||
@@ -2040,6 +2061,12 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
}
|
||||
}
|
||||
if (setInputFilter) {
|
||||
if (mTraceManager.isA11yTracingEnabledForTypes(FLAGS_WINDOW_MANAGER_INTERNAL
|
||||
| FLAGS_INPUT_FILTER)) {
|
||||
mTraceManager.logTrace("WindowManagerInternal.setInputFilter",
|
||||
FLAGS_WINDOW_MANAGER_INTERNAL | FLAGS_INPUT_FILTER,
|
||||
"inputFilter=" + inputFilter);
|
||||
}
|
||||
mWindowManagerService.setInputFilter(inputFilter);
|
||||
}
|
||||
}
|
||||
@@ -2763,26 +2790,21 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
@GuardedBy("mLock")
|
||||
@Override
|
||||
public MagnificationSpec getCompatibleMagnificationSpecLocked(int windowId) {
|
||||
if (mTraceManager.isA11yTracingEnabled()) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".getCompatibleMagnificationSpecLocked",
|
||||
"windowId=" + windowId);
|
||||
}
|
||||
|
||||
IBinder windowToken = mA11yWindowManager.getWindowTokenForUserAndWindowIdLocked(
|
||||
mCurrentUserId, windowId);
|
||||
if (windowToken != null) {
|
||||
return mWindowManagerService.getCompatibleMagnificationSpecForWindow(
|
||||
windowToken);
|
||||
if (mTraceManager.isA11yTracingEnabledForTypes(FLAGS_WINDOW_MANAGER_INTERNAL)) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".getCompatibleMagnificationSpecForWindow",
|
||||
FLAGS_WINDOW_MANAGER_INTERNAL, "windowToken=" + windowToken);
|
||||
}
|
||||
|
||||
return mWindowManagerService.getCompatibleMagnificationSpecForWindow(windowToken);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public KeyEventDispatcher getKeyEventDispatcher() {
|
||||
if (mTraceManager.isA11yTracingEnabled()) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".getKeyEventDispatcher");
|
||||
}
|
||||
|
||||
if (mKeyEventDispatcher == null) {
|
||||
mKeyEventDispatcher = new KeyEventDispatcher(
|
||||
mMainHandler, MainHandler.MSG_SEND_KEY_EVENT_TO_INPUT_FILTER, mLock,
|
||||
@@ -2795,13 +2817,6 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
@SuppressWarnings("AndroidFrameworkPendingIntentMutability")
|
||||
public PendingIntent getPendingIntentActivity(Context context, int requestCode, Intent intent,
|
||||
int flags) {
|
||||
if (mTraceManager.isA11yTracingEnabled()) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".getPendingIntentActivity",
|
||||
"context=" + context + ";requestCode=" + requestCode + ";intent=" + intent
|
||||
+ ";flags=" + flags);
|
||||
}
|
||||
|
||||
|
||||
return PendingIntent.getActivity(context, requestCode, intent, flags);
|
||||
}
|
||||
|
||||
@@ -2816,9 +2831,9 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
*/
|
||||
@Override
|
||||
public void performAccessibilityShortcut(String targetName) {
|
||||
if (mTraceManager.isA11yTracingEnabled()) {
|
||||
if (mTraceManager.isA11yTracingEnabledForTypes(FLAGS_ACCESSIBILITY_MANAGER)) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".performAccessibilityShortcut",
|
||||
"targetName=" + targetName);
|
||||
FLAGS_ACCESSIBILITY_MANAGER, "targetName=" + targetName);
|
||||
}
|
||||
|
||||
if ((UserHandle.getAppId(Binder.getCallingUid()) != Process.SYSTEM_UID)
|
||||
@@ -3005,9 +3020,9 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
|
||||
@Override
|
||||
public List<String> getAccessibilityShortcutTargets(@ShortcutType int shortcutType) {
|
||||
if (mTraceManager.isA11yTracingEnabled()) {
|
||||
if (mTraceManager.isA11yTracingEnabledForTypes(FLAGS_ACCESSIBILITY_MANAGER)) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".getAccessibilityShortcutTargets",
|
||||
"shortcutType=" + shortcutType);
|
||||
FLAGS_ACCESSIBILITY_MANAGER, "shortcutType=" + shortcutType);
|
||||
}
|
||||
|
||||
if (mContext.checkCallingOrSelfPermission(Manifest.permission.MANAGE_ACCESSIBILITY)
|
||||
@@ -3079,11 +3094,6 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
|
||||
@Override
|
||||
public void sendAccessibilityEventForCurrentUserLocked(AccessibilityEvent event) {
|
||||
if (mTraceManager.isA11yTracingEnabled()) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".sendAccessibilityEventForCurrentUserLocked",
|
||||
"event=" + event);
|
||||
}
|
||||
|
||||
sendAccessibilityEventLocked(event, mCurrentUserId);
|
||||
}
|
||||
|
||||
@@ -3105,8 +3115,10 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
*/
|
||||
@Override
|
||||
public boolean sendFingerprintGesture(int gestureKeyCode) {
|
||||
if (mTraceManager.isA11yTracingEnabled()) {
|
||||
if (mTraceManager.isA11yTracingEnabledForTypes(
|
||||
FLAGS_ACCESSIBILITY_MANAGER | FLAGS_FINGERPRINT)) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".sendFingerprintGesture",
|
||||
FLAGS_ACCESSIBILITY_MANAGER | FLAGS_FINGERPRINT,
|
||||
"gestureKeyCode=" + gestureKeyCode);
|
||||
}
|
||||
|
||||
@@ -3131,9 +3143,9 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
*/
|
||||
@Override
|
||||
public int getAccessibilityWindowId(@Nullable IBinder windowToken) {
|
||||
if (mTraceManager.isA11yTracingEnabled()) {
|
||||
if (mTraceManager.isA11yTracingEnabledForTypes(FLAGS_ACCESSIBILITY_MANAGER)) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".getAccessibilityWindowId",
|
||||
"windowToken=" + windowToken);
|
||||
FLAGS_ACCESSIBILITY_MANAGER, "windowToken=" + windowToken);
|
||||
}
|
||||
|
||||
synchronized (mLock) {
|
||||
@@ -3153,8 +3165,9 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
*/
|
||||
@Override
|
||||
public long getRecommendedTimeoutMillis() {
|
||||
if (mTraceManager.isA11yTracingEnabled()) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".getRecommendedTimeoutMillis");
|
||||
if (mTraceManager.isA11yTracingEnabledForTypes(FLAGS_ACCESSIBILITY_MANAGER)) {
|
||||
mTraceManager.logTrace(
|
||||
LOG_TAG + ".getRecommendedTimeoutMillis", FLAGS_ACCESSIBILITY_MANAGER);
|
||||
}
|
||||
|
||||
synchronized(mLock) {
|
||||
@@ -3171,8 +3184,10 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
@Override
|
||||
public void setWindowMagnificationConnection(
|
||||
IWindowMagnificationConnection connection) throws RemoteException {
|
||||
if (mTraceManager.isA11yTracingEnabled()) {
|
||||
if (mTraceManager.isA11yTracingEnabledForTypes(
|
||||
FLAGS_ACCESSIBILITY_MANAGER | FLAGS_WINDOW_MAGNIFICATION_CONNECTION)) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".setWindowMagnificationConnection",
|
||||
FLAGS_ACCESSIBILITY_MANAGER | FLAGS_WINDOW_MAGNIFICATION_CONNECTION,
|
||||
"connection=" + connection);
|
||||
}
|
||||
|
||||
@@ -3206,9 +3221,9 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
|
||||
@Override
|
||||
public void associateEmbeddedHierarchy(@NonNull IBinder host, @NonNull IBinder embedded) {
|
||||
if (mTraceManager.isA11yTracingEnabled()) {
|
||||
if (mTraceManager.isA11yTracingEnabledForTypes(FLAGS_ACCESSIBILITY_MANAGER)) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".associateEmbeddedHierarchy",
|
||||
"host=" + host + ";embedded=" + embedded);
|
||||
FLAGS_ACCESSIBILITY_MANAGER, "host=" + host + ";embedded=" + embedded);
|
||||
}
|
||||
|
||||
synchronized (mLock) {
|
||||
@@ -3218,8 +3233,9 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
|
||||
@Override
|
||||
public void disassociateEmbeddedHierarchy(@NonNull IBinder token) {
|
||||
if (mTraceManager.isA11yTracingEnabled()) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".disassociateEmbeddedHierarchy", "token=" + token);
|
||||
if (mTraceManager.isA11yTracingEnabledForTypes(FLAGS_ACCESSIBILITY_MANAGER)) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".disassociateEmbeddedHierarchy",
|
||||
FLAGS_ACCESSIBILITY_MANAGER, "token=" + token);
|
||||
}
|
||||
|
||||
synchronized (mLock) {
|
||||
@@ -3231,7 +3247,11 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
* Gets the stroke width of the focus rectangle.
|
||||
* @return The stroke width.
|
||||
*/
|
||||
@Override
|
||||
public int getFocusStrokeWidth() {
|
||||
if (mTraceManager.isA11yTracingEnabledForTypes(FLAGS_ACCESSIBILITY_MANAGER)) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".getFocusStrokeWidth", FLAGS_ACCESSIBILITY_MANAGER);
|
||||
}
|
||||
synchronized (mLock) {
|
||||
final AccessibilityUserState userState = getCurrentUserStateLocked();
|
||||
|
||||
@@ -3243,7 +3263,11 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
* Gets the color of the focus rectangle.
|
||||
* @return The color.
|
||||
*/
|
||||
@Override
|
||||
public int getFocusColor() {
|
||||
if (mTraceManager.isA11yTracingEnabledForTypes(FLAGS_ACCESSIBILITY_MANAGER)) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".getFocusColor", FLAGS_ACCESSIBILITY_MANAGER);
|
||||
}
|
||||
synchronized (mLock) {
|
||||
final AccessibilityUserState userState = getCurrentUserStateLocked();
|
||||
|
||||
@@ -3299,9 +3323,6 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
|
||||
@Override
|
||||
public FullScreenMagnificationController getFullScreenMagnificationController() {
|
||||
if (mTraceManager.isA11yTracingEnabled()) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".getFullScreenMagnificationController");
|
||||
}
|
||||
synchronized (mLock) {
|
||||
return mMagnificationController.getFullScreenMagnificationController();
|
||||
}
|
||||
@@ -3309,11 +3330,6 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
|
||||
@Override
|
||||
public void onClientChangeLocked(boolean serviceInfoChanged) {
|
||||
if (mTraceManager.isA11yTracingEnabled()) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".onClientChangeLocked",
|
||||
"serviceInfoChanged=" + serviceInfoChanged);
|
||||
}
|
||||
|
||||
AccessibilityUserState userState = getUserStateLocked(mCurrentUserId);
|
||||
onUserStateChangedLocked(userState);
|
||||
if (serviceInfoChanged) {
|
||||
@@ -3840,11 +3856,6 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
|
||||
@Override
|
||||
public void setGestureDetectionPassthroughRegion(int displayId, Region region) {
|
||||
if (mTraceManager.isA11yTracingEnabled()) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".setGestureDetectionPassthroughRegion",
|
||||
"displayId=" + displayId + ";region=" + region);
|
||||
}
|
||||
|
||||
mMainHandler.sendMessage(
|
||||
obtainMessage(
|
||||
AccessibilityManagerService::setGestureDetectionPassthroughRegionInternal,
|
||||
@@ -3855,11 +3866,6 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
|
||||
@Override
|
||||
public void setTouchExplorationPassthroughRegion(int displayId, Region region) {
|
||||
if (mTraceManager.isA11yTracingEnabled()) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".setTouchExplorationPassthroughRegion",
|
||||
"displayId=" + displayId + ";region=" + region);
|
||||
}
|
||||
|
||||
mMainHandler.sendMessage(
|
||||
obtainMessage(
|
||||
AccessibilityManagerService::setTouchExplorationPassthroughRegionInternal,
|
||||
@@ -3888,7 +3894,10 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
if (userState.mUserId != mCurrentUserId) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mTraceManager.isA11yTracingEnabledForTypes(FLAGS_ACCESSIBILITY_SERVICE_CLIENT)) {
|
||||
mTraceManager.logTrace(LOG_TAG + ".updateFocusAppearanceDataLocked",
|
||||
FLAGS_ACCESSIBILITY_SERVICE_CLIENT, "userState=" + userState);
|
||||
}
|
||||
mMainHandler.post(() -> {
|
||||
broadcastToClients(userState, ignoreRemoteException(client -> {
|
||||
client.mCallback.setFocusAppearance(userState.getFocusStrokeWidthLocked(),
|
||||
@@ -3898,7 +3907,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
|
||||
}
|
||||
|
||||
AccessibilityTraceManager getTraceManager() {
|
||||
public AccessibilityTraceManager getTraceManager() {
|
||||
return mTraceManager;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import static com.android.internal.util.function.pooled.PooledLambda.obtainMessa
|
||||
|
||||
import android.Manifest;
|
||||
import android.accessibilityservice.AccessibilityServiceInfo;
|
||||
import android.accessibilityservice.AccessibilityTrace;
|
||||
import android.accessibilityservice.IAccessibilityServiceClient;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.ComponentName;
|
||||
@@ -53,10 +54,7 @@ import java.util.Set;
|
||||
*/
|
||||
class AccessibilityServiceConnection extends AbstractAccessibilityServiceConnection {
|
||||
private static final String LOG_TAG = "AccessibilityServiceConnection";
|
||||
private static final String TRACE_A11Y_SERVICE_CONNECTION =
|
||||
LOG_TAG + ".IAccessibilityServiceConnection";
|
||||
private static final String TRACE_A11Y_SERVICE_CLIENT =
|
||||
LOG_TAG + ".IAccessibilityServiceClient";
|
||||
|
||||
/*
|
||||
Holding a weak reference so there isn't a loop of references. AccessibilityUserState keeps
|
||||
lists of bound and binding services. These are freed on user changes, but just in case it
|
||||
@@ -137,8 +135,8 @@ class AccessibilityServiceConnection extends AbstractAccessibilityServiceConnect
|
||||
|
||||
@Override
|
||||
public void disableSelf() {
|
||||
if (mTrace.isA11yTracingEnabled()) {
|
||||
mTrace.logTrace(TRACE_A11Y_SERVICE_CONNECTION + ".disableSelf");
|
||||
if (svcConnTracingEnabled()) {
|
||||
logTraceSvcConn("disableSelf", "");
|
||||
}
|
||||
synchronized (mLock) {
|
||||
AccessibilityUserState userState = mUserStateWeakReference.get();
|
||||
@@ -218,9 +216,9 @@ class AccessibilityServiceConnection extends AbstractAccessibilityServiceConnect
|
||||
return;
|
||||
}
|
||||
try {
|
||||
if (mTrace.isA11yTracingEnabled()) {
|
||||
mTrace.logTrace(TRACE_A11Y_SERVICE_CLIENT + ".init", this + ", " + mId + ", "
|
||||
+ mOverlayWindowTokens.get(Display.DEFAULT_DISPLAY));
|
||||
if (svcClientTracingEnabled()) {
|
||||
logTraceSvcClient("init",
|
||||
this + "," + mId + "," + mOverlayWindowTokens.get(Display.DEFAULT_DISPLAY));
|
||||
}
|
||||
serviceInterface.init(this, mId, mOverlayWindowTokens.get(Display.DEFAULT_DISPLAY));
|
||||
} catch (RemoteException re) {
|
||||
@@ -264,9 +262,8 @@ class AccessibilityServiceConnection extends AbstractAccessibilityServiceConnect
|
||||
|
||||
@Override
|
||||
public boolean setSoftKeyboardShowMode(int showMode) {
|
||||
if (mTrace.isA11yTracingEnabled()) {
|
||||
mTrace.logTrace(TRACE_A11Y_SERVICE_CONNECTION + ".setSoftKeyboardShowMode",
|
||||
"showMode=" + showMode);
|
||||
if (svcConnTracingEnabled()) {
|
||||
logTraceSvcConn("setSoftKeyboardShowMode", "showMode=" + showMode);
|
||||
}
|
||||
synchronized (mLock) {
|
||||
if (!hasRightsToCurrentUserLocked()) {
|
||||
@@ -280,8 +277,8 @@ class AccessibilityServiceConnection extends AbstractAccessibilityServiceConnect
|
||||
|
||||
@Override
|
||||
public int getSoftKeyboardShowMode() {
|
||||
if (mTrace.isA11yTracingEnabled()) {
|
||||
mTrace.logTrace(TRACE_A11Y_SERVICE_CONNECTION + ".getSoftKeyboardShowMode");
|
||||
if (svcConnTracingEnabled()) {
|
||||
logTraceSvcConn("getSoftKeyboardShowMode", "");
|
||||
}
|
||||
final AccessibilityUserState userState = mUserStateWeakReference.get();
|
||||
return (userState != null) ? userState.getSoftKeyboardShowModeLocked() : 0;
|
||||
@@ -289,9 +286,8 @@ class AccessibilityServiceConnection extends AbstractAccessibilityServiceConnect
|
||||
|
||||
@Override
|
||||
public boolean switchToInputMethod(String imeId) {
|
||||
if (mTrace.isA11yTracingEnabled()) {
|
||||
mTrace.logTrace(TRACE_A11Y_SERVICE_CONNECTION + ".switchToInputMethod",
|
||||
"imeId=" + imeId);
|
||||
if (svcConnTracingEnabled()) {
|
||||
logTraceSvcConn("switchToInputMethod", "imeId=" + imeId);
|
||||
}
|
||||
synchronized (mLock) {
|
||||
if (!hasRightsToCurrentUserLocked()) {
|
||||
@@ -311,8 +307,8 @@ class AccessibilityServiceConnection extends AbstractAccessibilityServiceConnect
|
||||
|
||||
@Override
|
||||
public boolean isAccessibilityButtonAvailable() {
|
||||
if (mTrace.isA11yTracingEnabled()) {
|
||||
mTrace.logTrace(TRACE_A11Y_SERVICE_CONNECTION + ".isAccessibilityButtonAvailable");
|
||||
if (svcConnTracingEnabled()) {
|
||||
logTraceSvcConn("isAccessibilityButtonAvailable", "");
|
||||
}
|
||||
synchronized (mLock) {
|
||||
if (!hasRightsToCurrentUserLocked()) {
|
||||
@@ -373,9 +369,9 @@ class AccessibilityServiceConnection extends AbstractAccessibilityServiceConnect
|
||||
}
|
||||
if (serviceInterface != null) {
|
||||
try {
|
||||
if (mTrace.isA11yTracingEnabled()) {
|
||||
mTrace.logTrace(TRACE_A11Y_SERVICE_CLIENT
|
||||
+ ".onFingerprintCapturingGesturesChanged", String.valueOf(active));
|
||||
if (svcClientTracingEnabled()) {
|
||||
logTraceSvcClient(
|
||||
"onFingerprintCapturingGesturesChanged", String.valueOf(active));
|
||||
}
|
||||
mServiceInterface.onFingerprintCapturingGesturesChanged(active);
|
||||
} catch (RemoteException e) {
|
||||
@@ -394,9 +390,8 @@ class AccessibilityServiceConnection extends AbstractAccessibilityServiceConnect
|
||||
}
|
||||
if (serviceInterface != null) {
|
||||
try {
|
||||
if (mTrace.isA11yTracingEnabled()) {
|
||||
mTrace.logTrace(TRACE_A11Y_SERVICE_CLIENT + ".onFingerprintGesture",
|
||||
String.valueOf(gesture));
|
||||
if (svcClientTracingEnabled()) {
|
||||
logTraceSvcClient("onFingerprintGesture", String.valueOf(gesture));
|
||||
}
|
||||
mServiceInterface.onFingerprintGesture(gesture);
|
||||
} catch (RemoteException e) {
|
||||
@@ -410,15 +405,17 @@ class AccessibilityServiceConnection extends AbstractAccessibilityServiceConnect
|
||||
if (mSecurityPolicy.canPerformGestures(this)) {
|
||||
MotionEventInjector motionEventInjector =
|
||||
mSystemSupport.getMotionEventInjectorForDisplayLocked(displayId);
|
||||
if (wmTracingEnabled()) {
|
||||
logTraceWM("isTouchOrFaketouchDevice", "");
|
||||
}
|
||||
if (motionEventInjector != null
|
||||
&& mWindowManagerService.isTouchOrFaketouchDevice()) {
|
||||
motionEventInjector.injectEvents(
|
||||
gestureSteps.getList(), mServiceInterface, sequence, displayId);
|
||||
} else {
|
||||
try {
|
||||
if (mTrace.isA11yTracingEnabled()) {
|
||||
mTrace.logTrace(TRACE_A11Y_SERVICE_CLIENT + ".onPerformGestureResult",
|
||||
sequence + ", false");
|
||||
if (svcClientTracingEnabled()) {
|
||||
logTraceSvcClient("onPerformGestureResult", sequence + ", false");
|
||||
}
|
||||
mServiceInterface.onPerformGestureResult(sequence, false);
|
||||
} catch (RemoteException re) {
|
||||
|
||||
@@ -60,7 +60,7 @@ final class AccessibilityShellCommand extends ShellCommand {
|
||||
}
|
||||
case "start-trace":
|
||||
case "stop-trace":
|
||||
return mService.getTraceManager().onShellCommand(cmd);
|
||||
return mService.getTraceManager().onShellCommand(cmd, this);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
/**
|
||||
* Copyright (C) 2021 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.android.server.accessibility;
|
||||
|
||||
/**
|
||||
* Interface to log accessibility trace.
|
||||
*/
|
||||
public interface AccessibilityTrace {
|
||||
/**
|
||||
* Whether the trace is enabled.
|
||||
*/
|
||||
boolean isA11yTracingEnabled();
|
||||
|
||||
/**
|
||||
* Start tracing.
|
||||
*/
|
||||
void startTrace();
|
||||
|
||||
/**
|
||||
* Stop tracing.
|
||||
*/
|
||||
void stopTrace();
|
||||
|
||||
/**
|
||||
* Log one trace entry.
|
||||
* @param where A string to identify this log entry, which can be used to filter/search
|
||||
* through the tracing file.
|
||||
*/
|
||||
void logTrace(String where);
|
||||
|
||||
/**
|
||||
* Log one trace entry.
|
||||
* @param where A string to identify this log entry, which can be used to filter/search
|
||||
* through the tracing file.
|
||||
* @param callingParams The parameters for the method to be logged.
|
||||
*/
|
||||
void logTrace(String where, String callingParams);
|
||||
|
||||
/**
|
||||
* Log one trace entry. Accessibility services using AccessibilityInteractionClient to
|
||||
* make screen content related requests use this API to log entry when receive callback.
|
||||
* @param timestamp The timestamp when a callback is received.
|
||||
* @param where A string to identify this log entry, which can be used to filter/search
|
||||
* through the tracing file.
|
||||
* @param callingParams The parameters for the callback.
|
||||
* @param processId The process id of the calling component.
|
||||
* @param threadId The threadId of the calling component.
|
||||
* @param callingUid The calling uid of the callback.
|
||||
* @param callStack The call stack of the callback.
|
||||
*/
|
||||
void logTrace(long timestamp, String where, String callingParams, int processId,
|
||||
long threadId, int callingUid, StackTraceElement[] callStack);
|
||||
}
|
||||
@@ -15,72 +15,197 @@
|
||||
*/
|
||||
package com.android.server.accessibility;
|
||||
|
||||
import static android.accessibilityservice.AccessibilityTrace.FLAGS_ACCESSIBILITY_INTERACTION_CLIENT;
|
||||
import static android.accessibilityservice.AccessibilityTrace.FLAGS_ACCESSIBILITY_INTERACTION_CONNECTION;
|
||||
import static android.accessibilityservice.AccessibilityTrace.FLAGS_ACCESSIBILITY_INTERACTION_CONNECTION_CALLBACK;
|
||||
import static android.accessibilityservice.AccessibilityTrace.FLAGS_ACCESSIBILITY_MANAGER_CLIENT_STATES;
|
||||
import static android.accessibilityservice.AccessibilityTrace.FLAGS_ACCESSIBILITY_SERVICE;
|
||||
import static android.accessibilityservice.AccessibilityTrace.FLAGS_LOGGING_ALL;
|
||||
import static android.accessibilityservice.AccessibilityTrace.FLAGS_LOGGING_NONE;
|
||||
import static android.view.accessibility.AccessibilityManager.STATE_FLAG_TRACE_A11Y_INTERACTION_CLIENT_ENABLED;
|
||||
import static android.view.accessibility.AccessibilityManager.STATE_FLAG_TRACE_A11Y_INTERACTION_CONNECTION_CB_ENABLED;
|
||||
import static android.view.accessibility.AccessibilityManager.STATE_FLAG_TRACE_A11Y_INTERACTION_CONNECTION_ENABLED;
|
||||
import static android.view.accessibility.AccessibilityManager.STATE_FLAG_TRACE_A11Y_SERVICE_ENABLED;
|
||||
|
||||
import android.accessibilityservice.AccessibilityTrace;
|
||||
import android.annotation.MainThread;
|
||||
import android.annotation.NonNull;
|
||||
import android.os.Binder;
|
||||
import android.os.ShellCommand;
|
||||
|
||||
import com.android.server.wm.WindowManagerInternal;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Manager of accessibility trace.
|
||||
*/
|
||||
class AccessibilityTraceManager implements AccessibilityTrace {
|
||||
public class AccessibilityTraceManager implements AccessibilityTrace {
|
||||
private final WindowManagerInternal.AccessibilityControllerInternal mA11yController;
|
||||
private final AccessibilityManagerService mService;
|
||||
private final Object mA11yMSLock;
|
||||
|
||||
AccessibilityTraceManager(
|
||||
private long mEnabledLoggingFlags;
|
||||
|
||||
private static AccessibilityTraceManager sInstance = null;
|
||||
|
||||
@MainThread
|
||||
static AccessibilityTraceManager getInstance(
|
||||
@NonNull WindowManagerInternal.AccessibilityControllerInternal a11yController,
|
||||
@NonNull AccessibilityManagerService service) {
|
||||
@NonNull AccessibilityManagerService service,
|
||||
@NonNull Object lock) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new AccessibilityTraceManager(a11yController, service, lock);
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
private AccessibilityTraceManager(
|
||||
@NonNull WindowManagerInternal.AccessibilityControllerInternal a11yController,
|
||||
@NonNull AccessibilityManagerService service,
|
||||
@NonNull Object lock) {
|
||||
mA11yController = a11yController;
|
||||
mService = service;
|
||||
mA11yMSLock = lock;
|
||||
mEnabledLoggingFlags = FLAGS_LOGGING_NONE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isA11yTracingEnabled() {
|
||||
return mA11yController.isAccessibilityTracingEnabled();
|
||||
synchronized (mA11yMSLock) {
|
||||
return mEnabledLoggingFlags != FLAGS_LOGGING_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startTrace() {
|
||||
if (!mA11yController.isAccessibilityTracingEnabled()) {
|
||||
mA11yController.startTrace();
|
||||
mService.scheduleUpdateClientsIfNeeded(mService.getCurrentUserState());
|
||||
public boolean isA11yTracingEnabledForTypes(long typeIdFlags) {
|
||||
synchronized (mA11yMSLock) {
|
||||
return ((typeIdFlags & mEnabledLoggingFlags) != FLAGS_LOGGING_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTraceStateForAccessibilityManagerClientState() {
|
||||
int state = 0x0;
|
||||
synchronized (mA11yMSLock) {
|
||||
if (isA11yTracingEnabledForTypes(FLAGS_ACCESSIBILITY_INTERACTION_CONNECTION)) {
|
||||
state |= STATE_FLAG_TRACE_A11Y_INTERACTION_CONNECTION_ENABLED;
|
||||
}
|
||||
if (isA11yTracingEnabledForTypes(FLAGS_ACCESSIBILITY_INTERACTION_CONNECTION_CALLBACK)) {
|
||||
state |= STATE_FLAG_TRACE_A11Y_INTERACTION_CONNECTION_CB_ENABLED;
|
||||
}
|
||||
if (isA11yTracingEnabledForTypes(FLAGS_ACCESSIBILITY_INTERACTION_CLIENT)) {
|
||||
state |= STATE_FLAG_TRACE_A11Y_INTERACTION_CLIENT_ENABLED;
|
||||
}
|
||||
if (isA11yTracingEnabledForTypes(FLAGS_ACCESSIBILITY_SERVICE)) {
|
||||
state |= STATE_FLAG_TRACE_A11Y_SERVICE_ENABLED;
|
||||
}
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startTrace(long loggingTypes) {
|
||||
if (loggingTypes == FLAGS_LOGGING_NONE) {
|
||||
// Ignore start none request
|
||||
return;
|
||||
}
|
||||
|
||||
synchronized (mA11yMSLock) {
|
||||
long oldEnabled = mEnabledLoggingFlags;
|
||||
mEnabledLoggingFlags = loggingTypes;
|
||||
|
||||
if (needToNotifyClients(oldEnabled)) {
|
||||
mService.scheduleUpdateClientsIfNeededLocked(mService.getCurrentUserState());
|
||||
}
|
||||
}
|
||||
|
||||
mA11yController.startTrace(loggingTypes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopTrace() {
|
||||
if (mA11yController.isAccessibilityTracingEnabled()) {
|
||||
boolean stop = false;
|
||||
synchronized (mA11yMSLock) {
|
||||
stop = isA11yTracingEnabled();
|
||||
|
||||
long oldEnabled = mEnabledLoggingFlags;
|
||||
mEnabledLoggingFlags = FLAGS_LOGGING_NONE;
|
||||
|
||||
if (needToNotifyClients(oldEnabled)) {
|
||||
mService.scheduleUpdateClientsIfNeededLocked(mService.getCurrentUserState());
|
||||
}
|
||||
}
|
||||
if (stop) {
|
||||
mA11yController.stopTrace();
|
||||
mService.scheduleUpdateClientsIfNeeded(mService.getCurrentUserState());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logTrace(String where) {
|
||||
logTrace(where, "");
|
||||
public void logTrace(String where, long loggingTypes) {
|
||||
logTrace(where, loggingTypes, "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logTrace(String where, String callingParams) {
|
||||
mA11yController.logTrace(where, callingParams, "".getBytes(),
|
||||
Binder.getCallingUid(), Thread.currentThread().getStackTrace());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logTrace(long timestamp, String where, String callingParams, int processId,
|
||||
long threadId, int callingUid, StackTraceElement[] callStack) {
|
||||
if (mA11yController.isAccessibilityTracingEnabled()) {
|
||||
mA11yController.logTrace(where, callingParams, "".getBytes(), callingUid, callStack,
|
||||
timestamp, processId, threadId);
|
||||
public void logTrace(String where, long loggingTypes, String callingParams) {
|
||||
if (isA11yTracingEnabledForTypes(loggingTypes)) {
|
||||
mA11yController.logTrace(where, loggingTypes, callingParams, "".getBytes(),
|
||||
Binder.getCallingUid(), Thread.currentThread().getStackTrace(),
|
||||
new HashSet<String>(Arrays.asList("logTrace")));
|
||||
}
|
||||
}
|
||||
|
||||
int onShellCommand(String cmd) {
|
||||
@Override
|
||||
public void logTrace(long timestamp, String where, long loggingTypes, String callingParams,
|
||||
int processId, long threadId, int callingUid, StackTraceElement[] callStack,
|
||||
Set<String> ignoreElementList) {
|
||||
if (isA11yTracingEnabledForTypes(loggingTypes)) {
|
||||
mA11yController.logTrace(where, loggingTypes, callingParams, "".getBytes(), callingUid,
|
||||
callStack, timestamp, processId, threadId,
|
||||
((ignoreElementList == null) ? new HashSet<String>() : ignoreElementList));
|
||||
}
|
||||
}
|
||||
|
||||
private boolean needToNotifyClients(long otherTypesEnabled) {
|
||||
return (mEnabledLoggingFlags & FLAGS_ACCESSIBILITY_MANAGER_CLIENT_STATES)
|
||||
!= (otherTypesEnabled & FLAGS_ACCESSIBILITY_MANAGER_CLIENT_STATES);
|
||||
}
|
||||
|
||||
int onShellCommand(String cmd, ShellCommand shell) {
|
||||
switch (cmd) {
|
||||
case "start-trace": {
|
||||
startTrace();
|
||||
String opt = shell.getNextOption();
|
||||
if (opt == null) {
|
||||
startTrace(FLAGS_LOGGING_ALL);
|
||||
return 0;
|
||||
}
|
||||
List<String> types = new ArrayList<String>();
|
||||
while (opt != null) {
|
||||
switch (opt) {
|
||||
case "-t": {
|
||||
String type = shell.getNextArg();
|
||||
while (type != null) {
|
||||
types.add(type);
|
||||
type = shell.getNextArg();
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
shell.getErrPrintWriter().println(
|
||||
"Error: option not recognized " + opt);
|
||||
stopTrace();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
opt = shell.getNextOption();
|
||||
}
|
||||
long enabledTypes = AccessibilityTrace.getLoggingFlagsFromNames(types);
|
||||
startTrace(enabledTypes);
|
||||
return 0;
|
||||
}
|
||||
case "stop-trace": {
|
||||
@@ -92,8 +217,29 @@ class AccessibilityTraceManager implements AccessibilityTrace {
|
||||
}
|
||||
|
||||
void onHelp(PrintWriter pw) {
|
||||
pw.println(" start-trace");
|
||||
pw.println(" Start the debug tracing.");
|
||||
pw.println(" start-trace [-t LOGGING_TYPE [LOGGING_TYPE...]]");
|
||||
pw.println(" Start the debug tracing. If no option is present, full trace will be");
|
||||
pw.println(" generated. Options are:");
|
||||
pw.println(" -t: Only generate tracing for the logging type(s) specified here.");
|
||||
pw.println(" LOGGING_TYPE can be any one of below:");
|
||||
pw.println(" IAccessibilityServiceConnection");
|
||||
pw.println(" IAccessibilityServiceClient");
|
||||
pw.println(" IAccessibilityManager");
|
||||
pw.println(" IAccessibilityManagerClient");
|
||||
pw.println(" IAccessibilityInteractionConnection");
|
||||
pw.println(" IAccessibilityInteractionConnectionCallback");
|
||||
pw.println(" IRemoteMagnificationAnimationCallback");
|
||||
pw.println(" IWindowMagnificationConnection");
|
||||
pw.println(" IWindowMagnificationConnectionCallback");
|
||||
pw.println(" WindowManagerInternal");
|
||||
pw.println(" WindowsForAccessibilityCallback");
|
||||
pw.println(" MagnificationCallbacks");
|
||||
pw.println(" InputFilter");
|
||||
pw.println(" Gesture");
|
||||
pw.println(" AccessibilityService");
|
||||
pw.println(" PMBroadcastReceiver");
|
||||
pw.println(" UserBroadcastReceiver");
|
||||
pw.println(" FingerprintGesture");
|
||||
pw.println(" stop-trace");
|
||||
pw.println(" Stop the debug tracing.");
|
||||
}
|
||||
|
||||
@@ -391,7 +391,7 @@ class AccessibilityUserState {
|
||||
return mBoundServices;
|
||||
}
|
||||
|
||||
int getClientStateLocked(boolean isUiAutomationRunning, boolean isTracingEnabled) {
|
||||
int getClientStateLocked(boolean isUiAutomationRunning, int traceClientState) {
|
||||
int clientState = 0;
|
||||
final boolean a11yEnabled = isUiAutomationRunning
|
||||
|| isHandlingAccessibilityEventsLocked();
|
||||
@@ -407,9 +407,9 @@ class AccessibilityUserState {
|
||||
if (mIsTextHighContrastEnabled) {
|
||||
clientState |= AccessibilityManager.STATE_FLAG_HIGH_TEXT_CONTRAST_ENABLED;
|
||||
}
|
||||
if (isTracingEnabled) {
|
||||
clientState |= AccessibilityManager.STATE_FLAG_ACCESSIBILITY_TRACING_ENABLED;
|
||||
}
|
||||
|
||||
clientState |= traceClientState;
|
||||
|
||||
return clientState;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.server.accessibility;
|
||||
|
||||
import static android.accessibilityservice.AccessibilityTrace.FLAGS_ACCESSIBILITY_INTERACTION_CONNECTION;
|
||||
import static android.accessibilityservice.AccessibilityTrace.FLAGS_WINDOW_MANAGER_INTERNAL;
|
||||
import static android.view.WindowManager.LayoutParams.TYPE_ACCESSIBILITY_OVERLAY;
|
||||
import static android.view.accessibility.AccessibilityEvent.WINDOWS_CHANGE_ACCESSIBILITY_FOCUSED;
|
||||
|
||||
@@ -69,6 +71,7 @@ public class AccessibilityWindowManager {
|
||||
private final AccessibilityEventSender mAccessibilityEventSender;
|
||||
private final AccessibilitySecurityPolicy mSecurityPolicy;
|
||||
private final AccessibilityUserManager mAccessibilityUserManager;
|
||||
private final AccessibilityTraceManager mTraceManager;
|
||||
|
||||
// Connections and window tokens for cross-user windows
|
||||
private final SparseArray<RemoteAccessibilityConnection>
|
||||
@@ -151,6 +154,10 @@ public class AccessibilityWindowManager {
|
||||
// In some cases, onWindowsForAccessibilityChanged will be called immediately in
|
||||
// setWindowsForAccessibilityCallback. We'll lost windows if flag is false.
|
||||
mTrackingWindows = true;
|
||||
if (traceWMEnabled()) {
|
||||
logTraceWM("setWindowsForAccessibilityCallback",
|
||||
"displayId=" + mDisplayId + ";callback=" + this);
|
||||
}
|
||||
result = mWindowManagerInternal.setWindowsForAccessibilityCallback(
|
||||
mDisplayId, this);
|
||||
if (!result) {
|
||||
@@ -167,6 +174,10 @@ public class AccessibilityWindowManager {
|
||||
*/
|
||||
void stopTrackingWindowsLocked() {
|
||||
if (mTrackingWindows) {
|
||||
if (traceWMEnabled()) {
|
||||
logTraceWM("setWindowsForAccessibilityCallback",
|
||||
"displayId=" + mDisplayId + ";callback=null");
|
||||
}
|
||||
mWindowManagerInternal.setWindowsForAccessibilityCallback(
|
||||
mDisplayId, null);
|
||||
mTrackingWindows = false;
|
||||
@@ -858,19 +869,21 @@ public class AccessibilityWindowManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for AccessibilityManagerService.
|
||||
* Constructor for AccessibilityWindowManager.
|
||||
*/
|
||||
public AccessibilityWindowManager(@NonNull Object lock, @NonNull Handler handler,
|
||||
@NonNull WindowManagerInternal windowManagerInternal,
|
||||
@NonNull AccessibilityEventSender accessibilityEventSender,
|
||||
@NonNull AccessibilitySecurityPolicy securityPolicy,
|
||||
@NonNull AccessibilityUserManager accessibilityUserManager) {
|
||||
@NonNull AccessibilityUserManager accessibilityUserManager,
|
||||
@NonNull AccessibilityTraceManager traceManager) {
|
||||
mLock = lock;
|
||||
mHandler = handler;
|
||||
mWindowManagerInternal = windowManagerInternal;
|
||||
mAccessibilityEventSender = accessibilityEventSender;
|
||||
mSecurityPolicy = securityPolicy;
|
||||
mAccessibilityUserManager = accessibilityUserManager;
|
||||
mTraceManager = traceManager;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -971,6 +984,9 @@ public class AccessibilityWindowManager {
|
||||
final int windowId;
|
||||
boolean shouldComputeWindows = false;
|
||||
final IBinder token = window.asBinder();
|
||||
if (traceWMEnabled()) {
|
||||
logTraceWM("getDisplayIdForWindow", "token=" + token);
|
||||
}
|
||||
final int displayId = mWindowManagerInternal.getDisplayIdForWindow(token);
|
||||
synchronized (mLock) {
|
||||
// We treat calls from a profile as if made by its parent as profiles
|
||||
@@ -1017,9 +1033,15 @@ public class AccessibilityWindowManager {
|
||||
registerIdLocked(leashToken, windowId);
|
||||
}
|
||||
if (shouldComputeWindows) {
|
||||
if (traceWMEnabled()) {
|
||||
logTraceWM("computeWindowsForAccessibility", "displayId=" + displayId);
|
||||
}
|
||||
mWindowManagerInternal.computeWindowsForAccessibility(displayId);
|
||||
}
|
||||
|
||||
if (traceWMEnabled()) {
|
||||
logTraceWM("setAccessibilityIdToSurfaceMetadata",
|
||||
"token=" + token + ";windowId=" + windowId);
|
||||
}
|
||||
mWindowManagerInternal.setAccessibilityIdToSurfaceMetadata(token, windowId);
|
||||
return windowId;
|
||||
}
|
||||
@@ -1153,6 +1175,10 @@ public class AccessibilityWindowManager {
|
||||
mActiveWindowId = AccessibilityWindowInfo.UNDEFINED_WINDOW_ID;
|
||||
}
|
||||
if (binder != null) {
|
||||
if (traceWMEnabled()) {
|
||||
logTraceWM("setAccessibilityIdToSurfaceMetadata", "token=" + binder
|
||||
+ ";windowId=AccessibilityWindowInfo.UNDEFINED_WINDOW_ID");
|
||||
}
|
||||
mWindowManagerInternal.setAccessibilityIdToSurfaceMetadata(
|
||||
binder, AccessibilityWindowInfo.UNDEFINED_WINDOW_ID);
|
||||
}
|
||||
@@ -1183,6 +1209,9 @@ public class AccessibilityWindowManager {
|
||||
* @return The userId
|
||||
*/
|
||||
public int getWindowOwnerUserId(@NonNull IBinder windowToken) {
|
||||
if (traceWMEnabled()) {
|
||||
logTraceWM("getWindowOwnerUserId", "token=" + windowToken);
|
||||
}
|
||||
return mWindowManagerInternal.getWindowOwnerUserId(windowToken);
|
||||
}
|
||||
|
||||
@@ -1561,6 +1590,10 @@ public class AccessibilityWindowManager {
|
||||
for (int i = 0; i < connectionList.size(); i++) {
|
||||
final RemoteAccessibilityConnection connection = connectionList.get(i);
|
||||
if (connection != null) {
|
||||
if (traceIntConnEnabled()) {
|
||||
logTraceIntConn("notifyOutsideTouch");
|
||||
}
|
||||
|
||||
try {
|
||||
connection.getRemote().notifyOutsideTouch();
|
||||
} catch (RemoteException re) {
|
||||
@@ -1581,6 +1614,9 @@ public class AccessibilityWindowManager {
|
||||
*/
|
||||
public int getDisplayIdByUserIdAndWindowIdLocked(int userId, int windowId) {
|
||||
final IBinder windowToken = getWindowTokenForUserAndWindowIdLocked(userId, windowId);
|
||||
if (traceWMEnabled()) {
|
||||
logTraceWM("getDisplayIdForWindow", "token=" + windowToken);
|
||||
}
|
||||
final int displayId = mWindowManagerInternal.getDisplayIdForWindow(windowToken);
|
||||
return displayId;
|
||||
}
|
||||
@@ -1609,6 +1645,9 @@ public class AccessibilityWindowManager {
|
||||
* @return The input focused windowId, or -1 if not found
|
||||
*/
|
||||
private int findFocusedWindowId(int userId) {
|
||||
if (traceWMEnabled()) {
|
||||
logTraceWM("getFocusedWindowToken", "");
|
||||
}
|
||||
final IBinder token = mWindowManagerInternal.getFocusedWindowToken();
|
||||
synchronized (mLock) {
|
||||
return findWindowIdLocked(userId, token);
|
||||
@@ -1658,6 +1697,9 @@ public class AccessibilityWindowManager {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (traceIntConnEnabled()) {
|
||||
logTraceIntConn("notifyOutsideTouch");
|
||||
}
|
||||
try {
|
||||
connection.getRemote().clearAccessibilityFocus();
|
||||
} catch (RemoteException re) {
|
||||
@@ -1680,6 +1722,25 @@ public class AccessibilityWindowManager {
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean traceWMEnabled() {
|
||||
return mTraceManager.isA11yTracingEnabledForTypes(FLAGS_WINDOW_MANAGER_INTERNAL);
|
||||
}
|
||||
|
||||
private void logTraceWM(String methodName, String params) {
|
||||
mTraceManager.logTrace("WindowManagerInternal." + methodName,
|
||||
FLAGS_WINDOW_MANAGER_INTERNAL, params);
|
||||
}
|
||||
|
||||
private boolean traceIntConnEnabled() {
|
||||
return mTraceManager.isA11yTracingEnabledForTypes(
|
||||
FLAGS_ACCESSIBILITY_INTERACTION_CONNECTION);
|
||||
}
|
||||
|
||||
private void logTraceIntConn(String methodName) {
|
||||
mTraceManager.logTrace(
|
||||
LOG_TAG + "." + methodName, FLAGS_ACCESSIBILITY_INTERACTION_CONNECTION);
|
||||
}
|
||||
|
||||
/**
|
||||
* Associate the token of the embedded view hierarchy to the host view hierarchy.
|
||||
*
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.server.accessibility;
|
||||
|
||||
import android.accessibilityservice.AccessibilityTrace;
|
||||
import android.annotation.NonNull;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
@@ -56,6 +57,7 @@ public class AutoclickController extends BaseEventStreamTransformation {
|
||||
|
||||
private static final String LOG_TAG = AutoclickController.class.getSimpleName();
|
||||
|
||||
private final AccessibilityTraceManager mTrace;
|
||||
private final Context mContext;
|
||||
private final int mUserId;
|
||||
|
||||
@@ -63,13 +65,18 @@ public class AutoclickController extends BaseEventStreamTransformation {
|
||||
private ClickScheduler mClickScheduler;
|
||||
private ClickDelayObserver mClickDelayObserver;
|
||||
|
||||
public AutoclickController(Context context, int userId) {
|
||||
public AutoclickController(Context context, int userId, AccessibilityTraceManager trace) {
|
||||
mTrace = trace;
|
||||
mContext = context;
|
||||
mUserId = userId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMotionEvent(MotionEvent event, MotionEvent rawEvent, int policyFlags) {
|
||||
if (mTrace.isA11yTracingEnabledForTypes(AccessibilityTrace.FLAGS_INPUT_FILTER)) {
|
||||
mTrace.logTrace(LOG_TAG + ".onMotionEvent", AccessibilityTrace.FLAGS_INPUT_FILTER,
|
||||
"event=" + event + ";rawEvent=" + rawEvent + ";policyFlags=" + policyFlags);
|
||||
}
|
||||
if (event.isFromSource(InputDevice.SOURCE_MOUSE)) {
|
||||
if (mClickScheduler == null) {
|
||||
Handler handler = new Handler(mContext.getMainLooper());
|
||||
@@ -89,6 +96,10 @@ public class AutoclickController extends BaseEventStreamTransformation {
|
||||
|
||||
@Override
|
||||
public void onKeyEvent(KeyEvent event, int policyFlags) {
|
||||
if (mTrace.isA11yTracingEnabledForTypes(AccessibilityTrace.FLAGS_INPUT_FILTER)) {
|
||||
mTrace.logTrace(LOG_TAG + ".onKeyEvent", AccessibilityTrace.FLAGS_INPUT_FILTER,
|
||||
"event=" + event + ";policyFlags=" + policyFlags);
|
||||
}
|
||||
if (mClickScheduler != null) {
|
||||
if (KeyEvent.isModifierKey(event.getKeyCode())) {
|
||||
mClickScheduler.updateMetaState(event.getMetaState());
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.server.accessibility;
|
||||
|
||||
import static android.accessibilityservice.AccessibilityTrace.FLAGS_INPUT_FILTER;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.os.SystemClock;
|
||||
@@ -64,6 +66,10 @@ public class KeyboardInterceptor extends BaseEventStreamTransformation implement
|
||||
|
||||
@Override
|
||||
public void onKeyEvent(KeyEvent event, int policyFlags) {
|
||||
if (mAms.getTraceManager().isA11yTracingEnabledForTypes(FLAGS_INPUT_FILTER)) {
|
||||
mAms.getTraceManager().logTrace(LOG_TAG + ".onKeyEvent",
|
||||
FLAGS_INPUT_FILTER, "event=" + event + ";policyFlags=" + policyFlags);
|
||||
}
|
||||
/*
|
||||
* Certain keys have system-level behavior that affects accessibility services.
|
||||
* Let that behavior settle before handling the keys
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.server.accessibility;
|
||||
|
||||
import android.accessibilityservice.AccessibilityTrace;
|
||||
import android.accessibilityservice.GestureDescription;
|
||||
import android.accessibilityservice.GestureDescription.GestureStep;
|
||||
import android.accessibilityservice.GestureDescription.TouchPoint;
|
||||
@@ -68,6 +69,7 @@ public class MotionEventInjector extends BaseEventStreamTransformation implement
|
||||
private final Handler mHandler;
|
||||
private final SparseArray<Boolean> mOpenGesturesInProgress = new SparseArray<>();
|
||||
|
||||
private final AccessibilityTraceManager mTrace;
|
||||
private IAccessibilityServiceClient mServiceInterfaceForCurrentGesture;
|
||||
private IntArray mSequencesInProgress = new IntArray(5);
|
||||
private boolean mIsDestroyed = false;
|
||||
@@ -80,15 +82,17 @@ public class MotionEventInjector extends BaseEventStreamTransformation implement
|
||||
/**
|
||||
* @param looper A looper on the main thread to use for dispatching new events
|
||||
*/
|
||||
public MotionEventInjector(Looper looper) {
|
||||
public MotionEventInjector(Looper looper, AccessibilityTraceManager trace) {
|
||||
mHandler = new Handler(looper, this);
|
||||
mTrace = trace;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param handler A handler to post messages. Exposes internal state for testing only.
|
||||
*/
|
||||
public MotionEventInjector(Handler handler) {
|
||||
public MotionEventInjector(Handler handler, AccessibilityTraceManager trace) {
|
||||
mHandler = handler;
|
||||
mTrace = trace;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -112,6 +116,12 @@ public class MotionEventInjector extends BaseEventStreamTransformation implement
|
||||
|
||||
@Override
|
||||
public void onMotionEvent(MotionEvent event, MotionEvent rawEvent, int policyFlags) {
|
||||
if (mTrace.isA11yTracingEnabledForTypes(
|
||||
AccessibilityTrace.FLAGS_INPUT_FILTER | AccessibilityTrace.FLAGS_GESTURE)) {
|
||||
mTrace.logTrace(LOG_TAG + ".onMotionEvent",
|
||||
AccessibilityTrace.FLAGS_INPUT_FILTER | AccessibilityTrace.FLAGS_GESTURE,
|
||||
"event=" + event + ";rawEvent=" + rawEvent + ";policyFlags=" + policyFlags);
|
||||
}
|
||||
// MotionEventInjector would cancel any injected gesture when any MotionEvent arrives.
|
||||
// For user using an external device to control the pointer movement, it's almost
|
||||
// impossible to perform the gestures. Any slightly unintended movement results in the
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.android.server.accessibility;
|
||||
|
||||
import android.accessibilityservice.AccessibilityServiceInfo;
|
||||
import android.accessibilityservice.AccessibilityTrace;
|
||||
import android.accessibilityservice.IAccessibilityServiceClient;
|
||||
import android.annotation.Nullable;
|
||||
import android.app.UiAutomation;
|
||||
@@ -269,6 +270,14 @@ class UiAutomationManager {
|
||||
// If the serviceInterface is null, the UiAutomation has been shut down on
|
||||
// another thread.
|
||||
if (serviceInterface != null) {
|
||||
if (mTrace.isA11yTracingEnabledForTypes(
|
||||
AccessibilityTrace.FLAGS_ACCESSIBILITY_SERVICE_CLIENT)) {
|
||||
mTrace.logTrace("UiAutomationService.connectServiceUnknownThread",
|
||||
AccessibilityTrace.FLAGS_ACCESSIBILITY_SERVICE_CLIENT,
|
||||
"serviceConnection=" + this + ";connectionId=" + mId
|
||||
+ "windowToken="
|
||||
+ mOverlayWindowTokens.get(Display.DEFAULT_DISPLAY));
|
||||
}
|
||||
serviceInterface.init(this, mId,
|
||||
mOverlayWindowTokens.get(Display.DEFAULT_DISPLAY));
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.server.accessibility.gestures;
|
||||
|
||||
import static android.accessibilityservice.AccessibilityTrace.FLAGS_GESTURE;
|
||||
import static android.accessibilityservice.AccessibilityTrace.FLAGS_INPUT_FILTER;
|
||||
import static android.view.MotionEvent.ACTION_CANCEL;
|
||||
import static android.view.MotionEvent.ACTION_DOWN;
|
||||
import static android.view.MotionEvent.ACTION_HOVER_ENTER;
|
||||
@@ -82,6 +84,7 @@ public class TouchExplorer extends BaseEventStreamTransformation
|
||||
implements GestureManifold.Listener {
|
||||
|
||||
static final boolean DEBUG = false;
|
||||
private static final long LOGGING_FLAGS = FLAGS_GESTURE | FLAGS_INPUT_FILTER;
|
||||
|
||||
// Tag for logging received events.
|
||||
private static final String LOG_TAG = "TouchExplorer";
|
||||
@@ -254,6 +257,10 @@ public class TouchExplorer extends BaseEventStreamTransformation
|
||||
|
||||
@Override
|
||||
public void onMotionEvent(MotionEvent event, MotionEvent rawEvent, int policyFlags) {
|
||||
if (mAms.getTraceManager().isA11yTracingEnabledForTypes(LOGGING_FLAGS)) {
|
||||
mAms.getTraceManager().logTrace(LOG_TAG + ".onMotionEvent", LOGGING_FLAGS,
|
||||
"event=" + event + ";rawEvent=" + rawEvent + ";policyFlags=" + policyFlags);
|
||||
}
|
||||
if (!event.isFromSource(InputDevice.SOURCE_TOUCHSCREEN)) {
|
||||
super.onMotionEvent(event, rawEvent, policyFlags);
|
||||
return;
|
||||
@@ -303,6 +310,10 @@ public class TouchExplorer extends BaseEventStreamTransformation
|
||||
|
||||
@Override
|
||||
public void onAccessibilityEvent(AccessibilityEvent event) {
|
||||
if (mAms.getTraceManager().isA11yTracingEnabledForTypes(LOGGING_FLAGS)) {
|
||||
mAms.getTraceManager().logTrace(LOG_TAG + ".onAccessibilityEvent",
|
||||
LOGGING_FLAGS, "event=" + event);
|
||||
}
|
||||
final int eventType = event.getEventType();
|
||||
|
||||
if (eventType == TYPE_VIEW_HOVER_EXIT) {
|
||||
@@ -341,6 +352,10 @@ public class TouchExplorer extends BaseEventStreamTransformation
|
||||
|
||||
@Override
|
||||
public void onDoubleTapAndHold(MotionEvent event, MotionEvent rawEvent, int policyFlags) {
|
||||
if (mAms.getTraceManager().isA11yTracingEnabledForTypes(LOGGING_FLAGS)) {
|
||||
mAms.getTraceManager().logTrace(LOG_TAG + ".onDoubleTapAndHold", LOGGING_FLAGS,
|
||||
"event=" + event + ";rawEvent=" + rawEvent + ";policyFlags=" + policyFlags);
|
||||
}
|
||||
if (mDispatcher.longPressWithTouchEvents(event, policyFlags)) {
|
||||
sendHoverExitAndTouchExplorationGestureEndIfNeeded(policyFlags);
|
||||
if (isSendMotionEventsEnabled()) {
|
||||
@@ -357,6 +372,10 @@ public class TouchExplorer extends BaseEventStreamTransformation
|
||||
|
||||
@Override
|
||||
public boolean onDoubleTap(MotionEvent event, MotionEvent rawEvent, int policyFlags) {
|
||||
if (mAms.getTraceManager().isA11yTracingEnabledForTypes(LOGGING_FLAGS)) {
|
||||
mAms.getTraceManager().logTrace(LOG_TAG + ".onDoubleTap", LOGGING_FLAGS,
|
||||
"event=" + event + ";rawEvent=" + rawEvent + ";policyFlags=" + policyFlags);
|
||||
}
|
||||
mAms.onTouchInteractionEnd();
|
||||
// Remove pending event deliveries.
|
||||
mSendHoverEnterAndMoveDelayed.cancel();
|
||||
@@ -389,6 +408,9 @@ public class TouchExplorer extends BaseEventStreamTransformation
|
||||
|
||||
@Override
|
||||
public boolean onGestureStarted() {
|
||||
if (mAms.getTraceManager().isA11yTracingEnabledForTypes(LOGGING_FLAGS)) {
|
||||
mAms.getTraceManager().logTrace(LOG_TAG + ".onGestureStarted", LOGGING_FLAGS);
|
||||
}
|
||||
// We have to perform gesture detection, so
|
||||
// clear the current state and try to detect.
|
||||
mSendHoverEnterAndMoveDelayed.cancel();
|
||||
@@ -402,6 +424,10 @@ public class TouchExplorer extends BaseEventStreamTransformation
|
||||
|
||||
@Override
|
||||
public boolean onGestureCompleted(AccessibilityGestureEvent gestureEvent) {
|
||||
if (mAms.getTraceManager().isA11yTracingEnabledForTypes(LOGGING_FLAGS)) {
|
||||
mAms.getTraceManager().logTrace(LOG_TAG + ".onGestureCompleted",
|
||||
LOGGING_FLAGS, "event=" + gestureEvent);
|
||||
}
|
||||
endGestureDetection(true);
|
||||
mSendTouchInteractionEndDelayed.cancel();
|
||||
dispatchGesture(gestureEvent);
|
||||
@@ -410,6 +436,10 @@ public class TouchExplorer extends BaseEventStreamTransformation
|
||||
|
||||
@Override
|
||||
public boolean onGestureCancelled(MotionEvent event, MotionEvent rawEvent, int policyFlags) {
|
||||
if (mAms.getTraceManager().isA11yTracingEnabledForTypes(LOGGING_FLAGS)) {
|
||||
mAms.getTraceManager().logTrace(LOG_TAG + ".onGestureCancelled", LOGGING_FLAGS,
|
||||
"event=" + event + ";rawEvent=" + rawEvent + ";policyFlags=" + policyFlags);
|
||||
}
|
||||
if (mState.isGestureDetecting()) {
|
||||
endGestureDetection(event.getActionMasked() == ACTION_UP);
|
||||
return true;
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.server.accessibility.magnification;
|
||||
|
||||
import static android.accessibilityservice.AccessibilityTrace.FLAGS_WINDOW_MANAGER_INTERNAL;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.annotation.NonNull;
|
||||
@@ -46,6 +48,7 @@ import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.internal.util.function.pooled.PooledLambda;
|
||||
import com.android.server.LocalServices;
|
||||
import com.android.server.accessibility.AccessibilityManagerService;
|
||||
import com.android.server.accessibility.AccessibilityTraceManager;
|
||||
import com.android.server.wm.WindowManagerInternal;
|
||||
|
||||
import java.util.Locale;
|
||||
@@ -135,6 +138,10 @@ public class FullScreenMagnificationController {
|
||||
*/
|
||||
@GuardedBy("mLock")
|
||||
boolean register() {
|
||||
if (traceEnabled()) {
|
||||
logTrace("setMagnificationCallbacks",
|
||||
"displayID=" + mDisplayId + ";callback=" + this);
|
||||
}
|
||||
mRegistered = mControllerCtx.getWindowManager().setMagnificationCallbacks(
|
||||
mDisplayId, this);
|
||||
if (!mRegistered) {
|
||||
@@ -142,6 +149,10 @@ public class FullScreenMagnificationController {
|
||||
return false;
|
||||
}
|
||||
mSpecAnimationBridge.setEnabled(true);
|
||||
if (traceEnabled()) {
|
||||
logTrace("getMagnificationRegion",
|
||||
"displayID=" + mDisplayId + ";region=" + mMagnificationRegion);
|
||||
}
|
||||
// Obtain initial state.
|
||||
mControllerCtx.getWindowManager().getMagnificationRegion(
|
||||
mDisplayId, mMagnificationRegion);
|
||||
@@ -162,6 +173,10 @@ public class FullScreenMagnificationController {
|
||||
void unregister(boolean delete) {
|
||||
if (mRegistered) {
|
||||
mSpecAnimationBridge.setEnabled(false);
|
||||
if (traceEnabled()) {
|
||||
logTrace("setMagnificationCallbacks",
|
||||
"displayID=" + mDisplayId + ";callback=null");
|
||||
}
|
||||
mControllerCtx.getWindowManager().setMagnificationCallbacks(
|
||||
mDisplayId, null);
|
||||
mMagnificationRegion.setEmpty();
|
||||
@@ -431,6 +446,10 @@ public class FullScreenMagnificationController {
|
||||
void setForceShowMagnifiableBounds(boolean show) {
|
||||
if (mRegistered) {
|
||||
mForceShowMagnifiableBounds = show;
|
||||
if (traceEnabled()) {
|
||||
logTrace("setForceShowMagnifiableBounds",
|
||||
"displayID=" + mDisplayId + ";show=" + show);
|
||||
}
|
||||
mControllerCtx.getWindowManager().setForceShowMagnifiableBounds(
|
||||
mDisplayId, show);
|
||||
}
|
||||
@@ -1255,6 +1274,16 @@ public class FullScreenMagnificationController {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean traceEnabled() {
|
||||
return mControllerCtx.getTraceManager().isA11yTracingEnabledForTypes(
|
||||
FLAGS_WINDOW_MANAGER_INTERNAL);
|
||||
}
|
||||
|
||||
private void logTrace(String methodName, String params) {
|
||||
mControllerCtx.getTraceManager().logTrace(
|
||||
"WindowManagerInternal." + methodName, FLAGS_WINDOW_MANAGER_INTERNAL, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
@@ -1320,6 +1349,13 @@ public class FullScreenMagnificationController {
|
||||
mEnabled = enabled;
|
||||
if (!mEnabled) {
|
||||
mSentMagnificationSpec.clear();
|
||||
if (mControllerCtx.getTraceManager().isA11yTracingEnabledForTypes(
|
||||
FLAGS_WINDOW_MANAGER_INTERNAL)) {
|
||||
mControllerCtx.getTraceManager().logTrace(
|
||||
"WindowManagerInternal.setMagnificationSpec",
|
||||
FLAGS_WINDOW_MANAGER_INTERNAL,
|
||||
"displayID=" + mDisplayId + ";spec=" + mSentMagnificationSpec);
|
||||
}
|
||||
mControllerCtx.getWindowManager().setMagnificationSpec(
|
||||
mDisplayId, mSentMagnificationSpec);
|
||||
}
|
||||
@@ -1367,6 +1403,13 @@ public class FullScreenMagnificationController {
|
||||
}
|
||||
|
||||
mSentMagnificationSpec.setTo(spec);
|
||||
if (mControllerCtx.getTraceManager().isA11yTracingEnabledForTypes(
|
||||
FLAGS_WINDOW_MANAGER_INTERNAL)) {
|
||||
mControllerCtx.getTraceManager().logTrace(
|
||||
"WindowManagerInternal.setMagnificationSpec",
|
||||
FLAGS_WINDOW_MANAGER_INTERNAL,
|
||||
"displayID=" + mDisplayId + ";spec=" + mSentMagnificationSpec);
|
||||
}
|
||||
mControllerCtx.getWindowManager().setMagnificationSpec(
|
||||
mDisplayId, mSentMagnificationSpec);
|
||||
}
|
||||
@@ -1455,6 +1498,7 @@ public class FullScreenMagnificationController {
|
||||
public static class ControllerContext {
|
||||
private final Context mContext;
|
||||
private final AccessibilityManagerService mAms;
|
||||
private final AccessibilityTraceManager mTrace;
|
||||
private final WindowManagerInternal mWindowManager;
|
||||
private final Handler mHandler;
|
||||
private final Long mAnimationDuration;
|
||||
@@ -1469,6 +1513,7 @@ public class FullScreenMagnificationController {
|
||||
long animationDuration) {
|
||||
mContext = context;
|
||||
mAms = ams;
|
||||
mTrace = ams.getTraceManager();
|
||||
mWindowManager = windowManager;
|
||||
mHandler = handler;
|
||||
mAnimationDuration = animationDuration;
|
||||
@@ -1490,6 +1535,14 @@ public class FullScreenMagnificationController {
|
||||
return mAms;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return AccessibilityTraceManager
|
||||
*/
|
||||
@NonNull
|
||||
public AccessibilityTraceManager getTraceManager() {
|
||||
return mTrace;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return WindowManagerInternal
|
||||
*/
|
||||
|
||||
@@ -61,6 +61,7 @@ import android.view.ViewConfiguration;
|
||||
import com.android.internal.R;
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.server.accessibility.AccessibilityManagerService;
|
||||
import com.android.server.accessibility.AccessibilityTraceManager;
|
||||
import com.android.server.accessibility.gestures.GestureUtils;
|
||||
|
||||
/**
|
||||
@@ -142,12 +143,13 @@ public class FullScreenMagnificationGestureHandler extends MagnificationGestureH
|
||||
|
||||
public FullScreenMagnificationGestureHandler(@UiContext Context context,
|
||||
FullScreenMagnificationController fullScreenMagnificationController,
|
||||
AccessibilityTraceManager trace,
|
||||
Callback callback,
|
||||
boolean detectTripleTap,
|
||||
boolean detectShortcutTrigger,
|
||||
@NonNull WindowMagnificationPromptController promptController,
|
||||
int displayId) {
|
||||
super(displayId, detectTripleTap, detectShortcutTrigger, callback);
|
||||
super(displayId, detectTripleTap, detectShortcutTrigger, trace, callback);
|
||||
if (DEBUG_ALL) {
|
||||
Log.i(mLogTag,
|
||||
"FullScreenMagnificationGestureHandler(detectTripleTap = " + detectTripleTap
|
||||
|
||||
@@ -411,8 +411,7 @@ public class MagnificationController implements WindowMagnificationManager.Callb
|
||||
synchronized (mLock) {
|
||||
if (mWindowMagnificationMgr == null) {
|
||||
mWindowMagnificationMgr = new WindowMagnificationManager(mContext,
|
||||
mAms.getCurrentUserIdLocked(),
|
||||
this);
|
||||
mAms.getCurrentUserIdLocked(), this, mAms.getTraceManager());
|
||||
}
|
||||
return mWindowMagnificationMgr;
|
||||
}
|
||||
|
||||
@@ -20,11 +20,13 @@ import static android.view.InputDevice.SOURCE_TOUCHSCREEN;
|
||||
import static android.view.MotionEvent.ACTION_CANCEL;
|
||||
import static android.view.MotionEvent.ACTION_UP;
|
||||
|
||||
import android.accessibilityservice.AccessibilityTrace;
|
||||
import android.annotation.NonNull;
|
||||
import android.util.Log;
|
||||
import android.util.Slog;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import com.android.server.accessibility.AccessibilityTraceManager;
|
||||
import com.android.server.accessibility.BaseEventStreamTransformation;
|
||||
|
||||
import java.util.ArrayDeque;
|
||||
@@ -99,14 +101,17 @@ public abstract class MagnificationGestureHandler extends BaseEventStreamTransfo
|
||||
void onTripleTapped(int displayId, int mode);
|
||||
}
|
||||
|
||||
private final AccessibilityTraceManager mTrace;
|
||||
protected final Callback mCallback;
|
||||
|
||||
protected MagnificationGestureHandler(int displayId, boolean detectTripleTap,
|
||||
boolean detectShortcutTrigger,
|
||||
AccessibilityTraceManager trace,
|
||||
@NonNull Callback callback) {
|
||||
mDisplayId = displayId;
|
||||
mDetectTripleTap = detectTripleTap;
|
||||
mDetectShortcutTrigger = detectShortcutTrigger;
|
||||
mTrace = trace;
|
||||
mCallback = callback;
|
||||
|
||||
mDebugInputEventHistory = DEBUG_EVENT_STREAM ? new ArrayDeque<>() : null;
|
||||
@@ -118,6 +123,12 @@ public abstract class MagnificationGestureHandler extends BaseEventStreamTransfo
|
||||
if (DEBUG_ALL) {
|
||||
Slog.i(mLogTag, "onMotionEvent(" + event + ")");
|
||||
}
|
||||
if (mTrace.isA11yTracingEnabledForTypes(
|
||||
AccessibilityTrace.FLAGS_INPUT_FILTER | AccessibilityTrace.FLAGS_GESTURE)) {
|
||||
mTrace.logTrace("MagnificationGestureHandler.onMotionEvent",
|
||||
AccessibilityTrace.FLAGS_INPUT_FILTER | AccessibilityTrace.FLAGS_GESTURE,
|
||||
"event=" + event + ";rawEvent=" + rawEvent + ";policyFlags=" + policyFlags);
|
||||
}
|
||||
if (DEBUG_EVENT_STREAM) {
|
||||
storeEventInto(mDebugInputEventHistory, event);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
|
||||
package com.android.server.accessibility.magnification;
|
||||
|
||||
import static android.accessibilityservice.AccessibilityTrace.FLAGS_REMOTE_MAGNIFICATION_ANIMATION_CALLBACK;
|
||||
import static android.accessibilityservice.AccessibilityTrace.FLAGS_WINDOW_MAGNIFICATION_CONNECTION;
|
||||
import static android.accessibilityservice.AccessibilityTrace.FLAGS_WINDOW_MAGNIFICATION_CONNECTION_CALLBACK;
|
||||
import static android.os.IBinder.DeathRecipient;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
@@ -27,6 +30,8 @@ import android.view.accessibility.IWindowMagnificationConnection;
|
||||
import android.view.accessibility.IWindowMagnificationConnectionCallback;
|
||||
import android.view.accessibility.MagnificationAnimationCallback;
|
||||
|
||||
import com.android.server.accessibility.AccessibilityTraceManager;
|
||||
|
||||
/**
|
||||
* A wrapper of {@link IWindowMagnificationConnection}.
|
||||
*/
|
||||
@@ -36,9 +41,12 @@ class WindowMagnificationConnectionWrapper {
|
||||
private static final String TAG = "WindowMagnificationConnectionWrapper";
|
||||
|
||||
private final @NonNull IWindowMagnificationConnection mConnection;
|
||||
private final @NonNull AccessibilityTraceManager mTrace;
|
||||
|
||||
WindowMagnificationConnectionWrapper(@NonNull IWindowMagnificationConnection connection) {
|
||||
WindowMagnificationConnectionWrapper(@NonNull IWindowMagnificationConnection connection,
|
||||
@NonNull AccessibilityTraceManager trace) {
|
||||
mConnection = connection;
|
||||
mTrace = trace;
|
||||
}
|
||||
|
||||
//Should not use this instance anymore after calling it.
|
||||
@@ -52,9 +60,15 @@ class WindowMagnificationConnectionWrapper {
|
||||
|
||||
boolean enableWindowMagnification(int displayId, float scale, float centerX, float centerY,
|
||||
@Nullable MagnificationAnimationCallback callback) {
|
||||
if (mTrace.isA11yTracingEnabledForTypes(FLAGS_WINDOW_MAGNIFICATION_CONNECTION)) {
|
||||
mTrace.logTrace(TAG + ".enableWindowMagnification",
|
||||
FLAGS_WINDOW_MAGNIFICATION_CONNECTION,
|
||||
"displayId=" + displayId + ";scale=" + scale + ";centerX=" + centerX
|
||||
+ ";centerY=" + centerY + ";callback=" + callback);
|
||||
}
|
||||
try {
|
||||
mConnection.enableWindowMagnification(displayId, scale, centerX, centerY,
|
||||
transformToRemoteCallback(callback));
|
||||
transformToRemoteCallback(callback, mTrace));
|
||||
} catch (RemoteException e) {
|
||||
if (DBG) {
|
||||
Slog.e(TAG, "Error calling enableWindowMagnification()", e);
|
||||
@@ -65,6 +79,10 @@ class WindowMagnificationConnectionWrapper {
|
||||
}
|
||||
|
||||
boolean setScale(int displayId, float scale) {
|
||||
if (mTrace.isA11yTracingEnabledForTypes(FLAGS_WINDOW_MAGNIFICATION_CONNECTION)) {
|
||||
mTrace.logTrace(TAG + ".setScale", FLAGS_WINDOW_MAGNIFICATION_CONNECTION,
|
||||
"displayId=" + displayId + ";scale=" + scale);
|
||||
}
|
||||
try {
|
||||
mConnection.setScale(displayId, scale);
|
||||
} catch (RemoteException e) {
|
||||
@@ -78,8 +96,14 @@ class WindowMagnificationConnectionWrapper {
|
||||
|
||||
boolean disableWindowMagnification(int displayId,
|
||||
@Nullable MagnificationAnimationCallback callback) {
|
||||
if (mTrace.isA11yTracingEnabledForTypes(FLAGS_WINDOW_MAGNIFICATION_CONNECTION)) {
|
||||
mTrace.logTrace(TAG + ".disableWindowMagnification",
|
||||
FLAGS_WINDOW_MAGNIFICATION_CONNECTION,
|
||||
"displayId=" + displayId + ";callback=" + callback);
|
||||
}
|
||||
try {
|
||||
mConnection.disableWindowMagnification(displayId, transformToRemoteCallback(callback));
|
||||
mConnection.disableWindowMagnification(displayId,
|
||||
transformToRemoteCallback(callback, mTrace));
|
||||
} catch (RemoteException e) {
|
||||
if (DBG) {
|
||||
Slog.e(TAG, "Error calling disableWindowMagnification()", e);
|
||||
@@ -90,6 +114,10 @@ class WindowMagnificationConnectionWrapper {
|
||||
}
|
||||
|
||||
boolean moveWindowMagnifier(int displayId, float offsetX, float offsetY) {
|
||||
if (mTrace.isA11yTracingEnabledForTypes(FLAGS_WINDOW_MAGNIFICATION_CONNECTION)) {
|
||||
mTrace.logTrace(TAG + ".moveWindowMagnifier", FLAGS_WINDOW_MAGNIFICATION_CONNECTION,
|
||||
"displayId=" + displayId + ";offsetX=" + offsetX + ";offsetY=" + offsetY);
|
||||
}
|
||||
try {
|
||||
mConnection.moveWindowMagnifier(displayId, offsetX, offsetY);
|
||||
} catch (RemoteException e) {
|
||||
@@ -102,6 +130,11 @@ class WindowMagnificationConnectionWrapper {
|
||||
}
|
||||
|
||||
boolean showMagnificationButton(int displayId, int magnificationMode) {
|
||||
if (mTrace.isA11yTracingEnabledForTypes(FLAGS_WINDOW_MAGNIFICATION_CONNECTION)) {
|
||||
mTrace.logTrace(TAG + ".showMagnificationButton",
|
||||
FLAGS_WINDOW_MAGNIFICATION_CONNECTION,
|
||||
"displayId=" + displayId + ";mode=" + magnificationMode);
|
||||
}
|
||||
try {
|
||||
mConnection.showMagnificationButton(displayId, magnificationMode);
|
||||
} catch (RemoteException e) {
|
||||
@@ -114,6 +147,10 @@ class WindowMagnificationConnectionWrapper {
|
||||
}
|
||||
|
||||
boolean removeMagnificationButton(int displayId) {
|
||||
if (mTrace.isA11yTracingEnabledForTypes(FLAGS_WINDOW_MAGNIFICATION_CONNECTION)) {
|
||||
mTrace.logTrace(TAG + ".removeMagnificationButton",
|
||||
FLAGS_WINDOW_MAGNIFICATION_CONNECTION, "displayId=" + displayId);
|
||||
}
|
||||
try {
|
||||
mConnection.removeMagnificationButton(displayId);
|
||||
} catch (RemoteException e) {
|
||||
@@ -126,6 +163,14 @@ class WindowMagnificationConnectionWrapper {
|
||||
}
|
||||
|
||||
boolean setConnectionCallback(IWindowMagnificationConnectionCallback connectionCallback) {
|
||||
if (mTrace.isA11yTracingEnabledForTypes(
|
||||
FLAGS_WINDOW_MAGNIFICATION_CONNECTION
|
||||
| FLAGS_WINDOW_MAGNIFICATION_CONNECTION_CALLBACK)) {
|
||||
mTrace.logTrace(TAG + ".setConnectionCallback",
|
||||
FLAGS_WINDOW_MAGNIFICATION_CONNECTION
|
||||
| FLAGS_WINDOW_MAGNIFICATION_CONNECTION_CALLBACK,
|
||||
"callback=" + connectionCallback);
|
||||
}
|
||||
try {
|
||||
mConnection.setConnectionCallback(connectionCallback);
|
||||
} catch (RemoteException e) {
|
||||
@@ -139,25 +184,38 @@ class WindowMagnificationConnectionWrapper {
|
||||
|
||||
private static @Nullable
|
||||
IRemoteMagnificationAnimationCallback transformToRemoteCallback(
|
||||
MagnificationAnimationCallback callback) {
|
||||
MagnificationAnimationCallback callback, AccessibilityTraceManager trace) {
|
||||
if (callback == null) {
|
||||
return null;
|
||||
}
|
||||
return new RemoteAnimationCallback(callback);
|
||||
return new RemoteAnimationCallback(callback, trace);
|
||||
}
|
||||
|
||||
private static class RemoteAnimationCallback extends
|
||||
IRemoteMagnificationAnimationCallback.Stub {
|
||||
|
||||
private final MagnificationAnimationCallback mCallback;
|
||||
private final AccessibilityTraceManager mTrace;
|
||||
|
||||
RemoteAnimationCallback(@NonNull MagnificationAnimationCallback callback) {
|
||||
RemoteAnimationCallback(@NonNull MagnificationAnimationCallback callback,
|
||||
@NonNull AccessibilityTraceManager trace) {
|
||||
mCallback = callback;
|
||||
mTrace = trace;
|
||||
if (mTrace.isA11yTracingEnabledForTypes(
|
||||
FLAGS_REMOTE_MAGNIFICATION_ANIMATION_CALLBACK)) {
|
||||
mTrace.logTrace("RemoteAnimationCallback.constructor",
|
||||
FLAGS_REMOTE_MAGNIFICATION_ANIMATION_CALLBACK, "callback=" + callback);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResult(boolean success) throws RemoteException {
|
||||
mCallback.onResult(success);
|
||||
if (mTrace.isA11yTracingEnabledForTypes(
|
||||
FLAGS_REMOTE_MAGNIFICATION_ANIMATION_CALLBACK)) {
|
||||
mTrace.logTrace("RemoteAnimationCallback.onResult",
|
||||
FLAGS_REMOTE_MAGNIFICATION_ANIMATION_CALLBACK, "success=" + success);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ import android.view.Display;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.server.accessibility.AccessibilityTraceManager;
|
||||
import com.android.server.accessibility.EventStreamTransformation;
|
||||
import com.android.server.accessibility.gestures.MultiTap;
|
||||
import com.android.server.accessibility.gestures.MultiTapAndHold;
|
||||
@@ -89,9 +90,10 @@ public class WindowMagnificationGestureHandler extends MagnificationGestureHandl
|
||||
|
||||
public WindowMagnificationGestureHandler(@UiContext Context context,
|
||||
WindowMagnificationManager windowMagnificationMgr,
|
||||
AccessibilityTraceManager trace,
|
||||
Callback callback,
|
||||
boolean detectTripleTap, boolean detectShortcutTrigger, int displayId) {
|
||||
super(displayId, detectTripleTap, detectShortcutTrigger, callback);
|
||||
super(displayId, detectTripleTap, detectShortcutTrigger, trace, callback);
|
||||
if (DEBUG_ALL) {
|
||||
Slog.i(mLogTag,
|
||||
"WindowMagnificationGestureHandler() , displayId = " + displayId + ")");
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
|
||||
package com.android.server.accessibility.magnification;
|
||||
|
||||
import static android.accessibilityservice.AccessibilityTrace.FLAGS_WINDOW_MAGNIFICATION_CONNECTION;
|
||||
import static android.accessibilityservice.AccessibilityTrace.FLAGS_WINDOW_MAGNIFICATION_CONNECTION_CALLBACK;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.content.BroadcastReceiver;
|
||||
@@ -39,6 +42,7 @@ import com.android.internal.annotations.GuardedBy;
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.internal.os.BackgroundThread;
|
||||
import com.android.server.LocalServices;
|
||||
import com.android.server.accessibility.AccessibilityTraceManager;
|
||||
import com.android.server.statusbar.StatusBarManagerInternal;
|
||||
|
||||
/**
|
||||
@@ -111,11 +115,14 @@ public class WindowMagnificationManager implements
|
||||
}
|
||||
|
||||
private final Callback mCallback;
|
||||
private final AccessibilityTraceManager mTrace;
|
||||
|
||||
public WindowMagnificationManager(Context context, int userId, @NonNull Callback callback) {
|
||||
public WindowMagnificationManager(Context context, int userId, @NonNull Callback callback,
|
||||
AccessibilityTraceManager trace) {
|
||||
mContext = context;
|
||||
mUserId = userId;
|
||||
mCallback = callback;
|
||||
mTrace = trace;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -135,7 +142,7 @@ public class WindowMagnificationManager implements
|
||||
mConnectionWrapper = null;
|
||||
}
|
||||
if (connection != null) {
|
||||
mConnectionWrapper = new WindowMagnificationConnectionWrapper(connection);
|
||||
mConnectionWrapper = new WindowMagnificationConnectionWrapper(connection, mTrace);
|
||||
}
|
||||
|
||||
if (mConnectionWrapper != null) {
|
||||
@@ -197,7 +204,10 @@ public class WindowMagnificationManager implements
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mTrace.isA11yTracingEnabledForTypes(FLAGS_WINDOW_MAGNIFICATION_CONNECTION)) {
|
||||
mTrace.logTrace(TAG + ".requestWindowMagnificationConnection",
|
||||
FLAGS_WINDOW_MAGNIFICATION_CONNECTION, "connect=" + connect);
|
||||
}
|
||||
final long identity = Binder.clearCallingIdentity();
|
||||
try {
|
||||
final StatusBarManagerInternal service = LocalServices.getService(
|
||||
@@ -511,6 +521,12 @@ public class WindowMagnificationManager implements
|
||||
|
||||
@Override
|
||||
public void onWindowMagnifierBoundsChanged(int displayId, Rect bounds) {
|
||||
if (mTrace.isA11yTracingEnabledForTypes(
|
||||
FLAGS_WINDOW_MAGNIFICATION_CONNECTION_CALLBACK)) {
|
||||
mTrace.logTrace(TAG + "ConnectionCallback.onWindowMagnifierBoundsChanged",
|
||||
FLAGS_WINDOW_MAGNIFICATION_CONNECTION_CALLBACK,
|
||||
"displayId=" + displayId + ";bounds=" + bounds);
|
||||
}
|
||||
synchronized (mLock) {
|
||||
WindowMagnifier magnifier = mWindowMagnifiers.get(displayId);
|
||||
if (magnifier == null) {
|
||||
@@ -527,11 +543,23 @@ public class WindowMagnificationManager implements
|
||||
@Override
|
||||
public void onChangeMagnificationMode(int displayId, int magnificationMode)
|
||||
throws RemoteException {
|
||||
if (mTrace.isA11yTracingEnabledForTypes(
|
||||
FLAGS_WINDOW_MAGNIFICATION_CONNECTION_CALLBACK)) {
|
||||
mTrace.logTrace(TAG + "ConnectionCallback.onChangeMagnificationMode",
|
||||
FLAGS_WINDOW_MAGNIFICATION_CONNECTION_CALLBACK,
|
||||
"displayId=" + displayId + ";mode=" + magnificationMode);
|
||||
}
|
||||
//TODO: Uses this method to change the magnification mode on non-default display.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSourceBoundsChanged(int displayId, Rect sourceBounds) {
|
||||
if (mTrace.isA11yTracingEnabledForTypes(
|
||||
FLAGS_WINDOW_MAGNIFICATION_CONNECTION_CALLBACK)) {
|
||||
mTrace.logTrace(TAG + "ConnectionCallback.onSourceBoundsChanged",
|
||||
FLAGS_WINDOW_MAGNIFICATION_CONNECTION_CALLBACK,
|
||||
"displayId=" + displayId + ";source=" + sourceBounds);
|
||||
}
|
||||
synchronized (mLock) {
|
||||
WindowMagnifier magnifier = mWindowMagnifiers.get(displayId);
|
||||
if (magnifier == null) {
|
||||
@@ -543,11 +571,23 @@ public class WindowMagnificationManager implements
|
||||
|
||||
@Override
|
||||
public void onPerformScaleAction(int displayId, float scale) {
|
||||
if (mTrace.isA11yTracingEnabledForTypes(
|
||||
FLAGS_WINDOW_MAGNIFICATION_CONNECTION_CALLBACK)) {
|
||||
mTrace.logTrace(TAG + "ConnectionCallback.onPerformScaleAction",
|
||||
FLAGS_WINDOW_MAGNIFICATION_CONNECTION_CALLBACK,
|
||||
"displayId=" + displayId + ";scale=" + scale);
|
||||
}
|
||||
mCallback.onPerformScaleAction(displayId, scale);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccessibilityActionPerformed(int displayId) {
|
||||
if (mTrace.isA11yTracingEnabledForTypes(
|
||||
FLAGS_WINDOW_MAGNIFICATION_CONNECTION_CALLBACK)) {
|
||||
mTrace.logTrace(TAG + "ConnectionCallback.onAccessibilityActionPerformed",
|
||||
FLAGS_WINDOW_MAGNIFICATION_CONNECTION_CALLBACK,
|
||||
"displayId=" + displayId);
|
||||
}
|
||||
mCallback.onAccessibilityActionPerformed(displayId);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.server.wm;
|
||||
|
||||
import static android.accessibilityservice.AccessibilityTrace.FLAGS_MAGNIFICATION_CALLBACK;
|
||||
import static android.accessibilityservice.AccessibilityTrace.FLAGS_WINDOWS_FOR_ACCESSIBILITY_CALLBACK;
|
||||
import static android.os.Build.IS_USER;
|
||||
import static android.view.InsetsState.ITYPE_NAVIGATION_BAR;
|
||||
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY;
|
||||
@@ -34,6 +36,7 @@ import static com.android.server.accessibility.AccessibilityTraceProto.CALLING_P
|
||||
import static com.android.server.accessibility.AccessibilityTraceProto.CALLING_PKG;
|
||||
import static com.android.server.accessibility.AccessibilityTraceProto.CALLING_STACKS;
|
||||
import static com.android.server.accessibility.AccessibilityTraceProto.ELAPSED_REALTIME_NANOS;
|
||||
import static com.android.server.accessibility.AccessibilityTraceProto.LOGGING_TYPE;
|
||||
import static com.android.server.accessibility.AccessibilityTraceProto.PROCESS_NAME;
|
||||
import static com.android.server.accessibility.AccessibilityTraceProto.THREAD_ID_NAME;
|
||||
import static com.android.server.accessibility.AccessibilityTraceProto.WHERE;
|
||||
@@ -42,6 +45,7 @@ import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME
|
||||
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
|
||||
import static com.android.server.wm.utils.RegionUtils.forEachRect;
|
||||
|
||||
import android.accessibilityservice.AccessibilityTrace;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.annotation.NonNull;
|
||||
@@ -100,8 +104,6 @@ import com.android.server.wm.WindowManagerInternal.WindowsForAccessibilityCallba
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -117,21 +119,16 @@ final class AccessibilityController {
|
||||
private static final String TAG = AccessibilityController.class.getSimpleName();
|
||||
|
||||
private static final Object STATIC_LOCK = new Object();
|
||||
static AccessibilityControllerInternal
|
||||
static AccessibilityControllerInternalImpl
|
||||
getAccessibilityControllerInternal(WindowManagerService service) {
|
||||
return AccessibilityControllerInternalImpl.getInstance(service);
|
||||
}
|
||||
|
||||
private final AccessibilityTracing mAccessibilityTracing;
|
||||
private final AccessibilityControllerInternalImpl mAccessibilityTracing;
|
||||
private final WindowManagerService mService;
|
||||
private static final Rect EMPTY_RECT = new Rect();
|
||||
private static final float[] sTempFloats = new float[9];
|
||||
|
||||
AccessibilityController(WindowManagerService service) {
|
||||
mService = service;
|
||||
mAccessibilityTracing = AccessibilityTracing.getInstance(service);
|
||||
}
|
||||
|
||||
private SparseArray<DisplayMagnifier> mDisplayMagnifiers = new SparseArray<>();
|
||||
private SparseArray<WindowsForAccessibilityObserver> mWindowsForAccessibilityObserver =
|
||||
new SparseArray<>();
|
||||
@@ -139,10 +136,17 @@ final class AccessibilityController {
|
||||
// Set to true if initializing window population complete.
|
||||
private boolean mAllObserversInitialized = true;
|
||||
|
||||
AccessibilityController(WindowManagerService service) {
|
||||
mService = service;
|
||||
mAccessibilityTracing =
|
||||
AccessibilityController.getAccessibilityControllerInternal(service);
|
||||
}
|
||||
|
||||
boolean setMagnificationCallbacks(int displayId, MagnificationCallbacks callbacks) {
|
||||
if (mAccessibilityTracing.isEnabled()) {
|
||||
mAccessibilityTracing.logState(
|
||||
if (mAccessibilityTracing.isTracingEnabled(FLAGS_MAGNIFICATION_CALLBACK)) {
|
||||
mAccessibilityTracing.logTrace(
|
||||
TAG + ".setMagnificationCallbacks",
|
||||
FLAGS_MAGNIFICATION_CALLBACK,
|
||||
"displayId=" + displayId + "; callbacks={" + callbacks + "}");
|
||||
}
|
||||
boolean result = false;
|
||||
@@ -185,9 +189,10 @@ final class AccessibilityController {
|
||||
*/
|
||||
boolean setWindowsForAccessibilityCallback(int displayId,
|
||||
WindowsForAccessibilityCallback callback) {
|
||||
if (mAccessibilityTracing.isEnabled()) {
|
||||
mAccessibilityTracing.logState(
|
||||
if (mAccessibilityTracing.isTracingEnabled(FLAGS_WINDOWS_FOR_ACCESSIBILITY_CALLBACK)) {
|
||||
mAccessibilityTracing.logTrace(
|
||||
TAG + ".setWindowsForAccessibilityCallback",
|
||||
FLAGS_WINDOWS_FOR_ACCESSIBILITY_CALLBACK,
|
||||
"displayId=" + displayId + "; callback={" + callback + "}");
|
||||
}
|
||||
|
||||
@@ -239,9 +244,10 @@ final class AccessibilityController {
|
||||
}
|
||||
|
||||
void performComputeChangedWindowsNot(int displayId, boolean forceSend) {
|
||||
if (mAccessibilityTracing.isEnabled()) {
|
||||
mAccessibilityTracing.logState(
|
||||
if (mAccessibilityTracing.isTracingEnabled(FLAGS_WINDOWS_FOR_ACCESSIBILITY_CALLBACK)) {
|
||||
mAccessibilityTracing.logTrace(
|
||||
TAG + ".performComputeChangedWindowsNot",
|
||||
FLAGS_WINDOWS_FOR_ACCESSIBILITY_CALLBACK,
|
||||
"displayId=" + displayId + "; forceSend=" + forceSend);
|
||||
}
|
||||
WindowsForAccessibilityObserver observer = null;
|
||||
@@ -258,8 +264,10 @@ final class AccessibilityController {
|
||||
}
|
||||
|
||||
void setMagnificationSpec(int displayId, MagnificationSpec spec) {
|
||||
if (mAccessibilityTracing.isEnabled()) {
|
||||
mAccessibilityTracing.logState(TAG + ".setMagnificationSpec",
|
||||
if (mAccessibilityTracing.isTracingEnabled(FLAGS_MAGNIFICATION_CALLBACK
|
||||
| FLAGS_WINDOWS_FOR_ACCESSIBILITY_CALLBACK)) {
|
||||
mAccessibilityTracing.logTrace(TAG + ".setMagnificationSpec",
|
||||
FLAGS_MAGNIFICATION_CALLBACK | FLAGS_WINDOWS_FOR_ACCESSIBILITY_CALLBACK,
|
||||
"displayId=" + displayId + "; spec={" + spec + "}");
|
||||
}
|
||||
final DisplayMagnifier displayMagnifier = mDisplayMagnifiers.get(displayId);
|
||||
@@ -274,8 +282,9 @@ final class AccessibilityController {
|
||||
}
|
||||
|
||||
void getMagnificationRegion(int displayId, Region outMagnificationRegion) {
|
||||
if (mAccessibilityTracing.isEnabled()) {
|
||||
mAccessibilityTracing.logState(TAG + ".getMagnificationRegion",
|
||||
if (mAccessibilityTracing.isTracingEnabled(FLAGS_MAGNIFICATION_CALLBACK)) {
|
||||
mAccessibilityTracing.logTrace(TAG + ".getMagnificationRegion",
|
||||
FLAGS_MAGNIFICATION_CALLBACK,
|
||||
"displayId=" + displayId + "; outMagnificationRegion={" + outMagnificationRegion
|
||||
+ "}");
|
||||
}
|
||||
@@ -286,9 +295,10 @@ final class AccessibilityController {
|
||||
}
|
||||
|
||||
void onRectangleOnScreenRequested(int displayId, Rect rectangle) {
|
||||
if (mAccessibilityTracing.isEnabled()) {
|
||||
mAccessibilityTracing.logState(
|
||||
if (mAccessibilityTracing.isTracingEnabled(FLAGS_MAGNIFICATION_CALLBACK)) {
|
||||
mAccessibilityTracing.logTrace(
|
||||
TAG + ".onRectangleOnScreenRequested",
|
||||
FLAGS_MAGNIFICATION_CALLBACK,
|
||||
"displayId=" + displayId + "; rectangle={" + rectangle + "}");
|
||||
}
|
||||
final DisplayMagnifier displayMagnifier = mDisplayMagnifiers.get(displayId);
|
||||
@@ -299,9 +309,11 @@ final class AccessibilityController {
|
||||
}
|
||||
|
||||
void onWindowLayersChanged(int displayId) {
|
||||
if (mAccessibilityTracing.isEnabled()) {
|
||||
mAccessibilityTracing.logState(
|
||||
TAG + ".onWindowLayersChanged", "displayId=" + displayId);
|
||||
if (mAccessibilityTracing.isTracingEnabled(FLAGS_MAGNIFICATION_CALLBACK
|
||||
| FLAGS_WINDOWS_FOR_ACCESSIBILITY_CALLBACK)) {
|
||||
mAccessibilityTracing.logTrace(TAG + ".onWindowLayersChanged",
|
||||
FLAGS_MAGNIFICATION_CALLBACK | FLAGS_WINDOWS_FOR_ACCESSIBILITY_CALLBACK,
|
||||
"displayId=" + displayId);
|
||||
}
|
||||
final DisplayMagnifier displayMagnifier = mDisplayMagnifiers.get(displayId);
|
||||
if (displayMagnifier != null) {
|
||||
@@ -315,8 +327,10 @@ final class AccessibilityController {
|
||||
}
|
||||
|
||||
void onRotationChanged(DisplayContent displayContent) {
|
||||
if (mAccessibilityTracing.isEnabled()) {
|
||||
mAccessibilityTracing.logState(TAG + ".onRotationChanged",
|
||||
if (mAccessibilityTracing.isTracingEnabled(FLAGS_MAGNIFICATION_CALLBACK
|
||||
| FLAGS_WINDOWS_FOR_ACCESSIBILITY_CALLBACK)) {
|
||||
mAccessibilityTracing.logTrace(TAG + ".onRotationChanged",
|
||||
FLAGS_MAGNIFICATION_CALLBACK | FLAGS_WINDOWS_FOR_ACCESSIBILITY_CALLBACK,
|
||||
"displayContent={" + displayContent + "}");
|
||||
}
|
||||
final int displayId = displayContent.getDisplayId();
|
||||
@@ -332,8 +346,9 @@ final class AccessibilityController {
|
||||
}
|
||||
|
||||
void onAppWindowTransition(int displayId, int transition) {
|
||||
if (mAccessibilityTracing.isEnabled()) {
|
||||
mAccessibilityTracing.logState(TAG + ".onAppWindowTransition",
|
||||
if (mAccessibilityTracing.isTracingEnabled(FLAGS_MAGNIFICATION_CALLBACK)) {
|
||||
mAccessibilityTracing.logTrace(TAG + ".onAppWindowTransition",
|
||||
FLAGS_MAGNIFICATION_CALLBACK,
|
||||
"displayId=" + displayId + "; transition=" + transition);
|
||||
}
|
||||
final DisplayMagnifier displayMagnifier = mDisplayMagnifiers.get(displayId);
|
||||
@@ -344,8 +359,10 @@ final class AccessibilityController {
|
||||
}
|
||||
|
||||
void onWindowTransition(WindowState windowState, int transition) {
|
||||
if (mAccessibilityTracing.isEnabled()) {
|
||||
mAccessibilityTracing.logState(TAG + ".onWindowTransition",
|
||||
if (mAccessibilityTracing.isTracingEnabled(FLAGS_MAGNIFICATION_CALLBACK
|
||||
| FLAGS_WINDOWS_FOR_ACCESSIBILITY_CALLBACK)) {
|
||||
mAccessibilityTracing.logTrace(TAG + ".onWindowTransition",
|
||||
FLAGS_MAGNIFICATION_CALLBACK | FLAGS_WINDOWS_FOR_ACCESSIBILITY_CALLBACK,
|
||||
"windowState={" + windowState + "}; transition=" + transition);
|
||||
}
|
||||
final int displayId = windowState.getDisplayId();
|
||||
@@ -362,9 +379,9 @@ final class AccessibilityController {
|
||||
|
||||
void onWindowFocusChangedNot(int displayId) {
|
||||
// Not relevant for the display magnifier.
|
||||
if (mAccessibilityTracing.isEnabled()) {
|
||||
mAccessibilityTracing.logState(
|
||||
TAG + ".onWindowFocusChangedNot", "displayId=" + displayId);
|
||||
if (mAccessibilityTracing.isTracingEnabled(FLAGS_WINDOWS_FOR_ACCESSIBILITY_CALLBACK)) {
|
||||
mAccessibilityTracing.logTrace(TAG + ".onWindowFocusChangedNot",
|
||||
FLAGS_WINDOWS_FOR_ACCESSIBILITY_CALLBACK, "displayId=" + displayId);
|
||||
}
|
||||
WindowsForAccessibilityObserver observer = null;
|
||||
synchronized (mService.mGlobalLock) {
|
||||
@@ -424,12 +441,10 @@ final class AccessibilityController {
|
||||
}
|
||||
|
||||
void onSomeWindowResizedOrMovedWithCallingUid(int callingUid, int... displayIds) {
|
||||
if (mAccessibilityTracing.isEnabled()) {
|
||||
mAccessibilityTracing.logState(
|
||||
TAG + ".onSomeWindowResizedOrMoved",
|
||||
"displayIds={" + displayIds.toString() + "}",
|
||||
"".getBytes(),
|
||||
callingUid);
|
||||
if (mAccessibilityTracing.isTracingEnabled(FLAGS_WINDOWS_FOR_ACCESSIBILITY_CALLBACK)) {
|
||||
mAccessibilityTracing.logTrace(TAG + ".onSomeWindowResizedOrMoved",
|
||||
FLAGS_WINDOWS_FOR_ACCESSIBILITY_CALLBACK,
|
||||
"displayIds={" + displayIds.toString() + "}", "".getBytes(), callingUid);
|
||||
}
|
||||
// Not relevant for the display magnifier.
|
||||
for (int i = 0; i < displayIds.length; i++) {
|
||||
@@ -442,9 +457,10 @@ final class AccessibilityController {
|
||||
}
|
||||
|
||||
void drawMagnifiedRegionBorderIfNeeded(int displayId, SurfaceControl.Transaction t) {
|
||||
if (mAccessibilityTracing.isEnabled()) {
|
||||
mAccessibilityTracing.logState(
|
||||
if (mAccessibilityTracing.isTracingEnabled(FLAGS_MAGNIFICATION_CALLBACK)) {
|
||||
mAccessibilityTracing.logTrace(
|
||||
TAG + ".drawMagnifiedRegionBorderIfNeeded",
|
||||
FLAGS_MAGNIFICATION_CALLBACK,
|
||||
"displayId=" + displayId + "; transaction={" + t + "}");
|
||||
}
|
||||
final DisplayMagnifier displayMagnifier = mDisplayMagnifiers.get(displayId);
|
||||
@@ -455,8 +471,9 @@ final class AccessibilityController {
|
||||
}
|
||||
|
||||
MagnificationSpec getMagnificationSpecForWindow(WindowState windowState) {
|
||||
if (mAccessibilityTracing.isEnabled()) {
|
||||
mAccessibilityTracing.logState(TAG + ".getMagnificationSpecForWindow",
|
||||
if (mAccessibilityTracing.isTracingEnabled(FLAGS_MAGNIFICATION_CALLBACK)) {
|
||||
mAccessibilityTracing.logTrace(TAG + ".getMagnificationSpecForWindow",
|
||||
FLAGS_MAGNIFICATION_CALLBACK,
|
||||
"windowState={" + windowState + "}");
|
||||
}
|
||||
final int displayId = windowState.getDisplayId();
|
||||
@@ -468,17 +485,19 @@ final class AccessibilityController {
|
||||
}
|
||||
|
||||
boolean hasCallbacks() {
|
||||
if (mAccessibilityTracing.isEnabled()) {
|
||||
mAccessibilityTracing.logState(TAG + ".hasCallbacks");
|
||||
if (mAccessibilityTracing.isTracingEnabled(FLAGS_MAGNIFICATION_CALLBACK
|
||||
| FLAGS_WINDOWS_FOR_ACCESSIBILITY_CALLBACK)) {
|
||||
mAccessibilityTracing.logTrace(TAG + ".hasCallbacks",
|
||||
FLAGS_MAGNIFICATION_CALLBACK | FLAGS_WINDOWS_FOR_ACCESSIBILITY_CALLBACK);
|
||||
}
|
||||
return (mDisplayMagnifiers.size() > 0
|
||||
|| mWindowsForAccessibilityObserver.size() > 0);
|
||||
}
|
||||
|
||||
void setForceShowMagnifiableBounds(int displayId, boolean show) {
|
||||
if (mAccessibilityTracing.isEnabled()) {
|
||||
mAccessibilityTracing.logState(TAG + ".setForceShowMagnifiableBounds",
|
||||
"displayId=" + displayId + "; show=" + show);
|
||||
if (mAccessibilityTracing.isTracingEnabled(FLAGS_MAGNIFICATION_CALLBACK)) {
|
||||
mAccessibilityTracing.logTrace(TAG + ".setForceShowMagnifiableBounds",
|
||||
FLAGS_MAGNIFICATION_CALLBACK, "displayId=" + displayId + "; show=" + show);
|
||||
}
|
||||
final DisplayMagnifier displayMagnifier = mDisplayMagnifiers.get(displayId);
|
||||
if (displayMagnifier != null) {
|
||||
@@ -495,12 +514,11 @@ final class AccessibilityController {
|
||||
|
||||
void handleWindowObserverOfEmbeddedDisplay(
|
||||
int embeddedDisplayId, WindowState parentWindow, int callingUid) {
|
||||
if (mAccessibilityTracing.isEnabled()) {
|
||||
mAccessibilityTracing.logState(TAG + ".handleWindowObserverOfEmbeddedDisplay",
|
||||
if (mAccessibilityTracing.isTracingEnabled(FLAGS_WINDOWS_FOR_ACCESSIBILITY_CALLBACK)) {
|
||||
mAccessibilityTracing.logTrace(TAG + ".handleWindowObserverOfEmbeddedDisplay",
|
||||
FLAGS_WINDOWS_FOR_ACCESSIBILITY_CALLBACK,
|
||||
"embeddedDisplayId=" + embeddedDisplayId + "; parentWindowState={"
|
||||
+ parentWindow + "}",
|
||||
"".getBytes(),
|
||||
callingUid);
|
||||
+ parentWindow + "}", "".getBytes(), callingUid);
|
||||
}
|
||||
if (embeddedDisplayId == Display.DEFAULT_DISPLAY || parentWindow == null) {
|
||||
return;
|
||||
@@ -537,9 +555,9 @@ final class AccessibilityController {
|
||||
}
|
||||
|
||||
void onImeSurfaceShownChanged(WindowState windowState, boolean shown) {
|
||||
if (mAccessibilityTracing.isEnabled()) {
|
||||
mAccessibilityTracing.logState(TAG + ".onImeSurfaceShownChanged",
|
||||
"windowState=" + windowState + "; shown=" + shown);
|
||||
if (mAccessibilityTracing.isTracingEnabled(FLAGS_MAGNIFICATION_CALLBACK)) {
|
||||
mAccessibilityTracing.logTrace(TAG + ".onImeSurfaceShownChanged",
|
||||
FLAGS_MAGNIFICATION_CALLBACK, "windowState=" + windowState + ";shown=" + shown);
|
||||
}
|
||||
final int displayId = windowState.getDisplayId();
|
||||
final DisplayMagnifier displayMagnifier = mDisplayMagnifiers.get(displayId);
|
||||
@@ -609,7 +627,7 @@ final class AccessibilityController {
|
||||
private final Handler mHandler;
|
||||
private final DisplayContent mDisplayContent;
|
||||
private final Display mDisplay;
|
||||
private final AccessibilityTracing mAccessibilityTracing;
|
||||
private final AccessibilityControllerInternalImpl mAccessibilityTracing;
|
||||
|
||||
private final MagnificationCallbacks mCallbacks;
|
||||
|
||||
@@ -628,11 +646,13 @@ final class AccessibilityController {
|
||||
mDisplay = display;
|
||||
mHandler = new MyHandler(mService.mH.getLooper());
|
||||
mMagnifedViewport = new MagnifiedViewport();
|
||||
mAccessibilityTracing = AccessibilityTracing.getInstance(mService);
|
||||
mAccessibilityTracing =
|
||||
AccessibilityController.getAccessibilityControllerInternal(mService);
|
||||
mLongAnimationDuration = mDisplayContext.getResources().getInteger(
|
||||
com.android.internal.R.integer.config_longAnimTime);
|
||||
if (mAccessibilityTracing.isEnabled()) {
|
||||
mAccessibilityTracing.logState(LOG_TAG + ".DisplayMagnifier.constructor",
|
||||
if (mAccessibilityTracing.isTracingEnabled(FLAGS_MAGNIFICATION_CALLBACK)) {
|
||||
mAccessibilityTracing.logTrace(LOG_TAG + ".DisplayMagnifier.constructor",
|
||||
FLAGS_MAGNIFICATION_CALLBACK,
|
||||
"windowManagerService={" + windowManagerService + "}; displayContent={"
|
||||
+ displayContent + "}; display={" + display + "}; callbacks={"
|
||||
+ callbacks + "}");
|
||||
@@ -640,9 +660,9 @@ final class AccessibilityController {
|
||||
}
|
||||
|
||||
void setMagnificationSpec(MagnificationSpec spec) {
|
||||
if (mAccessibilityTracing.isEnabled()) {
|
||||
mAccessibilityTracing.logState(
|
||||
LOG_TAG + ".setMagnificationSpec", "spec={" + spec + "}");
|
||||
if (mAccessibilityTracing.isTracingEnabled(FLAGS_MAGNIFICATION_CALLBACK)) {
|
||||
mAccessibilityTracing.logTrace(LOG_TAG + ".setMagnificationSpec",
|
||||
FLAGS_MAGNIFICATION_CALLBACK, "spec={" + spec + "}");
|
||||
}
|
||||
mMagnifedViewport.updateMagnificationSpec(spec);
|
||||
mMagnifedViewport.recomputeBounds();
|
||||
@@ -652,25 +672,26 @@ final class AccessibilityController {
|
||||
}
|
||||
|
||||
void setForceShowMagnifiableBounds(boolean show) {
|
||||
if (mAccessibilityTracing.isEnabled()) {
|
||||
mAccessibilityTracing.logState(
|
||||
LOG_TAG + ".setForceShowMagnifiableBounds", "show=" + show);
|
||||
if (mAccessibilityTracing.isTracingEnabled(FLAGS_MAGNIFICATION_CALLBACK)) {
|
||||
mAccessibilityTracing.logTrace(LOG_TAG + ".setForceShowMagnifiableBounds",
|
||||
FLAGS_MAGNIFICATION_CALLBACK, "show=" + show);
|
||||
}
|
||||
mForceShowMagnifiableBounds = show;
|
||||
mMagnifedViewport.setMagnifiedRegionBorderShown(show, true);
|
||||
}
|
||||
|
||||
boolean isForceShowingMagnifiableBounds() {
|
||||
if (mAccessibilityTracing.isEnabled()) {
|
||||
mAccessibilityTracing.logState(LOG_TAG + ".isForceShowingMagnifiableBounds");
|
||||
if (mAccessibilityTracing.isTracingEnabled(FLAGS_MAGNIFICATION_CALLBACK)) {
|
||||
mAccessibilityTracing.logTrace(LOG_TAG + ".isForceShowingMagnifiableBounds",
|
||||
FLAGS_MAGNIFICATION_CALLBACK);
|
||||
}
|
||||
return mForceShowMagnifiableBounds;
|
||||
}
|
||||
|
||||
void onRectangleOnScreenRequested(Rect rectangle) {
|
||||
if (mAccessibilityTracing.isEnabled()) {
|
||||
mAccessibilityTracing.logState(
|
||||
LOG_TAG + ".onRectangleOnScreenRequested", "rectangle={" + rectangle + "}");
|
||||
if (mAccessibilityTracing.isTracingEnabled(FLAGS_MAGNIFICATION_CALLBACK)) {
|
||||
mAccessibilityTracing.logTrace(LOG_TAG + ".onRectangleOnScreenRequested",
|
||||
FLAGS_MAGNIFICATION_CALLBACK, "rectangle={" + rectangle + "}");
|
||||
}
|
||||
if (DEBUG_RECTANGLE_REQUESTED) {
|
||||
Slog.i(LOG_TAG, "Rectangle on screen requested: " + rectangle);
|
||||
@@ -693,8 +714,9 @@ final class AccessibilityController {
|
||||
}
|
||||
|
||||
void onWindowLayersChanged() {
|
||||
if (mAccessibilityTracing.isEnabled()) {
|
||||
mAccessibilityTracing.logState(LOG_TAG + ".onWindowLayersChanged");
|
||||
if (mAccessibilityTracing.isTracingEnabled(FLAGS_MAGNIFICATION_CALLBACK)) {
|
||||
mAccessibilityTracing.logTrace(
|
||||
LOG_TAG + ".onWindowLayersChanged", FLAGS_MAGNIFICATION_CALLBACK);
|
||||
}
|
||||
if (DEBUG_LAYERS) {
|
||||
Slog.i(LOG_TAG, "Layers changed.");
|
||||
@@ -704,9 +726,9 @@ final class AccessibilityController {
|
||||
}
|
||||
|
||||
void onRotationChanged(DisplayContent displayContent) {
|
||||
if (mAccessibilityTracing.isEnabled()) {
|
||||
mAccessibilityTracing.logState(
|
||||
LOG_TAG + ".onRotationChanged", "displayContent={" + displayContent + "}");
|
||||
if (mAccessibilityTracing.isTracingEnabled(FLAGS_MAGNIFICATION_CALLBACK)) {
|
||||
mAccessibilityTracing.logTrace(LOG_TAG + ".onRotationChanged",
|
||||
FLAGS_MAGNIFICATION_CALLBACK, "displayContent={" + displayContent + "}");
|
||||
}
|
||||
if (DEBUG_ROTATION) {
|
||||
final int rotation = displayContent.getRotation();
|
||||
@@ -718,8 +740,9 @@ final class AccessibilityController {
|
||||
}
|
||||
|
||||
void onAppWindowTransition(int displayId, int transition) {
|
||||
if (mAccessibilityTracing.isEnabled()) {
|
||||
mAccessibilityTracing.logState(LOG_TAG + ".onAppWindowTransition",
|
||||
if (mAccessibilityTracing.isTracingEnabled(FLAGS_MAGNIFICATION_CALLBACK)) {
|
||||
mAccessibilityTracing.logTrace(LOG_TAG + ".onAppWindowTransition",
|
||||
FLAGS_MAGNIFICATION_CALLBACK,
|
||||
"displayId=" + displayId + "; transition=" + transition);
|
||||
}
|
||||
if (DEBUG_WINDOW_TRANSITIONS) {
|
||||
@@ -743,8 +766,9 @@ final class AccessibilityController {
|
||||
}
|
||||
|
||||
void onWindowTransition(WindowState windowState, int transition) {
|
||||
if (mAccessibilityTracing.isEnabled()) {
|
||||
mAccessibilityTracing.logState(LOG_TAG + ".onWindowTransition",
|
||||
if (mAccessibilityTracing.isTracingEnabled(FLAGS_MAGNIFICATION_CALLBACK)) {
|
||||
mAccessibilityTracing.logTrace(LOG_TAG + ".onWindowTransition",
|
||||
FLAGS_MAGNIFICATION_CALLBACK,
|
||||
"windowState={" + windowState + "}; transition=" + transition);
|
||||
}
|
||||
if (DEBUG_WINDOW_TRANSITIONS) {
|
||||
@@ -801,18 +825,18 @@ final class AccessibilityController {
|
||||
}
|
||||
|
||||
void onImeSurfaceShownChanged(boolean shown) {
|
||||
if (mAccessibilityTracing.isEnabled()) {
|
||||
mAccessibilityTracing.logState(
|
||||
LOG_TAG + ".onImeSurfaceShownChanged", "shown=" + shown);
|
||||
if (mAccessibilityTracing.isTracingEnabled(FLAGS_MAGNIFICATION_CALLBACK)) {
|
||||
mAccessibilityTracing.logTrace(LOG_TAG + ".onImeSurfaceShownChanged",
|
||||
FLAGS_MAGNIFICATION_CALLBACK, "shown=" + shown);
|
||||
}
|
||||
mHandler.obtainMessage(MyHandler.MESSAGE_NOTIFY_IME_WINDOW_VISIBILITY_CHANGED,
|
||||
shown ? 1 : 0, 0).sendToTarget();
|
||||
}
|
||||
|
||||
MagnificationSpec getMagnificationSpecForWindow(WindowState windowState) {
|
||||
if (mAccessibilityTracing.isEnabled()) {
|
||||
mAccessibilityTracing.logState(LOG_TAG + ".getMagnificationSpecForWindow",
|
||||
"windowState={" + windowState + "}");
|
||||
if (mAccessibilityTracing.isTracingEnabled(FLAGS_MAGNIFICATION_CALLBACK)) {
|
||||
mAccessibilityTracing.logTrace(LOG_TAG + ".getMagnificationSpecForWindow",
|
||||
FLAGS_MAGNIFICATION_CALLBACK, "windowState={" + windowState + "}");
|
||||
}
|
||||
MagnificationSpec spec = mMagnifedViewport.getMagnificationSpec();
|
||||
if (spec != null && !spec.isNop()) {
|
||||
@@ -824,8 +848,9 @@ final class AccessibilityController {
|
||||
}
|
||||
|
||||
void getMagnificationRegion(Region outMagnificationRegion) {
|
||||
if (mAccessibilityTracing.isEnabled()) {
|
||||
mAccessibilityTracing.logState(LOG_TAG + ".getMagnificationRegion",
|
||||
if (mAccessibilityTracing.isTracingEnabled(FLAGS_MAGNIFICATION_CALLBACK)) {
|
||||
mAccessibilityTracing.logTrace(LOG_TAG + ".getMagnificationRegion",
|
||||
FLAGS_MAGNIFICATION_CALLBACK,
|
||||
"outMagnificationRegion={" + outMagnificationRegion + "}");
|
||||
}
|
||||
// Make sure we're working with the most current bounds
|
||||
@@ -834,25 +859,26 @@ final class AccessibilityController {
|
||||
}
|
||||
|
||||
void destroy() {
|
||||
if (mAccessibilityTracing.isEnabled()) {
|
||||
mAccessibilityTracing.logState(LOG_TAG + ".destroy");
|
||||
if (mAccessibilityTracing.isTracingEnabled(FLAGS_MAGNIFICATION_CALLBACK)) {
|
||||
mAccessibilityTracing.logTrace(LOG_TAG + ".destroy", FLAGS_MAGNIFICATION_CALLBACK);
|
||||
}
|
||||
mMagnifedViewport.destroyWindow();
|
||||
}
|
||||
|
||||
// Can be called outside of a surface transaction
|
||||
void showMagnificationBoundsIfNeeded() {
|
||||
if (mAccessibilityTracing.isEnabled()) {
|
||||
mAccessibilityTracing.logState(LOG_TAG + ".showMagnificationBoundsIfNeeded");
|
||||
if (mAccessibilityTracing.isTracingEnabled(FLAGS_MAGNIFICATION_CALLBACK)) {
|
||||
mAccessibilityTracing.logTrace(LOG_TAG + ".showMagnificationBoundsIfNeeded",
|
||||
FLAGS_MAGNIFICATION_CALLBACK);
|
||||
}
|
||||
mHandler.obtainMessage(MyHandler.MESSAGE_SHOW_MAGNIFIED_REGION_BOUNDS_IF_NEEDED)
|
||||
.sendToTarget();
|
||||
}
|
||||
|
||||
void drawMagnifiedRegionBorderIfNeeded(SurfaceControl.Transaction t) {
|
||||
if (mAccessibilityTracing.isEnabled()) {
|
||||
mAccessibilityTracing.logState(LOG_TAG + ".drawMagnifiedRegionBorderIfNeeded",
|
||||
"transition={" + t + "}");
|
||||
if (mAccessibilityTracing.isTracingEnabled(FLAGS_MAGNIFICATION_CALLBACK)) {
|
||||
mAccessibilityTracing.logTrace(LOG_TAG + ".drawMagnifiedRegionBorderIfNeeded",
|
||||
FLAGS_MAGNIFICATION_CALLBACK, "transition={" + t + "}");
|
||||
}
|
||||
mMagnifedViewport.drawWindowIfNeeded(t);
|
||||
}
|
||||
@@ -1491,7 +1517,7 @@ final class AccessibilityController {
|
||||
|
||||
private final Handler mHandler;
|
||||
|
||||
private final AccessibilityTracing mAccessibilityTracing;
|
||||
private final AccessibilityControllerInternalImpl mAccessibilityTracing;
|
||||
|
||||
private final WindowsForAccessibilityCallback mCallback;
|
||||
|
||||
@@ -1511,24 +1537,26 @@ final class AccessibilityController {
|
||||
mCallback = callback;
|
||||
mDisplayId = displayId;
|
||||
mHandler = new MyHandler(mService.mH.getLooper());
|
||||
mAccessibilityTracing = AccessibilityTracing.getInstance(mService);
|
||||
mAccessibilityTracing =
|
||||
AccessibilityController.getAccessibilityControllerInternal(mService);
|
||||
mRecurringAccessibilityEventsIntervalMillis = ViewConfiguration
|
||||
.getSendRecurringAccessibilityEventsInterval();
|
||||
computeChangedWindows(true);
|
||||
}
|
||||
|
||||
void performComputeChangedWindows(boolean forceSend) {
|
||||
if (mAccessibilityTracing.isEnabled()) {
|
||||
mAccessibilityTracing.logState(LOG_TAG + ".performComputeChangedWindows",
|
||||
"forceSend=" + forceSend);
|
||||
if (mAccessibilityTracing.isTracingEnabled(FLAGS_WINDOWS_FOR_ACCESSIBILITY_CALLBACK)) {
|
||||
mAccessibilityTracing.logTrace(LOG_TAG + ".performComputeChangedWindows",
|
||||
FLAGS_WINDOWS_FOR_ACCESSIBILITY_CALLBACK, "forceSend=" + forceSend);
|
||||
}
|
||||
mHandler.removeMessages(MyHandler.MESSAGE_COMPUTE_CHANGED_WINDOWS);
|
||||
computeChangedWindows(forceSend);
|
||||
}
|
||||
|
||||
void scheduleComputeChangedWindows() {
|
||||
if (mAccessibilityTracing.isEnabled()) {
|
||||
mAccessibilityTracing.logState(LOG_TAG + ".scheduleComputeChangedWindows");
|
||||
if (mAccessibilityTracing.isTracingEnabled(FLAGS_WINDOWS_FOR_ACCESSIBILITY_CALLBACK)) {
|
||||
mAccessibilityTracing.logTrace(LOG_TAG + ".scheduleComputeChangedWindows",
|
||||
FLAGS_WINDOWS_FOR_ACCESSIBILITY_CALLBACK);
|
||||
}
|
||||
if (!mHandler.hasMessages(MyHandler.MESSAGE_COMPUTE_CHANGED_WINDOWS)) {
|
||||
mHandler.sendEmptyMessageDelayed(MyHandler.MESSAGE_COMPUTE_CHANGED_WINDOWS,
|
||||
@@ -1564,9 +1592,9 @@ final class AccessibilityController {
|
||||
* @param forceSend Send the windows the accessibility even if they haven't changed.
|
||||
*/
|
||||
void computeChangedWindows(boolean forceSend) {
|
||||
if (mAccessibilityTracing.isEnabled()) {
|
||||
mAccessibilityTracing.logState(
|
||||
LOG_TAG + ".computeChangedWindows", "forceSend=" + forceSend);
|
||||
if (mAccessibilityTracing.isTracingEnabled(FLAGS_WINDOWS_FOR_ACCESSIBILITY_CALLBACK)) {
|
||||
mAccessibilityTracing.logTrace(LOG_TAG + ".computeChangedWindows",
|
||||
FLAGS_WINDOWS_FOR_ACCESSIBILITY_CALLBACK, "forceSend=" + forceSend);
|
||||
}
|
||||
if (DEBUG) {
|
||||
Slog.i(LOG_TAG, "computeChangedWindows()");
|
||||
@@ -1912,8 +1940,8 @@ final class AccessibilityController {
|
||||
private static final class AccessibilityControllerInternalImpl
|
||||
implements AccessibilityControllerInternal {
|
||||
|
||||
private static AccessibilityControllerInternal sInstance;
|
||||
static AccessibilityControllerInternal getInstance(WindowManagerService service) {
|
||||
private static AccessibilityControllerInternalImpl sInstance;
|
||||
static AccessibilityControllerInternalImpl getInstance(WindowManagerService service) {
|
||||
synchronized (STATIC_LOCK) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new AccessibilityControllerInternalImpl(service);
|
||||
@@ -1923,18 +1951,23 @@ final class AccessibilityController {
|
||||
}
|
||||
|
||||
private final AccessibilityTracing mTracing;
|
||||
private volatile long mEnabledTracingFlags;
|
||||
|
||||
private AccessibilityControllerInternalImpl(WindowManagerService service) {
|
||||
mTracing = AccessibilityTracing.getInstance(service);
|
||||
mEnabledTracingFlags = 0L;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startTrace() {
|
||||
public void startTrace(long loggingTypes) {
|
||||
mEnabledTracingFlags = loggingTypes;
|
||||
mTracing.startTrace();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopTrace() {
|
||||
mTracing.stopTrace();
|
||||
mEnabledTracingFlags = 0L;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1942,19 +1975,37 @@ final class AccessibilityController {
|
||||
return mTracing.isEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logTrace(
|
||||
String where, String callingParams, byte[] a11yDump, int callingUid,
|
||||
StackTraceElement[] stackTrace) {
|
||||
mTracing.logState(where, callingParams, a11yDump, callingUid, stackTrace);
|
||||
boolean isTracingEnabled(long flags) {
|
||||
return (flags & mEnabledTracingFlags) != 0L;
|
||||
}
|
||||
|
||||
void logTrace(String where, long loggingTypes) {
|
||||
logTrace(where, loggingTypes, "");
|
||||
}
|
||||
|
||||
void logTrace(String where, long loggingTypes, String callingParams) {
|
||||
logTrace(where, loggingTypes, callingParams, "".getBytes(), Binder.getCallingUid());
|
||||
}
|
||||
|
||||
void logTrace(String where, long loggingTypes, String callingParams, byte[] a11yDump,
|
||||
int callingUid) {
|
||||
mTracing.logState(where, loggingTypes, callingParams, a11yDump, callingUid,
|
||||
new HashSet<String>(Arrays.asList("logTrace")));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logTrace(
|
||||
String where, String callingParams, byte[] a11yDump, int callingUid,
|
||||
StackTraceElement[] callStack, long timeStamp, int processId, long threadId) {
|
||||
mTracing.logState(where, callingParams, a11yDump, callingUid, callStack, timeStamp,
|
||||
processId, threadId);
|
||||
public void logTrace(String where, long loggingTypes, String callingParams, byte[] a11yDump,
|
||||
int callingUid, StackTraceElement[] stackTrace, Set<String> ignoreStackEntries) {
|
||||
mTracing.logState(where, loggingTypes, callingParams, a11yDump, callingUid, stackTrace,
|
||||
ignoreStackEntries);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logTrace(String where, long loggingTypes, String callingParams, byte[] a11yDump,
|
||||
int callingUid, StackTraceElement[] callStack, long timeStamp, int processId,
|
||||
long threadId, Set<String> ignoreStackEntries) {
|
||||
mTracing.logState(where, loggingTypes, callingParams, a11yDump, callingUid, callStack,
|
||||
timeStamp, processId, threadId, ignoreStackEntries);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1971,7 +2022,6 @@ final class AccessibilityController {
|
||||
|
||||
private static final int BUFFER_CAPACITY = 1024 * 1024 * 12;
|
||||
private static final String TRACE_FILENAME = "/data/misc/a11ytrace/a11y_trace.pb";
|
||||
private static final String TRACE_DIRECTORY = "/data/misc/a11ytrace/";
|
||||
private static final String TAG = "AccessibilityTracing";
|
||||
private static final long MAGIC_NUMBER_VALUE =
|
||||
((long) MAGIC_NUMBER_H << 32) | MAGIC_NUMBER_L;
|
||||
@@ -2001,13 +2051,6 @@ final class AccessibilityController {
|
||||
return;
|
||||
}
|
||||
synchronized (mLock) {
|
||||
try {
|
||||
Files.createDirectories(Paths.get(TRACE_DIRECTORY));
|
||||
mTraceFile.createNewFile();
|
||||
} catch (Exception e) {
|
||||
Slog.e(TAG, "Error: Failed to create trace file.");
|
||||
return;
|
||||
}
|
||||
mEnabled = true;
|
||||
mBuffer.resetBuffer();
|
||||
}
|
||||
@@ -2038,86 +2081,127 @@ final class AccessibilityController {
|
||||
/**
|
||||
* Write an accessibility trace log entry.
|
||||
*/
|
||||
void logState(String where) {
|
||||
void logState(String where, long loggingTypes) {
|
||||
if (!mEnabled) {
|
||||
return;
|
||||
}
|
||||
logState(where, "");
|
||||
logState(where, loggingTypes, "");
|
||||
}
|
||||
|
||||
/**
|
||||
* Write an accessibility trace log entry.
|
||||
*/
|
||||
void logState(String where, String callingParams) {
|
||||
void logState(String where, long loggingTypes, String callingParams) {
|
||||
if (!mEnabled) {
|
||||
return;
|
||||
}
|
||||
logState(where, callingParams, "".getBytes());
|
||||
logState(where, loggingTypes, callingParams, "".getBytes());
|
||||
}
|
||||
|
||||
/**
|
||||
* Write an accessibility trace log entry.
|
||||
*/
|
||||
void logState(String where, String callingParams, byte[] a11yDump) {
|
||||
void logState(String where, long loggingTypes, String callingParams, byte[] a11yDump) {
|
||||
if (!mEnabled) {
|
||||
return;
|
||||
}
|
||||
logState(where, callingParams, a11yDump, Binder.getCallingUid());
|
||||
logState(where, loggingTypes, callingParams, a11yDump, Binder.getCallingUid(),
|
||||
new HashSet<String>(Arrays.asList("logState")));
|
||||
}
|
||||
|
||||
/**
|
||||
* Write an accessibility trace log entry.
|
||||
*/
|
||||
void logState(
|
||||
String where, String callingParams, byte[] a11yDump, int callingUid) {
|
||||
void logState(String where, long loggingTypes, String callingParams, byte[] a11yDump,
|
||||
int callingUid, Set<String> ignoreStackEntries) {
|
||||
if (!mEnabled) {
|
||||
return;
|
||||
}
|
||||
StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace();
|
||||
|
||||
logState(where, callingParams, a11yDump, callingUid, stackTraceElements);
|
||||
ignoreStackEntries.add("logState");
|
||||
logState(where, loggingTypes, callingParams, a11yDump, callingUid, stackTraceElements,
|
||||
ignoreStackEntries);
|
||||
}
|
||||
|
||||
/**
|
||||
* Write an accessibility trace log entry.
|
||||
*/
|
||||
void logState(String where, String callingParams, byte[] a11yDump, int callingUid,
|
||||
StackTraceElement[] stackTrace) {
|
||||
void logState(String where, long loggingTypes, String callingParams, byte[] a11yDump,
|
||||
int callingUid, StackTraceElement[] stackTrace, Set<String> ignoreStackEntries) {
|
||||
if (!mEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
log(where, callingParams, a11yDump, callingUid, stackTrace,
|
||||
log(where, loggingTypes, callingParams, a11yDump, callingUid, stackTrace,
|
||||
SystemClock.elapsedRealtimeNanos(),
|
||||
Process.myPid() + ":" + Application.getProcessName(),
|
||||
Thread.currentThread().getId() + ":" + Thread.currentThread().getName());
|
||||
Thread.currentThread().getId() + ":" + Thread.currentThread().getName(),
|
||||
ignoreStackEntries);
|
||||
}
|
||||
|
||||
/**
|
||||
* Write an accessibility trace log entry.
|
||||
*/
|
||||
void logState(String where, String callingParams, byte[] a11yDump, int callingUid,
|
||||
StackTraceElement[] callingStack, long timeStamp, int processId, long threadId) {
|
||||
void logState(String where, long loggingTypes, String callingParams, byte[] a11yDump,
|
||||
int callingUid, StackTraceElement[] callingStack, long timeStamp, int processId,
|
||||
long threadId, Set<String> ignoreStackEntries) {
|
||||
if (!mEnabled) {
|
||||
return;
|
||||
}
|
||||
log(where, callingParams, a11yDump, callingUid, callingStack, timeStamp,
|
||||
String.valueOf(processId), String.valueOf(threadId));
|
||||
log(where, loggingTypes, callingParams, a11yDump, callingUid, callingStack, timeStamp,
|
||||
String.valueOf(processId), String.valueOf(threadId), ignoreStackEntries);
|
||||
}
|
||||
|
||||
private String toStackTraceString(StackTraceElement[] stackTraceElements) {
|
||||
private String toStackTraceString(StackTraceElement[] stackTraceElements,
|
||||
Set<String> ignoreStackEntries) {
|
||||
|
||||
if (stackTraceElements == null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
boolean skip = true;
|
||||
for (int i = 0; i < stackTraceElements.length; i++) {
|
||||
if (stackTraceElements[i].toString().contains(
|
||||
AccessibilityTracing.class.getSimpleName())) {
|
||||
skip = false;
|
||||
} else if (!skip) {
|
||||
stringBuilder.append(stackTraceElements[i].toString()).append("\n");
|
||||
int i = 0;
|
||||
|
||||
// Skip the first a few elements until after any ignoreStackEntries
|
||||
int firstMatch = -1;
|
||||
while (i < stackTraceElements.length) {
|
||||
for (String ele : ignoreStackEntries) {
|
||||
if (stackTraceElements[i].toString().contains(ele)) {
|
||||
// found the first stack element containing the ignorable stack entries
|
||||
firstMatch = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (firstMatch < 0) {
|
||||
// Haven't found the first match yet, continue
|
||||
i++;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
int lastMatch = firstMatch;
|
||||
if (i < stackTraceElements.length) {
|
||||
i++;
|
||||
// Found the first match. Now look for the last match.
|
||||
while (i < stackTraceElements.length) {
|
||||
for (String ele : ignoreStackEntries) {
|
||||
if (stackTraceElements[i].toString().contains(ele)) {
|
||||
// This is a match. Look at the next stack element.
|
||||
lastMatch = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (lastMatch != i) {
|
||||
// Found a no-match.
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
i = lastMatch + 1;
|
||||
while (i < stackTraceElements.length) {
|
||||
stringBuilder.append(stackTraceElements[i].toString()).append("\n");
|
||||
i++;
|
||||
}
|
||||
return stringBuilder.toString();
|
||||
}
|
||||
@@ -2125,19 +2209,22 @@ final class AccessibilityController {
|
||||
/**
|
||||
* Write the current state to the buffer
|
||||
*/
|
||||
private void log(String where, String callingParams, byte[] a11yDump, int callingUid,
|
||||
StackTraceElement[] callingStack, long timeStamp, String processName,
|
||||
String threadName) {
|
||||
private void log(String where, long loggingTypes, String callingParams, byte[] a11yDump,
|
||||
int callingUid, StackTraceElement[] callingStack, long timeStamp,
|
||||
String processName, String threadName, Set<String> ignoreStackEntries) {
|
||||
SomeArgs args = SomeArgs.obtain();
|
||||
args.arg1 = timeStamp;
|
||||
args.arg2 = where;
|
||||
args.arg3 = processName;
|
||||
args.arg4 = threadName;
|
||||
args.arg5 = callingUid;
|
||||
args.arg6 = callingParams;
|
||||
args.arg7 = callingStack;
|
||||
args.arg8 = a11yDump;
|
||||
mHandler.obtainMessage(LogHandler.MESSAGE_LOG_TRACE_ENTRY, args).sendToTarget();
|
||||
args.arg2 = loggingTypes;
|
||||
args.arg3 = where;
|
||||
args.arg4 = processName;
|
||||
args.arg5 = threadName;
|
||||
args.arg6 = ignoreStackEntries;
|
||||
args.arg7 = callingParams;
|
||||
args.arg8 = callingStack;
|
||||
args.arg9 = a11yDump;
|
||||
|
||||
mHandler.obtainMessage(
|
||||
LogHandler.MESSAGE_LOG_TRACE_ENTRY, callingUid, 0, args).sendToTarget();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2166,8 +2253,6 @@ final class AccessibilityController {
|
||||
LocalServices.getService(PackageManagerInternal.class);
|
||||
|
||||
long tokenOuter = os.start(ENTRY);
|
||||
String callingStack =
|
||||
toStackTraceString((StackTraceElement[]) args.arg7);
|
||||
|
||||
long reportedTimeStampNanos = (long) args.arg1;
|
||||
long currentElapsedRealtimeNanos = SystemClock.elapsedRealtimeNanos();
|
||||
@@ -2180,13 +2265,25 @@ final class AccessibilityController {
|
||||
|
||||
os.write(ELAPSED_REALTIME_NANOS, reportedTimeStampNanos);
|
||||
os.write(CALENDAR_TIME, fm.format(reportedTimeMillis).toString());
|
||||
os.write(WHERE, (String) args.arg2);
|
||||
os.write(PROCESS_NAME, (String) args.arg3);
|
||||
os.write(THREAD_ID_NAME, (String) args.arg4);
|
||||
os.write(CALLING_PKG, pmInternal.getNameForUid((int) args.arg5));
|
||||
os.write(CALLING_PARAMS, (String) args.arg6);
|
||||
|
||||
long loggingTypes = (long) args.arg2;
|
||||
List<String> loggingTypeNames =
|
||||
AccessibilityTrace.getNamesOfLoggingTypes(loggingTypes);
|
||||
|
||||
for (String type : loggingTypeNames) {
|
||||
os.write(LOGGING_TYPE, type);
|
||||
}
|
||||
os.write(WHERE, (String) args.arg3);
|
||||
os.write(PROCESS_NAME, (String) args.arg4);
|
||||
os.write(THREAD_ID_NAME, (String) args.arg5);
|
||||
os.write(CALLING_PKG, pmInternal.getNameForUid(message.arg1));
|
||||
os.write(CALLING_PARAMS, (String) args.arg7);
|
||||
|
||||
String callingStack = toStackTraceString(
|
||||
(StackTraceElement[]) args.arg8, (Set<String>) args.arg6);
|
||||
|
||||
os.write(CALLING_STACKS, callingStack);
|
||||
os.write(ACCESSIBILITY_SERVICE, (byte[]) args.arg8);
|
||||
os.write(ACCESSIBILITY_SERVICE, (byte[]) args.arg9);
|
||||
|
||||
long tokenInner = os.start(WINDOW_MANAGER_SERVICE);
|
||||
synchronized (mService.mGlobalLock) {
|
||||
|
||||
@@ -40,6 +40,7 @@ import com.android.server.input.InputManagerService;
|
||||
import com.android.server.policy.WindowManagerPolicy;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Window manager local system service interface.
|
||||
@@ -54,17 +55,18 @@ public abstract class WindowManagerInternal {
|
||||
*/
|
||||
public interface AccessibilityControllerInternal {
|
||||
/**
|
||||
* Enable the accessibility trace logging.
|
||||
* Start tracing for the given logging types.
|
||||
* @param loggingTypeFlags flags of the logging types enabled.
|
||||
*/
|
||||
void startTrace();
|
||||
void startTrace(long loggingTypeFlags);
|
||||
|
||||
/**
|
||||
* Disable the accessibility trace logging.
|
||||
* Disable accessibility tracing for all logging types.
|
||||
*/
|
||||
void stopTrace();
|
||||
|
||||
/**
|
||||
* Is trace enabled or not.
|
||||
* Is tracing enabled for any logging type.
|
||||
*/
|
||||
boolean isAccessibilityTracingEnabled();
|
||||
|
||||
@@ -73,20 +75,23 @@ public abstract class WindowManagerInternal {
|
||||
*
|
||||
* @param where A string to identify this log entry, which can be used to filter/search
|
||||
* through the tracing file.
|
||||
* @param loggingTypeFlags The flags for the logging types this log entry belongs to.
|
||||
* @param callingParams The parameters for the method to be logged.
|
||||
* @param a11yDump The proto byte array for a11y state when the entry is generated.
|
||||
* @param callingUid The calling uid.
|
||||
* @param stackTrace The stack trace, null if not needed.
|
||||
* @param ignoreStackEntries The stack entries can be removed
|
||||
*/
|
||||
void logTrace(
|
||||
String where, String callingParams, byte[] a11yDump, int callingUid,
|
||||
StackTraceElement[] stackTrace);
|
||||
String where, long loggingTypeFlags, String callingParams, byte[] a11yDump,
|
||||
int callingUid, StackTraceElement[] stackTrace, Set<String> ignoreStackEntries);
|
||||
|
||||
/**
|
||||
* Add an accessibility trace entry.
|
||||
*
|
||||
* @param where A string to identify this log entry, which can be used to filter/search
|
||||
* through the tracing file.
|
||||
* @param loggingTypeFlags The flags for the logging types this log entry belongs to.
|
||||
* @param callingParams The parameters for the method to be logged.
|
||||
* @param a11yDump The proto byte array for a11y state when the entry is generated.
|
||||
* @param callingUid The calling uid.
|
||||
@@ -94,9 +99,11 @@ public abstract class WindowManagerInternal {
|
||||
* @param timeStamp The time when the method to be logged is called.
|
||||
* @param processId The calling process Id.
|
||||
* @param threadId The calling thread Id.
|
||||
* @param ignoreStackEntries The stack entries can be removed
|
||||
*/
|
||||
void logTrace(String where, String callingParams, byte[] a11yDump, int callingUid,
|
||||
StackTraceElement[] callStack, long timeStamp, int processId, long threadId);
|
||||
void logTrace(String where, long loggingTypeFlags, String callingParams,
|
||||
byte[] a11yDump, int callingUid, StackTraceElement[] callStack, long timeStamp,
|
||||
int processId, long threadId, Set<String> ignoreStackEntries);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -65,6 +65,7 @@ import static org.mockito.Mockito.verifyNoMoreInteractions;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.accessibilityservice.AccessibilityServiceInfo;
|
||||
import android.accessibilityservice.AccessibilityTrace;
|
||||
import android.accessibilityservice.IAccessibilityServiceClient;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
|
||||
@@ -29,6 +29,7 @@ import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.accessibilityservice.AccessibilityServiceInfo;
|
||||
import android.accessibilityservice.AccessibilityTrace;
|
||||
import android.accessibilityservice.GestureDescription;
|
||||
import android.accessibilityservice.IAccessibilityServiceClient;
|
||||
import android.content.ComponentName;
|
||||
|
||||
@@ -120,6 +120,7 @@ public class AccessibilityWindowManagerTest {
|
||||
@Mock private AccessibilityWindowManager.AccessibilityEventSender mMockA11yEventSender;
|
||||
@Mock private AccessibilitySecurityPolicy mMockA11ySecurityPolicy;
|
||||
@Mock private AccessibilitySecurityPolicy.AccessibilityUserManager mMockA11yUserManager;
|
||||
@Mock private AccessibilityTraceManager mMockA11yTraceManager;
|
||||
|
||||
@Mock private IBinder mMockHostToken;
|
||||
@Mock private IBinder mMockEmbeddedToken;
|
||||
@@ -140,7 +141,8 @@ public class AccessibilityWindowManagerTest {
|
||||
mMockWindowManagerInternal,
|
||||
mMockA11yEventSender,
|
||||
mMockA11ySecurityPolicy,
|
||||
mMockA11yUserManager);
|
||||
mMockA11yUserManager,
|
||||
mMockA11yTraceManager);
|
||||
// Starts tracking window of default display and sets the default display
|
||||
// as top focused display before each testing starts.
|
||||
startTrackingPerDisplay(Display.DEFAULT_DISPLAY);
|
||||
|
||||
@@ -56,11 +56,13 @@ public class KeyboardInterceptorTest {
|
||||
private MessageCapturingHandler mHandler = new MessageCapturingHandler(
|
||||
msg -> mInterceptor.handleMessage(msg));
|
||||
@Mock AccessibilityManagerService mMockAms;
|
||||
@Mock AccessibilityTraceManager mMockTraceManager;
|
||||
@Mock WindowManagerPolicy mMockPolicy;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
when(mMockAms.getTraceManager()).thenReturn(mMockTraceManager);
|
||||
mInterceptor = new KeyboardInterceptor(mMockAms, mMockPolicy, mHandler);
|
||||
}
|
||||
|
||||
|
||||
@@ -113,6 +113,7 @@ public class MotionEventInjectorTest {
|
||||
|
||||
MotionEventInjector mMotionEventInjector;
|
||||
IAccessibilityServiceClient mServiceInterface;
|
||||
AccessibilityTraceManager mTrace;
|
||||
List<GestureStep> mLineList = new ArrayList<>();
|
||||
List<GestureStep> mClickList = new ArrayList<>();
|
||||
List<GestureStep> mContinuedLineList1 = new ArrayList<>();
|
||||
@@ -139,7 +140,8 @@ public class MotionEventInjectorTest {
|
||||
return mMotionEventInjector.handleMessage(msg);
|
||||
}
|
||||
});
|
||||
mMotionEventInjector = new MotionEventInjector(mMessageCapturingHandler);
|
||||
mTrace = mock(AccessibilityTraceManager.class);
|
||||
mMotionEventInjector = new MotionEventInjector(mMessageCapturingHandler, mTrace);
|
||||
mServiceInterface = mock(IAccessibilityServiceClient.class);
|
||||
|
||||
mLineList = createSimpleGestureFromPoints(0, 0, false, LINE_DURATION, LINE_START, LINE_END);
|
||||
|
||||
@@ -27,6 +27,7 @@ import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.accessibilityservice.AccessibilityServiceInfo;
|
||||
import android.accessibilityservice.AccessibilityTrace;
|
||||
import android.accessibilityservice.IAccessibilityServiceClient;
|
||||
import android.app.UiAutomation;
|
||||
import android.content.Context;
|
||||
|
||||
@@ -36,6 +36,7 @@ import static com.android.server.accessibility.gestures.TouchState.STATE_TOUCH_E
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.accessibilityservice.AccessibilityGestureEvent;
|
||||
import android.accessibilityservice.AccessibilityService;
|
||||
@@ -53,6 +54,7 @@ import androidx.test.InstrumentationRegistry;
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
|
||||
import com.android.server.accessibility.AccessibilityManagerService;
|
||||
import com.android.server.accessibility.AccessibilityTraceManager;
|
||||
import com.android.server.accessibility.EventStreamTransformation;
|
||||
import com.android.server.accessibility.utils.GestureLogParser;
|
||||
import com.android.server.testutils.OffsettableClock;
|
||||
@@ -107,6 +109,8 @@ public class TouchExplorerTest {
|
||||
|
||||
@Mock
|
||||
private AccessibilityManagerService mMockAms;
|
||||
@Mock
|
||||
private AccessibilityTraceManager mMockTraceManager;
|
||||
@Captor
|
||||
private ArgumentCaptor<AccessibilityGestureEvent> mGestureCaptor;
|
||||
|
||||
@@ -143,6 +147,7 @@ public class TouchExplorerTest {
|
||||
if (Looper.myLooper() == null) {
|
||||
Looper.prepare();
|
||||
}
|
||||
when(mMockAms.getTraceManager()).thenReturn(mMockTraceManager);
|
||||
mContext = InstrumentationRegistry.getContext();
|
||||
mTouchSlop = ViewConfiguration.get(mContext).getScaledTouchSlop();
|
||||
AccessibilityManagerService ams = new AccessibilityManagerService(mContext);
|
||||
|
||||
@@ -52,6 +52,7 @@ import androidx.test.InstrumentationRegistry;
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
|
||||
import com.android.server.accessibility.AccessibilityManagerService;
|
||||
import com.android.server.accessibility.AccessibilityTraceManager;
|
||||
import com.android.server.accessibility.test.MessageCapturingHandler;
|
||||
import com.android.server.wm.WindowManagerInternal;
|
||||
import com.android.server.wm.WindowManagerInternal.MagnificationCallbacks;
|
||||
@@ -93,6 +94,7 @@ public class FullScreenMagnificationControllerTest {
|
||||
mock(FullScreenMagnificationController.ControllerContext.class);
|
||||
final Context mMockContext = mock(Context.class);
|
||||
final AccessibilityManagerService mMockAms = mock(AccessibilityManagerService.class);
|
||||
final AccessibilityTraceManager mMockTraceManager = mock(AccessibilityTraceManager.class);
|
||||
final WindowManagerInternal mMockWindowManager = mock(WindowManagerInternal.class);
|
||||
private final MagnificationAnimationCallback mAnimationCallback = mock(
|
||||
MagnificationAnimationCallback.class);
|
||||
@@ -113,9 +115,11 @@ public class FullScreenMagnificationControllerTest {
|
||||
when(mMockContext.getMainLooper()).thenReturn(looper);
|
||||
when(mMockControllerCtx.getContext()).thenReturn(mMockContext);
|
||||
when(mMockControllerCtx.getAms()).thenReturn(mMockAms);
|
||||
when(mMockControllerCtx.getTraceManager()).thenReturn(mMockTraceManager);
|
||||
when(mMockControllerCtx.getWindowManager()).thenReturn(mMockWindowManager);
|
||||
when(mMockControllerCtx.getHandler()).thenReturn(mMessageCapturingHandler);
|
||||
when(mMockControllerCtx.getAnimationDuration()).thenReturn(1000L);
|
||||
when(mMockAms.getTraceManager()).thenReturn(mMockTraceManager);
|
||||
initMockWindowManager();
|
||||
|
||||
mFullScreenMagnificationController = new FullScreenMagnificationController(
|
||||
|
||||
@@ -52,6 +52,7 @@ import androidx.test.InstrumentationRegistry;
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
|
||||
import com.android.server.accessibility.AccessibilityManagerService;
|
||||
import com.android.server.accessibility.AccessibilityTraceManager;
|
||||
import com.android.server.accessibility.EventStreamTransformation;
|
||||
import com.android.server.accessibility.magnification.FullScreenMagnificationController.MagnificationInfoChangedCallback;
|
||||
import com.android.server.testutils.OffsettableClock;
|
||||
@@ -129,6 +130,10 @@ public class FullScreenMagnificationGestureHandlerTest {
|
||||
MagnificationInfoChangedCallback mMagnificationInfoChangedCallback;
|
||||
@Mock
|
||||
WindowMagnificationPromptController mWindowMagnificationPromptController;
|
||||
@Mock
|
||||
AccessibilityManagerService mMockAccessibilityManagerService;
|
||||
@Mock
|
||||
AccessibilityTraceManager mMockTraceManager;
|
||||
|
||||
private OffsettableClock mClock;
|
||||
private FullScreenMagnificationGestureHandler mMgh;
|
||||
@@ -144,7 +149,9 @@ public class FullScreenMagnificationGestureHandlerTest {
|
||||
mock(FullScreenMagnificationController.ControllerContext.class);
|
||||
final WindowManagerInternal mockWindowManager = mock(WindowManagerInternal.class);
|
||||
when(mockController.getContext()).thenReturn(mContext);
|
||||
when(mockController.getAms()).thenReturn(mock(AccessibilityManagerService.class));
|
||||
when(mockController.getAms()).thenReturn(mMockAccessibilityManagerService);
|
||||
when(mMockAccessibilityManagerService.getTraceManager()).thenReturn(mMockTraceManager);
|
||||
when(mockController.getTraceManager()).thenReturn(mMockTraceManager);
|
||||
when(mockController.getWindowManager()).thenReturn(mockWindowManager);
|
||||
when(mockController.getHandler()).thenReturn(new Handler(mContext.getMainLooper()));
|
||||
when(mockController.newValueAnimator()).thenReturn(new ValueAnimator());
|
||||
@@ -179,7 +186,7 @@ public class FullScreenMagnificationGestureHandlerTest {
|
||||
private FullScreenMagnificationGestureHandler newInstance(boolean detectTripleTap,
|
||||
boolean detectShortcutTrigger) {
|
||||
FullScreenMagnificationGestureHandler h = new FullScreenMagnificationGestureHandler(
|
||||
mContext, mFullScreenMagnificationController, mMockCallback,
|
||||
mContext, mFullScreenMagnificationController, mMockTraceManager, mMockCallback,
|
||||
detectTripleTap, detectShortcutTrigger,
|
||||
mWindowMagnificationPromptController, DISPLAY_0);
|
||||
mHandler = new TestHandler(h.mDetectingState, mClock) {
|
||||
|
||||
@@ -54,6 +54,7 @@ import androidx.test.runner.AndroidJUnit4;
|
||||
|
||||
import com.android.internal.util.test.FakeSettingsProvider;
|
||||
import com.android.server.accessibility.AccessibilityManagerService;
|
||||
import com.android.server.accessibility.AccessibilityTraceManager;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
@@ -83,6 +84,8 @@ public class MagnificationControllerTest {
|
||||
private static final int MODE_FULLSCREEN =
|
||||
Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE_FULLSCREEN;
|
||||
|
||||
@Mock
|
||||
private AccessibilityTraceManager mTraceManager;
|
||||
@Mock
|
||||
private AccessibilityManagerService mService;
|
||||
@Mock
|
||||
@@ -112,7 +115,7 @@ public class MagnificationControllerTest {
|
||||
CURRENT_USER_ID);
|
||||
mWindowMagnificationManager = Mockito.spy(
|
||||
new WindowMagnificationManager(mContext, CURRENT_USER_ID,
|
||||
mock(WindowMagnificationManager.Callback.class)));
|
||||
mock(WindowMagnificationManager.Callback.class), mTraceManager));
|
||||
mMockConnection = new MockWindowMagnificationConnection(true);
|
||||
mWindowMagnificationManager.setConnection(mMockConnection.getConnection());
|
||||
mScreenMagnificationControllerStubber = new FullScreenMagnificationControllerStubber(
|
||||
|
||||
@@ -31,6 +31,8 @@ import android.view.MotionEvent;
|
||||
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
|
||||
import com.android.server.accessibility.AccessibilityTraceManager;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -48,6 +50,8 @@ public class MagnificationGestureHandlerTest {
|
||||
private static final int FULLSCREEN_MODE =
|
||||
Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE_FULLSCREEN;
|
||||
|
||||
@Mock
|
||||
AccessibilityTraceManager mTraceManager;
|
||||
@Mock
|
||||
MagnificationGestureHandler.Callback mCallback;
|
||||
|
||||
@@ -57,6 +61,7 @@ public class MagnificationGestureHandlerTest {
|
||||
mMgh = new TestMagnificationGestureHandler(DISPLAY_0,
|
||||
/* detectTripleTap= */true,
|
||||
/* detectShortcutTrigger= */true,
|
||||
mTraceManager,
|
||||
mCallback);
|
||||
}
|
||||
|
||||
@@ -129,8 +134,9 @@ public class MagnificationGestureHandlerTest {
|
||||
boolean mIsInternalMethodCalled = false;
|
||||
|
||||
TestMagnificationGestureHandler(int displayId, boolean detectTripleTap,
|
||||
boolean detectShortcutTrigger, @NonNull Callback callback) {
|
||||
super(displayId, detectTripleTap, detectShortcutTrigger, callback);
|
||||
boolean detectShortcutTrigger, @NonNull AccessibilityTraceManager trace,
|
||||
@NonNull Callback callback) {
|
||||
super(displayId, detectTripleTap, detectShortcutTrigger, trace, callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -29,6 +29,8 @@ import android.view.accessibility.IWindowMagnificationConnection;
|
||||
import android.view.accessibility.IWindowMagnificationConnectionCallback;
|
||||
import android.view.accessibility.MagnificationAnimationCallback;
|
||||
|
||||
import com.android.server.accessibility.AccessibilityTraceManager;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.mockito.Mock;
|
||||
@@ -45,6 +47,8 @@ public class WindowMagnificationConnectionWrapperTest {
|
||||
|
||||
private IWindowMagnificationConnection mConnection;
|
||||
@Mock
|
||||
private AccessibilityTraceManager mTrace;
|
||||
@Mock
|
||||
private IWindowMagnificationConnectionCallback mCallback;
|
||||
@Mock
|
||||
private MagnificationAnimationCallback mAnimationCallback;
|
||||
@@ -57,7 +61,7 @@ public class WindowMagnificationConnectionWrapperTest {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
mMockWindowMagnificationConnection = new MockWindowMagnificationConnection();
|
||||
mConnection = mMockWindowMagnificationConnection.getConnection();
|
||||
mConnectionWrapper = new WindowMagnificationConnectionWrapper(mConnection);
|
||||
mConnectionWrapper = new WindowMagnificationConnectionWrapper(mConnection, mTrace);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -35,6 +35,7 @@ import android.view.ViewConfiguration;
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
|
||||
import com.android.server.accessibility.AccessibilityTraceManager;
|
||||
import com.android.server.accessibility.EventStreamTransformation;
|
||||
import com.android.server.accessibility.utils.TouchEventGenerator;
|
||||
|
||||
@@ -74,16 +75,18 @@ public class WindowMagnificationGestureHandlerTest {
|
||||
private WindowMagnificationGestureHandler mWindowMagnificationGestureHandler;
|
||||
@Mock
|
||||
MagnificationGestureHandler.Callback mMockCallback;
|
||||
@Mock
|
||||
AccessibilityTraceManager mMockTrace;
|
||||
|
||||
@Before
|
||||
public void setUp() throws RemoteException {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
mContext = InstrumentationRegistry.getInstrumentation().getContext();
|
||||
mWindowMagnificationManager = new WindowMagnificationManager(mContext, 0,
|
||||
mock(WindowMagnificationManager.Callback.class));
|
||||
mock(WindowMagnificationManager.Callback.class), mMockTrace);
|
||||
mMockConnection = new MockWindowMagnificationConnection();
|
||||
mWindowMagnificationGestureHandler = new WindowMagnificationGestureHandler(
|
||||
mContext, mWindowMagnificationManager, mMockCallback,
|
||||
mContext, mWindowMagnificationManager, mMockTrace, mMockCallback,
|
||||
/** detectTripleTap= */true, /** detectShortcutTrigger= */true, DISPLAY_0);
|
||||
mWindowMagnificationManager.setConnection(mMockConnection.getConnection());
|
||||
mWindowMagnificationGestureHandler.setNext(strictMock(EventStreamTransformation.class));
|
||||
|
||||
@@ -52,6 +52,7 @@ import android.view.accessibility.MagnificationAnimationCallback;
|
||||
|
||||
import com.android.internal.util.test.FakeSettingsProvider;
|
||||
import com.android.server.LocalServices;
|
||||
import com.android.server.accessibility.AccessibilityTraceManager;
|
||||
import com.android.server.statusbar.StatusBarManagerInternal;
|
||||
|
||||
import org.junit.Before;
|
||||
@@ -72,6 +73,8 @@ public class WindowMagnificationManagerTest {
|
||||
@Mock
|
||||
private Context mContext;
|
||||
@Mock
|
||||
private AccessibilityTraceManager mMockTrace;
|
||||
@Mock
|
||||
private StatusBarManagerInternal mMockStatusBarManagerInternal;
|
||||
@Mock
|
||||
private MagnificationAnimationCallback mAnimationCallback;
|
||||
@@ -88,7 +91,7 @@ public class WindowMagnificationManagerTest {
|
||||
mResolver = new MockContentResolver();
|
||||
mMockConnection = new MockWindowMagnificationConnection();
|
||||
mWindowMagnificationManager = new WindowMagnificationManager(mContext, CURRENT_USER_ID,
|
||||
mMockCallback);
|
||||
mMockCallback, mMockTrace);
|
||||
|
||||
when(mContext.getContentResolver()).thenReturn(mResolver);
|
||||
doAnswer((InvocationOnMock invocation) -> {
|
||||
|
||||
Reference in New Issue
Block a user