tag:blogger.com,1999:blog-85730870082801975942024-03-16T11:52:47.102-07:00Steps... [Moustafa Alzantot Personal Blog]Unknownnoreply@blogger.comBlogger8125tag:blogger.com,1999:blog-8573087008280197594.post-72143823926865117622016-09-17T22:05:00.000-07:002016-09-17T22:28:47.499-07:00EDX 6.008.1X Computational Probability and Inference Notes (Week 1)<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt;">
<div dir="ltr" style="line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 34.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">EDX 6.008.1x Computational Probability and Inference Notes (Week 1)</span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://www.edx.org/sites/default/files/styles/course_video_banner/public/course/image/featured-card/6.008x-banner_318x210.jpg?itok=fHwgcid6" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://www.edx.org/sites/default/files/styles/course_video_banner/public/course/image/featured-card/6.008x-banner_318x210.jpg?itok=fHwgcid6" /></a></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt;">
<b id="docs-internal-guid-32cc436a-3bab-f3e5-2113-27c13ef67783" style="font-weight: normal;"><br /></b></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Recently, I started doing the <a href="https://www.edx.org/course/computational-probability-inference-mitx-6-008-1x">EDX 6.008.1x Computational Probability and Inference online course on EDX</a>. This course is offered as part of the MITx and is similar to the </span><a href="http://web.mit.edu/6.008/www/" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">MIT 6.008 Introduction to Inference</span></a><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> course offered at MIT by </span><a href="https://www.edx.org/bio/polina-golland" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Prof. Polina Golland</span></a><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">. As a way to motivate myself keeping on track with the course, I decided to save my notes on the course content and publish them online. I hope you they can be useful for other students who are doing the course now, or in later sessions, and for anyone looking for information about topics related to the course subjects.</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt;">
<b style="font-weight: normal;"><br /></b></div>
<h4 dir="ltr" style="line-height: 1.38; margin-bottom: 4pt; margin-top: 14pt;">
<span style="background-color: transparent; color: #666666; font-family: "arial"; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Course topics: </span></h4>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">The course provides an introduction to probability theory and probabilistic graphical models and how to use to perform inferences. Probabilistic models are used in different application domains including information retrieval, data mining, computer vision, natural language processing, financial analysis, robotics, medical diagnosis, …….. The list goes on and on.</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt;">
<b style="font-weight: normal;"><br /></b></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">In addition to the theoretical topics covered by the course, it also includes 3 mini projects and one final project in Python programming language. The programming assignments and project were a strong reason for me to decide doing this course :)</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt;">
<b style="font-weight: normal;"><br /></b></div>
<h4 dir="ltr" style="line-height: 1.38; margin-bottom: 4pt; margin-top: 14pt;">
<span style="background-color: transparent; color: #666666; font-family: "arial"; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Course Requirements</span></h4>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">The course assumes good knowledge of calculus and being comfortable with python programming language. No prior knowledge of probability is required.</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt;">
<b style="font-weight: normal;"><br /></b></div>
<h1 dir="ltr" style="line-height: 1.38; margin-bottom: 6pt; margin-top: 20pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 26.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Week 1</span></h1>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt;">
<b style="font-weight: normal;"><br /></b></div>
<h2 dir="ltr" style="line-height: 1.38; margin-bottom: 6pt; margin-top: 18pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 21.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">What is probability?</span></h2>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt;">
<b style="font-weight: normal;"><br /></b></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Probability</span><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> is the science of representing and computing with uncertainty. It appears in our everyday life, especially when making decisions. For example, In the morning you may decide to take an umbrella because there is high chance that it will rain today. </span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt;">
<b style="font-weight: normal;"><br /></b></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">The goal of the course is to learn how to build computer programs that can perform reasoning under uncertainties by using probabilities.</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt;">
<b style="font-weight: normal;"><br /></b></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Simplest example of probability is flipping a fair coin, fair coin is a coin that has equal chance of landing heads or tails when being tossed, the probability of head = ½ and the probability of tail is also ½. But what does this mean ?</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt;">
<b style="font-weight: normal;"><br /></b></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">There is two interpretations for probability:</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt;">
<b style="font-weight: normal;"><br /></b></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Frequentist interpretation: </span><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">If you repeat the process of tossing the coin for N times (where N is a very large number, say 10,000 times), Approximately N/2 times the result will be heads and approximately N/2 times the result will be tails.</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt;">
<b style="font-weight: normal;"><br /></b></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Bayesian Interpretation: </span><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">It is hard to use the frequentist approach to explain the meaning of probability in some scenarios where the experiment cannot be repeated. For example, the probability that the a patient will die after being given a certain drug. Of course, this experiment cannot be repeated more than one time. Therefore, the frequentist approach does not help a lot in this scenario. The bayesian interpretation of probability is the that probability value is equal to the state of belief in the experiment outcome.</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">For example, the probability of heads when tossing a coin = ½ means that if you toss a coin once, then before tossing the coin your belief that the result will be heads is equal to ½. </span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt;">
<b style="font-weight: normal;"><br /></b></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Luckily, it does not make any difference which interpretation you choose to follow, because all probability laws are the same under the two interpretations.</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt;">
<b style="font-weight: normal;"><br /></b></div>
<h2 dir="ltr" style="line-height: 1.38; margin-bottom: 6pt; margin-top: 18pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 21.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Two ingredients to model uncertainty</span></h2>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">When we represent an uncertain world, we call the process that we observe its result an </span><span style="background-color: transparent; color: #4a86e8; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">experiment</span><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">. To model the uncertainty of the experiment we need to define two things:</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt;">
<b style="font-weight: normal;"><br /></b></div>
<ul style="margin-bottom: 0pt; margin-top: 0pt;">
<li dir="ltr" style="background-color: transparent; color: black; font-family: Arial; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: disc; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Sample Space </span><a href="http://api.gmath.guru/cgi-bin/gmath?%5COmega" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><img height="12" src="https://lh6.googleusercontent.com/2Zuhh01oTjETS8jJB4D7vsHeFTVukwtn5cnZbYyPu2vCKO7oYoLzSXNXa28LEIoNZZPc56UV59a0jLZpYWHPYbda5RpzaZLRg3YKJubtEc0cxlPafzp8ofyxfnZtq4L2ZvF23ARo" style="-webkit-transform: rotate(0.00rad); border: none; transform: rotate(0.00rad);" width="12" /></span></a><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> : The set of all possible outcomes of the experiment. The sample space can be either finite or infinite set.</span></div>
</li>
<li dir="ltr" style="background-color: transparent; color: black; font-family: Arial; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: disc; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Probability of each outcome: Define a probability function </span><a href="http://api.gmath.guru/cgi-bin/gmath?P%5Cleft(%5Comega%5Cright)" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><img height="17" src="https://lh5.googleusercontent.com/6aHSI8oRnwEwV8oMC0QscuhZLpJvyDOZhdJEnuF8cD-jaxMZHXoWHQDv7coNdupHpzl4YKhJktaq2VtpKkbmj-xCQH3VgozH-Q9QQXrOCLGqbrbomOysswbCjeaIYnP6CGZOdwAQ" style="-webkit-transform: rotate(0.00rad); border: none; transform: rotate(0.00rad);" width="37" /></span></a><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> that assigns a probability value for each possible outcome </span><a href="http://api.gmath.guru/cgi-bin/gmath?%5Comega%20%5Cin%20%5COmega" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><img height="12" src="https://lh4.googleusercontent.com/Z1kLeCyx5y_kKaKkwyEh775xNpNQoJTF2WaT0Xp_GTpVKXh6ZxWQG-YoaRTI0BWqSviM6xPs3LCCIvBMqmNq9GYKiZfvH01qMcucs70AcKMATXTY9KYBmlqsP6RxgftVHX81OXHO" style="-webkit-transform: rotate(0.00rad); border: none; transform: rotate(0.00rad);" width="43" /></span></a><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span></div>
</li>
</ul>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">For example, in the experiment of tossing a fair coin:</span></div>
<ul style="margin-bottom: 0pt; margin-top: 0pt;">
<li dir="ltr" style="background-color: transparent; color: black; font-family: Arial; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: disc; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Sample space: </span></div>
</li>
<li dir="ltr" style="background-color: transparent; color: black; font-family: Arial; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: disc; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Probability values:</span><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><a href="http://api.gmath.guru/cgi-bin/gmath?P(heads)%20%3D%20%5Cfrac%7B1%7D%7B2%7D" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><img height="33" src="https://lh3.googleusercontent.com/WCnzKOBb2GKi0SZuATLRcfHKilxxlYtE6aXKiiE3rM7iOltymuCkBjsTMRLmTVpakYhR0oa3QjYWoYZq28Kg52YrggzjyxXuMJIaFKN-lUInw5au8nrtccteNs1P-QXR8DU47Yyo" style="-webkit-transform: rotate(0.00rad); border: none; transform: rotate(0.00rad);" width="100" /></span><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span></a><a href="http://api.gmath.guru/cgi-bin/gmath?P(tails)%20%3D%20%5Cfrac%7B1%7D%7B2%7D" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><img height="33" src="https://lh5.googleusercontent.com/bVknsNRaXLMek3QrqzPrIgcTLxCKPWcnHQ85ElQBhM1f9fIY3eliX17orRxqWboxxyXJT2FUddWGo5nfE7tkM_6PXATdkIQNPqZYvHpNTSaXWiW0e-q1gccMwyjDPP6Gwq-1GNPy" style="-webkit-transform: rotate(0.00rad); border: none; transform: rotate(0.00rad);" width="92" /></span></a></div>
</li>
</ul>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt;">
<b style="font-weight: normal;"><br /></b></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Any subset of the sample Space </span><a href="http://api.gmath.guru/cgi-bin/gmath?%5COmega" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><img height="12" src="https://lh5.googleusercontent.com/K6_cq6-hu4OBTu38BMG1_YgamYGJ-sLU8DT9nCCHOTmlcfaWM6bXeusmWI9TakIQVIUE12FiRAih6G9PssjCC1gs4fGMemHMeuDgVyMWiKTvm_bPhQKKzzdOkNLBKtypxhap0uLD" style="-webkit-transform: rotate(0.00rad); border: none; transform: rotate(0.00rad);" width="12" /></span></a><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> is called an </span><span style="background-color: transparent; color: #4a86e8; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Event</span><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt;">
<b style="font-weight: normal;"><br /></b></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">The probability of an event </span><a href="http://api.gmath.guru/cgi-bin/gmath?A%20%5Csubset%20%5COmega" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><img height="12" src="https://lh3.googleusercontent.com/wcdGpt0C0XWqBN5NCdZkR-z3sBzOIhuObKh_nWpin_HvByW0rC6J4EVFvvNwXWKM06lKh5Zi7XCOlrLVpJGD2Io5SpDidXeiggPu8oR3QpcT7KkGFRtCdUuD31B4T5eforbV4wMx" style="-webkit-transform: rotate(0.00rad); border: none; transform: rotate(0.00rad);" width="47" /></span></a><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> is the sum of probabilities of the possible outcomes that belong to </span><a href="http://api.gmath.guru/cgi-bin/gmath?A" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><img height="11" src="https://lh4.googleusercontent.com/9pxf3yfF5deLWB3TRgoLl5ic0w9D6P5Ieh0pL8HPQA9FtYXy-M-rwpL0Ee2lM31gPBzL_XRTH4URPCZaD36qsc0JnLtrz2zNcPG9dMLKH_j0s56wRH1wgZqWXJL55rDFtFn1QUrW" style="-webkit-transform: rotate(0.00rad); border: none; transform: rotate(0.00rad);" width="12" /></span></a><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><a href="http://api.gmath.guru/cgi-bin/gmath?P(A)%20%3D%20%5Csum_%7B%5Comega%20%5Cin%20A%7D%7BP(%5Comega)%7D" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><img height="36" src="https://lh3.googleusercontent.com/wPiPMLO-VQUR3P8CrDSnRif1I8kYXmn_8CzGNt8WC80CzriYNMqzDvGWx0HVFru43iiMP2zU0lLLUt7lnnDiy9c8IrGjQkv8MaS3eGdsT56aE3CPG6jHY9vxn4TDITUYay09rgeY" style="-webkit-transform: rotate(0.00rad); border: none; transform: rotate(0.00rad);" width="125" /></span></a></div>
<h3 dir="ltr" style="line-height: 1.38; margin-bottom: 4pt; margin-top: 16pt;">
<span style="background-color: transparent; color: #434343; font-family: "arial"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Programming Note: representing a probability model</span></h3>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt;">
<b style="font-weight: normal;"><br /></b></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">The course recommends using the Python dictionary to represent a probability model, where the keys of the dictionary are the elements of the sample space and the values assigned to them are their probability values.</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Example: representing the probability model of a fair coin.</span></div>
<div dir="ltr" style="margin-left: 36pt;">
<table style="border-collapse: collapse; border: none; width: 624px;"><colgroup><col width="*"></col></colgroup><tbody>
<tr style="height: 0px;"><td style="border-bottom: solid #000000 1px; border-left: solid #000000 1px; border-right: solid #000000 1px; border-top: solid #000000 1px; padding: 7px 7px 7px 7px; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">model </span><span style="background-color: transparent; color: #666600; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">=</span><span style="background-color: transparent; color: black; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #666600; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">{</span><span style="background-color: transparent; color: #008800; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">'heads'</span><span style="background-color: transparent; color: black; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #666600; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">:</span><span style="background-color: transparent; color: black; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #006666; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">0.5</span><span style="background-color: transparent; color: #666600; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">,</span><span style="background-color: transparent; color: black; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #008800; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">'tails'</span><span style="background-color: transparent; color: black; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #666600; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">:</span><span style="background-color: transparent; color: black; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #006666; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">0.5}</span></div>
</td></tr>
</tbody></table>
</div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt;">
<b style="font-weight: normal;"><br /></b></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">The following can be used to sample 10 outputs from the preceding model</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt;">
<b style="font-weight: normal;"><br /></b></div>
<div dir="ltr" style="margin-left: 0pt;">
<table style="border-collapse: collapse; border: none; width: 624px;"><colgroup><col width="*"></col></colgroup><tbody>
<tr style="height: 0px;"><td style="border-bottom: solid #000000 1px; border-left: solid #000000 1px; border-right: solid #000000 1px; border-top: solid #000000 1px; padding: 7px 7px 7px 7px; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #000088; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">import</span><span style="background-color: transparent; color: black; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> numpy </span><span style="background-color: transparent; color: #000088; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">as</span><span style="background-color: transparent; color: black; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> np</span><span style="background-color: transparent; color: black; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><span style="background-color: transparent; color: black; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><span style="background-color: transparent; color: black; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">items</span><span style="background-color: transparent; color: #666600; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">,</span><span style="background-color: transparent; color: black; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> p_values </span><span style="background-color: transparent; color: #666600; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">=</span><span style="background-color: transparent; color: black; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> zip</span><span style="background-color: transparent; color: #666600; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">(*</span><span style="background-color: transparent; color: black; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">model</span><span style="background-color: transparent; color: #666600; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span><span style="background-color: transparent; color: black; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">items</span><span style="background-color: transparent; color: #666600; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">())</span><span style="background-color: transparent; color: black; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><span style="background-color: transparent; color: black; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">samples </span><span style="background-color: transparent; color: #666600; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">=</span><span style="background-color: transparent; color: black; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> np</span><span style="background-color: transparent; color: #666600; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span><span style="background-color: transparent; color: black; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">random</span><span style="background-color: transparent; color: #666600; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span><span style="background-color: transparent; color: black; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">choice</span><span style="background-color: transparent; color: #666600; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">(</span><span style="background-color: transparent; color: black; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">a </span><span style="background-color: transparent; color: #666600; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">=</span><span style="background-color: transparent; color: black; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> items</span><span style="background-color: transparent; color: #666600; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">,</span><span style="background-color: transparent; color: black; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> size </span><span style="background-color: transparent; color: #666600; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">=</span><span style="background-color: transparent; color: black; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #006666; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">10</span><span style="background-color: transparent; color: #666600; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">,</span><span style="background-color: transparent; color: black; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> p </span><span style="background-color: transparent; color: #666600; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">=</span><span style="background-color: transparent; color: black; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> p_values</span><span style="background-color: transparent; color: #666600; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">) </span></div>
</td></tr>
</tbody></table>
</div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt;">
<b style="font-weight: normal;"><br /></b></div>
<h3 dir="ltr" style="line-height: 1.38; margin-bottom: 4pt; margin-top: 16pt;">
<span style="background-color: transparent; color: #434343; font-family: "arial"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> Three axioms of probability</span></h3>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">The probability value assignment has to comply with the following three rules (known as three axioms of probability)</span></div>
<ul style="margin-bottom: 0pt; margin-top: 0pt;">
<li dir="ltr" style="background-color: transparent; color: black; font-family: Arial; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: disc; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<a href="http://api.gmath.guru/cgi-bin/gmath?P(%5Comega)%20%5Cgeq%200%20%20%5Cquad%20%5Cquad%20%5Cforall%20%5Comega%20%5Cin%20%5COmega" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><img height="17" src="https://lh5.googleusercontent.com/CJH5xGKiPtL5BKifoZv8EmU1K2gYpIawrfpBqwkyBAVy27Mdw2VUah_IkvfBTvKwfxH1e7R859b8UHFBOjFAb-Zpg1NwDzy74JrIiR6IjQi_5UlbG27xe6Aq-NMtIA5ir-SeCnT-" style="-webkit-transform: rotate(0.00rad); border: none; transform: rotate(0.00rad);" width="152" /></span></a></div>
</li>
<li dir="ltr" style="background-color: transparent; color: black; font-family: Arial; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: disc; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<a href="http://api.gmath.guru/cgi-bin/gmath?%5Csum_%7B%5Comega%20%5Cin%20%5COmega%7D%20%7BP(%5Comega)%20%7D%20%3D%201" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><img height="36" src="https://lh4.googleusercontent.com/-nvTpx0s_Dul9meb-5RDR_w-gZLFqabHeX1BmdwdGSGLy8GIgnippr3fR58k1EcRC_7V6PNRxUwp-cc1--yVa4rwleHxCb8nELEna_2AakE2IizfzhfwbkJ9gj8daZcSBstnIxq6" style="-webkit-transform: rotate(0.00rad); border: none; transform: rotate(0.00rad);" width="96" /></span></a></div>
</li>
<li dir="ltr" style="background-color: transparent; color: black; font-family: Arial; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: disc; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">If </span><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">A</span><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> and </span><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">B</span><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> are disjoint events ( </span><a href="http://api.gmath.guru/cgi-bin/gmath?A%20%5Ccap%20%20B%20%3D%20%5CPhi" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><img height="13" src="https://lh4.googleusercontent.com/Wetucv3xLeykdUTWMA9u3K0yRkclaHzT3SNYlgFL8FbcRFOGALUB2UsYpfSkjdADCUW8x0ffIK1JWM4WY0oVwkAaNraFJyE6hwNZQXY467-3cuTbwR_PtmNcwF0n28KTbGJkOufv" style="-webkit-transform: rotate(0.00rad); border: none; transform: rotate(0.00rad);" width="77" /></span></a><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">) , then </span><a href="http://api.gmath.guru/cgi-bin/gmath?P(A%20%5Ccup%20B)%20%3D%20P(A)%20%2B%20P(B)" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><img height="17" src="https://lh4.googleusercontent.com/Lo84q8F4YjLc_bMfFCPOs8kKzbi2yKCXs3ZW6X1rVu2U-2RHQXT4KPGhXVeHpZZXOFetp4fnGqXeZj8_CtULLSOwC3kxOaCWW57k-6nTFZffvx47BvkA3tm0zZy5YeE5gnc55dJC" style="-webkit-transform: rotate(0.00rad); border: none; transform: rotate(0.00rad);" width="188" /></span></a></div>
</li>
</ul>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt;">
<b style="font-weight: normal;"><br /></b></div>
<h2 dir="ltr" style="line-height: 1.38; margin-bottom: 6pt; margin-top: 18pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 21.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Random Variables</span></h2>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt;">
<b style="font-weight: normal;"><br /></b></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Random variables, strangely enough despite their name, are functions that map the experiment outcomes to another set of values.</span><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">The course uses the python dictionary to represent a random variable that maps a finite sample space to another finite set of values.</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt;">
<b style="font-weight: normal;"><br /></b></div>
<div dir="ltr" style="margin-left: 0pt;">
<table style="border-collapse: collapse; border: none; width: 624px;"><colgroup><col width="*"></col></colgroup><tbody>
<tr style="height: 0px;"><td style="border-bottom: solid #000000 1px; border-left: solid #000000 1px; border-right: solid #000000 1px; border-top: solid #000000 1px; padding: 7px 7px 7px 7px; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">weather_model </span><span style="background-color: transparent; color: #666600; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">=</span><span style="background-color: transparent; color: black; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #666600; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">{'</span><span style="background-color: transparent; color: black; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">sunny</span><span style="background-color: transparent; color: #666600; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">':</span><span style="background-color: transparent; color: black; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #006666; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">0.7</span><span style="background-color: transparent; color: #666600; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">,</span><span style="background-color: transparent; color: black; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #666600; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">'</span><span style="background-color: transparent; color: black; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">rainy</span><span style="background-color: transparent; color: #666600; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">'</span><span style="background-color: transparent; color: black; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #666600; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">:</span><span style="background-color: transparent; color: black; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #006666; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">0.25</span><span style="background-color: transparent; color: #666600; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">,</span><span style="background-color: transparent; color: black; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #666600; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">'</span><span style="background-color: transparent; color: black; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">snowy</span><span style="background-color: transparent; color: #666600; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">':</span><span style="background-color: transparent; color: black; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #006666; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">0.05}</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">random_variable_mapping </span><span style="background-color: transparent; color: #666600; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">=</span><span style="background-color: transparent; color: black; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #666600; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">{'</span><span style="background-color: transparent; color: black; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">sunny</span><span style="background-color: transparent; color: #666600; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">':</span><span style="background-color: transparent; color: black; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #006666; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">1</span><span style="background-color: transparent; color: #666600; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">,</span><span style="background-color: transparent; color: black; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #666600; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">'</span><span style="background-color: transparent; color: black; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">rainy</span><span style="background-color: transparent; color: #666600; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">'</span><span style="background-color: transparent; color: black; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #666600; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">:</span><span style="background-color: transparent; color: black; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #006666; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">1</span><span style="background-color: transparent; color: #666600; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">,</span><span style="background-color: transparent; color: black; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #666600; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">'</span><span style="background-color: transparent; color: black; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">snowy</span><span style="background-color: transparent; color: #666600; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">':</span><span style="background-color: transparent; color: black; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #006666; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">0</span><span style="background-color: transparent; color: black; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #666600; font-family: "consolas"; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">} </span></div>
</td></tr>
</tbody></table>
</div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt;">
<br /></div>
</div>
</div>
<script src="https://latex.codecogs.com/latexit.php?dynamic&div" type="text/javascript"></script>
</div>
Unknownnoreply@blogger.com14tag:blogger.com,1999:blog-8573087008280197594.post-12772300320975213832016-03-19T22:42:00.003-07:002016-03-19T22:42:32.601-07:00Integrating cpplint with Vim<div dir="ltr" style="text-align: left;" trbidi="on">
Vim is a light-weight, yet powerful editor. Although it may be quite frustrating for developers that it does not, by default, support features such as nice syntax highlighting or keyboard shortcuts, It is really too easy and straightforward to enable such developer friendly features into it. Here I am showing how to setup a keyboard shortcut to use <b class="">cpplint</b> with <b>Vim</b> in order to perform code style checking.<br />
<br />
<br />
<b class="">cpplint</b> is a code style checker that checks how much your code matches the G<a href="https://google.github.io/styleguide/cppguide.html">oogle C++ Style guidlines</a>. The feedback returned by <b>cpplint</b> can be valuable for developers to practice writing good code according to Google C++ style guidelines (or others).<br />
<br />
<br />
Steps:<br />
<ol style="text-align: left;">
<li>Download <b>cpplint</b> from <a href="https://github.com/google/styleguide/tree/gh-pages/cpplint">here</a>.</li>
<li>copy <b>cpplint</b> to one of your path directories, make sure it is executable. For example:</li>
</ol>
<div>
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0;">sudo cp cpplint.py /usr/local/bin/cpplint.py
sudo chmod usr/local/bin/cpplint.py
</pre>
</div>
</div>
<div>
<br /></div>
<div>
3. To setup a keyboard shortcut in VIM to run <b>cpplint.py </b>against your cpp file. Add the following line into your ~/.vimrc file</div>
<div>
<div>
<br /></div>
</div>
<div>
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0;">autocmd BufRead *.cpp map <F7> :w<enter>:!/usr/local/bin/cpplint.py %<enter>
</pre>
</div>
</div>
<div>
<br />
4. Now, you can use the <b>F7</b> keyboard shortcut to run <b>cpplint</b> while editing any *.cpp file.</div>
<div>
<br /></div>
<div>
<br /></div>
<br />
<br /></div>
Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-8573087008280197594.post-32529092047768243822015-04-27T00:56:00.002-07:002015-04-29T12:25:53.992-07:00Running MATLAB 2012b on MAC OS X Yosemite<div dir="ltr" style="text-align: left;" trbidi="on">
I have been trying to install the MATLAB 2012b on MAC OS X 10.10.3 (Yosemite), however, starting the application after installation keeps gives an error message "<span style="font-family: Courier New, Courier, monospace;">Unexpected Exception: There was an unexcepted exception</span>" that refers to the path of log file with error details.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFfv2inUrcoLqp5mW5h6TORA3A0pskQryw-F-6q85RcZAWXL6TDrI_x_Igre50Np-OeXNqCiDCO9OV5kqN7hwyl_0jDmqDS-EBIK8r7n6hP6JOBzuWQVaCowo4mQ2KCDutkOWp2K9SMejz/s1600/Screen+Shot+2015-04-26+at+11.56.47+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFfv2inUrcoLqp5mW5h6TORA3A0pskQryw-F-6q85RcZAWXL6TDrI_x_Igre50Np-OeXNqCiDCO9OV5kqN7hwyl_0jDmqDS-EBIK8r7n6hP6JOBzuWQVaCowo4mQ2KCDutkOWp2K9SMejz/s1600/Screen+Shot+2015-04-26+at+11.56.47+PM.png" height="119" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Arial, Helvetica, sans-serif;">I checked what was inside the log file, and I have found the following message about the reason of the exception:</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></div>
<div style="line-height: 16px;">
<br /></div>
<pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 100%;"><code style="color: black; word-wrap: normal;"> com.mathworks.instutil.JNIException: java.lang.UnsatisfiedLinkError: Cant load library: /Applications/MATLAB_R2012b.app/bin/maci64/libinstutil.dylib
java.lang.UnsatisfiedLinkError: Cant load library: /Applications/MATLAB_R2012b.app/bin/maci64/libinstutil.dylib
</code></pre>
<div style="line-height: 16px;">
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></div>
<div style="line-height: 16px;">
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></div>
<span style="line-height: 16px;"><span style="font-family: Arial, Helvetica, sans-serif;">Doing a quick search about problems starting MATLAB on MAC OS X, I have found out that the reason might be the version of java that I am running.</span></span><br />
<span style="line-height: 16px;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></span>
<span style="line-height: 16px;"><span style="font-family: Arial, Helvetica, sans-serif;">I checked the version of java installed on my machine using</span></span><br />
<span style="line-height: 16px;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></span>
<br />
<pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> java -version
</code></pre>
<span style="line-height: 16px;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></span>
<span style="line-height: 16px;"><span style="font-family: Arial, Helvetica, sans-serif;">and the output was </span></span><br />
<pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> java version "1.8.0_40"
Java(TM) SE Runtime Environment (build 1.8.0_40-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode)
</code></pre>
<span style="line-height: 16px;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></span>
<span style="line-height: 16px;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></span>
<span style="line-height: 16px;"><span style="font-family: Arial, Helvetica, sans-serif;">as I am running Oracle Java 1.8. </span></span><br />
<span style="line-height: 16px;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></span>
<span style="line-height: 16px;"><span style="font-family: Arial, Helvetica, sans-serif;">I followed the instructions from this stack overflow answer, to remove the existing installation of Java 1.8 from my Mac.</span></span><br />
<pre class="lang-java prettyprint prettyprinted" style="background-color: #eeeeee; border: 0px; color: #393318; max-height: 600px; overflow: auto; padding: 5px; width: auto; word-wrap: normal;"><code><span style="font-family: Arial, Helvetica, sans-serif;">sudo rm -rf /Library/Java/JavaVirtualMachines/jdk<version>.jdk
sudo rm -rf /Library/PreferencePanes/JavaControlPanel.prefPane
sudo rm -rf /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin</span></code></pre>
<span style="line-height: 16px;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></span>
<span style="line-height: 16px;"><span style="font-family: Arial, Helvetica, sans-serif;">then I installed the Java for OS X from Apple:</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><a href="https://support.apple.com/kb/dl1572?locale=en_US">https://support.apple.com/kb/dl1572?locale=en_US</a></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Now, I tried again launching the MATLAB. I noticed that the error message have changed as now the application runs and I can view the splash screen but by the time when it is supposed to display the MATLAB desktop environment, it shows another error message instead.</span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiz8JElaJTYGn-CNIKE7axUuYvdRuB3J1re-n0mkT9Q-hbJps55FvZiv4RS8t0mS7odJcr_0_bNUbLW7k9UMJnyKWS_Sx4YflfzbpIQHwKtvuWN5CckmlPi374A6ZZMVGdDIGeKFpNpfBiH/s1600/Screen+Shot+2015-04-27+at+12.05.43+AM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><span style="font-family: Arial, Helvetica, sans-serif;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiz8JElaJTYGn-CNIKE7axUuYvdRuB3J1re-n0mkT9Q-hbJps55FvZiv4RS8t0mS7odJcr_0_bNUbLW7k9UMJnyKWS_Sx4YflfzbpIQHwKtvuWN5CckmlPi374A6ZZMVGdDIGeKFpNpfBiH/s1600/Screen+Shot+2015-04-27+at+12.05.43+AM.png" height="318" width="320" /></span></a></div>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">The new error message is </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"><b>Error Starting Desktop:</b></span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<br />
<pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> java.lang.NullPointerException
at com.mathworks.widgets.WindowsWidgetFactory$SearchAndClearButton.anyText(WindowsWidgetFactory.java:187)
at com.mathworks.widgets.WindowsWidgetFactory$SearchAndClearButton.getIcon(WindowsWidgetFactory.java:195)
at com.apple.laf.AquaButtonUI.setThemeBorder(AquaButtonUI.java:113)
at com.apple.laf.AquaButtonUI.installDefaults(AquaButtonUI.java:80)
at javax.swing.plaf.basic.BasicButtonUI.installUI(BasicButtonUI.java:88)
at javax.swing.JComponent.setUI(JComponent.java:664)
at javax.swing.AbstractButton.setUI(AbstractButton.java:1807)
at javax.swing.JButton.updateUI(JButton.java:146)
at javax.swing.AbstractButton.init(AbstractButton.java:2172)
at javax.swing.JButton.<init>(JButton.java:136)
</code></pre>
<pre style="line-height: 16px;"></pre>
<div>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Arial, Helvetica, sans-serif;">At this moment, I was able to start the MATLAB from the command line, but without the desktop GUI environment using the commands:</span></div>
<div>
<pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> sudo /Applications/MATLAB_R2012b.app/bin/matlab --nodesktop
</code></pre>
<span style="font-family: Arial, Helvetica, sans-serif;">or </span>
<br />
<pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> sudo /Applications/MATLAB_R2012b.app/bin/matlab --nojvm
</code></pre>
<div>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></div>
<span style="line-height: 16px;"><span style="font-family: Arial, Helvetica, sans-serif;">I tried installing <a href="https://support.apple.com/en-us/HT201341">X11</a> which is claimed to be required by MATLAB on OS X as stated <a href="http://www.mathworks.com/matlabcentral/answers/95806-why-will-matlab-not-start-up-properly-on-my-mac-os-x-system">here</a> but still the problem persists to happen.</span></span><br />
<span style="line-height: 16px;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="line-height: 16px;">Finally, I noticed that there is a <a href="https://www.mathworks.com/support/bugreports/1098655">bug report</a> for this issue on MathWorks website that provides a patch for solving this issue. I downloaded the patch from </span><a href="https://www.mathworks.com/support/bugreports/1098655">https://www.mathworks.com/support/bugreports/1098655</a> , and run at as described in the instruction on the page and now I can run MATLAB normally on my MAC Yosemite! :D :D</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<br />
<div>
<br /></div>
</div>
</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8573087008280197594.post-18977787226937917672015-04-26T21:44:00.000-07:002015-04-27T01:00:00.923-07:00Dissecting Android Permissions<div dir="ltr" style="text-align: left;" trbidi="on">
<h1 dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 10pt;">
<span style="background-color: transparent; color: black; font-family: 'Trebuchet MS'; font-size: 21px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">What are Android Permissions ?</span></h1>
<b id="docs-internal-guid-c1ec9274-f930-3e97-fed7-3497a8a00586" style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Android uses a fine-grained permission to control the application access to resources. APIs for accessing sensitive resources are actions are protected by permissions, the application developer must declare what permissions the application needs to operate correctly within the application manifest file “</span><span style="background-color: transparent; color: blue; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">manifest.xml</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">”. The syntax for that is :</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="margin-left: 0pt;">
<table style="border-collapse: collapse; border: none; width: 624px;"><colgroup><col width="*"></col></colgroup><tbody>
<tr style="height: 0px;"><td style="border-bottom: solid #000000 1px; border-left: solid #000000 1px; border-right: solid #000000 1px; border-top: solid #000000 1px; padding: 7px 7px 7px 7px; vertical-align: top;"><div dir="ltr" style="line-height: 1.7999999999999998; margin-bottom: 8pt; margin-left: 23pt; margin-top: 8pt;">
<span style="background-color: transparent; color: #000088; font-family: Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><uses-permission</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #882288; font-family: Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">android:</span><a href="http://developer.android.com/guide/topics/manifest/uses-permission-element.html#nm" style="text-decoration: none;"><span style="background-color: transparent; color: #882288; font-family: Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">name</span></a><span style="background-color: transparent; color: #666600; font-family: Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">=</span><span style="background-color: transparent; color: #880000; font-family: Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"</span><span style="background-color: transparent; color: #880000; font-family: Arial; font-size: 13px; font-style: italic; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">string</span><span style="background-color: transparent; color: #880000; font-family: Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"</span></div>
<div dir="ltr" style="line-height: 1.7999999999999998; margin-bottom: 8pt; margin-left: 23pt; margin-top: 8pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #882288; font-family: Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">android:</span><a href="http://developer.android.com/guide/topics/manifest/uses-permission-element.html#maxSdk" style="text-decoration: none;"><span style="background-color: transparent; color: #882288; font-family: Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">maxSdkVersion</span></a><span style="background-color: transparent; color: #666600; font-family: Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">=</span><span style="background-color: transparent; color: #880000; font-family: Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"</span><span style="background-color: transparent; color: #880000; font-family: Arial; font-size: 13px; font-style: italic; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">integer</span><span style="background-color: transparent; color: #880000; font-family: Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #000088; font-family: Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">/></span></div>
</td></tr>
</tbody></table>
</div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.7999999999999998; margin-bottom: 8pt; margin-top: 8pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">where </span><span style="background-color: transparent; color: blue; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> android:name</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> is the name of the required permission, and </span><span style="background-color: transparent; color: blue; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">android:maxSdkversion</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> is the highest API level at which the application needs to be granted this permission. Ths attribute is useful if the permission declared is no longer needed after a certain API level.</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">The list of all permissions defined by the base Android operating system can be found here:</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<a href="http://developer.android.com/reference/android/Manifest.permission.html" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">http://developer.android.com/reference/android/Manifest.permission.html</span></a></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">In addition to those, the application developer can also define new permissions to control what other applications can interact with his application.</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Example: </span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="margin-left: 0pt;">
<table style="border-collapse: collapse; border: none; width: 624px;"><colgroup><col width="*"></col></colgroup><tbody>
<tr style="height: 0px;"><td style="border-bottom: solid #000000 1px; border-left: solid #000000 1px; border-right: solid #000000 1px; border-top: solid #000000 1px; padding: 7px 7px 7px 7px; vertical-align: top;"><div dir="ltr" style="line-height: 1.71; margin-bottom: 0pt; margin-top: 8pt;">
<span style="background-color: transparent; color: #000088; font-family: Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><uses-permission</span></div>
<div dir="ltr" style="line-height: 1.71; margin-bottom: 0pt; margin-top: 8pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #882288; font-family: Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">android:name</span><span style="background-color: transparent; color: #666600; font-family: Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">=</span><span style="background-color: transparent; color: #880000; font-family: Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"android.permission.WRITE_EXTERNAL_STORAGE"</span></div>
<div dir="ltr" style="line-height: 1.71; margin-bottom: 0pt; margin-top: 8pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #882288; font-family: Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">android:maxSdkVersion</span><span style="background-color: transparent; color: #666600; font-family: Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">=</span><span style="background-color: transparent; color: #880000; font-family: Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"18"</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #000088; font-family: Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">/></span></div>
</td></tr>
</tbody></table>
</div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">This indicates that the application asks for being granted the “</span><span style="background-color: transparent; color: blue; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">android.permission.WRITE_EXTERNAL_STORAGE</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">” when installed on API level 18 or lower.</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">At the time of application installation, the user will presented with a list of all permissions requested by the application (as declared in the manifest file) and it is up to him to proceed with the installation process, therefore granting it all permissions it needs, or cancel the installation process.</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<h1 dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 10pt;">
<span style="background-color: transparent; color: black; font-family: 'Trebuchet MS'; font-size: 21px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">How permissions are maintained in Android ?</span></h1>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">In Android, the </span><a href="http://developer.android.com/reference/android/content/pm/PackageManager.html" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">PackageManger</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> is responsible for managing the packages installation and permissions. You can use the package manager to view all installed packages on your Android system:</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="margin-left: 0pt;">
<table style="border-collapse: collapse; border: none; width: 624px;"><colgroup><col width="*"></col></colgroup><tbody>
<tr style="height: 0px;"><td style="border-bottom: solid #000000 1px; border-left: solid #000000 1px; border-right: solid #000000 1px; border-top: solid #000000 1px; padding: 7px 7px 7px 7px; vertical-align: top;"><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">pm list packages</span></div>
</td></tr>
</tbody></table>
</div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">or list all permissions (including those that are defined by 3rd party application developers):</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="margin-left: 0pt;">
<table style="border-collapse: collapse; border: none; width: 624px;"><colgroup><col width="*"></col></colgroup><tbody>
<tr style="height: 0px;"><td style="border-bottom: solid #000000 1px; border-left: solid #000000 1px; border-right: solid #000000 1px; border-top: solid #000000 1px; padding: 7px 7px 7px 7px; vertical-align: top;"><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">pm list permissions</span></div>
</td></tr>
</tbody></table>
</div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Or you can also use it to install an application</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="margin-left: 0pt;">
<table style="border-collapse: collapse; border: none; width: 624px;"><colgroup><col width="*"></col></colgroup><tbody>
<tr style="height: 0px;"><td style="border-bottom: solid #000000 1px; border-left: solid #000000 1px; border-right: solid #000000 1px; border-top: solid #000000 1px; padding: 7px 7px 7px 7px; vertical-align: top;"><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">pm install <APK_filename></span></div>
</td></tr>
</tbody></table>
</div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">or to grant/ revoke permission to a package ?</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="margin-left: 0pt;">
<table style="border-collapse: collapse; border: none; width: 624px;"><colgroup><col width="*"></col></colgroup><tbody>
<tr style="height: 0px;"><td style="border-bottom: solid #000000 1px; border-left: solid #000000 1px; border-right: solid #000000 1px; border-top: solid #000000 1px; padding: 7px 7px 7px 7px; vertical-align: top;"><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> pm grant <PACKAGE> <PERMISSION></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> pm revoke <PACKAGE> <PERMISSION></span></div>
</td></tr>
</tbody></table>
</div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">When you attempt to install an application, The</span><a href="https://github.com/android/platform_packages_apps_packageinstaller/blob/master/src/com/android/packageinstaller/PackageInstallerActivity.java" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;"> PackageInstallerActivity</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> invokes the PackageManager that is starts the installation process. The package manager communicates with the PackageManagerService to get the app installed via the </span><a href="https://android.googlesource.com/platform/frameworks/base/+/0b285499db739ba50f2f839d633e763c70e67f96/cmds/installd/installd.c" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">installd</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> daemon. The PackageManager runs within the “</span><span style="background-color: transparent; color: blue; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">system_server</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">”</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> process and the installd runs as a native service. Both of install daemon (</span><span style="background-color: transparent; color: blue; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">installd</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">) and </span><span style="background-color: transparent; color: blue; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">system_server</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> are started at the boot time.</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><img alt="Package+Installer.jpg" height="469px;" src="https://lh4.googleusercontent.com/_J9dQ3hY0_earqfaDo0UYa4ybgKrI66WDwTjc3aqNZITtGbMR4gir0laghSYv9AQnrfO9SfMtYkBdY6V5Z-Tmo6mpE0YGkwonmb7CF3qob43THwCErmYQbW6ZPJzqSLLgSrgm3I" style="-webkit-transform: rotate(0.00rad); border: none; transform: rotate(0.00rad);" width="624px;" /></span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">( Figure Courtesy of http://kpbird.blogspot.com/2012/10/in-depth-android-package-manager-and.html )</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: 'Trebuchet MS'; font-size: 28px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">How does the installation process happen ?</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">A major difference between Android and Linux is that Android isolates each application from other applications to prevent malicious applications from snooping or crashing other installed application. This approach is known as “Sandboxing”, Android achieves this by considering each application as a different user. </span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">At installation time, the PackageManager copies the APK file and any native libraries within the app to “</span><span style="background-color: transparent; color: blue; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">/data/app/<package name></span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">” directory (or “</span><span style="background-color: transparent; color: blue; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">/system/app/<package name></span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">” for system applications). Then, it decides a unique identifiers (UID) for the new application. The application UIDs are chosen in the range between 10,000 and 99,999 . As defined in </span><a href="http://androidxref.com/5.1.0_r1/xref/system/core/include/private/android_filesystem_config.h" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">ANDROID_FILESYSTEM_CONFIG </span></a></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="margin-left: 0pt;">
<table style="border-collapse: collapse; border: none; width: 624px;"><colgroup><col width="*"></col></colgroup><tbody>
<tr style="height: 0px;"><td style="border-bottom: solid #000000 1px; border-left: solid #000000 1px; border-right: solid #000000 1px; border-top: solid #000000 1px; padding: 7px 7px 7px 7px; vertical-align: top;"><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">#</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">define</span><a href="http://androidxref.com/5.1.0_r1/s?refs=AID_APP&project=system" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #cc6666; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">AID_APP</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: brown; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">10000</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #666666; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">/* first app user */</span></div>
</td></tr>
</tbody></table>
</div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">In addition to the UID, the application is also assigned a username to the maps to the UID (For example application with UID 10032 is assigned the user name u0_a32 ) and a data directory at “</span><span style="background-color: transparent; color: blue; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">/data/data/<package name></span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">”. Permissions for the data directory are set appropriately such that it is owned by the new created user for this application. </span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Although that by default Android assigns to each application a unique UID, two application can request to be running under the same UID by setting the same value of </span><a href="http://developer.android.com/guide/topics/manifest/manifest-element.html#uid" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">android:sharedUserId</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> in their manifest files, this is only possible if both application are going to be signed by the same developer certificate. The two applications that share the same user id will share the same data directory and , if desired, run in the same process. The role of code signing in Android Security model is explained in more detail in this </span><a href="http://nelenkov.blogspot.com/2013/05/code-signing-in-androids-security-model.html" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">article</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">For example, the application “</span><span style="background-color: transparent; color: blue; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">nesl.ucla.edu.cameraap1</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">” has been assigned the UID : 10057 and the user name “</span><span style="background-color: transparent; color: blue; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">u0_a57</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">”. The data directory for that app /data/data/nesl.ucla.edu.cameraapp1” is therefore owned by “</span><span style="background-color: transparent; color: blue; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">u0_a57</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">” user.</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><img height="33px;" src="https://lh4.googleusercontent.com/OAxlY-lYbm6dt0P5cILp5mCOrFbgZf1iR1ZsHk1QI1ribkyQzYKT9n4cFzGYggC8FGBfdUPlV0WljUZgqLeQzIB90UmDN8ykbTgRzf1d4T7ZFp6ks8QEHn1JyYL1oTjZjAC52cw" style="-webkit-transform: rotate(0.00rad); border: none; transform: rotate(0.00rad);" width="624px;" /></span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Also during the installation, the PackageManager adds new entries for the new installed package in “</span><span style="background-color: transparent; color: blue; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">/data/system/packages.xml</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">” and “</span><span style="background-color: transparent; color: blue; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">/data/system/packages.list</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">” files.</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">The “</span><span style="background-color: transparent; color: blue; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">packages.xml</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">” also maintains information about installed packages, including the packagename, app directory (location of apk, and native libraries), their user ID, version number (as extracted from the manifest file), the certificate key by which the APK was signed and the list of permissions that have been granted to the application. Permissions are stored under the </span><span style="background-color: transparent; color: blue; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><perms></span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> tag. Adding or removing items from this section may grant or revoke permission to the application. However, modification will not be reflected until the </span><span style="background-color: transparent; color: blue; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">system_server</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> (hosting the </span><span style="background-color: transparent; color: blue; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">PackageManagerService</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">) is restarted since the application permissions are cached as we will see later.</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="margin-left: 0pt;">
<table style="border-collapse: collapse; border: none; width: 624px;"><colgroup><col width="*"></col></colgroup><tbody>
<tr style="height: 0px;"><td style="border-bottom: solid #000000 1px; border-left: solid #000000 1px; border-right: solid #000000 1px; border-top: solid #000000 1px; padding: 7px 7px 7px 7px; vertical-align: top;"><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><package name="nesl.ucla.edu.cameraapp1" codePath="/data/app/nesl.ucla.edu.cameraapp1-2" nativeLibraryPath="/data/app/nesl.ucla.edu.cameraapp1-2/lib" flags="572998" ft="14cca4e4b58" it="14cca4cf54b" ut="14cca4e4ea5" version="1" userId="10057"></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> <sigs count="1"></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> <cert index="6" /></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </sigs></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> <perms></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> <item name="android.permission.CAMERA" /></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </perms></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> <proper-signing-keyset identifier="48" /></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> <signing-keyset identifier="48" /></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </package></span></div>
</td></tr>
</tbody></table>
</div>
<b style="font-weight: normal;"><br /></b><br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">while the “</span><span style="background-color: transparent; color: blue; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">packages.list</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">” file lists all installed packages their user identifiers (UID), the location of their data directory, and the identifier of any groups (GIDs) they are member of.</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="margin-left: 0pt;">
<table style="border-collapse: collapse; border: none; width: 624px;"><colgroup><col width="*"></col></colgroup><tbody>
<tr style="height: 0px;"><td style="border-bottom: solid #000000 1px; border-left: solid #000000 1px; border-right: solid #000000 1px; border-top: solid #000000 1px; padding: 7px 7px 7px 7px; vertical-align: top;"><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">nesl.ucla.edu.wifistatuslog 10058 1 /data/data/nesl.ucla.edu.wifistatuslog default 3003</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">nesl.ucla.edu.cameraapp1 10057 1 /data/data/nesl.ucla.edu.cameraapp1 default none</span></div>
</td></tr>
</tbody></table>
</div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Note that granting some permissions to an application results in adding the applications UID into a members group. For example the package “nesl.ucla.edu.wifistatuslog” (u0_a58) is a member of 3003 group (inet) because it has been granted the “</span><span style="background-color: transparent; color: blue; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">android.permission.INTERNET</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">” permission. The mapping between permissions and group IDs can be found at:</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">“</span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/data/etc/platform.xml" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">/etc/permissions/platform.xml</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">” while the group identifier (GID) values for the groups are defined in </span><a href="http://androidxref.com/5.1.0_r1/xref/system/core/include/private/android_filesystem_config.h" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">ANDROID_FILESYSTEM_CONFIG</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.. Those kinds of permissions are enforced by at the low-level byl kernel itself. </span></div>
<b style="font-weight: normal;"><br /></b>
<h1 dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 10pt;">
<span style="background-color: transparent; color: black; font-family: 'Trebuchet MS'; font-size: 21px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Where does permission checking happen?</span></h1>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">When the android device boots, the first process started by the linux kernel is </span><span style="background-color: transparent; color: blue; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">init</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> (PID: 1) process that executes shell scripts defined inside </span><span style="background-color: transparent; color: blue; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">/init.rc</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">This goal of init.rc is to initialize the system environment by executing a series of commands. </span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">The init.rc defines the user under each each service is going to run (for example: </span><span style="background-color: transparent; color: blue; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Zygote</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> will </span><a href="http://androidxref.com/5.1.0_r1/xref/system/core/rootdir/init.zygote32.rc" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">run under the root user</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">, while keystore </span><a href="http://androidxref.com/5.1.0_r1/xref/system/core/rootdir/init.rc" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">service will be started under the keystore user)</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">One of the early processes started by init is the </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Zygote</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">. Zygote is a daemon whose goal is to start additional services and to load libraries. It acts as a loader for each Dalvik process by creating a copy of itself (e.g. forking it self). The zygote is started by executing the “</span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/cmds/app_process/app_main.cpp" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">system/bin/app_process</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">” command.</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Then it is the </span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/core/java/com/android/internal/os/ZygoteInit.java" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Zygote’s rule to start the </span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">“</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">system_server</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">” process. Therefore, the Zygote acts as the parent process oft he “system_server” and for any later running process.</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="margin-left: 0pt;">
<table style="border-collapse: collapse; border: none; width: 624px;"><colgroup><col width="*"></col></colgroup><tbody>
<tr style="height: 0px;"><td style="border-bottom: solid #000000 1px; border-left: solid #000000 1px; border-right: solid #000000 1px; border-top: solid #000000 1px; padding: 7px 7px 7px 7px; vertical-align: top;"><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">ps | grep Zygote</span></div>
</td></tr>
</tbody></table>
</div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><img height="40px;" src="https://lh4.googleusercontent.com/B5FHXkFNWbpa0mhuMGdbhD6ok-jv3nzOMjU5XYlUmT5iiqCDRfskY8V5x_L3yFFrhgK2wqZSlAvXKRlt0vlzR-ugr_nd4iOVP3exw8p2TFlH6M5e2ycSNBXeqBtAM9Ro3eaxhF4" style="-webkit-transform: rotate(0.00rad); border: none; transform: rotate(0.00rad);" width="624px;" /></span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Here, we notice that the Zygote is running the “root” user with PID = 3085 and PPID = 1</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">We also note that other running processes including the system_server have the Zygote’s PID (3085) assigned as their PPID.</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><img height="341px;" src="https://lh4.googleusercontent.com/34UOczLzfiM20Jp9f7WHp0-FH8kuAJtasvhTWxMAgjq2uLcLZlV87IZU19SzAurLjxxa7kzw3-J-ezqKODwl2Q3_16yAJ1wVbGpv_Ob3KnUQrhfhvaopD7PcpWih7hiHNtzIIVY" style="-webkit-transform: rotate(0.00rad); border: none; transform: rotate(0.00rad);" width="624px;" /></span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">The the system_server </span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/java/com/android/server/SystemServer.java" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">will start threads the android critical services </span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> that include the </span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">PackageManagerService</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="margin-left: 0pt;">
<table style="border-collapse: collapse; border: none; width: 624px;"><colgroup><col width="*"></col></colgroup><tbody>
<tr style="height: 0px;"><td style="border-bottom: solid #000000 1px; border-left: solid #000000 1px; border-right: solid #000000 1px; border-top: solid #000000 1px; padding: 7px 7px 7px 7px; vertical-align: top;"><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">ps -t -p 3339</span></div>
</td></tr>
</tbody></table>
</div>
<b style="font-weight: normal;"><br /></b>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><img height="224px;" src="https://lh5.googleusercontent.com/msk5QXae_2t67GfPU21HFuGI5Z6rEQZF609GcL0tn79wB_WZTyoF7_K9Q_4q1xQs07SRhJtbnPeQETPJCtjbnBplpsetrJ6TlNpI5MLdAVlTkWJwDLmyTrqKVNkgisYOw7bakls" style="-webkit-transform: rotate(0.00rad); border: none; transform: rotate(0.00rad);" width="624px;" /></span></div>
<b style="font-weight: normal;"><br /></b><br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Looking inside the source code of PackageMangerService</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Within the constructor, PackageManagerService instantiates an object (</span><span style="background-color: transparent; color: blue; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">mSettings</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">) of Settings class</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="margin-left: 0pt;">
<table style="border-collapse: collapse; border: none; width: 624px;"><colgroup><col width="*"></col></colgroup><tbody>
<tr style="height: 0px;"><td style="border-bottom: solid #000000 1px; border-left: solid #000000 1px; border-right: solid #000000 1px; border-top: solid #000000 1px; padding: 7px 7px 7px 7px; vertical-align: top;"><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-right: 2pt; margin-top: 0pt;">
<a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java#1300" style="text-decoration: none;"><span style="background-color: #dddddd; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">1300</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java#mSettings" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #990099; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">mSettings</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> = </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">new</span><a href="http://androidxref.com/5.1.0_r1/s?defs=Settings&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Settings</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">(</span><a href="http://androidxref.com/5.1.0_r1/s?defs=context&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">context</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">);</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span></div>
</td></tr>
</tbody></table>
</div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> The object </span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java#mSettings" style="text-decoration: none;"><span style="background-color: transparent; color: #990099; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">mSettings</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> will be used deserialize package configurations from “packages.xml” file by calling:</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="margin-left: 0pt;">
<table style="border-collapse: collapse; border: none; width: 624px;"><colgroup><col width="*"></col></colgroup><tbody>
<tr style="height: 0px;"><td style="border-bottom: solid #000000 1px; border-left: solid #000000 1px; border-right: solid #000000 1px; border-top: solid #000000 1px; padding: 7px 7px 7px 7px; vertical-align: top;"><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-right: 2pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java#mRestoredSettings" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #990099; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">mRestoredSettings</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> =</span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java#mSettings" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #990099; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">mSettings</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span><a href="http://androidxref.com/5.1.0_r1/s?defs=readLPw&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">readLPw</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">(</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">this</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">,</span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java#sUserManager" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #990099; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">sUserManager</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span><a href="http://androidxref.com/5.1.0_r1/s?defs=getUsers&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">getUsers</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">(</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">false</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">),</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java#1393" style="text-decoration: none;"><span style="background-color: #dddddd; color: #666666; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">1393</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java#mSdkVersion" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #990099; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">mSdkVersion</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">,</span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java#mOnlyCore" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #990099; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">mOnlyCore</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">);</span></div>
</td></tr>
</tbody></table>
</div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Also: updates to the package settings are serialized to the “packages.xml” file using the </span><span style="background-color: transparent; color: blue; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">mSettings</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> instance.</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="margin-left: 0pt;">
<table style="border-collapse: collapse; border: none; width: 624px;"><colgroup><col width="*"></col></colgroup><tbody>
<tr style="height: 0px;"><td style="border-bottom: solid #000000 1px; border-left: solid #000000 1px; border-right: solid #000000 1px; border-top: solid #000000 1px; padding: 7px 7px 7px 7px; vertical-align: top;"><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-right: 2pt; margin-top: 0pt;">
<a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java#1125" style="text-decoration: none;"><span style="background-color: #dddddd; color: #666666; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">1125</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java#mSettings" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #990099; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">mSettings</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span><a href="http://androidxref.com/5.1.0_r1/s?defs=writeLPr&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">writeLPr</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">();</span></div>
</td></tr>
</tbody></table>
</div>
<b style="font-weight: normal;"><br /></b>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">The </span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">packageManagerService</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> exposes two public methods: </span><a href="http://androidxref.com/5.1.0_r1/s?refs=checkPermission&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: blue; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">checkPermission</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">, and </span><a href="http://androidxref.com/5.1.0_r1/s?refs=checkUidPermission&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: blue; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">checkUidPermission</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> function that is given a package name or application UID have been granted the permission identified by </span><a href="http://androidxref.com/5.1.0_r1/s?refs=permName&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #6600cc; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">permName</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">, it will return either </span><a href="http://androidxref.com/5.1.0_r1/s?defs=PackageManager&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">PackageManager</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span><a href="http://androidxref.com/5.1.0_r1/s?defs=PERMISSION_GRANTED&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">PERMISSION_GRANTED</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> or </span><a href="http://androidxref.com/5.1.0_r1/s?defs=PackageManager&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">PackageManager</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span><a href="http://androidxref.com/5.1.0_r1/s?defs=PERMISSION_DENIED&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">PERMISSION_DENIED</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-right: 2pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span></div>
<div dir="ltr" style="margin-left: 0pt;">
<table style="border-collapse: collapse; border: none; width: 624px;"><colgroup><col width="*"></col></colgroup><tbody>
<tr style="height: 0px;"><td style="border-bottom: solid #000000 1px; border-left: solid #000000 1px; border-right: solid #000000 1px; border-top: solid #000000 1px; padding: 7px 7px 7px 7px; vertical-align: top;"><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-right: 2pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">public</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">int</span><a href="http://androidxref.com/5.1.0_r1/s?refs=checkPermission&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: blue; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">checkPermission</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">(</span><a href="http://androidxref.com/5.1.0_r1/s?defs=String&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">String</span></a><a href="http://androidxref.com/5.1.0_r1/s?refs=permName&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #6600cc; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">permName</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">,</span><a href="http://androidxref.com/5.1.0_r1/s?defs=String&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">String</span></a><a href="http://androidxref.com/5.1.0_r1/s?refs=pkgName&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #6600cc; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">pkgName</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">) {</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java#2373" style="text-decoration: none;"><span style="background-color: #dddddd; color: #666666; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">2373</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">synchronized</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> (</span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java#mPackages" style="text-decoration: none;"><span style="background-color: transparent; color: #990099; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">mPackages</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">) {</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java#2374" style="text-decoration: none;"><span style="background-color: #dddddd; color: #666666; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">2374</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><a href="http://androidxref.com/5.1.0_r1/s?defs=PackageParser&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">PackageParser</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span><a href="http://androidxref.com/5.1.0_r1/s?defs=Package&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Package</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> p =</span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java#mPackages" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #990099; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">mPackages</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java#get" style="text-decoration: none;"><span style="background-color: transparent; color: #990099; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">get</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">(</span><a href="http://androidxref.com/5.1.0_r1/s?defs=pkgName&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">pkgName</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">);</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java#2375" style="text-decoration: none;"><span style="background-color: #dddddd; color: #666666; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">2375</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">if</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> (p !=</span><a href="http://androidxref.com/5.1.0_r1/s?defs=null&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">null</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> && p.</span><a href="http://androidxref.com/5.1.0_r1/s?defs=mExtras&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">mExtras</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> !=</span><a href="http://androidxref.com/5.1.0_r1/s?defs=null&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">null</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">) {</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java#2376" style="text-decoration: none;"><span style="background-color: #dddddd; color: #666666; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">2376</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><a href="http://androidxref.com/5.1.0_r1/s?defs=PackageSetting&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">PackageSetting</span></a><a href="http://androidxref.com/5.1.0_r1/s?defs=ps&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">ps</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> = (</span><a href="http://androidxref.com/5.1.0_r1/s?defs=PackageSetting&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">PackageSetting</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">)p.</span><a href="http://androidxref.com/5.1.0_r1/s?defs=mExtras&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">mExtras</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">;</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java#2377" style="text-decoration: none;"><span style="background-color: #dddddd; color: #666666; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">2377</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">if</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> (</span><a href="http://androidxref.com/5.1.0_r1/s?defs=ps&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">ps</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span><a href="http://androidxref.com/5.1.0_r1/s?defs=sharedUser&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">sharedUser</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> !=</span><a href="http://androidxref.com/5.1.0_r1/s?defs=null&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">null</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">) {</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java#2378" style="text-decoration: none;"><span style="background-color: #dddddd; color: #666666; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">2378</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">if</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> (</span><a href="http://androidxref.com/5.1.0_r1/s?defs=ps&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">ps</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span><a href="http://androidxref.com/5.1.0_r1/s?defs=sharedUser&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">sharedUser</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span><a href="http://androidxref.com/5.1.0_r1/s?defs=grantedPermissions&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">grantedPermissions</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span><a href="http://androidxref.com/5.1.0_r1/s?defs=contains&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">contains</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">(</span><a href="http://androidxref.com/5.1.0_r1/s?defs=permName&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">permName</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">)) {</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java#2379" style="text-decoration: none;"><span style="background-color: #dddddd; color: #666666; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">2379</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">return</span><a href="http://androidxref.com/5.1.0_r1/s?defs=PackageManager&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">PackageManager</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span><a href="http://androidxref.com/5.1.0_r1/s?defs=PERMISSION_GRANTED&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">PERMISSION_GRANTED</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">;</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java#2380" style="text-decoration: none;"><span style="background-color: #dddddd; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">2380</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> }</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java#2381" style="text-decoration: none;"><span style="background-color: #dddddd; color: #666666; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">2381</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> } </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">else</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">if</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> (</span><a href="http://androidxref.com/5.1.0_r1/s?defs=ps&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">ps</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span><a href="http://androidxref.com/5.1.0_r1/s?defs=grantedPermissions&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">grantedPermissions</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span><a href="http://androidxref.com/5.1.0_r1/s?defs=contains&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">contains</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">(</span><a href="http://androidxref.com/5.1.0_r1/s?defs=permName&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">permName</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">)) {</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java#2382" style="text-decoration: none;"><span style="background-color: #dddddd; color: #666666; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">2382</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">return</span><a href="http://androidxref.com/5.1.0_r1/s?defs=PackageManager&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">PackageManager</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span><a href="http://androidxref.com/5.1.0_r1/s?defs=PERMISSION_GRANTED&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">PERMISSION_GRANTED</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">;</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java#2383" style="text-decoration: none;"><span style="background-color: #dddddd; color: #666666; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">2383</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> }</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java#2384" style="text-decoration: none;"><span style="background-color: #dddddd; color: #666666; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">2384</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> }</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java#2385" style="text-decoration: none;"><span style="background-color: #dddddd; color: #666666; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">2385</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> }</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java#2386" style="text-decoration: none;"><span style="background-color: #dddddd; color: #666666; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">2386</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">return</span><a href="http://androidxref.com/5.1.0_r1/s?defs=PackageManager&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">PackageManager</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span><a href="http://androidxref.com/5.1.0_r1/s?defs=PERMISSION_DENIED&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">PERMISSION_DENIED</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">;</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java#2387" style="text-decoration: none;"><span style="background-color: #dddddd; color: #666666; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">2387</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> }</span></div>
</td></tr>
</tbody></table>
</div>
<b style="font-weight: normal;"><br /></b>
<div dir="ltr" style="margin-left: 0pt;">
<table style="border-collapse: collapse; border: none; width: 624px;"><colgroup><col width="*"></col></colgroup><tbody>
<tr style="height: 0px;"><td style="border-bottom: solid #000000 1px; border-left: solid #000000 1px; border-right: solid #000000 1px; border-top: solid #000000 1px; padding: 7px 7px 7px 7px; vertical-align: top;"><br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-right: 2pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">@</span><a href="http://androidxref.com/5.1.0_r1/s?defs=Override&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Override</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span></a><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java#2390" style="text-decoration: none;"><span style="background-color: #dddddd; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">2390</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">public</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">int</span><a href="http://androidxref.com/5.1.0_r1/s?refs=checkUidPermission&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: blue; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">checkUidPermission</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">(</span><a href="http://androidxref.com/5.1.0_r1/s?defs=String&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">String</span></a><a href="http://androidxref.com/5.1.0_r1/s?refs=permName&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #6600cc; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">permName</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">, </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">int</span><a href="http://androidxref.com/5.1.0_r1/s?refs=uid&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #6600cc; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">uid</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">) {</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java#2391" style="text-decoration: none;"><span style="background-color: #dddddd; color: #666666; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">2391</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">synchronized</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> (</span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java#mPackages" style="text-decoration: none;"><span style="background-color: transparent; color: #990099; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">mPackages</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">) {</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java#2392" style="text-decoration: none;"><span style="background-color: #dddddd; color: #666666; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">2392</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><a href="http://androidxref.com/5.1.0_r1/s?defs=Object&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Object</span></a><a href="http://androidxref.com/5.1.0_r1/s?defs=obj&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">obj</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> =</span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java#mSettings" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #990099; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">mSettings</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span><a href="http://androidxref.com/5.1.0_r1/s?defs=getUserIdLPr&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">getUserIdLPr</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">(</span><a href="http://androidxref.com/5.1.0_r1/s?defs=UserHandle&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">UserHandle</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span><a href="http://androidxref.com/5.1.0_r1/s?defs=getAppId&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">getAppId</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">(</span><a href="http://androidxref.com/5.1.0_r1/s?defs=uid&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">uid</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">));</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java#2393" style="text-decoration: none;"><span style="background-color: #dddddd; color: #666666; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">2393</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">if</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> (</span><a href="http://androidxref.com/5.1.0_r1/s?defs=obj&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">obj</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> !=</span><a href="http://androidxref.com/5.1.0_r1/s?defs=null&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">null</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">) {</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java#2394" style="text-decoration: none;"><span style="background-color: #dddddd; color: #666666; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">2394</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><a href="http://androidxref.com/5.1.0_r1/s?defs=GrantedPermissions&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">GrantedPermissions</span></a><a href="http://androidxref.com/5.1.0_r1/s?defs=gp&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">gp</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> = (</span><a href="http://androidxref.com/5.1.0_r1/s?defs=GrantedPermissions&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">GrantedPermissions</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">)</span><a href="http://androidxref.com/5.1.0_r1/s?defs=obj&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">obj</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">;</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java#2395" style="text-decoration: none;"><span style="background-color: #dddddd; color: #666666; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">2395</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">if</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> (</span><a href="http://androidxref.com/5.1.0_r1/s?defs=gp&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">gp</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span><a href="http://androidxref.com/5.1.0_r1/s?defs=grantedPermissions&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">grantedPermissions</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span><a href="http://androidxref.com/5.1.0_r1/s?defs=contains&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">contains</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">(</span><a href="http://androidxref.com/5.1.0_r1/s?defs=permName&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">permName</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">)) {</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java#2396" style="text-decoration: none;"><span style="background-color: #dddddd; color: #666666; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">2396</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">return</span><a href="http://androidxref.com/5.1.0_r1/s?defs=PackageManager&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">PackageManager</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span><a href="http://androidxref.com/5.1.0_r1/s?defs=PERMISSION_GRANTED&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">PERMISSION_GRANTED</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">;</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java#2397" style="text-decoration: none;"><span style="background-color: #dddddd; color: #666666; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">2397</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> }</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java#2398" style="text-decoration: none;"><span style="background-color: #dddddd; color: #666666; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">2398</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> } </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">else</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> {</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java#2399" style="text-decoration: none;"><span style="background-color: #dddddd; color: #666666; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">2399</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><a href="http://androidxref.com/5.1.0_r1/s?defs=ArraySet&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">ArraySet</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><</span><a href="http://androidxref.com/5.1.0_r1/s?defs=String&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">String</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">></span><a href="http://androidxref.com/5.1.0_r1/s?defs=perms&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">perms</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> =</span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java#mSystemPermissions" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #990099; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">mSystemPermissions</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java#get" style="text-decoration: none;"><span style="background-color: transparent; color: #990099; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">get</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">(</span><a href="http://androidxref.com/5.1.0_r1/s?defs=uid&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">uid</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">);</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java#2400" style="text-decoration: none;"><span style="background-color: #dddddd; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">2400</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">if</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> (</span><a href="http://androidxref.com/5.1.0_r1/s?defs=perms&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">perms</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> !=</span><a href="http://androidxref.com/5.1.0_r1/s?defs=null&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">null</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> &&</span><a href="http://androidxref.com/5.1.0_r1/s?defs=perms&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">perms</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span><a href="http://androidxref.com/5.1.0_r1/s?defs=contains&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">contains</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">(</span><a href="http://androidxref.com/5.1.0_r1/s?defs=permName&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">permName</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">)) {</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java#2401" style="text-decoration: none;"><span style="background-color: #dddddd; color: #666666; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">2401</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">return</span><a href="http://androidxref.com/5.1.0_r1/s?defs=PackageManager&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">PackageManager</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span><a href="http://androidxref.com/5.1.0_r1/s?defs=PERMISSION_GRANTED&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">PERMISSION_GRANTED</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">;</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java#2402" style="text-decoration: none;"><span style="background-color: #dddddd; color: #666666; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">2402</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> }</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java#2403" style="text-decoration: none;"><span style="background-color: #dddddd; color: #666666; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">2403</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> }</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java#2404" style="text-decoration: none;"><span style="background-color: #dddddd; color: #666666; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">2404</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> }</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java#2405" style="text-decoration: none;"><span style="background-color: #dddddd; color: #666666; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">2405</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">return</span><a href="http://androidxref.com/5.1.0_r1/s?defs=PackageManager&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">PackageManager</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span><a href="http://androidxref.com/5.1.0_r1/s?defs=PERMISSION_DENIED&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">PERMISSION_DENIED</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">;</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java#2406" style="text-decoration: none;"><span style="background-color: #dddddd; color: #666666; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">2406</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> }</span></div>
<br /></td></tr>
</tbody></table>
</div>
<b style="font-weight: normal;"><br /></b>
<br />
<h1 dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 10pt;">
<span style="background-color: transparent; color: black; font-family: 'Trebuchet MS'; font-size: 21px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Case Analysis : LocationManager</span></h1>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Within the </span><span style="background-color: transparent; color: blue; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">LocationManagerService</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">, the function </span><a href="http://androidxref.com/5.1.0_r1/s?refs=getAllowedResolutionLevel&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: blue; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">getAllowedResolutionLevel</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> is used to return finest resolution level allowed for the calling application. It returns </span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/LocationManagerService.java#RESOLUTION_LEVEL_NONE" style="text-decoration: none;"><span style="background-color: transparent; color: #990099; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">RESOLUTION_LEVEL_NONE</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> if the application is not granted location access at all.</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-right: 2pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span></div>
<div dir="ltr" style="margin-left: 0pt;">
<table style="border-collapse: collapse; border: none; width: 624px;"><colgroup><col width="*"></col></colgroup><tbody>
<tr style="height: 0px;"><td style="border-bottom: solid #000000 1px; border-left: solid #000000 1px; border-right: solid #000000 1px; border-top: solid #000000 1px; padding: 7px 7px 7px 7px; vertical-align: top;"><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-right: 2pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">private</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">int</span><a href="http://androidxref.com/5.1.0_r1/s?refs=getAllowedResolutionLevel&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: blue; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">getAllowedResolutionLevel</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">(</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">int</span><a href="http://androidxref.com/5.1.0_r1/s?refs=pid&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #6600cc; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">pid</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">, </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">int</span><a href="http://androidxref.com/5.1.0_r1/s?refs=uid&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #6600cc; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">uid</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">) {</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/LocationManagerService.java#1006" style="text-decoration: none;"><span style="background-color: #dddddd; color: #666666; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">1006</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">if</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> (</span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/LocationManagerService.java#mContext" style="text-decoration: none;"><span style="background-color: transparent; color: #990099; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">mContext</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span><a href="http://androidxref.com/5.1.0_r1/s?defs=checkPermission&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">checkPermission</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">(</span><a href="http://androidxref.com/5.1.0_r1/s?defs=android&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">android</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span><a href="http://androidxref.com/5.1.0_r1/s?defs=Manifest&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Manifest</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span><a href="http://androidxref.com/5.1.0_r1/s?defs=permission&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">permission</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span><a href="http://androidxref.com/5.1.0_r1/s?defs=ACCESS_FINE_LOCATION&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">ACCESS_FINE_LOCATION</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">,</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/LocationManagerService.java#1007" style="text-decoration: none;"><span style="background-color: #dddddd; color: #666666; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">1007</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><a href="http://androidxref.com/5.1.0_r1/s?defs=pid&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">pid</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">,</span><a href="http://androidxref.com/5.1.0_r1/s?defs=uid&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">uid</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">) ==</span><a href="http://androidxref.com/5.1.0_r1/s?defs=PackageManager&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">PackageManager</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span><a href="http://androidxref.com/5.1.0_r1/s?defs=PERMISSION_GRANTED&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">PERMISSION_GRANTED</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">) {</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/LocationManagerService.java#1008" style="text-decoration: none;"><span style="background-color: #dddddd; color: #666666; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">1008</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">return</span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/LocationManagerService.java#RESOLUTION_LEVEL_FINE" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #990099; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">RESOLUTION_LEVEL_FINE</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">;</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/LocationManagerService.java#1009" style="text-decoration: none;"><span style="background-color: #dddddd; color: #666666; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">1009</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> } </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">else</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">if</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> (</span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/LocationManagerService.java#mContext" style="text-decoration: none;"><span style="background-color: transparent; color: #990099; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">mContext</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span><a href="http://androidxref.com/5.1.0_r1/s?defs=checkPermission&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">checkPermission</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">(</span><a href="http://androidxref.com/5.1.0_r1/s?defs=android&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">android</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span><a href="http://androidxref.com/5.1.0_r1/s?defs=Manifest&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Manifest</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span><a href="http://androidxref.com/5.1.0_r1/s?defs=permission&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">permission</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span><a href="http://androidxref.com/5.1.0_r1/s?defs=ACCESS_COARSE_LOCATION&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">ACCESS_COARSE_LOCATION</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">,</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/LocationManagerService.java#1010" style="text-decoration: none;"><span style="background-color: #dddddd; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">1010</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><a href="http://androidxref.com/5.1.0_r1/s?defs=pid&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">pid</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">,</span><a href="http://androidxref.com/5.1.0_r1/s?defs=uid&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">uid</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">) ==</span><a href="http://androidxref.com/5.1.0_r1/s?defs=PackageManager&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">PackageManager</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span><a href="http://androidxref.com/5.1.0_r1/s?defs=PERMISSION_GRANTED&project=frameworks" style="text-decoration: none;"><span style="background-color: transparent; color: #202062; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">PERMISSION_GRANTED</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">) {</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/LocationManagerService.java#1011" style="text-decoration: none;"><span style="background-color: #dddddd; color: #666666; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">1011</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">return</span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/LocationManagerService.java#RESOLUTION_LEVEL_COARSE" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #990099; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">RESOLUTION_LEVEL_COARSE</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">;</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/LocationManagerService.java#1012" style="text-decoration: none;"><span style="background-color: #dddddd; color: #666666; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">1012</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> } </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">else</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> {</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/LocationManagerService.java#1013" style="text-decoration: none;"><span style="background-color: #dddddd; color: #666666; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">1013</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">return</span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/LocationManagerService.java#RESOLUTION_LEVEL_NONE" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #990099; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">RESOLUTION_LEVEL_NONE</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">;</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/LocationManagerService.java#1014" style="text-decoration: none;"><span style="background-color: #dddddd; color: #666666; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">1014</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> }</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><a href="http://androidxref.com/5.1.0_r1/xref/frameworks/base/services/core/java/com/android/server/LocationManagerService.java#1015" style="text-decoration: none;"><span style="background-color: #dddddd; color: #666666; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">1015</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> }</span></div>
</td></tr>
</tbody></table>
</div>
<br />
<br />
<br />
<br />
<span style="font-family: Arial; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;"> </span></div>
Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-8573087008280197594.post-36319891898734355482015-01-07T23:28:00.003-08:002015-01-08T01:09:31.530-08:00Make Your Own Pebble Steel Smartwatch Charging Cable<div dir="ltr" style="text-align: left;" trbidi="on">
Salam Alikum,<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVcLxXxjPCzK2cETXB8fF7BDIpEbBcys5UYFJdBJov1MXtbR2SYzhPHuL2JcqsKNlPa3Y8KCqCZjEa-ClD7ES3pWL31pVymp4WKn4cgdMI8GA_Y5WapUelMHxp3QRV-Wk5_whdGh8O32hS/s1600/pebble.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVcLxXxjPCzK2cETXB8fF7BDIpEbBcys5UYFJdBJov1MXtbR2SYzhPHuL2JcqsKNlPa3Y8KCqCZjEa-ClD7ES3pWL31pVymp4WKn4cgdMI8GA_Y5WapUelMHxp3QRV-Wk5_whdGh8O32hS/s1600/pebble.jpg" height="200" width="200" /></a></div>
<br />
I have recently got myself a PebbleSteel smartwatch. I am really loving the watch as it looks very elegant and allows me to keep me informed with notifications about emails, calls and others without having to keep looking at my phone all the time. I preferred it to other smart-watches like Motorola 360 and Samsung gear since this one comes with an e-paper display that results in a longer battery life which can reach 7 days between charges.<br />
<br />
The watch came with a USB cable that attaches it self to the watch by a magnet while charging, Unfortunately I lost this cable few days ago and my watch went of battery charge today. Looking for some cable replacement online I have found its price to be in the range between 10$-15$ !! and it will take a few days to arrive. So, I started to look for solutions about how to make own Pebble Steel Smart-watch charging cable.<br />
<br />
<br />
Here is how I converted an old micro USB cable into a pebble watch charger, it may be useful for you in case of emergencies but<br />
<b><span style="color: red;">USE AT YOUR OWN RESPONSIBILITY, NO GUARANTEES PROVIDED.</span></b><br />
<br />
<br />
Step 1: Cut the USB cable end connector to expose the wires as shown<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjABBumqQb3BRRyXBTluyp3C4J0zXIiY1kW4UvVYxqQCXvITiHgILynkgJqpfd6KlGnp4Gue1CltODKgv_C2M6FVsoAFnBpTno1rl8dlc9ZyeG30B9yl0Cj_3x5fLIy6GdnRAbzULDNGr_G/s1600/IMG_20150107_195000.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjABBumqQb3BRRyXBTluyp3C4J0zXIiY1kW4UvVYxqQCXvITiHgILynkgJqpfd6KlGnp4Gue1CltODKgv_C2M6FVsoAFnBpTno1rl8dlc9ZyeG30B9yl0Cj_3x5fLIy6GdnRAbzULDNGr_G/s1600/IMG_20150107_195000.jpg" height="200" width="240" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTnTYbGGuAcQq7FPSClBdsxoIdEc6zvJQeAB0Dy-zq2vtrYu0tQRSk6U5beB0_UkSzfTeXO-LkX_Vcph79n7-QbWgKXE-W_hCzd03shaVsZZFs4QIU3lZYkwPDgQKVw3XasrX4216JfwCd/s1600/IMG_20150107_195502.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTnTYbGGuAcQq7FPSClBdsxoIdEc6zvJQeAB0Dy-zq2vtrYu0tQRSk6U5beB0_UkSzfTeXO-LkX_Vcph79n7-QbWgKXE-W_hCzd03shaVsZZFs4QIU3lZYkwPDgQKVw3XasrX4216JfwCd/s1600/IMG_20150107_195502.jpg" height="200" width="240" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
The USB cable has four wires (Red, Green, White, Black) as shown:</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghtyDMsuyIwPIOo23ETP347lapAGsdAh7za2HWAvUYbFE4nEMaOXNObM3UyabA7Te2eNbWZANqqnITC_5sw5cWovISAreRSwxomWZvyoylWGahmSiuUEaM6M8AV2yUAKpOBXT9Zyg2pEUj/s1600/wt6ha.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghtyDMsuyIwPIOo23ETP347lapAGsdAh7za2HWAvUYbFE4nEMaOXNObM3UyabA7Te2eNbWZANqqnITC_5sw5cWovISAreRSwxomWZvyoylWGahmSiuUEaM6M8AV2yUAKpOBXT9Zyg2pEUj/s1600/wt6ha.png" height="275" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Step 2: We need two wires to charge the pebble watch: Red wire (+5V), and Black wire (GND).</div>
<div class="separator" style="clear: both; text-align: left;">
Connect those wires to the Pebble charging connection points and use stick to fix it.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both;">
<b><i>IMPORTANT: </i></b>The polarity of the wires should be that the red wire (+5V) is to the bottom of the pebble, while the black wire (GND) is to the top (towards the backlight button).</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEikPYIG2svQxVPKga9od5Coxenw5GjOKy_NWLFcWuOaSpGj0pSe6Mo9NkNT4f0koRubDZGWJDklnLK1CUMrHMM6UhjczmzL36bgW2HigksVWlS19eHT_opg5qguspbtqq5j-e812LDru2Aw/s1600/IMG_20150107_200718.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEikPYIG2svQxVPKga9od5Coxenw5GjOKy_NWLFcWuOaSpGj0pSe6Mo9NkNT4f0koRubDZGWJDklnLK1CUMrHMM6UhjczmzL36bgW2HigksVWlS19eHT_opg5qguspbtqq5j-e812LDru2Aw/s1600/IMG_20150107_200718.jpg" height="320" width="240" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
I hope it can help you for charging your pebble in case of emergency, but be careful while doing it and use at your own responsibility.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Those links helped me in finding out the solution:</div>
<div class="separator" style="clear: both; text-align: left;">
<a href="http://www.reddit.com/r/pebble/comments/1az1yq/lost_my_charging_cable_fixed_it/">http://www.reddit.com/r/pebble/comments/1az1yq/lost_my_charging_cable_fixed_it/</a></div>
<div class="separator" style="clear: both; text-align: left;">
<a href="http://www.reddit.com/r/pebble/comments/18tzcx/ive_lost_my_charging_cable_how_soon_til_i_can/">http://www.reddit.com/r/pebble/comments/18tzcx/ive_lost_my_charging_cable_how_soon_til_i_can/</a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br />
<br /></div>
Unknownnoreply@blogger.com51tag:blogger.com,1999:blog-8573087008280197594.post-53266995138012756902014-10-18T18:12:00.002-07:002014-10-18T18:15:03.521-07:00Firmware upgrade for mbed FRDM-KL46z device<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgH2g6P0AZpv4ro_J9CYL1GfoofNz_ERH-j7PHWM3Lzv1___I8x2TlYoSmn_cihrQ0Cxpl7T5NCB7eRx-qTMY8iFssfM4BThYYg0KGyrvpwO8kFdo2W1SC1x2kXrn944jOcwCk9Uk3JKxGL/s1600/kl46_angle.JPG.250x250_q85.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgH2g6P0AZpv4ro_J9CYL1GfoofNz_ERH-j7PHWM3Lzv1___I8x2TlYoSmn_cihrQ0Cxpl7T5NCB7eRx-qTMY8iFssfM4BThYYg0KGyrvpwO8kFdo2W1SC1x2kXrn944jOcwCk9Uk3JKxGL/s1600/kl46_angle.JPG.250x250_q85.jpg" /></a></div>
<br />
mbed <a href="http://developer.mbed.org/platforms/FRDM-KL46Z/">FRDM-KL46z </a>is a low cost development platform. It is powered by a Cortext M0+ processor running at 48MHz. It comes with a number of built-in sensors : accelerometer, magnetometer, touch slider, and a light sensor. The board also contains two leds: green, and red, 4 digits LCD and Arduino-R3 compatible GPIO pins.<br />
<br />
<br />
Flashing your program on the mbed can be as simple as "drag and drop" due to having its own <a href="http://developer.mbed.org/compiler/">online compiler</a> and IDE that allows you to write your code and compile it online without requiring you to setup a compiler toolchain on your machine. The output binary file which is downloaded to your machine when compilation completes can be copied into a mass storage device (MSD) drive that appears on your computer when you plug-in your mbed kit, then the mbed status LED will blink for a short time and start executing the most recent binary program you copied into it.<br />
<br />
However, when you plug your kit for the first time you might not be able to find the mass storage drive where you should copy the binary files into. This happened for me when I tried attaching it to machines running Windows 8.1, Ubuntu 12.04 and Mac OS X 10.9.5. The reason of this problem is that the kits comes with an old firmware that needs to be upgraded (you need to do this only once) before being able to use with those new operating systems.<br />
<br />
Here the steps you should follow to do that necessary firmware upgrade:<br />
<br />
<ol style="text-align: left;">
<li>Download the latest OpenSDA firmware from <a href="http://www.pemicro.com/opensda/">here</a>.</li>
<li>Find a machine running windows 7 (The process here didn't succeed when I tried windows 8, and Mac OS).</li>
<li>Start your freedom board into the Bootloader mode by plugging it in while holding the reset switch button marked here.</li>
</ol>
<div style="margin-left: 4em;">
<i>You can notice a number of files on the "<span style="color: blue;">BOOTLOADER</span>" disk. If you open the one named "<span style="color: blue;">SDA_INFO.htm</span>" it should open a web page that contains information about the bootloader and firmware versions currently programmed on the board.
</i></div>
<ol style="text-align: left;">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCwrUpFH5ufDBWQnhxTjgXBb4cx6PZ1YOIOnwlwTmcEpm2tPdD_4BFqakYbI4EhkPpBpwlGjdewzWX0iJV9IrQFoPiAl4CNZ07J3az5QYbWxUPW296Zx78WBVHSL4D97CnvoM7XtVRzwBH/s1600/frdm_small.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCwrUpFH5ufDBWQnhxTjgXBb4cx6PZ1YOIOnwlwTmcEpm2tPdD_4BFqakYbI4EhkPpBpwlGjdewzWX0iJV9IrQFoPiAl4CNZ07J3az5QYbWxUPW296Zx78WBVHSL4D97CnvoM7XtVRzwBH/s1600/frdm_small.png" height="218" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<li>Copy the bootloader update file (named "<span style="color: blue;">BOOTUPDAETEAPP_Pemicro_vXXX.SDA</span>").</li>
<li>Unplug then replug the freedom board while holding the switch button (to enter the Bootloader mode again).</li>
<div style="margin-left: 4em;">
<i>You can verify that the bootloader is updated by opening the "<span style="color: blue;">SDA_INFO.htm</span>" file and noticing the bootloader version number.
</i></div>
<li>Copy the new firmware file you downloaded (named "<span style="color: blue;">MSD-DEBUG-FRDM-KL46Z48M_Pemicro_vxxx.SDA</span>" to the "<span style="color: blue;">BOOTLOADER</span>" disk.</li>
<li>Unplug then replug the board again without holding the reset switch. You should now find a mass storage disk drive labeled "<span style="color: blue;">FRDM-KL46Z</span>" that is where you should copy your binary files to program your board.</li>
</ol>
<br /></div>
<br />
<b><i>Thanks to <a href="http://eg.linkedin.com/pub/amr-alanwar/92/1a5/8b0">Amr Abd El-Hafez</a> for pointing this solution. The original post he made can be found <a href="http://developer.mbed.org/questions/4924/stuck-at-bootloader-mode/?c=13695">here</a>.</i></b><br />
<div>
<b><i><br /></i></b></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br />
<div style="text-align: left;">
<br /></div>
<br />
<br />
<br /></div>
Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-8573087008280197594.post-5454145881662233282014-07-19T17:27:00.001-07:002014-07-25T12:35:38.934-07:00Tips for Computer Science Junior Students<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 dir="rtl" style="margin-bottom: 0in; text-align: center;">
<span style="font-family: inherit;">Tips for Computer Science Junior Students</span></h2>
<div dir="rtl" style="text-align: center;">
نصائح لطلبة علوم الحاسب المبتدئين</div>
<div dir="rtl" style="text-align: center;">
<br /></div>
<div align="RIGHT" dir="rtl" style="margin-bottom: 0in;">
<span style="font-family: inherit;"><br /></span></div>
<div class="separator" dir="rtl" style="clear: both; text-align: center;">
<a href="http://i.huffpost.com/gen/1378599/thumbs/o-COMPUTER-SCIENCE-facebook.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://i.huffpost.com/gen/1378599/thumbs/o-COMPUTER-SCIENCE-facebook.jpg" height="200" width="400" /></a></div>
<div align="RIGHT" dir="rtl" style="margin-bottom: 0in;">
<span style="font-family: inherit;"><br /></span></div>
<div align="RIGHT" dir="rtl" style="margin-bottom: 0in;">
<span style="font-family: inherit;"><br /></span></div>
<div align="RIGHT" dir="rtl" style="margin-bottom: 0in;">
<span style="font-family: inherit;"><br /></span></div>
<div align="RIGHT" dir="rtl" style="margin-bottom: 0in;">
<span style="font-family: inherit;"><br /></span></div>
<div align="RIGHT" dir="rtl" style="margin-bottom: 0in;">
<b style="color: red;">أنا طالب في السنوات الجامعية الاولى , أدرس علوم الحاسب و أتسائل ما هي أفضل الخطوات التي ينبغي علي اتخاذها لأحصل على المؤهلات العملية و المهارية التي قد تؤهلني للالتحاق بأحدى الشركات العملاقة او استكمال دراسات ما بعد التخرج ؟</b></div>
<div align="RIGHT" dir="rtl" style="margin-bottom: 0in;">
<br /></div>
<div align="RIGHT" dir="rtl" style="margin-bottom: 0in;">
<br /></div>
<div align="RIGHT" dir="rtl" style="margin-bottom: 0in;">
سوف أحاول في هذه المقالة كتابة بعض النقاط التي قد تساعد من يبحث عن اجابة لهذا السؤال:</div>
<div align="RIGHT" dir="rtl" style="margin-bottom: 0in;">
</div>
<ul dir="rtl" style="text-align: right;">
<li style="text-align: right;">طور لغتك الانجليزية</li>
<li style="text-align: right;">اتعلم البرمجة و اتقن أحد لغاتها</li>
<li style="text-align: right;">تمرن</li>
<li style="text-align: right;">تعلم</li>
<li style="text-align: right;">ساهم</li>
</ul>
<div style="text-align: right;">
<br /></div>
<h3 dir="rtl" style="text-align: right;">
<span style="color: blue;">طور لغتك الانجليزية</span></h3>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://cdn.frontpagemag.com/wp-content/uploads/2014/07/12611613-learning-language-english-blackboard-education-concept-saying-do-you-speak-english-written-on-chalk.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://cdn.frontpagemag.com/wp-content/uploads/2014/07/12611613-learning-language-english-blackboard-education-concept-saying-do-you-speak-english-written-on-chalk.jpg" height="213" width="320" /></a></div>
<div style="text-align: center;">
<br /></div>
<div dir="rtl" style="text-align: right;">
اذا كانت لغتك الأم ليست هي اللغة الانجليزية و ما زلت تجد صعوبة في قرائة و فهم الكتب و المقالات المكتوبة باللغة الانجليزية او في سماع و فهم المحاضرات بها فانت في حاجة ماسة لرفع مستواك في مهارات التواصل المختلفة ( قراءة, كتابة, سماع , تحدث ) باللغة الانجليزية.</div>
<div dir="rtl" style="text-align: right;">
<br /></div>
<div dir="rtl" style="text-align: right;">
فبالاضافة الى انك سوف تجد نفسك مضطرا لقراءة العديد من الكتب و المقالات و مشاهدة محاضرات باللغة الانجليزية من اجل اكتساب مهارات معرفية فانك ايضا لن تستطيع اجتياز المقابلة الشخصية للحصول على الوظيفة اذا لم تكن قادر على فهم المتحدث اليك و ان تجعله ايضا قادر على فهم اجاباتك للأسئلة المطروحة كما ستشرحها له. أما اذا كنت تبحث عن الالتحاق باحد الجامعات لاستكمال الدراسة فانك سوف تكون مطالب باستيفاء الحد الأدنى من الدرجات في اختبارات تحديد اللغة الانجليزية (TOEFL / IELTS( و قد يستلزم الامر اجتياز مقابلات شخصية , باللغة الانجليزية, أيضاً.</div>
<div dir="rtl" style="text-align: right;">
<br /></div>
<div dir="rtl" style="text-align: right;">
<b>أنت لست محتاج لأن تكون قادر على تحدث الانجليزية بطلاقة و لكن يكفي أن تكون قادر على فهم ما تقرأه أو تسمعه و أن يكون لديك القدرة على شرح أفكارك للاخرين باستخدامها.</b></div>
<div dir="rtl" style="text-align: right;">
<br /></div>
<div dir="rtl" style="text-align: right;">
ماذا أفعل ؟؟</div>
<div dir="rtl" style="text-align: right;">
<br /></div>
<div dir="rtl" style="text-align: right;">
<ol style="text-align: right;">
<li>استعن بقاموس :D البدايات دائماً شاقة , لذا قد تجد نفسك مضطر ان تستعن بقاموس لفهم الكلمات الغامضة اثناء القراءة و لكن مع الوقت سوف يقل احتياجك له مع اكتسابك لمفردات لغوية جديدة دون أن تلاحظ ذلك. يمكنك ان تستعمل Google Translate لترجمة المفردات (لا أرجح استعماله لترجمة المقالة كاملة ثم قرائتها بالعربية لانك هكذا لن تكسب مفردات لغوية جديدة) او الاحتفاظ ب shortcut ل قاموس الكتروني في شريط المهام ليكون في متناول يدك.</li>
<li>استعمل ال English subtitles عند سماعك لمحاضرة الكترونية .. معظم مواقع التعليم الالكتروني ( مثلا Coursera) توفر نصا مكتوبا للمحاضرة , يمكنك استعمال النص المصاحب للمحاضرة المصورة ليسهل عليك فهمها و لمساعدتك في اكتساب مفردات جديدة.</li>
<li>اقرا كتب أو روايات باللغة الانجليزية , اسكتشف الكلمات الجديدة ثم استعن ب النسخة المقروءة من الكتاب audiobook و استمع للجزء الذي قرأته عدة مرات . هذه أحد الطرق الفعالة في تنمية المهارات اللغوية.</li>
<li>التحق بمركز تدريب جيد , اذا كنت تعرف أحد مدربي اللغة الانجليزية الذين تثق في كفائتهم.</li>
<li>استعن بكورس الكتروني: يوجد عدد من الكورسات الجيدة التي قد تساعدك في تنمية مهاراتك اللغوية منهم:
<ul>
<li> Tell Me More English </li>
<li> Effortless English </li>
</ul>
يمكنك تحميل أحدهم و الاستفادة منه.
</li>
<li>مارس التحدث اللغة الانجليزية : مع مجموعة من الاصدقاء او عن طريق احد المواقع الالكترونية. هناك عدد من المواقع الالكترونية التي تقدم تبادل تعليم اللغات بمعني ان تساعد انت أحد الناطقين باللغة الانجليزية في تعلم اللغة العربية مقابل ان يعلمك هو اللغة الانجليزية , مثل هذه المواقع قد يساعدك في تطوير مهارة التحدث. من أشهر تلك المواقع:<br />
<ul>
<li><a href="http://livemocha.com/"> http://livemocha.com/ </a></li>
<li><a href="http://www.italki.com/"> http://www.italki.com/ </a></li>
<li><a href="http://www.italki.com/">https://www.duolingo.com/ </a></li>
</ul>
</li>
</ol>
</div>
<div align="RIGHT" dir="rtl" style="margin-bottom: 0in;">
<br /></div>
<div align="RIGHT" dir="rtl" style="margin-bottom: 0in;">
<div align="RIGHT" dir="rtl" style="margin-bottom: 0in;">
<hr />
<br />
<h3>
<span style="color: blue;">
تعلم "البرمجة" و اتقن أحد لغاتها</span></h3>
</div>
<div align="RIGHT" dir="rtl" style="margin-bottom: 0in;">
<div class="separator" style="clear: both; text-align: center;">
<a href="http://qph.is.quoracdn.net/main-qimg-a2e926cf960025dd7bb5d7d4742fe2ee?convert_to_webp=true" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://qph.is.quoracdn.net/main-qimg-a2e926cf960025dd7bb5d7d4742fe2ee?convert_to_webp=true" height="271" width="320" /></a></div>
<span style="font-family: inherit;"><br />
</span><br />
لكي تتفوق في أحدى لغات البرمجة عليك أن تتقن "البرمجة نفسها أولاًً [1] . كما ترى في الشكل المرفق فان العديد ممن يعرفون لغات برمجة مختلفة لا يعرفون البرمجة (كتابة تعليمات للحاسب لجعله يقوم بأداء وظيفة أو حل مشكلة معينة) .<br />
<br />
يمكنك اعتبارتعلم لغة البرمجة كتعلم استخدام الشاكوش او المنشار مثلاُ ,, بينما تعلم البرمجة كتعلم النجارة , وحده فقط من يعرف النجارة و يعرف كيف يستخدم الأداة التي في يده سوف يكون قادراُ على تحويل قطعة الخشب الى باب او شباك.<br />
فأي لغة البرمجة هي أداة يجب عليك أولا ان تكون قادرا على معرفة ماذا تريد أن تفعل بها و كما تقول Gayle Laakmann ( أحدى مسؤلي التوظيف في شركة Google سابقاً) فانه يجب عليك ان تكون "غير منتمي لأحد اللغات" و أن افضل المبرمجين لا يوصف نفسه بأنه مبرمج بلغة كذا [<a href="http://www.quora.com/What-are-the-top-10-pieces-of-career-advice-Gayle-Laakmann-McDowell-would-give-to-future-software-engineers">2</a>].<br />
<br />
لكي تتعلم البرمجة فان عليك بالاضافة الى احتراف استخدام المكونات الاساسية ( conditions, loops, functions, recursion, etc.), دراسة الخوارزميات و تنمية مهاراتك في حل المشاكل باستخدام الحاسب كما سأتطرق لهذا لاحقاً.<br />
<br />
من المفيد جدا أن تتعلم أحد اللغات بعمق بينما تكون متطلع على كيفية كتابة اللغات الاخرى و أحدث الخواص بها.<br />
أنصحك بتعلم C++ أو Java فهم أكثر اللغات شيوعاًً.<br />
<br />
ما هي الكتب التي يمكنني البدأ بها لتعلم لغة C++ :<br />
<span style="text-align: left;"><br /></span>
<br />
<ul>
<li><span style="text-align: left;">أنصح بقراءة </span><a href="http://www.cplusplus.com/files/tutorial.pdf" style="text-align: left;">The C++ Language Tutoria</a><span style="text-align: left;">l فهي سلسة و بسيطة و تغطي تقريبا جميع اساسيات اللغة بالاضافة الى انها متاحة بشكل مجاني. </span><b style="text-align: left;"><u>أنصح بشدة أن تقرأها من البداية للنهاية مع تطبيق الأمثلة التي فيها بشكل عملي.</u></b></li>
</ul>
<br />
<div>
يمكنك أيضا قراءة هذه الكتب لدراسة اللغة بشكل أوسع و التعرض لأمثلة أكثر:</div>
<div>
<ul>
<li><a href="http://www.amazon.com/Accelerated-C-Practical-Programming-Example/dp/020170353X">Accelerated C++ : Practical Programming by Example</a></li>
<li><a href="http://www.amazon.com/Object-Oriented-Programming-C-4th-Edition/dp/0672323087">Object Oriented Programming in C++</a></li>
</ul>
<div>
<br /></div>
</div>
<div>
ثم يمكنك التركيز على تعلم مكتبة Standard Template Library (STL) و قرائة بعض الكتب المتقدمة مثل</div>
<div>
<ul>
<li>Effective C++</li>
<li>More Effective C++</li>
</ul>
</div>
<br /></div>
<hr />
<div align="RIGHT" dir="rtl" style="margin-bottom: 0in;">
<h3>
<span style="font-family: inherit;"><span lang="hi-IN" style="background-color: white; color: blue;">تعلم</span></span></h3>
<span style="font-family: inherit;"><span lang="hi-IN"><br /></span></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://www.pak101.com/funnypictures/Animals/2011/7/19/eduygwbu_mpnju.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://www.pak101.com/funnypictures/Animals/2011/7/19/eduygwbu_mpnju.jpg" height="240" width="320" /></a></div>
<div style="text-align: center;">
<span style="font-family: inherit;"><span lang="hi-IN"><br /></span></span></div>
<span style="font-family: inherit;"><span lang="hi-IN"><br /></span></span>
<span style="font-family: inherit;"><span lang="hi-IN"><br /></span></span>
<span style="font-family: inherit;"><span lang="hi-IN">من الحقائق المؤسفة أن نظامنا التعليمي في مصر يعتريه بعض النقص . اﻷمر الذي يلقي بظلاله على المستوى العلمي للخريجين فقد يكون بعض الطلبة على رغم من اجتهادهم لم يدرسوا بعض المواد الأساسية بالكم و الكيف اللازم , او لم يدرسوها على الاطلاق !</span></span><br />
<span style="font-family: inherit;"><span lang="hi-IN">و أحيانا اخرى , للاسف, يكون التقصير من جهة الطالب.</span></span><br />
<br />
<b><u>من الضروري ان تحدد الفراغات المعرفية المتواجدة لديك و أن تملأها بنفسك</u></b> .. هناك عدد من المواقع الالكترونية التى تطرح هذه المناهج مجانا ..<span style="font-family: inherit; text-align: left;">حاول
انك تحدد ما تحتاج لتتعلمه و تعلمه بنفسك أو مع اصدقائك.</span></div>
<div align="RIGHT" dir="rtl" style="margin-bottom: 0in;">
<span style="font-family: inherit;"><br />
</span><br />
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;">هذه القائمة تضم بعض المواد التي أرى أنه لا غنى لخريج علوم الحاسب عن دراستها و استيعابها جيدا : </span></div>
<div align="RIGHT" dir="rtl" style="margin-bottom: 0in;">
<br />
<ul>
<li><span style="font-family: inherit; text-align: left;"><a href="http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-042j-mathematics-for-computer-science-fall-2005/">Mathematics for ComputerScience</a></span></li>
<li><span style="font-family: inherit; text-align: left;"> ( <a href="https://www.coursera.org/course/algo">Part 1</a> , <a href="https://www.coursera.org/course/algo2">Part 2</a> ) Design and Analysis of
Algorithms</span></li>
<li><a href="https://www.coursera.org/course/ml" style="font-family: inherit; text-align: left;">Machine Learning</a></li>
<li><span style="font-family: inherit; text-align: left;"><a href="https://www.youtube.com/watch?v=XgQo4JkN4Bw&list=PL3289DD0D0F0CD4A3">Operating Systems</a></span></li>
<li><span style="font-family: inherit; text-align: left;"><a href="https://www.udacity.com/course/cs271">Artificial Intelligence</a></span></li>
</ul>
</div>
<div align="RIGHT" dir="rtl" style="margin-bottom: 0in;">
<span style="font-family: inherit;"><br />
</span></div>
<div align="RIGHT" dir="rtl" style="margin-bottom: 0in;">
<span style="font-family: inherit;">يمكنك أيضا زيارة المواقع الاتية للاطلاع على القائمة الكاملة للمواد المتاحة و الالتحاق باحدها:
</span><br />
<br />
<ul>
<li><a href="https://www.coursera.org/">Coursera</a></li>
<li><a href="https://www.udacity.com/">udacity</a></li>
<li><a href="https://www.edx.org/">EdX</a></li>
</ul>
</div>
<hr />
<div align="RIGHT" dir="rtl" style="margin-bottom: 0in;">
<h3>
<span style="color: blue; font-family: inherit; text-align: left;">تمرن</span></h3>
</div>
<div align="RIGHT" dir="rtl" style="margin-bottom: 0in;">
<div class="separator" style="clear: both; text-align: center;">
<a href="http://blog.tauedu.org/wp-content/uploads/2012/05/Brain-Exercise1.jpg?f22064" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://blog.tauedu.org/wp-content/uploads/2012/05/Brain-Exercise1.jpg?f22064" height="320" width="272" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<span style="font-family: inherit;">هناك مواقع تقدم بصفة دورية مسابقات برمجية يمكنك من خلالها تقييم و تطوير مهاراتك. يمكنك ايضا التمرن من خلال ممارسة المسابقات القديمة (المحفوظة على الموقع) و قرائة الحلول التي تم تقديمها من المتسابقين و من منظمي المسابقة.
</span><br />
<span style="font-family: inherit;"><br /></span></div>
<div align="RIGHT" dir="rtl" style="margin-bottom: 0in;">
<div style="text-align: -webkit-right;">
<span style="font-family: inherit; text-align: left;">من أشهر تلك المواقع: </span></div>
<div style="text-align: -webkit-right;">
مسابقات برمجية في حل المشاكل</div>
<div style="text-align: -webkit-right;">
</div>
<ul>
<li><span style="font-family: inherit; text-align: left;"><a href="http://www.topcoder.com/tc">TopCoder</a></span></li>
<li><span style="font-family: inherit; text-align: left;"><a href="http://codefores.com/">Codeforces</a></span></li>
<li><span style="font-family: inherit; text-align: left;"><a href="https://www.blogger.com/"><span id="goog_980520760"></span>HackerRank<span id="goog_980520761"></span></a></span></li>
</ul>
</div>
<div align="RIGHT" dir="rtl" style="margin-bottom: 0in;">
<span style="font-family: inherit;"><br />
</span></div>
<div align="RIGHT" dir="rtl" style="margin-bottom: 0in;">
<span lang="hi-IN"><span style="font-family: inherit;">مسابقات في المهارات رياضية و برمحية</span></span></div>
<div align="RIGHT" dir="rtl" style="margin-bottom: 0in;">
<br />
<ul>
<li><span style="font-family: inherit; text-align: left;"><a href="https://projecteuler.net/">Project Euler</a></span></li>
</ul>
</div>
<div align="RIGHT" dir="rtl" style="margin-bottom: 0in;">
مسابقات في تعلم الالة (machine learning( و تعرف على الانماط</div>
<div align="RIGHT" dir="rtl" style="margin-bottom: 0in;">
<br />
<ul>
<li><a href="http://www.kaggle.com/">kaggle</a></li>
</ul>
</div>
<div align="RIGHT" dir="rtl" style="margin-bottom: 0in;">
<span style="font-family: inherit;"><br />
</span><br />
ممكن تشوف قائمة بالمواقع دي هنا:<br />
<a href="http://codecondo.com/coding-challenges/">14 Coding Challenges to Help You Train Your Brain</a><br />
<div>
<br /></div>
<br />
اذا كان مستواك ليس جيدا بالدرجة التي تتمناها عند البداية فلا تبتئس و استمر في التدريب لان المواظبة هي الطريق الأمثل لتحسين مستواك.<br />
<br />
<br />
لو شفت مثلا ال rating history الخاص بكتير من ال أعضاء topcoder سوف تلاحظ ان التقييم بيزيد مع الوقت<br />
<br />
مثلاً : ده ال تقييم الخاص ب أحد الاعضاء ذوي التقييم red (أعلى تقييم)<br />
<a href="http://community.topcoder.com/tc?module=MemberProfile&cr=22658932">http://community.topcoder.com/tc?module=MemberProfile&cr=22658932</a><br />
<br />
ومن الواضح انه على الرغم من ان تقييمه كان grey (أقل تقييم) سنة 2007,,مع الممارسة مستواه استمر للصعود الى ان وصل ل red ( أعلى تقييم) خلال 3 سنوات.<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://qph.is.quoracdn.net/main-qimg-038af317077e0e86a0f92c372d150432?convert_to_webp=true" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://qph.is.quoracdn.net/main-qimg-038af317077e0e86a0f92c372d150432?convert_to_webp=true" height="271" width="400" /></a></div>
<br />
<h4>
<span style="text-align: left;">كيف أبدأ في ممارسة المسابقات البرمجية ؟</span></h4>
</div>
<div align="RIGHT" dir="rtl" style="margin-bottom: 0in;">
<div>
<ul>
<li>انضم لل ACM community في جامعتك, ان تواجدت, و شاركهم في التمرين او حاول تكون بنفسك مجموعة من اصدقائك لتتمرنوا معا.</li>
<li>المسؤلين عن تدريب ال ACM community في جامعة القاهرة اعدوا موقع يحتوي على قائمة بالمسائل ( متقسمة مستويات) و ايضا فيه فيديوهات بتشرح ازاي تشارك و ازاي تحل: <b><u>هتستفيد قوي لو حاولت تحل المسائل دي و تتفرج على الفيديوهات</u></b>: <a href="https://sites.google.com/site/acmicpcfcicu/home">https://sites.google.com/site/acmicpcfcicu/home</a></li>
<li>في كتب متخصصة عن المسابقات البرمجية, من المفيد الاطلاع عليها لمعرفة المهارات اللازمة و طرق الحل المختلفة . أشهرها:</li>
<ul>
<li><a href="http://www.amazon.com/Programming-Challenges-Contest-Training-Computer/dp/0387001638">Programming Challenges</a> (<i>أنصح البدأ بهذا الكتاب</i>)</li>
<li><a href="http://www.lulu.com/shop/steven-halim/competitive-programming-3/paperback/product-21059906.html">Competitive Programming</a></li>
</ul>
</ul>
<div>
<br />
<br /></div>
</div>
<hr />
<div>
<br />
<h3>
<span style="color: blue;">
ساهم</span></h3>
</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://www.myintervals.com/blog/wp-content/uploads/2012/01/opensource-logo1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://www.myintervals.com/blog/wp-content/uploads/2012/01/opensource-logo1.png" height="320" width="320" /></a></div>
<div>
<br /></div>
<div>
اذا أردت أن تطبق ما تعلمته في مشاريع فعلية و تحصل على خبرة و اضافة مفيدة في سيرتك الذاتية فقد تكون مهتماً بالمساهمة في احد المشاريع مفتوحة المصدر Open Source Projects</div>
<div>
<br /></div>
<div>
بالاضافة الى اكتسابك مهارات عملية في تنفيذ مشروع و التواصل مع مبرمجين اخرين اكثر خبرة فانها لها أهمية كبيرة في سيرتك الذاتية عند التقدم لاحد الوظائف. كما قد يمكنك ايضا تحقيق عائد مادي اذا تم اختيارك للمشاركة في برنامج<a href="https://www.google-melange.com/gsoc/homepage/google/gsoc2014"> Google Summer Code </a>.</div>
<div>
يمكنك البدأ عن طريق اختيار احد المشاريع التي تثير اهتمامك على <a href="https://github.com/">github</a> ثم تحديد ما سوف تقوم بتنفيذه مثلاً :حل احد المشاكل المتواجدة او اضافة ميزة جديدة .</div>
<div>
<br /></div>
<div>
للمزيد عن فائدة و كيفية المشاركة في المشاريع مفتوحة المصدر أنصحكم بقرائة المقالة التالية:</div>
<div>
<a href="http://blog.udacity.com/2013/10/get-started-with-open-source-projects.html">http://blog.udacity.com/2013/10/get-started-with-open-source-projects.html</a></div>
<div>
<a href="http://blog.udacity.com/2013/10/get-started-with-open-source-projects_8.html">http://blog.udacity.com/2013/10/get-started-with-open-source-projects_8.html</a></div>
<div>
<br /></div>
<div>
<br /></div>
<hr />
<div style="text-align: right;">
<br /></div>
<div style="text-align: right;">
أتمنى أن أكون قد وفقت في وصف ما أراه مفيدا, و اذا كانت لديكم أية أسئلة او تعليقات على المحتوى فمرحباُ بها..</div>
<div style="text-align: right;">
<br /></div>
</div>
</div>
</div>
Unknownnoreply@blogger.com25tag:blogger.com,1999:blog-8573087008280197594.post-16697321726586160542013-12-22T04:41:00.000-08:002013-12-22T10:07:20.304-08:00rJava Package Installation Problem on Linux<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="tr_bq">
<br /></div>
Attempting to install the Latent Semantic Analysis <a href="http://cran.r-project.org/web/packages/lsa/index.html">"lsa" package</a> for R on Ubuntu, the installation fails due to a problem in the <a href="http://cran.r-project.org/web/packages/rJava/index.html">rJava package</a> which is one of the dependencies for the "lsa".<br />
<br />
<blockquote>
<span style="background-color: white; font-family: Courier New, Courier, monospace;">configure: error: one or more Java configuration variables are not set.<br />Make sure R is configured with full Java support (including JDK). Run<br />R CMD javareconf<br />as a root to add java support to R</span></blockquote>
<br />
However, following the suggested solution by running R CMD javareconf as root didn't help. I noticed that output of this commands gives an empty line for JNI CPP FLAGS. The problem still exists after running those commands.<br />
<br />
Here is how I managed to solve the problem and get a successful installation of RJava and as a result the other packages that depend on it.<br />
<br />
<b>Step1 : </b>Make sure to have JDK installed which can be done by using the following command:<br />
sudo apt-get install openjdk-7-jdk<br />
<br />
<b>Step 2: </b> Define the JAVA_HOME environmental variable and add the JDK bin path to your PATH variable. You can do this by adding the following lines to the end of the .bashrc under the home directory.<br />
<br />
<div style="margin-bottom: 0in;">
export
JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64</div>
<br />
<div style="margin-bottom: 0in;">
export PATH=$PTH:$JAVA_HOME/bin</div>
<div style="margin-bottom: 0in;">
<br /></div>
<div style="margin-bottom: 0in;">
To ensure that those commands take effect immediately you can run</div>
<div style="margin-bottom: 0in;">
source ~/.bashrc</div>
<div style="margin-bottom: 0in;">
<br /></div>
<div style="margin-bottom: 0in;">
<b>Step 3:</b> First make sure that include/jni.h exist
under the JAVA_HOME directory then reconfigure the Java support for R using</div>
<div style="margin-bottom: 0in;">
<br /></div>
<div style="margin-bottom: 0in;">
sudo R CMD javareconf
JAVA_CPPFLAGS=-I$JAVA_HOME/include</div>
<div style="margin-bottom: 0in;">
<br /></div>
<div style="margin-bottom: 0in;">
<b>Step 4.</b> Reattempt installing RJava in R.</div>
<div style="margin-bottom: 0in;">
<br /></div>
<br />
<br /></div>
Unknownnoreply@blogger.com0