Fix NullPointerException in DreamManagerService
mCurrentDreamName has one access from an unlocked context, which causes a race condition between the dream being stopped and started. This causes a NullPointerExcpetion. This CL fixes this by moving the mCurrentDreamName read operation back into a locked block. Bug: 209911670 Test: m Change-Id: Icb8e904f067199fbfa62ff90aecd57bf38015546
This commit is contained in:
@@ -416,13 +416,14 @@ public final class DreamManagerService extends SystemService {
|
||||
mCurrentDreamCanDoze = canDoze;
|
||||
mCurrentDreamUserId = userId;
|
||||
|
||||
if (!mCurrentDreamName.equals(mAmbientDisplayComponent)) {
|
||||
mUiEventLogger.log(DreamManagerEvent.DREAM_START);
|
||||
}
|
||||
|
||||
PowerManager.WakeLock wakeLock = mPowerManager
|
||||
.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "startDream");
|
||||
mHandler.post(wakeLock.wrap(() -> {
|
||||
mAtmInternal.notifyDreamStateChanged(true);
|
||||
if (!mCurrentDreamName.equals(mAmbientDisplayComponent)) {
|
||||
mUiEventLogger.log(DreamManagerEvent.DREAM_START);
|
||||
}
|
||||
mController.startDream(newToken, name, isTest, canDoze, userId, wakeLock,
|
||||
mDreamOverlayServiceName);
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user