# Question
Title: How can I disable a stock app that has its Disable button greyed out?
There is a pesky bloatware app (specificlly VUDU Version 1.0) that came preinstalled on my device. Whenever I boot my device, it starts up an app process, so every time I boot I have to open up the App Switcher and swipe it away.

I went into the Settings app and tried to Force Stop and then Disable the app, but the Disable button is disabled ("greyed-out") itself. Some other apps also don't allow me to disable them. Is there any other way that I can enable the button or disable the app without rooting? I am running 4.4.2.

# Answer
> 4 votes
Sorry, but you have to root in order to do this. There is no other way.

1. Root
2. (optional) Install Titanium Backup and backup your phone. If you mess something up you can restore your phone using this
3. Now use an app called System App Remover to select the app you want to delete. You will have to grant superuser permission for it to work

# Answer
> 7 votes
On some Android versions you can use `adb` to disable apps that you would otherwise not be able to deactivate via the UI. The Debloater app linked to above automates and simplifies this process. This answer will explain how to perform the same process manually.

**WARNING: Disabling the wrong app or using the wrong commands can leave your device soft-bricked. Please make sure you know what you are doing before proceeding.**

1. Make sure you've got Android debugging set up correctly, then drop into an adb shell:

```
adb shell

```
2. Get a list of all installed packages by using `pm`

```
pm list packages -f

```
3. Identify the packages you want to disable and make a note of them.
4. Disable each package individually by running one of the following commands:

* if you are on **Kitkat**: `pm block <package_name>`, e.g. `pm block com.motorola.motocare`
    * if you are on **Lollipop**: `pm hide <package_name>`, e.g. `pm hide com.motorola.motocare`
5. The app should now be disabled and disappear from your launcher. In case of a background service it will permanently stop running in the background.

To reverse this procedure you can use one of the following commands:

* if you are on **Kitkat**: `pm unblock <package_name>`, e.g. `pm unblock com.motorola.motocare`
* if you are on **Lollipop**: `pm unhide <package_name>`, e.g. `pm unhide com.motorola.motocare`

# Answer
> 2 votes
Yes, there is another way :)

You are lucky because you have Android Kitkat version. Just use tool Debloater by Gatesjunior from XDA: http://forum.xda-developers.com/android/software/debloater-remove-carrier-bloat-t2998294

Requirements: The program requires that your manufacturer USB drivers are installed for your specific device as well as the following: • Windows Operating System • USB Debugging turned on for your device • Root or KitKat running on your device

# Answer
> 0 votes
Try this way:

1. Connect device via ADB
2. Go to ADB shell

```
adb shell

```
3. Find your target app by listing all the apps

```
pm list packages

```
4. Remove app like this

```
pm uninstall -k --user 0 com.android.inputdevices

```

---
Tags: 4.4-kitkat, bloatware, disable-app
---


title: How to disable builtin email app

text:
# Question
Title: How to disable builtin email app
On my new tablet I installed the gmail app and also configured the builtin app. Now I get two notifications for each email. How can I get rid of the builtin email app which does not seem as good as the gmail app?

# Answer
> 4 votes
If you have root you can do as suggested and use Titanium Backup to remove the stock email app.

If you aren't rooted you can remove the duplicate notification by going into the stock email app, settings, and then delete your email account from the app.

If you want to keep your account you can also go into your phone settings and find the application manager, swipe over to the all apps tab, find the stock email app and uncheck show notifications (if your android version is jelly bean).

# Answer
> 0 votes
Try this way:

1. Connect device via ADB
2. Go to ADB shell

```
adb shell

```
3. Remove app like this

```
pm uninstall -k --user 0 com.google.android.email

```

---
Tags: 4.1-jelly-bean, stock-email-app
---


title: My moto x wont turn on or charge

text:
# Question
Title: My moto x wont turn on or charge
So my Motorola X will not turn on or charge. Some other people have told me to connect it to a 5 volts 2.1 amps charger but that wont work for me. If any of you know a way that can work for me I would love it.

# Answer
> 2 votes
If you're sure you're using a known good charger, It's possible your phone just needs a reset. Try holding first the volume down button, and then the power switch at the same time for several seconds. If that doesn't work, try volume up and then the power button for several seconds. A few devices require all three be pressed at once. Do this after the charger has been connected for at least a half hour leaving it connected while you try the button combinations.

If that doesn't work, and you're certain you're using a known good charger and/or cable that work on other devices, your phone is very likely dead. It could be the battery or another hardware problem.

And, for future reference, it's very hard on LiIon batteries to run them completely dead and especially to leave them that way for very long. Phones will shut themselves down when the battery is too low but they continue to draw a small amount of power even while off. And that small drain can eventually destroy the battery.

# Answer
> 0 votes
I was having the same issues. Check out https://support.sprint.com/support/article/Troubleshoot-when-your-Moto-X-Pure-Edition-doesnt-turn-on/WTroubleshootingGuide\_542\_GKB89625-dvc9560007prd

For me, all I had to do was hold the power button for 30 seconds and boom, phone is on now. :D

# Answer
> 0 votes
tried everything plugged in laptop charge port and is no charging. before it wouldn't charge power up or restart just come on long enough to tell me that it was at 0% charge. charging fine now. Try laptop port to charge first may save a lot of time, up to 20% charge in 5 min.

# Answer
> 0 votes
My Moto X Play died completely after I plugged it in to my camera charger when the normal charger went walkabout. Retrospectively, I found it had charged up to 100 % and hibernated to protective mode to avoid damaging the battery. After lots of Googling I held the Volume Down and Power On Buttons until lots of gobbledook appeared on the screen about initiating a hard re-start or whatever and everything has worked fine since.

# Answer
> 0 votes
*phone stopped responding properly so I turned it off and it wouldn't turn back on when I tried, even plugged up and holding volume button..* **Solution:** Held power down for 10-30 seconds after leaving phone charging for over an hour and now it's restarted at 100%. Moto X 2nd gen

# Answer
> 0 votes
Moto X Style: Costed me 60 seconds (stopwatch check) before I got into the bootmenu again, by holding Power and volume up button. Old phone but still happy with it, live another day!!!

---
Tags: moto-x
---


# Question
Title: What represents 'bootloader' in the possible outputs of `adb get-state`?
I recently employed the use of `adb get-state` and decided to know further about it. Running `adb` *inter alia* shows:

```
adb get-state                - prints: offline | bootloader | device

```

I intend to know under what circumstance(s) would that command return *bootloader*.

As of now I'm aware of these outputs:

* device: booted into Android OS, debugging enabled and authorized
* recovery: booted into recovery environment
* sideload: during side-loading
* unauthorized: booted into Android OS, debugging enabled but not authorized yet
* *offline*: wireless device not in reach. (There may be other reasons.)
* unknown: When adbd not detected at other side. At least that's what I understand of it. Occurs in case of debugging being disabled or device not plugged in.

I'm yet to know about the following two outputs:

* host
* bootloader

I found all those outputs here with no added explanation.

Before you ask,

* yes, I've already ran that command when my Nexus 6 was booted into bootloader mode and I received *unknown* as output;
* it is mere curiosity with nothing that it would solve in particular *as of now*.

# Answer
> 2 votes
There are some hints in implementation details of ADB protocol and overview.

As communication starts between ADB server on host (PC) and ADB daemon (`adbd`) on device:

> Both sides send a CONNECT message when the connection between them is established.

Syntax of `CONNECT` message is:

```
CONNECT(version, maxdata, "system-identity-string")

```

> The system identity string should be `"<systemtype>:<serialno>:<banner>"` where systemtype is "bootloader", "device", or "host"

The connection state is set when the identity string is parsed. `device` and `host` are obvious i.e. if the CONNECT message is sent by device or host. We can't see `host` state on PC with an Android device on other side because it's set only when it's none of `bootloader`, `device` or three recovery states (`recovery`, `sideload` and `rescue`).

For `bootloader` part, it seems that ADB can have a *"simplified / embedded implementation... for limited environments, like the bootloader"*:

> The bootloader will support two streams. A "bootloader:debug" stream, which may be opened to get debug messages from the bootloader and a "bootloader:control", stream which will support the set of basic bootloader commands.

Also:

> The BOOTLOADER and RECOVERY states correspond to alternate states of devices when they are in the bootloader or recovery mode.

ADB server:

> maintains a list of "connected devices" and assigns a 'state' to each one of them: OFFLINE, BOOTLOADER, RECOVERY or ONLINE
> ...
> considers that a device is ONLINE when it has successfully connected to the adbd program within it. Otherwise, the device is OFFLINE

Other connection states (available to date) include:

```
Connecting    Haven't received a response from the device yet.
Authorizing   Authorizing with keys from ADB_VENDOR_KEYS.
Unauthorized  ADB_VENDOR_KEYS exhausted, fell back to user prompt.
NoPerm        Insufficient permissions to communicate with the device

```

With the addition of `authorizing` and `connecting` states:

> Previously, devices would transition as follows:
>
> ```
>   offline -> unauthorized -> offline -> online
>   offline -> unauthorized (when actually unauthorized)
>
> ```
>
> With this patch:
>
> ```
>   connecting -> authorizing -> online
>   connecting -> authorizing -> unauthorized (when actually unauthorized)
>
> ```

It seems that now `device offline` state appears only when a wrong `AUTH` type is requested or responded by client or server <sup>()</sup>.
`no permissions` or `connecting` states are set soon after device is connected.
`authorizing` or `unauthorized` are set when `AUTH` message is conveyed between client and server.
`unauthorized` is set either if host's private key(s) failed or if waiting for on-screen confirmation from user to add new public key.

If none of the above states is detected for any reason, it's returned `unknown`.

---
Tags: adb, command-line
---


# Question
Title: How to boot if the graphics chip is damaged and the screen is permanently blank?
My ASUS Zenphone Selfie Pro 4 graphics chip burned and the screen is green at boot, becoming blank after a while. Since I cannot see what is being 'shown' on the screen, how can I make the cellphone connect to wi-fi? I guess the boot process is halted at the gesture request screen.

