Android 4.4.2

From wikinotes

Interact with PC

rooting

Android Rooting Forums
http://www.xda-developers.com/root/ semi-official forums/instructions for rooting android.
http://androidforums.com/
http://rootzwiki.com/index
http://wiki.cyanogenmod.org/w/Main_Page cyanogen mod website contains more info abut rooting
Of Interest
http://bernaerts.dyndns.org/linux/74-ubuntu/328-ubuntu-trusty-android-adb-fastboot-qtadb rooting android device from linux
http://whiteboard.ping.se/Android/Rooting rooting android device from linux
http://androidforums.com/threads/how-to-root-any-android-device-manually.586982/ manually rooting devices from linux
https://www.youtube.com/watch?v=V-qmvoccOEI another semi-manual rooting process from linux

android devmode

Settings > About Phone
  >> tap BuildNumber 7x times ## yes this is really how to enter developper mode

Settings > Developer Options
  >> USB debugging (enable)


install adb

## install eclipse/sdk
##
sudo pacman -S eclipse android-tools android-udev
cower -d ncurses5-compat-libs
cower -d android-sdk


## add user to sdkusers
##
sudo groupadd        sdkusers
sudo gpasswd -u will sdkusers
sudo chown :sdkusers /opt/android-sdk
sudo chmod -R g+w    /opt/android-sdk
newgrp sdkusers

sudo gpasswd -u will adbusers
newgrp adbusers


## install (automatically-selected) phone-specific packages
##
cd /opt/android-sdk/tools
./android


## Check that the device is detected properly from adb:
adb devices			## your device should be displayed

rooting process

## I copped out, and used kingoroot from windows. (the HTC desire 320 is not supported by most tools)




root software notes

So this is a bit different than I'm used to. There are a handful of places that you can get Android software from:

  • Google Play Store
  • F-Droid (FOSS software)
  • standalone APK files (must be copied to your android device)




store apps on SD card

https://awanstuff.wordpress.com/2013/01/20/how-to-partition-sd-card-and-use-link2sd-in-any-android-phone-with-screenshots/ guide

This is something you'll want to get sorted EARLY because of the tiny storage capacity on the HTC Desire 320. This app requires root.


## format your SD card into 2x partitions
- 2G   FAT32 (apps)          !!! this should be larger than the 2G I gave it...
- REST EXT2  (app storage)

sudo  cfdisk    /dev/mmcblk0
sudo  mkfs.fat  /dev/mmcblk0p1
sudo  mkfs.ext2 /dev/mmcblk0p2

## from the google play store install:
- link2sd

## choose ext4 after opening link2sd, and install the
## startup scripts (that mount the SD card).


adb

By this point, it's pretty likely that you're going to want/need to start using ADB, so here is a summary of it's setup. ADB is a set of developer tools that can be used to acces/manipulate files on an Android device connected by USB.

adb devices
adb root						## restart adbd as root
adb remount					## remount filesystem as r/w
adb shell					## shell access to adb
adb reboot bootloader	## restart in bootloader
adb reboot recovery		## restart in recovery mode

With standard android kernels, there is no option to enable root over adb. This means that you

  • cannot copy files to your android device using adb
  • cannot install FDroid
  • cannot flash custom bootloaders/recovery modes
  • etc.

To get around this, I'm using adb insecure, which is available in the google play store, and also from the XDA forums: http://forum.xda-developers.com/showthread.php?t=1687590

## restart PC
## open adb Insecure, and click enable insecure adbd
adb root
adb remount
adb push myfile /system/vendor		## test pushing file


recovery/bootloader

http://www.droidviews.com/how-to-boot-android-devices-in-fastboot-download-bootloader-or-recovery-mode/ guide to getting into bootloader from different android devices


## You can restart your device into the bootloader in 2x ways:
#    - adb reboot bootloader
#    - adb reboot recovery



## Once you're in recovery mode (picture of bugdroid with chest open)
## press POWER to get access to a menu.


twrp

TWRP is a GUI frontend for

## download
curl -O# http://download.clockworkmod.com/recoveries/recovery-clockwork-touch-5.8.0.2-bravo.img


nandroid backup

http://trendblog.net/android-guide-make-nandroid-backup-android-phone/ excellent intro to nandroid

nandroid allows you to perform a full backup of your android device (bootloader, superblock and all) and it is the first step you should take after rooting your device, and unlocking the bootloader.



mtp/mtpfs/jmtpfs (mount android filesystem)

sudo pacman -S mtp 
cower -d jmtpfs

jmtpfs /mnt/usb			## mount detected android phone at /mnt/usb



Tethering

Tether Methods

Builtin

#### On Phone
Settings > More > Tethering and Portable Hotspot
   USB Tethering

#### On PC
(connect usb cable)
ip addr (find new network interface for phone)
sudo ip link set <iface> up
sudo dhcpcd <iface>


easytether

