code: @Implementation(minSdk = P)
    protected static @Nullable String[] nativeList(long ptr, @NonNull String path)
        throws IOException {
      String path_utf8 = path;
      if (path_utf8 == null) {
        // This will throw NPE.
        return null;
      }
  
      CppAssetManager2 assetmanager = AssetManagerFromLong(ptr);
      AssetDir asset_dir =
          assetmanager.OpenDir(path_utf8);
      if (asset_dir == null) {
        throw new FileNotFoundException(path_utf8);
      }
  
      int file_count = asset_dir.getFileCount();
  
      String[] array = new String[file_count]; // env.NewObjectArray(file_count, g_stringClass, null);
      // if (array == null) {
      //   return null;
      // }
  
      for (int i = 0; i < file_count; i++) {
        String java_string = asset_dir.getFileName(i).string();
  
        // Check for errors creating the strings (if malformed or no memory).
        // if (env.ExceptionCheck()) {
        //   return null;
        // }
  
        // env.SetObjectArrayElement(array, i, java_string);
        array[i] = java_string;
  
        // If we have a large amount of string in our array, we might overflow the
        // local reference table of the VM.
        // env.DeleteLocalRef(java_string);
      }
      return array;
    }
docs: static jobjectArray NativeList(JNIEnv* env, jclass /*clazz*/, jlong ptr, jstring path) {