# Answer
> 1 votes
I succeeded to boot by guessing the moment to enter the security gesture. Pressing the power button for 10s flashes green on the screen. If the touch doesn't respond, pressing again for 10s flashes again, and the gesture must be done timely.

---
Tags: data-recovery, remote-control, remote-access
---


title: UPNP over the internet?

text:
# Question
Title: UPNP over the internet?
I have a home media server running minidlna daemon, and I can stream media to my android phone when I am connected to the home LAN, but I can't seem to be able to do it over the internet. I'm using BubbleUPNP and I've already forwarded the ports on the home router, but I don't see any option/setting on the app to change the server address/port.

# Answer
This does not work because your phone does not receive the advertisement packets sent out by your media server and vice versa. Those packets are only forwarded within your home LAN but not over the internet (And for good reason: otherwise this would mean that *every* device connected to the internet would receive those advertisement packets).

One way to overcome this limitation would be to set up a VPN (like WireGuard, OpenVPN, IPsec, or the like). Thus your phone would get an IP address in, and stay connected to your home LAN, even if you are not on-site.
> 2 votes

---
Tags: internet, web-server, dlna
---


title: Removing encryption from recovery

text:
# Question
Title: Removing encryption from recovery
I'm running CyanogenMod 12 nightly on my G900T (klte). Everything works great except for the default encryption password, which causes my phone to boot loop.

I've formatted data and done factory resets, but `/data` is still encrypted and shows up as `/dev/dm-0`.

Is there a command that I can do to remove the encryption? I don't care about the data, I want it all gone. I just want to get back to having `/data` and the internal storage being stored in plaintext on disk to be able to boot into CyanogenMod.

How can I use `adb shell` to remove the encryption on these partitions?

# Answer
> 14 votes
The answer for me involved a number of things, but I think one is really the key.

# Use the "recovery" Command, bro

This uses CyanogenMod's/AOSP's `recovery` program to wipe the user data and disable encryption. (found in this answer on Stack Overflow) Boot into your recovery, and then from your computer run

```
adb shell recovery --wipe_data --set_filesystem_encryption=off

```

Your phone will reboot into system and things should hopefully work as planned.

