导航菜单

页面标题

页面副标题

哔哩哔哩 v1.6.6 - MediaResolveProvider.java 源代码

正在查看: 哔哩哔哩 v1.6.6 应用的 MediaResolveProvider.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.bilibili.lib.media.resolver.resolve;

import android.content.ContentProvider;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import bl.ps;
import bl.pv;
import bl.qw;
import bl.qy;
import com.bilibili.lib.media.ResolveConfig;
import com.bilibili.lib.media.resolver.exception.ResolveException;

public class MediaResolveProvider extends ContentProvider {
    @Override
    public int delete(Uri uri, String str, String[] strArr) {
        return 0;
    }

    @Override
    @Nullable
    public String getType(Uri uri) {
        return null;
    }

    @Override
    @Nullable
    public Uri insert(Uri uri, ContentValues contentValues) {
        return null;
    }

    @Override
    public boolean onCreate() {
        return true;
    }

    @Override
    @Nullable
    public Cursor query(Uri uri, String[] strArr, String str, String[] strArr2, String str2) {
        return null;
    }

    @Override
    public int update(Uri uri, ContentValues contentValues, String str, String[] strArr) {
        return 0;
    }

    public static Uri a(@NonNull Context context) {
        return Uri.parse("content://" + context.getPackageName() + ".provider.resolver");
    }

    @Override
    @Nullable
    public Bundle call(@NonNull String str, String str2, Bundle bundle) {
        char c;
        switch (str.hashCode()) {
            case -2112904826:
                if (str.equals("resolveMediaResource")) {
                    c = 1;
                    break;
                }
                c = 65535;
                break;
            case -1037293294:
                if (str.equals("enableNativeResolve")) {
                    c = 3;
                    break;
                }
                c = 65535;
                break;
            case -951857477:
                if (str.equals("getUgcVipQualities")) {
                    c = 4;
                    break;
                }
                c = 65535;
                break;
            case -307825753:
                if (str.equals("resolveSegment")) {
                    c = 2;
                    break;
                }
                c = 65535;
                break;
            case 100318070:
                if (str.equals("getPgcVipQualities")) {
                    c = 5;
                    break;
                }
                c = 65535;
                break;
            case 1948314824:
                if (str.equals("initLua")) {
                    c = 0;
                    break;
                }
                c = 65535;
                break;
            default:
                c = 65535;
                break;
        }
        switch (c) {
            case 0:
                a(bundle);
                return null;
            case 1:
                return a(getContext(), bundle);
            case 2:
                return b(getContext(), bundle);
            case 3:
                return a();
            case 4:
                return b();
            case 5:
                return c();
            default:
                return null;
        }
    }

    public static void a(Context context, ResolveConfig resolveConfig) {
        Bundle bundle = new Bundle();
        bundle.putParcelable("bundle_config", resolveConfig);
        try {
            context.getContentResolver().call(a(context), "initLua", (String) null, bundle);
        } catch (Exception unused) {
        }
        try {
            pv.a();
        } catch (NullPointerException unused2) {
            pv.a(resolveConfig);
        }
    }

    public static int[] b(Context context) {
        Bundle bundle;
        try {
            bundle = context.getContentResolver().call(a(context), "getUgcVipQualities", (String) null, (Bundle) null);
        } catch (Exception unused) {
            bundle = null;
        }
        if (bundle != null) {
            return bundle.getIntArray("bundle_result_int_array");
        }
        return null;
    }

    public static String a(Context context, String str, Object... objArr) throws ResolveException {
        Bundle a;
        Bundle bundle = new Bundle();
        bundle.putByteArray("bundle_run_args", qy.a(objArr));
        try {
            a = context.getContentResolver().call(a(context), str, (String) null, bundle);
        } catch (Exception unused) {
            a = a(context, str, bundle);
        }
        if (a == null) {
            return "";
        }
        a.setClassLoader(ResolveException.class.getClassLoader());
        ResolveException resolveException = (ResolveException) a.getSerializable("bundle_result_exception");
        if (resolveException != null) {
            throw resolveException;
        }
        return a.getString("bundle_result_parcel");
    }

    private static void a(Bundle bundle) {
        bundle.setClassLoader(ResolveConfig.class.getClassLoader());
        pv.a((ResolveConfig) bundle.getParcelable("bundle_config"));
    }

    private static Bundle a(Context context, Bundle bundle) {
        Bundle bundle2 = new Bundle();
        try {
            bundle2.putString("bundle_result_parcel", pv.a(context, a(1, ps.a(context).g(), qy.a(bundle.getByteArray("bundle_run_args")))).b().toString());
        } catch (ResolveException e) {
            bundle2.putSerializable("bundle_result_exception", e);
        } catch (Exception e2) {
            bundle2.putSerializable("bundle_result_exception", new ResolveException(e2));
        }
        return bundle2;
    }

    private static Bundle b(Context context, Bundle bundle) {
        Bundle bundle2 = new Bundle();
        try {
            bundle2.putString("bundle_result_parcel", pv.b(context, qy.a(bundle.getByteArray("bundle_run_args"))).b().toString());
        } catch (ResolveException e) {
            bundle2.putSerializable("bundle_result_exception", e);
        } catch (Exception e2) {
            bundle2.putSerializable("bundle_result_exception", new ResolveException(e2));
        }
        return bundle2;
    }

    private static Bundle a(Context context, String str, Bundle bundle) {
        if ("resolveMediaResource".equals(str)) {
            return a(context, bundle);
        }
        if ("resolveSegment".equals(str)) {
            return b(context, bundle);
        }
        return null;
    }

    private static Object[] a(int i, Object obj, Object[] objArr) {
        Object[] objArr2 = new Object[objArr.length + 1];
        if (i >= objArr.length) {
            System.arraycopy(objArr, 0, objArr2, 0, objArr.length);
            objArr2[objArr.length] = obj;
        } else {
            int i2 = 0;
            for (int i3 = 0; i3 < objArr.length; i3++) {
                if (i3 == i) {
                    i2 = 1;
                }
                objArr2[i3 + i2] = objArr[i3];
            }
            objArr2[i] = obj;
        }
        return objArr2;
    }

    private static Bundle a() {
        Bundle bundle = new Bundle();
        try {
            bundle.putBoolean("bundle_result_boolean", qw.a());
        } catch (Exception unused) {
        }
        return bundle;
    }

    private static Bundle b() {
        Bundle bundle = new Bundle();
        try {
            bundle.putIntArray("bundle_result_int_array", qw.b());
        } catch (Exception unused) {
        }
        return bundle;
    }

    private static Bundle c() {
        Bundle bundle = new Bundle();
        try {
            bundle.putIntArray("bundle_result_int_array", qw.c());
        } catch (Exception unused) {
        }
        return bundle;
    }
}