Merge "@EnforcePermission migrations - framework-minus-apex"
This commit is contained in:
committed by
Android (Google) Code Review
commit
13e657b87f
@@ -88,34 +88,34 @@ public class ActivityRecognitionHardware extends IActivityRecognitionHardware.St
|
||||
return nativeIsSupported();
|
||||
}
|
||||
|
||||
@android.annotation.EnforcePermission(android.Manifest.permission.LOCATION_HARDWARE)
|
||||
@Override
|
||||
public String[] getSupportedActivities() {
|
||||
checkPermissions();
|
||||
return mSupportedActivities;
|
||||
}
|
||||
|
||||
@android.annotation.EnforcePermission(android.Manifest.permission.LOCATION_HARDWARE)
|
||||
@Override
|
||||
public boolean isActivitySupported(String activity) {
|
||||
checkPermissions();
|
||||
int activityType = getActivityType(activity);
|
||||
return activityType != INVALID_ACTIVITY_TYPE;
|
||||
}
|
||||
|
||||
@android.annotation.EnforcePermission(android.Manifest.permission.LOCATION_HARDWARE)
|
||||
@Override
|
||||
public boolean registerSink(IActivityRecognitionHardwareSink sink) {
|
||||
checkPermissions();
|
||||
return mSinks.register(sink);
|
||||
}
|
||||
|
||||
@android.annotation.EnforcePermission(android.Manifest.permission.LOCATION_HARDWARE)
|
||||
@Override
|
||||
public boolean unregisterSink(IActivityRecognitionHardwareSink sink) {
|
||||
checkPermissions();
|
||||
return mSinks.unregister(sink);
|
||||
}
|
||||
|
||||
@android.annotation.EnforcePermission(android.Manifest.permission.LOCATION_HARDWARE)
|
||||
@Override
|
||||
public boolean enableActivityEvent(String activity, int eventType, long reportLatencyNs) {
|
||||
checkPermissions();
|
||||
|
||||
int activityType = getActivityType(activity);
|
||||
if (activityType == INVALID_ACTIVITY_TYPE) {
|
||||
@@ -130,9 +130,9 @@ public class ActivityRecognitionHardware extends IActivityRecognitionHardware.St
|
||||
return false;
|
||||
}
|
||||
|
||||
@android.annotation.EnforcePermission(android.Manifest.permission.LOCATION_HARDWARE)
|
||||
@Override
|
||||
public boolean disableActivityEvent(String activity, int eventType) {
|
||||
checkPermissions();
|
||||
|
||||
int activityType = getActivityType(activity);
|
||||
if (activityType == INVALID_ACTIVITY_TYPE) {
|
||||
@@ -147,9 +147,9 @@ public class ActivityRecognitionHardware extends IActivityRecognitionHardware.St
|
||||
return false;
|
||||
}
|
||||
|
||||
@android.annotation.EnforcePermission(android.Manifest.permission.LOCATION_HARDWARE)
|
||||
@Override
|
||||
public boolean flush() {
|
||||
checkPermissions();
|
||||
int result = nativeFlush();
|
||||
return result == NATIVE_SUCCESS_RESULT;
|
||||
}
|
||||
|
||||
@@ -28,35 +28,42 @@ interface IActivityRecognitionHardware {
|
||||
/**
|
||||
* Gets an array of supported activities by hardware.
|
||||
*/
|
||||
@EnforcePermission("LOCATION_HARDWARE")
|
||||
String[] getSupportedActivities();
|
||||
|
||||
/**
|
||||
* Returns true if the given activity is supported, false otherwise.
|
||||
*/
|
||||
@EnforcePermission("LOCATION_HARDWARE")
|
||||
boolean isActivitySupported(in String activityType);
|
||||
|
||||
/**
|
||||
* Registers a sink with Hardware Activity-Recognition.
|
||||
*/
|
||||
@EnforcePermission("LOCATION_HARDWARE")
|
||||
boolean registerSink(in IActivityRecognitionHardwareSink sink);
|
||||
|
||||
/**
|
||||
* Unregisters a sink with Hardware Activity-Recognition.
|
||||
*/
|
||||
@EnforcePermission("LOCATION_HARDWARE")
|
||||
boolean unregisterSink(in IActivityRecognitionHardwareSink sink);
|
||||
|
||||
/**
|
||||
* Enables tracking of a given activity/event type, if the activity is supported.
|
||||
*/
|
||||
@EnforcePermission("LOCATION_HARDWARE")
|
||||
boolean enableActivityEvent(in String activityType, int eventType, long reportLatencyNs);
|
||||
|
||||
/**
|
||||
* Disables tracking of a given activity/eventy type.
|
||||
*/
|
||||
@EnforcePermission("LOCATION_HARDWARE")
|
||||
boolean disableActivityEvent(in String activityType, int eventType);
|
||||
|
||||
/**
|
||||
* Requests hardware for all the activity events detected up to the given point in time.
|
||||
*/
|
||||
@EnforcePermission("LOCATION_HARDWARE")
|
||||
boolean flush();
|
||||
}
|
||||
Reference in New Issue
Block a user