@@ -50,7 +50,7 @@ final class DisplayPowerState {
5050 private static final int DIRTY_BRIGHTNESS = 1 << 2 ;
5151
5252 private final Choreographer mChoreographer ;
53- private final ElectronBeam mElectronBeam ;
53+ private final ElectronBeam mElectronBeam ; // may be null if only animating backlights
5454 private final PhotonicModulator mScreenBrightnessModulator ;
5555
5656 private int mDirty ;
@@ -134,16 +134,22 @@ public boolean isScreenOn() {
134134 * @return True if the electron beam was prepared.
135135 */
136136 public boolean prepareElectronBeam (boolean warmUp ) {
137- boolean success = mElectronBeam .prepare (warmUp );
138- invalidate (DIRTY_ELECTRON_BEAM );
139- return success ;
137+ if (mElectronBeam != null ) {
138+ boolean success = mElectronBeam .prepare (warmUp );
139+ invalidate (DIRTY_ELECTRON_BEAM );
140+ return success ;
141+ } else {
142+ return true ;
143+ }
140144 }
141145
142146 /**
143147 * Dismisses the electron beam surface.
144148 */
145149 public void dismissElectronBeam () {
146- mElectronBeam .dismiss ();
150+ if (mElectronBeam != null ) {
151+ mElectronBeam .dismiss ();
152+ }
147153 }
148154
149155 /**
@@ -224,7 +230,9 @@ public void dump(PrintWriter pw) {
224230 pw .println (" mScreenBrightness=" + mScreenBrightness );
225231 pw .println (" mElectronBeamLevel=" + mElectronBeamLevel );
226232
227- mElectronBeam .dump (pw );
233+ if (mElectronBeam != null ) {
234+ mElectronBeam .dump (pw );
235+ }
228236 }
229237
230238 private void invalidate (int dirty ) {
@@ -243,7 +251,7 @@ private void apply() {
243251 PowerManagerService .nativeSetScreenState (false );
244252 }
245253
246- if ((mDirty & DIRTY_ELECTRON_BEAM ) != 0 ) {
254+ if ((mDirty & DIRTY_ELECTRON_BEAM ) != 0 && mElectronBeam != null ) {
247255 mElectronBeam .draw (mElectronBeamLevel );
248256 }
249257
0 commit comments