diff options
| author | 2024-09-25 16:54:59 +0000 | |
|---|---|---|
| committer | 2024-09-25 16:54:59 +0000 | |
| commit | ba21f2518604c152f2bed61e89355e435f15cbc6 (patch) | |
| tree | 1b9eaa9b8a7cc31c2e70be57a36564cbbc7b2787 | |
| parent | afde520ff12a789e16053868ba483a59a3087012 (diff) | |
Use explicit user id for sensor privacy manager
Recent changes to the SensorPrivacyManager will cause it to default to
using the context user for these interactions, which will always be user
0 for SysUI. Therefore, the explicit user id needs to be specified.
Bug: 366660154
Test: atest CtsSensorPrivacyTestCases:android.sensorprivacy.cts.SensorPrivacyMicrophoneTest
Flag: NONE bugfix
Change-Id: I725b2fda806020bd21075364fa52fc302a841249
2 files changed, 12 insertions, 5 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/dagger/ReferenceSystemUIModule.java b/packages/SystemUI/src/com/android/systemui/dagger/ReferenceSystemUIModule.java index 5c075c240caf..8261e5083a63 100644 --- a/packages/SystemUI/src/com/android/systemui/dagger/ReferenceSystemUIModule.java +++ b/packages/SystemUI/src/com/android/systemui/dagger/ReferenceSystemUIModule.java @@ -55,6 +55,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; @@ -176,9 +177,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; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/IndividualSensorPrivacyControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/IndividualSensorPrivacyControllerImpl.java index da928a364984..3cf206643207 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/IndividualSensorPrivacyControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/IndividualSensorPrivacyControllerImpl.java @@ -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 |