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

Commit 2d7e351a authored by Jaekyun Seok's avatar Jaekyun Seok
Browse files

Fix NPE on a device having no sensor

If a device has no sensor, mUidPolicy isn't set. So mUidPolicy should be
initialized unconditionally.

Bug: 77151317
Bug: 76407833
Test: succeeded building and tested with a device having no sensor
Change-Id: I3ef9f252c220d58bdab5e4f458e48b74b66091ee
parent 92f8d8b1
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -86,6 +86,7 @@ static const String16 sManageSensorsPermission("android.permission.MANAGE_SENSOR
SensorService::SensorService()
    : mInitCheck(NO_INIT), mSocketBufferSize(SOCKET_BUFFER_SIZE_NON_BATCHED),
      mWakeLockAcquired(false) {
    mUidPolicy = new UidPolicy(this);
}

bool SensorService::initializeHmacKey() {
@@ -283,7 +284,6 @@ void SensorService::onFirstRef() {
            enableSchedFifoMode();

            // Start watching UID changes to apply policy.
            mUidPolicy = new UidPolicy(this);
            mUidPolicy->registerSelf();
        }
    }