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

Commit 9244aeaf authored by Prabir Pradhan's avatar Prabir Pradhan
Browse files

Use cc_defaults in inputflinger targets

We add a cc_defaults for all of the targets in inputflinger, and include
those defaults in inputflinger_tests. This makes it so that building
the test compiles all of the sources in the test target and includes
them in the executable.

The primary benefit of this refactor is that running the test on any
device will now test the inputflinger code that the test was compiled
with instead of testing the libraries that were on the device. Also,
the device does not need to be re-flashed or need its libraries to be
updated when running the tests after modifying inputflinger code.

Bug: None
Test: atest inputflinger_tests
Change-Id: Ic0406355e5b485c8bf29a65f7c7c37ea8cb68eab
parent ac914e8c
Loading
Loading
Loading
Loading
+46 −26
Original line number Original line Diff line number Diff line
@@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// See the License for the specific language governing permissions and
// limitations under the License.
// limitations under the License.


// Default flags to be used throughout all libraries in inputflinger.
cc_defaults {
cc_defaults {
    name: "inputflinger_defaults",
    name: "inputflinger_defaults",
    cflags: [
    cflags: [
@@ -23,22 +24,25 @@ cc_defaults {
    ],
    ],
}
}


cc_library_shared {
/////////////////////////////////////////////////
    name: "libinputflinger",
// libinputflinger
    defaults: ["inputflinger_defaults"],
/////////////////////////////////////////////////


filegroup {
    name: "libinputflinger_sources",
    srcs: [
    srcs: [
        "InputClassifier.cpp",
        "InputClassifier.cpp",
        "InputClassifierConverter.cpp",
        "InputClassifierConverter.cpp",
        "InputManager.cpp",
        "InputManager.cpp",
    ],
    ],
}


cc_defaults {
    name: "libinputflinger_defaults",
    srcs: [":libinputflinger_sources"],
    shared_libs: [
    shared_libs: [
        "android.hardware.input.classifier@1.0",
        "android.hardware.input.classifier@1.0",
        "libbase",
        "libbase",
        "libinputflinger_base",
        "libinputreporter",
        "libinputreader",
        "libbinder",
        "libbinder",
        "libcrypto",
        "libcrypto",
        "libcutils",
        "libcutils",
@@ -50,60 +54,76 @@ cc_library_shared {
        "libui",
        "libui",
        "server_configurable_flags",
        "server_configurable_flags",
    ],
    ],
}


    static_libs: [
cc_library_shared {
        "libinputdispatcher",
    name: "libinputflinger",
    defaults: [
        "inputflinger_defaults",
        "libinputflinger_defaults",
    ],
    ],

    cflags: [
    cflags: [
        // TODO(b/23084678): Move inputflinger to its own process and mark it hidden
        // TODO(b/23084678): Move inputflinger to its own process and mark it hidden
        //-fvisibility=hidden
        //-fvisibility=hidden
    ],
    ],

    shared_libs: [
    export_include_dirs: [
        // This should consist only of dependencies from inputflinger. Other dependencies should be
        ".",
        // in cc_defaults so that they are included in the tests.
        "include",
        "libinputflinger_base",
        "libinputreporter",
        "libinputreader",
    ],
    static_libs: [
        "libinputdispatcher",
    ],
    ],

    export_static_lib_headers: [
    export_static_lib_headers: [
        "libinputdispatcher",
        "libinputdispatcher",
    ],
    ],
    export_include_dirs: [
        ".",
        "include",
    ],
}
}


/////////////////////////////////////////////////
// libinputflinger_base
/////////////////////////////////////////////////

cc_library_headers {
cc_library_headers {
    name: "libinputflinger_headers",
    name: "libinputflinger_headers",
    header_libs: ["libinputreporter_headers"],
    export_include_dirs: ["include"],
    export_include_dirs: ["include"],
    export_header_lib_headers: ["libinputreporter_headers"],
}
}


cc_library_shared {
filegroup {
    name: "libinputflinger_base",
    name: "libinputflinger_base_sources",
    defaults: ["inputflinger_defaults"],

    srcs: [
    srcs: [
        "InputListener.cpp",
        "InputListener.cpp",
        "InputReaderBase.cpp",
        "InputReaderBase.cpp",
        "InputThread.cpp",
        "InputThread.cpp",
    ],
    ],
}


cc_defaults {
    name: "libinputflinger_base_defaults",
    srcs: [":libinputflinger_base_sources"],
    shared_libs: [
    shared_libs: [
        "libbase",
        "libbase",
        "libinput",
        "libinput",
        "liblog",
        "liblog",
        "libutils",
        "libutils",
    ],
    ],

    header_libs: [
    header_libs: [
        "libinputflinger_headers",
        "libinputflinger_headers",
    ],
    ],
}


cc_library_shared {
    name: "libinputflinger_base",
    defaults: [
        "inputflinger_defaults",
        "libinputflinger_base_defaults",
    ],
    export_header_lib_headers: [
    export_header_lib_headers: [
        "libinputflinger_headers",
        "libinputflinger_headers",
    ],
    ],
}
}

subdirs = [
    "host",
    "tests",
]
+34 −7
Original line number Original line Diff line number Diff line
@@ -12,9 +12,15 @@
// See the License for the specific language governing permissions and
// See the License for the specific language governing permissions and
// limitations under the License.
// limitations under the License.


cc_library_static {
cc_library_headers {
    name: "libinputdispatcher",
    name: "libinputdispatcher_headers",
    defaults: ["inputflinger_defaults"],
    export_include_dirs: [
        "include",
    ],
}

filegroup {
    name: "libinputdispatcher_sources",
    srcs: [
    srcs: [
        "Connection.cpp",
        "Connection.cpp",
        "Entry.cpp",
        "Entry.cpp",
@@ -24,20 +30,41 @@ cc_library_static {
        "InputState.cpp",
        "InputState.cpp",
        "InputTarget.cpp",
        "InputTarget.cpp",
        "Monitor.cpp",
        "Monitor.cpp",
        "TouchState.cpp"
        "TouchState.cpp",
    ],
    ],
}

cc_defaults {
    name: "libinputdispatcher_defaults",
    srcs: [":libinputdispatcher_sources"],
    shared_libs: [
    shared_libs: [
        "libbase",
        "libbase",
        "libcrypto",
        "libcrypto",
        "libcutils",
        "libcutils",
        "libinput",
        "libinput",
        "libinputreporter",
        "libinputflinger_base",
        "liblog",
        "liblog",
        "libstatslog",
        "libstatslog",
        "libui",
        "libui",
        "libutils",
        "libutils",
    ],
    ],
    header_libs: [
        "libinputdispatcher_headers",
    ],
}


    export_include_dirs: ["include"],
cc_library_static {
    name: "libinputdispatcher",
    defaults: [
        "inputflinger_defaults",
        "libinputdispatcher_defaults",
    ],
    shared_libs: [
        // This should consist only of dependencies from inputflinger. Other dependencies should be
        // in cc_defaults so that they are included in the tests.
        "libinputreporter",
        "libinputflinger_base",
    ],
    export_header_lib_headers: [
        "libinputdispatcher_headers",
    ],
}
}
+22 −9
Original line number Original line Diff line number Diff line
@@ -21,10 +21,8 @@ cc_library_headers {
    ],
    ],
}
}


