tag:blogger.com,1999:blog-70598065447279924182023-11-15T07:07:38.100-08:00shridutt kothari's blogIncome Schoolhttp://www.blogger.com/profile/03597457289839556604noreply@blogger.comBlogger11125tag:blogger.com,1999:blog-7059806544727992418.post-72915421339291417102016-01-08T06:13:00.001-08:002018-12-09T21:26:56.641-08:00तू ज्ञान का सागर है तेरी इक बूँद के प्यासे हम...<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div style="text-align: center;">
<span style="background-color: white; color: #444444; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13px; line-height: 12.1333px;">तू ज्ञान </span><span style="background-color: white; color: #444444; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13px; line-height: 12.1333px;">का सागर है</span></div>
<span style="background-color: white; color: #444444; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13px; line-height: 12.1333px;"></span><br />
<div style="text-align: center;">
<span style="background-color: white; color: #444444; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13px; line-height: 12.1333px;"><span style="line-height: 12.1333px;">तेरी इक बूँद के प्यासे हम</span></span></div>
<span style="background-color: white; color: #444444; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13px; line-height: 12.1333px;">
</span><span style="background-color: white; color: #444444; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13px; line-height: 12.1333px;"></span>
<br />
<div style="text-align: center;">
<span style="background-color: white; color: #444444; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13px; line-height: 12.1333px;"><span style="line-height: 12.1333px;">लौटा जो दिया तुमने</span></span></div>
<span style="background-color: white; color: #444444; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13px; line-height: 12.1333px;">
</span><span style="background-color: white; color: #444444; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13px; line-height: 12.1333px;"></span>
<div style="text-align: center;">
<span style="background-color: white; color: #444444; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13px; line-height: 12.1333px;"><span style="line-height: 12.1333px;">चले जायेंगे जहां से हम</span></span></div>
<span style="background-color: white; color: #444444; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13px; line-height: 12.1333px;">
</span><span style="background-color: white;"><div style="text-align: center;">
<span style="color: #444444; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13px; line-height: 12.1333px;">तू ज्ञान </span><span style="color: #444444; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13px; line-height: 12.1333px;">का सागर...</span></div>
</span><br />
<div style="text-align: center;">
<span style="color: #444444; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13px; line-height: 12.1333px;"><br /></span></div>
<span style="background-color: white; color: #444444; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13px; line-height: 12.1333px;"></span><br />
<div style="text-align: center;">
<span style="background-color: white; color: #444444; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13px; line-height: 12.1333px;"><span style="line-height: 12.1333px;">घायल मन का पागल पंछी उड़ने को बेक़रार</span></span></div>
<span style="background-color: white; color: #444444; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13px; line-height: 12.1333px;">
</span><span style="background-color: white; color: #444444; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13px; line-height: 12.1333px;"></span>
<br />
<div style="text-align: center;">
<span style="background-color: white; color: #444444; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13px; line-height: 12.1333px;"><span style="line-height: 12.1333px;">पंख हैं कोमल, आँख है धुँधली, जाना है सागर पार</span></span></div>
<span style="background-color: white; color: #444444; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13px; line-height: 12.1333px;">
</span><span style="background-color: white; color: #444444; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13px; line-height: 12.1333px;"></span>
<div style="text-align: center;">
<span style="background-color: white; color: #444444; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13px; line-height: 12.1333px;"><span style="line-height: 12.1333px;">अब तू ही इसे समझा, राह भूले थे कहाँ से हम</span></span></div>
<span style="background-color: white; color: #444444; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13px; line-height: 12.1333px;">
</span><span style="background-color: white;"><div style="text-align: center;">
<span style="color: #444444; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13px; line-height: 12.1333px;">तू ज्ञान </span><span style="color: #444444; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13px; line-height: 12.1333px;">का सागर...</span></div>
</span><br />
<div style="text-align: center;">
<span style="color: #444444; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13px; line-height: 12.1333px;"><br /></span></div>
<span style="background-color: white; color: #444444; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13px; line-height: 12.1333px;"></span><br />
<div style="text-align: center;">
<span style="background-color: white; color: #444444; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13px; line-height: 12.1333px;"><span style="line-height: 12.1333px;">इधर झूम के गाये ज़िंदगी, उधर है मौत खड़ी</span></span></div>
<span style="background-color: white; color: #444444; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13px; line-height: 12.1333px;">
</span><span style="background-color: white; color: #444444; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13px; line-height: 12.1333px;"></span>
<br />
<div style="text-align: center;">
<span style="background-color: white; color: #444444; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13px; line-height: 12.1333px;"><span style="line-height: 12.1333px;">कोई क्या जाने कहाँ है सीमा, उलझन आन पड़ी</span></span></div>
<span style="background-color: white; color: #444444; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13px; line-height: 12.1333px;">
</span><span style="background-color: white; color: #444444; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13px; line-height: 12.1333px;"></span>
<div style="text-align: center;">
<span style="background-color: white; color: #444444; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13px; line-height: 12.1333px;"><span style="line-height: 12.1333px;">कानों में ज़रा कह दे, कि आएँ कौन दिशा से हम</span></span></div>
<span style="background-color: white; color: #444444; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13px; line-height: 12.1333px;">
</span><span style="background-color: white;"><div style="text-align: center;">
<span style="color: #444444; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13px; line-height: 12.1333px;">तू ज्ञान </span><span style="color: #444444; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13px; line-height: 12.1333px;">का सागर...</span></div>
</span></div>
Income Schoolhttp://www.blogger.com/profile/03597457289839556604noreply@blogger.com0tag:blogger.com,1999:blog-7059806544727992418.post-37087140469600384572015-05-19T23:42:00.001-07:002018-12-09T21:26:56.433-08:00Enterprise mobility management<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="MsoNormal" style="text-align: center;">
<div style="text-align: left;">
<b><span style="font-family: "Segoe Print"; mso-bidi-font-family: "Segoe Print";">Lets talk about the buzz word EMM :-)</span></b></div>
</div>
<div class="MsoNormal">
<b style="background-color: white; color: #252525; font-family: sans-serif; font-size: 14px; line-height: 17.9200000762939px;"><br /></b></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-family: Segoe Print;"><b>Enterprise mobility management (EMM) </b>is the the concept about managing the mobile devices, wireless networks, and related services to enable broad use of mobile computing in a business context. </span></div>
<div class="MsoNormal">
<span style="font-family: Segoe Print;"><br /></span></div>
<div class="MsoNormal">
</div>
<div class="MsoNormal">
<span style="font-family: Segoe Print;">This is an emerging discipline within the enterprise that has become increasingly important over the past few years as more workers have bought smartphone and tablet computing devices and have sought support for using these devices in the workplace<b>.</b></span></div>
<div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-QdDvZDXEXT0/VVwuklF58oI/AAAAAAAAFG4/BaKUJ36VUxE/s1600/Enterprise-Mobility-Management-Framework-www.srishtis.com_.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="640" src="http://3.bp.blogspot.com/-QdDvZDXEXT0/VVwuklF58oI/AAAAAAAAFG4/BaKUJ36VUxE/s640/Enterprise-Mobility-Management-Framework-www.srishtis.com_.jpg" width="638" /></a></div>
<br /></div>
<div class="MsoNormal" style="text-align: left;">
<b><span style="font-family: Segoe Print;">The Needs of EMM: </span></b></div>
<div class="MsoNormal" style="text-align: left;">
<b><span style="font-family: Segoe Print;"><br /></span></b></div>
<div class="MsoNormal">
<b><span style="font-family: Segoe Print;">In today's business context enterprises are facing challenges with following things:</span></b><b><span style="font-family: "Segoe Print"; mso-bidi-font-family: "Segoe Print";"> </span></b></div>
<div class="MsoNormal">
<span style="font-family: "Segoe Print"; mso-bidi-font-family: "Segoe Print";">1. To manage enterprise, use of employee's personal devices i.e (BYOD): - <o:p></o:p></span></div>
<div class="MsoListParagraph" style="margin-left: .75in; mso-layout-grid-align: none; mso-list: l4 level1 lfo1; tab-stops: .25in .5in .75in 1.0in 1.25in 1.5in 1.75in 2.0in 2.25in 2.5in 2.75in 3.0in 3.25in 3.5in 3.75in 4.0in 4.25in 4.5in 4.75in 5.0in 5.25in 5.5in 5.75in 6.0in 6.25in 6.5in 6.75in 7.0in 7.25in 7.5in 7.75in 8.0in; text-autospace: none; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;">·<span style="font-family: 'Times New Roman'; font-size: 7pt; font-stretch: normal;">
</span></span><!--[endif]--><span style="font-family: "Segoe Print"; mso-bidi-font-family: "Segoe Print";">To manage use of device<o:p></o:p></span></div>
<div class="MsoListParagraph" style="margin-left: .75in; mso-layout-grid-align: none; mso-list: l4 level1 lfo1; tab-stops: .25in .5in .75in 1.0in 1.25in 1.5in 1.75in 2.0in 2.25in 2.5in 2.75in 3.0in 3.25in 3.5in 3.75in 4.0in 4.25in 4.5in 4.75in 5.0in 5.25in 5.5in 5.75in 6.0in 6.25in 6.5in 6.75in 7.0in 7.25in 7.5in 7.75in 8.0in; text-autospace: none; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;">·<span style="font-family: 'Times New Roman'; font-size: 7pt; font-stretch: normal;">
</span></span><!--[endif]--><span style="font-family: "Segoe Print"; mso-bidi-font-family: "Segoe Print";">To manage the installation of applications on those devices<o:p></o:p></span></div>
<div class="MsoListParagraph" style="margin-left: .75in; mso-layout-grid-align: none; mso-list: l4 level1 lfo1; tab-stops: .25in .5in .75in 1.0in 1.25in 1.5in 1.75in 2.0in 2.25in 2.5in 2.75in 3.0in 3.25in 3.5in 3.75in 4.0in 4.25in 4.5in 4.75in 5.0in 5.25in 5.5in 5.75in 6.0in 6.25in 6.5in 6.75in 7.0in 7.25in 7.5in 7.75in 8.0in; text-autospace: none; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;">·<span style="font-family: 'Times New Roman'; font-size: 7pt; font-stretch: normal;">
</span></span><!--[endif]--><span style="font-family: "Segoe Print"; mso-bidi-font-family: "Segoe Print";">To protect access on device <o:p></o:p></span></div>
<div class="MsoListParagraph" style="margin-left: .75in; mso-layout-grid-align: none; mso-list: l4 level1 lfo1; tab-stops: .25in .5in .75in 1.0in 1.25in 1.5in 1.75in 2.0in 2.25in 2.5in 2.75in 3.0in 3.25in 3.5in 3.75in 4.0in 4.25in 4.5in 4.75in 5.0in 5.25in 5.5in 5.75in 6.0in 6.25in 6.5in 6.75in 7.0in 7.25in 7.5in 7.75in 8.0in; text-autospace: none; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;">·<span style="font-family: 'Times New Roman'; font-size: 7pt; font-stretch: normal;">
</span></span><!--[endif]--><span style="font-family: Segoe Print;">Remotely Lock, wipe enterprise devices, manage enterprise work-space on BYOD <o:p></o:p></span></div>
<div class="MsoListParagraph" style="margin-left: .75in; mso-layout-grid-align: none; mso-list: l4 level1 lfo1; tab-stops: .25in .5in .75in 1.0in 1.25in 1.5in 1.75in 2.0in 2.25in 2.5in 2.75in 3.0in 3.25in 3.5in 3.75in 4.0in 4.25in 4.5in 4.75in 5.0in 5.25in 5.5in 5.75in 6.0in 6.25in 6.5in 6.75in 7.0in 7.25in 7.5in 7.75in 8.0in; text-autospace: none; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;">·<span style="font-family: 'Times New Roman'; font-size: 7pt; font-stretch: normal;">
</span></span><!--[endif]--><span style="font-family: "Segoe Print"; mso-bidi-font-family: "Segoe Print";">Remotely forceful installation,
uninstallation of apps on devices<o:p></o:p></span></div>
<div class="MsoListParagraph" style="margin-left: .75in; mso-layout-grid-align: none; mso-list: l4 level1 lfo1; tab-stops: .25in .5in .75in 1.0in 1.25in 1.5in 1.75in 2.0in 2.25in 2.5in 2.75in 3.0in 3.25in 3.5in 3.75in 4.0in 4.25in 4.5in 4.75in 5.0in 5.25in 5.5in 5.75in 6.0in 6.25in 6.5in 6.75in 7.0in 7.25in 7.5in 7.75in 8.0in; text-autospace: none; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;">·<span style="font-family: 'Times New Roman'; font-size: 7pt; font-stretch: normal;">
</span></span><!--[endif]--><span style="font-family: "Segoe Print"; mso-bidi-font-family: "Segoe Print";">BYOD manageability<o:p></o:p></span></div>
<div class="MsoListParagraph" style="margin-left: .75in; mso-layout-grid-align: none; mso-list: l4 level1 lfo1; tab-stops: .25in .5in .75in 1.0in 1.25in 1.5in 1.75in 2.0in 2.25in 2.5in 2.75in 3.0in 3.25in 3.5in 3.75in 4.0in 4.25in 4.5in 4.75in 5.0in 5.25in 5.5in 5.75in 6.0in 6.25in 6.5in 6.75in 7.0in 7.25in 7.5in 7.75in 8.0in; text-autospace: none; text-indent: -.25in;">
<span style="font-family: "Segoe Print"; mso-bidi-font-family: "Segoe Print";"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "Segoe Print"; mso-bidi-font-family: "Segoe Print";">2. To secure and manage Enterprise
application<o:p></o:p></span></div>
<div class="MsoListParagraph" style="margin-left: .75in; mso-layout-grid-align: none; mso-list: l6 level1 lfo2; tab-stops: .25in .5in .75in 1.0in 1.25in 1.5in 1.75in 2.0in 2.25in 2.5in 2.75in 3.0in 3.25in 3.5in 3.75in 4.0in 4.25in 4.5in 4.75in 5.0in 5.25in 5.5in 5.75in 6.0in 6.25in 6.5in 6.75in 7.0in 7.25in 7.5in 7.75in 8.0in; text-autospace: none; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;">·<span style="font-family: 'Times New Roman'; font-size: 7pt; font-stretch: normal;">
</span></span><!--[endif]--><span style="font-family: "Segoe Print"; mso-bidi-font-family: "Segoe Print";">To manage and control mobile device <b>environment and device functionality</b>
within Enterprise apps<o:p></o:p></span></div>
<div class="MsoListParagraph" style="margin-left: .75in; mso-layout-grid-align: none; mso-list: l6 level1 lfo2; tab-stops: .25in .5in .75in 1.0in 1.25in 1.5in 1.75in 2.0in 2.25in 2.5in 2.75in 3.0in 3.25in 3.5in 3.75in 4.0in 4.25in 4.5in 4.75in 5.0in 5.25in 5.5in 5.75in 6.0in 6.25in 6.5in 6.75in 7.0in 7.25in 7.5in 7.75in 8.0in; text-autospace: none; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;">·<span style="font-family: 'Times New Roman'; font-size: 7pt; font-stretch: normal;">
</span></span><!--[endif]--><span style="font-family: "Segoe Print"; mso-bidi-font-family: "Segoe Print";">To manage and control application features,
and behaviors<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "Segoe Print"; mso-bidi-font-family: "Segoe Print";">3. To ensure data security: -<o:p></o:p></span></div>
<div class="MsoListParagraph" style="margin-left: .75in; mso-layout-grid-align: none; mso-list: l1 level1 lfo3; tab-stops: .25in .5in .75in 1.0in 1.25in 1.5in 1.75in 2.0in 2.25in 2.5in 2.75in 3.0in 3.25in 3.5in 3.75in 4.0in 4.25in 4.5in 4.75in 5.0in 5.25in 5.5in 5.75in 6.0in 6.25in 6.5in 6.75in 7.0in 7.25in 7.5in 7.75in 8.0in; text-autospace: none; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;">·<span style="font-family: 'Times New Roman'; font-size: 7pt; font-stretch: normal;">
</span></span><!--[endif]--><span style="font-family: "Segoe Print"; mso-bidi-font-family: "Segoe Print";">Data on Rest – Encryption <o:p></o:p></span></div>
<div class="MsoListParagraph" style="margin-left: .75in; mso-layout-grid-align: none; mso-list: l1 level1 lfo3; tab-stops: .25in .5in .75in 1.0in 1.25in 1.5in 1.75in 2.0in 2.25in 2.5in 2.75in 3.0in 3.25in 3.5in 3.75in 4.0in 4.25in 4.5in 4.75in 5.0in 5.25in 5.5in 5.75in 6.0in 6.25in 6.5in 6.75in 7.0in 7.25in 7.5in 7.75in 8.0in; text-autospace: none; text-indent: -.25in;">
<!--[if !supportLists]--><span lang="EN" style="font-family: Symbol; mso-ansi-language: EN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;">·<span style="font-family: 'Times New Roman'; font-size: 7pt; font-stretch: normal;">
</span></span><!--[endif]--><span style="font-family: "Segoe Print"; mso-bidi-font-family: "Segoe Print";">Data on move – Always on VPN, App tunneling
</span><span lang="EN" style="font-family: "Segoe Print"; mso-ansi-language: EN; mso-bidi-font-family: "Segoe Print";"><o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<b><span style="font-family: "Segoe Print"; mso-bidi-font-family: "Segoe Print";">How </span></b><b><span style="font-family: 'Segoe Print';">EMM Needs </span></b><b><span style="font-family: "Segoe Print"; mso-bidi-font-family: "Segoe Print";">are addressed:</span></b></div>
<div class="MsoNormal">
<b><span style="font-family: "Segoe Print"; mso-bidi-font-family: "Segoe Print";"><br /></span></b>
<b><span style="font-family: "Segoe Print"; mso-bidi-font-family: "Segoe Print";">Lets see how following three key components are addressed in EMM:</span></b><br />
<b><span style="font-family: "Segoe Print"; mso-bidi-font-family: "Segoe Print";"><br /></span></b></div>
<div class="MsoListParagraph" style="mso-layout-grid-align: none; mso-list: l2 level1 lfo4; tab-stops: .25in .5in .75in 1.0in 1.25in 1.5in 1.75in 2.0in 2.25in 2.5in 2.75in 3.0in 3.25in 3.5in 3.75in 4.0in 4.25in 4.5in 4.75in 5.0in 5.25in 5.5in 5.75in 6.0in 6.25in 6.5in 6.75in 7.0in 7.25in 7.5in 7.75in 8.0in; text-autospace: none; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "Segoe Print"; mso-bidi-font-family: "Segoe Print"; mso-fareast-font-family: "Segoe Print";"> 1.<span style="font-family: 'Times New Roman'; font-size: 7pt; font-stretch: normal;"> </span></span><!--[endif]--><span style="font-family: "Segoe Print"; mso-bidi-font-family: "Segoe Print";">Device
management:</span></div>
<div class="MsoListParagraph" style="mso-layout-grid-align: none; mso-list: l2 level1 lfo4; tab-stops: .25in .5in .75in 1.0in 1.25in 1.5in 1.75in 2.0in 2.25in 2.5in 2.75in 3.0in 3.25in 3.5in 3.75in 4.0in 4.25in 4.5in 4.75in 5.0in 5.25in 5.5in 5.75in 6.0in 6.25in 6.5in 6.75in 7.0in 7.25in 7.5in 7.75in 8.0in; text-autospace: none; text-indent: -.25in;">
<span style="font-family: Symbol; text-indent: -0.25in;"> ·<span style="font-family: 'Times New Roman'; font-size: 7pt; font-stretch: normal;">
</span></span><span style="font-family: 'Segoe Print'; text-indent: -0.25in;">Devices registers on server console with
the help of Mobile device</span><br />
<span style="font-family: 'Segoe Print'; text-indent: -0.25in;"> Management (MDM) agent, approved on console</span></div>
<div class="MsoListParagraph" style="mso-layout-grid-align: none; mso-list: l2 level1 lfo4; tab-stops: .25in .5in .75in 1.0in 1.25in 1.5in 1.75in 2.0in 2.25in 2.5in 2.75in 3.0in 3.25in 3.5in 3.75in 4.0in 4.25in 4.5in 4.75in 5.0in 5.25in 5.5in 5.75in 6.0in 6.25in 6.5in 6.75in 7.0in 7.25in 7.5in 7.75in 8.0in; text-autospace: none; text-indent: -.25in;">
<span style="text-indent: -0.25in;"><span style="font-family: Segoe Print;"> </span></span><span style="font-family: Symbol; text-indent: -0.25in;">·<span style="font-family: 'Times New Roman'; font-size: 7pt; font-stretch: normal;">
</span></span><span style="font-family: 'Segoe Print'; text-indent: -0.25in;">Devices management is provided like lock,
wipe, password policies</span><br />
<span style="font-family: 'Segoe Print'; text-indent: -24px;"> </span><span style="font-family: 'Segoe Print'; text-indent: -0.25in;">enforcement etc.</span></div>
<div class="MsoListParagraph" style="mso-layout-grid-align: none; mso-list: l2 level1 lfo4; tab-stops: .25in .5in .75in 1.0in 1.25in 1.5in 1.75in 2.0in 2.25in 2.5in 2.75in 3.0in 3.25in 3.5in 3.75in 4.0in 4.25in 4.5in 4.75in 5.0in 5.25in 5.5in 5.75in 6.0in 6.25in 6.5in 6.75in 7.0in 7.25in 7.5in 7.75in 8.0in; text-autospace: none; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "Segoe Print"; mso-bidi-font-family: "Segoe Print"; mso-fareast-font-family: "Segoe Print";"> 2.<span style="font-family: 'Times New Roman'; font-size: 7pt; font-stretch: normal;"> </span></span><!--[endif]--><span style="font-family: "Segoe Print"; mso-bidi-font-family: "Segoe Print";">App
Management:</span></div>
<div class="MsoListParagraph" style="mso-layout-grid-align: none; mso-list: l2 level1 lfo4; tab-stops: .25in .5in .75in 1.0in 1.25in 1.5in 1.75in 2.0in 2.25in 2.5in 2.75in 3.0in 3.25in 3.5in 3.75in 4.0in 4.25in 4.5in 4.75in 5.0in 5.25in 5.5in 5.75in 6.0in 6.25in 6.5in 6.75in 7.0in 7.25in 7.5in 7.75in 8.0in; text-autospace: none; text-indent: -.25in;">
<span style="font-family: Symbol; text-indent: -0.25in;"> ·<span style="font-family: 'Times New Roman'; font-size: 7pt; font-stretch: normal;">
</span></span><span style="font-family: 'Segoe Print'; text-indent: -0.25in;">App wrapping</span></div>
<div class="MsoListParagraph" style="mso-layout-grid-align: none; mso-list: l2 level1 lfo4; tab-stops: .25in .5in .75in 1.0in 1.25in 1.5in 1.75in 2.0in 2.25in 2.5in 2.75in 3.0in 3.25in 3.5in 3.75in 4.0in 4.25in 4.5in 4.75in 5.0in 5.25in 5.5in 5.75in 6.0in 6.25in 6.5in 6.75in 7.0in 7.25in 7.5in 7.75in 8.0in; text-autospace: none; text-indent: -.25in;">
<span style="text-indent: -0.25in;"><span style="font-family: Segoe Print;"> </span></span><span style="font-family: Symbol; text-indent: -0.25in;">·<span style="font-family: 'Times New Roman'; font-size: 7pt; font-stretch: normal;">
</span></span><span style="font-family: 'Segoe Print'; text-indent: -0.25in;">SDK integration</span></div>
<div class="MsoListParagraph" style="mso-layout-grid-align: none; mso-list: l2 level1 lfo4; tab-stops: .25in .5in .75in 1.0in 1.25in 1.5in 1.75in 2.0in 2.25in 2.5in 2.75in 3.0in 3.25in 3.5in 3.75in 4.0in 4.25in 4.5in 4.75in 5.0in 5.25in 5.5in 5.75in 6.0in 6.25in 6.5in 6.75in 7.0in 7.25in 7.5in 7.75in 8.0in; text-autospace: none; text-indent: -.25in;">
<span style="font-family: Symbol; text-indent: -0.25in;"> ·<span style="font-family: 'Times New Roman'; font-size: 7pt; font-stretch: normal;">
</span></span><span style="font-family: 'Segoe Print'; text-indent: -0.25in;">Native OS support</span></div>
<div class="MsoListParagraph" style="mso-layout-grid-align: none; mso-list: l2 level1 lfo4; tab-stops: .25in .5in .75in 1.0in 1.25in 1.5in 1.75in 2.0in 2.25in 2.5in 2.75in 3.0in 3.25in 3.5in 3.75in 4.0in 4.25in 4.5in 4.75in 5.0in 5.25in 5.5in 5.75in 6.0in 6.25in 6.5in 6.75in 7.0in 7.25in 7.5in 7.75in 8.0in; text-autospace: none; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "Segoe Print"; mso-bidi-font-family: "Segoe Print"; mso-fareast-font-family: "Segoe Print";"> 3.<span style="font-family: 'Times New Roman'; font-size: 7pt; font-stretch: normal;"> </span></span><!--[endif]--><span style="font-family: "Segoe Print"; mso-bidi-font-family: "Segoe Print";">Data
security: </span></div>
<div class="MsoListParagraph" style="mso-layout-grid-align: none; mso-list: l2 level1 lfo4; tab-stops: .25in .5in .75in 1.0in 1.25in 1.5in 1.75in 2.0in 2.25in 2.5in 2.75in 3.0in 3.25in 3.5in 3.75in 4.0in 4.25in 4.5in 4.75in 5.0in 5.25in 5.5in 5.75in 6.0in 6.25in 6.5in 6.75in 7.0in 7.25in 7.5in 7.75in 8.0in; text-autospace: none; text-indent: -.25in;">
<span style="font-family: Symbol; text-indent: -0.25in;"> ·<span style="font-family: 'Times New Roman'; font-size: 7pt; font-stretch: normal;">
</span></span><span style="font-family: 'Segoe Print'; text-indent: -0.25in;">Encryption, App tunneling, data
containerization </span></div>
</div>
Income Schoolhttp://www.blogger.com/profile/03597457289839556604noreply@blogger.com0tag:blogger.com,1999:blog-7059806544727992418.post-90978385288017402132013-10-16T05:41:00.003-07:002018-12-09T21:26:57.053-08:00"Sabse bada rog, Kya kahenge logg"<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-XI3m1jJcky4/UotWHHYeygI/AAAAAAAAA9Y/ig8zRZ5vly4/s1600/images.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="80" src="https://4.bp.blogspot.com/-XI3m1jJcky4/UotWHHYeygI/AAAAAAAAA9Y/ig8zRZ5vly4/s1600/images.jpg" width="320" /></a></div>
<span style="background-color: white; color: #666666; font-family: "trebuchet ms" , "trebuchet" , "verdana" , sans-serif; font-size: 13.600000381469727px; line-height: 14.399999618530273px;"><br /></span>
<span style="background-color: white; color: #666666; font-family: "trebuchet ms" , "trebuchet" , "verdana" , sans-serif; font-size: 13.600000381469727px; line-height: 14.399999618530273px;">This is the very first time I am writing something "nontechnical stuff'(I must say).., So I would like to wish myself luck. ;) ;) </span><br />
<span style="background-color: white; color: #666666; font-family: "trebuchet ms" , "trebuchet" , "verdana" , sans-serif; font-size: 13.600000381469727px; line-height: 14.399999618530273px;">The above mentioned subject is quite familiar to most of the people in this world, especially in our country so I think there would be hardly anything which would be new to you, but it's just that I thought to scribble down everything at one place. </span><br />
<br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.600000381469727px; line-height: 14.399999618530273px;" />
<span style="background-color: white; color: #666666; font-family: "trebuchet ms" , "trebuchet" , "verdana" , sans-serif; font-size: 13.600000381469727px; line-height: 14.399999618530273px;">So here we go, the title “Sabse bada rog, kya kahenge log” says it all, which means the biggest fear we human beings (especially Indians) have that what he/she would think about me, what he/she would say about me, what if they make fun of me, what if it ends up being embarrassing & blah blah blah...<br />And with this we end up giving up so many precious things which we think or long to do. </span><br />
<br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.600000381469727px; line-height: 14.399999618530273px;" />
<span style="background-color: white; color: #666666; font-family: "trebuchet ms" , "trebuchet" , "verdana" , sans-serif; font-size: 13.600000381469727px; line-height: 14.399999618530273px;">Say for example, if you are standing at a red light in your car having fun with your friends & a beggar comes begging & your friends start mocking at him & suddenly there is a strike in your heart of generosity, thinking to give something to that poor guy but you decide against it just because of the fear, what your friends would think & may make fun of you, etc. etc. What I am trying to state here is just don’t let the fear of being mocked or anything let you suppress what you want to do. At times there is a sudden strong feeling which arises in our heart & we really wish to fulfil that but still suppress the same due to some or the other reason which again is not right since this small decision of suppressing our desire, no matter how small it may be, may not cost you much at that time but the same is obviously costing you in a way that you will gradually develop a habit to suppress your thoughts and eventually losing out the real human being in you who wishes to have freedom, do what he wants to do. A bitter truth is that we all say, I don’t care what he/she says or thinks about me but somewhere inside we do care, we do become conscious of the people surrounding us which may be our relatives or strangers. We live in a fear, what if I decide to do this or do that, but again everything ends up with a one liner, “I want to do this but you know I am afraid of what that uncle or aunty may think, that neighbor will say, that friend’s mom will say & the biggest & the most common one, “what if I fail” etc. etc. </span><br />
<br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.600000381469727px; line-height: 14.399999618530273px;" />
<span style="background-color: white; color: #666666; font-family: "trebuchet ms" , "trebuchet" , "verdana" , sans-serif; font-size: 13.600000381469727px; line-height: 14.399999618530273px;">Now I can bet many of us including me are always conscious of some or the other thing.., otherwise why would a thing like "facebook" be such a hit, if we din't care about what other people thought about us?Maybe it's just that we love the people around us, so we care about what they want, and try to do that to makethem happy, maybe we just wanna fit in, maybe we want to feel special, or maybe we are lonely and just want to please somebody so that we wouldn't have to be.</span><span style="color: #666666; font-family: "trebuchet ms" , "trebuchet" , "verdana" , sans-serif; font-size: x-small;"><span style="line-height: 14.399999618530273px;"><b> </b></span></span><br />
<span style="color: #666666; font-family: "trebuchet ms" , "trebuchet" , "verdana" , sans-serif; font-size: x-small;"><span style="line-height: 14.399999618530273px;"><b><br /></b></span></span>
<span style="background-color: white; color: #666666; font-family: "trebuchet ms" , "trebuchet" , "verdana" , sans-serif; font-size: 13.600000381469727px; line-height: 14.399999618530273px;">& so even strongly I can bet that, as when we look at the foreigners in our country, we always wonder about their carefree attitude, even if they would be wearing a shortest of half pants with a vest and a slipper, they would be looking cooler than us & that’s because we carry the burden of consciousness with us whereas they don’t even bother about anyone around but themselves. </span><br />
<span style="background-color: white; color: #666666; font-family: "trebuchet ms" , "trebuchet" , "verdana" , sans-serif; font-size: 13.600000381469727px; line-height: 14.399999618530273px;"><br /></span>
<span style="background-color: white; color: #666666; font-family: "trebuchet ms" , "trebuchet" , "verdana" , sans-serif; font-size: 13.600000381469727px; line-height: 14.399999618530273px;">To say the least, I would say, “Just be yourself” & lighten the burden of consciousness. </span><span style="background-color: white; color: #666666; font-family: "trebuchet ms" , "trebuchet" , "verdana" , sans-serif; font-size: 13.600000381469727px; line-height: 14.399999618530273px;">& offcource </span><span style="background-color: white; color: #666666; font-family: "trebuchet ms" , "trebuchet" , "verdana" , sans-serif; font-size: 13.600000381469727px; line-height: 14.399999618530273px;">if there are any suggestions or something which is an honest feedback or a constructive criticism we should take that.</span><br />
<br />
<span style="background-color: white; color: #666666; font-family: "trebuchet ms" , "trebuchet" , "verdana" , sans-serif; font-size: 13.600000381469727px; line-height: 14.399999618530273px;">Now most of you who might know me well may think, “better learn this yourself first & then try & teach others” & I am dead sure about this thought of yours.. but by writing this article, the urge in me to improve this aspect of mine will increase as every-time when I read this in future, it will remind me that I also need to work on this. </span><br />
<span style="background-color: white; color: #666666; font-family: "trebuchet ms" , "trebuchet" , "verdana" , sans-serif; font-size: 13.600000381469727px; line-height: 14.399999618530273px;"><br />Someone also said very beautifully:</span><br />
<span style="background-color: white; color: #666666; font-family: "trebuchet ms" , "trebuchet" , "verdana" , sans-serif; font-size: 13.600000381469727px; line-height: 14.399999618530273px;"> </span><span style="background-color: white; color: #666666; font-family: "trebuchet ms" , "trebuchet" , "verdana" , sans-serif; font-size: 13.600000381469727px; line-height: 14.399999618530273px;">Sirf dil ko saaf rakhte hain hum....</span><br />
<span style="background-color: white; color: #666666; font-family: "trebuchet ms" , "trebuchet" , "verdana" , sans-serif; font-size: 13.600000381469727px; line-height: 14.399999618530273px;"> Gairo se hume certificate nahi chahiye...</span><br />
<span style="background-color: white; color: #666666; font-family: "trebuchet ms" , "trebuchet" , "verdana" , sans-serif; font-size: 13.600000381469727px; line-height: 14.399999618530273px;"> Kyoki laakh bhala karo... phir bhi...<br /> Kuch to log kahenge... logo ka kaam hai kahna...</span><br />
<span style="background-color: white; color: #666666; font-family: "trebuchet ms" , "trebuchet" , "verdana" , sans-serif; font-size: 13.600000381469727px; line-height: 14.399999618530273px;"> Chodo bekaar ki baaton ko... kahin ...beet na jaye raina!!!</span><br />
<br />
<span style="background-color: white; color: #666666; font-family: "trebuchet ms" , "trebuchet" , "verdana" , sans-serif; font-size: 13.600000381469727px; line-height: 14.399999618530273px;">I think its enough for the first time & would like to close it off here. Finally would like to say to everyone reading & to myself too that shed those beliefs & do what your inner voice is screaming at you to do </span><span style="background-color: white; color: #666666; font-family: "trebuchet ms" , "trebuchet" , "verdana" , sans-serif; font-size: 13.600000381469727px; line-height: 14.399999618530273px;">&</span><span style="background-color: white; color: #666666; font-family: "trebuchet ms" , "trebuchet" , "verdana" , sans-serif; font-size: 13.600000381469727px; line-height: 14.399999618530273px;"> feel the trueness of life. </span><br />
<span style="background-color: white; color: #666666; font-family: "trebuchet ms" , "trebuchet" , "verdana" , sans-serif; font-size: 13.600000381469727px; line-height: 14.399999618530273px;">And last but in no way the least, thank you for your time & patience. </span><br />
<br />
<span style="background-color: white; color: #666666; font-family: "trebuchet ms" , "trebuchet" , "verdana" , sans-serif; font-size: 13.600000381469727px; line-height: 14.399999618530273px;">CHEERS!!!!! </span><br />
<span style="background-color: white; color: #666666; font-family: "trebuchet ms" , "trebuchet" , "verdana" , sans-serif; font-size: 13.600000381469727px; line-height: 14.399999618530273px;">~Shridutt </span><br />
<span style="background-color: white; color: #666666; font-family: "trebuchet ms" , "trebuchet" , "verdana" , sans-serif; font-size: 13.600000381469727px; line-height: 14.399999618530273px;"><br /></span>
<span style="background-color: white; color: #666666; font-family: "trebuchet ms" , "trebuchet" , "verdana" , sans-serif; font-size: 13.600000381469727px; line-height: 14.399999618530273px;"><br /></span></div>
Income Schoolhttp://www.blogger.com/profile/03597457289839556604noreply@blogger.com1tag:blogger.com,1999:blog-7059806544727992418.post-86169388437103677512013-09-17T02:21:00.001-07:002018-12-09T21:26:56.888-08:00Android Build FAQ<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="background-color: cyan; color: red;">= FAQ =</span><br />
<h3 style="text-align: left;">
<span style="background-color: #eeeeee; color: #b45f06;"><b>In general, the key thing to note is that android build system is non-recursive. </b></span><span style="background-color: #eeeeee; color: #b45f06;"><b>For more on recursive vs non-recursive, please see:</b></span></h3>
<div>
GNU Make Recursion -> "<a href="http://www.gnu.org/s/hello/manual/make/Recursion.html%22">http://www.gnu.org/s/hello/manual/make/Recursion.html"</a><br />
Why recursion is harmful -> "<a href="http://miller.emu.id.au/pmiller/books/rmch/?ref=DDiyet.Com">http://miller.emu.id.au/pmiller/books/rmch/?ref=DDiyet.Com</a>"</div>
<div>
<h3 style="text-align: left;">
All the commands mentioned here are from top of the tree and assume, you've already setup your environment with:<br /> $ source build/envsetup.sh<br /> $ choosecombo</h3>
<div>
<br /></div>
<div>
<br />
<span style="background-color: #cfe2f3;">== What java version is my build using? ==</span><br />
<br />
In Gingerbread, your JAVA_HOME is set to '''/usr/lib/jvm/java-6-sun''' by build/envsetup.sh. You may see errors if you do not have JAVA 1.6 installed.<br />
$ echo $JAVA_HOME # should return empty<br />
$ source build/envsetup.sh # will set your JAVA_HOME if it's empty, will honor the existing value otherwise<br />
$ which java<br />
$ java -version<br />
$ javac -version<br />
<br />
<span style="background-color: #cfe2f3;">== Related Build Error: method does not override a method from its superclass. @Override ==</span><br />
<br />
This "error" is due to a difference in the meaning of @Override between Java 1.5 and Java 1.6: Java 1.6 added the ability to use @Override to indicate that a method implements an interface method<br />
[which this code does].<br />
You should be able to compile this code without error if you use a Java 1.6 compiler (the 'java -version' command only shows the JRE version. Use 'javac -version' to get the compiler version and adjust your path accordingly).<br />
<br />
<span style="background-color: #cfe2f3;">== What are the various build variants and their usage ==</span><br />
<br />
Android build system supports the following build variants<br />
*user<br />
*userdebug<br />
*eng<br />
*tests<br />
<br />
You can build these variants as follows<br />
$ cd WORKSPACE<br />
$ source build/envsetup.sh<br />
$ choosecombo 1 1 <product-name> user<br />
$ choosecombo 1 1 <product-name> userdebug<br />
$ choosecombo 1 1 <product-name> eng<br />
Alternatively, you can run<br />
$ make PRODUCT-<product-name>-user<br />
$ make PRODUCT-<product-name>-eng<br />
$ make PRODUCT-<product-name>-tests<br />
Note that '''choosecombo''' doesn't support tests variant.<br />
<br />
<span style="background-color: #cfe2f3;">== Where is the build log? ==</span><br />
<br />
You can save one for yourself with<br />
$ make 2>&1 | tee log<br />
<br />
<span style="background-color: #cfe2f3;">== How do I clean the build? ==</span><br />
<br />
You can use '''dataclean''' to clean the staging area for your data partition<br />
$ make dataclean # will rm -rf $(PRODUCT_OUT)/data/*, data-qemu/*, userdata-qemu.img<br />
<br />
You can use '''installclean''' while switching between build variants<br />
$ choosecombo 1 1 <product-name> user<br />
$ make installclean # deletes all of the files that change between<br />
different build types<br />
$ choosecombo 1 1 <product-name> eng<br />
Clean and clobber, both will remove the entire build dir<br />
$ make clean # Remove all builds for current and past targets, does<br />
rm -rf<br />
$(OUT_DIR)<br />
$ make clobber # Remove all builds for current and past targets<br />
<br />
<span style="background-color: #cfe2f3;">== What is a module? ==</span><br />
<br />
In android build system, an Android.mk file defines how you build. An<br />
android module is the entity you are building and is specified by<br />
variable LOCAL_MODULE in the Android.mk<br />
A single Android.mk can build multiple modules.<br />
<br />
<span style="background-color: #cfe2f3;">== How do I rebuild my module? ==</span><br />
<br />
If you have a 'LOCAL_MODULE := foobar' in your Android.mk, you should be able to do<br />
$ make foobar<br />
<br />
<span style="background-color: #cfe2f3;">== What are m, mm, mmm? ==</span><br />
<br />
These are build utilities provided by build/envsetup.sh. Here's a<br />
description of all the available utilities<br />
- croot: Changes directory to the top of the tree.<br />
- m: Makes from the top of the tree.<br />
- mm: Builds all of the modules in the current directory.<br />
- mmm: Builds all of the modules in the supplied directories.<br />
- cgrep: Greps on all local C/C++ files.<br />
- jgrep: Greps on all local Java files.<br />
- mgrep: Greps on all makefiles<br />
- resgrep: Greps on all local res/*.xml files.<br />
- godir: Go to the directory containing a file<br />
- printconfig: tells you what configuration you are currently building<br />
Note that 'm' and 'mm' need a toplevel Android.mk in the directory you use them on.<br />
Example usage<br />
$ cd dalvik/tests<br />
$ mm<br />
$ mmm ../tools<br />
$ godir Atomic.h<br />
$ m<br />
$ croot<br />
<br />
<span style="background-color: #cfe2f3;">== How do I turn off prelinking for my module? ==</span><br />
<br />
Add<br />
LOCAL_PRELINK_MODULE := false<br />
For the module in your Android.mk LOCAL_PRELINK_MODULE is set to false<br />
by default for executables (built using BUILD_EXECUTABLE)<br />
<br />
<span style="background-color: #cfe2f3;">== How do I see what commands make is running? ==</span><br />
<br />
You can use the '''showcommands''' modifier target.<br />
What is does (build/core/config.mk)<br />
# The 'showcommands' goal says to show the full command<br />
# lines being executed, instead of a short message about<br />
# the kind of operation being done.<br />
SHOW_COMMANDS:= $(filter showcommands,$(MAKECMDGOALS))<br />
Usage<br />
$ make showcommands<br />
$ cd $some_dir_with_an_Android.mk<br />
$ mm showcommands<br />
<br />
<span style="background-color: #cfe2f3;">== How do I find out what are the available modules? ==</span><br />
<br />
$ cd $some_dir_with_an_Android.mk<br />
$ mm modules<br />
You can also run 'make' to see the list of all the modules available<br />
in your tree<br />
$ croot<br />
$ make modules<br />
<br />
<span style="background-color: #cfe2f3;">== How do I clean a single module/package? ==</span><br />
<br />
$ croot<br />
$ make clean-$(LOCAL_MODULE)<br />
<br />
<span style="background-color: #cfe2f3;">== How do I rebuild system image for an existing build? ==</span><br />
<br />
$ make snod<br />
<br />
<span style="background-color: #cfe2f3;">=== What is snod? ===</span><br />
<br />
'snod' is a pseduo-target provided by build/core/Makefile. You can use<br />
it to rebuild your system image without following it's dependencies<br />
and rebuilding everything else, apart from what you provide to make.<br />
Example use cases<br />
$ make framework snod # rebuilds framework module, and system image<br />
<br />
<span style="background-color: #cfe2f3;">== How do I build multiple variants and targets? ==</span><br />
<br />
Note: this script is broken in gingerbread.<br />
$ source build/tools/check_builds.sh<br />
$ golden_builds <product1>-eng <product2>-user <product3>-eng<br />
Additionally you can run<br />
$ check_builds <product1>-eng <product2>-user <product2>-eng<br />
What this will do for you, according to check_build.sh comments:<br />
# Go get dinner, and when you get back, there will be a file<br />
# test-builds/sizes.html that has a pretty chart of which files are<br />
# in which tree, and how big they are.<br />
<br />
<span style="background-color: #cfe2f3;">== How do I find what build properties are available for my build and </span><span style="background-color: #cfe2f3;">how they were derived? ==</span><br />
<br />
Post a full build, build properties can be examined in<br />
out/target/product/$(TARGET_PRODUCT)/build.prop<br />
This file is created/updated by build/core/Makefile (invoked by build/core/main.mk). The file is a concatentation of build/tools/buildinfo.sh output + your system.prop + $ADDITIONAL_BUILD_PROPERTIES<br />
<br />
<span style="background-color: #cfe2f3;">== App development ==</span><br />
<br />
$ cd your_app_folder<br />
$ mmm<br />
$ adb sync<br />
If you don't use the same machine for compilation and loading it is<br />
possible to forward the port used by adb (5037) to the PC connected to the device.<br />
If it's a linux machine, it is a lot easier, but it is possible to<br />
forward ports from windows.<br />
Fastboot still has to be run on the connected machine, but since it<br />
only needs a few image files it is easier to coordinate.<br />
<br />
<span style="background-color: #cfe2f3;">== How do I build my binary/library/applicaton? ==</span><br />
<br />
In general, refer to the build cookbook "http://source.android.com/<br />
porting/build_cookbook.html" You can also look at existing Android.mk<br />
files in your source tree. If you are tagging your module with<br />
"optional".<br />
In summary, 'user' tags cannot be used, they are used only for legacy<br />
modules (Grandfathered).<br />
'optional' tags makes sure that the module gets installed into user<br />
and eng builds as long as you add that module name to the list of<br />
packages (PRODUCT_PACKAGES).<br />
PRODUCT_PACKAGES for proprietary modules is defined in the device-<br />
vendor.mk<br />
file, e.g. vendor/<vendor-name>/prop/common/config/device-vendor.mk<br />
Opensource modules are defined in device/<vendor-name>/common/<br />
common.mk<br />
The 'eng' tag implies that the module will be picked up only by 'eng'<br />
variant of the build.<br />
The tests tag implies that the module will be picked up by tests variant of the<br />
build. The tests variant is not available from choosecombo.<br />
Do not use development (or any other tags not sanctioned by the android build system)<br />
<br />
<span style="background-color: #cfe2f3;">== My binary/library isn't available on target, whats wrong? ==</span><br />
<br />
Check if you've updated the appropriate .mk configuration file to include<br />
a PRODUCT_PACKAGES entry for the module.<br />
Check the build log to see if your module got built. You can also use<br />
'mm' with 'showcommands' to see if the module is being built & installed.<br />
<br />
<span style="background-color: #cfe2f3;">== I don't want to build everything, takes too long. What do I do? ==</span><br />
<br />
You can build "tiny android," an Android build with a limited<br />
userspace that<br />
is useful for kernel development and verification. The tiny android<br />
build will<br />
not boot into the full UI. It will stay at one of the loading screens<br />
(ANDROID_ - not the boot animation). ADB will be active, allowing you to run unit tests, etc. The build time for tiny android is significantly less than a full Android build. Tiny Android builds complete in less than 2 minutes,<br />
whereas a full Android build takes over 20 minutes.<br />
$ BUILD_TINY_ANDROID=true make -j4<br />
<br />
<span style="background-color: #cfe2f3;">=== How do I use a prebuilt kernel? ===</span><br />
<br />
The kernel objects, vmlinux and zImage will be at <platform>/out/<br />
target/product/<TARGET>/obj/KERNEL_OBJ and its subdirectories, where<br />
<TARGET> is the target device you selected in choosecombo above. You<br />
can override the TARGET_PREBUILT_KERNEL flag with your own kernel<br />
image to build android with your kernel, as follows:<br />
$ make -j4 TARGET_PREBUILT_KERNEL="<your_kernel_tree>/arch/arm/boot/zImage"<br />
<br />
<span style="background-color: #cfe2f3;">=== error: do_inode_allocate_extents: Failed to allocate blocks ===</span><br />
<span style="background-color: #cfe2f3;"><br /></span>
One way to workaround this is to increase the system image size.<br />
Please see<br />
BOARD_*_PARTITION_SIZE variables in device/<vendor>/$(TARGET_PRODUCT)/<br />
BoardConfig.mk in your workspace.<br />
<br />
<br />
<span style="background-color: #6aa84f;">== Misc ==</span><br />
<br />
<span style="background-color: #cfe2f3;">=== If you want to see all warnings in a pretty format, do ===</span><br />
<br />
$ build/tool/warn.py my_build_log > warn.html<br />
See the html page for a nice classification for all the warnings on your product.<br />
<br />
<span style="background-color: #cfe2f3;">=== What is the 'simulator' in lunch for? ===</span><br />
<br />
"the simulator is somewhat maintained, but it's a very specialized and very fragile tool which is only used by a handful of people at Google. It is likely to require the very precise environment that those people" use, which is specific to Google and isn't publicly available."<br />
See this thread for more detail<br />
"<a href="http://groups.google.com/group/android-building/browse_thread/thread/55521a7849bbac1a/e4e020a8213cf7c7?lnk=gst&q=generic+product#e4e020a8213cf7c7">http://groups.google.com/group/android-building/browse_thread/thread/55521a7849bbac1a/e4e020a8213cf7c7?lnk=gst&q=generic+product#e4e020a8213cf7c7</a>"<br />
<br />
<span style="background-color: #cfe2f3;">=== How do I rebuild the sdk? ===</span><br />
<br />
$ make PRODUCT-sdk-sdk<br />
<br />
<span style="background-color: #cfe2f3;">== What is the difference between board, target, product and device?==</span><br />
<br />
Android build system supports hierarchical layering of product,<br />
device, board, and arch in a one to many relationship as described at<br />
"<a href="http://androidxref.com/1.6/xref/development/pdk/" target="_blank"><span style="background-color: white; font-family: monospace;">/</span><span style="color: #202062; font-family: monospace;"><span style="background-color: white;">development</span></span><span style="background-color: white; font-family: monospace;">/</span><span style="color: #202062; font-family: monospace;"><span style="background-color: white;">pdk</span></span><span style="background-color: white; font-family: monospace;">/</span></a>"<br />
<br />
<span style="background-color: #cfe2f3;">=== TARGET ===</span><br />
<br />
In Android Build System, 'target' or 'TARGET' refers to your build<br />
target. There are a bunch of variables associated with a target.<br />
From a Build perspective, these are<br />
<br />
TARGET_PRODUCT: identifies the product that you are building<br />
TARGET_BUILD_TYPE: identifies the build type from one of<br />
'release,<br />
debug'<br />
TARGET_BUILD_VARIANT: identifies the build variant from one of<br />
'user,<br />
userdebug,<br />
eng,<br />
tests'<br />
From a PRODUCT perspective, these are<br />
TARGET_PRODUCT: identifies the product, for example, full_crespo,passion_us, passion_eu<br />
TARGET_DEVICE: identifies the device, for example, full_crespo,passion<br />
TARGET_BOARD_PLATFORM: can be used for a family of boards, for example, qsd8k, msm7k<br />
TARGET_BOOTLOADER_BOARD_NAME: used by OEMs for their boards, and by chipset_variants. for example, mahimahi of htc, full_crespo<br />
TARGET_ARCH: arm/x86<br />
TARGET_ARCH_VARIANT: armv5/armv7<br />
<br />
<span style="background-color: #cfe2f3;">=== BOARD ===</span><br />
<br />
In Android Build System, BOARD refers to the schematics of a product<br />
<br />
<span style="background-color: #cfe2f3;">=== DEVICE ===</span><br />
<br />
For OEMs, DEVICE refers to the physical layer of plastic on the device<br />
Each of these devices may result<br />
into multiple products. Examples<br />
* crespo # Samsung<br />
* passion # HTC<br />
<br />
<span style="background-color: #cfe2f3;">=== PRODUCT ===</span><br />
<br />
The product layer represents a complete specification of a shipping<br />
product<br />
"<a href="http://androidxref.com/1.6/xref/development/pdk/docs/guide/build_system.jd" target="_blank"><span style="background-color: white; font-family: monospace;">/</span><span style="color: #202062; font-family: monospace;"><span style="background-color: white;">development</span></span><span style="background-color: white; font-family: monospace;">/</span><span style="color: #202062; font-family: monospace;"><span style="background-color: white;">pdk</span></span><span style="background-color: white; font-family: monospace;">/</span><span style="color: #202062; font-family: monospace;"><span style="background-color: white;">docs</span></span><span style="background-color: white; font-family: monospace;">/</span><span style="color: #202062; font-family: monospace;"><span style="background-color: white;">guide</span></span><span style="background-color: white; font-family: monospace;">/</span><span style="color: #202062; font-family: monospace;"><span style="background-color: white;">build_system.jd</span></span></a>"<br />
<br />
<span style="background-color: #cfe2f3;">== How do I add a new target? ==</span><br />
<br />
Adding a new target means adding a new product. You can name your product as chipset_variant. Note that if one product may suffice for all your chipset variants.<br />
<br />
<span style="background-color: #cfe2f3;">== How do I add a new product? ==</span><br />
<br />
Android products use inheritance, you can generate a nice product graph using<br />
$ sudo apt-get install graphviz<br />
$ make product-graph # pdf goes in out/product.pdf<br />
<br />
<span style="background-color: #cfe2f3;">== PRODUCT CONFIGURATION ==</span><br />
<br />
In general, android build system builds products, and allows you to configure what goes into a product. It doesn't explicitly support configuration at a build level, in allowing you to choose what to<br />
build. A typical android build is supposed to build all possible code<br />
that is available see build/core/main.mk.<br />
You can choose what goes into a product, by adding to the<br />
PRODUCT_PACKAGES list which is used to specify what additional<br />
packages go into a product, as follows.<br />
<br />
<span style="background-color: #cfe2f3;">=== How do I generate a product graph ===</span><br />
$ sudo apt-get install graphviz<br />
$ make product-graph # pdf goes in out/product.pdf<br />
<br />
<span style="background-color: #cfe2f3;">=== What is device-vendor.mk, when do I modify it? ===</span><br />
<br />
device-vendor.mk allows you to configure proprietary modules to be installed on the target images.<br />
Starting with Gingerbread the Android build system enforces an explicit<br />
LOCAL_MODULES_TAGS for all modules which aren't in the GRANDFATHERED MODULES<br />
and recommends using "optional" tag for modules which are expected to be in all builds of a product.<br />
When LOCAL_MODULE_TAGS of a module is defined with an "optional" tag,<br />
the module will not be available in the generated final image/s (which will be flashed on Target).<br />
To get the module available in final image/s, module has to be part of PRODUCT_PACKAGES list.<br />
<br />
<span style="background-color: #cfe2f3;">=== What is device/<vendor>/common/common.mk, when do I modify it? ===</span><br />
<br />
The opensource counter part of device-vendor.mk [prev question] is<br />
device/<vendor>/common/common.mk and should be used for adding<br />
opensource modules to PRODUCT_PACKAGES.<br />
<br />
<span style="background-color: #cfe2f3;">=== How do I configure (enable/disable) a module? ===</span><br />
<br />
Configuration has two aspects with respect to Android Build System<br />
* What gets installed<br />
* What gets built<br />
What gets installed can be configured at a product level using the<br />
device-vendor.mk and common.mk configuration files, described above<br />
[prev questions].<br />
Controlling what get's built, is a more complicated story. Presently,<br />
for a typical build android build system builds all modules it can<br />
find using findleaves.py [See modules_to_install and modules_to_check in build/core/main.mk].<br />
The two ways to enable/disable a module then are<br />
* Add/Remove Android.mk<br />
* Wrap the Android.mk in TARGET_PRODUCT if you don't want to build your<br />
* modules for products like generic, emulator etc.<br />
If you want your module to not be built for variants not supported by<br />
your LOCAL_MODULE_TAGS, you can define LOCAL_DONT_CHECK_MODULE, though<br />
it is not recommended by android build system as of now. Example,<br />
$(CLEAR_VARS)<br />
LOCAL_DONT_CHECK_MODULE := true<br />
LOCAL_MODULE := foo<br />
LOCAL_MODULE_TAGS := eng<br />
What this will do for you is<br />
* For all non-eng builds, your module will only be built if it's a dependency<br />
* of another module<br />
* Else, it will be ignored<br />
<br />
<br />
<span style="background-color: #93c47d;">== Emulator ==</span><br />
<br />
<span style="background-color: #cfe2f3;">=== What is the emulator? ===</span><br />
<br />
From the AOSP WIKI documentation: "The Android SDK includes a mobile<br />
device emulator -- a virtual mobile device that runs on your computer.<br />
The emulator lets you develop and test Android applications without using a physical device."<br />
<br />
<span style="background-color: #cfe2f3;">=== How is it used? ===</span><br />
<br />
The emulator is provided by<br />
external/qemu<br />
sdk/emulator<br />
prebuilt/linux-x86/emulator<br />
The one in external/qemu produces an executable called "emulator"<br />
which can be used from the commandline. It get's built and installed<br />
in out/host/linux-x86/bin/emulator and can be used with the images<br />
generated by building the 'generic' products provided in the AOSP tree.<br />
The AOSP tree provides "non-hardware-specific targets" which can be used "to build entire user-level system and work with emulator".<br />
There are two such target products available<br />
target/product/generic<br />
target/product/generic_x86<br />
They use the following boards from target/board, respectively<br />
target/board/generic<br />
target/board/generic_x86<br />
(There's also an 'emulator' board available under target/board for<br />
which there's no emulator.mk under target/product, device/ or vendor/ which is where envsetup.sh looks for product makefiles, and so it doesn't show up in choosecombo)<br />
target/board/*/README.txt explains the existence and usage of all three, generic, generic_x86, emulator.<br />
Emulator usage example<br />
"<a href="http://groups.google.com/group/android-platform/browse_thread/thread/b115c4cadbfdb333/488ca1b48bc546d8?lnk=gst&q=generic+product#488ca1b48bc546d8">http://groups.google.com/group/android-platform/browse_thread/thread/b115c4cadbfdb333/488ca1b48bc546d8?lnk=gst&q=generic+product#488ca1b48bc546d8</a>"<br />
<br />
<span style="background-color: #cfe2f3;">== How do I rebuild the emulator? ==</span><br />
<br />
"<a href="http://groups.google.com/group/android-building/browse_thread/thread/f8f0c3bacd6efae/05ec2449d4e5dc6f?lnk=gst&q=emulator#05ec2449d4e5dc6f">http://groups.google.com/group/android-building/browse_thread/thread/f8f0c3bacd6efae/05ec2449d4e5dc6f?lnk=gst&q=emulator#05ec2449d4e5dc6f</a>"</div>
</div>
</div>
Income Schoolhttp://www.blogger.com/profile/03597457289839556604noreply@blogger.com0tag:blogger.com,1999:blog-7059806544727992418.post-86494226823854554842013-09-11T23:24:00.001-07:002018-12-09T21:26:56.970-08:00FOTA procedure in Android<a href="http://blogs.impetus.com/mobility/android/FOTA+mechanism+in+android+.do#.UjFeHQY_GJg.blogger">FOTA procedure in Android</a>Income Schoolhttp://www.blogger.com/profile/03597457289839556604noreply@blogger.com0tag:blogger.com,1999:blog-7059806544727992418.post-71770060973842377592013-08-22T08:29:00.001-07:002018-12-09T21:23:52.459-08:00FOTA in Android (Mechanism, Implementation & Behind the scene) -Firmware updation in Android over the air<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="border-bottom: solid #E48312 1.0pt; border: none; mso-border-bottom-alt: solid #E48312 .5pt; mso-border-bottom-themecolor: accent1; mso-border-bottom-themecolor: accent1; mso-element: para-border-div; padding: 0in 0in 1.0pt 0in;">
<br />
<h1>
What is FOTA?<o:p></o:p></h1>
</div>
<div class="MsoNormal">
Firmware Over-the-Air (FOTA) is a method used for update software on mobile phones and tablet computers etc.<o:p></o:p><br />
<br /></div>
<div style="border-bottom: solid #E48312 1.0pt; border: none; mso-border-bottom-alt: solid #E48312 .5pt; mso-border-bottom-themecolor: accent1; mso-border-bottom-themecolor: accent1; mso-element: para-border-div; padding: 0in 0in 1.0pt 0in;">
<h1>
FOTA in Android?<o:p></o:p></h1>
</div>
<div class="MsoNormal">
In android, FOTA can update current firmware, kernel, boot/system/recovery
images, single/multiple application etc.<o:p></o:p></div>
<div class="MsoNormal">
Major components involved in Android FOTA mechanism are:</div>
<div class="MsoListParagraphCxSpFirst" style="mso-list: l1 level1 lfo2; text-indent: -.25in;">
<ul style="text-align: left;">
<li><span style="font-family: "symbol"; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="font-family: "times new roman"; font-size: 7pt;"> </span></span>FOTA Server with push notification support</li>
<li><span style="font-family: "symbol"; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="font-family: "times new roman"; font-size: 7pt;"> </span></span>OTA Updater application in Android device</li>
<li><span style="font-family: "symbol"; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="font-family: "times new roman"; font-size: 7pt;"> </span></span>Recovery console in Android device</li>
</ul>
<div>
<br /></div>
<!--[if !supportLists]--><o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l1 level1 lfo2; text-indent: -.25in;">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpLast" style="mso-list: l1 level1 lfo2; text-indent: -.25in;">
<o:p></o:p></div>
<div style="border-bottom: solid #E48312 1.0pt; border: none; mso-border-bottom-alt: solid #E48312 .5pt; mso-border-bottom-themecolor: accent1; mso-border-bottom-themecolor: accent1; mso-element: para-border-div; padding: 0in 0in 1.0pt 0in;">
<h1>
FOTA procedure in Android?<o:p></o:p></h1>
</div>
<div class="MsoNormal">
In Android smartphones/tablets FOTA is performed in
following way:<o:p></o:p></div>
<div class="MsoListParagraphCxSpFirst" style="mso-list: l0 level1 lfo1; text-indent: -.25in;">
<br />
<ul style="text-align: left;">
<li><span style="font-family: "symbol"; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="font-family: "times new roman"; font-size: 7pt;"> </span></span>Device register to server for push notification
of firmware/software updates.</li>
<li><span style="font-family: "symbol"; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="font-family: "times new roman"; font-size: 7pt;"> </span></span>Server sends the update notification to the
device.</li>
<li><span style="font-family: "symbol"; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="font-family: "times new roman"; font-size: 7pt;"> </span></span>Device perform polling requests to server for
new update.</li>
<li><span style="font-family: "symbol"; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="font-family: "times new roman"; font-size: 7pt;"> </span></span>User performs manual update check.</li>
<li><span style="font-family: "symbol"; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="font-family: "times new roman"; font-size: 7pt;"> </span></span>If update is available, get the update file URL
from server.</li>
<li><span style="font-family: "symbol"; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="font-family: "times new roman"; font-size: 7pt;"> </span></span>Fetch update file and save in cache partition.</li>
<li><span style="font-family: "symbol"; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="font-family: "times new roman"; font-size: 7pt;"> </span></span>Verify the update file signature and checksum.</li>
<li><span style="font-family: "symbol"; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="font-family: "times new roman"; font-size: 7pt;"> </span></span>Reboot in recovery mode with update installation
command.</li>
<li><span style="font-family: "symbol"; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="font-family: "times new roman"; font-size: 7pt;"> </span></span>Recovery console verifies the signature of
update file.</li>
<li><span style="font-family: "symbol"; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="font-family: "times new roman"; font-size: 7pt;"> </span></span>Recovery console executed the updater script
from update file.</li>
<li><span style="font-family: "symbol"; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="font-family: "times new roman"; font-size: 7pt;"> </span></span>Device Reboots after installation.</li>
</ul>
<!--[if !supportLists]--><o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo1; text-indent: -.25in;">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo1; text-indent: -.25in;">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo1; text-indent: -.25in;">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo1; text-indent: -.25in;">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo1; text-indent: -.25in;">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo1; text-indent: -.25in;">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo1; text-indent: -.25in;">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo1; text-indent: -.25in;">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpLast" style="mso-list: l0 level1 lfo1; text-indent: -.25in;">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpLast" style="mso-list: l0 level1 lfo1; text-indent: -.25in;">
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://4.bp.blogspot.com/-8FsvIMh4liM/UhTxbGuYjgI/AAAAAAAAAtI/AtxF0SMokjk/s1600/FOTA_Android.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="640" src="https://4.bp.blogspot.com/-8FsvIMh4liM/UhTxbGuYjgI/AAAAAAAAAtI/AtxF0SMokjk/s1600/FOTA_Android.png" width="454" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><br /></td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div style="border-bottom: solid #E48312 1.0pt; border: none; mso-border-bottom-alt: solid #E48312 .5pt; mso-border-bottom-themecolor: accent1; mso-border-bottom-themecolor: accent1; mso-element: para-border-div; padding: 0in 0in 1.0pt 0in;">
<h1>
How to implement FOTA in Android <span style="font-size: 11.0pt;">(excluding
push notification)</span><o:p></o:p></h1>
</div>
<div class="MsoListParagraphCxSpFirst" style="margin-left: .25in; mso-add-space: auto; mso-list: l1 level1 lfo1; text-indent: -.25in;">
<br /></div>
<div class="MsoListParagraphCxSpFirst" style="margin-left: .25in; mso-add-space: auto; mso-list: l1 level1 lfo1; text-indent: -.25in;">
1. Create the Cryptographic signature for the OTA
signing (required for releasing, not needed for demo)<o:p></o:p></div>
<div class="MsoListParagraphCxSpFirst" style="margin-left: .25in; mso-add-space: auto; mso-list: l1 level1 lfo1; text-indent: -.25in;">
<br /></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: .25in; mso-add-space: auto;">
There are four keys that can be used during development for
authentication purposes:<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.0in; mso-add-space: auto; mso-list: l0 level1 lfo2; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "wingdings"; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings;">Ø<span style="font-family: "times new roman"; font-size: 7pt;">
</span></span><!--[endif]--><span style="color: blue; font-family: "courier new"; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-US;">testkey</span>
— a generic key for packages that do not otherwise specify a key.<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.0in; mso-add-space: auto; mso-list: l0 level1 lfo2; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "wingdings"; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings;">Ø<span style="font-family: "times new roman"; font-size: 7pt;">
</span></span><!--[endif]--><span style="color: blue; font-family: "courier new"; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-US;">platform</span>
— a key for packages that are part of the core platform.<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.0in; mso-add-space: auto; mso-list: l0 level1 lfo2; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "wingdings"; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings;">Ø<span style="font-family: "times new roman"; font-size: 7pt;">
</span></span><!--[endif]--><span style="color: blue; font-family: "courier new"; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-US;">shared</span>
— a key for things that are shared in the home/contacts process.<o:p></o:p></div>
<div class="MsoListParagraphCxSpLast" style="margin-left: 1.0in; mso-add-space: auto; mso-list: l0 level1 lfo2; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "wingdings"; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings;">Ø<span style="font-family: "times new roman"; font-size: 7pt;">
</span></span><!--[endif]--><span style="color: blue; font-family: "courier new"; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-US;">media</span>
— a key for packages that are part of the media/download system.<o:p></o:p></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .25in; margin-right: 0in; margin-top: 0in;">
The default AOSP keys are found in the
build/target/product/security directory.<o:p></o:p></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; text-indent: .25in;">
<span style="background-color: white; font-family: "lucida sans unicode" , sans-serif; font-size: 9pt; line-height: 110%;">(*.pk8 are the private keys, *.x509.pem are the
corresponding certificate/public keys)</span><o:p></o:p></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; text-indent: .25in;">
We can generate our keys with the shell script located at /<a href="http://code.metager.de/source/xref/android/4.2/development/"><span style="color: windowtext; text-decoration: none; text-underline: none;">development</span></a>/<a href="http://code.metager.de/source/xref/android/4.2/development/tools/"><span style="color: windowtext; text-decoration: none; text-underline: none;">tools</span></a>/<a href="http://code.metager.de/source/xref/android/4.2/development/tools/make_key"><span style="color: windowtext; text-decoration: none; text-underline: none;">make_key</span></a><o:p></o:p></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; text-indent: .25in;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="MsoNormal" style="text-indent: .25in;">
<b>Procedure to create Keys is as follows:<o:p></o:p></b></div>
<div class="MsoListParagraphCxSpLast" style="mso-list: l0 level1 lfo1; text-indent: -.25in;">
<div class="MsoListParagraph" style="margin-left: .75in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;">
<div style="text-align: left;">
</div>
<ul style="text-align: left;">
<li style="text-align: left;"><span style="text-indent: -0.25in;">First remove the existing AOSP keys </span><span style="text-indent: -0.25in;">:</span></li>
<li style="text-align: left;">
<script src="https://gist.github.com/shriduttkothari/6306060.js"></script>
</li>
<li><span style="font-family: "trebuchet ms" , sans-serif; font-size: 10pt; line-height: 110%;">Create New keys :</span></li>
<li style="text-align: left;">
<script src="https://gist.github.com/shriduttkothari/6306164.js"></script>
</li>
<li><span style="font-family: "trebuchet ms" , sans-serif; font-size: 10pt; line-height: 110%;">Verify the created keys :</span></li>
<li style="text-align: left;">
<script src="https://gist.github.com/shriduttkothari/6306211.js"></script>
</li>
<li><span style="font-family: "trebuchet ms" , sans-serif;"><span style="line-height: 14.399999618530273px;">Re-sign the OTA file content after creation :</span></span></li>
<li style="text-align: left;">
<script src="https://gist.github.com/shriduttkothari/6306234.js"></script>
</li>
<li><span style="font-family: "trebuchet ms" , sans-serif; line-height: 14.399999618530273px;">Re-sign the OTA file manually with SignApk.jar :</span></li>
<li style="text-align: left;">
<script src="https://gist.github.com/shriduttkothari/6306259.js"></script>
</li>
</ul>
<span style="font-family: "trebuchet ms" , sans-serif;"><span style="line-height: 14.399999618530273px;"><br /></span></span>
<br />
<ul style="text-align: left;">
</ul>
</div>
<div class="MsoListParagraph" style="margin-left: .75in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;">
<o:p></o:p></div>
</div>
<div class="MsoListParagraphCxSpLast" style="mso-list: l0 level1 lfo1; text-indent: -.25in;">
<div style="text-align: left;">
2. If the new update package can have older “build date time” than only we should comment the following line from following file : <br />
(otherwise skip this step):<br />
/build/tools/releasetools/ota_from_target_files<br />
<div>
<b> "script.AssertOlderBuild(ts);"</b><br />
<br />
<li style="text-align: left;">
<script src="https://gist.github.com/shriduttkothari/6307393.js"></script>
</li>
</div>
As the mentioned line creates the assert in the updater script for older build and aborts the installation if the update file is having older “build date time”.<br />
<br />
<span style="font-family: "trebuchet ms" , sans-serif; font-size: 10pt; line-height: 110%;"> 3. Create an FOTA update file with the command</span></div>
</div>
<script src="https://gist.github.com/shriduttkothari/6306303.js"></script>
<div class="MsoListParagraphCxSpLast" style="mso-list: l0 level1 lfo1; text-indent: -.25in;">
It will generate the full Android OS OTA update file in the out/target/product/product_name/someotafile.zip<br />
<br />
4. If we need to create any partial/incremental update then we can do with following command:<br />
<div style="text-align: center;">
</div>
<br />
<li style="text-align: left;">
<script src="https://gist.github.com/shriduttkothari/6306375.js"></script>
</li>
It will only include the specified packages in OTA update file, its build logic is in build/core/Makefile.</div>
<div class="MsoListParagraphCxSpLast" style="mso-list: l0 level1 lfo1; text-indent: -.25in;">
<br />
5. Now upload the zip on OTA server and whenever the update check for your device comes at server<br />
After verifying device, rom values from the request provide the Rom info in the form of Jason String.<br />
<div>
<br /></div>
6. Create an Android application with following permissions:<br />
<div style="text-align: left;">
<br />
<li style="text-align: left;">
<script src="https://gist.github.com/shriduttkothari/6306529.js"></script>
</li>
</div>
So that application can do following tasks:<o:p></o:p><br />
<ul style="text-align: left;">
<li>Perform polling request to server using internet on each time device boots/ manual update check by user.</li>
<li>Update can be downloaded to /cache partition.</li>
<li>For installation in recovery mode device can rebooted by the application.</li>
</ul>
<br />
7. Create a Activity with intent filter "android.settings.SYSTEM_UPDATE_SETTINGS"<br />
This intent is fired from /packages/apps/Settings/res/xml/device_info_settings.xml<br />
<br />
<li style="text-align: left;">
<script src="https://gist.github.com/shriduttkothari/6306785.js"></script></li>
So that when user navigates to System settings -> About device-> System Updates, our activity can be launched.</div>
<div class="MsoListParagraphCxSpLast" style="mso-list: l0 level1 lfo1; text-indent: -.25in;">
<br /></div>
<div class="MsoListParagraphCxSpLast" style="mso-list: l0 level1 lfo1; text-indent: -.25in;">
8. Create an AsyncTask, which can be called whenever polling is required to be performed to check the update on server, the doInBackground() method will have pseudo code as follows: </div>
<br />
<li style="text-align: left;">
<script src="https://gist.github.com/shriduttkothari/6306808.js"></script>
</li>
<br />
<div class="MsoListParagraphCxSpLast" style="mso-list: l0 level1 lfo1; text-indent: -.25in;">
</div>
<div class="MsoListParagraphCxSpLast" style="mso-list: l0 level1 lfo1; text-indent: -.25in;">
9. Create a broadcast receiver with intent filter "android.intent.action.BOOT_COMPLETED"<br />
<br />
<li style="text-align: left;">
<script src="https://gist.github.com/shriduttkothari/6306844.js"></script>
</li>
</div>
<div class="MsoListParagraphCxSpLast" style="mso-list: l0 level1 lfo1; text-indent: -.25in;">
<div class="MsoListParagraphCxSpLast" style="mso-list: l0 level1 lfo1; text-indent: -.25in;">
So that when device boots up we can start our UpdateCheckReceiver class, which can Schedule a repeating alarm to send the pending intent to this same broadcastReceiver class to instantiate a new AsyncTask, to perform polling on server, to check the update.</div>
</div>
<div class="MsoListParagraphCxSpLast" style="mso-list: l0 level1 lfo1; text-indent: -.25in;">
<br />
10. On a valid RomInfo Object received, Start the Downloader AsyncTask to download the update zip file from server, the doInBackground() method will have pseudo code as follows:<br />
<br />
<li style="text-align: left;">
<script src="https://gist.github.com/shriduttkothari/6307073.js"></script>
</li>
<br />
11. On successful download of the update zip file from server we must verify the cryptographic signature of the downloaded update file, and then we can install it as follows:<br />
<br />
<li style="text-align: left;">
<script src="https://gist.github.com/shriduttkothari/6307289.js"></script>
</li>
It will reboot the device in recovery mode, where recovery console will first verify the signature of the file then execute the updater script of that update zip file, which will install the updates i.e. (FOTA).<br />
If any problem occurs it will show an android error symbol and wait for user reboot, otherwise It will reboot in to updated android after successful installation.<br />
<br />
<br />
<div style="border-bottom: solid #E48312 1.0pt; border: none; mso-border-bottom-alt: solid #E48312 .5pt; mso-border-bottom-themecolor: accent1; mso-border-bottom-themecolor: accent1; mso-element: para-border-div; padding: 0in 0in 1.0pt 0in;">
<h1>
<span style="background-color: white;">Behind the scene </span><o:p></o:p></h1>
</div>
<div class="MsoListParagraphCxSpFirst" style="margin-left: .25in; mso-add-space: auto;">
<br /></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: .25in; mso-add-space: auto; mso-list: l1 level1 lfo1; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "symbol"; font-size: 14.0pt; line-height: 110%;">·<span style="font-family: "times new roman"; font-size: 7pt; line-height: normal;">
</span></span><!--[endif]--><span style="font-size: 14.0pt; line-height: 110%;">Releasetools
(which creates OTA update file)<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 27.0pt; mso-add-space: auto; text-indent: -9.0pt;">
– It Create digitally signed software updates from a
target-files-package (TFP)<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 22.5pt; mso-add-space: auto; mso-list: l4 level1 lfo2; text-indent: -4.5pt;">
<!--[if !supportLists]-->-<span style="font-size: 7pt;"> </span><!--[endif]--> TFP generated by Android* build system<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 27.0pt; mso-add-space: auto; mso-list: l5 level1 lfo3; text-indent: -9.0pt;">
<!--[if !supportLists]-->–<span style="font-size: 7pt;">
</span><!--[endif]-->We need to substitute testing for production
keys inside a TFP<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 27.0pt; mso-add-space: auto;">
<br /></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: .25in; mso-add-space: auto; mso-list: l1 level1 lfo1; tab-stops: 22.5pt; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "symbol"; font-size: 14.0pt; line-height: 110%;">·<span style="font-family: "times new roman"; font-size: 7pt; line-height: normal;">
</span></span><!--[endif]--><span style="font-size: 14.0pt; line-height: 110%;">SW
Update UI intent from AOSP Settings application<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 22.5pt; mso-add-space: auto; mso-list: l4 level1 lfo2; text-indent: -4.5pt;">
<!--[if !supportLists]-->-<span style="font-size: 7pt;"> </span><!--[endif]--><span style="font-family: "courier new"; mso-bidi-font-weight: bold; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-US;"> </span>android.settings.SYSTEM_UPDATE_SETTINGS<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 22.5pt; mso-add-space: auto; mso-list: l4 level1 lfo2; text-indent: -4.5pt;">
<!--[if !supportLists]-->-<span style="font-size: 7pt;"> </span><!--[endif]--> Intent
launched when user navigates to Settings->About device->System updates<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 27.0pt; mso-add-space: auto;">
<br /></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: .25in; mso-add-space: auto; mso-list: l1 level1 lfo1; tab-stops: 22.5pt; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "symbol"; font-size: 14.0pt; line-height: 110%;">·<span style="font-family: "times new roman"; font-size: 7pt; line-height: normal;">
</span></span><!--[endif]--><span style="font-size: 14.0pt; line-height: 110%;">android.os.RecoverySystem
APIs</span><o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 31.5pt; mso-add-space: auto; text-indent: -13.5pt;">
– Framework APIs to verify & install SW updates<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 27.0pt; mso-add-space: auto; mso-list: l5 level1 lfo3; text-indent: -9.0pt;">
<!--[if !supportLists]-->–<span style="font-size: 7pt;">
</span><!--[endif]-->Handles verification of OTA update digital
signature<o:p></o:p></div>
<div class="MsoListParagraphCxSpLast" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 27.0pt; margin-right: 0in; margin-top: 0in; mso-add-space: auto; mso-list: l4 level1 lfo2; text-indent: -9.0pt;">
<!--[if !supportLists]-->-<span style="font-size: 7pt;">
</span><!--[endif]-->Also used to engage Factory Data Reset<o:p></o:p></div>
<div class="Default" style="margin-left: 27.0pt; mso-list: l4 level1 lfo2; text-indent: -9.0pt;">
<!--[if !supportLists]--><span style="font-family: "trebuchet ms" , "sans-serif"; font-size: 10.0pt;">-<span style="font-family: "times new roman"; font-size: 7pt;">
</span></span><!--[endif]--><span style="font-family: "trebuchet ms" , "sans-serif"; font-size: 10.0pt;">RecoverySystem doesn’t
write to BCB due to permissions on doing raw block device I/O <o:p></o:p></span></div>
<div class="MsoListParagraphCxSpFirst" style="margin-left: 31.5pt; mso-add-space: auto; text-indent: -13.5pt;">
– Writes RC command files into /cache/recovery/command,
and reboots into Recovery Console<o:p></o:p><br />
– Typical RC commands which may be supplied in the /cache/recovery/command file:</div>
<pre style="background-color: white; margin-left: 0.25in; text-align: justify;"><span style="color: green; font-size: x-small;"> --send_intent=anystring - write the text out to recovery.intent
--update_package=path - verify install an OTA package file
--wipe_data - erase user data (and cache), then reboot
--wipe_cache - wipe cache (but not user data), then reboot
--set_encrypted_filesystem=on|off - enables / diasables encrypted fs
--just_exit - do nothing; exit</span></pre>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 31.5pt; mso-add-space: auto; text-indent: -13.5pt;">
<v:shapetype coordsize="21600,21600" id="_x0000_t202" o:spt="202" path="m,l,21600r21600,l21600,xe">
<v:stroke joinstyle="miter">
<v:path gradientshapeok="t" o:connecttype="rect">
</v:path></v:stroke></v:shapetype><v:shape id="Text_x0020_Box_x0020_2" o:gfxdata="UEsDBBQABgAIAAAAIQC75UiUBQEAAB4CAAATAAAAW0NvbnRlbnRfVHlwZXNdLnhtbKSRvU7DMBSF
dyTewfKKEqcMCKEmHfgZgaE8wMW+SSwc27JvS/v23KTJgkoXFsu+P+c7Ol5vDoMTe0zZBl/LVVlJ
gV4HY31Xy4/tS3EvRSbwBlzwWMsjZrlprq/W22PELHjb51r2RPFBqax7HCCXIaLnThvSAMTP1KkI
+gs6VLdVdad08ISeCho1ZLN+whZ2jsTzgcsnJwldluLxNDiyagkxOquB2Knae/OLUsyEkjenmdzb
mG/YhlRnCWPnb8C898bRJGtQvEOiVxjYhtLOxs8AySiT4JuDystlVV4WPeM6tK3VaILeDZxIOSsu
ti/jidNGNZ3/J08yC1dNv9v8AAAA//8DAFBLAwQUAAYACAAAACEArTA/8cEAAAAyAQAACwAAAF9y
ZWxzLy5yZWxzhI/NCsIwEITvgu8Q9m7TehCRpr2I4FX0AdZk2wbbJGTj39ubi6AgeJtl2G9m6vYx
jeJGka13CqqiBEFOe2Ndr+B03C3WIDihMzh6RwqexNA281l9oBFTfuLBBhaZ4ljBkFLYSMl6oAm5
8IFcdjofJ0z5jL0MqC/Yk1yW5UrGTwY0X0yxNwri3lQgjs+Qk/+zfddZTVuvrxO59CNCmoj3vCwj
MfaUFOjRhrPHaN4Wv0VV5OYgm1p+LW1eAAAA//8DAFBLAwQUAAYACAAAACEAdUbBnkADAAA8BwAA
HwAAAGNsaXBib2FyZC9kcmF3aW5ncy9kcmF3aW5nMS54bWysVdtuGzcQfS/QfxjwKQUqr6RKsa1m
HbhuHATIxYicZ2G0y9Wy4ZJbkroF/fgecteyoroN0HYBQbzMHJ45Mxy+eLlrNG2k88qaXIzOhoKk
KWypzCoXn+5vBxeCfGBTsrZG5mIvvXh59f13L3i2ctzWqiAgGD/jXNQhtLMs80UtG/ZntpUGe5V1
DQdM3SorHW+B3OhsPBw+zxpWRlw9Qv3KgWnt1L+A0rb4LMsbNhv2gNTF7Hil56iL/47MM7N57dp5
e+ci8+L95s6RKnMB5Qw3kEhk/UZvhml24rV6BNhVron2tqpohwyMJs8vRsDa5+L8AiqNpx2e3AUq
YDC9/GlyHg0KWIyG0/Hosrco6g/fwCjqV99AAdGOEAZHJH0bKZrNX6MePUR9Hwn+Ync0PsQfrSns
sAimKc++fYs8eTL2pmazktfO2W0tufTRohMKinbHJNEeTvQRa7l9Z0sozOtgE97/Jd4hbJ61zofX
0jYUB7lwsgjpKN689aFj+GASNfFWq/JWaZ0mbrW80Y42rHNxm74+qK/MtKFtLi6nSO0/QwzT9xRE
o4J0pFWTi4uDEc+ilK9MmQowsNLdGNFpk4owqhiPDLt5ymhMTrmPK0v8Q2FnETOKCx0Bg9q6L4K2
uOe58L+v2UlB+o1Bsi5HkwnMQppMpudjTNzxzvJ4h00BqFwEQd3wJmA2TNEbe41sVqrXtuMRGWkf
5mGvZQomsU3UHVhq1E4upBl8mqM7fUn3oEP7Smd/nI7hMAr1lJayqpDkQ3ZxQJLoajDw0pQLZYI0
IWez98GhedEAikB+CjV+sertOlCwhFKx0G1/1nkQ0WCwbksOctFy8ZlXMm851PCHlar2pAw6q9bQ
hD7cX1NvRJXSMjlvVSsX8Ge4SMde0toj62nlGVoyFYxW+8OPkYnB8Utrw6Nj2oxkgdJZ0rMlmBoY
HXCecPYyLPAEuH0bZLmIZDwil01uzR+xSYGL4SVWKaNSse/GBw+qfOLw29oDZ6cCHEobT60h3s8U
l2I/DKkgu5RGvU/zGtf+LjN0AoA03bHjjyel0d/WdNBjpSP2efsRGe+2u6sAQrHHZSfvRnLt37n4
OB3Pr/4EAAD//wMAUEsDBBQABgAIAAAAIQDaMKnNtAYAAKIZAAAaAAAAY2xpcGJvYXJkL3RoZW1l
L3RoZW1lMS54bWzsWV9vE0cQf6/U73C69xLH/7AjHJQ4TkLBEMWGisf13dq3ZO/2tLtO8FsFD31q
K1SKqkr9p1ZCoqKq1Ie2QvTLpEQF2u/Q2d278228KQhRaCViKd6b++3M7MzszO74zNnrMfX2MReE
JR1/+VTF93ASsJAkk45/ebj5Tsv3hERJiChLcMefYeGfXX37rTNoJaAkHTHEw2GEY+wBo0SsoI4f
SZmuLC2JAMhInGIpTuDdmPEYSXjkk6WQowMQENOlaqXSXIoRSfxV4CgVox6Ff4kUihBQPlBssJeg
GKRf4iiZYI0N95YVQvDJqEu5t49ox6/oP39p9cwSWskAVBrcTBQwkB2yA9+jSEggdvxN/ZfNyyaE
e9UF/s3a6UqjWvDXACoXcd3uxkZvreCnASgIYFWLOvfqrdpyzrMEMsNF3usbjVa1m/EugcywtqBz
q9lo1isWXoMMvr6Ab6+3ao3TFl6DDL6xgO9W17stm78GGXxzAd+ur1VaLYu/BkWUJHsL6Gq73erV
MnQBGTO67YS3uuqTwecoiIYikpSIMUukFVebKMDSV69idI3xTXivHiiSJPHkLMVjAHT8IcejKcSj
9PoD30tRwgRQK9XKeqVZqcF3/qkrFdAKRqXJhhSIBZLSxhMBJ6ns+O8CV78EObz5zeGN7w5v3ju8
cc9wsODbsB/K8Kd3b/35xfvek5++fnr7UzdelPFHd349uv/to7uf//7wEzdcluGPfvvhjwdfwYzH
D249/v62Y8YaR6PyjCGKWIwcwG084mXgGieIOnDDCJEyrst4SJB3ER84wD0ZWeCLM0RdwtexbbYr
HFKCC7g1vWZpOYj4VBKH5PNRbAE30DTZwUnkgipRJRcPp8nELZtPy7hdhPZdorsosXzam6aQMomL
ZTfClpY7FCUSTXACIa3esT2MHRpfJcQya58EnAk2lt5V4q0j4rTIkIys2JlP2iYxuGXmUhC8bdmm
f8VbZ9S16g28byNhJ7gDCFPLjFtoKlHsYjlEMS0b/AKSkUvJwYwHZVxPSF2XKPN6IRbCNecSh/WW
nH4eQQJzur1PZ7GN5JLsuXheQIyVkRtsrxuhOHVhBwRisST/nNhjjCJvh0kXvM/sDaKewQ8oOdHd
Vwhk0JKAEzf+ZTKxNJnHhXoz5Y7428LMCtvBjI4RThQSUruVsmOS/J/z9/bVJz//8vTLz/66/bDv
MASke2urP/rwo6M7Hxzd+fHx/Y/dcMsn/2L63iLCuVeOp+9znIjLO7pEmzpcVL43uRvOEm9yt3W8
Gb7J3XAmfOW5+6Sz2MtP3fNsDYlcud4cy/UhPT7pjD4mlA7kjOILQh/TBVSmcBOIapq+duLirpdG
MMwKhYWbcKTneJzJ94iMBhFKYQMu61vARGSsJ8JLmYAzviY7eSuhcE2Q5grabMAd1KRiOo37LDTk
5WV1Nc310Fda0EuXr4m+6eaCWi2FO3EhtrD2PzIFixbrgMOGBwekjt+oqzlwyxcBojhUKzNVNLeH
kpCPX7Jt2k0lWd+MLNsYjYwahYkdtjn9bNtAEQqxMXlbrXRRWkEG8ywKe1Gbqeg9FpU0KccoTbwD
iK7qaWX7AKUdnychjOIUfCDUYQvRCXRgAsmN918kplMu5AYSkTGADvfMuzRRfs2UaFcar12JqgrE
12UJ8JbtHTwe40CW/VWiKMuZR0gKJkqdb/V0C6we2FRiPojCA29Ep3wXgbtrLcgGvhcSAck9M0RI
oA9VbE47J2X5wNHpUgIQTSNkPF7Lk4+KbQPX26jQQT8Vayk9HdP92GOWDAs286U0KrAn86UU63od
S1G7Ge6xtVDZJIBuIUee2g8dn3EZMUhpaUSCTQ41Rm8wMDE0AOE1qA+tTf3N8f48IRoeihuFe4nc
JROPE8igMuIY78C5WrtM6p6FsvdcukhroZbdR+B7aGt0/FT1GkmgJY/wPqZDlQ5AdDQXqKYtugRY
l6It88RoospdOV6t2lbkNRMWr7oGFmUJTFeugZU8I2tzqbauuwaaFK0s71yIflHK8+6q0oLWcl7b
CjbavKrgggb/sdqoiuBitXruc4M+Xzzj4PAcxTG3pdNDZaOl0BuBDqiE+A0ID6hpyqsaOGS7kEs9
CHqVjSDEYY9lI8gLmZ7eqBiajKpYGbdk5zL9cDzOQYNxfizUANcvBn2UeqPJcseHTj5Ivw4j+C3A
B1pV0aqKBiNo8EPRNV35jp8Ncgq8N5QCU8sptRxTzyn1nNLIKY2c0swpTdjqqmUNP4+oL9/Lu9Md
Px9lpdr+WWX1bwAAAP//AwBQSwMEFAAGAAgAAAAhAJxmRkG7AAAAJAEAACoAAABjbGlwYm9hcmQv
ZHJhd2luZ3MvX3JlbHMvZHJhd2luZzEueG1sLnJlbHOEj80KwjAQhO+C7xD2btJ6EJEmvYjQq9QH
CMk2LTY/JFHs2xvoRUHwsjCz7DezTfuyM3liTJN3HGpaAUGnvJ6c4XDrL7sjkJSl03L2DjksmKAV
201zxVnmcpTGKSRSKC5xGHMOJ8aSGtHKRH1AVzaDj1bmIqNhQaq7NMj2VXVg8ZMB4otJOs0hdroG
0i+hJP9n+2GYFJ69elh0+UcEy6UXFqCMBjMHSldnnTUtXYGJhn39Jt4AAAD//wMAUEsBAi0AFAAG
AAgAAAAhALvlSJQFAQAAHgIAABMAAAAAAAAAAAAAAAAAAAAAAFtDb250ZW50X1R5cGVzXS54bWxQ
SwECLQAUAAYACAAAACEArTA/8cEAAAAyAQAACwAAAAAAAAAAAAAAAAA2AQAAX3JlbHMvLnJlbHNQ
SwECLQAUAAYACAAAACEAdUbBnkADAAA8BwAAHwAAAAAAAAAAAAAAAAAgAgAAY2xpcGJvYXJkL2Ry
YXdpbmdzL2RyYXdpbmcxLnhtbFBLAQItABQABgAIAAAAIQDaMKnNtAYAAKIZAAAaAAAAAAAAAAAA
AAAAAJ0FAABjbGlwYm9hcmQvdGhlbWUvdGhlbWUxLnhtbFBLAQItABQABgAIAAAAIQCcZkZBuwAA
ACQBAAAqAAAAAAAAAAAAAAAAAIkMAABjbGlwYm9hcmQvZHJhd2luZ3MvX3JlbHMvZHJhd2luZzEu
eG1sLnJlbHNQSwUGAAAAAAUABQBnAQAAjA0AAAAA
" o:spid="_x0000_s1026" style="height: 82.85pt; left: 0px; margin-left: 18.3pt; margin-top: 18.7pt; position: absolute; text-indent: 0px; visibility: visible; width: 467.3pt; z-index: 251677696;" type="#_x0000_t202"><br /></v:shape><o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: .25in; mso-add-space: auto; tab-stops: 22.5pt;">
</div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: .25in; mso-add-space: auto; mso-list: l1 level1 lfo1; tab-stops: 22.5pt; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "symbol"; font-size: 14.0pt; line-height: 110%;">·<span style="font-family: "times new roman"; font-size: 7pt; line-height: normal;">
</span></span><!--[endif]--><span style="font-size: 14.0pt; line-height: 110%;">/misc
partition<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 27.0pt; mso-add-space: auto; mso-list: l5 level1 lfo3; text-indent: -9.0pt;">
<!--[if !supportLists]-->–<span style="font-size: 7pt;">
</span><!--[endif]-->Very small size, does not contain a filesystem<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 27.0pt; mso-add-space: auto; mso-list: l5 level1 lfo3; text-indent: -9.0pt;">
<!--[if !supportLists]-->–<span style="font-size: 7pt;">
</span><!--[endif]-->Tiny partition used for communication between Recovery
Console (RC) and bootloader, and for RC to save state information<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 27.0pt; mso-add-space: auto; mso-list: l5 level1 lfo3; text-indent: -9.0pt;">
<!--[if !supportLists]-->–<span style="font-size: 7pt;">
</span><!--[endif]-->Contains Bootloader Control Block (BCB)<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.0in; mso-add-space: auto; mso-list: l8 level1 lfo6; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "wingdings"; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings;">Ø<span style="font-family: "times new roman"; font-size: 7pt;">
</span></span><!--[endif]-->command[32]: Commands for the bootloader<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="text-indent: 34.8pt;">
•
“boot-recovery” boot into RC instead of Android<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 70.8pt; mso-add-space: auto;">
• Other platform-specific commands may be implemented for update tasks
that must be done by the bootloader<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="text-indent: 34.8pt;">
• If empty,
garbage, or no known commands matched, normal Android boot<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="text-indent: 34.8pt;">
<br /></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.0in; mso-add-space: auto; mso-list: l8 level1 lfo6; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "wingdings"; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings;">Ø<span style="font-family: "times new roman"; font-size: 7pt;">
</span></span><!--[endif]-->status[32]: Return status field written by
bootloader after performing platform-specific commands<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="text-indent: 34.8pt;">
• No
specification, platform-dependent<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="text-indent: 34.8pt;">
<br /></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.0in; mso-add-space: auto; mso-list: l8 level1 lfo6; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "wingdings"; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings;">Ø<span style="font-family: "times new roman"; font-size: 7pt;">
</span></span><!--[endif]-->recovery[1024]: Command line for Recovery
Console<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 37.2pt; mso-add-space: auto; text-indent: 34.8pt;">
• Arguments tokenized by ‘\n’<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 37.2pt; mso-add-space: auto; text-indent: 34.8pt;">
• Invalid if first argument not ‘recovery’<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 13.5pt; mso-add-space: auto; tab-stops: 22.5pt;">
<br /></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 13.5pt; mso-add-space: auto; mso-list: l1 level1 lfo1; tab-stops: 22.5pt; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "symbol"; font-size: 14.0pt; line-height: 110%;">·<span style="font-family: "times new roman"; font-size: 7pt; line-height: normal;">
</span></span><!--[endif]--><span style="font-size: 14.0pt; line-height: 110%;">Recovery
Console (RC) (Alternate boot environment)<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: .25in; mso-add-space: auto;">
– Comments at the beginning of bootable/recovery/recovery.c are out of
date<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 27.0pt; mso-add-space: auto; mso-list: l4 level1 lfo2; text-indent: -9.0pt;">
<!--[if !supportLists]-->-<span style="font-size: 7pt;">
</span><!--[endif]-->A few ways to enter – <o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.0in; mso-add-space: auto; mso-list: l7 level1 lfo4; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "wingdings"; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings;">Ø<span style="font-family: "times new roman"; font-size: 7pt;">
</span></span><!--[endif]-->reboot recovery from a shell<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.0in; mso-add-space: auto; mso-list: l7 level1 lfo4; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "wingdings"; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings;">Ø<span style="font-family: "times new roman"; font-size: 7pt;">
</span></span><!--[endif]-->RecoverySystem APIs in Android Framework <o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.0in; mso-add-space: auto; mso-list: l7 level1 lfo4; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "wingdings"; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings;">Ø<span style="font-family: "times new roman"; font-size: 7pt;">
</span></span><!--[endif]-->OEMs often implement a bootloader ‘magic key’<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: .25in; mso-add-space: auto;">
– Verify & Apply SW updates<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: .25in; mso-add-space: auto;">
– Perform Factory Data Reset<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: .25in; mso-add-space: auto;">
– Typically controlled by “/cache/recovery/command” file left by Android RecoverySystem
APIs<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 27.0pt; mso-add-space: auto; mso-list: l4 level1 lfo2; text-indent: -9.0pt;">
<!--[if !supportLists]-->-<span style="font-size: 7pt;">
</span><!--[endif]-->Pictorial interface, no localization<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 27.0pt; mso-add-space: auto; mso-list: l4 level1 lfo2; text-indent: -9.0pt;">
<!--[if !supportLists]-->-<span style="font-size: 7pt;">
</span><!--[endif]-->Hidden non-localized menu for manual tasks<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 27.0pt; mso-add-space: auto; mso-list: l4 level1 lfo2; text-indent: -9.0pt;">
<!--[if !supportLists]-->-<span style="font-size: 7pt;">
</span><!--[endif]-->Other platform-specific tasks as implemented in
Recovery Console UI plug-in<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 27.0pt; mso-add-space: auto; mso-list: l4 level1 lfo2; text-indent: -9.0pt;">
<!--[if !supportLists]-->-<span style="font-size: 7pt;">
</span><!--[endif]-->Log files saved in /cache/recovery<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.0in; mso-add-space: auto; mso-list: l6 level1 lfo5; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "wingdings"; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings;">Ø<span style="font-family: "times new roman"; font-size: 7pt;">
</span></span><!--[endif]-->All stdout/stderr from RC and Updater<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.0in; mso-add-space: auto; mso-list: l6 level1 lfo5; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "wingdings"; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings;">Ø<span style="font-family: "times new roman"; font-size: 7pt;">
</span></span><!--[endif]-->Edify ui_print() commands<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 27.0pt; mso-add-space: auto; mso-list: l4 level1 lfo2; text-indent: -9.0pt;">
<!--[if !supportLists]-->-<span style="font-size: 7pt;">
</span><!--[endif]-->Upon startup, looks for command line arguments
in decreasing precedence:<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.0in; mso-add-space: auto; mso-list: l2 level1 lfo7; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "wingdings"; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings;">Ø<span style="font-family: "times new roman"; font-size: 7pt;">
</span></span><!--[endif]-->Actual command line to ‘recovery’, debug-only
scenario<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.0in; mso-add-space: auto; mso-list: l2 level1 lfo7; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "wingdings"; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings;">Ø<span style="font-family: "times new roman"; font-size: 7pt;">
</span></span><!--[endif]-->BCB.recovery<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 27.0pt; mso-add-space: auto; mso-list: l4 level1 lfo2; text-indent: -9.0pt;">
<!--[if !supportLists]-->-<span style="font-size: 7pt;">
</span><!--[endif]-->Android framework RecoverySystem doesn’t write
to BCB due to permissions on doing raw block device I/O, So Recovery console
(RC) Always copies arguments into BCB.recovery and sets BCB.command to
“boot-recovery”<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.0in; mso-add-space: auto; mso-list: l3 level1 lfo8; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "wingdings"; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings;">Ø<span style="font-family: "times new roman"; font-size: 7pt;">
</span></span><!--[endif]-->Makes sure we keep booting into RC with the same
arguments in event of unexpected power loss<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.0in; mso-add-space: auto; mso-list: l3 level1 lfo8; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "wingdings"; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings;">Ø<span style="font-family: "times new roman"; font-size: 7pt;">
</span></span><!--[endif]-->Don’t rely solely on /cache/recovery/command for
this<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 27.0pt; mso-add-space: auto; mso-list: l4 level1 lfo2; text-indent: -9.0pt;">
<!--[if !supportLists]-->-<span style="font-size: 7pt;">
</span><!--[endif]-->finish_recovery()<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.0in; mso-add-space: auto; mso-list: l0 level1 lfo9; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "wingdings"; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings;">Ø<span style="font-family: "times new roman"; font-size: 7pt;">
</span></span><!--[endif]-->Called when requested operations (SW update,
factory data reset, etc) are complete, whether successful or failed<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.0in; mso-add-space: auto; mso-list: l0 level1 lfo9; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "wingdings"; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings;">Ø<span style="font-family: "times new roman"; font-size: 7pt;">
</span></span><!--[endif]-->BCB is cleared so that subsequent reboot goes
back into Android<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.0in; mso-add-space: auto; mso-list: l0 level1 lfo9; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "wingdings"; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings;">Ø<span style="font-family: "times new roman"; font-size: 7pt;">
</span></span><!--[endif]-->Copies all logs to /cache/recovery/<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 27.0pt; mso-add-space: auto; mso-list: l5 level1 lfo3; text-indent: -9.0pt;">
<!--[if !supportLists]-->–<span style="font-size: 7pt;">
</span><!--[endif]-->If no arguments were given to RC, displays error
image and waits for menu input<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 27.0pt; mso-add-space: auto;">
<br /></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: .25in; mso-add-space: auto; mso-list: l1 level1 lfo1; tab-stops: 22.5pt; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "symbol"; font-size: 14.0pt; line-height: 110%;">·<span style="font-family: "times new roman"; font-size: 7pt; line-height: normal;">
</span></span><!--[endif]--><span style="font-size: 14.0pt; line-height: 110%;">Bootloader
Integration<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 27.0pt; mso-add-space: auto; mso-list: l4 level1 lfo2; text-indent: -9.0pt;">
<!--[if !supportLists]-->-<span style="font-size: 7pt;">
</span><!--[endif]-->Linux kernel should write “boot-recovery” into
BCB.command and zero out BCB.recovery if “recovery” is supplied as a reboot()
argument from android framework<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 27.0pt; mso-add-space: auto; mso-list: l5 level1 lfo3; text-indent: -9.0pt;">
<!--[if !supportLists]-->–<span style="font-size: 7pt;">
</span><!--[endif]-->Implement in a driver via
register_reboot_notifier()<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 27.0pt; mso-add-space: auto; mso-list: l4 level1 lfo2; text-indent: -9.0pt;">
<!--[if !supportLists]-->-<span style="font-size: 7pt;">
</span><!--[endif]-->Bootloader selects boot image (or other task)
based on BCB.command<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 27.0pt; mso-add-space: auto; mso-list: l5 level1 lfo3; text-indent: -9.0pt;">
<!--[if !supportLists]-->–<span style="font-size: 7pt;">
</span><!--[endif]-->BCB.command is persistent; keep booting into RC
until RC clears it<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 27.0pt; mso-add-space: auto; mso-list: l5 level1 lfo3; text-indent: -9.0pt;">
<!--[if !supportLists]-->–<span style="font-size: 7pt;">
</span><!--[endif]-->Garbage or zeroed out contents should simply
boot into Android<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 27.0pt; mso-add-space: auto;">
<br /></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: .25in; mso-add-space: auto; mso-list: l1 level1 lfo1; tab-stops: 22.5pt; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "symbol"; font-size: 14.0pt; line-height: 110%;">·<span style="font-family: "times new roman"; font-size: 7pt; line-height: normal;">
</span></span><!--[endif]--><b>U</b><span style="font-size: 14.0pt; line-height: 110%;">pdater</span><o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 27.0pt; mso-add-space: auto; mso-list: l5 level1 lfo3; text-indent: -9.0pt;">
<!--[if !supportLists]-->–<span style="font-size: 7pt;">
</span><!--[endif]-->SW update logic, binary inside SW update package<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 27.0pt; mso-add-space: auto; mso-list: l5 level1 lfo3; text-indent: -9.0pt;">
<!--[if !supportLists]-->–<span style="font-size: 7pt;">
</span><!--[endif]-->AOSP implementation runs script in Edify
language<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 27.0pt; mso-add-space: auto; mso-list: l5 level1 lfo3; text-indent: -9.0pt;">
<!--[if !supportLists]-->–<span style="font-size: 7pt;">
</span><!--[endif]-->Platform-specific tasks implemented in plug-ins<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: .25in; mso-add-space: auto;">
<br /></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: .25in; mso-add-space: auto; mso-list: l1 level1 lfo1; tab-stops: 22.5pt; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "symbol"; font-size: 14.0pt; line-height: 110%;">·<span style="font-family: "times new roman"; font-size: 7pt; line-height: normal;">
</span></span><!--[endif]--><span style="font-size: 14.0pt; line-height: 110%;">updater
script <o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 27.0pt; mso-add-space: auto; mso-list: l4 level1 lfo2; text-indent: -9.0pt;">
<!--[if !supportLists]-->-<span style="font-size: 7pt;">
</span><!--[endif]-->Updater script written in Edify language<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 27.0pt; mso-add-space: auto; mso-list: l4 level1 lfo2; text-indent: -9.0pt;">
<!--[if !supportLists]-->-<span style="font-size: 7pt;">
</span><!--[endif]-->Created by python script in AOSP /build/tools/releasetools/edify_generator.py &
/build/tools/releasetools/ota_from_target_files</div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 106.8pt; mso-add-space: auto; text-indent: 34.8pt;">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 27.0pt; mso-add-space: auto; mso-list: l4 level1 lfo2; text-indent: -9.0pt;">
<!--[if !supportLists]-->-<span style="font-size: 7pt;">
</span><!--[endif]-->Placed inside update zip file in /META-INF/…/updater-script<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 27.0pt; mso-add-space: auto;">
<br /></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: .25in; mso-add-space: auto;">
<br /></div>
<br />
<div class="MsoListParagraphCxSpLast" style="margin-left: .25in; mso-add-space: auto;">
<br /></div>
<div>
<br /></div>
</div>
</div>
Income Schoolhttp://www.blogger.com/profile/03597457289839556604noreply@blogger.com0Old Palasia, Indore, Madhya Pradesh, India22.727574231145805 75.88866233825683622.723912731145806 75.883619838256834 22.731235731145805 75.893704838256838tag:blogger.com,1999:blog-7059806544727992418.post-8076491151735886172013-07-24T10:31:00.001-07:002018-12-09T21:26:56.806-08:00Drive Trace Android Application<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<a href="http://ford.challengepost.com/submissions/16641-drive-trace-application?utm_campaign=ford-personalized-fuel-efficiency-app-challenge_20130325&utm_content=submission_visible_in_gallery&utm_medium=email&utm_source=transactional">http://ford.challengepost.com/submissions/16641-drive-trace-application?utm_campaign=ford-personalized-fuel-efficiency-app-challenge_20130325&utm_content=submission_visible_in_gallery&utm_medium=email&utm_source=transactional</a><br />
<br />
<iframe allowfullscreen="" frameborder="0" height="270" src="//www.youtube.com/embed/uhB5Z4_5LW4" width="480"></iframe><br />
<br />
<br />
<span style="background-color: white; color: #333333; font-family: arial, sans-serif; font-size: 13px; line-height: 17px;">Drive Trace application helps driver learn, compare and share information about his driving style and thereby help him to optimize the fuel usage. </span><br />
<br style="background-color: white; color: #333333; font-family: arial, sans-serif; font-size: 13px; line-height: 17px;" />
<span style="background-color: white; color: #333333; font-family: arial, sans-serif; font-size: 13px; line-height: 17px;">In on-drive mode, the application interacts with driver through Sync AppLink for trip creation or continuation and records per trip start and end location, fuel consumption, mileage and other details along with real-time vehicle data through OpenXC. It analyzes driving style through concrete algorithms and raises alerts on the go. Alerts can be enabled on configurable frequency to help driver unlearn the driving habits that lead to aggressive driving or over-idling. </span><br />
<br style="background-color: white; color: #333333; font-family: arial, sans-serif; font-size: 13px; line-height: 17px;" />
<span style="background-color: white; color: #333333; font-family: arial, sans-serif; font-size: 13px; line-height: 17px;">In off-drive mode, driver can view per trip details and effortlessly compare and analyze mileage, aggression & idling trends for selected trips. The application also supports managing trips and sharing of analysis graphs on e-mail, Bluetooth or on any social networking sites.</span></div>
Income Schoolhttp://www.blogger.com/profile/03597457289839556604noreply@blogger.com0tag:blogger.com,1999:blog-7059806544727992418.post-47524612414817652522013-07-16T22:30:00.003-07:002018-12-09T21:26:56.516-08:00ADB Over WiFi.<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="post-headline" style="font-family: Georgia, 'Times New Roman', serif; font-size: 18px; line-height: 26px;">
<h1 style="font-size: 34px; line-height: 1.2; margin: 0px; padding: 0px; text-align: center;">
<span style="background-color: #f3f3f3; color: #0b5394;">ADB Over WiFi</span></h1>
<h1 style="background-color: white; font-size: 34px; line-height: 1.2; margin: 0px; padding: 0px;">
<span style="font-size: 18px; line-height: 26px;">Are you an Android developer ? If yes, you certainly use</span><span style="font-size: 18px; line-height: 26px;"> </span><a href="http://developer.android.com/tools/help/adb.html" style="color: #3d86d5; font-size: 18px; line-height: 26px; text-decoration: none;">ADB (Android Debug Bridge)</a><span style="font-size: 18px; line-height: 26px;"> </span><span style="font-size: 18px; line-height: 26px;">to do various things like:</span></h1>
</div>
<div class="post-bodycopy clearfix" style="min-width: 0px;">
<ul style="background-color: white; font-family: Georgia, 'Times New Roman', serif; font-size: 18px; line-height: 26px; text-align: left;">
<li><div style="margin-bottom: 1em; margin-top: 1em; padding: 0px;">
Start a shell on the target device.</div>
</li>
<li><div style="margin-bottom: 1em; margin-top: 1em; padding: 0px;">
Install/Uninstall some packages/ apps.</div>
</li>
<li><div style="margin-bottom: 1em; margin-top: 1em; padding: 0px;">
Monitor the state of the device (memory used, cpu used etc.)</div>
</li>
<li><span style="font-size: 18px;">Push/Pull some files to/from the target device.</span></li>
</ul>
<ul style="background-color: white; font-family: Georgia, 'Times New Roman', serif; font-size: 18px; line-height: 26px; text-align: left;">
<li><span style="font-size: 18px;">Debug Android applications.</span></li>
</ul>
<div style="background-color: white; font-family: Georgia, 'Times New Roman', serif; font-size: 18px; line-height: 26px; margin-bottom: 1em; margin-top: 1em; padding: 0px; text-align: left;">
</div>
<div style="background-color: white; font-family: Georgia, 'Times New Roman', serif; font-size: 18px; line-height: 26px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
Most developers connect their device to their computer using a USB cable and that sucks because:</div>
<ul style="background-color: white; font-family: Georgia, 'Times New Roman', serif; font-size: 18px; line-height: 26px; margin-bottom: 10px; margin-top: 10px; padding-bottom: 0px; padding-top: 0px;">
<li><div style="margin-bottom: 1em; margin-top: 1em; padding: 0px;">
It is not ergonomic.</div>
</li>
<li><div style="margin-bottom: 1em; margin-top: 1em; padding: 0px;">
It is ugly.</div>
</li>
<li><div style="margin-bottom: 1em; margin-top: 1em; padding: 0px;">
You probably need that cable to plug your device to an electric outlet while you are at work.</div>
</li>
<li><div style="margin-bottom: 1em; margin-top: 1em; padding: 0px;">
You may not have a USB cable at all!</div>
</li>
</ul>
<div style="background-color: white; font-family: Georgia, 'Times New Roman', serif; font-size: 18px; line-height: 26px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
Anyway, for those of you who want to connect to your device wirelessly using ADB, I have some good news for you: <strong>it is possible and it is easy</strong>.</div>
<div style="background-color: white; font-family: Georgia, 'Times New Roman', serif; font-size: 18px; line-height: 26px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
First, let’s talk about how ADB works and then let’s dig into that very straightforward solution (or if you are busy just jump to the second paragraph).</div>
<div style="background-color: white; font-family: Georgia, 'Times New Roman', serif; font-size: 18px; line-height: 26px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
<strong>How does ADB work?</strong></div>
<div style="background-color: white; font-family: Georgia, 'Times New Roman', serif; font-size: 18px; line-height: 26px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
<em>ADB</em> is a tool that includes three components:</div>
<ul style="background-color: white; font-family: Georgia, 'Times New Roman', serif; font-size: 18px; line-height: 26px; margin-bottom: 10px; margin-top: 10px; padding-bottom: 0px; padding-top: 0px;">
<li><div style="margin-bottom: 1em; margin-top: 1em; padding: 0px;">
<span style="color: red;"><b><em>A daemon</em>:</b></span> It is a background process hosted by the target <span style="color: #444444;"><i><b>device</b></i></span>.</div>
</li>
<li><div style="margin-bottom: 1em; margin-top: 1em; padding: 0px;">
<span style="color: red;"><b><em>A client</em>:</b></span> It runs on your development <b><i><span style="color: #444444;">machine</span></i></b>. This is where you will be issuing your commands.</div>
</li>
<li><div style="margin-bottom: 1em; margin-top: 1em; padding: 0px;">
<span style="color: red;"><b><em>A server</em>:</b></span> It acts as a Proxy between the client and the <em>daemon</em>. It runs as a background process on <b><i><span style="color: #444444;">machine</span></i></b>.</div>
</li>
</ul>
<div style="background-color: white; font-family: Georgia, 'Times New Roman', serif; font-size: 18px; line-height: 26px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
As you can guess, there is a two way communication going on between the <em>server</em> and the <em>daemon</em>. That communication happens over a medium which can be of two sorts: <em>USB</em> or <em>TCP</em>. Aha, you get it know? If we want to connect to our device over wifi then we just have to switch the transport mode from USB to TCP. Let’s do that!</div>
<strong><span style="font-size: x-large;">The solution: Switching ADB transport mode from USB to TCPIP</span></strong><br />
<ol style="margin-bottom: 10px; margin-top: 10px; padding-bottom: 0px; padding-top: 0px; text-align: left;">
<li><div style="background-color: white; font-family: Georgia, 'Times New Roman', serif; font-size: 18px; line-height: 26px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
Before switching to TCP, we’ll need to grab the IP address of the device. To do that, we can either go to the phone settings or use the command line tool <em><a href="https://wiki.archlinux.org/index.php/Netcfg" style="color: #3d86d5; font-weight: bold; text-decoration: none;">netcfg</a></em>: </div>
<div class="syntaxhighlighter " id="highlighter_990791" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; margin: 1em 0px !important; outline: 0px !important; padding: 1px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 1513px;">
<div class="bar" style="background-color: rgb(231, 229, 220) !important; background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="toolbar" style="background-color: rgb(248, 248, 248) !important; background-image: none !important; border: 1px solid rgb(231, 229, 220) !important; bottom: auto !important; float: none !important; font-size: 1px !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 8px 8px 8px 0px !important; position: absolute !important; right: 0px !important; top: 0px !important; vertical-align: baseline !important; width: auto !important;">
view sourceprint?</div>
</div>
<div class="lines" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line alt1" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<span style="color: #3d85c6; font-size: large;"><b style="background-color: #eeeeee;">adb shell netcfg</b></span></div>
</div>
</div>
<div style="background-color: white; font-family: Georgia, 'Times New Roman', serif; font-size: 18px; line-height: 26px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
</div>
</li>
<li><div style="background-color: white; font-family: Georgia, 'Times New Roman', serif; font-size: 18px; line-height: 26px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
Once you are in possession of the device’s IP address (let’s say it’s: <em>192.168.65.150</em>), you can switch to TCP mode by doing: </div>
<div class="syntaxhighlighter " id="highlighter_863947" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; margin: 1em 0px !important; outline: 0px !important; padding: 1px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 1513px;">
<div class="bar" style="background-color: rgb(231, 229, 220) !important; background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="toolbar" style="background-color: rgb(248, 248, 248) !important; background-image: none !important; border: 1px solid rgb(231, 229, 220) !important; bottom: auto !important; float: none !important; font-size: 1px !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 8px 8px 8px 0px !important; position: absolute !important; right: 0px !important; top: 0px !important; vertical-align: baseline !important; width: auto !important;">
view sourceprint?</div>
</div>
<span style="color: #3d85c6; font-size: large;"><b style="background-color: #eeeeee;">adb tcpip</b></span></div>
<span style="font-family: Georgia, Times New Roman, serif; font-size: medium;"><span style="background-color: white; line-height: 26px;"> One thing to remember is that you can only choose a port number within the range of [5555...5585] (the reason being that </span></span><em style="background-color: white; font-family: Georgia, 'Times New Roman', serif; font-size: 18px; line-height: 26px;">ADB Server</em><span style="font-family: Georgia, Times New Roman, serif; font-size: medium;"><span style="background-color: white; line-height: 26px;"> only works with these ports). So for instance you could do: </span></span><div class="syntaxhighlighter " id="highlighter_722561" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; margin: 1em 0px !important; outline: 0px !important; padding: 1px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 1513px;">
<div class="bar" style="background-color: rgb(231, 229, 220) !important; background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="toolbar" style="background-color: rgb(248, 248, 248) !important; background-image: none !important; border: 1px solid rgb(231, 229, 220) !important; bottom: auto !important; float: none !important; font-size: 1px !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 8px 8px 8px 0px !important; position: absolute !important; right: 0px !important; top: 0px !important; vertical-align: baseline !important; width: auto !important;">
view source</div>
<div class="toolbar" style="background-color: rgb(248, 248, 248) !important; background-image: none !important; border: 1px solid rgb(231, 229, 220) !important; bottom: auto !important; float: none !important; font-size: 1px !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 8px 8px 8px 0px !important; position: absolute !important; right: 0px !important; top: 0px !important; vertical-align: baseline !important; width: auto !important;">
print?</div>
</div>
<span style="background-color: #eeeeee; color: #3d85c6; font-size: large;"><b>adb tcpip 5555</b></span></div>
<div style="background-color: white; font-family: Georgia, 'Times New Roman', serif; font-size: 18px; line-height: 26px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
</div>
</li>
<li><div style="background-color: white; font-family: Georgia, 'Times New Roman', serif; font-size: 18px; line-height: 26px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
Stop ADB Server (we’ll restart it later by issuing any ADB command): </div>
<div class="syntaxhighlighter " id="highlighter_50304" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; margin: 1em 0px !important; outline: 0px !important; padding: 1px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 1513px;">
<div class="bar" style="background-color: rgb(231, 229, 220) !important; background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="toolbar" style="background-color: rgb(248, 248, 248) !important; background-image: none !important; border: 1px solid rgb(231, 229, 220) !important; bottom: auto !important; float: none !important; font-size: 1px !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 8px 8px 8px 0px !important; position: absolute !important; right: 0px !important; top: 0px !important; vertical-align: baseline !important; width: auto !important;">
view sourceprint?</div>
</div>
<div class="lines" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line alt1" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<b><span style="background-color: #eeeeee; color: #3d85c6; font-size: large;">adb kill-server</span></b></div>
</div>
</div>
<div style="background-color: white; font-family: Georgia, 'Times New Roman', serif; font-size: 18px; line-height: 26px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
</div>
</li>
<li><div style="background-color: white; font-family: Georgia, 'Times New Roman', serif; font-size: 18px; line-height: 26px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
Set ADBHOST to your IP address: </div>
<div class="syntaxhighlighter " id="highlighter_135169" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; margin: 1em 0px !important; outline: 0px !important; padding: 1px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 1513px;">
<div class="bar" style="background-color: rgb(231, 229, 220) !important; background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="toolbar" style="background-color: rgb(248, 248, 248) !important; background-image: none !important; border: 1px solid rgb(231, 229, 220) !important; bottom: auto !important; float: none !important; font-size: 1px !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 8px 8px 8px 0px !important; position: absolute !important; right: 0px !important; top: 0px !important; vertical-align: baseline !important; width: auto !important;">
view sourceprint?</div>
</div>
<div class="lines" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line alt1" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<b><span style="background-color: #eeeeee; color: #3d85c6; font-size: large;">ADBHOST=192.168.65.150 adb devices</span></b></div>
</div>
</div>
<div style="background-color: white; font-family: Georgia, 'Times New Roman', serif; font-size: 18px; line-height: 26px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
</div>
</li>
<li><span style="background-color: white; font-family: Georgia, 'Times New Roman', serif; font-size: 18px; line-height: 26px;">Make sure your device is connected</span></li>
</ol>
<div style="background-color: white; font-family: Georgia, 'Times New Roman', serif; font-size: 18px; line-height: 26px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
the last part of the last command should print the device that you are trying to connect to.</div>
<div style="background-color: white; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
<strong><span style="font-family: Georgia, Times New Roman, serif;"><span style="line-height: 26px;"><span style="font-size: x-large;">What to do if you don’t have a USB cable from the beginning? </span><a href="http://en.wikipedia.org/wiki/Android_rooting" target="_blank"><span style="color: red;">(rooting requ</span></a></span></span></strong><a href="http://en.wikipedia.org/wiki/Android_rooting" target="_blank"><span style="color: red;"><strong style="background-color: transparent;"><span style="font-family: Georgia, Times New Roman, serif;"><span style="line-height: 26px;">i</span></span></strong><strong><span style="font-family: Georgia, Times New Roman, serif;"><span style="line-height: 26px;">red)</span></span></strong></span></a></div>
<div style="background-color: white; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
<span style="font-family: Georgia, Times New Roman, serif; font-size: medium;"><span style="line-height: 26px;">If you don’t have a USB cable at first, then you need to </span></span><a href="http://en.wikipedia.org/wiki/Android_rooting" target="_blank"><span style="color: red;"><span style="font-family: Georgia, Times New Roman, serif; font-size: medium;"><span style="line-height: 26px;">root your device. (can void warranty)</span></span></span></a></div>
<div style="background-color: white; font-family: Georgia, 'Times New Roman', serif; font-size: 18px; line-height: 26px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
<span style="font-size: 18px;">Than run the following command on your device: </span></div>
<div class="syntaxhighlighter " id="highlighter_905435" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; margin: 1em 0px !important; outline: 0px !important; padding: 1px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 1553px;">
<div class="bar" style="background-color: rgb(231, 229, 220) !important; background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="toolbar" style="background-color: rgb(248, 248, 248) !important; background-image: none !important; border: 1px solid rgb(231, 229, 220) !important; bottom: auto !important; float: none !important; font-size: 1px !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 8px 8px 8px 0px !important; position: absolute !important; right: 0px !important; top: 0px !important; vertical-align: baseline !important; width: auto !important;">
<a class="item viewSource" href="http://www.chentir.com/?p=1613#viewSource" style="background-image: url(http://www.chentir.com/wp-content/plugins/syntaxhighlighter-plus/syntaxhighlighter/styles/page_white_code.png) !important; background-repeat: no-repeat no-repeat !important; color: rgb(160, 160, 160) !important; display: block !important; float: left !important; font-weight: bold; height: 16px; margin-left: 8px !important; overflow: hidden !important; text-decoration: none; text-indent: -5000px !important; width: 16px;" title="view source">view source</a><a class="item printSource" href="http://www.chentir.com/?p=1613#printSource" style="background-image: url(http://www.chentir.com/wp-content/plugins/syntaxhighlighter-plus/syntaxhighlighter/styles/printer.png) !important; background-repeat: no-repeat no-repeat !important; color: rgb(160, 160, 160) !important; display: block !important; float: left !important; font-weight: bold; height: 16px; margin-left: 8px !important; overflow: hidden !important; text-decoration: none; text-indent: -5000px !important; width: 16px;" title="print">print</a><a class="item about" href="http://www.chentir.com/?p=1613#about" style="background-image: url(http://www.chentir.com/wp-content/plugins/syntaxhighlighter-plus/syntaxhighlighter/styles/help.png) !important; background-repeat: no-repeat no-repeat !important; color: rgb(160, 160, 160) !important; display: block !important; float: left !important; font-weight: bold; height: 16px; margin-left: 8px !important; overflow: hidden !important; text-decoration: none; text-indent: -5000px !important; width: 16px;" title="?">?</a></div>
</div>
<div class="lines" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line alt1" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<span style="color: #3d85c6; font-size: large;"><b style="background-color: white;"> </b><b style="background-color: #eeeeee;">setprop service.adb.tcp.port 5555</b></span></div>
</div>
</div>
<div style="background-color: white; font-family: Georgia, 'Times New Roman', serif; font-size: 18px; line-height: 26px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
</div>
<div style="background-color: white; font-family: Georgia, 'Times New Roman', serif; font-size: 18px; line-height: 26px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
Now you need to stop/restart the adb daemon: </div>
<div class="syntaxhighlighter " id="highlighter_928388" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; margin: 1em 0px !important; outline: 0px !important; padding: 1px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 1553px;">
<div class="bar" style="background-color: rgb(231, 229, 220) !important; background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="toolbar" style="background-color: rgb(248, 248, 248) !important; background-image: none !important; border: 1px solid rgb(231, 229, 220) !important; bottom: auto !important; float: none !important; font-size: 1px !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 8px 8px 8px 0px !important; position: absolute !important; right: 0px !important; top: 0px !important; vertical-align: baseline !important; width: auto !important;">
<a class="item viewSource" href="http://www.chentir.com/?p=1613#viewSource" style="background-image: url(http://www.chentir.com/wp-content/plugins/syntaxhighlighter-plus/syntaxhighlighter/styles/page_white_code.png) !important; background-repeat: no-repeat no-repeat !important; color: rgb(160, 160, 160) !important; display: block !important; float: left !important; font-weight: bold; height: 16px; margin-left: 8px !important; overflow: hidden !important; text-decoration: none; text-indent: -5000px !important; width: 16px;" title="view source">view source</a><a class="item printSource" href="http://www.chentir.com/?p=1613#printSource" style="background-image: url(http://www.chentir.com/wp-content/plugins/syntaxhighlighter-plus/syntaxhighlighter/styles/printer.png) !important; background-repeat: no-repeat no-repeat !important; color: rgb(160, 160, 160) !important; display: block !important; float: left !important; font-weight: bold; height: 16px; margin-left: 8px !important; overflow: hidden !important; text-decoration: none; text-indent: -5000px !important; width: 16px;" title="print">print</a><a class="item about" href="http://www.chentir.com/?p=1613#about" style="background-image: url(http://www.chentir.com/wp-content/plugins/syntaxhighlighter-plus/syntaxhighlighter/styles/help.png) !important; background-repeat: no-repeat no-repeat !important; color: rgb(160, 160, 160) !important; display: block !important; float: left !important; font-weight: bold; height: 16px; margin-left: 8px !important; overflow: hidden !important; text-decoration: none; text-indent: -5000px !important; width: 16px;" title="?">?</a></div>
</div>
<b style="background-color: white; color: #3d85c6; font-size: x-large;"> </b><span style="color: #3d85c6; font-size: large;"><b style="background-color: #eeeeee;">stop adbd</b></span></div>
<div class="syntaxhighlighter " id="highlighter_657711" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; margin: 1em 0px !important; outline: 0px !important; padding: 1px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 1553px;">
<div class="bar" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="toolbar" style="background-image: none !important; border: 1px solid rgb(231, 229, 220) !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 8px 8px 8px 0px !important; position: absolute !important; right: 0px !important; top: 0px !important; vertical-align: baseline !important; width: auto !important;">
<a class="item viewSource" href="http://www.chentir.com/?p=1613#viewSource" style="background-image: url(http://www.chentir.com/wp-content/plugins/syntaxhighlighter-plus/syntaxhighlighter/styles/page_white_code.png) !important; background-repeat: no-repeat no-repeat !important; display: block !important; float: left !important; height: 16px; margin-left: 8px !important; overflow: hidden !important; text-decoration: none; text-indent: -5000px !important; width: 16px;" title="view source"><span style="color: #3d85c6; font-size: large;"><b style="background-color: #eeeeee;">view source</b></span></a><a class="item printSource" href="http://www.chentir.com/?p=1613#printSource" style="background-image: url(http://www.chentir.com/wp-content/plugins/syntaxhighlighter-plus/syntaxhighlighter/styles/printer.png) !important; background-repeat: no-repeat no-repeat !important; display: block !important; float: left !important; height: 16px; margin-left: 8px !important; overflow: hidden !important; text-decoration: none; text-indent: -5000px !important; width: 16px;" title="print"><span style="color: #3d85c6; font-size: large;"><b style="background-color: #eeeeee;">print</b></span></a><a class="item about" href="http://www.chentir.com/?p=1613#about" style="background-image: url(http://www.chentir.com/wp-content/plugins/syntaxhighlighter-plus/syntaxhighlighter/styles/help.png) !important; background-repeat: no-repeat no-repeat !important; display: block !important; float: left !important; height: 16px; margin-left: 8px !important; overflow: hidden !important; text-decoration: none; text-indent: -5000px !important; width: 16px;" title="?"><span style="color: #3d85c6; font-size: large;"><b style="background-color: #eeeeee;">?</b></span></a></div>
</div>
<b style="background-color: white; color: #3d85c6; font-size: x-large;"> </b><span style="color: #3d85c6; font-size: large;"><b style="background-color: #eeeeee;">start adbd</b></span></div>
<div style="background-color: white; font-family: Georgia, 'Times New Roman', serif; font-size: 18px; line-height: 26px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
</div>
<div style="background-color: white; font-family: Georgia, 'Times New Roman', serif; font-size: 18px; line-height: 26px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
<strong>How to switch back to USB transport mode?</strong> </div>
<div class="syntaxhighlighter " id="highlighter_624537" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; margin: 1em 0px !important; outline: 0px !important; padding: 1px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 1553px;">
<div class="bar" style="background-color: rgb(231, 229, 220) !important; background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="toolbar" style="background-color: rgb(248, 248, 248) !important; background-image: none !important; border: 1px solid rgb(231, 229, 220) !important; bottom: auto !important; float: none !important; font-size: 1px !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 8px 8px 8px 0px !important; position: absolute !important; right: 0px !important; top: 0px !important; vertical-align: baseline !important; width: auto !important;">
<a class="item viewSource" href="http://www.chentir.com/?p=1613#viewSource" style="background-image: url(http://www.chentir.com/wp-content/plugins/syntaxhighlighter-plus/syntaxhighlighter/styles/page_white_code.png) !important; background-repeat: no-repeat no-repeat !important; color: rgb(160, 160, 160) !important; display: block !important; float: left !important; font-weight: bold; height: 16px; margin-left: 8px !important; overflow: hidden !important; text-decoration: none; text-indent: -5000px !important; width: 16px;" title="view source">view source</a><a class="item printSource" href="http://www.chentir.com/?p=1613#printSource" style="background-image: url(http://www.chentir.com/wp-content/plugins/syntaxhighlighter-plus/syntaxhighlighter/styles/printer.png) !important; background-repeat: no-repeat no-repeat !important; color: rgb(160, 160, 160) !important; display: block !important; float: left !important; font-weight: bold; height: 16px; margin-left: 8px !important; overflow: hidden !important; text-decoration: none; text-indent: -5000px !important; width: 16px;" title="print">print</a><a class="item about" href="http://www.chentir.com/?p=1613#about" style="background-image: url(http://www.chentir.com/wp-content/plugins/syntaxhighlighter-plus/syntaxhighlighter/styles/help.png) !important; background-repeat: no-repeat no-repeat !important; color: rgb(160, 160, 160) !important; display: block !important; float: left !important; font-weight: bold; height: 16px; margin-left: 8px !important; overflow: hidden !important; text-decoration: none; text-indent: -5000px !important; width: 16px;" title="?">?</a></div>
</div>
<b style="background-color: white; color: #3d85c6; font-size: x-large;"> </b><span style="background-color: #eeeeee; color: #3d85c6; font-size: large;"><b>adb usb</b></span></div>
<div style="background-color: white; font-family: Georgia, 'Times New Roman', serif; font-size: 18px; line-height: 26px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
</div>
<div style="background-color: white; font-family: Georgia, 'Times New Roman', serif; font-size: 18px; line-height: 26px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
<strong>But there is one caveat</strong></div>
<div style="background-color: white; font-family: Georgia, 'Times New Roman', serif; font-size: 18px; line-height: 26px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
This only works since Android 4.0 (ICS). If you have to develop/hack on other Android versions then you need to root that device (in order to use ADB in unsecure mode).</div>
<div style="background-color: white; font-family: Georgia, 'Times New Roman', serif; font-size: 18px; line-height: 26px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
That’s all folks, I hope that you are now using debug bridge over the air <img alt=":)" class="wp-smiley" src="http://www.chentir.com/wp-includes/images/smilies/icon_smile.gif" style="background-image: none !important; background-position: initial initial !important; background-repeat: initial initial !important; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: none !important; float: none; margin: 0px 1px -1px; padding: 0px !important;" /></div>
</div>
</div>
Income Schoolhttp://www.blogger.com/profile/03597457289839556604noreply@blogger.com0tag:blogger.com,1999:blog-7059806544727992418.post-76440703857703867922013-06-20T07:03:00.002-07:002018-12-09T21:26:56.724-08:00[Solved] - Nexus 7 Doesn't Show Up As Media Device (MTP)<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
<b>Solution To Nexus 7 Doesn't Show Up As Media Device (MTP)</b></h2>
<div class="MsoNormal" style="line-height: 13.5pt; margin-left: 22.5pt; mso-list: l0 level1 lfo1; tab-stops: list .5in; text-indent: -.25in; vertical-align: baseline;">
<!--[if !supportLists]--><span style="font-family: Georgia, Times New Roman, serif;">1.<span style="font-size: 7pt; line-height: normal;">
</span><!--[endif]-->Plug the Nexus 7 into
your computer with the USB cable.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: 13.5pt; margin-left: 22.5pt; mso-list: l0 level1 lfo1; tab-stops: list .5in; text-indent: -.25in; vertical-align: baseline;">
<!--[if !supportLists]--><span style="font-family: Georgia, Times New Roman, serif;">2.<span style="font-size: 7pt; line-height: normal;">
</span><!--[endif]-->Open Device Manager.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: 13.5pt; margin-left: 22.5pt; mso-list: l0 level1 lfo1; tab-stops: list .5in; text-indent: -.25in; vertical-align: baseline;">
<!--[if !supportLists]--><span style="font-family: Georgia, Times New Roman, serif;">3.<span style="font-size: 7pt; line-height: normal;">
</span><!--[endif]-->Find "Android
Device" near the top and expand the node. Double click on "Android
Composite ADB Interface".<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: 13.5pt; margin-left: 22.5pt; mso-list: l0 level1 lfo1; tab-stops: list .5in; text-indent: -.25in; vertical-align: baseline;">
<!--[if !supportLists]--><span style="font-family: Georgia, Times New Roman, serif;">4.<span style="font-size: 7pt; line-height: normal;">
</span><!--[endif]-->In the properties
window that pops up, uninstall the driver (chose to delete the current driver
as well).<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: 13.5pt; margin-left: 22.5pt; mso-list: l0 level1 lfo1; tab-stops: list .5in; text-indent: -.25in; vertical-align: baseline;">
<!--[if !supportLists]--><span style="font-family: Georgia, Times New Roman, serif;">5.<span style="font-size: 7pt; line-height: normal;">
</span><!--[endif]-->Unplug the tablet and
plug it back in.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: 13.5pt; margin-left: 22.5pt; mso-list: l0 level1 lfo1; tab-stops: list .5in; text-indent: -.25in; vertical-align: baseline;">
<br /></div>
</div>
Income Schoolhttp://www.blogger.com/profile/03597457289839556604noreply@blogger.com0tag:blogger.com,1999:blog-7059806544727992418.post-27216830071813159832013-06-20T01:33:00.003-07:002018-12-09T21:26:56.225-08:00Scaling images to given width and height with maintaining it's aspect ratio in android <div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<b><span style="font-family: Georgia, Times New Roman, serif;">Scaling images to given width and height with maintaining it's aspect ratio in android </span></b><br />
<br />
<br />
<div>
Following code can be used to scale images to given width and height with maintaining it's aspect ratio</div>
<div>
<br /></div>
<div>
<div>
import android.content.res.Resources;</div>
<div>
import android.graphics.Bitmap;</div>
<div>
import android.graphics.Bitmap.Config;</div>
<div>
import android.graphics.BitmapFactory;</div>
<div>
import android.graphics.BitmapFactory.Options;</div>
<div>
import android.graphics.Canvas;</div>
<div>
import android.graphics.Paint;</div>
<div>
import android.graphics.Rect;</div>
<div>
<br /></div>
<div>
public class BitmapSizeHelper {</div>
<div>
<br /></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>public static enum ScalingLogic {</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>CROP, FIT</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div>
<br /></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>public static Bitmap getBitmapFromResources(Resources res, int resId,</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>int dstWidth, int dstHeight, ScalingLogic scalingLogic) {</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>Options options = new Options();</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>options.inJustDecodeBounds = true;</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>BitmapFactory.decodeResource(res, resId, options);</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>options.inJustDecodeBounds = false;</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>options.inSampleSize = calculateSampleSize(options.outWidth,</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>options.outHeight, dstWidth, dstHeight, scalingLogic);</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>Bitmap unscaledBitmap = BitmapFactory.decodeResource(res, resId,</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>options);</div>
<div>
<br /></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>return unscaledBitmap;</div>
<div>
<br /></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div>
<br /></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>public static Bitmap getBitmapFromPath(int targetW, int targetH,</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>String photopath, int dstWidth, int dstHeight,</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>ScalingLogic scalingLogic) {</div>
<div>
<br /></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>Options options = new Options();</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>options.inJustDecodeBounds = true;</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>BitmapFactory.decodeFile(photopath, options);</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>options.inJustDecodeBounds = false;</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>options.inSampleSize = calculateSampleSize(options.outWidth,</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>options.outHeight, dstWidth, dstHeight, scalingLogic);</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>Bitmap bitmap = BitmapFactory.decodeFile(photopath, options);</div>
<div>
<br /></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>return bitmap;</div>
<div>
<br /></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div>
<br /></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>public static int calculateSampleSize(int srcWidth, int srcHeight,</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>int dstWidth, int dstHeight, ScalingLogic scalingLogic) {</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (scalingLogic == ScalingLogic.FIT) {</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>final float srcAspect = (float) srcWidth / (float) srcHeight;</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>final float dstAspect = (float) dstWidth / (float) dstHeight;</div>
<div>
<br /></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (srcAspect > dstAspect) {</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>return srcWidth / dstWidth;</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>} else {</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>return srcHeight / dstHeight;</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>} else {</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>final float srcAspect = (float) srcWidth / (float) srcHeight;</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>final float dstAspect = (float) dstWidth / (float) dstHeight;</div>
<div>
<br /></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (srcAspect > dstAspect) {</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>return srcHeight / dstHeight;</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>} else {</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>return srcWidth / dstWidth;</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div>
<br /></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>public static Bitmap createScaledBitmap(Bitmap unscaledBitmap,</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>int dstWidth, int dstHeight, ScalingLogic scalingLogic) {</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>Rect srcRect = calculateSrcRect(unscaledBitmap.getWidth(),</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>unscaledBitmap.getHeight(), dstWidth, dstHeight, scalingLogic);</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>Rect dstRect = calculateDstRect(unscaledBitmap.getWidth(),</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>unscaledBitmap.getHeight(), dstWidth, dstHeight, scalingLogic);</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>Bitmap scaledBitmap = Bitmap.createBitmap(dstRect.width(),</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>dstRect.height(), Config.ARGB_8888);</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>Canvas canvas = new Canvas(scaledBitmap);</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>canvas.drawBitmap(unscaledBitmap, srcRect, dstRect, new Paint(</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>Paint.FILTER_BITMAP_FLAG));</div>
<div>
<br /></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>return scaledBitmap;</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div>
<br /></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>public static Rect calculateSrcRect(int srcWidth, int srcHeight,</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>int dstWidth, int dstHeight, ScalingLogic scalingLogic) {</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (scalingLogic == ScalingLogic.CROP) {</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>final float srcAspect = (float) srcWidth / (float) srcHeight;</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>final float dstAspect = (float) dstWidth / (float) dstHeight;</div>
<div>
<br /></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (srcAspect > dstAspect) {</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>final int srcRectWidth = (int) (srcHeight * dstAspect);</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>final int srcRectLeft = (srcWidth - srcRectWidth) / 2;</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>return new Rect(srcRectLeft, 0, srcRectLeft + srcRectWidth,</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>srcHeight);</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>} else {</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>final int srcRectHeight = (int) (srcWidth / dstAspect);</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>final int scrRectTop = (int) (srcHeight - srcRectHeight) / 2;</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>return new Rect(0, scrRectTop, srcWidth, scrRectTop</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ srcRectHeight);</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>} else {</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>return new Rect(0, 0, srcWidth, srcHeight);</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div>
<br /></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>public static Rect calculateDstRect(int srcWidth, int srcHeight,</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>int dstWidth, int dstHeight, ScalingLogic scalingLogic) {</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (scalingLogic == ScalingLogic.FIT) {</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>final float srcAspect = (float) srcWidth / (float) srcHeight;</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>final float dstAspect = (float) dstWidth / (float) dstHeight;</div>
<div>
<br /></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (srcAspect > dstAspect) {</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>return new Rect(0, 0, dstWidth, (int) (dstWidth / srcAspect));</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>} else {</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>return new Rect(0, 0, (int) (dstHeight * srcAspect), dstHeight);</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>} else {</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>return new Rect(0, 0, dstWidth, dstHeight);</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div>
}</div>
</div>
<div>
<br /></div>
<div>
<b>Now we can use ablove code in two ways:</b></div>
<div>
<br /></div>
<div>
<b>1.</b> If we have any image with any size and we want to show it completely inside a fixed size of imageview we can do it like:</div>
<div>
<br /></div>
<div>
<div>
Drawable drawable = Drawable.createFromPath(brandPrimaryImagePath);</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>if(null!= drawable){</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>Bitmap bitmap = ((BitmapDrawable)drawable).getBitmap();</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>Bitmap scaledBitmap = BitmapSizeHelper.createScaledBitmap(bitmap, <b>x</b>, <b>y</b>, BitmapSizeHelper.ScalingLogic.FIT);</div>
</div>
<div>
}</div>
<div>
<br /></div>
<div>
where <b>x</b>, <b>y </b>are the width and height of imageview respectively.</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<div>
<b>2. </b>If we have any image with any size and we want to show it cropped inside a fixed size of imageview we can do it like:</div>
<div>
<br /></div>
<div>
<div>
Drawable drawable = Drawable.createFromPath(brandPrimaryImagePath);</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>if(null!= drawable){</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>Bitmap bitmap = ((BitmapDrawable)drawable).getBitmap();</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>Bitmap scaledBitmap = BitmapSizeHelper.createScaledBitmap(bitmap, <b>x</b>, <b>y</b>, BitmapSizeHelper.ScalingLogic.CROP);</div>
</div>
<div>
}</div>
<div>
<br /></div>
<div>
where <b>x</b>, <b>y </b>are the width and height of imageview respectively.</div>
</div>
</div>
Income Schoolhttp://www.blogger.com/profile/03597457289839556604noreply@blogger.com0tag:blogger.com,1999:blog-7059806544727992418.post-33711697618786944802013-05-24T09:10:00.000-07:002018-12-09T21:26:56.351-08:00Adding New System Service in Android<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<h3 style="text-align: left;">
<span style="font-family: Verdana, sans-serif;">To create a custom system service in android following steps are required</span></h3>
<ol style="text-align: left;">
<li><span style="font-family: Verdana, sans-serif; line-height: 107%;">Create service </span><span style="font-family: Verdana, sans-serif; line-height: 17px;">in framework</span></li>
<li><span style="font-family: Verdana, sans-serif; line-height: 107%;">Register service in SystemServer</span></li>
<li><span style="font-family: Verdana, sans-serif; line-height: 107%;">Create a .aidl interface of the service in framework</span></li>
<li><span style="font-family: Verdana, sans-serif; line-height: 107%;">Register .aidl interface in build system</span></li>
<li><span style="font-family: Verdana, sans-serif; line-height: 107%;">Create a manager for the service </span><span style="font-family: Verdana, sans-serif; line-height: 17px;">in framework</span></li>
<li><span style="font-family: Verdana, sans-serif; line-height: 107%;">Leverage the features of the service from service manager </span></li>
<li><span style="font-family: Verdana, sans-serif; line-height: 107%;">Register the service manager in ContextImpl</span></li>
<li><span style="font-family: Verdana, sans-serif; line-height: 107%;">Register name of service manager in Context (abstract class)</span></li>
</ol>
<div>
<span style="font-family: Verdana, sans-serif;"><span style="line-height: 17px;">After performing the above steps we need to build the new SDK for using the features of service through </span></span><span style="font-family: Verdana, sans-serif; line-height: 17px;">service manager.</span></div>
<div>
<span style="font-family: Verdana, sans-serif; line-height: 17px;"><br /></span></div>
<div>
<span style="font-family: Verdana, sans-serif; line-height: 17px;"><br /></span></div>
<div>
<b><span style="font-family: Verdana, sans-serif; line-height: 17px;">1. Create service </span><span style="font-family: Verdana, sans-serif; line-height: 17px;">in framework</span></b></div>
<div>
<span style="font-family: Verdana, sans-serif; line-height: 17px;"><br /></span></div>
<div style="text-align: left;">
<span style="font-family: Verdana, sans-serif; line-height: 17px;">We need to create a service (Not an android service) in directory <a href="http://androidxref.com/4.2.2_r1/xref/frameworks/base/services/java/com/android/server/" target="_blank">/</a></span><span style="font-family: Arial, sans-serif; line-height: 107%;"><a href="http://androidxref.com/4.2.2_r1/xref/frameworks/base/services/java/com/android/server/" target="_blank">frameworks/base/services/java/com/android/server/</a> where other system service are placed.</span></div>
<div style="text-align: left;">
<span style="font-family: Arial, sans-serif; line-height: 107%;"><br /></span></div>
<div style="text-align: left;">
<span style="font-family: Arial, sans-serif;"><span style="line-height: 17px;">example code:</span></span></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
</div>
<div style="background: #F9F9F9; border: dashed #2F6FAB 1.0pt; mso-border-alt: dashed #2F6FAB .75pt; mso-element: para-border-div; padding: 12.0pt 12.0pt 12.0pt 12.0pt;">
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<i><span style="color: #666666; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">/*DemoService.java */</span></i><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<b><span style="font-family: 'Courier New'; font-size: 10pt;">package</span></b><span style="font-family: 'Courier New'; font-size: 10pt;"> </span><span style="color: #006699; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">com.android.server</span><span style="color: #339933; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">;</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<b><span style="font-family: 'Courier New'; font-size: 10pt;">import</span></b><span style="font-family: 'Courier New'; font-size: 10pt;"> </span><span style="color: #006699; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">android.content.Context</span><span style="color: #339933; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">;</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<b><span style="font-family: 'Courier New'; font-size: 10pt;">import</span></b><span style="font-family: 'Courier New'; font-size: 10pt;"> </span><span style="color: #006699; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">android.os.Handler</span><span style="color: #339933; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">;</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">import</span><span style="font-family: 'Courier New'; font-size: 10pt;">
</span><span style="color: red; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">android.os.IDemoService;</span><span style="color: #c45911; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-themecolor: accent2; mso-themeshade: 191;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<b><span style="font-family: 'Courier New'; font-size: 10pt;">import</span></b><span style="font-family: 'Courier New'; font-size: 10pt;"> </span><span style="color: #006699; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">android.os.Looper</span><span style="color: #339933; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">;</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<b><span style="font-family: 'Courier New'; font-size: 10pt;">import</span></b><span style="font-family: 'Courier New'; font-size: 10pt;"> </span><span style="color: #006699; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">android.os.Message</span><span style="color: #339933; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">;</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<b><span style="font-family: 'Courier New'; font-size: 10pt;">import</span></b><span style="font-family: 'Courier New'; font-size: 10pt;"> </span><span style="color: #006699; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">android.os.Process</span><span style="color: #339933; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">;</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<b><span style="font-family: 'Courier New'; font-size: 10pt;">import</span></b><span style="font-family: 'Courier New'; font-size: 10pt;"> </span><span style="color: #006699; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">android.util.Log</span><span style="color: #339933; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">;<o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<br /></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<b><span style="font-family: 'Courier New'; font-size: 10pt;">public</span></b><span style="font-family: 'Courier New'; font-size: 10pt;"> <b>class</b> DemoService
<b>extends</b> IDemoService.</span><a href="http://www.google.com/search?hl=en&q=allinurl%3Astub+java.sun.com&btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; text-decoration: none; text-underline: none;">Stub</span></a><span style="font-family: 'Courier New'; font-size: 10pt;"> </span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">{</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> <b>private</b> <b>static</b> <b>final</b> </span><a href="http://www.google.com/search?hl=en&q=allinurl%3Astring+java.sun.com&btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; text-decoration: none; text-underline: none;">String</span></a><span style="font-family: 'Courier New'; font-size: 10pt;"> TAG </span><span style="color: #339933; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">=</span><span style="font-family: 'Courier New'; font-size: 10pt;"> </span><span style="color: blue; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">"DemoService"</span><span style="color: #339933; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">;</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> <b>private</b> DemoWorkerThread mWorker</span><span style="color: #339933; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">;</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> <b>private</b> DemoWorkerHandler mHandler</span><span style="color: #339933; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">;</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> <b>private</b> </span><a href="http://www.google.com/search?hl=en&q=allinurl%3Acontext+java.sun.com&btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; text-decoration: none; text-underline: none;">Context</span></a><span style="font-family: 'Courier New'; font-size: 10pt;"> mContext</span><span style="color: #339933; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">;</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> <b>public</b> DemoService</span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">(</span><a href="http://www.google.com/search?hl=en&q=allinurl%3Acontext+java.sun.com&btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; text-decoration: none; text-underline: none;">Context</span></a><span style="font-family: 'Courier New'; font-size: 10pt;"> context</span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">)</span><span style="font-family: 'Courier New'; font-size: 10pt;"> </span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">{</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> <b>super</b></span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">()</span><span style="color: #339933; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">;</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> mContext </span><span style="color: #339933; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">=</span><span style="font-family: 'Courier New'; font-size: 10pt;"> context</span><span style="color: #339933; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">;</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> mWorker </span><span style="color: #339933; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">=</span><span style="font-family: 'Courier New'; font-size: 10pt;"> <b>new</b> DemoWorkerThread</span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">(</span><span style="color: blue; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">"DemoServiceWorker"</span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">)</span><span style="color: #339933; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">;</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> mWorker.</span><span style="color: #006633; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">start</span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">()</span><span style="color: #339933; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">;</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> Log.</span><span style="color: #006633; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">i</span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">(</span><span style="font-family: 'Courier New'; font-size: 10pt;">TAG, </span><span style="color: blue; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">"Spawned worker thread"</span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">)</span><span style="color: #339933; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">;</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> </span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">}</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<br /></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> <b>public</b> </span><b><span style="color: #000066; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">void</span></b><span style="font-family: 'Courier New'; font-size: 10pt;"> setData</span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">(</span><b><span style="color: #000066; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">int</span></b><span style="font-family: 'Courier New'; font-size: 10pt;"> val</span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">)</span><span style="font-family: 'Courier New'; font-size: 10pt;"> </span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">{</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> Log.</span><span style="color: #006633; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">i</span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">(</span><span style="font-family: 'Courier New'; font-size: 10pt;">TAG, </span><span style="color: blue; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">"setData "</span><span style="font-family: 'Courier New'; font-size: 10pt;">
</span><span style="color: #339933; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">+</span><span style="font-family: 'Courier New'; font-size: 10pt;">
val</span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">)</span><span style="color: #339933; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">;</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> Message msg </span><span style="color: #339933; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">=</span><span style="font-family: 'Courier New'; font-size: 10pt;"> Message.</span><span style="color: #006633; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">obtain</span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">()</span><span style="color: #339933; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">;</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> msg.</span><span style="color: #006633; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">what</span><span style="font-family: 'Courier New'; font-size: 10pt;"> </span><span style="color: #339933; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">=</span><span style="font-family: 'Courier New'; font-size: 10pt;"> DemoWorkerHandler.</span><span style="color: #006633; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">MESSAGE_SET</span><span style="color: #339933; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">;</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> msg.</span><span style="color: #006633; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">arg1</span><span style="font-family: 'Courier New'; font-size: 10pt;"> </span><span style="color: #339933; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">=</span><span style="font-family: 'Courier New'; font-size: 10pt;"> val</span><span style="color: #339933; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">;</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> mHandler.</span><span style="color: #006633; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">sendMessage</span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">(</span><span style="font-family: 'Courier New'; font-size: 10pt;">msg</span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">)</span><span style="color: #339933; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">;</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> </span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">}</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<br /></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> <b>private</b> <b>class</b> DemoWorkerThread
<b>extends</b> </span><a href="http://www.google.com/search?hl=en&q=allinurl%3Athread+java.sun.com&btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; text-decoration: none; text-underline: none;">Thread</span></a><span style="font-family: 'Courier New'; font-size: 10pt;"> </span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">{</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> <b>public</b> DemoWorkerThread</span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">(</span><a href="http://www.google.com/search?hl=en&q=allinurl%3Astring+java.sun.com&btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; text-decoration: none; text-underline: none;">String</span></a><span style="font-family: 'Courier New'; font-size: 10pt;"> name</span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">)</span><span style="font-family: 'Courier New'; font-size: 10pt;"> </span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">{</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> <b>super</b></span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">(</span><span style="font-family: 'Courier New'; font-size: 10pt;">name</span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">)</span><span style="color: #339933; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">;</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> </span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">}</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> <b>public</b> </span><b><span style="color: #000066; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">void</span></b><span style="font-family: 'Courier New'; font-size: 10pt;"> run</span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">()</span><span style="font-family: 'Courier New'; font-size: 10pt;"> </span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">{</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> Looper.</span><span style="color: #006633; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">prepare</span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">()</span><span style="color: #339933; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">;</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> mHandler </span><span style="color: #339933; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">=</span><span style="font-family: 'Courier New'; font-size: 10pt;"> <b>new</b> DemoWorkerHandler</span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">()</span><span style="color: #339933; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">;</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> Looper.</span><span style="color: #006633; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">loop</span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">()</span><span style="color: #339933; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">;</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> </span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">}</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> </span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">}</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<br /></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> <b>private</b> <b>class</b> DemoWorkerHandler
<b>extends</b> Handler </span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">{</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> <b>private</b> <b>static</b> <b>final</b>
</span><b><span style="color: #000066; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">int</span></b><span style="font-family: 'Courier New'; font-size: 10pt;">
MESSAGE_SET </span><span style="color: #339933; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">=</span><span style="font-family: 'Courier New'; font-size: 10pt;"> </span><span style="color: #cc66cc; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">0</span><span style="color: #339933; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">;</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> @Override<o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> <b>public</b> </span><b><span style="color: #000066; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">void</span></b><span style="font-family: 'Courier New'; font-size: 10pt;"> handleMessage</span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">(</span><span style="font-family: 'Courier New'; font-size: 10pt;">Message msg</span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">)</span><span style="font-family: 'Courier New'; font-size: 10pt;"> </span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">{</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> <b>try</b> </span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">{</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> <b>if</b> </span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">(</span><span style="font-family: 'Courier New'; font-size: 10pt;">msg.</span><span style="color: #006633; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">what</span><span style="font-family: 'Courier New'; font-size: 10pt;"> </span><span style="color: #339933; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">==</span><span style="font-family: 'Courier New'; font-size: 10pt;"> MESSAGE_SET</span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">)</span><span style="font-family: 'Courier New'; font-size: 10pt;"> </span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">{</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> Log.</span><span style="color: #006633; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">i</span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">(</span><span style="font-family: 'Courier New'; font-size: 10pt;">TAG,</span><span style="color: blue; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">"set message
received:"</span><span style="color: #339933; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">+</span><span style="font-family: 'Courier New'; font-size: 10pt;">msg.</span><span style="color: #006633; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">arg1</span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">)</span><span style="color: #339933; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">;</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> </span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">}</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> </span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">}</span><span style="font-family: 'Courier New'; font-size: 10pt;"> <b>catch</b> </span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">(</span><a href="http://www.google.com/search?hl=en&q=allinurl%3Aexception+java.sun.com&btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; text-decoration: none; text-underline: none;">Exception</span></a><span style="font-family: 'Courier New'; font-size: 10pt;"> e</span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">)</span><span style="font-family: 'Courier New'; font-size: 10pt;"> </span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">{</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> </span><i><span style="color: #666666; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">// Log, don't crash!<o:p></o:p></span></i></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> Log.</span><span style="color: #006633; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">e</span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">(</span><span style="font-family: 'Courier New'; font-size: 10pt;">TAG, </span><span style="color: blue; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">"Exception in handleMessage"</span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">)</span><span style="color: #339933; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">;</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> </span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">}</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> </span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">}</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> </span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">}</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">}</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
</div>
<br />
<br />
<div style="background: white; border-bottom: solid #AAAAAA 1.0pt; border: none; mso-border-bottom-alt: solid #AAAAAA .75pt; mso-element: para-border-div; padding: 0in 0in 2.0pt 0in;">
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.1in; padding: 0in;">
<div style="text-align: left;">
<b><span style="font-family: Verdana, sans-serif;">2. Register service in SystemServer</span></b></div>
</div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.1in; padding: 0in;">
<span style="font-family: Verdana, sans-serif; line-height: 17px;">We need to register our service in </span><a href="http://androidxref.com/4.2.2_r1/xref/frameworks/base/services/java/com/android/server/SystemServer.java" target="_blank">/frameworks/base/services/java/com/android/server/SystemServer.java</a><span style="font-family: Verdana, sans-serif; line-height: 17px;">, </span><span style="font-family: Arial, sans-serif; line-height: 17px;">where other system service are registered.</span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.1in; padding: 0in;">
</div>
<div style="background: #F9F9F9; border: dashed #2F6FAB 1.0pt; mso-border-alt: dashed #2F6FAB .75pt; mso-element: para-border-div; padding: 12.0pt 12.0pt 12.0pt 12.0pt;">
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<i><span style="color: #666666; font-family: 'Courier New'; font-size: 10pt;">/*SystemService.java*/</span></i></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<i><span style="color: #666666; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">/*<o:p></o:p></span></i></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<i><span style="color: #666666; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";"> * go to function
"@Override public void run()"<o:p></o:p></span></i></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<i><span style="color: #666666; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";"> * ........ <o:p></o:p></span></i></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<i><span style="color: #666666; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";"> * Add following block
after line "if (factoryTest !=</span></i><br />
<i><span style="color: #666666; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";"> * SystemServer.FACTORY_TEST_LOW_LEVEL)
{" <o:p></o:p></span></i></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<i><span style="color: #666666; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";"> */</span></i><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<br /></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<b><span style="font-family: 'Courier New'; font-size: 10pt;">try</span></b><span style="font-family: 'Courier New'; font-size: 10pt;"> </span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">{</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> Slog.</span><span style="color: #006633; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">i</span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">(</span><span style="font-family: 'Courier New'; font-size: 10pt;">TAG, </span><span style="color: blue; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">"Starting Demo Service"</span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">)</span><span style="color: #339933; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">;</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> ServiceManager.</span><span style="color: #006633; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">addService</span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">(</span><span style="color: blue; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">"demo"</span><span style="font-family: 'Courier New'; font-size: 10pt;">, <b>new</b>
DemoService</span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">(</span><span style="font-family: 'Courier New'; font-size: 10pt;">context</span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">))</span><span style="color: #339933; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">;<o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> Slog.</span><span style="color: #006633; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">i</span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">(</span><span style="font-family: 'Courier New'; font-size: 10pt;">TAG, </span><span style="color: blue; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">"Demo Service Started"</span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">)</span><span style="color: #339933; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">;</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">}</span><span style="font-family: 'Courier New'; font-size: 10pt;"> <b>catch</b> </span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">(</span><a href="http://www.google.com/search?hl=en&q=allinurl%3Athrowable+java.sun.com&btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; text-decoration: none; text-underline: none;">Throwable</span></a><span style="font-family: 'Courier New'; font-size: 10pt;"> e</span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">)</span><span style="font-family: 'Courier New'; font-size: 10pt;"> </span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">{</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> Slog.</span><span style="color: #006633; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">e</span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">(</span><span style="font-family: 'Courier New'; font-size: 10pt;">TAG, </span><span style="color: blue; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">"Failure starting DemoService Service"</span><span style="font-family: 'Courier New'; font-size: 10pt;">, e</span><span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">)</span><span style="color: #339933; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">;</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="color: #009900; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">}<o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<br />
<br /></div>
</div>
<br />
<br />
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.1in; padding: 0in;">
<span style="line-height: 17px;"><b><span style="font-family: Verdana, sans-serif;">3. Create a .aidl interface of the service in framework</span></b></span><br />
<span style="font-family: Verdana, sans-serif; line-height: 14.4pt; text-indent: -0.25in;">A service can expose set of functions that can
be access by other process/application, by esposing them in .aidl file.</span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.1in; padding: 0in;">
<span style="text-indent: -0.25in;"><span style="line-height: 14.4pt;"><span style="font-family: Verdana, sans-serif;">To expose the functions of our DemoService we need to declare them in .aidl file in any existing directory or any new directory in framework </span></span></span></div>
<div class="MsoNormal" style="border: none; margin-bottom: 0.1in; padding: 0in; text-align: left;">
<span style="font-family: Verdana, sans-serif;"><span style="font-size: 14.5pt;">Note: </span>The directory represent the package structure so if we want to add our service manager in any existing package we have to put our .aidl in that directory other wise our new directory.</span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.1in; padding: 0in;">
<span style="font-family: Verdana, sans-serif;"><span style="line-height: 14.4pt; text-indent: -24px;">(here we will be creating our .aidl in framework's existing directory for simplicity, as creating new </span><span style="line-height: 19.1875px; text-indent: -24px;">directory</span><span style="line-height: 14.4pt; text-indent: -24px;"> in framework is little complex which we will discuss later)</span></span></div>
<div class="MsoNormal" style="border: none; margin-bottom: 0.1in; padding: 0in; text-align: left;">
<span style="font-family: Verdana, sans-serif;"><span style="line-height: 14.4pt; text-indent: -24px;">So we need to create </span></span><span style="line-height: 19.1875px;"><span style="font-family: Verdana, sans-serif;">IDemoService.aidl in direcotry </span></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.1in; padding: 0in;">
</div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; line-height: 14.4pt; margin: 4.8pt 0in 6pt;">
<span style="font-family: Verdana, sans-serif;"><a href="http://androidxref.com/4.2.2_r1/xref/frameworks/base/core/java/android/os/" target="_blank">/<span id="goog_423161015"></span>frameworks/base/core/java/android/os/</a></span></div>
<br />
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.1in; padding: 0in;">
<div style="background: #F9F9F9; border: dashed #2F6FAB 1.0pt; mso-border-alt: dashed #2F6FAB .75pt; mso-element: para-border-div; padding: 12.0pt 12.0pt 12.0pt 12.0pt;">
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">/*<o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> *
aidl file :</span><br />
<span style="font-family: 'Courier New'; font-size: 10pt;"> * frameworks/base/core/java/android/os/IDemoService.aidl<o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> *
This file contains definitions of functions which are</span><br />
<span style="font-family: 'Courier New'; font-size: 10pt;"> * exposed by service.<o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> */<o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">package
android.os;<o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">/**{@hide}*/</span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">interface
IDemoService {<o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt; line-height: 13.2pt;"> </span><span style="font-family: 'Courier New'; font-size: 10pt; line-height: 13.2pt;">void setData(int val);</span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">}<o:p></o:p></span></div>
</div>
<br />
<span style="font-family: Arial, sans-serif; font-size: 14.5pt;"><br /></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.1in; padding: 0in;">
<span style="font-family: Verdana, sans-serif; line-height: 17px;"><b>4. Register .aidl interface in build system</b></span><br />
<br />
<div style="text-align: left;">
<span style="font-family: Verdana, sans-serif;">We need to register our service's aidl interface in </span><span style="background-color: #f9f9f9; line-height: 17.59375px;"><span style="font-family: Verdana, sans-serif;"><a href="http://androidxref.com/4.2.2_r1/xref/frameworks/base/Android.mk" target="_blank">frameworks/base/Android.mk</a></span></span></div>
<div style="text-align: left;">
<span style="font-family: Verdana, sans-serif;"><span style="background-color: #f9f9f9; line-height: 17.59375px;"><b>Note:</b> here we don't have to add entry of any </span><span style="background-color: white;">aidl files for parcelables if we use any in our </span></span><span style="background-color: #f9f9f9; line-height: 17.59375px;"><span style="font-family: Verdana, sans-serif;">IDemoService.aidl.</span></span></div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.1in; padding: 0in;">
<div style="background: #F9F9F9; border: dashed #2F6FAB 1.0pt; mso-border-alt: dashed #2F6FAB .75pt; mso-element: para-border-div; padding: 12.0pt 12.0pt 12.0pt 12.0pt;">
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">/*<o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> * open frameworks/base/Android.mk and add line in red </span><br />
<span style="font-family: 'Courier New'; font-size: 10pt;"> * color mentioned below </span><span style="font-family: 'Courier New'; font-size: 10pt;">which contains location of</span><br />
<span style="font-family: 'Courier New'; font-size: 10pt;"> * our .aidl </span><span style="font-family: 'Courier New'; font-size: 10pt; line-height: 13.2pt;">file.</span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;"> */<o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">...<o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">core/java/android/os/IPowerManager.aidl
\<o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="color: red; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">core/java/android/os/IDemoService.aidl
\<o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">core/java/android/os/IRemoteCallback.aidl
\<o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; margin-bottom: 0.0001pt; padding: 0in;">
<span style="font-family: 'Courier New'; font-size: 10pt;">...<o:p></o:p></span></div>
</div>
</div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.1in; padding: 0in;">
<br />
<br /></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.1in; padding: 0in;">
<b><span style="font-family: Verdana, sans-serif; line-height: 17px;">5. Create a manager for the service </span><span style="font-family: Verdana, sans-serif; line-height: 17px;">in framework</span></b></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.1in; padding: 0in;">
<span style="font-family: Arial, sans-serif;">There are two approaches to create the our service </span><span style="font-family: Verdana, sans-serif; line-height: 17px;">manager either singleton or a normal class.</span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.1in; padding: 0in;">
<span style="font-family: Arial, sans-serif;"><b style="font-size: 14.5pt;">Note:</b><span style="font-size: 14.5pt;"> </span>If we create a normal class if we use that class from application we will end up with multiple instances of our service manager (still those different instances will contain same static instance of our system service), And than to provide single instance of our service manager we need to register our service manager in </span><span style="font-family: Verdana, sans-serif;"><a href="http://androidxref.com/4.2.2_r1/xref/frameworks/base/core/java/android/app/ContextImpl.java" target="_blank"><span style="background-color: white;">/</span><span style="color: #202062;"><span style="background-color: white;">frameworks</span></span><span style="background-color: white;">/</span><span style="color: #202062;"><span style="background-color: white;">base</span></span><span style="background-color: white;">/</span><span style="color: #202062;"><span style="background-color: white;">core</span></span><span style="background-color: white;">/</span><span style="color: #202062;"><span style="background-color: white;">java</span></span><span style="background-color: white;">/</span><span style="color: #202062;"><span style="background-color: white;">android</span></span><span style="background-color: white;">/</span><span style="color: #202062;"><span style="background-color: white;">app</span></span><span style="background-color: white;">/</span><span style="color: #202062;"><span style="background-color: white;">ContextImpl.java</span></span></a> and </span><br />
<span style="font-family: Arial, sans-serif;">so to optimized and simple we will see with singleton</span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.1in; padding: 0in;">
<br /></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.1in; padding: 0in;">
<div class="MsoListParagraphCxSpFirst" style="background: white; line-height: 115%; margin-bottom: 1.2pt; margin-left: 27.0pt; mso-add-space: auto; mso-margin-top-alt: auto; text-align: justify;">
<span style="font-family: Arial, sans-serif; font-size: 9.5pt; line-height: 115%;">Below is the sample code for a</span> <span style="font-family: Arial, sans-serif; font-size: 9.5pt; line-height: 115%;">Singleton manager class:</span> <o:p></o:p></div>
<div class="MsoListParagraphCxSpLast" style="background: white; line-height: 115%; margin-bottom: 1.2pt; mso-add-space: auto; mso-margin-top-alt: auto; text-align: justify;">
<br /></div>
<div style="background: #F9F9F9; border: dashed #2F6FAB 1.0pt; margin-left: .25in; margin-right: 0in; mso-border-alt: dashed #2F6FAB .75pt; mso-element: para-border-div; padding: 12.0pt 12.0pt 12.0pt 12.0pt;">
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"><span style="color: #767171; mso-themecolor: background2; mso-themeshade: 128;">/**<o:p></o:p></span></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"><span style="color: #767171; mso-themecolor: background2; mso-themeshade: 128;">* </span><b><span style="color: #16a231;">/framework/base/core/java/android/os</span><span style="color: #0b5118; mso-style-textfill-fill-alpha: 100.0%; mso-style-textfill-fill-color: #0B5118;">/</span><span style="color: #16a231;">DemoProxy.java<o:p></o:p></span></b></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"><span style="color: grey; mso-themecolor: background1; mso-themeshade: 128;">* It will be available in framework through </span><b><span style="color: #c45911; mso-themecolor: accent2; mso-themeshade: 191;">import android.os.DemoProxy;</span></b><span style="color: #767171; mso-themecolor: background2; mso-themeshade: 128;"><o:p></o:p></span></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"><span style="color: #767171; mso-themecolor: background2; mso-themeshade: 128;">*/<o:p></o:p></span></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"><b>import</b> android.os.IBinder;<o:p></o:p></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"><b>import</b> android.os.IDemoService;<o:p></o:p></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"><b>import</b> android.os.RemoteException;<o:p></o:p></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"><b>import</b> android.util.Log;<o:p></o:p></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"><span style="color: #767171; mso-themecolor: background2; mso-themeshade: 128;">/**<o:p></o:p></span></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"><span style="color: #767171; mso-themecolor: background2; mso-themeshade: 128;"> * Use this Singleton class to call the functionality of DemoService<o:p></o:p></span></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"><span style="color: #767171; mso-themecolor: background2; mso-themeshade: 128;"> * @author shridutt.kothari<o:p></o:p></span></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"><span style="color: #767171; mso-themecolor: background2; mso-themeshade: 128;"> * It is a like a </span><span style="color: #c45911; mso-themecolor: accent2; mso-themeshade: 191;">ServiceFetcher </span><span style="color: #767171; mso-themecolor: background2; mso-themeshade: 128;">for the </span><span style="color: #c45911; mso-themecolor: accent2; mso-themeshade: 191;">ContextImpl</span><span style="color: #767171; mso-themecolor: background2; mso-themeshade: 128;">.<o:p></o:p></span></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"><span style="color: #767171; mso-themecolor: background2; mso-themeshade: 128;"> */<o:p></o:p></span></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"><b>public class</b> DemoProxy {<o:p></o:p></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"> private static final String TAG = <span style="color: blue;">"DemoProxy"</span>;<o:p></o:p></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"> private final IDemoService mDemoService;<o:p></o:p></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"> private static DemoProxy demoProxy;<o:p></o:p></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"><o:p> </o:p></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"> <span style="color: #767171; mso-themecolor: background2; mso-themeshade: 128;">/** Get a handle to the DemoService.<o:p></o:p></span></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"><span style="color: #767171; mso-themecolor: background2; mso-themeshade: 128;"> * @return the DemoService, or null.<o:p></o:p></span></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"><span style="color: #767171; mso-themecolor: background2; mso-themeshade: 128;"> */<o:p></o:p></span></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"> <b>public static synchronized</b> DemoProxy getDemoProxy<span style="color: #517d33;">()</span> {<o:p></o:p></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"> if(DemoProxy == null) {<o:p></o:p></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"> IBinder binder = android.os.<span style="color: #2e74b5; mso-themecolor: accent1; mso-themeshade: 191;">ServiceManager</span>.<span style="color: #517d33;">getService(</span><span style="color: blue;">"demo"</span><span style="color: #517d33;">);</span><o:p></o:p></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"> <b>if</b>(binder != null) {<o:p></o:p></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"> IDemoService managerService = IDemoService.<span style="color: #2e74b5; mso-themecolor: accent1; mso-themeshade: 191;">Stub</span>.<span style="color: #517d33;">asInterface(</span>binder<span style="color: #517d33;">);</span><o:p></o:p></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"> demoProxy = new DemoProxy<span style="color: #517d33;">(</span>managerService<span style="color: #517d33;">);</span><o:p></o:p></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"> } <b>else</b> {<o:p></o:p></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"> Log.<span style="color: #517d33;">e(</span>TAG, <span style="color: blue;">"DemoService binder is null"</span><span style="color: #517d33;">);</span><o:p></o:p></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"> }<o:p></o:p></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"> }<o:p></o:p></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"> <b>return</b> demoProxy;<o:p></o:p></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"> }<o:p></o:p></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"><o:p> </o:p></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"> <span style="color: #767171; mso-themecolor: background2; mso-themeshade: 128;">/**<o:p></o:p></span></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"><span style="color: #767171; mso-themecolor: background2; mso-themeshade: 128;"> * Use {@link #getDemoProxy} to get the demoProxy instance.<o:p></o:p></span></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"><span style="color: #767171; mso-themecolor: background2; mso-themeshade: 128;"> */<o:p></o:p></span></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"> DemoProxy(IDemoService demoService) {<o:p></o:p></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"> if(demoService == null){<o:p></o:p></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"> <b>throw</b> new IllegalArgumentException<span style="color: #517d33;">(</span><span style="color: blue;">"demo service is null"</span><span style="color: #517d33;">);</span><o:p></o:p></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"> }<o:p></o:p></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"> mDemoService = demoService;<o:p></o:p></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"> }<o:p></o:p></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"> <span style="color: #767171; mso-themecolor: background2; mso-themeshade: 128;">/**<o:p></o:p></span></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"><span style="color: #767171; mso-themecolor: background2; mso-themeshade: 128;"> * Sets the value in demoService <o:p></o:p></span></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"><span style="color: #767171; mso-themecolor: background2; mso-themeshade: 128;"> * @param arg<o:p></o:p></span></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"><span style="color: #767171; mso-themecolor: background2; mso-themeshade: 128;"> */<o:p></o:p></span></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"> <b>public void</b> setData(int arg){<o:p></o:p></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"> <b>try</b>{<o:p></o:p></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"> Log.<span style="color: #517d33;">d(</span>TAG, <span style="color: blue;">"Going to call service from framework proxy"</span><span style="color: #517d33;">);</span><o:p></o:p></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"> m<span style="font-family: 'Courier New'; font-size: 13px; white-space: normal;">DemoService</span>.<span style="color: #385623; mso-themecolor: accent6; mso-themeshade: 128;">setData</span>(arg);<o:p></o:p></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"> Log.<span style="color: #517d33;">d(</span>TAG, <span style="color: blue;">"Service called successfully from framework proxy"</span><span style="color: #517d33;">);</span><o:p></o:p></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"> } <b>catch</b> (Exception e) {<o:p></o:p></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"> Log.<span style="color: #517d33;">d(</span>TAG, <span style="color: blue;">"FAILED to call service from framework proxy"</span><span style="color: #517d33;">);</span><o:p></o:p></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"> e.printStackTrace<span style="color: #517d33;">();<o:p></o:p></span></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"> }<o:p></o:p></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"> }<o:p></o:p></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"> <span style="color: grey; mso-themecolor: background1; mso-themeshade: 128;">/**<o:p></o:p></span></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"><span style="color: grey; mso-themecolor: background1; mso-themeshade: 128;"> * Get the binder of IDemoService.<o:p></o:p></span></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"><span style="color: grey; mso-themecolor: background1; mso-themeshade: 128;"> */<o:p></o:p></span></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"> <b>public I</b><b>DemoService</b> getDemoService(){<o:p></o:p></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"><b> </b>mDemoService;<b><o:p></o:p></b></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"><b> }</b><o:p></o:p></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"> <o:p></o:p></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;">}</pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"><span style="font-family: Verdana, sans-serif;">Now 3<sup>rd </sup>party apps can call getDemoService().setData(); method.</span></pre>
</div>
<div class="MsoNormal" style="margin-top: 12.0pt;">
<span style="font-family: Verdana, sans-serif; line-height: 17px;"><br /></span><span style="font-family: Verdana, sans-serif; line-height: 17px;"><b>6. Leverage the features of the service from service manager</b> </span></div>
</div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.1in; padding: 0in;">
<div style="text-align: left;">
<span style="font-family: Verdana, sans-serif;">We see in above code snippet <span style="color: blue;">setData (int arg)</span> method is to leverage the feature of our custom service, As we have called <span style="color: blue;">mDemoService.<span style="color: #385623; mso-themecolor: accent6; mso-themeshade: 128;">setData</span>(arg);</span> inside <span style="color: blue;">setData </span>method of our service manager (i.e. <span style="color: #b45f06;">DemoProxy</span>)</span></div>
<br />
<br />
<span style="font-family: Verdana, sans-serif; line-height: 17px;"><b>7. Register the service manager in ContextImpl</b></span><br />
<span style="font-family: Verdana, sans-serif; line-height: 17px;"><b><br /></b></span>
<br />
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Verdana, sans-serif;"><span style="font-family: "Verdana","sans-serif"; font-size: 12.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman";">Now
applications will be able to get the instance of our service manager with
the <span style="color: blue;">DemoProxy.getDemoProxy();</span> But if
our service manager is not a singleton class we need to register it in <span style="color: #783f04;">ContextImpl </span>so that applications can get
instance of service manger like <span style="color: blue;">Context.getSystemService("service_name");</span></span><span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";"><o:p></o:p></span></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: "Verdana","sans-serif"; font-size: 12.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman";"><br />
</span><span style="font-family: Verdana, sans-serif; font-size: 12.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman";">Now
our service, aidl of service, service manager all things are created, so we
need to write following code in <a href="http://androidxref.com/4.2.2_r1/xref/frameworks/base/core/java/android/app/ContextImpl.java"><span style="background: white; color: blue;">/</span><span style="background: white; color: #202062;">frameworks</span><span style="background: white; color: blue;">/</span><span style="background: white; color: #202062;">base</span><span style="background: white; color: blue;">/</span><span style="background: white; color: #202062;">core</span><span style="background: white; color: blue;">/</span><span style="background: white; color: #202062;">java</span><span style="background: white; color: blue;">/</span><span style="background: white; color: #202062;">android</span><span style="background: white; color: blue;">/</span><span style="background: white; color: #202062;">app</span><span style="background: white; color: blue;">/</span><span style="background: white; color: #202062;">ContextImpl.java</span></a> file in the static
block: </span><span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div style="background: #F9F9F9; border: dashed #2F6FAB 1.0pt; mso-border-alt: dashed #2F6FAB .75pt; mso-element: para-border-div; padding: 12.0pt 12.0pt 12.0pt 12.0pt;">
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"><span style="color: #767171; mso-themecolor: background2; mso-themeshade: 128;">/**<o:p></o:p></span></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"><span style="color: #767171; mso-themecolor: background2; mso-themeshade: 128;"> * In /frameworks/base/core/java/android/app/ContextImpl.java<o:p></o:p></span></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"><span style="color: #767171; mso-themecolor: background2; mso-themeshade: 128;"> * inside the static block we need to register our ServiceFetcher like this:<o:p></o:p></span></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"><span style="color: #767171; mso-themecolor: background2; mso-themeshade: 128;"> */<o:p></o:p></span></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;">registerService(<span style="color: blue; font-family: 'Times New Roman'; white-space: normal;">DEMO_SERVICE </span>, new ServiceFetcher() {<span style="color: #767171; mso-themecolor: background2; mso-themeshade: 128;"><o:p></o:p></span></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"> public Object createService(ContextImpl ctx) {<o:p></o:p></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"> return DemoProxy.getDemoProxy(); <o:p></o:p></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;">/**<o:p></o:p></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"> * Or we can create new object of it, if DemoProxy is not a singleton class.<o:p></o:p></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"> * see other registered Services for example.<o:p></o:p></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;"> */<o:p></o:p></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 13.2pt; padding: 0in;">}});<o:p></o:p></pre>
</div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br />
<br /></div>
<div class="MsoNormal" style="line-height: 13.2pt; margin-bottom: .0001pt; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<b style="font-family: Verdana, sans-serif; line-height: 17px;">8. Register name of the our service manager in Context (abstract class)</b></div>
<div class="MsoNormal" style="line-height: 12.75pt; margin-bottom: .0001pt; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: 13.2pt; margin-bottom: .0001pt; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: Verdana, sans-serif;"><span style="font-size: 10pt;">Now we need
to add entry of </span><span style="color: blue; mso-ascii-font-family: Calibri; mso-bidi-font-family: "Courier New"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">DEMO_SERVICE </span>as a constant in file <span style="font-size: 10pt;"><o:p></o:p></span></span></div>
<div class="MsoNormal" style="line-height: 12.75pt; margin-bottom: .0001pt; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: 13.2pt; margin-bottom: .0001pt; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: Verdana, sans-serif; font-size: 10pt;"><span style="color: blue;"><a href="http://androidxref.com/4.2.2_r1/xref/frameworks/base/core/java/android/content/Context.java">/frameworks/base/core/java/android/content/Context.java</a></span></span></div>
<div class="MsoNormal" style="line-height: 13.2pt; margin-bottom: .0001pt; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<b style="line-height: 13.2pt;"><span style="font-family: Verdana, sans-serif; font-size: 10pt;"><br /></span></b></div>
<div style="background: #F9F9F9; border: dashed #2F6FAB 1.0pt; mso-border-alt: dashed #2F6FAB .75pt; mso-element: para-border-div; padding: 12.0pt 12.0pt 12.0pt 12.0pt;">
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; padding: 0in;"><span style="color: #767171; mso-themecolor: background2; mso-themeshade: 128;">/** inside /frameworks/base/core/java/android/content/Context.java. */<o:p></o:p></span></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; padding: 0in;"><span style="color: #767171; mso-themecolor: background2; mso-themeshade: 128;">/**<o:p></o:p></span></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; padding: 0in;"><span style="color: #767171; mso-themecolor: background2; mso-themeshade: 128;"> * Use with {@link #getSystemService} to retrieve a<o:p></o:p></span></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; padding: 0in;"><span style="color: #767171; mso-themecolor: background2; mso-themeshade: 128;"> * {@link android.os.DemoProxy} for using DemoService<o:p></o:p></span></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; padding: 0in;"><span style="color: #767171; mso-themecolor: background2; mso-themeshade: 128;"> *<o:p></o:p></span></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; padding: 0in;"><span style="color: #767171; mso-themecolor: background2; mso-themeshade: 128;"> * @see #getSystemService<o:p></o:p></span></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; padding: 0in;"><span style="color: #767171; mso-themecolor: background2; mso-themeshade: 128;"> * @hide<o:p></o:p></span></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; padding: 0in;"><span style="color: #767171; mso-themecolor: background2; mso-themeshade: 128;"> */<o:p></o:p></span></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; padding: 0in;"> <span style="color: blue;">public static final</span> String DEMO_SERVICE = <span style="color: blue;">"demo"</span>;<o:p></o:p></pre>
</div>
<div class="MsoNormal" style="line-height: 13.2pt; margin-bottom: .0001pt; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<b style="line-height: 13.2pt;"><span style="font-family: Verdana, sans-serif; font-size: 10pt;"><br /></span></b></div>
<div class="MsoNormal" style="line-height: 13.2pt; margin-bottom: .0001pt; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<b style="line-height: 13.2pt;"><span style="font-family: Verdana, sans-serif; font-size: 10pt;">After all the
above steps we just need to build our custom </span></b></div>
<div class="MsoNormal" style="line-height: 13.2pt; margin-bottom: .0001pt; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<b><span style="font-family: Verdana, sans-serif; font-size: 10pt;">sdk and
than, we can use the service manager in applications like:</span></b><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: 13.2pt; margin-bottom: .0001pt; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<b><span style="font-family: Verdana, sans-serif; font-size: 10pt;"><br /></span></b></div>
<br />
<div class="MsoNormal" style="line-height: 13.2pt; margin-bottom: .0001pt; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: #783f04; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-fareast-font-family: "Times New Roman";">DemoProxy </span><span style="font-family: Verdana, sans-serif; font-size: 10pt;">dm= (</span><span style="color: #783f04; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-fareast-font-family: "Times New Roman";">DemoProxy</span><span style="font-family: Verdana, sans-serif; font-size: 10pt;">)
getApplicatioContext().getSystemService(Context.</span><span style="color: blue; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-fareast-font-family: "Times New Roman";">DEMO_SERVICE</span><span style="font-family: Verdana, sans-serif; font-size: 10pt;">);</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: 13.2pt; margin-bottom: .0001pt; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: Verdana, sans-serif; font-size: 10pt;"><br /></span></div>
<div class="MsoNormal" style="line-height: 13.2pt; margin-bottom: .0001pt; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: Verdana, sans-serif; font-size: 10pt;"><br /></span></div>
<div class="MsoNormal" style="line-height: 13.2pt; margin-bottom: .0001pt; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: Verdana, sans-serif; font-size: 10pt;"><br /></span></div>
<div class="MsoNormal" style="line-height: 13.2pt; margin-bottom: .0001pt; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: Verdana, sans-serif; font-size: 10pt;"><br /></span></div>
<div class="MsoNormal" style="line-height: 13.2pt; margin-bottom: .0001pt; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: Verdana, sans-serif; font-size: 10pt;"><br /></span></div>
<div class="MsoNormal" style="line-height: 13.2pt; margin-bottom: .0001pt; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: Verdana, sans-serif; font-size: 10pt;"><br /></span></div>
<div class="MsoNormal" style="line-height: 13.2pt; margin-bottom: .0001pt; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: Verdana, sans-serif; font-size: 10pt;"><br /></span></div>
</div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; margin-bottom: 0.1in; padding: 0in;">
<pre style="border: none; line-height: 13.2pt; padding: 0in;"></pre>
</div>
</div>
</div>
Income Schoolhttp://www.blogger.com/profile/03597457289839556604noreply@blogger.com2