Skip to content

Commit

Permalink
//fbandroid/libraries/fresco/static-webp/src/main/java/com/facebook/i…
Browse files Browse the repository at this point in the history
…magepipeline/nativecode:nativecode

Reviewed By: defHLT

Differential Revision: D68764290

fbshipit-source-id: c23897648ad7f9823349066a3e488a8d550aeff6
  • Loading branch information
generatedunixname89002005287564 authored and facebook-github-bot committed Jan 28, 2025
1 parent 316c4be commit 40521e6
Showing 1 changed file with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,32 @@
* LICENSE file in the root directory of this source tree.
*/

package com.facebook.imagepipeline.nativecode;
package com.facebook.imagepipeline.nativecode

import android.os.Build;
import com.facebook.infer.annotation.Nullsafe;
import com.facebook.soloader.nativeloader.NativeLoader;
import android.os.Build
import com.facebook.soloader.nativeloader.NativeLoader

/** Single place responsible for ensuring that `static-webp.so` is loaded */
@Nullsafe(Nullsafe.Mode.LOCAL)
public class StaticWebpNativeLoader {
object StaticWebpNativeLoader {

private static boolean sInitialized;
private var initialized = false

public static synchronized void ensure() {
if (!sInitialized) {
@JvmStatic
@Synchronized
fun ensure() {
if (!initialized) {
// On Android 4.1.2 the loading of the static-webp native library can fail because
// of the dependency with fb_jpegturbo. In this case we have to explicitely load that
// library
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN) {
try {
NativeLoader.loadLibrary("fb_jpegturbo");
} catch (UnsatisfiedLinkError error) {
NativeLoader.loadLibrary("fb_jpegturbo")
} catch (error: UnsatisfiedLinkError) {
// Head in the sand
}
}
NativeLoader.loadLibrary("static-webp");
sInitialized = true;
NativeLoader.loadLibrary("static-webp")
initialized = true
}
}
}

0 comments on commit 40521e6

Please sign in to comment.