项目:keepass2android
文件:KP2AKeyboard.java
@Override
protected void dump(FileDescriptor fd,PrintWriter fout,String[] args) {
super.dump(fd,fout,args);
final Printer p = new PrintWriterPrinter(fout);
p.println("LatiniME state :");
p.println(" Keyboard mode = " + mKeyboardSwitcher.getKeyboardMode());
p.println(" mCapsLock=" + mCapsLock);
p.println(" mComposing=" + mComposing.toString());
p.println(" mPredictionOn=" + mPredictionOn);
p.println(" mCorrectionMode=" + mCorrectionMode);
p.println(" mPredicting=" + mPredicting);
p.println(" mAutoCorrectOn=" + mAutoCorrectOn);
p.println(" mAutoSpace=" + mAutoSpace);
p.println(" mCompletionOn=" + mCompletionOn);
p.println(" TextEntryState.state=" + TextEntryState.getState());
p.println(" mSoundOn=" + mSoundOn);
p.println(" mVibrateOn=" + mVibrateOn);
p.println(" mPopupOn=" + mPopupOn);
}
@Override
protected void dump(final FileDescriptor fd,final PrintWriter fout,final String[] args) {
super.dump(fd,args);
final Printer p = new PrintWriterPrinter(fout);
p.println("LatiniME state :");
p.println(" VersionCode = " + ApplicationUtils.getVersionCode(this));
p.println(" VersionName = " + ApplicationUtils.getVersionName(this));
final Keyboard keyboard = mKeyboardSwitcher.getKeyboard();
final int keyboardMode = keyboard != null ? keyboard.mId.mMode : -1;
p.println(" Keyboard mode = " + keyboardMode);
final SettingsValues settingsValues = mSettings.getCurrent();
p.println(settingsValues.dump());
p.println(mDictionaryFacilitator.dump(this /* context */));
// Todo: Dump all settings values
}
项目:KeePass2Android
文件:KP2AKeyboard.java
@Override
protected void dump(FileDescriptor fd,args);
final Printer p = new PrintWriterPrinter(fout);
p.println("LatiniME state :");
p.println(" Keyboard mode = " + mKeyboardSwitcher.getKeyboardMode());
p.println(" mCapsLock=" + mCapsLock);
p.println(" mComposing=" + mComposing.toString());
p.println(" mPredictionOn=" + mPredictionOn);
p.println(" mCorrectionMode=" + mCorrectionMode);
p.println(" mPredicting=" + mPredicting);
p.println(" mAutoCorrectOn=" + mAutoCorrectOn);
p.println(" mAutoSpace=" + mAutoSpace);
p.println(" mCompletionOn=" + mCompletionOn);
p.println(" TextEntryState.state=" + TextEntryState.getState());
p.println(" mSoundOn=" + mSoundOn);
p.println(" mVibrateOn=" + mVibrateOn);
p.println(" mPopupOn=" + mPopupOn);
}
项目:LiteSDK
文件:CrashInfo.java
public void dump(Printer printer,String prefix) {
printer.println("------crash begin------");
printer.println("crash time:" + DateUtils.format(System.currentTimeMillis(),DateUtils.YMD_HMS));
printer.println(prefix + "appName=" + mAppName);
printer.println(prefix + "appVersionCode=" + mAppVersionCode);
printer.println(prefix + "appVersionName=" + mAppVersionName);
printer.println(prefix + "sdkVersion=" + mSDKVersion);
printer.println(prefix + "deviceName=" + mDeviceName);
printer.println(prefix + "deviceid=" + mdeviceid);
printer.println(prefix + "osversion=" + mOsversion);
printer.println(prefix + "osName=" + mOsName);
printer.println(prefix + "arch=" + march);
printer.println(prefix + "product=" + mProduct);
printer.println(prefix + "cpuCoreCount=" + mcpuCoreCount);
printer.println(prefix + "memorySize=" + memorySize);
printer.println(prefix + "threadName=" + mThreadName);
printer.println(prefix + "errorMessage=" + mErrorMessage);
printer.println("------crash end------");
}
项目:core-doppl
文件:Looper.java
public void dump(Printer pw,String prefix) {
/*pw = PrefixPrinter.create(pw,prefix);
pw.println(this.toString());
pw.println("mRun=" + mRun);
pw.println("mThread=" + mThread);
pw.println("mQueue=" + ((mQueue != null) ? mQueue : "(null"));
if (mQueue != null) {
synchronized (mQueue) {
long Now = SystemClock.uptimeMillis();
Message msg = mQueue.mMessages;
int n = 0;
while (msg != null) {
pw.println(" Message " + n + ": " + msg.toString(Now));
n++;
msg = msg.next;
}
pw.println("(Total messages: " + n + ")");
}
}*/
}
public void dump(Printer printer) {
printer.println(" Prepared statement cache:");
Map<String,PreparedStatement> cache = snapshot();
if (!cache.isEmpty()) {
int i = 0;
for (Map.Entry<String,PreparedStatement> entry : cache.entrySet()) {
PreparedStatement statement = entry.getValue();
if (statement.mInCache) { // might be false due to a race with entryRemoved
String sql = entry.getKey();
printer.println(" " + i + ": statementPtr=0x"
+ Long.toHexString(statement.mStatementPtr)
+ ",numParameters=" + statement.mNumParameters
+ ",type=" + statement.mType
+ ",readOnly=" + statement.mReadOnly
+ ",sql=\"" + trimsqlFordisplay(sql) + "\"");
}
i += 1;
}
} else {
printer.println(" <none>");
}
}
项目:TrustKit-Android
文件:TrustKit.java
/** Try to retrieve the Network Security Policy resource ID configured in the App's manifest.
*
* Somewhat convoluted as other means of getting the resource ID involve using private APIs.
*
* @param context
* @return The resource ID for the XML file containing the configured Network Security Policy or
* -1 if no policy was configured in the App's manifest or if we are not running on Android N.
*/
static private int getNetSecConfigResourceId(@NonNull Context context) {
ApplicationInfo info = context.getApplicationInfo();
// Dump the content of the ApplicationInfo,which contains the resource ID on Android N
class NetSecConfigResIdRetriever implements Printer {
private int netSecConfigResourceId = -1;
private final String NETSEC_LINE_FORMAT = "networkSecurityConfigRes=0x";
public void println(String x) {
if (netSecConfigResourceId == -1) {
// Attempt at parsing "networkSecurityConfigRes=0x1234"
if (x.contains(NETSEC_LINE_FORMAT)) {
netSecConfigResourceId =
Integer.parseInt(x.substring(NETSEC_LINE_FORMAT.length()),16);
}
}
}
private int getNetworkSecurityConfigResId() { return netSecConfigResourceId; }
}
NetSecConfigResIdRetriever retriever = new NetSecConfigResIdRetriever();
info.dump(retriever,"");
return retriever.getNetworkSecurityConfigResId();
}
@Override
protected void dump(FileDescriptor fd,args);
final Printer p = new PrintWriterPrinter(fout);
p.println("LatiniME state :");
p.println(" Keyboard mode = " + mKeyboardSwitcher.getKeyboardMode());
p.println(" mComposing=" + mComposing.toString());
p.println(" mPredictionOnForMode=" + mPredictionOnForMode);
p.println(" mCorrectionMode=" + mCorrectionMode);
p.println(" mPredicting=" + mPredicting);
p.println(" mAutoCorrectOn=" + mAutoCorrectOn);
p.println(" mAutoSpace=" + mAutoSpace);
p.println(" mCompletionOn=" + mCompletionOn);
p.println(" TextEntryState.state=" + TextEntryState.getState());
p.println(" mSoundOn=" + mSoundOn);
p.println(" mVibrateOn=" + mVibrateOn);
p.println(" mPopupOn=" + mPopupOn);
}
项目:j2objc
文件:TextUtils.java
/**
* Debugging tool to print the spans in a CharSequence. The output will
* be printed one span per line. If the CharSequence is not a Spanned,* then the entire string will be printed on a single line.
*/
public static void dumpSpans(CharSequence cs,Printer printer,String prefix) {
if (cs instanceof Spanned) {
Spanned sp = (Spanned) cs;
Object[] os = sp.getSpans(0,cs.length(),Object.class);
for (int i = 0; i < os.length; i++) {
Object o = os[i];
printer.println(prefix + cs.subSequence(sp.getSpanStart(o),sp.getSpanEnd(o)) + ": "
+ Integer.toHexString(System.identityHashCode(o))
+ " " + o.getClass().getCanonicalName()
+ " (" + sp.getSpanStart(o) + "-" + sp.getSpanEnd(o)
+ ") fl=#" + sp.getSpanFlags(o));
}
} else {
printer.println(prefix + cs + ": (no spans)");
}
}
项目:JotaTextEditor
文件:TextUtils.java
/**
* Debugging tool to print the spans in a CharSequence. The output will
* be printed one span per line. If the CharSequence is not a Spanned,sp.getSpanEnd(o)) + ": "
+ Integer.toHexString(System.identityHashCode(o))
+ " " + o.getClass().getCanonicalName()
+ " (" + sp.getSpanStart(o) + "-" + sp.getSpanEnd(o)
+ ") fl=#" + sp.getSpanFlags(o));
}
} else {
printer.println(prefix + cs + ": (no spans)");
}
}
项目:ApkLauncher
文件:FastPrintWriter.java
/**
* Constructs a new {@code PrintWriter} with {@code pr} as its target
* printer and a custom buffer size. Because a {@link Printer} is line-base,* autoflush is always enabled.
*
* @param pr
* the target writer.
* @param bufferLen
* specifies the size of the FastPrintWriter's internal buffer; the
* default is 512.
* @throws NullPointerException
* if {@code pr} is {@code null}.
*/
public FastPrintWriter(Printer pr,int bufferLen) {
super(new DummyWriter(),true);
if (pr == null) {
throw new NullPointerException("pr is null");
}
mBufferLen = bufferLen;
mText = new char[bufferLen];
mBytes = null;
mOutputStream = null;
mWriter = null;
mPrinter = pr;
mAutoFlush = true;
mSeparator = System.lineseparator();
initDefaultEncoder();
}
@Override
protected void dump(final FileDescriptor fd,args);
final Printer p = new PrintWriterPrinter(fout);
p.println("LatiniME state :");
final Keyboard keyboard = mKeyboardSwitcher.getKeyboard();
final int keyboardMode = keyboard != null ? keyboard.mId.mMode : -1;
p.println(" Keyboard mode = " + keyboardMode);
final SettingsValues settingsValues = mSettings.getCurrent();
p.println(" mIsSuggestionsSuggestionsRequested = "
+ settingsValues.isSuggestionsRequested(mdisplayOrientation));
p.println(" mCorrectionEnabled=" + settingsValues.mCorrectionEnabled);
p.println(" isComposingWord=" + mWordComposer.isComposingWord());
p.println(" mSoundOn=" + settingsValues.mSoundOn);
p.println(" mVibrateOn=" + settingsValues.mVibrateOn);
p.println(" mKeyPreviewPopupOn=" + settingsValues.mKeyPreviewPopupOn);
p.println(" inputAttributes=" + settingsValues.mInputAttributes);
}
@Override
protected void dump(final FileDescriptor fd,args);
final Printer p = new PrintWriterPrinter(fout);
p.println("LatiniME state :");
p.println(" VersionCode = " + ApplicationUtils.getVersionCode(this));
p.println(" VersionName = " + ApplicationUtils.getVersionName(this));
final Keyboard keyboard = mKeyboardSwitcher.getKeyboard();
final int keyboardMode = keyboard != null ? keyboard.mId.mMode : -1;
p.println(" Keyboard mode = " + keyboardMode);
}
项目:JkImageLoader
文件:LooperLogsDetectByPrinter.java
/**
* start monitor ui thread
* @author leibing
* @createTime 2017/3/1
* @lastModify 2017/3/1
* @param
* @return
*/
public static void start(){
Looper.getMainLooper().setMessageLogging(new Printer() {
@Override
public void println(String s) {
if (s.startsWith(START)){
LogMonitor.getInstance().startMonitor();
}
if (s.startsWith(END)){
LogMonitor.getInstance().removeMonitor();
}
}
});
}
private void dump(Printer printer,verbose);
}
}
}
项目:core-doppl
文件:Handler.java
public final void dump(Printer pw,String prefix) {
pw.println(prefix + this + " @ " + SystemClock.uptimeMillis());
if (mLooper == null) {
pw.println(prefix + "looper uninitialized");
} else {
mLooper.dump(pw,prefix + " ");
}
}
/**
* Dumps detailed @R_797_4045@ion about all databases used by the process.
* @param printer The printer for dumping database state.
* @param args Command-line arguments supplied to dumpsys dbinfo
*/
public static void dump(Printer printer,String[] args) {
boolean verbose = false;
for (String arg : args) {
if (arg.equals("-v")) {
verbose = true;
}
}
sqliteDatabase.dumpAll(printer,verbose);
}
private void dump(Printer printer,boolean verbose) {
synchronized (mlock) {
if (mConnectionPoolLocked != null) {
printer.println("");
mConnectionPoolLocked.dump(printer,verbose);
}
}
}
/**
* Dumps debugging @R_797_4045@ion about this connection,in the case where the
* caller might not actually own the connection.
*
* This function is written so that it may be called by a thread that does not
* own the connection. We need to be very careful because the connection state is
* not synchronized.
*
* At worst,the method may return stale or slightly wrong data,however
* it should not crash. This is ok as it is only used for diagnostic purposes.
*
* @param printer The printer to receive the dump,not null.
* @param verbose True to dump more verbose @R_797_4045@ion.
*/
void dumpunsafe(Printer printer,boolean verbose) {
printer.println("Connection #" + mConnectionId + ":");
if (verbose) {
printer.println(" connectionPtr: 0x" + Long.toHexString(mConnectionPtr));
}
printer.println(" isPrimaryConnection: " + mIsPrimaryConnection);
printer.println(" onlyAllowReadOnlyOperations: " + mOnlyAllowReadOnlyOperations);
mRecentOperations.dump(printer,verbose);
if (verbose) {
mPreparedStatementCache.dump(printer);
}
}
public void dump(Printer printer,boolean verbose) {
synchronized (mOperations) {
printer.println(" Most recently executed operations:");
int index = mIndex;
Operation operation = mOperations[index];
if (operation != null) {
int n = 0;
do {
StringBuilder msg = new StringBuilder();
msg.append(" ").append(n).append(": [");
msg.append(operation.getFormattedStartTime());
msg.append("] ");
operation.describe(msg,verbose);
printer.println(msg.toString());
if (index > 0) {
index -= 1;
} else {
index = MAX_RECENT_OPERATIONS - 1;
}
n += 1;
operation = mOperations[index];
} while (operation != null && n < MAX_RECENT_OPERATIONS);
} else {
printer.println(" <none>");
}
}
}
private void dump(Printer printer,verbose);
}
}
}
/**
* Dumps debugging @R_797_4045@ion about this connection,verbose);
if (verbose) {
mPreparedStatementCache.dump(printer);
}
}
public void dump(Printer printer,verbose);
printer.println(msg.toString());
if (index > 0) {
index -= 1;
} else {
index = MAX_RECENT_OPERATIONS - 1;
}
n += 1;
operation = mOperations[index];
} while (operation != null && n < MAX_RECENT_OPERATIONS);
} else {
printer.println(" <none>");
}
}
}
项目:nucleolus
文件:DefaultPresenterManager.java
public void print(Printer printer) {
Iterator i$ = this.idToPresenter.entrySet().iterator();
while (i$.hasNext()) {
Map.Entry entry = (Map.Entry) i$.next();
Object view = ((Presenter) entry.getValue()).getView();
printer.println("id: " + entry.getKey() + (view == null ? "" : " => view: " + view.toString()));
}
}
private void dump(Printer printer,verbose);
}
}
}
/**
* Dumps debugging @R_797_4045@ion about this connection,verbose);
if (verbose) {
mPreparedStatementCache.dump(printer);
}
}
public void dump(Printer printer,verbose);
printer.println(msg.toString());
if (index > 0) {
index -= 1;
} else {
index = MAX_RECENT_OPERATIONS - 1;
}
n += 1;
operation = mOperations[index];
} while (operation != null && n < MAX_RECENT_OPERATIONS);
} else {
printer.println(" <none>");
}
}
}
/**
* Dump detailed @R_797_4045@ion about all open databases in the current process.
* Used by bug report.
*/
static void dumpAll(Printer printer,verbose);
}
}
/**
* Dump detailed @R_797_4045@ion about all open databases in the current process.
* Used by bug report.
*/
static void dumpAll(Printer printer,verbose);
}
}
/**
* Dumps debugging @R_797_4045@ion about this connection pool.
*
* @param printer The printer to receive the dump,not null.
* @param verbose True to dump more verbose @R_797_4045@ion.
*/
public void dump(Printer printer,boolean verbose) {
/*
Printer indentedPrinter = Printer.create(printer," ");
synchronized (mlock) {
printer.println("Connection pool for " + mConfiguration.path + ":");
printer.println(" Open: " + mIsOpen);
printer.println(" Max connections: " + mMaxConnectionPoolSize);
printer.println(" Available primary connection:");
if (mAvailablePrimaryConnection != null) {
mAvailablePrimaryConnection.dump(indentedPrinter,verbose);
} else {
indentedPrinter.println("<none>");
}
printer.println(" Available non-primary connections:");
if (!mAvailableNonPrimaryConnections.isEmpty()) {
final int count = mAvailableNonPrimaryConnections.size();
for (int i = 0; i < count; i++) {
mAvailableNonPrimaryConnections.get(i).dump(indentedPrinter,verbose);
}
} else {
indentedPrinter.println("<none>");
}
printer.println(" Acquired connections:");
if (!mAcquiredConnections.isEmpty()) {
for (Map.Entry<sqliteConnection,AcquiredConnectionStatus> entry :
mAcquiredConnections.entrySet()) {
final sqliteConnection connection = entry.getKey();
connection.dumpunsafe(indentedPrinter,verbose);
indentedPrinter.println(" Status: " + entry.getValue());
}
} else {
indentedPrinter.println("<none>");
}
printer.println(" Connection waiters:");
if (mConnectionWaiterQueue != null) {
int i = 0;
final long Now = SystemClock.uptimeMillis();
for (ConnectionWaiter waiter = mConnectionWaiterQueue; waiter != null;
waiter = waiter.mNext,i++) {
indentedPrinter.println(i + ": waited for "
+ ((Now - waiter.mStartTime) * 0.001f)
+ " ms - thread=" + waiter.mThread
+ ",priority=" + waiter.mPriority
+ ",sql='" + waiter.msql + "'");
}
} else {
indentedPrinter.println("<none>");
}
}
*/
}
/**
* Dump detailed @R_797_4045@ion about all open databases in the current process.
* Used by bug report.
*/
static void dumpAll(Printer printer,verbose);
}
}
public void dump(Printer pw,String prefix) {
}
项目:android-test-kit
文件:HumanReadables.java
/**
* Transforms an arbitrary view into a string with (hopefully) enough debug info.
*
* @param v nullable view
* @return a string for human consumption.
*/
public static String describe(View v) {
if (null == v) {
return "null";
}
ToStringHelper helper = Objects.toStringHelper(v).add("id",v.getId());
if (v.getId() != -1 && v.getResources() != null) {
try {
helper.add("res-name",v.getResources().getResourceEntryName(v.getId()));
} catch (Resources.NotFoundException ignore) {
// Do nothing.
}
}
if (null != v.getContentDescription()) {
helper.add("desc",v.getContentDescription());
}
switch (v.getVisibility()) {
case View.GONE:
helper.add("visibility","GONE");
break;
case View.INVISIBLE:
helper.add("visibility","INVISIBLE");
break;
case View.VISIBLE:
helper.add("visibility","VISIBLE");
break;
default:
helper.add("visibility",v.getVisibility());
}
helper.add("width",v.getWidth())
.add("height",v.getHeight())
.add("has-focus",v.hasFocus())
.add("has-focusable",v.hasFocusable())
.add("has-window-focus",v.hasWindowFocus())
.add("is-clickable",v.isClickable())
.add("is-enabled",v.isEnabled())
.add("is-focused",v.isFocused())
.add("is-focusable",v.isFocusable())
.add("is-layout-requested",v.isLayoutRequested())
.add("is-selected",v.isSelected());
if (null != v.getRootView()) {
// pretty much only true in unit-tests.
helper.add("root-is-layout-requested",v.getRootView().isLayoutRequested());
}
EditorInfo ei = new EditorInfo();
InputConnection ic = v.onCreateInputConnection(ei);
boolean hasInputConnection = ic != null;
helper.add("has-input-connection",hasInputConnection);
if (hasInputConnection) {
StringBuilder sb = new StringBuilder();
sb.append("[");
Printer p = new StringBuilderPrinter(sb);
ei.dump(p,"");
sb.append("]");
helper.add("editor-info",sb.toString().replace("\n"," "));
}
if (Build.VERSION.SDK_INT > 10) {
helper.add("x",v.getX()).add("y",v.getY());
}
if (v instanceof TextView) {
innerDescribe((TextView) v,helper);
}
if (v instanceof Checkable) {
innerDescribe((Checkable) v,helper);
}
if (v instanceof ViewGroup) {
innerDescribe((ViewGroup) v,helper);
}
return helper.toString();
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。