Partial revert "Add overlayable configurator resources" am: 2c206f8685
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11725030 Change-Id: I93500c9f9a6bb067017af399f38bbb0ca1f9404d
This commit is contained in:
@@ -4456,11 +4456,4 @@
|
|||||||
<bool name="config_pdp_reject_enable_retry">false</bool>
|
<bool name="config_pdp_reject_enable_retry">false</bool>
|
||||||
<!-- pdp data reject retry delay in ms -->
|
<!-- pdp data reject retry delay in ms -->
|
||||||
<integer name="config_pdp_reject_retry_delay_ms">-1</integer>
|
<integer name="config_pdp_reject_retry_delay_ms">-1</integer>
|
||||||
|
|
||||||
<!-- Package name that is recognized as an actor for the packages listed in
|
|
||||||
@array/config_overlayableConfiguratorTargets. If an overlay targeting one of the listed
|
|
||||||
targets is signed with the same signature as the configurator, the overlay will be granted
|
|
||||||
the "actor" policy. -->
|
|
||||||
<string name="config_overlayableConfigurator" translatable="false" />
|
|
||||||
<string-array name="config_overlayableConfiguratorTargets" translatable="false" />
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -4034,8 +4034,5 @@
|
|||||||
<java-symbol type="string" name="config_pdp_reject_service_not_subscribed" />
|
<java-symbol type="string" name="config_pdp_reject_service_not_subscribed" />
|
||||||
<java-symbol type="string" name="config_pdp_reject_multi_conn_to_same_pdn_not_allowed" />
|
<java-symbol type="string" name="config_pdp_reject_multi_conn_to_same_pdn_not_allowed" />
|
||||||
|
|
||||||
<java-symbol type="string" name="config_overlayableConfigurator" />
|
|
||||||
<java-symbol type="array" name="config_overlayableConfiguratorTargets" />
|
|
||||||
|
|
||||||
<java-symbol type="array" name="config_notificationMsgPkgsAllowedAsConvos" />
|
<java-symbol type="array" name="config_notificationMsgPkgsAllowedAsConvos" />
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -29,18 +29,15 @@ import android.os.OverlayablePolicy;
|
|||||||
import android.os.SystemProperties;
|
import android.os.SystemProperties;
|
||||||
import android.util.Slog;
|
import android.util.Slog;
|
||||||
|
|
||||||
import com.android.internal.util.ArrayUtils;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle the creation and deletion of idmap files.
|
* Handle the creation and deletion of idmap files.
|
||||||
*
|
*
|
||||||
* The actual work is performed by the idmap binary, launched through idmap2d.
|
* The actual work is performed by idmap2d.
|
||||||
*
|
* @see IdmapDaemon
|
||||||
* Note: this class is subclassed in the OMS unit tests, and hence not marked as final.
|
|
||||||
*/
|
*/
|
||||||
class IdmapManager {
|
final class IdmapManager {
|
||||||
private static final boolean VENDOR_IS_Q_OR_LATER;
|
private static final boolean VENDOR_IS_Q_OR_LATER;
|
||||||
static {
|
static {
|
||||||
final String value = SystemProperties.get("ro.vndk.version", "29");
|
final String value = SystemProperties.get("ro.vndk.version", "29");
|
||||||
@@ -57,14 +54,10 @@ class IdmapManager {
|
|||||||
|
|
||||||
private final IdmapDaemon mIdmapDaemon;
|
private final IdmapDaemon mIdmapDaemon;
|
||||||
private final OverlayableInfoCallback mOverlayableCallback;
|
private final OverlayableInfoCallback mOverlayableCallback;
|
||||||
private final String mOverlayableConfigurator;
|
|
||||||
private final String[] mOverlayableConfiguratorTargets;
|
|
||||||
|
|
||||||
IdmapManager(final IdmapDaemon idmapDaemon, final OverlayableInfoCallback verifyCallback) {
|
IdmapManager(final IdmapDaemon idmapDaemon, final OverlayableInfoCallback verifyCallback) {
|
||||||
mOverlayableCallback = verifyCallback;
|
mOverlayableCallback = verifyCallback;
|
||||||
mIdmapDaemon = idmapDaemon;
|
mIdmapDaemon = idmapDaemon;
|
||||||
mOverlayableConfigurator = verifyCallback.getOverlayableConfigurator();
|
|
||||||
mOverlayableConfiguratorTargets = verifyCallback.getOverlayableConfiguratorTargets() ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -190,14 +183,6 @@ class IdmapManager {
|
|||||||
String targetOverlayableName = overlayPackage.targetOverlayableName;
|
String targetOverlayableName = overlayPackage.targetOverlayableName;
|
||||||
if (targetOverlayableName != null) {
|
if (targetOverlayableName != null) {
|
||||||
try {
|
try {
|
||||||
if (!mOverlayableConfigurator.isEmpty()
|
|
||||||
&& ArrayUtils.contains(mOverlayableConfiguratorTargets,
|
|
||||||
targetPackage.packageName)
|
|
||||||
&& mOverlayableCallback.signaturesMatching(mOverlayableConfigurator,
|
|
||||||
overlayPackage.packageName, userId)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
OverlayableInfo overlayableInfo = mOverlayableCallback.getOverlayableForTarget(
|
OverlayableInfo overlayableInfo = mOverlayableCallback.getOverlayableForTarget(
|
||||||
targetPackage.packageName, targetOverlayableName, userId);
|
targetPackage.packageName, targetOverlayableName, userId);
|
||||||
if (overlayableInfo != null && overlayableInfo.actor != null) {
|
if (overlayableInfo != null && overlayableInfo.actor != null) {
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ import android.content.pm.PackageInfo;
|
|||||||
import android.content.pm.PackageManagerInternal;
|
import android.content.pm.PackageManagerInternal;
|
||||||
import android.content.pm.UserInfo;
|
import android.content.pm.UserInfo;
|
||||||
import android.content.res.ApkAssets;
|
import android.content.res.ApkAssets;
|
||||||
import android.content.res.Resources;
|
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Binder;
|
import android.os.Binder;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
@@ -63,7 +62,6 @@ import android.util.AtomicFile;
|
|||||||
import android.util.Slog;
|
import android.util.Slog;
|
||||||
import android.util.SparseArray;
|
import android.util.SparseArray;
|
||||||
|
|
||||||
import com.android.internal.R;
|
|
||||||
import com.android.internal.content.om.OverlayConfig;
|
import com.android.internal.content.om.OverlayConfig;
|
||||||
import com.android.server.FgThread;
|
import com.android.server.FgThread;
|
||||||
import com.android.server.IoThread;
|
import com.android.server.IoThread;
|
||||||
@@ -1120,17 +1118,6 @@ public final class OverlayManagerService extends SystemService {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getOverlayableConfigurator() {
|
|
||||||
return Resources.getSystem().getString(R.string.config_overlayableConfigurator);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String[] getOverlayableConfiguratorTargets() {
|
|
||||||
return Resources.getSystem().getStringArray(
|
|
||||||
R.array.config_overlayableConfiguratorTargets);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PackageInfo> getOverlayPackages(final int userId) {
|
public List<PackageInfo> getOverlayPackages(final int userId) {
|
||||||
final List<PackageInfo> overlays = mPackageManagerInternal.getOverlayPackages(userId);
|
final List<PackageInfo> overlays = mPackageManagerInternal.getOverlayPackages(userId);
|
||||||
|
|||||||
@@ -80,24 +80,4 @@ public interface OverlayableInfoCallback {
|
|||||||
* in the system returns {@link PackageManager#SIGNATURE_MATCH}
|
* in the system returns {@link PackageManager#SIGNATURE_MATCH}
|
||||||
*/
|
*/
|
||||||
boolean signaturesMatching(@NonNull String pkgName1, @NonNull String pkgName2, int userId);
|
boolean signaturesMatching(@NonNull String pkgName1, @NonNull String pkgName2, int userId);
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieves the package name that is recognized as an actor for the packages specified by
|
|
||||||
* {@link #getOverlayableConfiguratorTargets()}.
|
|
||||||
*/
|
|
||||||
@NonNull
|
|
||||||
default String getOverlayableConfigurator() {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieves the target packages that recognize the {@link #getOverlayableConfigurator} as an
|
|
||||||
* actor for its overlayable declarations. Overlays targeting one of the specified targets that
|
|
||||||
* are signed with the same signature as the overlayable configurator will be granted the
|
|
||||||
* "actor" policy.
|
|
||||||
*/
|
|
||||||
@NonNull
|
|
||||||
default String[] getOverlayableConfiguratorTargets() {
|
|
||||||
return new String[0];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ import static org.junit.Assert.assertNull;
|
|||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
import android.content.om.OverlayInfo;
|
import android.content.om.OverlayInfo;
|
||||||
import android.os.OverlayablePolicy;
|
|
||||||
|
|
||||||
import androidx.test.runner.AndroidJUnit4;
|
import androidx.test.runner.AndroidJUnit4;
|
||||||
|
|
||||||
@@ -205,49 +204,4 @@ public class OverlayManagerServiceImplTests extends OverlayManagerServiceImplTes
|
|||||||
impl.setEnabled(OVERLAY, true, USER);
|
impl.setEnabled(OVERLAY, true, USER);
|
||||||
assertEquals(0, listener.count);
|
assertEquals(0, listener.count);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testConfigurator() {
|
|
||||||
final DummyPackageManagerHelper packageManager = getPackageManager();
|
|
||||||
packageManager.overlayableConfigurator = "actor";
|
|
||||||
packageManager.overlayableConfiguratorTargets = new String[]{TARGET};
|
|
||||||
reinitializeImpl();
|
|
||||||
|
|
||||||
installNewPackage(target("actor").setCertificate("one"), USER);
|
|
||||||
installNewPackage(target(TARGET)
|
|
||||||
.addOverlayable("TestResources")
|
|
||||||
.setCertificate("two"), USER);
|
|
||||||
|
|
||||||
final DummyDeviceState.PackageBuilder overlay = overlay(OVERLAY, TARGET, "TestResources")
|
|
||||||
.setCertificate("one");
|
|
||||||
installNewPackage(overlay, USER);
|
|
||||||
|
|
||||||
final DummyIdmapDaemon idmapDaemon = getIdmapDaemon();
|
|
||||||
final DummyIdmapDaemon.IdmapHeader idmap = idmapDaemon.getIdmap(overlay.build().apkPath);
|
|
||||||
assertNotNull(idmap);
|
|
||||||
assertEquals(OverlayablePolicy.ACTOR_SIGNATURE,
|
|
||||||
idmap.policies & OverlayablePolicy.ACTOR_SIGNATURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testConfiguratorDifferentSignatures() {
|
|
||||||
final DummyPackageManagerHelper packageManager = getPackageManager();
|
|
||||||
packageManager.overlayableConfigurator = "actor";
|
|
||||||
packageManager.overlayableConfiguratorTargets = new String[]{TARGET};
|
|
||||||
reinitializeImpl();
|
|
||||||
|
|
||||||
installNewPackage(target("actor").setCertificate("one"), USER);
|
|
||||||
installNewPackage(target(TARGET)
|
|
||||||
.addOverlayable("TestResources")
|
|
||||||
.setCertificate("two"), USER);
|
|
||||||
|
|
||||||
final DummyDeviceState.PackageBuilder overlay = overlay(OVERLAY, TARGET, "TestResources")
|
|
||||||
.setCertificate("two");
|
|
||||||
installNewPackage(overlay, USER);
|
|
||||||
|
|
||||||
final DummyIdmapDaemon idmapDaemon = getIdmapDaemon();
|
|
||||||
final DummyIdmapDaemon.IdmapHeader idmap = idmapDaemon.getIdmap(overlay.build().apkPath);
|
|
||||||
assertNotNull(idmap);
|
|
||||||
assertEquals(0, idmap.policies & OverlayablePolicy.ACTOR_SIGNATURE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ import java.util.Arrays;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/** Base class for creating {@link OverlayManagerServiceImplTests} tests. */
|
/** Base class for creating {@link OverlayManagerServiceImplTests} tests. */
|
||||||
@@ -84,14 +83,6 @@ class OverlayManagerServiceImplTestsBase {
|
|||||||
return mListener;
|
return mListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
DummyPackageManagerHelper getPackageManager() {
|
|
||||||
return mPackageManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
DummyIdmapDaemon getIdmapDaemon() {
|
|
||||||
return mIdmapDaemon;
|
|
||||||
}
|
|
||||||
|
|
||||||
void assertState(@State int expected, final String overlayPackageName, int userId) {
|
void assertState(@State int expected, final String overlayPackageName, int userId) {
|
||||||
final OverlayInfo info = mImpl.getOverlayInfo(overlayPackageName, userId);
|
final OverlayInfo info = mImpl.getOverlayInfo(overlayPackageName, userId);
|
||||||
if (info == null) {
|
if (info == null) {
|
||||||
@@ -314,8 +305,6 @@ class OverlayManagerServiceImplTestsBase {
|
|||||||
static final class DummyPackageManagerHelper implements PackageManagerHelper,
|
static final class DummyPackageManagerHelper implements PackageManagerHelper,
|
||||||
OverlayableInfoCallback {
|
OverlayableInfoCallback {
|
||||||
private final DummyDeviceState mState;
|
private final DummyDeviceState mState;
|
||||||
String[] overlayableConfiguratorTargets = new String[0];
|
|
||||||
String overlayableConfigurator = "";
|
|
||||||
|
|
||||||
private DummyPackageManagerHelper(DummyDeviceState state) {
|
private DummyPackageManagerHelper(DummyDeviceState state) {
|
||||||
mState = state;
|
mState = state;
|
||||||
@@ -387,16 +376,6 @@ class OverlayManagerServiceImplTestsBase {
|
|||||||
public void enforcePermission(String permission, String message) throws SecurityException {
|
public void enforcePermission(String permission, String message) throws SecurityException {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String[] getOverlayableConfiguratorTargets() {
|
|
||||||
return overlayableConfiguratorTargets;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getOverlayableConfigurator() {
|
|
||||||
return overlayableConfigurator;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static class DummyIdmapDaemon extends IdmapDaemon {
|
static class DummyIdmapDaemon extends IdmapDaemon {
|
||||||
|
|||||||
Reference in New Issue
Block a user