103 lines
		
	
	
		
			4.3 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
			
		
		
	
	
			103 lines
		
	
	
		
			4.3 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
| ==================================================================================================
 | |
| aidl_lazy_test
 | |
| ==================================================================================================
 | |
| This test can be run in one of two ways:
 | |
| 
 | |
| --------------------------------------------
 | |
| Without arguments: aidl_lazy_test
 | |
| --------------------------------------------
 | |
| This will run tests on the test service (described below), the goal being to test the dynamic
 | |
| service infrastructure.
 | |
| 
 | |
| --------------------------------------------
 | |
| With a service: aidl_lazy_test serviceName...
 | |
| --------------------------------------------
 | |
| This will run tests on the input service, verifying whether it successfully displays lazy behavior.
 | |
| If the service has multiple interfaces, each can be entered as a separate argument to be tested
 | |
| simultaneously.
 | |
| Infrastructure tests that rely on specific features of the dedicated test service will be skipped.
 | |
| 
 | |
| ==================================================================================================
 | |
| aidl_lazy_test_server
 | |
| ==================================================================================================
 | |
| aidl_lazy_test_server is a simple test service.
 | |
| 
 | |
| Because it represents the bare minimum requirements for implementing a service, it also serves as
 | |
| an example of how to add a new service. The required files are as follows:
 | |
| 
 | |
| ============================================
 | |
| In this directory
 | |
| ============================================
 | |
| --------------------------------------------
 | |
| server.cpp
 | |
| --------------------------------------------
 | |
| The implementation of the server. The only required function is main(), wherein the service must be
 | |
| instantiated and added (either to servicemanager as a standard service or to LazyServiceRegistrar
 | |
| to be a dynamic service). The server then joins the thread pool.
 | |
| 
 | |
| --------------------------------------------
 | |
| aidl_lazy_test_server.rc
 | |
| --------------------------------------------
 | |
| This file is read by init, which later starts the service. The interface, oneshot, and disabled
 | |
| lines are only required for dynamic services.
 | |
| 
 | |
| --------------------------------------------
 | |
| LazyTestService.h/.cpp
 | |
| --------------------------------------------
 | |
| The implementation of the service's functionality.
 | |
| 
 | |
| --------------------------------------------
 | |
| ILazyTestService.aidl
 | |
| --------------------------------------------
 | |
| The AIDL interface for the service, this will generate code that clients can use to interact with
 | |
| the service via IPC.
 | |
| 
 | |
| --------------------------------------------
 | |
| Android.bp
 | |
| --------------------------------------------
 | |
| An aidl_interface entry will need to be added for the .aidl file.
 | |
| 
 | |
| A cc_binary entry will need to be added for the service with:
 | |
| name
 | |
| srcs - The source file(s)
 | |
| init_rc - The .rc file
 | |
| shared_libs - Any shared libraries the source file depends on
 | |
| static_libs - The AIDL interface
 | |
| 
 | |
| ============================================
 | |
| In system/sepolicy
 | |
| ============================================
 | |
| --------------------------------------------
 | |
| private/aidl_lazy_test_server.te
 | |
| --------------------------------------------
 | |
| Only two lines are required in this file.
 | |
| 
 | |
| --------------------------------------------
 | |
| public/aidl_lazy_test_server.te
 | |
| --------------------------------------------
 | |
| The first two lines establish types for aidl_lazy_test_server and aidl_lazy_test_server_exec.
 | |
| binder_use and binder_call allow for basic use of this service.
 | |
| add_service allows the service to be registered. Note that an additional service type is required
 | |
| as the second argument to this function.
 | |
| 
 | |
| --------------------------------------------
 | |
| private/compat/<number>/<number>.ignore.cil
 | |
| --------------------------------------------
 | |
| aidl_lazy_test_server and aidl_lazy_test_server_exec, and aidl_lazy_test_service need to be added
 | |
| to the new objects list.
 | |
| 
 | |
| --------------------------------------------
 | |
| private/file_contexts
 | |
| --------------------------------------------
 | |
| A line is required to map aidl_lazy_test_server to aidl_lazy_test_server_exec.
 | |
| 
 | |
| --------------------------------------------
 | |
| private/service_contexts
 | |
| --------------------------------------------
 | |
| Each interface for the service must be mapped to aidl_lazy_test_service here.
 | |
| 
 | |
| --------------------------------------------
 | |
| public/service.te
 | |
| --------------------------------------------
 | |
| A line is required to define aidl_lazy_test_service.
 |