19648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov/*
29648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov * Copyright (C) 2011 The Android Open Source Project
39648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov *
49648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov * Licensed under the Apache License, Version 2.0 (the "License");
59648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov * you may not use this file except in compliance with the License.
69648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov * You may obtain a copy of the License at
79648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov *
89648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov *      http://www.apache.org/licenses/LICENSE-2.0
99648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov *
109648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov * Unless required by applicable law or agreed to in writing, software
119648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov * distributed under the License is distributed on an "AS IS" BASIS,
129648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
139648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov * See the License for the specific language governing permissions and
149648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov * limitations under the License.
159648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov */
169648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov
179648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganovpackage android.support.v4.view.accessibility;
189648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov
199648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganovimport android.os.Build;
209648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganovimport android.view.accessibility.AccessibilityEvent;
219648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov
229648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov/**
230574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * Helper for accessing features in {@link AccessibilityEvent}
240574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * introduced after API level 4 in a backwards compatible fashion.
259648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov */
269648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganovpublic class AccessibilityEventCompat {
279648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov
289648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    static interface AccessibilityEventVersionImpl {
299648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov        public int getRecordCount(AccessibilityEvent event);
309648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov        public void appendRecord(AccessibilityEvent event, Object record);
319648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov        public Object getRecord(AccessibilityEvent event, int index);
329648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    }
339648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov
349648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    static class AccessibilityEventStubImpl implements AccessibilityEventVersionImpl {
359648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov
36b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv        @Override
379648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov        public void appendRecord(AccessibilityEvent event, Object record) {
389648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov
399648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov        }
409648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov
41b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv        @Override
429648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov        public Object getRecord(AccessibilityEvent event, int index) {
439648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov            return null;
449648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov        }
459648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov
46b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv        @Override
479648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov        public int getRecordCount(AccessibilityEvent event) {
489648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov            return 0;
499648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov        }
509648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    }
519648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov
529648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    static class AccessibilityEventIcsImpl extends AccessibilityEventStubImpl {
539648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov
549648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov        @Override
559648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov        public void appendRecord(AccessibilityEvent event, Object record) {
569648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov            AccessibilityEventCompatIcs.appendRecord(event, record);
579648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov        }
589648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov
599648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov        @Override
609648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov        public Object getRecord(AccessibilityEvent event, int index) {
619648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov            return AccessibilityEventCompatIcs.getRecord(event, index);
629648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov        }
639648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov
649648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov        @Override
659648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov        public int getRecordCount(AccessibilityEvent event) {
669648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov            return AccessibilityEventCompatIcs.getRecordCount(event);
679648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov        }
689648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    }
699648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov
709648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    private final static AccessibilityEventVersionImpl IMPL;
719648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov
729648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    static {
739648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov        if (Build.VERSION.SDK_INT >= 14) { // ICS
749648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov            IMPL = new AccessibilityEventIcsImpl();
759648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov        } else {
769648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov            IMPL = new AccessibilityEventStubImpl();
779648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov        }
789648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    }
799648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov
809648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    /**
819648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov     * Represents the event of a hover enter over a {@link android.view.View}.
829648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov     */
839648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    public static final int TYPE_VIEW_HOVER_ENTER = 0x00000080;
849648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov
859648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    /**
869648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov     * Represents the event of a hover exit over a {@link android.view.View}.
879648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov     */
889648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    public static final int TYPE_VIEW_HOVER_EXIT = 0x00000100;
899648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov
909648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    /**
919648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov     * Represents the event of starting a touch exploration gesture.
929648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov     */
939648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    public static final int TYPE_TOUCH_EXPLORATION_GESTURE_START = 0x00000200;
949648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov
959648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    /**
969648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov     * Represents the event of ending a touch exploration gesture.
979648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov     */
989648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    public static final int TYPE_TOUCH_EXPLORATION_GESTURE_END = 0x00000400;
999648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov
1009648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    /**
1019648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov     * Represents the event of changing the content of a window.
1029648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov     */
1039648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    public static final int TYPE_WINDOW_CONTENT_CHANGED = 0x00000800;
1049648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov
1059648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    /**
1069648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov     * Represents the event of scrolling a view.
1079648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov     */
1089648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    public static final int TYPE_VIEW_SCROLLED = 0x00001000;
1099648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov
1109648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    /**
1119648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov     * Represents the event of changing the selection in an {@link android.widget.EditText}.
1129648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov     */
1139648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    public static final int TYPE_VIEW_TEXT_SELECTION_CHANGED = 0x00002000;
1149648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov
115b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv    /**
116b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv     * Represents the event of an application making an announcement.
117b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv     */
118b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv    public static final int TYPE_ANNOUNCEMENT = 0x00004000;
119b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv
120b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv    /**
121b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv     * Represents the event of gaining accessibility focus.
122b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv     */
123b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv    public static final int TYPE_VIEW_ACCESSIBILITY_FOCUSED = 0x00008000;
124b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv
125b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv    /**
126b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv     * Represents the event of clearing accessibility focus.
127b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv     */
128b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv    public static final int TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED = 0x00010000;
129b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv
130b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv    /**
131b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv     * Represents the event of traversing the text of a view at a given movement granularity.
132b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv     */
133b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv    public static final int TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY = 0x00020000;
134b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv
135b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv    /**
136b047962755c59a9855328ed273bae33a0663e21aCasey Burkhardt     * Represents the event of beginning gesture detection.
137b047962755c59a9855328ed273bae33a0663e21aCasey Burkhardt     */
138b047962755c59a9855328ed273bae33a0663e21aCasey Burkhardt    public static final int TYPE_GESTURE_DETECTION_START = 0x00040000;
139b047962755c59a9855328ed273bae33a0663e21aCasey Burkhardt
140b047962755c59a9855328ed273bae33a0663e21aCasey Burkhardt    /**
141b047962755c59a9855328ed273bae33a0663e21aCasey Burkhardt     * Represents the event of ending gesture detection.
142b047962755c59a9855328ed273bae33a0663e21aCasey Burkhardt     */
143b047962755c59a9855328ed273bae33a0663e21aCasey Burkhardt    public static final int TYPE_GESTURE_DETECTION_END = 0x00080000;
144b047962755c59a9855328ed273bae33a0663e21aCasey Burkhardt
145b047962755c59a9855328ed273bae33a0663e21aCasey Burkhardt    /**
146b047962755c59a9855328ed273bae33a0663e21aCasey Burkhardt     * Represents the event of the user starting to touch the screen.
147b047962755c59a9855328ed273bae33a0663e21aCasey Burkhardt     */
148b047962755c59a9855328ed273bae33a0663e21aCasey Burkhardt    public static final int TYPE_TOUCH_INTERACTION_START = 0x00100000;
149b047962755c59a9855328ed273bae33a0663e21aCasey Burkhardt
150b047962755c59a9855328ed273bae33a0663e21aCasey Burkhardt    /**
151b047962755c59a9855328ed273bae33a0663e21aCasey Burkhardt     * Represents the event of the user ending to touch the screen.
152b047962755c59a9855328ed273bae33a0663e21aCasey Burkhardt     */
153b047962755c59a9855328ed273bae33a0663e21aCasey Burkhardt    public static final int TYPE_TOUCH_INTERACTION_END = 0x00200000;
154b047962755c59a9855328ed273bae33a0663e21aCasey Burkhardt
155b047962755c59a9855328ed273bae33a0663e21aCasey Burkhardt    /**
156b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv     * Mask for {@link AccessibilityEvent} all types.
157b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv     *
158b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv     * @see AccessibilityEvent#TYPE_VIEW_CLICKED
159b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv     * @see AccessibilityEvent#TYPE_VIEW_LONG_CLICKED
160b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv     * @see AccessibilityEvent#TYPE_VIEW_SELECTED
161b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv     * @see AccessibilityEvent#TYPE_VIEW_FOCUSED
162b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv     * @see AccessibilityEvent#TYPE_VIEW_TEXT_CHANGED
163b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv     * @see AccessibilityEvent#TYPE_WINDOW_STATE_CHANGED
164b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv     * @see AccessibilityEvent#TYPE_NOTIFICATION_STATE_CHANGED
165b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv     * @see #TYPE_VIEW_HOVER_ENTER
166b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv     * @see #TYPE_VIEW_HOVER_EXIT
167b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv     * @see #TYPE_TOUCH_EXPLORATION_GESTURE_START
168b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv     * @see #TYPE_TOUCH_EXPLORATION_GESTURE_END
169b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv     * @see #TYPE_WINDOW_CONTENT_CHANGED
170b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv     * @see #TYPE_VIEW_SCROLLED
171b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv     * @see #TYPE_VIEW_TEXT_SELECTION_CHANGED
172b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv     * @see #TYPE_ANNOUNCEMENT
173b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv     * @see #TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY
174b047962755c59a9855328ed273bae33a0663e21aCasey Burkhardt     * @see #TYPE_GESTURE_DETECTION_START
175b047962755c59a9855328ed273bae33a0663e21aCasey Burkhardt     * @see #TYPE_GESTURE_DETECTION_END
176b047962755c59a9855328ed273bae33a0663e21aCasey Burkhardt     * @see #TYPE_TOUCH_INTERACTION_START
177b047962755c59a9855328ed273bae33a0663e21aCasey Burkhardt     * @see #TYPE_TOUCH_INTERACTION_END
178b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv     */
179b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv    public static final int TYPES_ALL_MASK = 0xFFFFFFFF;
180b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv
1819648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    /*
1829648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov     * Hide constructor from clients.
1839648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov     */
1849648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    private AccessibilityEventCompat() {
1859648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov
1869648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    }
1879648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov
1889648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    /**
1899648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov     * Gets the number of records contained in the event.
1909648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov     *
1919648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov     * @return The number of records.
1929648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov     */
1939648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    public static int getRecordCount(AccessibilityEvent event) {
1949648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov        return IMPL.getRecordCount(event);
1959648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    }
1969648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov
1979648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    /**
1989648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov     * Appends an {@link android.view.accessibility.AccessibilityRecord} to the end of
1999648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov     * event records.
2009648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov     *
2019648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov     * @param record The record to append.
2029648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov     *
2039648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov     * @throws IllegalStateException If called from an AccessibilityService.
2049648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov     */
2059648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    public static void appendRecord(AccessibilityEvent event, AccessibilityRecordCompat record) {
2069648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov        IMPL.appendRecord(event, record.getImpl());
2079648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    }
2089648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov
2099648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    /**
2109648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov     * Gets the record at a given index.
2119648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov     *
2129648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov     * @param index The index.
2139648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov     * @return The record at the specified index.
2149648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov     */
2159648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    public static AccessibilityRecordCompat getRecord(AccessibilityEvent event, int index) {
2169648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov        return new AccessibilityRecordCompat(IMPL.getRecord(event, index));
2179648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    }
2184184a5ee0959c0071eb6eb94878de9c5408d4e5eSvetoslav
2194184a5ee0959c0071eb6eb94878de9c5408d4e5eSvetoslav    /**
2204184a5ee0959c0071eb6eb94878de9c5408d4e5eSvetoslav     * Creates an {@link AccessibilityRecordCompat} from an {@link AccessibilityEvent}
2214184a5ee0959c0071eb6eb94878de9c5408d4e5eSvetoslav     * that can be used to manipulate the event properties defined in
2224184a5ee0959c0071eb6eb94878de9c5408d4e5eSvetoslav     * {@link android.view.accessibility.AccessibilityRecord}.
2234184a5ee0959c0071eb6eb94878de9c5408d4e5eSvetoslav     * <p>
2248f590dabd4e7d3fa4abfc74c91640690b63fc45aSvetoslav     * <strong>Note:</strong> Do not call {@link AccessibilityRecordCompat#recycle()} on the
2258f590dabd4e7d3fa4abfc74c91640690b63fc45aSvetoslav     * returned {@link AccessibilityRecordCompat}. Call {@link AccessibilityEvent#recycle()}
2264184a5ee0959c0071eb6eb94878de9c5408d4e5eSvetoslav     * in case you want to recycle the event.
2274184a5ee0959c0071eb6eb94878de9c5408d4e5eSvetoslav     * </p>
2284184a5ee0959c0071eb6eb94878de9c5408d4e5eSvetoslav     *
2294184a5ee0959c0071eb6eb94878de9c5408d4e5eSvetoslav     * @param event The from which to create a record.
2304184a5ee0959c0071eb6eb94878de9c5408d4e5eSvetoslav     * @return An {@link AccessibilityRecordCompat}.
2314184a5ee0959c0071eb6eb94878de9c5408d4e5eSvetoslav     */
2324184a5ee0959c0071eb6eb94878de9c5408d4e5eSvetoslav    public static AccessibilityRecordCompat asRecord(AccessibilityEvent event) {
2334184a5ee0959c0071eb6eb94878de9c5408d4e5eSvetoslav        return new AccessibilityRecordCompat(event);
2344184a5ee0959c0071eb6eb94878de9c5408d4e5eSvetoslav    }
2359648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov}
236