Merge changes from topic "system_ext"
am: a828ee6442
Change-Id: I2b636d0c54c932342586de47a38c16e93bf978e8
This commit is contained in:
@@ -5168,7 +5168,8 @@ package android.os {
|
||||
method @NonNull public static java.io.File getOdmDirectory();
|
||||
method @NonNull public static java.io.File getOemDirectory();
|
||||
method @NonNull public static java.io.File getProductDirectory();
|
||||
method @NonNull public static java.io.File getProductServicesDirectory();
|
||||
method @Deprecated @NonNull public static java.io.File getProductServicesDirectory();
|
||||
method @NonNull public static java.io.File getSystemExtDirectory();
|
||||
method @NonNull public static java.io.File getVendorDirectory();
|
||||
}
|
||||
|
||||
|
||||
@@ -103,6 +103,7 @@ std::vector<std::string> PoliciesForPath(const std::string& apk_path) {
|
||||
{"/oem/", kPolicyOem},
|
||||
{"/product/", kPolicyProduct},
|
||||
{"/system/", kPolicySystem},
|
||||
{"/system_ext/", kPolicySystem},
|
||||
{"/vendor/", kPolicyVendor},
|
||||
};
|
||||
|
||||
|
||||
@@ -614,10 +614,10 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
|
||||
|
||||
/**
|
||||
* Value for {@link #privateFlags}: whether this app is pre-installed on the
|
||||
* google partition of the system image.
|
||||
* system_ext partition of the system image.
|
||||
* @hide
|
||||
*/
|
||||
public static final int PRIVATE_FLAG_PRODUCT_SERVICES = 1 << 21;
|
||||
public static final int PRIVATE_FLAG_SYSTEM_EXT = 1 << 21;
|
||||
|
||||
/**
|
||||
* Indicates whether this package requires access to non-SDK APIs.
|
||||
@@ -713,7 +713,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
|
||||
PRIVATE_FLAG_USE_EMBEDDED_DEX,
|
||||
PRIVATE_FLAG_PRIVILEGED,
|
||||
PRIVATE_FLAG_PRODUCT,
|
||||
PRIVATE_FLAG_PRODUCT_SERVICES,
|
||||
PRIVATE_FLAG_SYSTEM_EXT,
|
||||
PRIVATE_FLAG_PROFILEABLE_BY_SHELL,
|
||||
PRIVATE_FLAG_REQUIRED_FOR_SYSTEM_USER,
|
||||
PRIVATE_FLAG_SIGNED_WITH_PLATFORM_KEY,
|
||||
@@ -2047,8 +2047,8 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
public boolean isProductServices() {
|
||||
return (privateFlags & ApplicationInfo.PRIVATE_FLAG_PRODUCT_SERVICES) != 0;
|
||||
public boolean isSystemExt() {
|
||||
return (privateFlags & ApplicationInfo.PRIVATE_FLAG_SYSTEM_EXT) != 0;
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
|
||||
@@ -6897,8 +6897,8 @@ public class PackageParser {
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
public boolean isProductServices() {
|
||||
return applicationInfo.isProductServices();
|
||||
public boolean isSystemExt() {
|
||||
return applicationInfo.isSystemExt();
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
|
||||
@@ -1186,7 +1186,7 @@ public class Build {
|
||||
ArrayList<Partition> partitions = new ArrayList();
|
||||
|
||||
String[] names = new String[] {
|
||||
"bootimage", "odm", "product", "product_services", Partition.PARTITION_NAME_SYSTEM,
|
||||
"bootimage", "odm", "product", "system_ext", Partition.PARTITION_NAME_SYSTEM,
|
||||
"vendor"
|
||||
};
|
||||
for (String name : names) {
|
||||
|
||||
@@ -54,7 +54,7 @@ public class Environment {
|
||||
private static final String ENV_ODM_ROOT = "ODM_ROOT";
|
||||
private static final String ENV_VENDOR_ROOT = "VENDOR_ROOT";
|
||||
private static final String ENV_PRODUCT_ROOT = "PRODUCT_ROOT";
|
||||
private static final String ENV_PRODUCT_SERVICES_ROOT = "PRODUCT_SERVICES_ROOT";
|
||||
private static final String ENV_SYSTEM_EXT_ROOT = "SYSTEM_EXT_ROOT";
|
||||
|
||||
/** {@hide} */
|
||||
public static final String DIR_ANDROID = "Android";
|
||||
@@ -77,8 +77,8 @@ public class Environment {
|
||||
private static final File DIR_ODM_ROOT = getDirectory(ENV_ODM_ROOT, "/odm");
|
||||
private static final File DIR_VENDOR_ROOT = getDirectory(ENV_VENDOR_ROOT, "/vendor");
|
||||
private static final File DIR_PRODUCT_ROOT = getDirectory(ENV_PRODUCT_ROOT, "/product");
|
||||
private static final File DIR_PRODUCT_SERVICES_ROOT = getDirectory(ENV_PRODUCT_SERVICES_ROOT,
|
||||
"/product_services");
|
||||
private static final File DIR_SYSTEM_EXT_ROOT = getDirectory(ENV_SYSTEM_EXT_ROOT,
|
||||
"/system_ext");
|
||||
|
||||
@UnsupportedAppUsage
|
||||
private static UserEnvironment sCurrentUser;
|
||||
@@ -222,11 +222,26 @@ public class Environment {
|
||||
* Return root directory of the "product_services" partition holding middleware
|
||||
* services if any. If present, the partition is mounted read-only.
|
||||
*
|
||||
* @deprecated This directory is not guaranteed to exist.
|
||||
* Its name is changed to "system_ext" because the partition's purpose is changed.
|
||||
* {@link #getSystemExtDirectory()}
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
@Deprecated
|
||||
public static @NonNull File getProductServicesDirectory() {
|
||||
return DIR_PRODUCT_SERVICES_ROOT;
|
||||
return getDirectory("PRODUCT_SERVICES_ROOT", "/product_services");
|
||||
}
|
||||
|
||||
/**
|
||||
* Return root directory of the "system_ext" partition holding system partition's extension
|
||||
* If present, the partition is mounted read-only.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
public static @NonNull File getSystemExtDirectory() {
|
||||
return DIR_SYSTEM_EXT_ROOT;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -194,9 +194,8 @@ public class SystemConfig {
|
||||
final ArrayMap<String, ArraySet<String>> mProductPrivAppPermissions = new ArrayMap<>();
|
||||
final ArrayMap<String, ArraySet<String>> mProductPrivAppDenyPermissions = new ArrayMap<>();
|
||||
|
||||
final ArrayMap<String, ArraySet<String>> mProductServicesPrivAppPermissions = new ArrayMap<>();
|
||||
final ArrayMap<String, ArraySet<String>> mProductServicesPrivAppDenyPermissions =
|
||||
new ArrayMap<>();
|
||||
final ArrayMap<String, ArraySet<String>> mSystemExtPrivAppPermissions = new ArrayMap<>();
|
||||
final ArrayMap<String, ArraySet<String>> mSystemExtPrivAppDenyPermissions = new ArrayMap<>();
|
||||
|
||||
final ArrayMap<String, ArrayMap<String, Boolean>> mOemPermissions = new ArrayMap<>();
|
||||
|
||||
@@ -321,12 +320,20 @@ public class SystemConfig {
|
||||
return mProductPrivAppDenyPermissions.get(packageName);
|
||||
}
|
||||
|
||||
public ArraySet<String> getProductServicesPrivAppPermissions(String packageName) {
|
||||
return mProductServicesPrivAppPermissions.get(packageName);
|
||||
/**
|
||||
* Read from "permission" tags in /system_ext/etc/permissions/*.xml
|
||||
* @return Set of privileged permissions that are explicitly granted.
|
||||
*/
|
||||
public ArraySet<String> getSystemExtPrivAppPermissions(String packageName) {
|
||||
return mSystemExtPrivAppPermissions.get(packageName);
|
||||
}
|
||||
|
||||
public ArraySet<String> getProductServicesPrivAppDenyPermissions(String packageName) {
|
||||
return mProductServicesPrivAppDenyPermissions.get(packageName);
|
||||
/**
|
||||
* Read from "deny-permission" tags in /system_ext/etc/permissions/*.xml
|
||||
* @return Set of privileged permissions that are explicitly denied.
|
||||
*/
|
||||
public ArraySet<String> getSystemExtPrivAppDenyPermissions(String packageName) {
|
||||
return mSystemExtPrivAppDenyPermissions.get(packageName);
|
||||
}
|
||||
|
||||
public Map<String, Boolean> getOemPermissions(String packageName) {
|
||||
@@ -398,11 +405,11 @@ public class SystemConfig {
|
||||
readPermissions(Environment.buildPath(
|
||||
Environment.getProductDirectory(), "etc", "permissions"), ALLOW_ALL);
|
||||
|
||||
// Allow /product_services to customize all system configs
|
||||
// Allow /system_ext to customize all system configs
|
||||
readPermissions(Environment.buildPath(
|
||||
Environment.getProductServicesDirectory(), "etc", "sysconfig"), ALLOW_ALL);
|
||||
Environment.getSystemExtDirectory(), "etc", "sysconfig"), ALLOW_ALL);
|
||||
readPermissions(Environment.buildPath(
|
||||
Environment.getProductServicesDirectory(), "etc", "permissions"), ALLOW_ALL);
|
||||
Environment.getSystemExtDirectory(), "etc", "permissions"), ALLOW_ALL);
|
||||
}
|
||||
|
||||
void readPermissions(File libraryDir, int permissionFlag) {
|
||||
@@ -848,7 +855,7 @@ public class SystemConfig {
|
||||
} break;
|
||||
case "privapp-permissions": {
|
||||
if (allowPrivappPermissions) {
|
||||
// privapp permissions from system, vendor, product and product_services
|
||||
// privapp permissions from system, vendor, product and system_ext
|
||||
// partitions are stored separately. This is to prevent xml files in
|
||||
// the vendor partition from granting permissions to priv apps in the
|
||||
// system partition and vice versa.
|
||||
@@ -858,17 +865,17 @@ public class SystemConfig {
|
||||
Environment.getOdmDirectory().toPath() + "/");
|
||||
boolean product = permFile.toPath().startsWith(
|
||||
Environment.getProductDirectory().toPath() + "/");
|
||||
boolean productServices = permFile.toPath().startsWith(
|
||||
Environment.getProductServicesDirectory().toPath() + "/");
|
||||
boolean systemExt = permFile.toPath().startsWith(
|
||||
Environment.getSystemExtDirectory().toPath() + "/");
|
||||
if (vendor) {
|
||||
readPrivAppPermissions(parser, mVendorPrivAppPermissions,
|
||||
mVendorPrivAppDenyPermissions);
|
||||
} else if (product) {
|
||||
readPrivAppPermissions(parser, mProductPrivAppPermissions,
|
||||
mProductPrivAppDenyPermissions);
|
||||
} else if (productServices) {
|
||||
readPrivAppPermissions(parser, mProductServicesPrivAppPermissions,
|
||||
mProductServicesPrivAppDenyPermissions);
|
||||
} else if (systemExt) {
|
||||
readPrivAppPermissions(parser, mSystemExtPrivAppPermissions,
|
||||
mSystemExtPrivAppDenyPermissions);
|
||||
} else {
|
||||
readPrivAppPermissions(parser, mPrivAppPermissions,
|
||||
mPrivAppDenyPermissions);
|
||||
|
||||
@@ -163,7 +163,7 @@ static void NativeVerifySystemIdmaps(JNIEnv* /*env*/, jclass /*clazz*/) {
|
||||
}
|
||||
|
||||
// Generic idmap parameters
|
||||
const char* argv[10];
|
||||
const char* argv[11];
|
||||
int argc = 0;
|
||||
struct stat st;
|
||||
|
||||
@@ -195,8 +195,8 @@ static void NativeVerifySystemIdmaps(JNIEnv* /*env*/, jclass /*clazz*/) {
|
||||
argv[argc++] = AssetManager::PRODUCT_OVERLAY_DIR;
|
||||
}
|
||||
|
||||
if (stat(AssetManager::PRODUCT_SERVICES_OVERLAY_DIR, &st) == 0) {
|
||||
argv[argc++] = AssetManager::PRODUCT_SERVICES_OVERLAY_DIR;
|
||||
if (stat(AssetManager::SYSTEM_EXT_OVERLAY_DIR, &st) == 0) {
|
||||
argv[argc++] = AssetManager::SYSTEM_EXT_OVERLAY_DIR;
|
||||
}
|
||||
|
||||
if (stat(AssetManager::ODM_OVERLAY_DIR, &st) == 0) {
|
||||
@@ -237,8 +237,8 @@ static jobjectArray NativeCreateIdmapsForStaticOverlaysTargetingAndroid(JNIEnv*
|
||||
input_dirs.push_back(AssetManager::PRODUCT_OVERLAY_DIR);
|
||||
}
|
||||
|
||||
if (stat(AssetManager::PRODUCT_SERVICES_OVERLAY_DIR, &st) == 0) {
|
||||
input_dirs.push_back(AssetManager::PRODUCT_SERVICES_OVERLAY_DIR);
|
||||
if (stat(AssetManager::SYSTEM_EXT_OVERLAY_DIR, &st) == 0) {
|
||||
input_dirs.push_back(AssetManager::SYSTEM_EXT_OVERLAY_DIR);
|
||||
}
|
||||
|
||||
if (stat(AssetManager::ODM_OVERLAY_DIR, &st) == 0) {
|
||||
|
||||
@@ -100,8 +100,8 @@ bool FileDescriptorWhitelist::IsAllowed(const std::string& path) const {
|
||||
static const char* kVendorOverlaySubdir = "/system/vendor/overlay-subdir/";
|
||||
static const char* kSystemProductOverlayDir = "/system/product/overlay/";
|
||||
static const char* kProductOverlayDir = "/product/overlay";
|
||||
static const char* kSystemProductServicesOverlayDir = "/system/product_services/overlay/";
|
||||
static const char* kProductServicesOverlayDir = "/product_services/overlay";
|
||||
static const char* kSystemSystemExtOverlayDir = "/system/system_ext/overlay/";
|
||||
static const char* kSystemExtOverlayDir = "/system_ext/overlay";
|
||||
static const char* kSystemOdmOverlayDir = "/system/odm/overlay";
|
||||
static const char* kOdmOverlayDir = "/odm/overlay";
|
||||
static const char* kSystemOemOverlayDir = "/system/oem/overlay";
|
||||
@@ -113,8 +113,8 @@ bool FileDescriptorWhitelist::IsAllowed(const std::string& path) const {
|
||||
|| android::base::StartsWith(path, kVendorOverlayDir)
|
||||
|| android::base::StartsWith(path, kSystemProductOverlayDir)
|
||||
|| android::base::StartsWith(path, kProductOverlayDir)
|
||||
|| android::base::StartsWith(path, kSystemProductServicesOverlayDir)
|
||||
|| android::base::StartsWith(path, kProductServicesOverlayDir)
|
||||
|| android::base::StartsWith(path, kSystemSystemExtOverlayDir)
|
||||
|| android::base::StartsWith(path, kSystemExtOverlayDir)
|
||||
|| android::base::StartsWith(path, kSystemOdmOverlayDir)
|
||||
|| android::base::StartsWith(path, kOdmOverlayDir)
|
||||
|| android::base::StartsWith(path, kSystemOemOverlayDir)
|
||||
|
||||
@@ -74,7 +74,7 @@ const char* AssetManager::RESOURCES_FILENAME = "resources.arsc";
|
||||
const char* AssetManager::IDMAP_BIN = "/system/bin/idmap";
|
||||
const char* AssetManager::VENDOR_OVERLAY_DIR = "/vendor/overlay";
|
||||
const char* AssetManager::PRODUCT_OVERLAY_DIR = "/product/overlay";
|
||||
const char* AssetManager::PRODUCT_SERVICES_OVERLAY_DIR = "/product_services/overlay";
|
||||
const char* AssetManager::SYSTEM_EXT_OVERLAY_DIR = "/system_ext/overlay";
|
||||
const char* AssetManager::ODM_OVERLAY_DIR = "/odm/overlay";
|
||||
const char* AssetManager::OEM_OVERLAY_DIR = "/oem/overlay";
|
||||
const char* AssetManager::OVERLAY_THEME_DIR_PROPERTY = "ro.boot.vendor.overlay.theme";
|
||||
@@ -575,7 +575,7 @@ bool AssetManager::appendPathToResTable(asset_path& ap, bool appAsLib) const {
|
||||
mZipSet.setZipResourceTableAsset(ap.path, ass);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (nextEntryIdx == 0 && ass != NULL) {
|
||||
// If this is the first resource table in the asset
|
||||
// manager, then we are going to cache it so that we
|
||||
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
static const char* IDMAP_BIN;
|
||||
static const char* VENDOR_OVERLAY_DIR;
|
||||
static const char* PRODUCT_OVERLAY_DIR;
|
||||
static const char* PRODUCT_SERVICES_OVERLAY_DIR;
|
||||
static const char* SYSTEM_EXT_OVERLAY_DIR;
|
||||
static const char* ODM_OVERLAY_DIR;
|
||||
static const char* OEM_OVERLAY_DIR;
|
||||
/*
|
||||
|
||||
@@ -198,14 +198,9 @@ class IdmapManager {
|
||||
return fulfilledPolicies | IIdmap2.POLICY_OEM_PARTITION;
|
||||
}
|
||||
|
||||
// Check partitions for which there exists no policy so overlays on these partitions will
|
||||
// not fulfill the system policy.
|
||||
if (ai.isProductServices()) {
|
||||
return fulfilledPolicies;
|
||||
}
|
||||
|
||||
// System_ext partition (/system_ext) is considered as system
|
||||
// Check this last since every partition except for data is scanned as system in the PMS.
|
||||
if (ai.isSystemApp()) {
|
||||
if (ai.isSystemApp() || ai.isSystemExt()) {
|
||||
return fulfilledPolicies | IIdmap2.POLICY_SYSTEM_PARTITION;
|
||||
}
|
||||
|
||||
|
||||
@@ -376,12 +376,12 @@ public class OtaDexoptService extends IOtaDexopt.Stub {
|
||||
continue;
|
||||
}
|
||||
|
||||
// If the path is in /system, /vendor, /product or /product_services, ignore. It will
|
||||
// If the path is in /system, /vendor, /product or /system_ext, ignore. It will
|
||||
// have been ota-dexopted into /data/ota and moved into the dalvik-cache already.
|
||||
if (pkg.codePath.startsWith("/system")
|
||||
|| pkg.codePath.startsWith("/vendor")
|
||||
|| pkg.codePath.startsWith("/product")
|
||||
|| pkg.codePath.startsWith("/product_services")) {
|
||||
|| pkg.codePath.startsWith("/system_ext")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -475,7 +475,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
static final int SCAN_AS_OEM = 1 << 19;
|
||||
static final int SCAN_AS_VENDOR = 1 << 20;
|
||||
static final int SCAN_AS_PRODUCT = 1 << 21;
|
||||
static final int SCAN_AS_PRODUCT_SERVICES = 1 << 22;
|
||||
static final int SCAN_AS_SYSTEM_EXT = 1 << 22;
|
||||
static final int SCAN_AS_ODM = 1 << 23;
|
||||
|
||||
@IntDef(flag = true, prefix = { "SCAN_" }, value = {
|
||||
@@ -593,7 +593,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
|
||||
private static final String PRODUCT_OVERLAY_DIR = "/product/overlay";
|
||||
|
||||
private static final String PRODUCT_SERVICES_OVERLAY_DIR = "/product_services/overlay";
|
||||
private static final String SYSTEM_EXT_OVERLAY_DIR = "/system_ext/overlay";
|
||||
|
||||
private static final String ODM_OVERLAY_DIR = "/odm/overlay";
|
||||
|
||||
@@ -2604,7 +2604,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
scanFlags = scanFlags | SCAN_FIRST_BOOT_OR_UPGRADE;
|
||||
}
|
||||
|
||||
// Collect vendor/product/product_services overlay packages. (Do this before scanning
|
||||
// Collect vendor/product/system_ext overlay packages. (Do this before scanning
|
||||
// any apps.)
|
||||
// For security and version matching reason, only consider overlay packages if they
|
||||
// reside in the right directory.
|
||||
@@ -2622,12 +2622,12 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
| SCAN_AS_SYSTEM
|
||||
| SCAN_AS_PRODUCT,
|
||||
0);
|
||||
scanDirTracedLI(new File(PRODUCT_SERVICES_OVERLAY_DIR),
|
||||
scanDirTracedLI(new File(SYSTEM_EXT_OVERLAY_DIR),
|
||||
mDefParseFlags
|
||||
| PackageParser.PARSE_IS_SYSTEM_DIR,
|
||||
scanFlags
|
||||
| SCAN_AS_SYSTEM
|
||||
| SCAN_AS_PRODUCT_SERVICES,
|
||||
| SCAN_AS_SYSTEM_EXT,
|
||||
0);
|
||||
scanDirTracedLI(new File(ODM_OVERLAY_DIR),
|
||||
mDefParseFlags
|
||||
@@ -2785,37 +2785,37 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
| SCAN_AS_PRODUCT,
|
||||
0);
|
||||
|
||||
// Collected privileged /product_services packages.
|
||||
File privilegedProductServicesAppDir =
|
||||
new File(Environment.getProductServicesDirectory(), "priv-app");
|
||||
// Collected privileged /system_ext packages.
|
||||
File privilegedSystemExtAppDir =
|
||||
new File(Environment.getSystemExtDirectory(), "priv-app");
|
||||
try {
|
||||
privilegedProductServicesAppDir =
|
||||
privilegedProductServicesAppDir.getCanonicalFile();
|
||||
privilegedSystemExtAppDir =
|
||||
privilegedSystemExtAppDir.getCanonicalFile();
|
||||
} catch (IOException e) {
|
||||
// failed to look up canonical path, continue with original one
|
||||
}
|
||||
scanDirTracedLI(privilegedProductServicesAppDir,
|
||||
scanDirTracedLI(privilegedSystemExtAppDir,
|
||||
mDefParseFlags
|
||||
| PackageParser.PARSE_IS_SYSTEM_DIR,
|
||||
scanFlags
|
||||
| SCAN_AS_SYSTEM
|
||||
| SCAN_AS_PRODUCT_SERVICES
|
||||
| SCAN_AS_SYSTEM_EXT
|
||||
| SCAN_AS_PRIVILEGED,
|
||||
0);
|
||||
|
||||
// Collect ordinary /product_services packages.
|
||||
File productServicesAppDir = new File(Environment.getProductServicesDirectory(), "app");
|
||||
// Collect ordinary /system_ext packages.
|
||||
File systemExtAppDir = new File(Environment.getSystemExtDirectory(), "app");
|
||||
try {
|
||||
productServicesAppDir = productServicesAppDir.getCanonicalFile();
|
||||
systemExtAppDir = systemExtAppDir.getCanonicalFile();
|
||||
} catch (IOException e) {
|
||||
// failed to look up canonical path, continue with original one
|
||||
}
|
||||
scanDirTracedLI(productServicesAppDir,
|
||||
scanDirTracedLI(systemExtAppDir,
|
||||
mDefParseFlags
|
||||
| PackageParser.PARSE_IS_SYSTEM_DIR,
|
||||
scanFlags
|
||||
| SCAN_AS_SYSTEM
|
||||
| SCAN_AS_PRODUCT_SERVICES,
|
||||
| SCAN_AS_SYSTEM_EXT,
|
||||
0);
|
||||
|
||||
// Prune any system packages that no longer exist.
|
||||
@@ -3045,23 +3045,23 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
scanFlags
|
||||
| SCAN_AS_SYSTEM
|
||||
| SCAN_AS_PRODUCT;
|
||||
} else if (FileUtils.contains(privilegedProductServicesAppDir, scanFile)) {
|
||||
} else if (FileUtils.contains(privilegedSystemExtAppDir, scanFile)) {
|
||||
reparseFlags =
|
||||
mDefParseFlags |
|
||||
PackageParser.PARSE_IS_SYSTEM_DIR;
|
||||
rescanFlags =
|
||||
scanFlags
|
||||
| SCAN_AS_SYSTEM
|
||||
| SCAN_AS_PRODUCT_SERVICES
|
||||
| SCAN_AS_SYSTEM_EXT
|
||||
| SCAN_AS_PRIVILEGED;
|
||||
} else if (FileUtils.contains(productServicesAppDir, scanFile)) {
|
||||
} else if (FileUtils.contains(systemExtAppDir, scanFile)) {
|
||||
reparseFlags =
|
||||
mDefParseFlags |
|
||||
PackageParser.PARSE_IS_SYSTEM_DIR;
|
||||
rescanFlags =
|
||||
scanFlags
|
||||
| SCAN_AS_SYSTEM
|
||||
| SCAN_AS_PRODUCT_SERVICES;
|
||||
| SCAN_AS_SYSTEM_EXT;
|
||||
} else {
|
||||
Slog.e(TAG, "Ignoring unexpected fallback path " + scanFile);
|
||||
continue;
|
||||
@@ -10849,7 +10849,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
* <li>{@link #SCAN_AS_OEM}</li>
|
||||
* <li>{@link #SCAN_AS_VENDOR}</li>
|
||||
* <li>{@link #SCAN_AS_PRODUCT}</li>
|
||||
* <li>{@link #SCAN_AS_PRODUCT_SERVICES}</li>
|
||||
* <li>{@link #SCAN_AS_SYSTEM_EXT}</li>
|
||||
* <li>{@link #SCAN_AS_INSTANT_APP}</li>
|
||||
* <li>{@link #SCAN_AS_VIRTUAL_PRELOAD}</li>
|
||||
* <li>{@link #SCAN_AS_ODM}</li>
|
||||
@@ -10886,8 +10886,8 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
scanFlags |= SCAN_AS_PRODUCT;
|
||||
}
|
||||
if ((systemPkgSetting.pkgPrivateFlags
|
||||
& ApplicationInfo.PRIVATE_FLAG_PRODUCT_SERVICES) != 0) {
|
||||
scanFlags |= SCAN_AS_PRODUCT_SERVICES;
|
||||
& ApplicationInfo.PRIVATE_FLAG_SYSTEM_EXT) != 0) {
|
||||
scanFlags |= SCAN_AS_SYSTEM_EXT;
|
||||
}
|
||||
if ((systemPkgSetting.pkgPrivateFlags
|
||||
& ApplicationInfo.PRIVATE_FLAG_ODM) != 0) {
|
||||
@@ -11669,8 +11669,8 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
pkg.applicationInfo.privateFlags |= ApplicationInfo.PRIVATE_FLAG_PRODUCT;
|
||||
}
|
||||
|
||||
if ((scanFlags & SCAN_AS_PRODUCT_SERVICES) != 0) {
|
||||
pkg.applicationInfo.privateFlags |= ApplicationInfo.PRIVATE_FLAG_PRODUCT_SERVICES;
|
||||
if ((scanFlags & SCAN_AS_SYSTEM_EXT) != 0) {
|
||||
pkg.applicationInfo.privateFlags |= ApplicationInfo.PRIVATE_FLAG_SYSTEM_EXT;
|
||||
}
|
||||
|
||||
if ((scanFlags & SCAN_AS_ODM) != 0) {
|
||||
@@ -12634,8 +12634,8 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
codeRoot = Environment.getOdmDirectory();
|
||||
} else if (FileUtils.contains(Environment.getProductDirectory(), codePath)) {
|
||||
codeRoot = Environment.getProductDirectory();
|
||||
} else if (FileUtils.contains(Environment.getProductServicesDirectory(), codePath)) {
|
||||
codeRoot = Environment.getProductServicesDirectory();
|
||||
} else if (FileUtils.contains(Environment.getSystemExtDirectory(), codePath)) {
|
||||
codeRoot = Environment.getSystemExtDirectory();
|
||||
} else if (FileUtils.contains(Environment.getOdmDirectory(), codePath)) {
|
||||
codeRoot = Environment.getOdmDirectory();
|
||||
} else {
|
||||
@@ -18187,9 +18187,9 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
return (pkg.applicationInfo.privateFlags & ApplicationInfo.PRIVATE_FLAG_PRODUCT) != 0;
|
||||
}
|
||||
|
||||
private static boolean isProductServicesApp(PackageParser.Package pkg) {
|
||||
private static boolean isSystemExtApp(PackageParser.Package pkg) {
|
||||
return (pkg.applicationInfo.privateFlags
|
||||
& ApplicationInfo.PRIVATE_FLAG_PRODUCT_SERVICES) != 0;
|
||||
& ApplicationInfo.PRIVATE_FLAG_SYSTEM_EXT) != 0;
|
||||
}
|
||||
|
||||
private static boolean isOdmApp(PackageParser.Package pkg) {
|
||||
@@ -18955,13 +18955,13 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
final File privilegedVendorAppDir = new File(Environment.getVendorDirectory(), "priv-app");
|
||||
final File privilegedOdmAppDir = new File(Environment.getOdmDirectory(), "priv-app");
|
||||
final File privilegedProductAppDir = new File(Environment.getProductDirectory(), "priv-app");
|
||||
final File privilegedProductServicesAppDir =
|
||||
new File(Environment.getProductServicesDirectory(), "priv-app");
|
||||
final File privilegedSystemExtAppDir =
|
||||
new File(Environment.getSystemExtDirectory(), "priv-app");
|
||||
return path.startsWith(privilegedAppDir.getCanonicalPath() + "/")
|
||||
|| path.startsWith(privilegedVendorAppDir.getCanonicalPath() + "/")
|
||||
|| path.startsWith(privilegedOdmAppDir.getCanonicalPath() + "/")
|
||||
|| path.startsWith(privilegedProductAppDir.getCanonicalPath() + "/")
|
||||
|| path.startsWith(privilegedProductServicesAppDir.getCanonicalPath() + "/");
|
||||
|| path.startsWith(privilegedSystemExtAppDir.getCanonicalPath() + "/");
|
||||
} catch (IOException e) {
|
||||
Slog.e(TAG, "Unable to access code path " + path);
|
||||
}
|
||||
@@ -18996,10 +18996,10 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
return false;
|
||||
}
|
||||
|
||||
static boolean locationIsProductServices(String path) {
|
||||
static boolean locationIsSystemExt(String path) {
|
||||
try {
|
||||
return path.startsWith(
|
||||
Environment.getProductServicesDirectory().getCanonicalPath() + "/");
|
||||
Environment.getSystemExtDirectory().getCanonicalPath() + "/");
|
||||
} catch (IOException e) {
|
||||
Slog.e(TAG, "Unable to access code path " + path);
|
||||
}
|
||||
@@ -19132,8 +19132,8 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
if (locationIsProduct(codePathString)) {
|
||||
scanFlags |= SCAN_AS_PRODUCT;
|
||||
}
|
||||
if (locationIsProductServices(codePathString)) {
|
||||
scanFlags |= SCAN_AS_PRODUCT_SERVICES;
|
||||
if (locationIsSystemExt(codePathString)) {
|
||||
scanFlags |= SCAN_AS_SYSTEM_EXT;
|
||||
}
|
||||
if (locationIsOdm(codePathString)) {
|
||||
scanFlags |= SCAN_AS_ODM;
|
||||
|
||||
@@ -1997,10 +1997,10 @@ class PackageManagerShellCommand extends ShellCommand {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isProductServicesApp(String pkg) {
|
||||
private boolean isSystemExtApp(String pkg) {
|
||||
try {
|
||||
final PackageInfo info = mInterface.getPackageInfo(pkg, 0, UserHandle.USER_SYSTEM);
|
||||
return info != null && info.applicationInfo.isProductServices();
|
||||
return info != null && info.applicationInfo.isSystemExt();
|
||||
} catch (RemoteException e) {
|
||||
return false;
|
||||
}
|
||||
@@ -2018,9 +2018,9 @@ class PackageManagerShellCommand extends ShellCommand {
|
||||
privAppPermissions = SystemConfig.getInstance().getVendorPrivAppPermissions(pkg);
|
||||
} else if (isProductApp(pkg)) {
|
||||
privAppPermissions = SystemConfig.getInstance().getProductPrivAppPermissions(pkg);
|
||||
} else if (isProductServicesApp(pkg)) {
|
||||
} else if (isSystemExtApp(pkg)) {
|
||||
privAppPermissions = SystemConfig.getInstance()
|
||||
.getProductServicesPrivAppPermissions(pkg);
|
||||
.getSystemExtPrivAppPermissions(pkg);
|
||||
} else {
|
||||
privAppPermissions = SystemConfig.getInstance().getPrivAppPermissions(pkg);
|
||||
}
|
||||
@@ -2042,9 +2042,9 @@ class PackageManagerShellCommand extends ShellCommand {
|
||||
privAppPermissions = SystemConfig.getInstance().getVendorPrivAppDenyPermissions(pkg);
|
||||
} else if (isProductApp(pkg)) {
|
||||
privAppPermissions = SystemConfig.getInstance().getProductPrivAppDenyPermissions(pkg);
|
||||
} else if (isProductServicesApp(pkg)) {
|
||||
} else if (isSystemExtApp(pkg)) {
|
||||
privAppPermissions = SystemConfig.getInstance()
|
||||
.getProductServicesPrivAppDenyPermissions(pkg);
|
||||
.getSystemExtPrivAppDenyPermissions(pkg);
|
||||
} else {
|
||||
privAppPermissions = SystemConfig.getInstance().getPrivAppDenyPermissions(pkg);
|
||||
}
|
||||
|
||||
@@ -148,8 +148,8 @@ public final class PackageSetting extends PackageSettingBase {
|
||||
return (pkgPrivateFlags & ApplicationInfo.PRIVATE_FLAG_PRODUCT) != 0;
|
||||
}
|
||||
|
||||
public boolean isProductServices() {
|
||||
return (pkgPrivateFlags & ApplicationInfo.PRIVATE_FLAG_PRODUCT_SERVICES) != 0;
|
||||
public boolean isSystemExt() {
|
||||
return (pkgPrivateFlags & ApplicationInfo.PRIVATE_FLAG_SYSTEM_EXT) != 0;
|
||||
}
|
||||
|
||||
public boolean isOdm() {
|
||||
|
||||
@@ -63,7 +63,7 @@ abstract class SettingBase {
|
||||
| ApplicationInfo.PRIVATE_FLAG_OEM
|
||||
| ApplicationInfo.PRIVATE_FLAG_VENDOR
|
||||
| ApplicationInfo.PRIVATE_FLAG_PRODUCT
|
||||
| ApplicationInfo.PRIVATE_FLAG_PRODUCT_SERVICES
|
||||
| ApplicationInfo.PRIVATE_FLAG_SYSTEM_EXT
|
||||
| ApplicationInfo.PRIVATE_FLAG_REQUIRED_FOR_SYSTEM_USER
|
||||
| ApplicationInfo.PRIVATE_FLAG_ODM);
|
||||
}
|
||||
|
||||
@@ -774,7 +774,7 @@ public final class Settings {
|
||||
| ApplicationInfo.PRIVATE_FLAG_OEM
|
||||
| ApplicationInfo.PRIVATE_FLAG_VENDOR
|
||||
| ApplicationInfo.PRIVATE_FLAG_PRODUCT
|
||||
| ApplicationInfo.PRIVATE_FLAG_PRODUCT_SERVICES
|
||||
| ApplicationInfo.PRIVATE_FLAG_SYSTEM_EXT
|
||||
| ApplicationInfo.PRIVATE_FLAG_ODM);
|
||||
pkgSetting.pkgFlags |= pkgFlags & ApplicationInfo.FLAG_SYSTEM;
|
||||
pkgSetting.pkgPrivateFlags |=
|
||||
@@ -786,7 +786,7 @@ public final class Settings {
|
||||
pkgSetting.pkgPrivateFlags |=
|
||||
pkgPrivateFlags & ApplicationInfo.PRIVATE_FLAG_PRODUCT;
|
||||
pkgSetting.pkgPrivateFlags |=
|
||||
pkgPrivateFlags & ApplicationInfo.PRIVATE_FLAG_PRODUCT_SERVICES;
|
||||
pkgPrivateFlags & ApplicationInfo.PRIVATE_FLAG_SYSTEM_EXT;
|
||||
pkgSetting.pkgPrivateFlags |=
|
||||
pkgPrivateFlags & ApplicationInfo.PRIVATE_FLAG_ODM;
|
||||
pkgSetting.primaryCpuAbiString = primaryCpuAbi;
|
||||
@@ -4413,7 +4413,7 @@ public final class Settings {
|
||||
ApplicationInfo.PRIVATE_FLAG_STATIC_SHARED_LIBRARY, "STATIC_SHARED_LIBRARY",
|
||||
ApplicationInfo.PRIVATE_FLAG_VENDOR, "VENDOR",
|
||||
ApplicationInfo.PRIVATE_FLAG_PRODUCT, "PRODUCT",
|
||||
ApplicationInfo.PRIVATE_FLAG_PRODUCT_SERVICES, "PRODUCT_SERVICES",
|
||||
ApplicationInfo.PRIVATE_FLAG_SYSTEM_EXT, "SYSTEM_EXT",
|
||||
ApplicationInfo.PRIVATE_FLAG_VIRTUAL_PRELOAD, "VIRTUAL_PRELOAD",
|
||||
ApplicationInfo.PRIVATE_FLAG_ODM, "ODM",
|
||||
};
|
||||
|
||||
@@ -1402,8 +1402,7 @@ public final class DefaultPermissionGrantPolicy {
|
||||
if (dir.isDirectory() && dir.canRead()) {
|
||||
Collections.addAll(ret, dir.listFiles());
|
||||
}
|
||||
dir = new File(Environment.getProductServicesDirectory(),
|
||||
"etc/default-permissions");
|
||||
dir = new File(Environment.getSystemExtDirectory(), "etc/default-permissions");
|
||||
if (dir.isDirectory() && dir.canRead()) {
|
||||
Collections.addAll(ret, dir.listFiles());
|
||||
}
|
||||
|
||||
@@ -1642,9 +1642,9 @@ public class PermissionManagerService {
|
||||
} else if (pkg.isProduct()) {
|
||||
wlPermissions =
|
||||
SystemConfig.getInstance().getProductPrivAppPermissions(pkg.packageName);
|
||||
} else if (pkg.isProductServices()) {
|
||||
} else if (pkg.isSystemExt()) {
|
||||
wlPermissions =
|
||||
SystemConfig.getInstance().getProductServicesPrivAppPermissions(
|
||||
SystemConfig.getInstance().getSystemExtPrivAppPermissions(
|
||||
pkg.packageName);
|
||||
} else {
|
||||
wlPermissions = SystemConfig.getInstance().getPrivAppPermissions(pkg.packageName);
|
||||
@@ -1678,9 +1678,9 @@ public class PermissionManagerService {
|
||||
} else if (pkg.isProduct()) {
|
||||
deniedPermissions = SystemConfig.getInstance()
|
||||
.getProductPrivAppDenyPermissions(pkg.packageName);
|
||||
} else if (pkg.isProductServices()) {
|
||||
} else if (pkg.isSystemExt()) {
|
||||
deniedPermissions = SystemConfig.getInstance()
|
||||
.getProductServicesPrivAppDenyPermissions(pkg.packageName);
|
||||
.getSystemExtPrivAppDenyPermissions(pkg.packageName);
|
||||
} else {
|
||||
deniedPermissions = SystemConfig.getInstance()
|
||||
.getPrivAppDenyPermissions(pkg.packageName);
|
||||
|
||||
@@ -115,7 +115,7 @@ public class PackageManagerServiceTest {
|
||||
|
||||
@Test
|
||||
public void testPartitions() throws Exception {
|
||||
String[] partitions = { "system", "vendor", "odm", "oem", "product", "product_services" };
|
||||
String[] partitions = { "system", "vendor", "odm", "oem", "product", "system_ext" };
|
||||
String[] appdir = { "app", "priv-app" };
|
||||
for (int i = 0; i < partitions.length; i++) {
|
||||
for (int j = 0; j < appdir.length; j++) {
|
||||
@@ -128,7 +128,7 @@ public class PackageManagerServiceTest {
|
||||
Assert.assertEquals(i == 1 || i == 2, PackageManagerService.locationIsVendor(path));
|
||||
Assert.assertEquals(i == 3, PackageManagerService.locationIsOem(path));
|
||||
Assert.assertEquals(i == 4, PackageManagerService.locationIsProduct(path));
|
||||
Assert.assertEquals(i == 5, PackageManagerService.locationIsProductServices(path));
|
||||
Assert.assertEquals(i == 5, PackageManagerService.locationIsSystemExt(path));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,16 +14,16 @@ prebuilt_etc {
|
||||
}
|
||||
|
||||
java_library {
|
||||
name: "com.android.test.libs.product_services",
|
||||
name: "com.android.test.libs.system_ext",
|
||||
installable: true,
|
||||
product_services_specific: true,
|
||||
srcs: ["product_services/java/**/*.java"],
|
||||
required: ["com.android.test.libs.product_services.xml"],
|
||||
system_ext_specific: true,
|
||||
srcs: ["system_ext/java/**/*.java"],
|
||||
required: ["com.android.test.libs.system_ext.xml"],
|
||||
}
|
||||
|
||||
prebuilt_etc {
|
||||
name: "com.android.test.libs.product_services.xml",
|
||||
src: "product_services/com.android.test.libs.product_services.xml",
|
||||
name: "com.android.test.libs.system_ext.xml",
|
||||
src: "system_ext/com.android.test.libs.system_ext.xml",
|
||||
sub_dir: "permissions",
|
||||
product_services_specific: true,
|
||||
system_ext_specific: true,
|
||||
}
|
||||
|
||||
@@ -15,6 +15,6 @@
|
||||
-->
|
||||
|
||||
<permissions>
|
||||
<library name="com.android.test.libs.product_services"
|
||||
file="/product_services/framework/com.android.test.libs.product_services.jar" />
|
||||
<library name="com.android.test.libs.system_ext"
|
||||
file="/system_ext/framework/com.android.test.libs.system_ext.jar" />
|
||||
</permissions>
|
||||
@@ -14,12 +14,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.test.libs.product_services;
|
||||
package com.android.test.libs.system_ext;
|
||||
|
||||
/**
|
||||
* Test class for product_services libs.
|
||||
* Test class for system_ext libs.
|
||||
*/
|
||||
public class LibsProductServicesTest {
|
||||
public class LibsSystemExtTest {
|
||||
|
||||
/**
|
||||
* Dummy method for testing.
|
||||
@@ -45,17 +45,17 @@ prebuilt_etc {
|
||||
}
|
||||
|
||||
android_app {
|
||||
name: "ProductServicesPrivAppPermissionTest",
|
||||
name: "SystemExtPrivAppPermissionTest",
|
||||
sdk_version: "current",
|
||||
privileged: true,
|
||||
manifest: "product_services/AndroidManifest.xml",
|
||||
product_services_specific: true,
|
||||
required: ["product_servicesprivapp-permissions-test.xml"],
|
||||
manifest: "system_ext/AndroidManifest.xml",
|
||||
system_ext_specific: true,
|
||||
required: ["system_extprivapp-permissions-test.xml"],
|
||||
}
|
||||
|
||||
prebuilt_etc {
|
||||
name: "product_servicesprivapp-permissions-test.xml",
|
||||
src: "product_services/privapp-permissions-test.xml",
|
||||
name: "system_extprivapp-permissions-test.xml",
|
||||
src: "system_ext/privapp-permissions-test.xml",
|
||||
sub_dir: "permissions",
|
||||
product_services_specific: true,
|
||||
system_ext_specific: true,
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
-->
|
||||
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.android.framework.permission.privapp.tests.product_services">
|
||||
package="com.android.framework.permission.privapp.tests.system_ext">
|
||||
|
||||
<!-- MANAGE_USB is signature|privileged -->
|
||||
<uses-permission android:name="android.permission.MANAGE_USB"/>
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<permissions>
|
||||
<privapp-permissions package="com.android.framework.permission.privapp.tests.product_services">
|
||||
<privapp-permissions package="com.android.framework.permission.privapp.tests.system_ext">
|
||||
<permission name="android.permission.MANAGE_USB"/>
|
||||
</privapp-permissions>
|
||||
</permissions>
|
||||
Reference in New Issue
Block a user