Register managers provided by the com.android.virt APEX

This allows apps to retrieve an instance of VirtualMachineManager via
Context.getSystemService() API.

Bug: 249093790
Test: builds
Test: atest --test-mapping packages/modules/Virtualization:avf-presubmit
Change-Id: I488c275343753f2a3af6270cbad2ab02f33f203f
This commit is contained in:
Nikita Ioffe
2022-11-16 15:56:02 +00:00
parent d567dc56b8
commit 167b913ad4
3 changed files with 18 additions and 0 deletions

View File

@@ -3146,6 +3146,7 @@ package android.content {
field public static final String TRANSLATION_MANAGER_SERVICE = "translation";
field public static final String UI_TRANSLATION_SERVICE = "ui_translation";
field public static final String UWB_SERVICE = "uwb";
field public static final String VIRTUALIZATION_SERVICE = "virtualization";
field public static final String VR_SERVICE = "vrmanager";
field public static final String WALLPAPER_EFFECTS_GENERATION_SERVICE = "wallpaper_effects_generation";
field public static final String WEARABLE_SENSING_SERVICE = "wearable_sensing";

View File

@@ -210,6 +210,7 @@ import android.service.oemlock.OemLockManager;
import android.service.persistentdata.IPersistentDataBlockService;
import android.service.persistentdata.PersistentDataBlockManager;
import android.service.vr.IVrManager;
import android.system.virtualmachine.VirtualizationFrameworkInitializer;
import android.telecom.TelecomManager;
import android.telephony.MmsManager;
import android.telephony.TelephonyFrameworkInitializer;
@@ -1566,6 +1567,7 @@ public final class SystemServiceRegistry {
NearbyFrameworkInitializer.registerServiceWrappers();
OnDevicePersonalizationFrameworkInitializer.registerServiceWrappers();
DeviceLockFrameworkInitializer.registerServiceWrappers();
VirtualizationFrameworkInitializer.registerServiceWrappers();
} finally {
// If any of the above code throws, we're in a pretty bad shape and the process
// will likely crash, but we'll reset it just in case there's an exception handler...

View File

@@ -3939,6 +3939,7 @@ public abstract class Context {
DISPLAY_HASH_SERVICE,
CREDENTIAL_SERVICE,
DEVICE_LOCK_SERVICE,
VIRTUALIZATION_SERVICE,
})
@Retention(RetentionPolicy.SOURCE)
public @interface ServiceName {}
@@ -6113,6 +6114,20 @@ public abstract class Context {
*/
public static final String DEVICE_LOCK_SERVICE = "device_lock";
/**
* Use with {@link #getSystemService(String)} to retrieve a
* {@link android.system.virtualmachine.VirtualMachineManager}.
*
* <p>On devices without {@link PackageManager#FEATURE_VIRTUALIZATION_FRAMEWORK} system feature
* the {@link #getSystemService(String)} will return {@code null}.
*
* @see #getSystemService(String)
* @see android.system.virtualmachine.VirtualMachineManager
* @hide
*/
@SystemApi
public static final String VIRTUALIZATION_SERVICE = "virtualization";
/**
* Determine whether the given permission is allowed for a particular
* process and user ID running in the system.