To reinstall an existing uninstalled package on a Samsung Android phone, connect the device to the computer in developer mode and start up ADB.
List all uninstalled packages and check the package name that is to be reinstalled, for example, gallery3d, in the adb window, enter:
pm list packages -u | grep "gallery" <enter>
To install it back, enter in the adb window:
pm package install-existing com.sec.android.gallery3d <enter>
This will restore gallery3d onto the android phone.