/*
 * Copyright (C) 2019 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef ART_LIBNATIVELOADER_PUBLIC_LIBRARIES_H_
#define ART_LIBNATIVELOADER_PUBLIC_LIBRARIES_H_

#include <algorithm>
#include <map>
#include <string>

#include <android-base/result.h>

namespace android::nativeloader {

using android::base::Result;

// These provide the list of libraries that are available to the namespace for apps.
// Not all of the libraries are available to apps. Depending on the context,
// e.g., if it is a vendor app or not, different set of libraries are made available.
const std::string& preloadable_public_libraries();
const std::string& default_public_libraries();
const std::string& vendor_public_libraries();
const std::string& product_public_libraries();
const std::string& extended_public_libraries();
const std::string& llndk_libraries_product();
const std::string& llndk_libraries_vendor();
const std::string& vndksp_libraries_product();
const std::string& vndksp_libraries_vendor();
const std::string& apex_jni_libraries(const std::string& apex_name);

// Returns the table of apexes and public libraries provided by the apexes.
// For example, com_android_foo -> libfoo.so:libbar.so
// Note that libfoo.so and libbar.so are listed in /system/etc/public.libraries.txt
// but provided by com.android.foo APEX.
const std::map<std::string, std::string>& apex_public_libraries();

std::string get_vndk_version(bool is_product_vndk);

// Returnes true if libnativeloader is running on devices and the device has
// treblelized product partition. It returns false for host.
// TODO: Remove this function and assume it is always true once when Mainline does not support any
// devices launched with Q or below.
bool is_product_treblelized();

// These are exported for testing
namespace internal {

enum Bitness { ALL = 0, ONLY_32, ONLY_64 };

struct ConfigEntry {
  std::string soname;
  bool nopreload;
  Bitness bitness;
};

Result<std::vector<std::string>> ParseConfig(
    const std::string& file_content,
    const std::function<Result<bool>(const ConfigEntry& /* entry */)>& filter_fn);

// Parses apex.libraries.config.txt file generated by linkerconfig
// and returns mapping of <apex namespace> to <library list> which matches <tag>.
Result<std::map<std::string, std::string>> ParseApexLibrariesConfig(
    const std::string& file_content, const std::string& tag);

}  // namespace internal

}  // namespace android::nativeloader

#endif  // ART_LIBNATIVELOADER_PUBLIC_LIBRARIES_H_
