@Implementation(minSdk = P)
  protected static @Nullable String[] nativeGetResourceStringArray(long ptr,
      @ArrayRes int resid) {
    CppAssetManager2 assetmanager = AssetManagerFromLong(ptr);
    ResolvedBag bag = assetmanager.GetBag(resid);
    if (bag == null) {
      return null;
    }

    String[] array = new String[bag.entry_count];
    if (array == null) {
      return null;
    }

    for (int i = 0; i < bag.entry_count; i++) {
      ResolvedBag.Entry entry = bag.entries[i];

      // Resolve any references to their final value.
      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) {
        return null;
      }

      if (value.get().dataType == Res_value.TYPE_STRING) {
        CppApkAssets apk_assets = assetmanager.GetApkAssets().get(cookie.intValue());
        ResStringPool pool = apk_assets.GetLoadedArsc().GetStringPool();

        String java_string = null;
        int str_len;
        String str_utf8 = pool.stringAt(value.get().data);
        if (str_utf8 != null) {
          java_string = str_utf8;
        } else {
          String str_utf16 = pool.stringAt(value.get().data);
          java_string = str_utf16;
        }

        // // 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;
  }
@Implementation(minSdk = P)
  protected static @Nullable String[] nativeGetResourceStringArray(long ptr,
      @ArrayRes int resid) {
    CppAssetManager2 assetmanager = AssetManagerFromLong(ptr);
    ResolvedBag bag = assetmanager.GetBag(resid);
    if (bag == null) {
      return null;
    }

    String[] array = new String[bag.entry_count];
    if (array == 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) {
        return null;
      }

      if (value.get().dataType == Res_value.TYPE_STRING) {
        CppApkAssets apk_assets = assetmanager.GetApkAssets().get(cookie.intValue());
        ResStringPool pool = apk_assets.GetLoadedArsc().GetStringPool();

        String java_string = null;
        int str_len;
        String str_utf8 = pool.stringAt(value.get().data);
        if (str_utf8 != null) {
          java_string = str_utf8;
        } else {
          String str_utf16 = pool.stringAt(value.get().data);
          java_string = str_utf16;
        }

        
        
        
        

        
        array[i] = java_string;

        
        
        
      }
    }
    return array;
  }
@ Implementation ( minSdk = P ) protected static @ Nullable String [ ] nativeGetResourceStringArray ( long ptr , @ ArrayRes int resid ) { CppAssetManager2 assetmanager = AssetManagerFromLong ( ptr ) ; ResolvedBag bag = assetmanager . GetBag ( resid ) ; if ( bag == null ) { return null ; } String [ ] array = new String [ bag . entry_count ] ; if ( array == null ) { return null ; } for ( int i = 0 ; i < bag . entry_count ; i ++ ) { ResolvedBag . Entry entry = bag . entries [ i ] ; // Resolve any references to their final value. 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 ) { return null ; } if ( value . get ( ) . dataType == Res_value . TYPE_STRING ) { CppApkAssets apk_assets = assetmanager . GetApkAssets ( ) . get ( cookie . intValue ( ) ) ; ResStringPool pool = apk_assets . GetLoadedArsc ( ) . GetStringPool ( ) ; String java_string = null ; int str_len ; String str_utf8 = pool . stringAt ( value . get ( ) . data ) ; if ( str_utf8 != null ) { java_string = str_utf8 ; } else { String str_utf16 = pool . stringAt ( value . get ( ) . data ) ; java_string = str_utf16 ; } // // 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 ; }
jint resid) {
jint resid ) {