summaryrefslogtreecommitdiffstats
path: root/core/java
diff options
context:
space:
mode:
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/content/AbstractThreadedSyncAdapter.java27
-rw-r--r--core/java/android/os/BatteryStats.java18
-rw-r--r--core/java/android/os/storage/VolumeInfo.java7
-rw-r--r--core/java/android/os/storage/VolumeRecord.java5
-rw-r--r--core/java/android/text/TextUtils.java5
-rw-r--r--core/java/android/view/accessibility/CaptioningManager.java36
-rw-r--r--core/java/android/webkit/WebViewClient.java21
-rw-r--r--core/java/android/widget/RelativeLayout.java18
-rw-r--r--core/java/android/widget/Spinner.java8
-rw-r--r--core/java/com/android/internal/inputmethod/InputMethodUtils.java39
-rw-r--r--core/java/com/android/internal/os/BatteryStatsImpl.java39
-rw-r--r--core/java/com/android/internal/widget/ButtonBarLayout.java12
12 files changed, 165 insertions, 70 deletions
diff --git a/core/java/android/content/AbstractThreadedSyncAdapter.java b/core/java/android/content/AbstractThreadedSyncAdapter.java
index 809f900..d4dee5b 100644
--- a/core/java/android/content/AbstractThreadedSyncAdapter.java
+++ b/core/java/android/content/AbstractThreadedSyncAdapter.java
@@ -28,13 +28,26 @@ import java.util.concurrent.atomic.AtomicInteger;
/**
* An abstract implementation of a SyncAdapter that spawns a thread to invoke a sync operation.
- * If a sync operation is already in progress when a startSync() request is received then an error
- * will be returned to the new request and the existing request will be allowed to continue.
- * When a startSync() is received and there is no sync operation in progress then a thread
- * will be started to run the operation and {@link #onPerformSync} will be invoked on that thread.
- * If a cancelSync() is received that matches an existing sync operation then the thread
- * that is running that sync operation will be interrupted, which will indicate to the thread
- * that the sync has been canceled.
+ * If a sync operation is already in progress when a sync request is received, an error will be
+ * returned to the new request and the existing request will be allowed to continue.
+ * However if there is no sync in progress then a thread will be spawned and {@link #onPerformSync}
+ * will be invoked on that thread.
+ * <p>
+ * Syncs can be cancelled at any time by the framework. For example a sync that was not
+ * user-initiated and lasts longer than 30 minutes will be considered timed-out and cancelled.
+ * Similarly the framework will attempt to determine whether or not an adapter is making progress
+ * by monitoring its network activity over the course of a minute. If the network traffic over this
+ * window is close enough to zero the sync will be cancelled. You can also request the sync be
+ * cancelled via {@link ContentResolver#cancelSync(Account, String)} or
+ * {@link ContentResolver#cancelSync(SyncRequest)}.
+ * <p>
+ * A sync is cancelled by issuing a {@link Thread#interrupt()} on the syncing thread. <strong>Either
+ * your code in {@link #onPerformSync(Account, Bundle, String, ContentProviderClient, SyncResult)}
+ * must check {@link Thread#interrupted()}, or you you must override one of
+ * {@link #onSyncCanceled(Thread)}/{@link #onSyncCanceled()}</strong> (depending on whether or not
+ * your adapter supports syncing of multiple accounts in parallel). If your adapter does not
+ * respect the cancel issued by the framework you run the risk of your app's entire process being
+ * killed.
* <p>
* In order to be a sync adapter one must extend this class, provide implementations for the
* abstract methods and write a service that returns the result of {@link #getSyncAdapterBinder()}
diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java
index 593f804..7fda30a 100644
--- a/core/java/android/os/BatteryStats.java
+++ b/core/java/android/os/BatteryStats.java
@@ -142,9 +142,9 @@ public abstract class BatteryStats implements Parcelable {
public static final int CAMERA_TURNED_ON = 17;
/**
- * A constant indicating a doze wake lock timer.
+ * A constant indicating a draw wake lock timer.
*/
- public static final int WAKE_TYPE_DOZE = 18;
+ public static final int WAKE_TYPE_DRAW = 18;
/**
* Include all of the data in the stats, including previously saved data.
@@ -3839,7 +3839,7 @@ public abstract class BatteryStats implements Parcelable {
final ArrayMap<String, ? extends BatteryStats.Uid.Wakelock> wakelocks
= u.getWakelockStats();
long totalFullWakelock = 0, totalPartialWakelock = 0, totalWindowWakelock = 0;
- long totalDozeWakelock = 0;
+ long totalDrawWakelock = 0;
int countWakelock = 0;
for (int iw=wakelocks.size()-1; iw>=0; iw--) {
final Uid.Wakelock wl = wakelocks.valueAt(iw);
@@ -3854,8 +3854,8 @@ public abstract class BatteryStats implements Parcelable {
"partial", which, linePrefix);
linePrefix = printWakeLock(sb, wl.getWakeTime(WAKE_TYPE_WINDOW), rawRealtime,
"window", which, linePrefix);
- linePrefix = printWakeLock(sb, wl.getWakeTime(WAKE_TYPE_DOZE), rawRealtime,
- "doze", which, linePrefix);
+ linePrefix = printWakeLock(sb, wl.getWakeTime(WAKE_TYPE_DRAW), rawRealtime,
+ "draw", which, linePrefix);
sb.append(" realtime");
pw.println(sb.toString());
uidActivity = true;
@@ -3867,7 +3867,7 @@ public abstract class BatteryStats implements Parcelable {
rawRealtime, which);
totalWindowWakelock += computeWakeLock(wl.getWakeTime(WAKE_TYPE_WINDOW),
rawRealtime, which);
- totalDozeWakelock += computeWakeLock(wl.getWakeTime(WAKE_TYPE_DOZE),
+ totalDrawWakelock += computeWakeLock(wl.getWakeTime(WAKE_TYPE_DRAW),
rawRealtime, which);
}
if (countWakelock > 1) {
@@ -3898,13 +3898,13 @@ public abstract class BatteryStats implements Parcelable {
formatTimeMs(sb, totalWindowWakelock);
sb.append("window");
}
- if (totalDozeWakelock != 0) {
+ if (totalDrawWakelock != 0) {
if (needComma) {
sb.append(",");
}
needComma = true;
- formatTimeMs(sb, totalDozeWakelock);
- sb.append("doze");
+ formatTimeMs(sb, totalDrawWakelock);
+ sb.append("draw");
}
sb.append(" realtime");
pw.println(sb.toString());
diff --git a/core/java/android/os/storage/VolumeInfo.java b/core/java/android/os/storage/VolumeInfo.java
index 8d11527..e33baa9 100644
--- a/core/java/android/os/storage/VolumeInfo.java
+++ b/core/java/android/os/storage/VolumeInfo.java
@@ -137,6 +137,7 @@ public class VolumeInfo implements Parcelable {
public final String id;
public final int type;
public final DiskInfo disk;
+ public final String partGuid;
public int mountFlags = 0;
public int mountUserId = -1;
public int state = STATE_UNMOUNTED;
@@ -149,10 +150,11 @@ public class VolumeInfo implements Parcelable {
/** Framework state */
public final int mtpIndex;
- public VolumeInfo(String id, int type, DiskInfo disk, int mtpIndex) {
+ public VolumeInfo(String id, int type, DiskInfo disk, String partGuid, int mtpIndex) {
this.id = Preconditions.checkNotNull(id);
this.type = type;
this.disk = disk;
+ this.partGuid = partGuid;
this.mtpIndex = mtpIndex;
}
@@ -164,6 +166,7 @@ public class VolumeInfo implements Parcelable {
} else {
disk = null;
}
+ partGuid = parcel.readString();
mountFlags = parcel.readInt();
mountUserId = parcel.readInt();
state = parcel.readInt();
@@ -385,6 +388,7 @@ public class VolumeInfo implements Parcelable {
pw.increaseIndent();
pw.printPair("type", DebugUtils.valueToString(getClass(), "TYPE_", type));
pw.printPair("diskId", getDiskId());
+ pw.printPair("partGuid", partGuid);
pw.printPair("mountFlags", DebugUtils.flagsToString(getClass(), "MOUNT_FLAG_", mountFlags));
pw.printPair("mountUserId", mountUserId);
pw.printPair("state", DebugUtils.valueToString(getClass(), "STATE_", state));
@@ -453,6 +457,7 @@ public class VolumeInfo implements Parcelable {
} else {
parcel.writeInt(0);
}
+ parcel.writeString(partGuid);
parcel.writeInt(mountFlags);
parcel.writeInt(mountUserId);
parcel.writeInt(state);
diff --git a/core/java/android/os/storage/VolumeRecord.java b/core/java/android/os/storage/VolumeRecord.java
index 096e2dd..cb16305 100644
--- a/core/java/android/os/storage/VolumeRecord.java
+++ b/core/java/android/os/storage/VolumeRecord.java
@@ -39,6 +39,7 @@ public class VolumeRecord implements Parcelable {
public final int type;
public final String fsUuid;
+ public String partGuid;
public String nickname;
public int userFlags;
@@ -50,6 +51,7 @@ public class VolumeRecord implements Parcelable {
public VolumeRecord(Parcel parcel) {
type = parcel.readInt();
fsUuid = parcel.readString();
+ partGuid = parcel.readString();
nickname = parcel.readString();
userFlags = parcel.readInt();
}
@@ -79,6 +81,8 @@ public class VolumeRecord implements Parcelable {
pw.increaseIndent();
pw.printPair("type", DebugUtils.valueToString(VolumeInfo.class, "TYPE_", type));
pw.printPair("fsUuid", fsUuid);
+ pw.printPair("partGuid", partGuid);
+ pw.println();
pw.printPair("nickname", nickname);
pw.printPair("userFlags",
DebugUtils.flagsToString(VolumeRecord.class, "USER_FLAG_", userFlags));
@@ -133,6 +137,7 @@ public class VolumeRecord implements Parcelable {
public void writeToParcel(Parcel parcel, int flags) {
parcel.writeInt(type);
parcel.writeString(fsUuid);
+ parcel.writeString(partGuid);
parcel.writeString(nickname);
parcel.writeInt(userFlags);
}
diff --git a/core/java/android/text/TextUtils.java b/core/java/android/text/TextUtils.java
index d51aa79..d8f7158 100644
--- a/core/java/android/text/TextUtils.java
+++ b/core/java/android/text/TextUtils.java
@@ -465,6 +465,11 @@ public class TextUtils {
return false;
}
+ /** {@hide} */
+ public static String nullIfEmpty(@Nullable String str) {
+ return isEmpty(str) ? null : str;
+ }
+
/**
* Returns the length that the specified CharSequence would have if
* spaces and control characters were trimmed from the start and end,
diff --git a/core/java/android/view/accessibility/CaptioningManager.java b/core/java/android/view/accessibility/CaptioningManager.java
index 410d39c..14f0b0a 100644
--- a/core/java/android/view/accessibility/CaptioningManager.java
+++ b/core/java/android/view/accessibility/CaptioningManager.java
@@ -266,11 +266,19 @@ public class CaptioningManager {
* background colors, edge properties, and typeface.
*/
public static final class CaptionStyle {
- /** Packed value for a color of 'none' and a cached opacity of 100%. */
+ /**
+ * Packed value for a color of 'none' and a cached opacity of 100%.
+ *
+ * @hide
+ */
private static final int COLOR_NONE_OPAQUE = 0x000000FF;
- /** Packed value for an unspecified color and opacity. */
- private static final int COLOR_UNSPECIFIED = 0x000001FF;
+ /**
+ * Packed value for a color of 'default' and opacity of 100%.
+ *
+ * @hide
+ */
+ public static final int COLOR_UNSPECIFIED = 0x00FFFFFF;
private static final CaptionStyle WHITE_ON_BLACK;
private static final CaptionStyle BLACK_ON_WHITE;
@@ -350,11 +358,11 @@ public class CaptioningManager {
private CaptionStyle(int foregroundColor, int backgroundColor, int edgeType, int edgeColor,
int windowColor, String rawTypeface) {
- mHasForegroundColor = foregroundColor != COLOR_UNSPECIFIED;
- mHasBackgroundColor = backgroundColor != COLOR_UNSPECIFIED;
+ mHasForegroundColor = hasColor(foregroundColor);
+ mHasBackgroundColor = hasColor(backgroundColor);
mHasEdgeType = edgeType != EDGE_TYPE_UNSPECIFIED;
- mHasEdgeColor = edgeColor != COLOR_UNSPECIFIED;
- mHasWindowColor = windowColor != COLOR_UNSPECIFIED;
+ mHasEdgeColor = hasColor(edgeColor);
+ mHasWindowColor = hasColor(windowColor);
// Always use valid colors, even when no override is specified, to
// ensure backwards compatibility with apps targeting KitKat MR2.
@@ -368,6 +376,20 @@ public class CaptioningManager {
}
/**
+ * Returns whether a packed color indicates a non-default value.
+ *
+ * @param packedColor the packed color value
+ * @return {@code true} if a non-default value is specified
+ * @hide
+ */
+ public static boolean hasColor(int packedColor) {
+ // Matches the color packing code from Settings. "Default" packed
+ // colors are indicated by zero alpha and non-zero red/blue. The
+ // cached alpha value used by Settings is stored in green.
+ return (packedColor >>> 24) != 0 || (packedColor & 0xFFFF00) == 0;
+ }
+
+ /**
* Applies a caption style, overriding any properties that are specified
* in the overlay caption.
*
diff --git a/core/java/android/webkit/WebViewClient.java b/core/java/android/webkit/WebViewClient.java
index 2f5c9e2..de8ccc1 100644
--- a/core/java/android/webkit/WebViewClient.java
+++ b/core/java/android/webkit/WebViewClient.java
@@ -298,14 +298,27 @@ public class WebViewClient {
* Notify the host application to handle a SSL client certificate
* request. The host application is responsible for showing the UI
* if desired and providing the keys. There are three ways to
- * respond: proceed(), cancel() or ignore(). Webview remembers the
- * response if proceed() or cancel() is called and does not
- * call onReceivedClientCertRequest() again for the same host and port
- * pair. Webview does not remember the response if ignore() is called.
+ * respond: proceed(), cancel() or ignore(). Webview stores the response
+ * in memory (for the life of the application) if proceed() or cancel() is
+ * called and does not call onReceivedClientCertRequest() again for the
+ * same host and port pair. Webview does not store the response if ignore()
+ * is called.
*
* This method is called on the UI thread. During the callback, the
* connection is suspended.
*
+ * For most use cases, the application program should implement the
+ * {@link android.security.KeyChainAliasCallback} interface and pass it to
+ * {@link android.security.KeyChain#choosePrivateKeyAlias} to start an
+ * activity for the user to choose the proper alias. The keychain activity will
+ * provide the alias through the callback method in the implemented interface. Next
+ * the application should create an async task to call
+ * {@link android.security.KeyChain#getPrivateKey} to receive the key.
+ *
+ * An example implementation of client certificates can be seen at
+ * <A href="https://android.googlesource.com/platform/packages/apps/Browser/+/android-5.1.1_r1/src/com/android/browser/Tab.java">
+ * AOSP Browser</a>
+ *
* The default behavior is to cancel, returning no client certificate.
*
* @param view The WebView that is initiating the callback
diff --git a/core/java/android/widget/RelativeLayout.java b/core/java/android/widget/RelativeLayout.java
index affc5da..339038e 100644
--- a/core/java/android/widget/RelativeLayout.java
+++ b/core/java/android/widget/RelativeLayout.java
@@ -522,7 +522,7 @@ public class RelativeLayout extends ViewGroup {
View baselineView = null;
LayoutParams baselineParams = null;
for (int i = 0; i < count; i++) {
- final View child = getChildAt(i);
+ final View child = views[i];
if (child.getVisibility() != GONE) {
final LayoutParams childParams = (LayoutParams) child.getLayoutParams();
if (baselineView == null || baselineParams == null
@@ -548,9 +548,9 @@ public class RelativeLayout extends ViewGroup {
if (offsetHorizontalAxis) {
for (int i = 0; i < count; i++) {
- View child = getChildAt(i);
+ final View child = views[i];
if (child.getVisibility() != GONE) {
- LayoutParams params = (LayoutParams) child.getLayoutParams();
+ final LayoutParams params = (LayoutParams) child.getLayoutParams();
final int[] rules = params.getRules(layoutDirection);
if (rules[CENTER_IN_PARENT] != 0 || rules[CENTER_HORIZONTAL] != 0) {
centerHorizontal(child, params, width);
@@ -578,9 +578,9 @@ public class RelativeLayout extends ViewGroup {
if (offsetVerticalAxis) {
for (int i = 0; i < count; i++) {
- View child = getChildAt(i);
+ final View child = views[i];
if (child.getVisibility() != GONE) {
- LayoutParams params = (LayoutParams) child.getLayoutParams();
+ final LayoutParams params = (LayoutParams) child.getLayoutParams();
final int[] rules = params.getRules(layoutDirection);
if (rules[CENTER_IN_PARENT] != 0 || rules[CENTER_VERTICAL] != 0) {
centerVertical(child, params, height);
@@ -607,9 +607,9 @@ public class RelativeLayout extends ViewGroup {
final int verticalOffset = contentBounds.top - top;
if (horizontalOffset != 0 || verticalOffset != 0) {
for (int i = 0; i < count; i++) {
- View child = getChildAt(i);
+ final View child = views[i];
if (child.getVisibility() != GONE && child != ignore) {
- LayoutParams params = (LayoutParams) child.getLayoutParams();
+ final LayoutParams params = (LayoutParams) child.getLayoutParams();
if (horizontalGravity) {
params.mLeft += horizontalOffset;
params.mRight += horizontalOffset;
@@ -626,9 +626,9 @@ public class RelativeLayout extends ViewGroup {
if (isLayoutRtl()) {
final int offsetWidth = myWidth - width;
for (int i = 0; i < count; i++) {
- View child = getChildAt(i);
+ final View child = views[i];
if (child.getVisibility() != GONE) {
- LayoutParams params = (LayoutParams) child.getLayoutParams();
+ final LayoutParams params = (LayoutParams) child.getLayoutParams();
params.mLeft -= offsetWidth;
params.mRight -= offsetWidth;
}
diff --git a/core/java/android/widget/Spinner.java b/core/java/android/widget/Spinner.java
index fdabe91..6abd129 100644
--- a/core/java/android/widget/Spinner.java
+++ b/core/java/android/widget/Spinner.java
@@ -711,9 +711,7 @@ public class Spinner extends AbsSpinner implements OnClickListener {
lp = generateDefaultLayoutParams();
}
- if (addChild) {
- addViewInLayout(child, 0, lp);
- }
+ addViewInLayout(child, 0, lp);
child.setSelected(hasFocus());
if (mDisableChildrenWhenDisabled) {
@@ -743,6 +741,10 @@ public class Spinner extends AbsSpinner implements OnClickListener {
childRight = childLeft + width;
child.layout(childLeft, childTop, childRight, childBottom);
+
+ if (!addChild) {
+ removeViewInLayout(child);
+ }
}
@Override
diff --git a/core/java/com/android/internal/inputmethod/InputMethodUtils.java b/core/java/com/android/internal/inputmethod/InputMethodUtils.java
index 042db71..ac17cbe 100644
--- a/core/java/com/android/internal/inputmethod/InputMethodUtils.java
+++ b/core/java/com/android/internal/inputmethod/InputMethodUtils.java
@@ -22,9 +22,10 @@ import android.app.AppOpsManager;
import android.content.ContentResolver;
import android.content.Context;
import android.content.pm.ApplicationInfo;
+import android.content.pm.IPackageManager;
import android.content.pm.PackageManager;
-import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Resources;
+import android.os.RemoteException;
import android.provider.Settings;
import android.provider.Settings.SettingNotFoundException;
import android.text.TextUtils;
@@ -646,7 +647,8 @@ public class InputMethodUtils {
}
public static void setNonSelectedSystemImesDisabledUntilUsed(
- PackageManager packageManager, List<InputMethodInfo> enabledImis) {
+ IPackageManager packageManager, List<InputMethodInfo> enabledImis,
+ int userId, String callingPackage) {
if (DEBUG) {
Slog.d(TAG, "setNonSelectedSystemImesDisabledUntilUsed");
}
@@ -685,9 +687,11 @@ public class InputMethodUtils {
ApplicationInfo ai = null;
try {
ai = packageManager.getApplicationInfo(packageName,
- PackageManager.GET_DISABLED_UNTIL_USED_COMPONENTS);
- } catch (NameNotFoundException e) {
- Slog.w(TAG, "NameNotFoundException: " + packageName, e);
+ PackageManager.GET_DISABLED_UNTIL_USED_COMPONENTS, userId);
+ } catch (RemoteException e) {
+ Slog.w(TAG, "getApplicationInfo failed. packageName=" + packageName
+ + " userId=" + userId, e);
+ continue;
}
if (ai == null) {
// No app found for packageName
@@ -697,19 +701,34 @@ public class InputMethodUtils {
if (!isSystemPackage) {
continue;
}
- setDisabledUntilUsed(packageManager, packageName);
+ setDisabledUntilUsed(packageManager, packageName, userId, callingPackage);
}
}
- private static void setDisabledUntilUsed(PackageManager packageManager, String packageName) {
- final int state = packageManager.getApplicationEnabledSetting(packageName);
+ private static void setDisabledUntilUsed(IPackageManager packageManager, String packageName,
+ int userId, String callingPackage) {
+ final int state;
+ try {
+ state = packageManager.getApplicationEnabledSetting(packageName, userId);
+ } catch (RemoteException e) {
+ Slog.w(TAG, "getApplicationEnabledSetting failed. packageName=" + packageName
+ + " userId=" + userId, e);
+ return;
+ }
if (state == PackageManager.COMPONENT_ENABLED_STATE_DEFAULT
|| state == PackageManager.COMPONENT_ENABLED_STATE_ENABLED) {
if (DEBUG) {
Slog.d(TAG, "Update state(" + packageName + "): DISABLED_UNTIL_USED");
}
- packageManager.setApplicationEnabledSetting(packageName,
- PackageManager.COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED, 0);
+ try {
+ packageManager.setApplicationEnabledSetting(packageName,
+ PackageManager.COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED,
+ 0 /* newState */, userId, callingPackage);
+ } catch (RemoteException e) {
+ Slog.w(TAG, "setApplicationEnabledSetting failed. packageName=" + packageName
+ + " userId=" + userId + " callingPackage=" + callingPackage, e);
+ return;
+ }
} else {
if (DEBUG) {
Slog.d(TAG, packageName + " is already DISABLED_UNTIL_USED");
diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java
index 83ce5f6..1bd821d 100644
--- a/core/java/com/android/internal/os/BatteryStatsImpl.java
+++ b/core/java/com/android/internal/os/BatteryStatsImpl.java
@@ -208,7 +208,7 @@ public final class BatteryStatsImpl extends BatteryStats {
final ArrayList<StopwatchTimer> mPartialTimers = new ArrayList<>();
final ArrayList<StopwatchTimer> mFullTimers = new ArrayList<>();
final ArrayList<StopwatchTimer> mWindowTimers = new ArrayList<>();
- final ArrayList<StopwatchTimer> mDozeTimers = new ArrayList<>();
+ final ArrayList<StopwatchTimer> mDrawTimers = new ArrayList<>();
final SparseArray<ArrayList<StopwatchTimer>> mSensorTimers = new SparseArray<>();
final ArrayList<StopwatchTimer> mWifiRunningTimers = new ArrayList<>();
final ArrayList<StopwatchTimer> mFullWifiLockTimers = new ArrayList<>();
@@ -5649,9 +5649,9 @@ public final class BatteryStatsImpl extends BatteryStats {
StopwatchTimer mTimerWindow;
/**
- * How long (in ms) this uid has had a doze wake lock.
+ * How long (in ms) this uid has had a draw wake lock.
*/
- StopwatchTimer mTimerDoze;
+ StopwatchTimer mTimerDraw;
/**
* Reads a possibly null Timer from a Parcel. The timer is associated with the
@@ -5680,8 +5680,8 @@ public final class BatteryStatsImpl extends BatteryStats {
if (mTimerWindow != null) {
wlactive |= !mTimerWindow.reset(false);
}
- if (mTimerDoze != null) {
- wlactive |= !mTimerDoze.reset(false);
+ if (mTimerDraw != null) {
+ wlactive |= !mTimerDraw.reset(false);
}
if (!wlactive) {
if (mTimerFull != null) {
@@ -5696,9 +5696,9 @@ public final class BatteryStatsImpl extends BatteryStats {
mTimerWindow.detach();
mTimerWindow = null;
}
- if (mTimerDoze != null) {
- mTimerDoze.detach();
- mTimerDoze = null;
+ if (mTimerDraw != null) {
+ mTimerDraw.detach();
+ mTimerDraw = null;
}
}
return !wlactive;
@@ -5709,14 +5709,14 @@ public final class BatteryStatsImpl extends BatteryStats {
mPartialTimers, screenOffTimeBase, in);
mTimerFull = readTimerFromParcel(WAKE_TYPE_FULL, mFullTimers, timeBase, in);
mTimerWindow = readTimerFromParcel(WAKE_TYPE_WINDOW, mWindowTimers, timeBase, in);
- mTimerDoze = readTimerFromParcel(WAKE_TYPE_DOZE, mDozeTimers, timeBase, in);
+ mTimerDraw = readTimerFromParcel(WAKE_TYPE_DRAW, mDrawTimers, timeBase, in);
}
void writeToParcelLocked(Parcel out, long elapsedRealtimeUs) {
Timer.writeTimerToParcel(out, mTimerPartial, elapsedRealtimeUs);
Timer.writeTimerToParcel(out, mTimerFull, elapsedRealtimeUs);
Timer.writeTimerToParcel(out, mTimerWindow, elapsedRealtimeUs);
- Timer.writeTimerToParcel(out, mTimerDoze, elapsedRealtimeUs);
+ Timer.writeTimerToParcel(out, mTimerDraw, elapsedRealtimeUs);
}
@Override
@@ -5725,7 +5725,7 @@ public final class BatteryStatsImpl extends BatteryStats {
case WAKE_TYPE_FULL: return mTimerFull;
case WAKE_TYPE_PARTIAL: return mTimerPartial;
case WAKE_TYPE_WINDOW: return mTimerWindow;
- case WAKE_TYPE_DOZE: return mTimerDoze;
+ case WAKE_TYPE_DRAW: return mTimerDraw;
default: throw new IllegalArgumentException("type = " + type);
}
}
@@ -5757,13 +5757,14 @@ public final class BatteryStatsImpl extends BatteryStats {
mTimerWindow = t;
}
return t;
- case WAKE_TYPE_DOZE:
- t = mTimerDoze;
+ case WAKE_TYPE_DRAW:
+ t = mTimerDraw;
if (t == null) {
- t = new StopwatchTimer(Uid.this, WAKE_TYPE_DOZE,
- mDozeTimers, mOnBatteryTimeBase);
- mTimerDoze = t;
+ t = new StopwatchTimer(Uid.this, WAKE_TYPE_DRAW,
+ mDrawTimers, mOnBatteryTimeBase);
+ mTimerDraw = t;
}
+ return t;
default:
throw new IllegalArgumentException("type=" + type);
}
@@ -6621,7 +6622,7 @@ public final class BatteryStatsImpl extends BatteryStats {
wl.getStopwatchTimer(WAKE_TYPE_WINDOW).readSummaryFromParcelLocked(in);
}
if (in.readInt() != 0) {
- wl.getStopwatchTimer(WAKE_TYPE_DOZE).readSummaryFromParcelLocked(in);
+ wl.getStopwatchTimer(WAKE_TYPE_DRAW).readSummaryFromParcelLocked(in);
}
}
@@ -9610,9 +9611,9 @@ public final class BatteryStatsImpl extends BatteryStats {
} else {
out.writeInt(0);
}
- if (wl.mTimerDoze != null) {
+ if (wl.mTimerDraw != null) {
out.writeInt(1);
- wl.mTimerDoze.writeSummaryFromParcelLocked(out, NOWREAL_SYS);
+ wl.mTimerDraw.writeSummaryFromParcelLocked(out, NOWREAL_SYS);
} else {
out.writeInt(0);
}
diff --git a/core/java/com/android/internal/widget/ButtonBarLayout.java b/core/java/com/android/internal/widget/ButtonBarLayout.java
index 39613e8..3b7bce4 100644
--- a/core/java/com/android/internal/widget/ButtonBarLayout.java
+++ b/core/java/com/android/internal/widget/ButtonBarLayout.java
@@ -31,7 +31,7 @@ import com.android.internal.R;
*/
public class ButtonBarLayout extends LinearLayout {
/** Whether the current configuration allows stacking. */
- private final boolean mAllowStacking;
+ private boolean mAllowStacking;
private int mLastWidthSize = -1;
@@ -43,6 +43,16 @@ public class ButtonBarLayout extends LinearLayout {
ta.recycle();
}
+ public void setAllowStacking(boolean allowStacking) {
+ if (mAllowStacking != allowStacking) {
+ mAllowStacking = allowStacking;
+ if (!mAllowStacking && getOrientation() == LinearLayout.VERTICAL) {
+ setStacked(false);
+ }
+ requestLayout();
+ }
+ }
+
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
final int widthSize = MeasureSpec.getSize(widthMeasureSpec);