VrManagerInternal.java revision bbb5b6e8db346df613c15447c0697def8a76584d
1/** 2 * Copyright (C) 2015 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16package com.android.server.vr; 17 18import android.annotation.NonNull; 19import android.content.ComponentName; 20 21/** 22 * Service for accessing the VR mode manager. 23 * 24 * @hide Only for use within system server. 25 */ 26public abstract class VrManagerInternal { 27 28 /** 29 * The error code returned on success. 30 */ 31 public static final int NO_ERROR = 0; 32 33 /** 34 * Return {@code true} if the given package is the currently bound VrListenerService for the 35 * given user. 36 * 37 * @param packageName The package name to check. 38 * @param userId the user ID to check the package name for. 39 * 40 * @return {@code true} if the given package is the currently bound VrListenerService. 41 */ 42 public abstract boolean isCurrentVrListener(String packageName, int userId); 43 44 /** 45 * Set the current VR mode state. 46 * <p/> 47 * This may delay the mode change slightly during application transitions to avoid frequently 48 * tearing down VrListenerServices unless necessary. 49 * 50 * @param enabled {@code true} to enable VR mode. 51 * @param packageName The package name of the requested VrListenerService to bind. 52 * @param userId the user requesting the VrListenerService component. 53 * @param calling the component currently using VR mode, or null to leave unchanged. 54 */ 55 public abstract void setVrMode(boolean enabled, @NonNull ComponentName packageName, 56 int userId, @NonNull ComponentName calling); 57 58 /** 59 * Set the current VR mode state immediately. 60 * 61 * @param enabled {@code true} to enable VR mode. 62 * @param packageName The package name of the requested VrListenerService to bind. 63 * @param userId the user requesting the VrListenerService component. 64 * @param calling the component currently using VR mode, or null to leave unchanged. 65 */ 66 public abstract void setVrModeImmediate(boolean enabled, @NonNull ComponentName packageName, 67 int userId, @NonNull ComponentName calling); 68 69 70 /** 71 * Return NO_ERROR if the given package is installed on the device and enabled as a 72 * VrListenerService for the given current user, or a negative error code indicating a failure. 73 * 74 * @param packageName the name of the package to check, or null to select the default package. 75 * @return NO_ERROR if the given package is installed and is enabled, or a negative error code 76 * given in {@link android.service.vr.VrModeException} on failure. 77 */ 78 public abstract int hasVrPackage(@NonNull ComponentName packageName, int userId); 79 80} 81