VrManagerInternal.java revision c7be3beced4ade05466a4a77c003ea81c2429f74
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 * 47 * @param enabled {@code true} to enable VR mode. 48 * @param packageName The package name of the requested VrListenerService to bind. 49 * @param userId the user requesting the VrListenerService component. 50 * @param calling the component currently using VR mode, or null to leave unchanged. 51 */ 52 public abstract void setVrMode(boolean enabled, @NonNull ComponentName packageName, 53 int userId, @NonNull ComponentName calling); 54 55 /** 56 * Return NO_ERROR if the given package is installed on the device and enabled as a 57 * VrListenerService for the given current user, or a negative error code indicating a failure. 58 * 59 * @param packageName the name of the package to check, or null to select the default package. 60 * @return NO_ERROR if the given package is installed and is enabled, or a negative error code 61 * given in {@link android.service.vr.VrModeException} on failure. 62 */ 63 public abstract int hasVrPackage(@NonNull ComponentName packageName, int userId); 64 65} 66