Fix IllegalArgumentException when trying to repin a disabled shortcut

This commit is contained in:
Cameron Gutman 2020-03-21 13:25:55 -07:00
parent eefc08db47
commit 977a1d4a3c
2 changed files with 15 additions and 0 deletions

View File

@ -517,6 +517,12 @@ public class AppView extends Activity implements AdapterFragmentCallbacks {
if (!foundExistingApp) {
// This app must be new
appGridAdapter.addApp(new AppObject(app));
// We could have a leftover shortcut from last time this PC was paired
// or if this app was removed then added again. Enable those shortcuts
// again if present.
shortcutHelper.enableAppShortcut(computer, app);
updated = true;
}
}

View File

@ -192,4 +192,13 @@ public class ShortcutHelper {
}
}
}
public void enableAppShortcut(ComputerDetails computer, NvApp app) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
String id = getShortcutIdForGame(computer, app);
if (getInfoForId(id) != null) {
sm.enableShortcuts(Collections.singletonList(id));
}
}
}
}