Search in sources :

Example 1 with SamsungRecommendationPlugin

use of com.android.printservice.recommendation.plugin.samsung.SamsungRecommendationPlugin in project platform_frameworks_base by android.

the class RecommendationServiceImpl method onConnected.

@Override
public void onConnected() {
    mPlugins = new ArrayList<>();
    try {
        for (VendorConfig config : VendorConfig.getAllConfigs(this)) {
            try {
                mPlugins.add(new RemotePrintServicePlugin(new MDNSFilterPlugin(this, config.name, config.packageName, config.mDNSNames), this, false));
            } catch (Exception e) {
                Log.e(LOG_TAG, "Could not initiate simple MDNS plugin for " + config.packageName, e);
            }
        }
    } catch (IOException | XmlPullParserException e) {
        new RuntimeException("Could not parse vendorconfig", e);
    }
    try {
        mPlugins.add(new RemotePrintServicePlugin(new HPRecommendationPlugin(this), this, false));
    } catch (Exception e) {
        Log.e(LOG_TAG, "Could not initiate " + getString(R.string.plugin_vendor_hp) + " plugin", e);
    }
    try {
        mPlugins.add(new RemotePrintServicePlugin(new MopriaRecommendationPlugin(this), this, true));
    } catch (Exception e) {
        Log.e(LOG_TAG, "Could not initiate " + getString(R.string.plugin_vendor_morpia) + " plugin", e);
    }
    try {
        mPlugins.add(new RemotePrintServicePlugin(new SamsungRecommendationPlugin(this), this, true));
    } catch (Exception e) {
        Log.e(LOG_TAG, "Could not initiate " + getString(R.string.plugin_vendor_samsung) + " plugin", e);
    }
    try {
        mPlugins.add(new RemotePrintServicePlugin(new XeroxPrintServiceRecommendationPlugin(this), this, false));
    } catch (Exception e) {
        Log.e(LOG_TAG, "Could not initiate " + getString(R.string.plugin_vendor_xerox) + " plugin", e);
    }
    final int numPlugins = mPlugins.size();
    for (int i = 0; i < numPlugins; i++) {
        try {
            mPlugins.get(i).start();
        } catch (RemotePrintServicePlugin.PluginException e) {
            Log.e(LOG_TAG, "Could not start plugin", e);
        }
    }
}
Also used : XeroxPrintServiceRecommendationPlugin(com.android.printservice.recommendation.plugin.xerox.XeroxPrintServiceRecommendationPlugin) IOException(java.io.IOException) IOException(java.io.IOException) XmlPullParserException(org.xmlpull.v1.XmlPullParserException) SamsungRecommendationPlugin(com.android.printservice.recommendation.plugin.samsung.SamsungRecommendationPlugin) MopriaRecommendationPlugin(com.android.printservice.recommendation.plugin.mopria.MopriaRecommendationPlugin) HPRecommendationPlugin(com.android.printservice.recommendation.plugin.hp.HPRecommendationPlugin) VendorConfig(com.android.printservice.recommendation.plugin.mdnsFilter.VendorConfig) MDNSFilterPlugin(com.android.printservice.recommendation.plugin.mdnsFilter.MDNSFilterPlugin) XmlPullParserException(org.xmlpull.v1.XmlPullParserException)

Example 2 with SamsungRecommendationPlugin

use of com.android.printservice.recommendation.plugin.samsung.SamsungRecommendationPlugin in project android_frameworks_base by DirtyUnicorns.

the class RecommendationServiceImpl method onConnected.

