{"id":61,"date":"2013-10-16T15:36:28","date_gmt":"2013-10-16T14:36:28","guid":{"rendered":"http:\/\/www.sarbyn.com\/tech\/?p=61"},"modified":"2014-01-01T16:11:20","modified_gmt":"2014-01-01T15:11:20","slug":"start-android-aosp-cyanogenmod-development-the-firsts-steps","status":"publish","type":"post","link":"https:\/\/www.sarbyn.com\/blog\/2013\/10\/16\/start-android-aosp-cyanogenmod-development-the-firsts-steps\/","title":{"rendered":"Start android AOSP &#8211; CyanogenMod development : the firsts steps"},"content":{"rendered":"<p>I&#8217;m still waiting for my 9$ Arduino&#8230;some mistake in Hong Kong customs procedure has generated a huge delay in shipment.<\/p>\n<p>But finally I found an &#8220;idea&#8221; for some Cyanogen development, and I want to share here the steps that I&#8217;m doing.<\/p>\n<h2>The Goal<\/h2>\n<p>At work I&#8217;m working on a feature that requires frequent &#8220;Force stop&#8221; and &#8220;Clear data&#8221; during the debug and development phase. I want to improve the &#8220;Application info&#8221; popup menu on the notification area (long click on the app notification) in order to add two new item: &#8220;Force Stop&#8221; and &#8220;Clear data&#8221;.<\/p>\n<h2>The Player<\/h2>\n<ul>\n<ul>\n<li>At the moment the Nexus S is not available, so I will use the ugliest android phone ever seen: the Motorola Defy (MB 526), aka &#8220;Jordan&#8221; &#8211; <a href=\"http:\/\/www.gsmarena.com\/motorola_defy+-4098.php\">specs<\/a> (From GSM arena)<\/li>\n<\/ul>\n<\/ul>\n<p><a href=\"https:\/\/i0.wp.com\/www.sarbyn.com\/tech\/wp-content\/uploads\/2013\/10\/wpid-wp-1381835151224.jpg\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"alignnone \" title=\"wp-1381835151224.jpg\" alt=\"image\" src=\"https:\/\/i0.wp.com\/www.sarbyn.com\/tech\/wp-content\/uploads\/2013\/10\/wpid-wp-1381835151224.jpg?resize=225%2C300\" width=\"225\" height=\"300\" \/><\/a><\/p>\n<ul>\n<ul>\n<li>I will use the CyanogenMod fork by\u00a0Quarx2k, based on Android JB 4.1.2 &#8211; <a href=\"http:\/\/forum.xda-developers.com\/showthread.php?t=1593117\">XDA forum post<\/a><\/li>\n<li>My old development machine @ work &#8211; a Dell studio XPS with Ubuntu 12.04 LTS<\/li>\n<\/ul>\n<\/ul>\n<p><a href=\"https:\/\/i0.wp.com\/www.sarbyn.com\/tech\/wp-content\/uploads\/2013\/10\/wpid-wp-1381834973687.jpg\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"alignnone \" title=\"wp-1381834973687.jpg\" alt=\"image\" src=\"https:\/\/i0.wp.com\/www.sarbyn.com\/tech\/wp-content\/uploads\/2013\/10\/wpid-wp-1381834973687.jpg?resize=225%2C300\" width=\"225\" height=\"300\" \/><\/a><\/p>\n<h2>Step 0 : setup the development environment<\/h2>\n<p>Simply follow the post on XDA forum. After a few hours you should have your standard build from JB sources<\/p>\n<h2>Step 1 : setup a new github repo<\/h2>\n<p>I need to modify the &#8220;<strong>frameworks\/base<\/strong>&#8221; project, because the notification area sources are in &#8220;<strong>frameworks\/base\/packages\/SystemUI<\/strong>&#8221; folder. \u00a0Simply go to &#8220;<a href=\"https:\/\/github.com\/Quarx2k\/android_frameworks_base\">https:\/\/github.com\/Quarx2k\/android_frameworks_base<\/a>&#8221; and fork this repository. My forked repo location is &#8220;<a href=\"https:\/\/github.com\/sarbyn\/android_frameworks_base_jordan\">https:\/\/github.com\/sarbyn\/android_frameworks_base_jordan<\/a>&#8221;<\/p>\n<p>Now you need to add a &#8220;<strong>local_manifest.xml<\/strong>&#8221; in your<strong> .repo\/local_manifests<\/strong> folder, in which you must define the new repository:<\/p>\n<pre class=\"brush: xml; title: local_manifest.xml; notranslate\" title=\"local_manifest.xml\">\r\n&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;\r\n   &lt;manifest&gt;\r\n   &lt;remove-project name=&quot;Quarx2k\/android_frameworks\/base&quot;\/&gt;\r\n   &lt;project remote=&quot;github&quot; path=&quot;frameworks\/base&quot; name=&quot;sarbyn\/android_frameworks_base_jordan&quot; revision=&quot;jellybean&quot;\/&gt;\r\n&lt;\/manifest&gt;\r\n<\/pre>\n<p>A simple explanation (from CM wiki)<\/p>\n<ul>\n<li>remote &#8212; the name of the remote. this can be one that was defined in either the regular manifest or local_manifest.xml.<\/li>\n<li>name &#8212; the name of the git project&#8211; for github it has the format account_name\/project_name.<\/li>\n<li>path &#8212; where the git repository should go in your local copy of the source code.<\/li>\n<li>revision &#8212; (OPTIONAL) which branch or tag to use in the repository.<\/li>\n<\/ul>\n<p>Now you are ready to &#8220;<strong>repo sync<\/strong>&#8221; your source tree.<\/p>\n<h2>Step 2 : start editing<\/h2>\n<p>Before you change anything you need to start a new git branch. Go into the main project folder and do a &#8220;<strong>repo start banchname frameworks\/base<\/strong>&#8220;. Now you are ready to modify the code in a new git branch.<\/p>\n<h2>Step 3 : build<\/h2>\n<p>When all the development is done, do a full build with the standard procedure<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsource build\/envsetup.sh &amp;&amp; brunch mb526\r\nmake -j# bacon\r\n<\/pre>\n<p># represents double the cores you have on your computer<\/p>\n<h2>Step 4 : commit and push on github repo<\/h2>\n<p>Enter in <strong>frameworks\/base<\/strong> and check the repo status with <strong>git status<\/strong>. Add all the modified files with the standard <strong>git add FILENAME<\/strong> and commit the changes with <strong>git commit -m &#8216;message&#8217;<\/strong>. Now you are ready to upload the new git branch on server <strong> git push -u github branch_name<\/strong><\/p>\n<h2>Step 5 : backup &amp; install<\/h2>\n<p>The last step is very simple: go into recovery mode and do a full Nandroid backup. After that you can flash your build and try if it works \ud83d\ude42<\/p>\n<div id=\"attachment_75\" style=\"width: 178px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/i0.wp.com\/www.sarbyn.com\/tech\/wp-content\/uploads\/2013\/10\/device-2013-10-16-162557.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-75\" class=\"size-medium wp-image-75\" alt=\"EUREKA!\" src=\"https:\/\/i0.wp.com\/www.sarbyn.com\/tech\/wp-content\/uploads\/2013\/10\/device-2013-10-16-162557-168x300.png?resize=168%2C300\" width=\"168\" height=\"300\" srcset=\"https:\/\/i0.wp.com\/www.sarbyn.com\/blog\/wp-content\/uploads\/2013\/10\/device-2013-10-16-162557.png?resize=168%2C300&amp;ssl=1 168w, https:\/\/i0.wp.com\/www.sarbyn.com\/blog\/wp-content\/uploads\/2013\/10\/device-2013-10-16-162557.png?w=480&amp;ssl=1 480w\" sizes=\"(max-width: 168px) 100vw, 168px\" \/><\/a><p id=\"caption-attachment-75\" class=\"wp-caption-text\">EUREKA!<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m still waiting for my 9$ Arduino&#8230;some mistake in Hong Kong customs procedure has generated a huge delay in shipment. But finally I found an &#8220;idea&#8221; for some Cyanogen development, and I want to share here the steps that I&#8217;m doing. The Goal At work I&#8217;m working on a feature that requires frequent &#8220;Force stop&#8221; <a class=\"read-more\" href=\"https:\/\/www.sarbyn.com\/blog\/2013\/10\/16\/start-android-aosp-cyanogenmod-development-the-firsts-steps\/\">&hellip;&nbsp;<span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[5],"tags":[75,30,22,29],"class_list":["post-61","post","type-post","status-publish","format-standard","hentry","category-android","tag-android","tag-aosp","tag-cyanogenmod","tag-repo"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p3JApm-Z","jetpack_likes_enabled":true,"jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.sarbyn.com\/blog\/wp-json\/wp\/v2\/posts\/61"}],"collection":[{"href":"https:\/\/www.sarbyn.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sarbyn.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sarbyn.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sarbyn.com\/blog\/wp-json\/wp\/v2\/comments?post=61"}],"version-history":[{"count":15,"href":"https:\/\/www.sarbyn.com\/blog\/wp-json\/wp\/v2\/posts\/61\/revisions"}],"predecessor-version":[{"id":80,"href":"https:\/\/www.sarbyn.com\/blog\/wp-json\/wp\/v2\/posts\/61\/revisions\/80"}],"wp:attachment":[{"href":"https:\/\/www.sarbyn.com\/blog\/wp-json\/wp\/v2\/media?parent=61"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sarbyn.com\/blog\/wp-json\/wp\/v2\/categories?post=61"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sarbyn.com\/blog\/wp-json\/wp\/v2\/tags?post=61"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}