Friday 28 June 2013

Revolution Toolbox

There is something amazing coming for all Android Revolution HD users. But not only. Every Android user would be able to use it!

I will just leave it here... ;)


Hint: Logo





Hint: App drawer icon




Have any questions or comments? Feel free to share! Also, if you like this article, please use media sharing buttons (Twitter, G+, Facebook) down this post!

Wednesday 26 June 2013

Friday 14 June 2013

Do we really need S-OFF?

Lately there has been a lot of confusion about if we - HTC users - really need S-OFF on our devices. I think it's time to make this case as clear as possible, and clear up any remaining doubts.

First of all, S-OFF stands for "Security OFF" and S-ON for "Security ON". It's a term specific to HTC devices (and refers to digital signature checking on the bootloader "hboot"). Retail devices always come with SHIP S-ON locked bootloaders. Hboot can also be found in an engineering version (ENG as opposed to SHIP), but it's not easy to get such a device.

You should also know the "fastboot" term: it is a diagnostic protocol used primarily to modify the flash filesystem via a USB connection from host computer. After enabling the protocol on the device itself (entering "fastboot" mode from inside the bootloader), it will accept a specific set of commands sent to it via USB using a command line, for example "fastboot flash boot boot.img" or "fastboot erase cache".


What's the main difference between S-ON and S-OFF from the end-user point of view?


With S-OFF you can:

  • Flash in fastboot original parts of the firmware like: Trust Zone (tz.img), Resource Power Manager (rpm.img), Advanced Digital Signal Processor (adsp.img), bootloader (hboot.img), Radio Config Data (rcdata.img), Splash Screen and others, very often device specific firmware like Consumer IR (cir.img) for the television remote controller in HTC One.
  • Flash in fastboot custom parts of the firmware above, however I've never seen in my life anyone compiling custom rpm.img or tz.img. I've seen custom bootloaders and Splash Screens only. You can also flash modified radio.img but there is rarely anyone out there who does this.
  • Use more advanced fastboot commands, for example you can change the CID (Carrier ID) of your device or even MID (Model ID). And this one is the most important one in the context of this article.
  • Reset the Tampered flag, so your device does not show up as "Relocked" if you relock your bootloader.

For about 2 years you have been able to unlock bootloaders of selected HTC devices on the htcdev.com webpage. Unlocking your bootloader results in an "UNLOCKED" message in the bootloader screen, and allows you to use some of the fastboot commands. For example system, boot and recovery partitions are no longer locked and you can flash a custom boot or recovery onto your device. This doesn't mean S-OFF, but it does give you some more control over your device.

Sometimes there are differences specific to the SoC ("System on a Chip") of each device. Both HTC One X and One X+ (nVidia Tegra 3) have locked out the capability to flash the boot partition from inside recovery, even if your bootloader is unlocked. It is possible to flash the boot partition only via the "fastboot flash boot <boot image name>" command. On the newest HTC smartphone - HTC One (Qualcomm Snapdragon S600) you can use either fastboot or adb shell (dd if=/... of=/...) to write the boot partition.

Do we really need S-OFF?

No, we don't. So what do we need? Because we surely need something. But to understand what we need, it's important to realize where the problem is first.

First of all, comparing HTC devices with Nexus devices is a pointless activity. Never do that. Why? Because they are all S-ON (they call it Secure Boot), and updates for Nexus devices contain the following (based on my experience with Samsung Galaxy Nexus):
  1. bootloader.img
  2. recovery.img
  3. GSM radio
  4. CDMA radio (in case of CDMA device)
That's all. On Nexus device you can flash the original bootloader or radio using the "package_extract_file" command in the updater-script. When HTC releases a major update, however, you will get:
  1. adsp.img
  2. cir.img
  3. dzdata_16g.hdr
  4. dzdata_16g.img
  5. dzdata_32g.hdr
  6. dzdata_32g.img
  7. dzdata_64g.hdr
  8. dzdata_64g.img
  9. bootloader.img
  10. radio.img
  11. recovery.img
  12. rpm.img
  13. sbl1-1.img
  14. sbl1-2.img
  15. sbl1-3.img
  16. sbl2.img
  17. sbl3.img
  18. tp.img
  19. tz.img
  20. more...
