Java Code Examples for com.facebook.common.logging.FLog#wtf()

The following examples show how to use com.facebook.common.logging.FLog#wtf() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainActivity.java    From react-native-xlog with MIT License 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Log.v(TAG, "if you open xlog in application's onCreate(), rather than delay to RNView, you may see me");
    Log.e(TAG, "if you open xlog in application's onCreate(), rather than delay to RNView, you may see me");
    Log.i(TAG, "if you open xlog in application's onCreate(), rather than delay to RNView, you may see me");
    Log.w(TAG, "if you open xlog in application's onCreate(), rather than delay to RNView, you may see me");
    Log.e(TAG, "if you open xlog in application's onCreate(), rather than delay to RNView, you may see me");
    Log.f(TAG, "if you open xlog in application's onCreate(), rather than delay to RNView, you may see me");
    Log.i(TAG, "if you open xlog in application's onCreate(), rather than delay to RNView, you may see me");

    FLog.v(F_TAG, "if you open xlog in application's onCreate(), rather than delay to RNView, you may see me");
    FLog.e(F_TAG, "if you open xlog in application's onCreate(), rather than delay to RNView, you may see me");
    FLog.i(F_TAG, "if you open xlog in application's onCreate(), rather than delay to RNView, you may see me");
    FLog.w(F_TAG, "if you open xlog in application's onCreate(), rather than delay to RNView, you may see me");
    FLog.e(F_TAG, "if you open xlog in application's onCreate(), rather than delay to RNView, you may see me");
    FLog.wtf(F_TAG, "if you open xlog in application's onCreate(), rather than delay to RNView, you may see me");

    android.util.Log.wtf("android-" + TAG, "you can't see me in xlog file");
}
 
Example 2
Source File: NativeMemoryCacheTrimStrategy.java    From fresco with MIT License 6 votes vote down vote up
@Override
public double getTrimRatio(MemoryTrimType trimType) {
  switch (trimType) {
    case OnCloseToDalvikHeapLimit:
      // Resources cached on native heap do not consume Dalvik heap, so no trimming here.
      return 0;
    case OnAppBackgrounded:
    case OnSystemMemoryCriticallyLowWhileAppInForeground:
    case OnSystemLowMemoryWhileAppInForeground:
    case OnSystemLowMemoryWhileAppInBackground:
      return 1;
    default:
      FLog.wtf(TAG, "unknown trim type: %s", trimType);
      return 0;
  }
}
 
Example 3
Source File: BitmapMemoryCacheTrimStrategy.java    From FanXin-based-HuanXin with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void trimCache(CountingMemoryCache<?, ?, ?> cache, MemoryTrimType trimType) {
  switch (trimType) {
    case OnCloseToDalvikHeapLimit:
  	  //Build.VERSION_CODES.LOLLIPOP
      if (Build.VERSION.SDK_INT >= 21) {
        final double cacheTrimTarget =
            1 - MemoryTrimType.OnCloseToDalvikHeapLimit.getSuggestedTrimRatio();
        final int cacheSizeTarget = (int) (cacheTrimTarget * cache.getSizeInBytes());
        cache.trimCacheTo(Integer.MAX_VALUE, cacheSizeTarget);
      }
      break;
    case OnAppBackgrounded:
    case OnSystemLowMemoryWhileAppInForeground:
    case OnSystemLowMemoryWhileAppInBackground:
      cache.clearEvictionQueue();
      break;
    default:
      FLog.wtf(TAG, "unknown trim type: %s", trimType);
      break;
  }
}
 
Example 4
Source File: NativeMemoryCacheTrimStrategy.java    From FanXin-based-HuanXin with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void trimCache(CountingMemoryCache<?, ?, ?> cache, MemoryTrimType trimType) {
  switch (trimType) {
    case OnCloseToDalvikHeapLimit:
      // Cached resources do not consume dalvik heap. We should not clear the
      // cache in case of OnCloseToDalvikHeapLimit.
      break;
    case OnAppBackgrounded:
    case OnSystemLowMemoryWhileAppInForeground:
    case OnSystemLowMemoryWhileAppInBackground:
      cache.clearEvictionQueue();
      break;
    default:
      FLog.wtf(TAG, "unknown trim type: %s", trimType);
      break;
  }

}
 
