package com.facebook;

import X.C30938nM;
import X.M12;
import X.M7e;
import android.content.ContentProvider;
import android.content.ContentValues;
import android.database.Cursor;
import android.net.Uri;
import android.os.ParcelFileDescriptor;
import android.util.Pair;
import com.bytedance.covode.number.Covode;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.UUID;
import kotlin.h.b.n;
import kotlin.o.z;

public final class FacebookContentProvider extends ContentProvider {
    public static final C30938nM LIZ = new C30938nM((byte) 0);
    public static final String LIZIZ;

    public final int delete(Uri uri, String str, String[] strArr) {
        M12.LIZ(uri);
        return 0;
    }

    public final String getType(Uri uri) {
        M12.LIZ(uri);
        return null;
    }

    public final Uri insert(Uri uri, ContentValues contentValues) {
        M12.LIZ(uri);
        return null;
    }

    public final boolean onCreate() {
        return true;
    }

    public final Cursor query(Uri uri, String[] strArr, String str, String[] strArr2, String str2) {
        M12.LIZ(uri);
        return null;
    }

    public final int update(Uri uri, ContentValues contentValues, String str, String[] strArr) {
        M12.LIZ(uri);
        return 0;
    }

    static {
        Covode.recordClassIndex(40801);
        String name = FacebookContentProvider.class.getName();
        M12.LIZ(name);
        LIZIZ = name;
    }

    private final Pair<UUID, String> LIZ(Uri uri) {
        try {
            String path = uri.getPath();
            if (path != null) {
                String substring = path.substring(1);
                n.LIZIZ(substring, "");
                Object[] array = z.LIZ(substring, new String[]{"/"}, 0, 6).toArray(new String[0]);
                if (array != null) {
                    String[] strArr = (String[]) array;
                    String str = strArr[0];
                    String str2 = strArr[1];
                    if (!"..".contentEquals(str) && !"..".contentEquals(str2)) {
                        return new Pair<>(UUID.fromString(str), str2);
                    }
                    throw new Exception();
                }
                throw new NullPointerException("null cannot be cast to non-null type kotlin.Array<T>");
            }
            throw new IllegalStateException("Required value was null.".toString());
        } catch (Exception unused) {
            return null;
        }
    }

    public final ParcelFileDescriptor openFile(Uri uri, String str) {
        M12.LIZ(uri, str);
        Pair<UUID, String> LIZ2 = LIZ(uri);
        if (LIZ2 != null) {
            try {
                File LIZ3 = M7e.LIZ((UUID) LIZ2.first, (String) LIZ2.second);
                if (LIZ3 != null) {
                    return ParcelFileDescriptor.open(LIZ3, 268435456);
                }
                throw new FileNotFoundException();
            } catch (FileNotFoundException e) {
                throw e;
            }
        } else {
            throw new FileNotFoundException();
        }
    }
}
