summaryrefslogtreecommitdiffstats
path: root/core/java
diff options
context:
space:
mode:
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/app/AlertDialog.java8
-rw-r--r--core/java/android/app/ContextImpl.java2
-rw-r--r--core/java/android/app/backup/BackupTransport.java7
-rw-r--r--core/java/android/hardware/camera2/CameraCharacteristics.java7
-rw-r--r--core/java/android/net/ConnectivityManager.java33
-rw-r--r--core/java/android/os/BatteryStats.java9
-rw-r--r--core/java/android/preference/Preference.java2
-rw-r--r--core/java/android/preference/PreferenceManager.java2
-rw-r--r--core/java/android/view/View.java7
-rw-r--r--core/java/android/view/Window.java9
-rw-r--r--core/java/android/webkit/WebView.java11
-rw-r--r--core/java/android/widget/AbsListView.java2
-rw-r--r--core/java/android/widget/TimePickerClockDelegate.java18
-rw-r--r--core/java/com/android/internal/app/AlertController.java4
-rw-r--r--core/java/com/android/internal/app/ShutdownActivity.java66
-rw-r--r--core/java/com/android/internal/app/WindowDecorActionBar.java7
-rw-r--r--core/java/com/android/internal/content/PackageMonitor.java5
-rw-r--r--core/java/com/android/internal/os/BatteryStatsImpl.java12
-rw-r--r--core/java/com/android/internal/util/FastPrintWriter.java8
19 files changed, 172 insertions, 47 deletions
diff --git a/core/java/android/app/AlertDialog.java b/core/java/android/app/AlertDialog.java
index 4ce7835..3c6458f 100644
--- a/core/java/android/app/AlertDialog.java
+++ b/core/java/android/app/AlertDialog.java
@@ -466,6 +466,8 @@ public class AlertDialog extends Dialog implements DialogInterface {
/**
* Set the resource id of the {@link Drawable} to be used in the title.
+ * <p>
+ * Takes precedence over values set using {@link #setIcon(Drawable)}.
*
* @return This Builder object to allow for chaining of calls to set methods
*/
@@ -485,7 +487,11 @@ public class AlertDialog extends Dialog implements DialogInterface {
}
/**
- * Set an icon as supplied by a theme attribute. e.g. android.R.attr.alertDialogIcon
+ * Set an icon as supplied by a theme attribute. e.g.
+ * {@link android.R.attr#alertDialogIcon}.
+ * <p>
+ * Takes precedence over values set using {@link #setIcon(int)} or
+ * {@link #setIcon(Drawable)}.
*
* @param attrId ID of a theme attribute that points to a drawable resource.
*/
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java
index 2df35df..2ef046d 100644
--- a/core/java/android/app/ContextImpl.java
+++ b/core/java/android/app/ContextImpl.java
@@ -2419,7 +2419,7 @@ class ContextImpl extends Context {
int res = -1;
try {
res = mount.mkdirs(getPackageName(), dir.getAbsolutePath());
- } catch (RemoteException e) {
+ } catch (Exception ignored) {
}
if (res != 0) {
Log.w(TAG, "Failed to ensure directory: " + dir);
diff --git a/core/java/android/app/backup/BackupTransport.java b/core/java/android/app/backup/BackupTransport.java
index 70bb5e4..e853540 100644
--- a/core/java/android/app/backup/BackupTransport.java
+++ b/core/java/android/app/backup/BackupTransport.java
@@ -213,8 +213,9 @@ public class BackupTransport {
/**
* Send one application's key/value data update to the backup destination. The
- * transport may send the data immediately, or may buffer it. After this is called,
- * {@link #finishBackup} will be called to ensure the data is sent and recorded successfully.
+ * transport may send the data immediately, or may buffer it. If this method returns
+ * {@link #TRANSPORT_OK}, {@link #finishBackup} will then be called to ensure the data
+ * is sent and recorded successfully.
*
* @param packageInfo The identity of the application whose data is being backed up.
* This specifically includes the signature list for the package.
@@ -226,6 +227,8 @@ public class BackupTransport {
* is to provide a guarantee that no stale data exists in the restore set when the
* device begins providing incremental backups.
* @return one of {@link BackupTransport#TRANSPORT_OK} (OK so far),
+ * {@link BackupTransport#TRANSPORT_PACKAGE_REJECTED} (to suppress backup of this
+ * specific package, but allow others to proceed),
* {@link BackupTransport#TRANSPORT_ERROR} (on network error or other failure), or
* {@link BackupTransport#TRANSPORT_NOT_INITIALIZED} (if the backend dataset has
* become lost due to inactivity purge or some other reason and needs re-initializing)
diff --git a/core/java/android/hardware/camera2/CameraCharacteristics.java b/core/java/android/hardware/camera2/CameraCharacteristics.java
index f487f01..1b621d1 100644
--- a/core/java/android/hardware/camera2/CameraCharacteristics.java
+++ b/core/java/android/hardware/camera2/CameraCharacteristics.java
@@ -315,16 +315,15 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri
* supported by this camera device.</p>
* <p>This key lists the valid modes for {@link CaptureRequest#COLOR_CORRECTION_ABERRATION_MODE android.colorCorrection.aberrationMode}. If no
* aberration correction modes are available for a device, this list will solely include
- * OFF mode.</p>
- * <p>For FULL capability device ({@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} <code>==</code> FULL), OFF is
- * always included.</p>
+ * OFF mode. All camera devices will support either OFF or FAST mode.</p>
+ * <p>Camera devices that support the MANUAL_POST_PROCESSING capability will always list
+ * OFF mode. This includes all FULL level devices.</p>
* <p>LEGACY devices will always only support FAST mode.</p>
* <p><b>Range of valid values:</b><br>
* Any value listed in {@link CaptureRequest#COLOR_CORRECTION_ABERRATION_MODE android.colorCorrection.aberrationMode}</p>
* <p>This key is available on all devices.</p>
*
* @see CaptureRequest#COLOR_CORRECTION_ABERRATION_MODE
- * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
*/
@PublicKey
public static final Key<int[]> COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES =
diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java
index 17ee494..cdc8661 100644
--- a/core/java/android/net/ConnectivityManager.java
+++ b/core/java/android/net/ConnectivityManager.java
@@ -933,10 +933,8 @@ public class ConnectivityManager {
return -1;
}
- NetworkCallback networkCallback = removeRequestForFeature(netCap);
- if (networkCallback != null) {
+ if (removeRequestForFeature(netCap)) {
Log.d(TAG, "stopUsingNetworkFeature for " + networkType + ", " + feature);
- unregisterNetworkCallback(networkCallback);
}
return 1;
}
@@ -1103,6 +1101,14 @@ public class ConnectivityManager {
int expireSequenceNumber;
Network currentNetwork;
int delay = -1;
+
+ private void clearDnsBinding() {
+ if (currentNetwork != null) {
+ currentNetwork = null;
+ setProcessDefaultNetworkForHostResolution(null);
+ }
+ }
+
NetworkCallback networkCallback = new NetworkCallback() {
@Override
public void onAvailable(Network network) {
@@ -1112,10 +1118,7 @@ public class ConnectivityManager {
}
@Override
public void onLost(Network network) {
- if (network.equals(currentNetwork)) {
- currentNetwork = null;
- setProcessDefaultNetworkForHostResolution(null);
- }
+ if (network.equals(currentNetwork)) clearDnsBinding();
Log.d(TAG, "startUsingNetworkFeature lost Network:" + network);
}
};
@@ -1144,10 +1147,7 @@ public class ConnectivityManager {
LegacyRequest l = sLegacyRequests.get(netCap);
if (l == null) return;
ourSeqNum = l.expireSequenceNumber;
- if (l.expireSequenceNumber == sequenceNum) {
- unregisterNetworkCallback(l.networkCallback);
- sLegacyRequests.remove(netCap);
- }
+ if (l.expireSequenceNumber == sequenceNum) removeRequestForFeature(netCap);
}
Log.d(TAG, "expireRequest with " + ourSeqNum + ", " + sequenceNum);
}
@@ -1178,12 +1178,15 @@ public class ConnectivityManager {
}
}
- private NetworkCallback removeRequestForFeature(NetworkCapabilities netCap) {
+ private boolean removeRequestForFeature(NetworkCapabilities netCap) {
+ final LegacyRequest l;
synchronized (sLegacyRequests) {
- LegacyRequest l = sLegacyRequests.remove(netCap);
- if (l == null) return null;
- return l.networkCallback;
+ l = sLegacyRequests.remove(netCap);
}
+ if (l == null) return false;
+ unregisterNetworkCallback(l.networkCallback);
+ l.clearDnsBinding();
+ return true;
}
/**
diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java
index 5fd697a..c0dca0e 100644
--- a/core/java/android/os/BatteryStats.java
+++ b/core/java/android/os/BatteryStats.java
@@ -604,6 +604,7 @@ public abstract class BatteryStats implements Parcelable {
public static final byte CMD_CURRENT_TIME = 5;
public static final byte CMD_OVERFLOW = 6;
public static final byte CMD_RESET = 7;
+ public static final byte CMD_SHUTDOWN = 8;
public byte cmd = CMD_NULL;
@@ -3529,6 +3530,11 @@ public abstract class BatteryStats implements Parcelable {
pw.println(DateFormat.format("yyyy-MM-dd-HH-mm-ss",
rec.currentTime).toString());
}
+ } else if (rec.cmd == HistoryItem.CMD_SHUTDOWN) {
+ if (checkin) {
+ pw.print(":");
+ }
+ pw.println("SHUTDOWN");
} else if (rec.cmd == HistoryItem.CMD_OVERFLOW) {
if (checkin) {
pw.print(":");
@@ -3849,7 +3855,8 @@ public abstract class BatteryStats implements Parcelable {
if (histStart >= 0 && !printed) {
if (rec.cmd == HistoryItem.CMD_CURRENT_TIME
|| rec.cmd == HistoryItem.CMD_RESET
- || rec.cmd == HistoryItem.CMD_START) {
+ || rec.cmd == HistoryItem.CMD_START
+ || rec.cmd == HistoryItem.CMD_SHUTDOWN) {
printed = true;
hprinter.printNextItem(pw, rec, baseTime, checkin,
(flags&DUMP_VERBOSE) != 0);
diff --git a/core/java/android/preference/Preference.java b/core/java/android/preference/Preference.java
index 56d5617..0224c73 100644
--- a/core/java/android/preference/Preference.java
+++ b/core/java/android/preference/Preference.java
@@ -215,7 +215,7 @@ public class Preference implements Comparable<Preference> {
final TypedArray a = context.obtainStyledAttributes(
attrs, com.android.internal.R.styleable.Preference, defStyleAttr, defStyleRes);
- for (int i = a.getIndexCount(); i >= 0; i--) {
+ for (int i = a.getIndexCount() - 1; i >= 0; i--) {
int attr = a.getIndex(i);
switch (attr) {
case com.android.internal.R.styleable.Preference_icon:
diff --git a/core/java/android/preference/PreferenceManager.java b/core/java/android/preference/PreferenceManager.java
index ad940c6..0a0e625 100644
--- a/core/java/android/preference/PreferenceManager.java
+++ b/core/java/android/preference/PreferenceManager.java
@@ -156,7 +156,7 @@ public class PreferenceManager {
* should be used ANY time a preference will be displayed, since some preference
* types need an Activity for managed queries.
*/
- private PreferenceManager(Context context) {
+ /*package*/ PreferenceManager(Context context) {
init(context);
}
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 27c1978..23792be 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -15531,6 +15531,13 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
final int width = bounds.width();
final int height = bounds.height();
final HardwareCanvas canvas = renderNode.start(width, height);
+
+ // Reverse left/top translation done by drawable canvas, which will
+ // instead be applied by rendernode's LTRB bounds below. This way, the
+ // drawable's bounds match with its rendernode bounds and its content
+ // will lie within those bounds in the rendernode tree.
+ canvas.translate(-bounds.left, -bounds.top);
+
try {
drawable.draw(canvas);
} finally {
diff --git a/core/java/android/view/Window.java b/core/java/android/view/Window.java
index 6944c53..55c6cb89 100644
--- a/core/java/android/view/Window.java
+++ b/core/java/android/view/Window.java
@@ -18,6 +18,7 @@ package android.view;
import android.annotation.NonNull;
import android.annotation.Nullable;
+import android.annotation.SystemApi;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
@@ -901,6 +902,14 @@ public abstract class Window {
}
/** @hide */
+ @SystemApi
+ public void setDisableWallpaperTouchEvents(boolean disable) {
+ setPrivateFlags(disable
+ ? WindowManager.LayoutParams.PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS : 0,
+ WindowManager.LayoutParams.PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS);
+ }
+
+ /** @hide */
public abstract void alwaysReadCloseOnTouchAttr();
/** @hide */
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 8d2c51f..48712bb 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -1634,11 +1634,12 @@ public class WebView extends AbsoluteLayout
* the portion of the HTML document that needs to be drawn. These
* optimizations are transparent to the developers. However, under certain
* circumstances, an App developer may want to disable them:
- * 1. When an app uses {@link #onDraw} to do own drawing and accesses portions
- * of the page that is way outside the visible portion of the page.
- * 2. When an app uses {@link #capturePicture} to capture a very large HTML document.
- * Note that capturePicture is a deprecated API.
- *
+ * <ol>
+ * <li>When an app uses {@link #onDraw} to do own drawing and accesses portions
+ * of the page that is way outside the visible portion of the page.</li>
+ * <li>When an app uses {@link #capturePicture} to capture a very large HTML document.
+ * Note that capturePicture is a deprecated API.</li>
+ * </ol>
* Enabling drawing the entire HTML document has a significant performance
* cost. This method should be called before any WebViews are created.
*/
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index d80ad6a..523f970 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -2565,7 +2565,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
if (getVisibility() == VISIBLE) {
selector.setVisible(true, false);
}
- selector.setState(getDrawableState());
+ updateSelectorState();
}
if (manageHotspot) {
selector.setHotspot(x, y);
diff --git a/core/java/android/widget/TimePickerClockDelegate.java b/core/java/android/widget/TimePickerClockDelegate.java
index 8d475a7..1534429 100644
--- a/core/java/android/widget/TimePickerClockDelegate.java
+++ b/core/java/android/widget/TimePickerClockDelegate.java
@@ -63,6 +63,8 @@ class TimePickerClockDelegate extends TimePicker.AbstractTimePickerDelegate impl
// Also NOT a real index, just used for keyboard mode.
private static final int ENABLE_PICKER_INDEX = 3;
+ // LayoutLib relies on these constants. Change TimePickerClockDelegate_Delegate if
+ // modifying these.
static final int AM = 0;
static final int PM = 1;
@@ -1051,15 +1053,16 @@ class TimePickerClockDelegate extends TimePicker.AbstractTimePickerDelegate impl
// Cache the codes.
if (mAmKeyCode == -1 || mPmKeyCode == -1) {
// Find the first character in the AM/PM text that is unique.
- KeyCharacterMap kcm = KeyCharacterMap.load(KeyCharacterMap.VIRTUAL_KEYBOARD);
- char amChar;
- char pmChar;
- for (int i = 0; i < Math.max(mAmText.length(), mPmText.length()); i++) {
- amChar = mAmText.toLowerCase(mCurrentLocale).charAt(i);
- pmChar = mPmText.toLowerCase(mCurrentLocale).charAt(i);
+ final KeyCharacterMap kcm = KeyCharacterMap.load(KeyCharacterMap.VIRTUAL_KEYBOARD);
+ final CharSequence amText = mAmText.toLowerCase(mCurrentLocale);
+ final CharSequence pmText = mPmText.toLowerCase(mCurrentLocale);
+ final int N = Math.min(amText.length(), pmText.length());
+ for (int i = 0; i < N; i++) {
+ final char amChar = amText.charAt(i);
+ final char pmChar = pmText.charAt(i);
if (amChar != pmChar) {
- KeyEvent[] events = kcm.getEvents(new char[]{amChar, pmChar});
// There should be 4 events: a down and up for both AM and PM.
+ final KeyEvent[] events = kcm.getEvents(new char[] { amChar, pmChar });
if (events != null && events.length == 4) {
mAmKeyCode = events[0].getKeyCode();
mPmKeyCode = events[2].getKeyCode();
@@ -1070,6 +1073,7 @@ class TimePickerClockDelegate extends TimePicker.AbstractTimePickerDelegate impl
}
}
}
+
if (amOrPm == AM) {
return mAmKeyCode;
} else if (amOrPm == PM) {
diff --git a/core/java/com/android/internal/app/AlertController.java b/core/java/com/android/internal/app/AlertController.java
index 35e03c3..20d209f 100644
--- a/core/java/com/android/internal/app/AlertController.java
+++ b/core/java/com/android/internal/app/AlertController.java
@@ -955,10 +955,10 @@ public class AlertController {
if (mIcon != null) {
dialog.setIcon(mIcon);
}
- if (mIconId >= 0) {
+ if (mIconId != 0) {
dialog.setIcon(mIconId);
}
- if (mIconAttrId > 0) {
+ if (mIconAttrId != 0) {
dialog.setIcon(dialog.getIconAttributeResId(mIconAttrId));
}
}
diff --git a/core/java/com/android/internal/app/ShutdownActivity.java b/core/java/com/android/internal/app/ShutdownActivity.java
new file mode 100644
index 0000000..97521cf
--- /dev/null
+++ b/core/java/com/android/internal/app/ShutdownActivity.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 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.
+ */
+
+package com.android.internal.app;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import android.os.IPowerManager;
+import android.os.RemoteException;
+import android.os.ServiceManager;
+import android.util.Slog;
+
+public class ShutdownActivity extends Activity {
+
+ private static final String TAG = "ShutdownActivity";
+ private boolean mReboot;
+ private boolean mConfirm;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ Intent intent = getIntent();
+ mReboot = Intent.ACTION_REBOOT.equals(intent.getAction());
+ mConfirm = intent.getBooleanExtra(Intent.EXTRA_KEY_CONFIRM, false);
+ Slog.i(TAG, "onCreate(): confirm=" + mConfirm);
+
+ Thread thr = new Thread("ShutdownActivity") {
+ @Override
+ public void run() {
+ IPowerManager pm = IPowerManager.Stub.asInterface(
+ ServiceManager.getService(Context.POWER_SERVICE));
+ try {
+ if (mReboot) {
+ pm.reboot(mConfirm, null, false);
+ } else {
+ pm.shutdown(mConfirm, false);
+ }
+ } catch (RemoteException e) {
+ }
+ }
+ };
+ thr.start();
+ finish();
+ // Wait for us to tell the power manager to shutdown.
+ try {
+ thr.join();
+ } catch (InterruptedException e) {
+ }
+ }
+}
diff --git a/core/java/com/android/internal/app/WindowDecorActionBar.java b/core/java/com/android/internal/app/WindowDecorActionBar.java
index d95f0e5..061b535 100644
--- a/core/java/com/android/internal/app/WindowDecorActionBar.java
+++ b/core/java/com/android/internal/app/WindowDecorActionBar.java
@@ -993,6 +993,13 @@ public class WindowDecorActionBar extends ActionBar implements
@Override
public void invalidate() {
+ if (mActionMode != this) {
+ // Not the active action mode - no-op. It's possible we are
+ // currently deferring onDestroy, so the app doesn't yet know we
+ // are going away and is trying to use us. That's also a no-op.
+ return;
+ }
+
mMenu.stopDispatchingItemsChanged();
try {
mCallback.onPrepareActionMode(this, mMenu);
diff --git a/core/java/com/android/internal/content/PackageMonitor.java b/core/java/com/android/internal/content/PackageMonitor.java
index 9df8ad5..eff44bd 100644
--- a/core/java/com/android/internal/content/PackageMonitor.java
+++ b/core/java/com/android/internal/content/PackageMonitor.java
@@ -24,6 +24,7 @@ import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
import android.os.UserHandle;
+import android.util.Slog;
import com.android.internal.os.BackgroundThread;
import java.util.HashSet;
@@ -279,8 +280,8 @@ public abstract class PackageMonitor extends android.content.BroadcastReceiver {
mChangeUserId = intent.getIntExtra(Intent.EXTRA_USER_HANDLE,
UserHandle.USER_NULL);
if (mChangeUserId == UserHandle.USER_NULL) {
- throw new IllegalArgumentException(
- "Intent broadcast does not contain user handle: " + intent);
+ Slog.w("PackageMonitor", "Intent broadcast does not contain user handle: " + intent);
+ return;
}
onBeginPackageChanges();
diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java
index 8ceee20..20bb95e 100644
--- a/core/java/com/android/internal/os/BatteryStatsImpl.java
+++ b/core/java/com/android/internal/os/BatteryStatsImpl.java
@@ -6955,6 +6955,17 @@ public final class BatteryStatsImpl extends BatteryStats {
}
}
+ private void recordShutdownLocked(final long elapsedRealtimeMs, final long uptimeMs) {
+ if (mRecordingHistory) {
+ mHistoryCur.currentTime = System.currentTimeMillis();
+ mLastRecordedClockTime = mHistoryCur.currentTime;
+ mLastRecordedClockRealtime = elapsedRealtimeMs;
+ addHistoryBufferLocked(elapsedRealtimeMs, uptimeMs, HistoryItem.CMD_SHUTDOWN,
+ mHistoryCur);
+ mHistoryCur.currentTime = 0;
+ }
+ }
+
// This should probably be exposed in the API, though it's not critical
private static final int BATTERY_PLUGGED_NONE = 0;
@@ -7627,6 +7638,7 @@ public final class BatteryStatsImpl extends BatteryStats {
}
public void shutdownLocked() {
+ recordShutdownLocked(SystemClock.elapsedRealtime(), SystemClock.uptimeMillis());
writeSyncLocked();
mShuttingDown = true;
}
diff --git a/core/java/com/android/internal/util/FastPrintWriter.java b/core/java/com/android/internal/util/FastPrintWriter.java
index c70a243..c74fea0 100644
--- a/core/java/com/android/internal/util/FastPrintWriter.java
+++ b/core/java/com/android/internal/util/FastPrintWriter.java
@@ -15,7 +15,7 @@ import java.nio.charset.CoderResult;
import java.nio.charset.CodingErrorAction;
public class FastPrintWriter extends PrintWriter {
- private static Writer sDummyWriter = new Writer() {
+ private static class DummyWriter extends Writer {
@Override
public void close() throws IOException {
UnsupportedOperationException ex
@@ -100,7 +100,7 @@ public class FastPrintWriter extends PrintWriter {
* if {@code out} is {@code null}.
*/
public FastPrintWriter(OutputStream out, boolean autoFlush, int bufferLen) {
- super(sDummyWriter, autoFlush);
+ super(new DummyWriter(), autoFlush);
if (out == null) {
throw new NullPointerException("out is null");
}
@@ -169,7 +169,7 @@ public class FastPrintWriter extends PrintWriter {
* if {@code wr} is {@code null}.
*/
public FastPrintWriter(Writer wr, boolean autoFlush, int bufferLen) {
- super(sDummyWriter, autoFlush);
+ super(new DummyWriter(), autoFlush);
if (wr == null) {
throw new NullPointerException("wr is null");
}
@@ -212,7 +212,7 @@ public class FastPrintWriter extends PrintWriter {
* if {@code pr} is {@code null}.
*/
public FastPrintWriter(Printer pr, int bufferLen) {
- super(sDummyWriter, true);
+ super(new DummyWriter(), true);
if (pr == null) {
throw new NullPointerException("pr is null");
}