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:
Mis012
2023-09-06 17:42:24 +02:00
parent 49861ce4dd
commit 90cb1c925a
11 changed files with 181 additions and 54 deletions

View File

@@ -3,6 +3,7 @@ package android.view;
import android.content.Context;
import android.content.res.XmlResourceParser;
import android.util.AttributeSet;
import android.util.Slog;
import android.util.Xml;
import java.io.FileReader;
import java.lang.reflect.Constructor;
@@ -11,6 +12,7 @@ import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlPullParserFactory;
public class LayoutInflater {
private static final String TAG = "LayoutInflater";
public interface Factory {
}
@@ -33,7 +35,7 @@ public class LayoutInflater {
}
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;
Class view_class = Class.forName(view_class_name);
@@ -68,7 +70,7 @@ public class LayoutInflater {
name = attrs.getAttributeValue(null, "class");
}
System.out.println("******** Creating view: " + name);
Slog.v(TAG, "******** Creating view: " + name);
View view;
@@ -78,7 +80,7 @@ public class LayoutInflater {
view = createView(name, null, attrs);
}
System.out.println("Created view is: " + view);
Slog.v(TAG, "Created view is: " + view);
return view;
}
@@ -116,9 +118,9 @@ public class LayoutInflater {
final String name = parser.getName();
System.out.println("**************************");
System.out.println("Creating root view: " + name);
System.out.println("**************************");
Slog.v(TAG, "**************************");
Slog.v(TAG, "Creating root view: " + name);
Slog.v(TAG, "**************************");
if (name.equals("merge")) {
if (root == null || !attachToRoot) {
@@ -139,7 +141,7 @@ public class LayoutInflater {
ViewGroup.LayoutParams params = 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
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
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)
// to root. Do that now.

View File

@@ -12,6 +12,7 @@ import android.os.Looper;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.util.LayoutDirection;
import android.util.Slog;
import android.util.SparseArray;
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.
*/
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.
@@ -882,7 +883,7 @@ public class View extends Object {
// --- stubs
public void setContentDescription(CharSequence contentDescription) {
System.out.println("setContentDescription called with: >" + contentDescription + "<");
Slog.w(TAG, "setContentDescription called with: >" + contentDescription + "<");
}
public void setId(int id) {
@@ -916,11 +917,11 @@ public class View extends Object {
}
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) {
System.out.println("calling setSelected on " + this + " with value: " + selected);
Slog.w(TAG, "calling setSelected on " + this + " with value: " + selected);
}
public ViewTreeObserver getViewTreeObserver() {
@@ -940,7 +941,7 @@ public class View extends Object {
public native void setVisibility(int visibility);
public void setPadding(int left, int top, int right, int bottom) {}
public void setBackgroundResource(int resid) {
// System.out.println("*** setBackgroundResource: " + getString(resid));
// Slog.w(TAG, "*** setBackgroundResource: " + getString(resid));
}
public void getHitRect(Rect outRect) {}
@@ -970,7 +971,7 @@ public class View extends Object {
}
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
}
@@ -1000,7 +1001,7 @@ public class View extends Object {
}
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) {}