Example 5
Source File: DraweeHolder.java    From FanXin-based-HuanXin with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Callback used to notify about top-level-drawable being drawn.
 */
@Override
public void onDraw() {
  // draw is only expected if the controller is attached
  if (mIsControllerAttached) {
    return;
  }
  // something went wrong here; controller is not attached, yet the hierarchy has to be drawn
  // log error and attach the controller
  FLog.wtf(
      DraweeEventTracker.class,
      "%x: Draw requested for a non-attached controller %x. %s",
      System.identityHashCode(this),
      System.identityHashCode(mController),
      toString());
  mIsHolderAttached = true;
  mIsVisible = true;
  mIsActivityStarted = true;
  attachOrDetatchController();
}
 
Example 6
Source File: FallbackJSBundleLoader.java    From react-native-GPay with MIT License 6 votes vote down vote up
/**
 * This loader delegates to (and so behaves like) the currently preferred
 * loader. If that loader fails in a recoverable way and we fall back from it,
 * it is replaced by the next most preferred loader.
 */
@Override
public String loadScript(CatalystInstanceImpl instance) {
  while (true) {
    try {
      return getDelegateLoader().loadScript(instance);
    } catch (Exception e) {
      if (e.getMessage() == null || !e.getMessage().startsWith(RECOVERABLE)) {
        throw e;
      }

      mLoaders.pop();
      mRecoveredErrors.add(e);
      FLog.wtf(TAG, "Falling back from recoverable error", e);
    }
  }
}
 
Example 7
Source File: BitmapMemoryCacheTrimStrategy.java    From fresco with MIT License 6 votes vote down vote up
@Override
public double getTrimRatio(MemoryTrimType trimType) {
  switch (trimType) {
    case OnCloseToDalvikHeapLimit:
      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        return MemoryTrimType.OnCloseToDalvikHeapLimit.getSuggestedTrimRatio();
      } else {
        // On pre-lollipop versions we keep bitmaps on the native heap, so no need to trim here
        // as it wouldn't help Dalvik heap anyway.
        return 0;
      }
    case OnAppBackgrounded:
    case OnSystemMemoryCriticallyLowWhileAppInForeground:
    case OnSystemLowMemoryWhileAppInForeground:
    case OnSystemLowMemoryWhileAppInBackground:
      return 1;
    default:
      FLog.wtf(TAG, "unknown trim type: %s", trimType);
      return 0;
  }
}
 
Example 8
Source File: SharedReference.java    From fresco with MIT License 5 votes vote down vote up
/**
 * Decreases the reference count of live object from the static map. Removes it if it's reference
 * count has become 0.
 *
 * @param value the value to remove.
 */
private static void removeLiveReference(Object value) {
  synchronized (sLiveObjects) {
    Integer count = sLiveObjects.get(value);
    if (count == null) {
      // Uh oh.
      FLog.wtf(
          "SharedReference", "No entry in sLiveObjects for value of type %s", value.getClass());
    } else if (count == 1) {
      sLiveObjects.remove(value);
    } else {
      sLiveObjects.put(value, count - 1);
    }
  }
}
 
Example 9
Source File: BitmapPoolBackend.java    From fresco with MIT License 5 votes vote down vote up
protected boolean isReusable(@Nullable Bitmap bitmap) {
  if (bitmap == null) {
    return false;
  }
  if (bitmap.isRecycled()) {
    FLog.wtf(TAG, "Cannot reuse a recycled bitmap: %s", bitmap);
    return false;
  }
  if (!bitmap.isMutable()) {
    FLog.wtf(TAG, "Cannot reuse an immutable bitmap: %s", bitmap);
    return false;
  }
  return true;
}
 
