MCPcopy Create free account
hub / github.com/facebook/SoLoader / processDepsBytes

Method processDepsBytes

java/com/facebook/soloader/NativeDeps.java:334–365  ·  view source on GitHub ↗
(byte[] apkId, byte[] deps)

Source from the content-addressed store, hash-verified

332 }
333
334 static boolean processDepsBytes(byte[] apkId, byte[] deps) throws IOException {
335 int offset = 0;
336 if (apkId != null) {
337 offset = verifyBytesAndGetOffset(apkId, deps);
338 if (offset == -1) {
339 return false;
340 }
341 }
342
343 int deps_offset = findNextLine(deps, offset);
344 if (deps_offset >= deps.length) {
345 return false;
346 }
347
348 int libsCount = parseLibCount(deps, offset, deps_offset - offset - 1);
349 if (libsCount <= 0) {
350 return false;
351 }
352
353 sPrecomputedDeps =
354 new HashMap<>((int) (libsCount / HASHMAP_LOAD_FACTOR) + 1, HASHMAP_LOAD_FACTOR);
355 sPrecomputedLibs = new ArrayList<>(libsCount);
356 indexDepsBytes(deps, deps_offset);
357
358 if (sPrecomputedLibs.size() != libsCount) {
359 return false;
360 }
361
362 sEncodedDeps = deps;
363 sInitialized = true;
364 return true;
365 }
366
367 // Returns whether soName is encoded at a specified offset in sEncodedDeps
368 private static boolean libIsAtOffset(String soName, int offset) {

Callers 1

initDepsMethod · 0.95

Calls 5

findNextLineMethod · 0.95
parseLibCountMethod · 0.95
indexDepsBytesMethod · 0.95
sizeMethod · 0.65

Tested by

no test coverage detected