Loading core/java/android/os/BatteryManager.java +22 −25 Original line number Diff line number Diff line Loading @@ -27,12 +27,6 @@ public class BatteryManager { */ public static final String EXTRA_STATUS = "status"; /** * Integer containing the current status constant for the dock battery. * @hide */ public static final String EXTRA_DOCK_STATUS = "dock_status"; /** * Extra for {@link android.content.Intent#ACTION_BATTERY_CHANGED}: * integer containing the current health constant. Loading @@ -45,12 +39,6 @@ public class BatteryManager { */ public static final String EXTRA_PRESENT = "present"; /** * Integer containing the current status constant for the dock battery. * @hide */ public static final String EXTRA_DOCK_PRESENT = "dock_present"; /** * Extra for {@link android.content.Intent#ACTION_BATTERY_CHANGED}: * integer field containing the current battery level, from 0 to Loading @@ -58,12 +46,6 @@ public class BatteryManager { */ public static final String EXTRA_LEVEL = "level"; /** * Integer field containing the current dock battery level. * @hide */ public static final String EXTRA_DOCK_LEVEL = "dock_level"; /** * Extra for {@link android.content.Intent#ACTION_BATTERY_CHANGED}: * integer containing the maximum battery level. Loading Loading @@ -111,6 +93,28 @@ public class BatteryManager { */ public static final String EXTRA_INVALID_CHARGER = "invalid_charger"; // Dock intents /** @hide **/ public static final String EXTRA_DOCK_STATUS = "dock_status"; /** @hide **/ public static final String EXTRA_DOCK_HEALTH = "dock_health"; /** @hide **/ public static final String EXTRA_DOCK_PRESENT = "dock_present"; /** @hide **/ public static final String EXTRA_DOCK_LEVEL = "dock_level"; /** @hide **/ public static final String EXTRA_DOCK_SCALE = "dock_scale"; /** @hide **/ public static final String EXTRA_DOCK_ICON_SMALL = "dock_icon-small"; /** @hide **/ public static final String EXTRA_DOCK_PLUGGED = "dock_plugged"; /** @hide **/ public static final String EXTRA_DOCK_VOLTAGE = "dock_voltage"; /** @hide **/ public static final String EXTRA_DOCK_TEMPERATURE = "dock_temperature"; /** @hide **/ public static final String EXTRA_DOCK_TECHNOLOGY = "dock_technology"; // values for "status" field in the ACTION_BATTERY_CHANGED Intent public static final int BATTERY_STATUS_UNKNOWN = 1; public static final int BATTERY_STATUS_CHARGING = 2; Loading @@ -127,13 +131,6 @@ public class BatteryManager { public static final int BATTERY_HEALTH_UNSPECIFIED_FAILURE = 6; public static final int BATTERY_HEALTH_COLD = 7; /** @hide */ public static final int DOCK_BATTERY_STATUS_UNKNOWN = 1; /** @hide */ public static final int DOCK_BATTERY_STATUS_CHARGING = 2; /** @hide */ public static final int DOCK_BATTERY_STATUS_NOT_CHARGING = 4; // values of the "plugged" field in the ACTION_BATTERY_CHANGED intent. // These must be powers of 2. /** Power source is an AC charger. */ Loading core/java/com/android/internal/os/DeviceDockBatteryHandler.java 0 → 100644 +53 −0 Original line number Diff line number Diff line /* * Copyright (C) 2013 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 com.android.internal.os; import android.content.Intent; import android.os.Bundle; public interface DeviceDockBatteryHandler { /** * Invoked when the system request an update of the dock battery status. Device should * access specific sysfs and read status, present and level of the device dock battery. */ public void update(); /** * Invoked after {@link #update()} for processing the values prior to notify them. */ public void process(); /** * Method that returns the data to notify to {@link Intent#ACTION_BATTERY_CHANGED} action. */ public Bundle getNotifyData(); /** * Method that returns if this handler has new battery data to notify * * @return If this handler has new battery data to notify. */ public boolean hasNewData(); /** * Method that returns if the dock battery is plugged (is powering device main battery) * * @return If the dock battery is plugged */ public boolean isPlugged(); } core/java/com/android/internal/os/IDeviceHandler.java 0 → 100644 +25 −0 Original line number Diff line number Diff line /* * Copyright (C) 2013 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 com.android.internal.os; /** * @hide */ public interface IDeviceHandler { public DeviceKeyHandler getDeviceKeyHandler(); public DeviceDockBatteryHandler getDeviceDockBatteryHandler(); } core/java/com/android/internal/policy/IPolicy.java +3 −1 Original line number Diff line number Diff line Loading @@ -22,6 +22,8 @@ import android.view.LayoutInflater; import android.view.Window; import android.view.WindowManagerPolicy; import com.android.internal.os.IDeviceHandler; /** * {@hide} */ Loading @@ -33,7 +35,7 @@ public interface IPolicy { public LayoutInflater makeNewLayoutInflater(Context context); public WindowManagerPolicy makeNewWindowManager(); public WindowManagerPolicy makeNewWindowManager(IDeviceHandler device); public FallbackEventHandler makeNewFallbackEventHandler(Context context); } core/java/com/android/internal/policy/PolicyManager.java +3 −2 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.view.LayoutInflater; import android.view.Window; import android.view.WindowManagerPolicy; import com.android.internal.os.IDeviceHandler; import com.android.internal.policy.IPolicy; /** Loading Loading @@ -63,8 +64,8 @@ public final class PolicyManager { return sPolicy.makeNewLayoutInflater(context); } public static WindowManagerPolicy makeNewWindowManager() { return sPolicy.makeNewWindowManager(); public static WindowManagerPolicy makeNewWindowManager(IDeviceHandler device) { return sPolicy.makeNewWindowManager(device); } public static FallbackEventHandler makeNewFallbackEventHandler(Context context) { Loading Loading
core/java/android/os/BatteryManager.java +22 −25 Original line number Diff line number Diff line Loading @@ -27,12 +27,6 @@ public class BatteryManager { */ public static final String EXTRA_STATUS = "status"; /** * Integer containing the current status constant for the dock battery. * @hide */ public static final String EXTRA_DOCK_STATUS = "dock_status"; /** * Extra for {@link android.content.Intent#ACTION_BATTERY_CHANGED}: * integer containing the current health constant. Loading @@ -45,12 +39,6 @@ public class BatteryManager { */ public static final String EXTRA_PRESENT = "present"; /** * Integer containing the current status constant for the dock battery. * @hide */ public static final String EXTRA_DOCK_PRESENT = "dock_present"; /** * Extra for {@link android.content.Intent#ACTION_BATTERY_CHANGED}: * integer field containing the current battery level, from 0 to Loading @@ -58,12 +46,6 @@ public class BatteryManager { */ public static final String EXTRA_LEVEL = "level"; /** * Integer field containing the current dock battery level. * @hide */ public static final String EXTRA_DOCK_LEVEL = "dock_level"; /** * Extra for {@link android.content.Intent#ACTION_BATTERY_CHANGED}: * integer containing the maximum battery level. Loading Loading @@ -111,6 +93,28 @@ public class BatteryManager { */ public static final String EXTRA_INVALID_CHARGER = "invalid_charger"; // Dock intents /** @hide **/ public static final String EXTRA_DOCK_STATUS = "dock_status"; /** @hide **/ public static final String EXTRA_DOCK_HEALTH = "dock_health"; /** @hide **/ public static final String EXTRA_DOCK_PRESENT = "dock_present"; /** @hide **/ public static final String EXTRA_DOCK_LEVEL = "dock_level"; /** @hide **/ public static final String EXTRA_DOCK_SCALE = "dock_scale"; /** @hide **/ public static final String EXTRA_DOCK_ICON_SMALL = "dock_icon-small"; /** @hide **/ public static final String EXTRA_DOCK_PLUGGED = "dock_plugged"; /** @hide **/ public static final String EXTRA_DOCK_VOLTAGE = "dock_voltage"; /** @hide **/ public static final String EXTRA_DOCK_TEMPERATURE = "dock_temperature"; /** @hide **/ public static final String EXTRA_DOCK_TECHNOLOGY = "dock_technology"; // values for "status" field in the ACTION_BATTERY_CHANGED Intent public static final int BATTERY_STATUS_UNKNOWN = 1; public static final int BATTERY_STATUS_CHARGING = 2; Loading @@ -127,13 +131,6 @@ public class BatteryManager { public static final int BATTERY_HEALTH_UNSPECIFIED_FAILURE = 6; public static final int BATTERY_HEALTH_COLD = 7; /** @hide */ public static final int DOCK_BATTERY_STATUS_UNKNOWN = 1; /** @hide */ public static final int DOCK_BATTERY_STATUS_CHARGING = 2; /** @hide */ public static final int DOCK_BATTERY_STATUS_NOT_CHARGING = 4; // values of the "plugged" field in the ACTION_BATTERY_CHANGED intent. // These must be powers of 2. /** Power source is an AC charger. */ Loading
core/java/com/android/internal/os/DeviceDockBatteryHandler.java 0 → 100644 +53 −0 Original line number Diff line number Diff line /* * Copyright (C) 2013 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 com.android.internal.os; import android.content.Intent; import android.os.Bundle; public interface DeviceDockBatteryHandler { /** * Invoked when the system request an update of the dock battery status. Device should * access specific sysfs and read status, present and level of the device dock battery. */ public void update(); /** * Invoked after {@link #update()} for processing the values prior to notify them. */ public void process(); /** * Method that returns the data to notify to {@link Intent#ACTION_BATTERY_CHANGED} action. */ public Bundle getNotifyData(); /** * Method that returns if this handler has new battery data to notify * * @return If this handler has new battery data to notify. */ public boolean hasNewData(); /** * Method that returns if the dock battery is plugged (is powering device main battery) * * @return If the dock battery is plugged */ public boolean isPlugged(); }
core/java/com/android/internal/os/IDeviceHandler.java 0 → 100644 +25 −0 Original line number Diff line number Diff line /* * Copyright (C) 2013 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 com.android.internal.os; /** * @hide */ public interface IDeviceHandler { public DeviceKeyHandler getDeviceKeyHandler(); public DeviceDockBatteryHandler getDeviceDockBatteryHandler(); }
core/java/com/android/internal/policy/IPolicy.java +3 −1 Original line number Diff line number Diff line Loading @@ -22,6 +22,8 @@ import android.view.LayoutInflater; import android.view.Window; import android.view.WindowManagerPolicy; import com.android.internal.os.IDeviceHandler; /** * {@hide} */ Loading @@ -33,7 +35,7 @@ public interface IPolicy { public LayoutInflater makeNewLayoutInflater(Context context); public WindowManagerPolicy makeNewWindowManager(); public WindowManagerPolicy makeNewWindowManager(IDeviceHandler device); public FallbackEventHandler makeNewFallbackEventHandler(Context context); }
core/java/com/android/internal/policy/PolicyManager.java +3 −2 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.view.LayoutInflater; import android.view.Window; import android.view.WindowManagerPolicy; import com.android.internal.os.IDeviceHandler; import com.android.internal.policy.IPolicy; /** Loading Loading @@ -63,8 +64,8 @@ public final class PolicyManager { return sPolicy.makeNewLayoutInflater(context); } public static WindowManagerPolicy makeNewWindowManager() { return sPolicy.makeNewWindowManager(); public static WindowManagerPolicy makeNewWindowManager(IDeviceHandler device) { return sPolicy.makeNewWindowManager(device); } public static FallbackEventHandler makeNewFallbackEventHandler(Context context) { Loading