Skip to content

Commit

Permalink
tank: Improve the asp shim.
Browse files Browse the repository at this point in the history
Signed-off-by: R0rt1z2 <[email protected]>
  • Loading branch information
R0rt1z2 committed Apr 12, 2020
1 parent 61b6979 commit ba771db
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 50 deletions.
2 changes: 1 addition & 1 deletion libshims/Android.mk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_SRC_FILES := asp.c
LOCAL_SRC_FILES := asp_shim.cpp
LOCAL_SHARED_LIBRARIES := liblog
LOCAL_MODULE := libshim_asp
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
Expand Down
47 changes: 0 additions & 47 deletions libshims/asp.c

This file was deleted.

28 changes: 28 additions & 0 deletions libshims/asp_shim.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include <string.h>
#include <log/log.h>

#define DEST_SIZE 1024

extern "C"
{
int __metrics_log_print(int bufID, int prio, const char *tag, const char *log, ...)
{
va_list ap;

int _a = bufID;
int _b = prio;

char dest[DEST_SIZE];
char dest2[DEST_SIZE];
char s[DEST_SIZE];

snprintf(dest, 0x400, 0 ,0x400);
snprintf(dest2, 0x400, 0, 0x400);

va_start(ap, log);
vsnprintf(s, DEST_SIZE, log, ap);
va_end(ap);

return __android_log_write(ANDROID_LOG_DEBUG, tag, log);
}
}
5 changes: 3 additions & 2 deletions rootdir/init.mt8127.rc
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ on init
mount tmpfs tmpfs /mnt/media_rw/ mode=0755,uid=1000,gid=1000
mkdir /mnt/media_rw/usbotg 0700 media_rw media_rw
mkdir /storage/usbotg 0700 root root
export LD_SHIM_LIBS "/system/vendor/lib/libasp.so|libshim_asp.so"
export LD_PRELOAD libshim_asp.so

# Preload the shim for amazon metrics logging
export LD_PRELOAD "libshim_asp.so"

# Backward compatibility
symlink /system/etc /etc
Expand Down

0 comments on commit ba771db

Please sign in to comment.