summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--api/current.xml121
-rw-r--r--core/java/android/content/Intent.java38
-rw-r--r--core/java/android/os/BatteryManager.java67
-rw-r--r--core/res/res/values/config.xml8
-rw-r--r--services/java/com/android/server/BatteryService.java21
5 files changed, 217 insertions, 38 deletions
diff --git a/api/current.xml b/api/current.xml
index bd1c42820514..0495764a0c0c 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -35829,17 +35829,6 @@
visibility="public"
>
</field>
-<field name="ACTION_REMOTE_INTENT"
- type="java.lang.String"
- transient="false"
- volatile="false"
- value="&quot;android.intent.action.REMOTE_INTENT&quot;"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
<field name="ACTION_RUN"
type="java.lang.String"
transient="false"
@@ -98763,6 +98752,116 @@
visibility="public"
>
</field>
+<field name="EXTRA_HEALTH"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;health&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="EXTRA_ICON_SMALL"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;icon-small&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="EXTRA_LEVEL"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;level&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="EXTRA_PLUGGED"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;plugged&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="EXTRA_PRESENT"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;present&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="EXTRA_SCALE"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;scale&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="EXTRA_STATUS"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;status&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="EXTRA_TECHNOLOGY"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;technology&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="EXTRA_TEMPERATURE"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;temperature&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="EXTRA_VOLTAGE"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;voltage&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
</class>
<class name="Binder"
extends="java.lang.Object"
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index 1359761f3b60..c1b9f28d3b8e 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -1352,14 +1352,20 @@ public class Intent implements Parcelable {
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_CONFIGURATION_CHANGED = "android.intent.action.CONFIGURATION_CHANGED";
/**
- * Broadcast Action: The charging state, or charge level of the battery has
- * changed.
+ * Broadcast Action: This is a <em>sticky broadcast</em> containing the
+ * charging state, level, and other information about the battery.
+ * See {@link android.os.BatteryManager} for documentation on the
+ * contents of the Intent.
*
* <p class="note">
* You can <em>not</em> receive this through components declared
* in manifests, only by explicitly registering for it with
* {@link Context#registerReceiver(BroadcastReceiver, IntentFilter)
- * Context.registerReceiver()}.
+ * Context.registerReceiver()}. See {@link #ACTION_BATTERY_LOW},
+ * {@link #ACTION_BATTERY_OKAY}, {@link #ACTION_POWER_CONNECTED},
+ * and {@link #ACTION_POWER_DISCONNECTED} for distinct battery-related
+ * broadcasts that are sent and can be received through manifest
+ * receivers.
*
* <p class="note">This is a protected intent that can only be sent
* by the system.
@@ -1434,7 +1440,8 @@ public class Intent implements Parcelable {
*/
public static final String ACTION_REQUEST_SHUTDOWN = "android.intent.action.ACTION_REQUEST_SHUTDOWN";
/**
- * Broadcast Action: Indicates low memory condition on the device
+ * Broadcast Action: A sticky broadcast that indicates low memory
+ * condition on the device
*
* <p class="note">This is a protected intent that can only be sent
* by the system.
@@ -1711,6 +1718,18 @@ public class Intent implements Parcelable {
"android.intent.action.REBOOT";
/**
+ * Broadcast Action: A sticky broadcast indicating the phone was docked
+ * or undocked. Includes the extra
+ * field {@link #EXTRA_DOCK_STATE}, containing the current dock state.
+ * This is intended for monitoring the current dock state.
+ * To launch an activity from a dock state change, use {@link #CATEGORY_CAR_DOCK}
+ * or {@link #CATEGORY_DESK_DOCK} instead.
+ */
+ @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
+ public static final String ACTION_DOCK_EVENT =
+ "android.intent.action.DOCK_EVENT";
+
+ /**
* Broadcast Action: a remote intent is to be broadcasted.
*
* A remote intent is used for remote RPC between devices. The remote intent
@@ -1720,6 +1739,7 @@ public class Intent implements Parcelable {
* does not trust intent broadcasts from arbitrary intent senders, it should require
* the sender to hold certain permissions so only trusted sender's broadcast will be
* let through.
+ * @hide
*/
public static final String ACTION_REMOTE_INTENT =
"android.intent.action.REMOTE_INTENT";
@@ -1878,16 +1898,6 @@ public class Intent implements Parcelable {
@SdkConstant(SdkConstantType.INTENT_CATEGORY)
public static final String CATEGORY_DESK_DOCK = "android.intent.category.DESK_DOCK";
- /**
- * Broadcast Action: The phone was docked or undocked. Includes the extra
- * field {@link #EXTRA_DOCK_STATE}, containing the current dock state.
- * This is intended for monitoring the current dock state.
- * To launch an activity from a dock state change, use {@link #CATEGORY_CAR_DOCK}
- * or {@link #CATEGORY_DESK_DOCK} instead.
- */
- @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
- public static final String ACTION_DOCK_EVENT = "android.intent.action.DOCK_EVENT";
-
// ---------------------------------------------------------------------
// ---------------------------------------------------------------------
// Standard extra data keys.
diff --git a/core/java/android/os/BatteryManager.java b/core/java/android/os/BatteryManager.java
index 8f1a756b295c..44b73c52dd05 100644
--- a/core/java/android/os/BatteryManager.java
+++ b/core/java/android/os/BatteryManager.java
@@ -18,10 +18,73 @@ package android.os;
/**
* The BatteryManager class contains strings and constants used for values
- * in the ACTION_BATTERY_CHANGED Intent.
+ * in the {@link android.content.Intent#ACTION_BATTERY_CHANGED} Intent.
*/
public class BatteryManager {
-
+ /**
+ * Extra for {@link android.content.Intent#ACTION_BATTERY_CHANGED}:
+ * integer containing the current status constant.
+ */
+ public static final String EXTRA_STATUS = "status";
+
+ /**
+ * Extra for {@link android.content.Intent#ACTION_BATTERY_CHANGED}:
+ * integer containing the current health constant.
+ */
+ public static final String EXTRA_HEALTH = "health";
+
+ /**
+ * Extra for {@link android.content.Intent#ACTION_BATTERY_CHANGED}:
+ * boolean indicating whether a battery is present.
+ */
+ public static final String EXTRA_PRESENT = "present";
+
+ /**
+ * Extra for {@link android.content.Intent#ACTION_BATTERY_CHANGED}:
+ * integer field containing the current battery level, from 0 to
+ * {@link #EXTRA_SCALE}.
+ */
+ public static final String EXTRA_LEVEL = "level";
+
+ /**
+ * Extra for {@link android.content.Intent#ACTION_BATTERY_CHANGED}:
+ * integer containing the maximum battery level.
+ */
+ public static final String EXTRA_SCALE = "scale";
+
+ /**
+ * Extra for {@link android.content.Intent#ACTION_BATTERY_CHANGED}:
+ * integer containing the resource ID of a small status bar icon
+ * indicating the current battery state.
+ */
+ public static final String EXTRA_ICON_SMALL = "icon-small";
+
+ /**
+ * Extra for {@link android.content.Intent#ACTION_BATTERY_CHANGED}:
+ * integer indicating whether the device is plugged in to a power
+ * source; 0 means it is on battery, other constants are different
+ * types of power sources.
+ */
+ public static final String EXTRA_PLUGGED = "plugged";
+
+ /**
+ * Extra for {@link android.content.Intent#ACTION_BATTERY_CHANGED}:
+ * integer containing the current battery voltage level.
+ */
+ public static final String EXTRA_VOLTAGE = "voltage";
+
+ /**
+ * Extra for {@link android.content.Intent#ACTION_BATTERY_CHANGED}:
+ * integer containing the current battery temperature.
+ */
+ public static final String EXTRA_TEMPERATURE = "temperature";
+
+ /**
+ * Extra for {@link android.content.Intent#ACTION_BATTERY_CHANGED}:
+ * String describing the technology of the current battery.
+ */
+ public static final String EXTRA_TECHNOLOGY = "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;
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index b710acb6d7cd..5ee21b8133c1 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -78,6 +78,14 @@
A value of -1 means no change in orientation by default. -->
<integer name="config_carDockRotation">-1</integer>
+ <!-- Control whether being in the desk dock (and powered) always
+ keeps the screen on. By default it doesn't. Set to true to make it. -->
+ <bool name="config_deskDockKeepsScreenOn">false</bool>
+
+ <!-- Control whether being in the car dock (and powered) always
+ keeps the screen on. By default it does. Set to false to not keep on. -->
+ <bool name="config_carDockKeepsScreenOn">true</bool>
+
<!-- Indicate whether the lid state impacts the accessibility of
the physical keyboard. 0 means it doesn't, 1 means it is accessible
when the lid is open, 2 means it is accessible when the lid is
diff --git a/services/java/com/android/server/BatteryService.java b/services/java/com/android/server/BatteryService.java
index 26fee89aec85..d78d88653faf 100644
--- a/services/java/com/android/server/BatteryService.java
+++ b/services/java/com/android/server/BatteryService.java
@@ -26,7 +26,6 @@ import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.BatteryManager;
import android.os.Binder;
-import android.os.Debug;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.ServiceManager;
@@ -333,16 +332,16 @@ class BatteryService extends Binder {
int icon = getIcon(mBatteryLevel);
- intent.putExtra("status", mBatteryStatus);
- intent.putExtra("health", mBatteryHealth);
- intent.putExtra("present", mBatteryPresent);
- intent.putExtra("level", mBatteryLevel);
- intent.putExtra("scale", BATTERY_SCALE);
- intent.putExtra("icon-small", icon);
- intent.putExtra("plugged", mPlugType);
- intent.putExtra("voltage", mBatteryVoltage);
- intent.putExtra("temperature", mBatteryTemperature);
- intent.putExtra("technology", mBatteryTechnology);
+ intent.putExtra(BatteryManager.EXTRA_STATUS, mBatteryStatus);
+ intent.putExtra(BatteryManager.EXTRA_HEALTH, mBatteryHealth);
+ intent.putExtra(BatteryManager.EXTRA_PRESENT, mBatteryPresent);
+ intent.putExtra(BatteryManager.EXTRA_LEVEL, mBatteryLevel);
+ intent.putExtra(BatteryManager.EXTRA_SCALE, BATTERY_SCALE);
+ intent.putExtra(BatteryManager.EXTRA_ICON_SMALL, icon);
+ intent.putExtra(BatteryManager.EXTRA_PLUGGED, mPlugType);
+ intent.putExtra(BatteryManager.EXTRA_VOLTAGE, mBatteryVoltage);
+ intent.putExtra(BatteryManager.EXTRA_TEMPERATURE, mBatteryTemperature);
+ intent.putExtra(BatteryManager.EXTRA_TECHNOLOGY, mBatteryTechnology);
if (false) {
Log.d(TAG, "updateBattery level:" + mBatteryLevel +