Loading core/java/android/print/PrintManager.java +8 −2 Original line number Diff line number Diff line Loading @@ -535,7 +535,10 @@ public final class PrintManager { return new PrinterDiscoverySession(mService, mContext, mUserId); } private static final class PrintDocumentAdapterDelegate extends IPrintDocumentAdapter.Stub /** * @hide */ public static final class PrintDocumentAdapterDelegate extends IPrintDocumentAdapter.Stub implements ActivityLifecycleCallbacks { private final Object mLock = new Object(); Loading Loading @@ -1061,7 +1064,10 @@ public final class PrintManager { } } private static final class PrintJobStateChangeListenerWrapper extends /** * @hide */ public static final class PrintJobStateChangeListenerWrapper extends IPrintJobStateChangeListener.Stub { private final WeakReference<PrintJobStateChangeListener> mWeakListener; private final WeakReference<Handler> mWeakHandler; Loading core/java/android/print/PrinterDiscoverySession.java +6 −4 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.print; import android.annotation.NonNull; import android.annotation.Nullable; import android.content.Context; import android.content.pm.ParceledListSlice; import android.os.Handler; Loading Loading @@ -72,7 +74,7 @@ public final class PrinterDiscoverySession { } } public final void startPrinterDiscovery(List<PrinterId> priorityList) { public final void startPrinterDiscovery(@Nullable List<PrinterId> priorityList) { if (isDestroyed()) { Log.w(LOG_TAG, "Ignoring start printers discovery - session destroyed"); return; Loading Loading @@ -102,7 +104,7 @@ public final class PrinterDiscoverySession { } } public final void startPrinterStateTracking(PrinterId printerId) { public final void startPrinterStateTracking(@NonNull PrinterId printerId) { if (isDestroyed()) { Log.w(LOG_TAG, "Ignoring start printer state tracking - session destroyed"); return; Loading @@ -114,7 +116,7 @@ public final class PrinterDiscoverySession { } } public final void stopPrinterStateTracking(PrinterId printerId) { public final void stopPrinterStateTracking(@NonNull PrinterId printerId) { if (isDestroyed()) { Log.w(LOG_TAG, "Ignoring stop printer state tracking - session destroyed"); return; Loading Loading @@ -285,7 +287,7 @@ public final class PrinterDiscoverySession { } } private static final class PrinterDiscoveryObserver extends IPrinterDiscoveryObserver.Stub { public static final class PrinterDiscoveryObserver extends IPrinterDiscoveryObserver.Stub { private final WeakReference<PrinterDiscoverySession> mWeakSession; Loading core/java/android/printservice/PrintService.java +2 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.printservice; import android.annotation.NonNull; import android.annotation.Nullable; import android.app.Service; import android.content.ComponentName; Loading Loading @@ -346,7 +347,7 @@ public abstract class PrintService extends Service { * @param localId A locally unique id in the context of your print service. * @return Global printer id. */ public final PrinterId generatePrinterId(String localId) { public @NonNull final PrinterId generatePrinterId(String localId) { throwIfNotCalledOnMainThread(); localId = Preconditions.checkNotNull(localId, "localId cannot be null"); return new PrinterId(new ComponentName(getPackageName(), Loading core/java/com/android/internal/util/Preconditions.java +19 −2 Original line number Diff line number Diff line Loading @@ -42,6 +42,23 @@ public class Preconditions { * @return the string reference that was validated * @throws IllegalArgumentException if {@code string} is empty */ public static @NonNull String checkStringNotEmpty(final String string) { if (TextUtils.isEmpty(string)) { throw new IllegalArgumentException(); } return string; } /** * Ensures that an string reference passed as a parameter to the calling * method is not empty. * * @param string an string reference * @param errorMessage the exception message to use if the check fails; will * be converted to a string using {@link String#valueOf(Object)} * @return the string reference that was validated * @throws IllegalArgumentException if {@code string} is empty */ public static @NonNull String checkStringNotEmpty(final String string, final Object errorMessage) { if (TextUtils.isEmpty(string)) { Loading Loading @@ -301,8 +318,8 @@ public class Preconditions { * * @throws NullPointerException if the {@code value} or any of its elements were {@code null} */ public static <T> Collection<T> checkCollectionElementsNotNull(final Collection<T> value, final String valueName) { public static @NonNull <C extends Collection<T>, T> C checkCollectionElementsNotNull( final C value, final String valueName) { if (value == null) { throw new NullPointerException(valueName + " must not be null"); } Loading core/tests/coretests/Android.mk +2 −1 Original line number Diff line number Diff line Loading @@ -32,7 +32,8 @@ LOCAL_STATIC_JAVA_LIBRARIES := \ littlemock \ android-support-test \ mockito-target \ espresso-core espresso-core \ ub-uiautomator LOCAL_JAVA_LIBRARIES := android.test.runner conscrypt telephony-common org.apache.http.legacy LOCAL_PACKAGE_NAME := FrameworksCoreTests Loading Loading
core/java/android/print/PrintManager.java +8 −2 Original line number Diff line number Diff line Loading @@ -535,7 +535,10 @@ public final class PrintManager { return new PrinterDiscoverySession(mService, mContext, mUserId); } private static final class PrintDocumentAdapterDelegate extends IPrintDocumentAdapter.Stub /** * @hide */ public static final class PrintDocumentAdapterDelegate extends IPrintDocumentAdapter.Stub implements ActivityLifecycleCallbacks { private final Object mLock = new Object(); Loading Loading @@ -1061,7 +1064,10 @@ public final class PrintManager { } } private static final class PrintJobStateChangeListenerWrapper extends /** * @hide */ public static final class PrintJobStateChangeListenerWrapper extends IPrintJobStateChangeListener.Stub { private final WeakReference<PrintJobStateChangeListener> mWeakListener; private final WeakReference<Handler> mWeakHandler; Loading
core/java/android/print/PrinterDiscoverySession.java +6 −4 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.print; import android.annotation.NonNull; import android.annotation.Nullable; import android.content.Context; import android.content.pm.ParceledListSlice; import android.os.Handler; Loading Loading @@ -72,7 +74,7 @@ public final class PrinterDiscoverySession { } } public final void startPrinterDiscovery(List<PrinterId> priorityList) { public final void startPrinterDiscovery(@Nullable List<PrinterId> priorityList) { if (isDestroyed()) { Log.w(LOG_TAG, "Ignoring start printers discovery - session destroyed"); return; Loading Loading @@ -102,7 +104,7 @@ public final class PrinterDiscoverySession { } } public final void startPrinterStateTracking(PrinterId printerId) { public final void startPrinterStateTracking(@NonNull PrinterId printerId) { if (isDestroyed()) { Log.w(LOG_TAG, "Ignoring start printer state tracking - session destroyed"); return; Loading @@ -114,7 +116,7 @@ public final class PrinterDiscoverySession { } } public final void stopPrinterStateTracking(PrinterId printerId) { public final void stopPrinterStateTracking(@NonNull PrinterId printerId) { if (isDestroyed()) { Log.w(LOG_TAG, "Ignoring stop printer state tracking - session destroyed"); return; Loading Loading @@ -285,7 +287,7 @@ public final class PrinterDiscoverySession { } } private static final class PrinterDiscoveryObserver extends IPrinterDiscoveryObserver.Stub { public static final class PrinterDiscoveryObserver extends IPrinterDiscoveryObserver.Stub { private final WeakReference<PrinterDiscoverySession> mWeakSession; Loading
core/java/android/printservice/PrintService.java +2 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.printservice; import android.annotation.NonNull; import android.annotation.Nullable; import android.app.Service; import android.content.ComponentName; Loading Loading @@ -346,7 +347,7 @@ public abstract class PrintService extends Service { * @param localId A locally unique id in the context of your print service. * @return Global printer id. */ public final PrinterId generatePrinterId(String localId) { public @NonNull final PrinterId generatePrinterId(String localId) { throwIfNotCalledOnMainThread(); localId = Preconditions.checkNotNull(localId, "localId cannot be null"); return new PrinterId(new ComponentName(getPackageName(), Loading
core/java/com/android/internal/util/Preconditions.java +19 −2 Original line number Diff line number Diff line Loading @@ -42,6 +42,23 @@ public class Preconditions { * @return the string reference that was validated * @throws IllegalArgumentException if {@code string} is empty */ public static @NonNull String checkStringNotEmpty(final String string) { if (TextUtils.isEmpty(string)) { throw new IllegalArgumentException(); } return string; } /** * Ensures that an string reference passed as a parameter to the calling * method is not empty. * * @param string an string reference * @param errorMessage the exception message to use if the check fails; will * be converted to a string using {@link String#valueOf(Object)} * @return the string reference that was validated * @throws IllegalArgumentException if {@code string} is empty */ public static @NonNull String checkStringNotEmpty(final String string, final Object errorMessage) { if (TextUtils.isEmpty(string)) { Loading Loading @@ -301,8 +318,8 @@ public class Preconditions { * * @throws NullPointerException if the {@code value} or any of its elements were {@code null} */ public static <T> Collection<T> checkCollectionElementsNotNull(final Collection<T> value, final String valueName) { public static @NonNull <C extends Collection<T>, T> C checkCollectionElementsNotNull( final C value, final String valueName) { if (value == null) { throw new NullPointerException(valueName + " must not be null"); } Loading
core/tests/coretests/Android.mk +2 −1 Original line number Diff line number Diff line Loading @@ -32,7 +32,8 @@ LOCAL_STATIC_JAVA_LIBRARIES := \ littlemock \ android-support-test \ mockito-target \ espresso-core espresso-core \ ub-uiautomator LOCAL_JAVA_LIBRARIES := android.test.runner conscrypt telephony-common org.apache.http.legacy LOCAL_PACKAGE_NAME := FrameworksCoreTests Loading