Merge "Add null check for vrManager" into pi-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
dd7047b4e8
@@ -26,7 +26,6 @@ import static android.os.HardwarePropertiesManager.TEMPERATURE_THROTTLING;
|
||||
import static android.os.HardwarePropertiesManager.TEMPERATURE_THROTTLING_BELOW_VR_MIN;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.AppOpsManager;
|
||||
import android.app.admin.DevicePolicyManager;
|
||||
import android.content.Context;
|
||||
@@ -34,8 +33,8 @@ import android.content.pm.PackageManager;
|
||||
import android.os.Binder;
|
||||
import android.os.CpuUsageInfo;
|
||||
import android.os.IHardwarePropertiesManager;
|
||||
import android.os.Process;
|
||||
import android.os.UserHandle;
|
||||
|
||||
import com.android.internal.util.DumpUtils;
|
||||
import com.android.server.vr.VrManagerInternal;
|
||||
|
||||
@@ -166,11 +165,11 @@ public class HardwarePropertiesManagerService extends IHardwarePropertiesManager
|
||||
final VrManagerInternal vrService = LocalServices.getService(VrManagerInternal.class);
|
||||
final DevicePolicyManager dpm = mContext.getSystemService(DevicePolicyManager.class);
|
||||
if (!dpm.isDeviceOwnerApp(callingPackage)
|
||||
&& !vrService.isCurrentVrListener(callingPackage, userId)
|
||||
&& mContext.checkCallingOrSelfPermission(Manifest.permission.DEVICE_POWER)
|
||||
!= PackageManager.PERMISSION_GRANTED) {
|
||||
throw new SecurityException("The caller is not a device owner, bound VrListenerService"
|
||||
+ ", or holding the DEVICE_POWER permission.");
|
||||
!= PackageManager.PERMISSION_GRANTED
|
||||
&& (vrService == null || !vrService.isCurrentVrListener(callingPackage, userId))) {
|
||||
throw new SecurityException("The caller is neither a device owner"
|
||||
+ ", nor holding the DEVICE_POWER permission, nor the current VrListener.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user