To get working brightness keys, try the following.
Run the command:
sudo -H gedit /etc/default/grub
Change this line
GRUB_CMLINE_LINUX_DEFAULT="quiet splash"
to something like below
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_osi=Linux acpi_backlight=vendor
Execute sudo update-grub
and reboot. See if brightness keys are working.
It is still possible Ubuntu won't remember your brightness settings. So you have to change brightness each time.
Please let us know the result as many Sony users are facing this problem.
This is for setting brightness manually after doing the above steps.
Try following for paths shown by ls /sys/class/backlight/*/brightness
and replace accordingly.
For example, paths will be like:
/sys/class/backlight/acpi_video0/brightness
For the above path Get the maximum brightness:
cat /sys/class/backlight/acpi_video0/max_brightness
Try a lower value to set the brightness, say output is 16 so I will try with half of it:
echo 8 | sudo tee /sys/class/backlight/acpi_video0/brightness
If this works, make this happen in each login automatically by doing the following
sudo -H gedit /etc/rc.local
Enter this line just before exit 0
. It should look like:
echo YOUR_VALUE_HERE > /sys/class/backlight/acpi_video0/brightness
exit 0
Also you can try with xdotool 
ls /sys/class/*/brightness