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
This commit is contained in:
Fabian Kozynski
2019-09-27 10:26:44 -04:00
parent 10b668e573
commit 8f70363a50

View File

@@ -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();