Merge "Remove unnecessary code"

This commit is contained in:
TreeHugger Robot
2017-06-07 02:36:12 +00:00
committed by Android (Google) Code Review

View File

@@ -21,10 +21,8 @@ import android.os.IBinder;
import android.os.Parcel;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.util.MathUtils;
import android.util.Slog;
import android.util.SparseArray;
import com.android.internal.annotations.GuardedBy;
import java.util.Arrays;
@@ -51,7 +49,6 @@ public class DisplayTransformManager {
private static final int SURFACE_FLINGER_TRANSACTION_COLOR_MATRIX = 1015;
private static final int SURFACE_FLINGER_TRANSACTION_DALTONIZER = 1014;
private static final int SURFACE_FLINGER_TRANSACTION_SATURATION = 1022;
/**
* Map of level -> color transformation matrix.
@@ -71,10 +68,6 @@ public class DisplayTransformManager {
@GuardedBy("mDaltonizerModeLock")
private int mDaltonizerMode = -1;
private final Object mSaturationLock = new Object();
@GuardedBy("mSaturationLock")
private float mSaturation = 1.0f;
/* package */ DisplayTransformManager() {
}
@@ -164,30 +157,6 @@ public class DisplayTransformManager {
}
}
/**
* Returns the current saturation.
*/
public float getSaturation() {
synchronized (mSaturationLock) {
return mSaturation;
}
}
/**
* Sets the saturation level of the display. The default value is 1.0.
*
* @param saturation A value between 0 (0% saturation, grayscale) and 2 (100% extra saturation)
*/
public void setSaturation(float saturation) {
synchronized (mSaturationLock) {
saturation = MathUtils.constrain(saturation, 0.0f, 2.0f);
if (mSaturation != saturation) {
mSaturation = saturation;
applySaturation(saturation);
}
}
}
/**
* Propagates the provided color transformation matrix to the SurfaceFlinger.
*/
@@ -232,23 +201,4 @@ public class DisplayTransformManager {
}
}
}
/**
* Propagates the provided saturation to the SurfaceFlinger.
*/
private static void applySaturation(float saturation) {
final IBinder flinger = ServiceManager.getService("SurfaceFlinger");
if (flinger != null) {
final Parcel data = Parcel.obtain();
data.writeInterfaceToken("android.ui.ISurfaceComposer");
data.writeFloat(saturation);
try {
flinger.transact(SURFACE_FLINGER_TRANSACTION_SATURATION, data, null, 0);
} catch (RemoteException ex) {
Slog.e(TAG, "Failed to set saturation", ex);
} finally {
data.recycle();
}
}
}
}