Example 10
Source File: BasePool.java    From fresco with MIT License 5 votes vote down vote up
/**
 * 'Decrement' an item from the counter
 *
 * @param numBytes size of the item in bytes
 */
public void decrement(int numBytes) {
  if (this.mNumBytes >= numBytes && this.mCount > 0) {
    this.mCount--;
    this.mNumBytes -= numBytes;
  } else {
    FLog.wtf(
        TAG,
        "Unexpected decrement of %d. Current numBytes = %d, count = %d",
        numBytes,
        this.mNumBytes,
        this.mCount);
  }
}
 
Example 11
Source File: HoneycombBitmapFactory.java    From fresco with MIT License 5 votes vote down vote up
/**
 * Creates a bitmap of the specified width and height.
 *
 * @param width the width of the bitmap
 * @param height the height of the bitmap
 * @param bitmapConfig the {@link android.graphics.Bitmap.Config} used to create the decoded
 *     Bitmap
 * @return a reference to the bitmap
 * @throws TooManyBitmapsException if the pool is full
 * @throws java.lang.OutOfMemoryError if the Bitmap cannot be allocated
 */
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1)
@Override
public CloseableReference<Bitmap> createBitmapInternal(
    int width, int height, Bitmap.Config bitmapConfig) {
  if (mImmutableBitmapFallback) {
    return createFallbackBitmap(width, height, bitmapConfig);
  }
  CloseableReference<PooledByteBuffer> jpgRef =
      mJpegGenerator.generate((short) width, (short) height);
  try {
    EncodedImage encodedImage = new EncodedImage(jpgRef);
    encodedImage.setImageFormat(DefaultImageFormats.JPEG);
    try {
      CloseableReference<Bitmap> bitmapRef =
          mPurgeableDecoder.decodeJPEGFromEncodedImage(
              encodedImage, bitmapConfig, null, jpgRef.get().size());
      if (!bitmapRef.get().isMutable()) {
        CloseableReference.closeSafely(bitmapRef);
        mImmutableBitmapFallback = true;
        FLog.wtf(TAG, "Immutable bitmap returned by decoder");
        // On some devices (Samsung GT-S7580) the returned bitmap can be immutable, in that case
        // let's jut use Bitmap.createBitmap() to hopefully create a mutable one.
        return createFallbackBitmap(width, height, bitmapConfig);
      }
      bitmapRef.get().setHasAlpha(true);
      bitmapRef.get().eraseColor(Color.TRANSPARENT);
      return bitmapRef;
    } finally {
      EncodedImage.closeSafely(encodedImage);
    }
  } finally {
    jpgRef.close();
  }
}
 
Example 12
Source File: FrescoControllerImpl.java    From fresco with MIT License 5 votes vote down vote up
private InstrumentedDrawable.Listener createListener(
    final ImageListener imageListener, final ImageInfo info, final String id) {
  return new InstrumentedDrawable.Listener() {

    public static final String TAG = "InstrumentedDrawable.Listener";

    @Override
    public void track(
        int viewWidth,
        int viewHeight,
        int imageWidth,
        int imageHeight,
        int scaledWidth,
        int scaledHeight,
        String scaleType) {
      if (imageListener != null) {
        if (!(info instanceof HasImageMetadata)) {
          FLog.wtf(TAG, "mInfo does not implement HasImageMetadata: " + info);
        } else {
          int encodedImageWidth = -1;
          int encodedImageHeight = -1;
          DimensionsInfo dimensionsInfo =
              new DimensionsInfo(
                  viewWidth,
                  viewHeight,
                  encodedImageWidth,
                  encodedImageHeight,
                  imageWidth,
                  imageHeight,
                  scaleType);

          if (imageListener != null) {
            imageListener.onImageDrawn(id, info, dimensionsInfo);
          }
        }
      }
    }
  };
}
 