If you need to run it from the phone itself (ie: you don't have a computer nearby to `adb` with):

```
recovery --wipe_data --set_filesystem_encryption=off

```

It should wipe, disable encryption, and reboot system.

# If All Else Fails

Don't use this method unless the above doesn't work or apply to your scenario.

### Destroy the LUKS Header for Filesystem Encryption

1. You need a recovery which will allow you to drop to a shell as `root`, so TWRP works in my case.
2. Locate the `userdata` partition by looking around in `/dev/block/platform/*/by-name/userdata`.
3. Write out a ton of zeroes to the beginning of that partition to wipe the LUKS header:

```
dd if=/dev/zero of=$PATH_TO_YOUR_USERDATA bs=4096 count=512

```

I claim no responsibility for what you do with this command. If you screw this up, you can brick your phone by overwriting your bootloader or other critical partitions. Make sure that `$PATH_TO_YOUR_USERDATA` points to the real `userdata` partition. Check the size of that partition to make sure you're wiping the right thing. I have a 16GB phone and `userdata` is 10.4GB, with the rest being dedicated to `system`, but your phone will be different.
4. Reformat that partition as `ext4` using `make_ext4fs $PATH_TO_YOUR_USERDATA`.

There might be errors, but usually they relate to not being able to find the internal "sdcard," this is okay.

After all this, reboot recovery again and then run a factory reset just to be safe.

### Why Does This Work?

Simply doing a factory reset seemed to not do anything for me, the phone would still see a LUKS partition there. I assume that this is because the LUKS header still existed at the disk level and the ext4 partition was just overlaid on top of it. For some reason, Android prioritized detection of a LUKS partition over an ext4 partition and attempts (and succeeds) to mount that.

### Where to Go from Here

(If you know what you're doing, you might also want to wipe `system` and install your ROM from scratch. *Again, I take no responsibility for anything you do with the information contained in this post.*)

Worked for me on a `klte` G900T (Samsung Galaxy S5 T-Mobile). Your mileage may vary.

# Answer
> 11 votes
On my Moto G 3rd Gen (osprey), neither calling recovery nor wiping LUKS header (at start and end of partition) worked - I still needed to enter the encryption password during Cyanogen Mod bootup, then was stuck with an "encryption error" message.

I finally found that my TWRP 3.0.1 recovery has a "Format Data" option in the "Wipe" section. This does a complete factory reset which also disables encryption.

Worked like a charm. If you have access to a decent TWRP version (easily flashed e.g. with Flashify), try this first.

# Answer
> 5 votes
**Provided that you're using TWRP or similar.**

* reboot to TWRP (enter password), and make a backup of `Data` partition to external `SD` or `OTG Drive`
* reboot to TWRP (cancel password), and format Data partition to `f2fs`
* restore backup made in step one to newly created `Data` partition
* reboot system
* enjoy Android with all your data saved, and encryption removed

# Answer
> 4 votes
The solution of manually wiping the LUKS header provided by Naftuli Tzvi Kay works fine, except for one thing. I do not how what it depends on, but in my experience, Android keeps the LUKS header at the END of the partition. And if that is the case with your device, then running

```
dd if=/dev/zero of=$PATH_TO_YOUR_USERDATA bs=4096 count=512

```

will fail to remove the header (footer?) because it wipes only the beginning of the partition. One could of course wipe the entire partition, but that would take unnecessarily long. So...

**To wipe the end of the partition** (of any size), after running the above command, run this command also:

```
dd bs=512 if=/dev/zero of=$PATH_TO_YOUR_USERDATA count=22048 seek=$((`blockdev --getsz $PATH_TO_YOUR_USERDATA` - 22048))

```

# Answer
> 4 votes
# Are you using custom recovery?

If yes, then do this after booting to a custom recovery (**TWRP** in my case):

1. On recovery start, **DO NOT decrypt the device**. Just tap **Cancel** when asked of password or pattern.
2. **Wipe the data partition.** (On TWRP after swiping to modify system: Wipe \> Advanced \> Check: Data)

This will of course wipe everything in the `userdata` partition. The whole data partition will be reformatted **including the encryption keys**.

# Answer
> 1 votes
My votes go to @Naftuli Kay, and other helpful answer here, but I have some info I'd like to share. It's too long for a comment, let it be an answer then.

Since some version of TWRP, there's 'format data' item on Wipe screen. It not only wipes /data partition, but also handles the encrypted FS matter. In my case, TWRP 3.0.2 on Samsung J500H wipes encryption, and it was the only way, factory reset doesn't work. CMR (that one being built along my CM 12.1 rom for J500H) can't clear encryption either.

`--set_encrypted_filesystem=off` also didn't work in TWRP and CMR.

wiping data via OpenRecoveryScript https://twrp.me/faq/openrecoveryscript.html also doesn't work

Android 3.0 started to map /sdcard to /data/media, so they had to rework /data wipe to not /data/media, and `rm -rf` is performed instead. See https://twrp.me/faq/datamedia.html for more details.

When you perform 'format data' you may see in recovery log (/cache/recover/log or /cache/recovery/last\_log) following info:

```
I:Successfully wiped crypto footer.

```

before it formats /data with `make_ext4fs`. The TWRP code has number of checks to find where the LUKS header is, and in my case it found it in the footer.

I looked at the TWRP source and I haven't found a way to 'format data' from command line (I need to wipe encrypted storage from an application in custom rom), so this option is present in UI only. With the only exception - if TWRP is compiled with `TW_OEM_BUILD` enabled then it **will** 'format data' on factory reset, clearing crypto header and formatting data partition, otherwise it would use regular wipe w/o formatting.

I'm going to try to `dd` with zeros, actually TWRP does the same to clear encryption, just it knows where to look for the header exactly ))

# Answer
> 0 votes
Expanding on Naftuli Tzvi Kay's answer above...

well, that answer got me to the right place, but my phone (CM11 / i9300) didn't have a `recovery` command, and the `wipe` command didn't have an option to disable encryption. So I did it manually from looking at the comments in the source code for the `recovery` command (file linked from the answer linked in the above question):

```
* The recovery tool communicates with the main system through /cache files.
* /cache/recovery/command - INPUT - command line for tool, one arg per line
* /cache/recovery/log - OUTPUT - combined log file from recovery run(s)
* /cache/recovery/intent - OUTPUT - intent that was passed in
*
* The arguments which may be supplied in the recovery.command file:
* --send_intent=anystring - write the text out to recovery.intent
* --update_package=path - verify install an OTA package file
* --wipe_data - erase user data (and cache), then reboot
* --wipe_cache - wipe cache (but not user data), then reboot
* --set_encrypted_filesystem=on|off - enables / diasables encrypted fs
*
* After completing, we remove /cache/recovery/command and reboot.

```

So to do it manually (with adb):

1. get up a prompt with root access, e.g.
> ```
> $ adb shell
> > su
>
> ```
2. put the following text into the file /cache/recovery/command, either with echo or vi:

> ```
> --wipe_data
> --set_encrypted_filesystem=off
>
> ```
>
> e.g. with `echo -e "--wipe_data\n--set_encrypted_filesystem=off" > /cache/recovery/command`
3. reboot into CWM or similar recovery

You should see a nice progress bar and it should get done :)

# Answer
> 0 votes
The best working method is to boot into TWRP and use the inbuilt terminal to format it as ext2(coz that's the only thing supported from terminal directly), and change the partition to ext4 using the "Repair Filesystem" Option under Mount

**To format as ext2:**

`mkfs.ext2 /dev/block/mmcbl0p23` (Substitute with the value of your userdata partition by looking around in /dev/block/platform/\*/by-name/userdata )

**Change filesystem as ext4:**

Wipe -\> Advanced Wipe -\> Select "Data" -\>Repair or Change FileSystem -\> Change File System -\> EXT4

Now, you should have encryption removed, and be able to mount /data partition from TWRP. Hope this helps :)

---
Tags: recovery-mode, encryption
---


# Question
Title: Disable telephone control (answer call, call) from Bluetooth headphones
Is there a way to disable telephone control (answer call, call) from Bluetooth headphones? I just want to listen to music.

# Answer
> 3 votes
Go to Setting - Bluetooth and find your headphone device in the list and press the settings gear next to it. Uncheck Phone Audio or similar entries related to phone/telephone (may vary by Android version or OEM).

# Answer
> 0 votes
Go to Settings, Accessibility, Answering and ending calls. Turn off the setting that automatically connects when you have headphones in.

---
Tags: bluetooth, media-button
---


# Question
Title: How to Block/Filter Sites on Mobile Data Connection (Preferably using DNS Server)
I researched a way to filter sites using DNS Server on android phone, and that is to changed the phone's DNS Server, it worked for WiFi connection, but not for Data Connection, how would I Block/Filter Sites on Mobile Data Connection (Preferably using DNS Server).

# Answer
> 2 votes
There are no settings to set DNS server with Mobile Data. An exception is Private DNS (DoT) on Android 9+. Also sometimes DNS leakage may occur with WiFi DNS settings e.g. if some app has hard-coded DNS server address. However with root access you can force redirect DNS queries to any specific server using `iptables`. See details in How does Android OS do DNS name resolution? and How to configure DNS properly?

Or you can edit `/etc/hosts` to blacklist commonly known ad domains using available `hosts` files like this one.

Or even better is to run a local DNS server on device to use features like pattern matching etc. `dnscrypt-proxy`, for instance, provides flexible options including encrypted DNS (DoH or DoT) which nullifies the possibility of ISP's eavesdropping on your DNS traffic. For setup instructions see How to fix SELinux errors when launching DNSCrypt as `init.d` script?

On non-rooted devices it's possible to use `VpnService` API of Android to capture all DNS traffic. That's how apps like 1.1.1.1 and NetGuard work. Then the VPN app may use a custom `hosts` file before making queries to configured upstream DNS server. Virtual Hosts is an open-source app to achieve this.

# Answer
> 0 votes
For this the phone has to be rooted and the mobile version of a ads-blocking HOSTS file can be used. Here is an example: http://free-software-for-android.github.io/AdAway/

For mobile data, the DNS server would be provided by the telco. You can remove the proxy provided in the APN used by the telco. See FAQ at above link.

---
Tags: mobile-data, dns, content-filter
---


# Question
Title: How Do I Get the Phone to Automatically Open My Gate for Package Delivery?
The intercom dials my number and the phone needs to press '9' to open the gate (the call disconnects when it does). I want it to do this by itself any time someone uses the intercom (I can't answer when I sleep or am driving or on silent etc.).

# Answer
> 0 votes
As far as I know from my friends and relatives whom live in gated communities. It depends on how old the intercom system is. The older communities have to use the hardwired phone lines to be able to be used with the communities exterior info-com system.

However, the newer communities do have the ability to through the communities network to connect your android device to the communities info-com system.

This though is just through again my families and friends personal experience.

---
Tags: tasker, automation, ifttt, automate
---


# Question
Title: How can I view the mobile data usage for each application for a given day?
How can I view the mobile data usage for each application for a given day?

I use Android 9 on Samsung Galaxy S9.

# Answer
> 3 votes
You can achieve that using a third-party data usage application like 3G Watchdog

With 3G Watchdog you can have finer breakdown of data usage down to individuals application with options to view data usage per period including real time, day, week or month.

---
Tags: mobile-data, 9.0-pie, data-monitoring, samsung-galaxy-s-9
---


# Question
Title: What is the standard operational battery temperature for the Note 9?
Bought the phone a week ago & today it seems to be running slightly warm just surfing sites in Chrome. Downloaded a battery app and see that the battery temp is at 32 degrees Celsius constantly right now for the last 2 hrs. Is this normal?

# Answer
> 0 votes
OEMs hardly provide such data to decide if it is normal or not. Not surprisingly, user manual of your device is quiet on this point.

This post on SE. Electronics (talks of Samsung), puts maximum safe temperature as 45°C.

However, temperature has a bearing on the battery performance. See this for details. At 32°C it results in 80% of optimum battery capacity.

I would consider based on my observations, that this perfectly fine, though Samsung phones have been reported to have fast charging problems with a low temperature error, which doesn't seem to be your problem.

---
Tags: battery, samsung-galaxy-note-9
---


# Question
Title: Cannot charge due to low battery temperature on Lenovo P780
My Lenovo P780 won't charge because the battery warning always pop up & says that charging is paused due battery's temperature is too low. I have checked the battery's temperature & it is around -20°C. I am just living in the Philippines and only got this when I went back to work in Vietnam.

Tried to warm up the phone, but the temperature is still -20°C. I can only charge the phone when it is "OFF" & it takes very long time to charge; 5 hours charging & the battery is charged up to 60% only. Why this happens and how to fix it?

# Answer
So what you have sounds like one of two things.

One, there is a software issue giving false readings off the temperature sensor. In order to diagnose this I would recommend installing a third party battery monitor which can monitor temperature. If this gives you a normal temperature you know its software and a factory reset should fix your problems. If it still is -20 than it could be hardware or just firmware level software.

Two, the temperature sensor could be broken or malfunctioning giving a false or default reading.

Either way if doesn't cause any problems a factory reset would either fix it or tell you what is wrong.

Let me know how it goes, I may have some other options for you if need be.
> 2 votes

# Answer
I faced similar issue, I did factory reset and then it started charging just fine.
> 1 votes

# Answer
Put Tape into the center battry switch, 2 should be ok but in centre put tape
> -2 votes

---
Tags: battery, charging
---


# Question
Title: Getting "ssid bytes size out of range" error on Android 10 if WiFi is enabled
I have OnePlus 7 Pro that got updated to Android 10. Since then, the phone randomly reboots. It seems it's related to WiFi since the random reboots almost never happen when WiFi is turned off (regardless if it's actually connected to a network or not)

Logcat:

```
Error: AndroidRuntime

*** FATAL EXCEPTION IN SYSTEM PROCESS: ClientModeImpl
java.lang.IllegalArgumentException: ssid bytes size out of range: 64
    at com.android.server.wifi.util.NativeUtil.decodeSsid(NativeUtil.java:278)
    at com.android.server.wifi.WifiScoreCard.computeHashLong(WifiScoreCard.java:588)
    at com.android.server.wifi.WifiScoreCard.access$100(WifiScoreCard.java:63)
    at com.android.server.wifi.WifiScoreCard$PerBssid.<init>(WifiScoreCard.java:380)
    at com.android.server.wifi.WifiScoreCard.lookupBssid(WifiScoreCard.java:530)
    at com.android.server.wifi.WifiCandidates.add(WifiCandidates.java:374)
    at com.android.server.wifi.WifiCandidates.add(WifiCandidates.java:393)
    at com.android.server.wifi.WifiNetworkSelector.lambda$selectNetwork$0$WifiNetworkSelector(WifiNetworkSelector.java:911)
    at com.android.server.wifi.-$$Lambda$WifiNetworkSelector$Z7htivbXF5AzGeTh0ZNbtUXC_0Q.onConnectable(Unknown Source:15)
    at com.android.server.wifi.SavedNetworkEvaluator.evaluateNetworks(SavedNetworkEvaluator.java:279)
    at com.android.server.wifi.WifiNetworkSelector.selectNetwork(WifiNetworkSelector.java:900)
    at com.android.server.wifi.WifiConnectivityManager.handleScanResults(WifiConnectivityManager.java:342)
    at com.android.server.wifi.WifiConnectivityManager.access$900(WifiConnectivityManager.java:73)
    at com.android.server.wifi.WifiConnectivityManager$AllSingleScanListener.onResults(WifiConnectivityManager.java:425)
    at android.net.wifi.WifiScanner$ServiceHandler.handleMessage(WifiScanner.java:1429)
    at android.os.Handler.dispatchMessage(Handler.java:107)
    at android.os.Looper.loop(Looper.java:214)
    at android.os.HandlerThread.run(HandlerThread.java:67)

PID: 28683
TID: 28862

The following error message says:

FATAL EXCEPTION: main
Process: com.google.android.gms.persistent, PID: 30417
DeadSystemException: The system died; earlier logs will point to the root cause

```

This is consistent and the same exact error shows up every time the system crashes/reboots.

Why, and how to fix this issue?

# Answer
> 0 votes
**The error message is caused by SSIDs containing more than 32 *bytes.***

According to the Wikipedia,

> Unlike basic service set identifiers, SSIDs are usually customizable. These SSIDs can be zero to 32 octets (32 bytes) long, and are, for convenience, usually in a natural language, such as English. The 802.11 standards prior to the 2012 edition did not define any particular encoding/representation for SSIDs, which were expected to be treated and handled as an arbitrary sequence of 0–32 octets that are not limited to printable characters. The IEEE 802.11-2012 defines a tag that the SSID is UTF-8 encoded and when interpreting could contain any non-ISO basic Latin characters within it. Wireless network stacks must still be prepared to handle arbitrary values in the SSID field.

Note that the limitation is 32 bytes, not 32 characters. While each character in ASCII encoding is 1 byte, characters in UTF-8 encoding can take up to 4 bytes. Example:

1. `Test` consisted of 4 characters and 4 bytes.
2. `テスト` consisted of 3 characters but **9 bytes**.

If the offending SSIDs are in your control, then the simple fix is by reducing their byte size (length).

---

The check on the Android-side that produces this error message was added on April 2019, which is between Android 9 (August 2018) and Android 10 (September 2019).

> NativeUtil: Perform range checks on ssid bytes size
>
> NativeUtil.encodeSsid/decodeSsid should perform range checks because the output/input is coming from binder/hwbinder interfaces which assume the ssid is not malformed (i.e within spec mandated size range).
>
> Most of the callers of these methods already handle IllegalArgumentException (including the hidden network list built in WifiCondControl). This should fix the reported issue of a hidden SSID added with size \> 32 causing crash in wificond.

---
Tags: wi-fi, reboot, crashes
---


# Question
Title: Huawei P20 lite not recognizing external keyboard
I got this keyboard from China that has holder for a phone, but has USB-micro cable. My phone (Huawei P20 lite) has USB-C, but that's not an issue, since I got usb-micro to usb-C converter. I tried to connect the keyboard through 3 different usb-micro to usb-C converters, but in any case the keyboard didn't work.

A friend of mine tried on Samsung S5(usb-micro) and S9(usb-c) aswell, using another 3 different usb-micro to usb-c converters. It worked well on S5 (usb-micro) but didn't work anyhow on S9(usb-c).

Tried aswell as downloading Swift keyboard (just in case it has any features) and go to Settings \> Language \> Default keyboard \> Input settings, but there was no options whatsoever.

I can't figure out what could possibly go wrong, while it's totally functionally working on all usb-micro devices and never on usb-c.

How to solve this problem, what to do about this?

# Answer
> 1 votes
I have the same with external keyboard, camera. It looks like the USB C Port does not support the extarnal interfaces, cannot supply. I have a small camera that lights automatically if connected to Samsung, but not on Huawei. Solution is iteressting for me also.

Have fun.

---
Tags: huawei, external-keyboard, huawei-p20
---


# Question
Title: How to calculate/verify SHA-256-Digest from META-INF/*.SF file?
I'm trying to manually verify an APK file in the way Android would do when such file is installed in some old system (\<7). I have one problem I can't really solve.

They say the following:

> As you can see, the signature file contains digest entries for the archive's files that look similar to the digest-value entries in the manifest. However, while the digest values in the manifest are computed from the files themselves, the digest values in the signature file are computed from the corresponding entries in the manifest.

So in this case, we have an example entry from the `META-INF/MANIFEST.MF` file, which is the following one:

```
Name: FingerprintProtocol.proto
SHA-256-Digest: WQ9R/MGV5m9Dye4Jtl3MiLRmX2RPoEPeinb3me7wnAU=

```

Now we take the corresponding entry from the `META-INF/*.SF` file, which looks like this:

```
Name: FingerprintProtocol.proto
SHA-256-Digest: fWL5eppUj0x6UVdPqHusFkpDbXpq7P0sqchfublqEnA=

```

The question is: How was `fWL5eppUj0x6UVdPqHusFkpDbXpq7P0sqchfublqEnA` calculated?

# Answer
You are trying to verify the APK using the old and outdated JAR signature (aka APK signature scheme v1). This type of signature is outdated for Android as there are some attack scenarios in which a file exists multiple times inside the APK/ZIP file.

Therefore when verifying a APK files you should better rely on the APK signature scheme v2/v3 if present in the APK file. The current verification process is documented here: APK signature verification process

The Android SDK comes with a tool called `apksigner.jar` (can also be used as library in own Java programs) that allows to to verify an APK files using the most recent available method.

For more details on apksigner and how to use it see this answer: https://android.stackexchange.com/a/218161/2241
> 0 votes

# Answer
It looks like the section includes some white spaces and not only the text. The whole code that should be hashed is the following:
> 0 votes

---
Tags: apk
---


# Question
Title: Adjust/personalize auto-correction on Android
Using a Moto G Play with Android 7.1.1 installed. Whenever I type the word `ie.` (that is), this is auto-corrected to one of:

```
or.
IE.

```

The auto-correction selected appears to be random (perhaps based on context). I would like to tell my phone to NOT auto-correct `ie` under any circumstances. If I meant to type `or` and accidentally typed `ie`...that one is on me!

Is there any way to adjust auto-correction by manually entering personalised phrases (such as into a dictionary)? I don't want to turn auto-correct off entirely.

# Answer
> 1 votes
Add the word to your personal dictionary.If you are using Gboard:

1. Go to its settings then Dictionary.
2. Click on Personal dictionary
3. Select a language or All languages if you want to add the word for every language.
4. Click the `+` button.
5. On "Type a word", enter `ie.`. Press the arrow to go back to the previous screen. (You can enter a shortcut for the word if you want but with your word being so short I don't think it is necessary).

For now on `ie.` will appear when you type and will not be auto-corrected.

---
Tags: keyboard, motorola-moto-g, auto-correct
---


# Question
Title: Can someone receive my calls on viber even I deleted the application, I called by mistake
Had called someone on viber by mistake, how can I let him not receiving the calls notification, I already blocked him; should I delete theapplication? Tour assistance is needed please

# Answer
> 0 votes
If you already called the person there is no way to delete the notification.

---
Tags: notifications, calls, viber-messenger
---


# Question
Title: How can I execute command in the terminal as root?
How can I get root permissions in a terminal?

# Answer
> 17 votes
Type `su` and your terminal prompt should change from `$` to `#`. This is assuming that your device is already rooted.

# Answer
> 3 votes
See the following questions:

# Answer
> 1 votes
Production phones don't ship with root access, developer phones do. If you have a production phone (likely: you'd know if you bought a dev phone), you have to "root" them first. As @Joe\_Casadonte points out, there are some great instructions here and elsewhere (Notably the CyanogenMod Wiki and Android Rom's google group) to get you started rooting your phone. (And if you get stuck ... come back here with your questions!).

Once you've rooted your phone, you can gain root privileges in the adb shell or the terminal emulator with the `su` command.

Note: it sounds from some of your responses like you haven't yet rooted your phone. So you'll need to start there.

# Answer
> 0 votes
Assuming that:

1. Your Android device is rooted;
2. The `su` binary is located at `/system/xbin/su`;
3. The shell binary is located at `/system/bin/sh`; and
4. Your Android device has Terminal Emulator installed.

If all the 4 conditions above are satisfied, then:

* If you want to enter the shell and become root (superuser uid 0) so you can execute commands without uid restrictions, start the Terminal Emulator app and just execute this command:

```
su -

```

In order to disconnect from the uid 0 (exit superuser status), press `Volume -` and `D`, or type `exit` and hit `Enter`
* Alternatively, if you want to **always** start Terminal Emulator as root, then start Terminal Emulator, go to **Preferences**, scroll down to the **SHELL** section, tap the **Command line** option and modify the command so it becomes this:

```
/system/xbin/su -c "/system/bin/sh -"

```

After you change the command, exit Terminal Emulator (close the application) and start it again. Notice how Terminal Emulator's shell interface now shows you `root@something` by default.

# Answer
> 0 votes
For my 8.1.0 go edition phone. It is `/sbin/su -c "/system/bin/sh -"`. I struggle too much to figure out where is `su` binary file(in my case `su` binary not exist in the `/system/xbin/` path). I found a path `/sbin/` is exist in ROOT directory and `su` binary is exist in that path. And of course i rooted my phone by magisk manager. Hope this answer will help someone.

---
Tags: root-access, terminal
---


# Question
Title: Forgot the Pattern lock pattern in lollipop. How di i reset it?
I locked my mobile with pattern lock. I forgot the pattern. In lollipop there is no option "Forget Pattern". I used Android Device Manager to lock my mobile. It Locked. But I does not ask for the password. The Mobile Screen is like bellow. How to Reset it?

# Answer
> 0 votes
The first and easiest way is resetting that Tushar's answer is about. I'm afraid there is no physical offline way to bypass the lock.

Although, there are apps that have access to the lock screen and can actually bypass it.

For example **Samsung's Knox** and **Google device manager** (Read a howto here), but they have prerequisites. You need to sync your device with them. If you have, be happy. If you have not, I can think of other ways.

# Answer
> -1 votes
Follow following steps -

1. Switch off your phone
2. Now hold the "volume up + home button + power button" until the phone boots (if you device doesn’t have a home button just hold together volume up key and power button.
3. Now a screen like DOS will come up with different options. Use the volume key to move up and down then scroll down to "Restore Factory Defaults" or "Delete all User Data”" depending on which is on your device.
4. After following the steps above, scroll down to "Reboot System" and wait for your phone to reboot.

---
Tags: android-device-manager, pattern-lock
---


# Question
Title: Should I be worried about this strange notification from Delta?
I got a notification from the `Fly Delta` app that just says "test". The icon appears to be missing. Should I be concerned about this? I've uninstalled the Delta app, but I'm unsure if I need to do more.

This is, to the best of my knowledge, the official Delta Airlines app installed from the Play Store.

# Answer
> 2 votes
A Twitter search suggests that a lot of people got the same message. It appears to be an error at Delta. What I don't know is whether there's any way to confirm that a particular message came from the app vs spoofed it in some way.

---
Tags: notifications, security
---


# Question
Title: How to put TWRP recovery on an S5? (heimdall fails with PIT transfer)
This is an SM GT900F.

I tried to install TWRP per these instructions. However, when issuing
`heimdall flash --RECOVERY recovery.img --no-reboot`
I got this (some clutter removed):

```
Initialising connection...
Detecting device...
Claiming interface...
Setting up interface...
Initialising protocol...
Protocol initialisation successful.
Beginning session...

Downloading device's PIT file...
ERROR: Failed to send request to end PIT file transfer!
ERROR: Failed to download PIT file!
Ending session...
ERROR: Failed to send end session packet!
Releasing device interface...

```

The phone was then stuck with a tiny blue dot on the left, which I suppose is the start of the blue progress bar mentioned here. It wouldn't react to anything anymore.

Fortunately, after removing the batteries, it boots just fine into the stock ROM. *(Phew.)* I have repeated this twice since, but this is consistent.

Does anyone have any idea how I should proceed?

# Answer
> 0 votes
I know this is coming late, but since my question is still getting votes, I might just as well answer it:

I have done many S3 and S5 in the last few years, and it seems the key to this was to do it with admin rights. I'm using Odin nowadays to do this, so I right-click it and start it as administrator. This might be the same for heimdall (you'd have to start a console with admin rights, of course), but I haven't tried that in a long time.

# Answer
> 2 votes
TLDR: It works with Heimdall 1.4.2 (which at least in my case i had to compile myself from source code).

Unfortunatley i don't have the reputation i need to comment. But in my humble opinion... sbi you have not answered or solved your own question(at least you didn't solve the specific problem you have been dealing with)... and should unmark your answer as the right answer.... You say it yourself.. It is just an assumption (unless you have testet it).

I had the same problem using ubuntu 16.04 and the heimdall from the ubuntu-repository(i.e. heimdall version 1.4.1). I had exactly the same output, as you postet in your question...

Searching the web, i found this this manual, describing that this error occurs in version 1.4.1 and is fixed in version 1.4.2 of heimdall. That tutorial shows you how to download the source code of heimdall(version 1.4.2) from https://gitlab.com/BenjaminDobell/Heimdall and compile it yourself.

Following that tutorial, it worked for me smoothley.

# Answer
> 1 votes
Try Odin instead of heimdall, and use corresponding .tar format recoveries. No more hassle of Heimdall command line.

---
Tags: samsung-galaxy-s-5, twrp
---


# Question
Title: How to reinstall Gboard after an accidental uninstall?
I accidentally uninstalled Gboard from my tablet. Now, since I can no longer type words, I cannot locate Gboard on the Play Store in order to install it again. Do you know of any work around?

# Answer
Apologies if you've tried this already, but from a browser on a different machine (laptop, desktop, another tablet or phone) you can go to the Play Store (http://play.google.com/store) and log in to the Google account you use on the tablet, and then find the app(s) you'd like to install. You should be able to install the app(s) to your device from there. At least, I've done this for an Android phone.
> 2 votes

# Answer
Create a folder in a different machine (desktop, laptop) and name it Gboard. Transfer the folder to your device. From your device, open the file browser, select that folder and hit Rename. Hold your finger on the name and hit Copy. Go to Play store. Hold your finger on the search bar and hit Paste.
> 1 votes

# Answer
Try downloading from apkmirror ?

For helping OP, you can access this site on a desktop and download an apk. Specifically download the one that is compatible for your phone's architecture. Then once you have downloaded, transfer it to your phone (wire or bluetooth).

Remember to uncheck Unknown Sources in Settings\>Security (recheck it after installation) to install the app.
> 0 votes

# Answer
I followed the prompt from someone above and adapted the approach by sending a friend a FB messenger message with one word Gboard. I then copied and pasted the word into the Appstore on my phone. The app was apparently installed but I was able to hit 'update' and hey presto I got my keyboard back - thank you to the person who made the first suggestion!!
> 0 votes

---
Tags: google-play-store, gboard
---


# Question
Title: Control phone with broken screen from computer?
I'll just clear up the basics before proceeding as previous comments have just been talking about things that really haven't helped me get any closer to fixing this.

**Have I checked out the broken screen tag wiki?**
Yes, filled with circumstantial answers that didn't really make any sense to me, every answer required something I couldn't do.

**Use a USB-OTG cable?**
Unfortunately the screen is untouchable. I can't see what I'm doing so I wouldn't be able to direct a mouse even if I could get one connected.

Basically, I have a Samsung Galaxy with a broken screen, touch screen also broke and USB debugging is disabled, can I still save this?

I just wanna be able to control it for a little before taking it to a store. I need to do some things, is this possible? Every answer I read just talks about circumstancials.

I actually might have USB debugging enabled, although my device isn't showing up when typing `adb devices` and simply prints `List of devices attached` with 2 blank lines after it.

# Answer
> 0 votes
This happened to me about 2 weeks ago. I search the web and couldn't find anything useful. What I did might seem ridiculous but it did the trick and I managed to not only get my pictures but also exported my contacts and saved them. This is what I did:

I connected an OTG cable to my keyboard and pressed the power on button to 'turn on' the screen. I typed the PIN code and pressed enter. Then very quickly disconnected the keyboard and connected the device to my pc (it helps having 2 cables, one with OTG adapter attached and one just with USB). This way I can see the files of the mobile and I can save my photos etc.

Now my problem was that my contacts were stored in the phone and I couldn't synchronize them because they weren't stored in Google. In order for me to export them I did the following:

Right after connecting with the keyboard and typing the PIN code, I took a screenshot (for Galaxy phones you can do that by pressing home and power buttons simultaneously). Then quickly again I would connect it in my PC and go to the screenshots folder and this way I could figure out where I was. It is quite hard at first but this way you can navigate anywhere you like just by pressing the arrow buttons and enter key. If at any moment you don't know where you are, you can take a screenshot. The disadvantage is that until you get to see the screenshot from your PC, the screen locks again and you will have to connect to the keyboard again and repeat the process but this way I exported my contacts, found them through my pc and imported them into my new phone.

Hope that this helps...

# Answer
> 0 votes
I ran into a similar problem with an older samsung phone that had the screen lock set as a pattern. The entire touch screen was smashed and touch was not working and connecting the phone to a computer did not help either.

My only option was to take it to a repair shop specializing in smart phone repairs and they fixed the phone by putting a new screen on it. It was a bit costly (the price usually varies on how new your phone model is, so newer phones are really expensive to repair, older ones a bit cheaper) but I was glad to pay that amount just to save my media and contacts.

Now I try to do a backup of all the essential files a couple times a year onto a portable drive.

---
Tags: samsung, broken-screen
---


title: Fast WRITE speed or fast READ speed?

text:
# Question
Title: Fast WRITE speed or fast READ speed?
To move and use apps on its SD Card my droid suggests I use a "fast" SD card. https://www.cameramemoryspeed.com/sd-memory-card-faq/fastest-memory-card/ Ranks SD Cards by WRITE Speed and READ Speed. Interestingly, the same chips seldom appear in both lists. If I want to use my SD Card to store and run apps, is fast WRITE speed or is fast READ speed the most important quality to look for.

# Answer
> 0 votes
You should consider the R/W together. Both make differences. However, for the apps, they *usually* do read and pull the files into memory (RAM) and make use. Write will only be done where something changes or the app's job is to modify the files. Else there will be very less write happening during app's operations. The write will be more used when installing new apps to the SD card.

So, for most apps, the read will make more difference. Generally, an SD card with higher write speed will also have higher read speeds. In the end, the memory will still be slower than the inbuilt EMMC/UFS in most of the phones. So, some performance drop should still happen.

---
Tags: applications, sd-card, ram
---


# Question
Title: How to remove someone else's Google account from the Pixel 3a?
So my friend has his partner's Google Pixel 3a with him. She did *factory reset* and gave it to him before leaving for a semester abroad. She forgot to remove her Google account before performing the reset though.

The phone runs on Android 9. Now when my friend tries to set up the device, he is asked to log in to an account which was associated with this particular device beforehand. Since he doesn't know the password of his partner's account, he is unable to use the device as his own.

Is there a way to fix this without having to ask the password?

# Answer
> 0 votes
He can't remove it without the password. But his partner can, by accessing the Google account and deleting the phone from the list of devices active on that account. This link will take the original account holder to the appropriate page:

https://myaccount.google.com/device-activity?utm\_source=google-account&utm\_medium=web

---
Tags: google-account, 9.0-pie, password, google-pixel, frp
---


# Question
Title: How to remove Google Account after factory reset
I have been given a Huawei smartphone that needed a new screen, which I've just had replaced. I now want to sell the phone.

Am I forced to enter the Google account of the previous owner in order to complete the start up process after a factory reset?

Can I then delete the old Google account ready for the new owner?

# Answer
If you have done a factory reset without removing the Google account first, then you have triggered FRP.

Although it is not nice, there are some tutorials on YouTube or WWW which work on some phones and help in bypassing the FRP. If that doesn't work, the Huawei customer service should have the tools to erase the FRP/persist partition and remove the requirement to add the previous owner's Google account.

Lastly, it is better to ask the previous owner to just come over and login once using his account. You can then remove his account and issue a fresh factory reset. Now it will be ready for resale.
> 0 votes

# Answer
If you have executed the factory reset properly then the phone is not asking you for a Google Account of the previous owner, it is asking you to provide **your** Google Account so you can best use features offered by the Android phone. If you don't have an account yet you can also create it with your phone directly providing that you have internet access.
> 0 votes

---
Tags: google-account, frp
---


# Question
Title: How can i relock bootloader of infinix smart 2 with or without data loss?
How can i relock bootloader of infinix smart 2 with or without data loss? i haven't install twrp and root device.

# Answer
> 1 votes
If you are sure that you have not made any modifications to the device, then the usual oem lock command should be all that you need to do:

```
fastboot oem lock-go

```

After that confirm the lock on the phone and you will be good to go.

# Answer
> 0 votes
You should not lose any Data `Re-locking` the bootloader of an uncompromised system. It is only when the bootloader is Un-locked does the data loss occurr. A little insight into bootloaders is that it is an actual security function of the bootloaders to eject the possible compromised files if checks fail.

The bootloader will verify that everything is good to go if not then the bootloader has the option to essentially factory reset your device by Un-locking to dispose of what it believes to be non-native binaries or files. The bootloader Re-locks and starts to verify and attempt to boot again.

---
Tags: bootloader
---


title: How to see Android OS System log file?

text:
# Question
Title: How to see Android OS System log file?
After leaving my Samsung Galaxy A-30 phone (with Android 9) for a few hours unbelievably I understood all of my internal storage is cleaned! I don't remember that I have installed any suspicious app but I just attached a USB flash to my phone for some data transferring last day.

Now I just want to know what happened to my phone's internal storage data, is there any system log file for Android 9? How can I find if an app with storage permission has done this?

# Answer
You can try to find it with `adb logcat`
> 0 votes

---
Tags: adb, logging
---


# Question
Title: How root huawei y7 trt lx1/ switch slot?
I am trying to root my phone,

* I unlocked bootloader
* I have uploaded Magisk-v16.6 to internal storage
* I flashed by many twrp versions (fastboot flash recovery TWRP\_3.2.3\_TRT-LX1\_by\_kiruha\_21.img/ twrp-3.2.3-4-land / boot-without-enciphering-data / twrp-3.3.1-0-CRO\_U00 / TRT-TWRP-3.1.1-0818 /TWRP\_3.2.2\_TREBLE\_TRT-LX1\_by\_kiruha\_21 / twrp-3.3.1-0-whyred but every time when I start phone i twrp mode - touchscreen not working
* I read https://forum.xda-developers.com/showpost.php?p=77597383&postcount=86

And I try to switch slot but when I run fastboot --set-active=a I get `error: Device does not support slots.` and when I run fastboot getvar current-slot I get

current-slot:
finished. total time: 0.002s

my fastboot version `fastboot version 1:8.1.0+r23-5~18.04`

# Answer
The bootloader must load the DTBO image that is compatible with the recovery image. in your case Touch is not working because the TWRP version does not support it. There is not much you can do, the TWRP kernel must be compiled with touch support (or maybe binary hex-patched).

Look for dtbo.img or (edit: dtb is appended to kernel for y7)
use the adb shell commands TWRP comes with:
https://twrp.me/faq/openrecoveryscript.html

You can also try to boot TWRP from fastboot instead of flashing it, sometimes this will affect to touch screen work.

```
fastboot boot C:\adb\TWRP_3.2.2_TRT-LX1_by_kiruha_21.img

```

regarding switch slots, you can not switch if you don't have A/B device. don't mix up different recoveries.

please note the differences between **/etc/recovery.fstab**

only in TWRP\_3.2.2\_TRT-LX1\_by\_kiruha\_21

```
/dev/block/bootdevice/by-name/userdata fs: f2fs
/dev/block/bootdevice/by-name/
vendor, product, version, log

```

only in TWRP\_3.2.2\_TREBLE\_TRT-LX1\_by\_kiruha\_21

```
/dev/block/bootdevice/by-name/userdata fs: ext4
/dev/block/bootdevice/by-name/
fsc, lksecapp, sbl1, dip, dpo, limits, mcfg, mdtp, mota, oem, syscfg

```

Please check if your phone has f2fs or ext4 file system, and check if vendor partition is present or not. Select the proper TWRP variant according to your partition layout.

you can check your partitions from adb shell or terminal emulator (one of these commands will work)

```
ls -d /dev/block/*/*/*/by-name/*
ls -d /dev/block/*/*/by-name/*
ls -d /dev/block/*/by-name/*

```

for file system type (one of these commands will work)

```
df -t ext4 /data
df -t f2fs /data
df -T /data
mount | grep "/data "

```
> 0 votes

# Answer
The best and safest way is to root it with magisk. First you need to unlock bootloader. It can be done with adb and fastboot commands. Then you have to flash twrp recovery with adb. After that you have to flash the latest magisk available via TWRP. latest Magisk is 20.1
> 0 votes

---
Tags: rooting, rom-flashing, fastboot, huawei, factory-image
---


# Question
Title: Samsung Galaxy Tab S2 in bootloop (standard recovery not working!)
Hi enthusiastic community! I would need your help and advice!

**The device:**

* Samsung Galaxy Tab S2 (SM-T819)
* bought with Android 6 second hand --\> last week updated to Android 7
* NOT rooted, original firmware, official update (did not mess around with it at all ...)
* I am using it without SD-card or SIM

**The problem:**

Stucks in boot loop first shows Galaxy Tab S2 logo and then S-A-M-S-U-N-G appears in big letters blinking) stays there forever and heat up a little on the back.

