[Spirit FM] mikereidis:
This is an early document, for further details see: "Dec 19 Spirit2 design details": http://xdaforums.com/showthread.php?p=35571087

Next Gen: Spirit2

After almost 2 years, Spirit FM (Spirit1 or version 1) is "mature". Among over 10,000 paid customers, many have been happy to run Spirit on 2-4 generations of phones.

From HTC Legends, Desires and Nexus1's running Android 2.1 Eclair, to OneX, Galaxy S, S2, and now S3 & Note2 running Android 4.2 Jellybean.

Spirit1 was not designed much, it was rapidly built using an open source app as it's base. This enabled a quick implementation on many phones, ROMs, etc.

A lot of quick hacks has accumulated, and now it's difficult to change or cleanup many sections of code without creating bugs on some phone and ROM combinations.

It's time to start fresh and design and build Spirit2 "properly".

I'll create a system to enable new settings/options in a few minutes, instead of an hour or more, editing 5 or 6 different files.

The code will be much cleaner, efficient and bug free when it doesn't have to support 7 different versions of Android, 200 different phones and 10 different FM APIs.

Spirit1 Future

Spirit1 will not disappear. Support will continue, but I can't guarantee I'll be able to make it work on old (3-4 year) phones running Android 4.2 JellyBean, for example.

No major new functions will likely be added to Spirit1. For example, FM record may remain an experimental test option, but will not be supported.

I will continue to make and release some minor bug and compatibility fixes; timing & extent to be determined. My focus will be on Spirit2, the future.

I hope those disappointed will eventually appreciate my decision to focus on the future when they get a new device.

I expect to cease sales of Spirit1 at some time; maybe in months or maybe years. At present, Google doesn't provide a good way to do this, and still allow

existing customers to re-download. AFAICT we can only set the price to high values, such as $99.99 or $249. If you ever see such a price on Spirit1 Light,

or Light & Unlocked, don't be appalled. It just means I wish to stop new sales while keeping existing customers happy.

In the short term, Spirit1 might even become a testing ground for Spirit2. Before a device is officially supported by Spirit2, it may be enabled on Spirit1.

Sometimes I get several reports that a new phone works OK. Then after some time, major problems become evident that make me regret calling the device supported,

especially for rarer devices.

Spirit2 Plans

Plans are always subject to change. Gotta be nimble. :)

Spirit2 will be available on Google Play around January, 2013. Beta versions will be available earlier, linked on a new XDA thread.

No Light version is planned, but a free version may be. Price should be the same as Spirit1 Unlocked.

Existing Spirit1 Unlocked customers can upgrade at no cost to Spirit2. Spirit2 isn't about making you pay twice.

But if you feel generous and appreciative of my support over the last few years, I'd be happy if you made a 2nd purchase.

Or as some appreciative users have, a 3rd, via Light or an additional tip/donation. :)

The upgrade path from Light to Spirit1 Unlocked, or to Spirit2, or from Unlocked to Spirit2 is the same. I cancel your original order, even 2 years later, and you get

a full refund. Then you simply buy the new version. You can email me for special needs, such as needing 2 versions for different phones.

I cancel any order at any time on request anyway, so this is nothing new.

Spirit2 will focus on a smaller number of popular phones among custom ROM developers and users. I will only support phones that I own for testing, and those with

very similar architectures. The 80/20 rule applies here, and focusing on 20% of the phones, for 80% coverage just makes sense.

If you want to run Spirit2, I recommend popular high end devices, mostly from Samsung and HTC. I'll be happy to make exceptions for other OEMs with popular higher end

phones, or phones with a similar architecture. For example, LG Optimus G and some Motorola devices have the same S3/S4/+ Qualcomm FM/audio architecture as HTC OneX LTE.

Spirit2 Design

Spirit2 design started November, 2012, after a 12 month delay from original plans. :)

Spirit2 will support digital audio features, such as FM recording, Bluetooth, VU meters and who knows what, possibly including visualizations and audio analysis.

Phones that are not capable of digital audio features likely won't be supported. Thankfully, the wildly popular GS2 GT-i9100 is now proven to support digital FM audio.