@Override
public void onConnected() {
    mPlugins = new ArrayList<>();
    try {
        for (VendorConfig config : VendorConfig.getAllConfigs(this)) {
            try {
                mPlugins.add(new RemotePrintServicePlugin(new MDNSFilterPlugin(this, config.name, config.packageName, config.mDNSNames), this, false));
            } catch (Exception e) {
                Log.e(LOG_TAG, "Could not initiate simple MDNS plugin for " + config.packageName, e);
            }
        }
    } catch (IOException | XmlPullParserException e) {
        new RuntimeException("Could not parse vendorconfig", e);
    }
    try {
        mPlugins.add(new RemotePrintServicePlugin(new HPRecommendationPlugin(this), this, false));
    } catch (Exception e) {
        Log.e(LOG_TAG, "Could not initiate " + getString(R.string.plugin_vendor_hp) + " plugin", e);
    }
    try {
        mPlugins.add(new RemotePrintServicePlugin(new MopriaRecommendationPlugin(this), this, true));
    } catch (Exception e) {
        Log.e(LOG_TAG, "Could not initiate " + getString(R.string.plugin_vendor_morpia) + " plugin", e);
    }
    try {
        mPlugins.add(new RemotePrintServicePlugin(new SamsungRecommendationPlugin(this), this, false));
    } catch (Exception e) {
        Log.e(LOG_TAG, "Could not initiate " + getString(R.string.plugin_vendor_samsung) + " plugin", e);
    }
    try {
        mPlugins.add(new RemotePrintServicePlugin(new XeroxPrintServiceRecommendationPlugin(this), this, false));
    } catch (Exception e) {
        Log.e(LOG_TAG, "Could not initiate " + getString(R.string.plugin_vendor_xerox) + " plugin", e);
    }
    final int numPlugins = mPlugins.size();
    for (int i = 0; i < numPlugins; i++) {
        try {
            mPlugins.get(i).start();
        } catch (RemotePrintServicePlugin.PluginException e) {
            Log.e(LOG_TAG, "Could not start plugin", e);
        }
    }
}
Also used : XeroxPrintServiceRecommendationPlugin(com.android.printservice.recommendation.plugin.xerox.XeroxPrintServiceRecommendationPlugin) IOException(java.io.IOException) IOException(java.io.IOException) XmlPullParserException(org.xmlpull.v1.XmlPullParserException) SamsungRecommendationPlugin(com.android.printservice.recommendation.plugin.samsung.SamsungRecommendationPlugin) MopriaRecommendationPlugin(com.android.printservice.recommendation.plugin.mopria.MopriaRecommendationPlugin) HPRecommendationPlugin(com.android.printservice.recommendation.plugin.hp.HPRecommendationPlugin) VendorConfig(com.android.printservice.recommendation.plugin.mdnsFilter.VendorConfig) MDNSFilterPlugin(com.android.printservice.recommendation.plugin.mdnsFilter.MDNSFilterPlugin) XmlPullParserException(org.xmlpull.v1.XmlPullParserException)

Example 3 with SamsungRecommendationPlugin

use of com.android.printservice.recommendation.plugin.samsung.SamsungRecommendationPlugin in project android_frameworks_base by AOSPA.

the class RecommendationServiceImpl method onConnected.

@Override
public void onConnected() {
    mPlugins = new ArrayList<>();
    try {
        for (VendorConfig config : VendorConfig.getAllConfigs(this)) {
            try {
                mPlugins.add(new RemotePrintServicePlugin(new MDNSFilterPlugin(this, config.name, config.packageName, config.mDNSNames), this, false));
            } catch (Exception e) {
                Log.e(LOG_TAG, "Could not initiate simple MDNS plugin for " + config.packageName, e);
            }
        }
    } catch (IOException | XmlPullParserException e) {
        new RuntimeException("Could not parse vendorconfig", e);
    }
    try {
        mPlugins.add(new RemotePrintServicePlugin(new HPRecommendationPlugin(this), this, false));
    } catch (Exception e) {
        Log.e(LOG_TAG, "Could not initiate " + getString(R.string.plugin_vendor_hp) + " plugin", e);
    }
    try {
        mPlugins.add(new RemotePrintServicePlugin(new MopriaRecommendationPlugin(this), this, true));
    } catch (Exception e) {
        Log.e(LOG_TAG, "Could not initiate " + getString(R.string.plugin_vendor_morpia) + " plugin", e);
    }
    try {
        mPlugins.add(new RemotePrintServicePlugin(new SamsungRecommendationPlugin(this), this, false));
    } catch (Exception e) {
        Log.e(LOG_TAG, "Could not initiate " + getString(R.string.plugin_vendor_samsung) + " plugin", e);
    }
    try {
        mPlugins.add(new RemotePrintServicePlugin(new XeroxPrintServiceRecommendationPlugin(this), this, false));
    } catch (Exception e) {
        Log.e(LOG_TAG, "Could not initiate " + getString(R.string.plugin_vendor_xerox) + " plugin", e);
    }
    final int numPlugins = mPlugins.size();
    for (int i = 0; i < numPlugins; i++) {
        try {
            mPlugins.get(i).start();
        } catch (RemotePrintServicePlugin.PluginException e) {
            Log.e(LOG_TAG, "Could not start plugin", e);
        }
    }
}
Also used : XeroxPrintServiceRecommendationPlugin(com.android.printservice.recommendation.plugin.xerox.XeroxPrintServiceRecommendationPlugin) IOException(java.io.IOException) IOException(java.io.IOException) XmlPullParserException(org.xmlpull.v1.XmlPullParserException) SamsungRecommendationPlugin(com.android.printservice.recommendation.plugin.samsung.SamsungRecommendationPlugin) MopriaRecommendationPlugin(com.android.printservice.recommendation.plugin.mopria.MopriaRecommendationPlugin) HPRecommendationPlugin(com.android.printservice.recommendation.plugin.hp.HPRecommendationPlugin) VendorConfig(com.android.printservice.recommendation.plugin.mdnsFilter.VendorConfig) MDNSFilterPlugin(com.android.printservice.recommendation.plugin.mdnsFilter.MDNSFilterPlugin) XmlPullParserException(org.xmlpull.v1.XmlPullParserException)

