import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.Region;
+import android.os.Binder;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
try {
mViewRootImpl.mAttachInfo.mAccessibilityFetchFlags = 0;
applyAppScaleAndMagnificationSpecIfNeeded(infos, spec);
- if (spec != null) {
+ // Recycle if called from another process. Specs are cached in the
+ // system process and obtained from a pool when read from parcel.
+ if (spec != null && android.os.Process.myPid() != Binder.getCallingPid()) {
spec.recycle();
}
adjustIsVisibleToUserIfNeeded(infos, interactiveRegion);
} catch (RemoteException re) {
/* ignore - the other side will time out */
}
+
+ // Recycle if called from the same process. Regions are obtained in
+ // the system process and instantiated when read from parcel.
+ if (interactiveRegion != null && android.os.Process.myPid() == Binder.getCallingPid()) {
+ interactiveRegion.recycle();
+ }
}
}
try {
mViewRootImpl.mAttachInfo.mAccessibilityFetchFlags = 0;
applyAppScaleAndMagnificationSpecIfNeeded(infos, spec);
- if (spec != null) {
+ // Recycle if called from another process. Specs are cached in the
+ // system process and obtained from a pool when read from parcel.
+ if (spec != null && android.os.Process.myPid() != Binder.getCallingPid()) {
spec.recycle();
}
adjustIsVisibleToUserIfNeeded(infos, interactiveRegion);
} catch (RemoteException re) {
/* ignore - the other side will time out */
}
+
+ // Recycle if called from the same process. Regions are obtained in
+ // the system process and instantiated when read from parcel.
+ if (interactiveRegion != null && android.os.Process.myPid() == Binder.getCallingPid()) {
+ interactiveRegion.recycle();
+ }
}
}
try {
mViewRootImpl.mAttachInfo.mAccessibilityFetchFlags = 0;
applyAppScaleAndMagnificationSpecIfNeeded(infos, spec);
- if (spec != null) {
+ // Recycle if called from another process. Specs are cached in the
+ // system process and obtained from a pool when read from parcel.
+ if (spec != null && android.os.Process.myPid() != Binder.getCallingPid()) {
spec.recycle();
}
adjustIsVisibleToUserIfNeeded(infos, interactiveRegion);
} catch (RemoteException re) {
/* ignore - the other side will time out */
}
+
+ // Recycle if called from the same process. Regions are obtained in
+ // the system process and instantiated when read from parcel.
+ if (interactiveRegion != null && android.os.Process.myPid() == Binder.getCallingPid()) {
+ interactiveRegion.recycle();
+ }
}
}
try {
mViewRootImpl.mAttachInfo.mAccessibilityFetchFlags = 0;
applyAppScaleAndMagnificationSpecIfNeeded(focused, spec);
- if (spec != null) {
+ // Recycle if called from another process. Specs are cached in the
+ // system process and obtained from a pool when read from parcel.
+ if (spec != null && android.os.Process.myPid() != Binder.getCallingPid()) {
spec.recycle();
}
adjustIsVisibleToUserIfNeeded(focused, interactiveRegion);
} catch (RemoteException re) {
/* ignore - the other side will time out */
}
+
+ // Recycle if called from the same process. Regions are obtained in
+ // the system process and instantiated when read from parcel.
+ if (interactiveRegion != null && android.os.Process.myPid() == Binder.getCallingPid()) {
+ interactiveRegion.recycle();
+ }
}
}
try {
mViewRootImpl.mAttachInfo.mAccessibilityFetchFlags = 0;
applyAppScaleAndMagnificationSpecIfNeeded(next, spec);
- if (spec != null) {
+ // Recycle if called from another process. Specs are cached in the
+ // system process and obtained from a pool when read from parcel.
+ if (spec != null && android.os.Process.myPid() != Binder.getCallingPid()) {
spec.recycle();
}
adjustIsVisibleToUserIfNeeded(next, interactiveRegion);
} catch (RemoteException re) {
/* ignore - the other side will time out */
}
+
+ // Recycle if called from the same process. Regions are obtained in
+ // the system process and instantiated when read from parcel.
+ if (interactiveRegion != null && android.os.Process.myPid() == Binder.getCallingPid()) {
+ interactiveRegion.recycle();
+ }
}
}
private final List<AccessibilityServiceInfo> mEnabledServicesForFeedbackTempList =
new ArrayList<>();
- private final Region mTempRegion = new Region();
-
private final Rect mTempRect = new Rect();
private final Rect mTempRect1 = new Rect();
throws RemoteException {
final int resolvedWindowId;
IAccessibilityInteractionConnection connection = null;
- Region partialInteractiveRegion = mTempRegion;
+ Region partialInteractiveRegion = Region.obtain();
synchronized (mLock) {
// We treat calls from a profile as if made by its parent as profiles
// share the accessibility state of the parent. The call below
}
if (!mSecurityPolicy.computePartialInteractiveRegionForWindowLocked(
resolvedWindowId, partialInteractiveRegion)) {
+ partialInteractiveRegion.recycle();
partialInteractiveRegion = null;
}
}
}
} finally {
Binder.restoreCallingIdentity(identityToken);
+ // Recycle if passed to another process.
+ if (partialInteractiveRegion != null && Binder.isProxy(connection)) {
+ partialInteractiveRegion.recycle();
+ }
}
return false;
}
throws RemoteException {
final int resolvedWindowId;
IAccessibilityInteractionConnection connection = null;
- Region partialInteractiveRegion = mTempRegion;
+ Region partialInteractiveRegion = Region.obtain();
synchronized (mLock) {
// We treat calls from a profile as if made by its parent as profiles
// share the accessibility state of the parent. The call below
}
if (!mSecurityPolicy.computePartialInteractiveRegionForWindowLocked(
resolvedWindowId, partialInteractiveRegion)) {
+ partialInteractiveRegion.recycle();
partialInteractiveRegion = null;
}
}
}
} finally {
Binder.restoreCallingIdentity(identityToken);
+ // Recycle if passed to another process.
+ if (partialInteractiveRegion != null && Binder.isProxy(connection)) {
+ partialInteractiveRegion.recycle();
+ }
}
return false;
}
long interrogatingTid) throws RemoteException {
final int resolvedWindowId;
IAccessibilityInteractionConnection connection = null;
- Region partialInteractiveRegion = mTempRegion;
+ Region partialInteractiveRegion = Region.obtain();
synchronized (mLock) {
// We treat calls from a profile as if made by its parent as profiles
// share the accessibility state of the parent. The call below
}
if (!mSecurityPolicy.computePartialInteractiveRegionForWindowLocked(
resolvedWindowId, partialInteractiveRegion)) {
+ partialInteractiveRegion.recycle();
partialInteractiveRegion = null;
}
}
}
} finally {
Binder.restoreCallingIdentity(identityToken);
+ // Recycle if passed to another process.
+ if (partialInteractiveRegion != null && Binder.isProxy(connection)) {
+ partialInteractiveRegion.recycle();
+ }
}
return false;
}
throws RemoteException {
final int resolvedWindowId;
IAccessibilityInteractionConnection connection = null;
- Region partialInteractiveRegion = mTempRegion;
+ Region partialInteractiveRegion = Region.obtain();
synchronized (mLock) {
// We treat calls from a profile as if made by its parent as profiles
// share the accessibility state of the parent. The call below
}
if (!mSecurityPolicy.computePartialInteractiveRegionForWindowLocked(
resolvedWindowId, partialInteractiveRegion)) {
+ partialInteractiveRegion.recycle();
partialInteractiveRegion = null;
}
}
}
} finally {
Binder.restoreCallingIdentity(identityToken);
+ // Recycle if passed to another process.
+ if (partialInteractiveRegion != null && Binder.isProxy(connection)) {
+ partialInteractiveRegion.recycle();
+ }
}
return false;
}
throws RemoteException {
final int resolvedWindowId;
IAccessibilityInteractionConnection connection = null;
- Region partialInteractiveRegion = mTempRegion;
+ Region partialInteractiveRegion = Region.obtain();
synchronized (mLock) {
// We treat calls from a profile as if made by its parent as profiles
// share the accessibility state of the parent. The call below
}
if (!mSecurityPolicy.computePartialInteractiveRegionForWindowLocked(
resolvedWindowId, partialInteractiveRegion)) {
+ partialInteractiveRegion.recycle();
partialInteractiveRegion = null;
}
}
}
} finally {
Binder.restoreCallingIdentity(identityToken);
+ // Recycle if passed to another process.
+ if (partialInteractiveRegion != null && Binder.isProxy(connection)) {
+ partialInteractiveRegion.recycle();
+ }
}
return false;
}