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);
}
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.");
}
}
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);
}
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);
}
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.");
}
}
Aggregations