Loading services/core/java/com/android/server/display/NightDisplayService.java +13 −2 Original line number Original line Diff line number Diff line Loading @@ -182,6 +182,8 @@ public final class NightDisplayService extends SystemService } } private void setUp() { private void setUp() { Slog.d(TAG, "setUp: currentUser=" + mCurrentUser); // Create a new controller for the current user and start listening for changes. // Create a new controller for the current user and start listening for changes. mController = new NightDisplayController(getContext(), mCurrentUser); mController = new NightDisplayController(getContext(), mCurrentUser); mController.setListener(this); mController.setListener(this); Loading @@ -196,6 +198,8 @@ public final class NightDisplayService extends SystemService } } private void tearDown() { private void tearDown() { Slog.d(TAG, "tearDown: currentUser=" + mCurrentUser); if (mController != null) { if (mController != null) { mController.setListener(null); mController.setListener(null); mController = null; mController = null; Loading Loading @@ -273,6 +277,8 @@ public final class NightDisplayService extends SystemService @Override @Override public void onAutoModeChanged(int autoMode) { public void onAutoModeChanged(int autoMode) { Slog.d(TAG, "onAutoModeChanged: autoMode=" + autoMode); if (mAutoMode != null) { if (mAutoMode != null) { mAutoMode.onStop(); mAutoMode.onStop(); mAutoMode = null; mAutoMode = null; Loading @@ -291,6 +297,8 @@ public final class NightDisplayService extends SystemService @Override @Override public void onCustomStartTimeChanged(NightDisplayController.LocalTime startTime) { public void onCustomStartTimeChanged(NightDisplayController.LocalTime startTime) { Slog.d(TAG, "onCustomStartTimeChanged: startTime=" + startTime); if (mAutoMode != null) { if (mAutoMode != null) { mAutoMode.onCustomStartTimeChanged(startTime); mAutoMode.onCustomStartTimeChanged(startTime); } } Loading @@ -298,6 +306,8 @@ public final class NightDisplayService extends SystemService @Override @Override public void onCustomEndTimeChanged(NightDisplayController.LocalTime endTime) { public void onCustomEndTimeChanged(NightDisplayController.LocalTime endTime) { Slog.d(TAG, "onCustomEndTimeChanged: endTime=" + endTime); if (mAutoMode != null) { if (mAutoMode != null) { mAutoMode.onCustomEndTimeChanged(endTime); mAutoMode.onCustomEndTimeChanged(endTime); } } Loading Loading @@ -419,7 +429,7 @@ public final class NightDisplayService extends SystemService @Override @Override public void onAlarm() { public void onAlarm() { if (DEBUG) Slog.d(TAG, "onAlarm"); Slog.d(TAG, "onAlarm"); updateActivated(); updateActivated(); } } } } Loading Loading @@ -477,7 +487,8 @@ public final class NightDisplayService extends SystemService @Override @Override public void onTwilightStateChanged(@Nullable TwilightState state) { public void onTwilightStateChanged(@Nullable TwilightState state) { if (DEBUG) Slog.d(TAG, "onTwilightStateChanged"); Slog.d(TAG, "onTwilightStateChanged: isNight=" + (state == null ? null : state.isNight())); updateActivated(state); updateActivated(state); } } } } Loading services/core/java/com/android/server/twilight/TwilightService.java +12 −7 Original line number Original line Diff line number Diff line Loading @@ -151,7 +151,7 @@ public final class TwilightService extends SystemService } } private void startListening() { private void startListening() { if (DEBUG) Slog.d(TAG, "startListening"); Slog.d(TAG, "startListening"); // Start listening for location updates (default: low power, max 1h, min 10m). // Start listening for location updates (default: low power, max 1h, min 10m). mLocationManager.requestLocationUpdates( mLocationManager.requestLocationUpdates( Loading @@ -173,7 +173,7 @@ public final class TwilightService extends SystemService mTimeChangedReceiver = new BroadcastReceiver() { mTimeChangedReceiver = new BroadcastReceiver() { @Override @Override public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) { if (DEBUG) Slog.d(TAG, "onReceive: " + intent); Slog.d(TAG, "onReceive: " + intent); updateTwilightState(); updateTwilightState(); } } }; }; Loading @@ -188,7 +188,7 @@ public final class TwilightService extends SystemService } } private void stopListening() { private void stopListening() { if (DEBUG) Slog.d(TAG, "stopListening"); Slog.d(TAG, "stopListening"); if (mTimeChangedReceiver != null) { if (mTimeChangedReceiver != null) { getContext().unregisterReceiver(mTimeChangedReceiver); getContext().unregisterReceiver(mTimeChangedReceiver); Loading Loading @@ -241,16 +241,21 @@ public final class TwilightService extends SystemService @Override @Override public void onAlarm() { public void onAlarm() { if (DEBUG) Slog.d(TAG, "onAlarm"); Slog.d(TAG, "onAlarm"); updateTwilightState(); updateTwilightState(); } } @Override @Override public void onLocationChanged(Location location) { public void onLocationChanged(Location location) { if (DEBUG) Slog.d(TAG, "onLocationChanged: " + location); if (location != null) { Slog.d(TAG, "onLocationChanged:" + " provider=" + location.getProvider() + " accuracy=" + location.getAccuracy() + " time=" + location.getTime()); mLastLocation = location; mLastLocation = location; updateTwilightState(); updateTwilightState(); } } } @Override @Override public void onStatusChanged(String provider, int status, Bundle extras) { public void onStatusChanged(String provider, int status, Bundle extras) { Loading Loading
services/core/java/com/android/server/display/NightDisplayService.java +13 −2 Original line number Original line Diff line number Diff line Loading @@ -182,6 +182,8 @@ public final class NightDisplayService extends SystemService } } private void setUp() { private void setUp() { Slog.d(TAG, "setUp: currentUser=" + mCurrentUser); // Create a new controller for the current user and start listening for changes. // Create a new controller for the current user and start listening for changes. mController = new NightDisplayController(getContext(), mCurrentUser); mController = new NightDisplayController(getContext(), mCurrentUser); mController.setListener(this); mController.setListener(this); Loading @@ -196,6 +198,8 @@ public final class NightDisplayService extends SystemService } } private void tearDown() { private void tearDown() { Slog.d(TAG, "tearDown: currentUser=" + mCurrentUser); if (mController != null) { if (mController != null) { mController.setListener(null); mController.setListener(null); mController = null; mController = null; Loading Loading @@ -273,6 +277,8 @@ public final class NightDisplayService extends SystemService @Override @Override public void onAutoModeChanged(int autoMode) { public void onAutoModeChanged(int autoMode) { Slog.d(TAG, "onAutoModeChanged: autoMode=" + autoMode); if (mAutoMode != null) { if (mAutoMode != null) { mAutoMode.onStop(); mAutoMode.onStop(); mAutoMode = null; mAutoMode = null; Loading @@ -291,6 +297,8 @@ public final class NightDisplayService extends SystemService @Override @Override public void onCustomStartTimeChanged(NightDisplayController.LocalTime startTime) { public void onCustomStartTimeChanged(NightDisplayController.LocalTime startTime) { Slog.d(TAG, "onCustomStartTimeChanged: startTime=" + startTime); if (mAutoMode != null) { if (mAutoMode != null) { mAutoMode.onCustomStartTimeChanged(startTime); mAutoMode.onCustomStartTimeChanged(startTime); } } Loading @@ -298,6 +306,8 @@ public final class NightDisplayService extends SystemService @Override @Override public void onCustomEndTimeChanged(NightDisplayController.LocalTime endTime) { public void onCustomEndTimeChanged(NightDisplayController.LocalTime endTime) { Slog.d(TAG, "onCustomEndTimeChanged: endTime=" + endTime); if (mAutoMode != null) { if (mAutoMode != null) { mAutoMode.onCustomEndTimeChanged(endTime); mAutoMode.onCustomEndTimeChanged(endTime); } } Loading Loading @@ -419,7 +429,7 @@ public final class NightDisplayService extends SystemService @Override @Override public void onAlarm() { public void onAlarm() { if (DEBUG) Slog.d(TAG, "onAlarm"); Slog.d(TAG, "onAlarm"); updateActivated(); updateActivated(); } } } } Loading Loading @@ -477,7 +487,8 @@ public final class NightDisplayService extends SystemService @Override @Override public void onTwilightStateChanged(@Nullable TwilightState state) { public void onTwilightStateChanged(@Nullable TwilightState state) { if (DEBUG) Slog.d(TAG, "onTwilightStateChanged"); Slog.d(TAG, "onTwilightStateChanged: isNight=" + (state == null ? null : state.isNight())); updateActivated(state); updateActivated(state); } } } } Loading
services/core/java/com/android/server/twilight/TwilightService.java +12 −7 Original line number Original line Diff line number Diff line Loading @@ -151,7 +151,7 @@ public final class TwilightService extends SystemService } } private void startListening() { private void startListening() { if (DEBUG) Slog.d(TAG, "startListening"); Slog.d(TAG, "startListening"); // Start listening for location updates (default: low power, max 1h, min 10m). // Start listening for location updates (default: low power, max 1h, min 10m). mLocationManager.requestLocationUpdates( mLocationManager.requestLocationUpdates( Loading @@ -173,7 +173,7 @@ public final class TwilightService extends SystemService mTimeChangedReceiver = new BroadcastReceiver() { mTimeChangedReceiver = new BroadcastReceiver() { @Override @Override public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) { if (DEBUG) Slog.d(TAG, "onReceive: " + intent); Slog.d(TAG, "onReceive: " + intent); updateTwilightState(); updateTwilightState(); } } }; }; Loading @@ -188,7 +188,7 @@ public final class TwilightService extends SystemService } } private void stopListening() { private void stopListening() { if (DEBUG) Slog.d(TAG, "stopListening"); Slog.d(TAG, "stopListening"); if (mTimeChangedReceiver != null) { if (mTimeChangedReceiver != null) { getContext().unregisterReceiver(mTimeChangedReceiver); getContext().unregisterReceiver(mTimeChangedReceiver); Loading Loading @@ -241,16 +241,21 @@ public final class TwilightService extends SystemService @Override @Override public void onAlarm() { public void onAlarm() { if (DEBUG) Slog.d(TAG, "onAlarm"); Slog.d(TAG, "onAlarm"); updateTwilightState(); updateTwilightState(); } } @Override @Override public void onLocationChanged(Location location) { public void onLocationChanged(Location location) { if (DEBUG) Slog.d(TAG, "onLocationChanged: " + location); if (location != null) { Slog.d(TAG, "onLocationChanged:" + " provider=" + location.getProvider() + " accuracy=" + location.getAccuracy() + " time=" + location.getTime()); mLastLocation = location; mLastLocation = location; updateTwilightState(); updateTwilightState(); } } } @Override @Override public void onStatusChanged(String provider, int status, Bundle extras) { public void onStatusChanged(String provider, int status, Bundle extras) { Loading