Saturday, March 28, 2015

Moto 360

I've been playing with the idea of getting an Android Wear smart watch for some time now. Specifically I had set my mind on the Moto 360, and luckily a dear friend of mine (and fellow geek) owns one. So after a brief intro (over some beers) I was even more inclined to get one. Then one of our local discount retailers (Hofer) had it on offer, and more or less at the same time it has been offered at quite a reasonable price on eBay (including some additional watch bands).

So I got it from ebay. Yesterday it arrived.
Ok, the unboxing is less spectacular with a pre-owned device, but still nice.
Charge the watch, install the Android Wear app from the play store and follow the instructions.

First thing I did, was send a text to my son (who was clogging the DSL line again) via the voice dictation on the watch. Boy, did I triple check this before sending :) But it worked flawlessly.

Half an hour later I was conducting a Facebook Messenger chat partially from the watch...
Why? Because I could.... (and I needed to test it).

And then, just for the fun of it, I told my watch to play some music on the phone. Soooo cool.


So, over the next couple of days I hope to find some more meaningful use cases.
One thing I really hope for, is that I can keep my phone in my pocket when I receive a text or any other notificaiton while I'm on the train/commute... Let's see how that works out.

And, oh,  thanks, Max, for making me do this.

Thursday, March 26, 2015

Android Automatic WiFi Login - no more

One of the most useful Android apps - Wifi Web Login - stopped working with Android 5.0/Lollipop. The reasons seems to be that Lollipop now continues to use the mobile data (3G, ...) connection if fails to connect to the internet through wifi.

So whenever you are connected to a (public/free) hotspot, which requires a web login (or just acceptance of their terms of service). Android will ignore the Wifi, until you login/accept.

Actually, a good move.
But it seems to break Wifi Web Login, which automated this for me anyway...
Now I'm back to logging in manually...
Still easier than before, because I only have to drag down the Wifi notification, and accept the ToS for some standard hotspots.
But sort of a step back.
Hopefully this will get fixed, but neither the webpage nor the play store hint towards a fix.



Thursday, February 26, 2015

Java updates without Ask Toolbar

One thing that has annoyed me, since Sun started this, was that the Java Installer / Updater would not only have crapware like the Ask Toolbar, but also - of course - have this selected by default.

I always found it inappropriate for a large IT vendor like Sun to include such intrusive sponsoring.
Especially with a security sensitive thing like Java.

Anyway, I just learned that you can turn this off.. Not sure since when.
In the Java Options (Windows Control Panel -> Java) on the Advanced tab, scroll down to the bottom, and there you have it.

Suppress sponsor offers when installing or updating Java.

Quite hidden, and not easily found by exactly those average Joe Users who would actually install the Ask toolbar ...
But ... eh... thanks ?



Friday, February 06, 2015

Google Glass is not dead

Now that everyone rushes to tell us how they always knew that Google Glass had been doomed to fail from the very beginning, I just want to note here, that I'd like to revisit their claim in 1 to 1.5 years.
My guess is, they will look pretty stupid.

Thursday, January 01, 2015

Android Screeen Recording

While I was trying to access my broken Nexus 5, I managed to get keyboard/mouse/touch access via the debug bridge (adb), but from time to time I had serious problems actually reading certain parts of the the screen (broken display!).

So I checked if and how I can do screen recordings, and found that it works really easy. At least starting with KitKat.

Fully documented on the official adb pages.

Of course you need USB debug access to your phone, but you do not need root access (!).

So all you need is a terminal/shell and then you can do start screenrecord.

Like:

adb shell screenrecord /sdcard/test.mp4
and stop it with Ctrl-C

and then get the file to your PC with
adb pull /sdcard/test.mp4
and remove it on the device with
adb shell rm /sdcard/test.mp4.


And this is the video, showing at first nothing (display off), then I switched the device on and then I swiped up to unlock:




There are some useful options available:
OptionsDescription
--helpDisplays a usage summary.
--size <WIDTHxHEIGHT>Sets the video size, for example: 1280x720. The default value is the device's main display resolution (if supported), 1280x720 if not. For best results, use a size supported by your device's Advanced Video Coding (AVC) encoder.
--bit-rate <RATE>Sets the video bit rate for the video, in megabits per second. The default value is 4Mbps. You can increase the bit rate to improve video quality or lower it for smaller movie files. The following example sets the recording bit rate to 6Mbps:
screenrecord --bit-rate 6000000 /sdcard/demo.mp4
--time-limit <TIME>Sets the maximum recording time, in seconds. The default and maximum value is 180 (3 minutes).
--rotateRotates the output 90 degrees. This feature is experimental.
--verboseDisplays log information on command line screen. If you do not set this option, the utility does not display any information while running.
If especially like the --time-limit for short recordings.

Wednesday, December 31, 2014

... and how to restore it

As noted a couple of days ago, I broke my Nexus 5 and managed to get a backup via adb.

Finally, UPS managed - as usual with their second attempt and one call in between - to deliver the new Nexus 5 yesterday.
So, unbox, switch on, log into Wifi, etc etc... and have the system update to 4.4.3.

What?!?
Say Again!

"... and have the system update to 4.4.3."
No matter how often I repeat this, it's still weird that a brand new Nexus 5, ordered and shipped directly from Google, comes with 4.4.2 the end of 2014.

Anyway, update to 4.4.3, reboot, update to 4.4.4, reboot, update to 5.0....
Nope.
No 5.0. No Lollipop. As we know, rechecking every 5 seconds for an Android over-the-air update is as useful as hitting the elevator call button 10 times.