See the difference? This firmware images (if updated) are stored inside firmware.zip inside the OTA update. And without S-OFF you can manually update (using fastboot commands or command shell) only recovery, boot, system and sometimes radio. Other partitions are locked and you can't update firmware images other way then only with signed firmware.zip.

Content of HTC OTA update

However, very often, flashing only the content of the system and boot partitions is not enough to have the device fully working. For example, in the HTC One X it was necessary to use the new bootloader together with the official HTC Jelly Bean update, otherwise your device wouldn't boot with an older bootloader. This is why flashing a custom ROM for an HTC device is nowhere the same as flashing a custom ROM on a Nexus device. Apart from having the latest system files, you need to have the latest firmware.zip package flashed as well.

Because HTC sells their devices to different carriers around the world, they need to accept some requirements. For example carrier branding. Because of carrier branding, HTC has more than one version of the RUU (ROM Update Utility) for each device. To indicate the difference between the branded and un-branded versions of the same device, HTC used so called "CID" numbers. 

To find out your current CID number (together with some other useful info) you can use the "fastboot getvar all" command. Also, keep in mind that every OTA update checks CID/MID numbers before it will start to patch your system:




                         ifelse( is_ship_bootloader(getprop("ro.bootloader")) == "t" ,
                         assert(check_cid(getprop("ro.cid"), "00000000" , "11111111" ,
                         "22222222" , "33333333" , "44444444" , "55555555" , "66666666" ,
                         "77777777" , "88888888" , "99999999" , "HTC__001" , "HTC__E11" ,
                         "HTC__102" , "HTC__203" , "HTC__405" , "HTC__Y13" , "HTC__304" ,
                         "HTC__032" , "HTC__A07" , "HTC__J15" , "HTC__016") == "t"););
                         ifelse( is_ship_bootloader(getprop("ro.bootloader")) == "t" ,
                         assert(check_mid("full", "PN0710000") == "t");,
                         assert(check_mid("simple", "PN0710000") == "t"););

Obviously "check_cid" includes also SuperCIDs (00000000, 11111111, ...).
Content of android-info.txt
It's all in updater-script, so it can be easily edited anyway. But the real problem is different. As mentioned already, every OTA update contains firmware.zip - package with bootloader, radio, touch panel drivers, trust zone and other parts of important firmware. It also contains the "android-info.txt" file, where CIDs/MIDs are listed, so your S-ON bootloader won't let you flash an original firmware.zip if your CID number is not listed there. Yes, I'm not talking here about custom radio, bootloader or anything custom at all. Original, untouched firmware.zip from an OTA update can't be flashed onto the device if the CID number doesn't match. Is it a problem? Yes, this is the real problem we're dealing here with. Not S-ON/S-OFF, but CID restrictions and an inability to change the CID number.

How this can be resolved? "android-info.txt" is a plain text file, so it can be edited easily. If your CID number is not on the list, just add one more line with your CID. However, as long as your device is S-ON, you won't be able to flash it, because every firmware.zip is signed with a special key. Once firmware.zip is modified, the signature is broken and the bootloader will reject the request to update it. But there is a different method: you can change the CID number on your device with a fastboot command "fastboot oem writecid <cid number>". The best CID number to use is one of the WWE CIDs (for instance HTC__001). But wait - you can't use this particular fastboot command without S-OFF.

Is this problem a real one, or just some sort of users ill-informed craving? It's very real, because without the ability to flash firmware.zip from a WWE OTA update, every user from any carrier or different world region is forced to wait months to receive OTA updates customized to his CID. Everyone can de-brand his device easily by flashing a stock system image, but it won't be enough: because firmware.zip with corresponding parts of the firmware is needed at the same time. This isn't about the OTA itself, it's about the firmware.zip inside that OTA update.

