lineagehw: Remove thermal monitor feature

Change-Id: I8422858634a2518b84efc56b24f2ace37f38724a
This commit is contained in:
Michael Bestas
2018-01-23 20:33:16 +02:00
parent 19d8afb7e6
commit dc1731e1dd
6 changed files with 2 additions and 208 deletions

View File

@@ -388,17 +388,6 @@ package lineageos.hardware {
method public void writeToParcel(android.os.Parcel, int);
}
public abstract interface IThermalListenerCallback implements android.os.IInterface {
method public abstract void onThermalChanged(int) throws android.os.RemoteException;
}
public static abstract class IThermalListenerCallback.Stub extends android.os.Binder implements lineageos.hardware.IThermalListenerCallback {
ctor public IThermalListenerCallback.Stub();
method public android.os.IBinder asBinder();
method public static lineageos.hardware.IThermalListenerCallback asInterface(android.os.IBinder);
method public boolean onTransact(int, android.os.Parcel, android.os.Parcel, int) throws android.os.RemoteException;
}
public final class LineageHardwareManager {
method public boolean get(int);
method public int getColorBalance();
@@ -423,7 +412,6 @@ package lineageos.hardware {
method public java.util.List<android.util.Range<java.lang.Float>> getPictureAdjustmentRanges();
method public java.lang.String getSerialNumber();
method public int getSupportedFeatures();
method public int getThermalState();
method public lineageos.hardware.TouchscreenGesture[] getTouchscreenGestures();
method public int getVibratorDefaultIntensity();
method public int getVibratorIntensity();
@@ -432,7 +420,6 @@ package lineageos.hardware {
method public int getVibratorWarningIntensity();
method public boolean isSunlightEnhancementSelfManaged();
method public boolean isSupported(int);
method public boolean registerThermalListener(lineageos.hardware.ThermalListenerCallback);
method public boolean requireAdaptiveBacklightForSunlightEnhancement();
method public boolean set(int, boolean);
method public boolean setColorBalance(int);
@@ -442,7 +429,6 @@ package lineageos.hardware {
method public boolean setPictureAdjustment(lineageos.hardware.HSIC);
method public boolean setTouchscreenGestureEnabled(lineageos.hardware.TouchscreenGesture, boolean);
method public boolean setVibratorIntensity(int);
method public boolean unRegisterThermalListener(lineageos.hardware.ThermalListenerCallback);
field public static final int FEATURE_ADAPTIVE_BACKLIGHT = 1; // 0x1
field public static final int FEATURE_AUTO_CONTRAST = 4096; // 0x1000
field public static final int FEATURE_COLOR_BALANCE = 131072; // 0x20000
@@ -456,7 +442,6 @@ package lineageos.hardware {
field public static final int FEATURE_PICTURE_ADJUSTMENT = 262144; // 0x40000
field public static final int FEATURE_SERIAL_NUMBER = 128; // 0x80
field public static final int FEATURE_SUNLIGHT_ENHANCEMENT = 256; // 0x100
field public static final int FEATURE_THERMAL_MONITOR = 32768; // 0x8000
field public static final int FEATURE_TOUCHSCREEN_GESTURES = 524288; // 0x80000
field public static final int FEATURE_TOUCH_HOVERING = 2048; // 0x800
field public static final int FEATURE_VIBRATOR = 1024; // 0x400
@@ -527,20 +512,6 @@ package lineageos.hardware {
field public static final int MODE_OUTDOOR = 3; // 0x3
}
public abstract class ThermalListenerCallback extends lineageos.hardware.IThermalListenerCallback.Stub {
ctor public ThermalListenerCallback();
}
public static final class ThermalListenerCallback.State {
ctor public ThermalListenerCallback.State();
method public static final java.lang.String toString(int);
field public static final int STATE_COOL = 0; // 0x0
field public static final int STATE_CRITICAL = 3; // 0x3
field public static final int STATE_UNKNOWN = -1; // 0xffffffff
field public static final int STATE_WARM_FALLING = 1; // 0x1
field public static final int STATE_WARM_RISING = 2; // 0x2
}
public class TouchscreenGesture implements android.os.Parcelable {
ctor public TouchscreenGesture(int, java.lang.String, int);
method public int describeContents();

View File

@@ -32,8 +32,6 @@ import lineageos.app.LineageContextConstants;
import lineageos.hardware.ILineageHardwareService;
import lineageos.hardware.LineageHardwareManager;
import lineageos.hardware.DisplayMode;
import lineageos.hardware.IThermalListenerCallback;
import lineageos.hardware.ThermalListenerCallback;
import lineageos.hardware.HSIC;
import lineageos.hardware.TouchscreenGesture;
@@ -55,22 +53,18 @@ import org.lineageos.hardware.LongTermOrbits;
import org.lineageos.hardware.PictureAdjustment;
import org.lineageos.hardware.SerialNumber;
import org.lineageos.hardware.SunlightEnhancement;
import org.lineageos.hardware.ThermalMonitor;
import org.lineageos.hardware.ThermalUpdateCallback;
import org.lineageos.hardware.TouchscreenGestures;
import org.lineageos.hardware.TouchscreenHovering;
import org.lineageos.hardware.VibratorHW;
/** @hide */
public class LineageHardwareService extends LineageSystemService implements ThermalUpdateCallback {
public class LineageHardwareService extends LineageSystemService {
private static final boolean DEBUG = true;
private static final String TAG = LineageHardwareService.class.getSimpleName();
private final Context mContext;
private final LineageHardwareInterface mLineageHwImpl;
private int mCurrentThermalState = ThermalListenerCallback.State.STATE_UNKNOWN;
private RemoteCallbackList<IThermalListenerCallback> mRemoteCallbackList;
private final ArrayMap<String, String> mDisplayModeMappings =
new ArrayMap<String, String>();
@@ -150,8 +144,6 @@ public class LineageHardwareService extends LineageSystemService implements Ther
mSupportedFeatures |= LineageHardwareManager.FEATURE_AUTO_CONTRAST;
if (DisplayModeControl.isSupported())
mSupportedFeatures |= LineageHardwareManager.FEATURE_DISPLAY_MODES;
if (ThermalMonitor.isSupported())
mSupportedFeatures |= LineageHardwareManager.FEATURE_THERMAL_MONITOR;
if (ColorBalance.isSupported())
mSupportedFeatures |= LineageHardwareManager.FEATURE_COLOR_BALANCE;
if (PictureAdjustment.isSupported())
@@ -180,8 +172,6 @@ public class LineageHardwareService extends LineageSystemService implements Ther
return TouchscreenHovering.isEnabled();
case LineageHardwareManager.FEATURE_AUTO_CONTRAST:
return AutoContrast.isEnabled();
case LineageHardwareManager.FEATURE_THERMAL_MONITOR:
return ThermalMonitor.isEnabled();
default:
Log.e(TAG, "feature " + feature + " is not a boolean feature");
return false;
@@ -421,26 +411,6 @@ public class LineageHardwareService extends LineageSystemService implements Ther
@Override
public void onStart() {
if (ThermalMonitor.isSupported()) {
ThermalMonitor.initialize(this);
mRemoteCallbackList = new RemoteCallbackList<IThermalListenerCallback>();
}
}
@Override
public void setThermalState(int state) {
mCurrentThermalState = state;
int i = mRemoteCallbackList.beginBroadcast();
while (i > 0) {
i--;
try {
mRemoteCallbackList.getBroadcastItem(i).onThermalChanged(state);
} catch (RemoteException e) {
// The RemoteCallbackList will take care of removing
// the dead object for us.
}
}
mRemoteCallbackList.finishBroadcast();
}
private DisplayMode remapDisplayMode(DisplayMode in) {
@@ -693,36 +663,6 @@ public class LineageHardwareService extends LineageSystemService implements Ther
return mLineageHwImpl.setDisplayMode(mode, makeDefault);
}
@Override
public int getThermalState() {
mContext.enforceCallingOrSelfPermission(
lineageos.platform.Manifest.permission.HARDWARE_ABSTRACTION_ACCESS, null);
if (isSupported(LineageHardwareManager.FEATURE_THERMAL_MONITOR)) {
return mCurrentThermalState;
}
return ThermalListenerCallback.State.STATE_UNKNOWN;
}
@Override
public boolean registerThermalListener(IThermalListenerCallback callback) {
mContext.enforceCallingOrSelfPermission(
lineageos.platform.Manifest.permission.HARDWARE_ABSTRACTION_ACCESS, null);
if (isSupported(LineageHardwareManager.FEATURE_THERMAL_MONITOR)) {
return mRemoteCallbackList.register(callback);
}
return false;
}
@Override
public boolean unRegisterThermalListener(IThermalListenerCallback callback) {
mContext.enforceCallingOrSelfPermission(
lineageos.platform.Manifest.permission.HARDWARE_ABSTRACTION_ACCESS, null);
if (isSupported(LineageHardwareManager.FEATURE_THERMAL_MONITOR)) {
return mRemoteCallbackList.unregister(callback);
}
return false;
}
@Override
public int getColorBalanceMin() {
mContext.enforceCallingOrSelfPermission(

View File

@@ -19,7 +19,6 @@ package lineageos.hardware;
import lineageos.hardware.DisplayMode;
import lineageos.hardware.HSIC;
import lineageos.hardware.IThermalListenerCallback;
import lineageos.hardware.TouchscreenGesture;
/** @hide */
@@ -52,9 +51,6 @@ interface ILineageHardwareService {
DisplayMode getDefaultDisplayMode();
boolean setDisplayMode(in DisplayMode mode, boolean makeDefault);
int getThermalState();
boolean registerThermalListener(IThermalListenerCallback callback);
boolean unRegisterThermalListener(IThermalListenerCallback callback);
boolean isSunlightEnhancementSelfManaged();
int getColorBalanceMin();

View File

@@ -1,21 +0,0 @@
/**
* Copyright (C) 2015 The CyanogenMod Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package lineageos.hardware;
interface IThermalListenerCallback {
void onThermalChanged(int state);
}

View File

@@ -134,12 +134,6 @@ public final class LineageHardwareManager {
@VisibleForTesting
public static final int FEATURE_DISPLAY_MODES = 0x2000;
/**
* Thermal change monitor
*/
@VisibleForTesting
public static final int FEATURE_THERMAL_MONITOR = 0x8000;
/**
* Color balance
*/
@@ -165,8 +159,7 @@ public final class LineageHardwareManager {
FEATURE_KEY_DISABLE,
FEATURE_SUNLIGHT_ENHANCEMENT,
FEATURE_TOUCH_HOVERING,
FEATURE_AUTO_CONTRAST,
FEATURE_THERMAL_MONITOR
FEATURE_AUTO_CONTRAST
);
private static LineageHardwareManager sLineageHardwareManagerInstance;
@@ -849,47 +842,6 @@ public final class LineageHardwareManager {
return true;
}
/**
* @return current thermal {@link lineageos.hardware.ThermalListenerCallback.State}
*/
public int getThermalState() {
try {
if (checkService()) {
return sService.getThermalState();
}
} catch (RemoteException e) {
}
return ThermalListenerCallback.State.STATE_UNKNOWN;
}
/**
* Register a callback to be notified of thermal state changes
* @return boolean indicating whether register succeeded or failed
*/
public boolean registerThermalListener(ThermalListenerCallback thermalCallback) {
try {
if (checkService()) {
return sService.registerThermalListener(thermalCallback);
}
} catch (RemoteException e) {
}
return false;
}
/**
* Unregister a callback previously registered to be notified of thermal state changes
* @return boolean indicating whether un-registering succeeded or failed
*/
public boolean unRegisterThermalListener(ThermalListenerCallback thermalCallback) {
try {
if (checkService()) {
return sService.unRegisterThermalListener(thermalCallback);
}
} catch (RemoteException e) {
}
return false;
}
/**
* @return a list of available touchscreen gestures on the devices
*/

View File

@@ -1,44 +0,0 @@
/**
* Copyright (C) 2015 The CyanogenMod Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package lineageos.hardware;
/**
* Callback class to register for thermal state changes
*/
public abstract class ThermalListenerCallback extends IThermalListenerCallback.Stub {
public static final class State {
public static final int STATE_UNKNOWN = -1;
public static final int STATE_COOL = 0;
public static final int STATE_WARM_FALLING = 1;
public static final int STATE_WARM_RISING = 2;
public static final int STATE_CRITICAL = 3;
public static final String toString(int state) {
switch (state) {
case STATE_COOL:
return "STATE_COOL";
case STATE_WARM_FALLING:
return "STATE_WARM_FALLING";
case STATE_WARM_RISING:
return "STATE_WARM_RISING";
case STATE_CRITICAL:
return "STATE_CRITICAL";
default:
return "STATE_UNKNOWN";
}
}
}
}