Unchanged from my original 2011 plan, Spirit will use and support the ST-Ericsson proposed Android FM API, hereafter referred to as "Android FM API", despite it's

mere "proposed" status. The Android FM API was first proposed over 2 years ago now, and seems to slowly be making it's way into AOSP. It's slow progress,

and uncertain future, has disappointed me. I hope that Spirit2 will help this FM API gain support from

phone and FM chip OEMs, as well as other 3rd party app developers.

Many Sony 2012 phones support this API already, on devices based on ST-Ericsson, Broadcom and Qualcomm FM chips at least. So stock, unrooted Sony devices should be

well supported, in theory at least. I'm not committing to official Sony support at this time however.

This API is similar to other "OEM Proprietary FM APIa" that don't need SU/root. But it's not proprietary, it's openly documented & uses open source code.

Other "OEM Proprietary" APIs will likely not be supported. Spirit2 will retain a focus on custom AOSP type ROMs that are incapable of running stock FM apps.

Support for different FM chips will be via plugins, exactly as specified for use with the Android FM API.

Unless and until phone or chip OEMs supply suitable FM chip plugins, Spirit2 will provide them. Sony has at least 3 plugins, but it's not clear if Sony can or would

allow their free re-distribution for other devices.

Third party developers will be able to write apps using the open, rich & documented Android FM API.

They will be able to run as standalone apps, widgets, etc. without Spirit2, on devices such as the Sony's that support this API (or a slight derivative).

On devices that do not support this API natively, 3rd party apps will be able to call compatible functions in the bottom-half, service portion of Spirit2.

They won't have to bother with tedious, boring stuff such as configuration, as the top-half, app/GUI portion of Spirit2 can handle that.

Or they could provide their own configuration mechanisms and do anything that Spirit2 does.

I hope that custom ROMs will be built using the Android FM API AOSP code, and support FM natively within their audio libraries and frameworks.

But I can't count on this anytime soon, so Spirit2 will do it's best to emulate functionality that is ideally done in the internals of a ROM.

This is the current situation with Spirit1 on many custom ROMs and it requires LOTS of effort and can never be perfect.

"FM Chip control" is just one part of the Android FM API. The other major component is audio routing and control. Audio has been the major challenge of Spirit1.

The FM chip/API code has changed very little during 2012.

A device that fully supports the Android FM API makes audio issues quite simple. The app can simply start or stop the audio with easy functions. Complexities like

volume control, headset cable media buttons, lockscreen controls, and possibly A2DP Bluetooth support can be taken care of by the framework of the ROM.

Even FM recording should be simple, on devices that support it. Spirit1 supports a simple FM record function, but it only works on devices like GS3 at present.

But Spirit2 will remain a more or less normal SU/root app, as Spirit1 is. I'm one person & don't have the resources to get involved in building kernels, libraries,

frameworks and ROMs. So Spirit2 will have components that replicate, as best it can, a proper system service for handling FM and FM related audio.

It seems to make sense to design & build a plugin mechanism for handling FM audio, similar in concept to the FM chip plugin for the Android FM API.

The Android FM API chip plugin, a library file such as libfmradio.cg2900.so, is oriented to code at the C/C++/JNI layer of Android/Java.

The Spirit2 audio system plugin is more likely to be done at the Java level, as there are many Android Java APIs that are required or useful.

Hypothetically, Spirit2 could run even on officially unsupported phones, if someone has or writes an FM plugin and an audio plugin.

Many FM chips could be supported, with at least basic features, by a single generic V4L FM plugin. A simple generic audio plugin could be created

that would rely on configurable "reflected" Java APIs or shell scripts etc. The "real world" however, is messier than this might imply.

Some portions of Spirit2 will be open sourced. Details to be determined.

EDIT: Which phones/architectures will Spirit2 support ?

Tentative, but:

Galaxy S3/Note2

Galaxy S2/Note

OneX International

OneS/X LTE, Evo 4G LTE & similar S3/S4/+ + WCN3660 + WCD9310. Might include Optimus G, Motorola.

Any Nexus capable of FM. Nexus 4 ? 10 ?

Sony 2012's maybe, since they support this API when stock.

I'm keeping an eye on popularity & compatibility of Motorola Razr I.