@@ -765,6 +765,13 @@ public void setTableBlock(TableBlock tableBlock){
765765 updateExternalFramework ();
766766 ensureLoadedManifestLinked ();
767767 }
768+ public boolean ensureTableBlock () {
769+ if (!hasTableBlock ()) {
770+ setTableBlock (TableBlock .createEmpty ());
771+ return true ;
772+ }
773+ return false ;
774+ }
768775 /**
769776 * Use getAndroidManifest()
770777 * */
@@ -845,8 +852,9 @@ private void ensureLoadedManifestLinked() {
845852 }
846853 if (packageBlock != null ) {
847854 manifestBlock .setPackageBlock (packageBlock );
848- manifestBlock .setApkFile (this );
849855 }
856+ manifestBlock .setApkFile (this );
857+ ensureFrameworkLinked ();
850858 }
851859 private void unlinkLoadedManifest () {
852860 AndroidManifestBlock manifestBlock = this .mManifestBlock ;
@@ -856,6 +864,24 @@ private void unlinkLoadedManifest() {
856864 manifestBlock .setPackageBlock (null );
857865 manifestBlock .setApkFile (null );
858866 }
867+ private void ensureFrameworkLinked () {
868+ if (mDisableLoadFramework ) {
869+ return ;
870+ }
871+ TableBlock tableBlock = this .mTableBlock ;
872+ if (tableBlock == null ||
873+ tableBlock instanceof FrameworkTable ||
874+ isAndroid (tableBlock )) {
875+ return ;
876+ }
877+ Integer preferred = this .preferredFramework ;
878+ if (preferred != null || (mManifestBlock != null && !tableBlock .hasFramework ())) {
879+ try {
880+ initializeAndroidFramework (tableBlock , preferred );
881+ } catch (IOException ignored ) {
882+ }
883+ }
884+ }
859885 private void updateExternalFramework (){
860886 TableBlock tableBlock = mTableBlock ;
861887 if (tableBlock == null ){
0 commit comments