Merge "Add permission check on disabling sensor privacy" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
6194c49caf
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.server;
|
||||
|
||||
import static android.Manifest.permission.MANAGE_SENSOR_PRIVACY;
|
||||
import static android.app.ActivityManager.RunningServiceInfo;
|
||||
import static android.app.ActivityManager.RunningTaskInfo;
|
||||
import static android.app.AppOpsManager.MODE_ALLOWED;
|
||||
@@ -197,7 +198,8 @@ public final class SensorPrivacyService extends SystemService {
|
||||
Intent.EXTRA_USER)).getIdentifier(),
|
||||
intent.getIntExtra(EXTRA_SENSOR, UNKNOWN), false);
|
||||
}
|
||||
}, new IntentFilter(ACTION_DISABLE_INDIVIDUAL_SENSOR_PRIVACY));
|
||||
}, new IntentFilter(ACTION_DISABLE_INDIVIDUAL_SENSOR_PRIVACY),
|
||||
MANAGE_SENSOR_PRIVACY, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -460,12 +462,12 @@ public final class SensorPrivacyService extends SystemService {
|
||||
*/
|
||||
private void enforceSensorPrivacyPermission() {
|
||||
if (mContext.checkCallingOrSelfPermission(
|
||||
android.Manifest.permission.MANAGE_SENSOR_PRIVACY) == PERMISSION_GRANTED) {
|
||||
MANAGE_SENSOR_PRIVACY) == PERMISSION_GRANTED) {
|
||||
return;
|
||||
}
|
||||
throw new SecurityException(
|
||||
"Changing sensor privacy requires the following permission: "
|
||||
+ android.Manifest.permission.MANAGE_SENSOR_PRIVACY);
|
||||
+ MANAGE_SENSOR_PRIVACY);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user