Example 4 with SamsungRecommendationPlugin

use of com.android.printservice.recommendation.plugin.samsung.SamsungRecommendationPlugin in project android_frameworks_base by ResurrectionRemix.

the class RecommendationServiceImpl method onConnected.

@Override
public void onConnected() {
    mPlugins = new ArrayList<>();
    try {
        for (VendorConfig config : VendorConfig.getAllConfigs(this)) {
            try {
                mPlugins.add(new RemotePrintServicePlugin(new MDNSFilterPlugin(this, config.name, config.packageName, config.mDNSNames), this, false));
            } catch (Exception e) {
                Log.e(LOG_TAG, "Could not initiate simple MDNS plugin for " + config.packageName, e);
            }
        }
    } catch (IOException | XmlPullParserException e) {
        new RuntimeException("Could not parse vendorconfig", e);
    }
    try {
        mPlugins.add(new RemotePrintServicePlugin(new HPRecommendationPlugin(this), this, false));
    } catch (Exception e) {
        Log.e(LOG_TAG, "Could not initiate " + getString(R.string.plugin_vendor_hp) + " plugin", e);
    }
    try {
        mPlugins.add(new RemotePrintServicePlugin(new MopriaRecommendationPlugin(this), this, true));
    } catch (Exception e) {
        Log.e(LOG_TAG, "Could not initiate " + getString(R.string.plugin_vendor_morpia) + " plugin", e);
    }
    try {
        mPlugins.add(new RemotePrintServicePlugin(new SamsungRecommendationPlugin(this), this, false));
    } catch (Exception e) {
        Log.e(LOG_TAG, "Could not initiate " + getString(R.string.plugin_vendor_samsung) + " plugin", e);
    }
    try {
        mPlugins.add(new RemotePrintServicePlugin(new XeroxPrintServiceRecommendationPlugin(this), this, false));
    } catch (Exception e) {
        Log.e(LOG_TAG, "Could not initiate " + getString(R.string.plugin_vendor_xerox) + " plugin", e);
    }
    final int numPlugins = mPlugins.size();
    for (int i = 0; i < numPlugins; i++) {
        try {
            mPlugins.get(i).start();
        } catch (RemotePrintServicePlugin.PluginException e) {
            Log.e(LOG_TAG, "Could not start plugin", e);
        }
    }
}
Also used : XeroxPrintServiceRecommendationPlugin(com.android.printservice.recommendation.plugin.xerox.XeroxPrintServiceRecommendationPlugin) IOException(java.io.IOException) IOException(java.io.IOException) XmlPullParserException(org.xmlpull.v1.XmlPullParserException) SamsungRecommendationPlugin(com.android.printservice.recommendation.plugin.samsung.SamsungRecommendationPlugin) MopriaRecommendationPlugin(com.android.printservice.recommendation.plugin.mopria.MopriaRecommendationPlugin) HPRecommendationPlugin(com.android.printservice.recommendation.plugin.hp.HPRecommendationPlugin) VendorConfig(com.android.printservice.recommendation.plugin.mdnsFilter.VendorConfig) MDNSFilterPlugin(com.android.printservice.recommendation.plugin.mdnsFilter.MDNSFilterPlugin) XmlPullParserException(org.xmlpull.v1.XmlPullParserException)

