
Android X server  - pmarin
http://my20percent.wordpress.com/2012/02/27/android-x-server/
======
tmzt
So this is implemented in pure java?

I did something similar, but ported the C X server to Android using the JNI.

If you want to compare approaches my source is at
<http://github.com/tmzt/androix> and a test apk is available at
<http://db.tt/UkFlvNAm>

------
Negitivefrags
> I had assumed that all internet-enabled smartphones would be sitting behind
> NAT-ing routers, both for security reasons and to conserve IPv4 addresses.
> But no, on the “3″ network in Australia at least, phones all have
> externally-accessible IP addresses, meaning they can run servers.

This seems like a terrible thing.

Given that data costs so much on phones, you would think just the internet
background noise would cost quite a lot per month.

<http://en.wikipedia.org/wiki/Internet_background_noise>

According to that article the background noise is about 20 bits per second.
According to my back of the envolope calculation that is about 6.1 megabytes
per month.

I get around 50 megabytes per $6 on my phone so this is costing me 73c per
month!

~~~
hosay123
Arguing _for_ NAT in order to compensate for a broken billing model is a
terrible idea. :)

Saunalahti in Finland also have publicly routed 3G. I wish this were far more
common, it feels very 22nd century to effortlessly ssh to the phone in your
pocket, even if the capability existed since the 20th. Such a shame
contemporary networks are usually so brain damaged

~~~
tjoff
Broken billing model is anything but flatrate? Hardly practical in practice
for such a scarce resource. Noone wants to pay for that, it can only exist as
an option where few will use it.

How about denial of service attacks? I could easily kill your battery and
drain your quota for the month with a few keystrokes - and there's not much
you can do about it.

Yes, I prefer NAT for my mobile connections. Just use a VPN if you want
external access.

~~~
hosay123
Not sure how you arrived at flat rate being the only alternative. It's almost
trivial to count ingress only for host flows to which the customer's device
responds positively (say, by replying using anything except ICMP or a TCP
error)

~~~
tjoff
Does any ISP do that though? I've never heard of it, then again I haven't had
contact with any ISP delivering external IPs to mobile connections.

The point about battery remains though. And the solution you propose can
easily be exploited to allow unlimited data for say, video streaming.

~~~
hosay123
In Saunalahti's case they differentiate by offering different connection
speeds, all at flat rate. I'm not really sure if what I suggested is
implemented anywhere, just playing devil's advocate. :) One possible solution
might be to combine it with stateful filtering, dropping a unidirectional
ingress flow after some number of packets if the device never responds. My
point was mainly that something must be broken if the customer is getting
billed due to the environment beyond their control.

In the case of power management I'm not sure it's that simple, it's at least
true that the HTC Dream would not usually respond to pings while the display
was off (haven't experimented with other devices). Presumably the application
processor only awoke when a kernel timer fires, which only applies to client
sockets the device itself created. Actually it makes sense that random inbound
data traffic wouldn't wake the phone, otherwise you risk your OS getting a bad
reputation because of some crappy telcos sending ARP every 1 second or
something.

~~~
tjoff
I agree that it is unreasonable, and is a bit shocked that there are countries
where receiving an sms can cost you money... But a reasonable solution to
incoming data is to enable NAT, it isn't much of a hinder for a tech savvy
user and is otherwise better for the 99.99% of the users.

My phone (Nexus S) always responds to the pings I send. Which kind of makes
sense, the default is to have a constant connection to google anyway (so that
it can receive any push messages). Apparently google already made the decision
that it is worth the battery drain. And android has already gotten plenty of
bad reputation for applications misbehaving. While I'm sure some telcos are
misbehaving in all ways imaginable as well it is probably nothing compared to
the apps users gladly install for themselves.

~~~
hosay123
> something must be broken if the customer is getting billed due to the
> environment beyond their control.

This is what happens when you debate random tangential topics online while
hung over.. so basically I had no point to make, and you made me realize NAT
is a pragmatic solution to the imaginary problem I'm complaining about.

> Presumably the application processor only awoke when a kernel timer fires

And of course for the reasons you point out, this presumption was obvious
nonsense. :) Now I'm not sure what caused the behaviour I saw on the Dream.

------
surrealize
More Android<->(non-android)Linux compatibility would be great. Given that the
linux desktop is moving toward wayland, and given that android's
SurfaceFlinger is a lot closer to wayland than to X, I'm not sure that X is
the best way forward. It would be interesting to see how much work it would
take to implement SurfaceFlinger apis in terms of wayland or vice versa.

Kind of like this work implementing the AudioFlinger api on top of pulseaudio:
[http://arunraghavan.net/2012/04/pulseaudio-on-android-
part-2...](http://arunraghavan.net/2012/04/pulseaudio-on-android-part-2/)

------
jevinskie
So is this the first real X client on Android? I've only found VNC clients for
Android in the past. Having a real X client would be amazing because that
would allow the efficient use of GUIs with a chroot install of debian (or
pick-your-distro)! The status quo is to use a VNC server in the chroot and a
VNC client on Android to get a GUI. Not very "clean".

------
jlgreco
I'm not convinced this would be good for much as it is, considering the
reality of input devices on Android, but it seems like something like this
could have potential in aiding porting. Getting a _good_ terminal emulator
ported to Android using this sort of thing to help could be an interesting
endeavor for example.

~~~
georgemcbay
Android has fantastic support for mice, touchpads and keyboards (not to
mention Xbox 360 controllers, etc).

~~~
jlgreco
In practice nobody actually uses those things. The _reality_ of input on
android is that the general public just uses touch screens.

~~~
jfb
The set of people willing to use a mouse with their phone is probably a strict
superset of those who want to run X, so I wouldn't think of it as problematic.

Also, good on the OP. But X on Android? It's a jfb Hell.

------
rogerbinns
What I really want is to extend my host's desktop onto the Android device. I'd
settle for something as simple as Synergy working (in the wishlist, not done
yet).

There are numerous solutions for Windows and Mac (eg AirDisplay, SplashTop)
but nothing to extend Linux desktops onto Android devices.

~~~
Elv13
Both GTK+ (broardway) and Qt (lighthouse) have some sort of HTML5 frontend. It
is the most portable solution, if not a little slow. Extending the desktop can
be done with some VNC+Xinerama trickery too. But it ain't easy, I will give
you that. If you want to drag and drop a window from Xorg to Android (2
server), get ready for trouble. Not that X can't support it, it does, but
modern toolkit hate being redirected like that, it is a very niche X11
feature.

~~~
rogerbinns
In other words not particularly practical :-)

I would expect the tablet to be plugged in as a virtual monitor (ie xrandr
would should it as another monitor) and if you take the tablet away it should
be no different than disconnecting a monitor.

------
tjoff
Cool. Since android has great VPN capabilites being NATed doesn't necessarily
present any problems.

EDIT: And why not link to the play store?
[https://play.google.com/store/apps/details?id=au.com.darksid...](https://play.google.com/store/apps/details?id=au.com.darkside.XServer)

------
dzorz
FWIW iSSH on iOS has good X support.

------
hayksaakian
This is cool hack, but is there anything fun or useful I could do with it?

~~~
olgeni
You can run xeyes as it was meant to be run.

~~~
tmzt
Xeyes with a touchscreen doesn't work so well, you have to touch the screen
before it tracks.

~~~
marshray
One could charge $1.99 for an app that allows users to poke the xeyes.

