vendor/sprd/platform/frameworks/base/packages/SystemUI/src_unisoc_systemui/com/unisoc/systemui/light/LightControllerImpl.java
public class LightControllerImpl extends LightController{
private static LightController sLightControllerInstance;
private static Context mContext;
private int mDefaultBrightness;
private String mBootHardware = SystemProperties.get("ro.boot.hardware");
public static LightController getInstance(Context context) {
synchronized (LightControllerImpl.class) {
if (sLightControllerInstance == null) {
mContext = context;
sLightControllerInstance = new LightControllerImpl();
}
return sLightControllerInstance;
}
}
public void getDefaultBrightness() {
if (!supportLowlight()) {
return;
}
mDefaultBrightness = Settings.System.getIntForUser(mContext.getContentResolver(),
Settings.System.SCREEN_BRIGHTNESS, -1, ActivityManager.getCurrentUser());
Log.d("LightControllerImpl", "mDefaultBrightness:" + mDefaultBrightness);
}
public void resetDefaultScreenBrightness() {
if (!supportLowlight()) {
return;
}
Log.d("LightControllerImpl", "resetDefaultScreenBrightness");
Settings.System.putIntForUser(mContext.getContentResolver(),
Settings.System.SCREEN_BRIGHTNESS, mDefaultBrightness, ActivityManager.getCurrentUser());
}
public void setMaxScreenBrightness() {
if (!supportLowlight()) {
return;
}
Log.d("LightControllerImpl", "setMaxScreenBrightness mMaxLight:"+PowerManager.BRIGHTNESS_ON);
Settings.System.putIntForUser(mContext.getContentResolver(),
Settings.System.SCREEN_BRIGHTNESS, PowerManager.BRIGHTNESS_ON, UserHandle.myUserId());
}
public boolean supportLowlight() {
if (mBootHardware.contains("7731") || mBootHardware.contains("9832")) {
return false;
} else {
return false; //modify
}
}
}