Merge "Remove all traces of legacy renderer support in stagefright."
diff --git a/core/java/android/os/StrictMode.java b/core/java/android/os/StrictMode.java
index 8762512..97f015b 100644
--- a/core/java/android/os/StrictMode.java
+++ b/core/java/android/os/StrictMode.java
@@ -106,6 +106,8 @@
private static final String TAG = "StrictMode";
private static final boolean LOG_V = false;
+ private static final boolean IS_USER_BUILD = "user".equals(Build.TYPE);
+
// Only log a duplicate stack trace to the logs every second.
private static final long MIN_LOG_INTERVAL_MS = 1000;
@@ -693,7 +695,7 @@
public static boolean conditionallyEnableDebugLogging() {
// For debug builds, log event loop stalls to dropbox for analysis.
// Similar logic also appears in ActivityThread.java for system apps.
- if ("user".equals(Build.TYPE)) {
+ if (IS_USER_BUILD) {
setCloseGuardEnabled(false);
return false;
}
@@ -1240,6 +1242,11 @@
mContainerState = threadState;
}
+ // Empty constructor for the NO_OP_SPAN
+ protected Span() {
+ mContainerState = null;
+ }
+
/**
* To be called when the critical span is complete (i.e. the
* animation is done animating). This can be called on any
@@ -1286,6 +1293,13 @@
}
}
+ // The no-op span that's used in user builds.
+ private static final Span NO_OP_SPAN = new Span() {
+ public void finish() {
+ // Do nothing.
+ }
+ };
+
/**
* Linked lists of active spans and a freelist.
*
@@ -1327,6 +1341,9 @@
* @hide
*/
public static Span enterCriticalSpan(String name) {
+ if (IS_USER_BUILD) {
+ return NO_OP_SPAN;
+ }
if (name == null || name.isEmpty()) {
throw new IllegalArgumentException("name must be non-null and non-empty");
}
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index ab5ff3d..30b1e5d 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -2893,8 +2893,8 @@
void reportScrollStateChange(int newState) {
if (newState != mLastScrollState) {
if (mOnScrollListener != null) {
- mOnScrollListener.onScrollStateChanged(this, newState);
mLastScrollState = newState;
+ mOnScrollListener.onScrollStateChanged(this, newState);
}
}
}
@@ -3431,12 +3431,13 @@
public void smoothScrollBy(int distance, int duration) {
if (mFlingRunnable == null) {
mFlingRunnable = new FlingRunnable();
- } else {
- mFlingRunnable.endFling();
}
// No sense starting to scroll if we're not going anywhere
if (distance != 0) {
+ reportScrollStateChange(OnScrollListener.SCROLL_STATE_FLING);
mFlingRunnable.startScroll(distance, duration);
+ } else {
+ mFlingRunnable.endFling();
}
}
diff --git a/services/java/com/android/server/PackageManagerService.java b/services/java/com/android/server/PackageManagerService.java
index cd58284..a0a1974 100644
--- a/services/java/com/android/server/PackageManagerService.java
+++ b/services/java/com/android/server/PackageManagerService.java
@@ -7327,16 +7327,22 @@
pw.println(" ");
pw.println("Package warning messages:");
File fname = getSettingsProblemFile();
- FileInputStream in;
+ FileInputStream in = null;
try {
in = new FileInputStream(fname);
int avail = in.available();
byte[] data = new byte[avail];
in.read(data);
pw.print(new String(data));
- in.close();
} catch (FileNotFoundException e) {
} catch (IOException e) {
+ } finally {
+ if (in != null) {
+ try {
+ in.close();
+ } catch (IOException e) {
+ }
+ }
}
}
}
diff --git a/services/java/com/android/server/ProcessStats.java b/services/java/com/android/server/ProcessStats.java
index 43dbcc0..1a12a84 100644
--- a/services/java/com/android/server/ProcessStats.java
+++ b/services/java/com/android/server/ProcessStats.java
@@ -799,8 +799,9 @@
}
private String readFile(String file, char endChar) {
+ FileInputStream is = null;
try {
- FileInputStream is = new FileInputStream(file);
+ is = new FileInputStream(file);
int len = is.read(mBuffer);
is.close();
@@ -815,6 +816,13 @@
}
} catch (java.io.FileNotFoundException e) {
} catch (java.io.IOException e) {
+ } finally {
+ if (is != null) {
+ try {
+ is.close();
+ } catch (java.io.IOException e) {
+ }
+ }
}
return null;
}
@@ -841,4 +849,3 @@
}
}
}
-