Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ad00d024 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Introduces VrManager as a system service."

parents 21c8595d 56345f4b
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -6204,6 +6204,10 @@ package android.app {
    method public void onDetached();
  }
  public class VrManager {
    method public void setPersistentVrModeEnabled(boolean);
  }
  public final class WallpaperInfo implements android.os.Parcelable {
    ctor public WallpaperInfo(android.content.Context, android.content.pm.ResolveInfo) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
    method public int describeContents();
@@ -9006,6 +9010,7 @@ package android.content {
    field public static final java.lang.String USB_SERVICE = "usb";
    field public static final java.lang.String USER_SERVICE = "user";
    field public static final java.lang.String VIBRATOR_SERVICE = "vibrator";
    field public static final java.lang.String VR_SERVICE = "vrmanager";
    field public static final java.lang.String WALLPAPER_SERVICE = "wallpaper";
    field public static final java.lang.String WIFI_AWARE_SERVICE = "wifiaware";
    field public static final java.lang.String WIFI_P2P_SERVICE = "wifip2p";
+9 −0
Original line number Diff line number Diff line
@@ -115,6 +115,7 @@ import android.print.PrintManager;
import android.service.autofill.IAutoFillManagerService;
import android.service.persistentdata.IPersistentDataBlockService;
import android.service.persistentdata.PersistentDataBlockManager;
import android.service.vr.IVrManager;
import android.telecom.TelecomManager;
import android.telephony.CarrierConfigManager;
import android.telephony.SubscriptionManager;
@@ -814,6 +815,14 @@ final class SystemServiceRegistry {
                IAutoFillManagerService service = IAutoFillManagerService.Stub.asInterface(b);
                return new AutoFillManager(ctx, service);
            }});

        registerService(Context.VR_SERVICE, VrManager.class, new CachedServiceFetcher<VrManager>() {
            @Override
            public VrManager createService(ContextImpl ctx) throws ServiceNotFoundException {
                IBinder b = ServiceManager.getServiceOrThrow(Context.VR_SERVICE);
                return new VrManager(IVrManager.Stub.asInterface(b));
            }
        });
    }

    /**
+44 −0
Original line number Diff line number Diff line
package android.app;


import android.annotation.SystemApi;
import android.content.ComponentName;
import android.os.RemoteException;
import android.service.vr.IVrManager;

/**
 * Used to control aspects of a devices Virtual Reality (VR) capabilities.
 * <p>
 * You do not instantiate this class directly; instead, retrieve it through
 * {@link android.content.Context#getSystemService}.
 * @hide
 */
@SystemApi
public class VrManager {
    private final IVrManager mService;

    /**
     * {@hide}
     */
    public VrManager(IVrManager service) {
        mService = service;
    }

    /**
     * Sets the persistent VR mode state of a device. When a device is in persistent VR mode it will
     * remain in VR mode even if the foreground does not specify Vr mode being enabled. Mainly used
     * by VR viewers to indicate that a device is placed in a VR viewer.
     *
     * <p>Requires {@link android.Manifest.permission#ACCESS_VR_MANAGER} permission.</p>
     *
     * @see Activity#setVrModeEnabled(boolean, ComponentName)
     * @param enabled true if the device should be placed in persistent VR mode.
     */
    public void setPersistentVrModeEnabled(boolean enabled) {
        try {
            mService.setPersistentVrModeEnabled(enabled);
        } catch (RemoteException e) {
            e.rethrowFromSystemServer();
        }
    }
}
+11 −0
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ import android.annotation.UserIdInt;
import android.app.IApplicationThread;
import android.app.IServiceConnection;
import android.app.Notification;
import android.app.VrManager;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.res.AssetManager;
@@ -3763,6 +3764,16 @@ public abstract class Context {
     */
    public static final String OVERLAY_SERVICE = "overlay";

    /**
     * Use with {@link #getSystemService} to retrieve a
     * {@link VrManager} for accessing the VR service.
     *
     * @see #getSystemService
     * @hide
     */
    @SystemApi
    public static final String VR_SERVICE = "vrmanager";

    /**
     * Determine whether the given permission is allowed for a particular
     * process and user ID running in the system.
+8 −0
Original line number Diff line number Diff line
@@ -42,5 +42,13 @@ interface IVrManager {
     */
    boolean getVrModeState();

    /**
     * Sets the persistent VR mode state of a device. When a device is in persistent VR mode it will
     * remain in VR mode even if the foreground does not specify VR mode being enabled. Mainly used
     * by VR viewers to indicate that a device is placed in a VR viewer.
     *
     * @param enabled true if the device should be placed in persistent VR mode.
     */
    void setPersistentVrModeEnabled(in boolean enabled);
}
Loading