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

Commit a3e9d14b authored by Kweku Adams's avatar Kweku Adams
Browse files

Enabling users to dismiss the heap dump notification.

1. setOngoing meant that users were not allowed to dismiss the
notification, even though a deleteIntent was added to the notification.

2. showWhen is by default set to false, so calling setWhen had no effect

3. Trying to delete the heap dump accidentally reposted the
notification.

Bug: 127581643
Test: manual
Change-Id: Ifbdb3c9800756b28656bc8175ef8f90902c397c7
parent 98384b4f
Loading
Loading
Loading
Loading
+3 −8
Original line number Diff line number Diff line
@@ -1751,7 +1751,6 @@ public class ActivityManagerService extends IActivityManager.Stub
                        ? R.string.dump_heap_ready_notification : R.string.dump_heap_notification;
                String text = mContext.getString(titleId, procName);
                Intent deleteIntent = new Intent();
                deleteIntent.setAction(DumpHeapActivity.ACTION_DELETE_DUMPHEAP);
                Intent intent = new Intent();
@@ -1767,8 +1766,6 @@ public class ActivityManagerService extends IActivityManager.Stub
                Notification notification =
                        new Notification.Builder(mContext, SystemNotificationChannels.DEVELOPER)
                        .setSmallIcon(com.android.internal.R.drawable.stat_sys_adb)
                        .setWhen(0)
                        .setOngoing(true)
                        .setAutoCancel(true)
                        .setTicker(text)
                        .setColor(mContext.getColor(
@@ -5093,11 +5090,9 @@ public class ActivityManagerService extends IActivityManager.Stub
        mContext.registerReceiver(new BroadcastReceiver() {
            @Override
            public void onReceive(Context context, Intent intent) {
                if (intent.getBooleanExtra(DumpHeapActivity.EXTRA_DELAY_DELETE, false)) {
                    mHandler.sendEmptyMessageDelayed(POST_DUMP_HEAP_NOTIFICATION_MSG, 5*60*1000);
                } else {
                    mHandler.sendEmptyMessage(POST_DUMP_HEAP_NOTIFICATION_MSG);
                }
                final long delay = intent.getBooleanExtra(
                        DumpHeapActivity.EXTRA_DELAY_DELETE, false) ? 5 * 60 * 1000 : 0;
                mHandler.sendEmptyMessageDelayed(DELETE_DUMPHEAP_MSG, delay);
            }
        }, dumpheapFilter);