Well, so enable developer options with the 7x tap on the Build Number. Enable USB debugging.
Connect to PC, authorize, find the device with "adb devices". Voila.

Let's try the "adb restore". Enter the password on the mobile, this time without the help of the "adb shell input" workaround. The restore starts, and ends without any further message after about 2-3 seconds.

Not good.
Lets check the log with "adb logcat". There's something about mismatched header versions, so lets google this.
Well, as can be expected you cannot restore a 5.x backup to a 4.x device.
How silly of me to even consider it.

Recheck the over-the-air upgrade.
Nope, still not 5.0.

So screw it, download the factory image for 5.0.1.
Unlock bootloader, apply image, as described.
Reboot, log into Wifi, ...
Then the new Lollipop Setup Assistant kicks in and allows me to actually place my old phone to he back of the new one to NFC pair them, and transfer the basic settings (mainly account and Google settings) directly.

So I plug in the USB mouse again to the old, broken Nexus 5, and try to find the NFC settings (which are of course in the broken part of the display). Google around a bit to find there in the settings they are, and manage to half blindly enable NFC.
A couple of seconds later I have my account and (Google) launcher settings on the new Nexus 5.
Nice.
A lot of the app icons on the home screen are marked to show that the app itself is (still) missing behind the icon.

So I tried to restore the backup.
Again enable developer options (I just loaded a new system image, so everything I did an hour ago was of course gone) and USB debugging (and sideloading).

And now the "adb restore" really did work. Since there is no proper status on the device itself, I started a "adb shell logcat -s BackupManagerService" in another window to see some progress.

And about half an hour later I was done.
Most apps had their settings again, but not all.

Considering what last-resort hack this was, pretty good.
Considering how easy it is, to upgrade from one iPad to the next (via iTunes) this was pretty ugly.

By the way:
The Setup Assistant from Lollipop now supports a lot of options, even restoring data from a previous backup.
But I was not really inclined to test this right now.
If someone wants to sponsor yet another Nexus device for me, I'd be happy to test this for you.

Sunday, December 28, 2014

How to Backup a Broken Nexus 5 via USB

So, the other day I decided to drop my beloved Nexus 5 - display first - on a concrete (or stone, whatever) floor, right in the middle of Vienna's most busy shopping street. And got a result like this:

Not only was the glass broken, but the display itself was defect in large areas as well. Touch of course did not longer work.

I visited a repair shop just down the road, and guess what, they only have Samsung and Apple spares on stock, and I got the tip to use a cover next time. Yeah right, Thanks a lot.
So with the broken display and all, I decided to purchase a new one (via Play store), which is en-route to Vienna right now.

In the meantime I was trying to save whatever I can from the old device. My Nexus is unrooted without even a hint of Titanium Backup or the likes activated. Luckily I enabled the developer options as a first step after I got it.
So I connected it via USB to my PC and saved whatever as accessible this way.

I have the Android Developer Kit / SDK Tools installed on my PC, so I have adb at hand - the Android Debug Bridge, which is needed for the following steps.

Then I tried an "adb backup", which prompted for a confirmation on my device.
Of course, with no touch and the broken display I could not enter one.

So, the ultimate hack of 2014 to the rescue:

Step 1.
Connect a USB mouse via USB converted to the phone.
Yes, I really wrote that. A regular (PC) USB mouse. And you'll also see a regular mouse pointer on the display then. How cool is that.


Unlock the phone by drawing the swipe pattern with the mouse.

Then immediately (with the mouse again), go to settings and change the pattern to a PIN.

The PIN can be easily sent via USB from the PC, the pattern less so. Now we can disconnect the mouse again.

Step 2.
Connect the phone to the PC again.

Run "adb devices" just to be sure you are connected (all adb commands are of course from the windows command line or whatever your "host" operating system is).

If you are stuck with the lock screen, you need to swipe up with the following adb command[1]:
adb shell input swipe 500 1900 500 900

Then you should get the PIN prompt.

Unlock it with a sequence like this:
adb shell input text 1234 
adb shell input keyevent 66

The first line sends the PIN (1234 in this example), the second line sends the ENTER after it.  The event codes can be found in the Android Developer docs or here. The POWER, ENTER, BACK and HOME keys/events are quite useful :)

Step 3.
Start the backup with
adb backup  -apk -obb -shared -system -all

(or whatever options you require)
Then you'll get the full backup confirmation prompt, which needs to be answered again with the help of  adb shell input commands.
You can set a password with
adb shell input text password  [2].

However, it does not accept the keyevent 66 to confirm this dialog; this literally inserts a new line at the end of the password.
We have to tap on the "BACK UP MY DATA" button at the right bottom of the screen. Which leads us to

Step 4.
Luckily you can also emulate touch events via USB. Some research, some guessing, and trial and error showed, that this button is roughly in the area of coordinates 800,1750   (so in the right third and just above the button bar). The display is 1080x1920 in size, so that was easy to guess and test.
So we send a
adb shell input tap 800 1750

And the backup starts.
Magic.

Tomorrow I shall hopefully receive my new Nexus 5 (if the UPS guy for once delivers on the first attempt) and then I can report on how the migration to the new device works.

--

[1] The screen is 1080x1920; so the start position for our swipe is 500/1900 , i.e. quite in the middle, almost on the bottom, the end is 500/900, i.e. quite in the middle, quite in the middle, and almost perfect swipe to unlock.
[2] substitute your real desired password for password here, right after text.