import android.os.RemoteException;
import android.service.vr.IVrManager;
+import java.io.FileDescriptor;
+
/**
* Used to control aspects of a devices Virtual Reality (VR) capabilities.
* <p>
e.rethrowFromSystemServer();
}
}
+
+ /**
+ * Initiate connection for system controller data.
+ *
+ * @param fd Controller data file descriptor.
+ *
+ * {@hide}
+ */
+ public void connectController(FileDescriptor fd) {
+ try {
+ mService.connectController(fd);
+ } catch (RemoteException e) {
+ e.rethrowFromSystemServer();
+ }
+ }
+
+ /**
+ * Sever connection for system controller data.
+ *
+ * {@hide}
+ */
+ public void disconnectController() {
+ try {
+ mService.disconnectController();
+ } catch (RemoteException e) {
+ e.rethrowFromSystemServer();
+ }
+ }
}
* currently, else return the display id of the virtual display
*/
int getCompatibilityDisplayId();
+
+ /**
+ * Initiate connection for system controller data.
+ *
+ * @param fd Controller data file descriptor.
+ */
+ void connectController(in FileDescriptor fd);
+
+ /**
+ * Sever connection for system controller data.
+ */
+ void disconnectController();
}
import android.os.Message;
import android.os.RemoteCallbackList;
import android.os.RemoteException;
+import android.os.ServiceManager;
import android.os.UserHandle;
import android.provider.Settings;
import android.service.notification.NotificationListenerService;
import android.service.vr.IVrListener;
import android.service.vr.IVrManager;
import android.service.vr.IVrStateCallbacks;
+import android.service.vr.IVrWindowManager;
import android.service.vr.VrListenerService;
import android.text.TextUtils;
import android.util.ArrayMap;
}
@Override
+ public void connectController(FileDescriptor fd) throws android.os.RemoteException {
+ enforceCallerPermission(Manifest.permission.RESTRICTED_VR_ACCESS);
+ VrManagerService.this.connectController(fd);
+ }
+
+ @Override
+ public void disconnectController() throws android.os.RemoteException {
+ enforceCallerPermission(Manifest.permission.RESTRICTED_VR_ACCESS);
+ VrManagerService.this.disconnectController();
+ }
+
+ @Override
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
if (getContext().checkCallingOrSelfPermission(android.Manifest.permission.DUMP)
!= PackageManager.PERMISSION_GRANTED) {
return mVrModeEnabled;
}
}
+
+ private void connectController(FileDescriptor fd) throws android.os.RemoteException {
+ // TODO(b/36506799): move vr_wm code to VrCore and remove this.
+ IVrWindowManager remote =
+ IVrWindowManager.Stub.asInterface(
+ ServiceManager.getService(IVrWindowManager.SERVICE_NAME));
+ remote.connectController(fd);
+ }
+
+ private void disconnectController() throws android.os.RemoteException {
+ // TODO(b/36506799): move vr_wm code to VrCore and remove this.
+ IVrWindowManager remote =
+ IVrWindowManager.Stub.asInterface(
+ ServiceManager.getService(IVrWindowManager.SERVICE_NAME));
+ remote.disconnectController();
+ }
}