**Steps already tried and did not work out:**

* press `powerOn` button 10s, 1 min, 2 min ... --\> no reaction
* press `volUp + volDown + powerOn` --\> reboots put stuck later at the logo
* press `volUp + powerOn + home` --\> **does not enter recovery mode**
* press `volDown + powerOn + home`, in this very order --\> enters downloading mode and asks to downloading a custom OS (`volUp`) or cancel (`volDown`)
* if I press cancel reboots and stuck at the logo again
* if `volUp` then gets into Odin downloading mode and shows the following information:

```
ODIN MODE (HIGH SPEED)
PROCUCT NAME: SM-T819
CURRENT BINARY: Samsung Official
SYSTEM STATUS: Official
FAP LOCKS: ON
WARRANTY VOID: 0x0
QUALCOMM SECUREBOOT: ENABLE (CSB)
RP SWREV: S1, T1, H1, R1, A2, P1
SECURE DOWNLOAD : ENABLE
download mode !!

[Arrow down]
Downloading ...
Do not turn off target

```

I guess it is waiting to download from USB.

* tried this steps with and without charging cable connected to my laptop --\> does not make a difference!
* Eventually it ran out of battery and shut down! Tried the same steps after it's shutdown (power cable connected) but situation did not change!
* I cannot mount the tablet on my Ubuntu Lenovo Thinkpad --\> if I do `lsusb` the tablet is not listed ...
* after the battery ran out I tried this: when Samsung Galaxy S2 logo appears, release the Power key and immediately hold the volume down key --\> it is rebooting and showing the battery symbol (0% charged) over and over again.

