Wednesday, March 28, 2018

Android screen size and dpi

Often, when working on particular device, you need to find out exact screen dimensions and dpi:


uki  08:04 ~ $ adb shell dumpsys window displays | grep dpi
    init=1440x2880 560dpi base=1440x2880 476dpi cur=1440x2880 app=1440x2737 rng=1440x1357-2737x2654

Friday, March 16, 2018

Resizing Mac APFS disk to create a case-sensitive HFS (hfsx) for Linux sharing and Android builds

Resizing Mac APFS 500Gb to 350Gb and creating HFSx (case-sensitive) for AOSP building.



$ sudo diskutil apfs resizeContainer disk0s2 250g hfsx REPO 0b

..
Shrinking APFS Physical Store disk0s2 from 499,963,170,816 to 249,999,998,976 bytes
Shrinking APFS data structures

[ \ 0%..10%..20%..30%..40%............................... ] 47% 0:00:02 

..

Initialized /dev/rdisk0s3 as a 233 GB case-sensitive HFS Plus volume
Mounting disk
1 new disk created or changed due to APFS operation
Disk from APFS operation: disk0s3
Finished APFS operation
uki 192.168.1.7 13:16 ~ $ diskutil list
/dev/disk0 (internal):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                         500.3 GB   disk0
   1:                        EFI EFI                     314.6 MB   disk0s1
   2:                 Apple_APFS Container disk1         250.0 GB   disk0s2
   3:                  Apple_HFS REPO                    249.8 GB   disk0s3

/dev/disk1 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +250.0 GB   disk1
                                 Physical Store disk0s2
   1:                APFS Volume SYSTEM                  220.6 GB   disk1s1
   2:                APFS Volume Preboot                 22.3 MB    disk1s2
   3:                APFS Volume Recovery                509.8 MB   disk1s3

   4:                APFS Volume VM                      1.1 GB     disk1s4



REFERENCE:

http://www.peachpit.com/articles/article.aspx?p=1403238

https://www.macobserver.com/tips/deep-dive/resize-your-apfs-container/

Thursday, March 8, 2018

Mac case-sensitive

Mac, for some idiotic reason is not case sensitive anymore:

$ echo 'You should see this assigned to abc' > abc ; echo 'and not only this printed twice' > ABC ; cat  abc ABC
and not only this printed twice

and not only this printed twice


In order to work with source code I tried few things, such as USC-C SSD drive formated as case-sensitive, bu tit is too slow.

So I created a new case-sensitive APSF partition using DiskUtility.


$ cd /Volumes/REPO 
REPO $ echo 'You should see this assigned to abc' > abc ; echo 'and not only this printed twice' > ABC ; cat  abc ABC
You should see this assigned to abc
and not only this printed twice

Building and Installing Android AOSP

In these notes, I will document few things:

1) Building newest AOSP for the HiKey SBC
2) Installing new image in Android Studio Emulator
3) Installing Android Pie preview of Android "Tiamen" (a Siberian fish, the picture is shown below) on Pixel 2 XL.



General Info about the AOSP

read general info:

Preview Images

https://developer.android.com/preview/download.html#images

Android P (pie) image:
taimen-ppp1.180208.014-factory-8e44f67a.zip 

Emulator running preview:

Factory Images


Android Oreo image 8.1.0 (OPM1.171019.021, Mar 2018):


Hikey960 binaries for Android 8.0.0 (20171017) ARM:


Hardware specific Binaries


Pixel 2 XL binaries for Android 8.1.0 (OPM1.171019.021)

Google (Vendor Image):

Qualcomm (GPS, Audio, Camera, Gestures, Graphics, DRM, Video, Sensors)


https://dl.google.com/dl/android/aosp/google_devices-taimen-opm1.171019.021-66c50345.tgz

AOSP building


Reference AOSP Development Boards (e.g. HiKey)




Kernel:
$ git clone https://android.googlesource.com/kernel/hikey-linaro android-hikey-linaro









Wednesday, February 21, 2018

Mac Screenshots

To change the default saving location of Mac Screenshots (Desktop) you run the following in the Terminal, I also added the first command to ~/.bash_profile:


$ defaults write com.apple.screencapture location ~/Screenshots

$ killall SystemUIServer

Tuesday, February 13, 2018

repo reset

Sometimes you have to get back to the pristine sync with your repo, I created a function in my ~/.bash_profile for that.


# REPO HEAD updated: February 13, 2018
function repo_reset()
{
source activate py27
cd ~/REPO/my-repo-name
pwd
#repo sync
repo forall -vc "git clean -xdf"
repo forall -vc "git reset --hard HEAD"
ls -alt
}

The "ls" command with sorting

The Mac/Unix "ls" command does not include sorting by file name. 

To get it done I added a new function in Bash to my ~/.bash_profile


# ls with sort - updated: February 13, 2018
function list()
{
    if [ "$1" != "" ]; then
        ls -a $1 | sort
    fi
   
    ls -a | sort
}

Monday, January 22, 2018

Building AOSP on Mac: Could not find a supported mac sdk: ["10.10" "10.11" "10.12"]


To build Android on MacBookPro High Sierra, I had to overcome few obstacles.
I looked up the MacOS SDK version, I am currently running:
$ ls /Applications/XCode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/
MacOSX.sdk  

MacOSX10.13.sdk

$ edit build/soong/cc/config/x86_darwin_host.go

Then changed build/soong/cc/config/x86_darwin_host.go to:

line 92, add "10.13",
 darwinSupportedSdkVersions = []string{
  "10.10",
  "10.11",
  "10.12",
  "10.13",
 }
Also, tried previous SDKs:
$ cd /Applications/XCode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs



$ git clone https://github.com/phracker/MacOSX-SDKs.git

copy directories into:


/Applications/XCode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs

uki 10:44 SDKs $ list

MacOSX.sdk/

MacOSX10.11.sdk/

MacOSX10.12.sdk/

MacOSX10.13.sdk

uki 10:44 SDKs $

Wednesday, January 3, 2018

Why developers should use Google Nexus / Pixel devices

It is January 2018. I sitting in front of two 2017 FLAGSHIP phones from Huawei and Samsung and the sample code app that I am trying will not run on neither of them (Android 7, API 24), but it does run on the Google Pixel C tablet that is 3 years old and discontinued but has been already updated to Android 8, API 26.

This really teaches me a lesson, get Pixel phone as a next phone.




Thursday, December 21, 2017

Missing xcrun on macOS High Sierra


Error

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

error: "" unsupported

Solution:


  • Re-install XCode from App Store (~20 minutes)
    • Open XCode and agree to lice agreement
    • Allow it to "Instal components..."
This resolved my problem, but optionally you can try the following:
  • xcode-select --install
  • sudo xcodebuild -license
  • xcode-select --reset