本文整理汇总了Java中com.facebook.stetho.common.LogUtil.w方法的典型用法代码示例。如果您正苦于以下问题:Java LogUtil.w方法的具体用法?Java LogUtil.w怎么用?Java LogUtil.w使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.facebook.stetho.common.LogUtil
的用法示例。
在下文中一共展示了LogUtil.w方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: bindToSocket
import com.facebook.stetho.common.LogUtil; //导入方法依赖的package包/类
@Nonnull
private static LocalServerSocket bindToSocket(String address) throws IOException {
int retries = MAX_BIND_RETRIES;
IOException firstException = null;
do {
try {
if (LogUtil.isLoggable(Log.DEBUG)) {
LogUtil.d("Trying to bind to @" + address);
}
return new LocalServerSocket(address);
} catch (BindException be) {
LogUtil.w(be, "Binding error, sleep " + TIME_BETWEEN_BIND_RETRIES_MS + " ms...");
if (firstException == null) {
firstException = be;
}
Util.sleepUninterruptibly(TIME_BETWEEN_BIND_RETRIES_MS);
}
} while (retries-- > 0);
throw firstException;
}
示例2: closeAll
import com.facebook.stetho.common.LogUtil; //导入方法依赖的package包/类
private void closeAll(int mostImportantIndex) throws IOException {
IOException exceptionToThrow = null;
for (int i = 0; i < mStreams.length; i++) {
try {
mStreams[i].close();
} catch (IOException e) {
IOException previousException = exceptionToThrow;
if (i == mostImportantIndex || exceptionToThrow == null) {
exceptionToThrow = e;
}
if (previousException != null && previousException != exceptionToThrow) {
LogUtil.w(previousException, "Suppressing exception");
}
}
}
}
示例3: highlightNode
import com.facebook.stetho.common.LogUtil; //导入方法依赖的package包/类
@ChromeDevtoolsMethod
public void highlightNode(JsonRpcPeer peer, JSONObject params) {
final HighlightNodeRequest request =
mObjectMapper.convertValue(params, HighlightNodeRequest.class);
if (request.nodeId == null) {
LogUtil.w("DOM.highlightNode was not given a nodeId; JS objectId is not supported");
return;
}
final RGBAColor contentColor = request.highlightConfig.contentColor;
if (contentColor == null) {
LogUtil.w("DOM.highlightNode was not given a color to highlight with");
return;
}
mDocument.postAndWait(new Runnable() {
@Override
public void run() {
Object element = mDocument.getElementForNodeId(request.nodeId);
if (element != null) {
mDocument.highlightElement(element, contentColor.getColor());
}
}
});
}
示例4: getSearchResults
import com.facebook.stetho.common.LogUtil; //导入方法依赖的package包/类
@ChromeDevtoolsMethod
public GetSearchResultsResponse getSearchResults(JsonRpcPeer peer, JSONObject params) {
final GetSearchResultsRequest request = mObjectMapper.convertValue(
params,
GetSearchResultsRequest.class);
if (request.searchId == null) {
LogUtil.w("searchId may not be null");
return null;
}
final List<Integer> results = mSearchResults.get(request.searchId);
if (results == null) {
LogUtil.w("\"" + request.searchId + "\" is not a valid reference to a search result");
return null;
}
final List<Integer> resultsRange = results.subList(request.fromIndex, request.toIndex);
final GetSearchResultsResponse response = new GetSearchResultsResponse();
response.nodeIds = resultsRange;
return response;
}
示例5: listenOnAddress
import com.facebook.stetho.common.LogUtil; //导入方法依赖的package包/类
private void listenOnAddress(String address) throws IOException {
mServerSocket = bindToSocket(address);
LogUtil.i("Listening on @" + address);
while (!Thread.interrupted()) {
try {
// Use previously accepted socket the first time around, otherwise wait to
// accept another.
LocalSocket socket = mServerSocket.accept();
// Start worker thread
Thread t = new WorkerThread(socket, mSocketHandler);
t.setName(
WORKER_THREAD_NAME_PREFIX +
"-" + mFriendlyName +
"-" + mThreadId.incrementAndGet());
t.setDaemon(true);
t.start();
} catch (SocketException se) {
// ignore exception if interrupting the thread
if (Thread.interrupted()) {
break;
}
LogUtil.w(se, "I/O error");
} catch (InterruptedIOException ex) {
break;
} catch (IOException e) {
LogUtil.w(e, "I/O error initialising connection thread");
break;
}
}
LogUtil.i("Server shutdown on @" + address);
}
示例6: run
import com.facebook.stetho.common.LogUtil; //导入方法依赖的package包/类
@Override
public void run() {
try {
mSocketHandler.onAccepted(mSocket);
} catch (IOException ex) {
LogUtil.w("I/O error: %s", ex);
} finally {
try {
mSocket.close();
} catch (IOException ignore) {
}
}
}
示例7: getIdStringQuietly
import com.facebook.stetho.common.LogUtil; //导入方法依赖的package包/类
@Nonnull
public static String getIdStringQuietly(Object idContext, @Nullable Resources r, int resourceId) {
try {
return getIdString(r, resourceId);
} catch (Resources.NotFoundException e) {
String idString = getFallbackIdString(resourceId);
LogUtil.w("Unknown identifier encountered on " + idContext + ": " + idString);
return idString;
}
}
示例8: initialize
import com.facebook.stetho.common.LogUtil; //导入方法依赖的package包/类
/**
* Start the listening service, providing a custom initializer as per
* {@link #newInitializerBuilder}.
*
* @see #initializeWithDefaults(Context)
*/
public static void initialize(final Initializer initializer) {
// Hook activity tracking so that after Stetho is attached we can figure out what
// activities are present.
boolean isTrackingActivities = ActivityTracker.get().beginTrackingIfPossible(
(Application)initializer.mContext.getApplicationContext());
if (!isTrackingActivities) {
LogUtil.w("Automatic activity tracking not available on this API level, caller must invoke " +
"ActivityTracker methods manually!");
}
initializer.start();
}
示例9: newInstance
import com.facebook.stetho.common.LogUtil; //导入方法依赖的package包/类
public static ViewHighlighter newInstance() {
// TODO: find ways to do highlighting on older versions too
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
return new OverlayHighlighter();
} else {
LogUtil.w("Running on pre-JBMR2: View highlighting is not supported");
return new NoopHighlighter();
}
}
示例10: invoke
import com.facebook.stetho.common.LogUtil; //导入方法依赖的package包/类
/**
* Tries to invoke a method on receiver with a single argument by trying out different types
* for arg until it finds one that matches (or not). No exceptions are thrown on failure.
*
* @param methodName The method name to be invoked
* @param argument The single argument to be provided to the method
*/
public void invoke(Object receiver, String methodName, String argument) {
Util.throwIfNull(receiver, methodName, argument);
int size = invokers.size();
for (int i = 0; i < size; ++i) {
final TypedMethodInvoker<?> invoker = invokers.get(i);
if (invoker.invoke(receiver, methodName, argument)) {
return;
}
}
LogUtil.w("Method with name " + methodName +
" not found for any of the MethodInvoker supported argument types.");
}
示例11: updateScreenBitmap
import com.facebook.stetho.common.LogUtil; //导入方法依赖的package包/类
private void updateScreenBitmap() {
if (!mIsRunning) {
return;
}
Activity activity = mActivityTracker.tryGetTopActivity();
if (activity == null) {
return;
}
// This stuff needs to happen in the UI thread
View rootView = activity.getWindow().getDecorView();
try {
if (mBitmap == null) {
int viewWidth = rootView.getWidth();
int viewHeight = rootView.getHeight();
float scale = Math.min((float) mRequest.maxWidth / (float) viewWidth,
(float) mRequest.maxHeight / (float) viewHeight);
int destWidth = (int) (viewWidth * scale);
int destHeight = (int) (viewHeight * scale);
mBitmap = Bitmap.createBitmap(destWidth, destHeight, Bitmap.Config.RGB_565);
mCanvas = new Canvas(mBitmap);
Matrix matrix = new Matrix();
mTempSrc.set(0, 0, viewWidth, viewHeight);
mTempDst.set(0, 0, destWidth, destHeight);
matrix.setRectToRect(mTempSrc, mTempDst, Matrix.ScaleToFit.CENTER);
mCanvas.setMatrix(matrix);
}
rootView.draw(mCanvas);
} catch (OutOfMemoryError e) {
LogUtil.w("Out of memory trying to allocate screencast Bitmap.");
}
}
示例12: logAndThrowProtocolException
import com.facebook.stetho.common.LogUtil; //导入方法依赖的package包/类
private static IOException logAndThrowProtocolException(String message) throws IOException {
LogUtil.w(message);
throw new IOException(message);
}
示例13: releaseObjectGroup
import com.facebook.stetho.common.LogUtil; //导入方法依赖的package包/类
@ChromeDevtoolsMethod
public void releaseObjectGroup(JsonRpcPeer peer, JSONObject params) {
LogUtil.w("Ignoring request to releaseObjectGroup: " + params);
}