Dangers:

So what are the dangers of obtaining S-OFF on your device? Some of the partitions in the device are extremely sensitive and can result in your device being bricked if they are even slightly corrupted. With S-OFF you can access all of these partitions and the slightest corruption during transfer (whether that be a power spike or you jiggled the cable slightly) can result in a bricked device as it does not check for signatures.

Here’s an example which has almost happened to me once on an S-OFF device: I was flashing a boot.img via fastboot, the command is: "fastboot flash boot boot.img". However I had made a small but significant typo: "fastboot flash hboot boot.img", simply by mis-hitting the B key; this command would be rejected by a device with S-ON as it is a protected partition, but would be accepted on a device with S-OFF. If I had pressed enter without checking the command, my device would have turned into a paperweight in seconds.
One of the most popular protected partitions the hacking community enjoy flashing is the radio partition. This is also a partition where the slightest corruption will cause your phone to brick. The FCC guidelines state the the radio must be booted with a separate processor (I guess to decrease the risk of it being tampered with), so what happens in a phone when it turns on is: radio is booted via a dedicated processor by the first stage loader, initialising the radio hardware (Wifi, Data, Bluetooth, etc.). Radio successfully boots and initiates the first stage loader to use the main CPU to load the second stage loader into RAM (also known as the SPL). Depending on the boot operation, it will either initiate the system or recovery. So without a functioning radio, the main CPU will not kick on and boot the phone.

Some other facts:
  1. You don't need S-OFF to root your device.
  2. You don't need S-OFF to be able to run Titanium Backup or other applications that requires root access. You just need root privileges for that.
  3. You don't need S-OFF to flash custom recovery image onto your device.
To summarize:

We don't need S-OFF, but we do need the ability to edit the CID number on the device (let's say at least on officially UNLOCKED devices), or the firmware.zip packages inside an OTA update should not be signed, so that "android-info.txt" can be easily edited, or the CID restrictions from android-info.txt should be removed (MID is enough to ensure that the right firmware gets to the right devices).

Something to re-think?

Even if we don't need S-OFF I'm quite worried about the policies of mobile companies and carriers. Their philosophy is "the more you are locked down, the more you are protected". That means Police should not fight with criminals, but everyone should just lock down their doors, windows and stay at home instead. It's far easier and cheaper to lock down mobile devices and not allow root access rather then improving the security in other areas.

Can you imagine that you just bought a brand new notebook for $3000 and:
  • you can login only as a Guest (no Administrator account available by default),
  • you can't change your operating system,
  • you can't use applications that requires Administrator privileges,
  • you can't browse freely the content of your hard drive.
You would say "Where the hell is my freedom?!" Here comes the answer from your notebook manufacturer - "For your own security, you don't have any freedom". Sounds like a George Orwell story to me.

I want the same freedom on my phone that I have on my PC.


This article was written in a cooperation with Shen Ye


Have any questions or comments? Feel free to share! Also, if you like this article, please use media sharing buttons (Twitter, G+, Facebook) down this post!


PS. I want thank to Tom Kelsall, my HTC Elevate companion for his help in a proper grammar redaction of the review! Thanks Tom!

Wednesday 5 June 2013

HTC One review - part 1. Design

I used to think that we were in an era when all smartphones with big screens looked more or less the same. Because if you're honest, what can be changed in the front of the device, if 90 to 95% of its surface is just touch screen? Oh dear, I was so wrong. HTC One is a true masterpiece of art. However, this review will also show some weak points of the newest HTC premium device. Yes there are some shortcomings, but we are not living in an ideal world so you won't ever find a perfect product: it doesn't matter if it's just a smartphone, a computer or even a car. People have different tastes or expectations and this won't ever change. But HTC One can surely satisfy more people then any other device before. Let's start from the beginning.






Size: 137.4 x 68.2 x 9.3mm


Weight: 143g


Display: 4.7 inch, Full HD 1080p, 468 PPI




Design

