author | Xindong Xu <xindong.xu@amlogic.com> | 2018-03-19 07:09:24 (GMT) |
---|---|---|
committer | Xindong Xu <xindong.xu@amlogic.com> | 2018-03-19 07:09:24 (GMT) |
commit | 9bc9e9993c2a94798db58d189a8ed1cd5749ed33 (patch) | |
tree | 8513c68a26fa4a3b6a664995e806ad4b9183a321 | |
parent | e63819f5c44eaf1013714c522c22e5b07e1ca4b1 (diff) | |
download | ampere-9bc9e9993c2a94798db58d189a8ed1cd5749ed33.zip ampere-9bc9e9993c2a94798db58d189a8ed1cd5749ed33.tar.gz ampere-9bc9e9993c2a94798db58d189a8ed1cd5749ed33.tar.bz2 |
systemcontrol: add PQ factory interface [1/1]
PD# 161103
add PQ factory interface
Change-Id: I6579be1807063fb3700441ccad4915f1e00d831e
17 files changed, 1523 insertions, 34 deletions
diff --git a/frameworks/core/java/com/droidlogic/app/SystemControlManager.java b/frameworks/core/java/com/droidlogic/app/SystemControlManager.java index 63fb361..95ef44f 100644 --- a/frameworks/core/java/com/droidlogic/app/SystemControlManager.java +++ b/frameworks/core/java/com/droidlogic/app/SystemControlManager.java @@ -15,6 +15,7 @@ import vendor.amlogic.hardware.systemcontrol.V1_0.ISystemControl; import vendor.amlogic.hardware.systemcontrol.V1_0.ISystemControlCallback; import vendor.amlogic.hardware.systemcontrol.V1_0.Result; import vendor.amlogic.hardware.systemcontrol.V1_0.DroidDisplayInfo; +import vendor.amlogic.hardware.systemcontrol.V1_0.SourceInputParam; public class SystemControlManager { private static final String TAG = "SysControlManager"; @@ -787,6 +788,1087 @@ public class SystemControlManager { return true; } + public int LoadPQSettings(SourceInputParam srcInputParam) { + synchronized (mLock) { + try { + return mProxy.loadPQSettings(srcInputParam); + } catch (RemoteException e) { + Log.e(TAG, "LoadPQSettings:" + e); + } + } + + return -1; + + } + + + public int LoadCpqLdimRegs() { + synchronized (mLock) { + try { + return mProxy.loadCpqLdimRegs(); + } catch (RemoteException e) { + Log.e(TAG, "LoadCpqLdimRegs:" + e); + } + } + + return -1; + } + + /** + * @Function: SetPQMode + * @Description: Set current source picture mode + * @Param: value mode refer to enum Pq_Mode, source refer to enum SourceInput, is_save 1 to save + * @Return: 0 success, -1 fail + */ + public int SetPQMode(int pq_mode, int is_save, int is_autoswitch) { + synchronized (mLock) { + try { + return mProxy.setPQmode(pq_mode, is_save, is_autoswitch); + } catch (RemoteException e) { + Log.e(TAG, "SetPQMode:" + e); + } + } + + return -1; + + } + + /** + * @Function: GetPQMode + * @Description: Get current source picture mode + * @Param: source refer to enum SourceInput + * @Return: picture mode refer to enum Pq_Mode + */ + public int GetPQMode() { + synchronized (mLock) { + try { + return mProxy.getPQmode(); + } catch (RemoteException e) { + Log.e(TAG, "getDisplay3DFormat:" + e); + } + } + return -1; + } + + /** + * @Function: SavePQMode + * @Description: Save current source picture mode + * @Param: picture mode refer to enum Pq_Mode, source refer to enum SourceInput + * @Return: 0 success, -1 fail + */ + public int SavePQMode(int pq_mode) { + synchronized (mLock) { + try { + return mProxy.savePQmode(pq_mode); + } catch (RemoteException e) { + Log.e(TAG, "SavePQMode:" + e); + } + } + return -1; + } + + public enum color_temperature { + COLOR_TEMP_STANDARD(0), + COLOR_TEMP_WARM(1), + COLOR_TEMP_COLD(2), + COLOR_TEMP_MAX(3); + private int val; + color_temperature(int val) { + this.val = val; + } + public int toInt() { + return this.val; + } + } + + /** + * @Function: SetColorTemperature + * @Description: Set current source color temperature mode + * @Param: value mode refer to enum color_temperature, source refer to enum SourceInput, is_save 1 to save + * @Return: 0 success, -1 fail + */ + public int SetColorTemperature(int mode, int is_save) { + synchronized (mLock) { + try { + return mProxy.setColorTemperature(mode, is_save); + } catch (RemoteException e) { + Log.e(TAG, "SavePQMode:" + e); + } + } + return -1; + + } + + /** + * @Function: GetColorTemperature + * @Description: Get current source color temperature mode + * @Param: source refer to enum SourceInput + * @Return: color temperature refer to enum color_temperature + */ + public int GetColorTemperature() { + synchronized (mLock) { + try { + return mProxy.getColorTemperature(); + } catch (RemoteException e) { + Log.e(TAG, "GetColorTemperature:" + e); + } + } + return -1; + } + + /** + * @Function: SaveColorTemperature + * @Description: Save current source color temperature mode + * @Param: color temperature mode refer to enum color_temperature, source refer to enum SourceInput + * @Return: 0 success, -1 fail + */ + public int SaveColorTemperature(int mode) { + synchronized (mLock) { + try { + return mProxy.saveColorTemperature(mode); + } catch (RemoteException e) { + Log.e(TAG, "SaveColorTemperature:" + e); + } + } + return -1; + } + + /** + * @Function: SetBrightness + * @Description: Set current source brightness value + * @Param: value brightness, source refer to enum SourceInput, is_save 1 to save + * @Return: 0 success, -1 fail + */ + public int SetBrightness(int value, int is_save) { + synchronized (mLock) { + try { + return mProxy.setBrightness(value, is_save); + } catch (RemoteException e) { + Log.e(TAG, "SetBrightness:" + e); + } + } + return -1; + } + + /** + * @Function: GetBrightness + * @Description: Get current source brightness value + * @Param: source refer to enum SourceInput + * @Return: value brightness + */ + public int GetBrightness() { + synchronized (mLock) { + try { + return mProxy.getBrightness(); + } catch (RemoteException e) { + Log.e(TAG, "GetBrightness:" + e); + } + } + return -1; + + } + + /** + * @Function: SaveBrightness + * @Description: Save current source brightness value + * @Param: value brightness, source refer to enum SourceInput + * @Return: 0 success, -1 fail + */ + public int SaveBrightness(int value) { + synchronized (mLock) { + try { + return mProxy.saveBrightness(value); + } catch (RemoteException e) { + Log.e(TAG, "SaveBrightness:" + e); + } + } + return -1; + } + + /** + * @Function: SetContrast + * @Description: Set current source contrast value + * @Param: value contrast, source refer to enum SourceInput, is_save 1 to save + * @Return: 0 success, -1 fail + */ + public int SetContrast(int value, int is_save) { + synchronized (mLock) { + try { + return mProxy.setContrast(value, is_save); + } catch (RemoteException e) { + Log.e(TAG, "SetContrast:" + e); + } + } + return -1; + + } + + /** + * @Function: GetContrast + * @Description: Get current source contrast value + * @Param: source refer to enum SourceInput + * @Return: value contrast + */ + public int GetContrast() { + synchronized (mLock) { + try { + return mProxy.getContrast(); + } catch (RemoteException e) { + Log.e(TAG, "GetContrast:" + e); + } + } + return -1; + + } + + /** + * @Function: SaveContrast + * @Description: Save current source contrast value + * @Param: value contrast, source refer to enum SourceInput + * @Return: 0 success, -1 fail + */ + public int SaveContrast(int value) { + synchronized (mLock) { + try { + return mProxy.saveContrast(value); + } catch (RemoteException e) { + Log.e(TAG, "SaveContrast:" + e); + } + } + return -1; + + } + + /** + * @Function: SetSatuation + * @Description: Set current source saturation value + * @Param: value saturation, source refer to enum SourceInput, fmt current fmt refer to tvin_sig_fmt_e, is_save 1 to save + * @Return: 0 success, -1 fail + */ + public int SetSaturation(int value, int is_save) { + synchronized (mLock) { + try { + return mProxy.setSaturation(value, is_save); + } catch (RemoteException e) { + Log.e(TAG, "SetBrightness:" + e); + } + } + return -1; + + } + + /** + * @Function: GetSatuation + * @Description: Get current source saturation value + * @Param: source refer to enum SourceInput + * @Return: value saturation + */ + public int GetSaturation() { + synchronized (mLock) { + try { + return mProxy.getSaturation(); + } catch (RemoteException e) { + Log.e(TAG, "GetSaturation:" + e); + } + } + return -1; + + } + + /** + * @Function: SaveSaturation + * @Description: Save current source saturation value + * @Param: value saturation, source refer to enum SourceInput + * @Return: 0 success, -1 fail + */ + public int SaveSaturation(int value) { + synchronized (mLock) { + try { + return mProxy.saveSaturation(value); + } catch (RemoteException e) { + Log.e(TAG, "SaveSaturation:" + e); + } + } + return -1; + + } + + /** + * @Function: SetHue + * @Description: Set current source hue value + * @Param: value saturation, source refer to enum SourceInput, fmt current fmt refer to tvin_sig_fmt_e, is_save 1 to save + * @Return: 0 success, -1 fail + */ + public int SetHue(int value, int is_save) { + synchronized (mLock) { + try { + return mProxy.setHue(value, is_save); + } catch (RemoteException e) { + Log.e(TAG, "SetHue:" + e); + } + } + return -1; + + } + + /** + * @Function: GetHue + * @Description: Get current source hue value + * @Param: source refer to enum SourceInput + * @Return: value hue + */ + public int GetHue() { + synchronized (mLock) { + try { + return mProxy.getHue(); + } catch (RemoteException e) { + Log.e(TAG, "GetHue:" + e); + } + } + return -1; + + } + + /** + * @Function: SaveHue + * @Description: Save current source hue value + * @Param: value hue, source refer to enum SourceInput + * @Return: 0 success, -1 fail + */ + public int SaveHue(int value) { + synchronized (mLock) { + try { + return mProxy.saveHue(value); + } catch (RemoteException e) { + Log.e(TAG, "SaveHue:" + e); + } + } + return -1; + + + } + + /** + * @Function: SetSharpness + * @Description: Set current source sharpness value + * @Param: value saturation, source_type refer to enum SourceInput, is_enable set 1 as default + * @Param: status_3d refer to enum Tvin_3d_Status, is_save 1 to save + * @Return: 0 success, -1 fail + */ + public int SetSharpness(int value, int is_enable, int is_save) { + synchronized (mLock) { + try { + return mProxy.setSharpness(value, is_enable, is_save); + } catch (RemoteException e) { + Log.e(TAG, "SetSharpness:" + e); + } + } + return -1; + + } + + /** + * @Function: GetSharpness + * @Description: Get current source sharpness value + * @Param: source refer to enum SourceInput + * @Return: value sharpness + */ + public int GetSharpness() { + synchronized (mLock) { + try { + return mProxy.getSharpness(); + } catch (RemoteException e) { + Log.e(TAG, "GetSharpness:" + e); + } + } + return -1; + + } + + /** + * @Function: SaveSharpness + * @Description: Save current source sharpness value + * @Param: value sharpness, source refer to enum SourceInput, isEnable set 1 enable as default + * @Return: 0 success, -1 fail + */ + public int SaveSharpness(int value, int isEnable) { + synchronized (mLock) { + try { + return mProxy.saveSharpness(value); + } catch (RemoteException e) { + Log.e(TAG, "SaveHue:" + e); + } + } + return -1; + + } + + public enum Noise_Reduction_Mode { + REDUCE_NOISE_CLOSE(0), + REDUCE_NOISE_WEAK(1), + REDUCE_NOISE_MID(2), + REDUCE_NOISE_STRONG(3), + REDUCTION_MODE_AUTO(4); + + private int val; + + Noise_Reduction_Mode(int val) { + this.val = val; + } + + public int toInt() { + return this.val; + } + } + + /** + * @Function: SetNoiseReductionMode + * @Description: Set current source noise reduction mode + * @Param: noise reduction mode refer to enum Noise_Reduction_Mode, source refer to enum SourceInput, is_save 1 to save + * @Return: 0 success, -1 fail + */ + public int SetNoiseReductionMode(int nr_mode, int is_save) { + synchronized (mLock) { + try { + return mProxy.setNoiseReductionMode(nr_mode, is_save); + } catch (RemoteException e) { + Log.e(TAG, "SetNoiseReductionMode:" + e); + } + } + return -1; + + } + + /** + * @Function: GetNoiseReductionMode + * @Description: Get current source noise reduction mode + * @Param: source refer to enum SourceInput + * @Return: noise reduction mode refer to enum Noise_Reduction_Mode + */ + public int GetNoiseReductionMode() { + synchronized (mLock) { + try { + return mProxy.getNoiseReductionMode(); + } catch (RemoteException e) { + Log.e(TAG, "GetNoiseReductionMode:" + e); + } + } + return -1; + + } + + /** + * @Function: SaveNoiseReductionMode + * @Description: Save current source noise reduction mode + * @Param: noise reduction mode refer to enum Noise_Reduction_Mode, source refer to enum SourceInput + * @Return: 0 success, -1 fail + */ + public int SaveNoiseReductionMode(int nr_mode) { + synchronized (mLock) { + try { + return mProxy.saveNoiseReductionMode(nr_mode); + } catch (RemoteException e) { + Log.e(TAG, "SaveNoiseReductionMode:" + e); + } + } + return -1; + + } + + public int SetEyeProtectionMode(SourceInputParam srcInputParam, int enable) { + synchronized (mLock) { + try { + return mProxy.setEyeProtectionMode(srcInputParam, enable); + } catch (RemoteException e) { + Log.e(TAG, "SetEyeProtectionMode:" + e); + } + } + return -1; + } + + public int GetEyeProtectionMode() { + synchronized (mLock) { + try { + return mProxy.getEyeProtectionMode(); + } catch (RemoteException e) { + Log.e(TAG, "GetEyeProtectionMode:" + e); + } + } + return -1; + } + + public int SetGammaValue(int curve, int isSave) { + synchronized (mLock) { + try { + return mProxy.setGammaValue(curve, isSave); + } catch (RemoteException e) { + Log.e(TAG, "SetGammaValue:" + e); + } + } + return -1; + + } + + public int GetGammaValue() { + synchronized (mLock) { + try { + return mProxy.getGammaValue(); + } catch (RemoteException e) { + Log.e(TAG, "GetGammaValue:" + e); + } + } + return -1; + + } + + public int GetDisplayMode(SourceInputParam srcInputParam) { + synchronized (mLock) { + try { + return mProxy.getDisplayMode(srcInputParam); + } catch (RemoteException e) { + Log.e(TAG, "GetDisplayMode:" + e); + } + } + return -1; + } + + public int GetOverscanParam(SourceInputParam srcInputParam, int id) { + synchronized (mLock) { + Mutable<Integer> resultVal = new Mutable<>(); + try { + return mProxy.getOverscanParam(srcInputParam, id); + } catch (RemoteException e) { + Log.e(TAG, "GetOverscanParam:" + e); + } + } + return -1; + } + + /** + * @Function: FactoryResetPQMode + * @Description: Reset all values of PQ mode for factory menu conctrol + * @Param: + * @Return: 0 success, -1 fail + */ + public int FactoryResetPQMode() { + synchronized (mLock) { + try { + return mProxy.factoryResetPQMode(); + } catch (RemoteException e) { + Log.e(TAG, "FactoryResetPQMode:" + e); + } + } + return -1; + } + + /** + * @Function: FactoryResetColorTemp + * @Description: Reset all values of color temperature mode for factory menu conctrol + * @Param: + * @Return: 0 success, -1 fail + */ + public int FactoryResetColorTemp() { + synchronized (mLock) { + try { + return mProxy.factoryResetColorTemp(); + } catch (RemoteException e) { + Log.e(TAG, "FactoryResetColorTemp:" + e); + } + } + return -1; + } + + public int FactorySetPQParam(SourceInputParam srcInputParam, int mode, int id, int value) { + synchronized (mLock) { + try { + return mProxy.factorySetPQParam(srcInputParam, mode, id, value); + } catch (RemoteException e) { + Log.e(TAG, "FactorySetPQParam:" + e); + } + } + return -1; + + } + + public int FactoryGetPQParam(SourceInputParam srcInputParam, int mode, int id) { + synchronized (mLock) { + Mutable<Integer> resultVal = new Mutable<>(); + try { + return mProxy.factoryGetPQParam(srcInputParam, mode, id); + } catch (RemoteException e) { + Log.e(TAG, "FactoryGetPQParam:" + e); + } + } + return -1; + + } + + public int FactorySetColorTemperatureParam(int colortemperature_mode, int id, int value) { + synchronized (mLock) { + try { + return mProxy.factorySetColorTemperatureParam(colortemperature_mode, id, value); + } catch (RemoteException e) { + Log.e(TAG, "FactorySetColorTemperatureParam:" + e); + } + } + return -1; + + } + + public int FactoryGetColorTemperatureParam(int colortemperature_mode, int id) { + synchronized (mLock) { + try { + return mProxy.factoryGetColorTemperatureParam(colortemperature_mode, id); + } catch (RemoteException e) { + Log.e(TAG, "factoryGetColorTemperatureParam:" + e); + } + } + return -1; + + + } + + public int FactorySaveColorTemperatureParam(int colortemperature_mode, int id, int value) { + synchronized (mLock) { + try { + return mProxy.factorySaveColorTemperatureParam(colortemperature_mode, id, value); + } catch (RemoteException e) { + Log.e(TAG, "FactorySaveColorTemperatureParam:" + e); + } + } + return -1; + + } + + public int FactorySetOverscan(SourceInputParam srcInputParam, int he_value, int hs_value, int ve_value, int vs_value) { + synchronized (mLock) { + try { + return mProxy.factorySetOverscan(srcInputParam, he_value, hs_value, ve_value, vs_value); + } catch (RemoteException e) { + Log.e(TAG, "FactorySaveColorTemperatureParam:" + e); + } + } + return -1; + + } + + public int FactoryGetOverscan(SourceInputParam srcInputParam, int id) { + synchronized (mLock) { + Mutable<Integer> resultVal = new Mutable<>(); + try { + return mProxy.factoryGetOverscan(srcInputParam, id); + } catch (RemoteException e) { + Log.e(TAG, "FactoryGetOverscan:" + e); + } + } + return -1; + + } + + public int FactorySetNolineParams(SourceInputParam srcInputParam, int type, int osd0_value, int osd25_value, + int osd50_value, int osd75_value, int osd100_value) { + synchronized (mLock) { + try { + return mProxy.factorySetNolineParams(srcInputParam, type, osd0_value, osd25_value, osd50_value, osd75_value, osd100_value); + } catch (RemoteException e) { + Log.e(TAG, "FactorySetNolineParams:" + e); + } + } + return -1; + } + + public int FactoryGetNolineParams(SourceInputParam srcInputParam, int type, int id) { + synchronized (mLock) { + try { + return mProxy.factoryGetNolineParams(srcInputParam, type, id); + } catch (RemoteException e) { + Log.e(TAG, "FactoryGetNolineParams:" + e); + } + } + return -1; + + } + + public int FactorySetParamsDefault() { + synchronized (mLock) { + try { + return mProxy.factorySetParamsDefault(); + } catch (RemoteException e) { + Log.e(TAG, "FactorySetParamsDefault:" + e); + } + } + return -1; + + } + + public int FactorySSMRestore() { + synchronized (mLock) { + try { + return mProxy.factorySSMRestore(); + } catch (RemoteException e) { + Log.e(TAG, "FactorySSMRestore:" + e); + } + } + return -1; + + } + + public int FactoryResetNonlinear() { + synchronized (mLock) { + try { + return mProxy.factoryResetNonlinear(); + } catch (RemoteException e) { + Log.e(TAG, "FactoryResetNonlinear:" + e); + } + } + return -1; + } + + public int FactorySetGamma(int gamma_r, int gamma_g, int gamma_b) { + synchronized (mLock) { + try { + return mProxy.factorySetGamma(gamma_r, gamma_g, gamma_b); + } catch (RemoteException e) { + Log.e(TAG, "FactorySetGamma:" + e); + } + } + return -1; + } + + public int SysSSMReadNTypes(int id, int data_len, int offset) { + synchronized (mLock) { + try { + return mProxy.sysSSMReadNTypes(id, data_len, offset); + } catch (RemoteException e) { + Log.e(TAG, "SysSSMReadNTypes:" + e); + } + } + return -1; + + } + + public int SysSSMWriteNTypes(int id, int data_len, int data_buf, int offset) { + synchronized (mLock) { + try { + return mProxy.sysSSMWriteNTypes(id, data_len, data_buf, offset); + } catch (RemoteException e) { + Log.e(TAG, "SysSSMWriteNTypes:" + e); + } + } + return -1; + + } + + public int GetActualAddr(int id) { + synchronized (mLock) { + Mutable<Integer> resultVal = new Mutable<>(); + try { + return mProxy.getActualAddr(id); + } catch (RemoteException e) { + Log.e(TAG, "GetActualAddr:" + e); + } + } + return -1; + + } + + public int GetActualSize(int id) { + synchronized (mLock) { + try { + return mProxy.getActualSize(id); + } catch (RemoteException e) { + Log.e(TAG, "GetActualSize:" + e); + } + } + return -1; + + } + + public int SSMRecovery() { + synchronized (mLock) { + try { + return mProxy.SSMRecovery(); + } catch (RemoteException e) { + Log.e(TAG, "SSMRecovery:" + e); + } + } + return -1; + + } + + public int SetPLLValues(SourceInputParam srcInputParam) { + synchronized (mLock) { + try { + return mProxy.setPLLValues(srcInputParam); + } catch (RemoteException e) { + Log.e(TAG, "SetPLLValues:" + e); + } + } + return -1; + + } + + public int SetCVD2Values(SourceInputParam srcInputParam) { + synchronized (mLock) { + try { + return mProxy.setCVD2Values(srcInputParam); + } catch (RemoteException e) { + Log.e(TAG, "SetCVD2Values:" + e); + } + } + return -1; + + } + + public int setPQConfig(int id, int value) { + synchronized (mLock) { + try { + return mProxy.setPQConfig(id, value); + } catch (RemoteException e) { + Log.e(TAG, "setPQConfig:" + e); + } + } + return -1; + } + + public int GetSSMStatus() { + synchronized (mLock) { + try { + return mProxy.getSSMStatus(); + } catch (RemoteException e) { + Log.e(TAG, "GetSSMStatus:" + e); + } + } + return -1; + } + + public int ResetLastPQSettingsSourceType() { + synchronized (mLock) { + try { + return mProxy.resetLastPQSettingsSourceType(); + } catch (RemoteException e) { + Log.e(TAG, "ResetLastPQSettingsSourceType:" + e); + } + } + return -1; + } + + public int SetCurrentSourceInfo(SourceInputParam srcInputParam) { + synchronized (mLock) { + try { + return mProxy.setCurrentSourceInfo(srcInputParam); + } catch (RemoteException e) { + Log.e(TAG, "SetCurrentSourceInfo:" + e); + } + } + return -1; + } + + public int GetAutoSwitchPCModeFlag() { + synchronized (mLock) { + try { + return mProxy.getAutoSwitchPCModeFlag(); + } catch (RemoteException e) { + Log.e(TAG, "GetAutoSwitchPCModeFlag:" + e); + } + } + return -1; + } + + /** + * @Function: Read the red gain with specified souce and color temperature + * @Param: + * @ Return value: the red gain value + * */ + public int FactoryWhiteBalanceSetRedGain(int sourceType, int colorTemp_mode, int value) { + synchronized (mLock) { + try { + return mProxy.setwhiteBalanceGainRed(sourceType, colorTemp_mode, value); + } catch (RemoteException e) { + Log.e(TAG, "FactoryWhiteBalanceSetRedGain:" + e); + } + } + return -1; + } + + public int FactoryWhiteBalanceSetGreenGain(int sourceType, int colorTemp_mode, int value) { + synchronized (mLock) { + try { + return mProxy.setwhiteBalanceGainGreen(sourceType, colorTemp_mode, value); + } catch (RemoteException e) { + Log.e(TAG, "FactoryWhiteBalanceSetGreenGain:" + e); + } + } + return -1; + } + + public int FactoryWhiteBalanceSetBlueGain(int sourceType, int colorTemp_mode, int value) { + synchronized (mLock) { + try { + return mProxy.setwhiteBalanceGainBlue(sourceType, colorTemp_mode, value); + } catch (RemoteException e) { + Log.e(TAG, "FactoryWhiteBalanceSetBlueGain:" + e); + } + } + return -1; + } + + public int FactoryWhiteBalanceGetRedGain(int sourceType, int colorTemp_mode) { + synchronized (mLock) { + try { + return mProxy.getwhiteBalanceGainRed(sourceType, colorTemp_mode); + } catch (RemoteException e) { + Log.e(TAG, "FactoryWhiteBalanceSetBlueGain:" + e); + } + } + return -1; + + } + + public int FactoryWhiteBalanceGetGreenGain(int sourceType, int colorTemp_mode) { + synchronized (mLock) { + try { + return mProxy.getwhiteBalanceGainGreen(sourceType, colorTemp_mode); + } catch (RemoteException e) { + Log.e(TAG, "FactoryWhiteBalanceGetRedGain:" + e); + } + } + return -1; + + } + + public int FactoryWhiteBalanceGetBlueGain(int sourceType, int colorTemp_mode) { + synchronized (mLock) { + try { + return mProxy.getwhiteBalanceGainBlue(sourceType, colorTemp_mode); + } catch (RemoteException e) { + Log.e(TAG, "FactoryWhiteBalanceGetBlueGain:" + e); + } + } + return -1; + + } + + public int FactoryWhiteBalanceSetRedOffset(int sourceType, int colorTemp_mode, int value) { + synchronized (mLock) { + try { + return mProxy.setwhiteBalanceOffsetRed(sourceType, colorTemp_mode, value); + } catch (RemoteException e) { + Log.e(TAG, "FactoryWhiteBalanceSetRedOffset:" + e); + } + } + return -1; + } + + public int FactoryWhiteBalanceSetGreenOffset(int sourceType, int colorTemp_mode, int value) { + synchronized (mLock) { + try { + return mProxy.setwhiteBalanceOffsetGreen(sourceType, colorTemp_mode, value); + } catch (RemoteException e) { + Log.e(TAG, "FactoryWhiteBalanceSetGreenOffset:" + e); + } + } + return -1; + } + + public int FactoryWhiteBalanceSetBlueOffset(int sourceType, int colorTemp_mode, int value) { + synchronized (mLock) { + try { + return mProxy.setwhiteBalanceOffsetBlue(sourceType, colorTemp_mode, value); + } catch (RemoteException e) { + Log.e(TAG, "FactoryWhiteBalanceSetBlueOffset:" + e); + } + } + return -1; + } + + public int FactoryWhiteBalanceGetRedOffset(int sourceType, int colorTemp_mode) { + synchronized (mLock) { + try { + return mProxy.getwhiteBalanceOffsetRed(sourceType, colorTemp_mode); + } catch (RemoteException e) { + Log.e(TAG, "FactoryWhiteBalanceSetBlueOffset:" + e); + } + } + return -1; + + } + + public int FactoryWhiteBalanceGetGreenOffset(int sourceType, int colorTemp_mode) { + synchronized (mLock) { + try { + return mProxy.getwhiteBalanceOffsetGreen(sourceType, colorTemp_mode); + } catch (RemoteException e) { + Log.e(TAG, "FactoryWhiteBalanceGetGreenOffset:" + e); + } + } + return -1; + + } + + public int FactoryWhiteBalanceGetBlueOffset(int sourceType, int colorTemp_mode) { + synchronized (mLock) { + try { + return mProxy.getwhiteBalanceOffsetBlue(sourceType, colorTemp_mode); + } catch (RemoteException e) { + Log.e(TAG, "FactoryWhiteBalanceGetBlueOffset:" + e); + } + } + return -1; + + } + + /** + * @Function: Save the white balance data to fbc or g9 + * @Param: + * @Return value: save OK: 0 , else -1 + * + * */ + public int FactoryWhiteBalanceSaveParameters(int sourceType, int colorTemp_mode, int r_gain, int g_gain, int b_gain, int r_offset, int g_offset, int b_offset) { + synchronized (mLock) { + try { + return mProxy.saveWhiteBalancePara(sourceType, colorTemp_mode, r_gain, g_gain, b_gain, r_offset, g_offset, b_offset); + } catch (RemoteException e) { + Log.e(TAG, "FactoryWhiteBalanceSaveParameters:" + e); + } + } + return -1; + } + + /** + * @Function: FactoryGetRGBScreen + * @Description: get rgb screen pattern + * @Return: rgb(0xrrggbb) + */ + public int FactoryGetRGBScreen() { + synchronized (mLock) { + try { + return mProxy.getRGBPattern(); + } catch (RemoteException e) { + Log.e(TAG, "FactoryGetRGBScreen:" + e); + } + } + return -1; + } + + /** + * @Function: FactorySetRGBScreen + * @Description: set test pattern with rgb. + * @Param r,g,b int 0~255 + * @Return: -1 failed, otherwise success + */ + public int FactorySetRGBScreen(int r, int g, int b) { + synchronized (mLock) { + try { + return mProxy.setRGBPattern(r, g, b); + } catch (RemoteException e) { + Log.e(TAG, "FactorySetRGBScreen:" + e); + } + } + return -1; + + } + private static class Mutable<E> { public E value; diff --git a/frameworks/services/systemcontrol/PQ/include/CPQControl.h b/frameworks/services/systemcontrol/PQ/include/CPQControl.h index ca085a0..9204591 100644 --- a/frameworks/services/systemcontrol/PQ/include/CPQControl.h +++ b/frameworks/services/systemcontrol/PQ/include/CPQControl.h @@ -135,24 +135,6 @@ public: int FactoryGetPQMode_Sharpness(source_input_param_t source_input_param, int pq_mode ); int FactorySetPQMode_Hue(source_input_param_t source_input_param, int pq_mode, int hue ); int FactoryGetPQMode_Hue(source_input_param_t source_input_param, int pq_mode ); - int FactorySetColorTemp_Rgain(int colortemp_mode, int rgain ); - int FactorySaveColorTemp_Rgain(int colortemp_mode, int rgain ); - int FactoryGetColorTemp_Rgain(int colortemp_mode ); - int FactorySetColorTemp_Ggain(int colortemp_mode, int ggain ); - int FactorySaveColorTemp_Ggain(int colortemp_mode, int ggain ); - int FactoryGetColorTemp_Ggain(int colortemp_mode ); - int FactorySetColorTemp_Bgain(int colortemp_mode, int bgain ); - int FactorySaveColorTemp_Bgain(int colortemp_mode, int bgain ); - int FactoryGetColorTemp_Bgain(int colortemp_mode ); - int FactorySetColorTemp_Roffset(int colortemp_mode, int roffset ); - int FactorySaveColorTemp_Roffset(int colortemp_mode, int roffset ); - int FactoryGetColorTemp_Roffset(int colortemp_mode ); - int FactorySetColorTemp_Goffset(int colortemp_mode, int goffset ); - int FactorySaveColorTemp_Goffset(int colortemp_mode, int goffset ); - int FactoryGetColorTemp_Goffset(int colortemp_mode ); - int FactorySetColorTemp_Boffset(int colortemp_mode, int boffset ); - int FactorySaveColorTemp_Boffset(int colortemp_mode, int boffset ); - int FactoryGetColorTemp_Boffset(int colortemp_mode ); int FactoryGetTestPattern(void ); int FactoryResetNonlinear(void); diff --git a/frameworks/services/systemcontrol/SystemControlClient.cpp b/frameworks/services/systemcontrol/SystemControlClient.cpp index 9506b28..894c14b 100644 --- a/frameworks/services/systemcontrol/SystemControlClient.cpp +++ b/frameworks/services/systemcontrol/SystemControlClient.cpp @@ -742,6 +742,67 @@ int SystemControlClient::getAutoSwitchPCModeFlag(void) { } //PQ end +int SystemControlClient::setwhiteBalanceGainRed(int32_t inputSrc, int32_t colortemp_mode, int32_t value) { + return mSysCtrl->setwhiteBalanceGainRed(inputSrc, colortemp_mode, value); +} + +int SystemControlClient::setwhiteBalanceGainGreen(int32_t inputSrc, int32_t colortemp_mode, int32_t value) { + return mSysCtrl->setwhiteBalanceGainGreen(inputSrc, colortemp_mode, value); +} + +int SystemControlClient::setwhiteBalanceGainBlue(int32_t inputSrc, int32_t colortemp_mode, int32_t value) { + return mSysCtrl->setwhiteBalanceGainBlue(inputSrc, colortemp_mode, value); +} + +int SystemControlClient::setwhiteBalanceOffsetRed(int32_t inputSrc, int32_t colortemp_mode, int32_t value) { + return mSysCtrl->setwhiteBalanceOffsetRed(inputSrc, colortemp_mode, value); +} + +int SystemControlClient::setwhiteBalanceOffsetGreen(int32_t inputSrc, int32_t colortemp_mode, int32_t value) { + return mSysCtrl->setwhiteBalanceOffsetGreen(inputSrc, colortemp_mode, value); +} + +int SystemControlClient::setwhiteBalanceOffsetBlue(int32_t inputSrc, int32_t colortemp_mode, int32_t value) { + return mSysCtrl->setwhiteBalanceOffsetBlue(inputSrc, colortemp_mode, value); +} + +int SystemControlClient::getwhiteBalanceGainRed(int32_t inputSrc, int32_t colortemp_mode) { + return mSysCtrl->getwhiteBalanceGainRed(inputSrc, colortemp_mode); +} + +int SystemControlClient::getwhiteBalanceGainGreen(int32_t inputSrc, int32_t colortemp_mode) { + return mSysCtrl->getwhiteBalanceGainGreen(inputSrc, colortemp_mode); +} + +int SystemControlClient::getwhiteBalanceGainBlue(int32_t inputSrc, int32_t colortemp_mode) { + return mSysCtrl->getwhiteBalanceGainBlue(inputSrc, colortemp_mode); +} + +int SystemControlClient::getwhiteBalanceOffsetRed(int32_t inputSrc, int32_t colortemp_mode) { + return mSysCtrl->getwhiteBalanceOffsetRed(inputSrc, colortemp_mode); +} + +int SystemControlClient::getwhiteBalanceOffsetGreen(int32_t inputSrc, int32_t colortemp_mode) { + return mSysCtrl->getwhiteBalanceOffsetGreen(inputSrc, colortemp_mode); +} + +int SystemControlClient::getwhiteBalanceOffsetBlue(int32_t inputSrc, int32_t colortemp_mode) { + return mSysCtrl->getwhiteBalanceOffsetBlue(inputSrc, colortemp_mode); +} + +int SystemControlClient:: saveWhiteBalancePara(int32_t sourceType, int32_t colorTemp_mode, int32_t r_gain, int32_t g_gain, int32_t b_gain, int32_t r_offset, int32_t g_offset, int32_t +b_offset) { + return mSysCtrl->saveWhiteBalancePara(sourceType, colorTemp_mode, r_gain, g_gain, b_gain, r_offset, g_offset, b_offset); +} + +int SystemControlClient::getRGBPattern() { + return mSysCtrl->getRGBPattern(); +} + +int SystemControlClient::setRGBPattern(int32_t r, int32_t g, int32_t b) { + return mSysCtrl->setRGBPattern(r, g, b); +} + void SystemControlClient::SystemControlDeathRecipient::serviceDied(uint64_t cookie, const ::android::wp<::android::hidl::base::V1_0::IBase>& who) { LOG(ERROR) << "system control service died. need release some resources"; diff --git a/frameworks/services/systemcontrol/SystemControlClient.h b/frameworks/services/systemcontrol/SystemControlClient.h index d59a8e6..5a033b4 100644 --- a/frameworks/services/systemcontrol/SystemControlClient.h +++ b/frameworks/services/systemcontrol/SystemControlClient.h @@ -175,6 +175,22 @@ public: int setCurrentSourceInfo(source_input_param_t srcInputParam); int getAutoSwitchPCModeFlag(void); //PQ end + int setwhiteBalanceGainRed(int32_t inputSrc, int32_t colortemp_mode, int32_t value); + int setwhiteBalanceGainGreen(int32_t inputSrc, int32_t colortemp_mode, int32_t value); + int setwhiteBalanceGainBlue(int32_t inputSrc, int32_t colortemp_mode, int32_t value); + int setwhiteBalanceOffsetRed(int32_t inputSrc, int32_t colortemp_mode, int32_t value); + int setwhiteBalanceOffsetGreen(int32_t inputSrc, int32_t colortemp_mode, int32_t value); + int setwhiteBalanceOffsetBlue(int32_t inputSrc, int32_t colortemp_mode, int32_t value); + int getwhiteBalanceGainRed(int32_t inputSrc, int32_t colortemp_mode); + int getwhiteBalanceGainGreen(int32_t inputSrc, int32_t colortemp_mode); + int getwhiteBalanceGainBlue(int32_t inputSrc, int32_t colortemp_mode); + int getwhiteBalanceOffsetRed(int32_t inputSrc, int32_t colortemp_mode); + int getwhiteBalanceOffsetGreen(int32_t inputSrc, int32_t colortemp_mode); + int getwhiteBalanceOffsetBlue(int32_t inputSrc, int32_t colortemp_mode); + int saveWhiteBalancePara(int32_t sourceType, int32_t colorTemp_mode, int32_t r_gain, int32_t g_gain, int32_t b_gain, int32_t r_offset, int32_t g_offset, int32_t + b_offset); + int getRGBPattern(); + int setRGBPattern(int32_t r, int32_t g, int32_t b); private: struct SystemControlDeathRecipient : public android::hardware::hidl_death_recipient { diff --git a/frameworks/services/systemcontrol/SystemControlHal.cpp b/frameworks/services/systemcontrol/SystemControlHal.cpp index 29b2cae..ba09336 100644 --- a/frameworks/services/systemcontrol/SystemControlHal.cpp +++ b/frameworks/services/systemcontrol/SystemControlHal.cpp @@ -735,6 +735,67 @@ Return<int32_t> SystemControlHal::getAutoSwitchPCModeFlag(void) { } //PQ end +Return<int32_t> SystemControlHal::setwhiteBalanceGainRed(int32_t inputSrc, int32_t colortemp_mode, int32_t value) { + return mSysControl->setwhiteBalanceGainRed(inputSrc, colortemp_mode, value); +} + +Return<int32_t> SystemControlHal::setwhiteBalanceGainGreen(int32_t inputSrc, int32_t colortemp_mode, int32_t value) { + return mSysControl->setwhiteBalanceGainGreen(inputSrc, colortemp_mode, value); +} + +Return<int32_t> SystemControlHal::setwhiteBalanceGainBlue(int32_t inputSrc, int32_t colortemp_mode, int32_t value) { + return mSysControl->setwhiteBalanceGainBlue(inputSrc, colortemp_mode, value); +} + +Return<int32_t> SystemControlHal::setwhiteBalanceOffsetRed(int32_t inputSrc, int32_t colortemp_mode, int32_t value) { + return mSysControl->setwhiteBalanceOffsetRed(inputSrc, colortemp_mode, value); +} + +Return<int32_t> SystemControlHal::setwhiteBalanceOffsetGreen(int32_t inputSrc, int32_t colortemp_mode, int32_t value) { + return mSysControl->setwhiteBalanceOffsetGreen(inputSrc, colortemp_mode, value); +} + +Return<int32_t> SystemControlHal::setwhiteBalanceOffsetBlue(int32_t inputSrc, int32_t colortemp_mode, int32_t value) { + return mSysControl->setwhiteBalanceOffsetBlue(inputSrc, colortemp_mode, value); +} + +Return<int32_t> SystemControlHal::getwhiteBalanceGainRed(int32_t inputSrc, int32_t colortemp_mode) { + return mSysControl->getwhiteBalanceGainRed(inputSrc, colortemp_mode); +} + +Return<int32_t> SystemControlHal::getwhiteBalanceGainGreen(int32_t inputSrc, int32_t colortemp_mode) { + return mSysControl->getwhiteBalanceGainGreen(inputSrc, colortemp_mode); +} + +Return<int32_t> SystemControlHal::getwhiteBalanceGainBlue(int32_t inputSrc, int32_t colortemp_mode) { + return mSysControl->getwhiteBalanceGainBlue(inputSrc, colortemp_mode); +} + +Return<int32_t> SystemControlHal::getwhiteBalanceOffsetRed(int32_t inputSrc, int32_t colortemp_mode) { + return mSysControl->getwhiteBalanceOffsetRed(inputSrc, colortemp_mode); +} + +Return<int32_t> SystemControlHal::getwhiteBalanceOffsetGreen(int32_t inputSrc, int32_t colortemp_mode) { + return mSysControl->getwhiteBalanceOffsetGreen(inputSrc, colortemp_mode); +} + +Return<int32_t> SystemControlHal::getwhiteBalanceOffsetBlue(int32_t inputSrc, int32_t colortemp_mode) { + return mSysControl->getwhiteBalanceOffsetBlue(inputSrc, colortemp_mode); +} + +Return<int32_t> SystemControlHal::saveWhiteBalancePara(int32_t sourceType, int32_t colorTemp_mode, int32_t r_gain, int32_t g_gain, int32_t b_gain, int32_t r_offset, int32_t g_offset, int32_t + b_offset) { + return mSysControl->saveWhiteBalancePara(sourceType, colorTemp_mode, r_gain, g_gain, b_gain, r_offset, g_offset, b_offset); +} + +Return<int32_t> SystemControlHal::getRGBPattern() { + return mSysControl->getRGBPattern(); +} + +Return<int32_t> SystemControlHal::setRGBPattern(int32_t r, int32_t g, int32_t b) { + return mSysControl->setRGBPattern(r, g, b); +} + void SystemControlHal::handleServiceDeath(uint32_t cookie) { mClients[cookie]->unlinkToDeath(mDeathRecipient); mClients[cookie].clear(); diff --git a/frameworks/services/systemcontrol/SystemControlHal.h b/frameworks/services/systemcontrol/SystemControlHal.h index 047fbc7..8e4bc07 100644 --- a/frameworks/services/systemcontrol/SystemControlHal.h +++ b/frameworks/services/systemcontrol/SystemControlHal.h @@ -170,6 +170,23 @@ class SystemControlHal : public ISystemControl, public SystemControlNotify { Return<int32_t> getAutoSwitchPCModeFlag(void) override; //PQ end + Return<int32_t> setwhiteBalanceGainRed(int32_t inputSrc, int32_t colortemp_mode, int32_t value) override; + Return<int32_t> setwhiteBalanceGainGreen(int32_t inputSrc, int32_t colortemp_mode, int32_t value) override; + Return<int32_t> setwhiteBalanceGainBlue(int32_t inputSrc, int32_t colortemp_mode, int32_t value) override; + Return<int32_t> setwhiteBalanceOffsetRed(int32_t inputSrc, int32_t colortemp_mode, int32_t value) override; + Return<int32_t> setwhiteBalanceOffsetGreen(int32_t inputSrc, int32_t colortemp_mode, int32_t value) override; + Return<int32_t> setwhiteBalanceOffsetBlue(int32_t inputSrc, int32_t colortemp_mode, int32_t value) override; + Return<int32_t> getwhiteBalanceGainRed(int32_t inputSrc, int32_t colortemp_mode) override; + Return<int32_t> getwhiteBalanceGainGreen(int32_t inputSrc, int32_t colortemp_mode) override; + Return<int32_t> getwhiteBalanceGainBlue(int32_t inputSrc, int32_t colortemp_mode) override; + Return<int32_t> getwhiteBalanceOffsetRed(int32_t inputSrc, int32_t colortemp_mode) override; + Return<int32_t> getwhiteBalanceOffsetGreen(int32_t inputSrc, int32_t colortemp_mode) override; + Return<int32_t> getwhiteBalanceOffsetBlue(int32_t inputSrc, int32_t colortemp_mode) override; + Return<int32_t> saveWhiteBalancePara(int32_t sourceType, int32_t colorTemp_mode, int32_t r_gain, int32_t g_gain, int32_t b_gain, int32_t r_offset, int32_t g_offset, int32_t + b_offset) override; + Return<int32_t> getRGBPattern() override; + Return<int32_t> setRGBPattern(int32_t r, int32_t g, int32_t b) override; + virtual void onEvent(int event); private: diff --git a/frameworks/services/systemcontrol/SystemControlService.cpp b/frameworks/services/systemcontrol/SystemControlService.cpp index f3409e5..70f2113 100644 --- a/frameworks/services/systemcontrol/SystemControlService.cpp +++ b/frameworks/services/systemcontrol/SystemControlService.cpp @@ -33,6 +33,8 @@ #include "SystemControlService.h" +#define VIDEO_RGB_SCREEN "/sys/class/video/rgb_screen" + namespace android { SystemControlService* SystemControlService::instantiate(const char *cfgpath) { @@ -903,6 +905,154 @@ int SystemControlService::getAutoSwitchPCModeFlag(void) } //PQ end +int SystemControlService::setwhiteBalanceGainRed(int inputSrc, int colortemp_mode, int value) { + int ret = -1; + if (value < 0) { + value = 0; + } else if (value > 2047) { + value = 2047; + } + + ret = pCPQControl->FactorySetColorTemperatureParam(colortemp_mode, GAIN_R, value); + if (ret != -1) { + ALOGI("save the red gain to flash"); + ret = pCPQControl->FactorySaveColorTemperatureParam(colortemp_mode, GAIN_R, value); + } + return ret; +} + +int SystemControlService::setwhiteBalanceGainGreen(int inputSrc, int colortemp_mode, int value) { + int ret = -1; + if (value < 0) { + value = 0; + } else if (value > 2047) { + value = 2047; + } + // not use fbc store the white balance params + ret = pCPQControl->FactorySetColorTemperatureParam(colortemp_mode, GAIN_G, value); + if (ret != -1) { + ALOGI("save the green gain to flash"); + ret = pCPQControl->FactorySaveColorTemperatureParam(colortemp_mode, GAIN_G, value); + } + return ret; +} + +int SystemControlService::setwhiteBalanceGainBlue(int inputSrc, int colortemp_mode, int value) { + int ret = -1; + if (value < 0) { + value = 0; + } else if (value > 2047) { + value = 2047; + } + // not use fbc store the white balance params + ret = pCPQControl->FactorySetColorTemperatureParam(colortemp_mode, GAIN_B, value); + if (ret != -1) { + ALOGI("save the blue gain to flash"); + ret = pCPQControl->FactorySaveColorTemperatureParam(colortemp_mode, GAIN_B, value); + } + return ret; +} + +int SystemControlService::setwhiteBalanceOffsetRed(int inputSrc, int colortemp_mode, int value) { + int ret = -1; + if (value < -1024) { + value = -1024; + } else if (value > 1023) { + value = 1023; + } + // not use fbc store the white balance params + ret = pCPQControl->FactorySetColorTemperatureParam(colortemp_mode, POST_OFFSET_R, value); + if (ret != -1) { + ALOGI("save the red offset to flash"); + ret = pCPQControl->FactorySaveColorTemperatureParam(colortemp_mode, POST_OFFSET_R, value); + } + return ret; +} + +int SystemControlService::setwhiteBalanceOffsetGreen(int inputSrc, int colortemp_mode, int value) { + int ret = -1; + if (value < -1024) { + value = -1024; + } else if (value > 1023) { + value = 1023; + } + // not use fbc store the white balance params + ret = pCPQControl->FactorySetColorTemperatureParam(colortemp_mode, POST_OFFSET_G, value); + if (ret != -1) { + ALOGI("save the green offset to flash"); + ret = pCPQControl->FactorySaveColorTemperatureParam(colortemp_mode, POST_OFFSET_G, value); + } + + return ret; +} + +int SystemControlService::setwhiteBalanceOffsetBlue(int inputSrc, int colortemp_mode, int value) { + int ret = -1; + if (value < -1024) { + value = -1024; + } else if (value > 1023) { + value = 1023; + } + // not use fbc store the white balance params + ret = pCPQControl->FactorySetColorTemperatureParam(colortemp_mode, POST_OFFSET_B, value); + if (ret != -1) { + ALOGI("save the green offset to flash"); + ret = pCPQControl->FactorySaveColorTemperatureParam(colortemp_mode, POST_OFFSET_B, value); + } + + return ret; +} + +int SystemControlService::getwhiteBalanceGainRed(int inputSrc, int colortemp_mode) { + return pCPQControl->FactoryGetColorTemperatureParam(colortemp_mode, GAIN_R); +} + +int SystemControlService::getwhiteBalanceGainGreen(int inputSrc, int colortemp_mode) { + return pCPQControl->FactoryGetColorTemperatureParam(colortemp_mode, GAIN_G); +} + +int SystemControlService::getwhiteBalanceGainBlue(int inputSrc, int colortemp_mode) { + return pCPQControl->FactoryGetColorTemperatureParam(colortemp_mode, GAIN_B); +} + +int SystemControlService::getwhiteBalanceOffsetRed(int inputSrc, int colortemp_mode) { + return pCPQControl->FactoryGetColorTemperatureParam(colortemp_mode, POST_OFFSET_R); +} + +int SystemControlService::getwhiteBalanceOffsetGreen(int inputSrc, int colortemp_mode) { + return pCPQControl->FactoryGetColorTemperatureParam(colortemp_mode, POST_OFFSET_G); +} + +int SystemControlService::getwhiteBalanceOffsetBlue(int inputSrc, int colortemp_mode) { + return pCPQControl->FactoryGetColorTemperatureParam(colortemp_mode, POST_OFFSET_B); +} + +int SystemControlService::saveWhiteBalancePara(int sourceType, int colorTemp_mode, int r_gain, int g_gain, int b_gain, int r_offset, int g_offset, int b_offset) { + int ret = 0; + pCPQControl->SaveColorTemperature(colorTemp_mode); + pCPQControl->FactorySaveColorTemperatureParam(colorTemp_mode, GAIN_R, r_gain); + pCPQControl->FactorySaveColorTemperatureParam(colorTemp_mode, GAIN_G, g_gain); + pCPQControl->FactorySaveColorTemperatureParam( colorTemp_mode, GAIN_B, b_gain); + pCPQControl->FactorySaveColorTemperatureParam(colorTemp_mode, POST_OFFSET_R, r_offset); + pCPQControl->FactorySaveColorTemperatureParam(colorTemp_mode, POST_OFFSET_G, g_offset); + pCPQControl->FactorySaveColorTemperatureParam(colorTemp_mode, POST_OFFSET_B, b_offset); + return ret; +} + +int SystemControlService::getRGBPattern() { + char value[32] = {0}; + bool ret = pSysWrite->readSysfs(VIDEO_RGB_SCREEN, value); + return strtol(value, NULL, 10); +} + +int SystemControlService::setRGBPattern(int r, int g, int b) { + int value = ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff); + char str[32] = {0}; + sprintf(str, "%d", value); + bool ret = pSysWrite->writeSysfs(VIDEO_RGB_SCREEN, str, 16); + return ret; +} + void SystemControlService::traceValue(const std::string& type, const std::string& key, const std::string& value) { if (mLogLevel > LOG_LEVEL_1) { /* diff --git a/frameworks/services/systemcontrol/SystemControlService.h b/frameworks/services/systemcontrol/SystemControlService.h index cfdbd24..98d78ba 100644 --- a/frameworks/services/systemcontrol/SystemControlService.h +++ b/frameworks/services/systemcontrol/SystemControlService.h @@ -179,6 +179,22 @@ public: int setCurrentSourceInfo(source_input_param_t srcInputParam); int getAutoSwitchPCModeFlag(void); //PQ end + int setwhiteBalanceGainRed(int inputSrc, int colortemp_mode, int value); + int setwhiteBalanceGainGreen(int inputSrc, int colortemp_mode, int value); + int setwhiteBalanceGainBlue(int inputSrc, int colortemp_mode, int value); + int setwhiteBalanceOffsetRed(int inputSrc, int colortemp_mode, int value); + int setwhiteBalanceOffsetGreen(int inputSrc, int colortemp_mode, int value); + int setwhiteBalanceOffsetBlue(int inputSrc, int colortemp_mode, int value); + int getwhiteBalanceGainRed(int inputSrc, int colortemp_mode); + int getwhiteBalanceGainGreen(int inputSrc, int colortemp_mode); + int getwhiteBalanceGainBlue(int inputSrc, int colortemp_mode); + int getwhiteBalanceOffsetRed(int inputSrc, int colortemp_mode); + int getwhiteBalanceOffsetGreen(int inputSrc, int colortemp_mode); + int getwhiteBalanceOffsetBlue(int inputSrc, int colortemp_mode); + int saveWhiteBalancePara(int sourceType, int colorTemp_mode, int r_gain, int g_gain, int b_gain, int r_offset, int g_offset, int + b_offset); + int getRGBPattern(); + int setRGBPattern(int r, int g, int b); static SystemControlService* instantiate(const char *cfgpath); diff --git a/interfaces/systemcontrol/1.0/ISystemControl.hal b/interfaces/systemcontrol/1.0/ISystemControl.hal index 5288c85..85c07ed 100644 --- a/interfaces/systemcontrol/1.0/ISystemControl.hal +++ b/interfaces/systemcontrol/1.0/ISystemControl.hal @@ -374,4 +374,49 @@ interface ISystemControl { getAutoSwitchPCModeFlag() generates (int32_t ret); //PD END + + setwhiteBalanceGainRed(int32_t inputSrc, int32_t colortemp_mode, int32_t value) + generates (int32_t ret); + + setwhiteBalanceGainGreen(int32_t inputSrc, int32_t colortemp_mode, int32_t value) + generates (int32_t ret); + + setwhiteBalanceGainBlue(int32_t inputSrc, int32_t colortemp_mode, int32_t value) + generates (int32_t ret); + + setwhiteBalanceOffsetRed(int32_t inputSrc, int32_t colortemp_mode, int32_t value) + generates (int32_t ret); + + setwhiteBalanceOffsetGreen(int32_t inputSrc, int32_t colortemp_mode, int32_t value) + generates (int32_t ret); + + setwhiteBalanceOffsetBlue(int32_t inputSrc, int32_t colortemp_mode, int32_t value) + generates (int32_t ret); + + getwhiteBalanceGainRed(int32_t inputSrc, int32_t colortemp_mode) + generates (int32_t ret); + + getwhiteBalanceGainGreen(int32_t inputSrc, int32_t colortemp_mode) + generates (int32_t ret); + + getwhiteBalanceGainBlue(int32_t inputSrc, int32_t colortemp_mode) + generates (int32_t ret); + + getwhiteBalanceOffsetRed(int32_t inputSrc, int32_t colortemp_mode) + generates (int32_t ret); + + getwhiteBalanceOffsetGreen(int32_t inputSrc, int32_t colortemp_mode) + generates (int32_t ret); + + getwhiteBalanceOffsetBlue(int32_t inputSrc, int32_t colortemp_mode) + generates (int32_t ret); + + saveWhiteBalancePara(int32_t sourceType, int32_t colorTemp_mode, int32_t r_gain, int32_t g_gain, int32_t b_gain, int32_t r_offset, int32_t g_offset, int32_t b_offset) + generates (int32_t ret); + + getRGBPattern() + generates (int32_t ret); + + setRGBPattern(int32_t r, int32_t g, int32_t b) + generates (int32_t ret); }; diff --git a/interfaces/tvserver/1.0/ITvServer.hal b/interfaces/tvserver/1.0/ITvServer.hal index 27a1915..f8c53c6 100644 --- a/interfaces/tvserver/1.0/ITvServer.hal +++ b/interfaces/tvserver/1.0/ITvServer.hal @@ -70,4 +70,12 @@ interface ITvServer { isVgaTimingInHdmi() generates (int32_t signal); + ssmSaveHDMIEdidMode(int32_t port_id, int32_t ver) + generates (int32_t ret); + + setHdmiEdidVersion(int32_t port_id, int32_t ver) + generates (int32_t ret); + + handleGPIO(string key, int32_t is_out, int32_t edge) + generates (int32_t ret); }; diff --git a/tv/frameworks/core/java/com/droidlogic/app/tv/TvControlManager.java b/tv/frameworks/core/java/com/droidlogic/app/tv/TvControlManager.java index 9f1734a..97c9bcd 100644 --- a/tv/frameworks/core/java/com/droidlogic/app/tv/TvControlManager.java +++ b/tv/frameworks/core/java/com/droidlogic/app/tv/TvControlManager.java @@ -1064,8 +1064,14 @@ public class TvControlManager { * @Return: 0 success, -1 fail */ public int SetHdmiEdidVersion(HdmiPortID port_id, HdmiEdidVer ver) { - int val[] = new int[]{port_id.toInt(), ver.toInt()}; - return sendCmdIntArray(SET_HDMI_EDID_VER, val); + synchronized (mLock) { + try { + return mProxy.setHdmiEdidVersion(port_id.toInt(), ver.toInt()); + } catch (RemoteException e) { + Log.e(TAG, "SetHdmiEdidVersion:" + e); + } + } + return -1; } /** @@ -3658,8 +3664,14 @@ public class TvControlManager { * @Return: 0 success, -1 fail */ public int SSMSaveHdmiEdidVer(HdmiPortID port_id, HdmiEdidVer ver) { - int val[] = new int[]{port_id.toInt(), ver.toInt()}; - return sendCmdIntArray(SSM_SAVE_HDMI_EDID_VER, val); + synchronized (mLock) { + try { + return mProxy.ssmSaveHDMIEdidMode(port_id.toInt(), ver.toInt()); + } catch (RemoteException e) { + Log.e(TAG, "FactoryWhiteBalanceGetGreenOffset:" + e); + } + } + return -1; } /** @@ -6787,17 +6799,14 @@ public class TvControlManager { * @param edge validly when {@param is_out} is true, 1/0 high/low */ public int handleGPIO(String portName, boolean isOut, int edge) { - Parcel cmd = Parcel.obtain(); - Parcel r = Parcel.obtain(); - cmd.writeInt(HANDLE_GPIO); - cmd.writeString(portName); - cmd.writeInt(isOut ? 1 : 0); - cmd.writeInt(edge); - sendCmdToTv(cmd, r); - int ret = r.readInt(); - cmd.recycle(); - r.recycle(); - return ret; + synchronized (mLock) { + try { + return mProxy.handleGPIO(portName, isOut ? 1 : 0, edge); + } catch (RemoteException e) { + Log.e(TAG, "handleGPIO:" + e); + } + } + return -1; } /** diff --git a/tv/frameworks/libtvbinder/TvServerHidlClient.cpp b/tv/frameworks/libtvbinder/TvServerHidlClient.cpp index 2e7ad6a..53c6b1b 100644 --- a/tv/frameworks/libtvbinder/TvServerHidlClient.cpp +++ b/tv/frameworks/libtvbinder/TvServerHidlClient.cpp @@ -218,6 +218,17 @@ std::string TvServerHidlClient::getMiscCfg(const std::string& key, const std::st return miscCfg; } +int TvServerHidlClient:: ssmSaveHDMIEdidMode(int32_t port_id, int32_t ver) { + return mTvServer->ssmSaveHDMIEdidMode(port_id, ver); +} + +int TvServerHidlClient::setHdmiEdidVersion(int32_t port_id, int32_t ver) { + return mTvServer->setHdmiEdidVersion(port_id, ver); +} + +int TvServerHidlClient::handleGPIO(const std::string& key, int32_t is_out, int32_t edge) { + return mTvServer->handleGPIO(key, is_out, edge); +} // callback from tv service Return<void> TvServerHidlClient::TvServerHidlCallback::notifyCallback(const TvHidlParcel& hidlParcel) diff --git a/tv/frameworks/libtvbinder/include/TvServerHidlClient.h b/tv/frameworks/libtvbinder/include/TvServerHidlClient.h index f2df5f2..78a9f69 100644 --- a/tv/frameworks/libtvbinder/include/TvServerHidlClient.h +++ b/tv/frameworks/libtvbinder/include/TvServerHidlClient.h @@ -85,6 +85,9 @@ public: void getCurSignalInfo(int &fmt, int &transFmt, int &status, int &frameRate); int setMiscCfg(const std::string& key, const std::string& val); std::string getMiscCfg(const std::string& key, const std::string& def); + int ssmSaveHDMIEdidMode(int32_t port_id, int32_t ver); + int setHdmiEdidVersion(int32_t port_id, int32_t ver); + int handleGPIO(const std::string& key, int32_t is_out, int32_t edge); private: class TvServerHidlCallback : public ITvServerCallback { diff --git a/tv/tvserver/tvserver/DroidTvServer.cpp b/tv/tvserver/tvserver/DroidTvServer.cpp index 16512a9..20021c7 100644 --- a/tv/tvserver/tvserver/DroidTvServer.cpp +++ b/tv/tvserver/tvserver/DroidTvServer.cpp @@ -183,6 +183,17 @@ Return<int32_t> DroidTvServer::isVgaTimingInHdmi() { return mTvServiceIntf->getHdmiPorts(); } +Return<int32_t> DroidTvServer::ssmSaveHDMIEdidMode(int32_t port_id, int32_t ver) { + return mTvServiceIntf->ssmSaveHDMIEdidMode(port_id, ver); +} + +Return<int32_t> DroidTvServer::setHdmiEdidVersion(int32_t port_id, int32_t ver) { + return mTvServiceIntf->setHdmiEdidVersion(port_id, ver); +} + +Return<int32_t> DroidTvServer::handleGPIO(const hidl_string& key, int32_t is_out, int32_t edge) { + return mTvServiceIntf->handleGPIO(key, is_out, edge); +} Return<void> DroidTvServer::setCallback(const sp<ITvServerCallback>& callback, ConnectType type) { if ((int)type > (int)ConnectType::TYPE_TOTAL - 1) { diff --git a/tv/tvserver/tvserver/DroidTvServer.h b/tv/tvserver/tvserver/DroidTvServer.h index c3d27c9..d6de40b 100644 --- a/tv/tvserver/tvserver/DroidTvServer.h +++ b/tv/tvserver/tvserver/DroidTvServer.h @@ -80,7 +80,9 @@ public: Return<int32_t> isDviSIgnal() override; Return<int32_t> isVgaTimingInHdmi() override; - + Return<int32_t> ssmSaveHDMIEdidMode(int32_t port_id, int32_t ver) override; + Return<int32_t> setHdmiEdidVersion(int32_t port_id, int32_t ver) override; + Return<int32_t> handleGPIO(const hidl_string& key, int32_t is_out, int32_t edge) override; Return<void> setCallback(const sp<ITvServerCallback>& callback, ConnectType type) override; diff --git a/tv/tvserver/tvserver/DroidTvServiceIntf.cpp b/tv/tvserver/tvserver/DroidTvServiceIntf.cpp index 16ce419..1dc7572 100644 --- a/tv/tvserver/tvserver/DroidTvServiceIntf.cpp +++ b/tv/tvserver/tvserver/DroidTvServiceIntf.cpp @@ -533,6 +533,18 @@ int DroidTvServiceIntf::isVgaTimingInHdmi() { return mpTv->isVgaFmtInHdmi(); } +int DroidTvServiceIntf::ssmSaveHDMIEdidMode(int port_id, int ver) { + return SSMSaveHDMIEdidMode((tv_hdmi_port_id_t)port_id, (tv_hdmi_edid_version_t)ver); +} + +int DroidTvServiceIntf::setHdmiEdidVersion(int port_id, int ver) { + return mpTv->SetHdmiEdidVersion((tv_hdmi_port_id_t)port_id, (tv_hdmi_edid_version_t)ver); +} + +int DroidTvServiceIntf::handleGPIO(const std::string& key, int is_out, int edge) { + return mpTv->handleGPIO(key.c_str(), is_out, edge); +} + int DroidTvServiceIntf::processCmd(const Parcel &p) { unsigned char dataBuf[512] = {0}; int ret = -1; diff --git a/tv/tvserver/tvserver/DroidTvServiceIntf.h b/tv/tvserver/tvserver/DroidTvServiceIntf.h index b8085cc..2e2b114 100644 --- a/tv/tvserver/tvserver/DroidTvServiceIntf.h +++ b/tv/tvserver/tvserver/DroidTvServiceIntf.h @@ -64,6 +64,9 @@ public: int isDviSIgnal(); int isVgaTimingInHdmi(); + int ssmSaveHDMIEdidMode(int port_id, int ver); + int setHdmiEdidVersion(int port_id, int ver); + int handleGPIO(const std::string& key, int is_out, int edge); virtual status_t dump(int fd, const Vector<String16>& args); |