Merge "Tweak the adb verification logic." into udc-dev

This commit is contained in:
TreeHugger Robot
2023-03-31 16:04:03 +00:00
committed by Android (Google) Code Review

View File

@@ -652,20 +652,33 @@ final class VerifyingSession {
private boolean isAdbVerificationEnabled(PackageInfoLite pkgInfoLite, int userId,
boolean requestedDisableVerification) {
boolean verifierIncludeAdb = android.provider.Settings.Global.getInt(
mPm.mContext.getContentResolver(),
android.provider.Settings.Global.PACKAGE_VERIFIER_INCLUDE_ADB, 1) != 0;
if (mPm.isUserRestricted(userId, UserManager.ENSURE_VERIFY_APPS)) {
if (!verifierIncludeAdb) {
Slog.w(TAG, "Force verification of ADB install because of user restriction.");
}
return true;
}
// Check if the developer wants to skip verification for ADB installs
// Check if the verification disabled globally, first.
if (!verifierIncludeAdb) {
return false;
}
// Check if the developer wants to skip verification for ADB installs.
if (requestedDisableVerification) {
if (!packageExists(pkgInfoLite.packageName)) {
// Always verify fresh install
// Always verify fresh install.
return true;
}
// Only skip when apk is debuggable
// Only skip when apk is debuggable.
return !pkgInfoLite.debuggable;
}
return android.provider.Settings.Global.getInt(mPm.mContext.getContentResolver(),
android.provider.Settings.Global.PACKAGE_VERIFIER_INCLUDE_ADB, 1) != 0;
return true;
}
/**