Release doze lock when the dream component changes

Bug: 260094933
Bug: 266937746
Test: m
Change-Id: Ia46f1e91469886bb562860ff81385928dd718ef7
This commit is contained in:
Galia Peycheva
2023-02-06 15:37:57 +00:00
parent 663be784e9
commit e85f0e1207
2 changed files with 5 additions and 14 deletions

View File

@@ -244,8 +244,6 @@ final class DreamController {
}
mListener.onDreamStopped(dream.mToken);
} else if (dream.mCanDoze && !mCurrentDream.mCanDoze) {
mListener.stopDozing(dream.mToken);
}
} finally {
@@ -292,7 +290,6 @@ final class DreamController {
*/
public interface Listener {
void onDreamStopped(Binder token);
void stopDozing(Binder token);
}
private final class DreamRecord implements DeathRecipient, ServiceConnection {

View File

@@ -499,12 +499,7 @@ public final class DreamManagerService extends SystemService {
}
synchronized (mLock) {
if (mCurrentDream == null) {
return;
}
final boolean sameDream = mCurrentDream.token == token;
if ((sameDream && mCurrentDream.isDozing) || (!sameDream && !mCurrentDream.isDozing)) {
if (mCurrentDream != null && mCurrentDream.token == token && mCurrentDream.isDozing) {
mCurrentDream.isDozing = false;
mDozeWakeLock.release();
mPowerManagerInternal.setDozeOverrideFromDreamManager(
@@ -665,6 +660,10 @@ public final class DreamManagerService extends SystemService {
Slog.i(TAG, "Entering dreamland.");
if (mCurrentDream != null && mCurrentDream.isDozing) {
stopDozingInternal(mCurrentDream.token);
}
mCurrentDream = new DreamRecord(name, userId, isPreviewMode, canDoze);
if (!mCurrentDream.name.equals(mAmbientDisplayComponent)) {
@@ -770,11 +769,6 @@ public final class DreamManagerService extends SystemService {
}
}
}
@Override
public void stopDozing(Binder token) {
stopDozingInternal(token);
}
};
private final ContentObserver mDozeEnabledObserver = new ContentObserver(null) {