Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 914b3757 authored by Ben Lin's avatar Ben Lin
Browse files

Adding proguard flags to avoid a11y methods getting stripped out.

AccessibilityNodeInfoCompat#obtain and AccessibilityNodeInfoCompat() are
both being stripped out by Proguard since DocsUI is not using these
methods. We are using these methods in tests to test a11y behaviors.

Test: Fixed AccessibilityTests.
Change-Id: I4533a0985794e8f7c36d8f81878196890281264f
(cherry picked from commit 832bec94)
parent 142a15c9
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ endif

LOCAL_PACKAGE_NAME := DocumentsUI
LOCAL_CERTIFICATE := platform
LOCAL_PROGUARD_FLAG_FILES := proguard.flags

include $(BUILD_PACKAGE)
include $(call all-makefiles-under, $(LOCAL_PATH))

proguard.flags

0 → 100644
+18 −0
Original line number Diff line number Diff line
# Copyright (C) 2017 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.

# Keep
-keep public class android.support.v4.view.accessibility.AccessibilityNodeInfoCompat {
   public static android.support.v4.view.accessibility.AccessibilityNodeInfoCompat obtain();
}
+2 −2
Original line number Diff line number Diff line
@@ -48,14 +48,14 @@ public class AccessibilityTest extends AndroidTestCase {

    public void test_announceSelected() throws Exception {
        View item = Views.createTestView(true);
        AccessibilityNodeInfoCompat info = new AccessibilityNodeInfoCompat(AccessibilityNodeInfo.obtain());
        AccessibilityNodeInfoCompat info = AccessibilityNodeInfoCompat.obtain();
        mAccessibilityDelegate.getItemDelegate().onInitializeAccessibilityNodeInfo(item, info);
        assertTrue(info.isSelected());
    }

    public void test_routesAccessibilityClicks() throws Exception {
        View item = Views.createTestView(true);
        AccessibilityNodeInfoCompat info = new AccessibilityNodeInfoCompat(AccessibilityNodeInfo.obtain());
        AccessibilityNodeInfoCompat info = AccessibilityNodeInfoCompat.obtain();
        mAccessibilityDelegate.getItemDelegate().onInitializeAccessibilityNodeInfo(item, info);
        mAccessibilityDelegate.getItemDelegate().performAccessibilityAction(item, AccessibilityNodeInfoCompat.ACTION_CLICK, null);
        assertTrue(mCallbackCalled);