com.facebook.imagepipeline.memory.BitmapCounterProvider Java Examples
The following examples show how to use
com.facebook.imagepipeline.memory.BitmapCounterProvider.
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: ImageFilter.java From react-native-image-filter-kit with MIT License | 6 votes |
private static void ashmemInfo(@Nonnull String stateLabel) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { BitmapCounter counter = BitmapCounterProvider.get(); FLog.d( ReactConstants.TAG, String.format( Locale.ROOT, "ImageFilterKit: bitmap pool %s - %d/%d images, %d/%d MB", stateLabel, counter.getCount(), counter.getMaxCount(), counter.getSize() / 1024 / 1024, counter.getMaxSize() / 1024 / 1024 ) ); } }
Example #2
Source File: DalvikBitmapFactory.java From FanXin-based-HuanXin with GNU General Public License v2.0 | 6 votes |
public DalvikBitmapFactory( EmptyJpegGenerator jpegGenerator, SingleByteArrayPool singleByteArrayPool) { mJpegGenerator = jpegGenerator; mSingleByteArrayPool = singleByteArrayPool; mUnpooledBitmapsCounter = BitmapCounterProvider.get(); mUnpooledBitmapsReleaser = new ResourceReleaser<Bitmap>() { @Override public void release(Bitmap value) { try { mUnpooledBitmapsCounter.decrease(value); } finally { value.recycle(); } } }; }
Example #3
Source File: GingerbreadPurgeableDecoderTest.java From fresco with MIT License | 5 votes |
@Before public void setUp() { mBitmap = MockBitmapFactory.create(); mBitmapCounter = new BitmapCounter(MAX_BITMAP_COUNT, MAX_BITMAP_SIZE); mockStatic(DalvikPurgeableDecoder.class); when(DalvikPurgeableDecoder.getBitmapFactoryOptions(anyInt(), any(Bitmap.Config.class))) .thenCallRealMethod(); when(DalvikPurgeableDecoder.endsWithEOI(any(CloseableReference.class), anyInt())) .thenCallRealMethod(); mockStatic(BitmapCounterProvider.class); when(BitmapCounterProvider.get()).thenReturn(mBitmapCounter); mockStatic(BitmapFactory.class); when(BitmapFactory.decodeFileDescriptor( any(FileDescriptor.class), any(Rect.class), any(BitmapFactory.Options.class))) .thenReturn(mBitmap); mInputBuf = new byte[LENGTH]; PooledByteBuffer input = new TrivialPooledByteBuffer(mInputBuf, POINTER); mByteBufferRef = CloseableReference.of(input); mEncodedImage = new EncodedImage(mByteBufferRef); mDecodeBuf = new byte[LENGTH + 2]; mDecodeBufRef = CloseableReference.of(mDecodeBuf, mock(ResourceReleaser.class)); mockStatic(Bitmaps.class); mGingerbreadPurgeableDecoder = new GingerbreadPurgeableDecoder(); }
Example #4
Source File: KitKatPurgeableDecoderTest.java From fresco with MIT License | 5 votes |
@Before public void setUp() { mFlexByteArrayPool = mock(FlexByteArrayPool.class); mBitmap = MockBitmapFactory.create(); mBitmapCounter = new BitmapCounter(MAX_BITMAP_COUNT, MAX_BITMAP_SIZE); mockStatic(DalvikPurgeableDecoder.class); when(DalvikPurgeableDecoder.getBitmapFactoryOptions(anyInt(), any(Bitmap.Config.class))) .thenCallRealMethod(); when(DalvikPurgeableDecoder.endsWithEOI(any(CloseableReference.class), anyInt())) .thenCallRealMethod(); mockStatic(BitmapCounterProvider.class); when(BitmapCounterProvider.get()).thenReturn(mBitmapCounter); mockStatic(BitmapFactory.class); when(BitmapFactory.decodeByteArray( any(byte[].class), anyInt(), anyInt(), any(BitmapFactory.Options.class))) .thenReturn(mBitmap); mInputBuf = new byte[LENGTH]; PooledByteBuffer input = new TrivialPooledByteBuffer(mInputBuf, POINTER); mByteBufferRef = CloseableReference.of(input); mEncodedImage = new EncodedImage(mByteBufferRef); mDecodeBuf = new byte[LENGTH + 2]; mDecodeBufRef = CloseableReference.of(mDecodeBuf, mock(ResourceReleaser.class)); when(mFlexByteArrayPool.get(Integer.valueOf(LENGTH))).thenReturn(mDecodeBufRef); mockStatic(Bitmaps.class); mKitKatPurgeableDecoder = new KitKatPurgeableDecoder(mFlexByteArrayPool); }
Example #5
Source File: AesCbcWithIntegrity.java From FimiX8-RE with MIT License | 4 votes |
public static SecretKeys generateKeyFromPassword(String password, byte[] salt, int iterationCount) throws GeneralSecurityException { fixPrng(); byte[] keyBytes = SecretKeyFactory.getInstance(PBE_ALGORITHM).generateSecret(new PBEKeySpec(password.toCharArray(), salt, iterationCount, BitmapCounterProvider.MAX_BITMAP_COUNT)).getEncoded(); return new SecretKeys(new SecretKeySpec(copyOfRange(keyBytes, 0, 16), CIPHER), new SecretKeySpec(copyOfRange(keyBytes, 16, 48), HMAC_ALGORITHM)); }
Example #6
Source File: DalvikPurgeableDecoder.java From fresco with MIT License | 4 votes |
protected DalvikPurgeableDecoder() { mUnpooledBitmapsCounter = BitmapCounterProvider.get(); }