├── app
├── Android.mk
├── MrknLogService
│ ├── res
│ │ └── values
│ │ │ └── strings.xml
│ ├── Android.mk
│ ├── AndroidManifest.xml
│ └── src
│ │ └── com
│ │ └── marakana
│ │ └── android
│ │ └── logservice
│ │ ├── LogServiceApp.java
│ │ └── ILogServiceImpl.java
├── MrknLogClient
│ ├── Android.mk
│ ├── res
│ │ ├── values
│ │ │ └── strings.xml
│ │ └── layout
│ │ │ └── log.xml
│ ├── AndroidManifest.xml
│ └── src
│ │ └── com
│ │ └── marakana
│ │ └── android
│ │ └── mrknlogclient
│ │ └── LogActivity.java
└── MrknLogNative
│ ├── res
│ ├── values
│ │ └── strings.xml
│ └── layout
│ │ └── log.xml
│ ├── Android.mk
│ ├── AndroidManifest.xml
│ └── src
│ └── com
│ └── marakana
│ └── android
│ └── mrknlognative
│ └── LogActivity.java
├── bin
├── Android.mk
├── mrknlog
│ ├── Android.mk
│ └── mrknlog.c
└── mrknlogd
│ ├── Android.mk
│ └── mrknlogd.c
├── lib
├── Android.mk
└── libmrknlog
│ ├── Android.mk
│ └── libmrknlog.c
├── framework
├── Android.mk
├── libmrknlog_jni
│ ├── Android.mk
│ ├── java
│ │ ├── com
│ │ │ └── marakana
│ │ │ │ └── android
│ │ │ │ └── lib
│ │ │ │ └── log
│ │ │ │ ├── LibLogException.java
│ │ │ │ ├── LibLog.java
│ │ │ │ └── Main.java
│ │ ├── com.marakana.android.lib.log.xml
│ │ └── Android.mk
│ └── jni
│ │ ├── Android.mk
│ │ └── com_marakana_android_lib_log_LibLog.cpp
└── mrknlogservice
│ ├── com.marakana.android.service.log.xml
│ ├── com
│ └── marakana
│ │ └── android
│ │ └── service
│ │ └── log
│ │ ├── ILogListener.aidl
│ │ ├── ILogService.aidl
│ │ ├── LogListener.java
│ │ └── LogManager.java
│ └── Android.mk
├── kernel
├── .gitignore
├── sepolicy
├── system_app.te
├── service.te
├── service_contexts
├── file_contexts
└── mrknlogd.te
├── AndroidProducts.mk
├── vendorsetup.sh
├── system.prop
├── sdk_addon
├── alpha_sdk_addon_stub_defs.txt
├── hardware.ini
├── source.properties
├── sys-img
│ └── source.prop_template
├── manifest.ini
├── repository_sysimg.xml
└── repository_addon.xml
├── overlay
└── frameworks
│ └── base
│ └── core
│ └── res
│ └── res
│ ├── drawable-nodpi
│ └── default_wallpaper.jpg
│ └── values
│ └── config.xml
├── ueventd.goldfish.rc
├── packages.mk
├── README.asciidoc
├── common.mk
├── fstab.goldfish
├── include
└── mrknlog.h
├── full_alpha.mk
├── BoardConfig.mk
├── alpha_sdk_addon.mk
├── init.goldfish.rc
└── NOTICE
/app/Android.mk:
--------------------------------------------------------------------------------
1 | include $(call all-subdir-makefiles)
2 |
--------------------------------------------------------------------------------
/bin/Android.mk:
--------------------------------------------------------------------------------
1 | include $(call all-subdir-makefiles)
2 |
--------------------------------------------------------------------------------
/lib/Android.mk:
--------------------------------------------------------------------------------
1 | include $(call all-subdir-makefiles)
2 |
--------------------------------------------------------------------------------
/framework/Android.mk:
--------------------------------------------------------------------------------
1 | include $(call all-subdir-makefiles)
2 |
--------------------------------------------------------------------------------
/kernel:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thenewcircle/alpha/HEAD/kernel
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | #IDE Project Files
2 | .classpath
3 | .project
4 | *.iml
5 |
6 |
--------------------------------------------------------------------------------
/framework/libmrknlog_jni/Android.mk:
--------------------------------------------------------------------------------
1 | include $(call all-subdir-makefiles)
2 |
--------------------------------------------------------------------------------
/sepolicy/system_app.te:
--------------------------------------------------------------------------------
1 | allow system_app mrknlog_service:service_manager add;
2 |
--------------------------------------------------------------------------------
/sepolicy/service.te:
--------------------------------------------------------------------------------
1 | type mrknlog_service, app_api_service, service_manager_type;
2 |
--------------------------------------------------------------------------------
/sepolicy/service_contexts:
--------------------------------------------------------------------------------
1 | com.marakana.android.service.log.ILogService u:object_r:mrknlog_service:s0
2 |
--------------------------------------------------------------------------------
/AndroidProducts.mk:
--------------------------------------------------------------------------------
1 | PRODUCT_MAKEFILES := $(LOCAL_DIR)/full_alpha.mk
2 |
3 | PRODUCT_MAKEFILES += $(LOCAL_DIR)/alpha_sdk_addon.mk
--------------------------------------------------------------------------------
/sepolicy/file_contexts:
--------------------------------------------------------------------------------
1 | # Domain transition for newcircle log daemon
2 | /system/bin/mrknlogd u:object_r:mrknlogd_exec:s0
3 |
--------------------------------------------------------------------------------
/vendorsetup.sh:
--------------------------------------------------------------------------------
1 | add_lunch_combo full_alpha-eng
2 | add_lunch_combo full_alpha-userdebug
3 | add_lunch_combo full_alpha-user
4 |
5 |
--------------------------------------------------------------------------------
/system.prop:
--------------------------------------------------------------------------------
1 | #
2 | # system.prop for generic sdk
3 | #
4 |
5 | rild.libpath=/system/lib/libreference-ril.so
6 | rild.libargs=-d /dev/ttyS0
7 |
--------------------------------------------------------------------------------
/sdk_addon/alpha_sdk_addon_stub_defs.txt:
--------------------------------------------------------------------------------
1 | +com.marakana.android.lib.log.*
2 | -com.marakana.android.lib.log.Main
3 | +com.marakana.android.service.log.*
4 |
--------------------------------------------------------------------------------
/overlay/frameworks/base/core/res/res/drawable-nodpi/default_wallpaper.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thenewcircle/alpha/HEAD/overlay/frameworks/base/core/res/res/drawable-nodpi/default_wallpaper.jpg
--------------------------------------------------------------------------------
/sdk_addon/hardware.ini:
--------------------------------------------------------------------------------
1 | # Custom hardware options for the add-on.
2 | # Properties defined here impact all AVD targeting this add-on.
3 | # Each skin can also override those values with its own hardware.ini file.
4 | vm.heapSize = 24
5 |
--------------------------------------------------------------------------------
/framework/libmrknlog_jni/java/com/marakana/android/lib/log/LibLogException.java:
--------------------------------------------------------------------------------
1 | package com.marakana.android.lib.log;
2 |
3 | public class LibLogException extends RuntimeException {
4 | public LibLogException(String msg) {
5 | super(msg);
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/framework/libmrknlog_jni/java/com.marakana.android.lib.log.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/MrknLogService/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Flush Log
4 | flush the main log buffer
5 |
6 |
--------------------------------------------------------------------------------
/framework/mrknlogservice/com.marakana.android.service.log.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/sdk_addon/source.properties:
--------------------------------------------------------------------------------
1 | #This file is a stub, used only for testing local installs
2 | Addon.NameDisplay=Alpha Add-On
3 | Addon.NameId=alpha
4 | Addon.VendorDisplay=NewCircle
5 | Addon.VendorId=newcircle
6 | Pkg.Desc=NewCircle Alpha Add-on
7 | AndroidVersion.ApiLevel=23
8 | Pkg.Revision=1
9 |
--------------------------------------------------------------------------------
/overlay/frameworks/base/core/res/res/values/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4
4 |
5 | true
6 |
--------------------------------------------------------------------------------
/framework/mrknlogservice/com/marakana/android/service/log/ILogListener.aidl:
--------------------------------------------------------------------------------
1 | package com.marakana.android.service.log;
2 |
3 | /**
4 | * Listener for used log size change events.
5 | *
6 | * {@hide}
7 | */
8 | oneway interface ILogListener {
9 | void onUsedLogSizeChange(int usedLogSize);
10 | }
11 |
--------------------------------------------------------------------------------
/app/MrknLogClient/Android.mk:
--------------------------------------------------------------------------------
1 | LOCAL_PATH:= $(call my-dir)
2 | include $(CLEAR_VARS)
3 |
4 | LOCAL_MODULE_TAGS := optional
5 | LOCAL_SRC_FILES := $(call all-java-files-under,src)
6 | LOCAL_JAVA_LIBRARIES := com.marakana.android.service.log
7 | LOCAL_PACKAGE_NAME := MrknLogClient
8 |
9 | include $(BUILD_PACKAGE)
10 |
--------------------------------------------------------------------------------
/sepolicy/mrknlogd.te:
--------------------------------------------------------------------------------
1 | # newcircle log daemon
2 | type mrknlogd, domain, mlstrustedsubject;
3 | type mrknlogd_exec, exec_type, file_type;
4 |
5 | init_daemon_domain(mrknlogd)
6 |
7 | # let the daemon access logd
8 | allow mrknlogd logd_socket:sock_file write;
9 | allow mrknlogd logd:unix_stream_socket connectto;
10 |
--------------------------------------------------------------------------------
/app/MrknLogClient/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Marakana Log Client
4 | Using %1$d of %2$d bytes of the log buffer
5 | Flush Log Buffer
6 |
7 |
--------------------------------------------------------------------------------
/sdk_addon/sys-img/source.prop_template:
--------------------------------------------------------------------------------
1 | Addon.VendorDisplay=NewCircle
2 | Addon.VendorId=newcircle
3 | AndroidVersion.ApiLevel=${PLATFORM_SDK_VERSION}
4 | Pkg.Desc=NewCircle Alpha Platform ${PLATFORM_VERSION}
5 | Pkg.Revision=1
6 | SystemImage.Abi=${TARGET_CPU_ABI}
7 | SystemImage.TagDisplay=Alpha Add-On
8 | SystemImage.TagId=alpha
9 |
--------------------------------------------------------------------------------
/app/MrknLogNative/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Marakana Log Native
4 | Using %1$d of %2$d bytes of the log buffer
5 | Flush Log Buffer
6 |
7 |
--------------------------------------------------------------------------------
/bin/mrknlog/Android.mk:
--------------------------------------------------------------------------------
1 | LOCAL_PATH:= $(call my-dir)
2 | include $(CLEAR_VARS)
3 |
4 | LOCAL_MODULE_TAGS := optional
5 | LOCAL_SRC_FILES := mrknlog.c
6 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../include/
7 | LOCAL_SHARED_LIBRARIES := libhardware
8 | LOCAL_CFLAGS += -g -O0
9 | LOCAL_MODULE := mrknlog
10 |
11 | include $(BUILD_EXECUTABLE)
12 |
13 |
--------------------------------------------------------------------------------
/ueventd.goldfish.rc:
--------------------------------------------------------------------------------
1 | # These settings are specific to running under the Android emulator
2 | /dev/qemu_trace 0666 system system
3 | /dev/qemu_pipe 0666 system system
4 | /dev/goldfish_pipe 0666 system system
5 | /dev/ttyS* 0666 system system
6 | /proc 0666 system system
7 |
--------------------------------------------------------------------------------
/bin/mrknlogd/Android.mk:
--------------------------------------------------------------------------------
1 | LOCAL_PATH:= $(call my-dir)
2 | include $(CLEAR_VARS)
3 |
4 | LOCAL_MODULE_TAGS := optional
5 | LOCAL_SRC_FILES := mrknlogd.c
6 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../include/
7 | LOCAL_SHARED_LIBRARIES := libcutils libhardware
8 | LOCAL_CFLAGS += -g -O0
9 | LOCAL_MODULE := mrknlogd
10 |
11 | include $(BUILD_EXECUTABLE)
12 |
13 |
--------------------------------------------------------------------------------
/sdk_addon/manifest.ini:
--------------------------------------------------------------------------------
1 | name=Alpha Add-On
2 | name-id=alpha
3 | vendor=NewCircle
4 | vendor-id=newcircle
5 | api=23
6 | libraries=com.marakana.android.lib.log;com.marakana.android.service.log
7 | com.marakana.android.lib.log=com.marakana.android.lib.log.jar;Marakana Log Library
8 | com.marakana.android.service.log=com.marakana.android.service.log.jar;Marakana Log Service
9 |
--------------------------------------------------------------------------------
/app/MrknLogNative/Android.mk:
--------------------------------------------------------------------------------
1 | LOCAL_PATH:= $(call my-dir)
2 | include $(CLEAR_VARS)
3 |
4 | LOCAL_MODULE_TAGS := optional
5 | LOCAL_SRC_FILES := $(call all-java-files-under,src)
6 | LOCAL_REQUIRED_MODULES := com.marakana.android.lib.log
7 | LOCAL_JAVA_LIBRARIES := com.marakana.android.lib.log
8 | LOCAL_PACKAGE_NAME := MrknLogNative
9 | LOCAL_PROGUARD_ENABLED := disabled
10 | LOCAL_CERTIFICATE := platform
11 |
12 | include $(BUILD_PACKAGE)
13 |
--------------------------------------------------------------------------------
/packages.mk:
--------------------------------------------------------------------------------
1 | # Add these packages to this product
2 | PRODUCT_PACKAGES += mrknlog.default
3 | PRODUCT_PACKAGES += mrknlog
4 | PRODUCT_PACKAGES += mrknlogd
5 |
6 | PRODUCT_PACKAGES += \
7 | com.marakana.android.lib.log \
8 | com.marakana.android.lib.log.xml \
9 | libmrknlog_jni
10 |
11 | PRODUCT_PACKAGES += \
12 | com.marakana.android.service.log \
13 | com.marakana.android.service.log.xml
14 |
15 | PRODUCT_PACKAGES += MrknLogService
16 |
--------------------------------------------------------------------------------
/framework/libmrknlog_jni/jni/Android.mk:
--------------------------------------------------------------------------------
1 | LOCAL_PATH:= $(call my-dir)
2 | include $(CLEAR_VARS)
3 |
4 | LOCAL_MODULE_TAGS := optional
5 | LOCAL_SRC_FILES := com_marakana_android_lib_log_LibLog.cpp
6 | LOCAL_C_INCLUDES += $(JNI_H_INCLUDE) $(LOCAL_PATH)/../../../include/
7 | LOCAL_CFLAGS += -g -O0 -Wno-unused-parameter
8 | LOCAL_SHARED_LIBRARIES := libcutils libhardware libnativehelper
9 | LOCAL_MODULE := libmrknlog_jni
10 |
11 | include $(BUILD_SHARED_LIBRARY)
12 |
--------------------------------------------------------------------------------
/framework/mrknlogservice/com/marakana/android/service/log/ILogService.aidl:
--------------------------------------------------------------------------------
1 | package com.marakana.android.service.log;
2 |
3 | import com.marakana.android.service.log.ILogListener;
4 |
5 | /**
6 | * System-private API for talking to the LogService.
7 | *
8 | * {@hide}
9 | */
10 | interface ILogService {
11 | void flushLog();
12 | int getTotalLogSize();
13 | int getUsedLogSize();
14 | void register(in ILogListener listener);
15 | void unregister(in ILogListener listener);
16 | }
17 |
--------------------------------------------------------------------------------
/lib/libmrknlog/Android.mk:
--------------------------------------------------------------------------------
1 | LOCAL_PATH:= $(call my-dir)
2 | include $(CLEAR_VARS)
3 |
4 | LOCAL_MODULE_TAGS := optional
5 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../include/
6 | LOCAL_SRC_FILES := libmrknlog.c
7 | LOCAL_SHARED_LIBRARIES := libcutils
8 | LOCAL_CFLAGS += -g -O0 -Wno-unused-parameter
9 | #Also defines the output file name
10 | LOCAL_MODULE := mrknlog.default
11 | #Put this module in the HAL search path
12 | LOCAL_MODULE_RELATIVE_PATH := hw
13 |
14 | include $(BUILD_SHARED_LIBRARY)
15 |
--------------------------------------------------------------------------------
/framework/mrknlogservice/com/marakana/android/service/log/LogListener.java:
--------------------------------------------------------------------------------
1 | package com.marakana.android.service.log;
2 |
3 | /**
4 | * Used for receiving notifications from the LogManager when the buffer size has changed.
5 | */
6 | public interface LogListener {
7 |
8 | /**
9 | * Called when the buffer size has changed.
10 | * Invoked on the main/looper/UI thread.
11 | *
12 | * @param usedLogSize the new log buffer size.
13 | */
14 | public void onUsedLogSizeChange(int usedLogSize);
15 | }
16 |
17 |
--------------------------------------------------------------------------------
/README.asciidoc:
--------------------------------------------------------------------------------
1 | = About This Project
2 |
3 | This project demonstrates how to put together a simple custom device for Android Open Source Project (AOSP).
4 |
5 | Clone into aosp/device/newcircle/alpha
6 |
7 | This code was developed to support NewCircle's Android Training courses.
8 |
9 | For more info, see http://thenewcircle.com/training/android/
10 |
11 | == Legal
12 |
13 | Please see ++NOTICE++ file in this directory for copyright, license terms, and legal disclaimers.
14 |
15 | Copyright © 2015 NewCircle Inc.
16 |
17 |
--------------------------------------------------------------------------------
/app/MrknLogClient/res/layout/log.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
7 |
9 |
10 |
--------------------------------------------------------------------------------
/app/MrknLogNative/res/layout/log.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
7 |
9 |
10 |
--------------------------------------------------------------------------------
/app/MrknLogService/Android.mk:
--------------------------------------------------------------------------------
1 | LOCAL_PATH:= $(call my-dir)
2 | include $(CLEAR_VARS)
3 |
4 | LOCAL_MODULE_TAGS := optional
5 | LOCAL_SRC_FILES := $(call all-java-files-under,src)
6 | LOCAL_REQUIRED_MODULES := \
7 | com.marakana.android.service.log \
8 | com.marakana.android.lib.log
9 | LOCAL_JAVA_LIBRARIES := \
10 | com.marakana.android.service.log \
11 | com.marakana.android.lib.log \
12 | framework
13 | LOCAL_PACKAGE_NAME := MrknLogService
14 | LOCAL_SDK_VERSION := current
15 | LOCAL_PROGUARD_ENABLED := disabled
16 | LOCAL_CERTIFICATE := platform
17 |
18 | include $(BUILD_PACKAGE)
19 |
--------------------------------------------------------------------------------
/framework/libmrknlog_jni/java/com/marakana/android/lib/log/LibLog.java:
--------------------------------------------------------------------------------
1 | package com.marakana.android.lib.log;
2 |
3 | public class LibLog {
4 |
5 | public LibLog() {
6 | this.init();
7 | }
8 |
9 | @Override
10 | protected void finalize() {
11 | this.close();
12 | }
13 |
14 | private native void init() throws LibLogException;
15 | public native void close();
16 | public native void flushLog() throws LibLogException;
17 | public native int getTotalLogSize() throws LibLogException;
18 | public native int getUsedLogSize() throws LibLogException;
19 |
20 | static {
21 | System.loadLibrary("mrknlog_jni");
22 | }
23 | }
24 |
25 |
--------------------------------------------------------------------------------
/app/MrknLogNative/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/framework/libmrknlog_jni/java/com/marakana/android/lib/log/Main.java:
--------------------------------------------------------------------------------
1 | package com.marakana.android.lib.log;
2 |
3 | /** @hide */
4 | public class Main {
5 | public static void main (String[] args) {
6 | try {
7 | LibLog libLog = new LibLog();
8 | try {
9 | int usedSize = libLog.getUsedLogSize();
10 | int totalSize = libLog.getTotalLogSize();
11 | libLog.flushLog();
12 | System.out.printf("Flushed log. Previously it was consuming %d of %d bytes\n",
13 | usedSize, totalSize);
14 | } finally {
15 | libLog.close();
16 | }
17 | } catch (LibLogException e) {
18 | System.err.println("Failed to flush the log");
19 | e.printStackTrace();
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/app/MrknLogClient/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
8 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/common.mk:
--------------------------------------------------------------------------------
1 | # Include all makefiles in sub-directories (one level deep)
2 | include $(call all-subdir-makefiles)
3 |
4 | # These are the hardware-specific features
5 | PRODUCT_COPY_FILES += \
6 | frameworks/native/data/etc/handheld_core_hardware.xml:system/etc/permissions/handheld_core_hardware.xml
7 |
8 | # Enable overlays
9 | DEVICE_PACKAGE_OVERLAYS := $(LOCAL_PATH)/overlay
10 |
11 | # Enable our custom kernel
12 | LOCAL_KERNEL := $(LOCAL_PATH)/kernel
13 | PRODUCT_COPY_FILES += $(LOCAL_KERNEL):kernel
14 |
15 | # Copy our init, ueventd, and fstab configuration files to the root
16 | # file system (ramdisk.img -> boot.img)
17 | PRODUCT_COPY_FILES += $(LOCAL_PATH)/init.goldfish.rc:root/init.goldfish.rc
18 |
19 | # Include all packages from this file
20 | include $(LOCAL_PATH)/packages.mk
21 |
--------------------------------------------------------------------------------
/fstab.goldfish:
--------------------------------------------------------------------------------
1 | # Android fstab file.
2 | #
3 | # The filesystem that contains the filesystem checker binary (typically /system) cannot
4 | # specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK
5 | /dev/block/mtdblock0 /system ext4 ro,barrier=1 wait
6 | /dev/block/mtdblock1 /data ext4 noatime,nosuid,nodev,barrier=1,nomblk_io_submit wait,check
7 | /dev/block/mtdblock2 /cache ext4 noatime,nosuid,nodev wait,check
8 | /devices/platform/goldfish_mmc.0 auto vfat defaults voldmanaged=sdcard:auto
9 |
--------------------------------------------------------------------------------
/app/MrknLogService/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/app/MrknLogService/src/com/marakana/android/logservice/LogServiceApp.java:
--------------------------------------------------------------------------------
1 | package com.marakana.android.logservice;
2 |
3 | import android.app.Application;
4 | import android.os.ServiceManager;
5 | import android.util.Log;
6 | import com.marakana.android.service.log.ILogService;
7 |
8 | public class LogServiceApp extends Application {
9 | private static final String TAG = "LogServiceApp";
10 | private static final String REMOTE_SERVICE_NAME = ILogService.class.getName();
11 | private ILogServiceImpl serviceImpl;
12 |
13 | public void onCreate() {
14 | super.onCreate();
15 | this.serviceImpl = new ILogServiceImpl(this);
16 | ServiceManager.addService(REMOTE_SERVICE_NAME, this.serviceImpl);
17 | Log.d(TAG, "Registered [" + serviceImpl.getClass().getName()
18 | + "] as [" + REMOTE_SERVICE_NAME + "]");
19 | }
20 |
21 | public void onTerminate() {
22 | super.onTerminate();
23 | Log.d(TAG, "Terminated");
24 | }
25 | }
26 |
27 |
--------------------------------------------------------------------------------
/framework/libmrknlog_jni/java/Android.mk:
--------------------------------------------------------------------------------
1 | LOCAL_PATH := $(call my-dir)
2 |
3 | # Build the library
4 | include $(CLEAR_VARS)
5 | LOCAL_MODULE_TAGS := optional
6 | LOCAL_MODULE := com.marakana.android.lib.log
7 | LOCAL_SRC_FILES := $(call all-java-files-under,.)
8 | include $(BUILD_JAVA_LIBRARY)
9 |
10 | # Build the documentation
11 | include $(CLEAR_VARS)
12 | LOCAL_SRC_FILES := $(call all-subdir-java-files) $(call all-subdir-html-files)
13 | LOCAL_MODULE:= com.marakana.android.lib.log_doc
14 | LOCAL_DROIDDOC_OPTIONS := com.marakana.android.lib.log
15 | LOCAL_MODULE_CLASS := JAVA_LIBRARIES
16 | LOCAL_DROIDDOC_USE_STANDARD_DOCLET := true
17 | include $(BUILD_DROIDDOC)
18 |
19 | # Copy com.marakana.android.lib.log.xml to /system/etc/permissions/
20 | include $(CLEAR_VARS)
21 | LOCAL_MODULE_TAGS := optional
22 | LOCAL_MODULE := com.marakana.android.lib.log.xml
23 | LOCAL_MODULE_CLASS := ETC
24 | LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/permissions
25 | LOCAL_SRC_FILES := $(LOCAL_MODULE)
26 | include $(BUILD_PREBUILT)
27 |
--------------------------------------------------------------------------------
/framework/mrknlogservice/Android.mk:
--------------------------------------------------------------------------------
1 | LOCAL_PATH := $(call my-dir)
2 |
3 | # Build the library
4 | include $(CLEAR_VARS)
5 | LOCAL_MODULE_TAGS := optional
6 | LOCAL_MODULE := com.marakana.android.service.log
7 | LOCAL_SRC_FILES := $(call all-java-files-under,.)
8 | LOCAL_SRC_FILES += com/marakana/android/service/log/ILogListener.aidl
9 | LOCAL_SRC_FILES += com/marakana/android/service/log/ILogService.aidl
10 | include $(BUILD_JAVA_LIBRARY)
11 |
12 | # Build the documentation
13 | include $(CLEAR_VARS)
14 | LOCAL_SRC_FILES := $(call all-subdir-java-files) $(call all-subdir-html-files)
15 | LOCAL_MODULE:= com.marakana.android.service.log_doc
16 | LOCAL_DROIDDOC_OPTIONS := com.marakana.android.service.log
17 | LOCAL_MODULE_CLASS := JAVA_LIBRARIES
18 | LOCAL_DROIDDOC_USE_STANDARD_DOCLET := true
19 | include $(BUILD_DROIDDOC)
20 |
21 | # Copy com.marakana.android.service.log.xml to /system/etc/permissions/
22 | include $(CLEAR_VARS)
23 | LOCAL_MODULE_TAGS := optional
24 | LOCAL_MODULE := com.marakana.android.service.log.xml
25 | LOCAL_MODULE_CLASS := ETC
26 | LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/permissions
27 | LOCAL_SRC_FILES := $(LOCAL_MODULE)
28 | include $(BUILD_PREBUILT)
29 |
--------------------------------------------------------------------------------
/include/mrknlog.h:
--------------------------------------------------------------------------------
1 | #ifndef _MRKNLOG_INTERFACE_H
2 | #define _MRKNLOG_INTERFACE_H
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 |
11 | __BEGIN_DECLS
12 |
13 | #define MRKNLOG_HARDWARE_MODULE_ID "mrknlog"
14 |
15 | struct mrknlog_device_t {
16 | /*
17 | * Common HAL device structure.
18 | * Always placed at the head of the module definition.
19 | */
20 | struct hw_device_t common;
21 |
22 | /*
23 | * Android liblog reference to the sub-log(s) we
24 | * want to access from this module.
25 | */
26 | struct logger_list *logger_list;
27 |
28 | /*
29 | * Flush the log device
30 | *
31 | * Returns: 0 on success, error code on failure
32 | */
33 | int (*flush_log)(struct mrknlog_device_t* dev);
34 |
35 | /*
36 | * Get the total log size
37 | *
38 | * Returns: total log size, < 0 on failure
39 | */
40 | int (*get_total_log_size)(struct mrknlog_device_t* dev);
41 |
42 | /*
43 | * Get the used log size
44 | *
45 | * Returns: used log size, < 0 on failure
46 | */
47 | int (*get_used_log_size)(struct mrknlog_device_t* dev);
48 | };
49 |
50 | __END_DECLS
51 |
52 | #endif /* End of the _MRKNLOG_INTERFACE_H block */
53 |
--------------------------------------------------------------------------------
/bin/mrknlog/mrknlog.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | #include
6 | #include
7 |
8 | int main (int argc, char* argv[]) {
9 | hw_module_t* module;
10 | int ret = hw_get_module(MRKNLOG_HARDWARE_MODULE_ID, (hw_module_t const**)&module);
11 | if (ret == 0) {
12 | struct mrknlog_device_t *dev;
13 | ret = module->methods->open(module, 0, (struct hw_device_t **) &dev);
14 | if (ret == 0) {
15 | int usedSize = dev->get_used_log_size(dev);
16 | int totalSize = dev->get_total_log_size(dev);
17 | if (totalSize >= 0 && usedSize >= 0) {
18 | if (dev->flush_log(dev) == 0) {
19 | printf("Flushed log. Previously it was consuming %d of %d bytes\n",
20 | usedSize, totalSize);
21 | ret = 0;
22 | } else {
23 | fprintf(stderr, "Failed to flush log: %s", strerror(errno));
24 | ret = -1;
25 | }
26 | } else {
27 | fprintf(stderr, "Failed to get log size: %s", strerror(errno));
28 | ret = -2;
29 | }
30 | dev->common.close((struct hw_device_t *)dev);
31 | } else {
32 | fprintf(stderr, "Failed to open device: %d", ret);
33 | ret = -3;
34 | }
35 | } else {
36 | fprintf(stderr, "Failed to get module: %s", MRKNLOG_HARDWARE_MODULE_ID);
37 | ret = -4;
38 | }
39 | return ret;
40 | }
41 |
--------------------------------------------------------------------------------
/full_alpha.mk:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright 2013 The Android Open-Source Project
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 | #
16 |
17 | # Include the common definitions and packages
18 | # This is done before inherit to override any duplicates
19 | include $(LOCAL_PATH)/common.mk
20 |
21 | # Inherit all packages from the "full" Android product
22 | $(call inherit-product, $(SRC_TARGET_DIR)/product/full_x86.mk)
23 |
24 | # Override inherited values
25 | PRODUCT_NAME := full_alpha
26 | PRODUCT_DEVICE := alpha
27 | PRODUCT_MODEL := Full Alpha Image for Emulator
28 |
29 | # Enable overlays
30 | DEVICE_PACKAGE_OVERLAYS := $(LOCAL_PATH)/overlay
31 |
32 | # Include SELinux policy additions for our services
33 | BOARD_SEPOLICY_DIRS += device/newcircle/alpha/sepolicy
34 |
35 | # Add our device-specific packages
36 | PRODUCT_PACKAGES += MrknLogNative
37 | PRODUCT_PACKAGES += MrknLogClient
38 |
--------------------------------------------------------------------------------
/BoardConfig.mk:
--------------------------------------------------------------------------------
1 | # config.mk
2 | #
3 | # Product-specific compile-time definitions.
4 | #
5 |
6 | # The generic product target doesn't have any hardware-specific pieces.
7 | TARGET_NO_BOOTLOADER := true
8 | TARGET_NO_KERNEL := false
9 | TARGET_CPU_ABI := x86
10 | TARGET_ARCH := x86
11 | TARGET_ARCH_VARIANT := x86
12 | TARGET_PRELINK_MODULE := false
13 |
14 | # The IA emulator (qemu) uses the Goldfish devices
15 | HAVE_HTC_AUDIO_DRIVER := true
16 | BOARD_USES_GENERIC_AUDIO := true
17 |
18 | # no hardware camera
19 | USE_CAMERA_STUB := true
20 |
21 | # customize the malloced address to be 16-byte aligned
22 | BOARD_MALLOC_ALIGNMENT := 16
23 |
24 | # Enable dex-preoptimization to speed up the first boot sequence
25 | # of an SDK AVD. Note that this operation only works on Linux for now
26 | ifeq ($(HOST_OS),linux)
27 | WITH_DEXPREOPT ?= true
28 | endif
29 |
30 | # Build OpenGLES emulation host and guest libraries
31 | BUILD_EMULATOR_OPENGL := true
32 |
33 | # Build and enable the OpenGL ES View renderer. When running on the emulator,
34 | # the GLES renderer disables itself if host GL acceleration isn't available.
35 | USE_OPENGL_RENDERER := true
36 |
37 | TARGET_USERIMAGES_USE_EXT4 := true
38 | BOARD_SYSTEMIMAGE_PARTITION_SIZE := 1342177280 # 1.25 GB
39 | BOARD_USERDATAIMAGE_PARTITION_SIZE := 576716800
40 | BOARD_CACHEIMAGE_PARTITION_SIZE := 69206016
41 | BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
42 | BOARD_FLASH_BLOCK_SIZE := 512
43 | TARGET_USERIMAGES_SPARSE_EXT_DISABLED := true
44 |
45 | BOARD_SEPOLICY_DIRS += \
46 | build/target/board/generic/sepolicy \
47 | build/target/board/generic_x86/sepolicy
48 |
--------------------------------------------------------------------------------
/sdk_addon/repository_sysimg.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this SDK addon except in compliance with the License.
6 | You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0
7 |
8 | Unless required by applicable law or agreed to in writing, software
9 | distributed under the License is distributed on an "AS IS" BASIS,
10 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | See the License for the specific language governing permissions and
12 | limitations under the License.
13 |
14 |
15 | 1
16 | NewCircle SDK Platform 6.0
17 | 23
18 | x86
19 |
20 |
21 | 187303276
22 | 33f9a1d41f16cb6f5b8099752131b8f01d5f53c3
23 | alpha_sdk_img_r1.zip
24 |
25 |
26 |
27 |
28 |
29 | newcircle
30 | NewCircle
31 |
32 | alpha
33 |
34 |
35 |
--------------------------------------------------------------------------------
/app/MrknLogNative/src/com/marakana/android/mrknlognative/LogActivity.java:
--------------------------------------------------------------------------------
1 | package com.marakana.android.mrknlognative;
2 |
3 | import android.app.Activity;
4 | import android.os.Bundle;
5 | import android.os.Handler;
6 | import android.view.View;
7 | import android.widget.Button;
8 | import android.widget.TextView;
9 | import com.marakana.android.lib.log.LibLog;
10 |
11 | public class LogActivity extends Activity
12 | implements View.OnClickListener, Runnable {
13 |
14 | private TextView output;
15 | private Handler handler;
16 | private LibLog libLog;
17 |
18 | public void onCreate(Bundle savedInstanceState) {
19 | super.onCreate(savedInstanceState);
20 | super.setContentView(R.layout.log);
21 | this.output = (TextView) super.findViewById(R.id.output);
22 | Button button = (Button) super.findViewById(R.id.button);
23 | button.setOnClickListener(this);
24 | this.handler = new Handler();
25 | }
26 |
27 | @Override
28 | public void onResume() {
29 | super.onResume();
30 | this.libLog = new LibLog();
31 | this.handler.post(this);
32 | }
33 |
34 | @Override
35 | public void onPause() {
36 | super.onPause();
37 | this.handler.removeCallbacks(this);
38 | this.libLog.close();
39 | }
40 |
41 | public void onClick(View view) {
42 | this.libLog.flushLog();
43 | this.updateOutput();
44 | }
45 |
46 | public void run() {
47 | this.updateOutput();
48 | this.handler.postDelayed(this, 1000);
49 | }
50 |
51 | private void updateOutput() {
52 | int usedLogSize = this.libLog.getUsedLogSize();
53 | int totalLogSize = this.libLog.getTotalLogSize();
54 | this.output.setText(
55 | super.getString(R.string.log_utilization_message,
56 | usedLogSize, totalLogSize));
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/alpha_sdk_addon.mk:
--------------------------------------------------------------------------------
1 | # Include the common stuff
2 | include $(LOCAL_PATH)/common.mk
3 |
4 | # List of modules to include in the the add-on system image
5 | #PRODUCT_PACKAGES +=
6 |
7 | # The name of this add-on (for the SDK)
8 | PRODUCT_SDK_ADDON_NAME := alpha_sdk_addon
9 |
10 | # Copy the following files for this add-on's SDK
11 | PRODUCT_SDK_ADDON_COPY_FILES := \
12 | $(LOCAL_PATH)/sdk_addon/source.properties:source.properties \
13 | $(LOCAL_PATH)/sdk_addon/manifest.ini:manifest.ini \
14 | $(LOCAL_PATH)/sdk_addon/hardware.ini:hardware.ini
15 |
16 | # The add-on system image doesn't explicitly copy the kernel for us
17 | PRODUCT_SDK_ADDON_COPY_FILES += $(LOCAL_KERNEL):images/x86/kernel-qemu
18 |
19 | # Copy the jar files for the libraries (APIs) exposed in this add-on's SDK
20 | PRODUCT_SDK_ADDON_COPY_MODULES := \
21 | com.marakana.android.lib.log:libs/com.marakana.android.lib.log.jar \
22 | com.marakana.android.service.log:libs/com.marakana.android.service.log.jar
23 |
24 | PRODUCT_SDK_ADDON_STUB_DEFS := $(LOCAL_PATH)/sdk_addon/alpha_sdk_addon_stub_defs.txt
25 |
26 | # Req'd on Lollipop+, system images are built as a separate package
27 | PRODUCT_SDK_ADDON_SYS_IMG_SOURCE_PROP := $(LOCAL_PATH)/sdk_addon/sys-img/source.prop_template
28 |
29 | # Define the name of the documentation to generate for this add-on's SDK
30 | PRODUCT_SDK_ADDON_DOC_MODULES := \
31 | com.marakana.android.service.log_doc
32 |
33 | # Define a config file for the emulated acceleration
34 | BOARD_EGL_CFG := device/generic/goldfish/opengl/system/egl/egl.cfg
35 |
36 | # This add-on extends the default sdk product.
37 | $(call inherit-product, $(SRC_TARGET_DIR)/product/sdk_x86.mk)
38 |
39 | # The name of this add-on (for the build system)
40 | # Use 'make PRODUCT--sdk_addon' to build the an add-on,
41 | # so in this case, we would run 'make PRODUCT-alpha_sdk_addon-sdk_addon'
42 | PRODUCT_NAME := alpha_sdk_addon
43 | PRODUCT_DEVICE := alpha
44 | PRODUCT_MODEL := NewCircle Alpha SDK Addon Image for Emulator
45 |
--------------------------------------------------------------------------------
/bin/mrknlogd/mrknlogd.c:
--------------------------------------------------------------------------------
1 | #define LOG_TAG "MRKN Log Daemon"
2 |
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 | #include
12 |
13 | int runFlag = 1;
14 |
15 | static void sig_handler(int signo) {
16 | SLOGI("Caught signal %d. Scheduling exit.", signo);
17 | runFlag = 0;
18 | }
19 |
20 | int main (int argc, char* argv[]) {
21 | int ret;
22 | if (argc != 2) {
23 | fprintf(stderr, "Usage: %s \n", argv[0]);
24 | ret = -1;
25 | } else {
26 | hw_module_t* module;
27 | ret = hw_get_module(MRKNLOG_HARDWARE_MODULE_ID, (hw_module_t const**)&module);
28 | if (ret == 0) {
29 | struct mrknlog_device_t *dev;
30 | ret = module->methods->open(module, 0, (struct hw_device_t **) &dev);
31 | if (ret == 0) {
32 | int frequency = atoi(argv[1]);
33 | int totalSize;
34 | int usedSize;
35 | int count = 1;
36 | while(runFlag) {
37 | totalSize = dev->get_total_log_size(dev);
38 | usedSize = dev->get_used_log_size(dev);
39 | if (dev->flush_log(dev) == 0) {
40 | SLOGI("Flushed log (%d, %d of %d bytes). Waiting %d seconds before the next flush.",
41 | count, usedSize, totalSize, frequency);
42 | } else if (errno == ECONNREFUSED) {
43 | SLOGW("Too early to flush log. Socket not ready yet.");
44 | } else {
45 | SLOGE("Failed to flush log. Bailing out: %s", strerror(errno));
46 | break;
47 | }
48 | count++;
49 | sleep(frequency);
50 | }
51 | SLOGI("Done after %d iterations.", count);
52 | dev->common.close((struct hw_device_t *)dev);
53 | } else {
54 | fprintf(stderr, "Failed to open device: %d", ret);
55 | ret = -2;
56 | }
57 | } else {
58 | fprintf(stderr, "Failed to get module: %s", MRKNLOG_HARDWARE_MODULE_ID);
59 | ret = -3;
60 | }
61 | }
62 | return ret;
63 | }
64 |
--------------------------------------------------------------------------------
/sdk_addon/repository_addon.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this SDK addon except in compliance with the License.
6 | You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0
7 |
8 | Unless required by applicable law or agreed to in writing, software
9 | distributed under the License is distributed on an "AS IS" BASIS,
10 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | See the License for the specific language governing permissions and
12 | limitations under the License.
13 |
14 |
15 | newcircle
16 | NewCircle
17 | alpha
18 | Alpha Add-On
19 | 23
20 | 1
21 | NewCircle Alpha Add-On
22 | http://thenewcircle.com/
23 |
24 |
25 |
26 | 104797
27 | 7418c038e40bdd82ebc8533183ab9404ad6860ec
28 | alpha_sdk_addon_r1.zip
29 |
30 |
31 |
32 |
33 |
34 | com.marakana.android.lib.log
35 | LibLog
36 |
37 |
38 | com.marakana.android.service.log
39 | LogService
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/app/MrknLogClient/src/com/marakana/android/mrknlogclient/LogActivity.java:
--------------------------------------------------------------------------------
1 |
2 | package com.marakana.android.mrknlogclient;
3 |
4 | import android.app.Activity;
5 | import android.content.pm.PackageManager;
6 | import android.os.Bundle;
7 | import android.view.View;
8 | import android.view.View.OnClickListener;
9 | import android.widget.Button;
10 | import android.widget.TextView;
11 |
12 | import com.marakana.android.service.log.LogListener;
13 | import com.marakana.android.service.log.LogManager;
14 |
15 | public class LogActivity extends Activity implements OnClickListener, LogListener {
16 |
17 | private static final String FLUSH_LOG =
18 | "com.marakana.android.logservice.FLUSH_LOG";
19 |
20 | private TextView output;
21 |
22 | private final LogManager logManager = LogManager.getInstance();
23 |
24 | private final int totalLogSize = this.logManager.getTotalLogSize();
25 |
26 | public void onCreate(Bundle savedInstanceState) {
27 | super.onCreate(savedInstanceState);
28 | super.setContentView(R.layout.log);
29 | this.output = (TextView)super.findViewById(R.id.output);
30 | Button button = (Button)super.findViewById(R.id.button);
31 | button.setOnClickListener(this);
32 | }
33 |
34 | private void updateOutput(int usedLogSize) {
35 | this.output.setText(super.getString(R.string.log_utilization_message,
36 | usedLogSize, this.totalLogSize));
37 | }
38 |
39 | @Override
40 | public void onResume() {
41 | super.onResume();
42 | this.logManager.register(this);
43 | this.updateOutput(this.logManager.getUsedLogSize());
44 | }
45 |
46 | @Override
47 | public void onPause() {
48 | super.onPause();
49 | this.logManager.unregister(this);
50 | }
51 |
52 | @Override
53 | public void onClick(View view) {
54 | //Verify the FLUSH_LOG permission
55 | if (checkSelfPermission(FLUSH_LOG)
56 | != PackageManager.PERMISSION_GRANTED) {
57 | //Ask the user for permission
58 | requestPermissions(new String[]{FLUSH_LOG}, 0);
59 | } else {
60 | //We already have permission
61 | flushLog();
62 | }
63 | }
64 |
65 | @Override
66 | public void onRequestPermissionsResult(int requestCode,
67 | String permissions[], int[] grantResults) {
68 | // If request is cancelled, the result arrays are empty.
69 | if (grantResults.length > 0
70 | && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
71 | //Permission was granted
72 | flushLog();
73 | }
74 | }
75 |
76 | private void flushLog() {
77 | this.logManager.flushLog();
78 | this.updateOutput(0);
79 | }
80 |
81 | @Override
82 | public void onUsedLogSizeChange(int usedLogSize) {
83 | this.updateOutput(usedLogSize);
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/framework/libmrknlog_jni/jni/com_marakana_android_lib_log_LibLog.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include "JNIHelp.h"
5 |
6 | static const char * class_name = "com/marakana/android/lib/log/LibLog";
7 |
8 | static mrknlog_device_t *device;
9 |
10 | static void throwLibLogException(JNIEnv *env, const char *msg) {
11 | jniThrowException(env, "com/marakana/android/lib/log/LibLogException", msg);
12 | }
13 |
14 | static void native_init(JNIEnv *env, jobject object) {
15 | hw_module_t* module;
16 | int err = hw_get_module(MRKNLOG_HARDWARE_MODULE_ID, (hw_module_t const**)&module);
17 | if (err) {
18 | throwLibLogException(env, "Failed to get module");
19 | } else {
20 | struct mrknlog_device_t *dev;
21 | err = module->methods->open(module, 0, (struct hw_device_t **) &dev);
22 | if (err) {
23 | throwLibLogException(env, "Failed to open device");
24 | } else {
25 | device = dev;
26 | }
27 | }
28 | }
29 |
30 | static void native_close(JNIEnv *env, jobject object) {
31 | if (device) {
32 | device->common.close((struct hw_device_t *)device);
33 | device = NULL;
34 | }
35 | }
36 |
37 | static struct mrknlog_device_t * getDevice(JNIEnv *env, jobject object) {
38 | if (device) {
39 | return device;
40 | }
41 | throwLibLogException(env, "Not initialized or closed");
42 | return NULL;
43 | }
44 |
45 | static void flushLog(JNIEnv *env, jobject object) {
46 | struct mrknlog_device_t *dev = getDevice(env, object);
47 | if (dev && dev->flush_log(dev) != 0) {
48 | throwLibLogException(env, "Failed to flush log");
49 | }
50 | }
51 |
52 | static jint getTotalLogSize(JNIEnv *env, jobject object) {
53 | struct mrknlog_device_t *dev = getDevice(env, object);
54 | int ret = 0;
55 | if (dev) {
56 | ret = dev->get_total_log_size(dev);
57 | if (ret < 0) {
58 | throwLibLogException(env, "Failed to get total log size");
59 | }
60 | }
61 | return ret;
62 | }
63 |
64 | static jint getUsedLogSize(JNIEnv *env, jobject object) {
65 | struct mrknlog_device_t *dev = getDevice(env, object);
66 | int ret = 0;
67 | if (dev) {
68 | ret = dev->get_used_log_size(dev);
69 | if (ret < 0) {
70 | throwLibLogException(env, "Failed to get used log size");
71 | }
72 | }
73 | return ret;
74 | }
75 |
76 | static JNINativeMethod method_table[] = {
77 | { "init", "()V", (void *) native_init },
78 | { "close", "()V", (void *) native_close },
79 | { "flushLog", "()V", (void *) flushLog },
80 | { "getTotalLogSize", "()I", (void *) getTotalLogSize },
81 | { "getUsedLogSize", "()I", (void *) getUsedLogSize }
82 | };
83 |
84 |
85 | extern "C" jint JNI_OnLoad(JavaVM* vm, void* reserved) {
86 | JNIEnv* env = NULL;
87 | if (vm->GetEnv((void**) &env, JNI_VERSION_1_6) == JNI_OK) {
88 | if (jniRegisterNativeMethods(env, class_name, method_table, NELEM(method_table)) == 0) {
89 | return JNI_VERSION_1_6;
90 | }
91 | }
92 | return JNI_ERR;
93 | }
94 |
--------------------------------------------------------------------------------
/init.goldfish.rc:
--------------------------------------------------------------------------------
1 |
2 | on early-init
3 | mount debugfs debugfs /sys/kernel/debug
4 |
5 | on init
6 | # See storage config details at http://source.android.com/tech/storage/
7 | mkdir /mnt/media_rw/sdcard 0700 media_rw media_rw
8 | mkdir /storage/sdcard 0700 root root
9 |
10 | export EXTERNAL_STORAGE /storage/sdcard
11 |
12 | # Support legacy paths
13 | symlink /storage/sdcard /sdcard
14 | symlink /storage/sdcard /mnt/sdcard
15 |
16 | on boot
17 | setprop ARGH ARGH
18 | setprop net.eth0.gw 10.0.2.2
19 | setprop net.eth0.dns1 10.0.2.3
20 | setprop net.dns1 10.0.2.3
21 | setprop net.gprs.local-ip 10.0.2.15
22 | setprop ro.radio.use-ppp no
23 | setprop ro.build.product generic
24 | setprop ro.product.device generic
25 |
26 | # fake some battery state
27 | setprop status.battery.state Slow
28 | setprop status.battery.level 5
29 | setprop status.battery.level_raw 50
30 | setprop status.battery.level_scale 9
31 |
32 | # disable some daemons the emulator doesn't want
33 | stop dund
34 | stop akmd
35 |
36 | # start essential services
37 | start qemud
38 | start goldfish-logcat
39 | start goldfish-setup
40 |
41 | setprop ro.setupwizard.mode EMULATOR
42 |
43 | # enable Google-specific location features,
44 | # like NetworkLocationProvider and LocationCollector
45 | setprop ro.com.google.locationfeatures 1
46 |
47 | # For the emulator, which bypasses Setup Wizard, you can specify
48 | # account info for the device via these two properties. Google
49 | # Login Service will insert these accounts into the database when
50 | # it is created (ie, after a data wipe).
51 | #
52 | # setprop ro.config.hosted_account username@hosteddomain.org:password
53 | # setprop ro.config.google_account username@gmail.com:password
54 | #
55 | # You MUST have a Google account on the device, and you MAY
56 | # additionally have a hosted account. No other configuration is
57 | # supported, and arbitrary breakage may result if you specify
58 | # something else.
59 |
60 | on fs
61 | mount_all /fstab.goldfish
62 |
63 | service goldfish-setup /system/etc/init.goldfish.sh
64 | user root
65 | group root
66 | oneshot
67 |
68 | # The qemu-props program is used to set various system
69 | # properties on boot. It must be run early during the boot
70 | # process to avoid race conditions with other daemons that
71 | # might read them (e.g. surface flinger), so define it in
72 | # class 'core'
73 | #
74 | service qemu-props /system/bin/qemu-props
75 | class core
76 | user root
77 | group root
78 | oneshot
79 |
80 | service qemud /system/bin/qemud
81 | socket qemud stream 666
82 | oneshot
83 |
84 | # -Q is a special logcat option that forces the
85 | # program to check wether it runs on the emulator
86 | # if it does, it redirects its output to the device
87 | # named by the androidboot.console kernel option
88 | # if not, is simply exits immediately
89 |
90 | service goldfish-logcat /system/bin/logcat -Q
91 | oneshot
92 |
93 | # fusewrapped external sdcard daemon running as media_rw (1023)
94 | service fuse_sdcard /system/bin/sdcard -u 1023 -g 1023 -d /mnt/media_rw/sdcard /storage/sdcard
95 | class late_start
96 | disabled
97 |
98 | # Custom log-flushing daemon
99 | service mrknlogd /system/bin/mrknlogd 30
100 | class late_start
101 | user system
102 | group log
103 | oneshot
--------------------------------------------------------------------------------
/lib/libmrknlog/libmrknlog.c:
--------------------------------------------------------------------------------
1 | #define LOG_NDEBUG 1 /* <1> */
2 | #define LOG_TAG "MrknLog" /* <1> */
3 | #define LOG_ID LOG_ID_MAIN /* <2> */
4 |
5 | #include /* <3> */
6 | #include
7 | #include
8 | #include
9 | #include
10 |
11 | static struct logger* get_logger_device(struct logger_list *logger_list) {
12 | // "open" retrieves and existing logger from the list
13 | return android_logger_open(logger_list, LOG_ID); /* <4> */
14 | }
15 |
16 | static int flush_log(struct mrknlog_device_t* dev) {
17 | SLOGV("Flushing %s", android_log_id_to_name(LOG_ID)); /* <1> */
18 |
19 | struct logger *logger = get_logger_device(dev->logger_list);
20 | return android_logger_clear(logger); /* <4> */
21 | }
22 |
23 | static int get_total_log_size(struct mrknlog_device_t* dev) {
24 | SLOGV("Getting total buffer size of %s", /* <1> */
25 | android_log_id_to_name(LOG_ID));
26 |
27 | struct logger *logger = get_logger_device(dev->logger_list);
28 | return android_logger_get_log_size(logger); /* <4> */
29 | }
30 |
31 | static int get_used_log_size(struct mrknlog_device_t* dev) {
32 | SLOGV("Getting used buffer size of %s", /* <1> */
33 | android_log_id_to_name(LOG_ID));
34 |
35 | struct logger *logger = get_logger_device(dev->logger_list);
36 | return android_logger_get_log_readable_size(logger); /* <4> */
37 | }
38 |
39 | static int close_mrknlog(struct mrknlog_device_t* dev) {
40 | SLOGV("Closing %s", android_log_id_to_name(LOG_ID)); /* <1> */
41 |
42 | if (dev) {
43 | android_logger_list_free(dev->logger_list); /* <4> */
44 | free(dev); /* <5> */
45 | }
46 | return 0;
47 | }
48 |
49 | static int open_mrknlog(const struct hw_module_t *module, char const *name,
50 | struct hw_device_t **device) {
51 |
52 | struct logger_list *logger_read = android_logger_list_open( /* <4> */
53 | LOG_ID, O_RDONLY | O_NDELAY, 1, 0);
54 |
55 | if (!logger_read) {
56 | SLOGE("Failed to open %s: %s", /* <1> */
57 | android_log_id_to_name(LOG_ID), strerror(errno));
58 | return -1;
59 | } else {
60 | struct mrknlog_device_t *dev = /* <3> */
61 | malloc(sizeof(struct mrknlog_device_t)); /* <5> */
62 | if (!dev) {
63 | return -ENOMEM;
64 | }
65 | SLOGV("Opened %s", android_log_id_to_name(LOG_ID)); /* <1> */
66 | memset(dev, 0, sizeof(*dev)); /* <5> */
67 | dev->common.tag = HARDWARE_DEVICE_TAG; /* <5> */
68 | dev->common.version = 0; /* <5> */
69 | dev->common.module = (struct hw_module_t *)module; /* <5> */
70 | dev->common.close = /* <6> */
71 | (int (*)(struct hw_device_t *)) close_mrknlog;
72 | dev->logger_list = logger_read;
73 | dev->flush_log = flush_log; /* <6> */
74 | dev->get_total_log_size = get_total_log_size; /* <6> */
75 | dev->get_used_log_size = get_used_log_size; /* <6> */
76 |
77 | *device = (struct hw_device_t *)dev;
78 | return 0;
79 | }
80 | }
81 |
82 | static struct hw_module_methods_t mrknlog_module_methods = {
83 | .open = open_mrknlog, /* <6> */
84 | };
85 |
86 | struct hw_module_t HAL_MODULE_INFO_SYM = { /* <7> */
87 | .tag = HARDWARE_MODULE_TAG,
88 | .version_major = 1,
89 | .version_minor = 0,
90 | .id = MRKNLOG_HARDWARE_MODULE_ID, /* <3> */
91 | .name = "mrknlog module",
92 | .author = "NewCircle, Inc.",
93 | .methods = &mrknlog_module_methods, /* <6> */
94 | };
95 |
--------------------------------------------------------------------------------
/framework/mrknlogservice/com/marakana/android/service/log/LogManager.java:
--------------------------------------------------------------------------------
1 | package com.marakana.android.service.log;
2 |
3 | import android.os.Handler;
4 | import android.os.IBinder;
5 | import android.os.Message;
6 | import android.os.RemoteException;
7 | import android.os.ServiceManager;
8 | import android.util.Log;
9 | import android.util.Slog; /* This is to avoid generating events for ourselves */
10 | import java.util.HashMap;
11 |
12 | public class LogManager {
13 | private static final String TAG = "LogManager";
14 | private static final String REMOTE_SERVICE_NAME = ILogService.class.getName();
15 | private static final boolean DEBUG = false; // change to true to enable debugging
16 |
17 | private HashMap mListeners =
18 | new HashMap();
19 |
20 | private class ListenerTransport extends ILogListener.Stub { // <1>
21 | private LogListener mListener;
22 |
23 | public ListenerTransport(LogListener listener) {
24 | mListener = listener;
25 | }
26 |
27 | private void clearListener() {
28 | mListener = null;
29 | }
30 |
31 | @Override
32 | public void onUsedLogSizeChange(final int usedLogSize) { // <2>
33 | if (DEBUG) Slog.d(TAG, "onUsedLogSizeChange: " + usedLogSize);
34 |
35 | Message message = mHandler.obtainMessage();
36 | message.arg1 = usedLogSize;
37 | mHandler.sendMessage(message);
38 | }
39 |
40 | private final Handler mHandler = new Handler() { // <3>
41 | @Override
42 | public void handleMessage(Message message) { // <4>
43 | if (mListener == null) return;
44 |
45 | int usedLogSize = message.arg1;
46 | if (DEBUG) Slog.d(TAG, "Notifying local listener: " + usedLogSize);
47 | mListener.onUsedLogSizeChange(usedLogSize); // <6>
48 | }
49 | };
50 | }
51 |
52 | //Singleton instance
53 | private static LogManager sInstance;
54 |
55 | private final ILogService mService;
56 |
57 | public static synchronized LogManager getInstance() {
58 | if (sInstance == null) {
59 | sInstance = new LogManager();
60 | }
61 | return sInstance;
62 | }
63 |
64 | private LogManager() {
65 | Log.d(TAG, "Connecting to ILogService by name [" + REMOTE_SERVICE_NAME + "]");
66 | mService = ILogService.Stub.asInterface(
67 | ServiceManager.getService(REMOTE_SERVICE_NAME)); // <7>
68 | if (mService == null) {
69 | throw new IllegalStateException("Failed to find ILogService by name [" + REMOTE_SERVICE_NAME + "]");
70 | }
71 | }
72 |
73 | public void flushLog() {
74 | try {
75 | if (DEBUG) Slog.d(TAG, "Flushing log.");
76 | mService.flushLog(); // <8>
77 | } catch (RemoteException e) {
78 | throw new RuntimeException("Failed to flush log", e);
79 | }
80 | }
81 |
82 | public int getTotalLogSize() {
83 | try {
84 | if (DEBUG) Slog.d(TAG, "Getting total log size.");
85 | return mService.getTotalLogSize(); // <8>
86 | } catch (RemoteException e) {
87 | throw new RuntimeException("Failed to get total log size", e);
88 | }
89 | }
90 |
91 | public int getUsedLogSize() {
92 | try {
93 | if (DEBUG) Slog.d(TAG, "Getting used log size.");
94 | return mService.getUsedLogSize(); // <8>
95 | } catch (Exception e) {
96 | throw new RuntimeException("Failed to get used log size", e);
97 | }
98 | }
99 |
100 | public void register(LogListener listener) {
101 | if (listener == null) return;
102 |
103 | if (mListeners.containsKey(listener)) {
104 | Log.w(TAG, "Already registered: " + listener);
105 | } else {
106 | synchronized (mListeners) { // <5>
107 | ListenerTransport wrapper = new ListenerTransport(listener);
108 | try {
109 | if (DEBUG) Log.d(TAG, "Registering remote listener.");
110 | mService.register(wrapper); // <8>
111 | } catch (RemoteException e) {
112 | throw new RuntimeException("Failed to register " + listener, e);
113 | }
114 |
115 | mListeners.put(listener, wrapper);
116 | }
117 | }
118 | }
119 |
120 | public void unregister(LogListener listener) {
121 | if (listener == null) return;
122 |
123 | if (!mListeners.containsKey(listener)) {
124 | Log.w(TAG, "Not registered: " + listener);
125 | } else {
126 | synchronized (mListeners) { // <5>
127 | ListenerTransport wrapper = mListeners.remove(listener);
128 |
129 | if (wrapper != null) {
130 | try {
131 | if (DEBUG) Log.d(TAG, "Unregistering remote listener.");
132 | mService.unregister(wrapper); // <8>
133 | } catch (RemoteException e) {
134 | throw new RuntimeException("Failed to unregister " + listener, e);
135 | }
136 | }
137 |
138 | wrapper.clearListener(); // <9>
139 | }
140 | }
141 | }
142 | }
143 |
--------------------------------------------------------------------------------
/app/MrknLogService/src/com/marakana/android/logservice/ILogServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.marakana.android.logservice;
2 |
3 | import android.content.Context;
4 | import android.content.pm.PackageManager;
5 | import android.os.Binder;
6 | import android.os.IBinder;
7 | import android.os.RemoteException;
8 | import android.util.Slog;
9 | import java.io.FileDescriptor;
10 | import java.io.PrintWriter;
11 | import java.util.HashMap;
12 | import java.util.Map;
13 | import java.util.concurrent.atomic.AtomicInteger;
14 | import com.marakana.android.service.log.ILogListener;
15 | import com.marakana.android.service.log.ILogService;
16 | import com.marakana.android.lib.log.LibLog;
17 | import com.marakana.android.lib.log.LibLogException;
18 |
19 | class ILogServiceImpl extends ILogService.Stub {
20 | private static final String TAG = "ILogServiceImpl";
21 | private static final int INCREMENTAL_TIMEOUT = 2 * 1000;
22 | private static final boolean DEBUG = false;
23 | private final Map listeners =
24 | new HashMap();
25 | private final AtomicInteger flushCounter = new AtomicInteger();
26 | private final Context context;
27 | private final LibLog libLog;
28 | private LogServiceThread logServiceThread;
29 |
30 |
31 | ILogServiceImpl(Context context) {
32 | this.context = context;
33 | this.libLog = new LibLog();
34 | }
35 |
36 | protected void finalize() throws Throwable {
37 | this.libLog.close();
38 | super.finalize();
39 | }
40 |
41 | public void flushLog() {
42 | this.context.enforceCallingOrSelfPermission(
43 | Manifest.permission.FLUSH_LOG, "Flush somewhere else");
44 | if (DEBUG) Slog.d(TAG, "Flushing log.");
45 | this.libLog.flushLog();
46 | this.flushCounter.incrementAndGet();
47 | }
48 |
49 | public int getUsedLogSize() {
50 | if (DEBUG) Slog.d(TAG, "Getting used log size.");
51 | return this.libLog.getUsedLogSize();
52 | }
53 |
54 | public int getTotalLogSize() {
55 | if (DEBUG) Slog.d(TAG, "Getting total log size.");
56 | return this.libLog.getTotalLogSize();
57 | }
58 |
59 | public void register(ILogListener listener) throws RemoteException {
60 | if (listener != null) {
61 | IBinder binder = listener.asBinder();
62 | synchronized(this.listeners) {
63 | if (this.listeners.containsKey(binder)) {
64 | Slog.w(TAG, "Ignoring duplicate listener: " + binder);
65 | } else {
66 | ListenerTracker listenerTracker = new ListenerTracker(listener);
67 | binder.linkToDeath(listenerTracker, 0);
68 | this.listeners.put(binder, listenerTracker);
69 | if (DEBUG) Slog.d(TAG, "Registered listener: " + binder);
70 | if (this.logServiceThread == null) {
71 | if (DEBUG) Slog.d(TAG, "Starting thread");
72 | this.logServiceThread = new LogServiceThread();
73 | this.logServiceThread.start();
74 | }
75 | }
76 | }
77 | }
78 | }
79 |
80 | public void unregister(ILogListener listener) {
81 | if (listener != null) {
82 | IBinder binder = listener.asBinder();
83 | synchronized(this.listeners) {
84 | ListenerTracker listenerTracker =
85 | this.listeners.remove(binder);
86 | if (listenerTracker == null) {
87 | Slog.w(TAG, "Ignoring unregistered listener: " + binder);
88 | } else {
89 | if (DEBUG) Slog.d(TAG, "Unregistered listener: " + binder);
90 | binder.unlinkToDeath(listenerTracker, 0);
91 | if (this.logServiceThread != null && this.listeners.isEmpty()) {
92 | if (DEBUG) Slog.d(TAG, "Stopping thread");
93 | this.logServiceThread.interrupt();
94 | this.logServiceThread = null;
95 | }
96 | }
97 | }
98 | }
99 | }
100 |
101 | protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
102 | if (this.context.checkCallingOrSelfPermission(android.Manifest.permission.DUMP) !=
103 | PackageManager.PERMISSION_GRANTED) {
104 | pw.print("Permission Denial: can't dump ILogService from from pid=");
105 | pw.print(Binder.getCallingPid());
106 | pw.print(", uid=");
107 | pw.println(Binder.getCallingUid());
108 | return;
109 | } else if (args.length > 0 && args[0] != null) {
110 | if (args[0].equals("flush-count")) {
111 | pw.println(this.flushCounter.get());
112 | } else if (args[0].equals("used-size")) {
113 | pw.println(this.getUsedLogSize());
114 | } else if (args[0].equals("total-size")) {
115 | pw.println(this.getTotalLogSize());
116 | } else if (args[0].equals("listeners")) {
117 | pw.println(this.listeners.size());
118 | } else {
119 | pw.println("Usage: ILogService [flush-count|used-size|total-size|listeners]");
120 | }
121 | } else {
122 | pw.println("ILogServiceState:");
123 | pw.print("Flush count: ");
124 | pw.println(this.flushCounter.get());
125 | pw.print("Used log size: ");
126 | pw.println(this.getUsedLogSize());
127 | pw.print("Total log size: ");
128 | pw.println(this.getTotalLogSize());
129 | pw.print("Listeners: ");
130 | pw.println(this.listeners.size());
131 | }
132 | }
133 |
134 | private final class ListenerTracker implements IBinder.DeathRecipient {
135 | private final ILogListener listener;
136 |
137 | public ListenerTracker(ILogListener listener) {
138 | this.listener = listener;
139 | }
140 |
141 | public ILogListener getListener() {
142 | return this.listener;
143 | }
144 |
145 | public void binderDied() {
146 | ILogServiceImpl.this.unregister(this.listener);
147 | }
148 | }
149 |
150 | private final class LogServiceThread extends Thread {
151 | private int mLastKnownSize;
152 |
153 | public void run() {
154 | while(!Thread.interrupted()) {
155 | try {
156 | if (DEBUG) Slog.d(TAG, "Waiting for log data");
157 | int usedSize = ILogServiceImpl.this.getUsedLogSize();
158 |
159 | if (mLastKnownSize != usedSize) {
160 | mLastKnownSize = ILogServiceImpl.this.getUsedLogSize();
161 | if (DEBUG) Slog.d(TAG, "Log data changed. Used data is now at " + mLastKnownSize);
162 |
163 | synchronized(ILogServiceImpl.this.listeners) {
164 | for (Map.Entry entry : ILogServiceImpl.this.listeners.entrySet()) {
165 | ILogListener listener = entry.getValue().getListener();
166 | try {
167 | if (DEBUG) Slog.d(TAG, "Notifying listener: " + entry.getKey());
168 | listener.onUsedLogSizeChange(mLastKnownSize);
169 | } catch (RemoteException e) {
170 | Slog.e(TAG, "Failed to update listener: " + entry.getKey(), e);
171 | ILogServiceImpl.this.unregister(listener);
172 | }
173 | }
174 | }
175 | } else {
176 | //No change, take a rest before polling again
177 | try {
178 | Thread.sleep(INCREMENTAL_TIMEOUT);
179 | } catch (InterruptedException e2) {
180 | break;
181 | }
182 | }
183 | } catch (LibLogException e) {
184 | Slog.e(TAG, "Oops", e);
185 | try {
186 | Thread.sleep(INCREMENTAL_TIMEOUT);
187 | } catch (InterruptedException e2) {
188 | break;
189 | }
190 | }
191 | }
192 | }
193 | }
194 | }
195 |
--------------------------------------------------------------------------------
/NOTICE:
--------------------------------------------------------------------------------
1 |
2 | Copyright (c) 2005-2012, Marakana Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 |
7 | Unless required by applicable law or agreed to in writing, software
8 | distributed under the License is distributed on an "AS IS" BASIS,
9 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | See the License for the specific language governing permissions and
11 | limitations under the License.
12 |
13 |
14 | Apache License
15 | Version 2.0, January 2004
16 | http://www.apache.org/licenses/
17 |
18 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
19 |
20 | 1. Definitions.
21 |
22 | "License" shall mean the terms and conditions for use, reproduction,
23 | and distribution as defined by Sections 1 through 9 of this document.
24 |
25 | "Licensor" shall mean the copyright owner or entity authorized by
26 | the copyright owner that is granting the License.
27 |
28 | "Legal Entity" shall mean the union of the acting entity and all
29 | other entities that control, are controlled by, or are under common
30 | control with that entity. For the purposes of this definition,
31 | "control" means (i) the power, direct or indirect, to cause the
32 | direction or management of such entity, whether by contract or
33 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
34 | outstanding shares, or (iii) beneficial ownership of such entity.
35 |
36 | "You" (or "Your") shall mean an individual or Legal Entity
37 | exercising permissions granted by this License.
38 |
39 | "Source" form shall mean the preferred form for making modifications,
40 | including but not limited to software source code, documentation
41 | source, and configuration files.
42 |
43 | "Object" form shall mean any form resulting from mechanical
44 | transformation or translation of a Source form, including but
45 | not limited to compiled object code, generated documentation,
46 | and conversions to other media types.
47 |
48 | "Work" shall mean the work of authorship, whether in Source or
49 | Object form, made available under the License, as indicated by a
50 | copyright notice that is included in or attached to the work
51 | (an example is provided in the Appendix below).
52 |
53 | "Derivative Works" shall mean any work, whether in Source or Object
54 | form, that is based on (or derived from) the Work and for which the
55 | editorial revisions, annotations, elaborations, or other modifications
56 | represent, as a whole, an original work of authorship. For the purposes
57 | of this License, Derivative Works shall not include works that remain
58 | separable from, or merely link (or bind by name) to the interfaces of,
59 | the Work and Derivative Works thereof.
60 |
61 | "Contribution" shall mean any work of authorship, including
62 | the original version of the Work and any modifications or additions
63 | to that Work or Derivative Works thereof, that is intentionally
64 | submitted to Licensor for inclusion in the Work by the copyright owner
65 | or by an individual or Legal Entity authorized to submit on behalf of
66 | the copyright owner. For the purposes of this definition, "submitted"
67 | means any form of electronic, verbal, or written communication sent
68 | to the Licensor or its representatives, including but not limited to
69 | communication on electronic mailing lists, source code control systems,
70 | and issue tracking systems that are managed by, or on behalf of, the
71 | Licensor for the purpose of discussing and improving the Work, but
72 | excluding communication that is conspicuously marked or otherwise
73 | designated in writing by the copyright owner as "Not a Contribution."
74 |
75 | "Contributor" shall mean Licensor and any individual or Legal Entity
76 | on behalf of whom a Contribution has been received by Licensor and
77 | subsequently incorporated within the Work.
78 |
79 | 2. Grant of Copyright License. Subject to the terms and conditions of
80 | this License, each Contributor hereby grants to You a perpetual,
81 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
82 | copyright license to reproduce, prepare Derivative Works of,
83 | publicly display, publicly perform, sublicense, and distribute the
84 | Work and such Derivative Works in Source or Object form.
85 |
86 | 3. Grant of Patent License. Subject to the terms and conditions of
87 | this License, each Contributor hereby grants to You a perpetual,
88 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
89 | (except as stated in this section) patent license to make, have made,
90 | use, offer to sell, sell, import, and otherwise transfer the Work,
91 | where such license applies only to those patent claims licensable
92 | by such Contributor that are necessarily infringed by their
93 | Contribution(s) alone or by combination of their Contribution(s)
94 | with the Work to which such Contribution(s) was submitted. If You
95 | institute patent litigation against any entity (including a
96 | cross-claim or counterclaim in a lawsuit) alleging that the Work
97 | or a Contribution incorporated within the Work constitutes direct
98 | or contributory patent infringement, then any patent licenses
99 | granted to You under this License for that Work shall terminate
100 | as of the date such litigation is filed.
101 |
102 | 4. Redistribution. You may reproduce and distribute copies of the
103 | Work or Derivative Works thereof in any medium, with or without
104 | modifications, and in Source or Object form, provided that You
105 | meet the following conditions:
106 |
107 | (a) You must give any other recipients of the Work or
108 | Derivative Works a copy of this License; and
109 |
110 | (b) You must cause any modified files to carry prominent notices
111 | stating that You changed the files; and
112 |
113 | (c) You must retain, in the Source form of any Derivative Works
114 | that You distribute, all copyright, patent, trademark, and
115 | attribution notices from the Source form of the Work,
116 | excluding those notices that do not pertain to any part of
117 | the Derivative Works; and
118 |
119 | (d) If the Work includes a "NOTICE" text file as part of its
120 | distribution, then any Derivative Works that You distribute must
121 | include a readable copy of the attribution notices contained
122 | within such NOTICE file, excluding those notices that do not
123 | pertain to any part of the Derivative Works, in at least one
124 | of the following places: within a NOTICE text file distributed
125 | as part of the Derivative Works; within the Source form or
126 | documentation, if provided along with the Derivative Works; or,
127 | within a display generated by the Derivative Works, if and
128 | wherever such third-party notices normally appear. The contents
129 | of the NOTICE file are for informational purposes only and
130 | do not modify the License. You may add Your own attribution
131 | notices within Derivative Works that You distribute, alongside
132 | or as an addendum to the NOTICE text from the Work, provided
133 | that such additional attribution notices cannot be construed
134 | as modifying the License.
135 |
136 | You may add Your own copyright statement to Your modifications and
137 | may provide additional or different license terms and conditions
138 | for use, reproduction, or distribution of Your modifications, or
139 | for any such Derivative Works as a whole, provided Your use,
140 | reproduction, and distribution of the Work otherwise complies with
141 | the conditions stated in this License.
142 |
143 | 5. Submission of Contributions. Unless You explicitly state otherwise,
144 | any Contribution intentionally submitted for inclusion in the Work
145 | by You to the Licensor shall be under the terms and conditions of
146 | this License, without any additional terms or conditions.
147 | Notwithstanding the above, nothing herein shall supersede or modify
148 | the terms of any separate license agreement you may have executed
149 | with Licensor regarding such Contributions.
150 |
151 | 6. Trademarks. This License does not grant permission to use the trade
152 | names, trademarks, service marks, or product names of the Licensor,
153 | except as required for reasonable and customary use in describing the
154 | origin of the Work and reproducing the content of the NOTICE file.
155 |
156 | 7. Disclaimer of Warranty. Unless required by applicable law or
157 | agreed to in writing, Licensor provides the Work (and each
158 | Contributor provides its Contributions) on an "AS IS" BASIS,
159 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
160 | implied, including, without limitation, any warranties or conditions
161 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
162 | PARTICULAR PURPOSE. You are solely responsible for determining the
163 | appropriateness of using or redistributing the Work and assume any
164 | risks associated with Your exercise of permissions under this License.
165 |
166 | 8. Limitation of Liability. In no event and under no legal theory,
167 | whether in tort (including negligence), contract, or otherwise,
168 | unless required by applicable law (such as deliberate and grossly
169 | negligent acts) or agreed to in writing, shall any Contributor be
170 | liable to You for damages, including any direct, indirect, special,
171 | incidental, or consequential damages of any character arising as a
172 | result of this License or out of the use or inability to use the
173 | Work (including but not limited to damages for loss of goodwill,
174 | work stoppage, computer failure or malfunction, or any and all
175 | other commercial damages or losses), even if such Contributor
176 | has been advised of the possibility of such damages.
177 |
178 | 9. Accepting Warranty or Additional Liability. While redistributing
179 | the Work or Derivative Works thereof, You may choose to offer,
180 | and charge a fee for, acceptance of support, warranty, indemnity,
181 | or other liability obligations and/or rights consistent with this
182 | License. However, in accepting such obligations, You may act only
183 | on Your own behalf and on Your sole responsibility, not on behalf
184 | of any other Contributor, and only if You agree to indemnify,
185 | defend, and hold each Contributor harmless for any liability
186 | incurred by, or claims asserted against, such Contributor by reason
187 | of your accepting any such warranty or additional liability.
188 |
189 | END OF TERMS AND CONDITIONS
190 |
191 |
--------------------------------------------------------------------------------