The recent popularization of mobile devices equipped with high-performance sensors has given rise to the fast development of mobile sensing technology. Mobile sensing applications analyze the signals generated by human activities and environment changes, and thus get a better understanding of the environment and human behaviors. Nowadays, researchers have developed diverse mobile sensing applications, which benefit people's living, such as gesture recognition, vital sign monitoring, localization, and identification.Mobile sensing has two faces. While benefiting people's lives, its growing capability would also spawn new threats to security and privacy. Exploring the dual character of mobile sensing is challenging. On one hand, while the commercialization of new mobile devices enlarges the design space, it is challenging to design effective mobile sensing systems, which use less or cheaper sensors and achieve better performance or more functionalities. On the other hand, attackers can utilize the sensing strategies to track victims' activities and cause privacy leakages. It is challenging to find the potential leakages, because mobile sensing attacks usually use side channels and target the information hidden in non-textual data.To target the above challenges, I present the Mobile Sensing Application-Attack (MSAA) framework, a general model showing the structures of mobile sensing applications and attacks, and how the two faces are connected. MSAA reflects our principle of designing effective mobile sensing systems, i.e., we reduce the cost and improve the performance of current systems by exploring different sensors, various requirements for user/environment contexts, and different sensing algorithms. MSAA also shows our principle of exploring information leakages, i.e., we break a sensing system into basic components, and for each component we consider what user information could be extracted if data are leaked. I take handwriting input and indoor walking path tracking as examples, and show how we design effective mobile sensing techniques and also investigate their potential threats following MSAA. I design an audio-based handwriting input method for tiny mobile devices, which allows users to input words by writing on tables with fingers. Then, I explore the attacker's capability of recognizing a victim's handwriting content based on the handwriting sound. I also present an in-shoe force sensor-based indoor walking path tracking system, which enables smart shoes to locate users. Meanwhile, I show how likely a victim can be located if the foot force data are leaked to attackers. Our experiment results show that our applications can achieve satisfactory performance, and also confirm the threats of privacy leakage if they are maliciously used, which reveals the two faces of mobile sensing.