Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1b6a6d0f authored by mattgilbride's avatar mattgilbride
Browse files

@EnforcePermission migrations - framework-minus-apex

Immediate calls to helper methods that themselves call
permission checks OTHER THAN Context.enforceCallingOrSelfPermission.
Fixes applied by Android Lint (cl/18432857).

Bug: 232058525
Test: N/A
Change-Id: Ib0fc48fe50ca1317668194474324e99bef9c44ea
parent 5f27b968
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -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;
    }
+7 −0
Original line number Diff line number Diff line
@@ -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();
}
 No newline at end of file