cc_library_shared {
filegroup {
    name: "libinputreader",
    name: "libinputreader_sources",
    defaults: ["inputflinger_defaults"],

    srcs: [
    srcs: [
        "EventHub.cpp",
        "EventHub.cpp",
        "InputDevice.cpp",
        "InputDevice.cpp",
@@ -44,14 +42,16 @@ cc_library_shared {
        "mapper/TouchInputMapper.cpp",
        "mapper/TouchInputMapper.cpp",
        "mapper/VibratorInputMapper.cpp",
        "mapper/VibratorInputMapper.cpp",
        "InputReader.cpp",
        "InputReader.cpp",
        "InputReaderFactory.cpp",
        "TouchVideoDevice.cpp",
        "TouchVideoDevice.cpp",
    ],
    ],
}


cc_defaults {
    name: "libinputreader_defaults",
    srcs: [":libinputreader_sources"],
    shared_libs: [
    shared_libs: [
        "libbase",
        "libbase",
        "libcap",
        "libcap",
        "libinputflinger_base",
        "libcrypto",
        "libcrypto",
        "libcutils",
        "libcutils",
        "libinput",
        "libinput",
@@ -59,13 +59,26 @@ cc_library_shared {
        "libui",
        "libui",
        "libutils",
        "libutils",
    ],
    ],

    header_libs: [
    header_libs: [
        "libinputflinger_headers",
        "libinputreader_headers",
        "libinputreader_headers",
    ],
    ],
}


cc_library_shared {
    name: "libinputreader",
    defaults: [
        "inputflinger_defaults",
        "libinputreader_defaults"
    ],
    srcs: [
        "InputReaderFactory.cpp",
    ],
    shared_libs: [
        // This should consist only of dependencies from inputflinger. Other dependencies should be
        // in cc_defaults so that they are included in the tests.
        "libinputflinger_base",
    ],
    export_header_lib_headers: [
    export_header_lib_headers: [
        "libinputflinger_headers",
        "libinputreader_headers",
    ],
    ],
}
}
+1 −1
Original line number Original line Diff line number Diff line
@@ -14,7 +14,7 @@
 * limitations under the License.
 * limitations under the License.
 */
 */


#include "Macros.h"
#include "../Macros.h"


#include "CursorInputMapper.h"
#include "CursorInputMapper.h"


+1 −1
Original line number Original line Diff line number Diff line
@@ -14,7 +14,7 @@
 * limitations under the License.
 * limitations under the License.
 */
 */


#include "Macros.h"
#include "../Macros.h"


#include "ExternalStylusInputMapper.h"
#include "ExternalStylusInputMapper.h"


Loading