**Questions:**

* What should I do else?
* Should I flash firmware? --\> I run the laptop with Ubuntu 17
* Should I dismantle it and disconnect the battery (worked on my Lenovo ...)?
* Do I have to root it?

**What do I want:**

I want the tablet to work again, would prefer not to root it, do not care about data loss ...

**Other observations:**

* I could not start it this morning after installing a new app (via Google Play) yesterday evening.
* Two days ago I could not charge the tablet with the adapter on a power plug, I needed to charge it via the laptop.
* It is alive and charges normally on the laptop (if I press shortly the `powerOn` button then the battery symbol appears)
* Does NOT charge with the charger plugged into a power plug, only on the laptop.

Thanks a lot for your help and patience to read all that!

**EDIT:**

07/13/2017

I followed esQmo\_'s solution in detail but I could not establish a connection between the computer and the tablet. In the end Samsung support fixed it and the tablet is running perfectly again. However, I think that the solution given by esQmo\_ is still the right thing to do in this case, but please note that for some reason (maybe my lack of experience or knowledge) it did not work out for me. Thanks!

# Answer
Seems like a softbrick state. You should try flashing a new firmware. The steps below are for Windows:

* Download the firmware from here (Registration required)
* Download Odin flasher from here
* Download Samsung Kiesand install it. Needed for drivers.

