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

Commit 1b41cc95 authored by Aravind Akella's avatar Aravind Akella
Browse files

Use LOCATION_HARDWARE permission for data injection.

Change-Id: I59c1e1e97a6a0457f6fc2984b214647814895cf2
parent abcbf05c
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1570,7 +1570,7 @@ public abstract class SensorManager {
     * Significant Motion, Step Counter etc.
     *
     * The tests which call this API need to have {@code
     * android.permission.HARDWARE_TEST} permission which isn't
     * android.permission.LOCATION_HADWARE} permission which isn't
     * available for third party applications.
     *
     * @param enable True to set the HAL in DATA_INJECTION mode.
@@ -1600,7 +1600,7 @@ public abstract class SensorManager {
     * the HAL is already in data injection mode.
     *
     * The tests which call this API need to have {@code
     * android.permission.HARDWARE_TEST} permission which isn't
     * android.permission.LOCATION_HARDWARE} permission which isn't
     * available for third party applications.
     *
     * @param sensor The sensor to inject.
+3 −3
Original line number Diff line number Diff line
@@ -80,7 +80,7 @@ public class SystemSensorManager extends SensorManager {
                nativeClassInit();
            }
            mHasDataInjectionPermissions = context.checkSelfPermission(
                    Manifest.permission.HARDWARE_TEST) == PackageManager.PERMISSION_GRANTED;
                    Manifest.permission.LOCATION_HARDWARE) == PackageManager.PERMISSION_GRANTED;
        }

        // initialize the sensor list
@@ -233,7 +233,7 @@ public class SystemSensorManager extends SensorManager {
    protected boolean enableDataInjectionImpl(boolean enable) {
        if (!mHasDataInjectionPermissions) {
            throw new SecurityException("Permission denial. Calling enableDataInjection without "
                    + Manifest.permission.HARDWARE_TEST);
                    + Manifest.permission.LOCATION_HARDWARE);
        }
        synchronized (mLock) {
            int ret = nativeEnableDataInjection(mNativeInstance, enable);
@@ -256,7 +256,7 @@ public class SystemSensorManager extends SensorManager {
            long timestamp) {
        if (!mHasDataInjectionPermissions) {
            throw new SecurityException("Permission denial. Calling injectSensorData without "
                    + Manifest.permission.HARDWARE_TEST);
                    + Manifest.permission.LOCATION_HARDWARE);
        }
        synchronized (mLock) {
            if (!mDataInjectionMode) {