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

Commit 92081a1c authored by Alex Stetson's avatar Alex Stetson Committed by Android (Google) Code Review
Browse files

Merge "Use explicit user id for sensor privacy manager" into main

parents 4b698405 ba21f251
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ import com.android.systemui.rotationlock.RotationLockNewModule;
import com.android.systemui.scene.SceneContainerFrameworkModule;
import com.android.systemui.screenshot.ReferenceScreenshotModule;
import com.android.systemui.settings.MultiUserUtilsModule;
import com.android.systemui.settings.UserTracker;
import com.android.systemui.shade.NotificationShadeWindowControllerImpl;
import com.android.systemui.shade.ShadeModule;
import com.android.systemui.startable.Dependencies;
@@ -178,9 +179,9 @@ public abstract class ReferenceSystemUIModule {
    @Provides
    @SysUISingleton
    static IndividualSensorPrivacyController provideIndividualSensorPrivacyController(
            SensorPrivacyManager sensorPrivacyManager) {
            SensorPrivacyManager sensorPrivacyManager, UserTracker userTracker) {
        IndividualSensorPrivacyController spC = new IndividualSensorPrivacyControllerImpl(
                sensorPrivacyManager);
                sensorPrivacyManager, userTracker);
        spC.init();
        return spC;
    }
+9 −3
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import android.util.SparseBooleanArray;
import androidx.annotation.NonNull;

import com.android.internal.camera.flags.Flags;
import com.android.systemui.settings.UserTracker;
import com.android.systemui.util.ListenerSet;

import java.util.Set;
@@ -41,14 +42,17 @@ public class IndividualSensorPrivacyControllerImpl implements IndividualSensorPr
    private static final int[] SENSORS = new int[] {CAMERA, MICROPHONE};

    private final @NonNull SensorPrivacyManager mSensorPrivacyManager;
    private final @NonNull UserTracker mUserTracker;
    private final SparseBooleanArray mSoftwareToggleState = new SparseBooleanArray();
    private final SparseBooleanArray mHardwareToggleState = new SparseBooleanArray();
    private Boolean mRequiresAuthentication;
    private final ListenerSet<Callback> mCallbacks = new ListenerSet<>();

    public IndividualSensorPrivacyControllerImpl(
            @NonNull SensorPrivacyManager sensorPrivacyManager) {
            @NonNull SensorPrivacyManager sensorPrivacyManager,
            @NonNull UserTracker userTracker) {
        mSensorPrivacyManager = sensorPrivacyManager;
        mUserTracker = userTracker;
    }

    @Override
@@ -94,12 +98,14 @@ public class IndividualSensorPrivacyControllerImpl implements IndividualSensorPr

    @Override
    public void setSensorBlocked(@Source int source, @Sensor int sensor, boolean blocked) {
        mSensorPrivacyManager.setSensorPrivacyForProfileGroup(source, sensor, blocked);
        mSensorPrivacyManager.setSensorPrivacyForProfileGroup(source, sensor, blocked,
                mUserTracker.getUserId());
    }

    @Override
    public void suppressSensorPrivacyReminders(int sensor, boolean suppress) {
        mSensorPrivacyManager.suppressSensorPrivacyReminders(sensor, suppress);
        mSensorPrivacyManager.suppressSensorPrivacyReminders(sensor, suppress,
                mUserTracker.getUserId());
    }

    @Override