@Implementation(minSdk = P)
  protected static @Nullable String[] nativeGetLocales(long ptr, boolean exclude_system) {
    CppAssetManager2 assetmanager = AssetManagerFromLong(ptr);
    Set<String> locales =
        assetmanager.GetResourceLocales(exclude_system, true /*merge_equivalent_languages*/);

    String[] array = new String[locales.size()]; // env.NewObjectArray(locales.size(), g_stringClass, null);
    // if (array == null) {
    //   return null;
    // }

    int idx = 0;
    for (String locale : locales) {
      String java_string = locale;
      if (java_string == null) {
        return null;
      }
      // env.SetObjectArrayElement(array, idx++, java_string);
      array[idx++] = java_string;
      // env.DeleteLocalRef(java_string);
    }
    return array;
  }
@Implementation(minSdk = P)
  protected static @Nullable String[] nativeGetLocales(long ptr, boolean exclude_system) {
    CppAssetManager2 assetmanager = AssetManagerFromLong(ptr);
    Set<String> locales =
        assetmanager.GetResourceLocales(exclude_system, true );

    String[] array = new String[locales.size()]; 
    
    
    

    int idx = 0;
    for (String locale : locales) {
      String java_string = locale;
      if (java_string == null) {
        return null;
      }
      
      array[idx++] = java_string;
      
    }
    return array;
  }
@ Implementation ( minSdk = P ) protected static @ Nullable String [ ] nativeGetLocales ( long ptr , boolean exclude_system ) { CppAssetManager2 assetmanager = AssetManagerFromLong ( ptr ) ; Set < String > locales = assetmanager . GetResourceLocales ( exclude_system , true /*merge_equivalent_languages*/ ) ; String [ ] array = new String [ locales . size ( ) ] ; // env.NewObjectArray(locales.size(), g_stringClass, null); // if (array == null) { //   return null; // } int idx = 0 ; for ( String locale : locales ) { String java_string = locale ; if ( java_string == null ) { return null ; } // env.SetObjectArrayElement(array, idx++, java_string); array [ idx ++ ] = java_string ; // env.DeleteLocalRef(java_string); } return array ; }
jboolean exclude_system) {
jboolean exclude_system ) {