1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-14 22:19:29 +01:00

revert accidentially commited stuff

This commit is contained in:
Andreas Shimokawa 2016-09-11 00:38:26 +02:00
parent 053b9553bc
commit ec1f539267

View File

@ -56,6 +56,7 @@ public class NotificationListener extends NotificationListenerService {
private LimitedQueue mActionLookup = new LimitedQueue(16); private LimitedQueue mActionLookup = new LimitedQueue(16);
private final BroadcastReceiver mReceiver = new BroadcastReceiver() { private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
@SuppressLint("NewApi")
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
String action = intent.getAction(); String action = intent.getAction();
@ -68,7 +69,7 @@ public class NotificationListener extends NotificationListenerService {
StatusBarNotification[] sbns = NotificationListener.this.getActiveNotifications(); StatusBarNotification[] sbns = NotificationListener.this.getActiveNotifications();
int handle = intent.getIntExtra("handle", -1); int handle = intent.getIntExtra("handle", -1);
for (StatusBarNotification sbn : sbns) { for (StatusBarNotification sbn : sbns) {
if (sbn.getId() == handle) { if ((int) sbn.getPostTime() == handle) {
if (action.equals(ACTION_OPEN)) { if (action.equals(ACTION_OPEN)) {
try { try {
PendingIntent pi = sbn.getNotification().contentIntent; PendingIntent pi = sbn.getNotification().contentIntent;
@ -91,7 +92,7 @@ public class NotificationListener extends NotificationListenerService {
StatusBarNotification[] sbns = NotificationListener.this.getActiveNotifications(); StatusBarNotification[] sbns = NotificationListener.this.getActiveNotifications();
int handle = intent.getIntExtra("handle", -1); int handle = intent.getIntExtra("handle", -1);
for (StatusBarNotification sbn : sbns) { for (StatusBarNotification sbn : sbns) {
if (sbn.getId() == handle) { if ((int) sbn.getPostTime() == handle) {
if (GBApplication.isRunningLollipopOrLater()) { if (GBApplication.isRunningLollipopOrLater()) {
String key = sbn.getKey(); String key = sbn.getKey();
NotificationListener.this.cancelNotification(key); NotificationListener.this.cancelNotification(key);
@ -275,7 +276,8 @@ public class NotificationListener extends NotificationListenerService {
LOG.info("Processing notification from source " + source); LOG.info("Processing notification from source " + source);
dissectNotificationTo(notification, notificationSpec); dissectNotificationTo(notification, notificationSpec);
notificationSpec.id = sbn.getId(); notificationSpec.id = (int) sbn.getPostTime(); //FIMXE: a truly unique id would be better
NotificationCompat.WearableExtender wearableExtender = new NotificationCompat.WearableExtender(notification); NotificationCompat.WearableExtender wearableExtender = new NotificationCompat.WearableExtender(notification);
List<NotificationCompat.Action> actions = wearableExtender.getActions(); List<NotificationCompat.Action> actions = wearableExtender.getActions();
for (NotificationCompat.Action act : actions) { for (NotificationCompat.Action act : actions) {