# Question
Title: Can my employer read my notes if I use their Wifi?
I have "Colornote" app in my android device and I'm using that app for many years. I write my passwords and many other personal things. My workplace has wifi and I use it regularly. Often my notes gets synced when I use that wifi. Can my employer read my notes? Colornote says they use AES encryption. I don't understand what it means. Many times, I use public wifi too. When I use public wifi, can they read my passwords and personal notes? Also can they read other word and google doc app documents that I have saved in phone and get synced when I'm online?

And if answers of the above questions are yes, will installing and using Norton360 VPN app secure my notes? Thanks.

# Answer
Most Wifi by default is encrypted and if your documents are encrypted on top, it will be impossible for anyone to look at them casually.

Wifi traffic is encrypted using WPA (before it was WEP).

> **Types of wireless security protocols**
> Most wireless APs come with the ability to enable one of four wireless encryption standards:
>
> 1. Wired Equivalent Privacy (WEP)
> 2. Wi-Fi Protected Access (WPA)
> 3. WPA2
> 4. WPA3

From Wireless security: WEP, WPA, WPA2 and WPA3 differences

If the documents were being stored on the server, then there could be a possibility of them being hacked.

* But they are not even stored on your works server.
* They are encrypted
* They are going from your phone to ColourNote directly as multiple IP packets, NOT as a file.
> 1 votes

---
Tags: wi-fi, security, encryption, colornote
---


# Question
Title: Recover accidentally deleted texts on Samsung Galaxy S21
I accidentally deleted all my text messages on my Samsung Galaxy S21 FE. I tried to find them in the cloud. The trash, but to no avail.

Is it possible to retrieve them?

# Answer
No, if you deleted them from your device, and they are not backed up in any way, you can not get them back.
> 0 votes

---
Tags: samsung, sms, data-recovery
---


# Question
Title: Can the Termux environment be put on an external SD card?
I would like to install my termux environment (usr folder) to an SD card. is this possible?

I have seen this post Can I install packages to external SD card on Termux in Android?. From what I understand the problems mentioned there is only if you want to install individual packaged to the SD card. I'm looking to install the whole usr folder.

# Answer
> 8 votes
If your device is rooted, you can do it, but it is a little tricky. (You may need to use another terminal app or work in failsafe of termux).

