Search in sources :

Example 1 with VrManagerInternal

use of com.android.server.vr.VrManagerInternal in project android_frameworks_base by ResurrectionRemix.

the class PhoneWindowManager method reportScreenStateToVrManager.

private void reportScreenStateToVrManager(boolean isScreenOn) {
    VrManagerInternal vrService = LocalServices.getService(VrManagerInternal.class);
    if (vrService == null) {
        return;
    }
    vrService.onScreenStateChanged(isScreenOn);
}
Also used : VrManagerInternal(com.android.server.vr.VrManagerInternal)

Example 2 with VrManagerInternal

use of com.android.server.vr.VrManagerInternal in project android_frameworks_base by DirtyUnicorns.

the class HardwarePropertiesManagerService method enforceHardwarePropertiesRetrievalAllowed.

/**
     * Throws SecurityException if the calling package is not allowed to retrieve information
     * provided by the service.
     *
     * @param callingPackage The calling package name.
     *
     * @throws SecurityException if something other than the profile or device owner, the
     *        current VR service, or a caller holding the {@link Manifest.permission#DEVICE_POWER}
     *        permission tries to retrieve information provided by this service.
     */
private void enforceHardwarePropertiesRetrievalAllowed(String callingPackage) throws SecurityException {
    final PackageManager pm = mContext.getPackageManager();
    int uid = 0;
    try {
        uid = pm.getPackageUid(callingPackage, 0);
        if (Binder.getCallingUid() != uid) {
            throw new SecurityException("The caller has faked the package name.");
        }
    } catch (PackageManager.NameNotFoundException e) {
        throw new SecurityException("The caller has faked the package name.");
    }
    final int userId = UserHandle.getUserId(uid);
    final VrManagerInternal vrService = LocalServices.getService(VrManagerInternal.class);
    final DevicePolicyManager dpm = mContext.getSystemService(DevicePolicyManager.class);
    if (!dpm.isDeviceOwnerApp(callingPackage) && !dpm.isProfileOwnerApp(callingPackage) && !vrService.isCurrentVrListener(callingPackage, userId) && mContext.checkCallingOrSelfPermission(Manifest.permission.DEVICE_POWER) != PackageManager.PERMISSION_GRANTED) {
        throw new SecurityException("The caller is not a device or profile owner, bound " + "VrListenerService, or holding the DEVICE_POWER permission.");
    }
}
Also used : DevicePolicyManager(android.app.admin.DevicePolicyManager) PackageManager(android.content.pm.PackageManager) VrManagerInternal(com.android.server.vr.VrManagerInternal)

Example 3 with VrManagerInternal

use of com.android.server.vr.VrManagerInternal in project android_frameworks_base by DirtyUnicorns.

the class PhoneWindowManager method reportScreenStateToVrManager.

private void reportScreenStateToVrManager(boolean isScreenOn) {
    VrManagerInternal vrService = LocalServices.getService(VrManagerInternal.class);
    if (vrService == null) {
        return;
    }
    vrService.onScreenStateChanged(isScreenOn);
}
Also used : VrManagerInternal(com.android.server.vr.VrManagerInternal)

Example 4 with VrManagerInternal

use of com.android.server.vr.VrManagerInternal in project android_frameworks_base by DirtyUnicorns.

the class ActivityManagerService method notifyVrManagerOfSleepState.

private void notifyVrManagerOfSleepState(boolean isSleeping) {
    final VrManagerInternal vrService = LocalServices.getService(VrManagerInternal.class);
    if (vrService == null) {
        return;
    }
    vrService.onSleepStateChanged(isSleeping);
}
Also used : VrManagerInternal(com.android.server.vr.VrManagerInternal)

Example 5 with VrManagerInternal

use of com.android.server.vr.VrManagerInternal in project android_frameworks_base by AOSPA.

the class HardwarePropertiesManagerService method enforceHardwarePropertiesRetrievalAllowed.

/**
     * Throws SecurityException if the calling package is not allowed to retrieve information
     * provided by the service.
     *
     * @param callingPackage The calling package name.
     *
     * @throws SecurityException if something other than the profile or device owner, the
     *        current VR service, or a caller holding the {@link Manifest.permission#DEVICE_POWER}
     *        permission tries to retrieve information provided by this service.
     */
private void enforceHardwarePropertiesRetrievalAllowed(String callingPackage) throws SecurityException {
    final PackageManager pm = mContext.getPackageManager();
    int uid = 0;
    try {
        uid = pm.getPackageUid(callingPackage, 0);
        if (Binder.getCallingUid() != uid) {
            throw new SecurityException("The caller has faked the package name.");
        }
    } catch (PackageManager.NameNotFoundException e) {
        throw new SecurityException("The caller has faked the package name.");
    }
    final int userId = UserHandle.getUserId(uid);
    final VrManagerInternal vrService = LocalServices.getService(VrManagerInternal.class);
    final DevicePolicyManager dpm = mContext.getSystemService(DevicePolicyManager.class);
    if (!dpm.isDeviceOwnerApp(callingPackage) && !dpm.isProfileOwnerApp(callingPackage) && !vrService.isCurrentVrListener(callingPackage, userId) && mContext.checkCallingOrSelfPermission(Manifest.permission.DEVICE_POWER) != PackageManager.PERMISSION_GRANTED) {
        throw new SecurityException("The caller is not a device or profile owner, bound " + "VrListenerService, or holding the DEVICE_POWER permission.");
    }
}
Also used : DevicePolicyManager(android.app.admin.DevicePolicyManager) PackageManager(android.content.pm.PackageManager) VrManagerInternal(com.android.server.vr.VrManagerInternal)

Aggregations

VrManagerInternal (com.android.server.vr.VrManagerInternal)10 DevicePolicyManager (android.app.admin.DevicePolicyManager)5 PackageManager (android.content.pm.PackageManager)5 Point (android.graphics.Point)2