Merge "Don't print sensitive data on AssistStructure.dump()" into oc-dev
am: 7bd1d3e48b
Change-Id: I8a186cf8fefe19d936acbbf19ae65a6e645eca4d
This commit is contained in:
@@ -1936,7 +1936,7 @@ public class AssistStructure implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public void dump() {
|
public void dump(boolean showSensitive) {
|
||||||
if (mActivityComponent == null) {
|
if (mActivityComponent == null) {
|
||||||
Log.i(TAG, "dump(): calling ensureData() first");
|
Log.i(TAG, "dump(): calling ensureData() first");
|
||||||
ensureData();
|
ensureData();
|
||||||
@@ -1949,11 +1949,11 @@ public class AssistStructure implements Parcelable {
|
|||||||
WindowNode node = getWindowNodeAt(i);
|
WindowNode node = getWindowNodeAt(i);
|
||||||
Log.i(TAG, "Window #" + i + " [" + node.getLeft() + "," + node.getTop()
|
Log.i(TAG, "Window #" + i + " [" + node.getLeft() + "," + node.getTop()
|
||||||
+ " " + node.getWidth() + "x" + node.getHeight() + "]" + " " + node.getTitle());
|
+ " " + node.getWidth() + "x" + node.getHeight() + "]" + " " + node.getTitle());
|
||||||
dump(" ", node.getRootViewNode());
|
dump(" ", node.getRootViewNode(), showSensitive);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void dump(String prefix, ViewNode node) {
|
void dump(String prefix, ViewNode node, boolean showSensitive) {
|
||||||
Log.i(TAG, prefix + "View [" + node.getLeft() + "," + node.getTop()
|
Log.i(TAG, prefix + "View [" + node.getLeft() + "," + node.getTop()
|
||||||
+ " " + node.getWidth() + "x" + node.getHeight() + "]" + " " + node.getClassName());
|
+ " " + node.getWidth() + "x" + node.getHeight() + "]" + " " + node.getClassName());
|
||||||
int id = node.getId();
|
int id = node.getId();
|
||||||
@@ -1992,12 +1992,15 @@ public class AssistStructure implements Parcelable {
|
|||||||
}
|
}
|
||||||
CharSequence text = node.getText();
|
CharSequence text = node.getText();
|
||||||
if (text != null) {
|
if (text != null) {
|
||||||
|
final String safeText = node.isSanitized() || showSensitive ? text.toString()
|
||||||
|
: "REDACTED[" + text.length() + " chars]";
|
||||||
Log.i(TAG, prefix + " Text (sel " + node.getTextSelectionStart() + "-"
|
Log.i(TAG, prefix + " Text (sel " + node.getTextSelectionStart() + "-"
|
||||||
+ node.getTextSelectionEnd() + "): " + text);
|
+ node.getTextSelectionEnd() + "): " + safeText);
|
||||||
Log.i(TAG, prefix + " Text size: " + node.getTextSize() + " , style: #"
|
Log.i(TAG, prefix + " Text size: " + node.getTextSize() + " , style: #"
|
||||||
+ node.getTextStyle());
|
+ node.getTextStyle());
|
||||||
Log.i(TAG, prefix + " Text color fg: #" + Integer.toHexString(node.getTextColor())
|
Log.i(TAG, prefix + " Text color fg: #" + Integer.toHexString(node.getTextColor())
|
||||||
+ ", bg: #" + Integer.toHexString(node.getTextBackgroundColor()));
|
+ ", bg: #" + Integer.toHexString(node.getTextBackgroundColor()));
|
||||||
|
Log.i(TAG, prefix + " Input type: " + node.getInputType());
|
||||||
}
|
}
|
||||||
String webDomain = node.getWebDomain();
|
String webDomain = node.getWebDomain();
|
||||||
if (webDomain != null) {
|
if (webDomain != null) {
|
||||||
@@ -2031,7 +2034,6 @@ public class AssistStructure implements Parcelable {
|
|||||||
Log.i(TAG, prefix + "Autofill info: id= " + autofillId
|
Log.i(TAG, prefix + "Autofill info: id= " + autofillId
|
||||||
+ ", type=" + node.getAutofillType()
|
+ ", type=" + node.getAutofillType()
|
||||||
+ ", options=" + Arrays.toString(node.getAutofillOptions())
|
+ ", options=" + Arrays.toString(node.getAutofillOptions())
|
||||||
+ ", inputType=" + node.getInputType()
|
|
||||||
+ ", hints=" + Arrays.toString(node.getAutofillHints())
|
+ ", hints=" + Arrays.toString(node.getAutofillHints())
|
||||||
+ ", value=" + node.getAutofillValue()
|
+ ", value=" + node.getAutofillValue()
|
||||||
+ ", sanitized=" + node.isSanitized());
|
+ ", sanitized=" + node.isSanitized());
|
||||||
@@ -2043,7 +2045,7 @@ public class AssistStructure implements Parcelable {
|
|||||||
String cprefix = prefix + " ";
|
String cprefix = prefix + " ";
|
||||||
for (int i=0; i<NCHILDREN; i++) {
|
for (int i=0; i<NCHILDREN; i++) {
|
||||||
ViewNode cnode = node.getChildAt(i);
|
ViewNode cnode = node.getChildAt(i);
|
||||||
dump(cprefix, cnode);
|
dump(cprefix, cnode, showSensitive);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -888,7 +888,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
|
|||||||
|
|
||||||
if (sVerbose) {
|
if (sVerbose) {
|
||||||
Slog.v(TAG, "Dumping structure of " + context + " before calling service.save()");
|
Slog.v(TAG, "Dumping structure of " + context + " before calling service.save()");
|
||||||
context.getStructure().dump();
|
context.getStructure().dump(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1402,7 +1402,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
|
|||||||
pw.println(context.getStructure() + " (look at logcat)");
|
pw.println(context.getStructure() + " (look at logcat)");
|
||||||
|
|
||||||
// TODO: add method on AssistStructure to dump on pw
|
// TODO: add method on AssistStructure to dump on pw
|
||||||
context.getStructure().dump();
|
context.getStructure().dump(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ public class AssistVisualizer extends View {
|
|||||||
|
|
||||||
public void logTree() {
|
public void logTree() {
|
||||||
if (mAssistStructure != null) {
|
if (mAssistStructure != null) {
|
||||||
mAssistStructure.dump();
|
mAssistStructure.dump(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user