HTC put in a lot of effort to make this device look amazing - efforts which have been a great success. However, design was never a weak point of HTC devices. As far back as I remember, HTC devices were always one step ahead of the competition when it came to the design and form innovation. So for me, it is not a surprise that HTC One sets a new standard of build quality and design.  

Gaps
However, some users are reporting a wide gap between its plastic and metal surfaces. I don't have any on mine, but as far as I know this problem is not a matter of just few devices. So right after you buy yours, make sure it doesn't have any gaps. Is it something that should stop you from buying HTC One? Surely not. It is normal in every production process that sometimes there are some manufacturing issues. On the other hand, it seems that HTC quality testing department is not working very well, if units with gaps are passing build flaw tests. HTC One is a premium device for a premium price, so as a customer, you have a right to expect a gap free product (especially since HTC advertised the device as "gap free"). If you have noticed any, go to the store where you bought your device and exchange it for a gap free unit.

Made from one piece of aluminium
HTC One is known to be made from aluminium with a unibody construction. You can have a silver model or a black one at the moment (more colours are rumoured to be on the way). I can tell you that both look amazing. The black device looks to be more solid, but silver gives you a better, more premium look and feel. Not much to discuss when it comes to colours, because it's a matter of a taste of each user. If you want to read more about the process of designing the HTC One, you can visit this blog - Metal-morphosis of the New HTC One and this one - Making the New HTC One.

No removable battery - no problem
The unibody design has some particular consequences. First of all, you can't remove or change the battery inside the HTC One. Is it an issue? Personally, I never found it to be a problem. There are methods to switch off the device completely without removing the battery - a combination of power + volume buttons. Also, I shared my thoughts on this topic here - Removable battery - do we really need it? It's been a while already since the HTC One has been on the market and it's a best-selling product, despite its non-removable battery. Does this mean a removable battery is not that important in the end?

Of course I understand some arguments against having a non-removable battery. But there are always two sides of an argument and I'm not here to judge which side is better. Personally I just prefer unibody design, mostly because I see no reason to replace or remove the battery inside the device.


No micro-SD card - no problem either
It seems that no micro-SD card slot is also a consequence of having such a design. However, I can imagine that a micro-SD card could be used the same way as micro-SIM card is and it won't make it impossible to have a unibody design. On the other hand I also don't find any reasonable arguments to have a micro-SD card. The vast majority of users don't need more then 32 GB of available space. If you want to know more details about Android and internal memory you can read my article here - Virtual SD card on Android. HTC One is not supposed to be your personal media storage - for that you should buy a mini-PC with an mATX motherboard and 2x2TB HDDs connected with RAID. If the internal storage on your HTC One is full, backup some pictures or music onto your PC (or use USB OTG).


What to improve
Is there room for some improvements? Yes, I think there is. First of all, the design of the hardware buttons is not really comfortable. Having the power button on the top of such big device is not the best solution. Also, the power button itself is too small and it doesn't protrude enough from the surface, so it's quite hard sometimes to press it. Maybe it's because of the IR sensor built into the button that they were stuck with this design. I believe that having a power button located on the right hand side of the device (like on Nexus devices) and volume buttons on the left hand side would be a much better solution.

Secondly, the build of the front speaker grilles. These tiny holes can get clogged very easily. I can't think of an alternate solution at the moment; I guess it's just the downside of having a smartphone with amazing sound capabilities, known as HTC BoomSound™.

The last biggest design flaw I found are capacitive buttons. There are just 2 buttons - home and back button. It is already confirmed that under the HTC logo there is a touch sensor as well, and with the new "logo2menu" feature available in most custom kernels for HTC One it is possible to assign the HTC logo as a menu button. I think that the trend to have fewer buttons on smartphones comes from Apple - but iOS is a completely different operating system with a much simpler UI, and it's quite impossible to make the Android user experience that simple. Having just 2 capacitive buttons brings some negative consequences, for instance there is significant confusion about different "long-press" and "double-tap" combinations. For example, to activate the menu function you need to long press the Home button. To display "Recent Applications" you need to quickly tap twice on the Home button. Wouldn't it be easier for the end users to have 3 buttons instead of just 2, where one of them can be used in 3 different ways?

