Adobe-Runtime-Support
Adobe-Runtime-Support copied to clipboard
ExtensionInfo.isLoaded is inconsistent
I'm attempting to ascertain whether an extension has been loaded at runtime after specifying the extension is to be "delay load".
Problem Description
- AIR SDK v50.2.4.1
Firstly I flag the extension as delay load:
<extensionID delayLoad="true">com.distriqt.Core</extensionID>
I'm attempting to get the extension loaded state at runtime (without knowing/specifying a class contained in the extension) :
var info:ExtensionInfo = ExtensionContext.getExtensionInfo( "com.distriqt.Core" );
At this point the info.isLoaded
is false
as expected.
Then I attempt to load the extension:
ExtensionContext.loadExtension( "com.distriqt.Core", null );
Following this I attempt to check the load state by getting the info again:
var info:ExtensionInfo = ExtensionContext.getExtensionInfo( "com.distriqt.Core" );
I'm finding that info.isLoaded
is inconsistent, especially when loading multiple extensions. Generally it seems to always be false
.
One thing I have noted is that it seems to vary based on the supported platforms for an extension. eg on macOS I get:
[trace] androidx.work loaded=false
[trace] androidx.core loaded=false
[trace] com.distriqt.playservices.AppSet loaded=false
[trace] androidx.room loaded=false
[trace] androidx.browser loaded=false
[trace] com.distriqt.playservices.Base loaded=false
[trace] com.google.code.gson loaded=false
[trace] com.distriqt.playservices.Ads loaded=false
[trace] com.distriqt.Adverts loaded=false
[trace] androidx.vectordrawable loaded=false
[trace] com.distriqt.Core loaded=true
[trace] androidx.constraintlayout loaded=false
[trace] com.distriqt.Exceptions loaded=false
[trace] androidx.appcompat loaded=false
[trace] com.jetbrains.kotlin loaded=false
Here com.distriqt.Core
is the only extension with a valid macOS implementation. After the load however I can still access the default lib from Exceptions eg Exceptions.service.version
returns correctly so something is loaded?
However on Android:
[trace] androidx.work loaded=false
[trace] androidx.core loaded=false
[trace] com.distriqt.playservices.AppSet loaded=false
[trace] androidx.room loaded=false
[trace] androidx.browser loaded=false
[trace] com.distriqt.playservices.Base loaded=false
[trace] com.google.code.gson loaded=false
[trace] com.distriqt.playservices.Ads loaded=false
[trace] com.distriqt.Adverts loaded=true
[trace] androidx.vectordrawable loaded=false
[trace] com.distriqt.Core loaded=true
[trace] androidx.constraintlayout loaded=false
[trace] com.distriqt.Exceptions loaded=true
[trace] androidx.appcompat loaded=false
[trace] com.jetbrains.kotlin loaded=false
I get com.distriqt.Exceptions
, com.distriqt.Core
and com.distriqt.Adverts
loading but the others not.
Is this state tied to the supported platforms for an extension? Or does the isLoaded
flag mean something different than documented? (https://airsdk.dev/reference/actionscript/3.0/flash/external/ExtensionInfo.html#isLoaded)
Hi
It seems like we may have caused some issues when trying to ensure that the extensions' swf definitions were available from worker threads.. the mechanism we added there involved tracking the 'toplevel' object that was used when creating the initial reference to the extension (i.e. when we parse the XML descriptor file at start-up). So a worker that's then coming later with its own toplevel shouldn't be able to load extensions, but should be able to get at the swf definitions.
The issue though is caused by the fact that during start-up, it's an "internal" toplevel object that's being used when the extensions are first registered, but when you access things from your SWF code it's then a "content" toplevel object... so the loading of the SWF data did probably work, but the state was not being set to "loaded".
The thing I can't quite work out is how come some of them ended up with a loaded state of "true"..! if they are mentioned in the app descriptor with 'delayLoad' set, then the loaded state should be incorrect the whole time...
We have a fix for this though - just need to ensure it doesn't then break the Worker scenarios..!
thanks
Great to hear, let me know if you want me to test anything
AIR SDK v51.0.1.2
It seems that this feature is still not working.
Descriptor:
<extensionID delayLoad="true">com.distriqt.Core</extensionID>
Then in runtime:
var info:ExtensionInfo = ExtensionContext.getExtensionInfo( "com.distriqt.Core" );
returns true, but expected false.
Hi @ajwfrost, could you please confirm that the issue still exists on your side? Thank you.
@cleverbeapps can you please confirm what platform you tried this on? I just checked on Windows and it's working okay..
@ajwfrost platform is iOS (I didn't try with Android). What about iOS on your side?
Ah - we may need to clarify this in the documentation. On iOS, because (a) the initial extensions native code is statically linked, and (b) they don't allow ActionScript to be interpreted/assembled on-device, then the idea of a 'delayed load' doesn't work. The AS3 library code will always be compiled to machine code ahead of time and linked into the application along with the AIR runtime and the ANE native library archive.
If you're trying to delay loading of large bits of functionality/data or similar, then this would need to be something handled separately within an ANE itself, i.e. the ANE will be loaded but could have code within it that brings in a dylib later on. But you wouldn't be able to load/change the AS3 definitions etc.
thanks