Merge "Merge \"Do not remove handlers for loaders.\" into nyc-mr1-dev am: b6ee468b3e" into nyc-mr1-dev-plus-aosp
This commit is contained in:
committed by
Android (Google) Code Review
commit
1134308842
@@ -36,7 +36,7 @@ public class PrintServiceRecommendationsLoader extends Loader<List<Recommendatio
|
||||
private final @NonNull PrintManager mPrintManager;
|
||||
|
||||
/** Handler to sequentialize the delivery of the results to the main thread */
|
||||
private final Handler mHandler;
|
||||
private final @NonNull Handler mHandler;
|
||||
|
||||
/** Listens for updates to the data from the platform */
|
||||
private PrintManager.PrintServiceRecommendationsChangeListener mListener;
|
||||
@@ -90,9 +90,7 @@ public class PrintServiceRecommendationsLoader extends Loader<List<Recommendatio
|
||||
mListener = null;
|
||||
}
|
||||
|
||||
if (mHandler != null) {
|
||||
mHandler.removeMessages(0);
|
||||
}
|
||||
mHandler.removeMessages(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -39,7 +39,7 @@ public class PrintServicesLoader extends Loader<List<PrintServiceInfo>> {
|
||||
private final @NonNull PrintManager mPrintManager;
|
||||
|
||||
/** Handler to sequentialize the delivery of the results to the main thread */
|
||||
private Handler mHandler;
|
||||
private final @NonNull Handler mHandler;
|
||||
|
||||
/** Listens for updates to the data from the platform */
|
||||
private PrintManager.PrintServicesChangeListener mListener;
|
||||
@@ -54,6 +54,7 @@ public class PrintServicesLoader extends Loader<List<PrintServiceInfo>> {
|
||||
public PrintServicesLoader(@NonNull PrintManager printManager, @NonNull Context context,
|
||||
int selectionFlags) {
|
||||
super(Preconditions.checkNotNull(context));
|
||||
mHandler = new MyHandler();
|
||||
mPrintManager = Preconditions.checkNotNull(printManager);
|
||||
mSelectionFlags = Preconditions.checkFlagsArgument(selectionFlags,
|
||||
PrintManager.ALL_SERVICES);
|
||||
@@ -75,7 +76,6 @@ public class PrintServicesLoader extends Loader<List<PrintServiceInfo>> {
|
||||
|
||||
@Override
|
||||
protected void onStartLoading() {
|
||||
mHandler = new MyHandler();
|
||||
mListener = new PrintManager.PrintServicesChangeListener() {
|
||||
@Override public void onPrintServicesChanged() {
|
||||
queueNewResult();
|
||||
@@ -95,10 +95,7 @@ public class PrintServicesLoader extends Loader<List<PrintServiceInfo>> {
|
||||
mListener = null;
|
||||
}
|
||||
|
||||
if (mHandler != null) {
|
||||
mHandler.removeMessages(0);
|
||||
mHandler = null;
|
||||
}
|
||||
mHandler.removeMessages(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -119,8 +116,6 @@ public class PrintServicesLoader extends Loader<List<PrintServiceInfo>> {
|
||||
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
|
||||
if (isStarted()) {
|
||||
deliverResult((List<PrintServiceInfo>) msg.obj);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user