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

Commit 6cc49065 authored by Philip P. Moltmann's avatar Philip P. Moltmann
Browse files

Fine tune what sensor use UI to show

Sometimes we want to show a dialog, sometimes a notification, sometimes
nothing.

- Also some minor UI tuning to match mocks.
- Also suppress dialog while dialog is visible and shortly after. This
  avoids a dialog directly after closing previous dialog.

Test: Triggered dialog. Needs exhaustive test of all
      cases though.
Bug: 162549680
Change-Id: I52ccd22858969823d8670a9e345d3da994ec1c19
parent bc503754
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -41,4 +41,7 @@ interface ISensorPrivacyManager {

    void setIndividualSensorPrivacyForProfileGroup(int userId, int sensor, boolean enable);
    // =============== End of transactions used on native side as well ============================

    void suppressIndividualSensorPrivacyReminders(int userId, String packageName, IBinder token,
            boolean suppress);
}
 No newline at end of file
+31 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.annotation.RequiresPermission;
import android.annotation.SystemService;
import android.annotation.TestApi;
import android.content.Context;
import android.os.Binder;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.ServiceManager;
@@ -44,6 +45,18 @@ import java.lang.annotation.RetentionPolicy;
@TestApi
@SystemService(Context.SENSOR_PRIVACY_SERVICE)
public final class SensorPrivacyManager {
    /**
     * Unique Id of this manager to identify to the service
     * @hide
     */
    private IBinder token = new Binder();

    /**
     * An extra containing a sensor
     * @hide
     */
    public static final String EXTRA_SENSOR = SensorPrivacyManager.class.getName()
            + ".extra.sensor";

    /** Microphone
     * @hide */
@@ -299,4 +312,22 @@ public final class SensorPrivacyManager {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * Don't show dialogs to turn off sensor privacy for this package.
     *
     * @param packageName Package name not to show dialogs for
     * @param suppress Whether to suppress or re-enable.
     *
     * @hide
     */
    public void suppressIndividualSensorPrivacyReminders(@NonNull String packageName,
            boolean suppress) {
        try {
            mService.suppressIndividualSensorPrivacyReminders(mContext.getUserId(), packageName,
                    token, suppress);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }
}
+5 −0
Original line number Diff line number Diff line
@@ -2649,6 +2649,11 @@
    <string name="config_usbResolverActivity" translatable="false"
            >com.android.systemui/com.android.systemui.usb.UsbResolverActivity</string>

    <!-- Component name of the activity used to inform a user about a sensory being blocked because
     of privacy settings. -->
    <string name="config_sensorUseStartedActivity" translatable="false"
            >com.android.systemui/com.android.systemui.sensorprivacy.SensorUseStartedActivity</string>

    <!-- Name of the dialog that is used to request the user's consent for a Platform VPN -->
    <string name="config_platformVpnConfirmDialogComponent" translatable="false"
            >com.android.vpndialogs/com.android.vpndialogs.PlatformVpnConfirmDialog</string>
Loading