GPS antenna of a phone works even it is placed inside, but why its not working indoor
Line-of-sight should be taken with a grain of salt in this case. If it is taken too literal, it often stops making sense, as is the case here.

First off: line of sight seems to suggest a visible line. But one must keep in mind that materials that are opaque and (almost) impassible to light in the visible wavelengths, might be almost translucent for other wavelengths. Examples of this include how visible light can pass through window glass without significant issue, but low-IR (from thermal radiation) or UV can not! (this is why you can't get a good tan behind a window). 

Second: When people say line-of-sight, it usually means that the signal cannot take large attenuation (and/or doesn't work well with reflected signals). The case of your phone and your body present attenuation to the antenna: they weaken the signal (though you might be suprised how little this really is, as many plastics are reasonably invisible to the wavelengths of GPS. This is also why you need a metal can to shield against RF, even if you have a plastic enclosure). But they weaken the signal far less than the walls and ceilings in buildings. In part this could be due to the large amounts of metal one might find in many buildings (rebar in concrete, for example). 

Hence the signal strength the antenna receives when it is on the back of the phone but outside, will still likely be many times more powerfull as the signal strength inside of a building, but with the antenna pointed "up".