summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/java/android/app/Fragment.java14
-rw-r--r--core/java/android/app/FragmentManager.java172
-rw-r--r--core/java/android/hardware/UsbManager.java11
-rw-r--r--core/java/android/net/http/RequestHandle.java2
-rw-r--r--core/java/android/widget/AbsListView.java36
-rw-r--r--core/java/android/widget/CalendarView.java150
-rw-r--r--core/java/android/widget/DatePicker.java11
-rw-r--r--core/java/android/widget/NumberPicker.java6
-rw-r--r--core/java/android/widget/TimePicker.java11
-rw-r--r--core/jni/Android.mk4
-rw-r--r--core/jni/AndroidRuntime.cpp3
-rw-r--r--core/jni/android_hardware_UsbManager.cpp61
-rw-r--r--core/res/res/values/config.xml3
-rw-r--r--graphics/java/android/renderscript/Matrix2f.java2
-rw-r--r--graphics/java/android/renderscript/Matrix3f.java2
-rw-r--r--graphics/java/android/renderscript/Matrix4f.java2
-rw-r--r--media/jni/Android.mk16
-rw-r--r--media/mtp/Android.mk4
-rw-r--r--services/jni/Android.mk23
19 files changed, 373 insertions, 160 deletions
diff --git a/core/java/android/app/Fragment.java b/core/java/android/app/Fragment.java
index f06f2cf..a920814 100644
--- a/core/java/android/app/Fragment.java
+++ b/core/java/android/app/Fragment.java
@@ -323,6 +323,15 @@ public class Fragment implements ComponentCallbacks, OnCreateContextMenuListener
int mState = INITIALIZING;
+ // Non-null if the fragment's view hierarchy is currently animating away,
+ // meaning we need to wait a bit on completely destroying it. This is the
+ // animation that is running.
+ Animator mAnimatingAway;
+
+ // If mAnimatingAway != null, this is the state we should move to once the
+ // animation is done.
+ int mStateAfterAnimating;
+
// When instantiated from saved state, this is the saved state.
Bundle mSavedFragmentState;
SparseArray<Parcelable> mSavedViewState;
@@ -1240,6 +1249,11 @@ public class Fragment implements ComponentCallbacks, OnCreateContextMenuListener
if (mView != null) {
writer.print(prefix); writer.print("mView="); writer.println(mView);
}
+ if (mAnimatingAway != null) {
+ writer.print(prefix); writer.print("mAnimatingAway="); writer.println(mAnimatingAway);
+ writer.print(prefix); writer.print("mStateAfterAnimating=");
+ writer.println(mStateAfterAnimating);
+ }
if (mLoaderManager != null) {
writer.print(prefix); writer.println("Loader Manager:");
mLoaderManager.dump(prefix + " ", fd, writer, args);
diff --git a/core/java/android/app/FragmentManager.java b/core/java/android/app/FragmentManager.java
index fe2ebed..3c98d67 100644
--- a/core/java/android/app/FragmentManager.java
+++ b/core/java/android/app/FragmentManager.java
@@ -38,6 +38,7 @@ import android.view.ViewGroup;
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.ArrayList;
+import java.util.Arrays;
/**
* Interface for interacting with {@link Fragment} objects inside of an
@@ -331,6 +332,7 @@ final class FragmentManagerImpl extends FragmentManager {
boolean mNeedMenuInvalidate;
boolean mStateSaved;
+ boolean mDestroyed;
String mNoTransactionsBecause;
// Temporary vars for state save and restore.
@@ -473,23 +475,23 @@ final class FragmentManagerImpl extends FragmentManager {
@Override
public void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) {
- if (mActive == null || mActive.size() <= 0) {
- return;
- }
-
- writer.print(prefix); writer.print("Active Fragments in ");
- writer.print(Integer.toHexString(System.identityHashCode(this)));
- writer.println(":");
-
String innerPrefix = prefix + " ";
- int N = mActive.size();
- for (int i=0; i<N; i++) {
- Fragment f = mActive.get(i);
- if (f != null) {
- writer.print(prefix); writer.print(" #"); writer.print(i);
- writer.print(": "); writer.println(f.toString());
- f.dump(innerPrefix, fd, writer, args);
+ int N;
+ if (mActive != null) {
+ N = mActive.size();
+ if (N > 0) {
+ writer.print(prefix); writer.print("Active Fragments in ");
+ writer.print(Integer.toHexString(System.identityHashCode(this)));
+ writer.println(":");
+ for (int i=0; i<N; i++) {
+ Fragment f = mActive.get(i);
+ writer.print(prefix); writer.print(" #"); writer.print(i);
+ writer.print(": "); writer.println(f);
+ if (f != null) {
+ f.dump(innerPrefix, fd, writer, args);
+ }
+ }
}
}
@@ -505,6 +507,18 @@ final class FragmentManagerImpl extends FragmentManager {
}
}
+ if (mCreatedMenus != null) {
+ N = mCreatedMenus.size();
+ if (N > 0) {
+ writer.print(prefix); writer.println("Fragments Created Menus:");
+ for (int i=0; i<N; i++) {
+ Fragment f = mCreatedMenus.get(i);
+ writer.print(prefix); writer.print(" #"); writer.print(i);
+ writer.print(": "); writer.println(f.toString());
+ }
+ }
+ }
+
if (mBackStack != null) {
N = mBackStack.size();
if (N > 0) {
@@ -517,6 +531,54 @@ final class FragmentManagerImpl extends FragmentManager {
}
}
}
+
+ synchronized (this) {
+ if (mBackStackIndices != null) {
+ N = mBackStackIndices.size();
+ if (N > 0) {
+ writer.print(prefix); writer.println("Back Stack Indices:");
+ for (int i=0; i<N; i++) {
+ BackStackRecord bs = mBackStackIndices.get(i);
+ writer.print(prefix); writer.print(" #"); writer.print(i);
+ writer.print(": "); writer.println(bs);
+ }
+ }
+ }
+
+ if (mAvailBackStackIndices != null && mAvailBackStackIndices.size() > 0) {
+ writer.print(prefix); writer.print("mAvailBackStackIndices: ");
+ writer.println(Arrays.toString(mAvailBackStackIndices.toArray()));
+ }
+ }
+
+ if (mPendingActions != null) {
+ N = mPendingActions.size();
+ if (N > 0) {
+ writer.print(prefix); writer.println("Pending Actions:");
+ for (int i=0; i<N; i++) {
+ Runnable r = mPendingActions.get(i);
+ writer.print(prefix); writer.print(" #"); writer.print(i);
+ writer.print(": "); writer.println(r);
+ }
+ }
+ }
+
+ writer.print(prefix); writer.println("FragmentManager misc state:");
+ writer.print(prefix); writer.print(" mCurState="); writer.print(mCurState);
+ writer.print(" mStateSaved="); writer.print(mStateSaved);
+ writer.print(" mDestroyed="); writer.println(mDestroyed);
+ if (mNeedMenuInvalidate) {
+ writer.print(prefix); writer.print(" mNeedMenuInvalidate=");
+ writer.println(mNeedMenuInvalidate);
+ }
+ if (mNoTransactionsBecause != null) {
+ writer.print(prefix); writer.print(" mNoTransactionsBecause=");
+ writer.println(mNoTransactionsBecause);
+ }
+ if (mAvailIndices != null && mAvailIndices.size() > 0) {
+ writer.print(prefix); writer.print(" mAvailIndices: ");
+ writer.println(Arrays.toString(mAvailIndices.toArray()));
+ }
}
Animator loadAnimator(Fragment fragment, int transit, boolean enter,
@@ -569,6 +631,14 @@ final class FragmentManagerImpl extends FragmentManager {
}
if (f.mState < newState) {
+ if (f.mAnimatingAway != null) {
+ // The fragment is currently being animated... but! Now we
+ // want to move our state back up. Give up on waiting for the
+ // animation, move to whatever the final state should be once
+ // the animation is done, and then we can proceed from there.
+ f.mAnimatingAway = null;
+ moveToState(f, f.mStateAfterAnimating, 0, 0);
+ }
switch (f.mState) {
case Fragment.INITIALIZING:
if (DEBUG) Log.v(TAG, "moveto CREATED: " + f);
@@ -716,18 +786,26 @@ final class FragmentManagerImpl extends FragmentManager {
}
if (f.mView != null && f.mContainer != null) {
Animator anim = null;
- if (mCurState > Fragment.INITIALIZING) {
+ if (mCurState > Fragment.INITIALIZING && !mDestroyed) {
anim = loadAnimator(f, transit, false,
transitionStyle);
}
if (anim != null) {
final ViewGroup container = f.mContainer;
final View view = f.mView;
+ final Fragment fragment = f;
container.startViewTransition(view);
+ f.mAnimatingAway = anim;
+ f.mStateAfterAnimating = newState;
anim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator anim) {
container.endViewTransition(view);
+ if (fragment.mAnimatingAway != null) {
+ fragment.mAnimatingAway = null;
+ moveToState(fragment, fragment.mStateAfterAnimating,
+ 0, 0);
+ }
}
});
anim.setTarget(f.mView);
@@ -741,25 +819,46 @@ final class FragmentManagerImpl extends FragmentManager {
}
case Fragment.CREATED:
if (newState < Fragment.CREATED) {
- if (DEBUG) Log.v(TAG, "movefrom CREATED: " + f);
- if (!f.mRetaining) {
+ if (mDestroyed) {
+ if (f.mAnimatingAway != null) {
+ // The fragment's containing activity is
+ // being destroyed, but this fragment is
+ // currently animating away. Stop the
+ // animation right now -- it is not needed,
+ // and we can't wait any more on destroying
+ // the fragment.
+ Animator anim = f.mAnimatingAway;
+ f.mAnimatingAway = null;
+ anim.cancel();
+ }
+ }
+ if (f.mAnimatingAway != null) {
+ // We are waiting for the fragment's view to finish
+ // animating away. Just make a note of the state
+ // the fragment now should move to once the animation
+ // is done.
+ f.mStateAfterAnimating = newState;
+ } else {
+ if (DEBUG) Log.v(TAG, "movefrom CREATED: " + f);
+ if (!f.mRetaining) {
+ f.mCalled = false;
+ f.onDestroy();
+ if (!f.mCalled) {
+ throw new SuperNotCalledException("Fragment " + f
+ + " did not call through to super.onDestroy()");
+ }
+ }
+
f.mCalled = false;
- f.onDestroy();
+ f.onDetach();
if (!f.mCalled) {
throw new SuperNotCalledException("Fragment " + f
- + " did not call through to super.onDestroy()");
+ + " did not call through to super.onDetach()");
}
+ f.mImmediateActivity = null;
+ f.mActivity = null;
+ f.mFragmentManager = null;
}
-
- f.mCalled = false;
- f.onDetach();
- if (!f.mCalled) {
- throw new SuperNotCalledException("Fragment " + f
- + " did not call through to super.onDetach()");
- }
- f.mImmediateActivity = null;
- f.mActivity = null;
- f.mFragmentManager = null;
}
}
}
@@ -873,9 +972,19 @@ final class FragmentManagerImpl extends FragmentManager {
transitionStyle);
if (anim != null) {
anim.setTarget(fragment.mView);
+ // Delay the actual hide operation until the animation finishes, otherwise
+ // the fragment will just immediately disappear
+ final Fragment finalFragment = fragment;
+ anim.addListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ finalFragment.mView.setVisibility(View.GONE);
+ }
+ });
anim.start();
+ } else {
+ fragment.mView.setVisibility(View.GONE);
}
- fragment.mView.setVisibility(View.GONE);
}
if (fragment.mAdded && fragment.mHasMenu) {
mNeedMenuInvalidate = true;
@@ -1442,6 +1551,7 @@ final class FragmentManagerImpl extends FragmentManager {
}
public void dispatchDestroy() {
+ mDestroyed = true;
moveToState(Fragment.INITIALIZING, false);
mActivity = null;
}
diff --git a/core/java/android/hardware/UsbManager.java b/core/java/android/hardware/UsbManager.java
index 1003bf9..6022b12 100644
--- a/core/java/android/hardware/UsbManager.java
+++ b/core/java/android/hardware/UsbManager.java
@@ -105,6 +105,14 @@ public class UsbManager {
*/
public static final String USB_FUNCTION_DISABLED = "disabled";
+ public static final int getDeviceId(String name) {
+ return native_get_device_id(name);
+ }
+
+ public static final String getDeviceName(int id) {
+ return native_get_device_name(id);
+ }
+
private static File getFunctionEnableFile(String function) {
return new File("/sys/class/usb_composite/" + function + "/enable");
}
@@ -130,4 +138,7 @@ public class UsbManager {
return false;
}
}
+
+ private static native int native_get_device_id(String name);
+ private static native String native_get_device_name(int id);
}
diff --git a/core/java/android/net/http/RequestHandle.java b/core/java/android/net/http/RequestHandle.java
index 103fd94..2c48a04 100644
--- a/core/java/android/net/http/RequestHandle.java
+++ b/core/java/android/net/http/RequestHandle.java
@@ -308,7 +308,7 @@ public class RequestHandle {
String A2 = mMethod + ":" + mUrl;
// because we do not preemptively send authorization headers, nc is always 1
- String nc = "000001";
+ String nc = "00000001";
String cnonce = computeCnonce();
String digest = computeDigest(A1, A2, nonce, QOP, nc, cnonce);
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index ab98763..6d3f227 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -512,6 +512,11 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
private AbsListView.PerformClick mPerformClick;
/**
+ * Delayed action for touch mode.
+ */
+ private Runnable mTouchModeReset;
+
+ /**
* This view is in transcript mode -- it shows the bottom of the list when the data
* changes
*/
@@ -2322,6 +2327,27 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
mFlingStrictSpan.finish();
mFlingStrictSpan = null;
}
+
+ if (mFlingRunnable != null) {
+ removeCallbacks(mFlingRunnable);
+ }
+
+ if (mPositionScroller != null) {
+ removeCallbacks(mPositionScroller);
+ }
+
+ if (mClearScrollingCache != null) {
+ removeCallbacks(mClearScrollingCache);
+ }
+
+ if (mPerformClick != null) {
+ removeCallbacks(mPerformClick);
+ }
+
+ if (mTouchModeReset != null) {
+ removeCallbacks(mTouchModeReset);
+ mTouchModeReset = null;
+ }
}
@Override
@@ -3020,7 +3046,11 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
((TransitionDrawable) d).resetTransition();
}
}
- postDelayed(new Runnable() {
+ if (mTouchModeReset != null) {
+ removeCallbacks(mTouchModeReset);
+ }
+ mTouchModeReset = new Runnable() {
+ @Override
public void run() {
mTouchMode = TOUCH_MODE_REST;
child.setPressed(false);
@@ -3029,7 +3059,9 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
post(performClick);
}
}
- }, ViewConfiguration.getPressedStateDuration());
+ };
+ postDelayed(mTouchModeReset,
+ ViewConfiguration.getPressedStateDuration());
} else {
mTouchMode = TOUCH_MODE_REST;
updateSelectorState();
diff --git a/core/java/android/widget/CalendarView.java b/core/java/android/widget/CalendarView.java
index 31599f9..7ef61a8 100644
--- a/core/java/android/widget/CalendarView.java
+++ b/core/java/android/widget/CalendarView.java
@@ -32,7 +32,6 @@ import android.graphics.drawable.Drawable;
import android.text.TextUtils;
import android.text.format.DateFormat;
import android.text.format.DateUtils;
-import android.text.format.Time;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.Log;
@@ -44,11 +43,9 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView.OnScrollListener;
-import java.security.InvalidParameterException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
-import java.util.HashMap;
import java.util.Locale;
import java.util.TimeZone;
@@ -63,6 +60,15 @@ import libcore.icu.LocaleData;
* @attr ref android.R.styleable#CalendarView_firstDayOfWeek
* @attr ref android.R.styleable#CalendarView_minDate
* @attr ref android.R.styleable#CalendarView_maxDate
+ * @attr ref android.R.styleable#CalendarView_shownWeekCount
+ * @attr ref android.R.styleable#CalendarView_selectedWeekBackgroundColor
+ * @attr ref android.R.styleable#CalendarView_focusedMonthDateColor
+ * @attr ref android.R.styleable#CalendarView_unfocusedMonthDateColor
+ * @attr ref android.R.styleable#CalendarView_weekNumberColor
+ * @attr ref android.R.styleable#CalendarView_weekSeparatorLineColor
+ * @attr ref android.R.styleable#CalendarView_selectedDateVerticalBar
+ * @attr ref android.R.styleable#CalendarView_weekDayTextAppearance
+ * @attr ref android.R.styleable#CalendarView_dateTextAppearance
*/
@Widget
public class CalendarView extends FrameLayout {
@@ -397,6 +403,16 @@ public class CalendarView extends FrameLayout {
invalidate();
}
+ @Override
+ public void setEnabled(boolean enabled) {
+ mListView.setEnabled(enabled);
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return mListView.isEnabled();
+ }
+
/**
* Gets the minimal date supported by this {@link CalendarView} in milliseconds
* since January 1, 1970 00:00:00 in {@link TimeZone#getDefault()} time
@@ -571,8 +587,8 @@ public class CalendarView extends FrameLayout {
* minimal or after the maximal date.
*
* @see #setDate(long, boolean, boolean)
- * @see #setMinDate(Calendar)
- * @see #setMaxDate(Calendar)
+ * @see #setMinDate(long)
+ * @see #setMaxDate(long)
*/
public void setDate(long date) {
setDate(date, false, false);
@@ -589,8 +605,8 @@ public class CalendarView extends FrameLayout {
* @throws IllegalArgumentException of the provided date is before the
* minimal or after the maximal date.
*
- * @see #setMinDate(Calendar)
- * @see #setMaxDate(Calendar)
+ * @see #setMinDate(long)
+ * @see #setMaxDate(long)
*/
public void setDate(long date, boolean animate, boolean center) {
mTempDate.setTimeInMillis(date);
@@ -995,61 +1011,26 @@ public class CalendarView extends FrameLayout {
return position;
}
- @SuppressWarnings("unchecked")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
- WeekView v;
- HashMap<String, Object> drawingParams = null;
+ WeekView weekView = null;
if (convertView != null) {
- v = (WeekView) convertView;
- // We store the drawing parameters in the view so it can be
- // recycled
- drawingParams = (HashMap<String, Object>) v.getTag();
+ weekView = (WeekView) convertView;
} else {
- v = getNewView();
- // Set up the new view
+ weekView = new WeekView(mContext);
android.widget.AbsListView.LayoutParams params =
- new android.widget.AbsListView.LayoutParams(
- LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
- v.setLayoutParams(params);
- v.setClickable(true);
- v.setOnTouchListener(this);
-
- drawingParams = new HashMap<String, Object>();
+ new android.widget.AbsListView.LayoutParams(LayoutParams.WRAP_CONTENT,
+ LayoutParams.WRAP_CONTENT);
+ weekView.setLayoutParams(params);
+ weekView.setClickable(true);
+ weekView.setOnTouchListener(this);
}
- // pass in all the view parameters
- putDrawingParementer(drawingParams, WeekView.VIEW_PARAMS_WEEK, position);
- putDrawingParementer(drawingParams, WeekView.VIEW_PARAMS_FOCUS_MONTH, mFocusedMonth);
- putDrawingParementer(drawingParams, WeekView.VIEW_PARAMS_SELECTED_DAY,
- (mSelectedWeek == position) ? mSelectedDate.get(Calendar.DAY_OF_WEEK) : -1);
- v.setWeekParams(drawingParams);
-
- return v;
- }
+ int selectedWeekDay = (mSelectedWeek == position) ? mSelectedDate.get(
+ Calendar.DAY_OF_WEEK) : -1;
+ weekView.init(position, selectedWeekDay, mFocusedMonth);
- /**
- * Puts the given <code>value</code> for the drawing
- * <code>parameter</code> in the <code>drawingParams</code>.
- */
- private void putDrawingParementer(HashMap<String, Object> drawingParams, String parameter,
- int value) {
- int[] valueArray = (int[]) drawingParams.get(parameter);
- if (valueArray == null) {
- valueArray = new int[1];
- drawingParams.put(parameter, valueArray);
- }
- valueArray[0] = value;
- }
-
- /**
- * Creates a new WeekView and returns it.
- * view creation.
- *
- * @return A new WeekView
- */
- private WeekView getNewView() {
- return new WeekView(mContext);
+ return weekView;
}
/**
@@ -1067,7 +1048,7 @@ public class CalendarView extends FrameLayout {
@Override
public boolean onTouch(View v, MotionEvent event) {
- if (mGestureDetector.onTouchEvent(event)) {
+ if (mListView.isEnabled() && mGestureDetector.onTouchEvent(event)) {
WeekView weekView = (WeekView) v;
weekView.getDayFromLocation(event.getX(), mTempDate);
// it is possible that the touched day is outside the valid range
@@ -1113,24 +1094,6 @@ public class CalendarView extends FrameLayout {
*/
private class WeekView extends View {
- /**
- * This specifies the position (or weeks since the epoch) of this week.
- */
- public static final String VIEW_PARAMS_WEEK = "week";
-
- /**
- * This sets one of the days in this view as selected
- * {@link Time#SUNDAY} through {@link Time#SATURDAY}.
- */
- public static final String VIEW_PARAMS_SELECTED_DAY = "selected_day";
-
- /**
- * Which month is currently in focus, as defined by {@link Time#month}
- * [0-11].
- */
- public static final String VIEW_PARAMS_FOCUS_MONTH = "focus_month";
-
-
private final Rect mTempRect = new Rect();
private final Paint mDrawPaint = new Paint();
@@ -1166,7 +1129,7 @@ public class CalendarView extends FrameLayout {
private boolean mHasSelectedDay = false;
// Which day is selected [0-6] or -1 if no day is selected
- private int mSelectedDate = -1;
+ private int mSelectedDay = -1;
// The number of days + a spot for week number if it is displayed
private int mNumCells;
@@ -1188,28 +1151,21 @@ public class CalendarView extends FrameLayout {
}
/**
- * Sets all the parameters for displaying this week. The only required
- * parameter is the week number. Other parameters have a default value
- * and will only update if a new value is included, except for focus
- * month, which will always default to no focus month if no value is
- * passed in. See {@link #VIEW_PARAMS_HEIGHT} for more info on
- * parameters.
+ * Initializes this week view.
*
- * @param params A map of the new parameters, see
- * {@link #VIEW_PARAMS_HEIGHT}
+ * @param weekNumber The number of the week this view represents. The
+ * week number is a zero based index of the weeks since
+ * {@link CalendarView#getMinDate()}.
+ * @param selectedWeekDay The selected day of the week from 0 to 6, -1 if no
+ * selected day.
+ * @param focusedMonth The month that is currently in focus i.e.
+ * highlighted.
*/
- public void setWeekParams(HashMap<String, Object> params) {
- if (!params.containsKey(VIEW_PARAMS_WEEK)) {
- throw new InvalidParameterException(
- "You must specify the week number for this view");
- }
- setTag(params);
- if (params.containsKey(VIEW_PARAMS_SELECTED_DAY)) {
- mSelectedDate = ((int[]) params.get(VIEW_PARAMS_SELECTED_DAY))[0];
- }
- mHasSelectedDay = mSelectedDate != -1;
+ public void init(int weekNumber, int selectedWeekDay, int focusedMonth) {
+ mSelectedDay = selectedWeekDay;
+ mHasSelectedDay = mSelectedDay != -1;
mNumCells = mShowWeekNumber ? mDaysPerWeek + 1 : mDaysPerWeek;
- mWeek = ((int[]) params.get(VIEW_PARAMS_WEEK))[0];
+ mWeek = weekNumber;
mTempDate.setTimeInMillis(mMinDate.getTimeInMillis());
mTempDate.add(Calendar.WEEK_OF_YEAR, mWeek);
mTempDate.setFirstDayOfWeek(mFirstDayOfWeek);
@@ -1230,14 +1186,10 @@ public class CalendarView extends FrameLayout {
mTempDate.add(Calendar.DAY_OF_MONTH, diff);
mFirstDay = (Calendar) mTempDate.clone();
-
mMonthOfFirstWeekDay = mTempDate.get(Calendar.MONTH);
- int focusMonth = params.containsKey(VIEW_PARAMS_FOCUS_MONTH) ? ((int[]) params
- .get(VIEW_PARAMS_FOCUS_MONTH))[0] : -1;
-
for (; i < mNumCells; i++) {
- mFocusDay[i] = (mTempDate.get(Calendar.MONTH) == focusMonth);
+ mFocusDay[i] = (mTempDate.get(Calendar.MONTH) == focusedMonth);
// do not draw dates outside the valid range to avoid user confusion
if (mTempDate.before(mMinDate) || mTempDate.after(mMaxDate)) {
mDayNumbers[i] = "";
@@ -1426,7 +1378,7 @@ public class CalendarView extends FrameLayout {
*/
private void updateSelectionPositions() {
if (mHasSelectedDay) {
- int selectedPosition = mSelectedDate - mFirstDayOfWeek;
+ int selectedPosition = mSelectedDay - mFirstDayOfWeek;
if (selectedPosition < 0) {
selectedPosition += 7;
}
diff --git a/core/java/android/widget/DatePicker.java b/core/java/android/widget/DatePicker.java
index 21d6266..493b881 100644
--- a/core/java/android/widget/DatePicker.java
+++ b/core/java/android/widget/DatePicker.java
@@ -103,6 +103,8 @@ public class DatePicker extends FrameLayout {
private final Calendar mCurrentDate = Calendar.getInstance();
+ private boolean mIsEnabled;
+
/**
* The callback used to indicate the user changes\d the date.
*/
@@ -295,11 +297,20 @@ public class DatePicker extends FrameLayout {
@Override
public void setEnabled(boolean enabled) {
+ if (mIsEnabled == enabled) {
+ return;
+ }
super.setEnabled(enabled);
mDaySpinner.setEnabled(enabled);
mMonthSpinner.setEnabled(enabled);
mYearSpinner.setEnabled(enabled);
mCalendarView.setEnabled(enabled);
+ mIsEnabled = enabled;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return mIsEnabled;
}
/**
diff --git a/core/java/android/widget/NumberPicker.java b/core/java/android/widget/NumberPicker.java
index 7fe4c2c..7ad0390 100644
--- a/core/java/android/widget/NumberPicker.java
+++ b/core/java/android/widget/NumberPicker.java
@@ -563,6 +563,9 @@ public class NumberPicker extends LinearLayout {
@Override
public boolean onInterceptTouchEvent(MotionEvent event) {
+ if (!isEnabled()) {
+ return false;
+ }
switch (event.getActionMasked()) {
case MotionEvent.ACTION_DOWN:
mLastMotionEventY = mLastDownEventY = event.getY();
@@ -606,6 +609,9 @@ public class NumberPicker extends LinearLayout {
@Override
public boolean onTouchEvent(MotionEvent ev) {
+ if (!isEnabled()) {
+ return false;
+ }
if (mVelocityTracker == null) {
mVelocityTracker = VelocityTracker.obtain();
}
diff --git a/core/java/android/widget/TimePicker.java b/core/java/android/widget/TimePicker.java
index a3da62f..107ea07 100644
--- a/core/java/android/widget/TimePicker.java
+++ b/core/java/android/widget/TimePicker.java
@@ -75,6 +75,8 @@ public class TimePicker extends FrameLayout {
private final String[] mAmPmStrings;
+ private boolean mIsEnabled;
+
// callbacks
private OnTimeChangedListener mOnTimeChangedListener;
@@ -188,10 +190,19 @@ public class TimePicker extends FrameLayout {
@Override
public void setEnabled(boolean enabled) {
+ if (mIsEnabled == enabled) {
+ return;
+ }
super.setEnabled(enabled);
mMinuteSpinner.setEnabled(enabled);
mHourSpinner.setEnabled(enabled);
mAmPmSpinner.setEnabled(enabled);
+ mIsEnabled = enabled;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return mIsEnabled;
}
/**
diff --git a/core/jni/Android.mk b/core/jni/Android.mk
index 8eeed3d..e9566ad 100644
--- a/core/jni/Android.mk
+++ b/core/jni/Android.mk
@@ -123,6 +123,7 @@ LOCAL_SRC_FILES:= \
android_media_ToneGenerator.cpp \
android_hardware_Camera.cpp \
android_hardware_SensorManager.cpp \
+ android_hardware_UsbManager.cpp \
android_debug_JNITest.cpp \
android_util_FileObserver.cpp \
android/opengl/poly_clip.cpp.arm \
@@ -200,7 +201,8 @@ LOCAL_SHARED_LIBRARIES := \
libmedia \
libwpa_client \
libjpeg \
- libnfc_ndef
+ libnfc_ndef \
+ libusbhost
ifeq ($(USE_OPENGL_RENDERER),true)
LOCAL_SHARED_LIBRARIES += libhwui
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp
index 2dfebe5..961bc1f1 100644
--- a/core/jni/AndroidRuntime.cpp
+++ b/core/jni/AndroidRuntime.cpp
@@ -77,8 +77,8 @@ extern int register_android_opengl_jni_GLES11Ext(JNIEnv* env);
extern int register_android_opengl_jni_GLES20(JNIEnv* env);
extern int register_android_hardware_Camera(JNIEnv *env);
-
extern int register_android_hardware_SensorManager(JNIEnv *env);
+extern int register_android_hardware_UsbManager(JNIEnv *env);
extern int register_android_media_AudioRecord(JNIEnv *env);
extern int register_android_media_AudioSystem(JNIEnv *env);
@@ -1266,6 +1266,7 @@ static const RegJNIRec gRegJNI[] = {
REG_JNI(register_com_android_internal_os_ZygoteInit),
REG_JNI(register_android_hardware_Camera),
REG_JNI(register_android_hardware_SensorManager),
+ REG_JNI(register_android_hardware_UsbManager),
REG_JNI(register_android_media_AudioRecord),
REG_JNI(register_android_media_AudioSystem),
REG_JNI(register_android_media_AudioTrack),
diff --git a/core/jni/android_hardware_UsbManager.cpp b/core/jni/android_hardware_UsbManager.cpp
new file mode 100644
index 0000000..8f32abf
--- /dev/null
+++ b/core/jni/android_hardware_UsbManager.cpp
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2010 The Android Open Source 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.
+ */
+
+#include "jni.h"
+#include "JNIHelp.h"
+#include "android_runtime/AndroidRuntime.h"
+
+#include <usbhost/usbhost.h>
+
+#include <stdio.h>
+
+using namespace android;
+
+static jint android_hardware_UsbManager_get_device_id(JNIEnv *env, jobject clazz, jstring name)
+{
+ const char *nameStr = env->GetStringUTFChars(name, NULL);
+ int id = usb_device_get_unique_id_from_name(nameStr);
+ env->ReleaseStringUTFChars(name, nameStr);
+ return id;
+}
+
+static jstring android_hardware_UsbManager_get_device_name(JNIEnv *env, jobject clazz, jint id)
+{
+ char* name = usb_device_get_name_from_unique_id(id);
+ jstring result = env->NewStringUTF(name);
+ free(name);
+ return result;
+}
+
+static JNINativeMethod method_table[] = {
+ { "native_get_device_id", "(Ljava/lang/String;)I",
+ (void*)android_hardware_UsbManager_get_device_id },
+ { "native_get_device_name", "(I)Ljava/lang/String;",
+ (void*)android_hardware_UsbManager_get_device_name },
+};
+
+int register_android_hardware_UsbManager(JNIEnv *env)
+{
+ jclass clazz = env->FindClass("android/hardware/UsbManager");
+ if (clazz == NULL) {
+ LOGE("Can't find android/hardware/UsbManager");
+ return -1;
+ }
+
+ return AndroidRuntime::registerNativeMethods(env, "android/hardware/UsbManager",
+ method_table, NELEM(method_table));
+}
+
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 8edea0d..590baf1 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -497,6 +497,9 @@
<!-- Enables SIP on WIFI only -->
<bool name="config_sip_wifi_only">true</bool>
+ <!-- Enables built-in SIP phone capability -->
+ <bool name="config_built_in_sip_phone">false</bool>
+
<!-- Boolean indicating if restoring network selection should be skipped -->
<!-- The restoring is handled by modem if it is true-->
<bool translatable="false" name="skip_restoring_network_selection">false</bool>
diff --git a/graphics/java/android/renderscript/Matrix2f.java b/graphics/java/android/renderscript/Matrix2f.java
index 6ce8379..6aa7d1b 100644
--- a/graphics/java/android/renderscript/Matrix2f.java
+++ b/graphics/java/android/renderscript/Matrix2f.java
@@ -57,7 +57,7 @@ public class Matrix2f {
}
public void load(Matrix2f src) {
- System.arraycopy(mMat, 0, src.getArray(), 0, 4);
+ System.arraycopy(src.getArray(), 0, mMat, 0, mMat.length);
}
public void loadRotate(float rot) {
diff --git a/graphics/java/android/renderscript/Matrix3f.java b/graphics/java/android/renderscript/Matrix3f.java
index b44d8fa..2d227a5 100644
--- a/graphics/java/android/renderscript/Matrix3f.java
+++ b/graphics/java/android/renderscript/Matrix3f.java
@@ -63,7 +63,7 @@ public class Matrix3f {
}
public void load(Matrix3f src) {
- System.arraycopy(mMat, 0, src.getArray(), 0, 9);
+ System.arraycopy(src.getArray(), 0, mMat, 0, mMat.length);
}
public void loadRotate(float rot, float x, float y, float z) {
diff --git a/graphics/java/android/renderscript/Matrix4f.java b/graphics/java/android/renderscript/Matrix4f.java
index 219d93b..144a9a3 100644
--- a/graphics/java/android/renderscript/Matrix4f.java
+++ b/graphics/java/android/renderscript/Matrix4f.java
@@ -71,7 +71,7 @@ public class Matrix4f {
}
public void load(Matrix4f src) {
- System.arraycopy(mMat, 0, src.getArray(), 0, 16);
+ System.arraycopy(src.getArray(), 0, mMat, 0, mMat.length);
}
public void loadRotate(float rot, float x, float y, float z) {
diff --git a/media/jni/Android.mk b/media/jni/Android.mk
index fbdfa67..d3604b0 100644
--- a/media/jni/Android.mk
+++ b/media/jni/Android.mk
@@ -9,10 +9,10 @@ LOCAL_SRC_FILES:= \
android_media_ResampleInputStream.cpp \
android_media_MediaProfiles.cpp \
android_media_AmrInputStream.cpp \
- android_media_MtpDatabase.cpp \
- android_media_MtpServer.cpp \
- android_media_PtpClient.cpp \
- android_media_PtpCursor.cpp \
+ android_media_MtpDatabase.cpp \
+ android_media_MtpServer.cpp \
+ android_media_PtpClient.cpp \
+ android_media_PtpCursor.cpp \
LOCAL_SHARED_LIBRARIES := \
libandroid_runtime \
@@ -26,11 +26,9 @@ LOCAL_SHARED_LIBRARIES := \
libsurfaceflinger_client \
libstagefright \
libcamera_client \
- libsqlite
-
-ifneq ($(TARGET_SIMULATOR),true)
-LOCAL_STATIC_LIBRARIES := libmtp libusbhost
-endif
+ libsqlite \
+ libmtp \
+ libusbhost
LOCAL_C_INCLUDES += \
external/tremor/Tremor \
diff --git a/media/mtp/Android.mk b/media/mtp/Android.mk
index e285847..93e70e4 100644
--- a/media/mtp/Android.mk
+++ b/media/mtp/Android.mk
@@ -43,7 +43,9 @@ LOCAL_MODULE:= libmtp
LOCAL_CFLAGS := -DMTP_DEVICE -DMTP_HOST
-include $(BUILD_STATIC_LIBRARY)
+LOCAL_SHARED_LIBRARIES := libutils libcutils libusbhost libbinder
+
+include $(BUILD_SHARED_LIBRARY)
endif
diff --git a/services/jni/Android.mk b/services/jni/Android.mk
index 89ead82..845869c 100644
--- a/services/jni/Android.mk
+++ b/services/jni/Android.mk
@@ -10,24 +10,23 @@ LOCAL_SRC_FILES:= \
com_android_server_SystemServer.cpp \
com_android_server_UsbService.cpp \
com_android_server_VibratorService.cpp \
- com_android_server_location_GpsLocationProvider.cpp \
+ com_android_server_location_GpsLocationProvider.cpp \
onload.cpp
LOCAL_C_INCLUDES += \
- $(JNI_H_INCLUDE)
+ $(JNI_H_INCLUDE)
LOCAL_SHARED_LIBRARIES := \
libandroid_runtime \
- libcutils \
- libhardware \
- libhardware_legacy \
- libnativehelper \
+ libcutils \
+ libhardware \
+ libhardware_legacy \
+ libnativehelper \
libsystem_server \
- libutils \
- libui \
- libsurfaceflinger_client
-
-LOCAL_STATIC_LIBRARIES := libusbhost
+ libutils \
+ libui \
+ libsurfaceflinger_client \
+ libusbhost
ifeq ($(TARGET_SIMULATOR),true)
ifeq ($(TARGET_OS),linux)
@@ -38,7 +37,7 @@ endif
endif
ifeq ($(WITH_MALLOC_LEAK_CHECK),true)
- LOCAL_CFLAGS += -DMALLOC_LEAK_CHECK
+ LOCAL_CFLAGS += -DMALLOC_LEAK_CHECK
endif
LOCAL_MODULE:= libandroid_servers