Merge "Handle HSPAP."
diff --git a/api/current.txt b/api/current.txt
index 019ea3c..47648a7 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -190,15 +190,15 @@
field public static final int accountPreferences = 16843423; // 0x101029f
field public static final int accountType = 16843407; // 0x101028f
field public static final int action = 16842797; // 0x101002d
- field public static final int actionBarDivider = 16843689; // 0x10103a9
- field public static final int actionBarItemBackground = 16843690; // 0x10103aa
+ field public static final int actionBarDivider = 16843675; // 0x101039b
+ field public static final int actionBarItemBackground = 16843676; // 0x101039c
field public static final int actionBarSize = 16843499; // 0x10102eb
- field public static final int actionBarSplitStyle = 16843670; // 0x1010396
+ field public static final int actionBarSplitStyle = 16843656; // 0x1010388
field public static final int actionBarStyle = 16843470; // 0x10102ce
field public static final int actionBarTabBarStyle = 16843508; // 0x10102f4
field public static final int actionBarTabStyle = 16843507; // 0x10102f3
field public static final int actionBarTabTextStyle = 16843509; // 0x10102f5
- field public static final int actionBarWidgetTheme = 16843685; // 0x10103a5
+ field public static final int actionBarWidgetTheme = 16843671; // 0x1010397
field public static final int actionButtonStyle = 16843480; // 0x10102d8
field public static final int actionDropDownStyle = 16843479; // 0x10102d7
field public static final int actionLayout = 16843515; // 0x10102fb
@@ -211,10 +211,10 @@
field public static final int actionModeCutDrawable = 16843537; // 0x1010311
field public static final int actionModePasteDrawable = 16843539; // 0x1010313
field public static final int actionModeSelectAllDrawable = 16843646; // 0x101037e
- field public static final int actionModeSplitBackground = 16843691; // 0x10103ab
- field public static final int actionModeStyle = 16843682; // 0x10103a2
+ field public static final int actionModeSplitBackground = 16843677; // 0x101039d
+ field public static final int actionModeStyle = 16843668; // 0x1010394
field public static final int actionOverflowButtonStyle = 16843510; // 0x10102f6
- field public static final int actionProviderClass = 16843671; // 0x1010397
+ field public static final int actionProviderClass = 16843657; // 0x1010389
field public static final int actionViewClass = 16843516; // 0x10102fc
field public static final int activatedBackgroundIndicator = 16843517; // 0x10102fd
field public static final int activityCloseEnterAnimation = 16842938; // 0x10100ba
@@ -260,8 +260,8 @@
field public static final int background = 16842964; // 0x10100d4
field public static final int backgroundDimAmount = 16842802; // 0x1010032
field public static final int backgroundDimEnabled = 16843295; // 0x101021f
- field public static final int backgroundSplit = 16843673; // 0x1010399
- field public static final int backgroundStacked = 16843672; // 0x1010398
+ field public static final int backgroundSplit = 16843659; // 0x101038b
+ field public static final int backgroundStacked = 16843658; // 0x101038a
field public static final int backupAgent = 16843391; // 0x101027f
field public static final int baseline = 16843548; // 0x101031c
field public static final int baselineAlignBottom = 16843042; // 0x1010122
@@ -270,7 +270,6 @@
field public static final int borderlessButtonStyle = 16843563; // 0x101032b
field public static final int bottom = 16843184; // 0x10101b0
field public static final int bottomBright = 16842957; // 0x10100cd
- field public static final int bottomChevronDrawable = 16843659; // 0x101038b
field public static final int bottomDark = 16842953; // 0x10100c9
field public static final int bottomLeftRadius = 16843179; // 0x10101ab
field public static final int bottomMedium = 16842958; // 0x10100ce
@@ -318,15 +317,15 @@
field public static final int codes = 16843330; // 0x1010242
field public static final int collapseColumns = 16843083; // 0x101014b
field public static final int color = 16843173; // 0x10101a5
- field public static final int colorActivatedHighlight = 16843678; // 0x101039e
+ field public static final int colorActivatedHighlight = 16843664; // 0x1010390
field public static final int colorBackground = 16842801; // 0x1010031
field public static final int colorBackgroundCacheHint = 16843435; // 0x10102ab
- field public static final int colorFocusedHighlight = 16843677; // 0x101039d
+ field public static final int colorFocusedHighlight = 16843663; // 0x101038f
field public static final int colorForeground = 16842800; // 0x1010030
field public static final int colorForegroundInverse = 16843270; // 0x1010206
- field public static final int colorLongPressedHighlight = 16843676; // 0x101039c
- field public static final int colorMultiSelectHighlight = 16843679; // 0x101039f
- field public static final int colorPressedHighlight = 16843675; // 0x101039b
+ field public static final int colorLongPressedHighlight = 16843662; // 0x101038e
+ field public static final int colorMultiSelectHighlight = 16843665; // 0x1010391
+ field public static final int colorPressedHighlight = 16843661; // 0x101038d
field public static final int columnCount = 16843639; // 0x1010377
field public static final int columnDelay = 16843215; // 0x10101cf
field public static final int columnOrderPreserved = 16843640; // 0x1010378
@@ -370,7 +369,7 @@
field public static final int dialogTitle = 16843250; // 0x10101f2
field public static final int digits = 16843110; // 0x1010166
field public static final int direction = 16843217; // 0x10101d1
- field public static final int directionDescriptions = 16843695; // 0x10103af
+ field public static final int directionDescriptions = 16843681; // 0x10103a1
field public static final int directionPriority = 16843218; // 0x10101d2
field public static final int disableDependentsState = 16843249; // 0x10101f1
field public static final int disabledAlpha = 16842803; // 0x1010033
@@ -384,11 +383,11 @@
field public static final int drawSelectorOnTop = 16843004; // 0x10100fc
field public static final int drawable = 16843161; // 0x1010199
field public static final int drawableBottom = 16843118; // 0x101016e
- field public static final int drawableEnd = 16843681; // 0x10103a1
+ field public static final int drawableEnd = 16843667; // 0x1010393
field public static final int drawableLeft = 16843119; // 0x101016f
field public static final int drawablePadding = 16843121; // 0x1010171
field public static final int drawableRight = 16843120; // 0x1010170
- field public static final int drawableStart = 16843680; // 0x10103a0
+ field public static final int drawableStart = 16843666; // 0x1010392
field public static final int drawableTop = 16843117; // 0x101016d
field public static final int drawingCacheQuality = 16842984; // 0x10100e8
field public static final int dropDownAnchor = 16843363; // 0x1010263
@@ -435,7 +434,7 @@
field public static final int fadeEnabled = 16843390; // 0x101027e
field public static final int fadeOffset = 16843383; // 0x1010277
field public static final int fadeScrollbars = 16843434; // 0x10102aa
- field public static final int fadingEdge = 16842975; // 0x10100df
+ field public static final deprecated int fadingEdge = 16842975; // 0x10100df
field public static final int fadingEdgeLength = 16842976; // 0x10100e0
field public static final int fastScrollAlwaysVisible = 16843573; // 0x1010335
field public static final int fastScrollEnabled = 16843302; // 0x1010226
@@ -445,7 +444,6 @@
field public static final int fastScrollTextColor = 16843609; // 0x1010359
field public static final int fastScrollThumbDrawable = 16843574; // 0x1010336
field public static final int fastScrollTrackDrawable = 16843577; // 0x1010339
- field public static final int feedbackCount = 16843665; // 0x1010391
field public static final int fillAfter = 16843197; // 0x10101bd
field public static final int fillBefore = 16843196; // 0x10101bc
field public static final int fillEnabled = 16843343; // 0x101024f
@@ -498,7 +496,6 @@
field public static final int hand_hour = 16843011; // 0x1010103
field public static final int hand_minute = 16843012; // 0x1010104
field public static final int handle = 16843354; // 0x101025a
- field public static final int handleDrawable = 16843655; // 0x1010387
field public static final int handleProfiling = 16842786; // 0x1010022
field public static final int hapticFeedbackEnabled = 16843358; // 0x101025e
field public static final int hardwareAccelerated = 16843475; // 0x10102d3
@@ -507,12 +504,10 @@
field public static final int headerDividersEnabled = 16843310; // 0x101022e
field public static final int height = 16843093; // 0x1010155
field public static final int hint = 16843088; // 0x1010150
- field public static final int hitRadius = 16843662; // 0x101038e
field public static final int homeAsUpIndicator = 16843531; // 0x101030b
field public static final int homeLayout = 16843549; // 0x101031d
field public static final int horizontalDivider = 16843053; // 0x101012d
field public static final int horizontalGap = 16843327; // 0x101023f
- field public static final int horizontalOffset = 16843667; // 0x1010393
field public static final int horizontalScrollViewStyle = 16843603; // 0x1010353
field public static final int horizontalSpacing = 16843028; // 0x1010114
field public static final int host = 16842792; // 0x1010028
@@ -630,7 +625,6 @@
field public static final int layout_x = 16843135; // 0x101017f
field public static final int layout_y = 16843136; // 0x1010180
field public static final int left = 16843181; // 0x10101ad
- field public static final int leftChevronDrawable = 16843656; // 0x1010388
field public static final int lineSpacingExtra = 16843287; // 0x1010217
field public static final int lineSpacingMultiplier = 16843288; // 0x1010218
field public static final int lines = 16843092; // 0x1010154
@@ -642,8 +636,10 @@
field public static final int listDividerAlertDialog = 16843525; // 0x1010305
field public static final int listPopupWindowStyle = 16843519; // 0x10102ff
field public static final int listPreferredItemHeight = 16842829; // 0x101004d
- field public static final int listPreferredItemHeightLarge = 16843668; // 0x1010394
- field public static final int listPreferredItemHeightSmall = 16843669; // 0x1010395
+ field public static final int listPreferredItemHeightLarge = 16843654; // 0x1010386
+ field public static final int listPreferredItemHeightSmall = 16843655; // 0x1010387
+ field public static final int listPreferredItemPaddingLeft = 16843683; // 0x10103a3
+ field public static final int listPreferredItemPaddingRight = 16843684; // 0x10103a4
field public static final int listSelector = 16843003; // 0x10100fb
field public static final int listSeparatorTextViewStyle = 16843272; // 0x1010208
field public static final int listViewStyle = 16842868; // 0x1010074
@@ -674,8 +670,8 @@
field public static final int minHeight = 16843072; // 0x1010140
field public static final int minLevel = 16843185; // 0x10101b1
field public static final int minLines = 16843094; // 0x1010156
- field public static final int minResizeHeight = 16843684; // 0x10103a4
- field public static final int minResizeWidth = 16843683; // 0x10103a3
+ field public static final int minResizeHeight = 16843670; // 0x1010396
+ field public static final int minResizeWidth = 16843669; // 0x1010395
field public static final int minSdkVersion = 16843276; // 0x101020c
field public static final int minWidth = 16843071; // 0x101013f
field public static final int mode = 16843134; // 0x101017e
@@ -705,11 +701,10 @@
field public static final int orderingFromXml = 16843239; // 0x10101e7
field public static final int orientation = 16842948; // 0x10100c4
field public static final int outAnimation = 16843128; // 0x1010178
- field public static final int outerRadius = 16843661; // 0x101038d
field public static final int overScrollFooter = 16843459; // 0x10102c3
field public static final int overScrollHeader = 16843458; // 0x10102c2
field public static final int overScrollMode = 16843457; // 0x10102c1
- field public static final int overridesImplicitlyEnabledSubtype = 16843696; // 0x10103b0
+ field public static final int overridesImplicitlyEnabledSubtype = 16843682; // 0x10103a2
field public static final int packageNames = 16843649; // 0x1010381
field public static final int padding = 16842965; // 0x10100d5
field public static final int paddingBottom = 16842969; // 0x10100d9
@@ -788,6 +783,7 @@
field public static final int reqNavigation = 16843306; // 0x101022a
field public static final int reqTouchScreen = 16843303; // 0x1010227
field public static final int required = 16843406; // 0x101028e
+ field public static final int requiresFadingEdge = 16843699; // 0x10103b3
field public static final int requiresSmallestWidthDp = 16843620; // 0x1010364
field public static final int resizeMode = 16843619; // 0x1010363
field public static final int resizeable = 16843405; // 0x101028d
@@ -795,7 +791,6 @@
field public static final int restoreAnyVersion = 16843450; // 0x10102ba
field public static final deprecated int restoreNeedsApplication = 16843421; // 0x101029d
field public static final int right = 16843183; // 0x10101af
- field public static final int rightChevronDrawable = 16843657; // 0x1010389
field public static final int ringtonePreferenceStyle = 16842899; // 0x1010093
field public static final int ringtoneType = 16843257; // 0x10101f9
field public static final int rotation = 16843558; // 0x1010326
@@ -871,7 +866,6 @@
field public static final int smallIcon = 16843422; // 0x101029e
field public static final int smallScreens = 16843396; // 0x1010284
field public static final int smoothScrollbar = 16843313; // 0x1010231
- field public static final int snapMargin = 16843664; // 0x1010390
field public static final int soundEffectsEnabled = 16843285; // 0x1010215
field public static final int spacing = 16843027; // 0x1010113
field public static final int spinnerDropDownItemStyle = 16842887; // 0x1010087
@@ -917,8 +911,8 @@
field public static final int stretchMode = 16843030; // 0x1010116
field public static final int subtitle = 16843473; // 0x10102d1
field public static final int subtitleTextStyle = 16843513; // 0x10102f9
- field public static final int subtypeExtraValue = 16843688; // 0x10103a8
- field public static final int subtypeLocale = 16843687; // 0x10103a7
+ field public static final int subtypeExtraValue = 16843674; // 0x101039a
+ field public static final int subtypeLocale = 16843673; // 0x1010399
field public static final int suggestActionMsg = 16843228; // 0x10101dc
field public static final int suggestActionMsgColumn = 16843229; // 0x10101dd
field public static final int summary = 16843241; // 0x10101e9
@@ -940,8 +934,7 @@
field public static final int tag = 16842961; // 0x10100d1
field public static final int targetActivity = 16843266; // 0x1010202
field public static final int targetClass = 16842799; // 0x101002f
- field public static final int targetDescriptions = 16843694; // 0x10103ae
- field public static final int targetDrawables = 16843654; // 0x1010386
+ field public static final int targetDescriptions = 16843680; // 0x10103a0
field public static final int targetPackage = 16842785; // 0x1010021
field public static final int targetSdkVersion = 16843376; // 0x1010270
field public static final int taskAffinity = 16842770; // 0x1010012
@@ -956,15 +949,15 @@
field public static final int tension = 16843370; // 0x101026a
field public static final int testOnly = 16843378; // 0x1010272
field public static final int text = 16843087; // 0x101014f
- field public static final int textAllCaps = 16843674; // 0x101039a
+ field public static final int textAllCaps = 16843660; // 0x101038c
field public static final int textAppearance = 16842804; // 0x1010034
field public static final int textAppearanceButton = 16843271; // 0x1010207
field public static final int textAppearanceInverse = 16842805; // 0x1010035
field public static final int textAppearanceLarge = 16842816; // 0x1010040
field public static final int textAppearanceLargeInverse = 16842819; // 0x1010043
field public static final int textAppearanceLargePopupMenu = 16843521; // 0x1010301
- field public static final int textAppearanceListItem = 16843692; // 0x10103ac
- field public static final int textAppearanceListItemSmall = 16843693; // 0x10103ad
+ field public static final int textAppearanceListItem = 16843678; // 0x101039e
+ field public static final int textAppearanceListItemSmall = 16843679; // 0x101039f
field public static final int textAppearanceMedium = 16842817; // 0x1010041
field public static final int textAppearanceMediumInverse = 16842820; // 0x1010044
field public static final int textAppearanceSearchResultSubtitle = 16843424; // 0x10102a0
@@ -1033,7 +1026,6 @@
field public static final int toYScale = 16843205; // 0x10101c5
field public static final int top = 16843182; // 0x10101ae
field public static final int topBright = 16842955; // 0x10100cb
- field public static final int topChevronDrawable = 16843658; // 0x101038a
field public static final int topDark = 16842951; // 0x10100c7
field public static final int topLeftRadius = 16843177; // 0x10101a9
field public static final int topOffset = 16843352; // 0x1010258
@@ -1046,7 +1038,7 @@
field public static final int translationY = 16843555; // 0x1010323
field public static final int type = 16843169; // 0x10101a1
field public static final int typeface = 16842902; // 0x1010096
- field public static final int uiOptions = 16843686; // 0x10103a6
+ field public static final int uiOptions = 16843672; // 0x1010398
field public static final int uncertainGestureColor = 16843382; // 0x1010276
field public static final int unfocusedMonthDateColor = 16843588; // 0x1010344
field public static final int unselectedAlpha = 16843278; // 0x101020e
@@ -1065,10 +1057,8 @@
field public static final int verticalCorrection = 16843322; // 0x101023a
field public static final int verticalDivider = 16843054; // 0x101012e
field public static final int verticalGap = 16843328; // 0x1010240
- field public static final int verticalOffset = 16843666; // 0x1010392
field public static final int verticalScrollbarPosition = 16843572; // 0x1010334
field public static final int verticalSpacing = 16843029; // 0x1010115
- field public static final int vibrationDuration = 16843663; // 0x101038f
field public static final int visibility = 16842972; // 0x10100dc
field public static final int visible = 16843156; // 0x1010194
field public static final int vmSafeMode = 16843448; // 0x10102b8
@@ -1085,7 +1075,6 @@
field public static final int wallpaperIntraOpenExitAnimation = 16843416; // 0x1010298
field public static final int wallpaperOpenEnterAnimation = 16843411; // 0x1010293
field public static final int wallpaperOpenExitAnimation = 16843412; // 0x1010294
- field public static final int waveDrawable = 16843660; // 0x101038c
field public static final int webTextViewStyle = 16843449; // 0x10102b9
field public static final int webViewStyle = 16842885; // 0x1010085
field public static final int weekDayTextAppearance = 16843592; // 0x1010348
diff --git a/core/java/android/app/ProgressDialog.java b/core/java/android/app/ProgressDialog.java
index f1a04f8..7f1f385 100644
--- a/core/java/android/app/ProgressDialog.java
+++ b/core/java/android/app/ProgressDialog.java
@@ -16,7 +16,10 @@
package android.app;
+import com.android.internal.R;
+
import android.content.Context;
+import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Handler;
@@ -29,8 +32,6 @@
import android.widget.ProgressBar;
import android.widget.TextView;
-import com.android.internal.R;
-
import java.text.NumberFormat;
/**
@@ -119,6 +120,9 @@
@Override
protected void onCreate(Bundle savedInstanceState) {
LayoutInflater inflater = LayoutInflater.from(mContext);
+ TypedArray a = mContext.obtainStyledAttributes(null,
+ com.android.internal.R.styleable.AlertDialog,
+ com.android.internal.R.attr.alertDialogStyle, 0);
if (mProgressStyle == STYLE_HORIZONTAL) {
/* Use a separate handler to update the text views as they
@@ -149,17 +153,22 @@
}
}
};
- View view = inflater.inflate(R.layout.alert_dialog_progress, null);
+ View view = inflater.inflate(a.getResourceId(
+ com.android.internal.R.styleable.AlertDialog_horizontalProgressLayout,
+ R.layout.alert_dialog_progress), null);
mProgress = (ProgressBar) view.findViewById(R.id.progress);
mProgressNumber = (TextView) view.findViewById(R.id.progress_number);
mProgressPercent = (TextView) view.findViewById(R.id.progress_percent);
setView(view);
} else {
- View view = inflater.inflate(R.layout.progress_dialog, null);
+ View view = inflater.inflate(a.getResourceId(
+ com.android.internal.R.styleable.AlertDialog_progressLayout,
+ R.layout.progress_dialog), null);
mProgress = (ProgressBar) view.findViewById(R.id.progress);
mMessageView = (TextView) view.findViewById(R.id.message);
setView(view);
}
+ a.recycle();
if (mMax > 0) {
setMax(mMax);
}
diff --git a/core/java/android/bluetooth/BluetoothHealth.java b/core/java/android/bluetooth/BluetoothHealth.java
index c165d92..9b2b8ca 100644
--- a/core/java/android/bluetooth/BluetoothHealth.java
+++ b/core/java/android/bluetooth/BluetoothHealth.java
@@ -81,6 +81,20 @@
*/
public static final int CHANNEL_TYPE_ANY = 12;
+ /** @hide */
+ public static final int HEALTH_OPERATION_SUCCESS = 6000;
+ /** @hide */
+ public static final int HEALTH_OPERATION_ERROR = 6001;
+ /** @hide */
+ public static final int HEALTH_OPERATION_INVALID_ARGS = 6002;
+ /** @hide */
+ public static final int HEALTH_OPERATION_GENERIC_FAILURE = 6003;
+ /** @hide */
+ public static final int HEALTH_OPERATION_NOT_FOUND = 6004;
+ /** @hide */
+ public static final int HEALTH_OPERATION_NOT_ALLOWED = 6005;
+
+
/**
* Register an application configuration that acts as a Health SINK.
* This is the configuration that will be used to communicate with health devices
diff --git a/core/java/android/server/BluetoothEventLoop.java b/core/java/android/server/BluetoothEventLoop.java
index e4f2d32..56da69d 100644
--- a/core/java/android/server/BluetoothEventLoop.java
+++ b/core/java/android/server/BluetoothEventLoop.java
@@ -20,6 +20,7 @@
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothClass;
import android.bluetooth.BluetoothDevice;
+import android.bluetooth.BluetoothHealth;
import android.bluetooth.BluetoothInputDevice;
import android.bluetooth.BluetoothPan;
import android.bluetooth.BluetoothProfile;
@@ -974,6 +975,22 @@
}
/**
+ * Called by native code for the async response to a Connect
+ * method call to org.bluez.Health
+ *
+ * @param chanCode The internal id of the channel
+ * @param result Result code of the operation.
+ */
+ private void onHealthDeviceConnectionResult(int chanCode, int result) {
+ log ("onHealthDeviceConnectionResult " + chanCode + " " + result);
+ // Success case gets handled by Property Change signal
+ if (result != BluetoothHealth.HEALTH_OPERATION_SUCCESS) {
+ mBluetoothService.onHealthDeviceChannelConnectionError(chanCode,
+ BluetoothHealth.STATE_CHANNEL_DISCONNECTED);
+ }
+ }
+
+ /**
* Called by native code on a DeviceDisconnected signal from
* org.bluez.NetworkServer.
*
diff --git a/core/java/android/server/BluetoothHealthProfileHandler.java b/core/java/android/server/BluetoothHealthProfileHandler.java
index a6ada2b..2d80de4 100644
--- a/core/java/android/server/BluetoothHealthProfileHandler.java
+++ b/core/java/android/server/BluetoothHealthProfileHandler.java
@@ -84,7 +84,6 @@
result = 31 * result + (mChannelPath == null ? 0 : mChannelPath.hashCode());
result = 31 * result + mDevice.hashCode();
result = 31 * result + mConfig.hashCode();
- result = 31 * result + mState;
result = 31 * result + mChannelType;
return result;
}
@@ -152,7 +151,7 @@
String channelType = getStringChannelType(chan.mChannelType);
if (!mBluetoothService.createChannelNative(deviceObjectPath, configPath,
- channelType)) {
+ channelType, chan.hashCode())) {
int prevState = chan.mState;
int state = BluetoothHealth.STATE_CHANNEL_DISCONNECTED;
callHealthChannelCallback(chan.mConfig, chan.mDevice, prevState, state, null,
@@ -258,7 +257,7 @@
boolean disconnectChannel(BluetoothDevice device,
BluetoothHealthAppConfiguration config, int id) {
- HealthChannel chan = findChannelById(device, config, id);
+ HealthChannel chan = findChannelById(id);
if (chan == null) {
return false;
}
@@ -273,7 +272,8 @@
callHealthChannelCallback(config, device, prevState, chan.mState,
null, chan.hashCode());
- if (!mBluetoothService.destroyChannelNative(deviceObjectPath, chan.mChannelPath)) {
+ if (!mBluetoothService.destroyChannelNative(deviceObjectPath, chan.mChannelPath,
+ chan.hashCode())) {
prevState = chan.mState;
chan.mState = BluetoothHealth.STATE_CHANNEL_CONNECTED;
callHealthChannelCallback(config, device, prevState, chan.mState,
@@ -284,8 +284,7 @@
}
}
- private HealthChannel findChannelById(BluetoothDevice device,
- BluetoothHealthAppConfiguration config, int id) {
+ private HealthChannel findChannelById(int id) {
for (HealthChannel chan : mHealthChannels) {
if (chan.hashCode() == id) return chan;
}
@@ -384,6 +383,15 @@
}
}
+ /*package*/ void onHealthDeviceChannelConnectionError(int chanCode,
+ int state) {
+ HealthChannel channel = findChannelById(chanCode);
+ if (channel == null) errorLog("No record of this channel:" + chanCode);
+
+ callHealthChannelCallback(channel.mConfig, channel.mDevice, channel.mState, state, null,
+ chanCode);
+ }
+
private BluetoothHealthAppConfiguration findHealthApplication(
BluetoothDevice device, String channelPath) {
BluetoothHealthAppConfiguration config = null;
@@ -424,9 +432,19 @@
config = findHealthApplication(device, channelPath);
if (exists) {
+ channel = findConnectingChannel(device, config);
+ if (channel == null) {
+ channel = new HealthChannel(device, config, null, false,
+ channelPath);
+ channel.mState = BluetoothHealth.STATE_CHANNEL_DISCONNECTED;
+ mHealthChannels.add(channel);
+ }
+ channel.mChannelPath = channelPath;
+
fd = mBluetoothService.getChannelFdNative(channelPath);
if (fd == null) {
errorLog("Error obtaining fd for channel:" + channelPath);
+ disconnectChannel(device, config, channel.hashCode());
return;
}
boolean mainChannel =
@@ -440,18 +458,10 @@
}
if (mainChannelPath.equals(channelPath)) mainChannel = true;
}
- channel = findConnectingChannel(device, config);
- if (channel != null) {
- channel.mChannelFd = fd;
- channel.mMainChannel = mainChannel;
- channel.mChannelPath = channelPath;
- prevState = channel.mState;
- } else {
- channel = new HealthChannel(device, config, fd, mainChannel,
- channelPath);
- mHealthChannels.add(channel);
- prevState = BluetoothHealth.STATE_CHANNEL_DISCONNECTED;
- }
+
+ channel.mChannelFd = fd;
+ channel.mMainChannel = mainChannel;
+ prevState = channel.mState;
state = BluetoothHealth.STATE_CHANNEL_CONNECTED;
} else {
channel = findChannelByPath(device, channelPath);
diff --git a/core/java/android/server/BluetoothService.java b/core/java/android/server/BluetoothService.java
index 03180ca..00d3331 100755
--- a/core/java/android/server/BluetoothService.java
+++ b/core/java/android/server/BluetoothService.java
@@ -2255,6 +2255,14 @@
}
}
+ /*package*/ void onHealthDeviceChannelConnectionError(int channelCode,
+ int newState) {
+ synchronized(mBluetoothHealthProfileHandler) {
+ mBluetoothHealthProfileHandler.onHealthDeviceChannelConnectionError(channelCode,
+ newState);
+ }
+ }
+
public int getHealthDeviceConnectionState(BluetoothDevice device) {
mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM,
"Need BLUETOOTH permission");
@@ -2785,8 +2793,9 @@
String channelType);
native String registerHealthApplicationNative(int dataType, String role, String name);
native boolean unregisterHealthApplicationNative(String path);
- native boolean createChannelNative(String devicePath, String appPath, String channelType);
- native boolean destroyChannelNative(String devicePath, String channelpath);
+ native boolean createChannelNative(String devicePath, String appPath, String channelType,
+ int code);
+ native boolean destroyChannelNative(String devicePath, String channelpath, int code);
native String getMainChannelNative(String path);
native String getChannelApplicationNative(String channelPath);
native ParcelFileDescriptor getChannelFdNative(String channelPath);
diff --git a/core/java/android/text/style/SuggestionRangeSpan.java b/core/java/android/text/style/SuggestionRangeSpan.java
index a637b1c..2dbfc72 100644
--- a/core/java/android/text/style/SuggestionRangeSpan.java
+++ b/core/java/android/text/style/SuggestionRangeSpan.java
@@ -28,15 +28,11 @@
* @hide
*/
public class SuggestionRangeSpan extends CharacterStyle implements ParcelableSpan {
- private final int mBackgroundColor;
+ private int mBackgroundColor;
- @Override
- public void updateDrawState(TextPaint tp) {
- tp.bgColor = mBackgroundColor;
- }
-
- public SuggestionRangeSpan(int color) {
- mBackgroundColor = color;
+ public SuggestionRangeSpan() {
+ // 0 is a fully transparent black. Has to be set using #setBackgroundColor
+ mBackgroundColor = 0;
}
public SuggestionRangeSpan(Parcel src) {
@@ -57,4 +53,13 @@
public int getSpanTypeId() {
return TextUtils.SUGGESTION_RANGE_SPAN;
}
+
+ public void setBackgroundColor(int backgroundColor) {
+ mBackgroundColor = backgroundColor;
+ }
+
+ @Override
+ public void updateDrawState(TextPaint tp) {
+ tp.bgColor = mBackgroundColor;
+ }
}
diff --git a/core/java/android/text/style/SuggestionSpan.java b/core/java/android/text/style/SuggestionSpan.java
index 693a7a9..51e9d7d 100644
--- a/core/java/android/text/style/SuggestionSpan.java
+++ b/core/java/android/text/style/SuggestionSpan.java
@@ -264,4 +264,16 @@
tp.setUnderlineText(mEasyCorrectUnderlineColor, mEasyCorrectUnderlineThickness);
}
}
+
+ /**
+ * @return The color of the underline for that span, or 0 if there is no underline
+ *
+ * @hide
+ */
+ public int getUnderlineColor() {
+ // The order here should match what is used in updateDrawState
+ if ((mFlags & FLAG_MISSPELLED) != 0) return mMisspelledUnderlineColor;
+ if ((mFlags & FLAG_EASY_CORRECT) != 0) return mEasyCorrectUnderlineColor;
+ return 0;
+ }
}
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 4a9c5bd..637f6466 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -27,6 +27,7 @@
import android.graphics.Interpolator;
import android.graphics.LinearGradient;
import android.graphics.Matrix;
+import android.graphics.Matrix.ScaleToFit;
import android.graphics.Paint;
import android.graphics.PixelFormat;
import android.graphics.Point;
@@ -68,6 +69,8 @@
import android.view.inputmethod.InputMethodManager;
import android.widget.ScrollBarDrawable;
+import static android.os.Build.VERSION_CODES.*;
+
import com.android.internal.R;
import com.android.internal.util.Predicate;
import com.android.internal.view.menu.MenuBuilder;
@@ -584,7 +587,7 @@
* @attr ref android.R.styleable#View_drawingCacheQuality
* @attr ref android.R.styleable#View_duplicateParentState
* @attr ref android.R.styleable#View_id
- * @attr ref android.R.styleable#View_fadingEdge
+ * @attr ref android.R.styleable#View_requiresFadingEdge
* @attr ref android.R.styleable#View_fadingEdgeLength
* @attr ref android.R.styleable#View_filterTouchesWhenObscured
* @attr ref android.R.styleable#View_fitsSystemWindows
@@ -2001,64 +2004,133 @@
@ViewDebug.ExportedProperty
int mViewFlags;
- /**
- * The transform matrix for the View. This transform is calculated internally
- * based on the rotation, scaleX, and scaleY properties. The identity matrix
- * is used by default. Do *not* use this variable directly; instead call
- * getMatrix(), which will automatically recalculate the matrix if necessary
- * to get the correct matrix based on the latest rotation and scale properties.
- */
- private final Matrix mMatrix = new Matrix();
+ static class TransformationInfo {
+ /**
+ * The transform matrix for the View. This transform is calculated internally
+ * based on the rotation, scaleX, and scaleY properties. The identity matrix
+ * is used by default. Do *not* use this variable directly; instead call
+ * getMatrix(), which will automatically recalculate the matrix if necessary
+ * to get the correct matrix based on the latest rotation and scale properties.
+ */
+ private final Matrix mMatrix = new Matrix();
- /**
- * The transform matrix for the View. This transform is calculated internally
- * based on the rotation, scaleX, and scaleY properties. The identity matrix
- * is used by default. Do *not* use this variable directly; instead call
- * getInverseMatrix(), which will automatically recalculate the matrix if necessary
- * to get the correct matrix based on the latest rotation and scale properties.
- */
- private Matrix mInverseMatrix;
+ /**
+ * The transform matrix for the View. This transform is calculated internally
+ * based on the rotation, scaleX, and scaleY properties. The identity matrix
+ * is used by default. Do *not* use this variable directly; instead call
+ * getInverseMatrix(), which will automatically recalculate the matrix if necessary
+ * to get the correct matrix based on the latest rotation and scale properties.
+ */
+ private Matrix mInverseMatrix;
- /**
- * An internal variable that tracks whether we need to recalculate the
- * transform matrix, based on whether the rotation or scaleX/Y properties
- * have changed since the matrix was last calculated.
- */
- boolean mMatrixDirty = false;
+ /**
+ * An internal variable that tracks whether we need to recalculate the
+ * transform matrix, based on whether the rotation or scaleX/Y properties
+ * have changed since the matrix was last calculated.
+ */
+ boolean mMatrixDirty = false;
- /**
- * An internal variable that tracks whether we need to recalculate the
- * transform matrix, based on whether the rotation or scaleX/Y properties
- * have changed since the matrix was last calculated.
- */
- private boolean mInverseMatrixDirty = true;
+ /**
+ * An internal variable that tracks whether we need to recalculate the
+ * transform matrix, based on whether the rotation or scaleX/Y properties
+ * have changed since the matrix was last calculated.
+ */
+ private boolean mInverseMatrixDirty = true;
- /**
- * A variable that tracks whether we need to recalculate the
- * transform matrix, based on whether the rotation or scaleX/Y properties
- * have changed since the matrix was last calculated. This variable
- * is only valid after a call to updateMatrix() or to a function that
- * calls it such as getMatrix(), hasIdentityMatrix() and getInverseMatrix().
- */
- private boolean mMatrixIsIdentity = true;
+ /**
+ * A variable that tracks whether we need to recalculate the
+ * transform matrix, based on whether the rotation or scaleX/Y properties
+ * have changed since the matrix was last calculated. This variable
+ * is only valid after a call to updateMatrix() or to a function that
+ * calls it such as getMatrix(), hasIdentityMatrix() and getInverseMatrix().
+ */
+ private boolean mMatrixIsIdentity = true;
- /**
- * The Camera object is used to compute a 3D matrix when rotationX or rotationY are set.
- */
- private Camera mCamera = null;
+ /**
+ * The Camera object is used to compute a 3D matrix when rotationX or rotationY are set.
+ */
+ private Camera mCamera = null;
- /**
- * This matrix is used when computing the matrix for 3D rotations.
- */
- private Matrix matrix3D = null;
+ /**
+ * This matrix is used when computing the matrix for 3D rotations.
+ */
+ private Matrix matrix3D = null;
- /**
- * These prev values are used to recalculate a centered pivot point when necessary. The
- * pivot point is only used in matrix operations (when rotation, scale, or translation are
- * set), so thes values are only used then as well.
- */
- private int mPrevWidth = -1;
- private int mPrevHeight = -1;
+ /**
+ * These prev values are used to recalculate a centered pivot point when necessary. The
+ * pivot point is only used in matrix operations (when rotation, scale, or translation are
+ * set), so thes values are only used then as well.
+ */
+ private int mPrevWidth = -1;
+ private int mPrevHeight = -1;
+
+ /**
+ * The degrees rotation around the vertical axis through the pivot point.
+ */
+ @ViewDebug.ExportedProperty
+ float mRotationY = 0f;
+
+ /**
+ * The degrees rotation around the horizontal axis through the pivot point.
+ */
+ @ViewDebug.ExportedProperty
+ float mRotationX = 0f;
+
+ /**
+ * The degrees rotation around the pivot point.
+ */
+ @ViewDebug.ExportedProperty
+ float mRotation = 0f;
+
+ /**
+ * The amount of translation of the object away from its left property (post-layout).
+ */
+ @ViewDebug.ExportedProperty
+ float mTranslationX = 0f;
+
+ /**
+ * The amount of translation of the object away from its top property (post-layout).
+ */
+ @ViewDebug.ExportedProperty
+ float mTranslationY = 0f;
+
+ /**
+ * The amount of scale in the x direction around the pivot point. A
+ * value of 1 means no scaling is applied.
+ */
+ @ViewDebug.ExportedProperty
+ float mScaleX = 1f;
+
+ /**
+ * The amount of scale in the y direction around the pivot point. A
+ * value of 1 means no scaling is applied.
+ */
+ @ViewDebug.ExportedProperty
+ float mScaleY = 1f;
+
+ /**
+ * The amount of scale in the x direction around the pivot point. A
+ * value of 1 means no scaling is applied.
+ */
+ @ViewDebug.ExportedProperty
+ float mPivotX = 0f;
+
+ /**
+ * The amount of scale in the y direction around the pivot point. A
+ * value of 1 means no scaling is applied.
+ */
+ @ViewDebug.ExportedProperty
+ float mPivotY = 0f;
+
+ /**
+ * The opacity of the View. This is a value from 0 to 1, where 0 means
+ * completely transparent and 1 means completely opaque.
+ */
+ @ViewDebug.ExportedProperty
+ float mAlpha = 1f;
+ }
+
+ TransformationInfo mTransformationInfo;
private boolean mLastIsOpaque;
@@ -2069,71 +2141,6 @@
private static final float NONZERO_EPSILON = .001f;
/**
- * The degrees rotation around the vertical axis through the pivot point.
- */
- @ViewDebug.ExportedProperty
- float mRotationY = 0f;
-
- /**
- * The degrees rotation around the horizontal axis through the pivot point.
- */
- @ViewDebug.ExportedProperty
- float mRotationX = 0f;
-
- /**
- * The degrees rotation around the pivot point.
- */
- @ViewDebug.ExportedProperty
- float mRotation = 0f;
-
- /**
- * The amount of translation of the object away from its left property (post-layout).
- */
- @ViewDebug.ExportedProperty
- float mTranslationX = 0f;
-
- /**
- * The amount of translation of the object away from its top property (post-layout).
- */
- @ViewDebug.ExportedProperty
- float mTranslationY = 0f;
-
- /**
- * The amount of scale in the x direction around the pivot point. A
- * value of 1 means no scaling is applied.
- */
- @ViewDebug.ExportedProperty
- float mScaleX = 1f;
-
- /**
- * The amount of scale in the y direction around the pivot point. A
- * value of 1 means no scaling is applied.
- */
- @ViewDebug.ExportedProperty
- float mScaleY = 1f;
-
- /**
- * The amount of scale in the x direction around the pivot point. A
- * value of 1 means no scaling is applied.
- */
- @ViewDebug.ExportedProperty
- float mPivotX = 0f;
-
- /**
- * The amount of scale in the y direction around the pivot point. A
- * value of 1 means no scaling is applied.
- */
- @ViewDebug.ExportedProperty
- float mPivotY = 0f;
-
- /**
- * The opacity of the View. This is a value from 0 to 1, where 0 means
- * completely transparent and 1 means completely opaque.
- */
- @ViewDebug.ExportedProperty
- float mAlpha = 1f;
-
- /**
* The distance in pixels from the left edge of this view's parent
* to the left edge of this view.
* {@hide}
@@ -2890,6 +2897,12 @@
}
break;
case R.styleable.View_fadingEdge:
+ if (context.getApplicationInfo().targetSdkVersion >= ICE_CREAM_SANDWICH) {
+ // Ignore the attribute starting with ICS
+ break;
+ }
+ // With builds < ICS, fall through and apply fading edges
+ case R.styleable.View_requiresFadingEdge:
final int fadingEdge = a.getInt(attr, FADING_EDGE_NONE);
if (fadingEdge != FADING_EDGE_NONE) {
viewFlagValues |= fadingEdge;
@@ -6776,8 +6789,11 @@
* @return The current transform matrix for the view
*/
public Matrix getMatrix() {
- updateMatrix();
- return mMatrix;
+ if (mTransformationInfo != null) {
+ updateMatrix();
+ return mTransformationInfo.mMatrix;
+ }
+ return Matrix.IDENTITY_MATRIX;
}
/**
@@ -6797,49 +6813,63 @@
* @return True if the transform matrix is the identity matrix, false otherwise.
*/
final boolean hasIdentityMatrix() {
- updateMatrix();
- return mMatrixIsIdentity;
+ if (mTransformationInfo != null) {
+ updateMatrix();
+ return mTransformationInfo.mMatrixIsIdentity;
+ }
+ return true;
+ }
+
+ void ensureTransformationInfo() {
+ if (mTransformationInfo == null) {
+ mTransformationInfo = new TransformationInfo();
+ }
}
/**
* Recomputes the transform matrix if necessary.
*/
private void updateMatrix() {
- if (mMatrixDirty) {
+ final TransformationInfo info = mTransformationInfo;
+ if (info == null) {
+ return;
+ }
+ if (info.mMatrixDirty) {
// transform-related properties have changed since the last time someone
// asked for the matrix; recalculate it with the current values
// Figure out if we need to update the pivot point
if ((mPrivateFlags & PIVOT_EXPLICITLY_SET) == 0) {
- if ((mRight - mLeft) != mPrevWidth || (mBottom - mTop) != mPrevHeight) {
- mPrevWidth = mRight - mLeft;
- mPrevHeight = mBottom - mTop;
- mPivotX = mPrevWidth / 2f;
- mPivotY = mPrevHeight / 2f;
+ if ((mRight - mLeft) != info.mPrevWidth || (mBottom - mTop) != info.mPrevHeight) {
+ info.mPrevWidth = mRight - mLeft;
+ info.mPrevHeight = mBottom - mTop;
+ info.mPivotX = info.mPrevWidth / 2f;
+ info.mPivotY = info.mPrevHeight / 2f;
}
}
- mMatrix.reset();
- if (!nonzero(mRotationX) && !nonzero(mRotationY)) {
- mMatrix.setTranslate(mTranslationX, mTranslationY);
- mMatrix.preRotate(mRotation, mPivotX, mPivotY);
- mMatrix.preScale(mScaleX, mScaleY, mPivotX, mPivotY);
+ info.mMatrix.reset();
+ if (!nonzero(info.mRotationX) && !nonzero(info.mRotationY)) {
+ info.mMatrix.setTranslate(info.mTranslationX, info.mTranslationY);
+ info.mMatrix.preRotate(info.mRotation, info.mPivotX, info.mPivotY);
+ info.mMatrix.preScale(info.mScaleX, info.mScaleY, info.mPivotX, info.mPivotY);
} else {
- if (mCamera == null) {
- mCamera = new Camera();
- matrix3D = new Matrix();
+ if (info.mCamera == null) {
+ info.mCamera = new Camera();
+ info.matrix3D = new Matrix();
}
- mCamera.save();
- mMatrix.preScale(mScaleX, mScaleY, mPivotX, mPivotY);
- mCamera.rotate(mRotationX, mRotationY, -mRotation);
- mCamera.getMatrix(matrix3D);
- matrix3D.preTranslate(-mPivotX, -mPivotY);
- matrix3D.postTranslate(mPivotX + mTranslationX, mPivotY + mTranslationY);
- mMatrix.postConcat(matrix3D);
- mCamera.restore();
+ info.mCamera.save();
+ info.mMatrix.preScale(info.mScaleX, info.mScaleY, info.mPivotX, info.mPivotY);
+ info.mCamera.rotate(info.mRotationX, info.mRotationY, -info.mRotation);
+ info.mCamera.getMatrix(info.matrix3D);
+ info.matrix3D.preTranslate(-info.mPivotX, -info.mPivotY);
+ info.matrix3D.postTranslate(info.mPivotX + info.mTranslationX,
+ info.mPivotY + info.mTranslationY);
+ info.mMatrix.postConcat(info.matrix3D);
+ info.mCamera.restore();
}
- mMatrixDirty = false;
- mMatrixIsIdentity = mMatrix.isIdentity();
- mInverseMatrixDirty = true;
+ info.mMatrixDirty = false;
+ info.mMatrixIsIdentity = info.mMatrix.isIdentity();
+ info.mInverseMatrixDirty = true;
}
}
@@ -6851,15 +6881,19 @@
* @return The inverse of the current matrix of this view.
*/
final Matrix getInverseMatrix() {
- updateMatrix();
- if (mInverseMatrixDirty) {
- if (mInverseMatrix == null) {
- mInverseMatrix = new Matrix();
+ final TransformationInfo info = mTransformationInfo;
+ if (info != null) {
+ updateMatrix();
+ if (info.mInverseMatrixDirty) {
+ if (info.mInverseMatrix == null) {
+ info.mInverseMatrix = new Matrix();
+ }
+ info.mMatrix.invert(info.mInverseMatrix);
+ info.mInverseMatrixDirty = false;
}
- mMatrix.invert(mInverseMatrix);
- mInverseMatrixDirty = false;
+ return info.mInverseMatrix;
}
- return mInverseMatrix;
+ return Matrix.IDENTITY_MATRIX;
}
/**
@@ -6905,14 +6939,16 @@
invalidateParentCaches();
invalidate(false);
+ ensureTransformationInfo();
final float dpi = mResources.getDisplayMetrics().densityDpi;
- if (mCamera == null) {
- mCamera = new Camera();
- matrix3D = new Matrix();
+ final TransformationInfo info = mTransformationInfo;
+ if (info.mCamera == null) {
+ info.mCamera = new Camera();
+ info.matrix3D = new Matrix();
}
- mCamera.setLocation(0.0f, 0.0f, -Math.abs(distance) / dpi);
- mMatrixDirty = true;
+ info.mCamera.setLocation(0.0f, 0.0f, -Math.abs(distance) / dpi);
+ info.mMatrixDirty = true;
invalidate(false);
}
@@ -6927,7 +6963,7 @@
* @return The degrees of rotation.
*/
public float getRotation() {
- return mRotation;
+ return mTransformationInfo != null ? mTransformationInfo.mRotation : 0;
}
/**
@@ -6945,12 +6981,14 @@
* @attr ref android.R.styleable#View_rotation
*/
public void setRotation(float rotation) {
- if (mRotation != rotation) {
+ ensureTransformationInfo();
+ final TransformationInfo info = mTransformationInfo;
+ if (info.mRotation != rotation) {
invalidateParentCaches();
// Double-invalidation is necessary to capture view's old and new areas
invalidate(false);
- mRotation = rotation;
- mMatrixDirty = true;
+ info.mRotation = rotation;
+ info.mMatrixDirty = true;
mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
invalidate(false);
}
@@ -6966,7 +7004,7 @@
* @return The degrees of Y rotation.
*/
public float getRotationY() {
- return mRotationY;
+ return mTransformationInfo != null ? mTransformationInfo.mRotationY : 0;
}
/**
@@ -6989,12 +7027,14 @@
* @attr ref android.R.styleable#View_rotationY
*/
public void setRotationY(float rotationY) {
- if (mRotationY != rotationY) {
+ ensureTransformationInfo();
+ final TransformationInfo info = mTransformationInfo;
+ if (info.mRotationY != rotationY) {
invalidateParentCaches();
// Double-invalidation is necessary to capture view's old and new areas
invalidate(false);
- mRotationY = rotationY;
- mMatrixDirty = true;
+ info.mRotationY = rotationY;
+ info.mMatrixDirty = true;
mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
invalidate(false);
}
@@ -7010,7 +7050,7 @@
* @return The degrees of X rotation.
*/
public float getRotationX() {
- return mRotationX;
+ return mTransformationInfo != null ? mTransformationInfo.mRotationX : 0;
}
/**
@@ -7033,12 +7073,14 @@
* @attr ref android.R.styleable#View_rotationX
*/
public void setRotationX(float rotationX) {
- if (mRotationX != rotationX) {
+ ensureTransformationInfo();
+ final TransformationInfo info = mTransformationInfo;
+ if (info.mRotationX != rotationX) {
invalidateParentCaches();
// Double-invalidation is necessary to capture view's old and new areas
invalidate(false);
- mRotationX = rotationX;
- mMatrixDirty = true;
+ info.mRotationX = rotationX;
+ info.mMatrixDirty = true;
mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
invalidate(false);
}
@@ -7055,7 +7097,7 @@
* @return The scaling factor.
*/
public float getScaleX() {
- return mScaleX;
+ return mTransformationInfo != null ? mTransformationInfo.mScaleX : 1;
}
/**
@@ -7069,12 +7111,14 @@
* @attr ref android.R.styleable#View_scaleX
*/
public void setScaleX(float scaleX) {
- if (mScaleX != scaleX) {
+ ensureTransformationInfo();
+ final TransformationInfo info = mTransformationInfo;
+ if (info.mScaleX != scaleX) {
invalidateParentCaches();
// Double-invalidation is necessary to capture view's old and new areas
invalidate(false);
- mScaleX = scaleX;
- mMatrixDirty = true;
+ info.mScaleX = scaleX;
+ info.mMatrixDirty = true;
mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
invalidate(false);
}
@@ -7091,7 +7135,7 @@
* @return The scaling factor.
*/
public float getScaleY() {
- return mScaleY;
+ return mTransformationInfo != null ? mTransformationInfo.mScaleY : 1;
}
/**
@@ -7105,12 +7149,14 @@
* @attr ref android.R.styleable#View_scaleY
*/
public void setScaleY(float scaleY) {
- if (mScaleY != scaleY) {
+ ensureTransformationInfo();
+ final TransformationInfo info = mTransformationInfo;
+ if (info.mScaleY != scaleY) {
invalidateParentCaches();
// Double-invalidation is necessary to capture view's old and new areas
invalidate(false);
- mScaleY = scaleY;
- mMatrixDirty = true;
+ info.mScaleY = scaleY;
+ info.mMatrixDirty = true;
mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
invalidate(false);
}
@@ -7127,7 +7173,7 @@
* @return The x location of the pivot point.
*/
public float getPivotX() {
- return mPivotX;
+ return mTransformationInfo != null ? mTransformationInfo.mPivotX : 0;
}
/**
@@ -7146,13 +7192,15 @@
* @attr ref android.R.styleable#View_transformPivotX
*/
public void setPivotX(float pivotX) {
+ ensureTransformationInfo();
mPrivateFlags |= PIVOT_EXPLICITLY_SET;
- if (mPivotX != pivotX) {
+ final TransformationInfo info = mTransformationInfo;
+ if (info.mPivotX != pivotX) {
invalidateParentCaches();
// Double-invalidation is necessary to capture view's old and new areas
invalidate(false);
- mPivotX = pivotX;
- mMatrixDirty = true;
+ info.mPivotX = pivotX;
+ info.mMatrixDirty = true;
mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
invalidate(false);
}
@@ -7169,7 +7217,7 @@
* @return The y location of the pivot point.
*/
public float getPivotY() {
- return mPivotY;
+ return mTransformationInfo != null ? mTransformationInfo.mPivotY : 0;
}
/**
@@ -7187,13 +7235,15 @@
* @attr ref android.R.styleable#View_transformPivotY
*/
public void setPivotY(float pivotY) {
+ ensureTransformationInfo();
mPrivateFlags |= PIVOT_EXPLICITLY_SET;
- if (mPivotY != pivotY) {
+ final TransformationInfo info = mTransformationInfo;
+ if (info.mPivotY != pivotY) {
invalidateParentCaches();
// Double-invalidation is necessary to capture view's old and new areas
invalidate(false);
- mPivotY = pivotY;
- mMatrixDirty = true;
+ info.mPivotY = pivotY;
+ info.mMatrixDirty = true;
mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
invalidate(false);
}
@@ -7207,7 +7257,7 @@
* @return The opacity of the view.
*/
public float getAlpha() {
- return mAlpha;
+ return mTransformationInfo != null ? mTransformationInfo.mAlpha : 1;
}
/**
@@ -7226,7 +7276,8 @@
* @attr ref android.R.styleable#View_alpha
*/
public void setAlpha(float alpha) {
- mAlpha = alpha;
+ ensureTransformationInfo();
+ mTransformationInfo.mAlpha = alpha;
invalidateParentCaches();
if (onSetAlpha((int) (alpha * 255))) {
mPrivateFlags |= ALPHA_SET;
@@ -7248,7 +7299,8 @@
* @return true if the View subclass handles alpha (the return value for onSetAlpha())
*/
boolean setAlphaNoInvalidation(float alpha) {
- mAlpha = alpha;
+ ensureTransformationInfo();
+ mTransformationInfo.mAlpha = alpha;
boolean subclassHandlesAlpha = onSetAlpha((int) (alpha * 255));
if (subclassHandlesAlpha) {
mPrivateFlags |= ALPHA_SET;
@@ -7278,7 +7330,9 @@
public final void setTop(int top) {
if (top != mTop) {
updateMatrix();
- if (mMatrixIsIdentity) {
+ final boolean matrixIsIdentity = mTransformationInfo == null
+ || mTransformationInfo.mMatrixIsIdentity;
+ if (matrixIsIdentity) {
if (mAttachInfo != null) {
int minTop;
int yLoc;
@@ -7303,10 +7357,10 @@
onSizeChanged(width, mBottom - mTop, width, oldHeight);
- if (!mMatrixIsIdentity) {
+ if (!matrixIsIdentity) {
if ((mPrivateFlags & PIVOT_EXPLICITLY_SET) == 0) {
// A change in dimension means an auto-centered pivot point changes, too
- mMatrixDirty = true;
+ mTransformationInfo.mMatrixDirty = true;
}
mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
invalidate(true);
@@ -7345,7 +7399,9 @@
public final void setBottom(int bottom) {
if (bottom != mBottom) {
updateMatrix();
- if (mMatrixIsIdentity) {
+ final boolean matrixIsIdentity = mTransformationInfo == null
+ || mTransformationInfo.mMatrixIsIdentity;
+ if (matrixIsIdentity) {
if (mAttachInfo != null) {
int maxBottom;
if (bottom < mBottom) {
@@ -7367,10 +7423,10 @@
onSizeChanged(width, mBottom - mTop, width, oldHeight);
- if (!mMatrixIsIdentity) {
+ if (!matrixIsIdentity) {
if ((mPrivateFlags & PIVOT_EXPLICITLY_SET) == 0) {
// A change in dimension means an auto-centered pivot point changes, too
- mMatrixDirty = true;
+ mTransformationInfo.mMatrixDirty = true;
}
mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
invalidate(true);
@@ -7400,7 +7456,9 @@
public final void setLeft(int left) {
if (left != mLeft) {
updateMatrix();
- if (mMatrixIsIdentity) {
+ final boolean matrixIsIdentity = mTransformationInfo == null
+ || mTransformationInfo.mMatrixIsIdentity;
+ if (matrixIsIdentity) {
if (mAttachInfo != null) {
int minLeft;
int xLoc;
@@ -7425,10 +7483,10 @@
onSizeChanged(mRight - mLeft, height, oldWidth, height);
- if (!mMatrixIsIdentity) {
+ if (!matrixIsIdentity) {
if ((mPrivateFlags & PIVOT_EXPLICITLY_SET) == 0) {
// A change in dimension means an auto-centered pivot point changes, too
- mMatrixDirty = true;
+ mTransformationInfo.mMatrixDirty = true;
}
mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
invalidate(true);
@@ -7458,7 +7516,9 @@
public final void setRight(int right) {
if (right != mRight) {
updateMatrix();
- if (mMatrixIsIdentity) {
+ final boolean matrixIsIdentity = mTransformationInfo == null
+ || mTransformationInfo.mMatrixIsIdentity;
+ if (matrixIsIdentity) {
if (mAttachInfo != null) {
int maxRight;
if (right < mRight) {
@@ -7480,10 +7540,10 @@
onSizeChanged(mRight - mLeft, height, oldWidth, height);
- if (!mMatrixIsIdentity) {
+ if (!matrixIsIdentity) {
if ((mPrivateFlags & PIVOT_EXPLICITLY_SET) == 0) {
// A change in dimension means an auto-centered pivot point changes, too
- mMatrixDirty = true;
+ mTransformationInfo.mMatrixDirty = true;
}
mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
invalidate(true);
@@ -7501,7 +7561,7 @@
* @return The visual x position of this view, in pixels.
*/
public float getX() {
- return mLeft + mTranslationX;
+ return mLeft + (mTransformationInfo != null ? mTransformationInfo.mTranslationX : 0);
}
/**
@@ -7523,7 +7583,7 @@
* @return The visual y position of this view, in pixels.
*/
public float getY() {
- return mTop + mTranslationY;
+ return mTop + (mTransformationInfo != null ? mTransformationInfo.mTranslationY : 0);
}
/**
@@ -7546,7 +7606,7 @@
* @return The horizontal position of this view relative to its left position, in pixels.
*/
public float getTranslationX() {
- return mTranslationX;
+ return mTransformationInfo != null ? mTransformationInfo.mTranslationX : 0;
}
/**
@@ -7560,12 +7620,14 @@
* @attr ref android.R.styleable#View_translationX
*/
public void setTranslationX(float translationX) {
- if (mTranslationX != translationX) {
+ ensureTransformationInfo();
+ final TransformationInfo info = mTransformationInfo;
+ if (info.mTranslationX != translationX) {
invalidateParentCaches();
// Double-invalidation is necessary to capture view's old and new areas
invalidate(false);
- mTranslationX = translationX;
- mMatrixDirty = true;
+ info.mTranslationX = translationX;
+ info.mMatrixDirty = true;
mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
invalidate(false);
}
@@ -7580,7 +7642,7 @@
* in pixels.
*/
public float getTranslationY() {
- return mTranslationY;
+ return mTransformationInfo != null ? mTransformationInfo.mTranslationY : 0;
}
/**
@@ -7594,12 +7656,14 @@
* @attr ref android.R.styleable#View_translationY
*/
public void setTranslationY(float translationY) {
- if (mTranslationY != translationY) {
+ ensureTransformationInfo();
+ final TransformationInfo info = mTransformationInfo;
+ if (info.mTranslationY != translationY) {
invalidateParentCaches();
// Double-invalidation is necessary to capture view's old and new areas
invalidate(false);
- mTranslationY = translationY;
- mMatrixDirty = true;
+ info.mTranslationY = translationY;
+ info.mMatrixDirty = true;
mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
invalidate(false);
}
@@ -7609,63 +7673,78 @@
* @hide
*/
public void setFastTranslationX(float x) {
- mTranslationX = x;
- mMatrixDirty = true;
+ ensureTransformationInfo();
+ final TransformationInfo info = mTransformationInfo;
+ info.mTranslationX = x;
+ info.mMatrixDirty = true;
}
/**
* @hide
*/
public void setFastTranslationY(float y) {
- mTranslationY = y;
- mMatrixDirty = true;
+ ensureTransformationInfo();
+ final TransformationInfo info = mTransformationInfo;
+ info.mTranslationY = y;
+ info.mMatrixDirty = true;
}
/**
* @hide
*/
public void setFastX(float x) {
- mTranslationX = x - mLeft;
- mMatrixDirty = true;
+ ensureTransformationInfo();
+ final TransformationInfo info = mTransformationInfo;
+ info.mTranslationX = x - mLeft;
+ info.mMatrixDirty = true;
}
/**
* @hide
*/
public void setFastY(float y) {
- mTranslationY = y - mTop;
- mMatrixDirty = true;
+ ensureTransformationInfo();
+ final TransformationInfo info = mTransformationInfo;
+ info.mTranslationY = y - mTop;
+ info.mMatrixDirty = true;
}
/**
* @hide
*/
public void setFastScaleX(float x) {
- mScaleX = x;
- mMatrixDirty = true;
+ ensureTransformationInfo();
+ final TransformationInfo info = mTransformationInfo;
+ info.mScaleX = x;
+ info.mMatrixDirty = true;
}
/**
* @hide
*/
public void setFastScaleY(float y) {
- mScaleY = y;
- mMatrixDirty = true;
+ ensureTransformationInfo();
+ final TransformationInfo info = mTransformationInfo;
+ info.mScaleY = y;
+ info.mMatrixDirty = true;
}
/**
* @hide
*/
public void setFastAlpha(float alpha) {
- mAlpha = alpha;
+ ensureTransformationInfo();
+ mTransformationInfo.mAlpha = alpha;
}
/**
* @hide
*/
public void setFastRotationY(float y) {
- mRotationY = y;
- mMatrixDirty = true;
+ ensureTransformationInfo();
+ final TransformationInfo info = mTransformationInfo;
+ info.mRotationY = y;
+ info.mMatrixDirty = true;
}
/**
@@ -7675,12 +7754,14 @@
*/
public void getHitRect(Rect outRect) {
updateMatrix();
- if (mMatrixIsIdentity || mAttachInfo == null) {
+ final TransformationInfo info = mTransformationInfo;
+ if (info == null || info.mMatrixIsIdentity || mAttachInfo == null) {
outRect.set(mLeft, mTop, mRight, mBottom);
} else {
final RectF tmpRect = mAttachInfo.mTmpTransformRect;
- tmpRect.set(-mPivotX, -mPivotY, getWidth() - mPivotX, getHeight() - mPivotY);
- mMatrix.mapRect(tmpRect);
+ tmpRect.set(-info.mPivotX, -info.mPivotY,
+ getWidth() - info.mPivotX, getHeight() - info.mPivotY);
+ info.mMatrix.mapRect(tmpRect);
outRect.set((int) tmpRect.left + mLeft, (int) tmpRect.top + mTop,
(int) tmpRect.right + mLeft, (int) tmpRect.bottom + mTop);
}
@@ -7768,7 +7849,9 @@
public void offsetTopAndBottom(int offset) {
if (offset != 0) {
updateMatrix();
- if (mMatrixIsIdentity) {
+ final boolean matrixIsIdentity = mTransformationInfo == null
+ || mTransformationInfo.mMatrixIsIdentity;
+ if (matrixIsIdentity) {
final ViewParent p = mParent;
if (p != null && mAttachInfo != null) {
final Rect r = mAttachInfo.mTmpInvalRect;
@@ -7794,7 +7877,7 @@
mTop += offset;
mBottom += offset;
- if (!mMatrixIsIdentity) {
+ if (!matrixIsIdentity) {
mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
invalidate(false);
}
@@ -7810,7 +7893,9 @@
public void offsetLeftAndRight(int offset) {
if (offset != 0) {
updateMatrix();
- if (mMatrixIsIdentity) {
+ final boolean matrixIsIdentity = mTransformationInfo == null
+ || mTransformationInfo.mMatrixIsIdentity;
+ if (matrixIsIdentity) {
final ViewParent p = mParent;
if (p != null && mAttachInfo != null) {
final Rect r = mAttachInfo.mTmpInvalRect;
@@ -7833,7 +7918,7 @@
mLeft += offset;
mRight += offset;
- if (!mMatrixIsIdentity) {
+ if (!matrixIsIdentity) {
mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
invalidate(false);
}
@@ -8309,7 +8394,8 @@
@ViewDebug.ExportedProperty(category = "drawing")
public boolean isOpaque() {
return (mPrivateFlags & OPAQUE_MASK) == OPAQUE_MASK &&
- (mAlpha >= 1.0f - ViewConfiguration.ALPHA_THRESHOLD);
+ ((mTransformationInfo != null ? mTransformationInfo.mAlpha : 1)
+ >= 1.0f - ViewConfiguration.ALPHA_THRESHOLD);
}
/**
@@ -8564,7 +8650,7 @@
* otherwise
*
* @see #setHorizontalFadingEdgeEnabled(boolean)
- * @attr ref android.R.styleable#View_fadingEdge
+ * @attr ref android.R.styleable#View_requiresFadingEdge
*/
public boolean isHorizontalFadingEdgeEnabled() {
return (mViewFlags & FADING_EDGE_HORIZONTAL) == FADING_EDGE_HORIZONTAL;
@@ -8579,7 +8665,7 @@
* horizontally
*
* @see #isHorizontalFadingEdgeEnabled()
- * @attr ref android.R.styleable#View_fadingEdge
+ * @attr ref android.R.styleable#View_requiresFadingEdge
*/
public void setHorizontalFadingEdgeEnabled(boolean horizontalFadingEdgeEnabled) {
if (isHorizontalFadingEdgeEnabled() != horizontalFadingEdgeEnabled) {
@@ -8599,7 +8685,7 @@
* otherwise
*
* @see #setVerticalFadingEdgeEnabled(boolean)
- * @attr ref android.R.styleable#View_fadingEdge
+ * @attr ref android.R.styleable#View_requiresFadingEdge
*/
public boolean isVerticalFadingEdgeEnabled() {
return (mViewFlags & FADING_EDGE_VERTICAL) == FADING_EDGE_VERTICAL;
@@ -8614,7 +8700,7 @@
* vertically
*
* @see #isVerticalFadingEdgeEnabled()
- * @attr ref android.R.styleable#View_fadingEdge
+ * @attr ref android.R.styleable#View_requiresFadingEdge
*/
public void setVerticalFadingEdgeEnabled(boolean verticalFadingEdgeEnabled) {
if (isVerticalFadingEdgeEnabled() != verticalFadingEdgeEnabled) {
@@ -10954,7 +11040,9 @@
if (sizeChanged) {
if ((mPrivateFlags & PIVOT_EXPLICITLY_SET) == 0) {
// A change in dimension means an auto-centered pivot point changes, too
- mMatrixDirty = true;
+ if (mTransformationInfo != null) {
+ mTransformationInfo.mMatrixDirty = true;
+ }
}
onSizeChanged(newWidth, newHeight, oldWidth, oldHeight);
}
@@ -11747,14 +11835,22 @@
+ "two integers");
}
- location[0] = mLeft + (int) (mTranslationX + 0.5f);
- location[1] = mTop + (int) (mTranslationY + 0.5f);
+ location[0] = mLeft;
+ location[1] = mTop;
+ if (mTransformationInfo != null) {
+ location[0] += (int) (mTransformationInfo.mTranslationX + 0.5f);
+ location[1] += (int) (mTransformationInfo.mTranslationY + 0.5f);
+ }
ViewParent viewParent = mParent;
while (viewParent instanceof View) {
final View view = (View)viewParent;
- location[0] += view.mLeft + (int) (view.mTranslationX + 0.5f) - view.mScrollX;
- location[1] += view.mTop + (int) (view.mTranslationY + 0.5f) - view.mScrollY;
+ location[0] += view.mLeft - view.mScrollX;
+ location[1] += view.mTop - view.mScrollY;
+ if (view.mTransformationInfo != null) {
+ location[0] += (int) (view.mTransformationInfo.mTranslationX + 0.5f);
+ location[1] += (int) (view.mTransformationInfo.mTranslationY + 0.5f);
+ }
viewParent = view.mParent;
}
diff --git a/core/java/android/view/ViewPropertyAnimator.java b/core/java/android/view/ViewPropertyAnimator.java
index 6ed49ee..84dc7d8 100644
--- a/core/java/android/view/ViewPropertyAnimator.java
+++ b/core/java/android/view/ViewPropertyAnimator.java
@@ -51,7 +51,7 @@
* The View whose properties are being animated by this class. This is set at
* construction time.
*/
- private View mView;
+ private final View mView;
/**
* The duration of the underlying Animator object. By default, we don't set the duration
@@ -225,6 +225,7 @@
*/
ViewPropertyAnimator(View view) {
mView = view;
+ view.ensureTransformationInfo();
}
/**
@@ -721,36 +722,37 @@
* @param value The value to set the property to
*/
private void setValue(int propertyConstant, float value) {
+ final View.TransformationInfo info = mView.mTransformationInfo;
switch (propertyConstant) {
case TRANSLATION_X:
- mView.mTranslationX = value;
+ info.mTranslationX = value;
break;
case TRANSLATION_Y:
- mView.mTranslationY = value;
+ info.mTranslationY = value;
break;
case ROTATION:
- mView.mRotation = value;
+ info.mRotation = value;
break;
case ROTATION_X:
- mView.mRotationX = value;
+ info.mRotationX = value;
break;
case ROTATION_Y:
- mView.mRotationY = value;
+ info.mRotationY = value;
break;
case SCALE_X:
- mView.mScaleX = value;
+ info.mScaleX = value;
break;
case SCALE_Y:
- mView.mScaleY = value;
+ info.mScaleY = value;
break;
case X:
- mView.mTranslationX = value - mView.mLeft;
+ info.mTranslationX = value - mView.mLeft;
break;
case Y:
- mView.mTranslationY = value - mView.mTop;
+ info.mTranslationY = value - mView.mTop;
break;
case ALPHA:
- mView.mAlpha = value;
+ info.mAlpha = value;
break;
}
}
@@ -762,27 +764,28 @@
* @return float The value of the named property
*/
private float getValue(int propertyConstant) {
+ final View.TransformationInfo info = mView.mTransformationInfo;
switch (propertyConstant) {
case TRANSLATION_X:
- return mView.mTranslationX;
+ return info.mTranslationX;
case TRANSLATION_Y:
- return mView.mTranslationY;
+ return info.mTranslationY;
case ROTATION:
- return mView.mRotation;
+ return info.mRotation;
case ROTATION_X:
- return mView.mRotationX;
+ return info.mRotationX;
case ROTATION_Y:
- return mView.mRotationY;
+ return info.mRotationY;
case SCALE_X:
- return mView.mScaleX;
+ return info.mScaleX;
case SCALE_Y:
- return mView.mScaleY;
+ return info.mScaleY;
case X:
- return mView.mLeft + mView.mTranslationX;
+ return mView.mLeft + info.mTranslationX;
case Y:
- return mView.mTop + mView.mTranslationY;
+ return mView.mTop + info.mTranslationY;
case ALPHA:
- return mView.mAlpha;
+ return info.mAlpha;
}
return 0;
}
@@ -861,7 +864,7 @@
}
}
if ((propertyMask & TRANSFORM_MASK) != 0) {
- mView.mMatrixDirty = true;
+ mView.mTransformationInfo.mMatrixDirty = true;
mView.mPrivateFlags |= View.DRAWN; // force another invalidation
}
// invalidate(false) in all cases except if alphaHandled gets set to true
diff --git a/core/java/android/view/accessibility/AccessibilityInteractionClient.java b/core/java/android/view/accessibility/AccessibilityInteractionClient.java
index 071701e..25b980b 100644
--- a/core/java/android/view/accessibility/AccessibilityInteractionClient.java
+++ b/core/java/android/view/accessibility/AccessibilityInteractionClient.java
@@ -104,6 +104,7 @@
public void setSameThreadMessage(Message message) {
synchronized (mInstanceLock) {
mSameThreadMessage = message;
+ mInstanceLock.notifyAll();
}
}
@@ -125,7 +126,6 @@
Thread.currentThread().getId());
// If the scale is zero the call has failed.
if (windowScale > 0) {
- handleSameThreadMessageIfNeeded();
AccessibilityNodeInfo info = getFindAccessibilityNodeInfoResultAndClear(
interactionId);
finalizeAccessibilityNodeInfo(info, connection, windowScale);
@@ -142,7 +142,7 @@
* in the currently active window and starts from the root View in the window.
*
* @param connection A connection for interacting with the system.
- * @param id The id of the node.
+ * @param viewId The id of the view.
* @return An {@link AccessibilityNodeInfo} if found, null otherwise.
*/
public AccessibilityNodeInfo findAccessibilityNodeInfoByViewIdInActiveWindow(
@@ -153,7 +153,6 @@
viewId, interactionId, this, Thread.currentThread().getId());
// If the scale is zero the call has failed.
if (windowScale > 0) {
- handleSameThreadMessageIfNeeded();
AccessibilityNodeInfo info = getFindAccessibilityNodeInfoResultAndClear(
interactionId);
finalizeAccessibilityNodeInfo(info, connection, windowScale);
@@ -182,7 +181,6 @@
text, interactionId, this, Thread.currentThread().getId());
// If the scale is zero the call has failed.
if (windowScale > 0) {
- handleSameThreadMessageIfNeeded();
List<AccessibilityNodeInfo> infos = getFindAccessibilityNodeInfosResultAndClear(
interactionId);
finalizeAccessibilityNodeInfos(infos, connection, windowScale);
@@ -217,7 +215,6 @@
Thread.currentThread().getId());
// If the scale is zero the call has failed.
if (windowScale > 0) {
- handleSameThreadMessageIfNeeded();
List<AccessibilityNodeInfo> infos = getFindAccessibilityNodeInfosResultAndClear(
interactionId);
finalizeAccessibilityNodeInfos(infos, connection, windowScale);
@@ -246,7 +243,6 @@
accessibilityWindowId, accessibilityViewId, action, interactionId, this,
Thread.currentThread().getId());
if (success) {
- handleSameThreadMessageIfNeeded();
return getPerformAccessibilityActionResult(interactionId);
}
} catch (RemoteException re) {
@@ -363,6 +359,11 @@
final long startTimeMillis = SystemClock.uptimeMillis();
while (true) {
try {
+ Message sameProcessMessage = getSameProcessMessageAndClear();
+ if (sameProcessMessage != null) {
+ sameProcessMessage.getTarget().handleMessage(sameProcessMessage);
+ }
+
if (mInteractionId == interactionId) {
return true;
}
@@ -402,17 +403,6 @@
}
/**
- * Handles the message stored if the interacted and interacting
- * threads are the same otherwise this is a NOP.
- */
- private void handleSameThreadMessageIfNeeded() {
- Message sameProcessMessage = getSameProcessMessageAndClear();
- if (sameProcessMessage != null) {
- sameProcessMessage.getTarget().handleMessage(sameProcessMessage);
- }
- }
-
- /**
* Finalize an {@link AccessibilityNodeInfo} before passing it to the client.
*
* @param info The info.
diff --git a/core/java/android/webkit/BrowserFrame.java b/core/java/android/webkit/BrowserFrame.java
index 49b4f66..309857d 100644
--- a/core/java/android/webkit/BrowserFrame.java
+++ b/core/java/android/webkit/BrowserFrame.java
@@ -422,9 +422,9 @@
final WebHistoryItem h = mCallbackProxy.getBackForwardList()
.getCurrentItem();
if (h != null) {
- String currentUrl = h.getUrl();
- if (currentUrl != null) {
- mDatabase.setFormData(currentUrl, data);
+ String url = WebTextView.urlForAutoCompleteData(h.getUrl());
+ if (url != null) {
+ mDatabase.setFormData(url, data);
}
}
}
diff --git a/core/java/android/webkit/WebTextView.java b/core/java/android/webkit/WebTextView.java
index 2a79caa..217ad7c 100644
--- a/core/java/android/webkit/WebTextView.java
+++ b/core/java/android/webkit/WebTextView.java
@@ -60,6 +60,8 @@
import android.widget.AutoCompleteTextView;
import android.widget.TextView;
+import java.net.MalformedURLException;
+import java.net.URL;
import java.util.ArrayList;
import junit.framework.Assert;
@@ -1044,6 +1046,7 @@
break;
}
setHint(null);
+ setThreshold(1);
if (single) {
mWebView.requestLabel(mWebView.nativeFocusCandidateFramePointer(),
mNodePointer);
@@ -1077,4 +1080,16 @@
/* package */ void setAutoFillProfileIsSet(boolean autoFillProfileIsSet) {
mAutoFillProfileIsSet = autoFillProfileIsSet;
}
+
+ static String urlForAutoCompleteData(String urlString) {
+ // Remove any fragment or query string.
+ URL url = null;
+ try {
+ url = new URL(urlString);
+ } catch (MalformedURLException e) {
+ Log.e(LOGTAG, "Unable to parse URL "+url);
+ }
+
+ return url != null ? url.getProtocol() + "://" + url.getHost() + url.getPath() : null;
+ }
}
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 7ba93da0..47abbc2 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -4826,7 +4826,7 @@
public RequestFormData(String name, String url, Message msg,
boolean autoFillable, boolean autoComplete) {
mName = name;
- mUrl = url;
+ mUrl = WebTextView.urlForAutoCompleteData(url);
mUpdateMessage = msg;
mAutoFillable = autoFillable;
mAutoComplete = autoComplete;
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index cf0971f..b948114 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -9559,8 +9559,8 @@
TextView.this.getPositionListener().removeSubscriber(SuggestionsPopupWindow.this);
- if ((mText instanceof Editable) && mSuggestionRangeSpan != null) {
- ((Editable) mText).removeSpan(mSuggestionRangeSpan);
+ if ((mText instanceof Spannable)) {
+ ((Spannable) mText).removeSpan(mSuggestionRangeSpan);
}
setCursorVisible(mCursorWasVisibleBeforeSuggestions);
@@ -9744,7 +9744,7 @@
}
private boolean updateSuggestions() {
- Spannable spannable = (Spannable)TextView.this.mText;
+ Spannable spannable = (Spannable) TextView.this.mText;
SuggestionSpan[] suggestionSpans = getSuggestionSpans();
final int nbSpans = suggestionSpans.length;
@@ -9754,6 +9754,7 @@
int spanUnionEnd = 0;
SuggestionSpan misspelledSpan = null;
+ int underlineColor = 0;
for (int spanIndex = 0; spanIndex < nbSpans; spanIndex++) {
SuggestionSpan suggestionSpan = suggestionSpans[spanIndex];
@@ -9766,6 +9767,9 @@
misspelledSpan = suggestionSpan;
}
+ // The first span dictates the background color of the highlighted text
+ if (spanIndex == 0) underlineColor = suggestionSpan.getUnderlineColor();
+
String[] suggestions = suggestionSpan.getSuggestions();
int nbSuggestions = suggestions.length;
for (int suggestionIndex = 0; suggestionIndex < nbSuggestions; suggestionIndex++) {
@@ -9808,9 +9812,17 @@
if (mNumberOfSuggestions == 0) return false;
- if (mSuggestionRangeSpan == null) mSuggestionRangeSpan =
- new SuggestionRangeSpan(mHighlightColor);
- ((Editable) mText).setSpan(mSuggestionRangeSpan, spanUnionStart, spanUnionEnd,
+ if (mSuggestionRangeSpan == null) mSuggestionRangeSpan = new SuggestionRangeSpan();
+ if (underlineColor == 0) {
+ // Fallback on the default highlight color when the first span does not provide one
+ mSuggestionRangeSpan.setBackgroundColor(mHighlightColor);
+ } else {
+ final float BACKGROUND_TRANSPARENCY = 0.3f;
+ final int newAlpha = (int) (Color.alpha(underlineColor) * BACKGROUND_TRANSPARENCY);
+ mSuggestionRangeSpan.setBackgroundColor(
+ (underlineColor & 0x00FFFFFF) + (newAlpha << 24));
+ }
+ spannable.setSpan(mSuggestionRangeSpan, spanUnionStart, spanUnionEnd,
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
mSuggestionsAdapter.notifyDataSetChanged();
@@ -9902,6 +9914,9 @@
suggestionSpansFlags[i]);
}
}
+
+ // Move cursor at the end of the replacement word
+ Selection.setSelection(editable, spanEnd + lengthDifference);
}
}
hide();
diff --git a/core/jni/android_bluetooth_common.h b/core/jni/android_bluetooth_common.h
index 2f5fd5a..1f4da3a 100644
--- a/core/jni/android_bluetooth_common.h
+++ b/core/jni/android_bluetooth_common.h
@@ -202,6 +202,13 @@
#define INPUT_OPERATION_GENERIC_FAILURE 5003
#define INPUT_OPERATION_SUCCESS 5004
+#define HEALTH_OPERATION_SUCCESS 6000
+#define HEALTH_OPERATION_ERROR 6001
+#define HEALTH_OPERATION_INVALID_ARGS 6002
+#define HEALTH_OPERATION_GENERIC_FAILURE 6003
+#define HEALTH_OPERATION_NOT_FOUND 6004
+#define HEALTH_OPERATION_NOT_ALLOWED 6005
+
#endif
} /* namespace android */
diff --git a/core/jni/android_server_BluetoothEventLoop.cpp b/core/jni/android_server_BluetoothEventLoop.cpp
index eee256a..0335ce7 100644
--- a/core/jni/android_server_BluetoothEventLoop.cpp
+++ b/core/jni/android_server_BluetoothEventLoop.cpp
@@ -74,6 +74,7 @@
static jmethodID method_onPanDeviceConnectionResult;
static jmethodID method_onHealthDevicePropertyChanged;
static jmethodID method_onHealthDeviceChannelChanged;
+static jmethodID method_onHealthDeviceConnectionResult;
typedef event_loop_native_data_t native_data_t;
@@ -141,6 +142,9 @@
"(Ljava/lang/String;[Ljava/lang/String;)V");
method_onPanDeviceConnectionResult = env->GetMethodID(clazz, "onPanDeviceConnectionResult",
"(Ljava/lang/String;I)V");
+ method_onHealthDeviceConnectionResult = env->GetMethodID(clazz,
+ "onHealthDeviceConnectionResult",
+ "(II)V");
method_onHealthDevicePropertyChanged = env->GetMethodID(clazz, "onHealthDevicePropertyChanged",
"(Ljava/lang/String;[Ljava/lang/String;)V");
method_onHealthDeviceChannelChanged = env->GetMethodID(clazz, "onHealthDeviceChannelChanged",
@@ -1533,6 +1537,39 @@
free(user);
}
+void onHealthDeviceConnectionResult(DBusMessage *msg, void *user, void *n) {
+ LOGV("%s", __FUNCTION__);
+
+ native_data_t *nat = (native_data_t *)n;
+ DBusError err;
+ dbus_error_init(&err);
+ JNIEnv *env;
+ nat->vm->GetEnv((void**)&env, nat->envVer);
+
+ jint result = HEALTH_OPERATION_SUCCESS;
+ if (dbus_set_error_from_message(&err, msg)) {
+ if (!strcmp(err.name, BLUEZ_ERROR_IFC ".InvalidArgs")) {
+ result = HEALTH_OPERATION_INVALID_ARGS;
+ } else if (!strcmp(err.name, BLUEZ_ERROR_IFC ".HealthError")) {
+ result = HEALTH_OPERATION_ERROR;
+ } else if (!strcmp(err.name, BLUEZ_ERROR_IFC ".NotFound")) {
+ result = HEALTH_OPERATION_NOT_FOUND;
+ } else if (!strcmp(err.name, BLUEZ_ERROR_IFC ".NotAllowed")) {
+ result = HEALTH_OPERATION_NOT_ALLOWED;
+ } else {
+ result = HEALTH_OPERATION_GENERIC_FAILURE;
+ }
+ LOG_AND_FREE_DBUS_ERROR(&err);
+ }
+
+ LOGV("... Health Device Code = %d, result = %d", code, result);
+ jint code = *(int *) user;
+ env->CallVoidMethod(nat->me,
+ method_onHealthDeviceConnectionResult,
+ code,
+ result);
+ free(user);
+}
#endif
static JNINativeMethod sMethods[] = {
diff --git a/core/jni/android_server_BluetoothService.cpp b/core/jni/android_server_BluetoothService.cpp
index 292047b..a49c918 100644
--- a/core/jni/android_server_BluetoothService.cpp
+++ b/core/jni/android_server_BluetoothService.cpp
@@ -78,8 +78,8 @@
void onDiscoverServicesResult(DBusMessage *msg, void *user, void *nat);
void onCreateDeviceResult(DBusMessage *msg, void *user, void *nat);
void onInputDeviceConnectionResult(DBusMessage *msg, void *user, void *nat);
-void onConnectPanResult(DBusMessage *msg, void *user, void *n);
void onPanDeviceConnectionResult(DBusMessage *msg, void *user, void *nat);
+void onHealthDeviceConnectionResult(DBusMessage *msg, void *user, void *nat);
/** Get native data stored in the opaque (Java code maintained) pointer mNativeData
@@ -1450,79 +1450,70 @@
}
static jboolean createChannelNative(JNIEnv *env, jobject object,
- jstring devicePath, jstring appPath, jstring config) {
+ jstring devicePath, jstring appPath, jstring config,
+ jint code) {
LOGV("%s", __FUNCTION__);
- jboolean result = JNI_FALSE;
#ifdef HAVE_BLUETOOTH
native_data_t *nat = get_native_data(env, object);
+ jobject eventLoop = env->GetObjectField(object, field_mEventLoop);
+ struct event_loop_native_data_t *eventLoopNat =
+ get_EventLoop_native_data(env, eventLoop);
- if (nat) {
- DBusError err;
- dbus_error_init(&err);
-
+ if (nat && eventLoopNat) {
const char *c_device_path = env->GetStringUTFChars(devicePath, NULL);
const char *c_app_path = env->GetStringUTFChars(appPath, NULL);
const char *c_config = env->GetStringUTFChars(config, NULL);
+ int *data = (int *) malloc(sizeof(int));
+ if (data == NULL) return JNI_FALSE;
- DBusMessage *reply = dbus_func_args(env, nat->conn,
- c_device_path,
- DBUS_HEALTH_DEVICE_IFACE,
- "CreateChannel",
- DBUS_TYPE_OBJECT_PATH, &c_app_path,
- DBUS_TYPE_STRING, &c_config,
- DBUS_TYPE_INVALID);
+ *data = code;
+ bool ret = dbus_func_args_async(env, nat->conn, -1, onHealthDeviceConnectionResult,
+ data, eventLoopNat, c_device_path,
+ DBUS_HEALTH_DEVICE_IFACE, "CreateChannel",
+ DBUS_TYPE_OBJECT_PATH, &c_app_path,
+ DBUS_TYPE_STRING, &c_config,
+ DBUS_TYPE_INVALID);
env->ReleaseStringUTFChars(devicePath, c_device_path);
env->ReleaseStringUTFChars(appPath, c_app_path);
env->ReleaseStringUTFChars(config, c_config);
- if (!reply) {
- if (dbus_error_is_set(&err)) {
- LOG_AND_FREE_DBUS_ERROR(&err);
- }
- } else {
- result = JNI_TRUE;
- }
+ return ret ? JNI_TRUE : JNI_FALSE;
}
#endif
- return result;
+ return JNI_FALSE;
}
static jboolean destroyChannelNative(JNIEnv *env, jobject object, jstring devicePath,
- jstring channelPath) {
+ jstring channelPath, jint code) {
LOGE("%s", __FUNCTION__);
- jboolean result = JNI_FALSE;
#ifdef HAVE_BLUETOOTH
native_data_t *nat = get_native_data(env, object);
+ jobject eventLoop = env->GetObjectField(object, field_mEventLoop);
+ struct event_loop_native_data_t *eventLoopNat =
+ get_EventLoop_native_data(env, eventLoop);
- if (nat) {
- DBusError err;
- dbus_error_init(&err);
-
+ if (nat && eventLoopNat) {
const char *c_device_path = env->GetStringUTFChars(devicePath, NULL);
const char *c_channel_path = env->GetStringUTFChars(channelPath, NULL);
+ int *data = (int *) malloc(sizeof(int));
+ if (data == NULL) return JNI_FALSE;
- DBusMessage *reply = dbus_func_args(env, nat->conn,
- c_device_path,
- DBUS_HEALTH_DEVICE_IFACE,
- "DestroyChannel",
- DBUS_TYPE_OBJECT_PATH, &c_channel_path,
- DBUS_TYPE_INVALID);
+ *data = code;
+ bool ret = dbus_func_args_async(env, nat->conn, -1, onHealthDeviceConnectionResult,
+ data, eventLoopNat, c_device_path,
+ DBUS_HEALTH_DEVICE_IFACE, "DestroyChannel",
+ DBUS_TYPE_OBJECT_PATH, &c_channel_path,
+ DBUS_TYPE_INVALID);
env->ReleaseStringUTFChars(devicePath, c_device_path);
env->ReleaseStringUTFChars(channelPath, c_channel_path);
- if (!reply) {
- if (dbus_error_is_set(&err)) {
- LOG_AND_FREE_DBUS_ERROR(&err);
- }
- } else {
- result = JNI_TRUE;
- }
+ return ret ? JNI_TRUE : JNI_FALSE;
}
#endif
- return result;
+ return JNI_FALSE;
}
static jstring getMainChannelNative(JNIEnv *env, jobject object, jstring devicePath) {
@@ -1755,9 +1746,10 @@
{"unregisterHealthApplicationNative", "(Ljava/lang/String;)Z",
(void *)unregisterHealthApplicationNative},
- {"createChannelNative", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Z",
+ {"createChannelNative", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;I)Z",
(void *)createChannelNative},
- {"destroyChannelNative", "(Ljava/lang/String;Ljava/lang/String;)Z", (void *)destroyChannelNative},
+ {"destroyChannelNative", "(Ljava/lang/String;Ljava/lang/String;I)Z",
+ (void *)destroyChannelNative},
{"getMainChannelNative", "(Ljava/lang/String;)Ljava/lang/String;", (void *)getMainChannelNative},
{"getChannelApplicationNative", "(Ljava/lang/String;)Ljava/lang/String;",
(void *)getChannelApplicationNative},
diff --git a/core/res/res/layout/activity_list_item.xml b/core/res/res/layout/activity_list_item.xml
index 7022fe1..572caf0 100644
--- a/core/res/res/layout/activity_list_item.xml
+++ b/core/res/res/layout/activity_list_item.xml
@@ -33,6 +33,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
- android:paddingLeft="6dip" />
+ android:paddingLeft="?android:attr/listPreferredItemPaddingLeft" />
</LinearLayout>
diff --git a/core/res/res/layout/activity_list_item_2.xml b/core/res/res/layout/activity_list_item_2.xml
index 3b84c733..a58ebfc 100644
--- a/core/res/res/layout/activity_list_item_2.xml
+++ b/core/res/res/layout/activity_list_item_2.xml
@@ -18,7 +18,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeight"
- android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textAppearance="?android:attr/textAppearanceListItemSmall"
android:gravity="center_vertical"
android:drawablePadding="14dip"
android:paddingLeft="16dip"
diff --git a/core/res/res/layout/alert_dialog_progress_holo.xml b/core/res/res/layout/alert_dialog_progress_holo.xml
new file mode 100644
index 0000000..94dbb2b
--- /dev/null
+++ b/core/res/res/layout/alert_dialog_progress_holo.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 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.
+-->
+
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="wrap_content" android:layout_height="match_parent">
+ <ProgressBar android:id="@+id/progress"
+ style="?android:attr/progressBarStyleHorizontal"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="16dip"
+ android:layout_marginBottom="1dip"
+ android:layout_marginLeft="16dip"
+ android:layout_marginRight="16dip"
+ android:layout_centerHorizontal="true" />
+ <TextView
+ android:id="@+id/progress_percent"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:paddingBottom="16dip"
+ android:layout_marginLeft="16dip"
+ android:layout_marginRight="16dip"
+ android:layout_alignParentLeft="true"
+ android:layout_below="@id/progress"
+ />
+ <TextView
+ android:id="@+id/progress_number"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:paddingBottom="16dip"
+ android:layout_marginLeft="16dip"
+ android:layout_marginRight="16dip"
+ android:layout_alignParentRight="true"
+ android:layout_below="@id/progress"
+ />
+</RelativeLayout>
diff --git a/core/res/res/layout/progress_dialog_holo.xml b/core/res/res/layout/progress_dialog_holo.xml
new file mode 100644
index 0000000..9631efd
--- /dev/null
+++ b/core/res/res/layout/progress_dialog_holo.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2011, 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.
+*/
+-->
+
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+
+ <LinearLayout android:id="@+id/body"
+ android:orientation="horizontal"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:baselineAligned="false"
+ android:padding="16dip">
+
+ <ProgressBar android:id="@android:id/progress"
+ style="?android:attr/progressBarStyle"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:max="10000"
+ android:layout_marginRight="16dip" />
+
+ <TextView android:id="@+id/message"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical" />
+ </LinearLayout>
+</FrameLayout>
diff --git a/core/res/res/layout/resolve_list_item.xml b/core/res/res/layout/resolve_list_item.xml
index 66e3b8a..c0404be 100644
--- a/core/res/res/layout/resolve_list_item.xml
+++ b/core/res/res/layout/resolve_list_item.xml
@@ -23,8 +23,8 @@
android:minHeight="?android:attr/listPreferredItemHeight"
android:layout_height="wrap_content"
android:layout_width="match_parent"
- android:paddingLeft="10dip"
- android:paddingRight="15dip">
+ android:paddingLeft="16dip"
+ android:paddingRight="16dip">
<!-- Activity icon when presenting dialog -->
<ImageView android:id="@+id/icon"
@@ -39,18 +39,18 @@
android:layout_height="wrap_content" >
<!-- Activity name -->
<TextView android:id="@android:id/text1"
- android:textAppearance="?android:attr/textAppearanceLarge"
+ android:textAppearance="?android:attr/textAppearanceListItemSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="2"
- android:paddingLeft="10dip" />
+ android:paddingLeft="16dip" />
<!-- Extended activity info to distinguish between duplicate activity names -->
<TextView android:id="@android:id/text2"
- android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="2"
- android:paddingLeft="10dip" />
+ android:paddingLeft="16dip" />
</LinearLayout>
</LinearLayout>
diff --git a/core/res/res/layout/simple_list_item_1.xml b/core/res/res/layout/simple_list_item_1.xml
index 252e006..c5e3efc 100644
--- a/core/res/res/layout/simple_list_item_1.xml
+++ b/core/res/res/layout/simple_list_item_1.xml
@@ -18,9 +18,9 @@
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceListItem"
+ android:textAppearance="?android:attr/textAppearanceListItemSmall"
android:gravity="center_vertical"
- android:paddingLeft="8dip"
- android:paddingRight="8dip"
- android:minHeight="?android:attr/listPreferredItemHeight"
+ android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
+ android:paddingRight="?android:attr/listPreferredItemPaddingRight"
+ android:minHeight="?android:attr/listPreferredItemHeightSmall"
/>
diff --git a/core/res/res/layout/simple_list_item_2.xml b/core/res/res/layout/simple_list_item_2.xml
index 9b6c62a..9369876 100644
--- a/core/res/res/layout/simple_list_item_2.xml
+++ b/core/res/res/layout/simple_list_item_2.xml
@@ -24,8 +24,8 @@
<TextView android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginLeft="8dip"
- android:layout_marginTop="8dip"
+ android:layout_marginLeft="?android:attr/listPreferredItemPaddingLeft"
+ android:layout_marginTop="8dip"
android:textAppearance="?android:attr/textAppearanceListItem"
/>
@@ -33,7 +33,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@android:id/text1"
- android:layout_alignLeft="@android:id/text1"
+ android:layout_alignLeft="@android:id/text1"
android:textAppearance="?android:attr/textAppearanceSmall"
/>
diff --git a/core/res/res/layout/simple_list_item_activated_1.xml b/core/res/res/layout/simple_list_item_activated_1.xml
index d60f93b..a5fb5d1 100644
--- a/core/res/res/layout/simple_list_item_activated_1.xml
+++ b/core/res/res/layout/simple_list_item_activated_1.xml
@@ -18,8 +18,10 @@
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceListItem"
+ android:textAppearance="?android:attr/textAppearanceListItemSmall"
android:gravity="center_vertical"
+ android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
+ android:paddingRight="?android:attr/listPreferredItemPaddingRight"
android:background="?android:attr/activatedBackgroundIndicator"
- android:minHeight="?android:attr/listPreferredItemHeight"
+ android:minHeight="?android:attr/listPreferredItemHeightSmall"
/>
diff --git a/core/res/res/layout/simple_list_item_activated_2.xml b/core/res/res/layout/simple_list_item_activated_2.xml
index 5be5c92..8746f6f 100644
--- a/core/res/res/layout/simple_list_item_activated_2.xml
+++ b/core/res/res/layout/simple_list_item_activated_2.xml
@@ -27,9 +27,9 @@
<TextView android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginLeft="8dip"
- android:layout_marginTop="8dip"
- android:textAppearance="?android:attr/textAppearanceLarge"
+ android:layout_marginLeft="?android:attr/listPreferredItemPaddingLeft"
+ android:layout_marginTop="6dip"
+ android:textAppearance="?android:attr/textAppearanceListItem"
/>
<TextView android:id="@android:id/text2"
diff --git a/core/res/res/layout/simple_list_item_checked.xml b/core/res/res/layout/simple_list_item_checked.xml
index 79d3a18..c9153f8 100644
--- a/core/res/res/layout/simple_list_item_checked.xml
+++ b/core/res/res/layout/simple_list_item_checked.xml
@@ -17,10 +17,10 @@
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
android:layout_width="match_parent"
- android:layout_height="?android:attr/listPreferredItemHeight"
- android:textAppearance="?android:attr/textAppearanceListItem"
+ android:layout_height="?android:attr/listPreferredItemHeightSmall"
+ android:textAppearance="?android:attr/textAppearanceListItemSmall"
android:gravity="center_vertical"
android:checkMark="?android:attr/textCheckMark"
- android:paddingLeft="8dip"
- android:paddingRight="8dip"
+ android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
+ android:paddingRight="?android:attr/listPreferredItemPaddingRight"
/>
diff --git a/core/res/res/layout/simple_list_item_single_choice.xml b/core/res/res/layout/simple_list_item_single_choice.xml
index ac4a4a8..4a6cefa 100644
--- a/core/res/res/layout/simple_list_item_single_choice.xml
+++ b/core/res/res/layout/simple_list_item_single_choice.xml
@@ -17,10 +17,10 @@
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
android:layout_width="match_parent"
- android:layout_height="?android:attr/listPreferredItemHeight"
- android:textAppearance="?android:attr/textAppearanceListItem"
+ android:layout_height="?android:attr/listPreferredItemHeightSmall"
+ android:textAppearance="?android:attr/textAppearanceListItemSmall"
android:gravity="center_vertical"
android:checkMark="?android:attr/listChoiceIndicatorSingle"
- android:paddingLeft="8dip"
- android:paddingRight="8dip"
+ android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
+ android:paddingRight="?android:attr/listPreferredItemPaddingRight"
/>
diff --git a/core/res/res/layout/simple_spinner_item.xml b/core/res/res/layout/simple_spinner_item.xml
index 77929ee..61dc025 100644
--- a/core/res/res/layout/simple_spinner_item.xml
+++ b/core/res/res/layout/simple_spinner_item.xml
@@ -19,7 +19,7 @@
-->
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
- style="?android:attr/spinnerItemStyle"
+ style="?android:attr/spinnerItemStyle"
android:singleLine="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index bc14ade..f90d67b 100755
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -235,6 +235,11 @@
<!-- The list item height for search results. @hide -->
<attr name="searchResultListItemHeight" format="dimension" />
+ <!-- The preferred padding along the left edge of list items. -->
+ <attr name="listPreferredItemPaddingLeft" format="dimension" />
+ <!-- The preferred padding along the right edge of list items. -->
+ <attr name="listPreferredItemPaddingRight" format="dimension" />
+
<!-- The preferred TextAppearance for the primary text of list items. -->
<attr name="textAppearanceListItem" format="reference" />
<!-- The preferred TextAppearance for the primary text of small list items. -->
@@ -1546,6 +1551,8 @@
<attr name="multiChoiceItemLayout" format="reference" />
<attr name="singleChoiceItemLayout" format="reference" />
<attr name="listItemLayout" format="reference" />
+ <attr name="progressLayout" format="reference" />
+ <attr name="horizontalProgressLayout" format="reference" />
</declare-styleable>
<!-- Fragment animation class attributes. -->
@@ -1799,7 +1806,13 @@
<!-- Defines whether the vertical scrollbar track should always be drawn. -->
<attr name="scrollbarAlwaysDrawVerticalTrack" format="boolean" />
- <!-- Defines which edges should be fadeded on scrolling. -->
+ <!-- {@deprecated This attribute is deprecated and will be ignored as of
+ API level {@link android.os.Build.VERSION_CODES#ICE_CREAM_SANDWICH}.
+ Using fading edges may introduce noticeable performance
+ degradations and should be used only when required by the application's
+ visual design. To request fading edges with API level
+ {@link android.os.Build.VERSION_CODES#ICE_CREAM_SANDWICH} and above,
+ use the <code>requiresFadingEdge</code> attribute instead.} -->
<attr name="fadingEdge">
<!-- No edge is faded. -->
<flag name="none" value="0x00000000" />
@@ -1808,6 +1821,15 @@
<!-- Fades vertical edges only. -->
<flag name="vertical" value="0x00002000" />
</attr>
+ <!-- Defines which edges should be faded on scrolling. -->
+ <attr name="requiresFadingEdge">
+ <!-- No edge is faded. -->
+ <flag name="none" value="0x00000000" />
+ <!-- Fades horizontal edges only. -->
+ <flag name="horizontal" value="0x00001000" />
+ <!-- Fades vertical edges only. -->
+ <flag name="vertical" value="0x00002000" />
+ </attr>
<!-- Defines the length of the fading edges. -->
<attr name="fadingEdgeLength" format="dimension" />
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index bc2b907..ba8be2e 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -1745,20 +1745,6 @@
<public type="attr" name="accessibilityFlags" />
<public type="attr" name="canRetrieveWindowContent" />
- <public type="attr" name="targetDrawables" />
- <public type="attr" name="handleDrawable" />
- <public type="attr" name="leftChevronDrawable" />
- <public type="attr" name="rightChevronDrawable" />
- <public type="attr" name="topChevronDrawable" />
- <public type="attr" name="bottomChevronDrawable" />
- <public type="attr" name="waveDrawable" />
- <public type="attr" name="outerRadius" />
- <public type="attr" name="hitRadius" />
- <public type="attr" name="vibrationDuration" />
- <public type="attr" name="snapMargin" />
- <public type="attr" name="feedbackCount" />
- <public type="attr" name="verticalOffset" />
- <public type="attr" name="horizontalOffset" />
<public type="attr" name="listPreferredItemHeightLarge" />
<public type="attr" name="listPreferredItemHeightSmall" />
@@ -1798,6 +1784,16 @@
<public type="attr" name="textAppearanceListItem" />
<public type="attr" name="textAppearanceListItemSmall" />
+ <public type="attr" name="targetDescriptions" />
+ <public type="attr" name="directionDescriptions" />
+
+ <public type="attr" name="overridesImplicitlyEnabledSubtype" />
+
+ <public type="attr" name="listPreferredItemPaddingLeft" />
+ <public type="attr" name="listPreferredItemPaddingRight" />
+
+ <public type="attr" name="requiresFadingEdge" />
+
<public type="style" name="TextAppearance.SuggestionHighlight" />
<public type="style" name="Theme.Holo.Light.DarkActionBar" />
@@ -2007,8 +2003,4 @@
<public type="color" name="holo_purple" />
<public type="color" name="holo_blue_bright" />
- <public type="attr" name="targetDescriptions" />
- <public type="attr" name="directionDescriptions" />
-
- <public type="attr" name="overridesImplicitlyEnabledSubtype" />
</resources>
diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml
index 5033611..356a2ad 100644
--- a/core/res/res/values/styles.xml
+++ b/core/res/res/values/styles.xml
@@ -61,6 +61,8 @@
<item name="bottomBright">@android:drawable/popup_bottom_bright</item>
<item name="bottomMedium">@android:drawable/popup_bottom_medium</item>
<item name="centerMedium">@android:drawable/popup_center_medium</item>
+ <item name="progressLayout">@android:layout/progress_dialog</item>
+ <item name="horizontalProgressLayout">@android:layout/alert_dialog_progress</item>
</style>
<style name="Widget.PreferenceFrameLayout">
@@ -2350,6 +2352,8 @@
<item name="centerMedium">@android:drawable/dialog_middle_holo_dark</item>
<item name="layout">@android:layout/alert_dialog_holo</item>
<item name="listLayout">@android:layout/select_dialog_holo</item>
+ <item name="progressLayout">@android:layout/progress_dialog_holo</item>
+ <item name="horizontalProgressLayout">@android:layout/alert_dialog_progress_holo</item>
<item name="listItemLayout">@android:layout/select_dialog_item_holo</item>
<item name="multiChoiceItemLayout">@android:layout/select_dialog_multichoice_holo</item>
<item name="singleChoiceItemLayout">@android:layout/select_dialog_singlechoice_holo</item>
diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml
index cc79006..d19c97f 100644
--- a/core/res/res/values/themes.xml
+++ b/core/res/res/values/themes.xml
@@ -124,6 +124,8 @@
<item name="dropdownListPreferredItemHeight">?android:attr/listPreferredItemHeight</item>
<item name="textAppearanceListItem">?android:attr/textAppearanceLarge</item>
<item name="textAppearanceListItemSmall">?android:attr/textAppearanceLarge</item>
+ <item name="listPreferredItemPaddingLeft">6dip</item>
+ <item name="listPreferredItemPaddingRight">6dip</item>
<!-- @hide -->
<item name="searchResultListItemHeight">58dip</item>
@@ -924,6 +926,8 @@
<item name="listPreferredItemHeightLarge">80dip</item>
<item name="dropdownListPreferredItemHeight">?android:attr/listPreferredItemHeightSmall</item>
<item name="textAppearanceListItemSmall">?android:attr/textAppearanceMedium</item>
+ <item name="listPreferredItemPaddingLeft">8dip</item>
+ <item name="listPreferredItemPaddingRight">8dip</item>
<!-- @hide -->
<item name="searchResultListItemHeight">58dip</item>
@@ -1229,6 +1233,8 @@
<item name="listPreferredItemHeightLarge">80dip</item>
<item name="dropdownListPreferredItemHeight">?android:attr/listPreferredItemHeightSmall</item>
<item name="textAppearanceListItemSmall">?android:attr/textAppearanceMedium</item>
+ <item name="listPreferredItemPaddingLeft">8dip</item>
+ <item name="listPreferredItemPaddingRight">8dip</item>
<!-- @hide -->
<item name="searchResultListItemHeight">58dip</item>
@@ -1534,6 +1540,9 @@
<item name="textAppearance">@android:style/TextAppearance.Holo</item>
<item name="textAppearanceInverse">@android:style/TextAppearance.Holo.Inverse</item>
+
+ <item name="listPreferredItemPaddingLeft">16dip</item>
+ <item name="listPreferredItemPaddingRight">16dip</item>
</style>
<!-- Variation of Theme.Holo.Dialog that has a nice minumum width for
@@ -1623,6 +1632,9 @@
<item name="textAppearance">@android:style/TextAppearance.Holo.Light</item>
<item name="textAppearanceInverse">@android:style/TextAppearance.Holo.Light.Inverse</item>
+
+ <item name="listPreferredItemPaddingLeft">16dip</item>
+ <item name="listPreferredItemPaddingRight">16dip</item>
</style>
<!-- Variation of Theme.Holo.Light.Dialog that has a nice minumum width for
diff --git a/graphics/java/android/graphics/Matrix.java b/graphics/java/android/graphics/Matrix.java
index 66ed104..a837294 100644
--- a/graphics/java/android/graphics/Matrix.java
+++ b/graphics/java/android/graphics/Matrix.java
@@ -37,6 +37,188 @@
public static final int MPERSP_1 = 7; //!< use with getValues/setValues
public static final int MPERSP_2 = 8; //!< use with getValues/setValues
+ /** @hide */
+ public static Matrix IDENTITY_MATRIX = new Matrix() {
+ void oops() {
+ throw new IllegalStateException("Matrix can not be modified");
+ }
+
+ @Override
+ public void set(Matrix src) {
+ oops();
+ }
+
+ @Override
+ public void reset() {
+ oops();
+ }
+
+ @Override
+ public void setTranslate(float dx, float dy) {
+ oops();
+ }
+
+ @Override
+ public void setScale(float sx, float sy, float px, float py) {
+ oops();
+ }
+
+ @Override
+ public void setScale(float sx, float sy) {
+ oops();
+ }
+
+ @Override
+ public void setRotate(float degrees, float px, float py) {
+ oops();
+ }
+
+ @Override
+ public void setRotate(float degrees) {
+ oops();
+ }
+
+ @Override
+ public void setSinCos(float sinValue, float cosValue, float px, float py) {
+ oops();
+ }
+
+ @Override
+ public void setSinCos(float sinValue, float cosValue) {
+ oops();
+ }
+
+ @Override
+ public void setSkew(float kx, float ky, float px, float py) {
+ oops();
+ }
+
+ @Override
+ public void setSkew(float kx, float ky) {
+ oops();
+ }
+
+ @Override
+ public boolean setConcat(Matrix a, Matrix b) {
+ oops();
+ return false;
+ }
+
+ @Override
+ public boolean preTranslate(float dx, float dy) {
+ oops();
+ return false;
+ }
+
+ @Override
+ public boolean preScale(float sx, float sy, float px, float py) {
+ oops();
+ return false;
+ }
+
+ @Override
+ public boolean preScale(float sx, float sy) {
+ oops();
+ return false;
+ }
+
+ @Override
+ public boolean preRotate(float degrees, float px, float py) {
+ oops();
+ return false;
+ }
+
+ @Override
+ public boolean preRotate(float degrees) {
+ oops();
+ return false;
+ }
+
+ @Override
+ public boolean preSkew(float kx, float ky, float px, float py) {
+ oops();
+ return false;
+ }
+
+ @Override
+ public boolean preSkew(float kx, float ky) {
+ oops();
+ return false;
+ }
+
+ @Override
+ public boolean preConcat(Matrix other) {
+ oops();
+ return false;
+ }
+
+ @Override
+ public boolean postTranslate(float dx, float dy) {
+ oops();
+ return false;
+ }
+
+ @Override
+ public boolean postScale(float sx, float sy, float px, float py) {
+ oops();
+ return false;
+ }
+
+ @Override
+ public boolean postScale(float sx, float sy) {
+ oops();
+ return false;
+ }
+
+ @Override
+ public boolean postRotate(float degrees, float px, float py) {
+ oops();
+ return false;
+ }
+
+ @Override
+ public boolean postRotate(float degrees) {
+ oops();
+ return false;
+ }
+
+ @Override
+ public boolean postSkew(float kx, float ky, float px, float py) {
+ oops();
+ return false;
+ }
+
+ @Override
+ public boolean postSkew(float kx, float ky) {
+ oops();
+ return false;
+ }
+
+ @Override
+ public boolean postConcat(Matrix other) {
+ oops();
+ return false;
+ }
+
+ @Override
+ public boolean setRectToRect(RectF src, RectF dst, ScaleToFit stf) {
+ oops();
+ return false;
+ }
+
+ @Override
+ public boolean setPolyToPoly(float[] src, int srcIndex, float[] dst, int dstIndex,
+ int pointCount) {
+ oops();
+ return false;
+ }
+
+ @Override
+ public void setValues(float[] values) {
+ oops();
+ }
+ };
+
/**
* @hide
*/
diff --git a/include/media/mediascanner.h b/include/media/mediascanner.h
index 803bffb..a73403b 100644
--- a/include/media/mediascanner.h
+++ b/include/media/mediascanner.h
@@ -62,12 +62,17 @@
private:
// current locale (like "ja_JP"), created/destroyed with strdup()/free()
char *mLocale;
+ char *mSkipList;
+ int *mSkipIndex;
MediaScanResult doProcessDirectory(
char *path, int pathRemaining, MediaScannerClient &client, bool noMedia);
MediaScanResult doProcessDirectoryEntry(
char *path, int pathRemaining, MediaScannerClient &client, bool noMedia,
struct dirent* entry, char* fileSpot);
+ void loadSkipList();
+ bool shouldSkipDirectory(char *path);
+
MediaScanner(const MediaScanner &);
MediaScanner &operator=(const MediaScanner &);
@@ -103,4 +108,3 @@
}; // namespace android
#endif // MEDIASCANNER_H
-
diff --git a/include/ui/Input.h b/include/ui/Input.h
index f1385a0..af899ef 100644
--- a/include/ui/Input.h
+++ b/include/ui/Input.h
@@ -660,15 +660,19 @@
static const uint32_t HISTORY_SIZE = 10;
// Oldest sample to consider when calculating the velocity.
- static const nsecs_t MAX_AGE = 200 * 1000000; // 200 ms
+ static const nsecs_t MAX_AGE = 100 * 1000000; // 100 ms
// The minimum duration between samples when estimating velocity.
- static const nsecs_t MIN_DURATION = 10 * 1000000; // 10 ms
+ static const nsecs_t MIN_DURATION = 5 * 1000000; // 5 ms
struct Movement {
nsecs_t eventTime;
BitSet32 idBits;
Position positions[MAX_POINTERS];
+
+ inline const Position& getPosition(uint32_t id) const {
+ return positions[idBits.getIndexOfBit(id)];
+ }
};
uint32_t mIndex;
diff --git a/libs/ui/Input.cpp b/libs/ui/Input.cpp
index 688b998..0d25823 100644
--- a/libs/ui/Input.cpp
+++ b/libs/ui/Input.cpp
@@ -752,6 +752,7 @@
switch (actionMasked) {
case AMOTION_EVENT_ACTION_DOWN:
+ case AMOTION_EVENT_ACTION_HOVER_ENTER:
// Clear all pointers on down before adding the new movement.
clear();
break;
@@ -764,12 +765,11 @@
clearPointers(downIdBits);
break;
}
- case AMOTION_EVENT_ACTION_OUTSIDE:
- case AMOTION_EVENT_ACTION_CANCEL:
- case AMOTION_EVENT_ACTION_SCROLL:
- case AMOTION_EVENT_ACTION_UP:
- case AMOTION_EVENT_ACTION_POINTER_UP:
- // Ignore these actions because they do not convey any new information about
+ case AMOTION_EVENT_ACTION_MOVE:
+ case AMOTION_EVENT_ACTION_HOVER_MOVE:
+ break;
+ default:
+ // Ignore all other actions because they do not convey any new information about
// pointer movement. We also want to preserve the last known velocity of the pointers.
// Note that ACTION_UP and ACTION_POINTER_UP always report the last known position
// of the pointers that went up. ACTION_POINTER_UP does include the new position of
@@ -814,68 +814,36 @@
bool VelocityTracker::getVelocity(uint32_t id, float* outVx, float* outVy) const {
const Movement& newestMovement = mMovements[mIndex];
if (newestMovement.idBits.hasBit(id)) {
- // Find the oldest sample that contains the pointer and that is not older than MAX_AGE.
- nsecs_t minTime = newestMovement.eventTime - MAX_AGE;
- uint32_t oldestIndex = mIndex;
- uint32_t numTouches = 1;
- do {
- uint32_t nextOldestIndex = (oldestIndex == 0 ? HISTORY_SIZE : oldestIndex) - 1;
- const Movement& nextOldestMovement = mMovements[nextOldestIndex];
- if (!nextOldestMovement.idBits.hasBit(id)
- || nextOldestMovement.eventTime < minTime) {
- break;
- }
- oldestIndex = nextOldestIndex;
- } while (++numTouches < HISTORY_SIZE);
-
- // Calculate an exponentially weighted moving average of the velocity estimate
- // at different points in time measured relative to the oldest sample.
- // This is essentially an IIR filter. Newer samples are weighted more heavily
- // than older samples. Samples at equal time points are weighted more or less
- // equally.
- //
- // One tricky problem is that the sample data may be poorly conditioned.
- // Sometimes samples arrive very close together in time which can cause us to
- // overestimate the velocity at that time point. Most samples might be measured
- // 16ms apart but some consecutive samples could be only 0.5sm apart because
- // the hardware or driver reports them irregularly or in bursts.
+ const Position& newestPosition = newestMovement.getPosition(id);
float accumVx = 0;
float accumVy = 0;
- uint32_t index = oldestIndex;
- uint32_t samplesUsed = 0;
- const Movement& oldestMovement = mMovements[oldestIndex];
- const Position& oldestPosition =
- oldestMovement.positions[oldestMovement.idBits.getIndexOfBit(id)];
- nsecs_t lastDuration = 0;
+ float duration = 0;
- while (numTouches-- > 1) {
- if (++index == HISTORY_SIZE) {
- index = 0;
- }
+ // Iterate over movement samples in reverse time order and accumulate velocity.
+ uint32_t index = mIndex;
+ do {
+ index = (index == 0 ? HISTORY_SIZE : index) - 1;
const Movement& movement = mMovements[index];
- nsecs_t duration = movement.eventTime - oldestMovement.eventTime;
-
- // If the duration between samples is small, we may significantly overestimate
- // the velocity. Consequently, we impose a minimum duration constraint on the
- // samples that we include in the calculation.
- if (duration >= MIN_DURATION) {
- const Position& position = movement.positions[movement.idBits.getIndexOfBit(id)];
- float scale = 1000000000.0f / duration; // one over time delta in seconds
- float vx = (position.x - oldestPosition.x) * scale;
- float vy = (position.y - oldestPosition.y) * scale;
-
- accumVx = (accumVx * lastDuration + vx * duration) / (duration + lastDuration);
- accumVy = (accumVy * lastDuration + vy * duration) / (duration + lastDuration);
-
- lastDuration = duration;
- samplesUsed += 1;
+ if (!movement.idBits.hasBit(id)) {
+ break;
}
- }
+
+ nsecs_t age = newestMovement.eventTime - movement.eventTime;
+ if (age > MAX_AGE) {
+ break;
+ }
+
+ const Position& position = movement.getPosition(id);
+ accumVx += newestPosition.x - position.x;
+ accumVy += newestPosition.y - position.y;
+ duration += age;
+ } while (index != mIndex);
// Make sure we used at least one sample.
- if (samplesUsed != 0) {
- *outVx = accumVx;
- *outVy = accumVy;
+ if (duration >= MIN_DURATION) {
+ float scale = 1000000000.0f / duration; // one over time delta in seconds
+ *outVx = accumVx * scale;
+ *outVy = accumVy * scale;
return true;
}
}
diff --git a/media/libmedia/MediaScanner.cpp b/media/libmedia/MediaScanner.cpp
index 41f8593..19dedfc 100644
--- a/media/libmedia/MediaScanner.cpp
+++ b/media/libmedia/MediaScanner.cpp
@@ -16,6 +16,7 @@
//#define LOG_NDEBUG 0
#define LOG_TAG "MediaScanner"
+#include <cutils/properties.h>
#include <utils/Log.h>
#include <media/mediascanner.h>
@@ -26,11 +27,14 @@
namespace android {
MediaScanner::MediaScanner()
- : mLocale(NULL) {
+ : mLocale(NULL), mSkipList(NULL), mSkipIndex(NULL) {
+ loadSkipList();
}
MediaScanner::~MediaScanner() {
setLocale(NULL);
+ free(mSkipList);
+ free(mSkipIndex);
}
void MediaScanner::setLocale(const char *locale) {
@@ -47,6 +51,33 @@
return mLocale;
}
+void MediaScanner::loadSkipList() {
+ mSkipList = (char *)malloc(PROPERTY_VALUE_MAX * sizeof(char));
+ if (mSkipList) {
+ property_get("testing.mediascanner.skiplist", mSkipList, "");
+ }
+ if (!mSkipList || (strlen(mSkipList) == 0)) {
+ free(mSkipList);
+ mSkipList = NULL;
+ return;
+ }
+ mSkipIndex = (int *)malloc(PROPERTY_VALUE_MAX * sizeof(int));
+ if (mSkipIndex) {
+ // dup it because strtok will modify the string
+ char *skipList = strdup(mSkipList);
+ if (skipList) {
+ char * path = strtok(skipList, ",");
+ int i = 0;
+ while (path) {
+ mSkipIndex[i++] = strlen(path);
+ path = strtok(NULL, ",");
+ }
+ mSkipIndex[i] = -1;
+ free(skipList);
+ }
+ }
+}
+
MediaScanResult MediaScanner::processDirectory(
const char *path, MediaScannerClient &client) {
int pathLength = strlen(path);
@@ -75,12 +106,39 @@
return result;
}
+bool MediaScanner::shouldSkipDirectory(char *path) {
+ if (path && mSkipList && mSkipIndex) {
+ int len = strlen(path);
+ int idx = 0;
+ // track the start position of next path in the comma
+ // separated list obtained from getprop
+ int startPos = 0;
+ while (mSkipIndex[idx] != -1) {
+ // no point to match path name if strlen mismatch
+ if ((len == mSkipIndex[idx])
+ // pick out the path segment from comma separated list
+ // to compare against current path parameter
+ && (strncmp(path, &mSkipList[startPos], len) == 0)) {
+ return true;
+ }
+ startPos += mSkipIndex[idx] + 1; // extra char for the delimiter
+ idx++;
+ }
+ }
+ return false;
+}
+
MediaScanResult MediaScanner::doProcessDirectory(
char *path, int pathRemaining, MediaScannerClient &client, bool noMedia) {
// place to copy file or directory name
char* fileSpot = path + strlen(path);
struct dirent* entry;
+ if (shouldSkipDirectory(path)) {
+ LOGD("Skipping: %s", path);
+ return MEDIA_SCAN_RESULT_OK;
+ }
+
// Treat all files as non-media in directories that contain a ".nomedia" file
if (pathRemaining >= 8 /* strlen(".nomedia") */ ) {
strcpy(fileSpot, ".nomedia");
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
index fb49d7b..9ab470b 100755
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -50,7 +50,7 @@
// Treat time out as an error if we have not received any output
// buffers after 3 seconds.
-const static int64_t kBufferFilledEventTimeOutUs = 3000000000LL;
+const static int64_t kBufferFilledEventTimeOutNs = 3000000000LL;
struct CodecInfo {
const char *mime;
@@ -2325,9 +2325,14 @@
{
CODEC_LOGV("OMX_EventPortSettingsChanged(port=%ld, data2=0x%08lx)",
data1, data2);
- CHECK(mFilledBuffers.empty());
if (data2 == 0 || data2 == OMX_IndexParamPortDefinition) {
+ // There is no need to check whether mFilledBuffers is empty or not
+ // when the OMX_EventPortSettingsChanged is not meant for reallocating
+ // the output buffers.
+ if (data1 == kPortIndexOutput) {
+ CHECK(mFilledBuffers.empty());
+ }
onPortSettingsChanged(data1);
} else if (data1 == kPortIndexOutput &&
(data2 == OMX_IndexConfigCommonOutputCrop ||
@@ -3220,7 +3225,7 @@
// for video encoding.
return mBufferFilled.wait(mLock);
}
- status_t err = mBufferFilled.waitRelative(mLock, kBufferFilledEventTimeOutUs);
+ status_t err = mBufferFilled.waitRelative(mLock, kBufferFilledEventTimeOutNs);
if (err != OK) {
CODEC_LOGE("Timed out waiting for output buffers: %d/%d",
countBuffersWeOwn(mPortBuffers[kPortIndexInput]),
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaProfileReader.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaProfileReader.java
index b1ad315..b1d049e 100644
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaProfileReader.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaProfileReader.java
@@ -95,6 +95,25 @@
return audioEncoderMap.get(audioEncoder);
}
+ public static int getMinFrameRateForCodec(int codec) {
+ return getMinOrMaxFrameRateForCodec(codec, false);
+ }
+
+ public static int getMaxFrameRateForCodec(int codec) {
+ return getMinOrMaxFrameRateForCodec(codec, true);
+ }
+
+ private static int getMinOrMaxFrameRateForCodec(int codec, boolean max) {
+ for (VideoEncoderCap cap: videoEncoders) {
+ if (cap.mCodec == codec) {
+ if (max) return cap.mMaxFrameRate;
+ else return cap.mMinFrameRate;
+ }
+ }
+ // Should never reach here
+ throw new IllegalArgumentException("Unsupported video codec " + codec);
+ }
+
private MediaProfileReader() {} // Don't call me
private static void initVideoEncoderMap() {
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaRecorderTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaRecorderTest.java
index 82df6690..796b52c 100644
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaRecorderTest.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaRecorderTest.java
@@ -247,7 +247,9 @@
mCamera.unlock();
mRecorder.setCamera(mCamera);
Thread.sleep(1000);
- recordVideo(15, 352, 288, MediaRecorder.VideoEncoder.H263,
+ int codec = MediaRecorder.VideoEncoder.H263;
+ int frameRate = MediaProfileReader.getMaxFrameRateForCodec(codec);
+ recordVideo(frameRate, 352, 288, codec,
MediaRecorder.OutputFormat.THREE_GPP,
MediaNames.RECORDED_PORTRAIT_H263, true);
mCamera.lock();
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/performance/MediaPlayerPerformance.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/performance/MediaPlayerPerformance.java
index 0f79515..0b887b9 100644
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/performance/MediaPlayerPerformance.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/performance/MediaPlayerPerformance.java
@@ -365,16 +365,6 @@
assertTrue("H264 playback memory test", memoryResult);
}
- private int getMaxFrameRateForVideoEncoder(int codec) {
- int frameRate = -1;
- for (VideoEncoderCap cap: videoEncoders) {
- if (cap.mCodec == MediaRecorder.VideoEncoder.H263) {
- frameRate = cap.mMaxFrameRate;
- }
- }
- return frameRate;
- }
-
// Test case 4: Capture the memory usage after every 20 video only recorded
@LargeTest
public void testH263RecordVideoOnlyMemoryUsage() throws Exception {
@@ -384,7 +374,7 @@
File videoH263RecordOnlyMemoryOut = new File(MEDIA_MEMORY_OUTPUT);
Writer output = new BufferedWriter(new FileWriter(videoH263RecordOnlyMemoryOut, true));
output.write("H263 video record only\n");
- int frameRate = getMaxFrameRateForVideoEncoder(MediaRecorder.VideoEncoder.H263);
+ int frameRate = MediaProfileReader.getMaxFrameRateForCodec(MediaRecorder.VideoEncoder.H263);
assertTrue("H263 video recording frame rate", frameRate != -1);
for (int i = 0; i < NUM_STRESS_LOOP; i++) {
assertTrue(stressVideoRecord(frameRate, 352, 288, MediaRecorder.VideoEncoder.H263,
@@ -406,7 +396,7 @@
File videoMp4RecordOnlyMemoryOut = new File(MEDIA_MEMORY_OUTPUT);
Writer output = new BufferedWriter(new FileWriter(videoMp4RecordOnlyMemoryOut, true));
output.write("MPEG4 video record only\n");
- int frameRate = getMaxFrameRateForVideoEncoder(MediaRecorder.VideoEncoder.MPEG_4_SP);
+ int frameRate = MediaProfileReader.getMaxFrameRateForCodec(MediaRecorder.VideoEncoder.MPEG_4_SP);
assertTrue("MPEG4 video recording frame rate", frameRate != -1);
for (int i = 0; i < NUM_STRESS_LOOP; i++) {
assertTrue(stressVideoRecord(frameRate, 352, 288, MediaRecorder.VideoEncoder.MPEG_4_SP,
@@ -428,7 +418,7 @@
File videoRecordAudioMemoryOut = new File(MEDIA_MEMORY_OUTPUT);
Writer output = new BufferedWriter(new FileWriter(videoRecordAudioMemoryOut, true));
- int frameRate = getMaxFrameRateForVideoEncoder(MediaRecorder.VideoEncoder.H263);
+ int frameRate = MediaProfileReader.getMaxFrameRateForCodec(MediaRecorder.VideoEncoder.H263);
assertTrue("H263 video recording frame rate", frameRate != -1);
output.write("Audio and h263 video record\n");
for (int i = 0; i < NUM_STRESS_LOOP; i++) {
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/MediaRecorderStressTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/MediaRecorderStressTest.java
index ae0589c..e6177ba 100644
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/MediaRecorderStressTest.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/MediaRecorderStressTest.java
@@ -205,7 +205,7 @@
mRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
mRecorder.setOutputFile(filename);
- mRecorder.setVideoFrameRate(20);
+ mRecorder.setVideoFrameRate(MediaRecorderStressTestRunner.mFrameRate);
mRecorder.setVideoSize(176,144);
Log.v(TAG, "setEncoder");
mRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H263);
@@ -269,7 +269,7 @@
mRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
mRecorder.setOutputFile(filename);
- mRecorder.setVideoFrameRate(20);
+ mRecorder.setVideoFrameRate(MediaRecorderStressTestRunner.mFrameRate);
mRecorder.setVideoSize(176,144);
Log.v(TAG, "Media recorder setEncoder");
mRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H263);
diff --git a/policy/src/com/android/internal/policy/impl/KeyguardViewManager.java b/policy/src/com/android/internal/policy/impl/KeyguardViewManager.java
index 337881f..cbf1c90 100644
--- a/policy/src/com/android/internal/policy/impl/KeyguardViewManager.java
+++ b/policy/src/com/android/internal/policy/impl/KeyguardViewManager.java
@@ -24,6 +24,7 @@
import android.content.res.Resources;
import android.graphics.PixelFormat;
import android.graphics.Canvas;
+import android.os.SystemProperties;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
@@ -100,7 +101,9 @@
if (DEBUG) Log.d(TAG, "show(); mKeyguardView==" + mKeyguardView);
Resources res = mContext.getResources();
- boolean enableScreenRotation = res.getBoolean(R.bool.config_enableLockScreenRotation);
+ boolean enableScreenRotation =
+ SystemProperties.getBoolean("lockscreen.rot_override",false)
+ || res.getBoolean(R.bool.config_enableLockScreenRotation);
if (mKeyguardHost == null) {
if (DEBUG) Log.d(TAG, "keyguard host is null, creating it...");
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index d6d3b9d..41af137 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -3327,20 +3327,28 @@
boolean didSomething = killPackageProcessesLocked(name, uid, -100,
callerWillRestart, false, doit, evenPersistent);
- for (i=mMainStack.mHistory.size()-1; i>=0; i--) {
+ TaskRecord lastTask = null;
+ for (i=0; i<mMainStack.mHistory.size(); i++) {
ActivityRecord r = (ActivityRecord)mMainStack.mHistory.get(i);
- if (r.packageName.equals(name)
+ final boolean samePackage = r.packageName.equals(name);
+ if ((samePackage || r.task == lastTask)
&& (r.app == null || evenPersistent || !r.app.persistent)) {
if (!doit) {
return true;
}
didSomething = true;
Slog.i(TAG, " Force finishing activity " + r);
- if (r.app != null) {
- r.app.removed = true;
+ if (samePackage) {
+ if (r.app != null) {
+ r.app.removed = true;
+ }
+ r.app = null;
}
- r.app = null;
- r.stack.finishActivityLocked(r, i, Activity.RESULT_CANCELED, null, "uninstall");
+ lastTask = r.task;
+ if (r.stack.finishActivityLocked(r, i, Activity.RESULT_CANCELED,
+ null, "force-stop")) {
+ i--;
+ }
}
}
diff --git a/wifi/java/android/net/wifi/WifiWatchdogStateMachine.java b/wifi/java/android/net/wifi/WifiWatchdogStateMachine.java
index c52142d..fe0e850 100644
--- a/wifi/java/android/net/wifi/WifiWatchdogStateMachine.java
+++ b/wifi/java/android/net/wifi/WifiWatchdogStateMachine.java
@@ -77,15 +77,15 @@
/**
* Low signal is defined as less than or equal to cut off
*/
- private static final int LOW_SIGNAL_CUTOFF = 1;
+ private static final int LOW_SIGNAL_CUTOFF = 0;
private static final long DEFAULT_DNS_CHECK_SHORT_INTERVAL_MS = 2 * 60 * 1000;
- private static final long DEFAULT_DNS_CHECK_LONG_INTERVAL_MS = 30 * 60 * 1000;
+ private static final long DEFAULT_DNS_CHECK_LONG_INTERVAL_MS = 60 * 60 * 1000;
private static final long DEFAULT_WALLED_GARDEN_INTERVAL_MS = 30 * 60 * 1000;
private static final int DEFAULT_MAX_SSID_BLACKLISTS = 7;
- private static final int DEFAULT_NUM_DNS_PINGS = 15; // Multiple pings to detect setup issues
- private static final int DEFAULT_MIN_DNS_RESPONSES = 3;
+ private static final int DEFAULT_NUM_DNS_PINGS = 5; // Multiple pings to detect setup issues
+ private static final int DEFAULT_MIN_DNS_RESPONSES = 1;
private static final int DEFAULT_DNS_PING_TIMEOUT_MS = 2000;
@@ -95,7 +95,9 @@
private static final String DEFAULT_WALLED_GARDEN_URL =
"http://clients3.google.com/generate_204";
private static final int WALLED_GARDEN_SOCKET_TIMEOUT_MS = 10000;
- private static final int DNS_INTRATEST_PING_INTERVAL = 200; // Long delay to detect setup issues
+ private static final int DNS_INTRATEST_PING_INTERVAL_MS = 200;
+ /* With some router setups, it takes a few hunder milli-seconds before connection is active */
+ private static final int DNS_START_DELAY_MS = 1000;
private static final int BASE = Protocol.BASE_WIFI_WATCHDOG;
@@ -677,7 +679,7 @@
for (int i=0; i < mNumDnsPings; i++) {
for (int j = 0; j < numDnses; j++) {
idDnsMap.put(mDnsPinger.pingDnsAsync(mDnsList.get(j), mDnsPingTimeoutMs,
- DNS_INTRATEST_PING_INTERVAL * i), j);
+ DNS_START_DELAY_MS + DNS_INTRATEST_PING_INTERVAL_MS * i), j);
}
}
}
diff --git a/wifi/java/android/net/wifi/p2p/WifiP2pService.java b/wifi/java/android/net/wifi/p2p/WifiP2pService.java
index e2b2249..2f7b927 100644
--- a/wifi/java/android/net/wifi/p2p/WifiP2pService.java
+++ b/wifi/java/android/net/wifi/p2p/WifiP2pService.java
@@ -132,6 +132,9 @@
/* User rejected to disable Wi-Fi in order to enable p2p */
private static final int WIFI_DISABLE_USER_REJECT = BASE + 5;
+ /* Airplane mode changed */
+ private static final int AIRPLANE_MODE_CHANGED = BASE + 6;
+
private final boolean mP2pSupported;
private final String mDeviceType;
private String mDeviceName;
@@ -168,6 +171,7 @@
// broadcasts
IntentFilter filter = new IntentFilter();
filter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION);
+ filter.addAction(Intent.ACTION_AIRPLANE_MODE_CHANGED);
filter.addAction(WifiManager.WIFI_AP_STATE_CHANGED_ACTION);
mContext.registerReceiver(new WifiStateReceiver(), filter);
@@ -187,6 +191,8 @@
} else if (intent.getAction().equals(WifiManager.WIFI_AP_STATE_CHANGED_ACTION)) {
mWifiApState = intent.getIntExtra(WifiManager.EXTRA_WIFI_AP_STATE,
WifiManager.WIFI_AP_STATE_DISABLED);
+ } else if (intent.getAction().equals(Intent.ACTION_AIRPLANE_MODE_CHANGED)) {
+ mP2pStateMachine.sendMessage(AIRPLANE_MODE_CHANGED);
}
}
}
@@ -352,7 +358,10 @@
case WifiP2pManager.REQUEST_GROUP_INFO:
replyToMessage(message, WifiP2pManager.RESPONSE_GROUP_INFO, mGroup);
break;
- // Ignore
+ case AIRPLANE_MODE_CHANGED:
+ if (isAirplaneModeOn()) sendMessage(WifiP2pManager.DISABLE_P2P);
+ break;
+ // Ignore
case WIFI_DISABLE_USER_ACCEPT:
case WIFI_DISABLE_USER_REJECT:
case GROUP_NEGOTIATION_TIMED_OUT:
@@ -1266,5 +1275,17 @@
}
}
+ private boolean isAirplaneSensitive() {
+ String airplaneModeRadios = Settings.System.getString(mContext.getContentResolver(),
+ Settings.System.AIRPLANE_MODE_RADIOS);
+ return airplaneModeRadios == null
+ || airplaneModeRadios.contains(Settings.System.RADIO_WIFI);
+ }
+
+ private boolean isAirplaneModeOn() {
+ return isAirplaneSensitive() && Settings.System.getInt(mContext.getContentResolver(),
+ Settings.System.AIRPLANE_MODE_ON, 0) == 1;
+ }
+
}
}