@@ -57,7 +57,7 @@ public static VPackage parsePackage(File packageFile) throws Throwable {
5757 && p .mAppMetaData != null
5858 && p .mAppMetaData .containsKey ("fake-signature" )) {
5959 String sig = p .mAppMetaData .getString ("fake-signature" );
60- p . mSignatures = new Signature []{new Signature (sig )};
60+ buildSignature ( p , new Signature []{new Signature (sig )}) ;
6161 VLog .d (TAG , "Using fake-signature feature on : " + p .packageName );
6262 } else {
6363 try {
@@ -66,7 +66,7 @@ public static VPackage parsePackage(File packageFile) throws Throwable {
6666 VLog .e (TAG , "collectCertificates failed" , e );
6767 if (VirtualCore .get ().getContext ().getFileStreamPath (Constants .FAKE_SIGNATURE_FLAG ).exists ()) {
6868 VLog .w (TAG , "Using fake signature: " + p .packageName );
69- p . mSignatures = new Signature []{new Signature (FAKE_SIG )};
69+ buildSignature ( p , new Signature []{new Signature (FAKE_SIG )}) ;
7070 } else {
7171 throw e ;
7272 }
@@ -75,6 +75,16 @@ public static VPackage parsePackage(File packageFile) throws Throwable {
7575 return buildPackageCache (p );
7676 }
7777
78+ private static void buildSignature (PackageParser .Package p , Signature [] signatures ) {
79+ if (Build .VERSION .SDK_INT < 28 ) {
80+ p .mSignatures = signatures ;
81+ } else {
82+ Object signingDetails = mirror .android .content .pm .PackageParser .Package .mSigningDetails .get (p );
83+ mirror .android .content .pm .PackageParser .SigningDetails .pastSigningCertificates .set (signingDetails , signatures );
84+ mirror .android .content .pm .PackageParser .SigningDetails .signatures .set (signingDetails , signatures );
85+ }
86+ }
87+
7888 public static VPackage readPackageCache (String packageName ) {
7989 Parcel p = Parcel .obtain ();
8090 try {
0 commit comments