universal7885: CameraLightSensor: Fix the service running even if I turn auto-brightness off

Change-Id: I795aef4cbd9d2d5676c8d4ccae11ce5fef828907
Signed-off-by: roynatech2544 <whiteshell2544@naver.com>
This commit is contained in:
roynatech2544 2021-11-01 01:31:30 +09:00
commit 4f2af28177
No known key found for this signature in database
GPG key ID: 9675C32163D88D30

View file

@ -65,7 +65,8 @@ public class CameraLightSensorService extends Activity {
}; };
private void onDisplayOn() throws Settings.SettingNotFoundException { private void onDisplayOn() throws Settings.SettingNotFoundException {
if(Settings.System.getInt(getContentResolver(), if(Settings.System.getInt(getContentResolver(),
Settings.System.SCREEN_BRIGHTNESS_MODE ) == 1){ Settings.System.SCREEN_BRIGHTNESS_MODE ) ==
Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC){
if(DEBUG) Log.d(TAG, "AutoBrightness Mode Enabled. Starting..."); if(DEBUG) Log.d(TAG, "AutoBrightness Mode Enabled. Starting...");
i = new Intent(mContext, Camera2Service.class); i = new Intent(mContext, Camera2Service.class);
mContext.startForegroundService(i); mContext.startForegroundService(i);
@ -75,7 +76,6 @@ public class CameraLightSensorService extends Activity {
} }
private void onDisplayOff(){ private void onDisplayOff(){
if(DEBUG) Log.d(TAG, "Screen is off. Stopping Service..."); if(DEBUG) Log.d(TAG, "Screen is off. Stopping Service...");
i = new Intent(mContext, Camera2Service.class);
mContext.stopService(i); mContext.stopService(i);
} }
public static void BatteryOptimization(Context context){ public static void BatteryOptimization(Context context){