mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-08-31 06:05:12 +00:00
Spam less to the error channel
This commit is contained in:
@@ -78,17 +78,17 @@ public class BackgroundService extends Service {
|
||||
@Override
|
||||
public void onConnectionReceived(final NetworkPackage identityPackage, final BaseComputerLink link) {
|
||||
|
||||
Log.e("BackgroundService", "Connection accepted!");
|
||||
Log.i("BackgroundService", "Connection accepted!");
|
||||
|
||||
String deviceId = identityPackage.getString("deviceId");
|
||||
|
||||
Device device = devices.get(deviceId);
|
||||
|
||||
if (device != null) {
|
||||
Log.e("BackgroundService", "addLink, known device: "+deviceId);
|
||||
Log.i("BackgroundService", "addLink, known device: "+deviceId);
|
||||
device.addLink(link);
|
||||
} else {
|
||||
Log.e("BackgroundService", "addLink,unknown device: "+deviceId);
|
||||
Log.i("BackgroundService", "addLink,unknown device: "+deviceId);
|
||||
String name = identityPackage.getString("deviceName");
|
||||
device = new Device(getBaseContext(), deviceId, name, link);
|
||||
devices.put(deviceId, device);
|
||||
@@ -101,7 +101,7 @@ public class BackgroundService extends Service {
|
||||
@Override
|
||||
public void onConnectionLost(BaseComputerLink link) {
|
||||
Device d = devices.get(link.getDeviceId());
|
||||
Log.e("onConnectionLost","removeLink, deviceId: "+link.getDeviceId());
|
||||
Log.i("onConnectionLost","removeLink, deviceId: "+link.getDeviceId());
|
||||
if (d != null) {
|
||||
d.removeLink(link);
|
||||
if (!d.isReachable() && !d.isPaired()) {
|
||||
|
@@ -11,7 +11,7 @@ public class LanComputerLink extends BaseComputerLink {
|
||||
private IoSession session = null;
|
||||
|
||||
public void disconnect() {
|
||||
Log.e("LanComputerLink","Disconnect: "+session.getRemoteAddress().toString());
|
||||
Log.i("LanComputerLink","Disconnect: "+session.getRemoteAddress().toString());
|
||||
session.close(true);
|
||||
}
|
||||
|
||||
@@ -22,9 +22,8 @@ public class LanComputerLink extends BaseComputerLink {
|
||||
|
||||
@Override
|
||||
public boolean sendPackage(NetworkPackage np) {
|
||||
Log.e("TcpComputerLink", "sendPackage");
|
||||
if (session == null) {
|
||||
Log.e("TcpComputerLink","not yet connected");
|
||||
Log.e("LanComputerLink","sendPackage failed: not yet connected");
|
||||
return false;
|
||||
} else {
|
||||
session.write(np.serialize());
|
||||
|
@@ -203,7 +203,7 @@ public class Device implements BaseComputerLink.PackageReceiver {
|
||||
|
||||
public void acceptPairing() {
|
||||
|
||||
Log.e("Device","Accepted pairing");
|
||||
Log.i("Device","Accepted pairing");
|
||||
|
||||
//Send our own public key
|
||||
NetworkPackage np = NetworkPackage.createPublicKeyPackage(context);
|
||||
@@ -232,7 +232,7 @@ public class Device implements BaseComputerLink.PackageReceiver {
|
||||
|
||||
public void rejectPairing() {
|
||||
|
||||
Log.e("Device","Rejected pairing");
|
||||
Log.i("Device","Rejected pairing");
|
||||
|
||||
pairStatus = PairStatus.NotPaired;
|
||||
|
||||
@@ -259,7 +259,7 @@ public class Device implements BaseComputerLink.PackageReceiver {
|
||||
|
||||
links.add(link);
|
||||
|
||||
Log.e("Device","addLink "+link.getLinkProvider().getName()+" -> "+getName() + " active links: "+ links.size());
|
||||
Log.i("Device","addLink "+link.getLinkProvider().getName()+" -> "+getName() + " active links: "+ links.size());
|
||||
|
||||
Collections.sort(links, new Comparator<BaseComputerLink>() {
|
||||
@Override
|
||||
@@ -278,7 +278,7 @@ public class Device implements BaseComputerLink.PackageReceiver {
|
||||
public void removeLink(BaseComputerLink link) {
|
||||
link.removePackageReceiver(this);
|
||||
links.remove(link);
|
||||
Log.e("Device","removeLink: "+link.getLinkProvider().getName() + " -> "+getName() + " active links: "+ links.size());
|
||||
Log.i("Device","removeLink: "+link.getLinkProvider().getName() + " -> "+getName() + " active links: "+ links.size());
|
||||
if (links.isEmpty()) {
|
||||
reloadPluginsFromSettings();
|
||||
}
|
||||
@@ -289,7 +289,7 @@ public class Device implements BaseComputerLink.PackageReceiver {
|
||||
|
||||
if (np.getType().equals(NetworkPackage.PACKAGE_TYPE_PAIR)) {
|
||||
|
||||
Log.e("Device","Pair package");
|
||||
Log.i("Device","Pair package");
|
||||
|
||||
boolean wantsPair = np.getBoolean("pair");
|
||||
|
||||
@@ -318,7 +318,7 @@ public class Device implements BaseComputerLink.PackageReceiver {
|
||||
|
||||
if (pairStatus == PairStatus.Requested) { //We started pairing
|
||||
|
||||
Log.e("Pairing","Pair answer");
|
||||
Log.i("Pairing","Pair answer");
|
||||
|
||||
pairStatus = PairStatus.Paired;
|
||||
pairingTimer.cancel();
|
||||
@@ -340,7 +340,7 @@ public class Device implements BaseComputerLink.PackageReceiver {
|
||||
|
||||
} else {
|
||||
|
||||
Log.e("Pairing","Pair request");
|
||||
Log.i("Pairing","Pair request");
|
||||
|
||||
Intent intent = new Intent(context, PairActivity.class);
|
||||
intent.putExtra("deviceId", deviceId);
|
||||
@@ -377,7 +377,7 @@ public class Device implements BaseComputerLink.PackageReceiver {
|
||||
|
||||
}
|
||||
} else {
|
||||
Log.e("Pairing","Unpair request");
|
||||
Log.i("Pairing","Unpair request");
|
||||
|
||||
if (pairStatus == PairStatus.Requested) {
|
||||
pairingTimer.cancel();
|
||||
@@ -438,7 +438,6 @@ public class Device implements BaseComputerLink.PackageReceiver {
|
||||
new AsyncTask<Void,Void,Void>() {
|
||||
@Override
|
||||
protected Void doInBackground(Void... voids) {
|
||||
//Log.e("sendPackage","Do in background");
|
||||
for(BaseComputerLink link : links) {
|
||||
//Log.e("sendPackage","Trying "+link.getLinkProvider().getName());
|
||||
if (link.sendPackage(np)) {
|
||||
@@ -471,7 +470,7 @@ public class Device implements BaseComputerLink.PackageReceiver {
|
||||
private void addPlugin(final String name) {
|
||||
Plugin existing = plugins.get(name);
|
||||
if (existing != null) {
|
||||
Log.e("addPlugin","plugin already present:" + name);
|
||||
Log.w("addPlugin","plugin already present:" + name);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -568,7 +567,6 @@ public class Device implements BaseComputerLink.PackageReceiver {
|
||||
if (isPaired() && isReachable()) {
|
||||
enabled = isPluginEnabled(pluginName);
|
||||
}
|
||||
//Log.e("reloadPluginsFromSettings",pluginName+"->"+enabled);
|
||||
if (enabled) {
|
||||
addPlugin(pluginName);
|
||||
} else {
|
||||
|
@@ -11,7 +11,7 @@ public class ContactsHelper {
|
||||
|
||||
public static String phoneNumberLookup(Context context, String number) {
|
||||
|
||||
Log.e("PhoneNumberLookup", number);
|
||||
//Log.e("PhoneNumberLookup", number);
|
||||
|
||||
Uri uri = Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, Uri.encode(number));
|
||||
Cursor cursor = null;
|
||||
@@ -34,7 +34,7 @@ public class ContactsHelper {
|
||||
int nameIndex = cursor.getColumnIndex(ContactsContract.PhoneLookup.DISPLAY_NAME);
|
||||
if (nameIndex != -1) {
|
||||
String name = cursor.getString(nameIndex);
|
||||
Log.e("PhoneNumberLookup", "success: " + name);
|
||||
//Log.e("PhoneNumberLookup", "success: " + name);
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
@@ -13,14 +13,14 @@ public class KdeConnectBroadcastReceiver extends BroadcastReceiver
|
||||
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
|
||||
Log.e("KdeConnect", "Broadcast event: "+intent.getAction());
|
||||
//Log.e("KdeConnect", "Broadcast event: "+intent.getAction());
|
||||
|
||||
String action = intent.getAction();
|
||||
|
||||
if(action.equals(Intent.ACTION_PACKAGE_REPLACED)) {
|
||||
Log.e("KdeConnect", "UpdateReceiver");
|
||||
Log.i("KdeConnect", "UpdateReceiver");
|
||||
if (!intent.getData().getSchemeSpecificPart().equals(context.getPackageName())) {
|
||||
Log.e("KdeConnect", "Ignoring, it's not me!");
|
||||
Log.i("KdeConnect", "Ignoring, it's not me!");
|
||||
return;
|
||||
}
|
||||
BackgroundService.RunCommand(context, new BackgroundService.InstanceCallback() {
|
||||
@@ -30,7 +30,7 @@ public class KdeConnectBroadcastReceiver extends BroadcastReceiver
|
||||
}
|
||||
});
|
||||
} else if (action.equals(Intent.ACTION_BOOT_COMPLETED)) {
|
||||
Log.e("KdeConnect", "KdeConnectBroadcastReceiver");
|
||||
Log.i("KdeConnect", "KdeConnectBroadcastReceiver");
|
||||
BackgroundService.RunCommand(context, new BackgroundService.InstanceCallback() {
|
||||
@Override
|
||||
public void onServiceStart(BackgroundService service) {
|
||||
@@ -41,7 +41,7 @@ public class KdeConnectBroadcastReceiver extends BroadcastReceiver
|
||||
|| action.equals(WifiManager.WIFI_STATE_CHANGED_ACTION)
|
||||
|| action.equals(ConnectivityManager.CONNECTIVITY_ACTION)
|
||||
) {
|
||||
Log.e("KdeConnect", "Connection state changed, trying to connect");
|
||||
Log.i("KdeConnect", "Connection state changed, trying to connect");
|
||||
BackgroundService.RunCommand(context, new BackgroundService.InstanceCallback() {
|
||||
@Override
|
||||
public void onServiceStart(BackgroundService service) {
|
||||
@@ -56,7 +56,7 @@ public class KdeConnectBroadcastReceiver extends BroadcastReceiver
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Log.e("KdeConnectBroadcastReceiver", "Ignoring broadcast event: "+intent.getAction());
|
||||
Log.i("KdeConnectBroadcastReceiver", "Ignoring broadcast event: "+intent.getAction());
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -26,13 +26,13 @@ public abstract class BaseLinkProvider {
|
||||
|
||||
//These two should be called when the provider links to a new computer
|
||||
protected void connectionAccepted(NetworkPackage identityPackage, BaseComputerLink link) {
|
||||
Log.e("LinkProvider", "connectionAccepted");
|
||||
Log.i("LinkProvider", "connectionAccepted");
|
||||
for(ConnectionReceiver cr : connectionReceivers) {
|
||||
cr.onConnectionReceived(identityPackage, link);
|
||||
}
|
||||
}
|
||||
protected void connectionLost(BaseComputerLink link) {
|
||||
Log.e("LinkProvider", "connectionLost");
|
||||
Log.i("LinkProvider", "connectionLost");
|
||||
for(ConnectionReceiver cr : connectionReceivers) {
|
||||
cr.onConnectionLost(link);
|
||||
}
|
||||
|
@@ -88,7 +88,7 @@ public class LanLinkProvider extends BaseLinkProvider {
|
||||
public void messageReceived(IoSession udpSession, Object message) throws Exception {
|
||||
super.messageReceived(udpSession, message);
|
||||
|
||||
Log.e("LanLinkProvider", "Udp message received (" + message.getClass() + ") " + message.toString());
|
||||
//Log.e("LanLinkProvider", "Udp message received (" + message.getClass() + ") " + message.toString());
|
||||
|
||||
NetworkPackage np = null;
|
||||
|
||||
@@ -114,7 +114,7 @@ public class LanLinkProvider extends BaseLinkProvider {
|
||||
}
|
||||
}
|
||||
|
||||
Log.e("LanLinkProvider", "It is an identity package, creating link");
|
||||
Log.i("LanLinkProvider", "Identity package received, creating link");
|
||||
|
||||
try {
|
||||
final InetSocketAddress address = (InetSocketAddress) udpSession.getRemoteAddress();
|
||||
@@ -136,7 +136,7 @@ public class LanLinkProvider extends BaseLinkProvider {
|
||||
public void operationComplete(IoFuture ioFuture) {
|
||||
IoSession session = ioFuture.getSession();
|
||||
|
||||
Log.e("LanLinkProvider", "Connection successful: " + session.isConnected());
|
||||
Log.i("LanLinkProvider", "Connection successful: " + session.isConnected());
|
||||
|
||||
LanComputerLink link = new LanComputerLink(session, identityPackage.getString("deviceId"), LanLinkProvider.this);
|
||||
|
||||
@@ -159,12 +159,12 @@ public class LanLinkProvider extends BaseLinkProvider {
|
||||
|
||||
private void addLink(NetworkPackage identityPackage, LanComputerLink link) {
|
||||
String deviceId = identityPackage.getString("deviceId");
|
||||
Log.e("LanLinkProvider","addLink to "+deviceId);
|
||||
Log.i("LanLinkProvider","addLink to "+deviceId);
|
||||
LanComputerLink oldLink = visibleComputers.get(deviceId);
|
||||
visibleComputers.put(deviceId, link);
|
||||
connectionAccepted(identityPackage, link);
|
||||
if (oldLink != null) {
|
||||
Log.e("LanLinkProvider","Removing old connection to same device");
|
||||
Log.i("LanLinkProvider","Removing old connection to same device");
|
||||
oldLink.disconnect();
|
||||
connectionLost(oldLink);
|
||||
}
|
||||
@@ -258,8 +258,6 @@ public class LanLinkProvider extends BaseLinkProvider {
|
||||
@Override
|
||||
public void onNetworkChange() {
|
||||
|
||||
Log.e("LanLinkProvider","OnNetworkChange: " + (udpAcceptor != null));
|
||||
|
||||
onStop();
|
||||
onStart();
|
||||
|
||||
|
@@ -104,12 +104,12 @@ public class NetworkPackage {
|
||||
}
|
||||
//QJSon does not escape slashes, but Java JSONObject does. Converting to QJson format.
|
||||
String json = jo.toString().replace("\\/","/")+"\n";
|
||||
Log.e("NetworkPackage.serialize",json);
|
||||
//Log.e("NetworkPackage.serialize",json);
|
||||
return json;
|
||||
}
|
||||
|
||||
static public NetworkPackage unserialize(String s) {
|
||||
Log.e("NetworkPackage.unserialize", s);
|
||||
//Log.e("NetworkPackage.unserialize", s);
|
||||
NetworkPackage np = new NetworkPackage();
|
||||
try {
|
||||
JSONObject jo = new JSONObject(s);
|
||||
@@ -156,7 +156,7 @@ public class NetworkPackage {
|
||||
Log.e("NetworkPackage","Exception");
|
||||
}
|
||||
|
||||
Log.e("NetworkPackage", "Encrypted " + chunks.length()+" chunks");
|
||||
Log.i("NetworkPackage", "Encrypted " + chunks.length()+" chunks");
|
||||
|
||||
}
|
||||
|
||||
|
@@ -55,7 +55,7 @@ public class BatteryPlugin extends Plugin {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
|
||||
Log.e("BatteryPlugin", "Battery event");
|
||||
Log.i("BatteryPlugin", "Battery event");
|
||||
|
||||
boolean isCharging = (0 != intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, 0));
|
||||
|
||||
|
@@ -35,8 +35,6 @@ public class MprisActivity extends Activity {
|
||||
@Override
|
||||
public void onServiceStart(BackgroundService service) {
|
||||
|
||||
Log.e("MprisActivity", "onService start");
|
||||
|
||||
Device device = service.getDevice(deviceId);
|
||||
final MprisPlugin mpris = (MprisPlugin) device.getPlugin("plugin_mpris");
|
||||
if (mpris == null) {
|
||||
@@ -86,14 +84,11 @@ public class MprisActivity extends Activity {
|
||||
//String prevPlayer = (String)spinner.getSelectedItem();
|
||||
spinner.setAdapter(adapter);
|
||||
|
||||
Log.e("MprisActivity", "playerListUpdatedHandler");
|
||||
|
||||
spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> arg0, View arg1, int pos, long id) {
|
||||
((TextView) findViewById(R.id.now_playing_textview)).setText("");
|
||||
String player = playerList.get(pos);
|
||||
Log.e("MprisActivity", "onPlayerSelected: " + player);
|
||||
mpris.setPlayer(player);
|
||||
//Spotify doesn't support changing the volume yet...
|
||||
if (player.equals("Spotify")) {
|
||||
|
@@ -27,7 +27,7 @@ public class NotificationReceiver extends NotificationListenerService {
|
||||
|
||||
@Override
|
||||
public void onNotificationPosted(StatusBarNotification statusBarNotification) {
|
||||
Log.e("NotificationReceiver.onNotificationPosted","listeners: " + listeners.size());
|
||||
Log.i("NotificationReceiver.onNotificationPosted","listeners: " + listeners.size());
|
||||
for(NotificationListener listener : listeners) {
|
||||
listener.onNotificationPosted(statusBarNotification);
|
||||
}
|
||||
@@ -49,7 +49,7 @@ public class NotificationReceiver extends NotificationListenerService {
|
||||
//This will be called for each intent launch, even if the service is already started and is reused
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
Log.e("NotificationReceiver", "onStartCommand");
|
||||
Log.i("NotificationReceiver", "onStartCommand");
|
||||
for (InstanceCallback c : callbacks) {
|
||||
c.onServiceStart(this);
|
||||
}
|
||||
|
@@ -84,11 +84,11 @@ public class NotificationsPlugin extends Plugin implements NotificationReceiver.
|
||||
} catch(Exception e) {
|
||||
nid.id = 0;
|
||||
}
|
||||
Log.e("NotificationId","unserialize: " + nid.packageName+ ", "+nid.tag+ ", "+nid.id);
|
||||
//Log.e("NotificationId","unserialize: " + nid.packageName+ ", "+nid.tag+ ", "+nid.id);
|
||||
return nid;
|
||||
}
|
||||
public String serialize() {
|
||||
Log.e("NotificationId","serialize: " + packageName+ ", "+tag+ ", "+id);
|
||||
//Log.e("NotificationId","serialize: " + packageName+ ", "+tag+ ", "+id);
|
||||
String safePackageName = (packageName == null)? "" : packageName;
|
||||
String safeTag = (tag == null)? "" : tag;
|
||||
return safePackageName+":"+safeTag+":"+id;
|
||||
@@ -115,7 +115,6 @@ public class NotificationsPlugin extends Plugin implements NotificationReceiver.
|
||||
|
||||
@Override
|
||||
public boolean onCreate() {
|
||||
Log.e("NotificationsPlugin", "onCreate");
|
||||
|
||||
if (Build.VERSION.SDK_INT < 18) return false;
|
||||
|
||||
@@ -267,7 +266,7 @@ public class NotificationsPlugin extends Plugin implements NotificationReceiver.
|
||||
|
||||
} else {
|
||||
|
||||
Log.e("NotificationsPlugin","Nothing to do");
|
||||
Log.w("NotificationsPlugin","Nothing to do");
|
||||
|
||||
}
|
||||
|
||||
|
@@ -55,7 +55,7 @@ public class TelephonyPlugin extends Plugin {
|
||||
|
||||
String action = intent.getAction();
|
||||
|
||||
Log.e("TelephonyPlugin","Telephony event: " + action);
|
||||
//Log.e("TelephonyPlugin","Telephony event: " + action);
|
||||
|
||||
if("android.provider.Telephony.SMS_RECEIVED".equals(action)) {
|
||||
|
||||
@@ -140,7 +140,7 @@ public class TelephonyPlugin extends Plugin {
|
||||
|
||||
public void smsBroadcastReceived(SmsMessage message) {
|
||||
|
||||
Log.e("SmsBroadcastReceived", message.toString());
|
||||
//Log.e("SmsBroadcastReceived", message.toString());
|
||||
|
||||
NetworkPackage np = new NetworkPackage(NetworkPackage.PACKAGE_TYPE_TELEPHONY);
|
||||
|
||||
|
@@ -38,7 +38,6 @@ public class DeviceActivity extends ActionBarActivity {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Log.e("MainActivity", "updateComputerList");
|
||||
|
||||
//Errors list
|
||||
final HashMap<String, Plugin> failedPlugins = device.getFailedPlugins();
|
||||
|
@@ -89,7 +89,6 @@ public class MainActivity extends ActionBarActivity {
|
||||
//
|
||||
|
||||
void updateComputerList() {
|
||||
Log.e("MainActivity","updateComputerList");
|
||||
|
||||
BackgroundService.RunCommand(MainActivity.this, new BackgroundService.InstanceCallback() {
|
||||
@Override
|
||||
|
@@ -16,7 +16,6 @@ public class PreferenceListAdapter extends ArrayAdapter<Preference> {
|
||||
|
||||
public PreferenceListAdapter(Context context, ArrayList<Preference> items) {
|
||||
super(context,0, items);
|
||||
Log.e("PreferenceListAdapter", ""+items.size());
|
||||
localList = items;
|
||||
}
|
||||
|
||||
|
@@ -31,7 +31,6 @@ public class SettingsActivity extends ListActivity {
|
||||
|
||||
final ArrayList<Preference> preferences = new ArrayList<Preference>();
|
||||
for (final String pluginName : plugins) {
|
||||
Log.e("SettingsActivity", pluginName);
|
||||
CheckBoxPreference pref = new CheckBoxPreference(getBaseContext());
|
||||
PluginFactory.PluginInfo info = PluginFactory.getPluginInfo(getBaseContext(), pluginName);
|
||||
pref.setKey(pluginName);
|
||||
|
Reference in New Issue
Block a user