我发现firefly的大佬在rk3399的设置里面添加了一个调节对比度的功能,现在我很想要一份该功能的补丁,想自己研究下对应的功能,并想在rk3288等其他平台添加该功能
问下,有没有该补丁呢,有或者没有都回复下好吗,麻烦各位了
firefly的工程师,能回复我一下吗?非常感谢!
基本上代码已经移植完成,但是有一个libsettings.so的库没法移植,rk3399的是64位的,而rk3288是32位,该库没法用在rk3288里面,不知道哪个工程师能给个32位的库
补丁:
进入到packages/apps/Settings/目录:
diff --git a/Android.mk b/Android.mk
index 537004e..58b0865 100644
— a/Android.mk
+++ b/Android.mk
@@ -42,6 +42,9 @@ LOCAL_PROGUARD_FLAG_FILES := proguard.flags
LOCAL_AAPT_FLAGS := --auto-add-overlay
–extra-packages android.support.v7.preference:android.support.v14.preference:android.support.v17.preference:android.support.v7.appcompat:android.support.v7.recyclerview
+#add libsettings-jni by louhn
+LOCAL_JNI_SHARED_LIBRARIES := libsettings-jni
+
ifneq ($(INCREMENTAL_BUILDS),)
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_JACK_ENABLED := incremental
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 3578d24..ee4e0aa 100755
— a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -3159,6 +3159,11 @@
android:enabled=“@bool/config_has_help” />
-
<!-- This is the longest AndroidManifest.xml ever. -->
+
+<activity
- android:name=“com.android.settings.display.AdvancedDisplaySettingsActivity”/>
+<activity - android:name=“com.android.settings.display.AdvancedDisplaySettingsMainActivity”/>
-
<!-- This is the longest AndroidManifest.xml ever. -->
- 确定
- 取消
- 副屏高级设置
- 主屏高级设置
- BCSH
- 重置
- 冷
- 暖
- 锐利
- HDR
- 亮度
- 当前数值:
- 对比度
- 饱和度
- 色调
- 最大亮度
- 最小亮度
- 开启4G守护
永久隐藏导航栏
永久隐藏状态栏
@@ -1452,7 +1472,7 @@
“允许安装来自未知来源的应用”
“您的平板电脑和个人数据更容易受到从未知来源获取的应用的攻击。对于因使用这些应用而造成的平板电脑损坏或数据丢失,您同意自行承担全部责任。”
“您的手机和个人数据更容易受到从未知来源获取的应用的攻击。对于因使用这些应用而造成的手机损坏或数据丢失,您同意自行承担全部责任。”
- “高级设置”
-
“启用更多设置选项”
“应用信息”
“存储空间”
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 2155245..aa5356e 100644
— a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -18,6 +18,7 @@
#000
#F00
#00F -
#FF00FF00
#FFCED7DB
diff --git a/res/values/strings.xml b/res/values/strings.xml
index c68557f..43ef48c 100755
— a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -19,6 +19,28 @@
Allow root access?
Allowing apps to request root access is very dangerous and could compromise the security of your system!
- Color
- OK
- Cancel
- Secondary Screen Advanced settings
- Main Screen Advanced settings
- BCSH
- reset
- cold
- warm
- sharp
- SDR->HDR
- HDR->SDR
- Brightness
- Current value:
- Contrast
- Saturation
- Tone
- Max brightness
- Min brightness
- “Yes”
@@ -3410,7 +3432,7 @@
damage to your phone or loss of data that may result from using
these apps.
- Advanced settings
- Enable more settings options
diff --git a/res/xml/hdmi_settings_timeout.xml b/res/xml/hdmi_settings_timeout.xml
index b86c58a..829121c 100644
— a/res/xml/hdmi_settings_timeout.xml
+++ b/res/xml/hdmi_settings_timeout.xml
@@ -31,6 +31,15 @@
+
-
<!--add by louhn--> -
<Preference -
android:key="advanced_settings_main" -
android:title="@string/advanced_settings_main" /> -
<Preference -
android:key="advanced_settings" -
android:title="@string/advanced_settings" />
<ListPreference
android:key=“hdmi_rotation”
diff --git a/src/com/android/settings/ApplicationSettings.java b/src/com/android/settings/ApplicationSettings.java
index 759ccea..52b3679 100644
— a/src/com/android/settings/ApplicationSettings.java
+++ b/src/com/android/settings/ApplicationSettings.java
@@ -30,7 +30,7 @@ public class ApplicationSettings extends SettingsPreferenceFragment {
private static final String KEY_TOGGLE_ADVANCED_SETTINGS = "toggle_advanced_settings";
private static final String KEY_APP_INSTALL_LOCATION = "app_install_location";
- // App installation location. Default is ask the user.
private static final int APP_INSTALL_AUTO = 0;
private static final int APP_INSTALL_DEVICE = 1;
@@ -115,7 +115,7 @@ public class ApplicationSettings extends SettingsPreferenceFragment {
Settings.System.ADVANCED_SETTINGS,
Settings.System.ADVANCED_SETTINGS_DEFAULT) > 0;
}
- private void setAdvancedSettingsEnabled(boolean enabled) {
int value = enabled ? 1 : 0;
// Change the system setting
diff --git a/src/com/android/settings/DisplaySettings.java b/src/com/android/settings/DisplaySettings.java
index 0e66032..a6923d4 100755
— a/src/com/android/settings/DisplaySettings.java
+++ b/src/com/android/settings/DisplaySettings.java
@@ -58,6 +58,21 @@ import com.android.settingslib.RestrictedPreference;
import java.util.ArrayList;
import java.util.List;
+//add by louhn advancedSetting
+import android.webkit.WebView.FindListener;
+import com.android.settings.display.DrmDisplaySetting;
+import android.support.v7.preference.PreferenceScreen;
+import android.os.DisplayOutputManager;
+import android.hardware.display.DisplayManager;
+import android.support.v7.preference.PreferenceCategory;
+import android.hardware.display.DisplayManager;
+import android.content.IntentFilter;
+import com.android.settings.display.DisplayInfo;
+import com.android.settings.data.ConstData;
+import android.view.Display;
+import java.lang.reflect.Method;
+
+
import static android.provider.Settings.Secure.CAMERA_GESTURE_DISABLED;
import static android.provider.Settings.Secure.DOUBLE_TAP_TO_WAKE;
import static android.provider.Settings.Secure.DOZE_ENABLED;
@@ -103,6 +118,37 @@ Preference.OnPreferenceChangeListener, Indexable {
private CheckBoxPreference mSystemStatusBarHide;
//end
- //add by louhn advancedSetting
- public static final String HDMI_PLUG_ACTION = “android.intent.action.HDMI_PLUGGED”;
- private PreferenceScreen mPreferenceScreen;
- private static String mStrPlatform;
- private static boolean mIsUseDisplayd;
- /**
-
* rk_fb输出相关 -
*/ - private DisplayOutputManager mDisplayOutputManager;
- /**
-
* 原生标准显示管理接口,用于DRM显示相关 -
*/ - private DisplayManager mDisplayManager;
- /**
-
* 插拔显示设备监听 -
*/ - private DisplayListener mDisplayListener;
- /**
-
* 主显示 -
*/ - private Preference mMainDisplayPreference;
- /**
-
* 次显示 -
*/ - private Preference mSecondDisPreference;
- /**
-
* HDMI热插拔接收器 -
*/ - private HDMIReceiver mHdmiReceiver;
+//////////////end by louhn///////////////////////////
/*add by louhn*/
private ListPreference mScreenOrientationPreference;
@@ -280,7 +326,212 @@ Preference.OnPreferenceChangeListener, Indexable {
mNightModePreference.setValue(String.valueOf(currentNightMode));
mNightModePreference.setOnPreferenceChangeListener(this);
}
-
//add by louhn advancedSetting -
initData(); -
rebuildView(); -
}
-
//add by louhn advancedSetting
-
private void initData(){
-
//mMainDisplayPreference = findPreference(KEY_MAIN_DISPLAY); -
//mSecondDisPreference = findPreference(KEY_SECOND_DISPLAY); -
//del by louhn -
//mDisplayDeviceCategory = (PreferenceCategory)findPreference(KEY_DISPLAY_DEVICE_CATEGORY); -
mDisplayManager = (DisplayManager)getActivity().getSystemService(Context.DISPLAY_SERVICE); -
mDisplayListener = new DisplayListener(); -
mHdmiReceiver = new HDMIReceiver(); -
}
-
/**
-
- 注册显示监听
-
*/
-
private void registerDisplayListener(){
-
mDisplayManager.registerDisplayListener(mDisplayListener, null); -
}
-
/**
-
- 取消显示监听
-
*/
-
private void unRegiserDisplayListener(){
-
mDisplayManager.unregisterDisplayListener(mDisplayListener); -
}
-
/**
-
- 注册HDMI接收器
-
*/
-
private void registerHDMIReceiver(){
-
IntentFilter filter = new IntentFilter(HDMI_PLUG_ACTION); -
getActivity().registerReceiver(mHdmiReceiver, filter); -
}
-
/**
-
- 取消注册HDMI接收器
-
*/
-
private void unRegisterHDMIReceiver(){
-
getActivity().unregisterReceiver(mHdmiReceiver); -
}
-
/**
-
- 重新构造页面
-
*/
-
private void rebuildView(){
-
//del by louhn -
//mDisplayDeviceCategory.removeAll(); -
List<DisplayInfo> displayInfos = getDisplayInfos(); -
Log.i(TAG, "rebuildView->displayInfos:" + displayInfos); -
if(displayInfos.size() > 0){ -
for(DisplayInfo displayInfo : displayInfos){ -
Intent intent = new Intent(); -
intent.putExtra(ConstData.IntentKey.DISPLAY_INFO, displayInfo); -
getActivity().setIntent(intent); -
if(displayInfo.getDisplayId() == 0){ -
Log.d("LOUHN_DEBUG","displayInfo.getDisplayId() == 0 in DisplaySettings.java"); -
//mMainDisplayPreference.setTitle(displayInfo.getDescription()); -
//del by louhn -
//mDisplayDeviceCategory.addPreference(mMainDisplayPreference); -
}else{ -
Log.d("LOUHN_DEBUG","displayInfo.getDisplayId() == 1 in DisplaySettings.java"); -
//mSecondDisPreference.setTitle(displayInfo.getDescription()); -
//del by louhn -
//mDisplayDeviceCategory.addPreference(mSecondDisPreference); -
} -
} -
} -
}
-
/**
-
- 获取所有外接显示设备信息,此方法已兼容rk_fb与DRM
-
- @param
-
*/
-
private List getDisplayInfos(){
-
List<DisplayInfo> displayInfos = new ArrayList<DisplayInfo>(); -
mDisplayOutputManager = null; -
try{ -
mDisplayOutputManager = new DisplayOutputManager(); -
}catch (Exception e){ -
Log.i(TAG, "new DisplayOutputManger exception:" + e); -
} -
mIsUseDisplayd = SystemProperties.getBoolean("ro.rk.displayd.enable", true); -
Log.d("LOUHN_DEBUG","mIsUseDisplayd2="+mIsUseDisplayd +" in DisplaySettings.java"); -
Display[] displays = mDisplayManager.getDisplays(); -
if(!mIsUseDisplayd){ -
displayInfos.addAll(DrmDisplaySetting.getDisplayInfoList()); -
}else{ -
//使用rk_fb方式获取显示列表 -
int[] mainTypes = mDisplayOutputManager.getIfaceList(mDisplayOutputManager.MAIN_DISPLAY); -
int[] externalTypes = mDisplayOutputManager.getIfaceList(mDisplayOutputManager.AUX_DISPLAY); -
//RK系列芯片,目前最多只能支持2个屏幕 -
if(mainTypes != null && mainTypes.length > 0){ -
int currMainType = mDisplayOutputManager.getCurrentInterface(mDisplayOutputManager.MAIN_DISPLAY); -
//主屏只能有一个 -
DisplayInfo displayInfo = new DisplayInfo(); -
displayInfo.setDisplayId(0); -
displayInfo.setDescription((String)invokeMethod(mDisplayOutputManager, "typetoface", new Class[]{int.class}, new Integer[]{currMainType})); -
displayInfo.setType(currMainType); -
displayInfo.setModes(mDisplayOutputManager.getModeList(0,currMainType)); -
displayInfos.add(displayInfo); -
} -
if(externalTypes != null && externalTypes.length > 0){ -
int currExternalType = mDisplayOutputManager.getCurrentInterface(mDisplayOutputManager.AUX_DISPLAY); -
//副屏只能有一个 -
DisplayInfo displayInfo = new DisplayInfo(); -
displayInfo.setType(currExternalType); -
displayInfo.setModes(mDisplayOutputManager.getModeList(1,currExternalType)); -
displayInfo.setDescription((String)invokeMethod(mDisplayOutputManager, "typetoface", new Class[]{int.class}, new Integer[]{currExternalType})); -
//副屏的id需要搜索标准接口 -
for(Display display : displays){ -
if(display.getDisplayId() != 0){ -
displayInfo.setDisplayId(display.getDisplayId()); -
break; -
} -
} -
displayInfos.add(displayInfo); -
} -
} -
return displayInfos; -
}
-
/** -
- 反射调用相关方法
-
- @param object
-
- @param methodName
-
- @param parameterTypes
-
- @param args
-
*/
-
private Object invokeMethod(Object object, String methodName, Class<?> parameterTypes, Object args){
-
Object result = null; -
try{ -
Method method = object.getClass().getDeclaredMethod(methodName, parameterTypes); -
method.setAccessible(true); -
result = method.invoke(object, args); -
}catch (Exception e){ -
Log.i(TAG, "invokeMethod->exception:" + e); -
} -
return result; -
}
-
/**
-
- 转换显示接口
-
*/
-
private void changeDisplayInterface(boolean isHDMIConnect){
-
mDisplayOutputManager = null; -
try{ -
mDisplayOutputManager = new DisplayOutputManager(); -
}catch (Exception e){ -
Log.i(TAG, "new DisplayOutputManger exception:" + e); -
} -
if(!isHDMIConnect){ -
mDisplayOutputManager.setInterface(mDisplayOutputManager.MAIN_DISPLAY,1, true); -
} -
}
-
/**
-
- 显示设备插拔监听器
-
- @author GaoFei
-
-
*/
-
class DisplayListener implements DisplayManager.DisplayListener{
-
@Override -
public void onDisplayAdded(int displayId) { -
Log.i(TAG, "DisplayListener->onDisplayAdded"); -
rebuildView(); -
} -
@Override -
public void onDisplayRemoved(int displayId) { -
Log.i(TAG, "DisplayListener->onDisplayRemoved"); -
rebuildView(); -
} -
@Override -
public void onDisplayChanged(int displayId) { -
Log.i(TAG, "DisplayListener->onDisplayChanged"); -
} -
}
-
/**
-
- HDMI 热插拔事件
-
- @author GaoFei
-
-
*/
-
class HDMIReceiver extends BroadcastReceiver{
-
@Override -
public void onReceive(Context context, Intent intent) { -
boolean state = intent.getBooleanExtra("state", true); -
changeDisplayInterface(state); -
//Log.i(TAG, "HDMIReceiver->onReceive"); -
rebuildView(); -
} -
}
-
//end by louhn advancedSetting
private static boolean allowAllRotations(Context context) {
return Resources.getSystem().getBoolean(
diff --git a/src/com/android/settings/HdmiSettings.java b/src/com/android/settings/HdmiSettings.java
index 9fe6a92..c64fe75 100755
— a/src/com/android/settings/HdmiSettings.java
+++ b/src/com/android/settings/HdmiSettings.java
@@ -56,7 +56,7 @@ import com.android.settings.display.*;
import android.app.DialogFragment;
import com.android.settings.data.ConstData;
+import com.android.settings.data.ConstDataTwo;
import android.hardware.display.DisplayManager;
import android.view.Display;
@@ -72,6 +72,12 @@ public class HdmiSettings extends SettingsPreferenceFragment
private static final String TAG = “HdmiSettings”;
private static final String KEY_HDMI_RESOLUTION = “hdmi_resolution”;
private static final String KEY_HDMI_SCALE = “hdmi_screen_zoom”;
- /add by louhn:advanced setting/
- private static final String KEY_ADVANCED_SETTINGS = “advanced_settings”;
- private static final String KEY_ADVANCED_SETTINGS_MAIN = “advanced_settings_main”;
- private Preference mHdmiAdvancedSetting;
- private Preference mHdmiAdvancedMainSetting;
- private static final String KEY_HDMI_ROTATION=“hdmi_rotation”;
private static final String KEY_HDMI_DUAL_SCREEN = “dual_screen_setting”;
private static final String KEY_HDMI_DUAL_SCREEN_VH = “dual_screen_vh”;
@@ -154,7 +160,14 @@ public class HdmiSettings extends SettingsPreferenceFragment
mHdmiDualScreen = (CheckBoxPreference)findPreference(KEY_HDMI_DUAL_SCREEN);
mHdmiDualScreen.setChecked(enable);
mHdmiDualScreen.setOnPreferenceChangeListener(this);
-
/*add by louhn:advanced setting*/ -
mHdmiAdvancedSetting = findPreference(KEY_ADVANCED_SETTINGS); -
mHdmiAdvancedSetting.setOnPreferenceClickListener(this); -
mHdmiAdvancedMainSetting = findPreference(KEY_ADVANCED_SETTINGS_MAIN); -
mHdmiAdvancedMainSetting.setOnPreferenceClickListener(this); -
mHdmiDualScreenVH = (CheckBoxPreference)findPreference(KEY_HDMI_DUAL_SCREEN_VH); mHdmiDualScreenVH.setChecked(SystemProperties.getBoolean("persist.sys.rotation.efull", false)); mHdmiDualScreenVH.setOnPreferenceChangeListener(this);
@@ -258,16 +271,24 @@ public class HdmiSettings extends SettingsPreferenceFragment
/**
* 还原分辨率值
*/
- public void updateResolutionValue() {
-
String resolutionValue = null; -
mDisplayInfo = getDisplayInfo(); -
if (mDisplayInfo != null) -
resolutionValue = DrmDisplaySetting.getCurDisplayMode(mDisplayInfo); -
Log.i(TAG, "resolutionValue:" + resolutionValue); -
mOldResolution = resolutionValue; -
if (resolutionValue != null) -
mHdmiResolution.setValue(resolutionValue); - }
- public void updateResolutionValue(){
-
String resolutionValue = null; -
if(!mIsUseDisplayd){ -
resolutionValue = DrmDisplaySetting.getCurDisplayMode(mDisplayInfo); -
Log.i(TAG, "3399 resolutionValue:" + resolutionValue); -
}else{ -
DisplayOutputManager displayOutputManager = null; -
try{ -
displayOutputManager = new DisplayOutputManager(); -
resolutionValue = displayOutputManager.getCurrentMode(mDisplayInfo.getDisplayId() == 0 ? 0 : 1, mDisplayInfo.getType()); -
}catch (Exception e){ -
Log.i(TAG, "updateResolutionValue->exception:" + e); -
} -
if(mOldResolution == null) -
mOldResolution = resolutionValue; -
} - }
private void updateHDMIState() {
Display[] allDisplays = mDisplayManager.getDisplays();
@@ -338,7 +359,20 @@ public class HdmiSettings extends SettingsPreferenceFragment
String value = SystemProperties.get(“persist.sys.rotation.einit”,“0”);
mHdmiDualScreenList.setValue(value);
}
-
return true;
-
/*add by louhn:advanced setting*/ -
else if (preference == mHdmiAdvancedSetting) { -
Intent advancedSettingIntent = new Intent(getActivity(), AdvancedDisplaySettingsActivity.class); -
advancedSettingIntent.putExtra(ConstData.IntentKey.DISPLAY_ID, 1); -
getActivity().startActivity(advancedSettingIntent); -
} -
else if (preference == mHdmiAdvancedMainSetting) { -
Intent advancedSettingIntentMain = new Intent(getActivity(), AdvancedDisplaySettingsMainActivity.class); -
Log.d("LOUHN_DEBUG","in onPreferenceClick second"); -
advancedSettingIntentMain.putExtra(ConstDataTwo.IntentKey.DISPLAY_ID, 0); -
getActivity().startActivity(advancedSettingIntentMain); -
} -
return true;}
@Override
解压,添加的文件.zip
放入了AdvancedDisplaySettingsActivity.java文件
packages/apps/Settings/src/com/android/settings/display/AdvancedDisplaySettingsActivity.java
packages/apps/Settings/src/com/android/settings/display/AdvancedDisplaySettingsMainActivity.java
添加了
packages/apps/Settings/res/layout/activity_advanced_display_settings.xml
packages/apps/Settings/res/layout/activity_advanced_display_settings_main.xml
packages/apps/Settings/res/layout/activity_base_input.xml
packages/apps/Settings/res/layout/activity_base_input_main.xml
packages/apps/Settings/res/layout/activity_base_input_for_advanced_display_settings.xml
packages/apps/Settings/res/layout/activity_base_input_for_advanced_display_settings_main.xml
packages/apps/Settings/res/drawable/layout_background.xml
packages/apps/Settings/src/com/android/settings/BaseInputActivity.java
packages/apps/Settings/src/com/android/settings/BaseInputMainActivity.ja
packages/apps/Settings/src/com/android/settings/utils/JniCall.java
out/target/product/rk3399_all/system/lib64
添加libsettings-jni.so
添加packages/apps/Settings/res/drawable/ramiro.jpg
build.prop添加
ro.rk.displayd.enable=false
文件
添加的文件.zip (956 KB)
没人回复,补丁只能自己硬扒了,分享给需要的人。该功能已经被我修改过了,我是在Setting->Display->HDMI目录下面添加了两条list:主屏高级设置、副屏高级设置。用于调节主屏和副屏的色彩
advanced_setting_patch.zip (6.18 KB)
{:4_211:}
赞!!!{:4_103:}