diff --git a/core/java/android/content/ContentResolver.java b/core/java/android/content/ContentResolver.java index 69a3b74640b43..b85ec2713beec 100644 --- a/core/java/android/content/ContentResolver.java +++ b/core/java/android/content/ContentResolver.java @@ -78,6 +78,7 @@ import java.util.concurrent.atomic.AtomicBoolean; *
For more information about using a ContentResolver with content providers, read the * Content Providers * developer guide.
+ * */ public abstract class ContentResolver { /** diff --git a/core/java/android/content/pm/RegisteredServicesCache.java b/core/java/android/content/pm/RegisteredServicesCache.java index a8c3b889421be..d7c4439f82588 100644 --- a/core/java/android/content/pm/RegisteredServicesCache.java +++ b/core/java/android/content/pm/RegisteredServicesCache.java @@ -17,6 +17,7 @@ package android.content.pm; import android.Manifest; +import android.annotation.Nullable; import android.annotation.UnsupportedAppUsage; import android.content.BroadcastReceiver; import android.content.ComponentName; @@ -176,7 +177,8 @@ public abstract class RegisteredServicesCache
* Possible values are defined in {@link Build.VERSION_CODES}.
- *
- * @see #FIRST_SDK_INT
*/
public static final int SDK_INT = SystemProperties.getInt(
"ro.build.version.sdk", 0);
diff --git a/core/java/android/service/notification/ScheduleCalendar.java b/core/java/android/service/notification/ScheduleCalendar.java
index 8b7946ce7651a..6ed966e0bbbd0 100644
--- a/core/java/android/service/notification/ScheduleCalendar.java
+++ b/core/java/android/service/notification/ScheduleCalendar.java
@@ -70,10 +70,10 @@ public class ScheduleCalendar {
}
// only allow alarms in the future
if (nextAlarm > now) {
- // store earliest alarm
- if (mSchedule.nextAlarm == 0) {
+ if (mSchedule.nextAlarm == 0 || mSchedule.nextAlarm < now) {
mSchedule.nextAlarm = nextAlarm;
} else {
+ // store earliest alarm
mSchedule.nextAlarm = Math.min(mSchedule.nextAlarm, nextAlarm);
}
} else if (mSchedule.nextAlarm < now) {
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index d17646216a64d..24dc2b7ef56db 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -1378,6 +1378,9 @@ public final class ViewRootImpl implements ViewParent,
}
if (mStopped) {
+ if (mSurfaceHolder != null) {
+ notifySurfaceDestroyed();
+ }
mSurface.release();
}
}
@@ -2252,13 +2255,7 @@ public final class ViewRootImpl implements ViewParent,
}
mIsCreating = false;
} else if (hadSurface) {
- mSurfaceHolder.ungetCallbacks();
- SurfaceHolder.Callback callbacks[] = mSurfaceHolder.getCallbacks();
- if (callbacks != null) {
- for (SurfaceHolder.Callback c : callbacks) {
- c.surfaceDestroyed(mSurfaceHolder);
- }
- }
+ notifySurfaceDestroyed();
mSurfaceHolder.mSurfaceLock.lock();
try {
mSurfaceHolder.mSurface = new Surface();
@@ -2522,6 +2519,16 @@ public final class ViewRootImpl implements ViewParent,
mIsInTraversal = false;
}
+ private void notifySurfaceDestroyed() {
+ mSurfaceHolder.ungetCallbacks();
+ SurfaceHolder.Callback[] callbacks = mSurfaceHolder.getCallbacks();
+ if (callbacks != null) {
+ for (SurfaceHolder.Callback c : callbacks) {
+ c.surfaceDestroyed(mSurfaceHolder);
+ }
+ }
+ }
+
private void maybeHandleWindowMove(Rect frame) {
// TODO: Well, we are checking whether the frame has changed similarly
diff --git a/core/java/android/view/accessibility/AccessibilityCache.java b/core/java/android/view/accessibility/AccessibilityCache.java
index 0e1e379d610a9..da5a1cd67922b 100644
--- a/core/java/android/view/accessibility/AccessibilityCache.java
+++ b/core/java/android/view/accessibility/AccessibilityCache.java
@@ -418,28 +418,20 @@ public class AccessibilityCache {
*
* @param nodes The nodes in the hosting window.
* @param rootNodeId The id of the root to evict.
- *
- * @return {@code true} if the cache was cleared
*/
- private boolean clearSubTreeRecursiveLocked(LongSparseArray Note: The MIME type and character encoding must
* be specified as separate parameters (for example {@code "text/html"} and
@@ -67,9 +67,10 @@ public class WebResourceResponse {
}
/**
- * Constructs a resource response with the given parameters. Callers must
- * implement {@link InputStream#read(byte[]) InputStream.read(byte[])} for
- * the input stream.
+ * Constructs a resource response with the given parameters. Callers must implement
+ * {@link InputStream#read(byte[])} for the input stream. {@link InputStream#close()} will be
+ * called after the WebView has finished with the response.
+ *
*
* Note: See {@link #WebResourceResponse(String,String,InputStream)}
* for details on what should be specified for {@code mimeType} and {@code encoding}.
@@ -201,7 +202,8 @@ public class WebResourceResponse {
/**
* Sets the input stream that provides the resource response's data. Callers
- * must implement {@link InputStream#read(byte[]) InputStream.read(byte[])}.
+ * must implement {@link InputStream#read(byte[])}. {@link InputStream#close()}
+ * will be called after the WebView has finished with the response.
*
* @param data the input stream that provides the resource response's data. Must not be a
* StringBufferInputStream.
diff --git a/core/java/android/webkit/WebViewClient.java b/core/java/android/webkit/WebViewClient.java
index bdd7a09002137..a29d449665404 100644
--- a/core/java/android/webkit/WebViewClient.java
+++ b/core/java/android/webkit/WebViewClient.java
@@ -370,11 +370,16 @@ public class WebViewClient {
/**
* Notify the host application that an SSL error occurred while loading a
- * resource. The host application must call either handler.cancel() or
- * handler.proceed(). Note that the decision may be retained for use in
+ * resource. The host application must call either {@link SslErrorHandler#cancel} or
+ * {@link SslErrorHandler#proceed}. Note that the decision may be retained for use in
* response to future SSL errors. The default behavior is to cancel the
* load.
*
+ * This API is only called for recoverable SSL certificate errors. In the case of
+ * non-recoverable errors (such as when the server fails the client), WebView will call {@link
+ * #onReceivedError(WebView, WebResourceRequest, WebResourceError)} with {@link
+ * #ERROR_FAILED_SSL_HANDSHAKE}.
+ *
* Applications are advised not to prompt the user about SSL errors, as
* the user is unlikely to be able to make an informed security decision
* and WebView does not provide any UI for showing the details of the
@@ -382,10 +387,10 @@ public class WebViewClient {
*
* Application overrides of this method may display custom error pages or
* silently log issues, but it is strongly recommended to always call
- * handler.cancel() and never allow proceeding past errors.
+ * {@link SslErrorHandler#cancel} and never allow proceeding past errors.
*
* @param view The WebView that is initiating the callback.
- * @param handler An SslErrorHandler object that will handle the user's
+ * @param handler An {@link SslErrorHandler} that will handle the user's
* response.
* @param error The SSL error object.
*/
diff --git a/core/java/com/android/internal/colorextraction/ColorExtractor.java b/core/java/com/android/internal/colorextraction/ColorExtractor.java
index c171fa6b25fdb..25ea397c2e98d 100644
--- a/core/java/com/android/internal/colorextraction/ColorExtractor.java
+++ b/core/java/com/android/internal/colorextraction/ColorExtractor.java
@@ -21,8 +21,7 @@ import android.annotation.Nullable;
import android.app.WallpaperColors;
import android.app.WallpaperManager;
import android.content.Context;
-import android.os.Trace;
-import android.os.UserHandle;
+import android.os.AsyncTask;
import android.util.Log;
import android.util.SparseArray;
@@ -32,7 +31,6 @@ import com.android.internal.colorextraction.types.Tonal;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
-import java.util.Iterator;
/**
* Class to process wallpaper colors and generate a tonal palette based on them.
@@ -55,11 +53,11 @@ public class ColorExtractor implements WallpaperManager.OnColorsChangedListener
protected WallpaperColors mLockColors;
public ColorExtractor(Context context) {
- this(context, new Tonal(context));
+ this(context, new Tonal(context), true /* immediately */);
}
@VisibleForTesting
- public ColorExtractor(Context context, ExtractionType extractionType) {
+ public ColorExtractor(Context context, ExtractionType extractionType, boolean immediately) {
mContext = context;
mExtractionType = extractionType;
@@ -73,23 +71,48 @@ public class ColorExtractor implements WallpaperManager.OnColorsChangedListener
}
mOnColorsChangedListeners = new ArrayList<>();
- GradientColors[] systemColors = mGradientColors.get(WallpaperManager.FLAG_SYSTEM);
- GradientColors[] lockColors = mGradientColors.get(WallpaperManager.FLAG_LOCK);
WallpaperManager wallpaperManager = mContext.getSystemService(WallpaperManager.class);
if (wallpaperManager == null) {
Log.w(TAG, "Can't listen to color changes!");
} else {
wallpaperManager.addOnColorsChangedListener(this, null /* handler */);
+ initExtractColors(wallpaperManager, immediately);
+ }
+ }
- // Initialize all gradients with the current colors
- Trace.beginSection("ColorExtractor#getWallpaperColors");
+ private void initExtractColors(WallpaperManager wallpaperManager, boolean immediately) {
+ if (immediately) {
mSystemColors = wallpaperManager.getWallpaperColors(WallpaperManager.FLAG_SYSTEM);
mLockColors = wallpaperManager.getWallpaperColors(WallpaperManager.FLAG_LOCK);
- Trace.endSection();
+ extractWallpaperColors();
+ } else {
+ new LoadWallpaperColors().executeOnExecutor(
+ AsyncTask.THREAD_POOL_EXECUTOR, wallpaperManager);
}
+ }
- // Initialize all gradients with the current colors
+ private class LoadWallpaperColors extends AsyncTask