From 8f70363a50edf0e3eb91f40b90c8e4a988b60812 Mon Sep 17 00:00:00 2001 From: Fabian Kozynski Date: Fri, 27 Sep 2019 10:26:44 -0400 Subject: [PATCH] Make MemoryTile share after Keyguard If the device is locked clicking on the MemoryTile will take a heapdump but not prompt for sharing. If the device is locked after a Reboot, clicking on the MemoryTile will crash the device as the resolver cannot find an activity. This makes sure that the Keyguard is dismissed before trying to share. Using the systemui ActivityStarter also catches any errors. Fixes: 141701312 Test: manual with device locked and after reboot Change-Id: I5f0e83f9c95c9b3b33318303d853299422233261 --- .../src/com/android/systemui/util/leak/GarbageMonitor.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/util/leak/GarbageMonitor.java b/packages/SystemUI/src/com/android/systemui/util/leak/GarbageMonitor.java index e84d9a9cde435..db4390686cd91 100644 --- a/packages/SystemUI/src/com/android/systemui/util/leak/GarbageMonitor.java +++ b/packages/SystemUI/src/com/android/systemui/util/leak/GarbageMonitor.java @@ -49,6 +49,7 @@ import android.util.LongSparseArray; import com.android.systemui.Dumpable; import com.android.systemui.R; import com.android.systemui.SystemUI; +import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.plugins.qs.QSTile; import com.android.systemui.qs.QSHost; import com.android.systemui.qs.tileimpl.QSTileImpl; @@ -386,13 +387,15 @@ public class GarbageMonitor implements Dumpable { public static final boolean ADD_TO_DEFAULT_ON_DEBUGGABLE_BUILDS = true; private final GarbageMonitor gm; + private final ActivityStarter mActivityStarter; private ProcessMemInfo pmi; private boolean dumpInProgress; @Inject - public MemoryTile(QSHost host, GarbageMonitor monitor) { + public MemoryTile(QSHost host, GarbageMonitor monitor, ActivityStarter starter) { super(host); gm = monitor; + mActivityStarter = starter; } @Override @@ -423,7 +426,7 @@ public class GarbageMonitor implements Dumpable { dumpInProgress = false; refreshState(); getHost().collapsePanels(); - mContext.startActivity(shareIntent); + mActivityStarter.postStartActivityDismissingKeyguard(shareIntent, 0); }); } }.start();