Swetu Talks
Saturday 18 July 2020
What is Image Stabilization? OIS and EIS explained.
Friday 17 July 2020
World's First Rotating camera Smartphone | Vivo X50 PRO
Thursday 16 July 2020
What happens to running AsyncTask when Activity Changes ?
If you start an AsyncTask inside an Activity and you rotate the device, the Activity will be destroyed and a new instance will be created.
Similarly, if user navigates to another activity, current activity will be destroyed or go in background activity stack and new activity would be in the foreground.
But the AsyncTask will not die. It will go on living until it completes. And when it completes, the AsyncTask won't update the UI of the new Activity. Indeed it updates the former instance of the activity that is not displayed anymore. This can lead to an Exception of the type
java.lang.IllegalArgumentException: View not attached to window manager if you use, for instance, findViewById to retrieve a view inside the Activity.
To resolve this problem, one option is to use IntentService along with a BroadcastReceiver to deliver result.
Another option is to run AsyncTask into worker fragment, as fragment is the cleanest way to handle configuration changes because fragment has the ability to retain their instances simply by calling setRetainInstance(true) in one of its lifecycle methods.
Thank you for Reading,
Swetabh
Wednesday 15 July 2020
What happens when you press power button of your Android phone? | How Android boots up?
So what exactly is the boot-up process?
- Boot ROM and Bootloader
- Kernel
- Init process
- System Server and Managers
- Launcher
- -> It detects external RAM and loads a program that will help in the second stage.
- -> The bootloader set up the network, memory, etc which require to run the kernel.
- Mount directories like /sys, /dev , /proc.
- Runs init.rc script that resides at <android source>/system/core/rootdir/
- registerZygoteSocket() : It register a server socket for zygote command connection.
It keeps polling a socket /dev/socket/zygote. When you launch an Application, the request to create a new process comes from system_server to zygote on this socket. - preloadClasses() : It is a simple text file that contains a list of classes that need to be preloaded.
- preloadResources() : Everything that is included in the android.R file will be included with this method.
Tuesday 14 July 2020
Introduction | Getting and leaving my first job | Currently where I am.
What is Ashmem?
ashmem (Anonymous shared memory subsystem) is a concept which is similar to POSIX SHM (Shared Memory). The difference is, ashmem claims that it overcomes the problem of memory leaks. ashmem is not available for Android applications, but they are used by the low-level system software/processes. The components of System Server like SurfaceFlinger, AudioFlinger, etc use ashmem for IPC. ashmem is fast. Another example where ashmem is used is, the Virtual Machine. When .oat code is provided to the VM using ashmem. When a process wants to communicate with another process, the process creates a shared memory region, and then shares the file descriptor of that memory region with the other process with which it wants to communicate. This file descriptor is sent to other process via Binder. The system processes rely ashmem through IMemory interface, which is not available or not exposed to the app developers.
ashmem also does memory management, by shrinking or expanding the memory area as needed. When the system needs more memory, it shrinks its area and releases memory for the system. If a shared memory area is marked as pinned, then that area can't be released at any circumstance. ashmem uses reference counting to destroy memory regions, when the processes referring to them have exited.
Basically, ashmem is a way used by the system level processes, not by application processes for IPC.
Ashmem supports a number of ioctl calls such as ASHMEM_SET_NAME, ASHMEM_GET_NAME, ASHMEM_SET_SIZE, ASHMEM_GET_SIZE, ASHMEM_SET_PROT_MASK, ASHMEM_GET_PROT_MASK, ASHMEM_PIN, ASHMEM_UNPIN, ASHMEM_GET_PIN_STATUS, ASHMEM_PURGE_ALL_CACHES
Kernal can discard unused shared block of memory when under pressure. Its implementation can be found at mm/ashmem.c with include at include/linux/ashmem.h
What is Image Stabilization? OIS and EIS explained.
Hi Guys, Today I'm going to talk about image stabilization, what are OIS and EIS? How these works and What are the advantages of having ...
-
Hi Guys, Today I'm going to talk about image stabilization, what are OIS and EIS? How these works and What are the advantages of having ...
-
Hi Guys, I am Swetabh Suman. I am from Dhanbad Jharkhand. I have completed my B.Tech from Gandhi Institute of Engineering and Technology (GI...
-
Hi Guys, Today I am going to talk about the world's first rotating camera smartphone i.e non-other than Vivo X50 Pro. ...