Example 5 with SamsungRecommendationPlugin

use of com.android.printservice.recommendation.plugin.samsung.SamsungRecommendationPlugin in project android_frameworks_base by crdroidandroid.

the class RecommendationServiceImpl method onConnected.

@Override
public void onConnected() {
    mPlugins = new ArrayList<>();
    try {
        for (VendorConfig config : VendorConfig.getAllConfigs(this)) {
            try {
                mPlugins.add(new RemotePrintServicePlugin(new MDNSFilterPlugin(this, config.name, config.packageName, config.mDNSNames), this, false));
            } catch (Exception e) {
                Log.e(LOG_TAG, "Could not initiate simple MDNS plugin for " + config.packageName, e);
            }
        }
    } catch (IOException | XmlPullParserException e) {
        new RuntimeException("Could not parse vendorconfig", e);
    }
    try {
        mPlugins.add(new RemotePrintServicePlugin(new HPRecommendationPlugin(this), this, false));
    } catch (Exception e) {
        Log.e(LOG_TAG, "Could not initiate " + getString(R.string.plugin_vendor_hp) + " plugin", e);
    }
    try {
        mPlugins.add(new RemotePrintServicePlugin(new MopriaRecommendationPlugin(this), this, true));
    } catch (Exception e) {
        Log.e(LOG_TAG, "Could not initiate " + getString(R.string.plugin_vendor_morpia) + " plugin", e);
    }
    try {
        mPlugins.add(new RemotePrintServicePlugin(new SamsungRecommendationPlugin(this), this, false));
    } catch (Exception e) {
        Log.e(LOG_TAG, "Could not initiate " + getString(R.string.plugin_vendor_samsung) + " plugin", e);
    }
    try {
        mPlugins.add(new RemotePrintServicePlugin(new XeroxPrintServiceRecommendationPlugin(this), this, false));
    } catch (Exception e) {
        Log.e(LOG_TAG, "Could not initiate " + getString(R.string.plugin_vendor_xerox) + " plugin", e);
    }
    final int numPlugins = mPlugins.size();
    for (int i = 0; i < numPlugins; i++) {
        try {
            mPlugins.get(i).start();
        } catch (RemotePrintServicePlugin.PluginException e) {
            Log.e(LOG_TAG, "Could not start plugin", e);
        }
    }
}
Also used : XeroxPrintServiceRecommendationPlugin(com.android.printservice.recommendation.plugin.xerox.XeroxPrintServiceRecommendationPlugin) IOException(java.io.IOException) IOException(java.io.IOException) XmlPullParserException(org.xmlpull.v1.XmlPullParserException) SamsungRecommendationPlugin(com.android.printservice.recommendation.plugin.samsung.SamsungRecommendationPlugin) MopriaRecommendationPlugin(com.android.printservice.recommendation.plugin.mopria.MopriaRecommendationPlugin) HPRecommendationPlugin(com.android.printservice.recommendation.plugin.hp.HPRecommendationPlugin) VendorConfig(com.android.printservice.recommendation.plugin.mdnsFilter.VendorConfig) MDNSFilterPlugin(com.android.printservice.recommendation.plugin.mdnsFilter.MDNSFilterPlugin) XmlPullParserException(org.xmlpull.v1.XmlPullParserException)

Aggregations

HPRecommendationPlugin (com.android.printservice.recommendation.plugin.hp.HPRecommendationPlugin)5 MDNSFilterPlugin (com.android.printservice.recommendation.plugin.mdnsFilter.MDNSFilterPlugin)5 VendorConfig (com.android.printservice.recommendation.plugin.mdnsFilter.VendorConfig)5 MopriaRecommendationPlugin (com.android.printservice.recommendation.plugin.mopria.MopriaRecommendationPlugin)5 SamsungRecommendationPlugin (com.android.printservice.recommendation.plugin.samsung.SamsungRecommendationPlugin)5 XeroxPrintServiceRecommendationPlugin (com.android.printservice.recommendation.plugin.xerox.XeroxPrintServiceRecommendationPlugin)5 IOException (java.io.IOException)5 XmlPullParserException (org.xmlpull.v1.XmlPullParserException)5