Posts Tagged ‘android’

Giving Android a swap file

Friday, November 20th, 2009

I don't know if it's because I'm doing more with it than I used to, or the rose-tinted specs that come with the novelty value have worn off, or if the later updates have been designed for more powerful hardware, but my G1's been lagging a bit recently, so I figured I'd have a look at what I can do to make it faster. Turns out it's quite receptive to the idea of a swap file.
You'll need root access for this - everything below is to be run as root. Following is how I did it on my cyanogen'd G1, but I don't see why it wouldn't work on anything else - it makes use of standard linux tools. This will likely advance the death of your sdcard - it increases the reads and writes by some large margin. I don't know enough about sdcards to know how much quicker it will die, but modern ones will likely deal with it better than older ones.

Anyway, in your terminal emulator:

dd if=/dev/zero of=/sdcard/swap bs=1M count=100

You can call it whatever you like. The 'count' value (100 above) is how many MB of swap space you want. The above will create 100MB of swap.
This will take a few seconds (of the order of 50), so if it's 'hung' it's probably not crashed.

Then we make it into a swap file and activate it as swap space:

mkswap /sdcard/swap
swapon /sdcard/swap

Finally, we want to change the swappiness of the system. When the system memory is completely full, and more is requested, the kernel needs to work out how to create some space. It, generally, can do one of two things: drop some filesystem cache, or move some application memory to swap.
The swappiness value dictates the priority of either - a value of 0 means it will always try to drop fs cache rather than use swap, and a value of 100 means it will always try to use swap and preserve the fs cache. Only values between 0 and 100 inclusive are allowed, and neither guarantees any action - you can still find yourself swapping out at 0, for example - just the priority afforded each solution.
The default value for the Linux kernel is 60, which is generally not appropriate for something running completely from flash media (where the fs cache isn't so important). So I'm dropping it to 20, which seems to work for me. If it doesn't for you, try some other values, it's an on-the-fly change.

echo 20 > /proc/sys/vm/swappiness

On rebooting the phone, the above settings wont hold. The swap file will still be available (assuming the SD card is still inserted), but on reboot you'll need to run

swapon /sdcard/swap
echo 20 > /proc/sys/vm/swappiness

On the plus side, you'll be rebooting less.

Cyanogen on my G1

Saturday, November 14th, 2009

I've just upgraded to Cyanogen on my G1 and it's lovely. Well, I got root, which is basically what I always wanted.

I basically followed the instructions on the Cyanogen wiki and everything worked exactly as described, I've nothing really to add here except to say it's brilliantly easy and everyone should do it.
One small note, though, the final reboot into Cyanogen takes a long time. Mine took just shy of thirty minutes, and I've read of others taking anything above about 15.

The first obvious benefits are root access, exchange activesync support, five workspaces (as against the stock 3) and a bunch of useful apps already installed, including a nifty power control widget which replaces my collection of 5 distinct widgets. I'll write more on it when I've used it more.
In case, as I did, you've been pondering this and wondering what the end result is like, it's almost exactly as previously, but with some new features, there's some screenshots on the webpage. I've not yet found anything to have been degraded by it, and it all looks and feels the same, but a bit more polished in areas. Though it only ships with one ringtone.

Android G1 factory reset

Tuesday, November 10th, 2009

With the phone off and the battery in, press and hold <power>+<back> for 20 seconds or so. You'll get the standard G1 splash screen, then a screen with an exclamation mark.

Press <alt>+<L> to get to the System Recovery screen. Here you're presented with four options:

reboot system now [Home+Back]
apply sdcard:update.zip [Alt+S]
wipe data/factory reset [Alt+W]
wipe cache partition

Which you should be able to choose from with the scrollball or use the key combinations for.

Android Issues

Saturday, October 24th, 2009

Some of this might well be rendered obsolete by the 1.6 update I've just received.

GMail Client
No bottom- or inline-posting, only top-posting. And, while you're at it, there's no way to read the quoted text while replying.
You have to read to the bottom of the email to get to the reply button, which is an odd move from someone who promotes top-posting. It's not even in the Menu.
There's no way of editing Labels or Filters.

POP/IMAP Client
This is very different to the GMail one, I don't know why.
It also doesn't honour read/unread flags in IMAP folders, and I continually get notifications that I've got new mail that arrived six months ago.

Calendar
To set the date in the calendar you have three boxes, year, month and date1 which are adjusted by either entering in the date, or a + and - button on each. This is fine when you don't go over a month boundary, at which point it gets confusing. Since nearly everything I plan is for 'next wednesday' or so, about one in four of my appointments require more thinking than I think they should.
There's no way to add calendars that are not already available to the www version of your calendar.

Google Docs
Editing documents is possible, but creating for some reason isn't. Also, no control over labels.
As in Mail and Calendar, there are web versions of these optimised for the Android screen, but they're similarly crippled.

Contacts
When viewing the contact, everything that has a number has a 'call' and a 'text' option, which fills the screen with never-used options.

SMS
When entering a name into the To: field, the first suggestion is as if you were writing a word with a keypad. For example, entering 'mum', the first option is '686'
Once you've scrolled past the useless entry and selected the one you want, the field is populated with name . Which is only an issue if you want send a message to more than about ten people, since you run out of characters in that field.
Enter is send. This is not a problem, but I _never_ remember and send multiple messages when I mean send.

Google Maps
When selecting start and end points for directions, recently chosen points are arranged alphabetically, not in the order in which you used them. And they're not named by how you searched for them, but by what Google calls them.

Everything's Massive
Google took a very straightforward approach to lists and fingers - make the buttons huge. I'd like more than two options per screen, though, and I think varying the length of the buttons would be a better approach.

  1. The order is configurable []