Loading core/java/android/os/ExternalVibration.java +18 −0 Original line number Diff line number Diff line Loading @@ -114,6 +114,24 @@ public class ExternalVibration implements Parcelable { return true; } /** * Links a recipient to death against this external vibration token */ public void linkToDeath(IBinder.DeathRecipient recipient) { try { mToken.linkToDeath(recipient, 0); } catch (RemoteException e) { return; } } /** * Unlinks a recipient to death against this external vibration token */ public void unlinkToDeath(IBinder.DeathRecipient recipient) { mToken.unlinkToDeath(recipient, 0); } @Override public boolean equals(Object o) { if (o == null || !(o instanceof ExternalVibration)) { Loading core/java/android/provider/DeviceConfig.java +2 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,8 @@ import java.util.concurrent.Executor; /** * Device level configuration parameters which can be tuned by a separate configuration service. * Namespaces that end in "_native" such as {@link #NAMESPACE_NETD_NATIVE} are intended to be used * by native code and should be pushed to system properties to make them accessible. * * @hide */ Loading core/java/android/view/accessibility/AccessibilityNodeIdManager.java +1 −2 Original line number Diff line number Diff line Loading @@ -16,12 +16,11 @@ package android.view.accessibility; import android.util.SparseArray; import android.view.View; /** @hide */ public final class AccessibilityNodeIdManager { private SparseArray<View> mIdsToViews = new SparseArray<>(); private WeakSparseArray<View> mIdsToViews = new WeakSparseArray<View>(); private static AccessibilityNodeIdManager sIdManager; /** Loading core/java/android/view/accessibility/WeakSparseArray.java 0 → 100644 +63 −0 Original line number Diff line number Diff line /* * Copyright (C) 2019 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.view.accessibility; import android.util.SparseArray; import java.lang.ref.Reference; import java.lang.ref.ReferenceQueue; import java.lang.ref.WeakReference; final class WeakSparseArray<E> { private final ReferenceQueue<E> mRefQueue = new ReferenceQueue<>(); private final SparseArray<WeakReferenceWithId<E>> mSparseArray = new SparseArray<>(); public void append(int key, E value) { removeUnreachableValues(); mSparseArray.append(key, new WeakReferenceWithId(value, mRefQueue, key)); } public void remove(int key) { removeUnreachableValues(); mSparseArray.remove(key); } public E get(int key) { removeUnreachableValues(); WeakReferenceWithId<E> ref = mSparseArray.get(key); return ref != null ? ref.get() : null; } private void removeUnreachableValues() { for (Reference ref = mRefQueue.poll(); ref != null; ref = mRefQueue.poll()) { mSparseArray.remove(((WeakReferenceWithId) ref).mId); } } private static class WeakReferenceWithId<E> extends WeakReference<E> { final int mId; WeakReferenceWithId(E referent, ReferenceQueue<? super E> q, int id) { super(referent, q); mId = id; } } } core/java/android/widget/AbsSeekBar.java +30 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,11 @@ import android.view.accessibility.AccessibilityNodeInfo; import android.view.inspector.InspectableProperty; import com.android.internal.R; import com.android.internal.util.Preconditions; import java.util.ArrayList; import java.util.Collections; import java.util.List; /** Loading Loading @@ -91,6 +96,10 @@ public abstract class AbsSeekBar extends ProgressBar { @UnsupportedAppUsage private boolean mIsDragging; private List<Rect> mUserGestureExclusionRects = Collections.emptyList(); private final List<Rect> mGestureExclusionRects = new ArrayList<>(); private final Rect mThumbRect = new Rect(); public AbsSeekBar(Context context) { super(context); } Loading Loading @@ -735,6 +744,27 @@ public abstract class AbsSeekBar extends ProgressBar { // Canvas will be translated, so 0,0 is where we start drawing thumb.setBounds(left, top, right, bottom); updateGestureExclusionRects(); } @Override public void setSystemGestureExclusionRects(@NonNull List<Rect> rects) { Preconditions.checkNotNull(rects, "rects must not be null"); mUserGestureExclusionRects = rects; updateGestureExclusionRects(); } private void updateGestureExclusionRects() { final Drawable thumb = mThumb; if (thumb == null) { super.setSystemGestureExclusionRects(mUserGestureExclusionRects); return; } mGestureExclusionRects.clear(); thumb.copyBounds(mThumbRect); mGestureExclusionRects.add(mThumbRect); mGestureExclusionRects.addAll(mUserGestureExclusionRects); super.setSystemGestureExclusionRects(mGestureExclusionRects); } /** Loading Loading
core/java/android/os/ExternalVibration.java +18 −0 Original line number Diff line number Diff line Loading @@ -114,6 +114,24 @@ public class ExternalVibration implements Parcelable { return true; } /** * Links a recipient to death against this external vibration token */ public void linkToDeath(IBinder.DeathRecipient recipient) { try { mToken.linkToDeath(recipient, 0); } catch (RemoteException e) { return; } } /** * Unlinks a recipient to death against this external vibration token */ public void unlinkToDeath(IBinder.DeathRecipient recipient) { mToken.unlinkToDeath(recipient, 0); } @Override public boolean equals(Object o) { if (o == null || !(o instanceof ExternalVibration)) { Loading
core/java/android/provider/DeviceConfig.java +2 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,8 @@ import java.util.concurrent.Executor; /** * Device level configuration parameters which can be tuned by a separate configuration service. * Namespaces that end in "_native" such as {@link #NAMESPACE_NETD_NATIVE} are intended to be used * by native code and should be pushed to system properties to make them accessible. * * @hide */ Loading
core/java/android/view/accessibility/AccessibilityNodeIdManager.java +1 −2 Original line number Diff line number Diff line Loading @@ -16,12 +16,11 @@ package android.view.accessibility; import android.util.SparseArray; import android.view.View; /** @hide */ public final class AccessibilityNodeIdManager { private SparseArray<View> mIdsToViews = new SparseArray<>(); private WeakSparseArray<View> mIdsToViews = new WeakSparseArray<View>(); private static AccessibilityNodeIdManager sIdManager; /** Loading
core/java/android/view/accessibility/WeakSparseArray.java 0 → 100644 +63 −0 Original line number Diff line number Diff line /* * Copyright (C) 2019 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.view.accessibility; import android.util.SparseArray; import java.lang.ref.Reference; import java.lang.ref.ReferenceQueue; import java.lang.ref.WeakReference; final class WeakSparseArray<E> { private final ReferenceQueue<E> mRefQueue = new ReferenceQueue<>(); private final SparseArray<WeakReferenceWithId<E>> mSparseArray = new SparseArray<>(); public void append(int key, E value) { removeUnreachableValues(); mSparseArray.append(key, new WeakReferenceWithId(value, mRefQueue, key)); } public void remove(int key) { removeUnreachableValues(); mSparseArray.remove(key); } public E get(int key) { removeUnreachableValues(); WeakReferenceWithId<E> ref = mSparseArray.get(key); return ref != null ? ref.get() : null; } private void removeUnreachableValues() { for (Reference ref = mRefQueue.poll(); ref != null; ref = mRefQueue.poll()) { mSparseArray.remove(((WeakReferenceWithId) ref).mId); } } private static class WeakReferenceWithId<E> extends WeakReference<E> { final int mId; WeakReferenceWithId(E referent, ReferenceQueue<? super E> q, int id) { super(referent, q); mId = id; } } }
core/java/android/widget/AbsSeekBar.java +30 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,11 @@ import android.view.accessibility.AccessibilityNodeInfo; import android.view.inspector.InspectableProperty; import com.android.internal.R; import com.android.internal.util.Preconditions; import java.util.ArrayList; import java.util.Collections; import java.util.List; /** Loading Loading @@ -91,6 +96,10 @@ public abstract class AbsSeekBar extends ProgressBar { @UnsupportedAppUsage private boolean mIsDragging; private List<Rect> mUserGestureExclusionRects = Collections.emptyList(); private final List<Rect> mGestureExclusionRects = new ArrayList<>(); private final Rect mThumbRect = new Rect(); public AbsSeekBar(Context context) { super(context); } Loading Loading @@ -735,6 +744,27 @@ public abstract class AbsSeekBar extends ProgressBar { // Canvas will be translated, so 0,0 is where we start drawing thumb.setBounds(left, top, right, bottom); updateGestureExclusionRects(); } @Override public void setSystemGestureExclusionRects(@NonNull List<Rect> rects) { Preconditions.checkNotNull(rects, "rects must not be null"); mUserGestureExclusionRects = rects; updateGestureExclusionRects(); } private void updateGestureExclusionRects() { final Drawable thumb = mThumb; if (thumb == null) { super.setSystemGestureExclusionRects(mUserGestureExclusionRects); return; } mGestureExclusionRects.clear(); thumb.copyBounds(mThumbRect); mGestureExclusionRects.add(mThumbRect); mGestureExclusionRects.addAll(mUserGestureExclusionRects); super.setSystemGestureExclusionRects(mGestureExclusionRects); } /** Loading