Revert "Verify PackageManagerShellCommand caller is shell"
This reverts commit dec5b1985f.
Reason for revert: a culprit of b/210553425
Change-Id: I3c2a7a80c497698c2fbc3e663a0a48004bec7ea8
This commit is contained in:
@@ -18,7 +18,6 @@ package com.android.server.pm;
|
||||
|
||||
import static android.content.pm.PackageInstaller.LOCATION_DATA_APP;
|
||||
|
||||
import android.Manifest;
|
||||
import android.accounts.IAccountManager;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.UserIdInt;
|
||||
@@ -171,20 +170,6 @@ class PackageManagerShellCommand extends ShellCommand {
|
||||
|
||||
@Override
|
||||
public int onCommand(String cmd) {
|
||||
switch (Binder.getCallingUid()) {
|
||||
case Process.ROOT_UID:
|
||||
case Process.SHELL_UID:
|
||||
break;
|
||||
default:
|
||||
// This is called from a test and is allowed as non-shell with the right permission
|
||||
if ("install-incremental".equals(cmd)) {
|
||||
mContext.enforceCallingPermission(Manifest.permission.USE_SYSTEM_DATA_LOADERS,
|
||||
"Caller missing USE_SYSTEM_DATA_LOADERS permission to use " + cmd);
|
||||
} else {
|
||||
throw new IllegalArgumentException("Caller must be root or shell");
|
||||
}
|
||||
}
|
||||
|
||||
if (cmd == null) {
|
||||
return handleDefaultCommands(cmd);
|
||||
}
|
||||
|
||||
@@ -1197,7 +1197,6 @@ public class DomainVerificationService extends SystemService
|
||||
@Nullable @UserIdInt Integer userId,
|
||||
@NonNull Function<String, PackageStateInternal> pkgSettingFunction)
|
||||
throws NameNotFoundException {
|
||||
mEnforcer.assertApprovedQuerent(mConnection.getCallingUid(), mProxy);
|
||||
synchronized (mLock) {
|
||||
mDebug.printState(writer, packageName, userId, pkgSettingFunction, mAttachedPkgStates);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ package com.android.server.pm.test.verify.domain
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.pm.PackageManager
|
||||
import android.content.pm.SigningDetails
|
||||
import android.content.pm.parsing.component.ParsedActivityImpl
|
||||
import android.content.pm.parsing.component.ParsedIntentInfoImpl
|
||||
import android.content.pm.verify.domain.DomainVerificationManager
|
||||
@@ -27,7 +26,6 @@ import android.content.pm.verify.domain.DomainVerificationState
|
||||
import android.os.Build
|
||||
import android.os.Process
|
||||
import android.util.ArraySet
|
||||
import android.util.IndentingPrintWriter
|
||||
import android.util.SparseArray
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import com.android.server.pm.parsing.pkg.AndroidPackage
|
||||
@@ -48,7 +46,6 @@ import org.mockito.Mockito.anyInt
|
||||
import org.mockito.Mockito.anyLong
|
||||
import org.mockito.Mockito.anyString
|
||||
import org.mockito.Mockito.eq
|
||||
import org.mockito.Mockito.mock
|
||||
import org.mockito.Mockito.verifyNoMoreInteractions
|
||||
import java.util.UUID
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
@@ -207,14 +204,6 @@ class DomainVerificationEnforcerTest {
|
||||
service(Type.QUERENT, "getInfo") {
|
||||
getDomainVerificationInfo(it.targetPackageName)
|
||||
},
|
||||
service(Type.QUERENT, "printState") {
|
||||
printState(mock(IndentingPrintWriter::class.java), null, null)
|
||||
},
|
||||
service(Type.QUERENT, "printStateInternal") {
|
||||
printState(mock(IndentingPrintWriter::class.java), null, null) {
|
||||
mockPkgState(it, UUID.randomUUID())
|
||||
}
|
||||
},
|
||||
service(Type.VERIFIER, "setStatus") {
|
||||
setDomainVerificationStatus(
|
||||
it.targetDomainSetId,
|
||||
@@ -322,7 +311,6 @@ class DomainVerificationEnforcerTest {
|
||||
}
|
||||
)
|
||||
}
|
||||
whenever(signingDetails) { SigningDetails.UNKNOWN }
|
||||
}
|
||||
|
||||
fun mockPkgState(packageName: String, domainSetId: UUID) =
|
||||
@@ -339,7 +327,6 @@ class DomainVerificationEnforcerTest {
|
||||
}
|
||||
}
|
||||
whenever(isSystem) { false }
|
||||
whenever(signingDetails) { SigningDetails.UNKNOWN }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -807,12 +794,8 @@ class DomainVerificationEnforcerTest {
|
||||
}
|
||||
|
||||
val valueAsInt = value as? Int
|
||||
if (valueAsInt != null) {
|
||||
if (valueAsInt == DomainVerificationManager.STATUS_OK) {
|
||||
throw AssertionError("Expected call to return false, was $value")
|
||||
}
|
||||
} else {
|
||||
throw AssertionError("Expected call to fail")
|
||||
if (valueAsInt != null && valueAsInt == DomainVerificationManager.STATUS_OK) {
|
||||
throw AssertionError("Expected call to return false, was $value")
|
||||
}
|
||||
} catch (e: SecurityException) {
|
||||
} catch (e: PackageManager.NameNotFoundException) {
|
||||
|
||||
Reference in New Issue
Block a user