Example 13
Source File: Bucket.java    From FanXin-based-HuanXin with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Releases a value to this bucket and decrements the inUse count
 * @param value the value to release
 */
public void release(V value) {
  Preconditions.checkNotNull(value);
  if (mInUseLength > 0) {
    mInUseLength --;
  } else {
    FLog.wtf(TAG, "Bucket inUseLength currently at %d", mInUseLength);
  }
  mFreeList.add(value);
}
 
Example 14
Source File: BasePool.java    From FanXin-based-HuanXin with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 'Decrement' an item from the counter
 * @param numBytes size of the item in bytes
 */
public void decrement(int numBytes) {
  if (this.mNumBytes >= numBytes && this.mCount > 0) {
    this.mCount--;
    this.mNumBytes -= numBytes;
  } else {
    FLog.wtf(
        TAG,
        "Unexpected decrement of %d. Current numBytes = %d, count = %d",
        numBytes,
        this.mNumBytes,
        this.mCount);
  }
}
 
Example 15
Source File: ImagePipelineUtilsImpl.java    From fresco with MIT License 4 votes vote down vote up
@Nullable
protected ImageRequestBuilder createDecodedImageRequestBuilder(
    @Nullable ImageRequestBuilder imageRequestBuilder, DecodedImageOptions imageOptions) {
  if (imageRequestBuilder == null) {
    return null;
  }

  if (mExperiments.useNativeRounding() && NativeCodeSetup.getUseNativeCode()) {
    setupNativeRounding(imageRequestBuilder, imageOptions.getRoundingOptions());
  }

  ResizeOptions resizeOptions = imageOptions.getResizeOptions();
  if (resizeOptions != null) {
    imageRequestBuilder.setResizeOptions(resizeOptions);
  }

  RotationOptions rotationOptions = imageOptions.getRotationOptions();
  if (rotationOptions != null) {
    imageRequestBuilder.setRotationOptions(rotationOptions);
  }

  if (imageOptions.getBitmapConfig() != null) {
    if (imageOptions.getRoundingOptions() != null || imageOptions.getPostprocessor() != null) {
      FLog.wtf(TAG, "Trying to use bitmap config incompatible with rounding.");
    } else {
      imageRequestBuilder.setImageDecodeOptions(
          ImageDecodeOptions.newBuilder()
              .setBitmapConfig(imageOptions.getBitmapConfig())
              .setCustomImageDecoder(
                  imageOptions.getImageDecodeOptions() != null
                      ? imageOptions.getImageDecodeOptions().customImageDecoder
                      : null)
              .build());
    }
  } else if (imageOptions.getImageDecodeOptions() != null
      && imageOptions.getImageDecodeOptions().customImageDecoder != null) {
    imageRequestBuilder.setImageDecodeOptions(
        ImageDecodeOptions.newBuilder()
            .setCustomImageDecoder(imageOptions.getImageDecodeOptions().customImageDecoder)
            .build());
  }

  imageRequestBuilder.setLocalThumbnailPreviewsEnabled(
      imageOptions.areLocalThumbnailPreviewsEnabled());

  imageRequestBuilder.setShouldDecodePrefetches(mExperiments.prefetchToBitmapCache());

  imageRequestBuilder.setPostprocessor(imageOptions.getPostprocessor());

  return imageRequestBuilder;
}
 
Example 16
Source File: BaseConsumer.java    From FanXin-based-HuanXin with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Called whenever onNewResultImpl or onFailureImpl throw an exception
 */
protected void onUnhandledException(Exception e) {
  FLog.wtf(this.getClass(), "unhandled exception", e);
}
 
Example 17
Source File: BaseConsumer.java    From fresco with MIT License 4 votes vote down vote up
/** Called whenever onNewResultImpl or onFailureImpl throw an exception */
protected void onUnhandledException(Exception e) {
  FLog.wtf(this.getClass(), "unhandled exception", e);
}