Skip to content

Instantly share code, notes, and snippets.

@sunwayforever
sunwayforever / background zygote
Last active August 3, 2016 08:35
background zygote
Working tree
modified cmds/app_process/app_main.cpp
@@ -17,6 +17,7 @@
#include <binder/ProcessState.h>
#include <utils/Log.h>
#include <cutils/memory.h>
+#include <cutils/sched_policy.h>
#include <cutils/process_name.h>
#include <cutils/properties.h>
#include <cutils/trace.h>
@sunwayforever
sunwayforever / hellofs
Last active August 3, 2016 08:34
hellofs
diff --git a/fs/Makefile b/fs/Makefile
index 443f2bc..b61e571 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -40,6 +40,7 @@ obj-$(CONFIG_QUOTACTL) += quota.o
obj-$(CONFIG_DNOTIFY) += dnotify.o
obj-$(CONFIG_PROC_FS) += proc/
+obj-y += hello/
obj-y += partitions/
@sunwayforever
sunwayforever / android_jni_example
Last active July 5, 2017 09:30
android jni example
Android.mk
==========
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := tests
LOCAL_SRC_FILES := $(call all-java-files-under, src)
@sunwayforever
sunwayforever / adopt Makefile to Android.mk
Last active July 6, 2017 06:03
convert Makefile to Android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := arm_translator
LOCAL_MODULE_CLASS := EXECUTABLES
LOCAL_MODULE_PATH := $(PRODUCT_OUT)/system/bin
intermediates-dir := $(call intermediates-dir-for,EXECUTABLES,arm_translator)
#include <cutils/properties.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <android/log.h>
#define SALSA_TRANSLATOR "/system/bin/salsa_translator"
#define SALSA_TRANSLATOR_ARGC 20
@sunwayforever
sunwayforever / suffix_tree.go
Last active July 19, 2017 09:02
algorithm: suffix_tree
package main
import (
"fmt"
"github.com/awalterschulze/gographviz"
)
type Node struct {
children map[byte]*Node
@sunwayforever
sunwayforever / kgdb_nexus5x.diff
Created July 19, 2017 07:52
kgdb patch for android 7.1 on nexus5x
diff --git a/arch/arm64/configs/bullhead_defconfig b/arch/arm64/configs/bullhead_defconfig
index 8256805..3a4a363 100644
--- a/arch/arm64/configs/bullhead_defconfig
+++ b/arch/arm64/configs/bullhead_defconfig
@@ -672,3 +672,16 @@ CONFIG_CRYPTO_AES_ARM64_CE_BLK=y
CONFIG_CRYPTO_AES_ARM64_NEON_BLK=y
CONFIG_QMI_ENCDEC=y
CONFIG_STRICT_MEMORY_RWX=y
+
+CONFIG_CMDLINE=" kgdboc=ttyHSL0,115200"
@sunwayforever
sunwayforever / salsa_pretranslator.c
Created July 19, 2017 08:12
android liblog and getopt example
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <libgen.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <getopt.h>
@sunwayforever
sunwayforever / WbXmlConverter.cpp
Last active July 19, 2017 08:18
wbxml converter
#include <WbXmlConverter.hpp>
#include <utils/String8.h>
using namespace android;
const char* WbXmlConverter::DRM_ELEMENT_CODE_PAGE[] = {
RO_ELEMENT_RIGHTS, RO_ELEMENT_CONTEXT, RO_ELEMENT_VERSION, RO_ELEMENT_UID, RO_ELEMENT_AGREEMENT,
RO_ELEMENT_ASSET, RO_ELEMENT_KEYINFO, RO_ELEMENT_KEYVALUE, RO_ELEMENT_PERMISSION, RO_ELEMENT_PLAY,
RO_ELEMENT_DISPLAY, RO_ELEMENT_EXECUTE, RO_ELEMENT_PRINT, RO_ELEMENT_CONSTRAINT, RO_ELEMENT_COUNT,
RO_ELEMENT_DATE_TIME, RO_ELEMENT_START_TIME, RO_ELEMENT_EXPIRY_TIME, RO_ELEMENT_AVAILABLE_TIME
};
@sunwayforever
sunwayforever / sync_cache.c
Created July 24, 2017 02:38
sync_cache.c
/* Machine description for AArch64 architecture.
Copyright (C) 2012-2014 Free Software Foundation, Inc.
Contributed by ARM Ltd.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.