Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2a169a69 authored by William Escande's avatar William Escande Committed by Gerrit Code Review
Browse files

Merge "Notification: Fix auto discard" into main

parents 5ef0c449 ab349c7f
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -116,7 +116,7 @@ class BluetoothOppNotification {

    private Context mContext;

    private HashMap<String, NotificationItem> mNotifications;
    private final HashMap<String, NotificationItem> mNotifications = new HashMap<>();

    private NotificationUpdateThread mUpdateNotificationThread;

@@ -179,7 +179,6 @@ class BluetoothOppNotification {
                NotificationManager.IMPORTANCE_HIGH);

        mNotificationMgr.createNotificationChannel(mNotificationChannel);
        mNotifications = new HashMap<String, NotificationItem>();
        // Get Content Resolver object one time
        mContentResolver = mContext.getContentResolver();
    }
@@ -704,9 +703,12 @@ class BluetoothOppNotification {
        cursor.close();
    }

    void cancelNotifications() {
        Log.v(TAG, "cancelNotifications ");
    void cancelOppNotifications() {
        Log.v(TAG, "cancelOppNotifications ");
        mHandler.removeCallbacksAndMessages(null);
        mNotificationMgr.cancelAll();
        mNotificationMgr.cancel(NOTIFICATION_ID_PROGRESS);
        mNotificationMgr.cancel(NOTIFICATION_ID_OUTBOUND_COMPLETE);
        mNotificationMgr.cancel(NOTIFICATION_ID_INBOUND_COMPLETE);
        mNotificationMgr.cancel(NOTIFICATION_ID_COMPLETE_SUMMARY);
    }
}
+2 −2
Original line number Diff line number Diff line
@@ -266,7 +266,7 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti
        mObserver = new BluetoothShareContentObserver();
        getContentResolver().registerContentObserver(BluetoothShare.CONTENT_URI, true, mObserver);
        mNotifier = new BluetoothOppNotification(this);
        mNotifier.mNotificationMgr.cancelAll();
        mNotifier.cancelOppNotifications();
        updateFromProvider();
        setBluetoothOppService(this);
    }
@@ -618,7 +618,7 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti
        }

        if (mNotifier != null) {
            mNotifier.cancelNotifications();
            mNotifier.cancelOppNotifications();
        }
    }

+1 −1
Original line number Diff line number Diff line
@@ -476,7 +476,7 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect
        } else {
            Log.d(TAG, "Notification Not Required.");
            if (sNotificationManager != null) {
                sNotificationManager.cancelAll();
                sNotificationManager.cancel(android.R.drawable.stat_sys_data_bluetooth);
            }
        }
    }
+2 −4
Original line number Diff line number Diff line
@@ -101,7 +101,7 @@ public class BluetoothOppNotificationTest {
                mReceiverName, COMPONENT_ENABLED_STATE_ENABLED, DONT_KILL_APP);

        // clear all OPP notifications before each test
        mOppNotification.cancelNotifications();
        mOppNotification.cancelOppNotifications();
    }

    @After
@@ -117,7 +117,7 @@ public class BluetoothOppNotificationTest {
                mReceiverName, mPreviousState, DONT_KILL_APP);

        // clear all OPP notifications after each test
        mOppNotification.cancelNotifications();
        mOppNotification.cancelOppNotifications();
    }

    @Ignore("b/288660228")
@@ -164,8 +164,6 @@ public class BluetoothOppNotificationTest {
        device.wait(Until.hasObject(By.text(titleString)), TIMEOUT_MS);
        UiObject2 title = device.findObject(By.text(titleString));
        assertThat(title).isNotNull();

        mOppNotification.cancelNotifications();
    }

    @Test