diff options
author | Philip P. Moltmann <moltmann@google.com> | 2016-02-09 17:21:11 -0800 |
---|---|---|
committer | Philip P. Moltmann <moltmann@google.com> | 2016-02-09 17:21:11 -0800 |
commit | 3443489e5118b21b9d87297e94ce79b45e3eaa5d (patch) | |
tree | 4b47f6d1cf64fcfe907cf5a8fca0f216b2061ef5 | |
parent | d4298a55a98ccc93467bd598a185538b0bd54453 (diff) | |
download | experimental-3443489e5118b21b9d87297e94ce79b45e3eaa5d.tar.gz |
Printer Discovery: Cleanup small issues left after last change.
Change-Id: I88d99973419f804485d33313f4b18efb2bf04329
7 files changed, 12 insertions, 14 deletions
diff --git a/PrinterVendorDiscovery/res/xml/vendorconfigs.xml b/PrinterVendorDiscovery/res/xml/vendorconfigs.xml index bf1922d..19f304f 100644 --- a/PrinterVendorDiscovery/res/xml/vendorconfigs.xml +++ b/PrinterVendorDiscovery/res/xml/vendorconfigs.xml @@ -16,8 +16,7 @@ limitations under the License. --> -<vendors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="vendorconfigs_schema.xsd"> +<vendors> <vendor> <name>@string/plugin_vendor_mopria</name> <package>org.mopria.printplugin</package> diff --git a/PrinterVendorDiscovery/src/com/android/printerdiscovery/IPrinterDiscoveryPlugin.java b/PrinterVendorDiscovery/src/com/android/printerdiscovery/IPrinterDiscoveryPlugin.java index a4f0fce..18b7372 100644 --- a/PrinterVendorDiscovery/src/com/android/printerdiscovery/IPrinterDiscoveryPlugin.java +++ b/PrinterVendorDiscovery/src/com/android/printerdiscovery/IPrinterDiscoveryPlugin.java @@ -18,7 +18,6 @@ package com.android.printerdiscovery; import android.annotation.IntRange; import android.annotation.NonNull; -import android.content.Context; import android.content.Intent; /** diff --git a/PrinterVendorDiscovery/src/com/android/printerdiscovery/PrinterDiscovery.java b/PrinterVendorDiscovery/src/com/android/printerdiscovery/PrinterDiscovery.java index 0e921dc..2d776a0 100644 --- a/PrinterVendorDiscovery/src/com/android/printerdiscovery/PrinterDiscovery.java +++ b/PrinterVendorDiscovery/src/com/android/printerdiscovery/PrinterDiscovery.java @@ -144,7 +144,7 @@ public class PrinterDiscovery extends Activity @Override public boolean isEmpty() { - return mPlugins.size() == 0; + return mPlugins.isEmpty(); } }); } @@ -172,7 +172,7 @@ public class PrinterDiscovery extends Activity if (!config.getMDNSNames().isEmpty()) { try { plugins.add(new RemotePrinterDiscoveryPlugin( - new MDNSFilterPlugin(this.getApplicationContext(), config.getName(), + new MDNSFilterPlugin(getApplicationContext(), config.getName(), config.getPackageName(), config.getMDNSNames()), this)); } catch (Throwable e) { Log.e(LOG_TAG, "Could not create plugin for " + config, e); @@ -182,7 +182,7 @@ public class PrinterDiscovery extends Activity try { plugins.add( - new RemotePrinterDiscoveryPlugin(new GCPPlugin(this.getApplicationContext()), + new RemotePrinterDiscoveryPlugin(new GCPPlugin(getApplicationContext()), this)); } catch (Throwable e) { Log.e(LOG_TAG, "Could not create GCP plugin", e); @@ -190,7 +190,7 @@ public class PrinterDiscovery extends Activity try { plugins.add( - new RemotePrinterDiscoveryPlugin(new MopriaPlugin(this.getApplicationContext()), + new RemotePrinterDiscoveryPlugin(new MopriaPlugin(getApplicationContext()), this)); } catch (Throwable e) { Log.e(LOG_TAG, "Could not create mopria plugin", e); diff --git a/PrinterVendorDiscovery/src/com/android/printerdiscovery/VendorConfig.java b/PrinterVendorDiscovery/src/com/android/printerdiscovery/VendorConfig.java index 393a7a6..30ba2ae 100644 --- a/PrinterVendorDiscovery/src/com/android/printerdiscovery/VendorConfig.java +++ b/PrinterVendorDiscovery/src/com/android/printerdiscovery/VendorConfig.java @@ -214,7 +214,7 @@ public class VendorConfig { * * @param context The content issuing the read * - * @return An map pointing from vendor name to {@link VendorConfig} + * @return An map pointing from vendor name to config * * @throws IOException * @throws XmlPullParserException @@ -255,7 +255,7 @@ public class VendorConfig { * @param tagName The vendor tag * @param context Calling context * - * @return A {@link VendorConfig} + * @return A config * * @throws XmlPullParserException * @throws IOException diff --git a/PrinterVendorDiscovery/src/com/android/printerdiscovery/plugins/gcp/GCPPlugin.java b/PrinterVendorDiscovery/src/com/android/printerdiscovery/plugins/gcp/GCPPlugin.java index c4c44b1..c9f2fee 100644 --- a/PrinterVendorDiscovery/src/com/android/printerdiscovery/plugins/gcp/GCPPlugin.java +++ b/PrinterVendorDiscovery/src/com/android/printerdiscovery/plugins/gcp/GCPPlugin.java @@ -96,7 +96,7 @@ public class GCPPlugin implements IPrinterDiscoveryPlugin, IDiscoveryListener { * * @return The list of service names */ - private ArrayList<String> getServicesNames(NetworkDevice networkDevice) { + private @NonNull ArrayList<String> getServicesNames(@NonNull NetworkDevice networkDevice) { ArrayList<String> mDnsServices = new ArrayList<>(); ArrayList<NetworkDevice> instances = networkDevice.getAllDiscoveryInstances(); diff --git a/PrinterVendorDiscovery/src/com/android/printerdiscovery/plugins/mopria/MopriaPlugin.java b/PrinterVendorDiscovery/src/com/android/printerdiscovery/plugins/mopria/MopriaPlugin.java index aecb4dd..c5022f7 100644 --- a/PrinterVendorDiscovery/src/com/android/printerdiscovery/plugins/mopria/MopriaPlugin.java +++ b/PrinterVendorDiscovery/src/com/android/printerdiscovery/plugins/mopria/MopriaPlugin.java @@ -97,7 +97,7 @@ public class MopriaPlugin implements IPrinterDiscoveryPlugin, IDiscoveryListener * * @return The list of service names */ - private ArrayList<String> getServicesNames(NetworkDevice networkDevice) { + private @NonNull ArrayList<String> getServicesNames(@NonNull NetworkDevice networkDevice) { ArrayList<String> mDnsServices = new ArrayList<>(); ArrayList<NetworkDevice> instances = networkDevice.getAllDiscoveryInstances(); @@ -116,7 +116,7 @@ public class MopriaPlugin implements IPrinterDiscoveryPlugin, IDiscoveryListener * * @return true iff the device is a GCP printer */ - private boolean isMopriaPrinter(NetworkDevice networkDevice) { + private boolean isMopriaPrinter(@NonNull NetworkDevice networkDevice) { final String ippService = mContext.getString(R.string.mdns_service_ipp); if (!getServicesNames(networkDevice).contains(ippService)) { diff --git a/PrinterVendorDiscovery/src/com/android/printerdiscovery/servicediscovery/NetworkDiscovery.java b/PrinterVendorDiscovery/src/com/android/printerdiscovery/servicediscovery/NetworkDiscovery.java index 1193853..259ec4c 100644 --- a/PrinterVendorDiscovery/src/com/android/printerdiscovery/servicediscovery/NetworkDiscovery.java +++ b/PrinterVendorDiscovery/src/com/android/printerdiscovery/servicediscovery/NetworkDiscovery.java @@ -73,7 +73,7 @@ public class NetworkDiscovery { /** * Register a new listener for network devices. If this is the first listener, this starts a new - * {@link NetworkDiscovery discovery session}. + * discovery session. * * @param listener Listener to register. * @param context Context the listener is running in. @@ -210,7 +210,7 @@ public class NetworkDiscovery { @Override public void run() { while (true) { - byte buffer[] = new byte[BUFFER_LENGTH]; + byte[] buffer = new byte[BUFFER_LENGTH]; DatagramPacket packet = new DatagramPacket(buffer, buffer.length); try { |