\[Update\]

* Uninstall Kies right after it has installed and drivers set up, this is to avoid conflicts with Odin while flashing devices (See below answer (@Babaks D's answer) for more)
* Unzip the firmware, unzip Odin then run the executable file.
* Power off the device then boot in download mode (Volume down + power button) then connect it via USB cable. Windows should install drivers.
* Now on Odin, you should see ID COM turns blue meaning that the device is detected.
* Click on AP button, then browse where the firmware folder is. Select the file. Wait a moment.
* Now click on Start and wait till the end. You should see PASS on the screen.
> 2 votes

# Answer
**My solution in the end was to send it in to Samsung and it got fixed by them.** That is not a practical solution for everyone especially if your support for your device is already expired. However, with this post I just wanted to state that it was possible to fix it. The tablet has been working perfectly since then and the boot loop might have been connected to the update to Android 7.0.
> 1 votes

# Answer
I tried the solution @esQmo\_ suggested. It went all good until the very last stage where Odin failed on installing the firmware. After doing some more research, I figured that you should not be running Kies as you want to interact with Odin.

Kies installs the drivers for you, but if you want to run Odin and download the new firmware on the device, Kies interferes and tries to communicate with the same device on the same port, resulting in having the COM BUS busy and thus Odin won't be able to download the firmware.

So if you want to follow the steps @esQmo\_ laid in, make sure that you have closed Kies before downloading the firmware on the device.
> 0 votes

# Answer
For me, the following procedure helped (SM-T813):

Prerequisites: ADB, ODIN, TWRP-tar-file for device

1. Initial State: "stucked" TWRP is running on device
2. Connect device to PC
3. Reboot device into download mode (I did it via "adb reboot bootloader")
4. Start ODIN, flash the latest version of TWRP (I assume its just important to "reflash" TWRP)
5. After the flash completed, my device returned to normal boot mode
> 0 votes

# Answer
My tablet was on a recovery boot loop and would proceed to install update only up to 25-32%. I tried clearing the cache by pressing the upVol and Power button but I couldn't get to that menu, perhaps because it wouldn't charge at all and I had to keep it plugged in. I did the power button + downVol and home key at the same time to get to the custom OS install screen, I left it sitting there for a good 15 minutes and I think it was able to sustain a charge so when I rebooted it finally completed the update on it's own. Weird but it finally updated after a few days of installing update loops.
> 0 votes

---
Tags: samsung-galaxy-s-2, boot-loop, linux, 7.0-nougat
---


# Question
Title: Gboard stopped working on Motorola phone
Gboard stopped working on Motorola phone - I cannot type as no keyboard appears data amd cache say 0.
I have tried various methods suggested, but still no keyboard appears when a cursor appears in a text box.

# Answer
Ok I have just fixed this on my Motorola phone. I believe an update has been rolled out to solve the problem so the issue is, how to get your gboard updated if it hasn't happened automatically.

"Gboard stopped working" kept popping up on my screen while following through on the process below, so I had to keep selecting "ok" every time it popped up, giving me small windows in which to perform the necessary actions.

Go to the Play Store, search for Gboard (SEE BELOW) and identify the app (which had its icon next to the word in the search options that came up for me) and select it. You should then have the option to update the app. Select update. After the installation finished everything was working again for me.

IMPORTANT To enter Gboard into the search bar you cannot use the keyboard. So select the microphone at the right-hand end of the search bar and speak, "Gboard" - i.e. use voice to text.
> 5 votes

---
Tags: motorola, gboard
---


title: My GKeyboard keeps crashing

text:
# Question
Title: My GKeyboard keeps crashing
It crashes every time I open my phone. I'm locked out of my device and I cannot even try to factory reset it.

# Answer
> 2 votes
it was a worldwide problem, latest update for gboard will fix it. if your device is standard configuration it will auto-update apps, in this case just enable Wi-Fi and wait for update.

if your device support usb otg connect a keyboard or mouse with usb-otg-adapter to unlock.

if you already unlocked you can speech-to-text in case you need enter text.

if you can't unlock your device, login to your google account and try to remote update gboard from pc by clicking this link. you can also remote install any other keyboard like swiftkey.

if nothing works you can adb sideload any official signed apk from recovery mode

---
Tags: gboard
---


# Question
Title: Google keyboard (gboard) keeps crashing, won't go away
After a recent Android update, about a month ago, "gboard", the built-in Google keyboard on my Nexus started crashing. This made the phone completely unusable, of course. With some effort, I managed to install an alternate keyboard -- Swiftkey -- and this made most of the gboard crashing go away.

But not all of it. Every hour or so, I still get an "Unfortunately, gboard has stopped" dialog box that locks my phone until I ack it. This is rather problematic if I'm using the phone for something else, and (for example) will cause my alarm clock app to not go off.

So, question:

How do I stop the "Unfortunately, gboard has stopped" dialog from ever happening again, short of a factory reset?

Can I reinstall or uninstall gboard? How? Can I surpress the error dialogs? Is there some other solution to this?

(Note: "wait for some update to fix the problem" is not an answer; I have no reason to believe that this is a general enough issue that Google will ever fix it)

# Answer
It's very easy - just follow the instructions below:

Open Settings/App Management/Gboard/Storage;

Then clear up the cache and you are good to go! If it does not work even after this step, you have to follow the exact same instructions but instead of clearing cache you clear data. That is a sure shot method to get it to work, but I do not recommend it before you clear cache as when you clear data your preferences are reset.
> 14 votes

# Answer
Ok I have just fixed this on my Motorola phone (the problem has just recurred very widely this December 2019). I believe an update has been rolled out to solve the problem so the issue is, how to get your gboard updated if it hasn't happened automatically.

"Gboard stopped working" kept popping up on my screen while following through on the process below, so I had to keep selecting "ok" every time it popped up, giving me small windows in which to perform the necessary actions.

Go to the Play Store, search for Gboard (SEE BELOW) and identify the app (which had its icon next to the word in the search options that came up for me) and select it. You should then have the option to update the app. Select update. After the installation finished everything was working again for me.

IMPORTANT To enter Gboard into the search bar you cannot use the keyboard. So select the microphone at the right-hand end of the search bar and speak, "Gboard" - i.e. use voice to text.
> 7 votes

# Answer
Having solved this problem, I can affirm the answer given by Jinen Setpal. Not having 50 reputation, I can't make a comment, so I'm saying this as a separate answer.

When I had this problem, not every button was responsive (even if there was a slight cue in the UI that it had been pressed). This prevented me from simply clearing the cache for Gboard, so I had to clear the data (I think it was around 60mb, then it went to about 40 something kb). Just as Jinen Setpal noted, there was a confirmation popup that warned that all of the data for that app would be deleted, even from databases (meaning that there is no backup for it).
> 2 votes

---
Tags: gboard
---


title: how apps bypass VPN?

text:
# Question
Title: how apps bypass VPN?
I installed flipkart from apk. And without logging in searched for mobile phones.Then cleared app data and started VPN and then opened the app again but I was getting recommendations of searched phones. How flipkart bypassed VPN? How can we sure that browsers don't really bypass VPN?

# Answer
It didn't bypass the VPN. The apps use your other identifications such as "Advertising ID" identify you. Then this information is used to give you suggestions/recommendations based on your previous browsing or search history.

Most apps will also keep a local cache. So, unless you have cleared data for the app, the app knows everything you previously did.
> 2 votes

---
Tags: browser, vpn
---


# Question
Title: My Google account was deleted, how do I sign into phone with that account
I am giving away one of my older android phones that was signed into one of my older Google accounts. The thing is that that account was deleted and I can't sign back into the phone, does anyone know how to fix this/bypass this?

# Answer
Google says you may still be able to reopen the account:

https://support.google.com/accounts/answer/6236295?hl=en
> 0 votes

---
Tags: google
---


title: Location Tracking as Evidence

text:
# Question
Title: Location Tracking as Evidence
With location tracking enabled in Android, I see entries in "Your Timeline" in Google Maps. I know it's possible to add/remove/edit entries in this timeline, but is there are a way to get a reliable, unmodified export of what has been tracked that could be used as evidence? I understand that tracking and times might not be 100% but I essentially want to see if there's a way to get a version similar to the KML export that hasn't been edited that I could say "this export can't be edited".

I've been told the red dots that appear on the map can't be edited and can be relied on but I'm not so sure if there's any non-editable version of Android's tracking history?

# Answer
> 0 votes
All personal data in your Google account, including timeline data, can be exported. here's an article showing how to do it. https://helpdeskgeek.com/how-to/how-to-download-your-personal-data-from-google/

---
Tags: gps, gps-tracking
---


# Question
Title: How to bind-mount "data" and "obb" folders from external SD card in "/sdcard/Android"?
Can someone help me mount my `Android/data` and `Android/obb` in my internal storage from my portable storage? I'm on a Pie ROM. I found this: How to bind mount a folder inside /sdcard with correct permissions? but I don't know what should I do.

When I type:

```
ls -dZ /sdcard

```

I get

```
u:object_r:rootfs:s0 /sdcard

```

# Answer
> 1 votes
Sub-directories in `/sdcard/Android/data` or `/sdcard/Android/obb` (called apps' private directories on primary external storage) have **synthesized permissions based on directory structure**. While public directories on the rest of the `/sdcard` have fixed permissions. See details in Android's Storage Journey and What is /storage/emulated/0/?.

My answer to your linked question: How to bind mount a folder inside /sdcard with correct permissions? addresses the latter case i.e. bind mounting public directories which are shared with all apps. But private directories cannot be bind-mounted from external storage with fixed permissions. However using the same approach you can bind-mount every app's private directory separately.

Let's take example of Termux app. Its private directories (`Android/data/com.termux` and `Android/obb/com.termux`) are owned by the UID of Termux app assigned at the time of installation. Common ways to get UID value is to read from `/data/system/packages.list` or do `ls -ld /sdcard/Android/data/com.termux` or using `stat` command. A simple approach is to bind-mount the directory as world-writable so that every app can write to it. But it's not a good idea to set such open permissions. So we go the Android's way; bind-mount a directory from external SD card using FUSE:

```
~# bindfs -u $(stat -c %u /sdcard/Android/data/com.termux) -g 9997 -p a-rwx,ug+rw,ug+X /mnt/media_rw/[UUID]/Android/data/com.termux /mnt/runtime/write/emulated/0/Android/data/com.termux

```
* For further mount options and details see the above linked answer.
* Replace `/mnt/media_rw/[UUID]` with `/mnt/expand/[UUID]/media/0` if SD card is formatted as Adoptable Storage but data is not *migrated*.
* In the same way `obb` directories can be bind-mounted.
* If your device supports `sdcardfs`, the same mount should propagate to `default` and `read` emulated *VIEWS* as well. Otherwise if your device is older you can bind-mount the same way to other *VIEWS*.
* Some apps by default prefer writing private data to secondary external storage (i.e. external SD card), so you don't need to bind-mount their `data` or `obb` directories.

---
Tags: external-sd, permissions, 9.0-pie, mount, bind-mount
---


title: start app automatically at reboot

text:
# Question
Title: start app automatically at reboot
I have an old-ish Google Pixel (gen1) phone that must have a hardware issue, and crashes/reboots every once in a while (every hour or so). It's unusable as a proper phone but I thought I could reuse it as a single app kiosk-style screen. For example, I could have my Google Photo Albums displayed or I could use it as a stock ticker.

Is there a way to make a specific app start and take over the screen on reboot for Android?

# Answer
Attempting to accomplish with automation. Using Automate to demonstrate how to do it:

1. Select the Broadcast Receive block. Click on it, in the Action section, select "Boot completed". Click Done.
2. Select App Start block. Click on it, in the Package section, select the first app you wish to start at boot. Click Done.
3. Save and give it a name. Link the blocks as seen on the image below.
4. In the Settings, select "Run on system startup".
5. Don't forget to give the necessary permissions when asked. Press start.

Every time you reboot your device, after the boot has been completed, the app will be launched.
> 1 votes

---
Tags: google-pixel
---


# Question
Title: Google Assistant Routine custom commands weird behavior
I'm trying to setup Google Assistant Routine for my wake-up alarm. Whenever I create 2 or more custom commands, they tend to change after saving. I'm trying to add 2 commands: **continue music** and **turn do not disturb off** (both these commands are correct and work fine with Google Assistant). But whenever I press the save button and check them back, one of them changes to the other one. So I'm only getting either **2 do not disturb off** or **2 continue music**.

The question is: am I doing something wrong? Maybe I don't understand something about Google Assistant Routines?

My device is **Xiaomi Mi A1** with latest **Android 9** installed.

# Answer
> 0 votes
I get the same behaviour on Pixel 3 XL. Clearly a bug. A workaround is create a new Google routine containing all the things you want to do, and activate that single routine in the clock app.

---
Tags: google-account, alarm, google-assistant
---


# Question
Title: Is it safe to charge tablet from phone via OTG cable if tablet's adapter is 5.2V?
Is it safe to charge tablet from phone via OTG cable if tablet's adapter is 5.2V (a bit above)?

# Answer
**Yes**, as long as it is supported by the tablet and you have compatible cables available.

USB Standards specify that charging voltage should be 5.00V ± 0.25V, i.e. 4.75V~5.25V.

Upper limit is 5.25V which is higher than tablet adapter voltage ; add to this the resistance offered by the cable and the input voltage will be well within safety limits.

How efficient it would be is upto you to verify as Robert pointed out in comments
> 0 votes

---
Tags: charging, tablet, usb-on-the-go
---


# Question
Title: Compile apps from GitHub source on device via Termux or apps?
Are there any ways to compile APKs on the device from GitHub source, like "APK builder" by heagoo? Termux method would be nice too if anyone knows.

I have tried the sdrausty.github.io method, but I believe that's more for his pre-configured APKs. I want something more universal.

Specifically, I'm looking to build this app: https://github.com/ukanth/afwall

# Answer
> 1 votes
> any app's ... that can compile apks on device from github source?

The command `~/buildAPKs/build.github.bash` can build nearly an unlimited number of APKs which are available at GitHub today and is available at https://github.com/BuildAPKs/buildAPKs.

This BASH script uses `aapt`, `ecj`, `dx` and `apksigner` in Termux and Termux PRoot to make APKs on device and runs in Amazon, Android, Arch Linux, Debian, Chromebook, Ubuntu and Windows.

The https://github.com/BuildAPKs/db.BuildAPKs repository has build results for a few of the accounts at GitHub. For example, the `B10NAMES` file has GitHub login names that built at least 10 APKs on device in Termux.

> Specifically, I'm looking to build this app: https://github.com/ukanth/afwall

```
$ ~/buildAPKs/build.github.bash https://github.com/ukanth/
build.github.bash: Beginning BuildAPKs with build.github.bash https://github.com/ukanth/:
.
.
.
Results for ukanth:
com.ukanth.simplebatterytemp.apk
com.andraskindler.quickscroll.apk
com.stericson.RootShell.apk

```

The app afwall does not build on the fly with BuildAPKs at present. Three of ukanth's apps do build on device in Termux on Android out of box. With modifications to this script, afwall should also build on device today.

---
Tags: apk, termux, development
---


# Question
Title: How can I detect if a shell script is running on Android?
What is the most reliable way to detect if a script is running on Android (instead of a regular Linux build)?

To run scripts, I'm using bash, the Terminal app, and BusyBox.

# Answer
To do this, we need the code below in a file somewhere on the Android device (in /data/checkdroid for example):

```
ANDROID_HOST=0
ANDROID_BUSYBOX=/system/bin/busybox
ANDROID_BUSYBOX_APPLETS="acpid add-shell addgroup adduser adjtimex arp arping ash awk base64 basename beep blkid blockdev bootchartd brctl bunzip2 bzcat bzip2 cal cat catv chat chattr chgrp chmod chown chpasswd chpst chroot chrt chvt cksum clear cmp comm conspy cp cpio crond crontab cryptpw cttyhack cut date dc dd deallocvt delgroup deluser depmod devmem df dhcprelay diff dirname dmesg dnsd dnsdomainname dos2unix du dumpkmap dumpleases echo ed egrep eject env envdir envuidgid ether-wake expand expr fakeidentd false fbset fbsplash fdflush fdformat fdisk fgconsole fgrep find findfs flock fold free freeramdisk fsck fsck.minix fsync ftpd ftpget ftpput fuser getopt getty grep groups gunzip gzip halt hd hdparm head hexdump hostid hostname httpd hush hwclock id ifconfig ifdown ifenslave ifplugd ifup inetd init insmod install ionice iostat ip ipaddr ipcalc ipcrm ipcs iplink iproute iprule iptunnel kbd_mode kill killall killall5 klogd last less linux32 linux64 linuxrc ln loadfont loadkmap logger login logname logread losetup lpd lpq lpr ls lsattr lsmod lsof lspci lsusb lzcat lzma lzop lzopcat makedevs makemime man md5sum mdev mesg microcom mkdir mkdosfs mke2fs mkfifo mkfs.ext2 mkfs.minix mkfs.vfat mknod mkpasswd mkswap mktemp modinfo modprobe more mount mountpoint mpstat mt mv nameif nanddump nandwrite nbd-client nc netstat nice nmeter nohup nslookup ntpd od openvt passwd patch pgrep pidof ping ping6 pipe_progress pivot_root pkill pmap popmaildir poweroff powertop printenv printf ps pscan pstree pwd pwdx raidautorun rdate rdev readahead readlink readprofile realpath reboot reformime remove-shell renice reset resize rev rm rmdir rmmod route rpm rpm2cpio rtcwake run-parts runlevel runsv runsvdir rx script scriptreplay sed sendmail seq setarch setconsole setfont setkeycodes setlogcons setserial setsid setuidgid sh sha1sum sha256sum sha3sum sha512sum showkey slattach sleep smemcap softlimit sort split start-stop-daemon stat strings stty su sulogin sum sv svlogd swapoff swapon switch_root sync sysctl syslogd tac tail tar tcpsvd tee telnet telnetd test tftp tftpd time timeout top touch tr traceroute traceroute6 true tty ttysize tunctl udhcpc udhcpd udpsvd umount uname unexpand uniq unix2dos unlzma unlzop unxz unzip uptime users usleep uudecode uuencode vconfig vi vlock volname wall watch watchdog wc wget which who whoami whois xargs xz xzcat yes zcat zcip"

checkAndroid() {
    [ ! -e "/system/bin/adb" ] && return
    ANDROID_HOST=1
    if ! type $ANDROID_BUSYBOX >/dev/null 2>&1; then
        echo "FAILED! this program needs busybox to work on Android" 1>&2
        exit 1
    fi
    for i in $ANDROID_BUSYBOX_APPLETS; do
        eval "alias '$i=$ANDROID_BUSYBOX $i'"
    done
}

```

Here is an usage example of this fixture:

```
source "/data/checkdroid"
echo "ANDROID_HOST=$ANDROID_HOST" && type rdate
# output:
# ANDROID_HOST=0
# rdate not found
checkAndroid
echo "ANDROID_HOST=$ANDROID_HOST" && type rdate
# output:
# ANDROID_HOST=1
# rdate is an alias for '/system/bin/busybox rdate'

```

Source: https://gist.github.com/enten/67c4e332908b248a59a9
> 0 votes

# Answer
To determine if the script itself is running on an Android device or another flavor of Linux use `getprop` to detect if the script is running on Android instead of regular Linux.

If you want to use the `getprop` command in a script to determine which version of Android is installed, use `getprop ro.build.version.release`. It will look something like `COMMANDIF="$(command -v getprop ro.build.version.release)"` in a script. Source reference https://github.com/TermuxArch/TermuxArch/blob/master/setupTermuxArch.bash#L657 example.
> 0 votes

---
Tags: shell, scripts
---


title: Empty variables in termux' bash

text:
# Question
Title: Empty variables in termux' bash
I want to perform a test: if a certain variable exists, is non-empty, and its value matches an existing directory, then "exists" should be outputted.

I did the following:

```
$ echo $var

$ if [ -d $var ]; then echo "exists"; fi
exists

```

I got "exist", although I did not assign any value to `$var`. Why did this happen, and how do I test this properly?

# Answer
I think you need to wrap $var in quotes.

`if [ -d "$var" ]; then echo "exists"; fi`
> 3 votes

# Answer
> \[ -d FILE \] True if FILE exists and is a directory

You probably want to use one of these tests instead:

> \[ -z STRING \] True of the length if "STRING" is zero.
>
> \[ -n STRING \] or \[ STRING \] True if the length of "STRING" is non-zero.

From https://www.tldp.org/LDP/abs/html/fto.html

> how do I test this properly? if a certain variable exists, is non-empty

This question is discussed in detail https://stackoverflow.com/questions/3601515/how-to-check-if-a-variable-is-set-in-bash here.

> its value matches an existing directory

This code \[\[ "${F1AR\[@\]}" =~ "${NAME##\*/}" \]\] checks if values match existing directories. From https://github.com/BuildAPKs/buildAPKs/blob/master/scripts/bash/build/build.github.bash#L59
> 0 votes

---
Tags: bash, termux
---


title: How to put LG G2 in fastboot mode?

text:
# Question
Title: How to put LG G2 in fastboot mode?
Is there any way to get an **LG G2** (running the latest version of stock software, Lollipop 5.0.2) in **fastboot mode**? None of the methods listed anywhere online work for me. I'm getting the feeling that it's not an option on this device, but I've heard no definitive confirmation of that.

Here's what I've tried and has not helped:

* Turning the device off, holding down power and volume down buttons, releasing them when the LG logo displays, and holding them down again to power up. This brings the phone into `Factory data reset` mode, in which the only option is to `Erase all user data & restore default settings`.
* Turning the device off, holding the volume up, and plugging a connected USB cable into the phone. This brings the phone into `Download Mode`.
* `adb reboot fastboot`. This reboots the phone normally.
* `adb reboot bootloader`. This also reboots the phone normally.

(If you're wondering why I need to get into Fastboot: How to Clear Caches in LG G2 Running Lollipop 5.0.2.)

To be clear, I mean that `fastboot devices` lists nothing when I do any of the above methods. But `adb` is working.

# Answer
Download mode may appear prior to fastboot mode.

1. Boot down the phone
2. Keep holding down `Volume Up` button.
3. Put a USB cable that is connected to a PC in to phone.
4. Continue holding `Volume Up` button throughout download mode until fastbood mode appears and you can release the `Volume Up` button.

Extra: Here's the how-to video.
> 4 votes

# Answer
Per this thread, the fastboot is entered in when boot partitions get corrupted. For obvious reasons, I'm not overly thrilled about testing this theory by corrupting my boot partitions :)
> 1 votes

# Answer
SarpSTA's answer is correct, but if you're on Windows you may need to install qualcomm drivers for some versions of the LG G2. I had to do this for the ls980 as per this post:

> Start by installing qualcomm drivers on your windows machine to better detect which mode your phone is in right now:
>
> https://www.dropbox.com/s/3hovx8h7nauy7e6/Qcomm\_Drivers.zip?dl=0
>
> Unzip into a regular folder onto desktop. Plug in device and go to device manager. Find device that is phone, right click and update driver. Choose option to provide your own driver and point to the location of the entire folder of qualcomm drivers on the desktop. When done, note how the device is described in device manger. It should be more specific now. It sounds like you may be in a QDLoader 9008 mode since no partitions are showing up for you.

Even though it said my drivers appear to be up to date, it would not boot into fastboot mode until after attempting to update from this Qualcomm\_Drivers package. Prior to that it would mount a bunch of drives.
> 1 votes

# Answer
1. Power off your LG device;
2. Connect your USB cable to your computer, but not your phone
3. Press and hold the Power and Volume Up keys simultaneously. Hold for about 5 to 8 seconds. Now connect the other end of the USB cable to your phone;
4. Done! If it worked, you're welcome.
> 0 votes

# Answer
Hi I had the same problem on my LG G2 mini. This command worked for me: dd if=/dev/zero of=/dev/block/platform/msm\_sdcc.1/by-name/laf By doing so, the phone can't enter Download mode and enters Fastboot mode instead. Use with caution though, I don't know what this really does to the device!
> 0 votes

# Answer
all you have to do is hold down the volume down button and the power button and then plug in the USB cord real fast as it starting up and then we'll go straight into fastboot mode
> 0 votes

---
Tags: fastboot, lg-g2
---