1. Create an `ext4` partition on the SD card. (This can be a 2nd partition).
2. Make a new folder where you want to mount the new partition on. (For example in your home folder add a folder called `ext4-fs`)
3. In termux mount the partition (I'm assuming a 2nd partition). You need to know the path to the device. I have found it to be `/dev/block/mmcblk1p2` but this may be different on your device. `mount /dev/block/mmcblk1p2 /data/data/com.termux/files/home/ext4-fs`.
4. Copy the `usr` folder from termux `/data/data/com.termux/files/usr` to the new mounted partition.

**From here on you will need to use commands that are in `/system/bin/`. (And may need to use failsafe mode or an other terminal app).**

5. Rename the `usr` folder to something like `usr-old`. `/system/bin/mv /data/data/com.termux/files/usr /data/data/com.termux/files/usr-old`.
6. Make symlink to the `usr` folder that's now on the new partition. `ln -s /data/data/com.termux/files/home/ext4-fs/usr /data/data/com.termux/files/usr`. This will now be your termux usr folder which is linked to the folder on the sd card. (You can force a symlink even if `usr` already exists with `ln -sfn`)

Now you can delete the old `usr` folder (That we renamed `usr-old`).

Now termux uses the symlinked folder that is on your SD card for all that needs the `usr` folder which is the whole termux environment.

**Every time you take out the SD card and reinsert it you will need to remount the partition.**

# Answer
> 1 votes
The problem was SELinux. I resolved by installing "The SELinux Switch" and then putting in the "permissive" mode. Now I can mount with root and access in Termux WITHOUT root!

---
Tags: external-sd, installation, termux
---


# Question
Title: Put Termux environment on external SD card
Following this answer, I formated my sdcard as ext4-fs.

Then tried mounting the sdcard into termux home as the link above says

```
mount /dev/block/mmcblk1p2 /data/data/com.termux/files/home/ext4-fs

```

I get error **mount: bad /etc/fstab: No such file or directory**

I could only mount the partition with root using **su** command, only then the **mount** command doesn't give error.

Mounting the partition with **su** from terminal *or* with app like **Link2Sd** (which also uses root) makes the mount point (i.e where the partition is mounted) unreadable for Termux.

What am I missing?

He (the author of the answer above) even went further to create a *symlink* to Termux $PREFIX using another terminal app which is **impossible** without root also **as** thus also not readable by Termux which even complicates everything

I think this should be possible, what am I doing wrong pls

# Answer
I had the same problem. The problem was SELinux. I resolved by installing "The SELinux Switch" and then putting in the "permissive" mode. Now I can mount with root and access in Termux WITHOUT root!
> 0 votes

---
Tags: external-sd, installation, mount, terminal, termux
---


# Question
Title: Get rid "Start voice call?" confirmation dialog on WhatsApp voice call
Every time I want to call someone on WhatsApp, a popup appears asking:

> Start voice call?
>
> `Cancel` `Call`

When I click on the call button, clearly I want to call that person, this pop-up is an unnecessary extra step.

How can I get rid of this pop-up?

# Answer
It seems like this appears 5 times and then disappears by itself. You cannot turn it off. The 5 counts are only if you press "call" 5 times, not "cancel". Simplest way - find someone you don't mind them being notified a few times of a missed call and call them 5 times.
> 2 votes

---
Tags: whatsapp-messenger, popup
---


# Question
Title: How to troubleshoot Audible App on Android Auto?
Sorry not sure this question is valid on this forum - please let me know, if you like me to remove it.

I am new to Android Auto, and I'm trying to get the Audible Application to work with my car.

The content (book) is already downloaded to the phone. Once I start to play the content after about a minute or so the audio is cut off, but I can see the progress bar (seconds) tick away. I try to stop the program from playing, but it won't respond, and continue to tick away.

If it helps

* the phone was connected using Bluetooth
* Android Auto version 9.0.630834 (on my phone)
* Phone Android Version 10
* Audible Version 3.47.0
* Audible Battery Setting: Allow Background Activity, Optimize Battery Usage is On
* Audible Permissions - No Permissions Denied

---

This morning I disabled Android Auto on my phone, and connected the car stereo to my phone using Bluetooth.

Same thing happened, I started Audible, then after a few minutes (2-3 minutes), the audio cuts off but the seconds tick away.

# Answer
The good people over at android-central provided a few hints.

It seems that it is running in a stable fashion. Although I find my config changes to be counterintuitive:

> I do not understand this but ever since I
>
> * **disabled** Allow background activity
> * **disabled** Optimize battery usage
>
> For Audible it seems to be solid.

You can follow the entire thread.
> 1 votes

---
Tags: android-auto, audible
---


title: How does Android generate FBE Keys

text:
# Question
Title: How does Android generate FBE Keys
I am trying to understand how FBE and metadata encryption works.

I read a lot of pages on FBE that it encrypts each file with different keys, and that those keys are encrypted and hashed with the Lock Screen Pin entered by the user.

My question is What if the user does not set the pin. How are the keys generated and how secure they are ?

How are the keys decrypted when there is no Pin set on a bootup of a device?

What is the role of Metadata Encryption from Android 11 to FBE Keys.

# Answer
A lot of details on Andorid´s File based Encryption ans how the different keys are related to each other can be found in the answer to the question Connection between PIN/password and encryption keys in Android on our sister site Security Stackexchange.

The only part that is not explained in detail is how the encryption meta data is stored in e.g. ext4 file-system. These details are presented in this presentation from 2021: One Key to Rule Them All: Recovering the Master Key from RAM to break Android's File-Based Encryption (presentation) \- see see page 7 and 8:

See also the full scientific paper: One Key to Rule Them All: Recovering the Master Key from RAM to break Android's File-Based Encryption
> 1 votes

---
Tags: security, encryption
---


# Question
Title: Android TV/box, wrong date time, and no internet access
I have a few Android TVs and Android TV boxes around the house, and one common nuisance is: that if the time and/or date are incorrect, then the internet for those devices won't work. Also through the ISP we use, the automatic time/date checkbox option does not work either.

The Android TV devices only forget the time/date once a month at most. But it is very unintuitive for someone to think that the time/date needs to be correct for the internet to work. Once more with the incorrect time/date, the internet in Firefox for Android still works. But not for Chrome or YouTube (if the date is incorrect). It's very frustrating and has been like that for years despite performing all the Android system updates available.

Why do the time and date need to be correct for Chrome & YouTube to work on Android TVs and TV boxes?

# Answer
A correct date or at least a date not too far away from reality is important for every internet device in these days.

The reason is that internet connections are mostly HTTPS (HTTP over SSL/TLS) connections and one integral step for establishing TLS is checking the used server certificate if is is trusted and valid. Each certificate contains two dates: not valid before and not valid after. The time span between both dates defines the period in which the certificate is valid. This validity period lasts between 3 to 12 months.

So if your system date is so wrong that is is outside of the validity period then the validity check can fail even if the certificate is perfectly valid and the TLS handshake will fail and so no connection can be established which means no data can be transmitted.
> 3 votes

# Answer
Your isp most probably started filtering the ports due to an attempted ddos attack or something. Maybe they did some wrong configuration for which ntp port is blocked and thus the tv / tv box is not getting time from ntp. I had this problem for a month and today the senior engineer of my home internet isp fixed it.
> 0 votes

---
Tags: internet, android-tv, date-and-time
---


# Question
Title: Can I downgrade Galaxy A10s from stock Recovery?
I have `Samsung Galaxy A10s (SM-A107F)`. In the summer I updated to `Android 11` (current firmware is `A107FXXS8CVK1`, `SEK` region). Now I want to roll back to `Android 10`, but I don’t have a computer, root and TWRP. Is it possible, for example, to download the firmware from here (version `A107FXXS8BUC1`, `SEK` region) and install it via `Apply update from SD card` in stock Recovery? And will I lose data on the phone or on the memory card, or both?

---

**UPD**: I want to downgrade because in `Android 11` there is no access to some folders due to `Scoped Storage`.

---

**UPD**: I also want to downgrade because I liked `One Ui 2` better.

# Answer
There are drawbacks when you downgrade:

* you will loose security updates
* firmwares from the internet can contain viruses
* you will loose all data (downgrade performs factory reset)
* if something goes wrong your phone is bricked
* There will be a warning screen on boot which tells the user that you modified the firmware. This warning cannot be removed once you enabled OEM unlocking. When you sell your phone you will get less money because of this warning. (Update: It's possible that flashing official firmware does not enable this warning. Also see comments.)

If you still want to downgrade you have to do it on your own risk:

1. backup all your data
2. enable developer settings
3. enable OEM unlocking in the developer settings
4. boot into download mode
5. start the tool Odin on your PC
6. flash firmware

I don't have the time to write a detailed tutorial but you can find many guides on the internet. One can be found here. Simply search for "Samsung flash odin" on the web.
> 2 votes

---
Tags: samsung, recovery-mode, android-10, device-firmware, android-11
---


# Question
Title: Does Pixel 4 support three-finger swipe?
Because the volume buttons no longer work, I want to assign three-finger swipe up and three-finger swipe down to increase and decrease the volume.

However, if the hardware doesn't support detecting more than two fingers, then there is no point in searching for an app to let me make this customization.

# Answer
**Google Pixel devices do support three-finger swipe, and possibly more.**

At the very least, the TalkBack gesture customization has three-finger swipes already set for moving the reading control

> ### Navigate your screen
>
> Version 9.1 & up
>
> | Action | One-finger gesture | Multi-finger gesture |
> | --- | --- | --- |
> | ... | ... | ... |
> | Move to the next reading control | Up then down | 3-finger swipe down |
> | Move to the previous reading control | Down then up | 3-finger swipe up |
> | ... | ... | ... |

As for testing the limit, based on utilizing How can I see the pointer location, and simulate it?, the touchscreen detects at least 10 pointers (5 left fingers + 5 right fingers).

---

Tested on Pixel 3a, which is the budget version of respective Pixel series
> 0 votes

---
Tags: google-pixel, volume-control, gestures, google-pixel-4
---


# Question
Title: dpkg does not work using Termux Ubuntu installation, returns tar errors and exits with error code 1
I have tried to use Termux to install Ubuntu on ChromeOS without developer mode or root priveleges, and was successful up to this point. I accessed an Ubuntu shell from Termux but `dpkg` returns this error for any package, rendering the system useless:

```
root@localhost:~# apt install nano
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
  spell
The following NEW packages will be installed:
  nano
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 243 kB of archives.
After this operation, 823 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu bionic/main i386 nano i386 2.9.3-2 [243 kB]
Fetched 243 kB in 1s (198 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
E: Setting in Start via TCSAFLUSH for stdin failed! - tcsetattr (13: Permission denied)
dpkg-deb: unrecoverable fatal error, aborting:
 wait for tar subprocess failed: Unknown error 512
dpkg: error processing archive /var/cache/apt/archives/nano_2.9.3-2_i386.deb (--unpack):
 dpkg-deb --control subprocess returned error exit status 2
Errors were encountered while processing:
 /var/cache/apt/archives/nano_2.9.3-2_i386.deb
tar: .: Cannot mkdir: No such file or directory
tar: ./conffiles: Cannot open: No such file or directory
tar: ./control: Cannot open: No such file or directory
tar: ./md5sums: Cannot open: No such file or directory
tar: ./postinst: Cannot open: No such file or directory
tar: ./prerm: Cannot open: No such file or directory
tar: Exiting with failure status due to previous errors
E: Sub-process /usr/bin/dpkg returned an error code (1)

```

# Answer
Try this:

```
sudo dpkg --configure -a
sudo apt install nano

```

You can't use `apt` without superuser (root) privilegies.
> 0 votes

---
Tags: termux
---


# Question
Title: Stop ActivityManager killing background Termux processes
I've been trying to run a ssh and a http server on my non-rooted Android phone using Termux.

I've installed Termux:Boot and termux-services to run them.

The server processes run for a while after I release the wakelock but are then killed by the system:

```
09-23 13:25:21.592  4450  5008 I ActivityManager: KPU : put [com.termux] : 15433 K
09-23 13:25:21.592  4450  5008 I ActivityManager: Killing 25360:com.termux/u0a171 (adj 904): DHA:empty #17

```

I tried disabling the app power monitor (Setting -\> Device maintenance -\> Battery) but it doesn't seem to make any difference.

Save rooting the phone, or keeping a wakelock in place, is there any way I can stop the ActivityManager killing my processes?

Setup: Samsung Galaxy A5 with stock-rom (Android 8 / Samsung Experience 9)

# Answer
> 0 votes
I don't have Galaxy A5, but I have Galaxy A10s and this helped me:

1. Go to `Settings -> Apps -> Termux`.
2. Tap `Battery`.
3. Enable `Allow background activity`.
4. Open Termux.
5. In Termux notification, click `Acquire wakelock`.
6. Tap `Allow`.

---
Tags: command-line, termux
---


# Question
Title: How can I get a ubuntu desktop on my Galaxy S8 Ultra?
I have installed UserLand and selected Ubuntu but all I see is this (note that I am in DEX mode on a Galaxy S8 Ultra):

All the tutorials say I have to set a VNC username and password but it never prompts me to do that. Any ideas?

FYI ultimately I want to run vscode and docker in the ubuntu instance.

# Answer
> 1 votes
Install Termux and VNC Viewer. Open Termux and run these commands:

```
apt update
apt upgrade
pkg install root-repo x11-repo
pkg install proot proot-distro
termux-setup-storage
proot-disto install ubuntu
proot-distro login ubuntu

```

In Ubuntu shell:

```
apt update
apt upgrade
apt install sudo nano
adduser name #replace name with any username
exit

```

In Termux:

```
proot-distro login --user name ubuntu

```

In Ubuntu:

```
sudo apt install xfce4 xfce4-goodies
sudo apt install tigervnc-standalone-server
vncserver
vncserver -kill :1
nano .vnc/xstartup

```

Edit `xstartup` file:

```
#!/bin/sh
startxfce4

```

Press Ctrl+O and Enter, then Ctrl+X.

```
chmod +777 .vnc/xstartup
vncserver -geometry 1280x720 #replace 1280x720 with your resolution

```

Don't close Termux, open VNC Viewer, tap `+`, set address `localhost:1`. Save connection and enter it. Now you have Ubuntu desktop.

---
Tags: linux, termux
---


# Question
Title: Cannot sign-in into the app using Google account
I have Shiaomi Redmi 5 with Android 8 and MIUI 11. My Google account is OK - I can use play store, gmail, whatever. But when some app requires sign-in my phone is stacked on the window

I.e. I try to tap my account but nothing happens. Is it possible that there is an Android or MIUI setting that prevents login? Or it is just a bug? What to do? Thanks.

# Answer
> 2 votes
That screen looks like the oAuth login dialog shown when you want to use your Google account to login into a third party app.

The login page is by default opened in your default web browser (not inside the app itself because the app should not be able to grab your Google credentials when you log-in).

If you can not login, then this is caused by the used web browser or a tool the causes the login to fail on network level.

Possible causes for the web browser to fail:

* Problems with defect cached parts of the web site -\> clear web browser cache
* Problems with the web browser itself -\> try a different web browser
* Active ad blocker (in the web browser or on Android level if the ad blocker works as a local VPN).

---
Tags: applications, google-account, google, miui
---


# Question
Title: adb succeeds but sporadically returns exit code 1
I'm using `adb` in an automated setup for testing. The following commands, whenever I execute them, sporadically return an exit code of `1` with no indication of errors happening:

* `adb shell settings put global bluetooth_disabled_profiles 1`
* `adb shell am force-stop [my app id]`
* `adb shell am start -n [my app id]/[app activity id]`
* `adb forward --remove tcp:8000`
    + interestingly, adding port forwarding using `adb forward tcp:8000 tcp:5050` always returns exit code `0`
* `adb forward --list`
* `adb devices -l`

The exit code of the commands listed above is `0` more than 95% of the time it is executed. In the other 1%…5% of executions, adb returns an exit code of `1` but stderr is empty. In all these cases, the command worked fine, i.e. it seems like `adb` should always return `0`.

I wonder why the exit code is non-zero. Should I get some additional info? Or is this a bug in `adb`? Is this a known issue?

Software info: I've tried different recent versions of `adb` on Windows 10, e.g.:

```
adb --version
Android Debug Bridge version 1.0.41
Version 31.0.3-7562133

```

# Answer
I've had problems with `adb push` failing for no obvious reason.

It proved to be a problem with the USB-C socket the device was connected to; try a different one?
> 0 votes

---
Tags: adb, windows
---


# Question
Title: What does the "Dual-band Wi-Fi" option do?
On my Zenfone 8 running Android 13, what does the setting for "Dual-band WiFi" do? It's located under Settings \> Network & internet \> Internet.

# Answer
The dual band WiFi mode allows you to be connected to two different WiFi networks at the same time. You can select a Primary network and a Secondary network as fallback.

Technically it isn't the correct terminology, it might seem to have something to do with the 2.4/5GHz bands, but it doesn't.
> 0 votes

---
Tags: wi-fi, settings
---


# Question
Title: Is there a way to record and playback a set of touches?
What I'm looking for is some sort of macro-recorder (though that term seems to be hijacked now my macro-photography apps).

I'd like to record a set of presses (specifically, beating a level in a game), and then have those repeated for me so I can accumulate in-game currency without wasting my time or a ton of money.

I imagine there would be other practical uses as well, but I'm not finding anything to do this in Google Play.

MacroDroid and Tasker both looked promising, but you can only assign predefined actions to predefined events - not a set of touches.

# Answer
I've developed such an app called RepetiTouch. It's currently in beta stage and aimed at developers, but a limited free version is available here. However, it needs a rooted device running Android 2.3 or later.

As far as I know, currently no other app with this functionality exists, but there are some tools/scripts providing such features using a computer and an USB connection, e.g., here.

Anyway, I discourage any use of any such apps or tools for farming.
> 15 votes

# Answer
The only app I know of that works fine is "**Android Bot Maker**" (XDA link **here**)

sadly, it can't record the touches, but you can set it manually yourself, by finding out the coordinates by enabling "show pointer location" on the developers category of the OS settings.
> 2 votes

# Answer
HiroMacro Auto-Touch Macro works well for me.
> 2 votes

# Answer
You can try the Culebra GUI: https://github.com/dtmilano/AndroidViewClient/wiki/Culebra-GUI. It is a python-based tool that lets you record interactions and re-run them.
> 2 votes

# Answer
If you want to do this on an Android Emulator. By using Memu, you have a button to record and play a script.
> 0 votes

# Answer
I wrote a script to record and playback the events like touching, accelerator, gyro, and etc.. https://github.com/tzutalin/adb-event-record
> 0 votes

# Answer
I had made a java application which does Android Record N Play
> 0 votes

# Answer
I am the developer for 123Autoit - NonRoot. The latest version has included the function of macro recording and playback action. the app is free to use.

Here is the video demo of the macro recording and playback on YouTube: 123Autoit nonroot Record and Playback function.
> 0 votes

# Answer
I'm certain this is possible, since I had an app about 6+ yrs ago that did exactly this. I used it to send myself (at another email address) notes of things I wanted a reminder for. After tapping an icon, it would record opening gmail, selecting 'compose', filling in the 'to' spot, then moving the cursor to the content area and selecting the microphone. All set up in an icon. All I had to do was tap the icon, then start speaking and I got text in the email. then I hit send. I got a new phone and never could find it again! Maybe because of security considerations it wouldn't work today!
> 0 votes

---
Tags: automation, touchscreen
---


# Question
Title: How can I keep apps from moving off the home screen?
I am using Samsung tablets for workers in the field. They only need to use one app but some users keep moving it off the home screen and then they can't find it.

How can I keep apps on the home screen from moving?

# Answer
A work-around you could use on Android to refrain from having apps move or be uninstalled by either accident or someone trying to purposely do so:

Settings -\> Accessibility -\> Dexterity and Interaction -\> Press and hold delay -\> Custom

From here, you can just set an obnoxiously long press and hold delay so that when icons are held down to be either moved or uninstalled, it takes however long you've set the interval for to actually initiate that command. So, a) doing it by accident becomes harder and b) Someone who doesn't know you've set that feature will assume it doesn't work and not opt to wait 35 seconds of holding an icon down.

Just my little trick, at least.
> 1 votes

# Answer
The stock home screen doesn't support locking/pinning the apps permanently.

You could try 3rd-party launchers for this purpose: Solo Launcher, Nova Launcher, etc. are some of those. Locking a desktop is possible in these launchers.
> 0 votes

# Answer
On Samsung devices with One UI, with the default home screen of One UI Home, it is possible to keep the app shortcuts from moving off the home screen.

1. On the home screen, long-hold on an empty space, then select "Settings"
    * Alternatively, open the Settings app - Home screen
2. Enable "Lock Home screen layout"

> **Lock Home screen layout**
>
> Prevent items on the Home screen from being removed or repositioned.
> 0 votes

# Answer
Settings -\> Accessibility -\> Press and hold delay -\> Long
> -2 votes

---
Tags: home-screen-shortcuts, home-screen
---


# Question
Title: "cannot add library libvulkan.so" when trying to start emulator
This is my first time attempting anything Android. I have installed Android Studio 2021.3.1 Patch 1 on Ubuntu 22.04 and created an Empty Compose Activity as a test.

The Device Manager looks like this

But when I try to run it I get

```
The emulator process for AVD Pixel_XL_API_33 has terminated

```

idea.log contains

```
INFO -      Emulator: Pixel XL API 33 - [...]android-sdk/emulator/emulator -netdelay none -netspeed full -avd Pixel_XL_API_33 -qt-hide-window -grpc-use-token -idle-grpc-timeout 300
INFO -      Emulator: Pixel XL API 33 - Android emulator version 31.3.13.0 (build_id 9189900) (CL:N/A)
INFO -      Emulator: Pixel XL API 33 - emulator: INFO: Found systemPath [...]/android-sdk/system-images/android-33/google_apis/x86_64/
WARN -      Emulator: Pixel XL API 33 - Failed to process .ini file ~/.android/avd/Pixel_XL_API_33.avd/quickbootChoice.ini for reading.
WARN -      Emulator: Pixel XL API 33 - cannot add library [...]/android-sdk/emulator/qemu/linux-x86_64/lib64/vulkan/libvulkan.so: failed
INFO -      Emulator: Pixel XL API 33 - WARNING: lavapipe is not a conformant vulkan implementation, testing use only.
INFO -      Emulator: Pixel XL API 33 - Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)
ERROR -      Emulator: Pixel XL API 33 - Emulator terminated with exit code 139

```

This happens with Android 5.0 and 8.1 projects.

As per this question I have tried `sudo ubuntu-drivers autoinstall` which gives

```
"/usr/bin/ubuntu-drivers", line 187, in command_install
    UbuntuDrivers.detect.nvidia_desktop_pre_installation_hook(to_install)
  File "/usr/lib/python3/dist-packages/UbuntuDrivers/detect.py", line 839, in nvidia_desktop_pre_installation_hook
    with_nvidia_kms = version >= 470
UnboundLocalError: local variable 'version' referenced before assignment

```

and `mesa-vulkan-drivers` are already installed.

How do I fix this error and run a basic project out-of-the-box in an emulator on Linux?

# Answer
I don't really have a solution, but a workaround: I had the same problem on openSUSE Leap 15.4 and could solve it by choosing "Software - GLES 2.0" for "Emulated Performance" when creating an emulated device.

It seems, the problem with libvulkan.so only occurs when using "Hardware - GLES 2.0" or "Automatic" which in my case seems to also choose the Hardware setting.

So as I said, I don't know how to fix the problem with hardware rendering, but for me the software rendering is good enough, though probably slightly slower.
> 4 votes

# Answer
If `mesa-vulkan-drivers` is already installed (`sudo apt install mesa-vulkan-drivers`)

* try to update your NVIDIA driver: `sudo ubuntu-drivers autoinstall`
* then **reboot** your system

---

If the `ubuntu-driver` command fails with this error:

```
UnboundLocalError: local variable 'version' referenced before assignment

```

You can try the fix from here but in my case it selected a driver which did not recognize my display anymore (wrong resolution), so I selected the latest proprietary driver myself:

* Open "Additional Drivers" in the Ubuntu Launcher
* Select the latest proprietary driver listed here
* `Apply` (this takes a while) and reboot your system

*Tested on Ubuntu 22.04*
> 2 votes

---
Tags: android-emulator, android-studio, avd-manager
---


# Question
Title: Android 11 tablet cannot connect to WiFi (saved; obtaining IP adrress)
I got a new Thomson Teo 13.3 Android 11 tablet (I started from factory defaults, it is *brand new*). I made a new Wi-Fi network on my NETGEAR WAX202 router, let's call its SSID "MyNetwork2", and had this tablet connect to it. It spins under "obtaining IP address" for a while; and then says "Saved" and that's all it shows.

I have 5 devices on my home network connected to the same router, and they work without a problem - although they are connected to a different Wi-Fi network. To test, I had my LineageOS 17 Samsung smartphone connect to this "MyNetwork2" - no problem whatsoever. So it is not the router, I imagine.

I found that Android 11 introduced some changes that may break WiFi network connectivity. Some of the articles I read:

Connecting Android 11+ devices to WPA/WPA2/WPA3/Enterprise SSID

> Since Android 11 Security Enhancement released in December 2020, this has changed and as a result, you cannot skip the certificate validation.

PSA: Android 11 will no longer let you insecurely connect to enterprise WiFi networks

> The problem that many users will come across after they update to Android 11\* is that the "Do Not Validate" option under the "CA certificate" dropdown has been removed

Although that probably does not apply to me, because I do not use an enterprise network.

Eventually I also found:

Wi-Fi connection issues with the Xiaomi Mi A2

> he had enabled WPA alongside WPA2 on the AP. They also confirmed that this wasn’t something I could’ve done myself, as there is no relevant option in the "user-facing" part of the configuration panel. ...

> ... which in turn leads wpa\_supplicant to ignore the fact that there’s a MBO/OCE tag (which is, of course, still present) despite the AP not supporting PMF as reported in the RSN IE, and just use the WPA IE to choose the needed ciphers

I don't understand half of the words here, but I tried disabling dual frequencies on the WiFi network, and adding both WPA and WPA2 - and of course, this didn't work either.

Anyways, I tried to obtain a logcat during the connection attempts, when the WiFi network is in this state:

I tried to grep only for relevant stuff:

```
$ grep -i 'wifi\|wpa\|conn\|net' ~/Desktop/logcat2
06-29 10:24:30.387   413  4727 I WifiService: startScan uid=1000
06-29 10:24:30.822   413  4727 I WifiService: startScan uid=1000
06-29 10:24:31.852   413   501 E WifiVendorHal: getWifiLinkLayerStats_1_3_Internal(l.973) failed {.code = ERROR_UNKNOWN, .description = unknown error}
06-29 10:24:34.867   413   501 E WifiVendorHal: getWifiLinkLayerStats_1_3_Internal(l.973) failed {.code = ERROR_UNKNOWN, .description = unknown error}
06-29 10:24:35.820   413  4727 D WifiNl80211Manager: Scan result ready event
06-29 10:24:35.820   413  4727 D WifiNative: Scan result ready event
06-29 10:24:35.839   413   505 D WificondScannerImpl: Filtering out 2 scan results.
06-29 10:24:35.859   413   501 E WifiVendorHal: getWifiLinkLayerStats_1_3_Internal(l.973) failed {.code = ERROR_UNKNOWN, .description = unknown error}
06-29 10:24:35.907  1020  1754 I ChimeraSrvcProxy: NullBinder for android.net.action.RECOMMEND_NETWORKS triggering remote TransactionTooLargeException due to Service without Chimera impl
06-29 10:24:37.784   413   501 E WifiVendorHal: getWifiLinkLayerStats_1_3_Internal(l.973) failed {.code = ERROR_UNKNOWN, .description = unknown error}
06-29 10:24:37.883  3892  3892 I wpa_supplicant: wlan0: CTRL-EVENT-DISCONNECTED bssid=37:XX:XX:XX:XX:e2 reason=3 locally_generated=1
06-29 10:24:37.892   326   326 I wificond: Regulatory domain changed
06-29 10:24:37.893   413   433 I EthernetTracker: interfaceLinkStateChanged, iface: wlan0, up: false
06-29 10:24:37.898   326   326 I wificond: 2.4Ghz frequencies: 2412 2417 2422 2427 2432 2437 2442 2447 2452 2457 2462 2467 2472
06-29 10:24:37.901   326   326 I wificond: 5Ghz non-DFS frequencies:
06-29 10:24:37.901   326   326 I wificond: 5Ghz DFS frequencies:
06-29 10:24:37.901   326   326 I wificond: 6Ghz frequencies:
06-29 10:24:37.902   326   326 I wificond: Regulatory domain changed to country: ES
06-29 10:24:37.909   326   326 I wificond: 2.4Ghz frequencies: 2412 2417 2422 2427 2432 2437 2442 2447 2452 2457 2462 2467 2472
06-29 10:24:37.909   326   326 I wificond: 5Ghz non-DFS frequencies:
06-29 10:24:37.909   326   326 I wificond: 5Ghz DFS frequencies:
06-29 10:24:37.909   326   326 I wificond: 6Ghz frequencies:
06-29 10:24:37.920   413   501 W LastMileLogger: Failed to stop event tracing: /sys/kernel/debug/tracing/instances/wifi/tracing_on: open failed: ENOENT (No such file or directory)
06-29 10:24:37.921   413   501 W LastMileLogger: Failed to read event trace: /sys/kernel/debug/tracing/instances/wifi/trace
06-29 10:24:37.929  3892  3892 I wpa_supplicant: wlan0: CTRL-EVENT-REGDOM-CHANGE init=CORE type=WORLD
06-29 10:24:37.949  3892  3892 I wpa_supplicant: wlan0: CTRL-EVENT-REGDOM-CHANGE init=USER type=COUNTRY alpha2=ES
06-29 10:24:37.952   413   501 D WifiCountryCode: Reading country code from telephony
06-29 10:24:37.963   413   501 D WifiCountryCode: Set telephony country code to:
06-29 10:24:37.965   413   501 D WifiCountryCode: updateCountryCode to null
06-29 10:24:37.965   413   501 D WifiClientModeImpl: Start Disconnecting Watchdog 23
06-29 10:24:37.968   413   501 I WifiClientModeImpl: Keep PMK cache for network disconnection reason 3
06-29 10:24:37.969   413   501 E WifiVendorHal: stopRssiMonitoring(l.2100) failed {.code = ERROR_NOT_AVAILABLE, .description = }
06-29 10:24:37.975   413   501 V WifiClientModeImpl: stopIpClient IpClientWithPreConnection: false
06-29 10:24:37.975   413   501 V WifiClientModeImpl: java.lang.Throwable
06-29 10:24:37.975   413   501 V WifiClientModeImpl:    at com.android.server.wifi.ClientModeImpl.stopIpClient(ClientModeImpl.java:1069)
06-29 10:24:37.975   413   501 V WifiClientModeImpl:    at com.android.server.wifi.ClientModeImpl.stopDhcpSetup(ClientModeImpl.java:1084)
06-29 10:24:37.975   413   501 V WifiClientModeImpl:    at com.android.server.wifi.ClientModeImpl.handleNetworkDisconnect(ClientModeImpl.java:2761)
06-29 10:24:37.975   413   501 V WifiClientModeImpl:    at com.android.server.wifi.ClientModeImpl.access$5400(ClientModeImpl.java:163)
06-29 10:24:37.975   413   501 V WifiClientModeImpl:    at com.android.server.wifi.ClientModeImpl$ConnectModeState.processMessage(ClientModeImpl.java:4290)
06-29 10:24:37.975   413   501 V WifiClientModeImpl:    at com.android.wifi.x.com.android.internal.util.StateMachine$SmHandler.processMsg(StateMachine.java:992)
06-29 10:24:37.975   413   501 V WifiClientModeImpl:    at com.android.wifi.x.com.android.internal.util.StateMachine$SmHandler.handleMessage(StateMachine.java:809)
06-29 10:24:37.975   413   501 V WifiClientModeImpl:    at android.os.Handler.dispatchMessage(Handler.java:106)
06-29 10:24:37.975   413   501 V WifiClientModeImpl:    at android.os.Looper.loop(Looper.java:223)
06-29 10:24:37.975   413   501 V WifiClientModeImpl:    at android.os.HandlerThread.run(HandlerThread.java:67)
06-29 10:24:37.977   413   506 D ConnectivityService: [122 WIFI] EVENT_NETWORK_INFO_CHANGED, going from UNKNOWN to DISCONNECTED
06-29 10:24:37.977   413   506 D ConnectivityService: [122 WIFI] disconnected, was satisfying 0
06-29 10:24:37.997   413   501 I WifiClientModeImpl: disconnectedstate enter
06-29 10:24:37.999   413   501 E WifiScoringParams: Invalid frequency(-1), using 5G as default rssi array
06-29 10:24:38.006   413   501 V WifiClientModeImpl: stopIpClient IpClientWithPreConnection: false
06-29 10:24:38.006   413   501 V WifiClientModeImpl: java.lang.Throwable
06-29 10:24:38.006   413   501 V WifiClientModeImpl:    at com.android.server.wifi.ClientModeImpl.stopIpClient(ClientModeImpl.java:1069)
06-29 10:24:38.006   413   501 V WifiClientModeImpl:    at com.android.server.wifi.ClientModeImpl.access$4200(ClientModeImpl.java:163)
06-29 10:24:38.006   413   501 V WifiClientModeImpl:    at com.android.server.wifi.ClientModeImpl$DisconnectedState.processMessage(ClientModeImpl.java:5686)
06-29 10:24:38.006   413   501 V WifiClientModeImpl:    at com.android.wifi.x.com.android.internal.util.StateMachine$SmHandler.processMsg(StateMachine.java:992)
06-29 10:24:38.006   413   501 V WifiClientModeImpl:    at com.android.wifi.x.com.android.internal.util.StateMachine$SmHandler.handleMessage(StateMachine.java:809)
06-29 10:24:38.006   413   501 V WifiClientModeImpl:    at android.os.Handler.dispatchMessage(Handler.java:106)
06-29 10:24:38.006   413   501 V WifiClientModeImpl:    at android.os.Looper.loop(Looper.java:223)
06-29 10:24:38.006   413   501 V WifiClientModeImpl:    at android.os.HandlerThread.run(HandlerThread.java:67)
06-29 10:24:38.009   413   501 I WifiClientModeImpl: Keep PMK cache for network disconnection reason 3
06-29 10:24:38.013   413   501 D WifiNetworkAgent: NetworkAgent: NetworkAgent channel lost
06-29 10:24:38.030   413   506 D ConnectivityService: NetReassign [no changes]
06-29 10:24:39.388   413  3531 D WifiNl80211Manager: Scan result ready event
06-29 10:24:39.388   413  3531 D WifiNative: Scan result ready event
06-29 10:24:39.431   413   505 D WificondScannerImpl: Filtering out 7 scan results.
06-29 10:24:39.447   413   501 E WifiVendorHal: getWifiLinkLayerStats_1_3_Internal(l.973) failed {.code = ERROR_UNKNOWN, .description = unknown error}
06-29 10:24:39.475  1020  1754 I ChimeraSrvcProxy: NullBinder for android.net.action.RECOMMEND_NETWORKS triggering remote TransactionTooLargeException due to Service without Chimera impl
06-29 10:24:40.391   413  4727 I WifiService: startScan uid=1000
06-29 10:24:40.827   413  4727 I WifiService: startScan uid=1000
06-29 10:24:41.776   413  4727 D WifiNl80211Manager: Scan result ready event
06-29 10:24:41.776   413  4727 D WifiNative: Scan result ready event
06-29 10:24:41.810   413   505 D WificondScannerImpl: Filtering out 4 scan results.
06-29 10:24:41.820   413   501 E WifiVendorHal: getWifiLinkLayerStats_1_3_Internal(l.973) failed {.code = ERROR_UNKNOWN, .description = unknown error}
06-29 10:24:41.860  1020  1754 I ChimeraSrvcProxy: NullBinder for android.net.action.RECOMMEND_NETWORKS triggering remote TransactionTooLargeException due to Service without Chimera impl
06-29 10:24:42.197   413  4727 I WifiService: connect uid=1000
06-29 10:24:42.208   413   501 D WifiConfigManager: Enable disabled network: "MyNetwork2" num=0
06-29 10:24:42.251   413   501 D WifiConfigStore: Writing to stores completed in 18 ms.
06-29 10:24:42.256   413   501 D WifiClientModeImpl: connectToUserSelectNetwork netId 5, uid 1000, forceReconnect = false
06-29 10:24:42.266   413   501 D WifiClientModeImpl: CMD_START_CONNECT  my state DisconnectedState nid=5 roam=false
06-29 10:24:42.310   413   501 D WifiClientModeImpl: No changes in MAC address
06-29 10:24:42.314   413   501 W LastMileLogger: Failed to open free_buffer pseudo-file: /sys/kernel/debug/tracing/instances/wifi/free_buffer: open failed: ENOENT (No such file or directory)
06-29 10:24:42.316   413   501 I WifiClientModeImpl: Connecting with 7a:f8:f8:9e:da:fc as the mac address
06-29 10:24:42.317   326   326 W wificond: Scan is not started. Ignore abort request
06-29 10:24:42.319   413   501 D SupplicantStaIfaceHal: connectToNetwork "MyNetwork2"WPA_PSK
06-29 10:24:42.319   413   501 D SupplicantStaIfaceHal: Network is already saved, but need to update BSSID.
06-29 10:24:42.334  3892  3892 I wpa_supplicant: wlan0: SME: Trying to authenticate with 37:XX:XX:XX:XX:e2 (SSID='MyNetwork2' freq=2472 MHz)
06-29 10:24:42.454  3892  3892 I wpa_supplicant: wlan0: Trying to associate with 37:XX:XX:XX:XX:e2 (SSID='MyNetwork2' freq=2472 MHz)
06-29 10:24:42.560   413   433 I EthernetTracker: interfaceLinkStateChanged, iface: wlan0, up: true
06-29 10:24:42.563  3892  3892 I wpa_supplicant: wlan0: Associated with 37:XX:XX:XX:XX:e2
06-29 10:24:42.568  3892  3892 I wpa_supplicant: wlan0: WPA: RX message 1 of 4-Way Handshake from 37:XX:XX:XX:XX:e2 (ver=2)
06-29 10:24:42.572  3892  3892 I wpa_supplicant: wlan0: WPA: Sending EAPOL-Key 2/4
06-29 10:24:42.572  3892  3892 I wpa_supplicant: wlan0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
06-29 10:24:42.583  3892  3892 I wpa_supplicant: wlan0: WPA: RX message 3 of 4-Way Handshake from 37:XX:XX:XX:XX:e2 (ver=2)
06-29 10:24:42.583  3892  3892 I wpa_supplicant: wlan0: WPA: Sending EAPOL-Key 4/4
06-29 10:24:42.607  3892  3892 I wpa_supplicant: wlan0: WPA: Key negotiation completed with 37:XX:XX:XX:XX:e2 [PTK=CCMP GTK=TKIP]
06-29 10:24:42.607  3892  3892 I wpa_supplicant: wlan0: CTRL-EVENT-CONNECTED - Connection to 37:XX:XX:XX:XX:e2 completed [id=0 id_str=%7B%22configKey%22%3A%22%5C%22MyNetwork2%5C%22WPA_PSK%22%2C%22creatorUid%22%3A%221000%22%7D]
06-29 10:24:42.612   413   433 I EthernetTracker: interfaceLinkStateChanged, iface: wlan0, up: true
06-29 10:24:42.629   413   501 D ConnectivityService: registerNetworkAgent NetworkAgentInfo{ ni{[type: WIFI[], state: UNKNOWN/IDLE, reason: (unspecified), extra: , failover: false, available: true, roaming: false]}  network{123}  nethandle{531686674445}  lp{{InterfaceName: wlan0 LinkAddresses: [ ] DnsAddresses: [ ] Domains: null MTU: 0 Routes: [ ]}}  nc{[ Transports: WIFI Capabilities: NOT_METERED&INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VPN&NOT_ROAMING&FOREGROUND&NOT_CONGESTED&NOT_SUSPENDED LinkUpBandwidth>=1048576Kbps LinkDnBandwidth>=1048576Kbps OwnerUid: 1000 SSID: "MyNetwork2" RequestorUid: -1 RequestorPackageName: null]}  Score{20}  everValidated{false}  lastValidated{false}  created{false} lingering{false} explicitlySelected{true} acceptUnvalidated{false} everCaptivePortalDetected{false} lastCaptivePortalDetected{false} partialConnectivity{false} acceptPartialConnectivity{false} clat{mBaseIface: null, mIface: null, mState: IDLE} }
06-29 10:24:42.663   413   506 D ConnectivityService: [123 WIFI] EVENT_NETWORK_INFO_CHANGED, going from UNKNOWN to UNKNOWN
06-29 10:24:42.680   413   501 V WifiClientModeImpl: stopIpClient IpClientWithPreConnection: false
06-29 10:24:42.680   413   501 V WifiClientModeImpl: java.lang.Throwable
06-29 10:24:42.680   413   501 V WifiClientModeImpl:    at com.android.server.wifi.ClientModeImpl.stopIpClient(ClientModeImpl.java:1069)
06-29 10:24:42.680   413   501 V WifiClientModeImpl:    at com.android.server.wifi.ClientModeImpl.stopDhcpSetup(ClientModeImpl.java:1084)
06-29 10:24:42.680   413   501 V WifiClientModeImpl:    at com.android.server.wifi.ClientModeImpl.startIpClient(ClientModeImpl.java:6535)
06-29 10:24:42.680   413   501 V WifiClientModeImpl:    at com.android.server.wifi.ClientModeImpl.access$6800(ClientModeImpl.java:163)
06-29 10:24:42.680   413   501 V WifiClientModeImpl:    at com.android.server.wifi.ClientModeImpl$ObtainingIpState.enter(ClientModeImpl.java:5132)
06-29 10:24:42.680   413   501 V WifiClientModeImpl:    at com.android.wifi.x.com.android.internal.util.StateMachine$SmHandler.invokeEnterMethods(StateMachine.java:1037)
06-29 10:24:42.680   413   501 V WifiClientModeImpl:    at com.android.wifi.x.com.android.internal.util.StateMachine$SmHandler.performTransitions(StateMachine.java:879)
06-29 10:24:42.680   413   501 V WifiClientModeImpl:    at com.android.wifi.x.com.android.internal.util.StateMachine$SmHandler.handleMessage(StateMachine.java:819)
06-29 10:24:42.680   413   501 V WifiClientModeImpl:    at android.os.Handler.dispatchMessage(Handler.java:106)
06-29 10:24:42.680   413   501 V WifiClientModeImpl:    at android.os.Looper.loop(Looper.java:223)
06-29 10:24:42.680   413   501 V WifiClientModeImpl:    at android.os.HandlerThread.run(HandlerThread.java:67)
06-29 10:24:42.693   413   501 E WifiVendorHal: getWifiLinkLayerStats_1_3_Internal(l.973) failed {.code = ERROR_UNKNOWN, .description = unknown error}
06-29 10:24:42.717   413   501 E WifiVendorHal: getWifiLinkLayerStats_1_3_Internal(l.973) failed {.code = ERROR_UNKNOWN, .description = unknown error}
06-29 10:24:42.741   413   506 D ConnectivityService: NetReassign [no changes]
06-29 10:24:42.756  3386  3386 E PreferenceGroup: Found duplicated key: "StandardWifiEntry:MyNetwork2,2". This can cause unintended behaviour, please use unique keys for every preference.
06-29 10:24:42.808   245   393 E Netd    : no such netId 123
06-29 10:24:42.832   413   501 E WifiVendorHal: getWifiLinkLayerStats_1_3_Internal(l.973) failed {.code = ERROR_UNKNOWN, .description = unknown error}
06-29 10:24:45.737   413   501 E WifiVendorHal: getWifiLinkLayerStats_1_3_Internal(l.973) failed {.code = ERROR_UNKNOWN, .description = unknown error}
06-29 10:24:48.754   413   501 E WifiVendorHal: getWifiLinkLayerStats_1_3_Internal(l.973) failed {.code = ERROR_UNKNOWN, .description = unknown error}
06-29 10:24:50.442   413  4727 I WifiService: startScan uid=1000
06-29 10:24:50.465   326   326 E wificond: NL80211_CMD_TRIGGER_SCAN failed: Device or resource busy
06-29 10:24:50.466   413   505 E WificondScannerImpl: Failed to start scan, freqs=null
06-29 10:24:50.469   413   501 E WifiScanRequestProxy: Scan failure received. reason: -1,description: Scan failed
06-29 10:24:50.523  1020  1754 I ChimeraSrvcProxy: NullBinder for android.net.action.RECOMMEND_NETWORKS triggering remote TransactionTooLargeException due to Service without Chimera impl
06-29 10:24:50.836   413  4727 I WifiService: startScan uid=1000
06-29 10:24:50.865   413   505 E WificondScannerImpl: Failed to start scan, freqs=null
06-29 10:24:50.869   413   501 E WifiScanRequestProxy: Scan failure received. reason: -1,description: Scan failed
06-29 10:24:50.933  1020  1754 I ChimeraSrvcProxy: NullBinder for android.net.action.RECOMMEND_NETWORKS triggering remote TransactionTooLargeException due to Service without Chimera impl
06-29 10:24:51.767   413   501 E WifiVendorHal: getWifiLinkLayerStats_1_3_Internal(l.973) failed {.code = ERROR_UNKNOWN, .description = unknown error}
06-29 10:24:50.864   326   326 E wificond: NL80211_CMD_TRIGGER_SCAN failed: Device or resource busy
06-29 10:24:54.789   413   501 E WifiVendorHal: getWifiLinkLayerStats_1_3_Internal(l.973) failed {.code = ERROR_UNKNOWN, .description = unknown error}
06-29 10:24:57.806   413   501 E WifiVendorHal: getWifiLinkLayerStats_1_3_Internal(l.973) failed {.code = ERROR_UNKNOWN, .description = unknown error}
06-29 10:25:00.454   413  6577 I WifiService: startScan uid=1000
06-29 10:25:00.716   413   501 E WifiVendorHal: getWifiLinkLayerStats_1_3_Internal(l.973) failed {.code = ERROR_UNKNOWN, .description = unknown error}
06-29 10:25:00.844   413  6577 I WifiService: startScan uid=1000
06-29 10:25:04.849   413  6577 E WifiThreadRunner: WifiThreadRunner.call() timed out!
06-29 10:25:04.849   413  6577 E WifiThreadRunner: java.lang.Throwable: Stack trace:
06-29 10:25:04.849   413  6577 E WifiThreadRunner:  at com.android.server.wifi.WifiThreadRunner.call(WifiThreadRunner.java:80)
06-29 10:25:04.849   413  6577 E WifiThreadRunner:  at com.android.server.wifi.WifiServiceImpl.startScan(WifiServiceImpl.java:497)
06-29 10:25:04.849   413  6577 E WifiThreadRunner:  at android.net.wifi.IWifiManager$Stub.onTransact(IWifiManager.java:718)
06-29 10:25:04.849   413  6577 E WifiThreadRunner:  at android.os.Binder.execTransactInternal(Binder.java:1154)
06-29 10:25:04.849   413  6577 E WifiThreadRunner:  at android.os.Binder.execTransact(Binder.java:1123)
06-29 10:25:05.967  3892  3892 I wpa_supplicant: wlan0: CTRL-EVENT-DISCONNECTED bssid=37:XX:XX:XX:XX:e2 reason=3 locally_generated=1
06-29 10:25:05.970   413   433 I EthernetTracker: interfaceLinkStateChanged, iface: wlan0, up: false
06-29 10:25:05.971   326   326 I wificond: Regulatory domain changed
06-29 10:25:05.973   413  3531 D WifiNl80211Manager: Scan result ready event
06-29 10:25:05.973   413  3531 D WifiNative: Scan result ready event
06-29 10:25:05.980   413   501 W LastMileLogger: Failed to stop event tracing: /sys/kernel/debug/tracing/instances/wifi/tracing_on: open failed: ENOENT (No such file or directory)
06-29 10:25:05.982   413   501 W LastMileLogger: Failed to read event trace: /sys/kernel/debug/tracing/instances/wifi/trace
06-29 10:25:05.985   326   326 I wificond: 2.4Ghz frequencies: 2412 2417 2422 2427 2432 2437 2442 2447 2452 2457 2462 2467 2472
06-29 10:25:05.987   326   326 I wificond: 5Ghz non-DFS frequencies:
06-29 10:25:05.987   326   326 I wificond: 5Ghz DFS frequencies:
06-29 10:25:05.987   326   326 I wificond: 6Ghz frequencies:
06-29 10:25:05.987   326   326 I wificond: Regulatory domain changed to country: ES
06-29 10:25:05.989   413   501 D WifiCountryCode: Reading country code from telephony
06-29 10:25:05.989  3892  3892 I wpa_supplicant: wlan0: CTRL-EVENT-REGDOM-CHANGE init=CORE type=WORLD
06-29 10:25:05.992   413   501 D WifiCountryCode: Set telephony country code to:
06-29 10:25:05.992   326   326 I wificond: 2.4Ghz frequencies: 2412 2417 2422 2427 2432 2437 2442 2447 2452 2457 2462 2467 2472
06-29 10:25:05.993   326   326 I wificond: 5Ghz non-DFS frequencies:
06-29 10:25:05.993   413   501 D WifiCountryCode: updateCountryCode to null
06-29 10:25:05.993   326   326 I wificond: 5Ghz DFS frequencies:
06-29 10:25:05.993   326   326 I wificond: 6Ghz frequencies:
06-29 10:25:05.993   413   501 D WifiClientModeImpl: Start Disconnecting Watchdog 24
06-29 10:25:05.994  3892  3892 I wpa_supplicant: wlan0: CTRL-EVENT-REGDOM-CHANGE init=USER type=COUNTRY alpha2=ES
06-29 10:25:05.999   413   501 I WifiClientModeImpl: Keep PMK cache for network disconnection reason 3
06-29 10:25:06.001   413   501 E WifiVendorHal: stopRssiMonitoring(l.2100) failed {.code = ERROR_NOT_AVAILABLE, .description = }
06-29 10:25:06.007   413   505 D WificondScannerImpl: Filtering out 1 scan results.
06-29 10:25:06.007   413   501 V WifiClientModeImpl: stopIpClient IpClientWithPreConnection: false
06-29 10:25:06.007   413   501 V WifiClientModeImpl: java.lang.Throwable
06-29 10:25:06.007   413   501 V WifiClientModeImpl:    at com.android.server.wifi.ClientModeImpl.stopIpClient(ClientModeImpl.java:1069)
06-29 10:25:06.007   413   501 V WifiClientModeImpl:    at com.android.server.wifi.ClientModeImpl.stopDhcpSetup(ClientModeImpl.java:1084)
06-29 10:25:06.007   413   501 V WifiClientModeImpl:    at com.android.server.wifi.ClientModeImpl.handleNetworkDisconnect(ClientModeImpl.java:2761)
06-29 10:25:06.007   413   501 V WifiClientModeImpl:    at com.android.server.wifi.ClientModeImpl.access$5400(ClientModeImpl.java:163)
06-29 10:25:06.007   413   501 V WifiClientModeImpl:    at com.android.server.wifi.ClientModeImpl$ConnectModeState.processMessage(ClientModeImpl.java:4290)
06-29 10:25:06.007   413   501 V WifiClientModeImpl:    at com.android.wifi.x.com.android.internal.util.StateMachine$SmHandler.processMsg(StateMachine.java:992)
06-29 10:25:06.007   413   501 V WifiClientModeImpl:    at com.android.wifi.x.com.android.internal.util.StateMachine$SmHandler.handleMessage(StateMachine.java:809)
06-29 10:25:06.007   413   501 V WifiClientModeImpl:    at android.os.Handler.dispatchMessage(Handler.java:106)
06-29 10:25:06.007   413   501 V WifiClientModeImpl:    at android.os.Looper.loop(Looper.java:223)
06-29 10:25:06.007   413   501 V WifiClientModeImpl:    at android.os.HandlerThread.run(HandlerThread.java:67)
06-29 10:25:06.021   413   506 D ConnectivityService: [123 WIFI] EVENT_NETWORK_INFO_CHANGED, going from UNKNOWN to DISCONNECTED
06-29 10:25:06.021   413   506 D ConnectivityService: [123 WIFI] disconnected, was satisfying 0
06-29 10:25:06.029   413   501 I WifiClientModeImpl: disconnectedstate enter
06-29 10:25:06.035   413   501 E WifiScoringParams: Invalid frequency(-1), using 5G as default rssi array
06-29 10:25:06.040  1020  1754 I ChimeraSrvcProxy: NullBinder for android.net.action.RECOMMEND_NETWORKS triggering remote TransactionTooLargeException due to Service without Chimera impl
06-29 10:25:06.042   413   501 V WifiClientModeImpl: stopIpClient IpClientWithPreConnection: false
06-29 10:25:06.042   413   501 V WifiClientModeImpl: java.lang.Throwable
06-29 10:25:06.042   413   501 V WifiClientModeImpl:    at com.android.server.wifi.ClientModeImpl.stopIpClient(ClientModeImpl.java:1069)
06-29 10:25:06.042   413   501 V WifiClientModeImpl:    at com.android.server.wifi.ClientModeImpl.access$4200(ClientModeImpl.java:163)
06-29 10:25:06.042   413   501 V WifiClientModeImpl:    at com.android.server.wifi.ClientModeImpl$DisconnectedState.processMessage(ClientModeImpl.java:5686)
06-29 10:25:06.042   413   501 V WifiClientModeImpl:    at com.android.wifi.x.com.android.internal.util.StateMachine$SmHandler.processMsg(StateMachine.java:992)
06-29 10:25:06.042   413   501 V WifiClientModeImpl:    at com.android.wifi.x.com.android.internal.util.StateMachine$SmHandler.handleMessage(StateMachine.java:809)
06-29 10:25:06.042   413   501 V WifiClientModeImpl:    at android.os.Handler.dispatchMessage(Handler.java:106)
06-29 10:25:06.042   413   501 V WifiClientModeImpl:    at android.os.Looper.loop(Looper.java:223)
06-29 10:25:06.042   413   501 V WifiClientModeImpl:    at android.os.HandlerThread.run(HandlerThread.java:67)
06-29 10:25:06.042   413   501 I WifiClientModeImpl: Keep PMK cache for network disconnection reason 3
06-29 10:25:06.049   413   501 D WifiNetworkAgent: NetworkAgent: NetworkAgent channel lost
06-29 10:25:06.055   413   501 E WifiVendorHal: getWifiLinkLayerStats_1_3_Internal(l.973) failed {.code = ERROR_UNKNOWN, .description = unknown error}
06-29 10:25:06.073   413   506 D ConnectivityService: NetReassign [no changes]
06-29 10:25:06.137  1020  1754 I ChimeraSrvcProxy: NullBinder for android.net.action.RECOMMEND_NETWORKS triggering remote TransactionTooLargeException due to Service without Chimera impl
06-29 10:25:07.389   413  4727 D WifiNl80211Manager: Scan result ready event
06-29 10:25:07.389   413  4727 D WifiNative: Scan result ready event
06-29 10:25:07.411   413   505 D WificondScannerImpl: Filtering out 5 scan results.
06-29 10:25:07.425   413   501 E WifiVendorHal: getWifiLinkLayerStats_1_3_Internal(l.973) failed {.code = ERROR_UNKNOWN, .description = unknown error}
06-29 10:25:07.461  1020  1754 I ChimeraSrvcProxy: NullBinder for android.net.action.RECOMMEND_NETWORKS triggering remote TransactionTooLargeException due to Service without Chimera impl
06-29 10:25:10.475   413  4727 I WifiService: startScan uid=1000
06-29 10:25:11.845   413  4727 D WifiNl80211Manager: Scan result ready event
06-29 10:25:11.845   413  4727 D WifiNative: Scan result ready event
06-29 10:25:11.860   413   505 D WificondScannerImpl: Filtering out 2 scan results.
06-29 10:25:11.872   413   501 E WifiVendorHal: getWifiLinkLayerStats_1_3_Internal(l.973) failed {.code = ERROR_UNKNOWN, .description = unknown error}
06-29 10:25:11.926  1020  1754 I ChimeraSrvcProxy: NullBinder for android.net.action.RECOMMEND_NETWORKS triggering remote TransactionTooLargeException due to Service without Chimera impl
06-29 10:25:14.866   413  4727 I WifiService: startScan uid=1000
06-29 10:25:16.043   413   501 D WifiConfigStore: Writing to stores completed in 13 ms.
06-29 10:25:16.251   413  3531 D WifiNl80211Manager: Scan result ready event
06-29 10:25:16.251   413  3531 D WifiNative: Scan result ready event
06-29 10:25:16.267   413   505 D WificondScannerImpl: Filtering out 3 scan results.
06-29 10:25:16.279   413   501 E WifiVendorHal: getWifiLinkLayerStats_1_3_Internal(l.973) failed {.code = ERROR_UNKNOWN, .description = unknown error}
06-29 10:25:16.343  1020  1178 I ChimeraSrvcProxy: NullBinder for android.net.action.RECOMMEND_NETWORKS triggering remote TransactionTooLargeException due to Service without Chimera impl

```

I am unable to make sense of the above logs. They are nothing short of gibberish to an end-user trying to debug their problem.

So, would anyone have an idea about what is wrong here - and what should I do to get WiFi connection with this tablet on this router and network work?

# Answer
First of all, I found https://f-droid.org/packages/com.vrem.wifianalyzer/ \- obviously, it had to be installed via `adb install` over USB, as I did not have WiFi.

But this program showed, that all this device can see, are networks in the 2.4 GHz range. So, I set my network to 5 GHz only - and suddenly, it was invisible to the tablet.

Then I thought, I should take a closer look at the specs of the tablet. Of course, there are no specs of the tablet to find easily.

Thankfully, I finally found something that looks more or less reasonable:

https://mobilespecs.net/tablet/THOMSON/Thomson\_TEO\_13P\_T13P2BK32V2\_32\_GB\_13.3\_T13P2BK32V3.html

> * Processor model: A133
> * Processor family: Allwinner
> * Wi-Fi standards: 802.11b, 802.11g, Wi-Fi 4 (802.11n)
> * Top Wi-Fi standard: Wi-Fi 4 (802.11n)

Rather unfortunate (though expected), there is no mention of what WiFi chipset is being used; I found this: https://www.cnx-software.com/2020/10/31/allwinner-a133-tablet-processor-pairs-with-xr829-or-aw859a-wifi-bluetooth-chip/

> the company also pairs A133 processor with its own wireless chips, either XR829 WiFI 4 and Bluetooth 4.2 chip, or AW859A dual-band 802.11ac WiFi 5 and Bluetooth 5 chip.

So, my guess is this device has an XR829 WiFi chipset. But never mind that.

If I look at https://www.rfwireless-world.com/Terminology/difference-between-wifi-6-and-wifi-5.html \- they mention that WiFi 3 "supports 2.4 GHz and 5 GHz frequency bands", but there is no such mention for WiFi 4. So, I cannot really tell, if WiFi 4 *in principle* supports 5 GHz - but based on what the app above reported, I assumed that this WiFi chip cannot handle 5 GHz.

So, I just made these changes to my WiFi network, with respect to the screenshot posted above in OP:

* Security options: back to WPA2-Personal \[AES\] *only*
* Band: 2.4 GHz *only*

... and finally, it connected to the Wi-Fi.
> 1 votes

---
Tags: wi-fi, networking, connection-issues, android-11
---


title: Fastboot flash boot (FAILED)

text:
# Question
Title: Fastboot flash boot (FAILED)
I am using Ubuntu 20.04.3 LTS and when trying to boot into, or flash, the TWRP recovery bootimage image I compiled.

I have no additional information on why I got this error. Just flashing twrp bootimage on moto g(40) fusion. Error I received on executing `fastboot boot boot.img`:

```
$    downloading 'boot.img'...
$    FAILED (command write failed (Success))
$    finished. total time: 0.000s

```

# Answer
> 0 votes
My error was resolved on **using different usb slot** to connect my device via usb cable. I still have no idea on why I got this error but it was resolved. Maybe **using a different usb cable** might also solve this error.

# Answer
> 1 votes
https://forum.xda-developers.com/t/fastboot-problem-on-usb-3-0-ports.3859995/ also talks about this problem, although it might be a different case.

In their case, it was a Poco F1 phone, a computer with a AMD CPU, and a **USB 3.0 port**. Downgrading to USB 2.0 fixed the problem

The thread also offered a way to fix it on Windows by running these commands as administrator. I'm not sure what they do, but they seem to force USB 2.0

```
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\usbflags\18D1D00D0100" /v "osvc" /t REG_BINARY /d "0000" /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\usbflags\18D1D00D0100" /v "SkipContainerIdQuery" /t REG_BINARY /d "01000000" /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\usbflags\18D1D00D0100" /v "SkipBOSDescriptorQuery" /t REG_BINARY /d "01000000" /f

```

---
Tags: adb, twrp, fastboot, linux
---


# Question
Title: How to unpack and edit boot.img for ROM porting?
I recently downloaded this ROM for my Allview P5 (Allview P5 is the equivalent of Gionee GN700W/FLY IQ441/QMobile Noir A8). It\`s called Primonex ROM and is made for the Gionee version of the phone.

* Firstly, I tried to install it as it is but it got stuck at the boot screen.
* After some research I found out that it could be a problem with the `boot.img` file and I don't know how to extract or edit it...

Can someone tell me how to do it?

# Answer
# Tools selection

The method I present here relies on CyanogenMod's Android source code.

While Google's AOSP only provides the tool to *build* the `boot.img` file, CyanogenMod also adds the `unpackbootimg` tool allowing you to *unpack* it. This tool does not seem specifically designed for CyanogenMod in any way, so most chances are that it will work for other ROMs as well.

There are, however, a relatively large number of alternatives to unpack the `boot.img` file which all work more-or-less the same.

Basically, such unpack tool will extract the content of the `boot.img` file and display a set of parameters you will have to pass to Google's `mkbootimg` tool to build a file whose configuration (mainly kernel parameters and memory addresses) will match the original one.

Here are a few examples, I did not test them personally so cannot recommend any and I present them only for reference purposes:

* A few are open source or script based:

+ The Android Kitchen was apparently meant to be some kind of Swiss army knife for Android developers. The original author officially stopped maintaining the project, a few other users forked it like javilonas or cmotc.
    + szym targets easiness by adding shell script wrappers to its toolset to make the complete unpacking and repacking process more straightforward.
    + osm0sis proposes a fork of CyanogenMod's tools *"forked and updated"* according to the project's own description. This project seems indeed still maintained which is not very common in this area, however the actual advantage over CyanogenMod's original tools remains unclear to me.
* Some are free closed source proprietary binaries:

+ Kuisma's `unmkbootimg` appears pretty often in help forums and seems to do a good job in helping to handle odd cases, outputting "human readable" English recommendation when some modification are required in `mkbootimg` source code and displaying the exact command-line to use to rebuild the image.
    + Xiaolu's `mkbootimg_tools` seems also mentioned quite often and allows to unpack and repack `boot.img` and the device tree file `dt.img`. Don't be fooled by the fact it is hosted on GitHub: it *is* a closed source proprietary binary and only compiled binaries are available on their repository (actually I'm even wondering about the exact interest of using a source-code repository to store binary blobs, but different people, different minds...).
    + CNexus on the XDA forum provides an archive with a selection of tools.
    + This answer in Unix.SE recommends some tools from the now seemingly defunct Android Serial Port project. The file names, however, lead me to think these should be old prebuilt versions of CyanogenMod's tools (the project being closed, there is neither documentation nor support).

All these tools (and others you may find with any search engine) should work the same way, but some may work better than others in handling some particular edge-case you may face with your own device. Most of them however, at least in the open source arena, do not seem regularly maintained, so the best bet in my opinion to have working, maintained and documented tools is to go with CyanogenMod's ones.

Some manufacturers produce ROMs which are more or less far from AOSP standard (unusual addresses, headers, file format, etc.). If the standard procedure below does not work, maybe one of these alternative software may do the trick. Otherwise, you will have to check for issues specific to your device: some seem to need a specific procedure or even specific tools (confer this question related to MediaTek devices, for instance).

# Tools installation

Compiling CyanogenMod toolset for `boot.img` packing and unpacking is quite straightforward.

* If you already have installed the complete Android source code tree (you can check my other answer to get more information about this), go in `system/core/mkbootimg/` directory (as a reminder, Google's AOSP source code only provide the tool to build the `boot.img` file, they do *not* provide any unpacking tool),
* If you haven't and don't need this for any other purpose, an easier and quicker solution is to only clone CyanogenMod's *android\_system\_core* repository:

```
  git clone https://github.com/CyanogenMod/android_system_core.git
  cd android_system_core/mkbootimg/

```

Once in the right directory, compile and install:

```
gcc -o ./mkbootimg -I ../include ../libmincrypt/*.c ./mkbootimg.c
gcc -o ./unpackbootimg -I ../include ../libmincrypt/*.c ./unpackbootimg.c
sudo cp ./mkbootimg ./unpackbootimg /usr/bin/

```

Note that Google is replacing the C `mkbootimg` with a Python version, so in future versions no compilation may be needed anymore for this command.

You will also need to install Android tools on your computer to let it communicate with your phone. You will need `adb` (Android Debug Bridge, a shell utility allowing to communicate with Android's debug subsystem), `adbd` (the related daemon) and `fastboot` (a shell utility allowing to communicate with your phone's bootloader system).

Your favorite Linux distribution may provide them in a single or separate packages, but usually they are always called "android-tools":

* Debian / Ubuntu: `sudo apt-get install android-tools-{adb,adbd,fastboot}`
* Fedora / CentOS: `sudo yum install android-tools`
* openSUSE: `sudo zypper install android-tools`

# Fetch the `boot.img` file

Extract the boot.img either from ROM .zip file or directly from the device:

* From the stock ROM .zip file: some applications like SuperSU may modify the boot.img directly on the device, replacing it with the stock one would break such applications.
* Directly from the device: some people report read issue leading to corrupted `boot.img`. IMO, these issues are most likely linked to the use of poor USB cables or USB hub and can be simply avoided by using good quality cables connecting directly the phone to the computer. You also need the ability to run ADB in root mode (depending on the ROM used, this may be trivial or not).

The first method is very obvious: extract the .zip file with any ZIP software, the `boot.img` file should be right there at the root of the archive.

For the second method, you will first have to determine the (sadly device-specific) path to the storage device where `boot.img`'s content can be retrieved. I know two methods for this:

* `ls /dev/block/platform/*/by-name/` (where `*` covers yet another device-specific folder name, chances are it is the only directory below `platform/`), the exact name to search is also platform dependent but makes usual sense (some examples: `boot`, `LNX` (acronym for "Linux")). The files in this directory are actually symbolic links and some people bother to manually go to the target, but I recommend sticking with the higher level name based path which, while longer, remains less error prone. So you will end-up with a path like `/dev/block/platform/sdhci-tegra.3/by-name/LNX`.
* On some (older?) devices, the right device could be found by investigating the output of `cat /proc/mtd`. If you see the device `mtd2` associated to the `"boot"` label, then you will use the path `/dev/mtd2`.

Now:

* From the phone's developer menu:
    + Enable debugging on your phone,
    + Allow root access to ADB (this step applies to phones running CynogenMod, other devices may require some potentially more complex procedure),
* Connect it to your computer (and from there to the VM guest if you are running Android tools from within a virtual machine).

If this is not already done, I recommend to manually start the ADB server on the computer's side, this will allow you to directly validate the RSA key on device's side without affecting the behavior of the following ADB commands:

```
adb start-server

```

Then switch ADB in root mode:

```
adb root

```

Finally, you should be able to directly extract the `boot.img` file from the device using such command (the source and destination path and names are given as examples, adapt them to your needs and preferences):

```
adb pull /dev/block/platform/sdhci-tegra.3/by-name/LNX ./boot.img

```

The command will copy the whole partition, both used and free space, so don't be surprised that the resulting `boot.img` file will be larger than the original `boot.img` file coming with the stock ROM .zip file, the content itself remains similar.

Once the transfer is finished, disconnect the phone and don't forget to disable both debugging and root access from the developer menu.

# Unpack the original `boot.img` file

Unpack the `boot.img` file itself using the command compiled previously:

```
unpackbootimg -i ./boot.img

```

This will output several information essential to let you rebuild a new `boot.img` with the correct structure with respect to the stock `boot.img`. However, don't rush on your notepad since CyanogenMod's `upackbootimg` also saves the very same information in several files we will use later on.

This command generates several files with particular suffixes added to the input file's name:

* `*-second`: This is the second-stage bootloader, optional and rarely used on end-user phones. If this file is empty (the most common case), then the phone's bootloader will directly call the Linux kernel.
* `*-zImage`: This is the Linux kernel.
* `*-ramdisk.gz` or `*-ramdisk.lz4`: the RAM disk used to populate the device's root directory. The extension differs depending on the compression algorithm used.
* `*-dt`: The device tree, populating `/dev`.
* The rest are small files each storing one of the values displayed in `unpackbootimg` output. These values define the command-line parameter to pass to the Linux kernel and the addresses where the bootloader will have to load each object at boot time.

Most often, one unpacks the `boot.img` to be able to edit the content of the phone's root directory. As seen above, this content is stored in the `*-ramdisk.gz` or `*-ramdisk.lz4` file and it can be extracted using the commands below:

```
mkdir ./ramdisk
cd ./ramdisk/
gzip -dc ../boot.img-ramdisk.gz | cpio -imd

```

For an LZ4 compressed RAM disk, replace the last step with `lz4 -d ../boot.img-ramdisk.lz4 | cpio -imd`.

You are now free to do the modification you want before proceeding. However, it could be worth to follow the full unpack - repack - boot procedure once without changing anything to ensure that your tools are working as expected. Otherwise, in case of an issue, you will not be certain if the cause is your modification or some incompatibility (see my remarks at the beginning about some manufacturers requiring non-standard procedures or tools).

# Rebuild to get the new `new-boot.img` file

CyanogenMod ROM building process relies on an internal tool, `mkbootfs`, to produce the `boot.img` file (this happens in build/tools/releasetools/common.py). However, the steps to build this tool seems uselessly complex to me, whereas using the system-provided `cpio` seems to work just as fine. The main difference between the two, as per my understanding after a (very) quick check in `mkbootfs` souce code, seems to be that the latter applies some sanity measures by not including dotted files and the `/root` directory in the resulting archive while the `cpio`-based procedure below will just blindly put the whole selected directory tree in the archive.

Conclusion: unnecessarily complex to compile with very few advantages, so let's stick on system provided tools!

Begin by creating the new RAM disk, from the `ramdisk` directory created above, type:

```
find . ! -name . | LC_ALL=C sort | cpio -o -H newc -R root:root | gzip > ../new-boot.img-ramdisk.gz

```

Or, if you need to generate an LZ4 archive:

```
find . ! -name . | LC_ALL=C sort | cpio -o -H newc -R root:root | lz4 > ../new-boot.img-ramdisk.lz4

```

The goal here is to create a new RAM disk file with properties as close as possible to the original one (for instance, setting the owner seems often missing in the procedures shared in forums and blogs, however this was required on my device).

Go now in the parent directory to generate the `new-boot.img` file itself.

```
cd ..

```

As seen above, CyanogenMod's `unpackbootimg` command generates a file matching each parameter expected by `mkbootimg`. Therefore, all you have to do is issue a `mkbootimg -h` to get a listing of all parameters, then set each one of them to the appropriate value using the matching file. Note that some parameters expect a file path while others expect to receive the content of the file as value. See an example of resulting command below:

```
mkbootimg                                           \
--kernel ./boot.img-zImage                          \
--ramdisk ./new-boot.img-ramdisk.gz                 \
--second ./boot.img-second                          \
--cmdline "$(cat ./boot.img-cmdline)"               \
--base "$(cat ./boot.img-base)"                     \
--pagesize "$(cat ./boot.img-pagesize)"             \
--dt ./boot.img-dt                                  \
--ramdisk_offset "$(cat ./boot.img-ramdisk_offset)" \
--second_offset "$(cat ./boot.img-second_offset)"   \
--tags_offset "$(cat ./boot.img-tags_offset)"       \
--output ./new-boot.img

```

Only two parameters are not set here:

* `--board`: As per my understanding, this is just an informative field allowing to insert a model name in the resulting image.
* `--id`: This one does not expect any value, it just prints out a unique identifier after the image has been built (combining a timestamp and a checksum).

# Flash the `new-boot.img` file onto the device

* Start the device in fastboot mode (aka bootloader mode, usually by holding power and volume up buttons).
* Connect the USB cable.
* Check that the device is correctly detected:

```
  sudo fastboot devices

```
* Try to boot using the new ROM (without flashing it yet, so in case of issue you just have to restart the phone to get it back on trails, replace the `./new-boot.img` file name with your own):

```
  sudo fastboot boot ./new-boot.img

```
* If the phone works successfully with the new boot image, then go back in fastboot mode and flash it permanently:

```
  sudo fastboot flash boot ./new-boot.img
  sudo fastboot reboot

```

# Conclusion

This procedure may seem daunting at first, but once you get it, you will see it is actually not.

The "daunting" aspect comes from the fact that there is not a single "Android system": a lot of manufacturers and ROM providers make changes which can range from a subtle path difference to a completely non-standard environment.

What you have to do is determine your particular device's posture, and then what are the few commands which are appropriate in your case. Once you get them, you can stick to them and even easily script them if you need them often.

I voluntarily went into relatively low-level details sometimes because it will make you troubleshooting your issues more easily. Would you use some "easier" opaque utility to build and flash your new `boot.img` file and see that your device cannot start with it, it would be harder for you to determine which step went wrong. Here, at each step, you will be able to compare the data you are manipulating with the data coming from the original `boot.img` file or the data as seen on the phone, or try for instance to rebuild the `boot.img` file with either the original or the newly generated RAM disk file to check if that makes any difference (this allows you to pinpoint if the issue comes from the `boot.img` or the RAM disk file generation procedure).
> 16 votes

# Answer
Use the Android Kitchen. There is an option to unpack/repack boot.img there, under `Advanced options`.
> 2 votes

# Answer
Trying to edit boot.img on some no-name mediatek phone only Android boot image editor worked perfectly. It's simple and easy to use. Other tools are either not maintained anymore, or produced invalid boot image.
> 1 votes

---
Tags: rom-flashing, rom
---


# Question
Title: How do I block an app from using mobile data even in foreground?
I want to block an app from using mobile data even when that app is in foreground. How can I do that? I can find an option to disable mobile data when in background and an option to disable WiFi for an app but I want to disable mobile data for a specific app completely. I am using a Galaxy A71 phone with Android 10.

# Answer
Use a Firewall. See Firewall Tag Wiki for helpful reading.

Net Guard is a well acclaimed app that does not need root access. It is an open source app developed by Marcel and can be downloaded from F-Droid too. It is very effective and has excellent logging features too.
> 0 votes

# Answer
The popular Android distribution LineageOS has a built-in firewall that can block an app from using mobile data and/or WiFi entirely.

https://lineageos.org/
> 0 votes

---
Tags: mobile-data, android-10
---


# Question
Title: How do I prevent an app from running a foreground service?
I have an app that wants to run a foreground service (not configurable) but I want the regular Android power restrictions to be applied to it because the foreground service is unnecessary (I always start it manually when needed).

I do not want to force-stop the app.

How can I prevent the app from starting a background service? I tried `pm revoke <packagename> android.permission.FOREGROUND_SERVICE` but apparently that's not a changeable permission type.

# Answer
> 3 votes
This permission is always granted but is managed via AppOps.

To prevent an app from using it, run `appops set <packagename> START_FOREGROUND ignore`.

---
Tags: battery-life, permissions
---


# Question
Title: WhatsApp can't use Google account for backup
My old phone just died on me yesterday. It used to back up the WhatsApp chat history to my main Google account, which I also used to register the device.

Now I have a new phone, and I registered it to the same Google account. After installing WhatsApp, I tried to restore the Google Drive backup to the new installation. However, when I try to enter my Google account, it tells me "This account already exists on your device"

Somehow after switching apps, WhatsApp assumed I don't want to restore a backup, and now I'm stuck with no history.

Also, when I try to set up the Google Drive backup on my new device, it gives me the same error when I try to enter my Google account; "This account already exists on your device". I can't figure out what I am doing wrong.

Is it just impossible to backup WhatsApp to an account already registered to the same device?

# Answer
I just encountered the same problem on Android 13. I fixed the problem by deleting the Google account and then in the application settings Google Play Service \> Permissions. Make sure there are no more denied permissions.
I deleted all WhatsApp data and then made sure there were no more denied permissions.
Then restarted the application.

I was able to add a Google account and find my backup !
> 2 votes

# Answer
Did you already add that Google account while setting up the phone? Please check Settings \> Users & accounts if that account is already added. If it is, then try removing it and adding it again.

**P.S:** It may be called *Accounts* in older Android versions.
> 1 votes

# Answer
After several unsuccessful attempts to get Whatsapp to use my main google account, I just left it as it was. After a few weeks, Whatsapp notified me by itself that I should set up a backup plan. At that time, it *did* allow me to select the account I wanted to use, without a hassle.

Looks like the problem fixed itself over time.
> 1 votes

# Answer
Not deliberately wanting to comment on a necro'd thread, BUT ... I literally just had exactly this issue, following a message from WhatsApp itself. However, the solution was quite simple:-

I forced a complete restart of the app by using the Android STOP option on the WhatsApp application; and Restarting it using the icon on the main screen.

Once that was done, it allowed me to setup the backup frequency on my existing Google account.
> 0 votes

---
Tags: whatsapp-messenger, google-account
---


# Question
Title: Apps suddenly unable to access SD card for seemingly no reason
## SOLVED (see accepted answer)

So this one is weird.

Everything was working fine untill I rebooted my phone earlier today.

For some reason, since this reboot, apps are unable to access my SD card storage. As far as I know, no update was applied with this reboot. I do not recall tinkering or changing anything related to this recently.

**Symptoms**

* SD card is still visible in the storage tab of the settings (there is no available option to unmount or eject it) or in select cases when choosing a folder from an app, however the content does not show up past the root.
* My music player (Oto music) sends an error message "Cannot play this file" while trying to play a song from the SD card
* File explorer will not show the SD card directory at all
* Resillio Sync has a synced folder on the SD card. It now says "Can't open the destination folder". If I try adding a new synced folder on the SD card and select the root of the SD card, I get the message "Android OS restricts access to this folder"
* Google file is stuck in a loop trying to get permissions to access the card
* SD card works just fine on another phone.
* Other SD cards have the same problem with my phone, not just this one
* SD card does not show up when using file transfer with a Windows PC
* Rebooting the phone did nothing
* Removing the card and putting it back in again did nothing
* Formatting the card did nothing
* I factory reset the phone. It worked, but the problem came back at the first reboot.

**Current state of investigations** I have reset the phone a second time and reboot it every time I install an app, uninstall or disable a system app or change some settings. So far the SD card is still accessible so I know what it's not:

* it's not the fault of disabling system apps
* it's not related to using a work profile (Insular)
* still haven't found an app that causes it

I have no idea what could cause this, all I know is it's related to my phone in particular and it appeared out of nowhere.

I am using Android 13 on ColorOS.

Thanks to anyone who can help.

# Answer
## **SOLVED**

Found the thing! This bug is caused by activating the option Disable permission monitoring in the Developper Options.

This is an option that is specific to a handful of phone manufacturers (Oppo in my case). Enabling this option is needed for using some tweak apps such as Shizuku. However, if it is enabled on phone boot, SD card will be unaccessible.

## **FIX**

Disabling this option and rebooting the phone fixed it. If you still need to use this option, you can enable it while the phone is on and disable it before rebooting. It will work fine despite this minor inconvenience.
> 2 votes

---
Tags: external-sd, sd-card, storage, files, file-permissions
---


# Question
Title: Smartphone locked with no access to Gboard Keyboard
(First excuse my bad English, It's not my mother tongue)

Before my smartphone (Wiko Freddy) was locked, somebody disable GBoard on it, and reboot the phone.

I read a lot of articles and try a lot of tools on my computer (Windows 10 x64) from the net, but actually nothing unlocked this problem.

When connecting the phone with a USB cable to Windows 10 :

* the phone is in "charging mode"

On the phone, USB Debugging Mode seems active, but not detected from the tools who requested to activate this option on the phone before continuing.

List of products/tools tested :

* DroitKit
* FoneDog Toolkit for Android
* Free Android Data Recovery
* iMyFone D-BAck for Android
* iMyFone LockWiper (Android)
* Jihosoft Android Phone Recovery
* MyPhoneExplorer
* ScrCpy
* SnapPea
* UltData for Android
* UnlockGo (Android) And other products removed from the pc.

Some of the tested tools inform that they can unlock only Samsung phone. Some are only trial version.

In device manager (Windows) : =\> Android Device

* Android Composite ADB Interface

=\> Other devices : (3 times Android without installed drivers)

* Android
* Android
* Android

I try to update drivers but Windows says that the last drivers are still installed. =\> Wiko-Freddy USB drivers =\> Google USB Drivers

I try to use ADB commands. But the device is unauthorized. D:\_adb-tools\>adb devices * daemon not running; starting now at tcp:5037 * daemon started successfully List of devices attached 37dc5a88 unauthorized \<=====

I don't see any confirmation dialog box on the phone to allow remote connexion (from windows).

I'm sure that this problem can be resolved without reset the phone in the original configuration. I would like to preserve all datas on the phone.

I would like to know How to use ADB commands to :

* Force the unauthorized status to authorized
* Reactivate GBoard
* and change the charging mode to MTP mode

## By advance, many thanks for your help. Regards,

Hi Alexcs (and eveybody)

Thank you very much for your reply.

As I'm a novice, and try to understand, can you give me more details on this solution please.

* With this solution, is there any risk for the data's ?
* When I search the stock ROM for the Wiko Freddy on the net, there are a lot of sites who propose this file, with different size. Do you have any recommendation for choosing the right one ?
* How to put the phone in EDL mode ?

I just know the recovery mode when pressing Power on and volume down on the phone on boot. Options are : Reboot system now Reboot to bootloader Apply update from ADB (\**) Apply update from SD card Wipe data factory reset wipe cache partition Mount /system View recovery logs Power off

(\**) When testing this option, this message appear on the mobile : Supported API: 3 Now send the package you want to apply to the device with "adb sideload "

On windows : List of devices attached 37dc5a88 sideload

As it's seem possible to send package and write in this case to the phone, Is there any way to :

* copy the configuration file where the Gboard keyboard should be define to the pc
* modify this file (with any tool)
* and copy (replace) it back to the phone in the good place
* and reboot the mobile to retrieve the keyboard?

By advance, thank you very much for your help and answers about all solutions who will preserve all data's on the phone. Regards,

# Answer
You haven't mentioned android version, but I guess it's AVBv1 signed. Therefore it's possible to flash modified boot partition.

* download the stock ROM
* extract the `boot.img` file with AIK
* modify `default.prop`

```
ro.adb.secure=0
persist.service.adb.enable=1

```
* repack the file
* flash file into `boot` partition in EDL mode

once adb is working use scrcpy to do the necessary.
> 1 votes

---
Tags: adb
---


# Question
Title: How to easily switch keyboards on Android 9 (MIUI)
My old phone (Android 8 I believe) showed a little icon on bottom right side to allow switching keyboards, from Gboard to Hackers' keyboard or else.

My new phone on Android 9 (also a new brand, Xiaomi, MIUI) after installing several keyboards, does not show the switch.

Does someone know how to switch keyboards easily on Xiaomi's Android 9 (as I could do previously on older Android) without having to go everytime into Configuration menus.

# Answer
**To switch between different languages in Gboard** (keyboard visible in the screenshot in the question) —

* Long press on the spacebar
(In much older versions of Gboard, you could also switch between different installed keyboards this way, but that feature disappeared long back.)
* Use the language switch key (the globe-like icon on the left of the spacebar)

**To switch to another installed keyboard**

* Go to Settings → Additional Settings → Languages & Input → Current Keyboard → Choose Keyboards
* Make sure that the keyboard that you want to use is enabled.
* Now, navigate to any text input and start typing with your current keyboard
* You should see a notification from Android System, that says *Choose keyboard*
(Note: This notification lasts only until your current keyboard is open, so you have to open the notification panel, without closing the keyboard, to see this notification.)
* Tap on this notification and you should be able to choose your other keyboard in the menu
> 1 votes

# Answer
Did you mean this?

First, you go to Settings \> Apps \> Manage Apps \> Select 3 dots on the top right corner \> Show All Apps. Then find the Android System, search notification name "Virtual Keyboard."
> 0 votes

# Answer
I did not see the option to switch keyboards because **I forgot that I blocked the notification for keyboard input.** I fixed it by following these steps:

* Go to Settings \> Apps \> Manage Apps
* Tap on the three dots on the top right corner and select Show All Apps
* Find and tap on Android System
* Tap on Notifications and scroll down to Virtual Keyboard
* Enable the notifications for Virtual Keyboard
> 0 votes

# Answer
Long press space. All keyboard options will display. Choose the one you want.
> -1 votes

---
Tags: keyboard
---


# Question
Title: How does Google Play determine location? How do I trick it to think I'm in US? VPN and location spoofer don't work
I just want to buy in-game content from Play Store and I can't redeem the code (with the "need more info" error). It's a US code, my phone has US settings, I cleared all Play data, made an account set in the US, and I use VPN and FakeGps which work on Google Maps, but YouTube and Play still know I'm not in the US right now, and I can't find any more info on what else it uses to tell where I am.

# Answer
It most likely knows this from your SIM card and phone number which is not a US one simply.
> 0 votes

---
Tags: google-play-store, geolocation, in-app-purchase
---


# Question
Title: Using multi profiles in Android browsers?
I want to have multi profiles in Android browsers. I mean, tabs that can open the same site with different credentials like many browsers on Windows.

How to achieve this?

# Answer
I haven't found one, but my solution is...

* I have many browsers installed and I use Firefox, Chrome, Brave, and DuckDuckGo for different purposes. There are many more choices to select from.

I have Brave installed as the default browser and use it for general purposes.
* Another option is to install Parallel Space, this will let you run a clone of another app. If you really want to use the two copies of the same browser, then you can run one under PS.

I have no affiliations with any of the browsers or Parallel Space.
> 1 votes

---
Tags: browser
---


# Question
Title: Can I customize the signal strength threshold for disconnecting WiFi?
Android's default threshold is too high, resulting in the system sometimes not cutting off WiFi even though the signal is already too weak to access the Internet. So I would like to set the threshold manually.

# Answer
As mentioned by Robert, this function is usually performed by Wifi Access Points that support "Active Handover" function. That's what I have at home, but it doesn't work elsewhere.

I have been using Wifi Switcher App

> Automatically switch to a better WiFi network when current signal is weak
>
> Ensure you stay connected to the most powerful Wi-Fi network available. The best WiFi roaming app available.
>
> By default, Android devices will not switch to a different Wi-Fi network as long as the current network connection is available, although the signal level is very weak and makes the network unusable.

There are many others that might work, But I haven't tried them.

I am not associated with any of them.
> 1 votes

---
Tags: applications, wi-fi
---


# Question
Title: SMS messages restored from Titanium Backup were automatically deleted
I understand I *should have* used a different app for backing up my messages, but I did not. I used Titanium Backup and made a full backup of apps and data. I was apparently also using Android Messenger and not Google Hangouts to store my SMS. This service was apparently deprecated in August. I go to Titanium to restore my messages, and for a moment, it looks good! I see all my messages. Then they rapidly delete themselves before my very eyes!

I try again, I reload app + data, or data only, and the same thing happens---I see all my messages, then I watch it delete them one by one very quickly.

What is happening in this process, and how can I prevent it? Where are they going?

About adb backups, not Titanium Backup, is this Reddit thread relevant (could I get my SMS back if I have an old ADB lying around?)?

# Answer
OK, here's the deal...

So, the issue was that Messenger vs Hangouts is controlled external to your application, and external to your Google account manager, it's an OS-level setting. So, the issue was I had to sign into Messenger, agree to the terms, declare it my default SMS manager, and then when I did the restore, it didn't automatically delete. I guess prior to this, Messenger and Hangouts were in a fight somehow.

This is probably a one-off problem, I had not converted from the deprecated messenger to the supported Hangouts, my phone was kind of grandfathered in, while the default SMS program had changed.

If you are in this situation in the future, set your default SMS to Messenger, and Hangouts won't delete your messages.
> 0 votes

# Answer
The very same thing happened to me as well. But no Hangouts is involved here. I just used the files of a TWRP backup, but OAndBackupX or Neo Backup will behave just the same.

There seems to be some other location where Android keeps the number of messages processed. Logcat says:

```
SyncCursorPair: Not in sync; # local messages = 9453, # remote message = 1*

```

What's pretty puzzling is that on a fresh phone, if you send 1 test message, then overwrite the `bugle_db` with your backup, all messages get deleted but your test message remains. There has to be some other storage for them as well.

I found https://github.com/tmo1/sms-db and it was quickly setup on Debian. Extract the `bugle_db` from whichever data backup you have.

Just issue

```
sms-db.pl -f bugle -i bugle_db

```

and then

```
sms-db.pl -f bugle -o msgs.xml

```

The resulting `msgs.xml` can be imported with https://www.synctech.com.au/sms-backup-restore/ (APK available for download, no Play Store necessary).

Worked reliably on a LineageOS 19.1 just now.

---

As a side note: use SMS Backup+ (F-Droid/Aurora Droid).

It can easily be configured to use your own mail server (I certainly don't want to hand my most private messages over to someone I don't know)

Aaaand: Make sure your \<insert relative here\> also regularly uses it after you set it up for them ;-) Would have made my life easier, it was there all the time on the old phone/ROM version anyway.

I also found https://github.com/p1ne/SMS-Tools and https://github.com/Nerdmind/Android-SMS-Extractor. They might come in handy as well.
> 1 votes

---
Tags: sms, backup, restore, titanium-backup
---