Move shortcut creation/updates off the main thread for the common cases

These caused quite a few ANRs due to long Binder calls in ShortcutManager.getDynamicShortcuts()
This commit is contained in:
Cameron Gutman
2023-10-26 00:24:44 -05:00
parent ebfe843299
commit 0da47da8d8
2 changed files with 20 additions and 20 deletions

View File

@@ -260,6 +260,11 @@ public class PcView extends Activity implements AdapterFragmentCallbacks {
updateComputer(details);
}
});
// Add a launcher shortcut for this PC (off the main thread to prevent ANRs)
if (details.pairState == PairState.PAIRED) {
shortcutHelper.createAppViewShortcutForOnlineHost(details);
}
}
}
});
@@ -720,11 +725,6 @@ public class PcView extends Activity implements AdapterFragmentCallbacks {
}
}
// Add a launcher shortcut for this PC
if (details.pairState == PairState.PAIRED) {
shortcutHelper.createAppViewShortcutForOnlineHost(details);
}
if (existingEntry != null) {
// Replace the information in the existing entry
existingEntry.details = details;