package com.gh.common.provider

import android.content.Context
import android.content.pm.PackageInfo
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.common.util.PackageUtils
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.core.provider.IPackageUtilsProvider

@Route(path = RouteConsts.provider.packageUtils, name = "PackageUtils暴露服务")
class PackageUtilsProviderImpl : IPackageUtilsProvider {
    override fun obtainProcessName(context: Context): String? {
        return PackageUtils.obtainProcessName(context)
    }

    override fun getGhVersionName(): String {
        return PackageUtils.getGhVersionName()
    }

    override fun getGhVersionCode(): Int {
        return PackageUtils.getGhVersionCode()
    }

    override fun getInstalledPackages(context: Context, flag: Int): List<PackageInfo> {
        return PackageUtils.getInstalledPackages(context, flag)
    }

    override fun getApkSignatureByPackageName(context: Context, packageName: String): Array<String> {
        return PackageUtils.getApkSignatureByPackageName(context, packageName)
    }

    override fun getSideLoadedInfo(): MutableMap<String, String>? {
        return PackageUtils.getSideLoadedInfo()
    }

    override fun init(context: Context?) {
        // Do nothing
    }
}