Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-28283] Android: Hyperloop based requires fail to load when using "remote" encryption policy

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionUnresolved
Affected Version/sRelease 9.0.0
Fix Version/sRelease 9.3.0
ComponentsAndroid
Labelsandroid, encryption, hyperloop, regression, remote
ReporterEwan Harris
AssigneeJoshua Quick
Created2020-12-10T15:19:59.000+0000
Updated2020-12-11T18:01:02.000+0000

Description

Description

When using Hyperloop with appc-sourcecode-encryption-policy enabled, Hyperloop requires fail to load.

Steps to reproduce

1. Add <property name="appc-sourcecode-encryption-policy">remote</property> to a hyperloop-examples project that is registered with the platform 2. Build to Android

Actual

App will error on a Hyperloop require like below
[ERROR] TiExceptionHandler: Error: Requested module not found: android.provider.Settings
[ERROR] TiExceptionHandler:     at Module.require (ti:/module.js:297:8)
[ERROR] TiExceptionHandler:     at Module.global.Module.require (<embedded>:5051:34)

Expected

No error should occur

Comments

  1. Joshua Quick 2020-12-10

    The real issue is that \*.bootstrap.js scripts are not being executed on app startup when remote policy encryption is used. This is an issue with our "ti.playserivces" module. It's bootstrap script isn't being loaded on startup and it is used to check/update Google Play Services on the device if needed before running the "app.js". This step is being skipped due to this remote policy issue.
  2. Joshua Quick 2020-12-10

    I've isolated the issue. The problem is that our File.exists() method returns false for remote-policy encrypted files. This is preventing Titanium from loading our "bootstrap.json" file. The read() method works fine. It's just a file existence check issue. https://github.com/appcelerator/titanium_mobile/blob/master/common/Resources/ti.internal/bootstrap.loader.js#L33 I can see the same issue when doing the below. The below will return false when checking if the "app.js" exists, which of course isn't true.
       const file = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, 'app.js');
       console.log("### app.js exists:" + file.exists());
       
  3. Joshua Quick 2020-12-11

    PR (master): https://github.com/appcelerator/titanium_mobile/pull/12336
  4. Christopher Williams 2020-12-11

    merged to master for 10.0.0 target, back port PRs for 9_3_X and 9_2_X are in progress for 9.3.0 GA target and maintenance branch build target.
  5. Christopher Williams 2020-12-11

    backport PRs for 9.3.0 GA target and 9_2_X branches have been merged/landed.

JSON Source