- 1 tap = home

- 2 tap = recent apps
- long tap = menu



I'm writing this review using Android 4.2.2 on my HTC One. On Android 4.1.2 it was less complicated, but somehow worse, because without the possibility to assign a long tap on the home button as "menu", you would have to deal with an ugly black "action overflow" button at the bottom of the display, the result of application developers failing to implement the appropriate Android SDK (level 11 or higher). Such a button takes about 10% of the screen space and in some cases it does absolutely nothing. You can disable it by proper system modification (qemu.hw.mainkeys=1) but then you wouldn't be able to access the app's settings if the particular app doesn't support Android SDK level 11+. You can read more about Google's approach to the issue here - Say Goodbye to the Menu Button.

I believe that the perfect combination of capacitive buttons would be following:

- Back button
---> short press = back
---> long press = kill recent app

- Home button


- Menu button

---> short press = home
---> long press = recent apps


Shiny edges
Coming back to overall design, I forgot to mention that I really like the shining aluminium edges of the One. It's much more visible on the silver version, which is also known to be less susceptible to fingerprints. This is a really awesome effect, and there is no phone on the market that looks as good as the HTC One. Say no to plastic!

Heat dissipation
Apart from premium looks, the aluminium unibody brings one more very important feature. It works as a natural, huge radiator, taking out heat from inside your device. I can definitely tell that the HTC One is running much cooler than the HTC One X or One X+. The included "System on a Chip" is part of the reason, but the aluminium body helps a lot in dissipating any heat that does build up.



Camera
Camera housing is flat in HTC One, and it's very good move from HTC. In HTC One X/X+ camera housing protrudes from the phone body and it was very easy to scratch it. It seems that HTC took seriously users feedback in that matter.





Verdict

There is a lot of marketing effort behind the HTC One, but this time it's one of those rare occasions where advertising doesn't lie. The HTC One is a premium product, with unique and completely amazing design. If you're looking for a smartphone that will gain people attention on the street, the HTC One fits perfectly. But design is not all - it also has great hardware inside, but this is a material for part 2 of this review, coming in a few days!

PS. I want thank to Tom Kelsall, my HTC Elevate companion for his help in a proper grammar redaction of the review! Thanks Tom!




Design summarize:

+ overall design
+ aluminium unibody construction
+ it feels really great in the hand
+ available in two great looking colours
+ two sound grids for best multimedia experience

- gaps on some units
- only 2 capacitive buttons
- hardware buttons location

Have any questions or comments? Feel free to share! Also, if you like this article, please use media sharing buttons (Twitter, G+, Facebook) down this post!

Saturday 1 June 2013

HTC One Android 4.2.2 with HTC Sense 5.1 aka HTC Sense 5.0?




There were quite a lot of rumours about upcoming HTC Sense and Android 4.2.2 update for HTC One and HTC Butterfly. All were expecting HTC Sense 5.1 to show up, but instead, the version of HTC UI in latest Android 4.2.2 update is still 5.0. However, it does have a lot of important changes. Let me introduce few of them.
1. % battery icon


Finally! The most popular modification in custom ROMs of all kind. Now you can enable it under Settings ---> Power ---> Show battery level.


2. Android EQS


HTC did a great job by incorporating Android native EQS. You can switch it by tapping on the EQS icon in the upper right corner of the notification menu.


3. Android Daydream

Another Android 4.2.2 feature included in latest HTC update.


4. Long press home button works as menu button.

It's been very popular modification in HTC One custom ROMs. Now it's by default added to Android 4.2.2 update as well.


5. Minor changes in the app drawer and dock

Now you can remove all the icons from the dock, which wasn't possible in HTC Sense 5.0 we had in Android 4.1.2. Also, after moving some particular icon to the dock, it won't be gone from the app drawer.


6. More new screenshots coming soon!