Make picture color mode less of a feature
- Shun it to developer settings - Hide 'natural' mode - Remove dialog Bug: 24038268 Change-Id: Ibaf363bc06b444f2a361707b98742328fc290cfc
This commit is contained in:
@@ -7026,4 +7026,7 @@
|
|||||||
|
|
||||||
<!-- Name of feature to change color setting for the display [CHAR LIMIT=60] -->
|
<!-- Name of feature to change color setting for the display [CHAR LIMIT=60] -->
|
||||||
<string name="picture_color_mode">Picture color mode</string>
|
<string name="picture_color_mode">Picture color mode</string>
|
||||||
|
|
||||||
|
<!-- Description of feature to change color setting for the display [CHAR LIMIT=NONE] -->
|
||||||
|
<string name="picture_color_mode_desc">Use sRGB</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@@ -60,6 +60,12 @@
|
|||||||
android:summary="@string/runningservices_settings_summary"
|
android:summary="@string/runningservices_settings_summary"
|
||||||
android:fragment="com.android.settings.applications.RunningServices" />
|
android:fragment="com.android.settings.applications.RunningServices" />
|
||||||
|
|
||||||
|
<com.android.settings.ColorModePreference
|
||||||
|
android:key="color_mode"
|
||||||
|
android:title="@string/picture_color_mode"
|
||||||
|
android:summary="@string/picture_color_mode_desc"
|
||||||
|
android:persistent="false" />
|
||||||
|
|
||||||
<PreferenceCategory android:key="debug_debugging_category"
|
<PreferenceCategory android:key="debug_debugging_category"
|
||||||
android:title="@string/debug_debugging_category">
|
android:title="@string/debug_debugging_category">
|
||||||
|
|
||||||
|
@@ -104,12 +104,6 @@
|
|||||||
android:key="auto_rotate"
|
android:key="auto_rotate"
|
||||||
android:title="@string/display_auto_rotate_title" />
|
android:title="@string/display_auto_rotate_title" />
|
||||||
|
|
||||||
<com.android.settings.ColorModePreference
|
|
||||||
android:key="color_mode"
|
|
||||||
android:title="@string/picture_color_mode"
|
|
||||||
android:persistent="false"
|
|
||||||
settings:keywords="@string/keywords_color_mode" />
|
|
||||||
|
|
||||||
<PreferenceScreen
|
<PreferenceScreen
|
||||||
android:key="wifi_display"
|
android:key="wifi_display"
|
||||||
android:title="@string/wifi_display_settings_title"
|
android:title="@string/wifi_display_settings_title"
|
||||||
|
@@ -23,6 +23,7 @@ import android.hardware.display.DisplayManager.DisplayListener;
|
|||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.preference.DialogPreference;
|
import android.preference.DialogPreference;
|
||||||
|
import android.preference.SwitchPreference;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.Display;
|
import android.view.Display;
|
||||||
import android.view.Display.ColorTransform;
|
import android.view.Display.ColorTransform;
|
||||||
@@ -35,8 +36,7 @@ import android.widget.TextView;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class ColorModePreference extends DialogPreference implements
|
public class ColorModePreference extends SwitchPreference implements DisplayListener {
|
||||||
OnClickListener, DisplayListener {
|
|
||||||
|
|
||||||
private DisplayManager mDisplayManager;
|
private DisplayManager mDisplayManager;
|
||||||
private Display mDisplay;
|
private Display mDisplay;
|
||||||
@@ -91,7 +91,7 @@ public class ColorModePreference extends DialogPreference implements
|
|||||||
String[] descriptions = resources.getStringArray(R.array.color_mode_descriptions);
|
String[] descriptions = resources.getStringArray(R.array.color_mode_descriptions);
|
||||||
// Map the resource information describing color transforms.
|
// Map the resource information describing color transforms.
|
||||||
for (int i = 0; i < transforms.length; i++) {
|
for (int i = 0; i < transforms.length; i++) {
|
||||||
if (transforms[i] != -1) {
|
if (transforms[i] != -1 && i != 1 /* Skip Natural for now. */) {
|
||||||
ColorTransformDescription desc = new ColorTransformDescription();
|
ColorTransformDescription desc = new ColorTransformDescription();
|
||||||
desc.colorTransform = transforms[i];
|
desc.colorTransform = transforms[i];
|
||||||
desc.title = titles[i];
|
desc.title = titles[i];
|
||||||
@@ -126,46 +126,20 @@ public class ColorModePreference extends DialogPreference implements
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mCurrentIndex != -1) {
|
setChecked(mCurrentIndex == 1);
|
||||||
setSummary(mDescriptions.get(mCurrentIndex).title);
|
}
|
||||||
} else {
|
|
||||||
setSummary(null);
|
@Override
|
||||||
|
protected boolean persistBoolean(boolean value) {
|
||||||
|
// Right now this is a switch, so we only support two modes.
|
||||||
|
if (mDescriptions.size() == 2) {
|
||||||
|
ColorTransformDescription desc = mDescriptions.get(value ? 1 : 0);
|
||||||
|
|
||||||
|
mDisplay.requestColorTransform(desc.transform);
|
||||||
|
mCurrentIndex = mDescriptions.indexOf(desc);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
return true;
|
||||||
protected View onCreateDialogView() {
|
|
||||||
LayoutInflater inflater = LayoutInflater.from(getContext());
|
|
||||||
LinearLayout v = (LinearLayout) inflater.inflate(R.layout.radio_list_container, null);
|
|
||||||
for (int i = 0; i < mDescriptions.size(); i++) {
|
|
||||||
View child = inflater.inflate(R.layout.radio_with_summary, v, false);
|
|
||||||
ColorTransformDescription desc = mDescriptions.get(i);
|
|
||||||
child.setTag(desc);
|
|
||||||
((TextView) child.findViewById(android.R.id.title)).setText(desc.title);
|
|
||||||
((TextView) child.findViewById(android.R.id.summary)).setText(desc.summary);
|
|
||||||
((Checkable) child).setChecked(i == mCurrentIndex);
|
|
||||||
child.setClickable(true);
|
|
||||||
child.setOnClickListener(this);
|
|
||||||
v.addView(child);
|
|
||||||
}
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onPrepareDialogBuilder(Builder builder) {
|
|
||||||
super.onPrepareDialogBuilder(builder);
|
|
||||||
builder.setPositiveButton(null, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
ColorTransformDescription desc = (ColorTransformDescription) v.getTag();
|
|
||||||
|
|
||||||
mDisplay.requestColorTransform(desc.transform);
|
|
||||||
mCurrentIndex = mDescriptions.indexOf(desc);
|
|
||||||
|
|
||||||
setSummary(desc.title);
|
|
||||||
getDialog().dismiss();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class ColorTransformDescription {
|
private static class ColorTransformDescription {
|
||||||
|
@@ -156,6 +156,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
|||||||
private static final String USB_CONFIGURATION_KEY = "select_usb_configuration";
|
private static final String USB_CONFIGURATION_KEY = "select_usb_configuration";
|
||||||
private static final String WIFI_LEGACY_DHCP_CLIENT_KEY = "legacy_dhcp_client";
|
private static final String WIFI_LEGACY_DHCP_CLIENT_KEY = "legacy_dhcp_client";
|
||||||
private static final String MOBILE_DATA_ALWAYS_ON = "mobile_data_always_on";
|
private static final String MOBILE_DATA_ALWAYS_ON = "mobile_data_always_on";
|
||||||
|
private static final String KEY_COLOR_MODE = "color_mode";
|
||||||
|
|
||||||
private static final String INACTIVE_APPS_KEY = "inactive_apps";
|
private static final String INACTIVE_APPS_KEY = "inactive_apps";
|
||||||
|
|
||||||
@@ -253,6 +254,8 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
|||||||
|
|
||||||
private SwitchPreference mShowAllANRs;
|
private SwitchPreference mShowAllANRs;
|
||||||
|
|
||||||
|
private ColorModePreference mColorModePreference;
|
||||||
|
|
||||||
private final ArrayList<Preference> mAllPrefs = new ArrayList<Preference>();
|
private final ArrayList<Preference> mAllPrefs = new ArrayList<Preference>();
|
||||||
|
|
||||||
private final ArrayList<SwitchPreference> mResetSwitchPrefs
|
private final ArrayList<SwitchPreference> mResetSwitchPrefs
|
||||||
@@ -407,6 +410,13 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
|||||||
mAllPrefs.add(hdcpChecking);
|
mAllPrefs.add(hdcpChecking);
|
||||||
removePreferenceForProduction(hdcpChecking);
|
removePreferenceForProduction(hdcpChecking);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mColorModePreference = (ColorModePreference) findPreference(KEY_COLOR_MODE);
|
||||||
|
mColorModePreference.updateCurrentAndSupported();
|
||||||
|
if (mColorModePreference.getTransformsCount() < 2) {
|
||||||
|
removePreference(KEY_COLOR_MODE);
|
||||||
|
mColorModePreference = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ListPreference addListPreference(String prefKey) {
|
private ListPreference addListPreference(String prefKey) {
|
||||||
@@ -512,6 +522,19 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
|||||||
setPrefsEnabledState(mLastEnabledState);
|
setPrefsEnabledState(mLastEnabledState);
|
||||||
}
|
}
|
||||||
mSwitchBar.show();
|
mSwitchBar.show();
|
||||||
|
|
||||||
|
if (mColorModePreference != null) {
|
||||||
|
mColorModePreference.startListening();
|
||||||
|
mColorModePreference.updateCurrentAndSupported();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPause() {
|
||||||
|
super.onPause();
|
||||||
|
if (mColorModePreference != null) {
|
||||||
|
mColorModePreference.stopListening();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -79,7 +79,6 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
|
|||||||
private static final String KEY_CAMERA_GESTURE = "camera_gesture";
|
private static final String KEY_CAMERA_GESTURE = "camera_gesture";
|
||||||
private static final String KEY_CAMERA_DOUBLE_TAP_POWER_GESTURE
|
private static final String KEY_CAMERA_DOUBLE_TAP_POWER_GESTURE
|
||||||
= "camera_double_tap_power_gesture";
|
= "camera_double_tap_power_gesture";
|
||||||
private static final String KEY_COLOR_MODE = "color_mode";
|
|
||||||
|
|
||||||
private static final int DLG_GLOBAL_CHANGE_WARNING = 1;
|
private static final int DLG_GLOBAL_CHANGE_WARNING = 1;
|
||||||
|
|
||||||
@@ -97,8 +96,6 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
|
|||||||
private SwitchPreference mCameraGesturePreference;
|
private SwitchPreference mCameraGesturePreference;
|
||||||
private SwitchPreference mCameraDoubleTapPowerGesturePreference;
|
private SwitchPreference mCameraDoubleTapPowerGesturePreference;
|
||||||
|
|
||||||
private ColorModePreference mColorModePreference;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getMetricsCategory() {
|
protected int getMetricsCategory() {
|
||||||
return MetricsLogger.DISPLAY;
|
return MetricsLogger.DISPLAY;
|
||||||
@@ -174,13 +171,6 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
|
|||||||
removePreference(KEY_CAMERA_DOUBLE_TAP_POWER_GESTURE);
|
removePreference(KEY_CAMERA_DOUBLE_TAP_POWER_GESTURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
mColorModePreference = (ColorModePreference) findPreference(KEY_COLOR_MODE);
|
|
||||||
mColorModePreference.updateCurrentAndSupported();
|
|
||||||
if (mColorModePreference.getTransformsCount() < 2) {
|
|
||||||
removePreference(KEY_COLOR_MODE);
|
|
||||||
mColorModePreference = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (RotationPolicy.isRotationLockToggleVisible(activity)) {
|
if (RotationPolicy.isRotationLockToggleVisible(activity)) {
|
||||||
DropDownPreference rotatePreference =
|
DropDownPreference rotatePreference =
|
||||||
(DropDownPreference) findPreference(KEY_AUTO_ROTATE);
|
(DropDownPreference) findPreference(KEY_AUTO_ROTATE);
|
||||||
@@ -370,17 +360,6 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
|
|||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
updateState();
|
updateState();
|
||||||
if (mColorModePreference != null) {
|
|
||||||
mColorModePreference.startListening();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPause() {
|
|
||||||
super.onPause();
|
|
||||||
if (mColorModePreference != null) {
|
|
||||||
mColorModePreference.stopListening();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -438,10 +417,6 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
|
|||||||
getContentResolver(), CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED, 0);
|
getContentResolver(), CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED, 0);
|
||||||
mCameraDoubleTapPowerGesturePreference.setChecked(value == 0);
|
mCameraDoubleTapPowerGesturePreference.setChecked(value == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mColorModePreference != null) {
|
|
||||||
mColorModePreference.updateCurrentAndSupported();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateScreenSaverSummary() {
|
private void updateScreenSaverSummary() {
|
||||||
@@ -581,11 +556,6 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
|
|||||||
if (!isCameraDoubleTapPowerGestureAvailable(context.getResources())) {
|
if (!isCameraDoubleTapPowerGestureAvailable(context.getResources())) {
|
||||||
result.add(KEY_CAMERA_DOUBLE_TAP_POWER_GESTURE);
|
result.add(KEY_CAMERA_DOUBLE_TAP_POWER_GESTURE);
|
||||||
}
|
}
|
||||||
ColorModePreference pref = new ColorModePreference(context, null);
|
|
||||||
pref.updateCurrentAndSupported();
|
|
||||||
if (pref.getTransformsCount() < 2) {
|
|
||||||
result.add(KEY_COLOR_MODE);
|
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user