bundle_utils.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // Copyright 2019 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef BASE_ANDROID_BUNDLE_UTILS_H_
  5. #define BASE_ANDROID_BUNDLE_UTILS_H_
  6. #include <string>
  7. #include "base/base_export.h"
  8. namespace base {
  9. namespace android {
  10. // Utils to help working with android app bundles.
  11. class BASE_EXPORT BundleUtils {
  12. public:
  13. // Returns true if the current build is a bundle.
  14. static bool IsBundle();
  15. // Helper function asking Java to resolve a library path. This is required for
  16. // resolving a module library made available via SplitCompat, rather than in
  17. // its eventual fully-installed state.
  18. static std::string ResolveLibraryPath(const std::string& library_name);
  19. // dlopen wrapper that works for partitioned native libraries in dynamic
  20. // feature modules. This routine looks up the partition's address space in a
  21. // table of main library symbols, and uses it when loading the feature
  22. // library. It requires |library_name| (eg. chrome_foo) to resolve the file
  23. // path (which may be in an interesting location due to SplitCompat) and
  24. // |partition_name| to look up the load parameters in the main library. These
  25. // two values may be identical, but since the partition name is set at compile
  26. // time, and the code is linked into multiple libraries (eg. Chrome vs
  27. // Monochrome), they may not be.
  28. static void* DlOpenModuleLibraryPartition(const std::string& library_name,
  29. const std::string& partition);
  30. };
  31. } // namespace android
  32. } // namespace base
  33. #endif // BASE_ANDROID_BUNDLE_UTILS_H_