├── .gitignore ├── Android.mk ├── CleanSpec.mk ├── MODULE_LICENSE_APACHE2 ├── Makefile ├── NOTICE ├── Readme.md ├── adb.sh ├── adb ├── .clang-format ├── Android.mk ├── CPPLINT.cfg ├── MODULE_LICENSE_APACHE2 ├── Makefile ├── NOTICE ├── OVERVIEW.TXT ├── SERVICES.TXT ├── SYNC.TXT ├── adb.cpp ├── adb.h ├── adb_auth.cpp ├── adb_auth.h ├── adb_auth_client.cpp ├── adb_auth_host.cpp ├── adb_client.cpp ├── adb_client.h ├── adb_io.cpp ├── adb_io.h ├── adb_io_test.cpp ├── adb_listeners.cpp ├── adb_listeners.h ├── adb_listeners_test.cpp ├── adb_trace.cpp ├── adb_trace.h ├── adb_utils.cpp ├── adb_utils.h ├── adb_utils_test.cpp ├── client │ └── main.cpp ├── commandline.cpp ├── console.cpp ├── daemon │ └── main.cpp ├── diagnose_usb.cpp ├── diagnose_usb.h ├── fdevent.cpp ├── fdevent.h ├── fdevent_test.cpp ├── fdevent_test.h ├── file_sync_client.cpp ├── file_sync_service.cpp ├── file_sync_service.h ├── framebuffer_service.cpp ├── get_my_path_darwin.cpp ├── get_my_path_linux.cpp ├── jdwp_service.cpp ├── line_printer.cpp ├── line_printer.h ├── log-non-android.cpp ├── mutex_list.h ├── protocol.txt ├── remount_service.cpp ├── remount_service.h ├── security_log_tags.h ├── services.cpp ├── services.h ├── set_verity_enable_state_service.cpp ├── shell_service.cpp ├── shell_service.h ├── shell_service_protocol.cpp ├── shell_service_protocol_test.cpp ├── shell_service_test.cpp ├── socket.h ├── socket_test.cpp ├── sockets.cpp ├── sockets.dia ├── sysdeps.h ├── sysdeps │ ├── condition_variable.h │ └── mutex.h ├── sysdeps_test.cpp ├── sysdeps_unix.cpp ├── sysdeps_win32.cpp ├── sysdeps_win32_test.cpp ├── test_adb.py ├── test_device.py ├── transport.cpp ├── transport.h ├── transport_local.cpp ├── transport_test.cpp ├── transport_usb.cpp ├── usb_linux.cpp ├── usb_linux_client.cpp ├── usb_osx.cpp ├── usb_windows.cpp └── xdg-adbd.c ├── adbd.service ├── adf ├── Android.mk ├── libadf │ ├── Android.mk │ ├── adf.c │ ├── include │ │ └── adf │ │ │ └── adf.h │ └── tests │ │ ├── Android.mk │ │ └── adf_test.cpp └── libadfhwc │ ├── Android.mk │ ├── adfhwc.cpp │ └── include │ └── adfhwc │ └── adfhwc.h ├── base ├── .clang-format ├── Android.mk ├── CPPLINT.cfg ├── Makefile ├── errors_test.cpp ├── errors_unix.cpp ├── errors_windows.cpp ├── file.cpp ├── file_test.cpp ├── include │ └── android-base │ │ ├── errors.h │ │ ├── file.h │ │ ├── logging.h │ │ ├── macros.h │ │ ├── memory.h │ │ ├── parseint.h │ │ ├── parsenetaddress.h │ │ ├── stringprintf.h │ │ ├── strings.h │ │ ├── test_utils.h │ │ ├── thread_annotations.h │ │ ├── unique_fd.h │ │ └── utf8.h ├── logging.cpp ├── logging_test.cpp ├── parseint_test.cpp ├── parsenetaddress.cpp ├── parsenetaddress_test.cpp ├── stringprintf.cpp ├── stringprintf_test.cpp ├── strings.cpp ├── strings_test.cpp ├── test_main.cpp ├── test_utils.cpp ├── utf8.cpp └── utf8_test.cpp ├── bootstat ├── Android.mk ├── README.md ├── boot_event_record_store.cpp ├── boot_event_record_store.h ├── boot_event_record_store_test.cpp ├── bootstat.cpp ├── bootstat.rc ├── event_log_list_builder.cpp ├── event_log_list_builder.h ├── event_log_list_builder_test.cpp ├── histogram_logger.cpp ├── histogram_logger.h ├── testrunner.cpp ├── uptime_parser.cpp └── uptime_parser.h ├── configure ├── cpio ├── Android.mk └── mkbootfs.c ├── crash_reporter ├── .project_alias ├── 99-crash-reporter.rules ├── Android.mk ├── OWNERS ├── README.md ├── TEST_WARNING ├── crash_collector.cc ├── crash_collector.h ├── crash_collector_test.cc ├── crash_collector_test.h ├── crash_reporter.cc ├── crash_reporter.rc ├── crash_reporter_logs.conf ├── crash_reporter_logs_test.cc ├── crash_sender ├── dbus_bindings │ └── org.chromium.LibCrosService.xml ├── init │ ├── crash-reporter.conf │ ├── crash-sender.conf │ └── warn-collector.conf ├── kernel_collector.cc ├── kernel_collector.h ├── kernel_collector_test.cc ├── kernel_collector_test.h ├── kernel_log_collector.sh ├── kernel_warning_collector.cc ├── kernel_warning_collector.h ├── list_proxies.cc ├── periodic_scheduler ├── testrunner.cc ├── udev_collector.cc ├── udev_collector.h ├── udev_collector_test.cc ├── unclean_shutdown_collector.cc ├── unclean_shutdown_collector.h ├── unclean_shutdown_collector_test.cc ├── user_collector.cc ├── user_collector.h ├── user_collector_test.cc ├── warn_collector.l ├── warn_collector_test.c ├── warn_collector_test.sh └── warn_collector_test_reporter.sh ├── debuggerd ├── .clang-format ├── Android.bp ├── Android.soong.mk ├── MODULE_LICENSE_APACHE2 ├── NOTICE ├── arm │ ├── crashglue.S │ └── machine.cpp ├── arm64 │ ├── crashglue.S │ └── machine.cpp ├── backtrace.cpp ├── backtrace.h ├── client │ └── debuggerd_client.cpp ├── crasher.cpp ├── debuggerd.cpp ├── debuggerd.rc ├── debuggerd64.rc ├── elf_utils.cpp ├── elf_utils.h ├── getevent.cpp ├── getevent.h ├── include │ └── debuggerd │ │ └── client.h ├── machine.h ├── mips │ ├── crashglue.S │ └── machine.cpp ├── mips64 │ ├── crashglue.S │ └── machine.cpp ├── signal_sender.cpp ├── signal_sender.h ├── test │ ├── BacktraceMock.h │ ├── dump_memory_test.cpp │ ├── elf_fake.cpp │ ├── elf_fake.h │ ├── host_signal_fixup.h │ ├── log_fake.cpp │ ├── log_fake.h │ ├── property_fake.cpp │ ├── ptrace_fake.cpp │ ├── ptrace_fake.h │ ├── selinux │ │ └── android.h │ ├── selinux_fake.cpp │ ├── sys │ │ └── system_properties.h │ └── tombstone_test.cpp ├── tombstone.cpp ├── tombstone.h ├── utility.cpp ├── utility.h ├── x86 │ ├── crashglue.S │ └── machine.cpp └── x86_64 │ ├── crashglue.S │ └── machine.cpp ├── fastboot ├── .clang-format ├── Android.mk ├── bootimg_utils.cpp ├── bootimg_utils.h ├── engine.cpp ├── fastboot.cpp ├── fastboot.h ├── fastboot_protocol.txt ├── fs.cpp ├── fs.h ├── protocol.cpp ├── socket.cpp ├── socket.h ├── socket_mock.cpp ├── socket_mock.h ├── socket_test.cpp ├── tcp.cpp ├── tcp.h ├── tcp_test.cpp ├── transport.h ├── udp.cpp ├── udp.h ├── udp_test.cpp ├── usb.h ├── usb_linux.cpp ├── usb_osx.cpp ├── usb_windows.cpp ├── usbtest.cpp ├── util.cpp ├── util_linux.cpp ├── util_osx.cpp └── util_windows.cpp ├── fingerprintd ├── Android.mk ├── FingerprintDaemonProxy.cpp ├── FingerprintDaemonProxy.h ├── IFingerprintDaemon.cpp ├── IFingerprintDaemon.h ├── IFingerprintDaemonCallback.cpp ├── IFingerprintDaemonCallback.h └── fingerprintd.cpp ├── fs_mgr ├── Android.mk ├── fs_mgr.c ├── fs_mgr_format.c ├── fs_mgr_fstab.c ├── fs_mgr_main.c ├── fs_mgr_priv.h ├── fs_mgr_priv_verity.h ├── fs_mgr_slotselect.c ├── fs_mgr_verity.cpp └── include │ └── fs_mgr.h ├── gatekeeperd ├── Android.mk ├── IGateKeeperService.cpp ├── IGateKeeperService.h ├── IUserManager.cpp ├── IUserManager.h ├── SoftGateKeeper.h ├── SoftGateKeeperDevice.cpp ├── SoftGateKeeperDevice.h ├── gatekeeperd.cpp ├── gatekeeperd.rc └── tests │ ├── Android.mk │ └── gatekeeper_test.cpp ├── healthd ├── Android.mk ├── BatteryMonitor.cpp ├── BatteryPropertiesRegistrar.cpp ├── BatteryPropertiesRegistrar.h ├── healthd.cpp ├── healthd_board_default.cpp ├── healthd_mode_android.cpp ├── healthd_mode_charger.cpp ├── images │ ├── battery_fail.png │ └── battery_scale.png └── include │ └── healthd │ ├── BatteryMonitor.h │ └── healthd.h ├── include.mk ├── include ├── android │ └── log.h ├── backtrace │ ├── Backtrace.h │ ├── BacktraceMap.h │ └── backtrace_constants.h ├── binderwrapper │ ├── binder_test_base.h │ ├── binder_wrapper.h │ └── stub_binder_wrapper.h ├── cutils │ ├── android_reboot.h │ ├── ashmem.h │ ├── atomic.h │ ├── bitops.h │ ├── compiler.h │ ├── config_utils.h │ ├── debugger.h │ ├── fs.h │ ├── hashmap.h │ ├── iosched_policy.h │ ├── jstring.h │ ├── klog.h │ ├── list.h │ ├── log.h │ ├── memory.h │ ├── misc.h │ ├── multiuser.h │ ├── native_handle.h │ ├── open_memstream.h │ ├── partition_utils.h │ ├── process_name.h │ ├── properties.h │ ├── qtaguid.h │ ├── record_stream.h │ ├── sched_policy.h │ ├── sockets.h │ ├── str_parms.h │ ├── threads.h │ ├── trace.h │ └── uevent.h ├── log │ ├── event_tag_map.h │ ├── log.h │ ├── log_read.h │ ├── logd.h │ ├── logger.h │ ├── logprint.h │ └── uio.h ├── nativebridge │ └── native_bridge.h ├── private │ ├── android_filesystem_capability.h │ ├── android_filesystem_config.h │ ├── android_logger.h │ └── canned_fs_config.h ├── system │ ├── camera.h │ ├── graphics.h │ ├── qemu_pipe.h │ ├── radio.h │ ├── thread_defs.h │ └── window.h ├── sysutils │ ├── FrameworkClient.h │ ├── FrameworkCommand.h │ ├── FrameworkListener.h │ ├── List.h │ ├── NetlinkEvent.h │ ├── NetlinkListener.h │ ├── ServiceManager.h │ ├── SocketClient.h │ ├── SocketClientCommand.h │ └── SocketListener.h ├── usbhost │ └── usbhost.h ├── utils │ ├── AndroidThreads.h │ ├── Atomic.h │ ├── BitSet.h │ ├── BlobCache.h │ ├── ByteOrder.h │ ├── CallStack.h │ ├── Compat.h │ ├── Condition.h │ ├── Debug.h │ ├── Endian.h │ ├── Errors.h │ ├── FileMap.h │ ├── Flattenable.h │ ├── Functor.h │ ├── JenkinsHash.h │ ├── KeyedVector.h │ ├── LinearTransform.h │ ├── List.h │ ├── Log.h │ ├── Looper.h │ ├── LruCache.h │ ├── Mutex.h │ ├── NativeHandle.h │ ├── Printer.h │ ├── ProcessCallStack.h │ ├── PropertyMap.h │ ├── RWLock.h │ ├── RefBase.h │ ├── Singleton.h │ ├── SortedVector.h │ ├── StopWatch.h │ ├── String16.h │ ├── String8.h │ ├── StrongPointer.h │ ├── SystemClock.h │ ├── Thread.h │ ├── ThreadDefs.h │ ├── Timers.h │ ├── Tokenizer.h │ ├── Trace.h │ ├── TypeHelpers.h │ ├── Unicode.h │ ├── Vector.h │ ├── VectorImpl.h │ ├── misc.h │ └── threads.h └── ziparchive │ ├── zip_archive.h │ ├── zip_archive_stream_entry.h │ └── zip_writer.h ├── init ├── Android.mk ├── MODULE_LICENSE_APACHE2 ├── NOTICE ├── action.cpp ├── action.h ├── bootchart.cpp ├── bootchart.h ├── builtins.cpp ├── builtins.h ├── compare-bootcharts.py ├── devices.cpp ├── devices.h ├── grab-bootchart.sh ├── import_parser.cpp ├── import_parser.h ├── init.cpp ├── init.h ├── init_parser.cpp ├── init_parser.h ├── init_parser_test.cpp ├── keychords.cpp ├── keychords.h ├── keyword_map.h ├── log.cpp ├── log.h ├── parser.cpp ├── parser.h ├── parser │ ├── tokenizer.cpp │ ├── tokenizer.h │ └── tokenizer_test.cpp ├── perfboot.py ├── property_service.cpp ├── property_service.h ├── readme.txt ├── service.cpp ├── service.h ├── signal_handler.cpp ├── signal_handler.h ├── ueventd.cpp ├── ueventd.h ├── ueventd_keywords.h ├── ueventd_parser.cpp ├── ueventd_parser.h ├── util.cpp ├── util.h ├── util_test.cpp ├── watchdogd.cpp └── watchdogd.h ├── libbacktrace ├── Android.build.mk ├── Android.mk ├── Backtrace.cpp ├── BacktraceCurrent.cpp ├── BacktraceCurrent.h ├── BacktraceLog.h ├── BacktraceMap.cpp ├── BacktraceOffline.cpp ├── BacktraceOffline.h ├── BacktracePtrace.cpp ├── BacktracePtrace.h ├── GetPss.cpp ├── GetPss.h ├── ThreadEntry.cpp ├── ThreadEntry.h ├── UnwindCurrent.cpp ├── UnwindCurrent.h ├── UnwindMap.cpp ├── UnwindMap.h ├── UnwindPtrace.cpp ├── UnwindPtrace.h ├── backtrace_offline_test.cpp ├── backtrace_test.cpp ├── backtrace_testlib.c ├── thread_utils.c └── thread_utils.h ├── libbinderwrapper ├── Android.mk ├── binder_test_base.cc ├── binder_wrapper.cc ├── real_binder_wrapper.cc ├── real_binder_wrapper.h └── stub_binder_wrapper.cc ├── libcrypto_utils ├── Android.mk ├── Makefile ├── android_pubkey.c ├── include │ └── crypto_utils │ │ └── android_pubkey.h └── tests │ ├── Android.mk │ └── android_pubkey_test.cpp ├── libcutils ├── Android.mk ├── MODULE_LICENSE_APACHE2 ├── Makefile ├── NOTICE ├── android_reboot.c ├── arch-arm │ └── memset32.S ├── arch-arm64 │ └── android_memset.S ├── arch-mips │ └── android_memset.c ├── arch-x86 │ ├── android_memset16.S │ ├── android_memset32.S │ └── cache.h ├── arch-x86_64 │ ├── android_memset16.S │ ├── android_memset32.S │ └── cache.h ├── ashmem-dev.c ├── ashmem-host.c ├── canned_fs_config.c ├── config_utils.c ├── debugger.c ├── dlmalloc_stubs.c ├── fs.c ├── fs_config.c ├── hashmap.c ├── iosched_policy.c ├── klog.c ├── load_file.c ├── multiuser.c ├── native_handle.c ├── open_memstream.c ├── partition_utils.c ├── process_name.c ├── properties.c ├── properties_nonandroid.c ├── qtaguid.c ├── record_stream.c ├── sched_policy.c ├── socket_inaddr_any_server_unix.c ├── socket_inaddr_any_server_windows.c ├── socket_local_client_unix.c ├── socket_local_server_unix.c ├── socket_local_unix.h ├── socket_loopback_client_unix.c ├── socket_loopback_server_unix.c ├── socket_network_client_unix.c ├── socket_network_client_windows.c ├── sockets.cpp ├── sockets_unix.cpp ├── sockets_windows.cpp ├── str_parms.c ├── strdup16to8.c ├── strdup8to16.c ├── strlcpy.c ├── tests │ ├── Android.mk │ ├── MemsetTest.cpp │ ├── PropertiesTest.cpp │ ├── sockets_test.cpp │ ├── test_str_parms.cpp │ └── trace-dev_test.cpp ├── threads.c ├── trace-dev.c ├── trace-host.c └── uevent.c ├── libdiskconfig ├── Android.mk ├── config_mbr.c ├── diskconfig.c ├── diskutils.c ├── dump_diskconfig.c ├── include │ └── diskconfig │ │ └── diskconfig.h └── write_lst.c ├── libion ├── Android.mk ├── include │ └── ion │ │ └── ion.h ├── ion.c ├── ion_test.c ├── kernel-headers │ └── linux │ │ ├── ion.h │ │ └── ion_test.h ├── original-kernel-headers │ └── linux │ │ ├── ion.h │ │ └── ion_test.h └── tests │ ├── Android.mk │ ├── allocate_test.cpp │ ├── device_test.cpp │ ├── exit_test.cpp │ ├── formerly_valid_handle_test.cpp │ ├── invalid_values_test.cpp │ ├── ion_test_fixture.cpp │ ├── ion_test_fixture.h │ └── map_test.cpp ├── liblog ├── Android.bp ├── Android.soong.mk ├── NOTICE ├── README ├── config_read.c ├── config_read.h ├── config_write.c ├── config_write.h ├── event.logtags ├── event_tag_map.c ├── fake_log_device.c ├── fake_log_device.h ├── fake_writer.c ├── log_event_list.c ├── log_event_write.c ├── log_is_loggable.c ├── log_portability.h ├── log_time.cpp ├── logd_reader.c ├── logd_writer.c ├── logger.h ├── logger_lock.c ├── logger_name.c ├── logger_read.c ├── logger_write.c ├── logprint.c ├── pmsg_reader.c ├── pmsg_writer.c ├── tests │ ├── Android.mk │ ├── benchmark.h │ ├── benchmark_main.cpp │ ├── libc_test.cpp │ ├── liblog_benchmark.cpp │ └── liblog_test.cpp └── uio.c ├── libmemtrack ├── Android.mk ├── include │ └── memtrack │ │ └── memtrack.h ├── memtrack.c └── memtrack_test.c ├── libmemunreachable ├── Allocator.cpp ├── Allocator.h ├── Android.mk ├── HeapWalker.cpp ├── HeapWalker.h ├── Leak.h ├── LeakFolding.cpp ├── LeakFolding.h ├── LeakPipe.cpp ├── LeakPipe.h ├── LineBuffer.cpp ├── LineBuffer.h ├── LinkedList.h ├── MemUnreachable.cpp ├── ProcessMappings.cpp ├── ProcessMappings.h ├── PtracerThread.cpp ├── PtracerThread.h ├── README.md ├── ScopedAlarm.h ├── ScopedDisableMalloc.h ├── ScopedPipe.h ├── ScopedSignalHandler.h ├── Semaphore.h ├── Tarjan.h ├── ThreadCapture.cpp ├── ThreadCapture.h ├── anon_vma_naming.h ├── bionic.h ├── include │ └── memunreachable │ │ └── memunreachable.h ├── log.h └── tests │ ├── Allocator_test.cpp │ ├── DisableMalloc_test.cpp │ ├── HeapWalker_test.cpp │ ├── HostMallocStub.cpp │ ├── LeakFolding_test.cpp │ ├── MemUnreachable_test.cpp │ └── ThreadCapture_test.cpp ├── libnativebridge ├── Android.mk ├── native_bridge.cc └── tests │ ├── Android.mk │ ├── Android.nativebridge-dummy.mk │ ├── CodeCacheCreate_test.cpp │ ├── CodeCacheExists_test.cpp │ ├── CodeCacheStatFail_test.cpp │ ├── CompleteFlow_test.cpp │ ├── DummyNativeBridge.cpp │ ├── DummyNativeBridge2.cpp │ ├── InvalidCharsNativeBridge_test.cpp │ ├── NativeBridge2Signal_test.cpp │ ├── NativeBridgeTest.h │ ├── NativeBridgeVersion_test.cpp │ ├── NeedsNativeBridge_test.cpp │ ├── PreInitializeNativeBridgeFail1_test.cpp │ ├── PreInitializeNativeBridgeFail2_test.cpp │ ├── PreInitializeNativeBridge_test.cpp │ ├── ReSetupNativeBridge_test.cpp │ ├── UnavailableNativeBridge_test.cpp │ └── ValidNameNativeBridge_test.cpp ├── libnativeloader ├── Android.mk ├── dlext_namespaces.h ├── include │ └── nativeloader │ │ └── native_loader.h └── native_loader.cpp ├── libnetutils ├── Android.mk ├── NOTICE ├── dhcp_utils.c ├── dhcpclient.c ├── dhcpmsg.c ├── dhcpmsg.h ├── dhcptool.c ├── ifc_utils.c ├── include │ └── netutils │ │ ├── dhcp.h │ │ └── ifc.h ├── packet.c └── packet.h ├── libpackagelistparser ├── Android.mk ├── include │ └── packagelistparser │ │ └── packagelistparser.h └── packagelistparser.c ├── libpixelflinger ├── Android.mk ├── MODULE_LICENSE_APACHE2 ├── NOTICE ├── arch-arm64 │ ├── col32cb16blend.S │ └── t32cb16blend.S ├── arch-mips │ ├── col32cb16blend.S │ └── t32cb16blend.S ├── arch-mips64 │ ├── col32cb16blend.S │ └── t32cb16blend.S ├── buffer.cpp ├── buffer.h ├── clear.cpp ├── clear.h ├── codeflinger │ ├── ARMAssembler.cpp │ ├── ARMAssembler.h │ ├── ARMAssemblerInterface.cpp │ ├── ARMAssemblerInterface.h │ ├── ARMAssemblerProxy.cpp │ ├── ARMAssemblerProxy.h │ ├── Arm64Assembler.cpp │ ├── Arm64Assembler.h │ ├── Arm64Disassembler.cpp │ ├── Arm64Disassembler.h │ ├── CodeCache.cpp │ ├── CodeCache.h │ ├── GGLAssembler.cpp │ ├── GGLAssembler.h │ ├── MIPS64Assembler.cpp │ ├── MIPS64Assembler.h │ ├── MIPSAssembler.cpp │ ├── MIPSAssembler.h │ ├── armreg.h │ ├── blending.cpp │ ├── disassem.c │ ├── disassem.h │ ├── load_store.cpp │ ├── mips64_disassem.c │ ├── mips64_disassem.h │ ├── mips_disassem.c │ ├── mips_disassem.h │ ├── mips_opcode.h │ ├── texturing.cpp │ └── tinyutils │ │ └── smartpointer.h ├── col32cb16blend.S ├── col32cb16blend_neon.S ├── fixed.cpp ├── format.cpp ├── include │ ├── pixelflinger │ │ ├── format.h │ │ └── pixelflinger.h │ └── private │ │ └── pixelflinger │ │ ├── ggl_context.h │ │ └── ggl_fixed.h ├── picker.cpp ├── picker.h ├── pixelflinger.cpp ├── raster.cpp ├── raster.h ├── rotate90CW_4x4_16v6.S ├── scanline.cpp ├── scanline.h ├── t32cb16blend.S ├── tests │ ├── Android.mk │ ├── arch-arm64 │ │ ├── Android.mk │ │ ├── assembler │ │ │ ├── Android.mk │ │ │ ├── arm64_assembler_test.cpp │ │ │ └── asm_test_jacket.S │ │ ├── col32cb16blend │ │ │ ├── Android.mk │ │ │ └── col32cb16blend_test.c │ │ ├── disassembler │ │ │ ├── Android.mk │ │ │ └── arm64_diassembler_test.cpp │ │ └── t32cb16blend │ │ │ ├── Android.mk │ │ │ └── t32cb16blend_test.c │ ├── arch-mips │ │ ├── Android.mk │ │ ├── col32cb16blend │ │ │ ├── Android.mk │ │ │ └── col32cb16blend_test.c │ │ └── t32cb16blend │ │ │ ├── Android.mk │ │ │ └── t32cb16blend_test.c │ ├── arch-mips64 │ │ ├── Android.mk │ │ ├── assembler │ │ │ ├── Android.mk │ │ │ ├── asm_mips_test_jacket.S │ │ │ └── mips64_assembler_test.cpp │ │ ├── col32cb16blend │ │ │ ├── Android.mk │ │ │ └── col32cb16blend_test.c │ │ └── disassembler │ │ │ ├── Android.mk │ │ │ └── mips64_disassembler_test.cpp │ ├── codegen │ │ ├── Android.mk │ │ └── codegen.cpp │ └── gglmul │ │ ├── Android.mk │ │ └── gglmul_test.cpp ├── trap.cpp └── trap.h ├── libprocessgroup ├── Android.mk ├── cleanup.cpp ├── include │ └── processgroup │ │ └── processgroup.h ├── processgroup.cpp └── processgroup_priv.h ├── libsparse ├── Android.mk ├── append2simg.c ├── backed_block.c ├── backed_block.h ├── defs.h ├── img2simg.c ├── include │ └── sparse │ │ └── sparse.h ├── output_file.c ├── output_file.h ├── simg2img.c ├── simg2simg.c ├── simg_dump.py ├── sparse.c ├── sparse_crc32.c ├── sparse_crc32.h ├── sparse_defs.h ├── sparse_err.c ├── sparse_file.h ├── sparse_format.h └── sparse_read.c ├── libsuspend ├── Android.mk ├── autosuspend.c ├── autosuspend_autosleep.c ├── autosuspend_earlysuspend.c ├── autosuspend_ops.h ├── autosuspend_wakeup_count.c └── include │ └── suspend │ └── autosuspend.h ├── libsync ├── Android.mk ├── include │ └── sync │ │ └── sync.h ├── sw_sync.h ├── sync.c ├── sync_test.c └── tests │ ├── Android.mk │ └── sync_test.cpp ├── libsysutils ├── Android.mk ├── EventLogTags.logtags └── src │ ├── FrameworkClient.cpp │ ├── FrameworkCommand.cpp │ ├── FrameworkListener.cpp │ ├── NetlinkEvent.cpp │ ├── NetlinkListener.cpp │ ├── ServiceManager.cpp │ ├── SocketClient.cpp │ └── SocketListener.cpp ├── libusbhost ├── Android.mk └── usbhost.c ├── libutils ├── Android.mk ├── BlobCache.cpp ├── CallStack.cpp ├── CleanSpec.mk ├── FileMap.cpp ├── JenkinsHash.cpp ├── LinearTransform.cpp ├── Log.cpp ├── Looper.cpp ├── MODULE_LICENSE_APACHE2 ├── NOTICE ├── NativeHandle.cpp ├── Printer.cpp ├── ProcessCallStack.cpp ├── PropertyMap.cpp ├── README ├── RefBase.cpp ├── SharedBuffer.cpp ├── SharedBuffer.h ├── SharedBufferTest.cpp ├── Static.cpp ├── StopWatch.cpp ├── String16.cpp ├── String8.cpp ├── SystemClock.cpp ├── Threads.cpp ├── Timers.cpp ├── Tokenizer.cpp ├── Trace.cpp ├── Unicode.cpp ├── VectorImpl.cpp ├── misc.cpp ├── primes.py └── tests │ ├── Android.mk │ ├── BitSet_test.cpp │ ├── BlobCache_test.cpp │ ├── Looper_test.cpp │ ├── LruCache_test.cpp │ ├── String8_test.cpp │ ├── StrongPointer_test.cpp │ ├── SystemClock_test.cpp │ ├── TestHelpers.h │ ├── Unicode_test.cpp │ └── Vector_test.cpp ├── libziparchive ├── Android.mk ├── entry_name_utils-inl.h ├── entry_name_utils_test.cc ├── testdata │ ├── bad_crc.zip │ ├── declaredlength.zip │ ├── large.zip │ └── valid.zip ├── zip_archive.cc ├── zip_archive_common.h ├── zip_archive_private.h ├── zip_archive_stream_entry.cc ├── zip_archive_test.cc ├── zip_writer.cc └── zip_writer_test.cc ├── lmkd ├── Android.mk ├── lmkd.c └── lmkd.rc ├── logcat ├── Android.mk ├── MODULE_LICENSE_APACHE2 ├── NOTICE ├── event.logtags ├── logcat.cpp ├── logcatd.rc ├── logpersist └── tests │ ├── Android.mk │ ├── logcat_benchmark.cpp │ └── logcat_test.cpp ├── logd ├── Android.mk ├── CommandListener.cpp ├── CommandListener.h ├── FlushCommand.cpp ├── FlushCommand.h ├── LogAudit.cpp ├── LogAudit.h ├── LogBuffer.cpp ├── LogBuffer.h ├── LogBufferElement.cpp ├── LogBufferElement.h ├── LogCommand.cpp ├── LogCommand.h ├── LogKlog.cpp ├── LogKlog.h ├── LogListener.cpp ├── LogListener.h ├── LogReader.cpp ├── LogReader.h ├── LogStatistics.cpp ├── LogStatistics.h ├── LogTimes.cpp ├── LogTimes.h ├── LogUtils.h ├── LogWhiteBlackList.cpp ├── LogWhiteBlackList.h ├── README.auditd ├── README.property ├── event.logtags ├── libaudit.c ├── libaudit.h ├── logd.rc ├── main.cpp └── tests │ ├── Android.mk │ └── logd_test.cpp ├── logwrapper ├── Android.mk ├── NOTICE ├── include │ └── logwrap │ │ └── logwrap.h ├── logwrap.c └── logwrapper.c ├── metricsd ├── .clang-format ├── Android.mk ├── OWNERS ├── README.md ├── WATCHLISTS ├── aidl │ └── android │ │ └── brillo │ │ └── metrics │ │ ├── IMetricsCollectorService.aidl │ │ └── IMetricsd.aidl ├── c_metrics_library.cc ├── collectors │ ├── averaged_statistics_collector.cc │ ├── averaged_statistics_collector.h │ ├── averaged_statistics_collector_test.cc │ ├── cpu_usage_collector.cc │ ├── cpu_usage_collector.h │ ├── cpu_usage_collector_test.cc │ ├── disk_usage_collector.cc │ └── disk_usage_collector.h ├── constants.h ├── etc │ └── weaved │ │ └── traits │ │ └── metrics.json ├── include │ └── metrics │ │ ├── c_metrics_library.h │ │ ├── metrics_collector_service_client.h │ │ ├── metrics_library.h │ │ ├── metrics_library_mock.h │ │ ├── timer.h │ │ └── timer_mock.h ├── libmetrics-369476.gyp ├── libmetrics.gypi ├── libmetrics.pc.in ├── metrics.gyp ├── metrics_client.cc ├── metrics_collector.cc ├── metrics_collector.h ├── metrics_collector.rc ├── metrics_collector_main.cc ├── metrics_collector_service_client.cc ├── metrics_collector_service_impl.cc ├── metrics_collector_service_impl.h ├── metrics_collector_test.cc ├── metrics_library.cc ├── metrics_library_test.cc ├── metricsd.rc ├── metricsd_main.cc ├── persistent_integer.cc ├── persistent_integer.h ├── persistent_integer_mock.h ├── persistent_integer_test.cc ├── timer.cc ├── timer_test.cc └── uploader │ ├── bn_metricsd_impl.cc │ ├── bn_metricsd_impl.h │ ├── crash_counters.cc │ ├── crash_counters.h │ ├── metrics_hashes.cc │ ├── metrics_hashes.h │ ├── metrics_hashes_unittest.cc │ ├── metrics_log.cc │ ├── metrics_log.h │ ├── metrics_log_base.cc │ ├── metrics_log_base.h │ ├── metrics_log_base_unittest.cc │ ├── metricsd_service_runner.cc │ ├── metricsd_service_runner.h │ ├── mock │ ├── mock_system_profile_setter.h │ ├── sender_mock.cc │ └── sender_mock.h │ ├── proto │ ├── README │ ├── chrome_user_metrics_extension.proto │ ├── histogram_event.proto │ ├── system_profile.proto │ └── user_action_event.proto │ ├── sender.h │ ├── sender_http.cc │ ├── sender_http.h │ ├── system_profile_cache.cc │ ├── system_profile_cache.h │ ├── system_profile_setter.h │ ├── upload_service.cc │ ├── upload_service.h │ └── upload_service_test.cc ├── mkbootimg ├── Android.mk ├── bootimg.h └── mkbootimg ├── reboot ├── Android.mk └── reboot.c ├── rootdir ├── Android.mk ├── asan.options ├── etc │ ├── hosts │ ├── public.libraries.android.txt │ └── public.libraries.wear.txt ├── init-debug.rc ├── init.environ.rc.in ├── init.rc ├── init.usb.configfs.rc ├── init.usb.rc ├── init.zygote32.rc ├── init.zygote32_64.rc ├── init.zygote64.rc ├── init.zygote64_32.rc └── ueventd.rc ├── run-as ├── Android.mk ├── NOTICE ├── package.c ├── package.h └── run-as.c ├── sdcard ├── Android.mk └── sdcard.c ├── toolbox ├── Android.mk ├── MODULE_LICENSE_BSD ├── NOTICE ├── bsd-compatibility.h ├── generate-input.h-labels.py ├── getevent.c ├── newfs_msdos.c ├── r.c ├── sendevent.c ├── toolbox.c └── upstream-netbsd │ ├── bin │ └── dd │ │ ├── args.c │ │ ├── conv.c │ │ ├── dd.c │ │ ├── dd.h │ │ ├── dd_hostops.c │ │ ├── extern.h │ │ ├── misc.c │ │ └── position.c │ ├── include │ ├── namespace.h │ ├── sys │ │ ├── extattr.h │ │ └── mtio.h │ └── util.h │ ├── lib │ ├── libc │ │ ├── gen │ │ │ ├── getbsize.c │ │ │ └── humanize_number.c │ │ ├── stdlib │ │ │ └── strsuftoll.c │ │ └── string │ │ │ └── swab.c │ └── libutil │ │ └── raise_default_signal.c │ └── usr.bin │ └── grep │ ├── fastgrep.c │ ├── file.c │ ├── grep.c │ ├── grep.h │ ├── queue.c │ └── util.c ├── trusty ├── gatekeeper │ ├── Android.mk │ ├── gatekeeper_ipc.h │ ├── module.cpp │ ├── trusty_gatekeeper.cpp │ ├── trusty_gatekeeper.h │ ├── trusty_gatekeeper_ipc.c │ └── trusty_gatekeeper_ipc.h ├── keymaster │ ├── Android.mk │ ├── Makefile │ ├── keymaster_ipc.h │ ├── module.cpp │ ├── trusty_keymaster_device.cpp │ ├── trusty_keymaster_device.h │ ├── trusty_keymaster_device_test.cpp │ ├── trusty_keymaster_ipc.c │ ├── trusty_keymaster_ipc.h │ └── trusty_keymaster_main.cpp ├── libtrusty │ ├── Android.mk │ ├── include │ │ └── trusty │ │ │ └── tipc.h │ ├── tipc-test │ │ ├── Android.mk │ │ └── tipc_test.c │ ├── tipc_ioctl.h │ └── trusty.c ├── nvram │ ├── Android.mk │ ├── module.c │ └── trusty_nvram_implementation.cpp ├── storage │ ├── interface │ │ ├── Android.mk │ │ └── include │ │ │ └── trusty │ │ │ └── interface │ │ │ └── storage.h │ ├── lib │ │ ├── Android.mk │ │ ├── include │ │ │ └── trusty │ │ │ │ └── lib │ │ │ │ └── storage.h │ │ └── storage.c │ ├── proxy │ │ ├── Android.mk │ │ ├── ipc.c │ │ ├── ipc.h │ │ ├── log.h │ │ ├── proxy.c │ │ ├── rpmb.c │ │ ├── rpmb.h │ │ ├── storage.c │ │ └── storage.h │ └── tests │ │ ├── Android.mk │ │ └── main.cpp ├── trusty-base.mk └── trusty-storage.mk └── tzdatacheck ├── Android.mk └── tzdatacheck.cpp /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | *.pyc 3 | *.o 4 | *.a 5 | adb/adbd 6 | adb/xdg-adbd 7 | -------------------------------------------------------------------------------- /Android.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2008 The Android Open Source Project 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | LOCAL_PATH := $(my-dir) 17 | 18 | include $(call first-makefiles-under,$(LOCAL_PATH)) 19 | -------------------------------------------------------------------------------- /MODULE_LICENSE_APACHE2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tonyho/adbd-linux/7c56fbf46978ec889b6eee4124457dccdeb2b651/MODULE_LICENSE_APACHE2 -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | # Limitation 2 | Openssl version < 1.1, must be 1.0, as the 1.1 has broken API 3 | 4 | # Info 5 | Base on:https://github.com/hadess/adbd 6 | 7 | Modify for Yocto building and common Linux based OS. 8 | 9 | # Compiling in normal Linux OS 10 | ``` 11 | RANLIB=ranlib AR=ar CXX=g++ CC=gcc make 12 | ``` 13 | 14 | -------------------------------------------------------------------------------- /adb/.clang-format: -------------------------------------------------------------------------------- 1 | BasedOnStyle: Google 2 | AllowShortBlocksOnASingleLine: false 3 | AllowShortFunctionsOnASingleLine: false 4 | 5 | AccessModifierOffset: -2 6 | ColumnLimit: 100 7 | CommentPragmas: NOLINT:.* 8 | DerivePointerAlignment: false 9 | IndentWidth: 4 10 | PointerAlignment: Left 11 | TabWidth: 4 12 | UseTab: Never 13 | PenaltyExcessCharacter: 32 14 | -------------------------------------------------------------------------------- /adb/CPPLINT.cfg: -------------------------------------------------------------------------------- 1 | set noparent 2 | filter=-build/header_guard,-build/include,-readability/function,-whitespace/indent 3 | -------------------------------------------------------------------------------- /adb/MODULE_LICENSE_APACHE2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tonyho/adbd-linux/7c56fbf46978ec889b6eee4124457dccdeb2b651/adb/MODULE_LICENSE_APACHE2 -------------------------------------------------------------------------------- /adb/diagnose_usb.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __DIAGNOSE_LINUX_USB_H 18 | #define __DIAGNOSE_LINUX_USB_H 19 | 20 | #include 21 | 22 | // USB permission error help text. The short version will be one line, long may be multi-line. 23 | // Returns a string message to print, or an empty string if no problems could be found. 24 | std::string UsbNoPermissionsShortHelpText(); 25 | std::string UsbNoPermissionsLongHelpText(); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /adb/get_my_path_darwin.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #import 18 | #include 19 | 20 | #include "adb.h" 21 | 22 | void get_my_path(char *s, size_t maxLen) 23 | { 24 | CFBundleRef mainBundle = CFBundleGetMainBundle(); 25 | CFURLRef executableURL = CFBundleCopyExecutableURL(mainBundle); 26 | CFStringRef executablePathString = CFURLCopyFileSystemPath(executableURL, kCFURLPOSIXPathStyle); 27 | CFRelease(executableURL); 28 | 29 | CFStringGetFileSystemRepresentation(executablePathString, s, maxLen); 30 | CFRelease(executablePathString); 31 | } 32 | 33 | -------------------------------------------------------------------------------- /adb/get_my_path_linux.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | #include "adb.h" 23 | 24 | void get_my_path(char *exe, size_t maxLen) 25 | { 26 | char proc[64]; 27 | snprintf(proc, sizeof proc, "/proc/%d/exe", getpid()); 28 | int err = readlink(proc, exe, maxLen - 1); 29 | if(err > 0) { 30 | exe[err] = '\0'; 31 | } else { 32 | exe[0] = '\0'; 33 | } 34 | } 35 | 36 | -------------------------------------------------------------------------------- /adb/log-non-android.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int __android_log_security_bswrite(int32_t tag, const char *payload) 5 | { 6 | #if 0 7 | struct iovec vec[4]; 8 | char type = EVENT_TYPE_STRING; 9 | uint32_t len = strlen(payload); 10 | 11 | vec[0].iov_base = &tag; 12 | vec[0].iov_len = sizeof(tag); 13 | vec[1].iov_base = &type; 14 | vec[1].iov_len = sizeof(type); 15 | vec[2].iov_base = &len; 16 | vec[2].iov_len = sizeof(len); 17 | vec[3].iov_base = (void*)payload; 18 | vec[3].iov_len = len; 19 | 20 | return write_to_log(LOG_ID_SECURITY, vec, 4); 21 | #endif 22 | return 0; 23 | } 24 | 25 | int __android_log_print(int prio, const char *tag, const char *fmt, ...) 26 | { 27 | #if 0 28 | va_list ap; 29 | char buf[LOG_BUF_SIZE]; 30 | 31 | va_start(ap, fmt); 32 | vsnprintf(buf, LOG_BUF_SIZE, fmt, ap); 33 | va_end(ap); 34 | 35 | return __android_log_write(prio, tag, buf); 36 | #endif 37 | return 0; 38 | } 39 | -------------------------------------------------------------------------------- /adb/mutex_list.h: -------------------------------------------------------------------------------- 1 | /* the list of mutexes used by adb */ 2 | /* #ifndef __MUTEX_LIST_H 3 | * Do not use an include-guard. This file is included once to declare the locks 4 | * and once in win32 to actually do the runtime initialization. 5 | */ 6 | #ifndef ADB_MUTEX 7 | #error ADB_MUTEX not defined when including this file 8 | #endif 9 | ADB_MUTEX(basename_lock) 10 | ADB_MUTEX(dirname_lock) 11 | ADB_MUTEX(transport_lock) 12 | #if ADB_HOST 13 | ADB_MUTEX(local_transports_lock) 14 | #endif 15 | ADB_MUTEX(usb_lock) 16 | 17 | #undef ADB_MUTEX 18 | -------------------------------------------------------------------------------- /adb/remount_service.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _REMOUNT_SERVICE_H_ 18 | #define _REMOUNT_SERVICE_H_ 19 | 20 | #include 21 | 22 | bool make_block_device_writable(const std::string&); 23 | void remount_service(int, void*); 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /adb/security_log_tags.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef __SECURITY_LOG_TAGS_H 17 | #define __SECURITY_LOG_TAGS_H 18 | 19 | /* TODO: Automatically generate this file from the logtags file when build 20 | * infrastructure is in place. 21 | * Defined in frameworks/base/core/java/android/auditing/SecurityLog.logtags 22 | */ 23 | #define SEC_TAG_ADB_SHELL_INTERACTIVE 210001 24 | #define SEC_TAG_ADB_SHELL_CMD 210002 25 | #define SEC_TAG_ADB_RECV_FILE 210003 26 | #define SEC_TAG_ADB_SEND_FILE 210004 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /adb/services.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef SERVICES_H_ 18 | #define SERVICES_H_ 19 | 20 | constexpr char kShellServiceArgRaw[] = "raw"; 21 | constexpr char kShellServiceArgPty[] = "pty"; 22 | constexpr char kShellServiceArgShellProtocol[] = "v2"; 23 | 24 | #endif // SERVICES_H_ 25 | -------------------------------------------------------------------------------- /adb/sockets.dia: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tonyho/adbd-linux/7c56fbf46978ec889b6eee4124457dccdeb2b651/adb/sockets.dia -------------------------------------------------------------------------------- /adbd.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=ADB Daemon 3 | After=sysinit.target 4 | Before=network.service 5 | 6 | [Service] 7 | Type=simple 8 | ExecStartPre=/sbin/xdg-adbd start 9 | ExecStart=/bin/bash -c 'ADB_TRACE=1 /sbin/adbd 2> /var/log/adbd.err 1> /var/log/adbd.out' 10 | 11 | ExecStopPost=/bin/umount /dev/usb-ffs/adb 12 | 13 | [Install] 14 | WantedBy=basic.target 15 | -------------------------------------------------------------------------------- /adf/Android.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2013 The Android Open Source Project 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | LOCAL_PATH := $(my-dir) 17 | 18 | include $(call first-makefiles-under,$(LOCAL_PATH)) 19 | -------------------------------------------------------------------------------- /adf/libadf/Android.mk: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2013 The Android Open Source Project 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | LOCAL_PATH:= $(call my-dir) 16 | 17 | include $(CLEAR_VARS) 18 | LOCAL_SRC_FILES := adf.c 19 | LOCAL_MODULE := libadf 20 | LOCAL_MODULE_TAGS := optional 21 | LOCAL_CFLAGS += -Werror 22 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include 23 | LOCAL_C_INCLUDES += $(LOCAL_EXPORT_C_INCLUDE_DIRS) 24 | include $(BUILD_STATIC_LIBRARY) 25 | -------------------------------------------------------------------------------- /adf/libadf/tests/Android.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2013 The Android Open Source Project 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | LOCAL_PATH := $(my-dir) 17 | 18 | include $(CLEAR_VARS) 19 | LOCAL_SRC_FILES := adf_test.cpp 20 | LOCAL_MODULE := adf-unit-tests 21 | LOCAL_STATIC_LIBRARIES := libadf 22 | LOCAL_CFLAGS += -Werror 23 | include $(BUILD_NATIVE_TEST) 24 | -------------------------------------------------------------------------------- /adf/libadfhwc/Android.mk: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2013 The Android Open Source Project 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | LOCAL_PATH:= $(call my-dir) 16 | 17 | include $(CLEAR_VARS) 18 | LOCAL_SRC_FILES := adfhwc.cpp 19 | LOCAL_MODULE := libadfhwc 20 | LOCAL_MODULE_TAGS := optional 21 | LOCAL_STATIC_LIBRARIES := libadf liblog libutils 22 | LOCAL_CFLAGS += -DLOG_TAG=\"adfhwc\" -Werror 23 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include 24 | LOCAL_C_INCLUDES += $(LOCAL_EXPORT_C_INCLUDE_DIRS) 25 | include $(BUILD_STATIC_LIBRARY) 26 | -------------------------------------------------------------------------------- /base/.clang-format: -------------------------------------------------------------------------------- 1 | BasedOnStyle: Google 2 | AllowShortBlocksOnASingleLine: false 3 | AllowShortFunctionsOnASingleLine: false 4 | 5 | CommentPragmas: NOLINT:.* 6 | DerivePointerAlignment: false 7 | IndentWidth: 2 8 | PointerAlignment: Left 9 | TabWidth: 2 10 | UseTab: Never 11 | PenaltyExcessCharacter: 32 12 | -------------------------------------------------------------------------------- /base/CPPLINT.cfg: -------------------------------------------------------------------------------- 1 | set noparent 2 | filter=-build/header_guard,-build/include,-build/c++11,-whitespace/operators 3 | -------------------------------------------------------------------------------- /base/errors_test.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "android-base/errors.h" 18 | 19 | #include 20 | 21 | namespace android { 22 | namespace base { 23 | 24 | // Error strings aren't consistent enough across systems to test the output, 25 | // just make sure we can compile correctly and nothing crashes even if we send 26 | // it possibly bogus error codes. 27 | TEST(ErrorsTest, TestSystemErrorString) { 28 | SystemErrorCodeToString(-1); 29 | SystemErrorCodeToString(0); 30 | SystemErrorCodeToString(1); 31 | } 32 | 33 | } // namespace base 34 | } // namespace android 35 | -------------------------------------------------------------------------------- /base/errors_unix.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "android-base/errors.h" 18 | 19 | #include 20 | #include 21 | 22 | namespace android { 23 | namespace base { 24 | 25 | std::string SystemErrorCodeToString(int error_code) { 26 | return strerror(error_code); 27 | } 28 | 29 | } // namespace base 30 | } // namespace android 31 | -------------------------------------------------------------------------------- /base/test_main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | #include "android-base/logging.h" 20 | 21 | int main(int argc, char** argv) { 22 | ::testing::InitGoogleTest(&argc, argv); 23 | android::base::InitLogging(argv, android::base::StderrLogger); 24 | return RUN_ALL_TESTS(); 25 | } 26 | -------------------------------------------------------------------------------- /bootstat/histogram_logger.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | namespace bootstat { 21 | 22 | // Builds an EventLog buffer named |event| containing |data| and writes 23 | // the log into the Tron histogram logs. 24 | void LogHistogram(const std::string& event, int32_t data); 25 | 26 | } // namespace bootstat -------------------------------------------------------------------------------- /bootstat/testrunner.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | int main(int argc, char** argv) { 21 | ::testing::InitGoogleTest(&argc, argv); 22 | android::base::InitLogging(argv, android::base::StderrLogger); 23 | return RUN_ALL_TESTS(); 24 | } 25 | -------------------------------------------------------------------------------- /bootstat/uptime_parser.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "uptime_parser.h" 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | namespace bootstat { 26 | 27 | time_t ParseUptime() { 28 | std::string uptime_str; 29 | if (!android::base::ReadFileToString("/proc/uptime", &uptime_str)) { 30 | PLOG(ERROR) << "Failed to read /proc/uptime"; 31 | return -1; 32 | } 33 | 34 | // Cast intentionally rounds down. 35 | return static_cast(strtod(uptime_str.c_str(), NULL)); 36 | } 37 | 38 | } // namespace bootstat -------------------------------------------------------------------------------- /bootstat/uptime_parser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef UPTIME_PARSER_H_ 18 | #define UPTIME_PARSER_H_ 19 | 20 | #include 21 | 22 | namespace bootstat { 23 | 24 | // Returns the number of seconds the system has been on since reboot. 25 | time_t ParseUptime(); 26 | 27 | } // namespace bootstat 28 | 29 | #endif // UPTIME_PARSER_H_ -------------------------------------------------------------------------------- /cpio/Android.mk: -------------------------------------------------------------------------------- 1 | # Copyright 2005 The Android Open Source Project 2 | 3 | LOCAL_PATH:= $(call my-dir) 4 | include $(CLEAR_VARS) 5 | 6 | LOCAL_SRC_FILES := \ 7 | mkbootfs.c 8 | 9 | LOCAL_MODULE := mkbootfs 10 | 11 | LOCAL_CFLAGS := -Werror 12 | 13 | LOCAL_SHARED_LIBRARIES := libcutils 14 | 15 | include $(BUILD_HOST_EXECUTABLE) 16 | 17 | $(call dist-for-goals,dist_files,$(LOCAL_BUILT_MODULE)) 18 | -------------------------------------------------------------------------------- /crash_reporter/.project_alias: -------------------------------------------------------------------------------- 1 | crash 2 | -------------------------------------------------------------------------------- /crash_reporter/99-crash-reporter.rules: -------------------------------------------------------------------------------- 1 | ACTION=="change", SUBSYSTEM=="drm", KERNEL=="card0", ENV{ERROR}=="1", RUN+="/sbin/crash_reporter --udev=KERNEL=card0:SUBSYSTEM=drm:ACTION=change" 2 | # For detecting cypress trackpad issue. Passing into crash_reporter SUBSYSTEM=i2c-cyapa since crash_reporter does not handle DRIVER string. 3 | ACTION=="change", SUBSYSTEM=="i2c", DRIVER=="cyapa", ENV{ERROR}=="1", RUN+="/sbin/crash_reporter --udev=SUBSYSTEM=i2c-cyapa:ACTION=change" 4 | # For detecting Atmel trackpad/touchscreen issue. Passing into crash_reporter SUBSYSTEM=i2c-atmel_mxt_ts since crash_reporter does not handle DRIVER string. 5 | ACTION=="change", SUBSYSTEM=="i2c", DRIVER=="atmel_mxt_ts", ENV{ERROR}=="1", RUN+="/sbin/crash_reporter --udev=SUBSYSTEM=i2c-atmel_mxt_ts:ACTION=change" 6 | ACTION=="add", SUBSYSTEM=="devcoredump", RUN+="/sbin/crash_reporter --udev=SUBSYSTEM=devcoredump:ACTION=add:KERNEL_NUMBER=%n" 7 | -------------------------------------------------------------------------------- /crash_reporter/OWNERS: -------------------------------------------------------------------------------- 1 | set noparent 2 | vapier@chromium.org 3 | -------------------------------------------------------------------------------- /crash_reporter/crash_collector_test.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef CRASH_REPORTER_CRASH_COLLECTOR_TEST_H_ 18 | #define CRASH_REPORTER_CRASH_COLLECTOR_TEST_H_ 19 | 20 | #include "crash_collector.h" 21 | 22 | #include 23 | #include 24 | 25 | #include 26 | #include 27 | 28 | class CrashCollectorMock : public CrashCollector { 29 | public: 30 | MOCK_METHOD0(SetUpDBus, void()); 31 | MOCK_METHOD1(GetActiveUserSessions, 32 | bool(std::map *sessions)); 33 | }; 34 | 35 | #endif // CRASH_REPORTER_CRASH_COLLECTOR_TEST_H_ 36 | -------------------------------------------------------------------------------- /crash_reporter/dbus_bindings/org.chromium.LibCrosService.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /crash_reporter/init/crash-reporter.conf: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2011 The Chromium OS Authors. All rights reserved. 2 | # Use of this source code is governed by a BSD-style license that can be 3 | # found in the LICENSE file. 4 | 5 | description "Initialize crash reporting services" 6 | author "chromium-os-dev@chromium.org" 7 | 8 | # This job merely initializes its service and then terminates; the 9 | # actual checking and reporting of crash dumps is triggered by an 10 | # hourly cron job. 11 | start on starting system-services 12 | 13 | pre-start script 14 | mkdir -p /var/spool 15 | 16 | # Only allow device coredumps on a "developer system". 17 | if ! is_developer_end_user; then 18 | # consumer end-user - disable device coredumps, if driver exists. 19 | echo 1 > /sys/class/devcoredump/disabled || true 20 | fi 21 | end script 22 | 23 | # crash_reporter uses argv[0] as part of the command line for 24 | # /proc/sys/kernel/core_pattern. That command line is invoked by 25 | # the kernel, and can't rely on PATH, so argv[0] must be a full 26 | # path; we invoke it as such here. 27 | exec /sbin/crash_reporter --init 28 | -------------------------------------------------------------------------------- /crash_reporter/init/crash-sender.conf: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2014 The Chromium OS Authors. All rights reserved. 2 | # Use of this source code is governed by a BSD-style license that can be 3 | # found in the LICENSE file. 4 | 5 | description "Run the crash sender periodically" 6 | author "chromium-os-dev@chromium.org" 7 | 8 | start on starting system-services 9 | stop on stopping system-services 10 | 11 | exec periodic_scheduler 3600 14400 crash_sender /sbin/crash_sender 12 | -------------------------------------------------------------------------------- /crash_reporter/init/warn-collector.conf: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013 The Chromium OS Authors. All rights reserved. 2 | # Use of this source code is governed by a BSD-style license that can be 3 | # found in the LICENSE file. 4 | 5 | description "Runs a daemon which collects and reports kernel warnings" 6 | author "chromium-os-dev@chromium.org" 7 | 8 | start on started system-services 9 | stop on stopping system-services 10 | respawn 11 | 12 | exec warn_collector 13 | -------------------------------------------------------------------------------- /crash_reporter/kernel_collector_test.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef CRASH_REPORTER_KERNEL_COLLECTOR_TEST_H_ 18 | #define CRASH_REPORTER_KERNEL_COLLECTOR_TEST_H_ 19 | 20 | #include "kernel_collector.h" 21 | 22 | #include 23 | #include 24 | 25 | class KernelCollectorMock : public KernelCollector { 26 | public: 27 | MOCK_METHOD0(DumpDirMounted, bool()); 28 | MOCK_METHOD0(SetUpDBus, void()); 29 | }; 30 | 31 | #endif // CRASH_REPORTER_KERNEL_COLLECTOR_TEST_H_ 32 | -------------------------------------------------------------------------------- /crash_reporter/testrunner.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | int main(int argc, char** argv) { 21 | SetUpTests(&argc, argv, true); 22 | return RUN_ALL_TESTS(); 23 | } 24 | -------------------------------------------------------------------------------- /crash_reporter/warn_collector_test.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * Test driver for the warn_collector daemon. 19 | */ 20 | #include 21 | 22 | int main(int ac, char **av) { 23 | int status = system("exec \"${SRC}\"/warn_collector_test.sh"); 24 | return status < 0 ? EXIT_FAILURE : WEXITSTATUS(status); 25 | } 26 | -------------------------------------------------------------------------------- /crash_reporter/warn_collector_test_reporter.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | # Copyright (C) 2013 The Android Open Source Project 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | # Replacement for the crash reporter, for testing. Log the first line of the 18 | # "warning" file, which by convention contains the warning hash, and remove the 19 | # file. 20 | 21 | set -e 22 | 23 | exec 1>> warn-test-log 24 | exec 2>> warn-test-log 25 | 26 | head -1 warning 27 | rm warning 28 | -------------------------------------------------------------------------------- /debuggerd/.clang-format: -------------------------------------------------------------------------------- 1 | BasedOnStyle: Google 2 | AllowShortBlocksOnASingleLine: false 3 | AllowShortFunctionsOnASingleLine: false 4 | 5 | ColumnLimit: 100 6 | CommentPragmas: NOLINT:.* 7 | DerivePointerAlignment: false 8 | IndentWidth: 2 9 | ContinuationIndentWidth: 2 10 | PointerAlignment: Left 11 | TabWidth: 2 12 | UseTab: Never 13 | PenaltyExcessCharacter: 32 14 | 15 | Cpp11BracedListStyle: false 16 | -------------------------------------------------------------------------------- /debuggerd/Android.bp: -------------------------------------------------------------------------------- 1 | cc_library_static { 2 | name: "libdebuggerd_client", 3 | srcs: ["client/debuggerd_client.cpp"], 4 | 5 | cflags: [ 6 | "-Wall", 7 | "-Wextra", 8 | "-Werror", 9 | "-Os", 10 | ], 11 | 12 | local_include_dirs: ["include"], 13 | export_include_dirs: ["include"], 14 | 15 | // libdebuggerd_client gets async signal safe logging via libc_logging, 16 | // which defines its interface in bionic private headers. 17 | include_dirs: ["bionic/libc"], 18 | static_libs: ["libc_logging"], 19 | } 20 | -------------------------------------------------------------------------------- /debuggerd/MODULE_LICENSE_APACHE2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tonyho/adbd-linux/7c56fbf46978ec889b6eee4124457dccdeb2b651/debuggerd/MODULE_LICENSE_APACHE2 -------------------------------------------------------------------------------- /debuggerd/debuggerd.rc: -------------------------------------------------------------------------------- 1 | service debuggerd /system/bin/debuggerd 2 | group root readproc 3 | writepid /dev/cpuset/system-background/tasks 4 | -------------------------------------------------------------------------------- /debuggerd/debuggerd64.rc: -------------------------------------------------------------------------------- 1 | service debuggerd64 /system/bin/debuggerd64 2 | group root readproc 3 | writepid /dev/cpuset/system-background/tasks 4 | -------------------------------------------------------------------------------- /debuggerd/elf_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _DEBUGGERD_ELF_UTILS_H 18 | #define _DEBUGGERD_ELF_UTILS_H 19 | 20 | #include 21 | #include 22 | 23 | class Backtrace; 24 | 25 | bool elf_get_build_id(Backtrace*, uintptr_t, std::string*); 26 | 27 | #endif // _DEBUGGERD_ELF_UTILS_H 28 | -------------------------------------------------------------------------------- /debuggerd/getevent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _DEBUGGERD_GETEVENT_H 18 | #define _DEBUGGERD_GETEVENT_H 19 | 20 | int init_getevent(); 21 | void uninit_getevent(); 22 | int get_event(struct input_event* event, int timeout); 23 | 24 | #endif // _DEBUGGERD_GETEVENT_H 25 | -------------------------------------------------------------------------------- /debuggerd/machine.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _DEBUGGERD_MACHINE_H 18 | #define _DEBUGGERD_MACHINE_H 19 | 20 | #include 21 | 22 | #include 23 | 24 | #include "utility.h" 25 | 26 | void dump_memory_and_code(log_t* log, Backtrace* backtrace); 27 | void dump_registers(log_t* log, pid_t tid); 28 | 29 | #endif // _DEBUGGERD_MACHINE_H 30 | -------------------------------------------------------------------------------- /debuggerd/mips/crashglue.S: -------------------------------------------------------------------------------- 1 | .set noat 2 | 3 | .globl crash1 4 | .globl crashnostack 5 | 6 | crash1: 7 | li $0,0xdead0000+0 8 | li $1,0xdead0000+1 9 | li $2,0xdead0000+2 10 | li $3,0xdead0000+3 11 | li $4,0xdead0000+4 12 | li $5,0xdead0000+5 13 | li $6,0xdead0000+6 14 | li $7,0xdead0000+7 15 | li $8,0xdead0000+8 16 | li $9,0xdead0000+9 17 | li $10,0xdead0000+10 18 | li $11,0xdead0000+11 19 | li $12,0xdead0000+12 20 | li $13,0xdead0000+13 21 | li $14,0xdead0000+14 22 | li $15,0xdead0000+15 23 | li $16,0xdead0000+16 24 | li $17,0xdead0000+17 25 | li $18,0xdead0000+18 26 | li $19,0xdead0000+19 27 | li $20,0xdead0000+20 28 | li $21,0xdead0000+21 29 | li $22,0xdead0000+22 30 | li $23,0xdead0000+23 31 | li $24,0xdead0000+24 32 | li $25,0xdead0000+25 33 | li $26,0xdead0000+26 34 | li $27,0xdead0000+27 35 | li $28,0xdead0000+28 36 | # don't trash the stack otherwise the signal handler won't run 37 | #li $29,0xdead0000+29 38 | li $30,0xdead0000+30 39 | li $31,0xdead0000+31 40 | 41 | lw $zero,($0) 42 | b . 43 | 44 | 45 | crashnostack: 46 | li $sp, 0 47 | lw $zero,($0) 48 | b . 49 | -------------------------------------------------------------------------------- /debuggerd/mips64/crashglue.S: -------------------------------------------------------------------------------- 1 | .set noat 2 | 3 | .globl crash1 4 | .globl crashnostack 5 | 6 | crash1: 7 | li $0,0xdead0000+0 8 | li $1,0xdead0000+1 9 | li $2,0xdead0000+2 10 | li $3,0xdead0000+3 11 | li $4,0xdead0000+4 12 | li $5,0xdead0000+5 13 | li $6,0xdead0000+6 14 | li $7,0xdead0000+7 15 | li $8,0xdead0000+8 16 | li $9,0xdead0000+9 17 | li $10,0xdead0000+10 18 | li $11,0xdead0000+11 19 | li $12,0xdead0000+12 20 | li $13,0xdead0000+13 21 | li $14,0xdead0000+14 22 | li $15,0xdead0000+15 23 | li $16,0xdead0000+16 24 | li $17,0xdead0000+17 25 | li $18,0xdead0000+18 26 | li $19,0xdead0000+19 27 | li $20,0xdead0000+20 28 | li $21,0xdead0000+21 29 | li $22,0xdead0000+22 30 | li $23,0xdead0000+23 31 | li $24,0xdead0000+24 32 | li $25,0xdead0000+25 33 | li $26,0xdead0000+26 34 | li $27,0xdead0000+27 35 | li $28,0xdead0000+28 36 | # don't trash the stack otherwise the signal handler won't run 37 | #li $29,0xdead0000+29 38 | li $30,0xdead0000+30 39 | li $31,0xdead0000+31 40 | 41 | lw $zero,($0) 42 | b . 43 | 44 | 45 | crashnostack: 46 | li $sp, 0 47 | lw $zero,($0) 48 | b . 49 | -------------------------------------------------------------------------------- /debuggerd/signal_sender.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _DEBUGGERD_SIGNAL_SENDER_H 18 | #define _DEBUGGERD_SIGNAL_SENDER_H 19 | 20 | #include 21 | 22 | bool start_signal_sender(); 23 | bool stop_signal_sender(); 24 | 25 | // Sends a signal to a target process or thread. 26 | // If tid is greater than zero, this performs tgkill(pid, tid, signal). 27 | // Otherwise, it performs kill(pid, signal). 28 | bool send_signal(pid_t pid, pid_t tid, int signal); 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /debuggerd/test/elf_fake.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | #include 20 | 21 | class Backtrace; 22 | 23 | std::string g_build_id; 24 | 25 | void elf_set_fake_build_id(const std::string& build_id) { 26 | g_build_id = build_id; 27 | } 28 | 29 | bool elf_get_build_id(Backtrace*, uintptr_t, std::string* build_id) { 30 | if (g_build_id != "") { 31 | *build_id = g_build_id; 32 | return true; 33 | } 34 | return false; 35 | } 36 | -------------------------------------------------------------------------------- /debuggerd/test/elf_fake.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _DEBUGGERD_TEST_ELF_FAKE_H 18 | #define _DEBUGGERD_TEST_ELF_FAKE_H 19 | 20 | #include 21 | 22 | void elf_set_fake_build_id(const std::string&); 23 | 24 | #endif // _DEBUGGERD_TEST_ELF_FAKE_H 25 | -------------------------------------------------------------------------------- /debuggerd/test/log_fake.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _DEBUGGERD_TEST_LOG_FAKE_H 18 | #define _DEBUGGERD_TEST_LOG_FAKE_H 19 | 20 | #include 21 | 22 | void resetLogs(); 23 | std::string getFakeLogBuf(); 24 | std::string getFakeLogPrint(); 25 | 26 | #endif // _DEBUGGERD_TEST_LOG_FAKE_H 27 | -------------------------------------------------------------------------------- /debuggerd/test/ptrace_fake.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _DEBUGGERD_TEST_PTRACE_FAKE_H 18 | #define _DEBUGGERD_TEST_PTRACE_FAKE_H 19 | 20 | #include 21 | 22 | void ptrace_set_fake_getsiginfo(const siginfo_t&); 23 | 24 | #endif // _DEBUGGERD_TEST_PTRACE_FAKE_H 25 | -------------------------------------------------------------------------------- /debuggerd/test/selinux/android.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | extern "C" int selinux_android_restorecon(const char*, unsigned int); 18 | -------------------------------------------------------------------------------- /debuggerd/test/selinux_fake.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | extern "C" int selinux_android_restorecon(const char*, unsigned int) { 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /debuggerd/x86/crashglue.S: -------------------------------------------------------------------------------- 1 | .globl crash1 2 | .globl crashnostack 3 | 4 | crash1: 5 | movl $0xa5a50000, %eax 6 | movl $0xa5a50001, %ebx 7 | movl $0xa5a50002, %ecx 8 | 9 | movl $0, %edx 10 | jmp *%edx 11 | 12 | 13 | crashnostack: 14 | movl $0, %ebp 15 | jmp *%ebp 16 | -------------------------------------------------------------------------------- /debuggerd/x86_64/crashglue.S: -------------------------------------------------------------------------------- 1 | .globl crash1 2 | .globl crashnostack 3 | 4 | crash1: 5 | movl $0xa5a50000, %eax 6 | movl $0xa5a50001, %ebx 7 | movl $0xa5a50002, %ecx 8 | 9 | movl $0, %edx 10 | jmp *%rdx 11 | 12 | 13 | crashnostack: 14 | movl $0, %ebp 15 | jmp *%rbp 16 | -------------------------------------------------------------------------------- /fastboot/.clang-format: -------------------------------------------------------------------------------- 1 | BasedOnStyle: Google 2 | AllowShortBlocksOnASingleLine: false 3 | AllowShortFunctionsOnASingleLine: Inline 4 | 5 | ColumnLimit: 100 6 | CommentPragmas: NOLINT:.* 7 | DerivePointerAlignment: false 8 | IndentWidth: 4 9 | ContinuationIndentWidth: 8 10 | ConstructorInitializerIndentWidth: 8 11 | AccessModifierOffset: -2 12 | PointerAlignment: Left 13 | TabWidth: 4 14 | UseTab: Never 15 | PenaltyExcessCharacter: 32 16 | -------------------------------------------------------------------------------- /fastboot/fs.h: -------------------------------------------------------------------------------- 1 | #ifndef _FS_H_ 2 | #define _FS_H_ 3 | 4 | #include 5 | 6 | struct fs_generator; 7 | 8 | const struct fs_generator* fs_get_generator(const std::string& fs_type); 9 | int fs_generator_generate(const struct fs_generator* gen, int tmpFileNo, long long partSize); 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /fingerprintd/Android.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2015 The Android Open Source Project 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | LOCAL_PATH := $(call my-dir) 18 | 19 | include $(CLEAR_VARS) 20 | LOCAL_CFLAGS := -Wall -Wextra -Werror -Wunused 21 | LOCAL_SRC_FILES := \ 22 | FingerprintDaemonProxy.cpp \ 23 | IFingerprintDaemon.cpp \ 24 | IFingerprintDaemonCallback.cpp \ 25 | fingerprintd.cpp 26 | LOCAL_MODULE := fingerprintd 27 | LOCAL_SHARED_LIBRARIES := \ 28 | libbinder \ 29 | liblog \ 30 | libhardware \ 31 | libutils \ 32 | libkeystore_binder 33 | include $(BUILD_EXECUTABLE) 34 | -------------------------------------------------------------------------------- /fs_mgr/fs_mgr_priv_verity.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | #define FS_MGR_SETUP_VERITY_DISABLED (-2) 20 | #define FS_MGR_SETUP_VERITY_FAIL (-1) 21 | #define FS_MGR_SETUP_VERITY_SUCCESS 0 22 | 23 | __BEGIN_DECLS 24 | 25 | int fs_mgr_setup_verity(struct fstab_rec *fstab); 26 | 27 | __END_DECLS 28 | -------------------------------------------------------------------------------- /gatekeeperd/gatekeeperd.rc: -------------------------------------------------------------------------------- 1 | service gatekeeperd /system/bin/gatekeeperd /data/misc/gatekeeper 2 | class late_start 3 | user system 4 | -------------------------------------------------------------------------------- /gatekeeperd/tests/Android.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2015 The Android Open Source Project 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | LOCAL_PATH:= $(call my-dir) 18 | 19 | include $(CLEAR_VARS) 20 | LOCAL_MODULE := gatekeeperd-unit-tests 21 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk 22 | LOCAL_CFLAGS += -g -Wall -Werror -std=gnu++11 -Wno-missing-field-initializers 23 | LOCAL_SHARED_LIBRARIES := libgatekeeper libcrypto libbase 24 | LOCAL_STATIC_LIBRARIES := libscrypt_static 25 | LOCAL_C_INCLUDES := external/scrypt/lib/crypto 26 | LOCAL_SRC_FILES := \ 27 | gatekeeper_test.cpp 28 | include $(BUILD_NATIVE_TEST) 29 | 30 | -------------------------------------------------------------------------------- /healthd/healthd_board_default.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | void healthd_board_init(struct healthd_config*) 20 | { 21 | // use defaults 22 | } 23 | 24 | 25 | int healthd_board_battery_update(struct android::BatteryProperties*) 26 | { 27 | // return 0 to log periodic polled battery status to kernel log 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /healthd/images/battery_fail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tonyho/adbd-linux/7c56fbf46978ec889b6eee4124457dccdeb2b651/healthd/images/battery_fail.png -------------------------------------------------------------------------------- /healthd/images/battery_scale.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tonyho/adbd-linux/7c56fbf46978ec889b6eee4124457dccdeb2b651/healthd/images/battery_scale.png -------------------------------------------------------------------------------- /include.mk: -------------------------------------------------------------------------------- 1 | top_builddir ?= $(top_srcdir) 2 | -include $(top_builddir)/config.mk 3 | 4 | prefix ?= /usr 5 | exec_prefix ?= $(prefix) 6 | bindir ?= $(prefix)/bin 7 | sbindir ?= $(exec_prefix)/sbin 8 | datadir ?= $(prefix)/share 9 | mandir ?= $(datadir)/man 10 | sysconfdir ?= $(prefix)/etc 11 | OPT_CFLAGS ?= -O2 -g 12 | OPT_CXXFLAGS ?= -O2 -g 13 | -------------------------------------------------------------------------------- /include/backtrace/backtrace_constants.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _BACKTRACE_BACKTRACE_CONSTANTS_H 18 | #define _BACKTRACE_BACKTRACE_CONSTANTS_H 19 | 20 | // When the pid to be traced is set to this value, then trace the current 21 | // process. If the tid value is not BACKTRACE_NO_TID, then the specified 22 | // thread from the current process will be traced. 23 | #define BACKTRACE_CURRENT_PROCESS -1 24 | // When the tid to be traced is set to this value, then trace the specified 25 | // current thread of the specified pid. 26 | #define BACKTRACE_CURRENT_THREAD -1 27 | 28 | #define MAX_BACKTRACE_FRAMES 64 29 | 30 | #endif // _BACKTRACE_BACKTRACE_CONSTANTS_H 31 | -------------------------------------------------------------------------------- /include/cutils/android_reboot.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011, The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __CUTILS_ANDROID_REBOOT_H__ 18 | #define __CUTILS_ANDROID_REBOOT_H__ 19 | 20 | #include 21 | 22 | __BEGIN_DECLS 23 | 24 | /* Commands */ 25 | #define ANDROID_RB_RESTART 0xDEAD0001 26 | #define ANDROID_RB_POWEROFF 0xDEAD0002 27 | #define ANDROID_RB_RESTART2 0xDEAD0003 28 | 29 | /* Properties */ 30 | #define ANDROID_RB_PROPERTY "sys.powerctl" 31 | 32 | int android_reboot(int cmd, int flags, const char *arg); 33 | int android_reboot_with_callback( 34 | int cmd, int flags, const char *arg, 35 | void (*cb_on_remount)(const struct mntent*)); 36 | 37 | __END_DECLS 38 | 39 | #endif /* __CUTILS_ANDROID_REBOOT_H__ */ 40 | -------------------------------------------------------------------------------- /include/cutils/ashmem.h: -------------------------------------------------------------------------------- 1 | /* cutils/ashmem.h 2 | ** 3 | ** Copyright 2008 The Android Open Source Project 4 | ** 5 | ** This file is dual licensed. It may be redistributed and/or modified 6 | ** under the terms of the Apache 2.0 License OR version 2 of the GNU 7 | ** General Public License. 8 | */ 9 | 10 | #ifndef _CUTILS_ASHMEM_H 11 | #define _CUTILS_ASHMEM_H 12 | 13 | #include 14 | 15 | #if defined(__BIONIC__) 16 | #include 17 | #endif 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | int ashmem_create_region(const char *name, size_t size); 24 | int ashmem_set_prot_region(int fd, int prot); 25 | int ashmem_pin_region(int fd, size_t offset, size_t len); 26 | int ashmem_unpin_region(int fd, size_t offset, size_t len); 27 | int ashmem_get_size_region(int fd); 28 | 29 | #ifdef __cplusplus 30 | } 31 | #endif 32 | 33 | #endif /* _CUTILS_ASHMEM_H */ 34 | -------------------------------------------------------------------------------- /include/cutils/iosched_policy.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __CUTILS_IOSCHED_POLICY_H 18 | #define __CUTILS_IOSCHED_POLICY_H 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | typedef enum { 25 | IoSchedClass_NONE, 26 | IoSchedClass_RT, 27 | IoSchedClass_BE, 28 | IoSchedClass_IDLE, 29 | } IoSchedClass; 30 | 31 | extern int android_set_ioprio(int pid, IoSchedClass clazz, int ioprio); 32 | extern int android_get_ioprio(int pid, IoSchedClass *clazz, int *ioprio); 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | 38 | #endif /* __CUTILS_IOSCHED_POLICY_H */ 39 | -------------------------------------------------------------------------------- /include/cutils/log.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /include/cutils/multiuser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __CUTILS_MULTIUSER_H 18 | #define __CUTILS_MULTIUSER_H 19 | 20 | #include 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | // NOTE: keep in sync with android.os.UserId 27 | 28 | #define MULTIUSER_APP_PER_USER_RANGE 100000 29 | 30 | typedef uid_t userid_t; 31 | typedef uid_t appid_t; 32 | 33 | extern userid_t multiuser_get_user_id(uid_t uid); 34 | extern appid_t multiuser_get_app_id(uid_t uid); 35 | extern uid_t multiuser_get_uid(userid_t userId, appid_t appId); 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | 41 | #endif /* __CUTILS_MULTIUSER_H */ 42 | -------------------------------------------------------------------------------- /include/cutils/open_memstream.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __CUTILS_OPEN_MEMSTREAM_H__ 18 | #define __CUTILS_OPEN_MEMSTREAM_H__ 19 | 20 | #include 21 | 22 | #if defined(__APPLE__) 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | FILE* open_memstream(char** bufp, size_t* sizep); 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | 34 | #endif /* __APPLE__ */ 35 | 36 | #endif /*__CUTILS_OPEN_MEMSTREAM_H__*/ 37 | -------------------------------------------------------------------------------- /include/cutils/partition_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011, The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __CUTILS_PARTITION_WIPED_H__ 18 | #define __CUTILS_PARTITION_WIPED_H__ 19 | 20 | __BEGIN_DECLS 21 | 22 | int partition_wiped(char *source); 23 | 24 | __END_DECLS 25 | 26 | #endif /* __CUTILS_PARTITION_WIPED_H__ */ 27 | -------------------------------------------------------------------------------- /include/cutils/process_name.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * Gives the current process a name. 19 | */ 20 | 21 | #ifndef __PROCESS_NAME_H 22 | #define __PROCESS_NAME_H 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | /** 29 | * Sets the current process name. 30 | * 31 | * Warning: This leaks a string every time you call it. Use judiciously! 32 | */ 33 | void set_process_name(const char* process_name); 34 | 35 | /** Gets the current process name. */ 36 | const char* get_process_name(void); 37 | 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | 42 | #endif /* __PROCESS_NAME_H */ 43 | -------------------------------------------------------------------------------- /include/cutils/uevent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __CUTILS_UEVENT_H 18 | #define __CUTILS_UEVENT_H 19 | 20 | #include 21 | #include 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | int uevent_open_socket(int buf_sz, bool passcred); 28 | ssize_t uevent_kernel_multicast_recv(int socket, void *buffer, size_t length); 29 | ssize_t uevent_kernel_multicast_uid_recv(int socket, void *buffer, size_t length, uid_t *uid); 30 | ssize_t uevent_kernel_recv(int socket, void *buffer, size_t length, bool require_group, uid_t *uid); 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | 36 | #endif /* __CUTILS_UEVENT_H */ 37 | -------------------------------------------------------------------------------- /include/log/uio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2014 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _LIBS_CUTILS_UIO_H 18 | #define _LIBS_CUTILS_UIO_H 19 | 20 | #if !defined(_WIN32) 21 | 22 | #include 23 | 24 | #else 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | // 31 | // Implementation of sys/uio.h for Win32. 32 | // 33 | 34 | #include 35 | 36 | struct iovec { 37 | void* iov_base; 38 | size_t iov_len; 39 | }; 40 | 41 | extern int readv( int fd, struct iovec* vecs, int count ); 42 | extern int writev( int fd, const struct iovec* vecs, int count ); 43 | 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | #endif 49 | 50 | #endif /* _LIBS_UTILS_UIO_H */ 51 | 52 | -------------------------------------------------------------------------------- /include/private/canned_fs_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _CANNED_FS_CONFIG_H 18 | #define _CANNED_FS_CONFIG_H 19 | 20 | #include 21 | 22 | int load_canned_fs_config(const char* fn); 23 | void canned_fs_config(const char* path, int dir, const char* target_out_path, 24 | unsigned* uid, unsigned* gid, unsigned* mode, uint64_t* capabilities); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /include/sysutils/FrameworkClient.h: -------------------------------------------------------------------------------- 1 | #ifndef _FRAMEWORK_CLIENT_H 2 | #define _FRAMEWORK_CLIENT_H 3 | 4 | #include "List.h" 5 | 6 | #include 7 | 8 | class FrameworkClient { 9 | int mSocket; 10 | pthread_mutex_t mWriteMutex; 11 | 12 | public: 13 | FrameworkClient(int sock); 14 | virtual ~FrameworkClient() {} 15 | 16 | int sendMsg(const char *msg); 17 | int sendMsg(const char *msg, const char *data); 18 | }; 19 | 20 | typedef android::sysutils::List FrameworkClientCollection; 21 | #endif 22 | -------------------------------------------------------------------------------- /include/sysutils/FrameworkCommand.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef __FRAMEWORK_CMD_HANDLER_H 17 | #define __FRAMEWORK_CMD_HANDLER_H 18 | 19 | #include "List.h" 20 | 21 | class SocketClient; 22 | 23 | class FrameworkCommand { 24 | private: 25 | const char *mCommand; 26 | 27 | public: 28 | 29 | FrameworkCommand(const char *cmd); 30 | virtual ~FrameworkCommand() { } 31 | 32 | virtual int runCommand(SocketClient *c, int argc, char **argv) = 0; 33 | 34 | const char *getCommand() { return mCommand; } 35 | }; 36 | 37 | typedef android::sysutils::List FrameworkCommandCollection; 38 | #endif 39 | -------------------------------------------------------------------------------- /include/sysutils/ServiceManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _SERVICE_MANAGER_H 18 | #define _SERVICE_MANAGER_H 19 | 20 | class ServiceManager { 21 | public: 22 | ServiceManager(); 23 | virtual ~ServiceManager() {} 24 | 25 | int start(const char *name); 26 | int stop(const char *name); 27 | bool isRunning(const char *name); 28 | }; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /include/sysutils/SocketClientCommand.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef _SOCKETCLIENTCOMMAND_H 17 | #define _SOCKETCLIENTCOMMAND_H 18 | 19 | #include 20 | 21 | class SocketClientCommand { 22 | public: 23 | virtual ~SocketClientCommand() { } 24 | virtual void runSocketCommand(SocketClient *client) = 0; 25 | }; 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /include/utils/Atomic.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2005 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef ANDROID_UTILS_ATOMIC_H 18 | #define ANDROID_UTILS_ATOMIC_H 19 | 20 | #include 21 | 22 | #endif // ANDROID_UTILS_ATOMIC_H 23 | -------------------------------------------------------------------------------- /include/utils/Endian.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2005 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | // 18 | // Android endian-ness defines. 19 | // 20 | #ifndef _LIBS_UTILS_ENDIAN_H 21 | #define _LIBS_UTILS_ENDIAN_H 22 | 23 | #if defined(__APPLE__) || defined(_WIN32) 24 | 25 | #define __BIG_ENDIAN 0x1000 26 | #define __LITTLE_ENDIAN 0x0001 27 | #define __BYTE_ORDER __LITTLE_ENDIAN 28 | 29 | #else 30 | 31 | #include 32 | 33 | #endif 34 | 35 | #endif /*_LIBS_UTILS_ENDIAN_H*/ 36 | -------------------------------------------------------------------------------- /include/utils/Functor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef ANDROID_FUNCTOR_H 18 | #define ANDROID_FUNCTOR_H 19 | 20 | #include 21 | 22 | namespace android { 23 | 24 | class Functor { 25 | public: 26 | Functor() {} 27 | virtual ~Functor() {} 28 | virtual status_t operator ()(int /*what*/, void* /*data*/) { return NO_ERROR; } 29 | }; 30 | 31 | }; // namespace android 32 | 33 | #endif // ANDROID_FUNCTOR_H 34 | -------------------------------------------------------------------------------- /include/utils/SystemClock.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef ANDROID_UTILS_SYSTEMCLOCK_H 18 | #define ANDROID_UTILS_SYSTEMCLOCK_H 19 | 20 | #include 21 | #include 22 | 23 | namespace android { 24 | 25 | int64_t uptimeMillis(); 26 | int64_t elapsedRealtime(); 27 | int64_t elapsedRealtimeNano(); 28 | 29 | }; // namespace android 30 | 31 | #endif // ANDROID_UTILS_SYSTEMCLOCK_H 32 | 33 | -------------------------------------------------------------------------------- /include/utils/misc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2005 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | // 18 | // Handy utility functions and portability code. 19 | // 20 | #ifndef _LIBS_UTILS_MISC_H 21 | #define _LIBS_UTILS_MISC_H 22 | 23 | #include 24 | 25 | /* get #of elements in a static array */ 26 | #ifndef NELEM 27 | # define NELEM(x) ((int) (sizeof(x) / sizeof((x)[0]))) 28 | #endif 29 | 30 | namespace android { 31 | 32 | typedef void (*sysprop_change_callback)(void); 33 | void add_sysprop_change_callback(sysprop_change_callback cb, int priority); 34 | void report_sysprop_change(); 35 | 36 | }; // namespace android 37 | 38 | #endif // _LIBS_UTILS_MISC_H 39 | -------------------------------------------------------------------------------- /include/utils/threads.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _LIBS_UTILS_THREADS_H 18 | #define _LIBS_UTILS_THREADS_H 19 | 20 | /* 21 | * Please, DO NOT USE! 22 | * 23 | * This file is here only for legacy reasons. Instead, include directly 24 | * the headers you need below. 25 | * 26 | */ 27 | 28 | #include 29 | 30 | #ifdef __cplusplus 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #endif 37 | 38 | #endif // _LIBS_UTILS_THREADS_H 39 | -------------------------------------------------------------------------------- /init/MODULE_LICENSE_APACHE2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tonyho/adbd-linux/7c56fbf46978ec889b6eee4124457dccdeb2b651/init/MODULE_LICENSE_APACHE2 -------------------------------------------------------------------------------- /init/bootchart.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _BOOTCHART_H 18 | #define _BOOTCHART_H 19 | 20 | #include 21 | #include 22 | 23 | int do_bootchart_init(const std::vector& args); 24 | void bootchart_sample(int* timeout); 25 | 26 | #endif /* _BOOTCHART_H */ 27 | -------------------------------------------------------------------------------- /init/builtins.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _INIT_BUILTINS_H 18 | #define _INIT_BUILTINS_H 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #include "keyword_map.h" 25 | 26 | using BuiltinFunction = int (*) (const std::vector& args); 27 | class BuiltinFunctionMap : public KeywordMap { 28 | public: 29 | BuiltinFunctionMap() { 30 | } 31 | private: 32 | Map& map() const override; 33 | }; 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /init/devices.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _INIT_DEVICES_H 18 | #define _INIT_DEVICES_H 19 | 20 | #include 21 | 22 | extern void handle_device_fd(); 23 | extern void device_init(void); 24 | extern int add_dev_perms(const char *name, const char *attr, 25 | mode_t perm, unsigned int uid, 26 | unsigned int gid, unsigned short prefix, 27 | unsigned short wildcard); 28 | int get_device_fd(); 29 | 30 | #endif /* _INIT_DEVICES_H */ 31 | -------------------------------------------------------------------------------- /init/grab-bootchart.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # This script is used to retrieve a bootchart log generated by init. 4 | # All options are passed to adb, for better or for worse. 5 | # See the readme in this directory for more on bootcharting. 6 | 7 | TMPDIR=/tmp/android-bootchart 8 | rm -rf $TMPDIR 9 | mkdir -p $TMPDIR 10 | 11 | LOGROOT=/data/bootchart 12 | TARBALL=bootchart.tgz 13 | 14 | FILES="header proc_stat.log proc_ps.log proc_diskstats.log kernel_pacct" 15 | 16 | for f in $FILES; do 17 | adb "${@}" pull $LOGROOT/$f $TMPDIR/$f 2>&1 > /dev/null 18 | done 19 | (cd $TMPDIR && tar -czf $TARBALL $FILES) 20 | bootchart ${TMPDIR}/${TARBALL} 21 | gnome-open ${TARBALL%.tgz}.png 22 | echo "Clean up ${TMPDIR}/ and ./${TARBALL%.tgz}.png when done" 23 | -------------------------------------------------------------------------------- /init/keychords.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _INIT_KEYCHORDS_H_ 18 | #define _INIT_KEYCHORDS_H_ 19 | 20 | struct service; 21 | 22 | void add_service_keycodes(service*); 23 | void keychord_init(); 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /init/log.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _INIT_LOG_H_ 18 | #define _INIT_LOG_H_ 19 | 20 | #include 21 | 22 | #include 23 | 24 | void InitKernelLogging(char* argv[]); 25 | 26 | int selinux_klog_callback(int level, const char* fmt, ...) __printflike(2, 3); 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /init/parser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef PARSER_H_ 18 | #define PARSER_H_ 19 | 20 | #define T_EOF 0 21 | #define T_TEXT 1 22 | #define T_NEWLINE 2 23 | 24 | struct parse_state 25 | { 26 | char *ptr; 27 | char *text; 28 | int line; 29 | int nexttoken; 30 | void *context; 31 | void (*parse_line)(struct parse_state *state, int nargs, char **args); 32 | const char *filename; 33 | void *priv; 34 | }; 35 | 36 | void dump_parser_state(void); 37 | int next_token(struct parse_state *state); 38 | void parse_error(struct parse_state *state, const char *fmt, ...); 39 | 40 | #endif /* PARSER_H_ */ 41 | -------------------------------------------------------------------------------- /init/property_service.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _INIT_PROPERTY_H 18 | #define _INIT_PROPERTY_H 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | struct property_audit_data { 26 | ucred *cr; 27 | const char* name; 28 | }; 29 | 30 | extern void property_init(void); 31 | extern void property_load_boot_defaults(void); 32 | extern void load_persist_props(void); 33 | extern void load_system_props(void); 34 | extern void start_property_service(void); 35 | std::string property_get(const char* name); 36 | extern int property_set(const char *name, const char *value); 37 | 38 | 39 | #endif /* _INIT_PROPERTY_H */ 40 | -------------------------------------------------------------------------------- /init/signal_handler.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _INIT_SIGNAL_HANDLER_H_ 18 | #define _INIT_SIGNAL_HANDLER_H_ 19 | 20 | void signal_handler_init(void); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /init/ueventd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _INIT_UEVENTD_H_ 18 | #define _INIT_UEVENTD_H_ 19 | 20 | #include 21 | #include 22 | 23 | enum devname_src_t { 24 | DEVNAME_UNKNOWN = 0, 25 | DEVNAME_UEVENT_DEVNAME, 26 | DEVNAME_UEVENT_DEVPATH, 27 | }; 28 | 29 | struct ueventd_subsystem { 30 | struct listnode slist; 31 | 32 | const char *name; 33 | const char *dirname; 34 | devname_src_t devname_src; 35 | }; 36 | 37 | int ueventd_main(int argc, char **argv); 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /init/ueventd_keywords.h: -------------------------------------------------------------------------------- 1 | #ifndef KEYWORD 2 | #define __MAKE_KEYWORD_ENUM__ 3 | #define KEYWORD(symbol, flags, nargs) K_##symbol, 4 | enum { 5 | K_UNKNOWN, 6 | #endif 7 | KEYWORD(subsystem, SECTION, 1) 8 | KEYWORD(devname, OPTION, 1) 9 | KEYWORD(dirname, OPTION, 1) 10 | #ifdef __MAKE_KEYWORD_ENUM__ 11 | KEYWORD_COUNT, 12 | }; 13 | #undef __MAKE_KEYWORD_ENUM__ 14 | #undef KEYWORD 15 | #endif 16 | -------------------------------------------------------------------------------- /init/ueventd_parser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _INIT_UEVENTD_PARSER_H_ 18 | #define _INIT_UEVENTD_PARSER_H_ 19 | 20 | #include "ueventd.h" 21 | 22 | #define UEVENTD_PARSER_MAXARGS 5 23 | 24 | int ueventd_parse_config_file(const char *fn); 25 | void set_device_permission(int nargs, char **args); 26 | struct ueventd_subsystem *ueventd_subsystem_find_by_name(const char *name); 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /init/watchdogd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _INIT_WATCHDOGD_H_ 18 | #define _INIT_WATCHDOGD_H_ 19 | 20 | int watchdogd_main(int argc, char **argv); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /libbacktrace/BacktraceLog.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _LIBBACKTRACE_BACKTRACE_LOG_H 18 | #define _LIBBACKTRACE_BACKTRACE_LOG_H 19 | 20 | #define LOG_TAG "libbacktrace" 21 | 22 | #include 23 | 24 | // Macro to log the function name along with the warning message. 25 | #define BACK_LOGW(format, ...) \ 26 | ALOGW("%s: " format, __PRETTY_FUNCTION__, ##__VA_ARGS__) 27 | 28 | #define BACK_LOGE(format, ...) \ 29 | ALOGE("%s: " format, __PRETTY_FUNCTION__, ##__VA_ARGS__) 30 | 31 | #endif // _LIBBACKTRACE_BACKTRACE_LOG_H 32 | -------------------------------------------------------------------------------- /libbacktrace/BacktracePtrace.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _LIBBACKTRACE_BACKTRACE_PTRACE_H 18 | #define _LIBBACKTRACE_BACKTRACE_PTRACE_H 19 | 20 | #include 21 | #include 22 | 23 | #include 24 | 25 | class BacktraceMap; 26 | 27 | class BacktracePtrace : public Backtrace { 28 | public: 29 | BacktracePtrace(pid_t pid, pid_t tid, BacktraceMap* map) : Backtrace(pid, tid, map) {} 30 | virtual ~BacktracePtrace() {} 31 | 32 | size_t Read(uintptr_t addr, uint8_t* buffer, size_t bytes); 33 | 34 | bool ReadWord(uintptr_t ptr, word_t* out_value); 35 | }; 36 | 37 | #endif // _LIBBACKTRACE_BACKTRACE_PTRACE_H 38 | -------------------------------------------------------------------------------- /libbacktrace/GetPss.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _LIBBACKTRACE_GET_PSS_H 18 | #define _LIBBACKTRACE_GET_PSS_H 19 | 20 | size_t GetPssBytes(); 21 | 22 | #endif // _LIBBACKTRACE_GET_PSS_H 23 | -------------------------------------------------------------------------------- /libbacktrace/thread_utils.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "thread_utils.h" 18 | 19 | #if !defined(__BIONIC__) 20 | 21 | // glibc doesn't implement or export tgkill. 22 | #include 23 | #include 24 | 25 | int tgkill(int tgid, int tid, int sig) { 26 | return syscall(__NR_tgkill, tgid, tid, sig); 27 | } 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /libbacktrace/thread_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _LIBBACKTRACE_THREAD_UTILS_H 18 | #define _LIBBACKTRACE_THREAD_UTILS_H 19 | 20 | #include 21 | 22 | #if !defined(__ANDROID__) 23 | #include 24 | #endif 25 | 26 | __BEGIN_DECLS 27 | 28 | int tgkill(int tgid, int tid, int sig); 29 | 30 | __END_DECLS 31 | 32 | #endif /* _LIBBACKTRACE_THREAD_UTILS_H */ 33 | -------------------------------------------------------------------------------- /libbinderwrapper/binder_test_base.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | #include 20 | #include 21 | 22 | namespace android { 23 | 24 | BinderTestBase::BinderTestBase() : binder_wrapper_(new StubBinderWrapper()) { 25 | // Pass ownership. 26 | BinderWrapper::InitForTesting(binder_wrapper_); 27 | } 28 | 29 | BinderTestBase::~BinderTestBase() { 30 | BinderWrapper::Destroy(); 31 | } 32 | 33 | } // namespace android 34 | -------------------------------------------------------------------------------- /libcrypto_utils/Makefile: -------------------------------------------------------------------------------- 1 | top_srcdir ?= .. 2 | srcdir = $(top_srcdir)/libcrypto_utils 3 | VPATH = $(srcdir) 4 | include $(top_srcdir)/include.mk 5 | 6 | LOCAL_SRC_FILES = android_pubkey.c 7 | LOCAL_MODULE = libcrypto_utils.a 8 | 9 | ################################ 10 | 11 | OBJS = $(LOCAL_SRC_FILES:.c=.o) 12 | CFLAGS = $(OPT_CFLAGS) $(LOCAL_CFLAGS) -I$(top_srcdir)/include/ -I$(srcdir)/include/ -I$(srcdir) -DHAVE_PTHREADS=1 -DADB_NON_ANDROID=1 13 | CFLAGS += -DPROP_NAME_MAX=32 -DPROP_VALUE_MAX=92 14 | 15 | all: $(LOCAL_MODULE) 16 | 17 | %.o: %.c 18 | ${CC} -g -c -fPIC $(CFLAGS) $(LFLAGS) $< -o $@ 19 | #gcc -g -c -fPIC $(CFLAGS) $(LFLAGS) $< -o $@ 20 | 21 | $(LOCAL_MODULE): $(OBJS) 22 | ${AR} rcs $@ $? 23 | ${RANLIB} $@ 24 | #ar rcs $@ $? 25 | #ranlib $@ 26 | 27 | clean: 28 | rm -f $(LOCAL_MODULE) *.o 29 | 30 | -------------------------------------------------------------------------------- /libcrypto_utils/tests/Android.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2016 The Android Open Source Project 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | LOCAL_PATH := $(call my-dir) 18 | 19 | include $(CLEAR_VARS) 20 | LOCAL_MODULE := libcrypto_utils_test 21 | LOCAL_SRC_FILES := android_pubkey_test.cpp 22 | LOCAL_CFLAGS := -Wall -Werror -Wextra -std=c++11 23 | LOCAL_SHARED_LIBRARIES := libcrypto_utils libcrypto-host 24 | include $(BUILD_HOST_NATIVE_TEST) 25 | -------------------------------------------------------------------------------- /libcutils/MODULE_LICENSE_APACHE2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tonyho/adbd-linux/7c56fbf46978ec889b6eee4124457dccdeb2b651/libcutils/MODULE_LICENSE_APACHE2 -------------------------------------------------------------------------------- /libcutils/arch-x86/cache.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #if defined(__slm__) 18 | /* Values are optimized for Silvermont */ 19 | #define SHARED_CACHE_SIZE (1024*1024) /* Silvermont L2 Cache */ 20 | #define DATA_CACHE_SIZE (24*1024) /* Silvermont L1 Data Cache */ 21 | #else 22 | /* Values are optimized for Atom */ 23 | #define SHARED_CACHE_SIZE (512*1024) /* Atom L2 Cache */ 24 | #define DATA_CACHE_SIZE (24*1024) /* Atom L1 Data Cache */ 25 | #endif 26 | 27 | #define SHARED_CACHE_SIZE_HALF (SHARED_CACHE_SIZE / 2) 28 | #define DATA_CACHE_SIZE_HALF (DATA_CACHE_SIZE / 2) 29 | -------------------------------------------------------------------------------- /libcutils/arch-x86_64/cache.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* Values are optimized for Silvermont */ 18 | #define SHARED_CACHE_SIZE (1024*1024) /* Silvermont L2 Cache */ 19 | #define DATA_CACHE_SIZE (24*1024) /* Silvermont L1 Data Cache */ 20 | 21 | #define SHARED_CACHE_SIZE_HALF (SHARED_CACHE_SIZE / 2) 22 | #define DATA_CACHE_SIZE_HALF (DATA_CACHE_SIZE / 2) 23 | -------------------------------------------------------------------------------- /libcutils/dlmalloc_stubs.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "log/log.h" 18 | 19 | #define UNUSED __attribute__((__unused__)) 20 | 21 | /* 22 | * Stubs for functions defined in bionic/libc/bionic/dlmalloc.c. These 23 | * are used in host builds, as the host libc will not contain these 24 | * functions. 25 | */ 26 | void dlmalloc_inspect_all(void(*handler)(void*, void *, size_t, void*) UNUSED, 27 | void* arg UNUSED) 28 | { 29 | ALOGW("Called host unimplemented stub: dlmalloc_inspect_all"); 30 | } 31 | 32 | int dlmalloc_trim(size_t unused UNUSED) 33 | { 34 | ALOGW("Called host unimplemented stub: dlmalloc_trim"); 35 | return 0; 36 | } 37 | -------------------------------------------------------------------------------- /libcutils/multiuser.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | userid_t multiuser_get_user_id(uid_t uid) { 20 | return uid / MULTIUSER_APP_PER_USER_RANGE; 21 | } 22 | 23 | appid_t multiuser_get_app_id(uid_t uid) { 24 | return uid % MULTIUSER_APP_PER_USER_RANGE; 25 | } 26 | 27 | uid_t multiuser_get_uid(userid_t userId, appid_t appId) { 28 | return userId * MULTIUSER_APP_PER_USER_RANGE + (appId % MULTIUSER_APP_PER_USER_RANGE); 29 | } 30 | -------------------------------------------------------------------------------- /libdiskconfig/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | include $(CLEAR_VARS) 3 | 4 | commonSources := \ 5 | diskconfig.c \ 6 | diskutils.c \ 7 | write_lst.c \ 8 | config_mbr.c 9 | 10 | include $(CLEAR_VARS) 11 | LOCAL_SRC_FILES := $(commonSources) 12 | LOCAL_MODULE := libdiskconfig 13 | LOCAL_MODULE_TAGS := optional 14 | LOCAL_SYSTEM_SHARED_LIBRARIES := libcutils liblog libc 15 | LOCAL_CFLAGS := -Werror 16 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include 17 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/include 18 | include $(BUILD_SHARED_LIBRARY) 19 | 20 | ifeq ($(HOST_OS),linux) 21 | include $(CLEAR_VARS) 22 | LOCAL_SRC_FILES := $(commonSources) 23 | LOCAL_MODULE := libdiskconfig_host 24 | LOCAL_MODULE_TAGS := optional 25 | LOCAL_CFLAGS := -O2 -g -W -Wall -Werror -D_LARGEFILE64_SOURCE 26 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include 27 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/include 28 | include $(BUILD_HOST_STATIC_LIBRARY) 29 | endif # HOST_OS == linux 30 | -------------------------------------------------------------------------------- /libdiskconfig/dump_diskconfig.c: -------------------------------------------------------------------------------- 1 | /* libs/diskconfig/dump_diskconfig.c 2 | * 3 | * Copyright 2008, The Android Open Source Project 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #define LOG_TAG "dump_diskconfig" 19 | #include 20 | 21 | #include 22 | 23 | #include "diskconfig.h" 24 | 25 | int 26 | main(int argc, char *argv[]) 27 | { 28 | struct disk_info *dinfo; 29 | 30 | if (argc < 2) { 31 | ALOGE("usage: %s ", argv[0]); 32 | return 1; 33 | } 34 | 35 | if (!(dinfo = load_diskconfig(argv[1], NULL))) 36 | return 1; 37 | 38 | dump_disk_config(dinfo); 39 | 40 | return 0; 41 | } 42 | 43 | -------------------------------------------------------------------------------- /libion/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | LOCAL_SRC_FILES := ion.c 5 | LOCAL_MODULE := libion 6 | LOCAL_MODULE_TAGS := optional 7 | LOCAL_SHARED_LIBRARIES := liblog 8 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/include $(LOCAL_PATH)/kernel-headers 9 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include $(LOCAL_PATH)/kernel-headers 10 | LOCAL_CFLAGS := -Werror 11 | include $(BUILD_SHARED_LIBRARY) 12 | 13 | include $(CLEAR_VARS) 14 | LOCAL_SRC_FILES := ion.c ion_test.c 15 | LOCAL_MODULE := iontest 16 | LOCAL_MODULE_TAGS := optional tests 17 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/include $(LOCAL_PATH)/kernel-headers 18 | LOCAL_SHARED_LIBRARIES := liblog 19 | LOCAL_CFLAGS := -Werror 20 | include $(BUILD_EXECUTABLE) 21 | 22 | include $(call first-makefiles-under,$(LOCAL_PATH)) 23 | -------------------------------------------------------------------------------- /libion/tests/Android.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2013 The Android Open Source Project 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | LOCAL_PATH:= $(call my-dir) 18 | 19 | include $(CLEAR_VARS) 20 | LOCAL_CLANG := true 21 | LOCAL_MODULE := ion-unit-tests 22 | LOCAL_CFLAGS += -g -Wall -Werror -Wno-missing-field-initializers 23 | LOCAL_SHARED_LIBRARIES += libion 24 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/../kernel-headers 25 | LOCAL_SRC_FILES := \ 26 | ion_test_fixture.cpp \ 27 | allocate_test.cpp \ 28 | formerly_valid_handle_test.cpp \ 29 | invalid_values_test.cpp \ 30 | map_test.cpp \ 31 | device_test.cpp \ 32 | exit_test.cpp 33 | include $(BUILD_NATIVE_TEST) 34 | -------------------------------------------------------------------------------- /liblog/Android.soong.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(my-dir) 2 | 3 | include $(call first-makefiles-under,$(LOCAL_PATH)) 4 | -------------------------------------------------------------------------------- /liblog/fake_log_device.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _LIBLOG_FAKE_LOG_DEVICE_H 18 | #define _LIBLOG_FAKE_LOG_DEVICE_H 19 | 20 | #include 21 | 22 | #include "log_portability.h" 23 | 24 | struct iovec; 25 | 26 | LIBLOG_HIDDEN int fakeLogOpen(const char *pathName, int flags); 27 | LIBLOG_HIDDEN int fakeLogClose(int fd); 28 | LIBLOG_HIDDEN ssize_t fakeLogWritev(int fd, 29 | const struct iovec* vector, int count); 30 | 31 | #endif // _LIBLOG_FAKE_LOG_DEVICE_H 32 | -------------------------------------------------------------------------------- /liblog/tests/libc_test.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | #include 20 | 21 | TEST(libc, __pstore_append) { 22 | FILE *fp; 23 | ASSERT_TRUE(NULL != (fp = fopen("/dev/pmsg0", "a"))); 24 | static const char message[] = "libc.__pstore_append\n"; 25 | ASSERT_EQ((size_t)1, fwrite(message, sizeof(message), 1, fp)); 26 | ASSERT_EQ(0, fclose(fp)); 27 | fprintf(stderr, "Reboot, ensure string libc.__pstore_append is in /sys/fs/pstore/pmsg-ramoops-0\n"); 28 | } 29 | -------------------------------------------------------------------------------- /libmemtrack/Android.mk: -------------------------------------------------------------------------------- 1 | # Copyright 2013 The Android Open Source Project 2 | 3 | LOCAL_PATH:= $(call my-dir) 4 | 5 | include $(CLEAR_VARS) 6 | LOCAL_SRC_FILES := memtrack.c 7 | LOCAL_MODULE := libmemtrack 8 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include 9 | LOCAL_C_INCLUDES += $(LOCAL_PATH)/include 10 | LOCAL_C_INCLUDES += hardware/libhardware/include 11 | LOCAL_SHARED_LIBRARIES := libhardware liblog 12 | LOCAL_CFLAGS := -Wall -Werror 13 | include $(BUILD_SHARED_LIBRARY) 14 | 15 | include $(CLEAR_VARS) 16 | LOCAL_SRC_FILES := memtrack_test.c 17 | LOCAL_MODULE := memtrack_test 18 | LOCAL_SHARED_LIBRARIES := libmemtrack libpagemap 19 | LOCAL_CFLAGS := -Wall -Werror 20 | include $(BUILD_EXECUTABLE) 21 | -------------------------------------------------------------------------------- /libmemunreachable/LineBuffer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _LIBMEMUNREACHABLE_LINE_BUFFER_H 18 | #define _LIBMEMUNREACHABLE_LINE_BUFFER_H 19 | 20 | #include 21 | 22 | class LineBuffer { 23 | public: 24 | LineBuffer(int fd, char* buffer, size_t buffer_len); 25 | 26 | bool GetLine(char** line, size_t* line_len); 27 | 28 | private: 29 | int fd_; 30 | char* buffer_ = nullptr; 31 | size_t buffer_len_ = 0; 32 | size_t start_ = 0; 33 | size_t bytes_ = 0; 34 | }; 35 | 36 | #endif // _LIBMEMUNREACHABLE_LINE_BUFFER_H 37 | -------------------------------------------------------------------------------- /libmemunreachable/ProcessMappings.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef LIBMEMUNREACHABLE_PROCESS_MAPPING_H_ 18 | #define LIBMEMUNREACHABLE_PROCESS_MAPPING_H_ 19 | 20 | #include "Allocator.h" 21 | 22 | struct Mapping { 23 | uintptr_t begin; 24 | uintptr_t end; 25 | bool read; 26 | bool write; 27 | bool execute; 28 | bool priv; 29 | char name[96]; 30 | }; 31 | 32 | // This function is not re-entrant since it uses a static buffer for 33 | // the line data. 34 | bool ProcessMappings(pid_t pid, allocator::vector& mappings); 35 | 36 | #endif // LIBMEMUNREACHABLE_PROCESS_MAPPING_H_ 37 | -------------------------------------------------------------------------------- /libmemunreachable/anon_vma_naming.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef LIBMEMUNREACHABLE_ANON_VMA_NAMING_H_ 18 | #define LIBMEMUNREACHABLE_ANON_VMA_NAMING_H_ 19 | 20 | #include 21 | 22 | #define PR_SET_VMA 0x53564d41 23 | #define PR_SET_VMA_ANON_NAME 0 24 | 25 | #endif // LIBMEMUNREACHABLE_ANON_VMA_NAMING_H_ 26 | -------------------------------------------------------------------------------- /libmemunreachable/bionic.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef LIBMEMUNREACHABLE_BIONIC_H_ 18 | #define LIBMEMUNREACHABLE_BIONIC_H_ 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | __BEGIN_DECLS 25 | 26 | /* Exported from bionic */ 27 | extern void malloc_disable(); 28 | extern void malloc_enable(); 29 | extern int malloc_iterate(uintptr_t base, size_t size, 30 | void (*callback)(uintptr_t base, size_t size, void* arg), void* arg); 31 | extern ssize_t malloc_backtrace(void* pointer, uintptr_t* frames, size_t frame_count); 32 | 33 | __END_DECLS 34 | 35 | #endif // LIBMEMUNREACHABLE_BIONIC_H_ 36 | -------------------------------------------------------------------------------- /libmemunreachable/log.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef LIBMEMUNREACHABLE_LOG_H_ 18 | #define LIBMEMUNREACHABLE_LOG_H_ 19 | 20 | #define LOG_TAG "libmemunreachable" 21 | 22 | #include 23 | 24 | #endif // LIBMEMUNREACHABLE_LOG_H_ 25 | -------------------------------------------------------------------------------- /libmemunreachable/tests/HostMallocStub.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "bionic.h" 18 | 19 | void malloc_disable() { 20 | } 21 | 22 | void malloc_enable() { 23 | } 24 | -------------------------------------------------------------------------------- /libnativebridge/tests/NativeBridgeTest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef NATIVE_BRIDGE_TEST_H_ 18 | #define NATIVE_BRIDGE_TEST_H_ 19 | 20 | #define LOG_TAG "NativeBridge_test" 21 | 22 | #include 23 | #include 24 | 25 | constexpr const char* kNativeBridgeLibrary = "libnativebridge-dummy.so"; 26 | constexpr const char* kCodeCache = "./code_cache"; 27 | constexpr const char* kCodeCacheStatFail = "./code_cache/temp"; 28 | 29 | namespace android { 30 | 31 | class NativeBridgeTest : public testing::Test { 32 | }; 33 | 34 | }; // namespace android 35 | 36 | #endif // NATIVE_BRIDGE_H_ 37 | 38 | -------------------------------------------------------------------------------- /libnativebridge/tests/NativeBridgeVersion_test.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "NativeBridgeTest.h" 18 | 19 | #include 20 | 21 | namespace android { 22 | 23 | TEST_F(NativeBridgeTest, Version) { 24 | // When a bridge isn't loaded, we expect 0. 25 | EXPECT_EQ(NativeBridgeGetVersion(), 0U); 26 | 27 | // After our dummy bridge has been loaded, we expect 1. 28 | ASSERT_TRUE(LoadNativeBridge(kNativeBridgeLibrary, nullptr)); 29 | EXPECT_EQ(NativeBridgeGetVersion(), 1U); 30 | 31 | // Unload 32 | UnloadNativeBridge(); 33 | 34 | // Version information is gone. 35 | EXPECT_EQ(NativeBridgeGetVersion(), 0U); 36 | } 37 | 38 | } // namespace android 39 | -------------------------------------------------------------------------------- /libnativebridge/tests/PreInitializeNativeBridgeFail2_test.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "NativeBridgeTest.h" 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | namespace android { 30 | 31 | TEST_F(NativeBridgeTest, PreInitializeNativeBridgeFail2) { 32 | // Needs LoadNativeBridge() first 33 | ASSERT_FALSE(PreInitializeNativeBridge(nullptr, "isa")); 34 | ASSERT_TRUE(NativeBridgeError()); 35 | } 36 | 37 | } // namespace android 38 | -------------------------------------------------------------------------------- /libnativebridge/tests/ReSetupNativeBridge_test.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "NativeBridgeTest.h" 18 | 19 | namespace android { 20 | 21 | TEST_F(NativeBridgeTest, ReSetup) { 22 | EXPECT_EQ(false, NativeBridgeError()); 23 | LoadNativeBridge("", nullptr); 24 | EXPECT_EQ(false, NativeBridgeError()); 25 | LoadNativeBridge("", nullptr); 26 | // This should lead to an error for trying to re-setup a native bridge. 27 | EXPECT_EQ(true, NativeBridgeError()); 28 | } 29 | 30 | } // namespace android 31 | -------------------------------------------------------------------------------- /libnativebridge/tests/UnavailableNativeBridge_test.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "NativeBridgeTest.h" 18 | 19 | namespace android { 20 | 21 | TEST_F(NativeBridgeTest, NoNativeBridge) { 22 | EXPECT_EQ(false, NativeBridgeAvailable()); 23 | // Try to initialize. This should fail as we are not set up. 24 | EXPECT_EQ(false, InitializeNativeBridge(nullptr, nullptr)); 25 | EXPECT_EQ(true, NativeBridgeError()); 26 | EXPECT_EQ(false, NativeBridgeAvailable()); 27 | } 28 | 29 | } // namespace android 30 | -------------------------------------------------------------------------------- /libnetutils/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | include $(CLEAR_VARS) 3 | 4 | LOCAL_SRC_FILES := \ 5 | dhcpclient.c \ 6 | dhcpmsg.c \ 7 | dhcp_utils.c \ 8 | ifc_utils.c \ 9 | packet.c 10 | 11 | LOCAL_SHARED_LIBRARIES := \ 12 | libcutils \ 13 | liblog 14 | 15 | LOCAL_MODULE := libnetutils 16 | 17 | LOCAL_CFLAGS := -Werror 18 | 19 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include 20 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/include 21 | 22 | include $(BUILD_SHARED_LIBRARY) 23 | 24 | include $(CLEAR_VARS) 25 | LOCAL_SRC_FILES := dhcptool.c 26 | LOCAL_SHARED_LIBRARIES := libnetutils 27 | LOCAL_MODULE := dhcptool 28 | LOCAL_MODULE_TAGS := debug 29 | include $(BUILD_EXECUTABLE) 30 | -------------------------------------------------------------------------------- /libnetutils/packet.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2008, The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _WIFI_PACKET_H_ 18 | #define _WIFI_PACKET_H_ 19 | 20 | int open_raw_socket(const char *ifname, uint8_t *hwaddr, int if_index); 21 | int send_packet(int s, int if_index, struct dhcp_msg *msg, int size, 22 | uint32_t saddr, uint32_t daddr, uint32_t sport, uint32_t dport); 23 | int receive_packet(int s, struct dhcp_msg *msg); 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /libpackagelistparser/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH:= $(call my-dir) 2 | 3 | ######################### 4 | include $(CLEAR_VARS) 5 | 6 | LOCAL_MODULE := libpackagelistparser 7 | LOCAL_MODULE_TAGS := optional 8 | LOCAL_SRC_FILES := packagelistparser.c 9 | LOCAL_SHARED_LIBRARIES := liblog 10 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/include 11 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include 12 | 13 | LOCAL_CLANG := true 14 | LOCAL_SANITIZE := integer 15 | 16 | include $(BUILD_SHARED_LIBRARY) 17 | 18 | ######################### 19 | include $(CLEAR_VARS) 20 | 21 | 22 | LOCAL_MODULE := libpackagelistparser 23 | LOCAL_MODULE_TAGS := optional 24 | LOCAL_SRC_FILES := packagelistparser.c 25 | LOCAL_STATIC_LIBRARIES := liblog 26 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/include 27 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include 28 | 29 | LOCAL_CLANG := true 30 | LOCAL_SANITIZE := integer 31 | 32 | include $(BUILD_STATIC_LIBRARY) 33 | -------------------------------------------------------------------------------- /libpixelflinger/MODULE_LICENSE_APACHE2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tonyho/adbd-linux/7c56fbf46978ec889b6eee4124457dccdeb2b651/libpixelflinger/MODULE_LICENSE_APACHE2 -------------------------------------------------------------------------------- /libpixelflinger/clear.h: -------------------------------------------------------------------------------- 1 | /* libs/pixelflinger/clear.h 2 | ** 3 | ** Copyright 2006, The Android Open Source Project 4 | ** 5 | ** Licensed under the Apache License, Version 2.0 (the "License"); 6 | ** you may not use this file except in compliance with the License. 7 | ** You may obtain a copy of the License at 8 | ** 9 | ** http://www.apache.org/licenses/LICENSE-2.0 10 | ** 11 | ** Unless required by applicable law or agreed to in writing, software 12 | ** distributed under the License is distributed on an "AS IS" BASIS, 13 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | ** See the License for the specific language governing permissions and 15 | ** limitations under the License. 16 | */ 17 | 18 | #ifndef ANDROID_GGL_CLEAR_H 19 | #define ANDROID_GGL_CLEAR_H 20 | 21 | #include 22 | #include 23 | 24 | namespace android { 25 | 26 | void ggl_init_clear(context_t* c); 27 | 28 | }; // namespace android 29 | 30 | #endif // ANDROID_GGL_CLEAR_H 31 | -------------------------------------------------------------------------------- /libpixelflinger/picker.h: -------------------------------------------------------------------------------- 1 | /* libs/pixelflinger/picker.h 2 | ** 3 | ** Copyright 2006, The Android Open Source Project 4 | ** 5 | ** Licensed under the Apache License, Version 2.0 (the "License"); 6 | ** you may not use this file except in compliance with the License. 7 | ** You may obtain a copy of the License at 8 | ** 9 | ** http://www.apache.org/licenses/LICENSE-2.0 10 | ** 11 | ** Unless required by applicable law or agreed to in writing, software 12 | ** distributed under the License is distributed on an "AS IS" BASIS, 13 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | ** See the License for the specific language governing permissions and 15 | ** limitations under the License. 16 | */ 17 | 18 | 19 | #ifndef ANDROID_PICKER_H 20 | #define ANDROID_PICKER_H 21 | 22 | #include 23 | 24 | namespace android { 25 | 26 | void ggl_init_picker(context_t* c); 27 | void ggl_pick(context_t* c); 28 | 29 | }; // namespace android 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /libpixelflinger/raster.h: -------------------------------------------------------------------------------- 1 | /* libs/pixelflinger/raster.h 2 | ** 3 | ** Copyright 2006, The Android Open Source Project 4 | ** 5 | ** Licensed under the Apache License, Version 2.0 (the "License"); 6 | ** you may not use this file except in compliance with the License. 7 | ** You may obtain a copy of the License at 8 | ** 9 | ** http://www.apache.org/licenses/LICENSE-2.0 10 | ** 11 | ** Unless required by applicable law or agreed to in writing, software 12 | ** distributed under the License is distributed on an "AS IS" BASIS, 13 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | ** See the License for the specific language governing permissions and 15 | ** limitations under the License. 16 | */ 17 | 18 | 19 | #ifndef ANDROID_GGL_RASTER_H 20 | #define ANDROID_GGL_RASTER_H 21 | 22 | #include 23 | 24 | namespace android { 25 | 26 | void ggl_init_raster(context_t* c); 27 | 28 | void gglCopyPixels(void* c, GGLint x, GGLint y, GGLsizei width, GGLsizei height, GGLenum type); 29 | void gglRasterPos2d(void* c, GGLint x, GGLint y); 30 | 31 | }; // namespace android 32 | 33 | #endif // ANDROID_GGL_RASTER_H 34 | -------------------------------------------------------------------------------- /libpixelflinger/scanline.h: -------------------------------------------------------------------------------- 1 | /* libs/pixelflinger/scanline.h 2 | ** 3 | ** Copyright 2006, The Android Open Source Project 4 | ** 5 | ** Licensed under the Apache License, Version 2.0 (the "License"); 6 | ** you may not use this file except in compliance with the License. 7 | ** You may obtain a copy of the License at 8 | ** 9 | ** http://www.apache.org/licenses/LICENSE-2.0 10 | ** 11 | ** Unless required by applicable law or agreed to in writing, software 12 | ** distributed under the License is distributed on an "AS IS" BASIS, 13 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | ** See the License for the specific language governing permissions and 15 | ** limitations under the License. 16 | */ 17 | 18 | 19 | #ifndef ANDROID_SCANLINE_H 20 | #define ANDROID_SCANLINE_H 21 | 22 | #include 23 | 24 | namespace android { 25 | 26 | void ggl_init_scanline(context_t* c); 27 | void ggl_uninit_scanline(context_t* c); 28 | void ggl_pick_scanline(context_t* c); 29 | 30 | }; // namespace android 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /libpixelflinger/tests/Android.mk: -------------------------------------------------------------------------------- 1 | include $(all-subdir-makefiles) 2 | -------------------------------------------------------------------------------- /libpixelflinger/tests/arch-arm64/Android.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(TARGET_ARCH),arm64) 2 | include $(all-subdir-makefiles) 3 | endif 4 | -------------------------------------------------------------------------------- /libpixelflinger/tests/arch-arm64/assembler/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH:= $(call my-dir) 2 | include $(CLEAR_VARS) 3 | 4 | LOCAL_SRC_FILES:= \ 5 | arm64_assembler_test.cpp\ 6 | asm_test_jacket.S 7 | 8 | LOCAL_SHARED_LIBRARIES := \ 9 | libcutils \ 10 | libpixelflinger 11 | 12 | LOCAL_C_INCLUDES := \ 13 | $(LOCAL_PATH)/../../.. 14 | 15 | LOCAL_MODULE:= test-pixelflinger-arm64-assembler-test 16 | 17 | LOCAL_MODULE_TAGS := tests 18 | 19 | LOCAL_MULTILIB := 64 20 | 21 | include $(BUILD_NATIVE_TEST) 22 | -------------------------------------------------------------------------------- /libpixelflinger/tests/arch-arm64/col32cb16blend/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH:= $(call my-dir) 2 | include $(CLEAR_VARS) 3 | 4 | LOCAL_SRC_FILES:= \ 5 | col32cb16blend_test.c \ 6 | ../../../arch-arm64/col32cb16blend.S 7 | 8 | LOCAL_SHARED_LIBRARIES := 9 | 10 | LOCAL_C_INCLUDES := 11 | 12 | LOCAL_MODULE:= test-pixelflinger-arm64-col32cb16blend 13 | 14 | LOCAL_MODULE_TAGS := tests 15 | 16 | LOCAL_MULTILIB := 64 17 | 18 | include $(BUILD_NATIVE_TEST) 19 | -------------------------------------------------------------------------------- /libpixelflinger/tests/arch-arm64/disassembler/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH:= $(call my-dir) 2 | include $(CLEAR_VARS) 3 | 4 | LOCAL_SRC_FILES:= \ 5 | arm64_diassembler_test.cpp \ 6 | ../../../codeflinger/Arm64Disassembler.cpp 7 | 8 | LOCAL_SHARED_LIBRARIES := 9 | 10 | LOCAL_MODULE:= test-pixelflinger-arm64-disassembler-test 11 | 12 | LOCAL_MODULE_TAGS := tests 13 | 14 | LOCAL_MULTILIB := 64 15 | 16 | include $(BUILD_NATIVE_TEST) 17 | -------------------------------------------------------------------------------- /libpixelflinger/tests/arch-arm64/t32cb16blend/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH:= $(call my-dir) 2 | include $(CLEAR_VARS) 3 | 4 | LOCAL_SRC_FILES:= \ 5 | t32cb16blend_test.c \ 6 | ../../../arch-arm64/t32cb16blend.S 7 | 8 | LOCAL_SHARED_LIBRARIES := 9 | 10 | LOCAL_C_INCLUDES := 11 | 12 | LOCAL_MODULE:= test-pixelflinger-arm64-t32cb16blend 13 | 14 | LOCAL_MODULE_TAGS := tests 15 | 16 | LOCAL_MULTILIB := 64 17 | 18 | include $(BUILD_NATIVE_TEST) 19 | -------------------------------------------------------------------------------- /libpixelflinger/tests/arch-mips/Android.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(TARGET_ARCH),mips) 2 | include $(all-subdir-makefiles) 3 | endif 4 | ifeq ($(TARGET_ARCH),mipsel) 5 | include $(all-subdir-makefiles) 6 | endif 7 | -------------------------------------------------------------------------------- /libpixelflinger/tests/arch-mips/col32cb16blend/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH:= $(call my-dir) 2 | include $(CLEAR_VARS) 3 | 4 | LOCAL_SRC_FILES:= \ 5 | col32cb16blend_test.c \ 6 | ../../../arch-mips/col32cb16blend.S 7 | 8 | LOCAL_SHARED_LIBRARIES := 9 | 10 | LOCAL_C_INCLUDES := 11 | 12 | LOCAL_MODULE:= test-pixelflinger-mips-col32cb16blend 13 | 14 | LOCAL_MODULE_TAGS := tests 15 | 16 | LOCAL_MULTILIB := 32 17 | 18 | include $(BUILD_NATIVE_TEST) 19 | -------------------------------------------------------------------------------- /libpixelflinger/tests/arch-mips/t32cb16blend/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH:= $(call my-dir) 2 | include $(CLEAR_VARS) 3 | 4 | LOCAL_SRC_FILES:= \ 5 | t32cb16blend_test.c \ 6 | ../../../arch-mips/t32cb16blend.S 7 | 8 | LOCAL_SHARED_LIBRARIES := 9 | 10 | LOCAL_C_INCLUDES := 11 | 12 | LOCAL_MODULE:= test-pixelflinger-mips-t32cb16blend 13 | 14 | LOCAL_MODULE_TAGS := tests 15 | 16 | LOCAL_MULTILIB := 32 17 | 18 | include $(BUILD_NATIVE_TEST) 19 | -------------------------------------------------------------------------------- /libpixelflinger/tests/arch-mips64/Android.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(TARGET_ARCH),mips64) 2 | include $(all-subdir-makefiles) 3 | endif 4 | -------------------------------------------------------------------------------- /libpixelflinger/tests/arch-mips64/assembler/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH:= $(call my-dir) 2 | include $(CLEAR_VARS) 3 | 4 | LOCAL_SRC_FILES:= \ 5 | mips64_assembler_test.cpp\ 6 | asm_mips_test_jacket.S 7 | 8 | LOCAL_SHARED_LIBRARIES := \ 9 | libcutils \ 10 | libpixelflinger 11 | 12 | LOCAL_C_INCLUDES := \ 13 | $(LOCAL_PATH)/../../.. 14 | 15 | LOCAL_MODULE:= test-pixelflinger-mips64-assembler-test 16 | 17 | LOCAL_MODULE_TAGS := tests 18 | 19 | LOCAL_MULTILIB := 64 20 | 21 | include $(BUILD_NATIVE_TEST) 22 | -------------------------------------------------------------------------------- /libpixelflinger/tests/arch-mips64/col32cb16blend/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH:= $(call my-dir) 2 | include $(CLEAR_VARS) 3 | 4 | LOCAL_SRC_FILES:= \ 5 | col32cb16blend_test.c \ 6 | ../../../arch-mips64/col32cb16blend.S 7 | 8 | LOCAL_SHARED_LIBRARIES := 9 | 10 | LOCAL_C_INCLUDES := 11 | 12 | LOCAL_MODULE:= test-pixelflinger-mips64-col32cb16blend 13 | 14 | LOCAL_MODULE_TAGS := tests 15 | 16 | LOCAL_MULTILIB := 64 17 | 18 | include $(BUILD_NATIVE_TEST) 19 | -------------------------------------------------------------------------------- /libpixelflinger/tests/arch-mips64/disassembler/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH:= $(call my-dir) 2 | include $(CLEAR_VARS) 3 | 4 | LOCAL_SRC_FILES:= \ 5 | mips64_disassembler_test.cpp \ 6 | ../../../codeflinger/mips64_disassem.c 7 | 8 | LOCAL_SHARED_LIBRARIES := 9 | 10 | LOCAL_MODULE:= test-pixelflinger-mips64-disassembler-test 11 | 12 | LOCAL_MODULE_TAGS := tests 13 | 14 | LOCAL_MULTILIB := 64 15 | 16 | include $(BUILD_NATIVE_TEST) 17 | -------------------------------------------------------------------------------- /libpixelflinger/tests/codegen/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH:= $(call my-dir) 2 | include $(CLEAR_VARS) 3 | 4 | LOCAL_SRC_FILES:= \ 5 | codegen.cpp.arm 6 | 7 | LOCAL_SHARED_LIBRARIES := \ 8 | libcutils \ 9 | libpixelflinger 10 | 11 | LOCAL_C_INCLUDES := \ 12 | $(LOCAL_PATH)/../.. 13 | 14 | LOCAL_MODULE:= test-opengl-codegen 15 | 16 | LOCAL_MODULE_TAGS := tests 17 | 18 | include $(BUILD_NATIVE_TEST) 19 | -------------------------------------------------------------------------------- /libpixelflinger/tests/gglmul/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH:= $(call my-dir) 2 | include $(CLEAR_VARS) 3 | 4 | LOCAL_SRC_FILES:= \ 5 | gglmul_test.cpp 6 | 7 | LOCAL_SHARED_LIBRARIES := 8 | 9 | LOCAL_C_INCLUDES := \ 10 | $(LOCAL_PATH)/../../include 11 | 12 | LOCAL_MODULE:= test-pixelflinger-gglmul 13 | 14 | LOCAL_MODULE_TAGS := tests 15 | 16 | include $(BUILD_NATIVE_TEST) 17 | -------------------------------------------------------------------------------- /libpixelflinger/trap.h: -------------------------------------------------------------------------------- 1 | /* libs/pixelflinger/trap.h 2 | ** 3 | ** Copyright 2006, The Android Open Source Project 4 | ** 5 | ** Licensed under the Apache License, Version 2.0 (the "License"); 6 | ** you may not use this file except in compliance with the License. 7 | ** You may obtain a copy of the License at 8 | ** 9 | ** http://www.apache.org/licenses/LICENSE-2.0 10 | ** 11 | ** Unless required by applicable law or agreed to in writing, software 12 | ** distributed under the License is distributed on an "AS IS" BASIS, 13 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | ** See the License for the specific language governing permissions and 15 | ** limitations under the License. 16 | */ 17 | 18 | 19 | #ifndef ANDROID_TRAP_H 20 | #define ANDROID_TRAP_H 21 | 22 | #include 23 | 24 | namespace android { 25 | 26 | void ggl_init_trap(context_t* c); 27 | void ggl_state_changed(context_t* c, int flags); 28 | 29 | }; // namespace android 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /libprocessgroup/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | LOCAL_SRC_FILES := processgroup.cpp 5 | LOCAL_MODULE := libprocessgroup 6 | LOCAL_STATIC_LIBRARIES := liblog 7 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/include 8 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include 9 | LOCAL_CFLAGS := -Wall -Werror 10 | include $(BUILD_STATIC_LIBRARY) 11 | 12 | include $(CLEAR_VARS) 13 | LOCAL_SRC_FILES := processgroup.cpp 14 | LOCAL_MODULE := libprocessgroup 15 | LOCAL_SHARED_LIBRARIES := liblog 16 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/include 17 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include 18 | LOCAL_CFLAGS := -Wall -Werror 19 | LOCAL_REQUIRED_MODULE := processgroup_cleanup 20 | include $(BUILD_SHARED_LIBRARY) 21 | 22 | include $(CLEAR_VARS) 23 | LOCAL_SRC_FILES := cleanup.cpp 24 | LOCAL_MODULE := processgroup_cleanup 25 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/include 26 | LOCAL_CFLAGS := -Wall -Werror 27 | LOCAL_FORCE_STATIC_EXECUTABLE := true 28 | LOCAL_STATIC_LIBRARIES := libc libcutils 29 | include $(BUILD_EXECUTABLE) 30 | -------------------------------------------------------------------------------- /libprocessgroup/cleanup.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Google, Inc 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #include 17 | #include 18 | 19 | #include "processgroup_priv.h" 20 | 21 | int main(int argc, char **argv) 22 | { 23 | char buf[PATH_MAX]; 24 | if (argc != 2) 25 | return -1; 26 | 27 | memcpy(buf, PROCESSGROUP_CGROUP_PATH, sizeof(PROCESSGROUP_CGROUP_PATH)); 28 | strlcat(buf, argv[1], sizeof(buf)); 29 | return rmdir(buf); 30 | } 31 | -------------------------------------------------------------------------------- /libprocessgroup/include/processgroup/processgroup.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Google, Inc 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _PROCESSGROUP_H_ 18 | #define _PROCESSGROUP_H_ 19 | 20 | #include 21 | #include 22 | 23 | __BEGIN_DECLS 24 | 25 | int killProcessGroup(uid_t uid, int initialPid, int signal); 26 | 27 | int createProcessGroup(uid_t uid, int initialPid); 28 | 29 | void removeAllProcessGroups(void); 30 | 31 | __END_DECLS 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /libsparse/defs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _LIBSPARSE_DEFS_H_ 18 | 19 | #ifndef __unused 20 | #define __unused __attribute__((__unused__)) 21 | #endif 22 | 23 | #endif /* _LIBSPARSE_DEFS_H_ */ 24 | -------------------------------------------------------------------------------- /libsparse/sparse_crc32.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _LIBSPARSE_SPARSE_CRC32_H_ 18 | #define _LIBSPARSE_SPARSE_CRC32_H_ 19 | 20 | #include 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | uint32_t sparse_crc32(uint32_t crc, const void *buf, size_t size); 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /libsparse/sparse_err.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | void sparse_default_print(const char *fmt, ...) 24 | { 25 | va_list argp; 26 | 27 | va_start(argp, fmt); 28 | vfprintf(stderr, fmt, argp); 29 | va_end(argp); 30 | } 31 | 32 | void (*sparse_print_error)(const char *fmt, ...) = sparse_default_print; 33 | void (*sparse_print_verbose)(const char *fmt, ...) = sparse_default_print; 34 | -------------------------------------------------------------------------------- /libsparse/sparse_file.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _LIBSPARSE_SPARSE_FILE_H_ 18 | #define _LIBSPARSE_SPARSE_FILE_H_ 19 | 20 | #include 21 | 22 | struct sparse_file { 23 | unsigned int block_size; 24 | int64_t len; 25 | bool verbose; 26 | 27 | struct backed_block_list *backed_block_list; 28 | struct output_file *out; 29 | }; 30 | 31 | 32 | #endif /* _LIBSPARSE_SPARSE_FILE_H_ */ 33 | -------------------------------------------------------------------------------- /libsuspend/Android.mk: -------------------------------------------------------------------------------- 1 | # Copyright 2012 The Android Open Source Project 2 | 3 | LOCAL_PATH:= $(call my-dir) 4 | 5 | libsuspend_src_files := \ 6 | autosuspend.c \ 7 | autosuspend_autosleep.c \ 8 | autosuspend_earlysuspend.c \ 9 | autosuspend_wakeup_count.c \ 10 | 11 | libsuspend_libraries := \ 12 | liblog libcutils 13 | 14 | include $(CLEAR_VARS) 15 | LOCAL_SRC_FILES := $(libsuspend_src_files) 16 | LOCAL_MODULE := libsuspend 17 | LOCAL_MODULE_TAGS := optional 18 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include 19 | LOCAL_C_INCLUDES += $(LOCAL_PATH)/include 20 | LOCAL_SHARED_LIBRARIES := $(libsuspend_libraries) 21 | LOCAL_CFLAGS := -Werror 22 | #LOCAL_CFLAGS += -DLOG_NDEBUG=0 23 | include $(BUILD_SHARED_LIBRARY) 24 | 25 | include $(CLEAR_VARS) 26 | LOCAL_SRC_FILES := $(libsuspend_src_files) 27 | LOCAL_MODULE := libsuspend 28 | LOCAL_MODULE_TAGS := optional 29 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include 30 | LOCAL_C_INCLUDES += $(LOCAL_PATH)/include 31 | LOCAL_CFLAGS := -Werror 32 | #LOCAL_CFLAGS += -DLOG_NDEBUG=0 33 | include $(BUILD_STATIC_LIBRARY) 34 | -------------------------------------------------------------------------------- /libsuspend/autosuspend_ops.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _LIBSUSPEND_AUTOSUSPEND_OPS_H_ 18 | #define _LIBSUSPEND_AUTOSUSPEND_OPS_H_ 19 | 20 | struct autosuspend_ops { 21 | int (*enable)(void); 22 | int (*disable)(void); 23 | }; 24 | 25 | struct autosuspend_ops *autosuspend_autosleep_init(void); 26 | struct autosuspend_ops *autosuspend_earlysuspend_init(void); 27 | struct autosuspend_ops *autosuspend_wakeup_count_init(void); 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /libsync/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH:= $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | LOCAL_SRC_FILES := sync.c 5 | LOCAL_MODULE := libsync 6 | LOCAL_MODULE_TAGS := optional 7 | LOCAL_SHARED_LIBRARIES := liblog 8 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/include 9 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include 10 | LOCAL_CFLAGS := -Werror 11 | include $(BUILD_SHARED_LIBRARY) 12 | 13 | include $(CLEAR_VARS) 14 | LOCAL_SRC_FILES := sync.c sync_test.c 15 | LOCAL_MODULE := sync_test 16 | LOCAL_MODULE_TAGS := optional tests 17 | LOCAL_SHARED_LIBRARIES := liblog 18 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/include 19 | LOCAL_CFLAGS := -Werror 20 | include $(BUILD_EXECUTABLE) 21 | -------------------------------------------------------------------------------- /libsync/sw_sync.h: -------------------------------------------------------------------------------- 1 | /* 2 | * sw_sync.h 3 | * 4 | * Copyright 2013 Google, Inc 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #ifndef __SYS_CORE_SW_SYNC_H 20 | #define __SYS_CORE_SW_SYNC_H 21 | 22 | __BEGIN_DECLS 23 | 24 | /* 25 | * sw_sync is mainly intended for testing and should not be compiled into 26 | * production kernels 27 | */ 28 | 29 | int sw_sync_timeline_create(void); 30 | int sw_sync_timeline_inc(int fd, unsigned count); 31 | int sw_sync_fence_create(int fd, const char *name, unsigned value); 32 | 33 | __END_DECLS 34 | 35 | #endif /* __SYS_CORE_SW_SYNC_H */ 36 | -------------------------------------------------------------------------------- /libsync/tests/Android.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2014 The Android Open Source Project 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | LOCAL_PATH:= $(call my-dir) 18 | 19 | include $(CLEAR_VARS) 20 | LOCAL_CLANG := true 21 | LOCAL_MODULE := sync-unit-tests 22 | LOCAL_CFLAGS += -g -Wall -Werror -std=gnu++11 -Wno-missing-field-initializers -Wno-sign-compare 23 | LOCAL_SHARED_LIBRARIES += libsync 24 | LOCAL_STATIC_LIBRARIES += libgtest_main 25 | LOCAL_C_INCLUDES += $(LOCAL_PATH)/../include 26 | LOCAL_C_INCLUDES += $(LOCAL_PATH)/.. 27 | LOCAL_SRC_FILES := \ 28 | sync_test.cpp 29 | include $(BUILD_NATIVE_TEST) 30 | -------------------------------------------------------------------------------- /libsysutils/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH:= $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | LOCAL_SRC_FILES:= \ 6 | src/SocketListener.cpp \ 7 | src/FrameworkListener.cpp \ 8 | src/NetlinkListener.cpp \ 9 | src/NetlinkEvent.cpp \ 10 | src/FrameworkCommand.cpp \ 11 | src/SocketClient.cpp \ 12 | src/ServiceManager.cpp \ 13 | EventLogTags.logtags 14 | 15 | LOCAL_MODULE:= libsysutils 16 | 17 | LOCAL_CFLAGS := -Werror 18 | 19 | LOCAL_SHARED_LIBRARIES := \ 20 | libcutils \ 21 | liblog \ 22 | libnl 23 | 24 | include $(BUILD_SHARED_LIBRARY) 25 | 26 | -------------------------------------------------------------------------------- /libsysutils/EventLogTags.logtags: -------------------------------------------------------------------------------- 1 | # See system/core/logcat/event.logtags for a description of the format of this file. 2 | 3 | # FrameworkListener dispatchCommand overflow 4 | 78001 exp_det_dispatchCommand_overflow 5 | 65537 exp_det_netlink_failure (uid|1) 6 | -------------------------------------------------------------------------------- /libsysutils/src/FrameworkClient.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #define LOG_TAG "FrameworkClient" 7 | #include 8 | 9 | #include 10 | 11 | FrameworkClient::FrameworkClient(int socket) { 12 | mSocket = socket; 13 | pthread_mutex_init(&mWriteMutex, NULL); 14 | } 15 | 16 | int FrameworkClient::sendMsg(const char *msg) { 17 | int ret; 18 | if (mSocket < 0) { 19 | errno = EHOSTUNREACH; 20 | return -1; 21 | } 22 | 23 | pthread_mutex_lock(&mWriteMutex); 24 | ret = TEMP_FAILURE_RETRY(write(mSocket, msg, strlen(msg) +1)); 25 | if (ret < 0) { 26 | SLOGW("Unable to send msg '%s' (%s)", msg, strerror(errno)); 27 | } 28 | pthread_mutex_unlock(&mWriteMutex); 29 | return 0; 30 | } 31 | 32 | int FrameworkClient::sendMsg(const char *msg, const char *data) { 33 | size_t bufflen = strlen(msg) + strlen(data) + 1; 34 | char *buffer = (char *) alloca(bufflen); 35 | if (!buffer) { 36 | errno = -ENOMEM; 37 | return -1; 38 | } 39 | snprintf(buffer, bufflen, "%s%s", msg, data); 40 | return sendMsg(buffer); 41 | } 42 | 43 | -------------------------------------------------------------------------------- /libsysutils/src/FrameworkCommand.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #include 17 | 18 | #define LOG_TAG "FrameworkCommand" 19 | 20 | #include 21 | 22 | #include 23 | 24 | #define UNUSED __attribute__((unused)) 25 | 26 | FrameworkCommand::FrameworkCommand(const char *cmd) { 27 | mCommand = cmd; 28 | } 29 | 30 | int FrameworkCommand::runCommand(SocketClient *c UNUSED, int argc UNUSED, 31 | char **argv UNUSED) { 32 | SLOGW("Command %s has no run handler!", getCommand()); 33 | errno = ENOSYS; 34 | return -1; 35 | } 36 | -------------------------------------------------------------------------------- /libutils/MODULE_LICENSE_APACHE2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tonyho/adbd-linux/7c56fbf46978ec889b6eee4124457dccdeb2b651/libutils/MODULE_LICENSE_APACHE2 -------------------------------------------------------------------------------- /libutils/NativeHandle.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | namespace android { 21 | 22 | sp NativeHandle::create( 23 | native_handle_t* handle, bool ownsHandle) { 24 | return handle ? new NativeHandle(handle, ownsHandle) : NULL; 25 | } 26 | 27 | NativeHandle::NativeHandle(native_handle_t* handle, bool ownsHandle) 28 | : mHandle(handle), mOwnsHandle(ownsHandle) 29 | {} 30 | 31 | NativeHandle::~NativeHandle() { 32 | if (mOwnsHandle) { 33 | native_handle_close(mHandle); 34 | native_handle_delete(mHandle); 35 | } 36 | } 37 | 38 | } // namespace android 39 | -------------------------------------------------------------------------------- /libutils/Trace.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | static void traceInit() __attribute__((constructor)); 21 | 22 | static void traceInit() 23 | { 24 | ::android::add_sysprop_change_callback(atrace_update_tags, 0); 25 | } 26 | -------------------------------------------------------------------------------- /libziparchive/testdata/bad_crc.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tonyho/adbd-linux/7c56fbf46978ec889b6eee4124457dccdeb2b651/libziparchive/testdata/bad_crc.zip -------------------------------------------------------------------------------- /libziparchive/testdata/declaredlength.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tonyho/adbd-linux/7c56fbf46978ec889b6eee4124457dccdeb2b651/libziparchive/testdata/declaredlength.zip -------------------------------------------------------------------------------- /libziparchive/testdata/large.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tonyho/adbd-linux/7c56fbf46978ec889b6eee4124457dccdeb2b651/libziparchive/testdata/large.zip -------------------------------------------------------------------------------- /libziparchive/testdata/valid.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tonyho/adbd-linux/7c56fbf46978ec889b6eee4124457dccdeb2b651/libziparchive/testdata/valid.zip -------------------------------------------------------------------------------- /lmkd/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH:= $(call my-dir) 2 | include $(CLEAR_VARS) 3 | 4 | LOCAL_SRC_FILES := lmkd.c 5 | LOCAL_SHARED_LIBRARIES := liblog libm libc libprocessgroup 6 | LOCAL_CFLAGS := -Werror 7 | 8 | LOCAL_MODULE := lmkd 9 | 10 | LOCAL_INIT_RC := lmkd.rc 11 | 12 | include $(BUILD_EXECUTABLE) 13 | -------------------------------------------------------------------------------- /lmkd/lmkd.rc: -------------------------------------------------------------------------------- 1 | service lmkd /system/bin/lmkd 2 | class core 3 | group root readproc 4 | critical 5 | socket lmkd seqpacket 0660 system system 6 | writepid /dev/cpuset/system-background/tasks 7 | -------------------------------------------------------------------------------- /logcat/Android.mk: -------------------------------------------------------------------------------- 1 | # Copyright 2006-2014 The Android Open Source Project 2 | 3 | LOCAL_PATH:= $(call my-dir) 4 | include $(CLEAR_VARS) 5 | 6 | LOCAL_SRC_FILES:= logcat.cpp event.logtags 7 | 8 | LOCAL_SHARED_LIBRARIES := liblog libbase libcutils libpcrecpp 9 | 10 | LOCAL_MODULE := logcat 11 | 12 | LOCAL_CFLAGS := -Werror 13 | 14 | include $(BUILD_EXECUTABLE) 15 | 16 | include $(CLEAR_VARS) 17 | 18 | LOCAL_MODULE := logpersist.start 19 | LOCAL_MODULE_TAGS := debug 20 | LOCAL_MODULE_CLASS := EXECUTABLES 21 | LOCAL_INIT_RC := logcatd.rc 22 | LOCAL_MODULE_PATH := $(bin_dir) 23 | LOCAL_SRC_FILES := logpersist 24 | ALL_TOOLS := logpersist.start logpersist.stop logpersist.cat 25 | LOCAL_POST_INSTALL_CMD := $(hide) $(foreach t,$(filter-out $(LOCAL_MODULE),$(ALL_TOOLS)),ln -sf $(LOCAL_MODULE) $(TARGET_OUT)/bin/$(t);) 26 | include $(BUILD_PREBUILT) 27 | 28 | include $(call first-makefiles-under,$(LOCAL_PATH)) 29 | -------------------------------------------------------------------------------- /logcat/MODULE_LICENSE_APACHE2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tonyho/adbd-linux/7c56fbf46978ec889b6eee4124457dccdeb2b651/logcat/MODULE_LICENSE_APACHE2 -------------------------------------------------------------------------------- /logcat/logcatd.rc: -------------------------------------------------------------------------------- 1 | on property:persist.logd.logpersistd=logcatd 2 | # all exec/services are called with umask(077), so no gain beyond 0700 3 | mkdir /data/misc/logd 0700 logd log 4 | # logd for write to /data/misc/logd, log group for read from pstore (-L) 5 | exec - logd log -- /system/bin/logcat -L -b ${persist.logd.logpersistd.buffer:-all} -v threadtime -v usec -v printable -D -f /data/misc/logd/logcat -r 1024 -n ${persist.logd.logpersistd.size:-256} 6 | start logcatd 7 | 8 | on property:persist.logd.logpersistd=clear 9 | stop logcatd 10 | # logd for clear of only our files in /data/misc/logd 11 | exec - logd log -- /system/bin/logcat -c -f /data/misc/logd/logcat -n ${persist.logd.logpersistd.size:-256} 12 | setprop persist.logd.logpersistd "" 13 | 14 | on property:persist.logd.logpersistd=stop 15 | stop logcatd 16 | setprop persist.logd.logpersistd "" 17 | 18 | service logcatd /system/bin/logcat -b ${persist.logd.logpersistd.buffer:-all} -v threadtime -v usec -v printable -D -f /data/misc/logd/logcat -r 1024 -n ${persist.logd.logpersistd.size:-256} 19 | class late_start 20 | disabled 21 | # logd for write to /data/misc/logd, log group for read from log daemon 22 | user logd 23 | group log 24 | writepid /dev/cpuset/system-background/tasks 25 | -------------------------------------------------------------------------------- /logd/LogCommand.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012-2014 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _LOGD_COMMAND_H 18 | #define _LOGD_COMMAND_H 19 | 20 | #include 21 | #include 22 | 23 | class LogCommand : public FrameworkCommand { 24 | public: 25 | LogCommand(const char *cmd); 26 | virtual ~LogCommand() {} 27 | }; 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /logd/LogListener.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012-2013 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _LOGD_LOG_LISTENER_H__ 18 | #define _LOGD_LOG_LISTENER_H__ 19 | 20 | #include 21 | #include "LogReader.h" 22 | 23 | class LogListener : public SocketListener { 24 | LogBuffer *logbuf; 25 | LogReader *reader; 26 | 27 | public: 28 | LogListener(LogBuffer *buf, LogReader *reader); 29 | 30 | protected: 31 | virtual bool onDataAvailable(SocketClient *cli); 32 | 33 | private: 34 | static int getLogSocket(); 35 | }; 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /logd/LogReader.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012-2013 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _LOGD_LOG_WRITER_H__ 18 | #define _LOGD_LOG_WRITER_H__ 19 | 20 | #include 21 | 22 | #define LOGD_SNDTIMEO 32 23 | 24 | class LogBuffer; 25 | 26 | class LogReader : public SocketListener { 27 | LogBuffer &mLogbuf; 28 | 29 | public: 30 | LogReader(LogBuffer *logbuf); 31 | void notifyNewLog(); 32 | 33 | LogBuffer &logbuf(void) const { return mLogbuf; } 34 | 35 | protected: 36 | virtual bool onDataAvailable(SocketClient *cli); 37 | 38 | private: 39 | static int getLogSocket(); 40 | 41 | void doSocketDelete(SocketClient *cli); 42 | 43 | }; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /logd/README.auditd: -------------------------------------------------------------------------------- 1 | Auditd Daemon 2 | 3 | The audit daemon is a simplified version of its desktop 4 | counterpart designed to gather the audit logs from the 5 | audit kernel subsystem. The audit subsystem of the kernel 6 | includes Linux Security Modules (LSM) messages as well. 7 | 8 | To enable the audit subsystem, you must add this to your 9 | kernel config: 10 | CONFIG_AUDIT=y 11 | 12 | To enable a LSM, you must consult that LSM's documentation, the 13 | example below is for SELinux: 14 | CONFIG_SECURITY_SELINUX=y 15 | 16 | This does not include possible dependencies that may need to be 17 | satisfied for that particular LSM. 18 | -------------------------------------------------------------------------------- /logd/logd.rc: -------------------------------------------------------------------------------- 1 | service logd /system/bin/logd 2 | socket logd stream 0666 logd logd 3 | socket logdr seqpacket 0666 logd logd 4 | socket logdw dgram 0222 logd logd 5 | group root system readproc 6 | writepid /dev/cpuset/system-background/tasks 7 | 8 | service logd-reinit /system/bin/logd --reinit 9 | oneshot 10 | disabled 11 | writepid /dev/cpuset/system-background/tasks 12 | -------------------------------------------------------------------------------- /metricsd/.clang-format: -------------------------------------------------------------------------------- 1 | ../../../build/tools/brillo-clang-format -------------------------------------------------------------------------------- /metricsd/OWNERS: -------------------------------------------------------------------------------- 1 | semenzato@chromium.org 2 | derat@chromium.org 3 | bsimonnet@chromium.org 4 | -------------------------------------------------------------------------------- /metricsd/WATCHLISTS: -------------------------------------------------------------------------------- 1 | # See http://dev.chromium.org/developers/contributing-code/watchlists for 2 | # a description of this file's format. 3 | # Please keep these keys in alphabetical order. 4 | 5 | { 6 | 'WATCHLIST_DEFINITIONS': { 7 | 'all': { 8 | 'filepath': '.', 9 | }, 10 | }, 11 | 'WATCHLISTS': { 12 | 'all': ['petkov@chromium.org', 13 | 'semenzato@chromium.org', 14 | 'sosa@chromium.org'] 15 | }, 16 | } 17 | -------------------------------------------------------------------------------- /metricsd/aidl/android/brillo/metrics/IMetricsCollectorService.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package android.brillo.metrics; 18 | 19 | interface IMetricsCollectorService { 20 | oneway void notifyUserCrash(); 21 | } 22 | -------------------------------------------------------------------------------- /metricsd/aidl/android/brillo/metrics/IMetricsd.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package android.brillo.metrics; 18 | 19 | interface IMetricsd { 20 | oneway void recordHistogram(String name, int sample, int min, int max, 21 | int nbuckets); 22 | oneway void recordLinearHistogram(String name, int sample, int max); 23 | oneway void recordSparseHistogram(String name, int sample); 24 | oneway void recordCrash(String type); 25 | String getHistogramsDump(); 26 | } 27 | -------------------------------------------------------------------------------- /metricsd/etc/weaved/traits/metrics.json: -------------------------------------------------------------------------------- 1 | { 2 | "_metrics": { 3 | "commands": { 4 | "enableAnalyticsReporting": { 5 | "minimalRole": "manager", 6 | "parameters": {} 7 | }, 8 | "disableAnalyticsReporting": { 9 | "minimalRole": "manager", 10 | "parameters": {} 11 | } 12 | }, 13 | "state": { 14 | "analyticsReportingState": { 15 | "type": "string", 16 | "enum": [ "enabled", "disabled" ] 17 | } 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /metricsd/libmetrics-369476.gyp: -------------------------------------------------------------------------------- 1 | { 2 | 'variables': { 3 | 'libbase_ver': 369476, 4 | }, 5 | 'includes': [ 6 | 'libmetrics.gypi', 7 | ], 8 | } 9 | -------------------------------------------------------------------------------- /metricsd/libmetrics.gypi: -------------------------------------------------------------------------------- 1 | { 2 | 'target_defaults': { 3 | 'variables': { 4 | 'deps': [ 5 | 'libbrillo-<(libbase_ver)', 6 | 'libchrome-<(libbase_ver)', 7 | ] 8 | }, 9 | 'cflags_cc': [ 10 | '-fno-exceptions', 11 | ], 12 | }, 13 | 'targets': [ 14 | { 15 | 'target_name': 'libmetrics-<(libbase_ver)', 16 | 'type': 'shared_library', 17 | 'cflags': [ 18 | '-fvisibility=default', 19 | ], 20 | 'libraries+': [ 21 | '-lpolicy-<(libbase_ver)', 22 | ], 23 | 'sources': [ 24 | 'c_metrics_library.cc', 25 | 'metrics_library.cc', 26 | 'serialization/metric_sample.cc', 27 | 'serialization/serialization_utils.cc', 28 | 'timer.cc', 29 | ], 30 | 'include_dirs': ['.'], 31 | }, 32 | ], 33 | } 34 | -------------------------------------------------------------------------------- /metricsd/libmetrics.pc.in: -------------------------------------------------------------------------------- 1 | bslot=@BSLOT@ 2 | 3 | Name: libmetrics 4 | Description: Chrome OS metrics library 5 | Version: ${bslot} 6 | Requires.private: libchrome-${bslot} 7 | Libs: -lmetrics-${bslot} 8 | -------------------------------------------------------------------------------- /metricsd/metrics_collector.rc: -------------------------------------------------------------------------------- 1 | service metricscollector /system/bin/metrics_collector --foreground --logtosyslog 2 | class late_start 3 | user metrics_coll 4 | group metrics_coll 5 | -------------------------------------------------------------------------------- /metricsd/metrics_collector_service_impl.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "metrics_collector_service_impl.h" 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | #include "metrics_collector.h" 24 | 25 | using namespace android; 26 | 27 | BnMetricsCollectorServiceImpl::BnMetricsCollectorServiceImpl( 28 | MetricsCollector* metrics_collector) 29 | : metrics_collector_(metrics_collector) { 30 | } 31 | 32 | android::binder::Status BnMetricsCollectorServiceImpl::notifyUserCrash() { 33 | metrics_collector_->ProcessUserCrash(); 34 | return android::binder::Status::ok(); 35 | } 36 | -------------------------------------------------------------------------------- /metricsd/metricsd.rc: -------------------------------------------------------------------------------- 1 | on post-fs-data 2 | mkdir /data/misc/metrics 0750 metrics_coll system 3 | mkdir /data/misc/metricsd 0700 metricsd metricsd 4 | mkdir /data/misc/metrics_collector 0700 metrics_coll metrics_coll 5 | 6 | service metricsd /system/bin/metricsd --foreground --logtosyslog 7 | class late_start 8 | user metricsd 9 | group system inet 10 | -------------------------------------------------------------------------------- /metricsd/uploader/metrics_hashes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef METRICS_UPLOADER_METRICS_HASHES_H_ 18 | #define METRICS_UPLOADER_METRICS_HASHES_H_ 19 | 20 | #include 21 | 22 | namespace metrics { 23 | 24 | // Computes a uint64 hash of a given string based on its MD5 hash. Suitable for 25 | // metric names. 26 | uint64_t HashMetricName(const std::string& name); 27 | 28 | } // namespace metrics 29 | 30 | #endif // METRICS_UPLOADER_METRICS_HASHES_H_ 31 | -------------------------------------------------------------------------------- /metricsd/uploader/mock/mock_system_profile_setter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef METRICS_UPLOADER_MOCK_MOCK_SYSTEM_PROFILE_SETTER_H_ 18 | #define METRICS_UPLOADER_MOCK_MOCK_SYSTEM_PROFILE_SETTER_H_ 19 | 20 | #include "uploader/system_profile_setter.h" 21 | 22 | namespace metrics { 23 | class ChromeUserMetricsExtension; 24 | } 25 | 26 | // Mock profile setter used for testing. 27 | class MockSystemProfileSetter : public SystemProfileSetter { 28 | public: 29 | bool Populate(metrics::ChromeUserMetricsExtension* profile_proto) override { 30 | return true; 31 | } 32 | }; 33 | 34 | #endif // METRICS_UPLOADER_MOCK_MOCK_SYSTEM_PROFILE_SETTER_H_ 35 | -------------------------------------------------------------------------------- /metricsd/uploader/mock/sender_mock.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "uploader/mock/sender_mock.h" 18 | 19 | SenderMock::SenderMock() { 20 | Reset(); 21 | } 22 | 23 | bool SenderMock::Send(const std::string& content, const std::string& hash) { 24 | send_call_count_ += 1; 25 | last_message_ = content; 26 | is_good_proto_ = last_message_proto_.ParseFromString(content); 27 | return should_succeed_; 28 | } 29 | 30 | void SenderMock::Reset() { 31 | send_call_count_ = 0; 32 | last_message_ = ""; 33 | should_succeed_ = true; 34 | last_message_proto_.Clear(); 35 | is_good_proto_ = false; 36 | } 37 | -------------------------------------------------------------------------------- /metricsd/uploader/proto/user_action_event.proto: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | // 17 | // Stores information about an event that occurs in response to a user action, 18 | // e.g. an interaction with a browser UI element. 19 | 20 | syntax = "proto2"; 21 | 22 | option optimize_for = LITE_RUNTIME; 23 | option java_outer_classname = "UserActionEventProtos"; 24 | option java_package = "org.chromium.components.metrics"; 25 | 26 | package metrics; 27 | 28 | // Next tag: 3 29 | message UserActionEventProto { 30 | // The name of the action, hashed. 31 | optional fixed64 name_hash = 1; 32 | 33 | // The timestamp for the event, in seconds since the epoch. 34 | optional int64 time = 2; 35 | } 36 | -------------------------------------------------------------------------------- /metricsd/uploader/sender.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef METRICS_UPLOADER_SENDER_H_ 18 | #define METRICS_UPLOADER_SENDER_H_ 19 | 20 | #include 21 | 22 | // Abstract class for a Sender that uploads a metrics message. 23 | class Sender { 24 | public: 25 | virtual ~Sender() {} 26 | // Sends a message |content| with its sha1 hash |hash| 27 | virtual bool Send(const std::string& content, const std::string& hash) = 0; 28 | }; 29 | 30 | #endif // METRICS_UPLOADER_SENDER_H_ 31 | -------------------------------------------------------------------------------- /metricsd/uploader/system_profile_setter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef METRICS_UPLOADER_SYSTEM_PROFILE_SETTER_H_ 18 | #define METRICS_UPLOADER_SYSTEM_PROFILE_SETTER_H_ 19 | 20 | namespace metrics { 21 | class ChromeUserMetricsExtension; 22 | } 23 | 24 | // Abstract class used to delegate populating SystemProfileProto with system 25 | // information to simplify testing. 26 | class SystemProfileSetter { 27 | public: 28 | virtual ~SystemProfileSetter() {} 29 | // Populates the protobuf with system informations. 30 | virtual bool Populate(metrics::ChromeUserMetricsExtension* profile_proto) = 0; 31 | }; 32 | 33 | #endif // METRICS_UPLOADER_SYSTEM_PROFILE_SETTER_H_ 34 | -------------------------------------------------------------------------------- /mkbootimg/Android.mk: -------------------------------------------------------------------------------- 1 | 2 | LOCAL_PATH:= $(call my-dir) 3 | include $(CLEAR_VARS) 4 | 5 | LOCAL_SRC_FILES := mkbootimg 6 | LOCAL_MODULE_CLASS := EXECUTABLES 7 | LOCAL_IS_HOST_MODULE := true 8 | 9 | LOCAL_MODULE := mkbootimg 10 | 11 | include $(BUILD_PREBUILT) 12 | -------------------------------------------------------------------------------- /reboot/Android.mk: -------------------------------------------------------------------------------- 1 | # Copyright 2013 The Android Open Source Project 2 | 3 | LOCAL_PATH := $(call my-dir) 4 | include $(CLEAR_VARS) 5 | 6 | LOCAL_SRC_FILES := reboot.c 7 | 8 | LOCAL_SHARED_LIBRARIES := libcutils 9 | 10 | LOCAL_MODULE := reboot 11 | 12 | LOCAL_CFLAGS := -Werror 13 | 14 | include $(BUILD_EXECUTABLE) 15 | -------------------------------------------------------------------------------- /rootdir/asan.options: -------------------------------------------------------------------------------- 1 | allow_user_segv_handler=1 2 | detect_odr_violation=0 3 | alloc_dealloc_mismatch=0 4 | allocator_may_return_null=1 5 | detect_container_overflow=0 6 | -------------------------------------------------------------------------------- /rootdir/etc/hosts: -------------------------------------------------------------------------------- 1 | 127.0.0.1 localhost 2 | ::1 ip6-localhost 3 | -------------------------------------------------------------------------------- /rootdir/etc/public.libraries.android.txt: -------------------------------------------------------------------------------- 1 | libandroid.so 2 | libc.so 3 | libdl.so 4 | libEGL.so 5 | libGLESv1_CM.so 6 | libGLESv2.so 7 | libGLESv3.so 8 | libicui18n.so 9 | libicuuc.so 10 | libjnigraphics.so 11 | liblog.so 12 | libmediandk.so 13 | libm.so 14 | libOpenMAXAL.so 15 | libOpenSLES.so 16 | libRS.so 17 | libstdc++.so 18 | libwebviewchromium_plat_support.so 19 | libz.so 20 | -------------------------------------------------------------------------------- /rootdir/etc/public.libraries.wear.txt: -------------------------------------------------------------------------------- 1 | libandroid.so 2 | libc.so 3 | libdl.so 4 | libEGL.so 5 | libGLESv1_CM.so 6 | libGLESv2.so 7 | libGLESv3.so 8 | libicui18n.so 9 | libicuuc.so 10 | libjnigraphics.so 11 | liblog.so 12 | libmediandk.so 13 | libm.so 14 | libOpenMAXAL.so 15 | libOpenSLES.so 16 | libRS.so 17 | libstdc++.so 18 | libz.so 19 | -------------------------------------------------------------------------------- /rootdir/init-debug.rc: -------------------------------------------------------------------------------- 1 | on property:persist.mmc.max_read_speed=* 2 | write /sys/block/mmcblk0/max_read_speed ${persist.mmc.max_read_speed} 3 | 4 | on property:persist.mmc.max_write_speed=* 5 | write /sys/block/mmcblk0/max_write_speed ${persist.mmc.max_write_speed} 6 | 7 | on property:persist.mmc.cache_size=* 8 | write /sys/block/mmcblk0/cache_size ${persist.mmc.cache_size} 9 | 10 | on early-init 11 | mount debugfs debugfs /sys/kernel/debug 12 | -------------------------------------------------------------------------------- /rootdir/init.environ.rc.in: -------------------------------------------------------------------------------- 1 | # set up the global environment 2 | on init 3 | export ANDROID_BOOTLOGO 1 4 | export ANDROID_ROOT /system 5 | export ANDROID_ASSETS /system/app 6 | export ANDROID_DATA /data 7 | export ANDROID_STORAGE /storage 8 | export EXTERNAL_STORAGE /sdcard 9 | export ASEC_MOUNTPOINT /mnt/asec 10 | export BOOTCLASSPATH %BOOTCLASSPATH% 11 | export SYSTEMSERVERCLASSPATH %SYSTEMSERVERCLASSPATH% 12 | %EXPORT_GLOBAL_ASAN_OPTIONS% 13 | -------------------------------------------------------------------------------- /rootdir/init.zygote32.rc: -------------------------------------------------------------------------------- 1 | service zygote /system/bin/app_process -Xzygote /system/bin --zygote --start-system-server 2 | class main 3 | priority -20 4 | socket zygote stream 660 root system 5 | onrestart write /sys/android_power/request_state wake 6 | onrestart write /sys/power/state on 7 | onrestart restart media 8 | onrestart restart netd 9 | writepid /dev/cpuset/foreground/tasks /sys/fs/cgroup/stune/foreground/tasks 10 | -------------------------------------------------------------------------------- /rootdir/init.zygote32_64.rc: -------------------------------------------------------------------------------- 1 | service zygote /system/bin/app_process32 -Xzygote /system/bin --zygote --start-system-server --socket-name=zygote 2 | class main 3 | priority -20 4 | socket zygote stream 660 root system 5 | onrestart write /sys/android_power/request_state wake 6 | onrestart write /sys/power/state on 7 | onrestart restart media 8 | onrestart restart netd 9 | writepid /dev/cpuset/foreground/tasks /sys/fs/cgroup/stune/foreground/tasks 10 | 11 | service zygote_secondary /system/bin/app_process64 -Xzygote /system/bin --zygote --socket-name=zygote_secondary 12 | class main 13 | priority -20 14 | socket zygote_secondary stream 660 root system 15 | onrestart restart zygote 16 | writepid /dev/cpuset/foreground/tasks /sys/fs/cgroup/stune/foreground/tasks 17 | -------------------------------------------------------------------------------- /rootdir/init.zygote64.rc: -------------------------------------------------------------------------------- 1 | service zygote /system/bin/app_process64 -Xzygote /system/bin --zygote --start-system-server 2 | class main 3 | priority -20 4 | socket zygote stream 660 root system 5 | onrestart write /sys/android_power/request_state wake 6 | onrestart write /sys/power/state on 7 | onrestart restart media 8 | onrestart restart netd 9 | writepid /dev/cpuset/foreground/tasks /sys/fs/cgroup/stune/foreground/tasks 10 | -------------------------------------------------------------------------------- /rootdir/init.zygote64_32.rc: -------------------------------------------------------------------------------- 1 | service zygote /system/bin/app_process64 -Xzygote /system/bin --zygote --start-system-server --socket-name=zygote 2 | class main 3 | priority -20 4 | socket zygote stream 660 root system 5 | onrestart write /sys/android_power/request_state wake 6 | onrestart write /sys/power/state on 7 | onrestart restart media 8 | onrestart restart netd 9 | writepid /dev/cpuset/foreground/tasks /sys/fs/cgroup/stune/foreground/tasks 10 | 11 | service zygote_secondary /system/bin/app_process32 -Xzygote /system/bin --zygote --socket-name=zygote_secondary 12 | class main 13 | priority -20 14 | socket zygote_secondary stream 660 root system 15 | onrestart restart zygote 16 | writepid /dev/cpuset/foreground/tasks /sys/fs/cgroup/stune/foreground/tasks 17 | -------------------------------------------------------------------------------- /run-as/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH:= $(call my-dir) 2 | include $(CLEAR_VARS) 3 | 4 | LOCAL_SRC_FILES := run-as.c package.c 5 | 6 | LOCAL_SHARED_LIBRARIES := libselinux 7 | 8 | LOCAL_MODULE := run-as 9 | 10 | LOCAL_CFLAGS := -Werror 11 | 12 | include $(BUILD_EXECUTABLE) 13 | -------------------------------------------------------------------------------- /sdcard/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | LOCAL_SRC_FILES := sdcard.c 6 | LOCAL_MODULE := sdcard 7 | LOCAL_CFLAGS := -Wall -Wno-unused-parameter -Werror 8 | LOCAL_SHARED_LIBRARIES := liblog libcutils libpackagelistparser 9 | 10 | LOCAL_SANITIZE := integer 11 | LOCAL_CLANG := true 12 | 13 | include $(BUILD_EXECUTABLE) 14 | -------------------------------------------------------------------------------- /toolbox/MODULE_LICENSE_BSD: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tonyho/adbd-linux/7c56fbf46978ec889b6eee4124457dccdeb2b651/toolbox/MODULE_LICENSE_BSD -------------------------------------------------------------------------------- /toolbox/sendevent.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | int sendevent_main(int argc, char *argv[]) 12 | { 13 | int fd; 14 | ssize_t ret; 15 | int version; 16 | struct input_event event; 17 | 18 | if(argc != 5) { 19 | fprintf(stderr, "use: %s device type code value\n", argv[0]); 20 | return 1; 21 | } 22 | 23 | fd = open(argv[1], O_RDWR); 24 | if(fd < 0) { 25 | fprintf(stderr, "could not open %s, %s\n", argv[optind], strerror(errno)); 26 | return 1; 27 | } 28 | if (ioctl(fd, EVIOCGVERSION, &version)) { 29 | fprintf(stderr, "could not get driver version for %s, %s\n", argv[optind], strerror(errno)); 30 | return 1; 31 | } 32 | memset(&event, 0, sizeof(event)); 33 | event.type = atoi(argv[2]); 34 | event.code = atoi(argv[3]); 35 | event.value = atoi(argv[4]); 36 | ret = write(fd, &event, sizeof(event)); 37 | if(ret < (ssize_t) sizeof(event)) { 38 | fprintf(stderr, "write event failed, %s\n", strerror(errno)); 39 | return -1; 40 | } 41 | return 0; 42 | } 43 | -------------------------------------------------------------------------------- /toolbox/upstream-netbsd/include/namespace.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tonyho/adbd-linux/7c56fbf46978ec889b6eee4124457dccdeb2b651/toolbox/upstream-netbsd/include/namespace.h -------------------------------------------------------------------------------- /toolbox/upstream-netbsd/include/sys/extattr.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tonyho/adbd-linux/7c56fbf46978ec889b6eee4124457dccdeb2b651/toolbox/upstream-netbsd/include/sys/extattr.h -------------------------------------------------------------------------------- /toolbox/upstream-netbsd/include/sys/mtio.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /toolbox/upstream-netbsd/include/util.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tonyho/adbd-linux/7c56fbf46978ec889b6eee4124457dccdeb2b651/toolbox/upstream-netbsd/include/util.h -------------------------------------------------------------------------------- /trusty/gatekeeper/trusty_gatekeeper_ipc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | __BEGIN_DECLS 18 | 19 | int trusty_gatekeeper_connect(); 20 | int trusty_gatekeeper_call(uint32_t cmd, void *in, uint32_t in_size, uint8_t *out, 21 | uint32_t *out_size); 22 | void trusty_gatekeeper_disconnect(); 23 | 24 | __END_DECLS 25 | -------------------------------------------------------------------------------- /trusty/keymaster/trusty_keymaster_ipc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | __BEGIN_DECLS 18 | 19 | int trusty_keymaster_connect(void); 20 | int trusty_keymaster_call(uint32_t cmd, void *in, uint32_t in_size, uint8_t *out, 21 | uint32_t *out_size); 22 | void trusty_keymaster_disconnect(void); 23 | 24 | __END_DECLS 25 | -------------------------------------------------------------------------------- /trusty/libtrusty/Android.mk: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2015 The Android Open Source Project 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | LOCAL_PATH := $(call my-dir) 16 | 17 | # == libtrusty Static library == 18 | include $(CLEAR_VARS) 19 | 20 | LOCAL_MODULE := libtrusty 21 | LOCAL_MODULE_TAGS := optional 22 | LOCAL_SRC_FILES := trusty.c 23 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include 24 | 25 | include $(BUILD_STATIC_LIBRARY) 26 | 27 | # == libtrusty shared library == 28 | include $(CLEAR_VARS) 29 | 30 | LOCAL_MODULE := libtrusty 31 | LOCAL_MODULE_TAGS := optional 32 | LOCAL_SRC_FILES := trusty.c 33 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include 34 | LOCAL_SHARED_LIBRARIES := liblog 35 | 36 | include $(BUILD_SHARED_LIBRARY) 37 | -------------------------------------------------------------------------------- /trusty/libtrusty/include/trusty/tipc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _LIB_TIPC_H 18 | #define _LIB_TIPC_H 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | int tipc_connect(const char *dev_name, const char *srv_name); 25 | int tipc_close(int fd); 26 | 27 | #ifdef __cplusplus 28 | } 29 | #endif 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /trusty/libtrusty/tipc-test/Android.mk: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2015 The Android Open Source Project 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | LOCAL_PATH := $(call my-dir) 16 | 17 | include $(CLEAR_VARS) 18 | 19 | LOCAL_MODULE := tipc-test 20 | LOCAL_FORCE_STATIC_EXECUTABLE := true 21 | LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) 22 | LOCAL_MODULE_TAGS := optional 23 | LOCAL_SRC_FILES := tipc_test.c 24 | LOCAL_STATIC_LIBRARIES := libc libtrusty liblog 25 | LOCAL_MULTILIB := both 26 | LOCAL_MODULE_STEM_32 := $(LOCAL_MODULE)32 27 | LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64 28 | 29 | include $(BUILD_EXECUTABLE) 30 | -------------------------------------------------------------------------------- /trusty/libtrusty/tipc_ioctl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _TIPC_IOCTL_H 18 | #define _TIPC_IOCTL_H 19 | 20 | #include 21 | #include 22 | 23 | #define TIPC_IOC_MAGIC 'r' 24 | #define TIPC_IOC_CONNECT _IOW(TIPC_IOC_MAGIC, 0x80, char *) 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /trusty/nvram/Android.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2016 The Android Open-Source Project 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | LOCAL_PATH := $(call my-dir) 18 | 19 | # nvram.trusty is the Trusty NVRAM HAL module. 20 | include $(CLEAR_VARS) 21 | LOCAL_MODULE := nvram.trusty 22 | LOCAL_MODULE_RELATIVE_PATH := hw 23 | LOCAL_SRC_FILES := \ 24 | module.c \ 25 | trusty_nvram_implementation.cpp 26 | LOCAL_MODULE_TAGS := optional 27 | LOCAL_CFLAGS := -Wall -Werror -Wextra -fvisibility=hidden 28 | LOCAL_STATIC_LIBRARIES := libnvram-hal 29 | LOCAL_SHARED_LIBRARIES := libtrusty libnvram-messages liblog 30 | include $(BUILD_SHARED_LIBRARY) 31 | -------------------------------------------------------------------------------- /trusty/storage/interface/Android.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2015 The Android Open-Source Project 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | LOCAL_PATH:= $(call my-dir) 18 | 19 | include $(CLEAR_VARS) 20 | 21 | LOCAL_MODULE := libtrustystorageinterface 22 | 23 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include 24 | 25 | include $(BUILD_STATIC_LIBRARY) 26 | -------------------------------------------------------------------------------- /trusty/storage/lib/Android.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2015 The Android Open-Source Project 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | LOCAL_PATH:= $(call my-dir) 18 | 19 | include $(CLEAR_VARS) 20 | 21 | LOCAL_MODULE := libtrustystorage 22 | 23 | LOCAL_SRC_FILES := \ 24 | storage.c \ 25 | 26 | LOCAL_CLFAGS = -fvisibility=hidden -Wall -Werror 27 | 28 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include 29 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/include 30 | 31 | LOCAL_STATIC_LIBRARIES := \ 32 | liblog \ 33 | libtrusty \ 34 | libtrustystorageinterface 35 | 36 | include $(BUILD_STATIC_LIBRARY) 37 | 38 | -------------------------------------------------------------------------------- /trusty/storage/proxy/Android.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2016 The Android Open-Source Project 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | LOCAL_PATH:= $(call my-dir) 18 | 19 | include $(CLEAR_VARS) 20 | 21 | LOCAL_MODULE := storageproxyd 22 | 23 | LOCAL_C_INCLUDES += bionic/libc/kernel/uapi 24 | 25 | LOCAL_SRC_FILES := \ 26 | ipc.c \ 27 | rpmb.c \ 28 | storage.c \ 29 | proxy.c 30 | 31 | LOCAL_CLFAGS = -Wall -Werror 32 | 33 | LOCAL_SHARED_LIBRARIES := \ 34 | liblog \ 35 | 36 | LOCAL_STATIC_LIBRARIES := \ 37 | libtrustystorageinterface \ 38 | libtrusty 39 | 40 | include $(BUILD_EXECUTABLE) 41 | 42 | -------------------------------------------------------------------------------- /trusty/storage/proxy/ipc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #pragma once 17 | 18 | #include 19 | #include 20 | 21 | int ipc_connect(const char *device, const char *service_name); 22 | void ipc_disconnect(void); 23 | ssize_t ipc_get_msg(struct storage_msg *msg, void *req_buf, size_t req_buf_len); 24 | int ipc_respond(struct storage_msg *msg, void *out, size_t out_size); 25 | -------------------------------------------------------------------------------- /trusty/storage/proxy/log.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #define LOG_TAG "storageproxyd" 18 | #include 19 | 20 | -------------------------------------------------------------------------------- /trusty/storage/proxy/rpmb.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #pragma once 17 | 18 | #include 19 | #include 20 | 21 | int rpmb_open(const char *rpmb_devname); 22 | int rpmb_send(struct storage_msg *msg, const void *r, size_t req_len); 23 | void rpmb_close(void); 24 | -------------------------------------------------------------------------------- /trusty/storage/tests/Android.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2016 The Android Open Source Project 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | LOCAL_PATH:= $(call my-dir) 18 | 19 | include $(CLEAR_VARS) 20 | LOCAL_MODULE := secure-storage-unit-test 21 | LOCAL_CFLAGS += -g -Wall -Werror -std=gnu++11 -Wno-missing-field-initializers 22 | LOCAL_STATIC_LIBRARIES := \ 23 | libtrustystorageinterface \ 24 | libtrustystorage \ 25 | libtrusty \ 26 | liblog 27 | LOCAL_SRC_FILES := main.cpp 28 | include $(BUILD_NATIVE_TEST) 29 | 30 | -------------------------------------------------------------------------------- /trusty/trusty-base.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2016 The Android Open-Source Project 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | # 18 | # This makefile should be included by devices that use Trusty TEE 19 | # to pull in the baseline set of Trusty specific modules. 20 | # 21 | 22 | PRODUCT_PACKAGES += \ 23 | keystore.trusty \ 24 | gatekeeper.trusty 25 | 26 | PRODUCT_PROPERTY_OVERRIDES += \ 27 | ro.hardware.keystore=trusty \ 28 | ro.hardware.gatekeeper=trusty 29 | -------------------------------------------------------------------------------- /trusty/trusty-storage.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2015 The Android Open-Source Project 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | PRODUCT_PACKAGES += \ 18 | storageproxyd \ 19 | -------------------------------------------------------------------------------- /tzdatacheck/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH:= $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | # ======================================================== 6 | # Executable 7 | # ======================================================== 8 | include $(CLEAR_VARS) 9 | LOCAL_SRC_FILES:= tzdatacheck.cpp 10 | LOCAL_MODULE := tzdatacheck 11 | LOCAL_SHARED_LIBRARIES := libbase libcutils liblog 12 | LOCAL_CFLAGS := -Werror 13 | include $(BUILD_EXECUTABLE) 14 | 15 | include $(CLEAR_VARS) 16 | LOCAL_SRC_FILES:= tzdatacheck.cpp 17 | LOCAL_MODULE := tzdatacheck 18 | LOCAL_SHARED_LIBRARIES := libbase libcutils liblog 19 | LOCAL_CFLAGS := -Werror 20 | include $(BUILD_HOST_EXECUTABLE) 21 | 22 | --------------------------------------------------------------------------------