code: @Implementation(minSdk = P)
    protected static @Nullable int[] nativeGetResourceStringArrayInfo(long ptr,
        @ArrayRes int resid) {
      CppAssetManager2 assetmanager = AssetManagerFromLong(ptr);
      ResolvedBag bag = assetmanager.GetBag(resid);
      if (bag == null) {
        return null;
      }
  
      int[] array = new int[bag.entry_count * 2];
      // if (array == null) {
      //   return null;
      // }
  
      int[] buffer = array; //reinterpret_cast<int*>(env.GetPrimitiveArrayCritical(array, null));
      // if (buffer == null) {
      //   return null;
      // }
  
      for (int i = 0; i < bag.entry_count; i++) {
        ResolvedBag.Entry entry = bag.entries[i];
        final Ref<Res_value> value = new Ref<>(entry.value);
        final Ref<ResTable_config> selected_config = new Ref<>(null);
        final Ref<Integer> flags = new Ref<>(0);
        final Ref<Integer> ref = new Ref<>(0);
        ApkAssetsCookie cookie =
            assetmanager.ResolveReference(entry.cookie, value, selected_config, flags, ref);
        if (cookie.intValue() == kInvalidCookie) {
          // env.ReleasePrimitiveArrayCritical(array, buffer, JNI_ABORT);
          return null;
        }
  
        int string_index = -1;
        if (value.get().dataType == Res_value.TYPE_STRING) {
          string_index = (int) (value.get().data);
        }
  
        buffer[i * 2] = ApkAssetsCookieToJavaCookie(cookie);
        buffer[(i * 2) + 1] = string_index;
      }
      // env.ReleasePrimitiveArrayCritical(array, buffer, 0);
      return array;
    }
docs: jint resid) {