diff options
Diffstat (limited to 'core/java/android/os')
-rw-r--r-- | core/java/android/os/BatteryStats.java | 11 | ||||
-rw-r--r-- | core/java/android/os/Build.java | 38 | ||||
-rw-r--r-- | core/java/android/os/Debug.java | 56 | ||||
-rw-r--r-- | core/java/android/os/Power.java | 7 |
4 files changed, 98 insertions, 14 deletions
diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java index 333ba73..8a0fd58 100644 --- a/core/java/android/os/BatteryStats.java +++ b/core/java/android/os/BatteryStats.java @@ -61,6 +61,13 @@ public abstract class BatteryStats implements Parcelable { */ public static final int SCAN_WIFI_LOCK = 6; + /** + * A constant indicating a wifi multicast timer + * + * {@hide} + */ + public static final int WIFI_MULTICAST_ENABLED = 7; + /** * Include all of the data in the stats, including previously saved data. */ @@ -225,9 +232,13 @@ public abstract class BatteryStats implements Parcelable { public abstract void noteFullWifiLockReleasedLocked(); public abstract void noteScanWifiLockAcquiredLocked(); public abstract void noteScanWifiLockReleasedLocked(); + public abstract void noteWifiMulticastEnabledLocked(); + public abstract void noteWifiMulticastDisabledLocked(); public abstract long getWifiTurnedOnTime(long batteryRealtime, int which); public abstract long getFullWifiLockTime(long batteryRealtime, int which); public abstract long getScanWifiLockTime(long batteryRealtime, int which); + public abstract long getWifiMulticastTime(long batteryRealtime, + int which); /** * Note that these must match the constants in android.os.LocalPowerManager. diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java index 467c17f..5487c54 100644 --- a/core/java/android/os/Build.java +++ b/core/java/android/os/Build.java @@ -59,11 +59,47 @@ public class Build { public static final String RELEASE = getString("ro.build.version.release"); /** - * The user-visible SDK version of the framework. It is an integer starting at 1. + * The user-visible SDK version of the framework in its raw String + * representation; use {@link #SDK_INT} instead. + * + * @deprecated Use {@link #SDK_INT} to easily get this as an integer. */ public static final String SDK = getString("ro.build.version.sdk"); + + /** + * The user-visible SDK version of the framework; its possible + * values are defined in {@link Build.VERSION_CODES}. + */ + public static final int SDK_INT = SystemProperties.getInt( + "ro.build.version.sdk", 0); + + /** + * The current development codename, or the string "REL" if this is + * a release build. + */ + public static final String CODENAME = getString("ro.build.version.codename"); } + /** + * Enumeration of the currently known SDK version codes. These are the + * values that can be found in {@link VERSION#SDK}. Version numbers + * increment monotonically with each official platform release. + */ + public static class VERSION_CODES { + /** + * October 2008: The original, first, version of Android. Yay! + */ + public static final int BASE = 1; + /** + * February 2009: First Android update, officially called 1.1. + */ + public static final int BASE_1_1 = 2; + /** + * May 2009: Android 1.5. + */ + public static final int CUPCAKE = 3; + } + /** The type of build, like "user" or "eng". */ public static final String TYPE = getString("ro.build.type"); diff --git a/core/java/android/os/Debug.java b/core/java/android/os/Debug.java index a7de895..d9612af 100644 --- a/core/java/android/os/Debug.java +++ b/core/java/android/os/Debug.java @@ -30,6 +30,10 @@ import java.io.PrintWriter; import java.io.Reader; import java.lang.reflect.Field; import java.lang.reflect.Modifier; +import java.lang.annotation.Target; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import org.apache.harmony.dalvik.ddmc.Chunk; import org.apache.harmony.dalvik.ddmc.ChunkHandler; @@ -876,6 +880,17 @@ href="{@docRoot}guide/developing/tools/traceview.html">Traceview: A Graphical Lo /** + * Equivalent to <code>setFieldsOn(cl, false)</code>. + * + * @see #setFieldsOn(Class, boolean) + * + * @hide + */ + public static void setFieldsOn(Class<?> cl) { + setFieldsOn(cl, false); + } + + /** * Reflectively sets static fields of a class based on internal debugging * properties. This method is a no-op if android.util.Config.DEBUG is * false. @@ -887,7 +902,7 @@ href="{@docRoot}guide/developing/tools/traceview.html">Traceview: A Graphical Lo * Class setup: define a class whose only fields are non-final, static * primitive types (except for "char") or Strings. In a static block * after the field definitions/initializations, pass the class to - * this method, Debug.setFieldsOn(). Example: + * this method, Debug.setFieldsOn(). Example: * <pre> * package com.example; * @@ -899,12 +914,18 @@ href="{@docRoot}guide/developing/tools/traceview.html">Traceview: A Graphical Lo * public static String ns = null; * public static boolean b = false; * public static int i = 5; + * @Debug.DebugProperty * public static float f = 0.1f; + * @@Debug.DebugProperty * public static double d = 0.5d; * * // This MUST appear AFTER all fields are defined and initialized! * static { + * // Sets all the fields * Debug.setFieldsOn(MyDebugVars.class); + * + * // Sets only the fields annotated with @Debug.DebugProperty + * // Debug.setFieldsOn(MyDebugVars.class, true); * } * } * </pre> @@ -917,25 +938,31 @@ href="{@docRoot}guide/developing/tools/traceview.html">Traceview: A Graphical Lo * {@hide} * * @param cl The class to (possibly) modify + * @param partial If false, sets all static fields, otherwise, only set + * fields with the {@link android.os.Debug.DebugProperty} + * annotation * @throws IllegalArgumentException if any fields are final or non-static, * or if the type of the field does not match the type of * the internal debugging property value. */ - public static void setFieldsOn(Class<?> cl) { + public static void setFieldsOn(Class<?> cl, boolean partial) { if (Config.DEBUG) { if (debugProperties != null) { /* Only look for fields declared directly by the class, * so we don't mysteriously change static fields in superclasses. */ for (Field field : cl.getDeclaredFields()) { - final String propertyName = cl.getName() + "." + field.getName(); - boolean isStatic = Modifier.isStatic(field.getModifiers()); - boolean isFinal = Modifier.isFinal(field.getModifiers()); - if (!isStatic || isFinal) { - throw new IllegalArgumentException(propertyName + - " must be static and non-final"); + if (!partial || field.getAnnotation(DebugProperty.class) != null) { + final String propertyName = cl.getName() + "." + field.getName(); + boolean isStatic = Modifier.isStatic(field.getModifiers()); + boolean isFinal = Modifier.isFinal(field.getModifiers()); + + if (!isStatic || isFinal) { + throw new IllegalArgumentException(propertyName + + " must be static and non-final"); + } + modifyFieldIfSet(field, debugProperties, propertyName); } - modifyFieldIfSet(field, debugProperties, propertyName); } } } else { @@ -944,4 +971,15 @@ href="{@docRoot}guide/developing/tools/traceview.html">Traceview: A Graphical Lo ") called in non-DEBUG build"); } } + + /** + * Annotation to put on fields you want to set with + * {@link Debug#setFieldsOn(Class, boolean)}. + * + * @hide + */ + @Target({ ElementType.FIELD }) + @Retention(RetentionPolicy.RUNTIME) + public @interface DebugProperty { + } } diff --git a/core/java/android/os/Power.java b/core/java/android/os/Power.java index 47497e5..3679e47 100644 --- a/core/java/android/os/Power.java +++ b/core/java/android/os/Power.java @@ -80,10 +80,9 @@ public class Power public static native int setLastUserActivityTimeout(long ms); /** - * Turn the device off. - * - * This method is considered deprecated in favor of - * {@link android.policy.ShutdownThread.shutdownAfterDisablingRadio()}. + * Low-level function turn the device off immediately, without trying + * to be clean. Most people should use + * {@link android.internal.app.ShutdownThread} for a clean shutdown. * * @deprecated * @hide |