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