Merge "Port ImageProcessing to Filterscript." into jb-mr1-dev
diff --git a/api/17.txt b/api/17.txt
index 7b2f161..ee9a973 100644
--- a/api/17.txt
+++ b/api/17.txt
@@ -29625,7 +29625,6 @@
method protected void onTextChanged(java.lang.CharSequence, int, int, int);
method public boolean onTextContextMenuItem(int);
method public void removeTextChangedListener(android.text.TextWatcher);
- method protected void resetResolvedDrawables();
method public void setAllCaps(boolean);
method public final void setAutoLinkMask(int);
method public void setCompoundDrawablePadding(int);
diff --git a/api/current.txt b/api/current.txt
index 7b2f161..ee9a973 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -29625,7 +29625,6 @@
method protected void onTextChanged(java.lang.CharSequence, int, int, int);
method public boolean onTextContextMenuItem(int);
method public void removeTextChangedListener(android.text.TextWatcher);
- method protected void resetResolvedDrawables();
method public void setAllCaps(boolean);
method public final void setAutoLinkMask(int);
method public void setCompoundDrawablePadding(int);
diff --git a/core/java/android/os/FileUtils.java b/core/java/android/os/FileUtils.java
index 0941d71..2bec1c1 100644
--- a/core/java/android/os/FileUtils.java
+++ b/core/java/android/os/FileUtils.java
@@ -16,6 +16,7 @@
package android.os;
+import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
@@ -91,7 +92,7 @@
}
return result;
}
-
+
/**
* Copy data from a source stream to destFile.
* Return true if succeed, return false if failed.
@@ -143,12 +144,16 @@
*/
public static String readTextFile(File file, int max, String ellipsis) throws IOException {
InputStream input = new FileInputStream(file);
+ // wrapping a BufferedInputStream around it because when reading /proc with unbuffered
+ // input stream, bytes read not equal to buffer size is not necessarily the correct
+ // indication for EOF; but it is true for BufferedInputStream due to its implementation.
+ BufferedInputStream bis = new BufferedInputStream(input);
try {
long size = file.length();
if (max > 0 || (size > 0 && max == 0)) { // "head" mode: read the first N bytes
if (size > 0 && (max == 0 || size < max)) max = (int) size;
byte[] data = new byte[max + 1];
- int length = input.read(data);
+ int length = bis.read(data);
if (length <= 0) return "";
if (length <= max) return new String(data, 0, length);
if (ellipsis == null) return new String(data, 0, max);
@@ -161,7 +166,7 @@
if (last != null) rolled = true;
byte[] tmp = last; last = data; data = tmp;
if (data == null) data = new byte[-max];
- len = input.read(data);
+ len = bis.read(data);
} while (len == data.length);
if (last == null && len <= 0) return "";
@@ -178,12 +183,13 @@
int len;
byte[] data = new byte[1024];
do {
- len = input.read(data);
+ len = bis.read(data);
if (len > 0) contents.write(data, 0, len);
} while (len == data.length);
return contents.toString();
}
} finally {
+ bis.close();
input.close();
}
}
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 608bdd7..946965b 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -3666,15 +3666,10 @@
// Padding from the background drawable is stored at this point in mUserPaddingLeftInitial
// and mUserPaddingRightInitial) so drawable padding will be used as ultimate default if
// defined.
- if (startPaddingDefined) {
- mUserPaddingLeftInitial = startPadding;
- } else if (leftPaddingDefined) {
+ if (leftPaddingDefined) {
mUserPaddingLeftInitial = leftPadding;
}
- if (endPaddingDefined) {
- mUserPaddingRightInitial = endPadding;
- }
- else if (rightPaddingDefined) {
+ if (rightPaddingDefined) {
mUserPaddingRightInitial = rightPadding;
}
}
@@ -11559,8 +11554,10 @@
/**
* Resolve all RTL related properties.
+ *
+ * @hide
*/
- void resolveRtlPropertiesIfNeeded() {
+ public void resolveRtlPropertiesIfNeeded() {
if (!needRtlPropertiesResolution()) return;
// Order is important here: LayoutDirection MUST be resolved first
@@ -11584,8 +11581,12 @@
onRtlPropertiesChanged(getLayoutDirection());
}
- // Reset resolution of all RTL related properties.
- void resetRtlProperties() {
+ /**
+ * Reset resolution of all RTL related properties.
+ *
+ * @hide
+ */
+ public void resetRtlProperties() {
resetResolvedLayoutDirection();
resetResolvedTextDirection();
resetResolvedTextAlignment();
@@ -14195,7 +14196,7 @@
*
* @hide
*/
- public void resolveDrawables() {
+ protected void resolveDrawables() {
if (mBackground != null) {
mBackground.setLayoutDirection(getLayoutDirection());
}
@@ -14218,7 +14219,10 @@
public void onResolveDrawables(int layoutDirection) {
}
- private void resetResolvedDrawables() {
+ /**
+ * @hide
+ */
+ protected void resetResolvedDrawables() {
mPrivateFlags2 &= ~PFLAG2_DRAWABLE_RESOLVED;
}
@@ -14804,14 +14808,14 @@
if (isRtlCompatibilityMode()) {
mPaddingLeft = mUserPaddingLeftInitial;
mPaddingRight = mUserPaddingRightInitial;
+ return;
+ }
+ if (isLayoutRtl()) {
+ mPaddingLeft = (mUserPaddingEnd >= 0) ? mUserPaddingEnd : mUserPaddingLeftInitial;
+ mPaddingRight = (mUserPaddingStart >= 0) ? mUserPaddingStart : mUserPaddingRightInitial;
} else {
- if (isLayoutRtl()) {
- mPaddingLeft = mUserPaddingRightInitial;
- mPaddingRight = mUserPaddingLeftInitial;
- } else {
- mPaddingLeft = mUserPaddingLeftInitial;
- mPaddingRight = mUserPaddingRightInitial;
- }
+ mPaddingLeft = (mUserPaddingStart >= 0) ? mUserPaddingStart : mUserPaddingLeftInitial;
+ mPaddingRight = (mUserPaddingEnd >= 0) ? mUserPaddingEnd : mUserPaddingRightInitial;
}
}
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index 0661992..9ce7df9 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -5263,6 +5263,21 @@
* @hide
*/
@Override
+ public void resolveRtlPropertiesIfNeeded() {
+ super.resolveRtlPropertiesIfNeeded();
+ int count = getChildCount();
+ for (int i = 0; i < count; i++) {
+ final View child = getChildAt(i);
+ if (child.isLayoutDirectionInherited()) {
+ child.resolveRtlPropertiesIfNeeded();
+ }
+ }
+ }
+
+ /**
+ * @hide
+ */
+ @Override
public boolean resolveLayoutDirection() {
final boolean result = super.resolveLayoutDirection();
if (result) {
@@ -5317,6 +5332,51 @@
* @hide
*/
@Override
+ public void resolvePadding() {
+ super.resolvePadding();
+ int count = getChildCount();
+ for (int i = 0; i < count; i++) {
+ final View child = getChildAt(i);
+ if (child.isLayoutDirectionInherited()) {
+ child.resolvePadding();
+ }
+ }
+ }
+
+ /**
+ * @hide
+ */
+ @Override
+ protected void resolveDrawables() {
+ super.resolveDrawables();
+ int count = getChildCount();
+ for (int i = 0; i < count; i++) {
+ final View child = getChildAt(i);
+ if (child.isLayoutDirectionInherited()) {
+ child.resolveDrawables();
+ }
+ }
+ }
+
+ /**
+ * @hide
+ */
+ @Override
+ public void resetRtlProperties() {
+ super.resetRtlProperties();
+ int count = getChildCount();
+ for (int i = 0; i < count; i++) {
+ final View child = getChildAt(i);
+ if (child.isLayoutDirectionInherited()) {
+ child.resetRtlProperties();
+ }
+ }
+ }
+
+ /**
+ * @hide
+ */
+ @Override
public void resetResolvedLayoutDirection() {
super.resetResolvedLayoutDirection();
@@ -5362,6 +5422,38 @@
}
/**
+ * @hide
+ */
+ @Override
+ public void resetResolvedPadding() {
+ super.resetResolvedPadding();
+
+ int count = getChildCount();
+ for (int i = 0; i < count; i++) {
+ final View child = getChildAt(i);
+ if (child.isLayoutDirectionInherited()) {
+ child.resetResolvedPadding();
+ }
+ }
+ }
+
+ /**
+ * @hide
+ */
+ @Override
+ protected void resetResolvedDrawables() {
+ super.resetResolvedDrawables();
+
+ int count = getChildCount();
+ for (int i = 0; i < count; i++) {
+ final View child = getChildAt(i);
+ if (child.isLayoutDirectionInherited()) {
+ child.resetResolvedDrawables();
+ }
+ }
+ }
+
+ /**
* Return true if the pressed state should be delayed for children or descendants of this
* ViewGroup. Generally, this should be done for containers that can scroll, such as a List.
* This prevents the pressed state from appearing when the user is actually trying to scroll
diff --git a/core/java/android/widget/CheckedTextView.java b/core/java/android/widget/CheckedTextView.java
index e74e37c..de8b80d 100644
--- a/core/java/android/widget/CheckedTextView.java
+++ b/core/java/android/widget/CheckedTextView.java
@@ -188,10 +188,11 @@
resetPaddingToInitialValues();
int newPadding = (mCheckMarkDrawable != null) ?
mCheckMarkWidth + mBasePadding : mBasePadding;
- mNeedRequestlayout |= (mPaddingRight != newPadding);
if (isLayoutRtl()) {
+ mNeedRequestlayout |= (mPaddingLeft != newPadding);
mPaddingLeft = newPadding;
} else {
+ mNeedRequestlayout |= (mPaddingRight != newPadding);
mPaddingRight = newPadding;
}
if (mNeedRequestlayout) {
@@ -200,18 +201,6 @@
}
}
- @Override
- public void setPadding(int left, int top, int right, int bottom) {
- super.setPadding(left, top, right, bottom);
- setBasePadding(isLayoutRtl());
- }
-
- @Override
- public void setPaddingRelative(int start, int top, int end, int bottom) {
- super.setPaddingRelative(start, top, end, bottom);
- setBasePadding(isLayoutRtl());
- }
-
private void setBasePadding(boolean isLayoutRtl) {
if (isLayoutRtl) {
mBasePadding = mPaddingLeft;
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 958b669..b3c679c 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -8314,6 +8314,9 @@
}
}
+ /**
+ * @hide
+ */
protected void resetResolvedDrawables() {
mResolvedDrawables = false;
}
diff --git a/core/java/com/android/internal/widget/RotarySelector.java b/core/java/com/android/internal/widget/RotarySelector.java
index a2a38dc..4e405f4 100644
--- a/core/java/com/android/internal/widget/RotarySelector.java
+++ b/core/java/com/android/internal/widget/RotarySelector.java
@@ -25,7 +25,9 @@
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.graphics.drawable.Drawable;
+import android.os.UserHandle;
import android.os.Vibrator;
+import android.provider.Settings;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
@@ -667,11 +669,16 @@
* Triggers haptic feedback.
*/
private synchronized void vibrate(long duration) {
- if (mVibrator == null) {
- mVibrator = (android.os.Vibrator)
- getContext().getSystemService(Context.VIBRATOR_SERVICE);
+ final boolean hapticEnabled = Settings.System.getIntForUser(
+ mContext.getContentResolver(), Settings.System.HAPTIC_FEEDBACK_ENABLED, 1,
+ UserHandle.USER_CURRENT) != 0;
+ if (hapticEnabled) {
+ if (mVibrator == null) {
+ mVibrator = (android.os.Vibrator) getContext()
+ .getSystemService(Context.VIBRATOR_SERVICE);
+ }
+ mVibrator.vibrate(duration);
}
- mVibrator.vibrate(duration);
}
/**
diff --git a/core/java/com/android/internal/widget/SlidingTab.java b/core/java/com/android/internal/widget/SlidingTab.java
index f535a08..aebc4f6 100644
--- a/core/java/com/android/internal/widget/SlidingTab.java
+++ b/core/java/com/android/internal/widget/SlidingTab.java
@@ -21,7 +21,9 @@
import android.content.res.TypedArray;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
+import android.os.UserHandle;
import android.os.Vibrator;
+import android.provider.Settings;
import android.util.AttributeSet;
import android.util.Log;
import android.view.Gravity;
@@ -811,11 +813,16 @@
* Triggers haptic feedback.
*/
private synchronized void vibrate(long duration) {
- if (mVibrator == null) {
- mVibrator = (android.os.Vibrator)
- getContext().getSystemService(Context.VIBRATOR_SERVICE);
+ final boolean hapticEnabled = Settings.System.getIntForUser(
+ mContext.getContentResolver(), Settings.System.HAPTIC_FEEDBACK_ENABLED, 1,
+ UserHandle.USER_CURRENT) != 0;
+ if (hapticEnabled) {
+ if (mVibrator == null) {
+ mVibrator = (android.os.Vibrator) getContext()
+ .getSystemService(Context.VIBRATOR_SERVICE);
+ }
+ mVibrator.vibrate(duration);
}
- mVibrator.vibrate(duration);
}
/**
diff --git a/core/java/com/android/internal/widget/WaveView.java b/core/java/com/android/internal/widget/WaveView.java
index 2d89234..d33d50c 100644
--- a/core/java/com/android/internal/widget/WaveView.java
+++ b/core/java/com/android/internal/widget/WaveView.java
@@ -25,7 +25,9 @@
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.drawable.BitmapDrawable;
+import android.os.UserHandle;
import android.os.Vibrator;
+import android.provider.Settings;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Log;
@@ -573,11 +575,16 @@
* Triggers haptic feedback.
*/
private synchronized void vibrate(long duration) {
- if (mVibrator == null) {
- mVibrator = (android.os.Vibrator)
- getContext().getSystemService(Context.VIBRATOR_SERVICE);
+ final boolean hapticEnabled = Settings.System.getIntForUser(
+ mContext.getContentResolver(), Settings.System.HAPTIC_FEEDBACK_ENABLED, 1,
+ UserHandle.USER_CURRENT) != 0;
+ if (hapticEnabled) {
+ if (mVibrator == null) {
+ mVibrator = (android.os.Vibrator) getContext()
+ .getSystemService(Context.VIBRATOR_SERVICE);
+ }
+ mVibrator.vibrate(duration);
}
- mVibrator.vibrate(duration);
}
/**
diff --git a/core/java/com/android/internal/widget/multiwaveview/GlowPadView.java b/core/java/com/android/internal/widget/multiwaveview/GlowPadView.java
index f507a79..0f49776 100644
--- a/core/java/com/android/internal/widget/multiwaveview/GlowPadView.java
+++ b/core/java/com/android/internal/widget/multiwaveview/GlowPadView.java
@@ -31,7 +31,9 @@
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
+import android.os.UserHandle;
import android.os.Vibrator;
+import android.provider.Settings;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Log;
@@ -543,7 +545,10 @@
}
private void vibrate() {
- if (mVibrator != null) {
+ final boolean hapticEnabled = Settings.System.getIntForUser(
+ mContext.getContentResolver(), Settings.System.HAPTIC_FEEDBACK_ENABLED, 1,
+ UserHandle.USER_CURRENT) != 0;
+ if (mVibrator != null && hapticEnabled) {
mVibrator.vibrate(mVibrationDuration);
}
}
diff --git a/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java b/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java
index 7990b4c..e22d1e8 100644
--- a/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java
+++ b/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java
@@ -32,7 +32,9 @@
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
+import android.os.UserHandle;
import android.os.Vibrator;
+import android.provider.Settings;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Log;
@@ -593,7 +595,10 @@
}
private void vibrate() {
- if (mVibrator != null) {
+ final boolean hapticEnabled = Settings.System.getIntForUser(
+ mContext.getContentResolver(), Settings.System.HAPTIC_FEEDBACK_ENABLED, 1,
+ UserHandle.USER_CURRENT) != 0;
+ if (mVibrator != null && hapticEnabled) {
mVibrator.vibrate(mVibrationDuration);
}
}
diff --git a/core/res/res/layout/keyguard_emergency_carrier_area.xml b/core/res/res/layout/keyguard_emergency_carrier_area.xml
index c16955c..f9a593f 100644
--- a/core/res/res/layout/keyguard_emergency_carrier_area.xml
+++ b/core/res/res/layout/keyguard_emergency_carrier_area.xml
@@ -23,7 +23,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
- android:gravity="center_horizontal"
+ android:gravity="center"
android:layout_gravity="center_horizontal"
android:layout_alignParentBottom="true">
diff --git a/core/res/res/layout/keyguard_selector_view.xml b/core/res/res/layout/keyguard_selector_view.xml
index 4838c2a..daaf35b 100644
--- a/core/res/res/layout/keyguard_selector_view.xml
+++ b/core/res/res/layout/keyguard_selector_view.xml
@@ -41,10 +41,8 @@
<include layout="@layout/keyguard_emergency_carrier_area"
android:id="@+id/keyguard_selector_fade_container"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:layout_gravity="bottom|center_horizontal"
- android:gravity="center_horizontal" />
+ android:layout_height="48dp"
+ android:layout_gravity="bottom|center_horizontal" />
</FrameLayout>
</com.android.internal.policy.impl.keyguard.KeyguardSelectorView>
diff --git a/packages/FusedLocation/src/com/android/location/fused/FusionEngine.java b/packages/FusedLocation/src/com/android/location/fused/FusionEngine.java
index 2cf795d..87d56fd 100644
--- a/packages/FusedLocation/src/com/android/location/fused/FusionEngine.java
+++ b/packages/FusedLocation/src/com/android/location/fused/FusionEngine.java
@@ -42,16 +42,7 @@
private static final String NETWORK = LocationManager.NETWORK_PROVIDER;
private static final String GPS = LocationManager.GPS_PROVIDER;
- // threshold below which a location is considered stale enough
- // that we shouldn't use its bearing, altitude, speed etc
- private static final double WEIGHT_THRESHOLD = 0.5;
- // accuracy in meters at which a Location's weight is halved (compared to 0 accuracy)
- private static final double ACCURACY_HALFLIFE_M = 20.0;
- // age in seconds at which a Location's weight is halved (compared to 0 age)
- private static final double AGE_HALFLIFE_S = 60.0;
-
- private static final double ACCURACY_DECAY_CONSTANT_M = Math.log(2) / ACCURACY_HALFLIFE_M;
- private static final double AGE_DECAY_CONSTANT_S = Math.log(2) / AGE_HALFLIFE_S;
+ public static final long SWITCH_ON_FRESHNESS_CLIFF_NS = 11 * 1000000000; // 11 seconds
private final Context mContext;
private final LocationManager mLocationManager;
@@ -62,8 +53,6 @@
private Location mFusedLocation;
private Location mGpsLocation;
private Location mNetworkLocation;
- private double mNetworkWeight;
- private double mGpsWeight;
private boolean mEnabled;
private ProviderRequestUnbundled mRequest;
@@ -102,10 +91,6 @@
Log.i(TAG, "engine stopped (" + mContext.getPackageName() + ")");
}
- private boolean isAvailable() {
- return mStats.get(GPS).available || mStats.get(NETWORK).available;
- }
-
/** Called on mLooper thread */
public void enable() {
mEnabled = true;
@@ -130,7 +115,6 @@
public boolean requested;
public long requestTime;
public long minTime;
- public long lastRequestTtff;
@Override
public String toString() {
StringBuilder s = new StringBuilder();
@@ -171,9 +155,6 @@
return;
}
- ProviderStats gpsStats = mStats.get(GPS);
- ProviderStats networkStats = mStats.get(NETWORK);
-
long networkInterval = Long.MAX_VALUE;
long gpsInterval = Long.MAX_VALUE;
for (LocationRequest request : mRequest.getLocationRequests()) {
@@ -209,104 +190,46 @@
}
}
- private static double weighAccuracy(Location loc) {
- double accuracy = loc.getAccuracy();
- return Math.exp(-accuracy * ACCURACY_DECAY_CONSTANT_M);
- }
+ /**
+ * Test whether one location (a) is better to use than another (b).
+ */
+ private static boolean isBetterThan(Location locationA, Location locationB) {
+ if (locationA == null) {
+ return false;
+ }
+ if (locationB == null) {
+ return true;
+ }
+ // A provider is better if the reading is sufficiently newer. Heading
+ // underground can cause GPS to stop reporting fixes. In this case it's
+ // appropriate to revert to cell, even when its accuracy is less.
+ if (locationA.getElapsedRealtimeNanos() > locationB.getElapsedRealtimeNanos() + SWITCH_ON_FRESHNESS_CLIFF_NS) {
+ return true;
+ }
- private static double weighAge(Location loc) {
- long ageSeconds = SystemClock.elapsedRealtimeNanos() - loc.getElapsedRealtimeNanos();
- ageSeconds /= 1000000000L;
- if (ageSeconds < 0) ageSeconds = 0;
- return Math.exp(-ageSeconds * AGE_DECAY_CONSTANT_S);
- }
-
- private double weigh(double gps, double network) {
- return (gps * mGpsWeight) + (network * mNetworkWeight);
- }
-
- private double weigh(double gps, double network, double wrapMin, double wrapMax) {
- // apply aliasing
- double wrapWidth = wrapMax - wrapMin;
- if (gps - network > wrapWidth / 2) network += wrapWidth;
- else if (network - gps > wrapWidth / 2) gps += wrapWidth;
-
- double result = weigh(gps, network);
-
- // remove aliasing
- if (result > wrapMax) result -= wrapWidth;
- return result;
+ // A provider is better if it has better accuracy. Assuming both readings
+ // are fresh (and by that accurate), choose the one with the smaller
+ // accuracy circle.
+ if (!locationA.hasAccuracy()) {
+ return false;
+ }
+ if (!locationB.hasAccuracy()) {
+ return true;
+ }
+ return locationA.getAccuracy() < locationB.getAccuracy();
}
private void updateFusedLocation() {
- // naive fusion
- mNetworkWeight = weighAccuracy(mNetworkLocation) * weighAge(mNetworkLocation);
- mGpsWeight = weighAccuracy(mGpsLocation) * weighAge(mGpsLocation);
- // scale mNetworkWeight and mGpsWeight so that they add to 1
- double totalWeight = mNetworkWeight + mGpsWeight;
- mNetworkWeight /= totalWeight;
- mGpsWeight /= totalWeight;
-
- Location fused = new Location(LocationManager.FUSED_PROVIDER);
- // fuse lat/long
- // assumes the two locations are close enough that earth curvature doesn't matter
- fused.setLatitude(weigh(mGpsLocation.getLatitude(), mNetworkLocation.getLatitude()));
- fused.setLongitude(weigh(mGpsLocation.getLongitude(), mNetworkLocation.getLongitude(),
- -180.0, 180.0));
-
- // fused accuracy
- //TODO: use some real math instead of this crude fusion
- // one suggestion is to fuse in a quadratic manner, eg
- // sqrt(weigh(gpsAcc^2, netAcc^2)).
- // another direction to explore is to consider the difference in the 2
- // locations. If the component locations overlap, the fused accuracy is
- // better than the component accuracies. If they are far apart,
- // the fused accuracy is much worse.
- fused.setAccuracy((float)weigh(mGpsLocation.getAccuracy(), mNetworkLocation.getAccuracy()));
-
- // fused time - now
- fused.setTime(System.currentTimeMillis());
- fused.setElapsedRealtimeNanos(SystemClock.elapsedRealtimeNanos());
-
- // fuse altitude
- if (mGpsLocation.hasAltitude() && !mNetworkLocation.hasAltitude() &&
- mGpsWeight > WEIGHT_THRESHOLD) {
- fused.setAltitude(mGpsLocation.getAltitude()); // use GPS
- } else if (!mGpsLocation.hasAltitude() && mNetworkLocation.hasAltitude() &&
- mNetworkWeight > WEIGHT_THRESHOLD) {
- fused.setAltitude(mNetworkLocation.getAltitude()); // use Network
- } else if (mGpsLocation.hasAltitude() && mNetworkLocation.hasAltitude()) {
- fused.setAltitude(weigh(mGpsLocation.getAltitude(), mNetworkLocation.getAltitude()));
+ // may the best location win!
+ if (isBetterThan(mGpsLocation, mNetworkLocation)) {
+ mFusedLocation = new Location(mGpsLocation);
+ } else {
+ mFusedLocation = new Location(mNetworkLocation);
}
-
- // fuse speed
- if (mGpsLocation.hasSpeed() && !mNetworkLocation.hasSpeed() &&
- mGpsWeight > WEIGHT_THRESHOLD) {
- fused.setSpeed(mGpsLocation.getSpeed()); // use GPS if its not too old
- } else if (!mGpsLocation.hasSpeed() && mNetworkLocation.hasSpeed() &&
- mNetworkWeight > WEIGHT_THRESHOLD) {
- fused.setSpeed(mNetworkLocation.getSpeed()); // use Network
- } else if (mGpsLocation.hasSpeed() && mNetworkLocation.hasSpeed()) {
- fused.setSpeed((float)weigh(mGpsLocation.getSpeed(), mNetworkLocation.getSpeed()));
- }
-
- // fuse bearing
- if (mGpsLocation.hasBearing() && !mNetworkLocation.hasBearing() &&
- mGpsWeight > WEIGHT_THRESHOLD) {
- fused.setBearing(mGpsLocation.getBearing()); // use GPS if its not too old
- } else if (!mGpsLocation.hasBearing() && mNetworkLocation.hasBearing() &&
- mNetworkWeight > WEIGHT_THRESHOLD) {
- fused.setBearing(mNetworkLocation.getBearing()); // use Network
- } else if (mGpsLocation.hasBearing() && mNetworkLocation.hasBearing()) {
- fused.setBearing((float)weigh(mGpsLocation.getBearing(), mNetworkLocation.getBearing(),
- 0.0, 360.0));
- }
-
if (mNetworkLocation != null) {
- fused.setExtraLocation(Location.EXTRA_NO_GPS_LOCATION, mNetworkLocation);
+ mFusedLocation.setExtraLocation(Location.EXTRA_NO_GPS_LOCATION, mNetworkLocation);
}
-
- mFusedLocation = fused;
+ mFusedLocation.setProvider(LocationManager.FUSED_PROVIDER);
mCallback.reportLocation(mFusedLocation);
}
@@ -349,9 +272,9 @@
StringBuilder s = new StringBuilder();
s.append("mEnabled=" + mEnabled).append(' ').append(mRequest).append('\n');
s.append("fused=").append(mFusedLocation).append('\n');
- s.append(String.format("gps %.3f %s\n", mGpsWeight, mGpsLocation));
+ s.append(String.format("gps %s\n", mGpsLocation));
s.append(" ").append(mStats.get(GPS)).append('\n');
- s.append(String.format("net %.3f %s\n", mNetworkWeight, mNetworkLocation));
+ s.append(String.format("net %s\n", mNetworkLocation));
s.append(" ").append(mStats.get(NETWORK)).append('\n');
pw.append(s);
}
diff --git a/packages/SystemUI/res/anim/recent_app_enter.xml b/packages/SystemUI/res/anim/recent_app_enter.xml
deleted file mode 100644
index 4947eee..0000000
--- a/packages/SystemUI/res/anim/recent_app_enter.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2009, 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.
-*/
--->
-
-<!-- Special window zoom animation: this is the element that enters the screen,
- it starts at 200% and scales down. Goes with zoom_exit.xml. -->
-<set xmlns:android="http://schemas.android.com/apk/res/android"
- android:interpolator="@android:anim/decelerate_interpolator">
- <scale android:fromXScale="0.25" android:toXScale="1.0"
- android:fromYScale="0.25" android:toYScale="1.0"
- android:pivotX="0%p" android:pivotY="0%p"
- android:duration="500" />
- <alpha android:fromAlpha="0.0" android:toAlpha="1.0"
- android:duration="500"/>
-</set>
diff --git a/packages/SystemUI/res/anim/recent_app_leave.xml b/packages/SystemUI/res/anim/recent_app_leave.xml
deleted file mode 100644
index 3d83988..0000000
--- a/packages/SystemUI/res/anim/recent_app_leave.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2009, 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.
-*/
--->
-
-<!-- Special window zoom animation: this is the element that enters the screen,
- it starts at 200% and scales down. Goes with zoom_exit.xml. -->
-<set xmlns:android="http://schemas.android.com/apk/res/android"
- android:interpolator="@android:anim/decelerate_interpolator">
- <scale android:fromXScale="1.0" android:toXScale="0.25"
- android:fromYScale="1.0" android:toYScale="0.25"
- android:pivotX="0%p" android:pivotY="0%p"
- android:duration="500" />
- <alpha android:fromAlpha="1.0" android:toAlpha="0.0"
- android:duration="500"/>
-</set>
diff --git a/packages/SystemUI/res/anim/recents_launch_from_launcher_enter.xml b/packages/SystemUI/res/anim/recents_launch_from_launcher_enter.xml
new file mode 100644
index 0000000..73ae9f2
--- /dev/null
+++ b/packages/SystemUI/res/anim/recents_launch_from_launcher_enter.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2012, 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.
+*/
+-->
+
+<set xmlns:android="http://schemas.android.com/apk/res/android"
+ android:detachWallpaper="true"
+ android:shareInterpolator="false"
+ android:zAdjustment="normal">
+ <!--scale android:fromXScale="2.0" android:toXScale="1.0"
+ android:fromYScale="2.0" android:toYScale="1.0"
+ android:interpolator="@android:interpolator/decelerate_cubic"
+ android:fillEnabled="true"
+ android:fillBefore="true" android:fillAfter="true"
+ android:pivotX="50%p" android:pivotY="50%p"
+ android:duration="250" /-->
+ <alpha android:fromAlpha="0.0" android:toAlpha="1.0"
+ android:fillEnabled="true"
+ android:fillBefore="true" android:fillAfter="true"
+ android:interpolator="@android:interpolator/decelerate_cubic"
+ android:duration="250"/>
+</set>
diff --git a/packages/SystemUI/res/anim/recents_launch_from_launcher_exit.xml b/packages/SystemUI/res/anim/recents_launch_from_launcher_exit.xml
new file mode 100644
index 0000000..becc9d0
--- /dev/null
+++ b/packages/SystemUI/res/anim/recents_launch_from_launcher_exit.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2012, 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.
+*/
+-->
+
+<set xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shareInterpolator="false"
+ android:zAdjustment="normal">
+ <alpha android:fromAlpha="1.0" android:toAlpha="0.0"
+ android:fillEnabled="true"
+ android:fillBefore="true" android:fillAfter="true"
+ android:interpolator="@android:interpolator/decelerate_cubic"
+ android:duration="250"/>
+</set>
diff --git a/packages/SystemUI/res/anim/recents_return_to_launcher_enter.xml b/packages/SystemUI/res/anim/recents_return_to_launcher_enter.xml
new file mode 100644
index 0000000..efa9019
--- /dev/null
+++ b/packages/SystemUI/res/anim/recents_return_to_launcher_enter.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2012, 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.
+*/
+-->
+
+<set xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shareInterpolator="false"
+ android:zAdjustment="normal">
+ <alpha android:fromAlpha="0.0" android:toAlpha="1.0"
+ android:interpolator="@android:interpolator/decelerate_cubic"
+ android:duration="250"/>
+</set>
diff --git a/packages/SystemUI/res/anim/recents_return_to_launcher_exit.xml b/packages/SystemUI/res/anim/recents_return_to_launcher_exit.xml
new file mode 100644
index 0000000..e95e667
--- /dev/null
+++ b/packages/SystemUI/res/anim/recents_return_to_launcher_exit.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2012, 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.
+*/
+-->
+
+<set xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shareInterpolator="false"
+ android:zAdjustment="normal">
+ <!--scale android:fromXScale="1.0" android:toXScale="2.0"
+ android:fromYScale="1.0" android:toYScale="2.0"
+ android:interpolator="@android:interpolator/decelerate_cubic"
+ android:pivotX="50%p" android:pivotY="50%p"
+ android:duration="250" /-->
+ <alpha android:fromAlpha="1.0" android:toAlpha="0.0"
+ android:interpolator="@android:interpolator/decelerate_cubic"
+ android:duration="250"/>
+</set>
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index 4bf6c10..4de0891 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -52,7 +52,7 @@
<dimen name="status_bar_recents_item_padding">0dip</dimen>
<!-- When recents first appears, how far the icon and label of the primary activity
travel -->
- <dimen name="status_bar_recents_app_icon_translate_distance">100dp</dimen>
+ <dimen name="status_bar_recents_app_icon_translate_distance">35dip</dimen>
<!-- Where to place the app icon over the thumbnail -->
<dimen name="status_bar_recents_app_icon_left_margin">0dp</dimen>
diff --git a/packages/SystemUI/src/com/android/systemui/SearchPanelView.java b/packages/SystemUI/src/com/android/systemui/SearchPanelView.java
index f71f554..bc61ab0 100644
--- a/packages/SystemUI/src/com/android/systemui/SearchPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/SearchPanelView.java
@@ -184,8 +184,8 @@
private void vibrate() {
Context context = getContext();
- if (Settings.System.getInt(context.getContentResolver(),
- Settings.System.HAPTIC_FEEDBACK_ENABLED, 1) != 0) {
+ if (Settings.System.getIntForUser(context.getContentResolver(),
+ Settings.System.HAPTIC_FEEDBACK_ENABLED, 1, UserHandle.USER_CURRENT) != 0) {
Resources res = context.getResources();
Vibrator vibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
vibrator.vibrate(res.getInteger(R.integer.config_search_panel_view_vibration_duration));
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsActivity.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsActivity.java
index 79069b8..ef9f36e 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsActivity.java
@@ -18,6 +18,7 @@
import android.app.Activity;
import android.app.ActivityManager;
+import android.app.WallpaperManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@@ -26,6 +27,7 @@
import android.os.UserHandle;
import android.view.MotionEvent;
import android.view.View;
+import android.view.WindowManager;
import com.android.systemui.R;
import com.android.systemui.SystemUIApplication;
@@ -42,6 +44,7 @@
private IntentFilter mIntentFilter;
private boolean mShowing;
private boolean mForeground;
+
private BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
@@ -79,6 +82,9 @@
@Override
public void onPause() {
+ overridePendingTransition(
+ R.anim.recents_return_to_launcher_enter,
+ R.anim.recents_return_to_launcher_exit);
mForeground = false;
super.onPause();
}
@@ -92,8 +98,23 @@
super.onStop();
}
+ private void updateWallpaperVisibility(boolean visible) {
+ int wpflags = visible ? WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER : 0;
+ int curflags = getWindow().getAttributes().flags
+ & WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
+ if (wpflags != curflags) {
+ getWindow().setFlags(wpflags, WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER);
+ }
+ }
+
@Override
public void onStart() {
+ // Hide wallpaper if it's not a static image
+ if (WallpaperManager.getInstance(this).getWallpaperInfo() != null) {
+ updateWallpaperVisibility(false);
+ } else {
+ updateWallpaperVisibility(true);
+ }
mShowing = true;
if (mRecentsPanel != null) {
mRecentsPanel.refreshViews();
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
index 8607508..57d2ed3 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
@@ -520,7 +520,7 @@
public void onWindowAnimationStart() {
if (mItemToAnimateInWhenWindowAnimationIsFinished != null) {
- final int startDelay = 100;
+ final int startDelay = 150;
final int duration = 250;
final ViewHolder holder = mItemToAnimateInWhenWindowAnimationIsFinished;
final TimeInterpolator cubic = new DecelerateInterpolator(1.5f);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index 3e929d6..577b1f4 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -485,7 +485,11 @@
| Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
if (firstTask == null) {
- mContext.startActivityAsUser(intent, new UserHandle(UserHandle.USER_CURRENT));
+ ActivityOptions opts = ActivityOptions.makeCustomAnimation(mContext,
+ R.anim.recents_launch_from_launcher_enter,
+ R.anim.recents_launch_from_launcher_exit);
+ mContext.startActivityAsUser(intent, opts.toBundle(), new UserHandle(
+ UserHandle.USER_CURRENT));
} else {
Bitmap first = firstTask.getThumbnail();
final Resources res = mContext.getResources();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java
index 8c390c8..faf20e2 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java
@@ -754,6 +754,7 @@
mBrightnessDialog.setCanceledOnTouchOutside(true);
mBrightnessController = new BrightnessController(mContext,
+ (ImageView) mBrightnessDialog.findViewById(R.id.brightness_icon),
(ToggleSlider) mBrightnessDialog.findViewById(R.id.brightness_slider));
mBrightnessController.addStateChangedCallback(mModel);
mBrightnessDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BrightnessController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BrightnessController.java
index 0009503..e18b28a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BrightnessController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BrightnessController.java
@@ -28,6 +28,7 @@
import android.util.Slog;
import android.view.IWindowManager;
import android.widget.CompoundButton;
+import android.widget.ImageView;
import com.android.systemui.statusbar.policy.BatteryController.BatteryStateChangeCallback;
@@ -40,6 +41,7 @@
private final int mMaximumBacklight;
private final Context mContext;
+ private final ImageView mIcon;
private final ToggleSlider mControl;
private final boolean mAutomaticAvailable;
private final IPowerManager mPower;
@@ -52,8 +54,9 @@
public void onBrightnessLevelChanged();
}
- public BrightnessController(Context context, ToggleSlider control) {
+ public BrightnessController(Context context, ImageView icon, ToggleSlider control) {
mContext = context;
+ mIcon = icon;
mControl = control;
mUserTracker = new CurrentUserTracker(mContext);
@@ -84,8 +87,10 @@
automatic = 0;
}
control.setChecked(automatic != 0);
+ updateIcon(automatic != 0);
} else {
control.setChecked(false);
+ updateIcon(false /*automatic*/);
//control.hideToggle();
}
@@ -105,6 +110,7 @@
public void onChanged(ToggleSlider view, boolean tracking, boolean automatic, int value) {
setMode(automatic ? Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC
: Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL);
+ updateIcon(automatic);
if (!automatic) {
final int val = value + mMinimumBacklight;
setBrightness(val);
@@ -136,4 +142,12 @@
} catch (RemoteException ex) {
}
}
+
+ private void updateIcon(boolean automatic) {
+ if (mIcon != null) {
+ mIcon.setImageResource(automatic ?
+ com.android.systemui.R.drawable.ic_qs_brightness_auto_on :
+ com.android.systemui.R.drawable.ic_qs_brightness_auto_off);
+ }
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/SettingsView.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/SettingsView.java
index 194f1f6..f71842e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/SettingsView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/SettingsView.java
@@ -78,6 +78,7 @@
});
mBrightness = new BrightnessController(context,
+ (ImageView)findViewById(R.id.brightness_icon),
(ToggleSlider)findViewById(R.id.brightness));
mDoNotDisturb = new DoNotDisturbController(context,
(CompoundButton)findViewById(R.id.do_not_disturb_checkbox));
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index daed0a2..7132e1e 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -3930,48 +3930,54 @@
removeDyingProviderLocked(null, providers.get(i), true);
}
- if (mIntentSenderRecords.size() > 0) {
- Iterator<WeakReference<PendingIntentRecord>> it
- = mIntentSenderRecords.values().iterator();
- while (it.hasNext()) {
- WeakReference<PendingIntentRecord> wpir = it.next();
- if (wpir == null) {
+ if (name == null) {
+ // Remove pending intents. For now we only do this when force
+ // stopping users, because we have some problems when doing this
+ // for packages -- app widgets are not currently cleaned up for
+ // such packages, so they can be left with bad pending intents.
+ if (mIntentSenderRecords.size() > 0) {
+ Iterator<WeakReference<PendingIntentRecord>> it
+ = mIntentSenderRecords.values().iterator();
+ while (it.hasNext()) {
+ WeakReference<PendingIntentRecord> wpir = it.next();
+ if (wpir == null) {
+ it.remove();
+ continue;
+ }
+ PendingIntentRecord pir = wpir.get();
+ if (pir == null) {
+ it.remove();
+ continue;
+ }
+ if (name == null) {
+ // Stopping user, remove all objects for the user.
+ if (pir.key.userId != userId) {
+ // Not the same user, skip it.
+ continue;
+ }
+ } else {
+ if (UserHandle.getAppId(pir.uid) != appId) {
+ // Different app id, skip it.
+ continue;
+ }
+ if (userId != UserHandle.USER_ALL && pir.key.userId != userId) {
+ // Different user, skip it.
+ continue;
+ }
+ if (!pir.key.packageName.equals(name)) {
+ // Different package, skip it.
+ continue;
+ }
+ }
+ if (!doit) {
+ return true;
+ }
+ didSomething = true;
it.remove();
- continue;
- }
- PendingIntentRecord pir = wpir.get();
- if (pir == null) {
- it.remove();
- continue;
- }
- if (name == null) {
- // Stopping user, remove all objects for the user.
- if (pir.key.userId != userId) {
- // Not the same user, skip it.
- continue;
+ pir.canceled = true;
+ if (pir.key.activity != null) {
+ pir.key.activity.pendingResults.remove(pir.ref);
}
- } else {
- if (UserHandle.getAppId(pir.uid) != appId) {
- // Different app id, skip it.
- continue;
- }
- if (userId != UserHandle.USER_ALL && pir.key.userId != userId) {
- // Different user, skip it.
- continue;
- }
- if (!pir.key.packageName.equals(name)) {
- // Different package, skip it.
- continue;
- }
- }
- if (!doit) {
- return true;
- }
- didSomething = true;
- it.remove();
- pir.canceled = true;
- if (pir.key.activity != null) {
- pir.key.activity.pendingResults.remove(pir.ref);
}
}
}
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Blend.java b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Blend.java
index 2920824..2303fc3 100644
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Blend.java
+++ b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Blend.java
@@ -52,8 +52,10 @@
new AdapterView.OnItemSelectedListener() {
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
currentIntrinsic = pos;
- runTest();
- act.updateDisplay();
+ if (mRS != null) {
+ runTest();
+ act.updateDisplay();
+ }
}
public void onNothingSelected(AdapterView parent) {
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/TestBase.java b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/TestBase.java
index 8009daa..bb3f2f3 100644
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/TestBase.java
+++ b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/TestBase.java
@@ -123,6 +123,7 @@
public void destroy() {
mRS.destroy();
+ mRS = null;
}
public void updateBitmap(Bitmap b) {