summaryrefslogtreecommitdiffstats
path: root/core/java
diff options
context:
space:
mode:
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/hardware/camera2/impl/CameraDevice.java60
-rw-r--r--core/java/android/os/BatteryStats.java5
-rw-r--r--core/java/android/preference/PreferenceActivity.java11
-rw-r--r--core/java/android/provider/DocumentsProvider.java2
-rw-r--r--core/java/android/util/MapCollections.java2
-rw-r--r--core/java/android/view/View.java31
-rw-r--r--core/java/com/android/internal/os/BatteryStatsImpl.java3
7 files changed, 86 insertions, 28 deletions
diff --git a/core/java/android/hardware/camera2/impl/CameraDevice.java b/core/java/android/hardware/camera2/impl/CameraDevice.java
index c5d0999..c428a17 100644
--- a/core/java/android/hardware/camera2/impl/CameraDevice.java
+++ b/core/java/android/hardware/camera2/impl/CameraDevice.java
@@ -19,27 +19,24 @@ package android.hardware.camera2.impl;
import static android.hardware.camera2.CameraAccessException.CAMERA_IN_USE;
import android.hardware.camera2.CameraAccessException;
-import android.hardware.camera2.CameraMetadata;
-import android.hardware.camera2.CameraCharacteristics;
import android.hardware.camera2.CaptureRequest;
import android.hardware.camera2.CaptureResult;
import android.hardware.camera2.ICameraDeviceCallbacks;
import android.hardware.camera2.ICameraDeviceUser;
import android.hardware.camera2.utils.CameraBinderDecorator;
import android.hardware.camera2.utils.CameraRuntimeException;
-import android.os.IBinder;
-import android.os.RemoteException;
import android.os.Handler;
+import android.os.IBinder;
import android.os.Looper;
+import android.os.RemoteException;
import android.util.Log;
import android.util.SparseArray;
import android.view.Surface;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
-import java.util.Stack;
/**
* HAL2.1+ implementation of CameraDevice. Use CameraManager#open to instantiate
@@ -49,6 +46,8 @@ public class CameraDevice implements android.hardware.camera2.CameraDevice {
private final String TAG;
private final boolean DEBUG;
+ private static final int REQUEST_ID_NONE = -1;
+
// TODO: guard every function with if (!mRemoteDevice) check (if it was closed)
private ICameraDeviceUser mRemoteDevice;
@@ -63,7 +62,8 @@ public class CameraDevice implements android.hardware.camera2.CameraDevice {
private final SparseArray<CaptureListenerHolder> mCaptureListenerMap =
new SparseArray<CaptureListenerHolder>();
- private final Stack<Integer> mRepeatingRequestIdStack = new Stack<Integer>();
+ private int mRepeatingRequestId = REQUEST_ID_NONE;
+ private final ArrayList<Integer> mRepeatingRequestIdDeletedList = new ArrayList<Integer>();
// Map stream IDs to Surfaces
private final SparseArray<Surface> mConfiguredOutputs = new SparseArray<Surface>();
@@ -186,7 +186,7 @@ public class CameraDevice implements android.hardware.camera2.CameraDevice {
stopRepeating();
try {
- mRemoteDevice.waitUntilIdle();
+ waitUntilIdle();
// TODO: mRemoteDevice.beginConfigure
// Delete all streams first (to free up HW resources)
@@ -293,7 +293,11 @@ public class CameraDevice implements android.hardware.camera2.CameraDevice {
}
if (repeating) {
- mRepeatingRequestIdStack.add(requestId);
+ // Queue for deletion after in-flight requests finish
+ if (mRepeatingRequestId != REQUEST_ID_NONE) {
+ mRepeatingRequestIdDeletedList.add(mRepeatingRequestId);
+ }
+ mRepeatingRequestId = requestId;
}
if (mIdle) {
@@ -327,8 +331,13 @@ public class CameraDevice implements android.hardware.camera2.CameraDevice {
synchronized (mLock) {
checkIfCameraClosed();
- while (!mRepeatingRequestIdStack.isEmpty()) {
- int requestId = mRepeatingRequestIdStack.pop();
+ if (mRepeatingRequestId != REQUEST_ID_NONE) {
+
+ int requestId = mRepeatingRequestId;
+ mRepeatingRequestId = REQUEST_ID_NONE;
+
+ // Queue for deletion after in-flight requests finish
+ mRepeatingRequestIdDeletedList.add(requestId);
try {
mRemoteDevice.cancelRequest(requestId);
@@ -347,7 +356,7 @@ public class CameraDevice implements android.hardware.camera2.CameraDevice {
synchronized (mLock) {
checkIfCameraClosed();
- if (!mRepeatingRequestIdStack.isEmpty()) {
+ if (mRepeatingRequestId != REQUEST_ID_NONE) {
throw new IllegalStateException("Active repeating request ongoing");
}
@@ -359,6 +368,10 @@ public class CameraDevice implements android.hardware.camera2.CameraDevice {
// impossible
return;
}
+
+ mRepeatingRequestId = REQUEST_ID_NONE;
+ mRepeatingRequestIdDeletedList.clear();
+ mCaptureListenerMap.clear();
}
}
@@ -572,13 +585,28 @@ public class CameraDevice implements android.hardware.camera2.CameraDevice {
holder = CameraDevice.this.mCaptureListenerMap.get(requestId);
// Clean up listener once we no longer expect to see it.
-
- // TODO: how to handle repeating listeners?
- // we probably want cancelRequest to return # of times it already enqueued and
- // keep a counter.
if (holder != null && !holder.isRepeating()) {
CameraDevice.this.mCaptureListenerMap.remove(requestId);
}
+
+ // TODO: add 'capture sequence completed' callback to the
+ // service, and clean up repeating requests there instead.
+
+ // If we received a result for a repeating request and have
+ // prior repeating requests queued for deletion, remove those
+ // requests from mCaptureListenerMap.
+ if (holder != null && holder.isRepeating()
+ && mRepeatingRequestIdDeletedList.size() > 0) {
+ Iterator<Integer> iter = mRepeatingRequestIdDeletedList.iterator();
+ while (iter.hasNext()) {
+ int deletedRequestId = iter.next();
+ if (deletedRequestId < requestId) {
+ CameraDevice.this.mCaptureListenerMap.remove(deletedRequestId);
+ iter.remove();
+ }
+ }
+ }
+
}
// Check if we have a listener for this
diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java
index dbaa325..7ae8ca8 100644
--- a/core/java/android/os/BatteryStats.java
+++ b/core/java/android/os/BatteryStats.java
@@ -844,12 +844,13 @@ public abstract class BatteryStats implements Parcelable {
public static final int DATA_CONNECTION_EVDO_B = 12;
public static final int DATA_CONNECTION_LTE = 13;
public static final int DATA_CONNECTION_EHRPD = 14;
- public static final int DATA_CONNECTION_OTHER = 15;
+ public static final int DATA_CONNECTION_HSPAP = 15;
+ public static final int DATA_CONNECTION_OTHER = 16;
static final String[] DATA_CONNECTION_NAMES = {
"none", "gprs", "edge", "umts", "cdma", "evdo_0", "evdo_A",
"1xrtt", "hsdpa", "hsupa", "hspa", "iden", "evdo_b", "lte",
- "ehrpd", "other"
+ "ehrpd", "hspap", "other"
};
public static final int NUM_DATA_CONNECTION_TYPES = DATA_CONNECTION_OTHER+1;
diff --git a/core/java/android/preference/PreferenceActivity.java b/core/java/android/preference/PreferenceActivity.java
index 2ab5a91..ed9264a 100644
--- a/core/java/android/preference/PreferenceActivity.java
+++ b/core/java/android/preference/PreferenceActivity.java
@@ -33,7 +33,6 @@ import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
import android.util.AttributeSet;
-import android.util.Log;
import android.util.TypedValue;
import android.util.Xml;
import android.view.LayoutInflater;
@@ -125,8 +124,6 @@ public abstract class PreferenceActivity extends ListActivity implements
PreferenceManager.OnPreferenceTreeClickListener,
PreferenceFragment.OnPreferenceStartFragmentCallback {
- private static final String TAG = "PreferenceActivity";
-
// Constants for state save/restore
private static final String HEADERS_TAG = ":android:headers";
private static final String CUR_HEADER_TAG = ":android:cur_header";
@@ -576,12 +573,14 @@ public abstract class PreferenceActivity extends ListActivity implements
// Single pane, showing just a prefs fragment.
findViewById(com.android.internal.R.id.headers).setVisibility(View.GONE);
mPrefsContainer.setVisibility(View.VISIBLE);
+ CharSequence initialTitleStr = null;
+ CharSequence initialShortTitleStr = null;
if (initialTitle != 0) {
- CharSequence initialTitleStr = getText(initialTitle);
- CharSequence initialShortTitleStr = initialShortTitle != 0
+ initialTitleStr = getText(initialTitle);
+ initialShortTitleStr = initialShortTitle != 0
? getText(initialShortTitle) : null;
- showBreadCrumbs(initialTitleStr, initialShortTitleStr);
}
+ showBreadCrumbs(initialTitleStr, initialShortTitleStr);
} else if (mHeaders.size() > 0) {
setListAdapter(new HeaderAdapter(this, mHeaders));
if (!mSinglePane) {
diff --git a/core/java/android/provider/DocumentsProvider.java b/core/java/android/provider/DocumentsProvider.java
index 25d6f5b..cc81be5 100644
--- a/core/java/android/provider/DocumentsProvider.java
+++ b/core/java/android/provider/DocumentsProvider.java
@@ -216,6 +216,8 @@ public abstract class DocumentsProvider extends ContentProvider {
* {@link Root#FLAG_SUPPORTS_RECENTS}. The returned documents should be
* sorted by {@link Document#COLUMN_LAST_MODIFIED} in descending order, and
* limited to only return the 64 most recently modified documents.
+ * <p>
+ * Recent documents do not support change notifications.
*
* @param projection list of {@link Document} columns to put into the
* cursor. If {@code null} all supported columns should be
diff --git a/core/java/android/util/MapCollections.java b/core/java/android/util/MapCollections.java
index f4a9b0b..28b788b 100644
--- a/core/java/android/util/MapCollections.java
+++ b/core/java/android/util/MapCollections.java
@@ -97,10 +97,10 @@ abstract class MapCollections<K, V> {
if (!mEntryValid) {
throw new IllegalStateException();
}
+ colRemoveAt(mIndex);
mIndex--;
mEnd--;
mEntryValid = false;
- colRemoveAt(mIndex);
}
@Override
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index e2d98ed..aa2b0d4 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -3102,6 +3102,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
*/
private static final int UNDEFINED_PADDING = Integer.MIN_VALUE;
+ private boolean mUseBackgroundPadding = false;
+
/**
* @hide
*/
@@ -5900,6 +5902,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
sThreadLocal.set(localInsets);
}
boolean res = computeFitSystemWindows(insets, localInsets);
+ mUserPaddingLeftInitial = localInsets.left;
+ mUserPaddingRightInitial = localInsets.right;
internalSetPadding(localInsets.left, localInsets.top,
localInsets.right, localInsets.bottom);
return res;
@@ -12133,12 +12137,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
if (!isTextAlignmentResolved()) {
resolveTextAlignment();
}
- if (!isPaddingResolved()) {
- resolvePadding();
- }
+ // Should resolve Drawables before Padding because we need the layout direction of the
+ // Drawable to correctly resolve Padding.
if (!isDrawablesResolved()) {
resolveDrawables();
}
+ if (!isPaddingResolved()) {
+ resolvePadding();
+ }
onRtlPropertiesChanged(getLayoutDirection());
return true;
}
@@ -12341,6 +12347,16 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
// If start / end padding are defined, they will be resolved (hence overriding) to
// left / right or right / left depending on the resolved layout direction.
// If start / end padding are not defined, use the left / right ones.
+ if (mBackground != null && mUseBackgroundPadding) {
+ Rect padding = sThreadLocal.get();
+ if (padding == null) {
+ padding = new Rect();
+ sThreadLocal.set(padding);
+ }
+ mBackground.getPadding(padding);
+ mUserPaddingLeftInitial = padding.left;
+ mUserPaddingRightInitial = padding.right;
+ }
switch (resolvedLayoutDirection) {
case LAYOUT_DIRECTION_RTL:
if (mUserPaddingStart != UNDEFINED_PADDING) {
@@ -15336,6 +15352,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
mUserPaddingRightInitial = padding.right;
internalSetPadding(padding.left, padding.top, padding.right, padding.bottom);
}
+ mUseBackgroundPadding = true;
+ } else {
+ mUseBackgroundPadding = false;
}
// Compare the minimum sizes of the old Drawable and the new. If there isn't an old or
@@ -15361,6 +15380,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
/* Remove the background */
mBackground = null;
+ mUseBackgroundPadding = false;
+
if ((mPrivateFlags & PFLAG_ONLY_DRAWS_BACKGROUND) != 0) {
/*
* This view ONLY drew the background before and we're removing
@@ -15432,6 +15453,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
mUserPaddingLeftInitial = left;
mUserPaddingRightInitial = right;
+ mUseBackgroundPadding = false;
+
internalSetPadding(left, top, right, bottom);
}
@@ -15518,6 +15541,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
mUserPaddingStart = start;
mUserPaddingEnd = end;
+ mUseBackgroundPadding = false;
+
switch(getLayoutDirection()) {
case LAYOUT_DIRECTION_RTL:
mUserPaddingLeftInitial = end;
diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java
index e0a154c..a99aa33 100644
--- a/core/java/com/android/internal/os/BatteryStatsImpl.java
+++ b/core/java/com/android/internal/os/BatteryStatsImpl.java
@@ -2172,6 +2172,9 @@ public final class BatteryStatsImpl extends BatteryStats {
case TelephonyManager.NETWORK_TYPE_EHRPD:
bin = DATA_CONNECTION_EHRPD;
break;
+ case TelephonyManager.NETWORK_TYPE_HSPAP:
+ bin = DATA_CONNECTION_HSPAP;
+ break;
default:
bin = DATA_CONNECTION_OTHER;
break;