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

Commit 6a8d3dc6 authored by Evan Severson's avatar Evan Severson
Browse files

Remove package manager feature for toggles

Create a dedicated api in the sensor privacy service to check if the
toggle is supported.

Also address some other api feedback and also rename the older mute
feature to all-sensors so that there are no longer overloaded methods
with different functions.

Test: Checkbuild, CtsSensorPrivacyTestCases, Manual
Fixes: 181681375
Change-Id: I655544846310e864ec8479ce8f93aee2860824f7
parent 33c1862f
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -17694,6 +17694,15 @@ package android.hardware {
    method public void onDynamicSensorDisconnected(android.hardware.Sensor);
  }
  public final class SensorPrivacyManager {
    method public boolean supportsSensorToggle(int);
  }
  public static class SensorPrivacyManager.Sensors {
    field public static final int CAMERA = 2; // 0x2
    field public static final int MICROPHONE = 1; // 0x1
  }
  public final class TriggerEvent {
    field public android.hardware.Sensor sensor;
    field public long timestamp;
+1 −8
Original line number Diff line number Diff line
@@ -2731,10 +2731,8 @@ package android.content.pm {
    field public static final String EXTRA_REQUEST_PERMISSIONS_NAMES = "android.content.pm.extra.REQUEST_PERMISSIONS_NAMES";
    field public static final String EXTRA_REQUEST_PERMISSIONS_RESULTS = "android.content.pm.extra.REQUEST_PERMISSIONS_RESULTS";
    field public static final String FEATURE_BROADCAST_RADIO = "android.hardware.broadcastradio";
    field public static final String FEATURE_CAMERA_TOGGLE = "android.hardware.camera.toggle";
    field public static final String FEATURE_CONTEXT_HUB = "android.hardware.context_hub";
    field public static final String FEATURE_INCREMENTAL_DELIVERY = "android.software.incremental_delivery";
    field public static final String FEATURE_MICROPHONE_TOGGLE = "android.hardware.microphone.toggle";
    field public static final String FEATURE_REBOOT_ESCROW = "android.hardware.reboot_escrow";
    field public static final String FEATURE_TELEPHONY_CARRIERLOCK = "android.hardware.telephony.carrierlock";
    field public static final String FEATURE_TELEPHONY_IMS_SINGLE_REGISTRATION = "android.hardware.telephony.ims.singlereg";
@@ -3115,12 +3113,7 @@ package android.hardware {
  }
  public static interface SensorPrivacyManager.OnSensorPrivacyChangedListener {
    method public void onSensorPrivacyChanged(boolean);
  }
  public static class SensorPrivacyManager.Sensors {
    field public static final int CAMERA = 2; // 0x2
    field public static final int MICROPHONE = 1; // 0x1
    method public void onSensorPrivacyChanged(int, boolean);
  }
}
+0 −15
Original line number Diff line number Diff line
@@ -817,10 +817,8 @@ package android.content.pm {
    method public void holdLock(android.os.IBinder, int);
    method @RequiresPermission(android.Manifest.permission.KEEP_UNINSTALLED_PACKAGES) public void setKeepUninstalledPackages(@NonNull java.util.List<java.lang.String>);
    field public static final String FEATURE_ADOPTABLE_STORAGE = "android.software.adoptable_storage";
    field public static final String FEATURE_CAMERA_TOGGLE = "android.hardware.camera.toggle";
    field public static final String FEATURE_FILE_BASED_ENCRYPTION = "android.software.file_based_encryption";
    field public static final String FEATURE_HDMI_CEC = "android.hardware.hdmi.cec";
    field public static final String FEATURE_MICROPHONE_TOGGLE = "android.hardware.microphone.toggle";
    field public static final int FLAG_PERMISSION_REVOKE_WHEN_REQUESTED = 128; // 0x80
    field public static final int MATCH_KNOWN_PACKAGES = 4202496; // 0x402000
    field public static final String SYSTEM_SHARED_LIBRARY_SERVICES = "android.ext.services";
@@ -1045,23 +1043,10 @@ package android.graphics.fonts {
package android.hardware {

  public final class SensorPrivacyManager {
    method @RequiresPermission(android.Manifest.permission.OBSERVE_SENSOR_PRIVACY) public void addSensorPrivacyListener(int, @NonNull android.hardware.SensorPrivacyManager.OnSensorPrivacyChangedListener);
    method @RequiresPermission(android.Manifest.permission.OBSERVE_SENSOR_PRIVACY) public void addSensorPrivacyListener(int, @NonNull java.util.concurrent.Executor, @NonNull android.hardware.SensorPrivacyManager.OnSensorPrivacyChangedListener);
    method @RequiresPermission(android.Manifest.permission.OBSERVE_SENSOR_PRIVACY) public boolean isSensorPrivacyEnabled(int);
    method @RequiresPermission(android.Manifest.permission.OBSERVE_SENSOR_PRIVACY) public void removeSensorPrivacyListener(@NonNull android.hardware.SensorPrivacyManager.OnSensorPrivacyChangedListener);
    method @RequiresPermission(android.Manifest.permission.MANAGE_SENSOR_PRIVACY) public void setSensorPrivacy(int, boolean);
    method @RequiresPermission(android.Manifest.permission.MANAGE_SENSOR_PRIVACY) public void setSensorPrivacyForProfileGroup(int, boolean);
  }

  public static interface SensorPrivacyManager.OnSensorPrivacyChangedListener {
    method public void onSensorPrivacyChanged(boolean);
  }

  public static class SensorPrivacyManager.Sensors {
    field public static final int CAMERA = 2; // 0x2
    field public static final int MICROPHONE = 1; // 0x1
  }

}

package android.hardware.biometrics {
+0 −26
Original line number Diff line number Diff line
@@ -3653,32 +3653,6 @@ public abstract class PackageManager {
    @SdkConstant(SdkConstantType.FEATURE)
    public static final String FEATURE_TUNER = "android.hardware.tv.tuner";

    /**
     * Feature for {@link #getSystemAvailableFeatures} and
     * {@link #hasSystemFeature}: The device supports a enabling/disabling sensor privacy for
     * microphone. When sensory privacy for the microphone is enabled no microphone data is sent to
     * clients, e.g. all audio data is silent.
     *
     * @hide
     */
    @SystemApi
    @TestApi
    @SdkConstant(SdkConstantType.FEATURE)
    public static final String FEATURE_MICROPHONE_TOGGLE = "android.hardware.microphone.toggle";

    /**
     * Feature for {@link #getSystemAvailableFeatures} and
     * {@link #hasSystemFeature}: The device supports a enabling/disabling sensor privacy for
     * camera. When sensory privacy for the camera is enabled no camera data is sent to clients,
     * e.g. the view finder in a camera app would appear blank.
     *
     * @hide
     */
    @SystemApi
    @TestApi
    @SdkConstant(SdkConstantType.FEATURE)
    public static final String FEATURE_CAMERA_TOGGLE = "android.hardware.camera.toggle";

    /**
     * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: The device has
     * the necessary changes to support app enumeration.
+2 −0
Original line number Diff line number Diff line
@@ -24,6 +24,8 @@ interface ISensorPrivacyManager {
    // the ones in
    //   frameworks/native/libs/sensorprivacy/aidl/android/hardware/ISensorPrivacyManager.aidl
    // =============== Beginning of transactions used on native side as well ======================
    boolean supportsSensorToggle(int sensor);

    void addSensorPrivacyListener(in ISensorPrivacyListener listener);

    void addIndividualSensorPrivacyListener(int userId, int sensor,
Loading