Merge "Fix VerifyingSession disabled check" into udc-dev
This commit is contained in:
@@ -41,6 +41,7 @@ import android.content.pm.SharedLibraryInfo;
|
||||
import android.content.pm.SigningDetails;
|
||||
import android.content.pm.UserInfo;
|
||||
import android.content.pm.VersionedPackage;
|
||||
import android.os.UserHandle;
|
||||
import android.util.ArrayMap;
|
||||
import android.util.ArraySet;
|
||||
import android.util.Pair;
|
||||
@@ -519,14 +520,15 @@ public interface Computer extends PackageDataSnapshot {
|
||||
* returns false.
|
||||
*/
|
||||
boolean isComponentEffectivelyEnabled(@NonNull ComponentInfo componentInfo,
|
||||
@UserIdInt int userId);
|
||||
@NonNull UserHandle userHandle);
|
||||
|
||||
/**
|
||||
* @return true if the runtime app user enabled state and the install-time app manifest enabled
|
||||
* state are both effectively enabled for the given app. Or if the app cannot be found,
|
||||
* returns false.
|
||||
*/
|
||||
boolean isApplicationEffectivelyEnabled(@NonNull String packageName, @UserIdInt int userId);
|
||||
boolean isApplicationEffectivelyEnabled(@NonNull String packageName,
|
||||
@NonNull UserHandle userHandle);
|
||||
|
||||
@Nullable
|
||||
KeySet getKeySetByAlias(@NonNull String packageName, @NonNull String alias);
|
||||
|
||||
@@ -5131,9 +5131,10 @@ public class ComputerEngine implements Computer {
|
||||
|
||||
@Override
|
||||
public boolean isComponentEffectivelyEnabled(@NonNull ComponentInfo componentInfo,
|
||||
@UserIdInt int userId) {
|
||||
@NonNull UserHandle userHandle) {
|
||||
try {
|
||||
String packageName = componentInfo.packageName;
|
||||
int userId = userHandle.getIdentifier();
|
||||
int appEnabledSetting =
|
||||
mSettings.getApplicationEnabledSetting(packageName, userId);
|
||||
if (appEnabledSetting == COMPONENT_ENABLED_STATE_DEFAULT) {
|
||||
@@ -5156,9 +5157,10 @@ public class ComputerEngine implements Computer {
|
||||
|
||||
@Override
|
||||
public boolean isApplicationEffectivelyEnabled(@NonNull String packageName,
|
||||
@UserIdInt int userId) {
|
||||
@NonNull UserHandle userHandle) {
|
||||
try {
|
||||
int appEnabledSetting = mSettings.getApplicationEnabledSetting(packageName, userId);
|
||||
int appEnabledSetting = mSettings.getApplicationEnabledSetting(packageName,
|
||||
userHandle.getIdentifier());
|
||||
if (appEnabledSetting == COMPONENT_ENABLED_STATE_DEFAULT) {
|
||||
final AndroidPackage pkg = getPackage(packageName);
|
||||
if (pkg == null) {
|
||||
|
||||
@@ -2570,7 +2570,7 @@ public class PackageManagerService implements PackageSender, TestUtilityService
|
||||
|
||||
if (best == null || cur.priority > best.priority) {
|
||||
if (computer.isComponentEffectivelyEnabled(cur.getComponentInfo(),
|
||||
UserHandle.USER_SYSTEM)) {
|
||||
UserHandle.SYSTEM)) {
|
||||
best = cur;
|
||||
} else {
|
||||
Slog.w(TAG, "Domain verification agent found but not enabled");
|
||||
|
||||
@@ -26,7 +26,6 @@ import static android.content.pm.PackageManager.MATCH_DEBUG_TRIAGED_MISSING;
|
||||
import static android.content.pm.SigningDetails.SignatureSchemeVersion.SIGNING_BLOCK_V4;
|
||||
import static android.os.PowerWhitelistManager.REASON_PACKAGE_VERIFIER;
|
||||
import static android.os.PowerWhitelistManager.TEMPORARY_ALLOWLIST_TYPE_FOREGROUND_SERVICE_ALLOWED;
|
||||
import static android.os.Process.SYSTEM_UID;
|
||||
import static android.os.Trace.TRACE_TAG_PACKAGE_MANAGER;
|
||||
|
||||
import static com.android.server.pm.PackageManagerService.CHECK_PENDING_INTEGRITY_VERIFICATION;
|
||||
@@ -408,7 +407,7 @@ final class VerifyingSession {
|
||||
final int numRequiredVerifierPackages = requiredVerifierPackages.size();
|
||||
for (int i = numRequiredVerifierPackages - 1; i >= 0; i--) {
|
||||
if (!snapshot.isApplicationEffectivelyEnabled(requiredVerifierPackages.get(i),
|
||||
SYSTEM_UID)) {
|
||||
verifierUser)) {
|
||||
Slog.w(TAG,
|
||||
"Required verifier: " + requiredVerifierPackages.get(i) + " is disabled");
|
||||
requiredVerifierPackages.remove(i);
|
||||
|
||||
Reference in New Issue
Block a user