curl -O# http://www.mobile-stream.com/beta/arch/easytether-0.8.5-2-x86_64.pkg.tar.xz
sudo tar -xvf easytether-0.8.5-2-x86_64.pkg.tar.xz -C /

## enable easytether on phone, then
sudo /usr/bin/easytether-usb
sudo ip link set tap-easytether up
sudo dhcpcd tap-easytether


Access Point Names (APNs)

Occasinally, your mobile network may prevent tethering. Also, occasionally your mobile network may provide a different APN for tethering. This affects where you are accessing the internet from.

Personally on my HTC Desire 320, I was unable to tether. Not using easy-tether, not using the builtin android tethering option. I was able to ping google (the request portion), but was unable to get a response. This might have something to do with the fact that my phone is total garbage, or that my phone does not use stock android.


Settings > Mobile Networks > Access Point Names (APNs)
Opts > New APN

#### Koodo APN Settngs
Name Koodo
APN sp.koodo.com
Proxy Leave blank
Port Leave blank
Username Leave blank
Password Leave blank
Server Leave blank
MMSC http ://aliasredirect.net/proxy/koodo/mmsc
MMSC proxy 74.49.0.18
MMS port 80
MCC 302
MNC 220
Authentication type Leave blank
APN type Leave blank 
####

Stock Programs

Base

Android Mods
------------
- Terminal Emulator
- Twilight        (redshift/f.lux clone)
- Link2SD         (allows moving apps to SD card)

- Zedge           (ringtones)
- Doze            (very, very, very effective battery saving program)
- audio profiles  (ferran negre) automatically set ringtone to quiet while at work
- Set Orientation (eyes-free project)


Unix
----
- JuiceSSH      (non-root ssh client)
- ZShaolin      (zsh, tmux, git, top, find, ...)


Navigation 
-----------
- Google Maps


Notes
------
- Simplenote


Organization
-------------
- TaskWarrior
- SolCalendar        (sync to CalDAV server only (1 way), for GUI, android calendar is better)
- CardDAV-Sync Free  (sync contacts with server 2x ways)


Games
-----
- GBA   (emulator, pokemon TCG. yeaaah)


News
----
- Reddit
- Hacker News


Media
-----
- Emby
- PlayerFM (also called Podcast Player-Free) (podcast downloader, very good)
- Steam
- IMDB


Web
---
- Firefox       (can use vimperator!)
- Chrome        (for when firefox doesn't work)


CalDav Sync

## Connect to Baikal Calendar
Options > Synced Accounts
   lavos.ddns.net:8614/cal.php
   will
   <password>

CardDav Sync


## Add Account

host:   lavos.ddns.net:8614/card.php
ssl:    No
user:   will
pass:  <pass>

Firefox

Android Firefox can sync with my real firefox, despite some misinformation, vimperator is not available on android.

TaskWarrior

<External Storage>/Android/data/kvj.taskw/files/<profile uuid>/.taskrc.android
app's ~/.taskrc config
/storage/emulated/0/Android/data/kvj.taskw/files
(my task-files location)
https://bitbucket.org/kvorobyev/taskwarriorandroid/wiki/Configuration Official App Documentation


taskwarrior is configured from CLI. *BUT* your <profile uuid> can be obtained by opening the taskwarrior app. It will prompt you to choose an account (and the account is based on the UUID).


ZShaolin

/data/data/org.dyne.zshaolin/files
zshaolin home directory

kdeconnect

remote control android from linux.


Root Programs

adb insecure			## allows `adb root` on stock android kernels
link2sd					## allows moving apps to SD card
titanium backup		## allows deletion of stock/carrier apps
fdroid               ## (standalone) FOSS software repo

fdroid

## Settings > Security > Unknown Sources (allow)

## go to the following website (from chrome on android), and download apk
## https://f-droid.org/

## using file-manager, open the .apk to install fdroid.
#### FDroid Packages:

## Shell
- termux    ## Android 5+ only (zsh, vim, ssh, python, gcc/clang, git)
- zshaolin  ## Similar to termux no python


Android System

adb shellrc

/system/etc/mkshrc
adb shell rcfile
## <personal_base>

## zshaolin/bin
zshaolin_root=/data/data/org.dyne.zshaolin/files
export PATH=${PATH}:${zshaolin_root}/system/bin
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${zshaolin_root}/system/lib

## vi mode
set -o vi

## aliases
alias lal="ls -la"


## </personal_base>

key layout

I like replacing capslock with control. Fortunately, android's keymap can be modified.

#### /system/usr/keylayout/Generic.kl
key 58   CTRL_LEFT

####

filesystem

Android's filesystem is mounted as read-only by default. If you want it to mount it as writable, you will have to do so manually. There are 2x options here either temporarily remounting the filesystem using su, OR, logging in as adb as root.

su
mount											## display all mounts
mount -o rw,remount,rw /system		## remount /system as read/write
												#  ( make sure to remount it as ro after )