You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
api-impl: use liblog for android.util.Log; use Log.v for debugging prints and Log.w for stub tracing
This commit is contained in:
@@ -68,6 +68,7 @@ libtranslationlayer_so = shared_library('translation_layer_main', [
|
|||||||
'src/api-impl-jni/util.c',
|
'src/api-impl-jni/util.c',
|
||||||
'src/api-impl-jni/android_graphics_Canvas.c',
|
'src/api-impl-jni/android_graphics_Canvas.c',
|
||||||
'src/api-impl-jni/android_graphics_Paint.c',
|
'src/api-impl-jni/android_graphics_Paint.c',
|
||||||
|
'src/api-impl-jni/android_util_Log.c',
|
||||||
'src/api-impl-jni/database/android_database_SQLiteCommon.c',
|
'src/api-impl-jni/database/android_database_SQLiteCommon.c',
|
||||||
'src/api-impl-jni/database/android_database_SQLiteConnection.c',
|
'src/api-impl-jni/database/android_database_SQLiteConnection.c',
|
||||||
'src/api-impl-jni/drawables/ninepatch.c',
|
'src/api-impl-jni/drawables/ninepatch.c',
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
JNIEXPORT jlong JNICALL Java_android_graphics_Bitmap_native_1bitmap_1from_1path(JNIEnv *env, jobject this, jobject path)
|
JNIEXPORT jlong JNICALL Java_android_graphics_Bitmap_native_1bitmap_1from_1path(JNIEnv *env, jobject this, jobject path)
|
||||||
{
|
{
|
||||||
GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(_CSTRING(path), NULL);
|
GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(_CSTRING(path), NULL);
|
||||||
printf(">>> made pixbuf from path: >%s<, >%p<\n", _CSTRING(path), pixbuf);
|
android_log_printf(ANDROID_LOG_VERBOSE, "["__FILE__"]", ">>> made pixbuf from path: >%s<, >%p<\n", _CSTRING(path), pixbuf);
|
||||||
|
|
||||||
sk_imageinfo_t info = {
|
sk_imageinfo_t info = {
|
||||||
.width = gdk_pixbuf_get_width(pixbuf),
|
.width = gdk_pixbuf_get_width(pixbuf),
|
||||||
|
|||||||
51
src/api-impl-jni/android_util_Log.c
Normal file
51
src/api-impl-jni/android_util_Log.c
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "defines.h"
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
|
/* copied from AOSP:
|
||||||
|
**
|
||||||
|
** Copyright 2006, The Android Open Source Project
|
||||||
|
**
|
||||||
|
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
** you may not use this file except in compliance with the License.
|
||||||
|
** You may obtain a copy of the License at
|
||||||
|
**
|
||||||
|
** http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
**
|
||||||
|
** Unless required by applicable law or agreed to in writing, software
|
||||||
|
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
** See the License for the specific language governing permissions and
|
||||||
|
** limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
JNIEXPORT jint JNICALL Java_android_util_Log_println_1native(JNIEnv* env, jobject this, jint bufID, jint priority, jstring tagObj, jstring msgObj)
|
||||||
|
{
|
||||||
|
const char* tag = NULL;
|
||||||
|
const char* msg = NULL;
|
||||||
|
|
||||||
|
if (msgObj == NULL) {
|
||||||
|
// jniThrowNullPointerException(env, "println needs a message");
|
||||||
|
fprintf(stderr, "Log.println_native: println needs a message\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bufID < 0 || bufID >= LOG_ID_MAX) {
|
||||||
|
// jniThrowNullPointerException(env, "bad bufID");
|
||||||
|
fprintf(stderr, "Log.println_native: bad bufID\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tagObj != NULL)
|
||||||
|
tag = (*env)->GetStringUTFChars(env, tagObj, NULL);
|
||||||
|
msg = (*env)->GetStringUTFChars(env, msgObj, NULL);
|
||||||
|
|
||||||
|
int res = __android_log_buf_write(bufID, priority, tag, msg);
|
||||||
|
|
||||||
|
if (tag != NULL)
|
||||||
|
(*env)->ReleaseStringUTFChars(env, tagObj, tag);
|
||||||
|
(*env)->ReleaseStringUTFChars(env, msgObj, msg);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
@@ -29,11 +29,11 @@ extern "C" {
|
|||||||
#define android_util_Log_LOG_ID_SYSTEM 3L
|
#define android_util_Log_LOG_ID_SYSTEM 3L
|
||||||
/*
|
/*
|
||||||
* Class: android_util_Log
|
* Class: android_util_Log
|
||||||
* Method: isLoggable
|
* Method: println_native
|
||||||
* Signature: (Ljava/lang/String;I)Z
|
* Signature: (IILjava/lang/String;Ljava/lang/String;)I
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jboolean JNICALL Java_android_util_Log_isLoggable
|
JNIEXPORT jint JNICALL Java_android_util_Log_println_1native
|
||||||
(JNIEnv *, jclass, jstring, jint);
|
(JNIEnv *, jclass, jint, jint, jstring, jstring);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
#include <dlfcn.h>
|
||||||
|
#include <pthread.h>
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
struct handle_cache handle_cache = {0};
|
struct handle_cache handle_cache = {0};
|
||||||
@@ -140,3 +143,50 @@ void extract_from_apk(const char *path, const char *target) {
|
|||||||
JNIEnv *env = get_jni_env();
|
JNIEnv *env = get_jni_env();
|
||||||
(*env)->CallStaticObjectMethod(env, handle_cache.asset_manager.class, handle_cache.asset_manager.extractFromAPK, _JSTRING(path), _JSTRING(target));
|
(*env)->CallStaticObjectMethod(env, handle_cache.asset_manager.class, handle_cache.asset_manager.extractFromAPK, _JSTRING(path), _JSTRING(target));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* logging with fallback to stderr */
|
||||||
|
|
||||||
|
typedef int __android_log_vprint_type(int prio, const char *tag, const char *fmt, va_list ap);
|
||||||
|
|
||||||
|
static int fallback_verbose_log(int prio, const char *tag, const char *fmt, va_list ap)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||||
|
pthread_mutex_lock(&mutex);
|
||||||
|
static char buf[1024];
|
||||||
|
ret = vsnprintf(buf, sizeof(buf), fmt, ap);
|
||||||
|
fprintf(stderr, "%lu: %s\n", pthread_self(), buf);
|
||||||
|
pthread_mutex_unlock(&mutex);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int android_log_vprintf(int prio, const char *tag, const char *fmt, va_list ap)
|
||||||
|
{
|
||||||
|
|
||||||
|
static __android_log_vprint_type *_android_log_vprintf = NULL;
|
||||||
|
if(!_android_log_vprintf) {
|
||||||
|
_android_log_vprintf = dlsym(RTLD_DEFAULT, "__android_log_vprint");
|
||||||
|
|
||||||
|
if(!_android_log_vprintf) {
|
||||||
|
_android_log_vprintf = &fallback_verbose_log;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return _android_log_vprintf(prio, tag, fmt, ap);
|
||||||
|
}
|
||||||
|
|
||||||
|
int android_log_printf(android_LogPriority prio, const char *tag, const char *fmt, ...)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
va_list ap;
|
||||||
|
va_start(ap, fmt);
|
||||||
|
|
||||||
|
ret = android_log_vprintf(prio, tag, fmt, ap);
|
||||||
|
|
||||||
|
va_end(ap);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|||||||
@@ -107,4 +107,32 @@ void extract_from_apk(const char *path, const char *target);
|
|||||||
|
|
||||||
void prepare_main_looper(JNIEnv* env);
|
void prepare_main_looper(JNIEnv* env);
|
||||||
|
|
||||||
|
/* we don't (currently?) install the headers for liblog */
|
||||||
|
typedef enum {
|
||||||
|
LOG_ID_MAIN = 0,
|
||||||
|
LOG_ID_RADIO = 1,
|
||||||
|
LOG_ID_EVENTS = 2,
|
||||||
|
LOG_ID_SYSTEM = 3,
|
||||||
|
|
||||||
|
LOG_ID_MAX
|
||||||
|
} log_id_t;
|
||||||
|
|
||||||
|
typedef enum android_LogPriority {
|
||||||
|
ANDROID_LOG_UNKNOWN = 0,
|
||||||
|
ANDROID_LOG_DEFAULT, /* only for SetMinPriority() */
|
||||||
|
ANDROID_LOG_VERBOSE,
|
||||||
|
ANDROID_LOG_DEBUG,
|
||||||
|
ANDROID_LOG_INFO,
|
||||||
|
ANDROID_LOG_WARN,
|
||||||
|
ANDROID_LOG_ERROR,
|
||||||
|
ANDROID_LOG_FATAL,
|
||||||
|
ANDROID_LOG_SILENT, /* only for SetMinPriority(); must be last */
|
||||||
|
} android_LogPriority;
|
||||||
|
|
||||||
|
/* TODO: do we really need the bufID, or can we use our function below which has a stderr fallback */
|
||||||
|
int __android_log_buf_write(int bufID, int prio, const char *tag, const char *text);
|
||||||
|
|
||||||
|
/* defined in util.c */
|
||||||
|
int android_log_printf(android_LogPriority prio, const char *tag, const char *fmt, ...);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import android.system.ErrnoException;
|
|||||||
// import android.os.Looper;
|
// import android.os.Looper;
|
||||||
import android.system.Os;
|
import android.system.Os;
|
||||||
import android.system.StructStat;
|
import android.system.StructStat;
|
||||||
import android.util.Log;
|
import android.util.Slog;
|
||||||
// import com.google.android.collect.Maps;
|
// import com.google.android.collect.Maps;
|
||||||
import com.android.internal.util.XmlUtils;
|
import com.android.internal.util.XmlUtils;
|
||||||
import dalvik.system.BlockGuard;
|
import dalvik.system.BlockGuard;
|
||||||
@@ -99,7 +99,7 @@ public final class SharedPreferencesImpl implements SharedPreferences {
|
|||||||
}
|
}
|
||||||
// Debugging
|
// Debugging
|
||||||
if (mFile.exists() && !mFile.canRead()) {
|
if (mFile.exists() && !mFile.canRead()) {
|
||||||
Log.w(TAG, "Attempt to read preferences file " + mFile + " without permission");
|
Slog.w(TAG, "Attempt to read preferences file " + mFile + " without permission");
|
||||||
}
|
}
|
||||||
Map map = null;
|
Map map = null;
|
||||||
StructStat stat = null;
|
StructStat stat = null;
|
||||||
@@ -112,11 +112,11 @@ public final class SharedPreferencesImpl implements SharedPreferences {
|
|||||||
new FileInputStream(mFile), 16 * 1024);
|
new FileInputStream(mFile), 16 * 1024);
|
||||||
map = XmlUtils.readMapXml(str);
|
map = XmlUtils.readMapXml(str);
|
||||||
} catch (XmlPullParserException e) {
|
} catch (XmlPullParserException e) {
|
||||||
Log.w(TAG, "getSharedPreferences", e);
|
Slog.w(TAG, "getSharedPreferences", e);
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
Log.w(TAG, "getSharedPreferences", e);
|
Slog.w(TAG, "getSharedPreferences", e);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.w(TAG, "getSharedPreferences", e);
|
Slog.w(TAG, "getSharedPreferences", e);
|
||||||
} finally {
|
} finally {
|
||||||
IoUtils.closeQuietly(str);
|
IoUtils.closeQuietly(str);
|
||||||
}
|
}
|
||||||
@@ -155,7 +155,7 @@ public final class SharedPreferencesImpl implements SharedPreferences {
|
|||||||
if (mDiskWritesInFlight > 0) {
|
if (mDiskWritesInFlight > 0) {
|
||||||
// If we know we caused it, it's not unexpected.
|
// If we know we caused it, it's not unexpected.
|
||||||
if (DEBUG)
|
if (DEBUG)
|
||||||
Log.d(TAG, "disk write in flight, not unexpected.");
|
Slog.d(TAG, "disk write in flight, not unexpected.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -203,7 +203,7 @@ public final class SharedPreferencesImpl implements SharedPreferences {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, ?> getAll() {
|
public Map<String, ?> getAll() {
|
||||||
System.out.println("\n\n...> getAll()\n\n");
|
Slog.v(TAG, "\n\n...> getAll()\n\n");
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
awaitLoadedLocked();
|
awaitLoadedLocked();
|
||||||
// noinspection unchecked
|
// noinspection unchecked
|
||||||
@@ -250,7 +250,7 @@ public final class SharedPreferencesImpl implements SharedPreferences {
|
|||||||
}
|
}
|
||||||
public boolean getBoolean(String key, boolean defValue) {
|
public boolean getBoolean(String key, boolean defValue) {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
System.out.println("android.app.SharedPreferencesImpl.getBoolean("+key+", "+defValue+")");
|
Slog.v(TAG, "android.app.SharedPreferencesImpl.getBoolean("+key+", "+defValue+")");
|
||||||
awaitLoadedLocked();
|
awaitLoadedLocked();
|
||||||
Boolean v = (Boolean)mMap.get(key);
|
Boolean v = (Boolean)mMap.get(key);
|
||||||
return v != null ? v : defValue;
|
return v != null ? v : defValue;
|
||||||
@@ -542,7 +542,7 @@ public final class SharedPreferencesImpl implements SharedPreferences {
|
|||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
File parent = file.getParentFile();
|
File parent = file.getParentFile();
|
||||||
if (!parent.mkdir()) {
|
if (!parent.mkdir()) {
|
||||||
Log.e(TAG, "Couldn't create directory for SharedPreferences file " + file);
|
Slog.e(TAG, "Couldn't create directory for SharedPreferences file " + file);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
/* FileUtils.setPermissions(
|
/* FileUtils.setPermissions(
|
||||||
@@ -552,7 +552,7 @@ public final class SharedPreferencesImpl implements SharedPreferences {
|
|||||||
try {
|
try {
|
||||||
str = new FileOutputStream(file);
|
str = new FileOutputStream(file);
|
||||||
} catch (FileNotFoundException e2) {
|
} catch (FileNotFoundException e2) {
|
||||||
Log.e(TAG, "Couldn't create SharedPreferences file " + file, e2);
|
Slog.e(TAG, "Couldn't create SharedPreferences file " + file, e2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
@@ -572,7 +572,7 @@ public final class SharedPreferencesImpl implements SharedPreferences {
|
|||||||
}
|
}
|
||||||
if (!mBackupFile.exists()) {
|
if (!mBackupFile.exists()) {
|
||||||
if (!mFile.renameTo(mBackupFile)) {
|
if (!mFile.renameTo(mBackupFile)) {
|
||||||
Log.e(TAG, "Couldn't rename file " + mFile + " to backup file " + mBackupFile);
|
Slog.e(TAG, "Couldn't rename file " + mFile + " to backup file " + mBackupFile);
|
||||||
mcr.setDiskWriteResult(false);
|
mcr.setDiskWriteResult(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -607,14 +607,14 @@ public final class SharedPreferencesImpl implements SharedPreferences {
|
|||||||
mcr.setDiskWriteResult(true);
|
mcr.setDiskWriteResult(true);
|
||||||
return;
|
return;
|
||||||
} catch (XmlPullParserException e) {
|
} catch (XmlPullParserException e) {
|
||||||
Log.w(TAG, "writeToFile: Got exception:", e);
|
Slog.w(TAG, "writeToFile: Got exception:", e);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.w(TAG, "writeToFile: Got exception:", e);
|
Slog.w(TAG, "writeToFile: Got exception:", e);
|
||||||
}
|
}
|
||||||
// Clean up an unsuccessfully written file
|
// Clean up an unsuccessfully written file
|
||||||
if (mFile.exists()) {
|
if (mFile.exists()) {
|
||||||
if (!mFile.delete()) {
|
if (!mFile.delete()) {
|
||||||
Log.e(TAG, "Couldn't clean up partially-written file " + mFile);
|
Slog.e(TAG, "Couldn't clean up partially-written file " + mFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mcr.setDiskWriteResult(false);
|
mcr.setDiskWriteResult(false);
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import android.os.Vibrator;
|
|||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
import android.util.Log;
|
import android.util.Slog;
|
||||||
import android.view.WindowManagerImpl;
|
import android.view.WindowManagerImpl;
|
||||||
import android.view.accessibility.AccessibilityManager;
|
import android.view.accessibility.AccessibilityManager;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
@@ -106,7 +106,7 @@ public class Context extends Object {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Context() {
|
public Context() {
|
||||||
System.out.println("new Context! this one is: " + this);
|
Slog.v(TAG, "new Context! this one is: " + this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int checkPermission(String permission, int pid, int uid) {
|
public int checkPermission(String permission, int pid, int uid) {
|
||||||
@@ -174,7 +174,7 @@ public class Context extends Object {
|
|||||||
case "accessibility":
|
case "accessibility":
|
||||||
return new AccessibilityManager();
|
return new AccessibilityManager();
|
||||||
default:
|
default:
|
||||||
System.out.println("!!!!!!! getSystemService: case >" + name + "< is not implemented yet");
|
Slog.e(TAG, "!!!!!!! getSystemService: case >" + name + "< is not implemented yet");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -247,7 +247,7 @@ public class Context extends Object {
|
|||||||
// spurious failure; probably racing with another process for this app
|
// spurious failure; probably racing with another process for this app
|
||||||
return files_dir;
|
return files_dir;
|
||||||
}
|
}
|
||||||
Log.w(TAG, "Unable to create files directory " + files_dir.getPath());
|
Slog.w(TAG, "Unable to create files directory " + files_dir.getPath());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -293,7 +293,7 @@ public class Context extends Object {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public SharedPreferences getSharedPreferences(String name, int mode) {
|
public SharedPreferences getSharedPreferences(String name, int mode) {
|
||||||
System.out.println("\n\n...> getSharedPreferences(" + name + ")\n\n");
|
Slog.v(TAG, "\n\n...> getSharedPreferences(" + name + ")\n\n");
|
||||||
File prefsFile = getSharedPrefsFile(name);
|
File prefsFile = getSharedPrefsFile(name);
|
||||||
return new SharedPreferencesImpl(prefsFile, mode);
|
return new SharedPreferencesImpl(prefsFile, mode);
|
||||||
}
|
}
|
||||||
@@ -309,19 +309,19 @@ public class Context extends Object {
|
|||||||
|
|
||||||
// TODO: do these both work? make them look more alike
|
// TODO: do these both work? make them look more alike
|
||||||
public FileInputStream openFileInput(String name) throws FileNotFoundException {
|
public FileInputStream openFileInput(String name) throws FileNotFoundException {
|
||||||
System.out.println("openFileInput called for: '" + name + "'");
|
Slog.v(TAG, "openFileInput called for: '" + name + "'");
|
||||||
File file = new File(getFilesDir(), name);
|
File file = new File(getFilesDir(), name);
|
||||||
|
|
||||||
return new FileInputStream(file);
|
return new FileInputStream(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
public FileOutputStream openFileOutput(String name, int mode) throws java.io.FileNotFoundException {
|
public FileOutputStream openFileOutput(String name, int mode) throws java.io.FileNotFoundException {
|
||||||
System.out.println("openFileOutput called for: '" + name + "'");
|
Slog.v(TAG, "openFileOutput called for: '" + name + "'");
|
||||||
return new FileOutputStream(android.os.Environment.getExternalStorageDirectory().getPath() + "/files/" + name);
|
return new FileOutputStream(android.os.Environment.getExternalStorageDirectory().getPath() + "/files/" + name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int checkCallingOrSelfPermission(String permission) {
|
public int checkCallingOrSelfPermission(String permission) {
|
||||||
System.out.println("!!! app wants to know if it has a permission: >" + permission + "<");
|
Slog.w(TAG, "!!! app wants to know if it has a permission: >" + permission + "< (returning PREMISSION_DENIED)");
|
||||||
|
|
||||||
return -1; // PackageManager.PERMISSION_DENIED
|
return -1; // PackageManager.PERMISSION_DENIED
|
||||||
}
|
}
|
||||||
@@ -329,15 +329,15 @@ public class Context extends Object {
|
|||||||
public void registerComponentCallbacks(ComponentCallbacks callbacks) {}
|
public void registerComponentCallbacks(ComponentCallbacks callbacks) {}
|
||||||
|
|
||||||
public boolean bindService(Intent dummy, ServiceConnection dummy2, int dummy3) {
|
public boolean bindService(Intent dummy, ServiceConnection dummy2, int dummy3) {
|
||||||
System.out.println("bindService("+dummy+", "+dummy2+", "+dummy3+")");
|
Slog.w(TAG, "bindService("+dummy+", "+dummy2+", "+dummy3+")");
|
||||||
return false; // maybe?
|
return false; // maybe?
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startActivity(Intent intent) {
|
public void startActivity(Intent intent) {
|
||||||
System.out.println("------------------");
|
Slog.w(TAG, "------------------");
|
||||||
System.out.println("app wants to startActivity("+intent+"), but we don't support that... :/");
|
Slog.w(TAG, "app wants to startActivity("+intent+"), but we don't support that... :/");
|
||||||
try { throw new java.lang.Exception(); } catch (java.lang.Exception e) { e.printStackTrace(); }
|
try { throw new java.lang.Exception(); } catch (java.lang.Exception e) { e.printStackTrace(); }
|
||||||
System.out.println("------------------");
|
Slog.w(TAG, "------------------");
|
||||||
}
|
}
|
||||||
|
|
||||||
public final TypedArray obtainStyledAttributes(AttributeSet set, int[] attrs) {
|
public final TypedArray obtainStyledAttributes(AttributeSet set, int[] attrs) {
|
||||||
|
|||||||
@@ -364,11 +364,5 @@ public final class Log {
|
|||||||
/**
|
/**
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public static /*native*/ int
|
public static native int println_native(int bufID, int priority, String tag, String msg);
|
||||||
println_native(int bufID,
|
|
||||||
int priority, String tag, String msg) {
|
|
||||||
String out = String.format("`¯´[%d][%d] [%s] : %s", bufID, priority, tag, msg);
|
|
||||||
System.out.println(out);
|
|
||||||
return out.getBytes().length;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package android.view;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.XmlResourceParser;
|
import android.content.res.XmlResourceParser;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
|
import android.util.Slog;
|
||||||
import android.util.Xml;
|
import android.util.Xml;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
@@ -11,6 +12,7 @@ import org.xmlpull.v1.XmlPullParserException;
|
|||||||
import org.xmlpull.v1.XmlPullParserFactory;
|
import org.xmlpull.v1.XmlPullParserFactory;
|
||||||
|
|
||||||
public class LayoutInflater {
|
public class LayoutInflater {
|
||||||
|
private static final String TAG = "LayoutInflater";
|
||||||
|
|
||||||
public interface Factory {
|
public interface Factory {
|
||||||
}
|
}
|
||||||
@@ -33,7 +35,7 @@ public class LayoutInflater {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final View createView(String name, String prefix, AttributeSet attrs) throws Exception {
|
public final View createView(String name, String prefix, AttributeSet attrs) throws Exception {
|
||||||
System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>> createView(" + name + ", " + prefix + ", " + attrs + ");");
|
Slog.v(TAG, ">>>>>>>>>>>>>>>>>>>>>>>>> createView(" + name + ", " + prefix + ", " + attrs + ");");
|
||||||
|
|
||||||
String view_class_name = prefix!=null ? prefix + name : name;
|
String view_class_name = prefix!=null ? prefix + name : name;
|
||||||
Class view_class = Class.forName(view_class_name);
|
Class view_class = Class.forName(view_class_name);
|
||||||
@@ -68,7 +70,7 @@ public class LayoutInflater {
|
|||||||
name = attrs.getAttributeValue(null, "class");
|
name = attrs.getAttributeValue(null, "class");
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("******** Creating view: " + name);
|
Slog.v(TAG, "******** Creating view: " + name);
|
||||||
|
|
||||||
View view;
|
View view;
|
||||||
|
|
||||||
@@ -78,7 +80,7 @@ public class LayoutInflater {
|
|||||||
view = createView(name, null, attrs);
|
view = createView(name, null, attrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("Created view is: " + view);
|
Slog.v(TAG, "Created view is: " + view);
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,9 +118,9 @@ public class LayoutInflater {
|
|||||||
|
|
||||||
final String name = parser.getName();
|
final String name = parser.getName();
|
||||||
|
|
||||||
System.out.println("**************************");
|
Slog.v(TAG, "**************************");
|
||||||
System.out.println("Creating root view: " + name);
|
Slog.v(TAG, "Creating root view: " + name);
|
||||||
System.out.println("**************************");
|
Slog.v(TAG, "**************************");
|
||||||
|
|
||||||
if (name.equals("merge")) {
|
if (name.equals("merge")) {
|
||||||
if (root == null || !attachToRoot) {
|
if (root == null || !attachToRoot) {
|
||||||
@@ -139,7 +141,7 @@ public class LayoutInflater {
|
|||||||
ViewGroup.LayoutParams params = null;
|
ViewGroup.LayoutParams params = null;
|
||||||
|
|
||||||
if (root != null) {
|
if (root != null) {
|
||||||
System.out.println("Creating params from root: " + root);
|
Slog.v(TAG, "Creating params from root: " + root);
|
||||||
|
|
||||||
// Create layout params that match root, if supplied
|
// Create layout params that match root, if supplied
|
||||||
params = root.generateLayoutParams(attrs);
|
params = root.generateLayoutParams(attrs);
|
||||||
@@ -150,12 +152,12 @@ public class LayoutInflater {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("-----> start inflating children");
|
Slog.v(TAG, "-----> start inflating children");
|
||||||
|
|
||||||
// Inflate all children under temp
|
// Inflate all children under temp
|
||||||
rInflate(parser, temp, attrs, true);
|
rInflate(parser, temp, attrs, true);
|
||||||
|
|
||||||
System.out.println("-----> done inflating children");
|
Slog.v(TAG, "-----> done inflating children");
|
||||||
|
|
||||||
// We are supposed to attach all the views we found (int temp)
|
// We are supposed to attach all the views we found (int temp)
|
||||||
// to root. Do that now.
|
// to root. Do that now.
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import android.os.Looper;
|
|||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.LayoutDirection;
|
import android.util.LayoutDirection;
|
||||||
|
import android.util.Slog;
|
||||||
import android.util.SparseArray;
|
import android.util.SparseArray;
|
||||||
import android.view.animation.Animation;
|
import android.view.animation.Animation;
|
||||||
|
|
||||||
@@ -26,7 +27,7 @@ public class View extends Object {
|
|||||||
/**
|
/**
|
||||||
* The logging tag used by this class with android.util.Log.
|
* The logging tag used by this class with android.util.Log.
|
||||||
*/
|
*/
|
||||||
protected static final String VIEW_LOG_TAG = "View";
|
protected static final String TAG = "View";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When set to true, apps will draw debugging information about their layouts.
|
* When set to true, apps will draw debugging information about their layouts.
|
||||||
@@ -882,7 +883,7 @@ public class View extends Object {
|
|||||||
// --- stubs
|
// --- stubs
|
||||||
|
|
||||||
public void setContentDescription(CharSequence contentDescription) {
|
public void setContentDescription(CharSequence contentDescription) {
|
||||||
System.out.println("setContentDescription called with: >" + contentDescription + "<");
|
Slog.w(TAG, "setContentDescription called with: >" + contentDescription + "<");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(int id) {
|
public void setId(int id) {
|
||||||
@@ -916,11 +917,11 @@ public class View extends Object {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setPressed(boolean pressed) {
|
public void setPressed(boolean pressed) {
|
||||||
System.out.println("calling setPressed on " + this + " with value: " + pressed);
|
Slog.w(TAG, "calling setPressed on " + this + " with value: " + pressed);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSelected(boolean selected) {
|
public void setSelected(boolean selected) {
|
||||||
System.out.println("calling setSelected on " + this + " with value: " + selected);
|
Slog.w(TAG, "calling setSelected on " + this + " with value: " + selected);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ViewTreeObserver getViewTreeObserver() {
|
public ViewTreeObserver getViewTreeObserver() {
|
||||||
@@ -940,7 +941,7 @@ public class View extends Object {
|
|||||||
public native void setVisibility(int visibility);
|
public native void setVisibility(int visibility);
|
||||||
public void setPadding(int left, int top, int right, int bottom) {}
|
public void setPadding(int left, int top, int right, int bottom) {}
|
||||||
public void setBackgroundResource(int resid) {
|
public void setBackgroundResource(int resid) {
|
||||||
// System.out.println("*** setBackgroundResource: " + getString(resid));
|
// Slog.w(TAG, "*** setBackgroundResource: " + getString(resid));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getHitRect(Rect outRect) {}
|
public void getHitRect(Rect outRect) {}
|
||||||
@@ -970,7 +971,7 @@ public class View extends Object {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean performHapticFeedback(int feedbackConstant, int flags) {
|
public boolean performHapticFeedback(int feedbackConstant, int flags) {
|
||||||
System.out.println("vibration motor go burrrr");
|
Slog.v(TAG, "vibration motor go burrrr");
|
||||||
return true; // FIXME why is it not void
|
return true; // FIXME why is it not void
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1000,7 +1001,7 @@ public class View extends Object {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void postInvalidate(int left, int top, int right, int bottom) {
|
public void postInvalidate(int left, int top, int right, int bottom) {
|
||||||
System.out.println("postInvalidate(" + left + "," + top + "," + right + "," + bottom + ") called");
|
Slog.w(TAG, "postInvalidate(" + left + "," + top + "," + right + "," + bottom + ") called");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOnGenericMotionListener(View.OnGenericMotionListener l) {}
|
public void setOnGenericMotionListener(View.OnGenericMotionListener l) {}
|
||||||
|
|||||||
Reference in New Issue
Block a user