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

Commit dd71c30e authored by Evan Severson's avatar Evan Severson Committed by android-build-team Robot
Browse files

Fix typo in sensor privacy init

Should be getting the value at index i, not using int i as a key. Also
when iterating over the state we should be holding the lock.

Test: Push sensor_privacy.xml file and reboot
Fixes: 185881144
Change-Id: I09823d888b05b674b32254d39ab030ce0e6c2acf
(cherry picked from commit 30a3a67d)
parent 0aa6818e
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -197,18 +197,18 @@ public final class SensorPrivacyService extends SystemService {
                if (readPersistedSensorPrivacyStateLocked()) {
                    persistSensorPrivacyStateLocked();
                }
            }

                for (int i = 0; i < mIndividualEnabled.size(); i++) {
                    int userId = mIndividualEnabled.keyAt(i);
                    SparseBooleanArray userIndividualEnabled =
                        mIndividualEnabled.get(i);
                            mIndividualEnabled.valueAt(i);
                    for (int j = 0; j < userIndividualEnabled.size(); j++) {
                        int sensor = userIndividualEnabled.keyAt(i);
                        boolean enabled = userIndividualEnabled.valueAt(j);
                        setUserRestriction(userId, sensor, enabled);
                    }
                }
            }

            int[] micAndCameraOps = new int[]{OP_RECORD_AUDIO, OP_CAMERA};
            mAppOpsManager.startWatchingNoted(micAndCameraOps, this);