bundle_utils.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. const std::string& split_name);
  20. // dlopen wrapper that works for partitioned native libraries in dynamic
  21. // feature modules. This routine looks up the partition's address space in a
  22. // table of main library symbols, and uses it when loading the feature
  23. // library. It requires |library_name| (eg. chrome_foo) to resolve the file
  24. // path (which may be in an interesting location due to SplitCompat) and
  25. // |partition_name| to look up the load parameters in the main library. These
  26. // two values may be identical, but since the partition name is set at compile
  27. // time, and the code is linked into multiple libraries (eg. Chrome vs
  28. // Monochrome), they may not be.
  29. static void* DlOpenModuleLibraryPartition(const std::string& library_name,
  30. const std::string& partition,
  31. const std::string& split_name);
  32. };
  33. } // namespace android
  34. } // namespace base
  35. #endif // BASE_ANDROID_BUNDLE_UTILS_H_