├── .clang-format
├── .gitignore
├── CHANGELOG.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── README.zh-CN.md
├── build.gradle
├── doc
└── images
│ └── wechat.jpg
├── gradle.properties
├── gradle
├── common.gradle
├── jcenter-publish.gradle
├── mavenCentral-android-publish.gradle
├── mavenCentral-java-publish.gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── koom-common
├── kwai-android-base
│ ├── .gitignore
│ ├── build.gradle
│ ├── consumer-rules.pro
│ ├── proguard-rules.pro
│ └── src
│ │ ├── androidTest
│ │ └── java
│ │ │ └── com
│ │ │ └── kwai
│ │ │ └── android
│ │ │ └── base
│ │ │ └── ExampleInstrumentedTest.kt
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── cpp
│ │ │ ├── Android.bp
│ │ │ ├── CMakeLists.txt
│ │ │ ├── CPPLINT.cfg
│ │ │ ├── README.md
│ │ │ ├── abi_compatibility.cpp
│ │ │ ├── async_safe
│ │ │ │ └── async_safe_log.cpp
│ │ │ ├── bionic
│ │ │ │ ├── ndk_port.cpp
│ │ │ │ └── system_property
│ │ │ │ │ └── prop_info.cpp
│ │ │ ├── chrono_utils.cpp
│ │ │ ├── cmsg.cpp
│ │ │ ├── errors_unix.cpp
│ │ │ ├── errors_windows.cpp
│ │ │ ├── file.cpp
│ │ │ ├── fmtlib
│ │ │ │ ├── .clang-format
│ │ │ │ ├── Android.bp
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── CONTRIBUTING.md
│ │ │ │ ├── ChangeLog.rst
│ │ │ │ ├── LICENSE.rst
│ │ │ │ ├── METADATA
│ │ │ │ ├── MODULE_LICENSE_BSD
│ │ │ │ ├── NOTICE
│ │ │ │ ├── README.rst
│ │ │ │ ├── doc
│ │ │ │ │ ├── CMakeLists.txt
│ │ │ │ │ ├── _static
│ │ │ │ │ │ ├── bootstrap.min.js
│ │ │ │ │ │ ├── breathe.css
│ │ │ │ │ │ └── fonts
│ │ │ │ │ │ │ ├── glyphicons-halflings-regular.eot
│ │ │ │ │ │ │ ├── glyphicons-halflings-regular.svg
│ │ │ │ │ │ │ ├── glyphicons-halflings-regular.ttf
│ │ │ │ │ │ │ └── glyphicons-halflings-regular.woff
│ │ │ │ │ ├── _templates
│ │ │ │ │ │ ├── layout.html
│ │ │ │ │ │ └── search.html
│ │ │ │ │ ├── api.rst
│ │ │ │ │ ├── basic-bootstrap
│ │ │ │ │ │ ├── README
│ │ │ │ │ │ ├── layout.html
│ │ │ │ │ │ └── theme.conf
│ │ │ │ │ ├── bootstrap
│ │ │ │ │ │ ├── alerts.less
│ │ │ │ │ │ ├── badges.less
│ │ │ │ │ │ ├── bootstrap.less
│ │ │ │ │ │ ├── breadcrumbs.less
│ │ │ │ │ │ ├── button-groups.less
│ │ │ │ │ │ ├── buttons.less
│ │ │ │ │ │ ├── carousel.less
│ │ │ │ │ │ ├── close.less
│ │ │ │ │ │ ├── code.less
│ │ │ │ │ │ ├── component-animations.less
│ │ │ │ │ │ ├── dropdowns.less
│ │ │ │ │ │ ├── forms.less
│ │ │ │ │ │ ├── glyphicons.less
│ │ │ │ │ │ ├── grid.less
│ │ │ │ │ │ ├── input-groups.less
│ │ │ │ │ │ ├── jumbotron.less
│ │ │ │ │ │ ├── labels.less
│ │ │ │ │ │ ├── list-group.less
│ │ │ │ │ │ ├── media.less
│ │ │ │ │ │ ├── mixins.less
│ │ │ │ │ │ ├── mixins
│ │ │ │ │ │ │ ├── alerts.less
│ │ │ │ │ │ │ ├── background-variant.less
│ │ │ │ │ │ │ ├── border-radius.less
│ │ │ │ │ │ │ ├── buttons.less
│ │ │ │ │ │ │ ├── center-block.less
│ │ │ │ │ │ │ ├── clearfix.less
│ │ │ │ │ │ │ ├── forms.less
│ │ │ │ │ │ │ ├── gradients.less
│ │ │ │ │ │ │ ├── grid-framework.less
│ │ │ │ │ │ │ ├── grid.less
│ │ │ │ │ │ │ ├── hide-text.less
│ │ │ │ │ │ │ ├── image.less
│ │ │ │ │ │ │ ├── labels.less
│ │ │ │ │ │ │ ├── list-group.less
│ │ │ │ │ │ │ ├── nav-divider.less
│ │ │ │ │ │ │ ├── nav-vertical-align.less
│ │ │ │ │ │ │ ├── opacity.less
│ │ │ │ │ │ │ ├── pagination.less
│ │ │ │ │ │ │ ├── panels.less
│ │ │ │ │ │ │ ├── progress-bar.less
│ │ │ │ │ │ │ ├── reset-filter.less
│ │ │ │ │ │ │ ├── resize.less
│ │ │ │ │ │ │ ├── responsive-visibility.less
│ │ │ │ │ │ │ ├── size.less
│ │ │ │ │ │ │ ├── tab-focus.less
│ │ │ │ │ │ │ ├── table-row.less
│ │ │ │ │ │ │ ├── text-emphasis.less
│ │ │ │ │ │ │ ├── text-overflow.less
│ │ │ │ │ │ │ └── vendor-prefixes.less
│ │ │ │ │ │ ├── modals.less
│ │ │ │ │ │ ├── navbar.less
│ │ │ │ │ │ ├── navs.less
│ │ │ │ │ │ ├── normalize.less
│ │ │ │ │ │ ├── pager.less
│ │ │ │ │ │ ├── pagination.less
│ │ │ │ │ │ ├── panels.less
│ │ │ │ │ │ ├── popovers.less
│ │ │ │ │ │ ├── print.less
│ │ │ │ │ │ ├── progress-bars.less
│ │ │ │ │ │ ├── responsive-embed.less
│ │ │ │ │ │ ├── responsive-utilities.less
│ │ │ │ │ │ ├── scaffolding.less
│ │ │ │ │ │ ├── tables.less
│ │ │ │ │ │ ├── theme.less
│ │ │ │ │ │ ├── thumbnails.less
│ │ │ │ │ │ ├── tooltip.less
│ │ │ │ │ │ ├── type.less
│ │ │ │ │ │ ├── utilities.less
│ │ │ │ │ │ ├── variables.less
│ │ │ │ │ │ └── wells.less
│ │ │ │ │ ├── build.py
│ │ │ │ │ ├── conf.py
│ │ │ │ │ ├── contents.rst
│ │ │ │ │ ├── fmt.less
│ │ │ │ │ ├── index.rst
│ │ │ │ │ ├── python-license.txt
│ │ │ │ │ ├── syntax.rst
│ │ │ │ │ └── usage.rst
│ │ │ │ ├── include
│ │ │ │ │ └── fmt
│ │ │ │ │ │ ├── chrono.h
│ │ │ │ │ │ ├── color.h
│ │ │ │ │ │ ├── compile.h
│ │ │ │ │ │ ├── core.h
│ │ │ │ │ │ ├── format-inl.h
│ │ │ │ │ │ ├── format.h
│ │ │ │ │ │ ├── locale.h
│ │ │ │ │ │ ├── os.h
│ │ │ │ │ │ ├── ostream.h
│ │ │ │ │ │ ├── posix.h
│ │ │ │ │ │ ├── printf.h
│ │ │ │ │ │ └── ranges.h
│ │ │ │ ├── src
│ │ │ │ │ ├── format.cc
│ │ │ │ │ └── os.cc
│ │ │ │ ├── support
│ │ │ │ │ ├── Android.mk
│ │ │ │ │ ├── AndroidManifest.xml
│ │ │ │ │ ├── C++.sublime-syntax
│ │ │ │ │ ├── README
│ │ │ │ │ ├── Vagrantfile
│ │ │ │ │ ├── appveyor-build.py
│ │ │ │ │ ├── appveyor.yml
│ │ │ │ │ ├── build.gradle
│ │ │ │ │ ├── cmake
│ │ │ │ │ │ ├── FindSetEnv.cmake
│ │ │ │ │ │ ├── JoinPaths.cmake
│ │ │ │ │ │ ├── cxx14.cmake
│ │ │ │ │ │ ├── fmt-config.cmake.in
│ │ │ │ │ │ └── fmt.pc.in
│ │ │ │ │ ├── compute-powers.py
│ │ │ │ │ ├── docopt.py
│ │ │ │ │ ├── fmt.pro
│ │ │ │ │ ├── manage.py
│ │ │ │ │ ├── rst2md.py
│ │ │ │ │ ├── rtd
│ │ │ │ │ │ ├── conf.py
│ │ │ │ │ │ ├── index.rst
│ │ │ │ │ │ └── theme
│ │ │ │ │ │ │ ├── layout.html
│ │ │ │ │ │ │ └── theme.conf
│ │ │ │ │ ├── travis-build.py
│ │ │ │ │ └── update-coverity-branch.py
│ │ │ │ └── test
│ │ │ │ │ ├── CMakeLists.txt
│ │ │ │ │ ├── add-subdirectory-test
│ │ │ │ │ ├── CMakeLists.txt
│ │ │ │ │ └── main.cc
│ │ │ │ │ ├── assert-test.cc
│ │ │ │ │ ├── chrono-test.cc
│ │ │ │ │ ├── color-test.cc
│ │ │ │ │ ├── compile-error-test
│ │ │ │ │ └── CMakeLists.txt
│ │ │ │ │ ├── compile-test.cc
│ │ │ │ │ ├── core-test.cc
│ │ │ │ │ ├── cuda-test
│ │ │ │ │ ├── CMakeLists.txt
│ │ │ │ │ ├── cpp14.cc
│ │ │ │ │ └── cuda-cpp14.cu
│ │ │ │ │ ├── custom-formatter-test.cc
│ │ │ │ │ ├── find-package-test
│ │ │ │ │ ├── CMakeLists.txt
│ │ │ │ │ └── main.cc
│ │ │ │ │ ├── format
│ │ │ │ │ ├── format-dyn-args-test.cc
│ │ │ │ │ ├── format-impl-test.cc
│ │ │ │ │ ├── format-test.cc
│ │ │ │ │ ├── fuzzing
│ │ │ │ │ ├── .gitignore
│ │ │ │ │ ├── CMakeLists.txt
│ │ │ │ │ ├── README.md
│ │ │ │ │ ├── build.sh
│ │ │ │ │ ├── chrono_duration.cpp
│ │ │ │ │ ├── fuzzer_common.h
│ │ │ │ │ ├── main.cpp
│ │ │ │ │ ├── named_arg.cpp
│ │ │ │ │ ├── one_arg.cpp
│ │ │ │ │ ├── sprintf.cpp
│ │ │ │ │ └── two_args.cpp
│ │ │ │ │ ├── gmock-gtest-all.cc
│ │ │ │ │ ├── gmock
│ │ │ │ │ └── gmock.h
│ │ │ │ │ ├── grisu-test.cc
│ │ │ │ │ ├── gtest-extra-test.cc
│ │ │ │ │ ├── gtest-extra.cc
│ │ │ │ │ ├── gtest-extra.h
│ │ │ │ │ ├── gtest
│ │ │ │ │ ├── gtest-spi.h
│ │ │ │ │ └── gtest.h
│ │ │ │ │ ├── header-only-test.cc
│ │ │ │ │ ├── header-only-test2.cc
│ │ │ │ │ ├── locale-test.cc
│ │ │ │ │ ├── mock-allocator.h
│ │ │ │ │ ├── os-test.cc
│ │ │ │ │ ├── ostream-test.cc
│ │ │ │ │ ├── posix-mock-test.cc
│ │ │ │ │ ├── posix-mock.h
│ │ │ │ │ ├── printf-test.cc
│ │ │ │ │ ├── ranges-test.cc
│ │ │ │ │ ├── scan-test.cc
│ │ │ │ │ ├── scan.h
│ │ │ │ │ ├── std-format-test.cc
│ │ │ │ │ ├── test-assert.h
│ │ │ │ │ ├── test-main.cc
│ │ │ │ │ ├── util.cc
│ │ │ │ │ └── util.h
│ │ │ ├── include
│ │ │ │ ├── android-base
│ │ │ │ │ ├── chrono_utils.h
│ │ │ │ │ ├── cmsg.h
│ │ │ │ │ ├── collections.h
│ │ │ │ │ ├── endian.h
│ │ │ │ │ ├── errno_restorer.h
│ │ │ │ │ ├── errors.h
│ │ │ │ │ ├── expected.h
│ │ │ │ │ ├── file.h
│ │ │ │ │ ├── format.h
│ │ │ │ │ ├── logging.h
│ │ │ │ │ ├── macros.h
│ │ │ │ │ ├── mapped_file.h
│ │ │ │ │ ├── memory.h
│ │ │ │ │ ├── no_destructor.h
│ │ │ │ │ ├── off64_t.h
│ │ │ │ │ ├── parsebool.h
│ │ │ │ │ ├── parsedouble.h
│ │ │ │ │ ├── parseint.h
│ │ │ │ │ ├── parsenetaddress.h
│ │ │ │ │ ├── process.h
│ │ │ │ │ ├── properties.h
│ │ │ │ │ ├── result.h
│ │ │ │ │ ├── scopeguard.h
│ │ │ │ │ ├── stringprintf.h
│ │ │ │ │ ├── strings.h
│ │ │ │ │ ├── test_utils.h
│ │ │ │ │ ├── thread_annotations.h
│ │ │ │ │ ├── threads.h
│ │ │ │ │ ├── unique_fd.h
│ │ │ │ │ └── utf8.h
│ │ │ │ ├── async_safe
│ │ │ │ │ ├── CHECK.h
│ │ │ │ │ ├── async_safe_stl.h
│ │ │ │ │ ├── log.h
│ │ │ │ │ └── stack_allocator.h
│ │ │ │ ├── bionic
│ │ │ │ │ ├── macros.h
│ │ │ │ │ ├── mte_kernel.h
│ │ │ │ │ ├── ndk_port.h
│ │ │ │ │ ├── pac.h
│ │ │ │ │ ├── reserved_signals.h
│ │ │ │ │ ├── system_property
│ │ │ │ │ │ └── prop_info.h
│ │ │ │ │ ├── tls.h
│ │ │ │ │ └── tls_defines.h
│ │ │ │ ├── jni_util
│ │ │ │ │ └── scoped_local_ref.h
│ │ │ │ ├── kwai_linker
│ │ │ │ │ ├── elf_reader.h
│ │ │ │ │ ├── elf_wrapper.h
│ │ │ │ │ └── kwai_dlfcn.h
│ │ │ │ ├── kwai_util
│ │ │ │ │ ├── ktime.h
│ │ │ │ │ └── kwai_macros.h
│ │ │ │ ├── platform
│ │ │ │ │ └── bionic
│ │ │ │ │ │ └── macros.h
│ │ │ │ ├── private
│ │ │ │ │ ├── CachedProperty.h
│ │ │ │ │ ├── ErrnoRestorer.h
│ │ │ │ │ ├── ScopedPthreadMutexLocker.h
│ │ │ │ │ └── android_filesystem_config.h
│ │ │ │ ├── procinfo
│ │ │ │ │ ├── process.h
│ │ │ │ │ └── process_map.h
│ │ │ │ └── rapidjson
│ │ │ │ │ ├── allocators.h
│ │ │ │ │ ├── document.h
│ │ │ │ │ ├── encodedstream.h
│ │ │ │ │ ├── encodings.h
│ │ │ │ │ ├── error
│ │ │ │ │ ├── en.h
│ │ │ │ │ └── error.h
│ │ │ │ │ ├── filereadstream.h
│ │ │ │ │ ├── filewritestream.h
│ │ │ │ │ ├── fwd.h
│ │ │ │ │ ├── internal
│ │ │ │ │ ├── biginteger.h
│ │ │ │ │ ├── diyfp.h
│ │ │ │ │ ├── dtoa.h
│ │ │ │ │ ├── ieee754.h
│ │ │ │ │ ├── itoa.h
│ │ │ │ │ ├── meta.h
│ │ │ │ │ ├── pow10.h
│ │ │ │ │ ├── regex.h
│ │ │ │ │ ├── stack.h
│ │ │ │ │ ├── strfunc.h
│ │ │ │ │ ├── strtod.h
│ │ │ │ │ └── swap.h
│ │ │ │ │ ├── istreamwrapper.h
│ │ │ │ │ ├── memorybuffer.h
│ │ │ │ │ ├── memorystream.h
│ │ │ │ │ ├── msinttypes
│ │ │ │ │ ├── inttypes.h
│ │ │ │ │ └── stdint.h
│ │ │ │ │ ├── ostreamwrapper.h
│ │ │ │ │ ├── pointer.h
│ │ │ │ │ ├── prettywriter.h
│ │ │ │ │ ├── rapidjson.h
│ │ │ │ │ ├── reader.h
│ │ │ │ │ ├── schema.h
│ │ │ │ │ ├── stream.h
│ │ │ │ │ ├── stringbuffer.h
│ │ │ │ │ └── writer.h
│ │ │ ├── kwai_linker
│ │ │ │ ├── elf_reader.cpp
│ │ │ │ ├── kwai_dlfcn.cpp
│ │ │ │ └── map_util.hpp
│ │ │ ├── kwai_util
│ │ │ │ └── ktime.cpp
│ │ │ ├── libcutils
│ │ │ │ └── include
│ │ │ │ │ └── cutils
│ │ │ │ │ └── list.h
│ │ │ ├── liblog
│ │ │ │ ├── event_tag_map.cpp
│ │ │ │ ├── include
│ │ │ │ │ ├── android
│ │ │ │ │ │ └── klog.h
│ │ │ │ │ ├── log
│ │ │ │ │ │ ├── event_tag_map.h
│ │ │ │ │ │ ├── kcheck.h
│ │ │ │ │ │ ├── log.h
│ │ │ │ │ │ ├── log_event_list.h
│ │ │ │ │ │ ├── log_id.h
│ │ │ │ │ │ ├── log_main.h
│ │ │ │ │ │ ├── log_properties.h
│ │ │ │ │ │ ├── log_radio.h
│ │ │ │ │ │ ├── log_read.h
│ │ │ │ │ │ ├── log_safetynet.h
│ │ │ │ │ │ ├── log_system.h
│ │ │ │ │ │ ├── log_time.h
│ │ │ │ │ │ ├── logger_write.h
│ │ │ │ │ │ └── logprint.h
│ │ │ │ │ └── private
│ │ │ │ │ │ └── android_logger.h
│ │ │ │ ├── log_event_list.cpp
│ │ │ │ ├── log_event_write.cpp
│ │ │ │ ├── log_time.cpp
│ │ │ │ ├── logd_reader.cpp
│ │ │ │ ├── logd_reader.h
│ │ │ │ ├── logd_writer.cpp
│ │ │ │ ├── logd_writer.h
│ │ │ │ ├── logger.h
│ │ │ │ ├── logger_name.cpp
│ │ │ │ ├── logger_read.cpp
│ │ │ │ ├── logger_write.cpp
│ │ │ │ ├── logger_write.h
│ │ │ │ ├── logprint.cpp
│ │ │ │ ├── pmsg_reader.cpp
│ │ │ │ ├── pmsg_reader.h
│ │ │ │ ├── pmsg_writer.cpp
│ │ │ │ ├── pmsg_writer.h
│ │ │ │ ├── properties.cpp
│ │ │ │ └── uio.h
│ │ │ ├── liblog_symbols.cpp
│ │ │ ├── liblog_symbols.h
│ │ │ ├── libsystem
│ │ │ │ └── include
│ │ │ │ │ └── system
│ │ │ │ │ ├── graphics-base-v1.0.h
│ │ │ │ │ ├── graphics-base-v1.1.h
│ │ │ │ │ ├── graphics-base-v1.2.h
│ │ │ │ │ ├── graphics-base.h
│ │ │ │ │ ├── graphics-sw.h
│ │ │ │ │ ├── graphics.h
│ │ │ │ │ └── thread_defs.h
│ │ │ ├── libutils
│ │ │ │ └── include
│ │ │ │ │ └── utils
│ │ │ │ │ ├── Errors.h
│ │ │ │ │ ├── FastStrcmp.h
│ │ │ │ │ ├── RWLock.h
│ │ │ │ │ └── ThreadDefs.h
│ │ │ ├── logging.cpp
│ │ │ ├── logging_splitters.h
│ │ │ ├── lzma
│ │ │ │ ├── 7z.h
│ │ │ │ ├── 7zAlloc.c
│ │ │ │ ├── 7zAlloc.h
│ │ │ │ ├── 7zArcIn.c
│ │ │ │ ├── 7zBuf.c
│ │ │ │ ├── 7zBuf.h
│ │ │ │ ├── 7zBuf2.c
│ │ │ │ ├── 7zCrc.c
│ │ │ │ ├── 7zCrc.h
│ │ │ │ ├── 7zCrcOpt.c
│ │ │ │ ├── 7zDec.c
│ │ │ │ ├── 7zFile.c
│ │ │ │ ├── 7zFile.h
│ │ │ │ ├── 7zStream.c
│ │ │ │ ├── 7zTypes.h
│ │ │ │ ├── 7zVersion.h
│ │ │ │ ├── 7zVersion.rc
│ │ │ │ ├── Aes.c
│ │ │ │ ├── Aes.h
│ │ │ │ ├── AesOpt.c
│ │ │ │ ├── Alloc.c
│ │ │ │ ├── Alloc.h
│ │ │ │ ├── Android.bp
│ │ │ │ ├── Bcj2.c
│ │ │ │ ├── Bcj2.h
│ │ │ │ ├── Bcj2Enc.c
│ │ │ │ ├── Bra.c
│ │ │ │ ├── Bra.h
│ │ │ │ ├── Bra86.c
│ │ │ │ ├── BraIA64.c
│ │ │ │ ├── Compiler.h
│ │ │ │ ├── CpuArch.c
│ │ │ │ ├── CpuArch.h
│ │ │ │ ├── Delta.c
│ │ │ │ ├── Delta.h
│ │ │ │ ├── DllSecur.c
│ │ │ │ ├── DllSecur.h
│ │ │ │ ├── LzFind.c
│ │ │ │ ├── LzFind.h
│ │ │ │ ├── LzFindMt.c
│ │ │ │ ├── LzFindMt.h
│ │ │ │ ├── LzHash.h
│ │ │ │ ├── Lzma2Dec.c
│ │ │ │ ├── Lzma2Dec.h
│ │ │ │ ├── Lzma2DecMt.c
│ │ │ │ ├── Lzma2DecMt.h
│ │ │ │ ├── Lzma2Enc.c
│ │ │ │ ├── Lzma2Enc.h
│ │ │ │ ├── Lzma86.h
│ │ │ │ ├── Lzma86Dec.c
│ │ │ │ ├── Lzma86Enc.c
│ │ │ │ ├── LzmaDec.c
│ │ │ │ ├── LzmaDec.h
│ │ │ │ ├── LzmaEnc.c
│ │ │ │ ├── LzmaEnc.h
│ │ │ │ ├── LzmaLib.c
│ │ │ │ ├── LzmaLib.h
│ │ │ │ ├── MtCoder.c
│ │ │ │ ├── MtCoder.h
│ │ │ │ ├── MtDec.c
│ │ │ │ ├── MtDec.h
│ │ │ │ ├── Ppmd.h
│ │ │ │ ├── Ppmd7.c
│ │ │ │ ├── Ppmd7.h
│ │ │ │ ├── Ppmd7Dec.c
│ │ │ │ ├── Ppmd7Enc.c
│ │ │ │ ├── Precomp.h
│ │ │ │ ├── RotateDefs.h
│ │ │ │ ├── Sha256.c
│ │ │ │ ├── Sha256.h
│ │ │ │ ├── Sort.c
│ │ │ │ ├── Sort.h
│ │ │ │ ├── Threads.c
│ │ │ │ ├── Threads.h
│ │ │ │ ├── Util
│ │ │ │ │ ├── 7z
│ │ │ │ │ │ ├── 7z.dsp
│ │ │ │ │ │ ├── 7z.dsw
│ │ │ │ │ │ ├── 7zMain.c
│ │ │ │ │ │ ├── Precomp.c
│ │ │ │ │ │ ├── Precomp.h
│ │ │ │ │ │ ├── makefile
│ │ │ │ │ │ └── makefile.gcc
│ │ │ │ │ ├── Lzma
│ │ │ │ │ │ ├── LzmaUtil.c
│ │ │ │ │ │ ├── LzmaUtil.dsp
│ │ │ │ │ │ ├── LzmaUtil.dsw
│ │ │ │ │ │ ├── makefile
│ │ │ │ │ │ └── makefile.gcc
│ │ │ │ │ ├── LzmaLib
│ │ │ │ │ │ ├── LzmaLib.def
│ │ │ │ │ │ ├── LzmaLib.dsp
│ │ │ │ │ │ ├── LzmaLib.dsw
│ │ │ │ │ │ ├── LzmaLibExports.c
│ │ │ │ │ │ ├── makefile
│ │ │ │ │ │ └── resource.rc
│ │ │ │ │ └── SfxSetup
│ │ │ │ │ │ ├── Precomp.c
│ │ │ │ │ │ ├── Precomp.h
│ │ │ │ │ │ ├── SfxSetup.c
│ │ │ │ │ │ ├── SfxSetup.dsp
│ │ │ │ │ │ ├── SfxSetup.dsw
│ │ │ │ │ │ ├── makefile
│ │ │ │ │ │ ├── makefile_con
│ │ │ │ │ │ ├── resource.rc
│ │ │ │ │ │ └── setup.ico
│ │ │ │ ├── Xz.c
│ │ │ │ ├── Xz.h
│ │ │ │ ├── XzCrc64.c
│ │ │ │ ├── XzCrc64.h
│ │ │ │ ├── XzCrc64Opt.c
│ │ │ │ ├── XzDec.c
│ │ │ │ ├── XzEnc.c
│ │ │ │ ├── XzEnc.h
│ │ │ │ └── XzIn.c
│ │ │ ├── mapped_file.cpp
│ │ │ ├── parsebool.cpp
│ │ │ ├── parsenetaddress.cpp
│ │ │ ├── process.cpp
│ │ │ ├── procinfo
│ │ │ │ ├── process.cpp
│ │ │ │ └── process_map.cpp
│ │ │ ├── properties.cpp
│ │ │ ├── stringprintf.cpp
│ │ │ ├── strings.cpp
│ │ │ ├── test_main.cpp
│ │ │ ├── test_utils.cpp
│ │ │ ├── threads.cpp
│ │ │ └── utf8.cpp
│ │ └── libs
│ │ │ ├── arm64-v8a
│ │ │ └── libkwai-android-base.so
│ │ │ ├── armeabi-v7a
│ │ │ └── libkwai-android-base.so
│ │ │ ├── x86
│ │ │ └── libkwai-android-base.so
│ │ │ └── x86_64
│ │ │ └── libkwai-android-base.so
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── kwai
│ │ └── android
│ │ └── base
│ │ └── ExampleUnitTest.kt
├── kwai-unwind
│ ├── .gitignore
│ ├── build.gradle
│ ├── consumer-rules.pro
│ ├── proguard-rules.pro
│ └── src
│ │ ├── androidTest
│ │ └── java
│ │ │ └── com
│ │ │ └── kwai
│ │ │ └── unwind
│ │ │ └── ExampleInstrumentedTest.kt
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── cpp
│ │ │ ├── CMakeLists.txt
│ │ │ ├── dexfile_support
│ │ │ │ ├── dex_file_ext.cpp
│ │ │ │ └── dex_file_supp.cpp
│ │ │ ├── fast_unwind
│ │ │ │ ├── fast_unwind.cpp
│ │ │ │ └── fast_unwind_test.cpp
│ │ │ ├── include
│ │ │ │ ├── art_api
│ │ │ │ │ ├── dex_file_external.h
│ │ │ │ │ └── dex_file_support.h
│ │ │ │ └── fast_unwind
│ │ │ │ │ ├── fast_unwind.h
│ │ │ │ │ └── fast_unwind_test.h
│ │ │ ├── libbacktrace
│ │ │ │ ├── .clang-format
│ │ │ │ ├── Android.bp
│ │ │ │ ├── Backtrace.cpp
│ │ │ │ ├── BacktraceAsyncSafeLog.h
│ │ │ │ ├── BacktraceCurrent.cpp
│ │ │ │ ├── BacktraceCurrent.h
│ │ │ │ ├── BacktraceLog.h
│ │ │ │ ├── BacktraceMap.cpp
│ │ │ │ ├── BacktracePtrace.cpp
│ │ │ │ ├── BacktracePtrace.h
│ │ │ │ ├── BacktraceTest.h
│ │ │ │ ├── ThreadEntry.cpp
│ │ │ │ ├── ThreadEntry.h
│ │ │ │ ├── UnwindMap.cpp
│ │ │ │ ├── UnwindMap.h
│ │ │ │ ├── UnwindStack.cpp
│ │ │ │ ├── UnwindStack.h
│ │ │ │ ├── UnwindStackMap.cpp
│ │ │ │ ├── UnwindStackMap.h
│ │ │ │ ├── backtrace_benchmarks.cpp
│ │ │ │ ├── backtrace_read_benchmarks.cpp
│ │ │ │ ├── backtrace_test.cpp
│ │ │ │ ├── backtrace_testlib.cpp
│ │ │ │ ├── backtrace_testlib.h
│ │ │ │ └── include
│ │ │ │ │ └── backtrace
│ │ │ │ │ ├── Backtrace.h
│ │ │ │ │ ├── BacktraceMap.h
│ │ │ │ │ └── backtrace_constants.h
│ │ │ └── libunwindstack
│ │ │ │ ├── .clang-format
│ │ │ │ ├── Android.bp
│ │ │ │ ├── AndroidVersions.md
│ │ │ │ ├── ArmExidx.cpp
│ │ │ │ ├── ArmExidx.h
│ │ │ │ ├── AsmGetRegsX86.S
│ │ │ │ ├── AsmGetRegsX86_64.S
│ │ │ │ ├── Check.h
│ │ │ │ ├── DexFile.cpp
│ │ │ │ ├── DexFile.h
│ │ │ │ ├── DexFiles.cpp
│ │ │ │ ├── DwarfCfa.cpp
│ │ │ │ ├── DwarfCfa.h
│ │ │ │ ├── DwarfDebugFrame.h
│ │ │ │ ├── DwarfEhFrame.h
│ │ │ │ ├── DwarfEhFrameWithHdr.cpp
│ │ │ │ ├── DwarfEhFrameWithHdr.h
│ │ │ │ ├── DwarfEncoding.h
│ │ │ │ ├── DwarfMemory.cpp
│ │ │ │ ├── DwarfOp.cpp
│ │ │ │ ├── DwarfOp.h
│ │ │ │ ├── DwarfSection.cpp
│ │ │ │ ├── Elf.cpp
│ │ │ │ ├── ElfInterface.cpp
│ │ │ │ ├── ElfInterfaceArm.cpp
│ │ │ │ ├── ElfInterfaceArm.h
│ │ │ │ ├── Global.cpp
│ │ │ │ ├── JitDebug.cpp
│ │ │ │ ├── LocalUnwinder.cpp
│ │ │ │ ├── Log.cpp
│ │ │ │ ├── MapInfo.cpp
│ │ │ │ ├── Maps.cpp
│ │ │ │ ├── Memory.cpp
│ │ │ │ ├── MemoryBuffer.h
│ │ │ │ ├── MemoryCache.h
│ │ │ │ ├── MemoryFileAtOffset.h
│ │ │ │ ├── MemoryLocal.h
│ │ │ │ ├── MemoryMte.cpp
│ │ │ │ ├── MemoryOffline.h
│ │ │ │ ├── MemoryOfflineBuffer.h
│ │ │ │ ├── MemoryRange.h
│ │ │ │ ├── MemoryRemote.h
│ │ │ │ ├── Regs.cpp
│ │ │ │ ├── RegsArm.cpp
│ │ │ │ ├── RegsArm64.cpp
│ │ │ │ ├── RegsInfo.h
│ │ │ │ ├── RegsMips.cpp
│ │ │ │ ├── RegsMips64.cpp
│ │ │ │ ├── RegsX86.cpp
│ │ │ │ ├── RegsX86_64.cpp
│ │ │ │ ├── Symbols.cpp
│ │ │ │ ├── Symbols.h
│ │ │ │ ├── TEST_MAPPING
│ │ │ │ ├── ThreadEntry.cpp
│ │ │ │ ├── ThreadEntry.h
│ │ │ │ ├── ThreadUnwinder.cpp
│ │ │ │ ├── Unwinder.cpp
│ │ │ │ ├── include
│ │ │ │ └── unwindstack
│ │ │ │ │ ├── Arch.h
│ │ │ │ │ ├── DexFiles.h
│ │ │ │ │ ├── DwarfError.h
│ │ │ │ │ ├── DwarfLocation.h
│ │ │ │ │ ├── DwarfMemory.h
│ │ │ │ │ ├── DwarfSection.h
│ │ │ │ │ ├── DwarfStructs.h
│ │ │ │ │ ├── Elf.h
│ │ │ │ │ ├── ElfInterface.h
│ │ │ │ │ ├── Error.h
│ │ │ │ │ ├── Global.h
│ │ │ │ │ ├── JitDebug.h
│ │ │ │ │ ├── LocalUnwinder.h
│ │ │ │ │ ├── Log.h
│ │ │ │ │ ├── MachineArm.h
│ │ │ │ │ ├── MachineArm64.h
│ │ │ │ │ ├── MachineMips.h
│ │ │ │ │ ├── MachineMips64.h
│ │ │ │ │ ├── MachineX86.h
│ │ │ │ │ ├── MachineX86_64.h
│ │ │ │ │ ├── MapInfo.h
│ │ │ │ │ ├── Maps.h
│ │ │ │ │ ├── Memory.h
│ │ │ │ │ ├── Regs.h
│ │ │ │ │ ├── RegsArm.h
│ │ │ │ │ ├── RegsArm64.h
│ │ │ │ │ ├── RegsGetLocal.h
│ │ │ │ │ ├── RegsMips.h
│ │ │ │ │ ├── RegsMips64.h
│ │ │ │ │ ├── RegsX86.h
│ │ │ │ │ ├── RegsX86_64.h
│ │ │ │ │ ├── UcontextArm.h
│ │ │ │ │ ├── UcontextArm64.h
│ │ │ │ │ ├── UcontextMips.h
│ │ │ │ │ ├── UcontextMips64.h
│ │ │ │ │ ├── UcontextX86.h
│ │ │ │ │ ├── UcontextX86_64.h
│ │ │ │ │ ├── Unwinder.h
│ │ │ │ │ ├── UserArm.h
│ │ │ │ │ ├── UserArm64.h
│ │ │ │ │ ├── UserMips.h
│ │ │ │ │ ├── UserMips64.h
│ │ │ │ │ ├── UserX86.h
│ │ │ │ │ └── UserX86_64.h
│ │ │ │ └── tools
│ │ │ │ ├── unwind.cpp
│ │ │ │ ├── unwind_for_offline.cpp
│ │ │ │ ├── unwind_info.cpp
│ │ │ │ ├── unwind_reg_info.cpp
│ │ │ │ └── unwind_symbols.cpp
│ │ └── libs
│ │ │ ├── arm64-v8a
│ │ │ └── libkwai-unwind.so
│ │ │ ├── armeabi-v7a
│ │ │ └── libkwai-unwind.so
│ │ │ ├── x86
│ │ │ └── libkwai-unwind.so
│ │ │ └── x86_64
│ │ │ └── libkwai-unwind.so
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── kwai
│ │ └── unwind
│ │ └── ExampleUnitTest.kt
└── third-party
│ ├── shark
│ ├── .gitignore
│ ├── SHARK-MODIFIED-LIST
│ ├── build.gradle
│ ├── gradle.properties
│ └── src
│ │ └── main
│ │ ├── java
│ │ └── kshark
│ │ │ ├── AndroidBuildMirror.kt
│ │ │ ├── AndroidMetadataExtractor.kt
│ │ │ ├── AndroidObjectInspectors.kt
│ │ │ ├── AndroidReferenceMatchers.kt
│ │ │ ├── AndroidResourceIdNames.kt
│ │ │ ├── AppSingletonInspector.kt
│ │ │ ├── ByteArraySourceProvider.kt
│ │ │ ├── CloseableHeapGraph.kt
│ │ │ ├── ConstantMemoryMetricsDualSourceProvider.kt
│ │ │ ├── DualSourceProvider.kt
│ │ │ ├── FileSourceProvider.kt
│ │ │ ├── FilteringLeakingObjectFinder.kt
│ │ │ ├── GcRoot.kt
│ │ │ ├── GraphContext.kt
│ │ │ ├── HeapAnalysis.kt
│ │ │ ├── HeapAnalysisException.kt
│ │ │ ├── HeapAnalyzer.kt
│ │ │ ├── HeapField.kt
│ │ │ ├── HeapGraph.kt
│ │ │ ├── HeapObject.kt
│ │ │ ├── HeapValue.kt
│ │ │ ├── Hprof.kt
│ │ │ ├── HprofDeobfuscator.kt
│ │ │ ├── HprofHeader.kt
│ │ │ ├── HprofHeapGraph.kt
│ │ │ ├── HprofIndex.kt
│ │ │ ├── HprofPrimitiveArrayStripper.kt
│ │ │ ├── HprofReader.kt
│ │ │ ├── HprofRecord.kt
│ │ │ ├── HprofRecordReader.kt
│ │ │ ├── HprofRecordTag.kt
│ │ │ ├── HprofVersion.kt
│ │ │ ├── HprofWriter.kt
│ │ │ ├── KeyedWeakReferenceFinder.kt
│ │ │ ├── LeakNodeStatus.kt
│ │ │ ├── LeakReference.kt
│ │ │ ├── LeakTrace.kt
│ │ │ ├── LeakTraceElement.kt
│ │ │ ├── LeakTraceObject.kt
│ │ │ ├── LeakTraceReference.kt
│ │ │ ├── LeakingObjectFinder.kt
│ │ │ ├── MetadataExtractor.kt
│ │ │ ├── ObjectInspector.kt
│ │ │ ├── ObjectInspectors.kt
│ │ │ ├── ObjectReporter.kt
│ │ │ ├── OnAnalysisProgressListener.kt
│ │ │ ├── OnHprofRecordListener.kt
│ │ │ ├── OnHprofRecordTagListener.kt
│ │ │ ├── PrimitiveType.kt
│ │ │ ├── ProguardMapping.kt
│ │ │ ├── ProguardMappingReader.kt
│ │ │ ├── RandomAccessHprofReader.kt
│ │ │ ├── RandomAccessSource.kt
│ │ │ ├── RandomAccessSourceProvider.kt
│ │ │ ├── ReferenceMatcher.kt
│ │ │ ├── ReferencePattern.kt
│ │ │ ├── SharkLog.kt
│ │ │ ├── StreamingHprofReader.kt
│ │ │ ├── StreamingRecordReaderAdapter.kt
│ │ │ ├── StreamingSourceProvider.kt
│ │ │ ├── ValueHolder.kt
│ │ │ └── internal
│ │ │ ├── AndroidNativeSizeMapper.kt
│ │ │ ├── ByteSubArray.kt
│ │ │ ├── ClassFieldsReader.kt
│ │ │ ├── DominatorTree.kt
│ │ │ ├── FieldIdReader.kt
│ │ │ ├── FieldValuesReader.kt
│ │ │ ├── HprofInMemoryIndex.kt
│ │ │ ├── IndexedObject.kt
│ │ │ ├── KeyedWeakReferenceMirror.kt
│ │ │ ├── LruCache.kt
│ │ │ ├── ObjectDominators.kt
│ │ │ ├── PathFinder.kt
│ │ │ ├── ReferencePathNode.kt
│ │ │ ├── ShallowSizeCalculator.kt
│ │ │ ├── SortedBytesMap.kt
│ │ │ ├── Strings.kt
│ │ │ ├── UnsortedByteEntries.kt
│ │ │ ├── aosp
│ │ │ ├── ByteArrayComparator.kt
│ │ │ └── ByteArrayTimSort.kt
│ │ │ └── hppc
│ │ │ ├── HHPC.kt
│ │ │ ├── LongLongScatterMap.kt
│ │ │ ├── LongObjectScatterMap.kt
│ │ │ ├── LongScatterSet.kt
│ │ │ └── Tuples.kt
│ │ └── resources
│ │ └── META-INF
│ │ └── proguard
│ │ └── shark.pro
│ └── xhook
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── cpp
│ └── xhook
│ │ ├── CMakeLists.txt
│ │ └── src
│ │ ├── dlopencb.cpp
│ │ ├── dlopencb.h
│ │ ├── queue.h
│ │ ├── tree.h
│ │ ├── xh_core.c
│ │ ├── xh_core.h
│ │ ├── xh_elf.c
│ │ ├── xh_elf.h
│ │ ├── xh_errno.h
│ │ ├── xh_jni.c
│ │ ├── xh_log.c
│ │ ├── xh_log.h
│ │ ├── xh_util.c
│ │ ├── xh_util.h
│ │ ├── xh_version.c
│ │ ├── xh_version.h
│ │ ├── xhook.c
│ │ └── xhook.h
│ └── libs
│ ├── arm64-v8a
│ └── libxhook_lib.so
│ ├── armeabi-v7a
│ └── libxhook_lib.so
│ ├── x86
│ └── libxhook_lib.so
│ └── x86_64
│ └── libxhook_lib.so
├── koom-demo
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── kwai
│ │ └── oomkiller
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── kwai
│ │ │ └── koom
│ │ │ └── demo
│ │ │ ├── KOOMApplication.java
│ │ │ ├── MainActivity.java
│ │ │ ├── javaleak
│ │ │ ├── JavaLeakTestActivity.java
│ │ │ ├── OOMMonitorInitTask.kt
│ │ │ └── test
│ │ │ │ ├── ActivityLeakMaker.java
│ │ │ │ ├── BitmapLeakMaker.java
│ │ │ │ ├── ByteArrayLeakMaker.java
│ │ │ │ ├── FragmentLeakMaker.java
│ │ │ │ ├── LeakMaker.java
│ │ │ │ └── StringLeakMaker.java
│ │ │ ├── nativeleak
│ │ │ ├── NativeLeakTest.kt
│ │ │ └── NativeLeakTestActivity.java
│ │ │ └── threadleak
│ │ │ ├── ThreadLeakTest.kt
│ │ │ └── ThreadLeakTestActivity.kt
│ ├── jni
│ │ ├── CMakeLists.txt
│ │ ├── native-leak-test.cpp
│ │ └── thread-leak-test.cpp
│ └── res
│ │ ├── drawable-v24
│ │ └── ic_launcher_foreground.xml
│ │ ├── drawable
│ │ └── ic_launcher_background.xml
│ │ ├── layout
│ │ ├── activity_java_leak_test.xml
│ │ ├── activity_main.xml
│ │ ├── activity_native_leak_test.xml
│ │ └── activity_thread_leak_test.xml
│ │ ├── mipmap-anydpi-v26
│ │ ├── ic_launcher.xml
│ │ └── ic_launcher_round.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── values-night
│ │ └── styles.xml
│ │ └── values
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── kwai
│ └── oomkiller
│ └── ExampleUnitTest.java
├── koom-fast-dump
├── .gitignore
├── README.md
├── README.zh-CN.md
├── build.gradle
├── consumer-rules.pro
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── cpp
│ ├── CMakeLists.txt
│ ├── hprof_dump.cpp
│ ├── hprof_dump_below_r_impl.cpp
│ ├── hprof_dump_below_v_impl.cpp
│ ├── hprof_dump_impl.cpp
│ ├── hprof_dump_v_impl.cpp
│ ├── include
│ │ ├── defines.h
│ │ ├── hprof_dump.h
│ │ ├── hprof_dump_below_r_impl.h
│ │ ├── hprof_dump_below_v_impl.h
│ │ ├── hprof_dump_impl.h
│ │ └── hprof_dump_v_impl.h
│ └── native_bridge.cpp
│ └── java
│ └── com
│ └── kwai
│ └── koom
│ └── fastdump
│ ├── ForkJvmHeapDumper.java
│ └── HeapDumper.java
├── koom-java-leak
├── .gitignore
├── README.md
├── README.zh-CN.md
├── build.gradle
├── consumer-rules.pro
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── cpp
│ ├── CMakeLists.txt
│ ├── hprof_strip.cpp
│ ├── include
│ │ └── hprof_strip.h
│ └── native_bridge.cpp
│ └── java
│ └── com
│ └── kwai
│ └── koom
│ └── javaoom
│ ├── hprof
│ └── ForkStripHeapDumper.java
│ └── monitor
│ ├── OOMFileManager.kt
│ ├── OOMHprofUploader.kt
│ ├── OOMMonitor.kt
│ ├── OOMMonitorConfig.kt
│ ├── OOMPreferenceManager.kt
│ ├── OOMReportUploader.kt
│ ├── analysis
│ ├── AnalysisExtraData.kt
│ ├── AnalysisReceiver.kt
│ ├── HeapAnalysisService.kt
│ └── HeapReport.java
│ ├── tracker
│ ├── FastHugeMemoryOOMTracker.kt
│ ├── FdOOMTracker.kt
│ ├── HeapOOMTracker.kt
│ ├── OOMTracker.kt
│ ├── PhysicalMemoryOOMTracker.kt
│ ├── ThreadOOMTracker.kt
│ └── model
│ │ └── SystemInfo.kt
│ └── utils
│ └── SizeUnit.kt
├── koom-monitor-base
├── .gitignore
├── README.md
├── README.zh-CN.md
├── build.gradle
├── consumer-rules.pro
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── kwai
│ │ └── koom
│ │ └── base
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ └── java
│ │ └── com
│ │ └── kwai
│ │ └── koom
│ │ └── base
│ │ ├── CommonConfig.kt
│ │ ├── DefaultInitTask.kt
│ │ ├── InitTask.kt
│ │ ├── Monitor.kt
│ │ ├── MonitorBuildConfig.kt
│ │ ├── MonitorConfig.kt
│ │ ├── MonitorLog.kt
│ │ ├── MonitorLogger.kt
│ │ ├── MonitorManager.kt
│ │ ├── Monitor_Application.kt
│ │ ├── Monitor_File.kt
│ │ ├── Monitor_Process.kt
│ │ ├── Monitor_Reflect.kt
│ │ ├── Monitor_SharedPreferences.kt
│ │ ├── Monitor_So.kt
│ │ ├── Monitor_System.kt
│ │ ├── Monitor_Thread.kt
│ │ └── loop
│ │ ├── LoopMonitor.kt
│ │ └── LoopThread.kt
│ └── test
│ └── java
│ └── com
│ └── kwai
│ └── koom
│ └── base
│ └── ExampleUnitTest.java
├── koom-native-leak
├── .gitignore
├── README.md
├── README.zh-CN.md
├── build.gradle
├── consumer-rules.pro
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── kwai
│ │ └── koom
│ │ └── nativeoom
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── kwai
│ │ │ └── koom
│ │ │ └── nativeoom
│ │ │ └── leakmonitor
│ │ │ ├── LeakListener.kt
│ │ │ ├── LeakMonitor.kt
│ │ │ ├── LeakMonitorConfig.kt
│ │ │ ├── LeakRecord.kt
│ │ │ └── allocationtag
│ │ │ ├── AllocationTagInfo.kt
│ │ │ └── AllocationTagLifecycleCallbacks.kt
│ └── jni
│ │ ├── CMakeLists.txt
│ │ ├── include
│ │ ├── constants.h
│ │ ├── leak_monitor.h
│ │ ├── memory_analyzer.h
│ │ ├── memory_map.h
│ │ └── utils
│ │ │ ├── auto_time.h
│ │ │ ├── concurrent_hash_map.h
│ │ │ ├── hook_helper.h
│ │ │ └── stack_trace.h
│ │ └── src
│ │ ├── jni_leak_monitor.cpp
│ │ ├── leak_monitor.cpp
│ │ ├── memory_analyzer.cpp
│ │ ├── memory_map.cpp
│ │ └── utils
│ │ ├── hook_helper.cpp
│ │ └── stack_trace.cpp
│ └── test
│ └── java
│ └── com
│ └── kwai
│ └── koom
│ └── nativeoom
│ └── ExampleUnitTest.java
├── koom-thread-leak
├── README.md
├── README.zh-CN.md
├── build.gradle
├── consumer-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── cpp
│ ├── CMakeLists.txt
│ └── src
│ │ ├── common
│ │ ├── callstack.cpp
│ │ ├── callstack.h
│ │ ├── constant.h
│ │ ├── log.h
│ │ ├── looper.cpp
│ │ ├── looper.h
│ │ └── util.h
│ │ ├── jni_bridge.cpp
│ │ ├── koom.cpp
│ │ ├── koom.h
│ │ └── thread
│ │ ├── hook_looper.cpp
│ │ ├── hook_looper.h
│ │ ├── loop_item.h
│ │ ├── thread_holder.cpp
│ │ ├── thread_holder.h
│ │ ├── thread_hook.cpp
│ │ ├── thread_hook.h
│ │ ├── thread_item.cpp
│ │ └── thread_item.h
│ └── java
│ └── com
│ └── kwai
│ └── performance
│ └── overhead
│ └── thread
│ └── monitor
│ ├── NativeHandler.kt
│ ├── ThreadLeakListener.kt
│ ├── ThreadLeakRecord.kt
│ ├── ThreadMonitor.kt
│ └── ThreadMonitorConfig.kt
├── settings.gradle
└── tools
└── koom-fill-crop.jar
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | .idea
4 | .DS_Store
5 | build
6 | captures
7 | .externalNativeBuild
8 | .cxx
9 | local.properties
10 | .classpath
11 | .project
12 | .settings/
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # v2.2.0
2 | New Features
3 | - Support leakcanary custom dumper.
4 | - Add two flavors StaticCpp and SharedCpp.
5 |
6 | # v2.1.0
7 | Enhancement
8 | - Support Android S.
9 | - AndroidGradlePlugin update to 7.1.0.
10 | - NDK update to 23.1.7779620.
11 |
12 | # v2.0.0
13 | New Features
14 | - Add Native Leak Monitor.
15 | - Add Thread Leak Monitor.
16 |
17 | # v1.1.0
18 | Enhancement
19 | - Add heap max ratio and force trigger.
20 | - Add support for x86.
21 |
22 | Bug fix
23 | - Hardcode cacheDir path on unpredictable case.
24 | - Add try-catch in abnormal start, delete abnormal json file.
25 |
26 | # v1.0.5
27 | Enhancement
28 | - Add custom root dir validity check.
29 |
30 | Bug fix
31 | - StripHprofHeapDumper bugfix.
32 |
33 | # v1.0.4
34 | First version with java-oom.
35 |
36 |
--------------------------------------------------------------------------------
/doc/images/wechat.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KwaiAppTeam/KOOM/f653d7c986debb242b1d8b96761351f63d9f04bf/doc/images/wechat.jpg
--------------------------------------------------------------------------------
/gradle/common.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'kotlin-android'
2 | apply plugin: 'kotlin-android-extensions'
3 |
4 | android {
5 | compileSdkVersion rootProject.ext.versions.compileSdkVersion
6 | buildToolsVersion rootProject.ext.versions.buildToolsVersion
7 |
8 | compileOptions {
9 | sourceCompatibility JavaVersion.VERSION_1_8
10 | targetCompatibility JavaVersion.VERSION_1_8
11 | }
12 |
13 | kotlinOptions {
14 | jvmTarget = "1.8"
15 | }
16 |
17 | defaultConfig {
18 | minSdkVersion rootProject.ext.versions.minSdkVersion
19 | targetSdkVersion rootProject.ext.versions.targetSdkVersion
20 | ndkVersion rootProject.ext.versions.ndk
21 |
22 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
23 | consumerProguardFiles "consumer-rules.pro"
24 | }
25 | }
--------------------------------------------------------------------------------
/gradle/jcenter-publish.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.novoda.bintray-release'
2 |
3 | publish {
4 | userOrg = "androidinternal"
5 | groupId = "com.kwai.koom"
6 | artifactId = "${project.getName()}"
7 | publishVersion = '1.0.0'
8 | repository = "KOOM"
9 | desc = "KOOM"
10 | }
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KwaiAppTeam/KOOM/f653d7c986debb242b1d8b96761351f63d9f04bf/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Jul 22 18:54:54 CST 2020
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
7 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/.gitignore:
--------------------------------------------------------------------------------
1 | build
2 | .cxx
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/consumer-rules.pro:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KwaiAppTeam/KOOM/f653d7c986debb242b1d8b96761351f63d9f04bf/koom-common/kwai-android-base/consumer-rules.pro
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/androidTest/java/com/kwai/android/base/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package com.kwai.android.base
2 |
3 | import androidx.test.platform.app.InstrumentationRegistry
4 | import androidx.test.ext.junit.runners.AndroidJUnit4
5 |
6 | import org.junit.Test
7 | import org.junit.runner.RunWith
8 |
9 | import org.junit.Assert.*
10 |
11 | /**
12 | * Instrumented test, which will execute on an Android device.
13 | *
14 | * See [testing documentation](http://d.android.com/tools/testing).
15 | */
16 | @RunWith(AndroidJUnit4::class)
17 | class ExampleInstrumentedTest {
18 | @Test
19 | fun useAppContext() {
20 | // Context of the app under test.
21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22 | assertEquals("com.kwai.android.base.test", appContext.packageName)
23 | }
24 | }
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/CPPLINT.cfg:
--------------------------------------------------------------------------------
1 | set noparent
2 | filter=-build/header_guard,-build/include,-build/c++11,-whitespace/operators
3 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/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) { return strerror(error_code); }
26 |
27 | } // namespace base
28 | } // namespace android
29 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/.clang-format:
--------------------------------------------------------------------------------
1 | # Run manually to reformat a file:
2 | # clang-format -i --style=file
3 | Language: Cpp
4 | BasedOnStyle: Google
5 | IndentPPDirectives: AfterHash
6 | IndentCaseLabels: false
7 | AlwaysBreakTemplateDeclarations: false
8 | DerivePointerAlignment: false
9 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/Android.bp:
--------------------------------------------------------------------------------
1 | cc_defaults {
2 | name: "fmtlib-defaults",
3 | srcs: ["src/format.cc"],
4 | cflags: [
5 | "-fno-exceptions",
6 | "-Wall",
7 | "-Werror",
8 | // If built without exceptions, libfmt uses assert.
9 | "-UNDEBUG",
10 | ],
11 | sanitize: {
12 | misc_undefined: ["integer"],
13 | },
14 | local_include_dirs: ["include"],
15 | export_include_dirs: ["include"],
16 | }
17 |
18 | // This is built into libbase. If you want to use this library, link to libbase instead.
19 | cc_library_static {
20 | name: "fmtlib",
21 | defaults: ["fmtlib-defaults"],
22 | vendor_available: true,
23 | ramdisk_available: true,
24 | recovery_available: true,
25 | host_supported: true,
26 | native_bridge_supported: true,
27 | target: {
28 | linux_bionic: {
29 | enabled: true,
30 | },
31 | windows: {
32 | enabled: true,
33 | },
34 | },
35 | apex_available: [
36 | "//apex_available:anyapex",
37 | "//apex_available:platform",
38 | ],
39 | min_sdk_version: "29",
40 | }
41 |
42 | cc_library_static {
43 | name: "fmtlib_ndk",
44 | defaults: ["fmtlib-defaults"],
45 | sdk_version: "current",
46 | stl: "c++_static",
47 | }
48 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | Contributing to {fmt}
2 | =====================
3 |
4 | By submitting a pull request or a patch, you represent that you have the right
5 | to license your contribution to the {fmt} project owners and the community,
6 | agree that your contributions are licensed under the {fmt} license, and agree
7 | to future changes to the licensing.
8 |
9 | All C++ code must adhere to [Google C++ Style Guide](
10 | https://google.github.io/styleguide/cppguide.html) with the following
11 | exceptions:
12 |
13 | * Exceptions are permitted
14 | * snake_case should be used instead of UpperCamelCase for function and type
15 | names
16 |
17 | Thanks for contributing!
18 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/METADATA:
--------------------------------------------------------------------------------
1 | name: "fmtlib"
2 | description: "{fmt} is an open-source formatting library for C++. It can be used as a safe and fast alternative to (s)printf and iostreams."
3 | third_party {
4 | url {
5 | type: HOMEPAGE
6 | value: "https://github.com/fmtlib/fmt"
7 | }
8 | url {
9 | type: GIT
10 | value: "https://github.com/fmtlib/fmt.git"
11 | }
12 | version: "7.0.1"
13 | license_type: NOTICE
14 | last_upgrade_date {
15 | year: 2020
16 | month: 7
17 | day: 10
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/MODULE_LICENSE_BSD:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KwaiAppTeam/KOOM/f653d7c986debb242b1d8b96761351f63d9f04bf/koom-common/kwai-android-base/src/main/cpp/fmtlib/MODULE_LICENSE_BSD
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/doc/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | find_program(DOXYGEN doxygen)
2 | if (NOT DOXYGEN)
3 | message(STATUS "Target 'doc' disabled (requires doxygen)")
4 | return ()
5 | endif ()
6 |
7 | add_custom_target(doc
8 | COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/build.py ${FMT_VERSION}
9 | SOURCES api.rst syntax.rst usage.rst build.py conf.py _templates/layout.html)
10 |
11 | install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/
12 | DESTINATION share/doc/fmt OPTIONAL
13 | PATTERN ".doctrees" EXCLUDE)
14 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/doc/_static/breathe.css:
--------------------------------------------------------------------------------
1 |
2 | /* -- breathe specific styles ----------------------------------------------- */
3 |
4 | /* So enum value descriptions are displayed inline to the item */
5 | .breatheenumvalues li tt + p {
6 | display: inline;
7 | }
8 |
9 | /* So parameter descriptions are displayed inline to the item */
10 | .breatheparameterlist li tt + p {
11 | display: inline;
12 | }
13 |
14 | .container .breathe-sectiondef {
15 | width: inherit;
16 | }
17 |
18 | .github-btn {
19 | border: 0;
20 | overflow: hidden;
21 | }
22 |
23 | .jumbotron {
24 | background-size: 100% 4px;
25 | background-repeat: repeat-y;
26 | color: white;
27 | text-align: center;
28 | }
29 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/doc/_static/fonts/glyphicons-halflings-regular.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KwaiAppTeam/KOOM/f653d7c986debb242b1d8b96761351f63d9f04bf/koom-common/kwai-android-base/src/main/cpp/fmtlib/doc/_static/fonts/glyphicons-halflings-regular.eot
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/doc/_static/fonts/glyphicons-halflings-regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KwaiAppTeam/KOOM/f653d7c986debb242b1d8b96761351f63d9f04bf/koom-common/kwai-android-base/src/main/cpp/fmtlib/doc/_static/fonts/glyphicons-halflings-regular.ttf
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/doc/_static/fonts/glyphicons-halflings-regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KwaiAppTeam/KOOM/f653d7c986debb242b1d8b96761351f63d9f04bf/koom-common/kwai-android-base/src/main/cpp/fmtlib/doc/_static/fonts/glyphicons-halflings-regular.woff
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/doc/basic-bootstrap/README:
--------------------------------------------------------------------------------
1 | Sphinx basic theme with Bootstrap support. Modifications are kept to
2 | a minimum to simplify integration in case of changes to Sphinx theming.
3 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/doc/basic-bootstrap/theme.conf:
--------------------------------------------------------------------------------
1 | [theme]
2 | inherit = basic
3 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/doc/bootstrap/bootstrap.less:
--------------------------------------------------------------------------------
1 | // Core variables and mixins
2 | @import "variables.less";
3 | @import "mixins.less";
4 |
5 | // Reset and dependencies
6 | @import "normalize.less";
7 | @import "print.less";
8 | @import "glyphicons.less";
9 |
10 | // Core CSS
11 | @import "scaffolding.less";
12 | @import "type.less";
13 | @import "code.less";
14 | @import "grid.less";
15 | @import "tables.less";
16 | @import "forms.less";
17 | @import "buttons.less";
18 |
19 | // Components
20 | @import "component-animations.less";
21 | @import "dropdowns.less";
22 | @import "button-groups.less";
23 | @import "input-groups.less";
24 | @import "navs.less";
25 | @import "navbar.less";
26 | @import "breadcrumbs.less";
27 | @import "pagination.less";
28 | @import "pager.less";
29 | @import "labels.less";
30 | @import "badges.less";
31 | @import "jumbotron.less";
32 | @import "thumbnails.less";
33 | @import "alerts.less";
34 | @import "progress-bars.less";
35 | @import "media.less";
36 | @import "list-group.less";
37 | @import "panels.less";
38 | @import "responsive-embed.less";
39 | @import "wells.less";
40 | @import "close.less";
41 |
42 | // Components w/ JavaScript
43 | @import "modals.less";
44 | @import "tooltip.less";
45 | @import "popovers.less";
46 | @import "carousel.less";
47 |
48 | // Utility classes
49 | @import "utilities.less";
50 | @import "responsive-utilities.less";
51 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/doc/bootstrap/breadcrumbs.less:
--------------------------------------------------------------------------------
1 | //
2 | // Breadcrumbs
3 | // --------------------------------------------------
4 |
5 |
6 | .breadcrumb {
7 | padding: @breadcrumb-padding-vertical @breadcrumb-padding-horizontal;
8 | margin-bottom: @line-height-computed;
9 | list-style: none;
10 | background-color: @breadcrumb-bg;
11 | border-radius: @border-radius-base;
12 |
13 | > li {
14 | display: inline-block;
15 |
16 | + li:before {
17 | content: "@{breadcrumb-separator}\00a0"; // Unicode space added since inline-block means non-collapsing white-space
18 | padding: 0 5px;
19 | color: @breadcrumb-color;
20 | }
21 | }
22 |
23 | > .active {
24 | color: @breadcrumb-active-color;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/doc/bootstrap/close.less:
--------------------------------------------------------------------------------
1 | //
2 | // Close icons
3 | // --------------------------------------------------
4 |
5 |
6 | .close {
7 | float: right;
8 | font-size: (@font-size-base * 1.5);
9 | font-weight: @close-font-weight;
10 | line-height: 1;
11 | color: @close-color;
12 | text-shadow: @close-text-shadow;
13 | .opacity(.2);
14 |
15 | &:hover,
16 | &:focus {
17 | color: @close-color;
18 | text-decoration: none;
19 | cursor: pointer;
20 | .opacity(.5);
21 | }
22 |
23 | // Additional properties for button version
24 | // iOS requires the button element instead of an anchor tag.
25 | // If you want the anchor version, it requires `href="#"`.
26 | // See https://developer.mozilla.org/en-US/docs/Web/Events/click#Safari_Mobile
27 | button& {
28 | padding: 0;
29 | cursor: pointer;
30 | background: transparent;
31 | border: 0;
32 | -webkit-appearance: none;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/doc/bootstrap/component-animations.less:
--------------------------------------------------------------------------------
1 | //
2 | // Component animations
3 | // --------------------------------------------------
4 |
5 | // Heads up!
6 | //
7 | // We don't use the `.opacity()` mixin here since it causes a bug with text
8 | // fields in IE7-8. Source: https://github.com/twbs/bootstrap/pull/3552.
9 |
10 | .fade {
11 | opacity: 0;
12 | .transition(opacity .15s linear);
13 | &.in {
14 | opacity: 1;
15 | }
16 | }
17 |
18 | .collapse {
19 | display: none;
20 |
21 | &.in { display: block; }
22 | tr&.in { display: table-row; }
23 | tbody&.in { display: table-row-group; }
24 | }
25 |
26 | .collapsing {
27 | position: relative;
28 | height: 0;
29 | overflow: hidden;
30 | .transition-property(~"height, visibility");
31 | .transition-duration(.35s);
32 | .transition-timing-function(ease);
33 | }
34 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/doc/bootstrap/jumbotron.less:
--------------------------------------------------------------------------------
1 | //
2 | // Jumbotron
3 | // --------------------------------------------------
4 |
5 |
6 | .jumbotron {
7 | padding: @jumbotron-padding (@jumbotron-padding / 2);
8 | margin-bottom: @jumbotron-padding;
9 | color: @jumbotron-color;
10 | background-color: @jumbotron-bg;
11 |
12 | h1,
13 | .h1 {
14 | color: @jumbotron-heading-color;
15 | }
16 |
17 | p {
18 | margin-bottom: (@jumbotron-padding / 2);
19 | font-size: @jumbotron-font-size;
20 | font-weight: 200;
21 | }
22 |
23 | > hr {
24 | border-top-color: darken(@jumbotron-bg, 10%);
25 | }
26 |
27 | .tb-container &,
28 | .container-fluid & {
29 | border-radius: @border-radius-large; // Only round corners at higher resolutions if contained in a container
30 | }
31 |
32 | .tb-container {
33 | max-width: 100%;
34 | }
35 |
36 | @media screen and (min-width: @screen-sm-min) {
37 | padding: (@jumbotron-padding * 1.6) 0;
38 |
39 | .tb-container &,
40 | .container-fluid & {
41 | padding-left: (@jumbotron-padding * 2);
42 | padding-right: (@jumbotron-padding * 2);
43 | }
44 |
45 | h1,
46 | .h1 {
47 | font-size: (@font-size-base * 4.5);
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/doc/bootstrap/labels.less:
--------------------------------------------------------------------------------
1 | //
2 | // Labels
3 | // --------------------------------------------------
4 |
5 | .label {
6 | display: inline;
7 | padding: .2em .6em .3em;
8 | font-size: 75%;
9 | font-weight: bold;
10 | line-height: 1;
11 | color: @label-color;
12 | text-align: center;
13 | white-space: nowrap;
14 | vertical-align: baseline;
15 | border-radius: .25em;
16 |
17 | // Add hover effects, but only for links
18 | a& {
19 | &:hover,
20 | &:focus {
21 | color: @label-link-hover-color;
22 | text-decoration: none;
23 | cursor: pointer;
24 | }
25 | }
26 |
27 | // Empty labels collapse automatically (not available in IE8)
28 | &:empty {
29 | display: none;
30 | }
31 |
32 | // Quick fix for labels in buttons
33 | .btn & {
34 | position: relative;
35 | top: -1px;
36 | }
37 | }
38 |
39 | // Colors
40 | // Contextual variations (linked labels get darker on :hover)
41 |
42 | .label-default {
43 | .label-variant(@label-default-bg);
44 | }
45 |
46 | .label-primary {
47 | .label-variant(@label-primary-bg);
48 | }
49 |
50 | .label-success {
51 | .label-variant(@label-success-bg);
52 | }
53 |
54 | .label-info {
55 | .label-variant(@label-info-bg);
56 | }
57 |
58 | .label-warning {
59 | .label-variant(@label-warning-bg);
60 | }
61 |
62 | .label-danger {
63 | .label-variant(@label-danger-bg);
64 | }
65 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/doc/bootstrap/media.less:
--------------------------------------------------------------------------------
1 | .media {
2 | // Proper spacing between instances of .media
3 | margin-top: 15px;
4 |
5 | &:first-child {
6 | margin-top: 0;
7 | }
8 | }
9 |
10 | .media,
11 | .media-body {
12 | zoom: 1;
13 | overflow: hidden;
14 | }
15 |
16 | .media-body {
17 | width: 10000px;
18 | }
19 |
20 | .media-object {
21 | display: block;
22 | }
23 |
24 | .media-right,
25 | .media > .pull-right {
26 | padding-left: 10px;
27 | }
28 |
29 | .media-left,
30 | .media > .pull-left {
31 | padding-right: 10px;
32 | }
33 |
34 | .media-left,
35 | .media-right,
36 | .media-body {
37 | display: table-cell;
38 | vertical-align: top;
39 | }
40 |
41 | .media-middle {
42 | vertical-align: middle;
43 | }
44 |
45 | .media-bottom {
46 | vertical-align: bottom;
47 | }
48 |
49 | // Reset margins on headings for tighter default spacing
50 | .media-heading {
51 | margin-top: 0;
52 | margin-bottom: 5px;
53 | }
54 |
55 | // Media list variation
56 | //
57 | // Undo default ul/ol styles
58 | .media-list {
59 | padding-left: 0;
60 | list-style: none;
61 | }
62 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/doc/bootstrap/mixins.less:
--------------------------------------------------------------------------------
1 | // Mixins
2 | // --------------------------------------------------
3 |
4 | // Utilities
5 | @import "mixins/hide-text.less";
6 | @import "mixins/opacity.less";
7 | @import "mixins/image.less";
8 | @import "mixins/labels.less";
9 | @import "mixins/reset-filter.less";
10 | @import "mixins/resize.less";
11 | @import "mixins/responsive-visibility.less";
12 | @import "mixins/size.less";
13 | @import "mixins/tab-focus.less";
14 | @import "mixins/text-emphasis.less";
15 | @import "mixins/text-overflow.less";
16 | @import "mixins/vendor-prefixes.less";
17 |
18 | // Components
19 | @import "mixins/alerts.less";
20 | @import "mixins/buttons.less";
21 | @import "mixins/panels.less";
22 | @import "mixins/pagination.less";
23 | @import "mixins/list-group.less";
24 | @import "mixins/nav-divider.less";
25 | @import "mixins/forms.less";
26 | @import "mixins/progress-bar.less";
27 | @import "mixins/table-row.less";
28 |
29 | // Skins
30 | @import "mixins/background-variant.less";
31 | @import "mixins/border-radius.less";
32 | @import "mixins/gradients.less";
33 |
34 | // Layout
35 | @import "mixins/clearfix.less";
36 | @import "mixins/center-block.less";
37 | @import "mixins/nav-vertical-align.less";
38 | @import "mixins/grid-framework.less";
39 | @import "mixins/grid.less";
40 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/doc/bootstrap/mixins/alerts.less:
--------------------------------------------------------------------------------
1 | // Alerts
2 |
3 | .alert-variant(@background; @border; @text-color) {
4 | background-color: @background;
5 | border-color: @border;
6 | color: @text-color;
7 |
8 | hr {
9 | border-top-color: darken(@border, 5%);
10 | }
11 | .alert-link {
12 | color: darken(@text-color, 10%);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/doc/bootstrap/mixins/background-variant.less:
--------------------------------------------------------------------------------
1 | // Contextual backgrounds
2 |
3 | .bg-variant(@color) {
4 | background-color: @color;
5 | a&:hover {
6 | background-color: darken(@color, 10%);
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/doc/bootstrap/mixins/border-radius.less:
--------------------------------------------------------------------------------
1 | // Single side border-radius
2 |
3 | .border-top-radius(@radius) {
4 | border-top-right-radius: @radius;
5 | border-top-left-radius: @radius;
6 | }
7 | .border-right-radius(@radius) {
8 | border-bottom-right-radius: @radius;
9 | border-top-right-radius: @radius;
10 | }
11 | .border-bottom-radius(@radius) {
12 | border-bottom-right-radius: @radius;
13 | border-bottom-left-radius: @radius;
14 | }
15 | .border-left-radius(@radius) {
16 | border-bottom-left-radius: @radius;
17 | border-top-left-radius: @radius;
18 | }
19 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/doc/bootstrap/mixins/buttons.less:
--------------------------------------------------------------------------------
1 | // Button variants
2 | //
3 | // Easily pump out default styles, as well as :hover, :focus, :active,
4 | // and disabled options for all buttons
5 |
6 | .button-variant(@color; @background; @border) {
7 | color: @color;
8 | background-color: @background;
9 | border-color: @border;
10 |
11 | &:hover,
12 | &:focus,
13 | &.focus,
14 | &:active,
15 | &.active,
16 | .open > .dropdown-toggle& {
17 | color: @color;
18 | background-color: darken(@background, 10%);
19 | border-color: darken(@border, 12%);
20 | }
21 | &:active,
22 | &.active,
23 | .open > .dropdown-toggle& {
24 | background-image: none;
25 | }
26 | &.disabled,
27 | &[disabled],
28 | fieldset[disabled] & {
29 | &,
30 | &:hover,
31 | &:focus,
32 | &.focus,
33 | &:active,
34 | &.active {
35 | background-color: @background;
36 | border-color: @border;
37 | }
38 | }
39 |
40 | .badge {
41 | color: @background;
42 | background-color: @color;
43 | }
44 | }
45 |
46 | // Button sizes
47 | .button-size(@padding-vertical; @padding-horizontal; @font-size; @line-height; @border-radius) {
48 | padding: @padding-vertical @padding-horizontal;
49 | font-size: @font-size;
50 | line-height: @line-height;
51 | border-radius: @border-radius;
52 | }
53 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/doc/bootstrap/mixins/center-block.less:
--------------------------------------------------------------------------------
1 | // Center-align a block level element
2 |
3 | .center-block() {
4 | display: block;
5 | margin-left: auto;
6 | margin-right: auto;
7 | }
8 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/doc/bootstrap/mixins/clearfix.less:
--------------------------------------------------------------------------------
1 | // Clearfix
2 | //
3 | // For modern browsers
4 | // 1. The space content is one way to avoid an Opera bug when the
5 | // contenteditable attribute is included anywhere else in the document.
6 | // Otherwise it causes space to appear at the top and bottom of elements
7 | // that are clearfixed.
8 | // 2. The use of `table` rather than `block` is only necessary if using
9 | // `:before` to contain the top-margins of child elements.
10 | //
11 | // Source: http://nicolasgallagher.com/micro-clearfix-hack/
12 |
13 | .clearfix() {
14 | &:before,
15 | &:after {
16 | content: " "; // 1
17 | display: table; // 2
18 | }
19 | &:after {
20 | clear: both;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/doc/bootstrap/mixins/hide-text.less:
--------------------------------------------------------------------------------
1 | // CSS image replacement
2 | //
3 | // Heads up! v3 launched with with only `.hide-text()`, but per our pattern for
4 | // mixins being reused as classes with the same name, this doesn't hold up. As
5 | // of v3.0.1 we have added `.text-hide()` and deprecated `.hide-text()`.
6 | //
7 | // Source: https://github.com/h5bp/html5-boilerplate/commit/aa0396eae757
8 |
9 | // Deprecated as of v3.0.1 (will be removed in v4)
10 | .hide-text() {
11 | font: ~"0/0" a;
12 | color: transparent;
13 | text-shadow: none;
14 | background-color: transparent;
15 | border: 0;
16 | }
17 |
18 | // New mixin to use as of v3.0.1
19 | .text-hide() {
20 | .hide-text();
21 | }
22 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/doc/bootstrap/mixins/image.less:
--------------------------------------------------------------------------------
1 | // Image Mixins
2 | // - Responsive image
3 | // - Retina image
4 |
5 |
6 | // Responsive image
7 | //
8 | // Keep images from scaling beyond the width of their parents.
9 | .img-responsive(@display: block) {
10 | display: @display;
11 | max-width: 100%; // Part 1: Set a maximum relative to the parent
12 | height: auto; // Part 2: Scale the height according to the width, otherwise you get stretching
13 | }
14 |
15 |
16 | // Retina image
17 | //
18 | // Short retina mixin for setting background-image and -size. Note that the
19 | // spelling of `min--moz-device-pixel-ratio` is intentional.
20 | .img-retina(@file-1x; @file-2x; @width-1x; @height-1x) {
21 | background-image: url("@{file-1x}");
22 |
23 | @media
24 | only screen and (-webkit-min-device-pixel-ratio: 2),
25 | only screen and ( min--moz-device-pixel-ratio: 2),
26 | only screen and ( -o-min-device-pixel-ratio: 2/1),
27 | only screen and ( min-device-pixel-ratio: 2),
28 | only screen and ( min-resolution: 192dpi),
29 | only screen and ( min-resolution: 2dppx) {
30 | background-image: url("@{file-2x}");
31 | background-size: @width-1x @height-1x;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/doc/bootstrap/mixins/labels.less:
--------------------------------------------------------------------------------
1 | // Labels
2 |
3 | .label-variant(@color) {
4 | background-color: @color;
5 |
6 | &[href] {
7 | &:hover,
8 | &:focus {
9 | background-color: darken(@color, 10%);
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/doc/bootstrap/mixins/list-group.less:
--------------------------------------------------------------------------------
1 | // List Groups
2 |
3 | .list-group-item-variant(@state; @background; @color) {
4 | .list-group-item-@{state} {
5 | color: @color;
6 | background-color: @background;
7 |
8 | a& {
9 | color: @color;
10 |
11 | .list-group-item-heading {
12 | color: inherit;
13 | }
14 |
15 | &:hover,
16 | &:focus {
17 | color: @color;
18 | background-color: darken(@background, 5%);
19 | }
20 | &.active,
21 | &.active:hover,
22 | &.active:focus {
23 | color: #fff;
24 | background-color: @color;
25 | border-color: @color;
26 | }
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/doc/bootstrap/mixins/nav-divider.less:
--------------------------------------------------------------------------------
1 | // Horizontal dividers
2 | //
3 | // Dividers (basically an hr) within dropdowns and nav lists
4 |
5 | .nav-divider(@color: #e5e5e5) {
6 | height: 1px;
7 | margin: ((@line-height-computed / 2) - 1) 0;
8 | overflow: hidden;
9 | background-color: @color;
10 | }
11 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/doc/bootstrap/mixins/nav-vertical-align.less:
--------------------------------------------------------------------------------
1 | // Navbar vertical align
2 | //
3 | // Vertically center elements in the navbar.
4 | // Example: an element has a height of 30px, so write out `.navbar-vertical-align(30px);` to calculate the appropriate top margin.
5 |
6 | .navbar-vertical-align(@element-height) {
7 | margin-top: ((@navbar-height - @element-height) / 2);
8 | margin-bottom: ((@navbar-height - @element-height) / 2);
9 | }
10 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/doc/bootstrap/mixins/opacity.less:
--------------------------------------------------------------------------------
1 | // Opacity
2 |
3 | .opacity(@opacity) {
4 | opacity: @opacity;
5 | // IE8 filter
6 | @opacity-ie: (@opacity * 100);
7 | filter: ~"alpha(opacity=@{opacity-ie})";
8 | }
9 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/doc/bootstrap/mixins/pagination.less:
--------------------------------------------------------------------------------
1 | // Pagination
2 |
3 | .pagination-size(@padding-vertical; @padding-horizontal; @font-size; @border-radius) {
4 | > li {
5 | > a,
6 | > span {
7 | padding: @padding-vertical @padding-horizontal;
8 | font-size: @font-size;
9 | }
10 | &:first-child {
11 | > a,
12 | > span {
13 | .border-left-radius(@border-radius);
14 | }
15 | }
16 | &:last-child {
17 | > a,
18 | > span {
19 | .border-right-radius(@border-radius);
20 | }
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/doc/bootstrap/mixins/panels.less:
--------------------------------------------------------------------------------
1 | // Panels
2 |
3 | .panel-variant(@border; @heading-text-color; @heading-bg-color; @heading-border) {
4 | border-color: @border;
5 |
6 | & > .panel-heading {
7 | color: @heading-text-color;
8 | background-color: @heading-bg-color;
9 | border-color: @heading-border;
10 |
11 | + .panel-collapse > .panel-body {
12 | border-top-color: @border;
13 | }
14 | .badge {
15 | color: @heading-bg-color;
16 | background-color: @heading-text-color;
17 | }
18 | }
19 | & > .panel-footer {
20 | + .panel-collapse > .panel-body {
21 | border-bottom-color: @border;
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/doc/bootstrap/mixins/progress-bar.less:
--------------------------------------------------------------------------------
1 | // Progress bars
2 |
3 | .progress-bar-variant(@color) {
4 | background-color: @color;
5 |
6 | // Deprecated parent class requirement as of v3.2.0
7 | .progress-striped & {
8 | #gradient > .striped();
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/doc/bootstrap/mixins/reset-filter.less:
--------------------------------------------------------------------------------
1 | // Reset filters for IE
2 | //
3 | // When you need to remove a gradient background, do not forget to use this to reset
4 | // the IE filter for IE9 and below.
5 |
6 | .reset-filter() {
7 | filter: e(%("progid:DXImageTransform.Microsoft.gradient(enabled = false)"));
8 | }
9 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/doc/bootstrap/mixins/resize.less:
--------------------------------------------------------------------------------
1 | // Resize anything
2 |
3 | .resizable(@direction) {
4 | resize: @direction; // Options: horizontal, vertical, both
5 | overflow: auto; // Per CSS3 UI, `resize` only applies when `overflow` isn't `visible`
6 | }
7 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/doc/bootstrap/mixins/responsive-visibility.less:
--------------------------------------------------------------------------------
1 | // Responsive utilities
2 |
3 | //
4 | // More easily include all the states for responsive-utilities.less.
5 | .responsive-visibility() {
6 | display: block !important;
7 | table& { display: table; }
8 | tr& { display: table-row !important; }
9 | th&,
10 | td& { display: table-cell !important; }
11 | }
12 |
13 | .responsive-invisibility() {
14 | display: none !important;
15 | }
16 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/doc/bootstrap/mixins/size.less:
--------------------------------------------------------------------------------
1 | // Sizing shortcuts
2 |
3 | .size(@width; @height) {
4 | width: @width;
5 | height: @height;
6 | }
7 |
8 | .square(@size) {
9 | .size(@size; @size);
10 | }
11 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/doc/bootstrap/mixins/tab-focus.less:
--------------------------------------------------------------------------------
1 | // WebKit-style focus
2 |
3 | .tab-focus() {
4 | // Default
5 | outline: thin dotted;
6 | // WebKit
7 | outline: 5px auto -webkit-focus-ring-color;
8 | outline-offset: -2px;
9 | }
10 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/doc/bootstrap/mixins/table-row.less:
--------------------------------------------------------------------------------
1 | // Tables
2 |
3 | .table-row-variant(@state; @background) {
4 | // Exact selectors below required to override `.table-striped` and prevent
5 | // inheritance to nested tables.
6 | .table > thead > tr,
7 | .table > tbody > tr,
8 | .table > tfoot > tr {
9 | > td.@{state},
10 | > th.@{state},
11 | &.@{state} > td,
12 | &.@{state} > th {
13 | background-color: @background;
14 | }
15 | }
16 |
17 | // Hover states for `.table-hover`
18 | // Note: this is not available for cells or rows within `thead` or `tfoot`.
19 | .table-hover > tbody > tr {
20 | > td.@{state}:hover,
21 | > th.@{state}:hover,
22 | &.@{state}:hover > td,
23 | &:hover > .@{state},
24 | &.@{state}:hover > th {
25 | background-color: darken(@background, 5%);
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/doc/bootstrap/mixins/text-emphasis.less:
--------------------------------------------------------------------------------
1 | // Typography
2 |
3 | .text-emphasis-variant(@color) {
4 | color: @color;
5 | a&:hover {
6 | color: darken(@color, 10%);
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/doc/bootstrap/mixins/text-overflow.less:
--------------------------------------------------------------------------------
1 | // Text overflow
2 | // Requires inline-block or block for proper styling
3 |
4 | .text-overflow() {
5 | overflow: hidden;
6 | text-overflow: ellipsis;
7 | white-space: nowrap;
8 | }
9 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/doc/bootstrap/pager.less:
--------------------------------------------------------------------------------
1 | //
2 | // Pager pagination
3 | // --------------------------------------------------
4 |
5 |
6 | .pager {
7 | padding-left: 0;
8 | margin: @line-height-computed 0;
9 | list-style: none;
10 | text-align: center;
11 | &:extend(.clearfix all);
12 | li {
13 | display: inline;
14 | > a,
15 | > span {
16 | display: inline-block;
17 | padding: 5px 14px;
18 | background-color: @pager-bg;
19 | border: 1px solid @pager-border;
20 | border-radius: @pager-border-radius;
21 | }
22 |
23 | > a:hover,
24 | > a:focus {
25 | text-decoration: none;
26 | background-color: @pager-hover-bg;
27 | }
28 | }
29 |
30 | .next {
31 | > a,
32 | > span {
33 | float: right;
34 | }
35 | }
36 |
37 | .previous {
38 | > a,
39 | > span {
40 | float: left;
41 | }
42 | }
43 |
44 | .disabled {
45 | > a,
46 | > a:hover,
47 | > a:focus,
48 | > span {
49 | color: @pager-disabled-color;
50 | background-color: @pager-bg;
51 | cursor: @cursor-disabled;
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/doc/bootstrap/responsive-embed.less:
--------------------------------------------------------------------------------
1 | // Embeds responsive
2 | //
3 | // Credit: Nicolas Gallagher and SUIT CSS.
4 |
5 | .embed-responsive {
6 | position: relative;
7 | display: block;
8 | height: 0;
9 | padding: 0;
10 | overflow: hidden;
11 |
12 | .embed-responsive-item,
13 | iframe,
14 | embed,
15 | object,
16 | video {
17 | position: absolute;
18 | top: 0;
19 | left: 0;
20 | bottom: 0;
21 | height: 100%;
22 | width: 100%;
23 | border: 0;
24 | }
25 | }
26 |
27 | // Modifier class for 16:9 aspect ratio
28 | .embed-responsive-16by9 {
29 | padding-bottom: 56.25%;
30 | }
31 |
32 | // Modifier class for 4:3 aspect ratio
33 | .embed-responsive-4by3 {
34 | padding-bottom: 75%;
35 | }
36 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/doc/bootstrap/thumbnails.less:
--------------------------------------------------------------------------------
1 | //
2 | // Thumbnails
3 | // --------------------------------------------------
4 |
5 |
6 | // Mixin and adjust the regular image class
7 | .thumbnail {
8 | display: block;
9 | padding: @thumbnail-padding;
10 | margin-bottom: @line-height-computed;
11 | line-height: @line-height-base;
12 | background-color: @thumbnail-bg;
13 | border: 1px solid @thumbnail-border;
14 | border-radius: @thumbnail-border-radius;
15 | .transition(border .2s ease-in-out);
16 |
17 | > img,
18 | a > img {
19 | &:extend(.img-responsive);
20 | margin-left: auto;
21 | margin-right: auto;
22 | }
23 |
24 | // Add a hover state for linked versions only
25 | a&:hover,
26 | a&:focus,
27 | a&.active {
28 | border-color: @link-color;
29 | }
30 |
31 | // Image captions
32 | .caption {
33 | padding: @thumbnail-caption-padding;
34 | color: @thumbnail-caption-color;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/doc/bootstrap/utilities.less:
--------------------------------------------------------------------------------
1 | //
2 | // Utility classes
3 | // --------------------------------------------------
4 |
5 |
6 | // Floats
7 | // -------------------------
8 |
9 | .clearfix {
10 | .clearfix();
11 | }
12 | .center-block {
13 | .center-block();
14 | }
15 | .pull-right {
16 | float: right !important;
17 | }
18 | .pull-left {
19 | float: left !important;
20 | }
21 |
22 |
23 | // Toggling content
24 | // -------------------------
25 |
26 | // Note: Deprecated .hide in favor of .hidden or .sr-only (as appropriate) in v3.0.1
27 | .hide {
28 | display: none !important;
29 | }
30 | .show {
31 | display: block !important;
32 | }
33 | .invisible {
34 | visibility: hidden;
35 | }
36 | .text-hide {
37 | .text-hide();
38 | }
39 |
40 |
41 | // Hide from screenreaders and browsers
42 | //
43 | // Credit: HTML5 Boilerplate
44 |
45 | .hidden {
46 | display: none !important;
47 | }
48 |
49 |
50 | // For Affix plugin
51 | // -------------------------
52 |
53 | .affix {
54 | position: fixed;
55 | }
56 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/doc/bootstrap/wells.less:
--------------------------------------------------------------------------------
1 | //
2 | // Wells
3 | // --------------------------------------------------
4 |
5 |
6 | // Base class
7 | .well {
8 | min-height: 20px;
9 | padding: 19px;
10 | margin-bottom: 20px;
11 | background-color: @well-bg;
12 | border: 1px solid @well-border;
13 | border-radius: @border-radius-base;
14 | .box-shadow(inset 0 1px 1px rgba(0,0,0,.05));
15 | blockquote {
16 | border-color: #ddd;
17 | border-color: rgba(0,0,0,.15);
18 | }
19 | }
20 |
21 | // Sizes
22 | .well-lg {
23 | padding: 24px;
24 | border-radius: @border-radius-large;
25 | }
26 | .well-sm {
27 | padding: 9px;
28 | border-radius: @border-radius-small;
29 | }
30 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/doc/contents.rst:
--------------------------------------------------------------------------------
1 | ########
2 | Contents
3 | ########
4 |
5 | .. toctree::
6 | :maxdepth: 2
7 |
8 | usage
9 | api
10 | syntax
11 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/include/fmt/posix.h:
--------------------------------------------------------------------------------
1 | #include "os.h"
2 | #warning "fmt/posix.h is deprecated; use fmt/os.h instead"
3 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/support/Android.mk:
--------------------------------------------------------------------------------
1 | # The Android.mk provided by the upstream fmtlib repository is for use with the
2 | # NDK and is not appropriate for the platform build. When integrating changes
3 | # from upstream, omit their Android.mk and leave the existing Android.bp
4 | # instead.
5 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/support/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/support/README:
--------------------------------------------------------------------------------
1 | This directory contains build support files such as
2 |
3 | * CMake modules
4 | * Build scripts
5 | * qmake (static build with dynamic libc only)
6 |
7 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/support/Vagrantfile:
--------------------------------------------------------------------------------
1 | # -*- mode: ruby -*-
2 | # vi: set ft=ruby :
3 |
4 | # A vagrant config for testing against gcc-4.8.
5 | Vagrant.configure("2") do |config|
6 | config.vm.box = "ubuntu/xenial64"
7 | config.disksize.size = '15GB'
8 |
9 | config.vm.provider "virtualbox" do |vb|
10 | vb.memory = "4096"
11 | end
12 |
13 | config.vm.provision "shell", inline: <<-SHELL
14 | apt-get update
15 | apt-get install -y g++ make wget git
16 | wget -q https://github.com/Kitware/CMake/releases/download/v3.14.4/cmake-3.14.4-Linux-x86_64.tar.gz
17 | tar xzf cmake-3.14.4-Linux-x86_64.tar.gz
18 | ln -s `pwd`/cmake-3.14.4-Linux-x86_64/bin/cmake /usr/local/bin
19 | SHELL
20 | end
21 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/support/appveyor.yml:
--------------------------------------------------------------------------------
1 | configuration:
2 | - Debug
3 | - Release
4 |
5 | clone_depth: 1
6 |
7 | image:
8 | - Visual Studio 2015
9 | - Visual Studio 2019
10 | - Visual Studio 2017
11 |
12 | platform:
13 | - Win32
14 | - x64
15 |
16 | environment:
17 | CTEST_OUTPUT_ON_FAILURE: 1
18 | MSVC_DEFAULT_OPTIONS: ON
19 | BUILD: msvc
20 |
21 | matrix:
22 | exclude:
23 | - image: Visual Studio 2015
24 | platform: Win32
25 | - image: Visual Studio 2019
26 | platform: Win32
27 |
28 | before_build:
29 | - mkdir build
30 | - cd build
31 |
32 | build_script:
33 | - python ../support/appveyor-build.py
34 |
35 | on_failure:
36 | - appveyor PushArtifact Testing/Temporary/LastTest.log
37 | - appveyor AddTest test
38 |
39 | # Uncomment this to debug AppVeyor failures.
40 | #on_finish:
41 | # - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
42 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/support/cmake/FindSetEnv.cmake:
--------------------------------------------------------------------------------
1 | # A CMake script to find SetEnv.cmd.
2 |
3 | find_program(WINSDK_SETENV NAMES SetEnv.cmd
4 | PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]/bin")
5 | if (WINSDK_SETENV AND PRINT_PATH)
6 | execute_process(COMMAND ${CMAKE_COMMAND} -E echo "${WINSDK_SETENV}")
7 | endif ()
8 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/support/cmake/JoinPaths.cmake:
--------------------------------------------------------------------------------
1 | # This module provides function for joining paths
2 | # known from from most languages
3 | #
4 | # Original license:
5 | # SPDX-License-Identifier: (MIT OR CC0-1.0)
6 | # Explicit permission given to distribute this module under
7 | # the terms of the project as described in /LICENSE.rst.
8 | # Copyright 2020 Jan Tojnar
9 | # https://github.com/jtojnar/cmake-snips
10 | #
11 | # Modelled after Python’s os.path.join
12 | # https://docs.python.org/3.7/library/os.path.html#os.path.join
13 | # Windows not supported
14 | function(join_paths joined_path first_path_segment)
15 | set(temp_path "${first_path_segment}")
16 | foreach(current_segment IN LISTS ARGN)
17 | if(NOT ("${current_segment}" STREQUAL ""))
18 | if(IS_ABSOLUTE "${current_segment}")
19 | set(temp_path "${current_segment}")
20 | else()
21 | set(temp_path "${temp_path}/${current_segment}")
22 | endif()
23 | endif()
24 | endforeach()
25 | set(${joined_path} "${temp_path}" PARENT_SCOPE)
26 | endfunction()
27 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/support/cmake/fmt-config.cmake.in:
--------------------------------------------------------------------------------
1 | @PACKAGE_INIT@
2 |
3 | include(${CMAKE_CURRENT_LIST_DIR}/@targets_export_name@.cmake)
4 | check_required_components(fmt)
5 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/support/cmake/fmt.pc.in:
--------------------------------------------------------------------------------
1 | prefix=@CMAKE_INSTALL_PREFIX@
2 | exec_prefix=@CMAKE_INSTALL_PREFIX@
3 | libdir=@libdir_for_pc_file@
4 | includedir=@includedir_for_pc_file@
5 |
6 | Name: fmt
7 | Description: A modern formatting library
8 | Version: @FMT_VERSION@
9 | Libs: -L${libdir} -l@FMT_LIB_NAME@
10 | Cflags: -I${includedir}
11 |
12 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/support/fmt.pro:
--------------------------------------------------------------------------------
1 | # Staticlib configuration for qmake builds
2 | # For some reason qmake 3.1 fails to identify source dependencies and excludes format.cc and printf.cc
3 | # from compilation so it _MUST_ be called as qmake -nodepend
4 | # A workaround is implemented below: a custom compiler is defined which does not track dependencies
5 |
6 | TEMPLATE = lib
7 |
8 | TARGET = fmt
9 |
10 | QMAKE_EXT_CPP = .cc
11 |
12 | CONFIG = staticlib warn_on c++11
13 |
14 | FMT_SOURCES = \
15 | ../src/format.cc \
16 | ../src/posix.cc
17 |
18 | fmt.name = libfmt
19 | fmt.input = FMT_SOURCES
20 | fmt.output = ${QMAKE_FILE_BASE}$$QMAKE_EXT_OBJ
21 | fmt.clean = ${QMAKE_FILE_BASE}$$QMAKE_EXT_OBJ
22 | fmt.depends = ${QMAKE_FILE_IN}
23 | # QMAKE_RUN_CXX will not be expanded
24 | fmt.commands = $$QMAKE_CXX -c $$QMAKE_CXXFLAGS $$QMAKE_CXXFLAGS_WARN_ON $$QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO $$QMAKE_CXXFLAGS_CXX11 ${QMAKE_FILE_IN}
25 | fmt.variable_out = OBJECTS
26 | fmt.CONFIG = no_dependencies no_link
27 | QMAKE_EXTRA_COMPILERS += fmt
28 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/support/rtd/conf.py:
--------------------------------------------------------------------------------
1 | # Sphinx configuration for readthedocs.
2 |
3 | import os, sys
4 |
5 | master_doc = 'index'
6 | html_theme = 'theme'
7 | html_theme_path = ["."]
8 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/support/rtd/index.rst:
--------------------------------------------------------------------------------
1 | If you are not redirected automatically, follow the
2 | `link to the fmt documentation `_.
3 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/support/rtd/theme/layout.html:
--------------------------------------------------------------------------------
1 | {% extends "basic/layout.html" %}
2 |
3 | {% block extrahead %}
4 |
5 |
6 |
9 | Page Redirection
10 | {% endblock %}
11 |
12 | {% block document %}
13 | If you are not redirected automatically, follow the link to the fmt documentation.
14 | {% endblock %}
15 |
16 | {% block footer %}
17 | {% endblock %}
18 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/support/rtd/theme/theme.conf:
--------------------------------------------------------------------------------
1 | [theme]
2 | inherit = basic
3 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/support/update-coverity-branch.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # Update the coverity branch from the master branch.
3 | # It is not done automatically because Coverity Scan limits
4 | # the number of submissions per day.
5 |
6 | from __future__ import print_function
7 | import shutil, tempfile
8 | from subprocess import check_output, STDOUT
9 |
10 | class Git:
11 | def __init__(self, dir):
12 | self.dir = dir
13 |
14 | def __call__(self, *args):
15 | output = check_output(['git'] + list(args), cwd=self.dir, stderr=STDOUT)
16 | print(output)
17 | return output
18 |
19 | dir = tempfile.mkdtemp()
20 | try:
21 | git = Git(dir)
22 | git('clone', '-b', 'coverity', 'git@github.com:fmtlib/fmt.git', dir)
23 | output = git('merge', '-X', 'theirs', '--no-commit', 'origin/master')
24 | if 'Fast-forward' not in output:
25 | git('reset', 'HEAD', '.travis.yml')
26 | git('checkout', '--', '.travis.yml')
27 | git('commit', '-m', 'Update coverity branch')
28 | git('push')
29 | finally:
30 | shutil.rmtree(dir)
31 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/test/add-subdirectory-test/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.1.0)
2 |
3 | project(fmt-test)
4 |
5 | add_subdirectory(../.. fmt)
6 |
7 | add_executable(library-test "main.cc")
8 | target_link_libraries(library-test fmt::fmt)
9 | target_compile_options(library-test PRIVATE ${PEDANTIC_COMPILE_FLAGS})
10 | target_include_directories(library-test PUBLIC SYSTEM .)
11 |
12 | if (TARGET fmt::fmt-header-only)
13 | add_executable(header-only-test "main.cc")
14 | target_link_libraries(header-only-test fmt::fmt-header-only)
15 | target_compile_options(header-only-test PRIVATE ${PEDANTIC_COMPILE_FLAGS})
16 | target_include_directories(header-only-test PUBLIC SYSTEM .)
17 | endif ()
18 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/test/add-subdirectory-test/main.cc:
--------------------------------------------------------------------------------
1 | #include "fmt/format.h"
2 |
3 | int main(int argc, char** argv) {
4 | for(int i = 0; i < argc; ++i)
5 | fmt::print("{}: {}\n", i, argv[i]);
6 | }
7 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/test/assert-test.cc:
--------------------------------------------------------------------------------
1 | // Formatting library for C++ - assertion tests
2 | //
3 | // Copyright (c) 2012 - present, Victor Zverovich
4 | // All rights reserved.
5 | //
6 | // For the license information refer to format.h.
7 |
8 | #include "fmt/core.h"
9 | #include "gtest.h"
10 |
11 | TEST(AssertTest, Fail) {
12 | #if GTEST_HAS_DEATH_TEST
13 | EXPECT_DEBUG_DEATH(FMT_ASSERT(false, "don't panic!"), "don't panic!");
14 | #else
15 | fmt::print("warning: death tests are not supported\n");
16 | #endif
17 | }
18 |
19 | bool test_condition = false;
20 |
21 | TEST(AssertTest, DanglingElse) {
22 | bool executed_else = false;
23 | if (test_condition)
24 | FMT_ASSERT(true, "");
25 | else
26 | executed_else = true;
27 | EXPECT_TRUE(executed_else);
28 | }
29 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/test/cuda-test/cpp14.cc:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | // The purpose of this part is to ensure NVCC's host compiler also supports
4 | // the standard version. See 'cuda-cpp14.cu'.
5 | //
6 | // https://en.cppreference.com/w/cpp/preprocessor/replace#Predefined_macros
7 | static_assert(__cplusplus >= 201402L, "expect C++ 2014 for host compiler");
8 |
9 | auto make_message_cpp() -> std::string {
10 | return fmt::format("host compiler \t: __cplusplus == {}", __cplusplus);
11 | }
12 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/test/cuda-test/cuda-cpp14.cu:
--------------------------------------------------------------------------------
1 | // Direct NVCC command line example:
2 | //
3 | // nvcc ./cuda-cpp14.cu -x cu -I"../include" -l"fmtd" -L"../build/Debug" \
4 | // -std=c++14 -Xcompiler /std:c++14 -Xcompiler /Zc:__cplusplus
5 |
6 | // Ensure that we are using the latest C++ standard for NVCC
7 | // The version is C++14
8 | //
9 | // https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#c-cplusplus-language-support
10 | // https://en.cppreference.com/w/cpp/preprocessor/replace#Predefined_macros
11 | static_assert(__cplusplus >= 201402L, "expect C++ 2014 for nvcc");
12 |
13 | #include
14 |
15 | #include
16 | #include
17 |
18 | extern auto make_message_cpp() -> std::string;
19 | extern auto make_message_cuda() -> std::string;
20 |
21 | int main() {
22 | std::cout << make_message_cuda() << std::endl;
23 | std::cout << make_message_cpp() << std::endl;
24 | }
25 |
26 | auto make_message_cuda() -> std::string {
27 | return fmt::format("nvcc compiler \t: __cplusplus == {}", __cplusplus);
28 | }
29 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/test/find-package-test/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.1.0)
2 |
3 | project(fmt-test)
4 |
5 | find_package(FMT REQUIRED)
6 |
7 | add_executable(library-test main.cc)
8 | target_link_libraries(library-test fmt::fmt)
9 | target_compile_options(library-test PRIVATE ${PEDANTIC_COMPILE_FLAGS})
10 | target_include_directories(library-test PUBLIC SYSTEM .)
11 |
12 | if (TARGET fmt::fmt-header-only)
13 | add_executable(header-only-test main.cc)
14 | target_link_libraries(header-only-test fmt::fmt-header-only)
15 | target_compile_options(header-only-test PRIVATE ${PEDANTIC_COMPILE_FLAGS})
16 | target_include_directories(header-only-test PUBLIC SYSTEM .)
17 | endif ()
18 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/test/find-package-test/main.cc:
--------------------------------------------------------------------------------
1 | #include "fmt/format.h"
2 |
3 | int main(int argc, char** argv) {
4 | for(int i = 0; i < argc; ++i)
5 | fmt::print("{}: {}\n", i, argv[i]);
6 | }
7 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/test/format-dyn-args-test.cc:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2020 Vladimir Solontsov
2 | // SPDX-License-Identifier: MIT Licence
3 |
4 | #include
5 |
6 | #include "gtest-extra.h"
7 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/test/fuzzing/.gitignore:
--------------------------------------------------------------------------------
1 | # ignore artifacts from the build.sh script
2 | build-*/
3 |
4 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/test/fuzzing/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2019, Paul Dreik
2 | # License: see LICENSE.rst in the fmt root directory
3 |
4 | # settings this links in a main. useful for reproducing,
5 | # kcov, gdb, afl, valgrind.
6 | # (note that libFuzzer can also reproduce, just pass it the files)
7 | option(FMT_FUZZ_LINKMAIN "enables the reproduce mode, instead of libFuzzer" On)
8 |
9 | # For oss-fuzz - insert $LIB_FUZZING_ENGINE into the link flags, but only for
10 | # the fuzz targets, otherwise the cmake configuration step fails.
11 | set(FMT_FUZZ_LDFLAGS "" CACHE STRING "LDFLAGS for the fuzz targets")
12 |
13 | # Find all fuzzers.
14 | set(SOURCES
15 | chrono_duration.cpp
16 | named_arg.cpp
17 | one_arg.cpp
18 | sprintf.cpp
19 | two_args.cpp
20 | )
21 |
22 | macro(implement_fuzzer sourcefile)
23 | get_filename_component(basename ${sourcefile} NAME_WE)
24 | set(name fuzzer_${basename})
25 | add_executable(${name} ${sourcefile} fuzzer_common.h)
26 | if (FMT_FUZZ_LINKMAIN)
27 | target_sources(${name} PRIVATE main.cpp)
28 | endif ()
29 | target_link_libraries(${name} PRIVATE fmt)
30 | if (FMT_FUZZ_LDFLAGS)
31 | target_link_libraries(${name} PRIVATE ${FMT_FUZZ_LDFLAGS})
32 | endif ()
33 | target_compile_features(${name} PRIVATE cxx_generic_lambdas)
34 | endmacro ()
35 |
36 | foreach (X IN ITEMS ${SOURCES})
37 | implement_fuzzer(${X})
38 | endforeach ()
39 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/test/fuzzing/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 | #include "fuzzer_common.h"
6 |
7 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t* Data, size_t Size);
8 | int main(int argc, char* argv[]) {
9 | for (int i = 1; i < argc; ++i) {
10 | std::ifstream in(argv[i]);
11 | assert(in);
12 | in.seekg(0, std::ios_base::end);
13 | const auto pos = in.tellg();
14 | assert(pos >= 0);
15 | in.seekg(0, std::ios_base::beg);
16 | std::vector buf(static_cast(pos));
17 | in.read(buf.data(), static_cast(buf.size()));
18 | assert(in.gcount() == pos);
19 | LLVMFuzzerTestOneInput(fmt_fuzzer::as_bytes(buf.data()), buf.size());
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/test/header-only-test.cc:
--------------------------------------------------------------------------------
1 | // Header-only configuration test
2 |
3 | #include "fmt/core.h"
4 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/test/header-only-test2.cc:
--------------------------------------------------------------------------------
1 | // Additional translation unit for the header-only configuration test
2 |
3 | #include "fmt/core.h"
4 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/fmtlib/test/test-assert.h:
--------------------------------------------------------------------------------
1 | // Formatting library for C++ - test version of FMT_ASSERT
2 | //
3 | // Copyright (c) 2012 - present, Victor Zverovich
4 | // All rights reserved.
5 | //
6 | // For the license information refer to format.h.
7 |
8 | #ifndef FMT_TEST_ASSERT_H_
9 | #define FMT_TEST_ASSERT_H_
10 |
11 | #include
12 |
13 | #include "gtest.h"
14 |
15 | class assertion_failure : public std::logic_error {
16 | public:
17 | explicit assertion_failure(const char* message) : std::logic_error(message) {}
18 |
19 | private:
20 | virtual void avoid_weak_vtable();
21 | };
22 |
23 | void assertion_failure::avoid_weak_vtable() {}
24 |
25 | #define FMT_ASSERT(condition, message) \
26 | if (!(condition)) throw assertion_failure(message);
27 |
28 | // Expects an assertion failure.
29 | #define EXPECT_ASSERT(stmt, message) \
30 | FMT_TEST_THROW_(stmt, assertion_failure, message, GTEST_NONFATAL_FAILURE_)
31 |
32 | #endif // FMT_TEST_ASSERT_H_
33 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/include/android-base/errno_restorer.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 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 | #pragma once
18 |
19 | #include "errno.h"
20 |
21 | #include "android-base/macros.h"
22 |
23 | namespace android {
24 | namespace base {
25 |
26 | class ErrnoRestorer {
27 | public:
28 | ErrnoRestorer() : saved_errno_(errno) {}
29 |
30 | ~ErrnoRestorer() { errno = saved_errno_; }
31 |
32 | // Allow this object to be used as part of && operation.
33 | operator bool() const { return true; }
34 |
35 | private:
36 | const int saved_errno_;
37 |
38 | DISALLOW_COPY_AND_ASSIGN(ErrnoRestorer);
39 | };
40 |
41 | } // namespace base
42 | } // namespace android
43 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/include/android-base/format.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2019 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 | #pragma once
18 |
19 | // We include fmtlib here as an alias, since libbase will have fmtlib statically linked already.
20 | // It is accessed through its normal fmt:: namespace.
21 | #pragma clang diagnostic push
22 | #pragma clang diagnostic ignored "-Wshadow"
23 | #include
24 | #pragma clang diagnostic pop
25 | #include
26 | #include
27 | #include
28 | #include
29 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/include/android-base/memory.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 | #pragma once
18 |
19 | namespace android {
20 | namespace base {
21 |
22 | // Use memcpy for access to unaligned data on targets with alignment
23 | // restrictions. The compiler will generate appropriate code to access these
24 | // structures without generating alignment exceptions.
25 | template static inline T get_unaligned(const void *address) {
26 | T result;
27 | memcpy(&result, address, sizeof(T));
28 | return result;
29 | }
30 |
31 | template static inline void put_unaligned(void *address, T v) {
32 | memcpy(address, &v, sizeof(T));
33 | }
34 |
35 | } // namespace base
36 | } // namespace android
37 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/include/android-base/off64_t.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018 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 | #pragma once
18 |
19 | #if defined(__APPLE__)
20 | /** Mac OS has always had a 64-bit off_t, so it doesn't have off64_t. */
21 | typedef off_t off64_t;
22 | #endif
23 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/include/android-base/parsenetaddress.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 | #pragma once
18 |
19 | #include
20 |
21 | namespace android {
22 | namespace base {
23 |
24 | // Parses |address| into |host| and |port|.
25 | //
26 | // If |address| doesn't contain a port number, the default value is taken from
27 | // |port|. If |canonical_address| is non-null it will be set to "host:port" or
28 | // "[host]:port" as appropriate.
29 | //
30 | // On failure, returns false and fills |error|.
31 | bool ParseNetAddress(const std::string &address, std::string *host, int *port,
32 | std::string *canonical_address, std::string *error);
33 |
34 | } // namespace base
35 | } // namespace android
36 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/include/android-base/threads.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018 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 | #pragma once
18 |
19 | #include
20 |
21 | namespace android {
22 | namespace base {
23 | uint64_t GetThreadId();
24 | }
25 | } // namespace android
26 |
27 | #if defined(__GLIBC__)
28 | // bionic has this Linux-specifix call, but glibc doesn't.
29 | extern "C" int tgkill(int tgid, int tid, int sig);
30 | #endif
31 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/include/kwai_util/ktime.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020. Kwai, Inc. All rights reserved.
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 | * Created by Qiushi Xue on 2020.
17 | *
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 | #include
24 |
25 | __BEGIN_DECLS
26 |
27 | uint64_t nanotime();
28 | // UTC time
29 | static uint64_t now();
30 |
31 | __END_DECLS
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/include/kwai_util/kwai_macros.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020. Kwai, Inc. All rights reserved.
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 | * Created by Qiushi Xue on 2020.
17 | *
18 | */
19 |
20 | #ifndef KWAI_MACROS_H
21 | #define KWAI_MACROS_H
22 |
23 | #define KWAI_EXPORT __attribute__((visibility("default")))
24 | #define ALWAYS_INLINE __attribute__((always_inline))
25 |
26 | #define KWAI_OVERRIDE
27 |
28 | #endif // KWAI_MACROS_H
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/include/private/ErrnoRestorer.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 | #pragma once
18 |
19 | #include
20 |
21 | #include "platform/bionic/macros.h"
22 |
23 | class ErrnoRestorer {
24 | public:
25 | explicit ErrnoRestorer() : saved_errno_(errno) {}
26 |
27 | ~ErrnoRestorer() { errno = saved_errno_; }
28 |
29 | void override(int new_errno) { saved_errno_ = new_errno; }
30 |
31 | private:
32 | int saved_errno_;
33 |
34 | BIONIC_DISALLOW_COPY_AND_ASSIGN(ErrnoRestorer);
35 | };
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/include/private/ScopedPthreadMutexLocker.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 | #pragma once
18 |
19 | #include
20 |
21 | #include "platform/bionic/macros.h"
22 |
23 | class ScopedPthreadMutexLocker {
24 | public:
25 | explicit ScopedPthreadMutexLocker(pthread_mutex_t *mu) : mu_(mu) { pthread_mutex_lock(mu_); }
26 |
27 | ~ScopedPthreadMutexLocker() { pthread_mutex_unlock(mu_); }
28 |
29 | private:
30 | pthread_mutex_t *mu_;
31 |
32 | BIONIC_DISALLOW_IMPLICIT_CONSTRUCTORS(ScopedPthreadMutexLocker);
33 | };
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/liblog/include/log/log_id.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 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 | #pragma once
18 |
19 | #include
20 |
21 | #ifdef __cplusplus
22 | extern "C" {
23 | #endif
24 |
25 | /*
26 | * log_id_t helpers
27 | */
28 | log_id_t android_name_to_log_id(const char *logName);
29 | const char *android_log_id_to_name(log_id_t log_id);
30 |
31 | #ifdef __cplusplus
32 | }
33 | #endif
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/liblog/include/log/log_properties.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2017 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 | #pragma once
19 |
20 | #ifdef __cplusplus
21 | extern "C" {
22 | #endif
23 |
24 | /* Returns `1` if the device is debuggable or `0` if not. */
25 | int __android_log_is_debuggable();
26 |
27 | #ifdef __cplusplus
28 | }
29 | #endif
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/liblog/include/log/log_safetynet.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2017 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 | #pragma once
18 |
19 | #include
20 |
21 | #ifdef __cplusplus
22 | extern "C" {
23 | #endif
24 |
25 | #define android_errorWriteLog(tag, subTag) __android_log_error_write(tag, subTag, -1, NULL, 0)
26 |
27 | #define android_errorWriteWithInfoLog(tag, subTag, uid, data, dataLen) \
28 | __android_log_error_write(tag, subTag, uid, data, dataLen)
29 |
30 | int __android_log_error_write(int tag, const char *subTag, int32_t uid, const char *data,
31 | uint32_t dataLen);
32 |
33 | #ifdef __cplusplus
34 | }
35 | #endif
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/liblog/include/log/logger_write.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 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 | #pragma once
19 |
20 | #include
21 |
22 | std::string &GetDefaultTag();
23 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/liblog/logd_reader.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 |
18 | #pragma once
19 |
20 | #include
21 | #include
22 |
23 | #include "log/log_read.h"
24 |
25 | __BEGIN_DECLS
26 |
27 | int LogdRead(struct logger_list *logger_list, struct log_msg *log_msg);
28 | void LogdClose(struct logger_list *logger_list);
29 |
30 | ssize_t SendLogdControlMessage(char *buf, size_t buf_size);
31 |
32 | __END_DECLS
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/liblog/logd_writer.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 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 | #pragma once
19 |
20 | #include
21 |
22 | #include
23 |
24 | int LogdWrite(log_id_t logId, struct timespec *ts, struct iovec *vec, size_t nr);
25 | void LogdClose();
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/liblog/logger_write.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 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 | #pragma once
19 |
20 | #include
21 |
22 | std::string &GetDefaultTag();
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/liblog/pmsg_reader.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 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 | #pragma once
19 |
20 | #include
21 | #include
22 |
23 | #include "log/log_read.h"
24 |
25 | __BEGIN_DECLS
26 |
27 | int PmsgRead(struct logger_list *logger_list, struct log_msg *log_msg);
28 | void PmsgClose(struct logger_list *logger_list);
29 |
30 | __END_DECLS
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/liblog/pmsg_writer.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 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 | #pragma once
19 |
20 | #include
21 |
22 | #include
23 |
24 | int PmsgWrite(log_id_t logId, struct timespec *ts, struct iovec *vec, size_t nr);
25 | void PmsgClose();
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/liblog/uio.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2019 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 | #pragma once
19 |
20 | #if defined(_WIN32)
21 | #include
22 | struct iovec {
23 | void *iov_base;
24 | size_t iov_len;
25 | };
26 | #else
27 | #include
28 | #endif
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/libsystem/include/system/graphics-base-v1.2.h:
--------------------------------------------------------------------------------
1 | // This file is autogenerated by hidl-gen. Do not edit manually.
2 | // Source: android.hardware.graphics.common@1.2
3 | // Location: hardware/interfaces/graphics/common/1.2/
4 |
5 | #ifndef HIDL_GENERATED_ANDROID_HARDWARE_GRAPHICS_COMMON_V1_2_EXPORTED_CONSTANTS_H_
6 | #define HIDL_GENERATED_ANDROID_HARDWARE_GRAPHICS_COMMON_V1_2_EXPORTED_CONSTANTS_H_
7 |
8 | #ifdef __cplusplus
9 | extern "C" {
10 | #endif
11 |
12 | typedef enum {
13 | HAL_HDR_HDR10_PLUS = 4,
14 | } android_hdr_v1_2_t;
15 |
16 | typedef enum {
17 | HAL_DATASPACE_DISPLAY_BT2020 = 142999552 /* ((STANDARD_BT2020 | TRANSFER_SRGB) | RANGE_FULL) */,
18 | HAL_DATASPACE_DYNAMIC_DEPTH = 4098 /* 0x1002 */,
19 | HAL_DATASPACE_JPEG_APP_SEGMENTS = 4099 /* 0x1003 */,
20 | HAL_DATASPACE_HEIF = 4100 /* 0x1004 */,
21 | } android_dataspace_v1_2_t;
22 |
23 | typedef enum {
24 | HAL_PIXEL_FORMAT_HSV_888 = 55 /* 0x37 */,
25 | } android_pixel_format_v1_2_t;
26 |
27 | #ifdef __cplusplus
28 | }
29 | #endif
30 |
31 | #endif // HIDL_GENERATED_ANDROID_HARDWARE_GRAPHICS_COMMON_V1_2_EXPORTED_CONSTANTS_H_
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/libsystem/include/system/graphics-base.h:
--------------------------------------------------------------------------------
1 | #ifndef SYSTEM_CORE_GRAPHICS_BASE_H_
2 | #define SYSTEM_CORE_GRAPHICS_BASE_H_
3 |
4 | #include "graphics-base-v1.0.h"
5 | #include "graphics-base-v1.1.h"
6 | #include "graphics-base-v1.2.h"
7 |
8 | #endif // SYSTEM_CORE_GRAPHICS_BASE_H_
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/libsystem/include/system/graphics-sw.h:
--------------------------------------------------------------------------------
1 | #ifndef SYSTEM_CORE_GRAPHICS_SW_H_
2 | #define SYSTEM_CORE_GRAPHICS_SW_H_
3 |
4 | /* Software formats not in the HAL definitions. */
5 | typedef enum {
6 | HAL_PIXEL_FORMAT_YCBCR_422_888 = 39, // 0x27
7 | HAL_PIXEL_FORMAT_YCBCR_444_888 = 40, // 0x28
8 | HAL_PIXEL_FORMAT_FLEX_RGB_888 = 41, // 0x29
9 | HAL_PIXEL_FORMAT_FLEX_RGBA_8888 = 42, // 0x2A
10 | } android_pixel_format_sw_t;
11 |
12 | /* for compatibility */
13 | #define HAL_PIXEL_FORMAT_YCbCr_422_888 HAL_PIXEL_FORMAT_YCBCR_422_888
14 | #define HAL_PIXEL_FORMAT_YCbCr_444_888 HAL_PIXEL_FORMAT_YCBCR_444_888
15 |
16 | #endif // SYSTEM_CORE_GRAPHICS_SW_H_
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/lzma/7zAlloc.h:
--------------------------------------------------------------------------------
1 | /* 7zAlloc.h -- Allocation functions
2 | 2017-04-03 : Igor Pavlov : Public domain */
3 |
4 | #ifndef __7Z_ALLOC_H
5 | #define __7Z_ALLOC_H
6 |
7 | #include "7zTypes.h"
8 |
9 | EXTERN_C_BEGIN
10 |
11 | void *SzAlloc(ISzAllocPtr p, size_t size);
12 | void SzFree(ISzAllocPtr p, void *address);
13 |
14 | void *SzAllocTemp(ISzAllocPtr p, size_t size);
15 | void SzFreeTemp(ISzAllocPtr p, void *address);
16 |
17 | EXTERN_C_END
18 |
19 | #endif
20 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/lzma/7zBuf.c:
--------------------------------------------------------------------------------
1 | /* 7zBuf.c -- Byte Buffer
2 | 2017-04-03 : Igor Pavlov : Public domain */
3 |
4 | #include "Precomp.h"
5 |
6 | #include "7zBuf.h"
7 |
8 | void Buf_Init(CBuf *p)
9 | {
10 | p->data = 0;
11 | p->size = 0;
12 | }
13 |
14 | int Buf_Create(CBuf *p, size_t size, ISzAllocPtr alloc)
15 | {
16 | p->size = 0;
17 | if (size == 0)
18 | {
19 | p->data = 0;
20 | return 1;
21 | }
22 | p->data = (Byte *)ISzAlloc_Alloc(alloc, size);
23 | if (p->data)
24 | {
25 | p->size = size;
26 | return 1;
27 | }
28 | return 0;
29 | }
30 |
31 | void Buf_Free(CBuf *p, ISzAllocPtr alloc)
32 | {
33 | ISzAlloc_Free(alloc, p->data);
34 | p->data = 0;
35 | p->size = 0;
36 | }
37 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/lzma/7zBuf.h:
--------------------------------------------------------------------------------
1 | /* 7zBuf.h -- Byte Buffer
2 | 2017-04-03 : Igor Pavlov : Public domain */
3 |
4 | #ifndef __7Z_BUF_H
5 | #define __7Z_BUF_H
6 |
7 | #include "7zTypes.h"
8 |
9 | EXTERN_C_BEGIN
10 |
11 | typedef struct
12 | {
13 | Byte *data;
14 | size_t size;
15 | } CBuf;
16 |
17 | void Buf_Init(CBuf *p);
18 | int Buf_Create(CBuf *p, size_t size, ISzAllocPtr alloc);
19 | void Buf_Free(CBuf *p, ISzAllocPtr alloc);
20 |
21 | typedef struct
22 | {
23 | Byte *data;
24 | size_t size;
25 | size_t pos;
26 | } CDynBuf;
27 |
28 | void DynBuf_Construct(CDynBuf *p);
29 | void DynBuf_SeekToBeg(CDynBuf *p);
30 | int DynBuf_Write(CDynBuf *p, const Byte *buf, size_t size, ISzAllocPtr alloc);
31 | void DynBuf_Free(CDynBuf *p, ISzAllocPtr alloc);
32 |
33 | EXTERN_C_END
34 |
35 | #endif
36 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/lzma/7zBuf2.c:
--------------------------------------------------------------------------------
1 | /* 7zBuf2.c -- Byte Buffer
2 | 2017-04-03 : Igor Pavlov : Public domain */
3 |
4 | #include "Precomp.h"
5 |
6 | #include
7 |
8 | #include "7zBuf.h"
9 |
10 | void DynBuf_Construct(CDynBuf *p)
11 | {
12 | p->data = 0;
13 | p->size = 0;
14 | p->pos = 0;
15 | }
16 |
17 | void DynBuf_SeekToBeg(CDynBuf *p)
18 | {
19 | p->pos = 0;
20 | }
21 |
22 | int DynBuf_Write(CDynBuf *p, const Byte *buf, size_t size, ISzAllocPtr alloc)
23 | {
24 | if (size > p->size - p->pos)
25 | {
26 | size_t newSize = p->pos + size;
27 | Byte *data;
28 | newSize += newSize / 4;
29 | data = (Byte *)ISzAlloc_Alloc(alloc, newSize);
30 | if (!data)
31 | return 0;
32 | p->size = newSize;
33 | if (p->pos != 0)
34 | memcpy(data, p->data, p->pos);
35 | ISzAlloc_Free(alloc, p->data);
36 | p->data = data;
37 | }
38 | if (size != 0)
39 | {
40 | memcpy(p->data + p->pos, buf, size);
41 | p->pos += size;
42 | }
43 | return 1;
44 | }
45 |
46 | void DynBuf_Free(CDynBuf *p, ISzAllocPtr alloc)
47 | {
48 | ISzAlloc_Free(alloc, p->data);
49 | p->data = 0;
50 | p->size = 0;
51 | p->pos = 0;
52 | }
53 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/lzma/7zCrc.h:
--------------------------------------------------------------------------------
1 | /* 7zCrc.h -- CRC32 calculation
2 | 2013-01-18 : Igor Pavlov : Public domain */
3 |
4 | #ifndef __7Z_CRC_H
5 | #define __7Z_CRC_H
6 |
7 | #include "7zTypes.h"
8 |
9 | EXTERN_C_BEGIN
10 |
11 | extern UInt32 g_CrcTable[];
12 |
13 | /* Call CrcGenerateTable one time before other CRC functions */
14 | void MY_FAST_CALL CrcGenerateTable(void);
15 |
16 | #define CRC_INIT_VAL 0xFFFFFFFF
17 | #define CRC_GET_DIGEST(crc) ((crc) ^ CRC_INIT_VAL)
18 | #define CRC_UPDATE_BYTE(crc, b) (g_CrcTable[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8))
19 |
20 | UInt32 MY_FAST_CALL CrcUpdate(UInt32 crc, const void *data, size_t size);
21 | UInt32 MY_FAST_CALL CrcCalc(const void *data, size_t size);
22 |
23 | EXTERN_C_END
24 |
25 | #endif
26 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/lzma/7zVersion.h:
--------------------------------------------------------------------------------
1 | #define MY_VER_MAJOR 18
2 | #define MY_VER_MINOR 06
3 | #define MY_VER_BUILD 0
4 | #define MY_VERSION_NUMBERS "18.06"
5 | #define MY_VERSION MY_VERSION_NUMBERS
6 |
7 | #ifdef MY_CPU_NAME
8 | #define MY_VERSION_CPU MY_VERSION " (" MY_CPU_NAME ")"
9 | #else
10 | #define MY_VERSION_CPU MY_VERSION
11 | #endif
12 |
13 | #define MY_DATE "2018-12-30"
14 | #undef MY_COPYRIGHT
15 | #undef MY_VERSION_COPYRIGHT_DATE
16 | #define MY_AUTHOR_NAME "Igor Pavlov"
17 | #define MY_COPYRIGHT_PD "Igor Pavlov : Public domain"
18 | #define MY_COPYRIGHT_CR "Copyright (c) 1999-2018 Igor Pavlov"
19 |
20 | #ifdef USE_COPYRIGHT_CR
21 | #define MY_COPYRIGHT MY_COPYRIGHT_CR
22 | #else
23 | #define MY_COPYRIGHT MY_COPYRIGHT_PD
24 | #endif
25 |
26 | #define MY_COPYRIGHT_DATE MY_COPYRIGHT " : " MY_DATE
27 | #define MY_VERSION_COPYRIGHT_DATE MY_VERSION_CPU " : " MY_COPYRIGHT " : " MY_DATE
28 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/lzma/Alloc.h:
--------------------------------------------------------------------------------
1 | /* Alloc.h -- Memory allocation functions
2 | 2018-02-19 : Igor Pavlov : Public domain */
3 |
4 | #ifndef __COMMON_ALLOC_H
5 | #define __COMMON_ALLOC_H
6 |
7 | #include "7zTypes.h"
8 |
9 | EXTERN_C_BEGIN
10 |
11 | void *MyAlloc(size_t size);
12 | void MyFree(void *address);
13 |
14 | #ifdef _WIN32
15 |
16 | void SetLargePageSize();
17 |
18 | void *MidAlloc(size_t size);
19 | void MidFree(void *address);
20 | void *BigAlloc(size_t size);
21 | void BigFree(void *address);
22 |
23 | #else
24 |
25 | #define MidAlloc(size) MyAlloc(size)
26 | #define MidFree(address) MyFree(address)
27 | #define BigAlloc(size) MyAlloc(size)
28 | #define BigFree(address) MyFree(address)
29 |
30 | #endif
31 |
32 | extern const ISzAlloc g_Alloc;
33 | extern const ISzAlloc g_BigAlloc;
34 | extern const ISzAlloc g_MidAlloc;
35 | extern const ISzAlloc g_AlignedAlloc;
36 |
37 |
38 | typedef struct
39 | {
40 | ISzAlloc vt;
41 | ISzAllocPtr baseAlloc;
42 | unsigned numAlignBits; /* ((1 << numAlignBits) >= sizeof(void *)) */
43 | size_t offset; /* (offset == (k * sizeof(void *)) && offset < (1 << numAlignBits) */
44 | } CAlignOffsetAlloc;
45 |
46 | void AlignOffsetAlloc_CreateVTable(CAlignOffsetAlloc *p);
47 |
48 |
49 | EXTERN_C_END
50 |
51 | #endif
52 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/lzma/BraIA64.c:
--------------------------------------------------------------------------------
1 | /* BraIA64.c -- Converter for IA-64 code
2 | 2017-01-26 : Igor Pavlov : Public domain */
3 |
4 | #include "Precomp.h"
5 |
6 | #include "CpuArch.h"
7 | #include "Bra.h"
8 |
9 | SizeT IA64_Convert(Byte *data, SizeT size, UInt32 ip, int encoding)
10 | {
11 | SizeT i;
12 | if (size < 16)
13 | return 0;
14 | size -= 16;
15 | i = 0;
16 | do
17 | {
18 | unsigned m = ((UInt32)0x334B0000 >> (data[i] & 0x1E)) & 3;
19 | if (m)
20 | {
21 | m++;
22 | do
23 | {
24 | Byte *p = data + (i + (size_t)m * 5 - 8);
25 | if (((p[3] >> m) & 15) == 5
26 | && (((p[-1] | ((UInt32)p[0] << 8)) >> m) & 0x70) == 0)
27 | {
28 | unsigned raw = GetUi32(p);
29 | unsigned v = raw >> m;
30 | v = (v & 0xFFFFF) | ((v & (1 << 23)) >> 3);
31 |
32 | v <<= 4;
33 | if (encoding)
34 | v += ip + (UInt32)i;
35 | else
36 | v -= ip + (UInt32)i;
37 | v >>= 4;
38 |
39 | v &= 0x1FFFFF;
40 | v += 0x700000;
41 | v &= 0x8FFFFF;
42 | raw &= ~((UInt32)0x8FFFFF << m);
43 | raw |= (v << m);
44 | SetUi32(p, raw);
45 | }
46 | }
47 | while (++m <= 4);
48 | }
49 | i += 16;
50 | }
51 | while (i <= size);
52 | return i;
53 | }
54 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/lzma/Compiler.h:
--------------------------------------------------------------------------------
1 | /* Compiler.h
2 | 2017-04-03 : Igor Pavlov : Public domain */
3 |
4 | #ifndef __7Z_COMPILER_H
5 | #define __7Z_COMPILER_H
6 |
7 | #ifdef _MSC_VER
8 |
9 | #ifdef UNDER_CE
10 | #define RPC_NO_WINDOWS_H
11 | /* #pragma warning(disable : 4115) // '_RPC_ASYNC_STATE' : named type definition in parentheses */
12 | #pragma warning(disable : 4201) // nonstandard extension used : nameless struct/union
13 | #pragma warning(disable : 4214) // nonstandard extension used : bit field types other than int
14 | #endif
15 |
16 | #if _MSC_VER >= 1300
17 | #pragma warning(disable : 4996) // This function or variable may be unsafe
18 | #else
19 | #pragma warning(disable : 4511) // copy constructor could not be generated
20 | #pragma warning(disable : 4512) // assignment operator could not be generated
21 | #pragma warning(disable : 4514) // unreferenced inline function has been removed
22 | #pragma warning(disable : 4702) // unreachable code
23 | #pragma warning(disable : 4710) // not inlined
24 | #pragma warning(disable : 4714) // function marked as __forceinline not inlined
25 | #pragma warning(disable : 4786) // identifier was truncated to '255' characters in the debug information
26 | #endif
27 |
28 | #endif
29 |
30 | #define UNUSED_VAR(x) (void)x;
31 | /* #define UNUSED_VAR(x) x=x; */
32 |
33 | #endif
34 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/lzma/Delta.h:
--------------------------------------------------------------------------------
1 | /* Delta.h -- Delta converter
2 | 2013-01-18 : Igor Pavlov : Public domain */
3 |
4 | #ifndef __DELTA_H
5 | #define __DELTA_H
6 |
7 | #include "7zTypes.h"
8 |
9 | EXTERN_C_BEGIN
10 |
11 | #define DELTA_STATE_SIZE 256
12 |
13 | void Delta_Init(Byte *state);
14 | void Delta_Encode(Byte *state, unsigned delta, Byte *data, SizeT size);
15 | void Delta_Decode(Byte *state, unsigned delta, Byte *data, SizeT size);
16 |
17 | EXTERN_C_END
18 |
19 | #endif
20 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/lzma/DllSecur.h:
--------------------------------------------------------------------------------
1 | /* DllSecur.h -- DLL loading for security
2 | 2016-06-08 : Igor Pavlov : Public domain */
3 |
4 | #ifndef __DLL_SECUR_H
5 | #define __DLL_SECUR_H
6 |
7 | #include "7zTypes.h"
8 |
9 | EXTERN_C_BEGIN
10 |
11 | #ifdef _WIN32
12 |
13 | void LoadSecurityDlls();
14 |
15 | #endif
16 |
17 | EXTERN_C_END
18 |
19 | #endif
20 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/lzma/Precomp.h:
--------------------------------------------------------------------------------
1 | /* Precomp.h -- StdAfx
2 | 2013-11-12 : Igor Pavlov : Public domain */
3 |
4 | #ifndef __7Z_PRECOMP_H
5 | #define __7Z_PRECOMP_H
6 |
7 | #include "Compiler.h"
8 | /* #include "7zTypes.h" */
9 |
10 | #endif
11 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/lzma/RotateDefs.h:
--------------------------------------------------------------------------------
1 | /* RotateDefs.h -- Rotate functions
2 | 2015-03-25 : Igor Pavlov : Public domain */
3 |
4 | #ifndef __ROTATE_DEFS_H
5 | #define __ROTATE_DEFS_H
6 |
7 | #ifdef _MSC_VER
8 |
9 | #include
10 |
11 | /* don't use _rotl with MINGW. It can insert slow call to function. */
12 |
13 | /* #if (_MSC_VER >= 1200) */
14 | #pragma intrinsic(_rotl)
15 | #pragma intrinsic(_rotr)
16 | /* #endif */
17 |
18 | #define rotlFixed(x, n) _rotl((x), (n))
19 | #define rotrFixed(x, n) _rotr((x), (n))
20 |
21 | #else
22 |
23 | /* new compilers can translate these macros to fast commands. */
24 |
25 | #define rotlFixed(x, n) (((x) << (n)) | ((x) >> (32 - (n))))
26 | #define rotrFixed(x, n) (((x) >> (n)) | ((x) << (32 - (n))))
27 |
28 | #endif
29 |
30 | #endif
31 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/lzma/Sha256.h:
--------------------------------------------------------------------------------
1 | /* Sha256.h -- SHA-256 Hash
2 | 2013-01-18 : Igor Pavlov : Public domain */
3 |
4 | #ifndef __CRYPTO_SHA256_H
5 | #define __CRYPTO_SHA256_H
6 |
7 | #include "7zTypes.h"
8 |
9 | EXTERN_C_BEGIN
10 |
11 | #define SHA256_DIGEST_SIZE 32
12 |
13 | typedef struct
14 | {
15 | UInt32 state[8];
16 | UInt64 count;
17 | Byte buffer[64];
18 | } CSha256;
19 |
20 | void Sha256_Init(CSha256 *p);
21 | void Sha256_Update(CSha256 *p, const Byte *data, size_t size);
22 | void Sha256_Final(CSha256 *p, Byte *digest);
23 |
24 | EXTERN_C_END
25 |
26 | #endif
27 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/lzma/Sort.h:
--------------------------------------------------------------------------------
1 | /* Sort.h -- Sort functions
2 | 2014-04-05 : Igor Pavlov : Public domain */
3 |
4 | #ifndef __7Z_SORT_H
5 | #define __7Z_SORT_H
6 |
7 | #include "7zTypes.h"
8 |
9 | EXTERN_C_BEGIN
10 |
11 | void HeapSort(UInt32 *p, size_t size);
12 | void HeapSort64(UInt64 *p, size_t size);
13 |
14 | /* void HeapSortRef(UInt32 *p, UInt32 *vals, size_t size); */
15 |
16 | EXTERN_C_END
17 |
18 | #endif
19 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/lzma/Util/7z/7z.dsw:
--------------------------------------------------------------------------------
1 | Microsoft Developer Studio Workspace File, Format Version 6.00
2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
3 |
4 | ###############################################################################
5 |
6 | Project: "7z"=.\7z.dsp - Package Owner=<4>
7 |
8 | Package=<5>
9 | {{{
10 | }}}
11 |
12 | Package=<4>
13 | {{{
14 | }}}
15 |
16 | ###############################################################################
17 |
18 | Global:
19 |
20 | Package=<5>
21 | {{{
22 | }}}
23 |
24 | Package=<3>
25 | {{{
26 | }}}
27 |
28 | ###############################################################################
29 |
30 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/lzma/Util/7z/Precomp.c:
--------------------------------------------------------------------------------
1 | /* Precomp.c -- StdAfx
2 | 2013-01-21 : Igor Pavlov : Public domain */
3 |
4 | #include "Precomp.h"
5 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/lzma/Util/7z/Precomp.h:
--------------------------------------------------------------------------------
1 | /* Precomp.h -- StdAfx
2 | 2013-06-16 : Igor Pavlov : Public domain */
3 |
4 | #ifndef __7Z_PRECOMP_H
5 | #define __7Z_PRECOMP_H
6 |
7 | #include "../../Compiler.h"
8 | #include "../../7zTypes.h"
9 |
10 | #endif
11 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/lzma/Util/7z/makefile:
--------------------------------------------------------------------------------
1 | CFLAGS = $(CFLAGS) -D_7ZIP_PPMD_SUPPPORT
2 |
3 | PROG = 7zDec.exe
4 |
5 | C_OBJS = \
6 | $O\7zAlloc.obj \
7 | $O\7zBuf.obj \
8 | $O\7zCrc.obj \
9 | $O\7zCrcOpt.obj \
10 | $O\7zFile.obj \
11 | $O\7zDec.obj \
12 | $O\7zArcIn.obj \
13 | $O\7zStream.obj \
14 | $O\Bcj2.obj \
15 | $O\Bra.obj \
16 | $O\Bra86.obj \
17 | $O\BraIA64.obj \
18 | $O\CpuArch.obj \
19 | $O\Delta.obj \
20 | $O\Lzma2Dec.obj \
21 | $O\LzmaDec.obj \
22 | $O\Ppmd7.obj \
23 | $O\Ppmd7Dec.obj \
24 |
25 | 7Z_OBJS = \
26 | $O\7zMain.obj \
27 |
28 | OBJS = \
29 | $O\Precomp.obj \
30 | $(7Z_OBJS) \
31 | $(C_OBJS) \
32 |
33 | !include "../../../CPP/Build.mak"
34 |
35 | $(7Z_OBJS): $(*B).c
36 | $(CCOMPL_USE)
37 | $(C_OBJS): ../../$(*B).c
38 | $(CCOMPL_USE)
39 | $O\Precomp.obj: Precomp.c
40 | $(CCOMPL_PCH)
41 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/lzma/Util/Lzma/LzmaUtil.dsw:
--------------------------------------------------------------------------------
1 | Microsoft Developer Studio Workspace File, Format Version 6.00
2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
3 |
4 | ###############################################################################
5 |
6 | Project: "LzmaUtil"=.\LzmaUtil.dsp - Package Owner=<4>
7 |
8 | Package=<5>
9 | {{{
10 | }}}
11 |
12 | Package=<4>
13 | {{{
14 | }}}
15 |
16 | ###############################################################################
17 |
18 | Global:
19 |
20 | Package=<5>
21 | {{{
22 | }}}
23 |
24 | Package=<3>
25 | {{{
26 | }}}
27 |
28 | ###############################################################################
29 |
30 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/lzma/Util/Lzma/makefile:
--------------------------------------------------------------------------------
1 | # MY_STATIC_LINK=1
2 | PROG = LZMAc.exe
3 |
4 | CFLAGS = $(CFLAGS) \
5 |
6 | LIB_OBJS = \
7 | $O\LzmaUtil.obj \
8 |
9 | C_OBJS = \
10 | $O\Alloc.obj \
11 | $O\LzFind.obj \
12 | $O\LzFindMt.obj \
13 | $O\LzmaDec.obj \
14 | $O\LzmaEnc.obj \
15 | $O\7zFile.obj \
16 | $O\7zStream.obj \
17 | $O\Threads.obj \
18 |
19 | OBJS = \
20 | $(LIB_OBJS) \
21 | $(C_OBJS) \
22 |
23 | !include "../../../CPP/Build.mak"
24 |
25 | $(LIB_OBJS): $(*B).c
26 | $(COMPL_O2)
27 | $(C_OBJS): ../../$(*B).c
28 | $(COMPL_O2)
29 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/lzma/Util/Lzma/makefile.gcc:
--------------------------------------------------------------------------------
1 | PROG = lzma
2 | CXX = g++
3 | LIB =
4 | RM = rm -f
5 | CFLAGS = -c -O2 -Wall -D_7ZIP_ST
6 |
7 | OBJS = \
8 | LzmaUtil.o \
9 | Alloc.o \
10 | LzFind.o \
11 | LzmaDec.o \
12 | LzmaEnc.o \
13 | 7zFile.o \
14 | 7zStream.o \
15 |
16 |
17 | all: $(PROG)
18 |
19 | $(PROG): $(OBJS)
20 | $(CXX) -o $(PROG) $(LDFLAGS) $(OBJS) $(LIB) $(LIB2)
21 |
22 | LzmaUtil.o: LzmaUtil.c
23 | $(CXX) $(CFLAGS) LzmaUtil.c
24 |
25 | Alloc.o: ../../Alloc.c
26 | $(CXX) $(CFLAGS) ../../Alloc.c
27 |
28 | LzFind.o: ../../LzFind.c
29 | $(CXX) $(CFLAGS) ../../LzFind.c
30 |
31 | LzmaDec.o: ../../LzmaDec.c
32 | $(CXX) $(CFLAGS) ../../LzmaDec.c
33 |
34 | LzmaEnc.o: ../../LzmaEnc.c
35 | $(CXX) $(CFLAGS) ../../LzmaEnc.c
36 |
37 | 7zFile.o: ../../7zFile.c
38 | $(CXX) $(CFLAGS) ../../7zFile.c
39 |
40 | 7zStream.o: ../../7zStream.c
41 | $(CXX) $(CFLAGS) ../../7zStream.c
42 |
43 | clean:
44 | -$(RM) $(PROG) $(OBJS)
45 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/lzma/Util/LzmaLib/LzmaLib.def:
--------------------------------------------------------------------------------
1 | EXPORTS
2 | LzmaCompress
3 | LzmaUncompress
4 |
5 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/lzma/Util/LzmaLib/LzmaLib.dsw:
--------------------------------------------------------------------------------
1 | Microsoft Developer Studio Workspace File, Format Version 6.00
2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
3 |
4 | ###############################################################################
5 |
6 | Project: "LzmaLib"=.\LzmaLib.dsp - Package Owner=<4>
7 |
8 | Package=<5>
9 | {{{
10 | }}}
11 |
12 | Package=<4>
13 | {{{
14 | }}}
15 |
16 | ###############################################################################
17 |
18 | Global:
19 |
20 | Package=<5>
21 | {{{
22 | }}}
23 |
24 | Package=<3>
25 | {{{
26 | }}}
27 |
28 | ###############################################################################
29 |
30 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/lzma/Util/LzmaLib/LzmaLibExports.c:
--------------------------------------------------------------------------------
1 | /* LzmaLibExports.c -- LZMA library DLL Entry point
2 | 2015-11-08 : Igor Pavlov : Public domain */
3 |
4 | #include "../../Precomp.h"
5 |
6 | #include
7 |
8 | BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
9 | {
10 | UNUSED_VAR(hInstance);
11 | UNUSED_VAR(dwReason);
12 | UNUSED_VAR(lpReserved);
13 | return TRUE;
14 | }
15 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/lzma/Util/LzmaLib/makefile:
--------------------------------------------------------------------------------
1 | MY_STATIC_LINK=1
2 | SLIB = sLZMA.lib
3 | PROG = LZMA.dll
4 | SLIBPATH = $O\$(SLIB)
5 |
6 | DEF_FILE = LzmaLib.def
7 | CFLAGS = $(CFLAGS) \
8 |
9 | LIB_OBJS = \
10 | $O\LzmaLibExports.obj \
11 |
12 | C_OBJS = \
13 | $O\Alloc.obj \
14 | $O\LzFind.obj \
15 | $O\LzFindMt.obj \
16 | $O\LzmaDec.obj \
17 | $O\LzmaEnc.obj \
18 | $O\LzmaLib.obj \
19 | $O\Threads.obj \
20 |
21 | OBJS = \
22 | $(LIB_OBJS) \
23 | $(C_OBJS) \
24 | $O\resource.res
25 |
26 | !include "../../../CPP/Build.mak"
27 |
28 | $(SLIBPATH): $O $(OBJS)
29 | lib -out:$(SLIBPATH) $(OBJS) $(LIBS)
30 |
31 | $(LIB_OBJS): $(*B).c
32 | $(COMPL_O2)
33 | $(C_OBJS): ../../$(*B).c
34 | $(COMPL_O2)
35 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/lzma/Util/LzmaLib/resource.rc:
--------------------------------------------------------------------------------
1 | #include "../../7zVersion.rc"
2 |
3 | MY_VERSION_INFO_DLL("LZMA library", "LZMA")
4 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/lzma/Util/SfxSetup/Precomp.c:
--------------------------------------------------------------------------------
1 | /* Precomp.c -- StdAfx
2 | 2013-01-21 : Igor Pavlov : Public domain */
3 |
4 | #include "Precomp.h"
5 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/lzma/Util/SfxSetup/Precomp.h:
--------------------------------------------------------------------------------
1 | /* Precomp.h -- StdAfx
2 | 2013-06-16 : Igor Pavlov : Public domain */
3 |
4 | #ifndef __7Z_PRECOMP_H
5 | #define __7Z_PRECOMP_H
6 |
7 | #include "../../Compiler.h"
8 | #include "../../7zTypes.h"
9 |
10 | #endif
11 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/lzma/Util/SfxSetup/SfxSetup.dsw:
--------------------------------------------------------------------------------
1 | Microsoft Developer Studio Workspace File, Format Version 6.00
2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
3 |
4 | ###############################################################################
5 |
6 | Project: "SfxSetup"=.\SfxSetup.dsp - Package Owner=<4>
7 |
8 | Package=<5>
9 | {{{
10 | }}}
11 |
12 | Package=<4>
13 | {{{
14 | }}}
15 |
16 | ###############################################################################
17 |
18 | Global:
19 |
20 | Package=<5>
21 | {{{
22 | }}}
23 |
24 | Package=<3>
25 | {{{
26 | }}}
27 |
28 | ###############################################################################
29 |
30 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/lzma/Util/SfxSetup/makefile:
--------------------------------------------------------------------------------
1 | PROG = 7zS2.sfx
2 | MY_FIXED = 1
3 |
4 | C_OBJS = \
5 | $O\7zAlloc.obj \
6 | $O\7zArcIn.obj \
7 | $O\7zBuf.obj \
8 | $O\7zBuf2.obj \
9 | $O\7zCrc.obj \
10 | $O\7zCrcOpt.obj \
11 | $O\7zFile.obj \
12 | $O\7zDec.obj \
13 | $O\7zStream.obj \
14 | $O\Bcj2.obj \
15 | $O\Bra.obj \
16 | $O\Bra86.obj \
17 | $O\BraIA64.obj \
18 | $O\CpuArch.obj \
19 | $O\Delta.obj \
20 | $O\DllSecur.obj \
21 | $O\Lzma2Dec.obj \
22 | $O\LzmaDec.obj \
23 |
24 | 7Z_OBJS = \
25 | $O\SfxSetup.obj \
26 |
27 | OBJS = \
28 | $(7Z_OBJS) \
29 | $(C_OBJS) \
30 | $O\resource.res
31 |
32 | !include "../../../CPP/Build.mak"
33 |
34 | $(7Z_OBJS): $(*B).c
35 | $(COMPL_O1)
36 | $(C_OBJS): ../../$(*B).c
37 | $(COMPL_O1)
38 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/lzma/Util/SfxSetup/makefile_con:
--------------------------------------------------------------------------------
1 | PROG = 7zS2con.sfx
2 | MY_FIXED = 1
3 | CFLAGS = $(CFLAGS) -D_CONSOLE
4 |
5 | C_OBJS = \
6 | $O\7zAlloc.obj \
7 | $O\7zArcIn.obj \
8 | $O\7zBuf.obj \
9 | $O\7zBuf2.obj \
10 | $O\7zCrc.obj \
11 | $O\7zCrcOpt.obj \
12 | $O\7zFile.obj \
13 | $O\7zDec.obj \
14 | $O\7zStream.obj \
15 | $O\Bcj2.obj \
16 | $O\Bra.obj \
17 | $O\Bra86.obj \
18 | $O\BraIA64.obj \
19 | $O\CpuArch.obj \
20 | $O\Delta.obj \
21 | $O\DllSecur.obj \
22 | $O\Lzma2Dec.obj \
23 | $O\LzmaDec.obj \
24 |
25 | 7Z_OBJS = \
26 | $O\SfxSetup.obj \
27 |
28 | OBJS = \
29 | $(7Z_OBJS) \
30 | $(C_OBJS) \
31 | $O\resource.res
32 |
33 | !include "../../../CPP/Build.mak"
34 |
35 | $(7Z_OBJS): $(*B).c
36 | $(COMPL_O1)
37 | $(C_OBJS): ../../$(*B).c
38 | $(COMPL_O1)
39 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/lzma/Util/SfxSetup/resource.rc:
--------------------------------------------------------------------------------
1 | #include "../../7zVersion.rc"
2 |
3 | MY_VERSION_INFO_APP("7z Setup SFX small", "7zS2.sfx")
4 |
5 | 1 ICON "setup.ico"
6 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/lzma/Util/SfxSetup/setup.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KwaiAppTeam/KOOM/f653d7c986debb242b1d8b96761351f63d9f04bf/koom-common/kwai-android-base/src/main/cpp/lzma/Util/SfxSetup/setup.ico
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/lzma/XzCrc64.h:
--------------------------------------------------------------------------------
1 | /* XzCrc64.h -- CRC64 calculation
2 | 2013-01-18 : Igor Pavlov : Public domain */
3 |
4 | #ifndef __XZ_CRC64_H
5 | #define __XZ_CRC64_H
6 |
7 | #include
8 |
9 | #include "7zTypes.h"
10 |
11 | EXTERN_C_BEGIN
12 |
13 | extern UInt64 g_Crc64Table[];
14 |
15 | void MY_FAST_CALL Crc64GenerateTable(void);
16 |
17 | #define CRC64_INIT_VAL UINT64_CONST(0xFFFFFFFFFFFFFFFF)
18 | #define CRC64_GET_DIGEST(crc) ((crc) ^ CRC64_INIT_VAL)
19 | #define CRC64_UPDATE_BYTE(crc, b) (g_Crc64Table[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8))
20 |
21 | UInt64 MY_FAST_CALL Crc64Update(UInt64 crc, const void *data, size_t size);
22 | UInt64 MY_FAST_CALL Crc64Calc(const void *data, size_t size);
23 |
24 | EXTERN_C_END
25 |
26 | #endif
27 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/parsebool.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2019 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/parsebool.h"
18 | #include
19 |
20 | namespace android {
21 | namespace base {
22 |
23 | ParseBoolResult ParseBool(std::string_view s) {
24 | if (s == "1" || s == "y" || s == "yes" || s == "on" || s == "true") {
25 | return ParseBoolResult::kTrue;
26 | }
27 | if (s == "0" || s == "n" || s == "no" || s == "off" || s == "false") {
28 | return ParseBoolResult::kFalse;
29 | }
30 | return ParseBoolResult::kError;
31 | }
32 |
33 | } // namespace base
34 | } // namespace android
35 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/process.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2019 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/process.h"
18 |
19 | namespace android {
20 | namespace base {
21 |
22 | void AllPids::PidIterator::Increment() {
23 | if (!dir_) {
24 | return;
25 | }
26 |
27 | dirent *de;
28 | while ((de = readdir(dir_.get())) != nullptr) {
29 | pid_t pid = atoi(de->d_name);
30 | if (pid != 0) {
31 | pid_ = pid;
32 | return;
33 | }
34 | }
35 | pid_ = -1;
36 | }
37 |
38 | } // namespace base
39 | } // namespace android
40 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/cpp/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 |
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/libs/arm64-v8a/libkwai-android-base.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KwaiAppTeam/KOOM/f653d7c986debb242b1d8b96761351f63d9f04bf/koom-common/kwai-android-base/src/main/libs/arm64-v8a/libkwai-android-base.so
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/libs/armeabi-v7a/libkwai-android-base.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KwaiAppTeam/KOOM/f653d7c986debb242b1d8b96761351f63d9f04bf/koom-common/kwai-android-base/src/main/libs/armeabi-v7a/libkwai-android-base.so
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/libs/x86/libkwai-android-base.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KwaiAppTeam/KOOM/f653d7c986debb242b1d8b96761351f63d9f04bf/koom-common/kwai-android-base/src/main/libs/x86/libkwai-android-base.so
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/main/libs/x86_64/libkwai-android-base.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KwaiAppTeam/KOOM/f653d7c986debb242b1d8b96761351f63d9f04bf/koom-common/kwai-android-base/src/main/libs/x86_64/libkwai-android-base.so
--------------------------------------------------------------------------------
/koom-common/kwai-android-base/src/test/java/com/kwai/android/base/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package com.kwai.android.base
2 |
3 | import org.junit.Test
4 |
5 | import org.junit.Assert.*
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * See [testing documentation](http://d.android.com/tools/testing).
11 | */
12 | class ExampleUnitTest {
13 | @Test
14 | fun addition_isCorrect() {
15 | assertEquals(4, 2 + 2)
16 | }
17 | }
--------------------------------------------------------------------------------
/koom-common/kwai-unwind/.gitignore:
--------------------------------------------------------------------------------
1 | build
2 | .cxx
--------------------------------------------------------------------------------
/koom-common/kwai-unwind/consumer-rules.pro:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KwaiAppTeam/KOOM/f653d7c986debb242b1d8b96761351f63d9f04bf/koom-common/kwai-unwind/consumer-rules.pro
--------------------------------------------------------------------------------
/koom-common/kwai-unwind/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/koom-common/kwai-unwind/src/androidTest/java/com/kwai/unwind/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package com.kwai.unwind
2 |
3 | import androidx.test.platform.app.InstrumentationRegistry
4 | import androidx.test.ext.junit.runners.AndroidJUnit4
5 |
6 | import org.junit.Test
7 | import org.junit.runner.RunWith
8 |
9 | import org.junit.Assert.*
10 |
11 | /**
12 | * Instrumented test, which will execute on an Android device.
13 | *
14 | * See [testing documentation](http://d.android.com/tools/testing).
15 | */
16 | @RunWith(AndroidJUnit4::class)
17 | class ExampleInstrumentedTest {
18 | @Test
19 | fun useAppContext() {
20 | // Context of the app under test.
21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22 | assertEquals("com.kwai.unwind.test", appContext.packageName)
23 | }
24 | }
--------------------------------------------------------------------------------
/koom-common/kwai-unwind/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
--------------------------------------------------------------------------------
/koom-common/kwai-unwind/src/main/cpp/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 |
--------------------------------------------------------------------------------
/koom-common/kwai-unwind/src/main/cpp/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(uint64_t addr, uint8_t* buffer, size_t bytes) override;
33 |
34 | bool ReadWord(uint64_t ptr, word_t* out_value) override;
35 | };
36 |
37 | #endif // _LIBBACKTRACE_BACKTRACE_PTRACE_H
38 |
--------------------------------------------------------------------------------
/koom-common/kwai-unwind/src/main/cpp/libbacktrace/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 256
29 |
30 | #endif // _BACKTRACE_BACKTRACE_CONSTANTS_H
31 |
--------------------------------------------------------------------------------
/koom-common/kwai-unwind/src/main/cpp/libunwindstack/Check.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2017 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 _LIBUNWINDSTACK_CHECK_H
18 | #define _LIBUNWINDSTACK_CHECK_H
19 |
20 | #include
21 |
22 | #include
23 |
24 | namespace unwindstack {
25 |
26 | #define CHECK(assertion) \
27 | if (__builtin_expect(!(assertion), false)) { \
28 | log(0, "%s:%d: %s\n", __FILE__, __LINE__, #assertion); \
29 | abort(); \
30 | }
31 |
32 | } // namespace unwindstack
33 |
34 | #endif // _LIBUNWINDSTACK_CHECK_H
35 |
--------------------------------------------------------------------------------
/koom-common/kwai-unwind/src/main/cpp/libunwindstack/MemoryLocal.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2019 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 _LIBUNWINDSTACK_MEMORY_LOCAL_H
18 | #define _LIBUNWINDSTACK_MEMORY_LOCAL_H
19 |
20 | #include
21 |
22 | #include
23 |
24 | namespace unwindstack {
25 |
26 | class MemoryLocal : public Memory {
27 | public:
28 | MemoryLocal() = default;
29 | virtual ~MemoryLocal() = default;
30 |
31 | bool IsLocal() const override { return true; }
32 |
33 | size_t Read(uint64_t addr, void* dst, size_t size) override;
34 | long ReadTag(uint64_t addr) override;
35 | };
36 |
37 | } // namespace unwindstack
38 |
39 | #endif // _LIBUNWINDSTACK_MEMORY_LOCAL_H
40 |
--------------------------------------------------------------------------------
/koom-common/kwai-unwind/src/main/cpp/libunwindstack/TEST_MAPPING:
--------------------------------------------------------------------------------
1 | {
2 | "presubmit": [
3 | {
4 | "name": "libunwindstack_unit_test"
5 | },
6 | {
7 | "name": "CtsSimpleperfTestCases"
8 | },
9 | {
10 | "name": "debuggerd_test"
11 | },
12 | {
13 | "name": "CtsPerfettoTestCases"
14 | }
15 | ]
16 | }
17 |
--------------------------------------------------------------------------------
/koom-common/kwai-unwind/src/main/cpp/libunwindstack/include/unwindstack/Arch.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 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 _LIBUNWINDSTACK_ARCH_H
18 | #define _LIBUNWINDSTACK_ARCH_H
19 |
20 | #include
21 |
22 | namespace unwindstack {
23 |
24 | enum ArchEnum : uint8_t {
25 | ARCH_UNKNOWN = 0,
26 | ARCH_ARM,
27 | ARCH_ARM64,
28 | ARCH_X86,
29 | ARCH_X86_64,
30 | ARCH_MIPS,
31 | ARCH_MIPS64,
32 | };
33 |
34 | static inline bool ArchIs32Bit(ArchEnum arch) {
35 | switch (arch) {
36 | case ARCH_ARM:
37 | case ARCH_X86:
38 | case ARCH_MIPS:
39 | return true;
40 | default:
41 | return false;
42 | }
43 | }
44 |
45 | } // namespace unwindstack
46 |
47 | #endif // _LIBUNWINDSTACK_ARCH_H
48 |
--------------------------------------------------------------------------------
/koom-common/kwai-unwind/src/main/cpp/libunwindstack/include/unwindstack/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 _LIBUNWINDSTACK_LOG_H
18 | #define _LIBUNWINDSTACK_LOG_H
19 |
20 | #include
21 |
22 | namespace unwindstack {
23 |
24 | void log_to_stdout(bool enable);
25 | void log(uint8_t indent, const char* format, ...);
26 | void log_async_safe(const char* format, ...);
27 |
28 | } // namespace unwindstack
29 |
30 | #endif // _LIBUNWINDSTACK_LOG_H
31 |
--------------------------------------------------------------------------------
/koom-common/kwai-unwind/src/main/libs/arm64-v8a/libkwai-unwind.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KwaiAppTeam/KOOM/f653d7c986debb242b1d8b96761351f63d9f04bf/koom-common/kwai-unwind/src/main/libs/arm64-v8a/libkwai-unwind.so
--------------------------------------------------------------------------------
/koom-common/kwai-unwind/src/main/libs/armeabi-v7a/libkwai-unwind.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KwaiAppTeam/KOOM/f653d7c986debb242b1d8b96761351f63d9f04bf/koom-common/kwai-unwind/src/main/libs/armeabi-v7a/libkwai-unwind.so
--------------------------------------------------------------------------------
/koom-common/kwai-unwind/src/main/libs/x86/libkwai-unwind.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KwaiAppTeam/KOOM/f653d7c986debb242b1d8b96761351f63d9f04bf/koom-common/kwai-unwind/src/main/libs/x86/libkwai-unwind.so
--------------------------------------------------------------------------------
/koom-common/kwai-unwind/src/main/libs/x86_64/libkwai-unwind.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KwaiAppTeam/KOOM/f653d7c986debb242b1d8b96761351f63d9f04bf/koom-common/kwai-unwind/src/main/libs/x86_64/libkwai-unwind.so
--------------------------------------------------------------------------------
/koom-common/kwai-unwind/src/test/java/com/kwai/unwind/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package com.kwai.unwind
2 |
3 | import org.junit.Test
4 |
5 | import org.junit.Assert.*
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * See [testing documentation](http://d.android.com/tools/testing).
11 | */
12 | class ExampleUnitTest {
13 | @Test
14 | fun addition_isCorrect() {
15 | assertEquals(4, 2 + 2)
16 | }
17 | }
--------------------------------------------------------------------------------
/koom-common/third-party/shark/.gitignore:
--------------------------------------------------------------------------------
1 | build
2 | .DS_Store
--------------------------------------------------------------------------------
/koom-common/third-party/shark/SHARK-MODIFIED-LIST:
--------------------------------------------------------------------------------
1 | shark/internal/LeakTraceReference.kt
2 | shark/internal/PathFinder.kt
3 | shark/AndroidBuildMirror.kt
4 | shark/HeapObject.kt
5 | shark/HprofHeapGraph.kt
6 | shark/internal/HprofInMemoryIndex.kt
7 | shark/internal/IndexedObject.kt
8 | shark/HprofReader.kt
9 | shark/HprofRecord.kt
10 | shark/HeapAnalyzer.kt
11 | shark/LeakTraceObject.kt
--------------------------------------------------------------------------------
/koom-common/third-party/shark/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'java-library'
2 | apply plugin: 'kotlin'
3 | apply plugin: 'org.jetbrains.dokka'
4 | apply from: rootProject.file('gradle/mavenCentral-java-publish.gradle')
5 |
6 | sourceCompatibility = JavaVersion.VERSION_1_7
7 | targetCompatibility = JavaVersion.VERSION_1_7
8 |
9 | dependencies {
10 | implementation deps.kotlin.stdlib
11 | // compileOnly ensures this dependency is not exposed through this artifact's pom.xml in Maven Central.
12 | // Okio is a required dependency, but we're making it required on the "shark" artifact which is the main artifact that
13 | // should generally be used. The shark artifact depends on Okio 2.x (ensure compatibility with modern Okio). Depending on 1.x here
14 | // enables us to ensure binary compatibility with Okio 1.x and allow us to use the deprecated (error level) Okio APIs to keep that
15 | // compatibility.
16 | // See https://github.com/square/leakcanary/issues/1624
17 | implementation deps.okio_1x
18 | }
--------------------------------------------------------------------------------
/koom-common/third-party/shark/gradle.properties:
--------------------------------------------------------------------------------
1 | POM_ARTIFACT_ID=shark
2 | POM_NAME=Shark
3 | POM_PACKAGING=jar
4 |
--------------------------------------------------------------------------------
/koom-common/third-party/shark/src/main/java/kshark/AndroidBuildMirror.kt:
--------------------------------------------------------------------------------
1 | package kshark
2 |
3 | /**
4 | * Caches values from the android.os.Build class in the heap dump.
5 | * Retrieve a cached instances via [fromHeapGraph].
6 | */
7 | class AndroidBuildMirror(
8 | /**
9 | * Value of android.os.Build.MANUFACTURER
10 | */
11 | val manufacturer: String,
12 | /**
13 | * Value of android.os.Build.VERSION.SDK_INT
14 | */
15 | val sdkInt: Int
16 | ) {
17 | companion object {
18 | /**
19 | * @see AndroidBuildMirror
20 | */
21 | fun fromHeapGraph(graph: HeapGraph): AndroidBuildMirror {
22 | return graph.context.getOrPut(AndroidBuildMirror::class.java.name) {
23 | val buildClass = graph.findClassByName("android.os.Build")!!
24 | val versionClass = graph.findClassByName("android.os.Build\$VERSION")!!
25 | val manufacturer = buildClass["MANUFACTURER"]!!.value.readAsJavaString()!!
26 | val sdkInt = versionClass["SDK_INT"]!!.value.asInt!!
27 | AndroidBuildMirror(manufacturer, sdkInt)
28 | }
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/koom-common/third-party/shark/src/main/java/kshark/AppSingletonInspector.kt:
--------------------------------------------------------------------------------
1 | package kshark
2 |
3 | import kshark.HeapObject.HeapInstance
4 |
5 | /**
6 | * Inspector that automatically marks instances of the provided class names as not leaking
7 | * because they're app wide singletons.
8 | */
9 | class AppSingletonInspector(private vararg val singletonClasses: String) : ObjectInspector {
10 | override fun inspect(
11 | reporter: ObjectReporter
12 | ) {
13 | if (reporter.heapObject is HeapInstance) {
14 | reporter.heapObject.instanceClass
15 | .classHierarchy
16 | .forEach { heapClass ->
17 | if (heapClass.name in singletonClasses) {
18 | reporter.notLeakingReasons += "${heapClass.name} is an app singleton"
19 | }
20 | }
21 | }
22 | }
23 | }
--------------------------------------------------------------------------------
/koom-common/third-party/shark/src/main/java/kshark/ByteArraySourceProvider.kt:
--------------------------------------------------------------------------------
1 | package kshark
2 |
3 | import okio.Buffer
4 | import okio.BufferedSource
5 | import okio.Source
6 | import java.io.IOException
7 |
8 | class ByteArraySourceProvider(private val byteArray: ByteArray) : DualSourceProvider {
9 | override fun openStreamingSource(): BufferedSource = Buffer().apply { write(byteArray) }
10 |
11 | override fun openRandomAccessSource(): RandomAccessSource {
12 | return object : RandomAccessSource {
13 |
14 | var closed = false
15 |
16 | override fun read(
17 | sink: Buffer,
18 | position: Long,
19 | byteCount: Long
20 | ): Long {
21 | if (closed) {
22 | throw IOException("Source closed")
23 | }
24 | val maxByteCount = byteCount.coerceAtMost(byteArray.size - position)
25 | sink.write(byteArray, position.toInt(), maxByteCount.toInt())
26 | return maxByteCount
27 | }
28 |
29 | override fun close() {
30 | closed = true
31 | }
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/koom-common/third-party/shark/src/main/java/kshark/CloseableHeapGraph.kt:
--------------------------------------------------------------------------------
1 | package kshark
2 |
3 | import java.io.Closeable
4 |
5 | /**
6 | * A [HeapGraph] that should be closed after being used.
7 | */
8 | interface CloseableHeapGraph : HeapGraph, Closeable
--------------------------------------------------------------------------------
/koom-common/third-party/shark/src/main/java/kshark/DualSourceProvider.kt:
--------------------------------------------------------------------------------
1 | package kshark
2 |
3 | /**
4 | * Both a [StreamingSourceProvider] and a [RandomAccessSourceProvider]
5 | */
6 | interface DualSourceProvider : StreamingSourceProvider, RandomAccessSourceProvider
7 |
--------------------------------------------------------------------------------
/koom-common/third-party/shark/src/main/java/kshark/FileSourceProvider.kt:
--------------------------------------------------------------------------------
1 | package kshark
2 |
3 | import okio.Buffer
4 | import okio.BufferedSource
5 | import okio.Okio
6 | import okio.Source
7 | import java.io.File
8 |
9 | class FileSourceProvider(private val file: File) : DualSourceProvider {
10 | override fun openStreamingSource(): BufferedSource = Okio.buffer(Okio.source(file.inputStream()))
11 |
12 | override fun openRandomAccessSource(): RandomAccessSource {
13 | val channel = file.inputStream().channel
14 | return object : RandomAccessSource {
15 | override fun read(
16 | sink: Buffer,
17 | position: Long,
18 | byteCount: Long
19 | ) = channel.transferTo(position, byteCount, sink)
20 |
21 | override fun close() = channel.close()
22 | }
23 | }
24 | }
--------------------------------------------------------------------------------
/koom-common/third-party/shark/src/main/java/kshark/FilteringLeakingObjectFinder.kt:
--------------------------------------------------------------------------------
1 | package kshark
2 |
3 | /**
4 | * Finds the objects that are leaking by scanning all objects in the heap dump
5 | * and delegating the decision to a list of [FilteringLeakingObjectFinder.LeakingObjectFilter]
6 | */
7 | class FilteringLeakingObjectFinder(private val filters: List) :
8 | LeakingObjectFinder {
9 |
10 | /**
11 | * Filter to be passed to the [FilteringLeakingObjectFinder] constructor.
12 | */
13 | interface LeakingObjectFilter {
14 | /**
15 | * Returns whether the passed in [heapObject] is leaking. This should only return true
16 | * when we're 100% sure the passed in [heapObject] should not be in memory anymore.
17 | */
18 | fun isLeakingObject(heapObject: HeapObject): Boolean
19 | }
20 |
21 | override fun findLeakingObjectIds(graph: HeapGraph): Set {
22 | return graph.objects
23 | .filter { heapObject ->
24 | filters.any { filter ->
25 | filter.isLeakingObject(heapObject)
26 | }
27 | }
28 | .map { it.objectId }
29 | .toSet()
30 | }
31 | }
--------------------------------------------------------------------------------
/koom-common/third-party/shark/src/main/java/kshark/GraphContext.kt:
--------------------------------------------------------------------------------
1 | package kshark
2 |
3 | /**
4 | * In memory store that can be used to store objects in a given [HeapGraph] instance.
5 | * This is a simple [MutableMap] of [String] to [Any], but with unsafe generics access.
6 | */
7 | class GraphContext {
8 | private val store = mutableMapOf()
9 | operator fun get(key: String): T? {
10 | @Suppress("UNCHECKED_CAST")
11 | return store[key] as T?
12 | }
13 |
14 | /**
15 | * @see MutableMap.getOrPut
16 | */
17 | fun getOrPut(
18 | key: String,
19 | defaultValue: () -> T
20 | ): T {
21 | @Suppress("UNCHECKED_CAST")
22 | return store.getOrPut(key, {
23 | defaultValue()
24 | }) as T
25 | }
26 |
27 | /**
28 | * @see MutableMap.set
29 | */
30 | operator fun set(
31 | key: String,
32 | value: T
33 | ) {
34 | store[key] = (value as Any?)
35 | }
36 |
37 | /**
38 | * @see MutableMap.containsKey
39 | */
40 | operator fun contains(key: String): Boolean {
41 | return key in store
42 | }
43 |
44 | /**
45 | * @see MutableMap.remove
46 | */
47 | operator fun minusAssign(key: String) {
48 | @Suppress("UNCHECKED_CAST")
49 | store -= key
50 | }
51 | }
--------------------------------------------------------------------------------
/koom-common/third-party/shark/src/main/java/kshark/HeapAnalysisException.kt:
--------------------------------------------------------------------------------
1 | package kshark
2 |
3 | import java.io.PrintWriter
4 | import java.io.StringWriter
5 |
6 | class HeapAnalysisException(cause: Throwable) : RuntimeException(cause) {
7 |
8 | override fun toString(): String {
9 | val stringWriter = StringWriter()
10 | cause!!.printStackTrace(PrintWriter(stringWriter))
11 | return stringWriter.toString()
12 | }
13 |
14 | companion object {
15 | private const val serialVersionUID: Long = -2522323377375290608
16 | }
17 | }
--------------------------------------------------------------------------------
/koom-common/third-party/shark/src/main/java/kshark/HprofReader.kt:
--------------------------------------------------------------------------------
1 | package kshark
2 |
3 | import kshark.StreamingRecordReaderAdapter.Companion.asStreamingRecordReader
4 | import kotlin.reflect.KClass
5 |
6 | @Deprecated("Replaced by HprofStreamingReader.readerFor or HprofRandomAccessReader.openReaderFor")
7 | class HprofReader internal constructor(
8 | private val hprof: Hprof
9 | ) {
10 | val identifierByteSize: Int
11 | get() = hprof.header.identifierByteSize
12 |
13 | val startPosition: Long
14 | get() = hprof.header.recordsPosition.toLong()
15 |
16 | fun readHprofRecords(
17 | recordTypes: Set>,
18 | listener: OnHprofRecordListener
19 | ) {
20 | val reader = StreamingHprofReader.readerFor(hprof.file, hprof.header).asStreamingRecordReader()
21 | reader.readRecords(recordTypes, listener)
22 | }
23 | }
--------------------------------------------------------------------------------
/koom-common/third-party/shark/src/main/java/kshark/HprofVersion.kt:
--------------------------------------------------------------------------------
1 | package kshark
2 |
3 | /**
4 | * Supported hprof versions
5 | */
6 | enum class HprofVersion(val versionString: String) {
7 | JDK1_2_BETA3("JAVA PROFILE 1.0"),
8 | JDK1_2_BETA4("JAVA PROFILE 1.0.1"),
9 | JDK_6("JAVA PROFILE 1.0.2"),
10 | ANDROID("JAVA PROFILE 1.0.3")
11 | }
12 |
--------------------------------------------------------------------------------
/koom-common/third-party/shark/src/main/java/kshark/LeakNodeStatus.kt:
--------------------------------------------------------------------------------
1 | package kshark
2 |
3 | /**
4 | * This class is kept to support backward compatible deserialization.
5 | */
6 | internal enum class LeakNodeStatus {
7 | NOT_LEAKING,
8 | LEAKING,
9 | UNKNOWN;
10 | }
--------------------------------------------------------------------------------
/koom-common/third-party/shark/src/main/java/kshark/LeakReference.kt:
--------------------------------------------------------------------------------
1 | package kshark
2 |
3 | import kshark.LeakTraceElement.Type.ARRAY_ENTRY
4 | import kshark.LeakTraceElement.Type.INSTANCE_FIELD
5 | import kshark.LeakTraceElement.Type.LOCAL
6 | import kshark.LeakTraceElement.Type.STATIC_FIELD
7 | import java.io.Serializable
8 |
9 | /**
10 | * This class is kept to support backward compatible deserialization.
11 | */
12 | internal class LeakReference : Serializable {
13 |
14 | private val type: LeakTraceElement.Type? = null
15 | private val name: String? = null
16 |
17 | fun fromV20(originObject: LeakTraceObject) = LeakTraceReference(
18 | originObject = originObject,
19 | referenceType = when (type!!) {
20 | INSTANCE_FIELD -> LeakTraceReference.ReferenceType.INSTANCE_FIELD
21 | STATIC_FIELD -> LeakTraceReference.ReferenceType.STATIC_FIELD
22 | LOCAL -> LeakTraceReference.ReferenceType.LOCAL
23 | ARRAY_ENTRY -> LeakTraceReference.ReferenceType.ARRAY_ENTRY
24 | },
25 | owningClassName = originObject.className,
26 | referenceName = name!!
27 | )
28 |
29 | companion object {
30 | private const val serialVersionUID: Long = 2028550902155599651
31 | }
32 | }
--------------------------------------------------------------------------------
/koom-common/third-party/shark/src/main/java/kshark/LeakingObjectFinder.kt:
--------------------------------------------------------------------------------
1 | package kshark
2 |
3 | /**
4 | * Finds the objects that are leaking, for which Shark will compute
5 | * leak traces.
6 | *
7 | * This is a functional interface with which you can create a [LeakingObjectFinder] from a lambda.
8 | */
9 | fun interface LeakingObjectFinder {
10 |
11 | /**
12 | * For a given heap graph, returns a set of object ids for the objects that are leaking.
13 | */
14 | fun findLeakingObjectIds(graph: HeapGraph): Set
15 |
16 | companion object {
17 | /**
18 | * Utility function to create a [LeakingObjectFinder] from the passed in [block] lambda
19 | * instead of using the anonymous `object : LeakingObjectFinder` syntax.
20 | *
21 | * Usage:
22 | *
23 | * ```kotlin
24 | * val listener = LeakingObjectFinder {
25 | *
26 | * }
27 | * ```
28 | */
29 | inline operator fun invoke(crossinline block: (HeapGraph) -> Set): LeakingObjectFinder =
30 | object : LeakingObjectFinder {
31 | override fun findLeakingObjectIds(graph: HeapGraph): Set = block(graph)
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/koom-common/third-party/shark/src/main/java/kshark/MetadataExtractor.kt:
--------------------------------------------------------------------------------
1 | package kshark
2 |
3 | /**
4 | * Extracts metadata from a hprof to be reported in [HeapAnalysisSuccess.metadata].
5 | *
6 | * This is a functional interface with which you can create a [MetadataExtractor] from a lambda.
7 | */
8 | fun interface MetadataExtractor {
9 | fun extractMetadata(graph: HeapGraph): Map
10 |
11 | companion object {
12 |
13 | /**
14 | * A no-op [MetadataExtractor]
15 | */
16 | val NO_OP = MetadataExtractor { emptyMap() }
17 |
18 | /**
19 | * Utility function to create a [MetadataExtractor] from the passed in [block] lambda instead of
20 | * using the anonymous `object : MetadataExtractor` syntax.
21 | *
22 | * Usage:
23 | *
24 | * ```kotlin
25 | * val inspector = MetadataExtractor { graph ->
26 | *
27 | * }
28 | * ```
29 | */
30 | inline operator fun invoke(crossinline block: (HeapGraph) -> Map): MetadataExtractor =
31 | object : MetadataExtractor {
32 | override fun extractMetadata(graph: HeapGraph): Map = block(graph)
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/koom-common/third-party/shark/src/main/java/kshark/ObjectInspector.kt:
--------------------------------------------------------------------------------
1 | package kshark
2 |
3 | /**
4 | * Provides LeakCanary with insights about objects (classes, instances and arrays) found in the
5 | * heap. [inspect] will be called for each object that LeakCanary wants to know more about.
6 | * The implementation can then use the provided [ObjectReporter] to provide insights for that
7 | * object.
8 | *
9 | * This is a functional interface with which you can create a [ObjectInspector] from a lambda.
10 | */
11 | fun interface ObjectInspector {
12 |
13 | /**
14 | * @see [ObjectInspector]
15 | */
16 | fun inspect(reporter: ObjectReporter)
17 |
18 | companion object {
19 | /**
20 | * Utility function to create a [ObjectInspector] from the passed in [block] lambda instead of
21 | * using the anonymous `object : OnHeapAnalyzedListener` syntax.
22 | *
23 | * Usage:
24 | *
25 | * ```kotlin
26 | * val inspector = ObjectInspector { reporter ->
27 | *
28 | * }
29 | * ```
30 | */
31 | inline operator fun invoke(crossinline block: (ObjectReporter) -> Unit): ObjectInspector =
32 | object : ObjectInspector {
33 | override fun inspect(
34 | reporter: ObjectReporter
35 | ) {
36 | block(reporter)
37 | }
38 | }
39 | }
40 | }
--------------------------------------------------------------------------------
/koom-common/third-party/shark/src/main/java/kshark/OnHprofRecordListener.kt:
--------------------------------------------------------------------------------
1 | package kshark
2 |
3 | /**
4 | * Listener passed in to [StreamingHprofReader.readRecords], gets notified for each [HprofRecord]
5 | * found in the heap dump which types is in the set of the recordTypes parameter passed to
6 | * [StreamingHprofReader.readRecords].
7 | *
8 | * This is a functional interface with which you can create a [OnHprofRecordListener] from a lambda.
9 | */
10 | fun interface OnHprofRecordListener {
11 | fun onHprofRecord(
12 | /**
13 | * The position of the record in the underlying hprof file.
14 | */
15 | position: Long,
16 | record: HprofRecord
17 | )
18 |
19 | companion object {
20 | /**
21 | * Utility function to create a [OnHprofRecordListener] from the passed in [block] lambda
22 | * instead of using the anonymous `object : OnHprofRecordListener` syntax.
23 | *
24 | * Usage:
25 | *
26 | * ```kotlin
27 | * val listener = OnHprofRecordListener { position, record ->
28 | *
29 | * }
30 | * ```
31 | */
32 | inline operator fun invoke(crossinline block: (Long, HprofRecord) -> Unit): OnHprofRecordListener =
33 | object : OnHprofRecordListener {
34 | override fun onHprofRecord(
35 | position: Long,
36 | record: HprofRecord
37 | ) {
38 | block(position, record)
39 | }
40 | }
41 | }
42 | }
--------------------------------------------------------------------------------
/koom-common/third-party/shark/src/main/java/kshark/PrimitiveType.kt:
--------------------------------------------------------------------------------
1 | package kshark
2 |
3 | /**
4 | * A primitive type in the prof.
5 | */
6 | enum class PrimitiveType(
7 | /**
8 | * The hprof defined "basic type".
9 | */
10 | val hprofType: Int,
11 | /**
12 | * The size in bytes for each value of that type.
13 | */
14 | val byteSize: Int
15 | ) {
16 | BOOLEAN(4, 1),
17 | CHAR(5, 2),
18 | FLOAT(6, 4),
19 | DOUBLE(7, 8),
20 | BYTE(8, 1),
21 | SHORT(9, 2),
22 | INT(10, 4),
23 | LONG(11, 8);
24 |
25 | companion object {
26 | /**
27 | * The hprof defined "basic type" for references.
28 | */
29 | const val REFERENCE_HPROF_TYPE = 2
30 |
31 | val byteSizeByHprofType = values().map { it.hprofType to it.byteSize }.toMap()
32 |
33 | val primitiveTypeByHprofType = values().map { it.hprofType to it }.toMap()
34 | }
35 | }
--------------------------------------------------------------------------------
/koom-common/third-party/shark/src/main/java/kshark/RandomAccessSource.kt:
--------------------------------------------------------------------------------
1 | package kshark
2 |
3 | import okio.Buffer
4 | import okio.BufferedSource
5 | import okio.Okio
6 | import okio.Source
7 | import okio.Timeout
8 | import java.io.Closeable
9 | import java.io.IOException
10 |
11 | interface RandomAccessSource : Closeable {
12 | @Throws(IOException::class)
13 | fun read(
14 | sink: Buffer,
15 | position: Long,
16 | byteCount: Long
17 | ): Long
18 |
19 | fun asStreamingSource(): BufferedSource {
20 | return Okio.buffer(object : Source {
21 | var position = 0L
22 |
23 | override fun timeout() = Timeout.NONE
24 |
25 | override fun close() {
26 | position = -1
27 | }
28 |
29 | override fun read(
30 | sink: Buffer,
31 | byteCount: Long
32 | ): Long {
33 | if (position == -1L) {
34 | throw IOException("Source closed")
35 | }
36 | val bytesRead = read(sink, position, byteCount)
37 | if (bytesRead == 0L) {
38 | return -1;
39 | }
40 | position += bytesRead
41 | return bytesRead
42 | }
43 | })
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/koom-common/third-party/shark/src/main/java/kshark/RandomAccessSourceProvider.kt:
--------------------------------------------------------------------------------
1 | package kshark
2 |
3 | import okio.Source
4 |
5 | /**
6 | * Can open [RandomAccessSource] instances.
7 | */
8 | interface RandomAccessSourceProvider {
9 | fun openRandomAccessSource(): RandomAccessSource
10 | }
11 |
--------------------------------------------------------------------------------
/koom-common/third-party/shark/src/main/java/kshark/SharkLog.kt:
--------------------------------------------------------------------------------
1 | package kshark
2 |
3 | /**
4 | * Central Logger for all Shark artifacts. Set [logger] to change where these logs go.
5 | */
6 | object SharkLog {
7 |
8 | /**
9 | * @see SharkLog
10 | */
11 | interface Logger {
12 |
13 | /**
14 | * Logs a debug message formatted with the passed in arguments.
15 | */
16 | fun d(message: String)
17 |
18 | /**
19 | * Logs a [Throwable] and debug message formatted with the passed in arguments.
20 | */
21 | fun d(
22 | throwable: Throwable,
23 | message: String
24 | )
25 | }
26 |
27 | @Volatile var logger: Logger? = null
28 |
29 | /**
30 | * @see Logger.d
31 | */
32 | inline fun d(message: () -> String) {
33 | // Local variable to prevent the ref from becoming null after the null check.
34 | val logger = logger ?: return
35 | logger.d(message.invoke())
36 | }
37 |
38 | /**
39 | * @see Logger.d
40 | */
41 | inline fun d(
42 | throwable: Throwable,
43 | message: () -> String
44 | ) {
45 | // Local variable to prevent the ref from becoming null after the null check.
46 | val logger = logger ?: return
47 | logger.d(throwable, message.invoke())
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/koom-common/third-party/shark/src/main/java/kshark/StreamingSourceProvider.kt:
--------------------------------------------------------------------------------
1 | package kshark
2 |
3 | import okio.BufferedSource
4 | import okio.Source
5 |
6 | /**
7 | * Can open [Source] instances.
8 | */
9 | fun interface StreamingSourceProvider {
10 | fun openStreamingSource(): BufferedSource
11 | }
12 |
--------------------------------------------------------------------------------
/koom-common/third-party/shark/src/main/java/kshark/ValueHolder.kt:
--------------------------------------------------------------------------------
1 | package kshark
2 |
3 | import kshark.ValueHolder.ReferenceHolder
4 |
5 | /**
6 | * A value in the heap dump, which can be a [ReferenceHolder] or
7 | * a primitive type.
8 | */
9 | sealed class ValueHolder {
10 | data class ReferenceHolder(val value: Long) : ValueHolder() {
11 | val isNull
12 | get() = value == NULL_REFERENCE
13 | }
14 |
15 | data class BooleanHolder(val value: Boolean) : ValueHolder()
16 | data class CharHolder(val value: Char) : ValueHolder()
17 | data class FloatHolder(val value: Float) : ValueHolder()
18 | data class DoubleHolder(val value: Double) : ValueHolder()
19 | data class ByteHolder(val value: Byte) : ValueHolder()
20 | data class ShortHolder(val value: Short) : ValueHolder()
21 | data class IntHolder(val value: Int) : ValueHolder()
22 | data class LongHolder(val value: Long) : ValueHolder()
23 |
24 | companion object {
25 | const val NULL_REFERENCE = 0L
26 | }
27 | }
--------------------------------------------------------------------------------
/koom-common/third-party/shark/src/main/java/kshark/internal/IndexedObject.kt:
--------------------------------------------------------------------------------
1 | package kshark.internal
2 |
3 | import kshark.PrimitiveType
4 |
5 | internal sealed class IndexedObject {
6 | abstract val position: Long
7 | abstract val recordSize: Long
8 |
9 | class IndexedClass(
10 | override val position: Long,
11 | val superclassId: Long,
12 | val instanceSize: Int,
13 | override val recordSize: Long,
14 | val fieldsIndex: Int
15 | ) : IndexedObject()
16 |
17 | class IndexedInstance(
18 | override val position: Long,
19 | val classId: Long,
20 | override val recordSize: Long
21 | ) : IndexedObject()
22 |
23 | class IndexedObjectArray(
24 | override val position: Long,
25 | val arrayClassId: Long,
26 | override val recordSize: Long
27 | ) : IndexedObject()
28 |
29 | class IndexedPrimitiveArray(
30 | override val position: Long,
31 | primitiveType: PrimitiveType,
32 | override val recordSize: Long
33 | ) : IndexedObject() {
34 | private val primitiveTypeOrdinal: Byte = primitiveType.ordinal.toByte()
35 | val primitiveType: PrimitiveType
36 | get() = PrimitiveType.values()[primitiveTypeOrdinal.toInt()]
37 | }
38 | }
--------------------------------------------------------------------------------
/koom-common/third-party/shark/src/main/java/kshark/internal/aosp/ByteArrayComparator.kt:
--------------------------------------------------------------------------------
1 | package kshark.internal.aosp
2 |
3 | internal interface ByteArrayComparator {
4 |
5 | /**
6 | * Indexes are divided by entrySize
7 | */
8 | fun compare(
9 | entrySize: Int,
10 | o1Array: ByteArray,
11 | o1Index: Int,
12 | o2Array: ByteArray,
13 | o2Index: Int
14 | ): Int
15 | }
--------------------------------------------------------------------------------
/koom-common/third-party/shark/src/main/java/kshark/internal/hppc/Tuples.kt:
--------------------------------------------------------------------------------
1 | package kshark.internal.hppc
2 |
3 | /** Alternative to Pair that doesn't box long.*/
4 | internal data class LongObjectPair(
5 | val first: Long,
6 | val second: B
7 | )
8 |
9 | /** Alternative to Pair that doesn't box int.*/
10 | internal data class IntObjectPair(
11 | val first: Int,
12 | val second: B
13 | )
14 |
15 | /** Alternative to Pair that doesn't box longs. */
16 | internal data class LongLongPair(
17 | val first: Long,
18 | val second: Long
19 | )
20 |
21 | internal infix fun Long.to(that: B): LongObjectPair = LongObjectPair(this, that)
22 |
23 | internal infix fun Int.to(that: B): IntObjectPair = IntObjectPair(this, that)
24 |
25 | internal infix fun Long.to(that: Long): LongLongPair = LongLongPair(this, that)
26 |
--------------------------------------------------------------------------------
/koom-common/third-party/shark/src/main/resources/META-INF/proguard/shark.pro:
--------------------------------------------------------------------------------
1 | # Used during heap analysis to find resource id names
2 | -keep class kshark.AndroidResourceIdNames { *; }
3 |
--------------------------------------------------------------------------------
/koom-common/third-party/xhook/.gitignore:
--------------------------------------------------------------------------------
1 | build
2 | .cxx
3 | .externalNativeBuild
4 | .DS_Store
--------------------------------------------------------------------------------
/koom-common/third-party/xhook/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/wenye/android_sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
--------------------------------------------------------------------------------
/koom-common/third-party/xhook/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/koom-common/third-party/xhook/src/main/libs/arm64-v8a/libxhook_lib.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KwaiAppTeam/KOOM/f653d7c986debb242b1d8b96761351f63d9f04bf/koom-common/third-party/xhook/src/main/libs/arm64-v8a/libxhook_lib.so
--------------------------------------------------------------------------------
/koom-common/third-party/xhook/src/main/libs/armeabi-v7a/libxhook_lib.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KwaiAppTeam/KOOM/f653d7c986debb242b1d8b96761351f63d9f04bf/koom-common/third-party/xhook/src/main/libs/armeabi-v7a/libxhook_lib.so
--------------------------------------------------------------------------------
/koom-common/third-party/xhook/src/main/libs/x86/libxhook_lib.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KwaiAppTeam/KOOM/f653d7c986debb242b1d8b96761351f63d9f04bf/koom-common/third-party/xhook/src/main/libs/x86/libxhook_lib.so
--------------------------------------------------------------------------------
/koom-common/third-party/xhook/src/main/libs/x86_64/libxhook_lib.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KwaiAppTeam/KOOM/f653d7c986debb242b1d8b96761351f63d9f04bf/koom-common/third-party/xhook/src/main/libs/x86_64/libxhook_lib.so
--------------------------------------------------------------------------------
/koom-demo/.gitignore:
--------------------------------------------------------------------------------
1 | build
2 | .DS_Store
--------------------------------------------------------------------------------
/koom-demo/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/koom-demo/src/androidTest/java/com/kwai/oomkiller/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.kwai.oomkiller;
2 |
3 | import static org.junit.Assert.assertEquals;
4 |
5 | import org.junit.Test;
6 | import org.junit.runner.RunWith;
7 |
8 | import android.content.Context;
9 | import androidx.test.ext.junit.runners.AndroidJUnit4;
10 | import androidx.test.platform.app.InstrumentationRegistry;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
23 | assertEquals("com.kwai.oomkiller", appContext.getPackageName());
24 | }
25 | }
--------------------------------------------------------------------------------
/koom-demo/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
25 |
26 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/koom-demo/src/main/java/com/kwai/koom/demo/KOOMApplication.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Kwai, Inc. All rights reserved.
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 | *
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 | * @author Rui Li
17 | */
18 |
19 | package com.kwai.koom.demo;
20 |
21 | import android.app.Application;
22 |
23 | import com.kwai.koom.base.DefaultInitTask;
24 |
25 | public class KOOMApplication extends Application {
26 |
27 | @Override
28 | public void onCreate() {
29 | super.onCreate();
30 | DefaultInitTask.INSTANCE.init(this);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/koom-demo/src/main/java/com/kwai/koom/demo/javaleak/test/BitmapLeakMaker.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Kwai, Inc. All rights reserved.
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 | *
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 | * @author Rui Li
17 | */
18 |
19 | package com.kwai.koom.demo.javaleak.test;
20 |
21 | import android.content.Context;
22 | import android.graphics.Bitmap;
23 |
24 | public class BitmapLeakMaker extends LeakMaker {
25 |
26 | @Override
27 | public void startLeak(Context context) {
28 | Bitmap bitmap = Bitmap.createBitmap(1920, 1080, Bitmap.Config.ARGB_8888);
29 | uselessObjectList.add(bitmap);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/koom-demo/src/main/java/com/kwai/koom/demo/javaleak/test/ByteArrayLeakMaker.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Kwai, Inc. All rights reserved.
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 | *
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 | * @author Rui Li
17 | */
18 |
19 | package com.kwai.koom.demo.javaleak.test;
20 |
21 | import android.content.Context;
22 |
23 | public class ByteArrayLeakMaker extends LeakMaker {
24 |
25 | @Override
26 | public void startLeak(Context context) {
27 | uselessObjectList.add(new ByteArrayHolder());
28 | }
29 |
30 | public static class ByteArrayHolder {
31 | private byte[] array;
32 |
33 | public ByteArrayHolder() {
34 | array = new byte[512 * 1024];
35 | }
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/koom-demo/src/main/java/com/kwai/koom/demo/javaleak/test/FragmentLeakMaker.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Kwai, Inc. All rights reserved.
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 | *
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 | * @author Rui Li
17 | */
18 |
19 | package com.kwai.koom.demo.javaleak.test;
20 |
21 | import android.content.Context;
22 | import androidx.fragment.app.Fragment;
23 |
24 | public class FragmentLeakMaker extends LeakMaker {
25 |
26 | @Override
27 | void startLeak(Context context) {
28 |
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/koom-demo/src/main/java/com/kwai/koom/demo/javaleak/test/StringLeakMaker.java:
--------------------------------------------------------------------------------
1 | package com.kwai.koom.demo.javaleak.test;
2 |
3 | import android.content.Context;
4 |
5 | import com.kwai.koom.demo.javaleak.test.LeakMaker;
6 |
7 | /**
8 | * Copyright 2020 Kwai, Inc. All rights reserved.
9 | *
10 | * Licensed under the Apache License, Version 2.0 (the "License");
11 | * you may not use this file except in compliance with the License.
12 | * You may obtain a copy of the License at
13 | *
16 | * Unless required by applicable law or agreed to in writing, software
17 | * distributed under the License is distributed on an "AS IS" BASIS,
18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 | * See the License for the specific language governing permissions and
20 | * limitations under the License.
21 | *
22 | * @author Rui Li
23 | */
24 | public class StringLeakMaker extends LeakMaker {
25 |
26 | @Override
27 | void startLeak(Context context) {
28 | String largeStr = new String(new byte[512 * 1024]);
29 | uselessObjectList.add(largeStr);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/koom-demo/src/main/java/com/kwai/koom/demo/nativeleak/NativeLeakTest.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021. Kwai, Inc. All rights reserved.
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 | * Created by lbtrace on 2021.
17 | *
18 | */
19 |
20 | package com.kwai.koom.demo.nativeleak
21 |
22 | object NativeLeakTest {
23 | /**
24 | * A native method that is implemented by the 'native-lib' native library,
25 | * which is packaged with this application.
26 | */
27 | @JvmStatic
28 | external fun triggerLeak(any: Any): Long
29 | }
--------------------------------------------------------------------------------
/koom-demo/src/main/java/com/kwai/koom/demo/threadleak/ThreadLeakTest.kt:
--------------------------------------------------------------------------------
1 | package com.kwai.koom.demo.threadleak
2 |
3 | object ThreadLeakTest {
4 | /**
5 | * A native method that is implemented by the 'native-lib' native library,
6 | * which is packaged with this application.
7 | */
8 | @JvmStatic
9 | external fun triggerLeak(delay:Long)
10 | }
--------------------------------------------------------------------------------
/koom-demo/src/main/jni/thread-leak-test.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include
7 |
8 | #define NOINLINE __attribute__((noinline))
9 | #define LOG_TAG "ThreadLeakTest"
10 | #define LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)
11 |
12 | static NOINLINE void TestThreadLeak(int64_t delay) {
13 | std::thread test_thread([](int64_t delay) {
14 | pthread_setname_np(pthread_self(), "test_thread");
15 | LOGI("test_thread run");
16 | std::thread *test_thread_1;
17 | std::thread *test_thread_2;
18 | test_thread_1 = new std::thread([]() {
19 | pthread_setname_np(pthread_self(), "test_thread_1");
20 | LOGI("test_thread_1 run");
21 | });
22 | test_thread_2 = new std::thread([]() {
23 | pthread_setname_np(pthread_self(), "test_thread_2");
24 | LOGI("test_thread_2 run");
25 | });
26 | std::this_thread::sleep_for(std::chrono::milliseconds(delay));
27 | test_thread_1->detach();
28 | LOGI("test_thread_1 detach");
29 | test_thread_2->join();
30 | LOGI("test_thread_2 join");
31 | }, delay);
32 | test_thread.detach();
33 | }
34 |
35 | extern "C"
36 | JNIEXPORT void JNICALL
37 | Java_com_kwai_koom_demo_threadleak_ThreadLeakTest_triggerLeak(
38 | JNIEnv *env,
39 | jclass, jlong delay) {
40 | TestThreadLeak(delay);
41 | }
--------------------------------------------------------------------------------
/koom-demo/src/main/res/layout/activity_thread_leak_test.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
15 |
16 |
21 |
22 |
28 |
29 |
35 |
36 |
--------------------------------------------------------------------------------
/koom-demo/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/koom-demo/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/koom-demo/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KwaiAppTeam/KOOM/f653d7c986debb242b1d8b96761351f63d9f04bf/koom-demo/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/koom-demo/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KwaiAppTeam/KOOM/f653d7c986debb242b1d8b96761351f63d9f04bf/koom-demo/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/koom-demo/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KwaiAppTeam/KOOM/f653d7c986debb242b1d8b96761351f63d9f04bf/koom-demo/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/koom-demo/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KwaiAppTeam/KOOM/f653d7c986debb242b1d8b96761351f63d9f04bf/koom-demo/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/koom-demo/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KwaiAppTeam/KOOM/f653d7c986debb242b1d8b96761351f63d9f04bf/koom-demo/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/koom-demo/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KwaiAppTeam/KOOM/f653d7c986debb242b1d8b96761351f63d9f04bf/koom-demo/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/koom-demo/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KwaiAppTeam/KOOM/f653d7c986debb242b1d8b96761351f63d9f04bf/koom-demo/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/koom-demo/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KwaiAppTeam/KOOM/f653d7c986debb242b1d8b96761351f63d9f04bf/koom-demo/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/koom-demo/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KwaiAppTeam/KOOM/f653d7c986debb242b1d8b96761351f63d9f04bf/koom-demo/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/koom-demo/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KwaiAppTeam/KOOM/f653d7c986debb242b1d8b96761351f63d9f04bf/koom-demo/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/koom-demo/src/main/res/values-night/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
--------------------------------------------------------------------------------
/koom-demo/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #BB86FC
4 | #6200EE
5 | #3700B3
6 | #03DAC5
7 |
--------------------------------------------------------------------------------
/koom-demo/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | OOM Killer
3 | Test Java Leak
4 | Start Java Leak
5 | 1.See OOMonitor tag log\n\n2.Use OOMHprofUploader\n\n3.OOMReportUploader
6 | Test hprof strip
7 | 1.See the log, fetch hprof file from local data path\n\n2.Use jar of tools/koom-fill-crop.jar refill the original hprof
8 |
--------------------------------------------------------------------------------
/koom-demo/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
--------------------------------------------------------------------------------
/koom-demo/src/test/java/com/kwai/oomkiller/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.kwai.oomkiller;
2 |
3 | import static org.junit.Assert.assertEquals;
4 |
5 | import org.junit.Test;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/koom-fast-dump/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/koom-fast-dump/consumer-rules.pro:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KwaiAppTeam/KOOM/f653d7c986debb242b1d8b96761351f63d9f04bf/koom-fast-dump/consumer-rules.pro
--------------------------------------------------------------------------------
/koom-fast-dump/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/koom-fast-dump/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
--------------------------------------------------------------------------------
/koom-fast-dump/src/main/java/com/kwai/koom/fastdump/HeapDumper.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Kwai, Inc. All rights reserved.
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 | *
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 | * Hprof dumper
17 | *
18 | * @author Rui Li
19 | */
20 |
21 | package com.kwai.koom.fastdump;
22 |
23 | public interface HeapDumper {
24 | /**
25 | * dump may cost several seconds, make sure called in a separated thread.
26 | *
27 | * @param path dump file
28 | * @return dump result success or not
29 | */
30 | boolean dump(String path);
31 | }
32 |
--------------------------------------------------------------------------------
/koom-java-leak/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/koom-java-leak/consumer-rules.pro:
--------------------------------------------------------------------------------
1 | # keep fork dump related jni function, must needed
2 | -keep class com.kwai.koom.javaoom.hprof.* {*;}
3 |
4 | # keep heap report json format, must needed
5 | -keep class com.kwai.koom.javaoom.monitor.analysis.HeapReport { *; }
6 | -keep class com.kwai.koom.javaoom.monitor.analysis.HeapReport$* { *; }
7 | -keep class com.kwai.koom.javaoom.monitor.analysis.HeapReport$*$* { *; }
8 |
--------------------------------------------------------------------------------
/koom-java-leak/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/koom-java-leak/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
8 |
9 |
--------------------------------------------------------------------------------
/koom-java-leak/src/main/java/com/kwai/koom/javaoom/monitor/OOMHprofUploader.kt:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2020 Kwai, Inc. All rights reserved.
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 | *
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 | * @author Rui Li
17 | */
18 |
19 | package com.kwai.koom.javaoom.monitor
20 |
21 | import java.io.File
22 |
23 | interface OOMHprofUploader {
24 |
25 | enum class HprofType {
26 | ORIGIN, STRIPPED
27 | }
28 |
29 | /**
30 | * 注意:外部调用完upload后,切记自行删除
31 | */
32 | fun upload(file: File, type: HprofType)
33 | }
--------------------------------------------------------------------------------
/koom-java-leak/src/main/java/com/kwai/koom/javaoom/monitor/OOMReportUploader.kt:
--------------------------------------------------------------------------------
1 | package com.kwai.koom.javaoom.monitor
2 |
3 | import java.io.File
4 |
5 | interface OOMReportUploader {
6 | /**
7 | * 注意:外部调用完upload后,切记自行删除
8 | */
9 | fun upload(file: File, content: String)
10 | }
--------------------------------------------------------------------------------
/koom-java-leak/src/main/java/com/kwai/koom/javaoom/monitor/analysis/AnalysisExtraData.kt:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2020 Kwai, Inc. All rights reserved.
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 | *
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 | * KOOM library entry point.
17 | *
18 | * @author Rui Li
19 | */
20 |
21 | package com.kwai.koom.javaoom.monitor.analysis
22 |
23 | class AnalysisExtraData {
24 | var reason: String? = null
25 |
26 | var usageSeconds: String? = null
27 |
28 | var currentPage: String? = null
29 | }
--------------------------------------------------------------------------------
/koom-java-leak/src/main/java/com/kwai/koom/javaoom/monitor/tracker/OOMTracker.kt:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2020 Kwai, Inc. All rights reserved.
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 | *
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 | * @author Rui Li
17 | */
18 |
19 | package com.kwai.koom.javaoom.monitor.tracker
20 |
21 | import com.kwai.koom.base.Monitor
22 | import com.kwai.koom.javaoom.monitor.OOMMonitorConfig
23 |
24 | abstract class OOMTracker : Monitor() {
25 | /**
26 | * @return true 表示追踪到oom、 false 表示没有追踪到oom
27 | */
28 | abstract fun track(): Boolean
29 |
30 | /**
31 | * 重置track状态
32 | */
33 | abstract fun reset()
34 |
35 | /**
36 | * @return 追踪到的oom的标识
37 | */
38 | abstract fun reason(): String
39 | }
--------------------------------------------------------------------------------
/koom-monitor-base/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/koom-monitor-base/README.md:
--------------------------------------------------------------------------------
1 | # Monitor base Introduction
2 | The basic module shared by the koom monitoring function. Before all monitoring modules are initialized, please make sure that the module has been initialized
3 |
4 | # Monitor base Get Started
5 | ## Setup dependencies
6 | - Add mavenCentral to the repositories of the project root directory build.gradle
7 | ```groovy
8 | repositories {
9 | mavenCentral()
10 | }
11 | ```
12 |
13 | - Add dependency in project app/build.gradle
14 | ```groovy
15 | dependencies {
16 | implementation "com.kuaishou.koom:koom-monitor-base:${latest_version}"
17 | }
18 | ```
19 | ## Setup code
20 | - Initialize `MonitorManager` in the `onCreate` method of `Application`
21 | ```java
22 | public class KOOMApplication extends Application {
23 |
24 | @Override
25 | public void onCreate() {
26 | super.onCreate();
27 | DefaultInitTask.INSTANCE.init(this);
28 | }
29 | }
30 | ```
--------------------------------------------------------------------------------
/koom-monitor-base/README.zh-CN.md:
--------------------------------------------------------------------------------
1 | # monitor base 简介
2 | koom 监控功能共用的基础模块,所有监控模块初始化之前,请确保该模块已经初始化
3 |
4 | # monitor base 初始化
5 | ## 依赖配置
6 | - 项目根目录 build.gradle 的 repositories 中增加 mavenCentral
7 | ```groovy
8 | repositories {
9 | mavenCentral()
10 | }
11 | ```
12 | - 项目 app/build.gradle 中增加依赖
13 | ```groovy
14 | dependencies {
15 | implementation "com.kuaishou.koom:koom-monitor-base:${latest_version}"
16 | }
17 | ```
18 | ## 代码初始化
19 | - 在 `Application` 的 `onCreate` 方法中初始化
20 | ```java
21 | public class KOOMApplication extends Application {
22 |
23 | @Override
24 | public void onCreate() {
25 | super.onCreate();
26 | DefaultInitTask.INSTANCE.init(this);
27 | }
28 | }
29 | ```
--------------------------------------------------------------------------------
/koom-monitor-base/consumer-rules.pro:
--------------------------------------------------------------------------------
1 | -keep class * extends com.kwai.koom.base.Monitor { *; }
--------------------------------------------------------------------------------
/koom-monitor-base/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/koom-monitor-base/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
--------------------------------------------------------------------------------
/koom-monitor-base/src/main/java/com/kwai/koom/base/InitTask.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022. Kwai, Inc. All rights reserved.
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 | * @author KOOM Team
17 | *
18 | */
19 | package com.kwai.koom.base
20 |
21 | import android.app.Application
22 |
23 | interface InitTask {
24 | fun init(application: Application)
25 | }
--------------------------------------------------------------------------------
/koom-monitor-base/src/main/java/com/kwai/koom/base/MonitorBuildConfig.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021. Kwai, Inc. All rights reserved.
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 | * @author KOOM Team
17 | *
18 | */
19 | package com.kwai.koom.base
20 |
21 | import android.os.Build
22 |
23 | object MonitorBuildConfig {
24 |
25 | @JvmStatic
26 | val DEBUG by lazy { MonitorManager.commonConfig.debugMode }
27 |
28 | @JvmStatic
29 | val VERSION_NAME by lazy { MonitorManager.commonConfig.versionNameInvoker() }
30 |
31 | @JvmStatic
32 | val ROM by lazy { Build.MANUFACTURER.toUpperCase()
33 | .let { if (it == "HUAWEI") "EMUI" else "OTHER"} }
34 | }
--------------------------------------------------------------------------------
/koom-monitor-base/src/main/java/com/kwai/koom/base/MonitorConfig.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021. Kwai, Inc. All rights reserved.
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 | * @author KOOM Team
17 | *
18 | */
19 | package com.kwai.koom.base
20 |
21 | abstract class MonitorConfig {
22 | interface Builder> {
23 | fun build(): C
24 | }
25 | }
--------------------------------------------------------------------------------
/koom-monitor-base/src/main/java/com/kwai/koom/base/Monitor_SharedPreferences.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021. Kwai, Inc. All rights reserved.
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 | * @author KOOM Team
17 | *
18 | */
19 | package com.kwai.koom.base
20 |
21 | import android.content.SharedPreferences
22 |
23 | val SharedPreferences.allKeys: Set
24 | get() = MonitorManager.commonConfig.sharedPreferencesKeysInvoker(this)
25 |
--------------------------------------------------------------------------------
/koom-monitor-base/src/main/java/com/kwai/koom/base/loop/LoopThread.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021. Kwai, Inc. All rights reserved.
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 | * @author KOOM Team
17 | *
18 | */
19 | package com.kwai.koom.base.loop
20 |
21 | import android.os.Handler
22 | import android.os.HandlerThread
23 | import android.os.Process.THREAD_PRIORITY_BACKGROUND
24 |
25 | internal object LoopThread : HandlerThread("LoopThread", THREAD_PRIORITY_BACKGROUND) {
26 | init {
27 | start()
28 | }
29 |
30 | internal val LOOP_HANDLER = Handler(LoopThread.looper)
31 | }
--------------------------------------------------------------------------------
/koom-monitor-base/src/test/java/com/kwai/koom/base/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021. Kwai, Inc. All rights reserved.
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 | * @author KOOM Team
17 | *
18 | */
19 |
20 | package com.kwai.koom.base;
21 |
22 | import org.junit.Test;
23 |
24 | import static org.junit.Assert.*;
25 |
26 | /**
27 | * Example local unit test, which will execute on the development machine (host).
28 | *
29 | * @see Testing documentation
30 | */
31 | public class ExampleUnitTest {
32 | @Test
33 | public void addition_isCorrect() {
34 | assertEquals(4, 2 + 2);
35 | }
36 | }
--------------------------------------------------------------------------------
/koom-native-leak/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/koom-native-leak/consumer-rules.pro:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KwaiAppTeam/KOOM/f653d7c986debb242b1d8b96761351f63d9f04bf/koom-native-leak/consumer-rules.pro
--------------------------------------------------------------------------------
/koom-native-leak/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/koom-native-leak/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
--------------------------------------------------------------------------------
/koom-native-leak/src/main/java/com/kwai/koom/nativeoom/leakmonitor/LeakListener.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021. Kwai, Inc. All rights reserved.
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 | * Created by lbtrace on 2021.
17 | *
18 | */
19 |
20 | package com.kwai.koom.nativeoom.leakmonitor
21 |
22 | interface LeakListener {
23 | /**
24 | * Return leak info collection, if no leak, collection is empty
25 | */
26 | fun onLeak(leaks: MutableCollection)
27 | }
--------------------------------------------------------------------------------
/koom-native-leak/src/main/jni/include/constants.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021. Kwai, Inc. All rights reserved.
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 | * Created by lbtrace on 2021.
17 | *
18 | */
19 |
20 | #ifndef KOOM_NATIVE_OOM_SRC_MAIN_JNI_INCLUDE_CONSTANTS_H_
21 | #define KOOM_NATIVE_OOM_SRC_MAIN_JNI_INCLUDE_CONSTANTS_H_
22 |
23 | #include
24 |
25 | const uint32_t kMaxBacktraceSize = 12;
26 | const uint32_t kMaxThreadNameLen = 16;
27 | const uint32_t kDefaultAllocThreshold = 15;
28 |
29 | #endif // KOOM_NATIVE_OOM_SRC_MAIN_JNI_INCLUDE_CONSTANTS_H_
30 |
--------------------------------------------------------------------------------
/koom-native-leak/src/main/jni/include/utils/auto_time.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021. Kwai, Inc. All rights reserved.
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 | * Created by lbtrace on 2021.
17 | *
18 | */
19 |
20 | #ifndef KOOM_NATIVE_OOM_SRC_MAIN_JNI_INCLUDE_UTILS_AUTO_TIME_H_
21 | #define KOOM_NATIVE_OOM_SRC_MAIN_JNI_INCLUDE_UTILS_AUTO_TIME_H_
22 | #include
23 |
24 | #include
25 |
26 | class AutoTime {
27 | public:
28 | AutoTime(const char *tag = nullptr) : tag_(tag), start_(clock()) {}
29 | ~AutoTime() {
30 | clock_t end = clock();
31 | ALOGI("%s consume time: %f s", tag_ ? tag_ : "",
32 | (static_cast(end - start_) / CLOCKS_PER_SEC));
33 | }
34 |
35 | private:
36 | const char *tag_;
37 | clock_t start_;
38 | };
39 | #endif // KOOM_NATIVE_OOM_SRC_MAIN_JNI_INCLUDE_UTILS_AUTO_TIME_H_
40 |
--------------------------------------------------------------------------------
/koom-native-leak/src/test/java/com/kwai/koom/nativeoom/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 |
2 | package com.kwai.koom.nativeoom;
3 |
4 | import org.junit.Test;
5 |
6 | import static org.junit.Assert.*;
7 |
8 | /**
9 | * Example local unit test, which will execute on the development machine (host).
10 | *
11 | * @see Testing documentation
12 | */
13 | public class ExampleUnitTest {
14 | @Test
15 | public void addition_isCorrect() {
16 | assertEquals(4, 2 + 2);
17 | }
18 | }
--------------------------------------------------------------------------------
/koom-thread-leak/consumer-rules.pro:
--------------------------------------------------------------------------------
1 | -keep class com.kwai.performance.overhead.thread.monitor.NativeHandler { *; }
2 |
--------------------------------------------------------------------------------
/koom-thread-leak/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/koom-thread-leak/src/main/cpp/src/common/constant.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021. Kwai, Inc. All rights reserved.
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 | * Created by shenvsv on 2021.
17 | *
18 | */
19 |
20 | #ifndef APM_RESDETECTOR_CONSTANT_H
21 | #define APM_RESDETECTOR_CONSTANT_H
22 |
23 | #include
24 | #include
25 |
26 | namespace koom {
27 |
28 | namespace Constant {
29 | #define ALWAYS_INLINE __attribute__((always_inline))
30 |
31 | const static int kMaxCallStackDepth = 18;
32 | const static int kDlopenSourceInit = 0;
33 | } // namespace Constant
34 | } // namespace koom
35 | #endif // APM_RESDETECTOR_CONSTANT_H
36 |
--------------------------------------------------------------------------------
/koom-thread-leak/src/main/cpp/src/common/looper.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021. Kwai, Inc. All rights reserved.
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 | * Created by shenvsv on 2021.
17 | *
18 | */
19 |
20 | #include
21 | #include
22 | struct LooperMessage;
23 | class looper {
24 | public:
25 | looper();
26 | ~looper();
27 | virtual void post(int what, void *data, bool flush = false);
28 | void quit();
29 | virtual void handle(int what, void *data);
30 |
31 | private:
32 | void addMsg(LooperMessage *msg, bool flush);
33 | static void *trampoline(void *p);
34 | void loop();
35 | LooperMessage *head = nullptr;
36 | LooperMessage *tail = nullptr;
37 | pthread_t worker;
38 | sem_t headWriteProtect;
39 | sem_t headDataAvailable;
40 | bool running;
41 | };
--------------------------------------------------------------------------------
/koom-thread-leak/src/main/cpp/src/thread/hook_looper.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021. Kwai, Inc. All rights reserved.
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 | * Created by shenvsv on 2021.
17 | *
18 | */
19 |
20 | #ifndef APM_KOOM_THREAD_SRC_MAIN_CPP_SRC_THREAD_HOOK_LOOPER_H_
21 | #define APM_KOOM_THREAD_SRC_MAIN_CPP_SRC_THREAD_HOOK_LOOPER_H_
22 |
23 | #include
24 |
25 | #include