Loading services/core/java/com/android/server/integrity/AppIntegrityManagerServiceImpl.java +24 −17 Original line number Original line Diff line number Diff line Loading @@ -239,23 +239,23 @@ public class AppIntegrityManagerServiceImpl extends IAppIntegrityManager.Stub { Slog.i(TAG, "Received integrity verification intent " + intent.toString()); Slog.i(TAG, "Received integrity verification intent " + intent.toString()); Slog.i(TAG, "Extras " + intent.getExtras()); Slog.i(TAG, "Extras " + intent.getExtras()); String packageName = intent.getStringExtra(EXTRA_PACKAGE_NAME); String installerPackageName = getInstallerPackageName(intent); PackageInfo packageInfo = getPackageArchiveInfo(intent.getData()); // Skip integrity verification if the verifier is doing the install. if (packageInfo == null) { if (!integrityCheckIncludesRuleProvider() Slog.w(TAG, "Cannot parse package " + packageName); && isRuleProvider(installerPackageName)) { // We can't parse the package. Slog.i(TAG, "Verifier doing the install. Skipping integrity check."); mPackageManagerInternal.setIntegrityVerificationResult( mPackageManagerInternal.setIntegrityVerificationResult( verificationId, PackageManagerInternal.INTEGRITY_VERIFICATION_ALLOW); verificationId, PackageManagerInternal.INTEGRITY_VERIFICATION_ALLOW); return; return; } } String installerPackageName = getInstallerPackageName(intent); String packageName = intent.getStringExtra(EXTRA_PACKAGE_NAME); // Skip integrity verification if the verifier is doing the install. PackageInfo packageInfo = getPackageArchiveInfo(intent.getData()); if (!integrityCheckIncludesRuleProvider() if (packageInfo == null) { && isRuleProvider(installerPackageName)) { Slog.w(TAG, "Cannot parse package " + packageName); Slog.i(TAG, "Verifier doing the install. Skipping integrity check."); // We can't parse the package. mPackageManagerInternal.setIntegrityVerificationResult( mPackageManagerInternal.setIntegrityVerificationResult( verificationId, PackageManagerInternal.INTEGRITY_VERIFICATION_ALLOW); verificationId, PackageManagerInternal.INTEGRITY_VERIFICATION_ALLOW); return; return; Loading Loading @@ -508,7 +508,8 @@ public class AppIntegrityManagerServiceImpl extends IAppIntegrityManager.Stub { return PackageInfoUtils.generate(pkg, null, flags, 0, 0, null, new PackageUserState(), return PackageInfoUtils.generate(pkg, null, flags, 0, 0, null, new PackageUserState(), UserHandle.getCallingUserId(), null); UserHandle.getCallingUserId(), null); } catch (Exception e) { } catch (Exception e) { throw new IllegalArgumentException("Exception reading " + dataUri, e); Slog.w(TAG, "Exception reading " + dataUri, e); return null; } } } } Loading @@ -530,12 +531,18 @@ public class AppIntegrityManagerServiceImpl extends IAppIntegrityManager.Stub { // If we didn't find a base.apk, then try to parse each apk until we find the one // If we didn't find a base.apk, then try to parse each apk until we find the one // that succeeds. // that succeeds. try { basePackageInfo = basePackageInfo = mContext.getPackageManager() mContext.getPackageManager() .getPackageArchiveInfo( .getPackageArchiveInfo( apkFile.getAbsolutePath(), apkFile.getAbsolutePath(), PackageManager.GET_SIGNING_CERTIFICATES PackageManager.GET_SIGNING_CERTIFICATES | PackageManager.GET_META_DATA); | PackageManager.GET_META_DATA); } catch (Exception e) { // Some of the splits may not contain a valid android manifest. It is an // expected exception. We still log it nonetheless but we should keep looking. Slog.w(TAG, "Exception reading " + apkFile, e); } if (basePackageInfo != null) { if (basePackageInfo != null) { Slog.i(TAG, "Found package info from " + apkFile); Slog.i(TAG, "Found package info from " + apkFile); break; break; Loading Loading
services/core/java/com/android/server/integrity/AppIntegrityManagerServiceImpl.java +24 −17 Original line number Original line Diff line number Diff line Loading @@ -239,23 +239,23 @@ public class AppIntegrityManagerServiceImpl extends IAppIntegrityManager.Stub { Slog.i(TAG, "Received integrity verification intent " + intent.toString()); Slog.i(TAG, "Received integrity verification intent " + intent.toString()); Slog.i(TAG, "Extras " + intent.getExtras()); Slog.i(TAG, "Extras " + intent.getExtras()); String packageName = intent.getStringExtra(EXTRA_PACKAGE_NAME); String installerPackageName = getInstallerPackageName(intent); PackageInfo packageInfo = getPackageArchiveInfo(intent.getData()); // Skip integrity verification if the verifier is doing the install. if (packageInfo == null) { if (!integrityCheckIncludesRuleProvider() Slog.w(TAG, "Cannot parse package " + packageName); && isRuleProvider(installerPackageName)) { // We can't parse the package. Slog.i(TAG, "Verifier doing the install. Skipping integrity check."); mPackageManagerInternal.setIntegrityVerificationResult( mPackageManagerInternal.setIntegrityVerificationResult( verificationId, PackageManagerInternal.INTEGRITY_VERIFICATION_ALLOW); verificationId, PackageManagerInternal.INTEGRITY_VERIFICATION_ALLOW); return; return; } } String installerPackageName = getInstallerPackageName(intent); String packageName = intent.getStringExtra(EXTRA_PACKAGE_NAME); // Skip integrity verification if the verifier is doing the install. PackageInfo packageInfo = getPackageArchiveInfo(intent.getData()); if (!integrityCheckIncludesRuleProvider() if (packageInfo == null) { && isRuleProvider(installerPackageName)) { Slog.w(TAG, "Cannot parse package " + packageName); Slog.i(TAG, "Verifier doing the install. Skipping integrity check."); // We can't parse the package. mPackageManagerInternal.setIntegrityVerificationResult( mPackageManagerInternal.setIntegrityVerificationResult( verificationId, PackageManagerInternal.INTEGRITY_VERIFICATION_ALLOW); verificationId, PackageManagerInternal.INTEGRITY_VERIFICATION_ALLOW); return; return; Loading Loading @@ -508,7 +508,8 @@ public class AppIntegrityManagerServiceImpl extends IAppIntegrityManager.Stub { return PackageInfoUtils.generate(pkg, null, flags, 0, 0, null, new PackageUserState(), return PackageInfoUtils.generate(pkg, null, flags, 0, 0, null, new PackageUserState(), UserHandle.getCallingUserId(), null); UserHandle.getCallingUserId(), null); } catch (Exception e) { } catch (Exception e) { throw new IllegalArgumentException("Exception reading " + dataUri, e); Slog.w(TAG, "Exception reading " + dataUri, e); return null; } } } } Loading @@ -530,12 +531,18 @@ public class AppIntegrityManagerServiceImpl extends IAppIntegrityManager.Stub { // If we didn't find a base.apk, then try to parse each apk until we find the one // If we didn't find a base.apk, then try to parse each apk until we find the one // that succeeds. // that succeeds. try { basePackageInfo = basePackageInfo = mContext.getPackageManager() mContext.getPackageManager() .getPackageArchiveInfo( .getPackageArchiveInfo( apkFile.getAbsolutePath(), apkFile.getAbsolutePath(), PackageManager.GET_SIGNING_CERTIFICATES PackageManager.GET_SIGNING_CERTIFICATES | PackageManager.GET_META_DATA); | PackageManager.GET_META_DATA); } catch (Exception e) { // Some of the splits may not contain a valid android manifest. It is an // expected exception. We still log it nonetheless but we should keep looking. Slog.w(TAG, "Exception reading " + apkFile, e); } if (basePackageInfo != null) { if (basePackageInfo != null) { Slog.i(TAG, "Found package info from " + apkFile); Slog.i(TAG, "Found package info from " + apkFile); break; break; Loading