ignore quickLog startService exception
This commit is contained in:
parent
0b673ef1ab
commit
60e6841578
|
@ -35,9 +35,9 @@ public class UnifiedPushDistributor extends BroadcastReceiver {
|
|||
public static final String ACTION_REGISTER = "org.unifiedpush.android.distributor.REGISTER";
|
||||
public static final String ACTION_UNREGISTER = "org.unifiedpush.android.distributor.UNREGISTER";
|
||||
|
||||
|
||||
// connector actions (these are actions used for distributor->connector broadcasts)
|
||||
public static final String ACTION_UNREGISTERED = "org.unifiedpush.android.connector.UNREGISTERED";
|
||||
public static final String ACTION_UNREGISTERED =
|
||||
"org.unifiedpush.android.connector.UNREGISTERED";
|
||||
public static final String ACTION_BYTE_MESSAGE =
|
||||
"org.unifiedpush.android.distributor.feature.BYTES_MESSAGE";
|
||||
public static final String ACTION_REGISTRATION_FAILED =
|
||||
|
@ -79,10 +79,10 @@ public class UnifiedPushDistributor extends BroadcastReceiver {
|
|||
switch (Strings.nullToEmpty(action)) {
|
||||
case ACTION_REGISTER -> register(context, application, instance, features, messenger);
|
||||
case ACTION_UNREGISTER -> unregister(context, instance);
|
||||
case Intent.ACTION_PACKAGE_FULLY_REMOVED ->
|
||||
unregisterApplication(context, intent.getData());
|
||||
default ->
|
||||
Log.d(Config.LOGTAG, "UnifiedPushDistributor received unknown action " + action);
|
||||
case Intent.ACTION_PACKAGE_FULLY_REMOVED -> unregisterApplication(
|
||||
context, intent.getData());
|
||||
default -> Log.d(
|
||||
Config.LOGTAG, "UnifiedPushDistributor received unknown action " + action);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -111,7 +111,11 @@ public class UnifiedPushDistributor extends BroadcastReceiver {
|
|||
Log.d(
|
||||
Config.LOGTAG,
|
||||
"successfully created UnifiedPush entry. waking up XmppConnectionService");
|
||||
quickLog(context, String.format("successfully registered %s (token = %s) for UnifiedPushed", application, instance));
|
||||
quickLog(
|
||||
context,
|
||||
String.format(
|
||||
"successfully registered %s (token = %s) for UnifiedPushed",
|
||||
application, instance));
|
||||
final Intent serviceIntent = new Intent(context, XmppConnectionService.class);
|
||||
serviceIntent.setAction(XmppConnectionService.ACTION_RENEW_UNIFIED_PUSH_ENDPOINTS);
|
||||
serviceIntent.putExtra("instance", instance);
|
||||
|
@ -177,7 +181,11 @@ public class UnifiedPushDistributor extends BroadcastReceiver {
|
|||
}
|
||||
final UnifiedPushDatabase unifiedPushDatabase = UnifiedPushDatabase.getInstance(context);
|
||||
if (unifiedPushDatabase.deleteInstance(instance)) {
|
||||
quickLog(context, String.format("successfully unregistered token %s from UnifiedPushed (application requested unregister)", instance));
|
||||
quickLog(
|
||||
context,
|
||||
String.format(
|
||||
"successfully unregistered token %s from UnifiedPushed (application requested unregister)",
|
||||
instance));
|
||||
Log.d(Config.LOGTAG, "successfully removed " + instance + " from UnifiedPush");
|
||||
// TODO send UNREGISTERED broadcast back to app?!
|
||||
}
|
||||
|
@ -192,7 +200,11 @@ public class UnifiedPushDistributor extends BroadcastReceiver {
|
|||
Log.d(Config.LOGTAG, "app " + application + " has been removed from the system");
|
||||
final UnifiedPushDatabase database = UnifiedPushDatabase.getInstance(context);
|
||||
if (database.deleteApplication(application)) {
|
||||
quickLog(context, String.format("successfully removed %s from UnifiedPushed (ACTION_PACKAGE_FULLY_REMOVED)", application));
|
||||
quickLog(
|
||||
context,
|
||||
String.format(
|
||||
"successfully removed %s from UnifiedPushed (ACTION_PACKAGE_FULLY_REMOVED)",
|
||||
application));
|
||||
Log.d(Config.LOGTAG, "successfully removed " + application + " from UnifiedPush");
|
||||
}
|
||||
}
|
||||
|
@ -210,6 +222,6 @@ public class UnifiedPushDistributor extends BroadcastReceiver {
|
|||
final Intent intent = new Intent(context, XmppConnectionService.class);
|
||||
intent.setAction(XmppConnectionService.ACTION_QUICK_LOG);
|
||||
intent.putExtra("message", message);
|
||||
context.startService(intent);
|
||||
Compatibility.startService(context, intent);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,8 +12,6 @@ import android.content.pm.PackageManager;
|
|||
import android.net.ConnectivityManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceCategory;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
|
||||
|
@ -26,10 +24,6 @@ import eu.siacs.conversations.AppSettings;
|
|||
import eu.siacs.conversations.Config;
|
||||
import eu.siacs.conversations.R;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class Compatibility {
|
||||
|
||||
public static boolean hasStoragePermission(final Context context) {
|
||||
|
@ -100,7 +94,7 @@ public class Compatibility {
|
|||
}
|
||||
|
||||
|
||||
public static void startService(Context context, Intent intent) {
|
||||
public static void startService(final Context context, final Intent intent) {
|
||||
try {
|
||||
if (Compatibility.runsAndTargetsTwentySix(context)) {
|
||||
intent.putExtra(EXTRA_NEEDS_FOREGROUND_SERVICE, true);
|
||||
|
@ -108,7 +102,7 @@ public class Compatibility {
|
|||
} else {
|
||||
context.startService(intent);
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
} catch (final RuntimeException e) {
|
||||
Log.d(
|
||||
Config.LOGTAG,
|
||||
context.getClass().getSimpleName() + " was unable to start service");
|
||||
|
|
Loading…
Reference in a new issue