Loading Android.mk +1 −0 Original line number Diff line number Diff line Loading @@ -163,6 +163,7 @@ LOCAL_SRC_FILES += \ core/java/android/hardware/IProCameraCallbacks.aidl \ core/java/android/hardware/ITorchService.aidl \ core/java/android/hardware/ITorchCallback.aidl \ core/java/android/hardware/IThermalListenerCallback.aidl \ core/java/android/hardware/camera2/ICameraDeviceUser.aidl \ core/java/android/hardware/camera2/ICameraDeviceCallbacks.aidl \ core/java/android/hardware/ISerialManager.aidl \ Loading core/java/android/hardware/CmHardwareManager.java +45 −1 Original line number Diff line number Diff line Loading @@ -95,6 +95,8 @@ public final class CmHardwareManager { */ public static final int FEATURE_TOUCH_HOVERING = 0x800; public static final int FEATURE_THERMAL_MONITOR = 0x8000; private static final List<Integer> BOOLEAN_FEATURES = Arrays.asList( FEATURE_ADAPTIVE_BACKLIGHT, FEATURE_COLOR_ENHANCEMENT, Loading @@ -102,7 +104,8 @@ public final class CmHardwareManager { FEATURE_KEY_DISABLE, FEATURE_SUNLIGHT_ENHANCEMENT, FEATURE_TAP_TO_WAKE, FEATURE_TOUCH_HOVERING FEATURE_TOUCH_HOVERING, FEATURE_THERMAL_MONITOR ); /** Loading Loading @@ -563,4 +566,45 @@ public final class CmHardwareManager { } return false; } /** * @return current thermal {@link cyanogenmod.hardware.ThermalListenerCallback.State} */ public int getThermalState() { try { if (mService != null) { return mService.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 (mService != null && thermalCallback != null) { return mService.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 (mService != null && thermalCallback != null) { return mService.unRegisterThermalListener(thermalCallback); } } catch (RemoteException e) { } return false; } } core/java/android/hardware/ICmHardwareService.aidl +5 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.hardware; import android.hardware.IThermalListenerCallback; /** {@hide} */ interface ICmHardwareService { Loading @@ -40,4 +42,7 @@ interface ICmHardwareService { String getSerialNumber(); boolean requireAdaptiveBacklightForSunlightEnhancement(); int getThermalState(); boolean registerThermalListener(IThermalListenerCallback callback); boolean unRegisterThermalListener(IThermalListenerCallback callback); } core/java/android/hardware/IThermalListenerCallback.aidl 0 → 100644 +21 −0 Original line number Diff line number Diff line /* * 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 android.hardware; interface IThermalListenerCallback { void onThermalChanged(int state); } core/java/android/hardware/ThermalListenerCallback.java 0 → 100644 +41 −0 Original line number Diff line number Diff line /* * 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 android.hardware; 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_NORMAL = 1; public static final int STATE_HIGH = 2; public static final int STATE_EXTREME = 3; public static final String toString(int state) { switch (state) { case STATE_COOL: return "STATE_COOL"; case STATE_NORMAL: return "STATE_NORMAL"; case STATE_HIGH: return "STATE_HIGH"; case STATE_EXTREME: return "STATE_EXTREME"; default: return "STATE_UNKNOWN"; } } } } Loading
Android.mk +1 −0 Original line number Diff line number Diff line Loading @@ -163,6 +163,7 @@ LOCAL_SRC_FILES += \ core/java/android/hardware/IProCameraCallbacks.aidl \ core/java/android/hardware/ITorchService.aidl \ core/java/android/hardware/ITorchCallback.aidl \ core/java/android/hardware/IThermalListenerCallback.aidl \ core/java/android/hardware/camera2/ICameraDeviceUser.aidl \ core/java/android/hardware/camera2/ICameraDeviceCallbacks.aidl \ core/java/android/hardware/ISerialManager.aidl \ Loading
core/java/android/hardware/CmHardwareManager.java +45 −1 Original line number Diff line number Diff line Loading @@ -95,6 +95,8 @@ public final class CmHardwareManager { */ public static final int FEATURE_TOUCH_HOVERING = 0x800; public static final int FEATURE_THERMAL_MONITOR = 0x8000; private static final List<Integer> BOOLEAN_FEATURES = Arrays.asList( FEATURE_ADAPTIVE_BACKLIGHT, FEATURE_COLOR_ENHANCEMENT, Loading @@ -102,7 +104,8 @@ public final class CmHardwareManager { FEATURE_KEY_DISABLE, FEATURE_SUNLIGHT_ENHANCEMENT, FEATURE_TAP_TO_WAKE, FEATURE_TOUCH_HOVERING FEATURE_TOUCH_HOVERING, FEATURE_THERMAL_MONITOR ); /** Loading Loading @@ -563,4 +566,45 @@ public final class CmHardwareManager { } return false; } /** * @return current thermal {@link cyanogenmod.hardware.ThermalListenerCallback.State} */ public int getThermalState() { try { if (mService != null) { return mService.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 (mService != null && thermalCallback != null) { return mService.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 (mService != null && thermalCallback != null) { return mService.unRegisterThermalListener(thermalCallback); } } catch (RemoteException e) { } return false; } }
core/java/android/hardware/ICmHardwareService.aidl +5 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.hardware; import android.hardware.IThermalListenerCallback; /** {@hide} */ interface ICmHardwareService { Loading @@ -40,4 +42,7 @@ interface ICmHardwareService { String getSerialNumber(); boolean requireAdaptiveBacklightForSunlightEnhancement(); int getThermalState(); boolean registerThermalListener(IThermalListenerCallback callback); boolean unRegisterThermalListener(IThermalListenerCallback callback); }
core/java/android/hardware/IThermalListenerCallback.aidl 0 → 100644 +21 −0 Original line number Diff line number Diff line /* * 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 android.hardware; interface IThermalListenerCallback { void onThermalChanged(int state); }
core/java/android/hardware/ThermalListenerCallback.java 0 → 100644 +41 −0 Original line number Diff line number Diff line /* * 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 android.hardware; 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_NORMAL = 1; public static final int STATE_HIGH = 2; public static final int STATE_EXTREME = 3; public static final String toString(int state) { switch (state) { case STATE_COOL: return "STATE_COOL"; case STATE_NORMAL: return "STATE_NORMAL"; case STATE_HIGH: return "STATE_HIGH"; case STATE_EXTREME: return "STATE_EXTREME"; default: return "STATE_UNKNOWN"; } } } }