title: Is it possible to backup without root?

text:
# Question
Title: Is it possible to backup without root?
I tried restoring a TWRP backup of my Pixel 3 and it ended up putting my phone into a bootloop. I downloaded the latest factory image and reflashed (not knowing the latest version bootloops when Magisk is flashed). I downloaded the last version to support Magisk but a) held off on rooting for a little bit b) accidentally flashed the newer one a second time. Fast forward to now: I spent the time (quite a long time) to reinstall and configure all my apps and then realized my mistake when I looked at my terminal when I went to root.

I tried adb and Google backups, but neither are backing up any non-Google app. Is there anyway to make a backup of my app data without root? Could I take a twrp backup of just my user data and restore it once I flash the version that supports rooting? Or will the changes that caused encrypted data to not be supported by twrp not be compatible? If the user data can't be restored by twrp, is there any way to unpack the twrp backup and manually transfer the data with adb push? Or could adb pull work?

# Answer
> 1 votes
`adb backup` should work at least on some apps. Test it for example with a simple tea timer or stopwatch app those apps should not disallow backup. If this does not work the backup function on your device may be defect (encountered this once on a Lenovo tablet).

But if it works for simple apps that the it is just that the other apps disallow backup (`android:allowBackup=false` set in AndroidManifest.xml). Note that this settings affects disables `adb backup` as well as Google Cloud backup.

If the app disallows backup then there is other way to backup the data except using root permissions.

However if you have root and TWRP installed you may be able to perform a user data backup. However AFAIK this only works if TWRP is able to decrypt the user data. If you only see the encrypted files or the encrypted partition I doubt that restoring those files will later work on the same device (it will never work on a different device).

Note that a (decrypted) user data backup independently how it was created can not be directly restored via ´adb push\`. For doing so adb would have to run with root permissions which is usually no longer possible (unless you have a manipulated adb version on the device).

What you can do with root permissions is backup and restore app user data. For example manually by using `tar` in an `adb shell` with root permissions.

---
Tags: adb, backup, google-pixel, google-backup, app-data
---


# Question
Title: Link between device state & user settable root of trust
I am (still) trying to understand exactly how verified boot works and I am wondering what happens when a user-settable root of trust is used by the device. As said here:

> If the device is LOCKED, the bootloader goes through the steps in Verifying Boot to verify the device's software. LOCKED devices boot only if the loaded OS is properly signed by the root of trust. For more details, see The boot flow.

* Does the fact of setting a user-settable root of trust imply that the device has to be UNLOCKED?
* Does it mean that a LOCKED device can boot on a custom OS if it is signed with the user-settable root of trust?
* Is the warning still displayed if the user-settable root of trust is used to validate tue boot process?

# Answer
* Custom root of trust has to be set from fastboot according to docs. The OEM can implement it in different ways, the docs recommend that a custom certificate can only be installed from UNLOCKED state
* Once your certificate is installed as root of trust, you can boot in LOCKED mode (only binaries signed by either you or the OEM will be allowed to boot)
* Following the docs, a warning should be displayed if booting a custom signed firmware (booting the OEM signed one shouldn't ?)
> 0 votes

---
Tags: security, boot
---


# Question
Title: How can I quickly delete ALL texts on an unrooted phone?
On a rooted phone, I merely delete `/data/data/com.android.providers.telephony/databases/mmssms.db` and then reboot.

Is there anything similarly quick that can be done on an unrooted phone?

I have a phone that has upwards of 50k texts and every app is hanging when trying to delete a single conversation.

(Android 6.0.1)

# Answer
Not near as quick, but SMS Backup & Restore app and other SMS management apps can do this, also many SMS messenger apps can do this as well, but without root you cannot do it manually.
> 3 votes

# Answer
You doesn't need root to done this, You can simply go to Settings, Apps and find message service then click Clear cache and storage.
> 0 votes

# Answer
I'm not sure is this a useful answer to this question.

My problem was, I need to delete all the conversation from my messages app on my phone. Since I'm a stock Android user from the past 5 years, all the messages from 5 years still exist in my new android phone (now I'm using pixe2). Why? , because google will sync all conversations with google account.

There is no option in default messages app to delete all conversation. I tried to clear app data, but not worked. Because Google will sync all the conversation back again to my phone. I tried to install other SMS apps but it not showing old conversations on my google account.

Finally, I found an app from Microsoft in the Google play store "SMS Organizer - Clean, Reminders, Offers & Backup"

https://play.google.com/store/apps/details?id=com.microsoft.android.smsorganizer

It will sync conversations from google account and it has the option to delete all conversations. It worked..
> 0 votes

---
Tags: 6.0-marshmallow, sms
---


# Question
Title: How to run a script in background from adb shell?
I have a problem with USB tethering on my rooted Nougat phone (LineageOS). After some time phone stops USB tethering. To fix that I run the following script like this:

```
adb shell
su
nohup sh tether.sh &
exit
exit

```

tether.sh

```
#!/system/bin/sh
service list
while true;
do
  if ! pidof -s dnsmasq > /dev/null
  then
    echo -n "Connectivity lost at "
    date -u +%FT%TZ
    echo "Waiting 3 seconds..."
    sleep 3
    echo "Calling ConnectivityManager.setUsbTethering(false)"
    service call connectivity 33 i32 0 2>&1
    sleep 3
    echo "Calling ConnectivityManager.setUsbTethering(true)"
    service call connectivity 33 i32 1 2>&1
    echo "Waiting 3 seconds..."
  fi
  sleep 3
done

```

Problem: If I use `nohup` my call to `service call connectivity` fails with service not found. And I put `service list` on top of the script which returns `Found 0 services:`. However the same commands work when ran directly from `adb shell; su`.

Why `service call` doesn't work inside this background script? Does it need the same `tty` to work?

# Answer
Processes receive signals from other processes or kernel as a warning or as a request to make some change in state. Receiving processes can *block*, *ignore* or *catch* signals, except `SIGKILL` which does what the name says. A process receives `SIGHUP` (hangup signal) when its controlling terminal (virtual or pseudo) disconnects or its controlling process (which is usually a shell) terminates. Quoted from `adb shell` source:

> PTYs automatically send SIGHUP to the slave-side process when the master side of the PTY closes

* See Terminals and Shells on Android for details on PTYs

Process can then handle the signal to continue its execution or just gets killed by the kernel.

`nohup` makes a process run (usually in background) by simply ignoring `SIGHUP` even if the controlling terminal closes. Additionally if FDs `0`, `1` and `2` of the process are attached to the terminal, `nohup` redirects `STDIN` from `/dev/null` and `STDOUT`/`STDERR` to `nohup.out` file.

Android's built-in `/system/bin/nohup` has some bad implementation like many other applets of `toybox`. It replaces `STDIN` with nothing and leaves `STDERR` attached to the terminal. So all shell commandline tools which are related to `system_server` behave unexpectedly because of no FD `0`.

Solution is to use `nohup` e.g. from busybox or do:

```
nohup tether.sh </dev/null &

```

Or without `nohup`:

```
tether.sh </dev/null &>/sdcard/usb.log &

```

In order to make sure a program ignores `SIGHUP`, add `trap '' 1` to script above the program to be executed. But it's not required with Android's default MirBSD Korn Shell (`/system/bin/sh`) which doesn't send `SIGHUP` to all jobs (children processes) in the same session i.e. attached to the same terminal. So `nohup` or `trap` isn't essentially required, whether shell exits or gets killed.

Secondly `mksh` doesn't detach from terminal(s) completely because in addition to `STDIN/OUT/ERR`, it attaches to `/dev/tty` directly (ref). So detaching FDs `0/1/2` doesn't suffice. However there's a daemon mode which completely detaches the command from terminal:

```
/system/bin/sh -T- tether.sh

```

Also `mksh` unblocks all signals, though not relevant here.

`bash` provides better job management; user can configure with `huponexit` whether or not to always send `SIGHUP` to all jobs on exit (ref). Bash's built-in `disown` command can be used to exclude jobs from receiving signals.

To keep script running in foreground, a multiplexer like `tmux` or `screen` can be used. That's what I do, particularly with `su` binaries from rooting solutions which don't detach (due to limited implementation of pseudo-terminals), when a program is running in background. See this issue for details.

**RELATED:** How to run an executable on boot and keep it running?
> 3 votes

---
Tags: adb, root-access, shell, scripts, usb-tethering
---


title: How do push notifications work?

text:
# Question
Title: How do push notifications work?
I am wondering how is push notifications system working?

Is there an active TCP/IP connection that runs in the background to Google servers?

# Answer
Yes, Android keeps one active connection to Google's servers, but it doesn't use much power or data, because no traffic is sent along it until something sends a GCM message to an app on your phone. There's only one connection on the phone, used by all apps: installing a new app that uses GCM doesn't add any extra load.

The first step in GCM is that a third-party server (such as an email server) sends a request to Google's GCM server. This server then sends the message to your device, through that open connection. The Android system looks at the message to determine which app it's for, and starts that app. The app must have registered with Android to use GCM, and it must have the relevant permission. When the app starts, it might create a notification straight away with the data from the message. GCM messages are very limited in size, so the app might instead open a normal connection to the third-party server to get more information (for example, downloading the headers of new emails).

The advantage of using push notifications is that apps don't have to run at regular intervals to check for new data, saving both power and data. The advantage of having a centralized mechanism like GCM is that the device only needs one open network connection and the Android GCM system is the only thing that needs to keep running, rather than each app having to stay running in the background to keep its own network connection to its own server.
> 30 votes

# Answer
Android OS is now using GCM (Google Cloud Messaging) for Push Notification WS. You can get better idea here; it will give you an Architectural Overview about Full Push Notification Service with its Life Cycle.

Hope it will Help.
> 6 votes

# Answer
Late reply to old question but worth putting it.

GCM was deprecated on last April 2018 and google has recommended to use FCM instead which is similar to GCM.

1. we don't need to write our own registration or subscription retry logic
2. You can use Firebase Notifications, a serverless notifications solution with a web console that lets anyone send notifications to target specific audiences based on Firebase Analytics insights.
3. It does have GCM’s core infrastructure.
4. A Single message can transfer a payload of up to 4KB to a client app.
> 2 votes

---
Tags: push-notifications
---


title: How to mute Gmail thread on Android?

text:
# Question
Title: How to mute Gmail thread on Android?
I muted the message on web browser on my pc. I can see Muted tag is applied to the thread. I no longer receive notification on this thread from browser on pc. But I keep getting notifications on my Android. I am not the only person on the to/cc list of its messages. I searched old questions and answers. They mentioned a `Done` button. But this button is gone on the Gmail android app I'm using. Please advise.

# Answer
> 0 votes
1. Long-press or open the conversation.
2. Click the 3-dot, select Mute.

---
Tags: gmail, inbox-by-gmail
---


# Question
Title: Apps coming as updated when recently installed
So, I recently downloaded myfitnesspal and when I did, it showed as updated and not installed. It said that the app was recently updated and not installed.

So my question is, is this normal sometimes and is anybody else having this problem? Is there anyway to fix this problem?

Thanks in advance for you reply!

# Answer
> 0 votes
Everything is fine. Google Play Store will mark new installed app as 'Updated', there is none option for 'Newly Installed'.

---
Tags: applications, google-play-store, google-play-services, application-error
---


# Question
Title: Why does my Samsung A8 have such poor contrast after updating to Android 9?
I have a Samsung A8 2018 SM-A530W, which was purchased from a major Canadian carrier. It recently updated itself to Android 9 through a Samsung application.

Since that update, many of my applications are very difficult to read. In the case of Calendar and Clock, the contrast ratio between the text and background makes text illegible. In the case of the settings screen, transparency to the wallpaper does the same. I'm sure this isn't intentional, but I'm wondering what I can do besides reset my phone.

White text on an almost-white background makes the calendar impossible to read.

Gray text over a gray background makes the clock difficult to read.

Black text over a transparent background to the default Galaxy wallpaper makes settings difficult to read.

# Answer
> 1 votes
You can change that.

1. Go to Settings -\> Accessibility -\> Visibilty enhancements -\> then try some functions there and see what is best for you (contrast theme,contrast font etc.)
2. If you are using any Galaxy Theme, after system update, they are also updated, so this can alse be a problen. You should try to change or just dissable theme you are using(if you are using) for a moment to test it.
3. If you love Night Mode,it can also solve your problem, but it is not good for using outside.

---
Tags: samsung
---


# Question
Title: Parallel Space game progress file location
I've been using parallel space on my Android device for a while now but it's been having an issue with logging in to the Google Play services and thus backing up my game progress becomes hectic. I'd like to know where the progress files are stored in my file manager so that I can cut and paste it manually. Thanks in advance.

# Answer
> 0 votes
If you don't have rooted phone, you can not do it. Problem is in PS, in most cases you need to change settings of PS. So tap on three dots in right upper corner, go to Speed Mode and turn it off. Speed Mode can reduce battery consumption and speed the PS, but it also disaable Google Play services to achive that.

---
Tags: data-recovery, google-play-games, virtualbox
---


# Question
Title: Can we delete Android system WebView app to free up space?
I am looking to free up some space on my android device.

# Answer
1. you cannot delete it without root as it is a system app.
2. even if you could delete it, it wouldn't free up space for other apps. System apps reside in their own space (`/system`), which during normal operations is mounted read-only.
3. even ignoring the other two points: deleting Webview would cause several apps to just stop working as they depend on it for displaying content (even local one).

TL;DR: No, don't.
> 0 votes

---
Tags: system, webview
---


# Question
Title: "No emoji found" in Google Japanese Input
I am using Google Japanese Input keyboard, and I often want to post a rare emoji such as or .

The search bar looks like the perfect place to search for an emoji, but unfortunately it fails every time:

It fails even on the simplest requests, such as "smile" or "sad".
It does not work in Japanese either:

I have changed phones, and changed OS (Nexus default, CyanogenMod, LineageOS, Samsung default) many times: The problem has always been present. So I guess it is not a bug, but rather a problem of me not using it correctly.

How to use that feature correctly?

# Answer
> 1 votes
I found the answer 10 minutes after posting the question, that's silly.

The trick is, you must search in hiragana. Even if your locale is English (like in my case).

For instance, search for `ねこ` instead of `cat` or :

Most users type the hiragana before getting the kanji anyway, so it kind of makes sense if you think about it afterwards.

---
Tags: emoticons, google-japanese-input
---


# Question
Title: HSP Profile not working on connecting via Android Settings Dialog
I am a newbie on bluetooth & facing a few basic problems. I am currently working on an android voice assistant application, trying to make it work with bluetooth headsets.

If I connect to bluetooth via settings dialog the voice is still captured from Phone's microphone(and not from headset) but when it's connected via HSP profile programatically, voice is captured from Headset.

Can anyone help me understand this behaviour?

# Answer
> 0 votes
By default HS/HF profile has only control connection established. Audio connection become active during voice calls and speech recognition. You need to use `BluetoothHeadset.startVoiceRecognition`/`BluetoothHeadset.stopVoiceRecognition` and listen to `ACTION_AUDIO_STATE_CHANGED` intents.

---
Tags: bluetooth, bluetooth-hsp
---


# Question
Title: How do I stop ads interrupting my music player
I have a Galaxy Note 9 where I usually have music playing in Amazon Music Player in the background while I play games. In the old version of the OS (Samsung's version Android 8.1) when I am playing a game and an advert starts, it would pause the music, but I could just slide down the notification area and unpause it. Since the recent upgrade to Android 9 (again Samsung's version which it automatically upgraded to), I have to wait until the advert has finished before I can unpause the music. This is ultra annoying!

I don't mind the advert, or even the advert playing its sounds while the music is in the background, but completely taking over the sound like this just wrong!

So is there a setting or app-permission or anything I can change to disable ads from stealing exclusive access to the audio?

# Answer
Open the Google Settings app on your device (called Google Settings or Settings, depending on your device). Scroll down and tap Google. Tap Ads. Turn on Opt out of interest-based ads or Opt out of Ads Personalization. Reset the ad id, or user id.

This is the only thing I've been able to find on the subject. Like you, I run a background app while doing other things and, knock on plastic and glass, it seems to have worked I have an S10+, but it should be the same on your note
> 3 votes

# Answer
If adblock is an option, I highly recommend Blokada. It is a local VPN that uses host files to block ads and can work without root. More info here. (I am not affiliated with it). It sounds easiest just to block the ads

However, there is no way to keep an app from stealing audio focus that I am aware of.
> 2 votes

---
Tags: samsung, audio, ads
---


# Question
Title: Asking for the return of experience about using Android AOSP for embedded device
I want to use Android AOSP (without GMS) as OS for an embedded device, is there any return of experience about this. I have some questions about this:

* What is the used system for providing OTA updates?
* I heard about Google providing updates for only 3 years so we need to adopt next major update during 3 years, is it true?
* I heard about project treble that aims on providing forward compatibility on vendor implentation part, any experience on that?
* What are the faced difficulties / challenges?
* Any other subjects?

# Answer
> 2 votes
You are mixing up a lot of things:

Google Mobile Services (GMS) as well as all the other Google apps and services are not part of Android Open Source Project (ASOP), therefore using AOSP you will never get them.

> What is the used system for providing OTA updates?

AOSP is source code. You can clone it using Git/Gerrit to clone the source code repositories - thats it (and then use it to develop an own version for your device). OTA updates are provided by Google for Google Smartphones. The same is true for any other vendors selling Android Smartphones (if they provide updates at all). Every device gets it's very specific update. Update by Google are useless for any other device.

> I heard about Google providing updates for only 3 years so we need to adopt next major update during 3 years, is it true?

That is true for Smartphone Android versions. I can't find the source but AFAIR Google is providing patches for the AOSP source code for more than three years.

> What are the faced difficulties / challenges?

For you the largest challenge is to understand that Android is not an OS like Windows. There are no general OS that can be installed on different device types, there are no binary releases, no binary updates, just the source code without device drivers, ...

> Any other subjects?

As it turns out that originally you want to develop an own ROM please use https://stackoverflow.com for further questions as developing question are off-topic here.

---
Tags: aosp
---


title: Something killing background apps

text:
# Question
Title: Something killing background apps
Just yesterday I bought noname device called `Hisense U30` with Android 9 and it works bad. It killing background apps VERY AGGRESSIVELY. Like I start music in `Yandex.Music` (russian analog Spotify), switch off screen and in 1-2 minutes something kills player. It kills everything.

What I already tried:

1. Disable every preinstalled battery savers;
2. Disable battery optimization for certain apps;
3. Tried everything from Background apps get killed (by something other than battery optimization)

Nothing. Player still get killed. OS looks pretty close to stock Android (at least not much preinstalled apps). So my guess is that OS is somehow incorrectly configured.

I looked into `logcat` and what I got:

1. It starts with `MemoryDetectService` like this

```
MemoryDetectService: onStartCommand()---> action = screen_off_app_clear
MemoryDetectService: AutoClearState -----> begin

```
2. Then this service scan through all (I presume) running apps and find mine player too

```
MemoryDetectService: getRunningAppPackageName()---> begin
...
MemoryDetectService: RunningAppProcessInfo: cur.processName = ru.yandex.music:Metrica, pkgName = ru.yandex.music, uid = 10123, uid % 10000 = 123
MemoryDetectService: RunningPkgList---> pkgName = ru.yandex.music
...
MemoryDetectService: getCurrentHomePackages(): recentTasks = ru.yandex.music

```
3. And then, SOMEHOW, decide to kill my player

```
MemoryDetectService: mRunningPkgList: pkgName = ru.yandex.music
MemoryDetectService: mNeedForceStopPkgList---> pkgName = ru.yandex.music
...
MemoryDetectService: currentPkgName---> ru.yandex.music
MemoryDetectService: hasPkgNeedClean(): currentPkgName(New Method: mRecent2PkgList.get(0)) = ru.yandex.music
MemoryDetectService: getWhiteListFromFile: String = null
MemoryDetectService: hasPkgNeedClean(): memBefore = 3894, mWhiteListStr =

```
4. And then it start to kill processes

```
MemoryDetectService: clearMemory-----> begin
MemoryDetectService: clearMemory(): sendBroadcast hmct.intent.action.CLEAR_CACHE: null;
MemoryDetectService: screen on cleaning open = true ,  screen off cleaning open = true
MemoryDetectService: killPackage---> begin
...
MemoryDetectService: forceStopPackage---> begin
MemoryDetectService: clearMemory(forceStopPackage): isScreenOn = false
ActivityManager: Force stopping ru.yandex.music appid=10123 user=0: from pid 1972
ANDR-IOP: IOP HAL: Received pkg_name = ru.yandex.music pid = 0
ActivityManager: kill app.info.packageName=ru.yandex.music minOomAdj=-10000 packageName=ru.yandex.music
ActivityManager: kill app.info.packageName=ru.yandex.music minOomAdj=-10000 packageName=ru.yandex.music
ActivityManager: Killing 6673:ru.yandex.music:Metrica/u0a123 (adj 200): stop ru.yandex.music
ANDR-IOP: IOP HAL: Received pkg_name = ru.yandex.music:Metrica pid = 0
ActivityManager: Scheduling restart of crashed service ru.yandex.music/com.yandex.metrica.MetricaService in 20937ms
Zygote  : Process 7489 exited due to signal (9)
...
ActivityManager: Killing 6616:ru.yandex.music/u0a123 (adj 200): stop ru.yandex.music
ANDR-IOP: IOP HAL: Received pkg_name = ru.yandex.music pid = 0
libprocessgroup: kill(-7799, 9) failed: No such process
ActivityManager: Scheduling restart of crashed service ru.yandex.music/.common.service.player.MediaSessionService in 20929ms
ActivityManager: Scheduling restart of crashed service ru.yandex.music/.common.service.player.AppForegrounderService in 20929ms
...
ActivityManager:   Force finishing activity ActivityRecord{ba18734 u0 ru.yandex.music/.main.MainScreenActivity t248}
MemoryDetectService: setPackageAliveState start----packageName = ru.yandex.music
MemoryDetectService: setPackageAliveState end----packageName = ru.yandex.music, aInfo.processName = ru.yandex.music
MemoryDetectService: mClearAppList---> pkgName = ru.yandex.music, mClearApp++--->1

```

Any idea how to fix this?

P.S. AFAIK there is no other ROM like Linage OS for my phone, and I am not a big fan of `root` cuz this will break Google Pay, so it would be **great** to deal with it without rooting device.

## Update 1

I looked up for this service in `dumpsys`, and I have an idea: disable this service via `adb shell am stopservice com.android.systemui/com.hmct.systemui.taskmanager.detectmemory.MemoryDetectService`. Will be back with results.

# Answer
> 3 votes
As I mentioned, I tried to disable `MemoryDetectService` via `adb` (`adb shell am stopservice com.android.systemui/com.hmct.systemui.taskmanager.detectmemory.MemoryDetectService`), and it looks like it worked. One day, none of my apps is killed while I using them, battery drain is the same (~25% from max yesterday, ~25% today).

From the name of the service I assume that this is service, written by `Hisense` themselves (if they even can modify `SystemUI`).

However, still few concerns:

1. Everything looks fine, but disable some system service is dangerous, so need to be prepared for any s\**t;
2. I'm not sure, will this service remain disabled, if I gonna reboot my phone.

Anyway, I will consider this problem solved.

**UPDATE**

Yes, as I expected, this fix is not persist after reboot, but I managed to write bash script and run it manually after each reboot via Termux:

```
#!/bin/bash

am stopservice com.android.systemui/com.hmct.systemui.taskmanager.detectmemory.MemoryDetectService

```

---
Tags: 9.0-pie
---


# Question
Title: How to disable bad RAM addresses and fix bad storage blocks?
The symptoms which device presents are:

1. Restarts randomly with a previous freeze of a few of seconds (this is becouse of `/proc/sys/kernel/panic` is set to 5).
2. Sometimes with a blue filled screen.
3. Even on boot or TWRP.
4. Can restart several times on boot at different times.
5. Can avoid the 'restart effect' for a while keeping RAM usage low.
6. Not using the device and stopping services that run in the background makes the device "reboot proof".
7. This error appears in the log of TRWP:
`E:Invalid block device on /sdcard ext4 [][][]flags=display="Internal SD" ; symlink ', 'flags=display="Internal SD" ; symlink' , 27`
8. When trying to change partition type or repair 'Internal storage' at TRWP it says `Invalid partition selection` (maybe becouse of 7?)

I have done this to try fixing it:

1. Using `adb` to fix badblocks (Found some).
2. Using different ROM's.
3. Wiping the whole device.
4. Set `kernel.panic_on_oops` to 0.

**UPDATE:** After analyzing a lot of crash reports, seg faults and memory corruptions I am pretty sure that the unusable ram is from address `0xb6000000` to `0xb6ffffff`.

How to leave them out? It is a ARMv7 device.

# Answer
> 4 votes
This might not be a direct solution to your problem, but I'm sharing my thoughts on it.

## SHORT ANSWER

* It's not very likely for RAM on embedded systems to get defective. And if it does, solutions might not be readily available, except if someone has already done that specifically for your device.
* Modern flash storage devices manage bad blocks on their own, users haven't much to do in this regard.

If any of both problems requires user intervention, usually it's time to replace phone.

> 7. This error appears in the log of TRWP:
> `E:Invalid block device on /sdcard ext4 [][][]flags=display="Internal SD" ; symlink ', 'flags=display="Internal SD" ; symlink' , 27`
> 8. When trying to change partition type or repair 'Internal storage' at TRWP it says `Invalid partition selection` (maybe becouse of 7?)

To me these symptoms look like those of a dying eMMC.

---

## BAD BLOCKS ON RAM

I suppose you are talking about a phone or similar device.

Phones have SoCs, the module which includes CPU, GPU, RAM, eMMC, modem, WiFi, Bluetooth and GPS along with other critical components. In addition to that, LPDRAM and eMMC are in most cases manufactured together as a single Multi-Chip Package (MCP).

That said, what you are saying is highly unlikely to occur on phones. On PCs RAM is installed as independent modules which are prone to physical damage and wear and tear e.g. due to moisture, rust, dust, jerky movements, vibration, loose connections, pressure (during installation), heat (because of overclocking or improper ventilation) etc. So there are tools like memtest86 to regularly check for memory faults. All of these factors are ignorable for phones because the RAM is tightly integrated with less than a square inch sized SoC chip, keeping in view all above factors.

Another possible reason is electrical failure of the circuits/components e.g. due to electric shock in a sudden blackout which renders it totally useless. This again doesn't seem very probable for phones as the RAM is part of SoC, so the whole SoC should fail along with other, some kind of, surge protection mechanisms (if any).

Since RAM is volatile memory, its cells never get physically changed while reading/writing data unlike eMMCs. eMMC is persistent storage, so the physical properties of silicon cells change during E/P operations. That's why eMMCs have a limited life but RAMs aren't subject to any such limitation.

So if RAM is defective, the most likely is that it was manufactured with faults. RAM failure because of growing bad blocks isn't a common case, at least no sooner than other components of device, but still can't be utterly rejected. So how to fix it?

Since hardware is handled by kernel, the only way to mark some memory addresses bad is by making kernel not allocate those addresses to any userspace program (as can be done on Linux with BadRAM which modifies kernel source). And that too if the bad memory lets the device boot to kernel stage. Otherwise you'll have to handle the matter at SoC/bootloader stage where RAM is being initialized after power on (as can be done on Linux with GRUB and on Windows with BCD). It's definitely impossible on phones since bootloaders are closed source. If your bootloader is configurable like in case of development boards, that's an exception. But in each case you probably have to go through thousands of lines of code.

BadRAM is no more maintained after kernel version 2.6.28, that was 10+ years back (probably because it wasn't accepted into mainstream kernel tree). You can ask the developer if he can assist you to port the patch to ARM (if it's possible at all). Or may be you can exploit kernel parameters `mem` and/or `memmap` somehow to achieve what you want. Again the situation might differ a lot when there is no ACPI and no BIOS. Personally I never came across such situation for mobile phones.

## BAD BLOCKS ON STORAGE

Coming to the other point, fixing bad blocks makes sense only with hard drives or at maximum with old raw NAND drives (ref). HDDs have a linear LBA to CHS mapping, which means a filesystem knows to which physical location data is being written. Modern flash memory storage devices (including eMMCs, SD cards and SSDs) have a built-in firmware controller called Flash Translation Layer (FTL). FTL handles LBA to PBA mapping, the filesystem and OS are quite unaware of. As a wear-leveling strategy, FTL doesn't map sequentially and the mapping is dynamic. First LBA could correspond to last PBA and last LBA could point to somewhere in the middle, continuously changing with Garbage Collection.

FTL also scans and keeps track of all bad sectors (more specifically silicon cells) and remaps worn bits from overprovisioned (kind of free) space if required. Filesystems will never identify a sector bad, unless the stage comes when E/P cycles limit of flash memory is reached and it starts behaving funny, becomes read-only and ultimately crashes. Even if a purchased software identifies a sector bad, you can't mark it as *not allocatable*; refer to dynamic nature of LBA to PBA mapping. You mark a sector bad in filesystem and after few minutes that would be moved to some other partition.

HDDs usually don't die at once. Their built-in firmware maintains a list (G-list) of bad sectors from the day of manufacturing (ref). LBAs corresponding to bad sectors get replaced with spare sectors which every HDD has. Once the pool of spare sectors is depleted, any newly appearing (possibly partially) bad sectors are exposed to OS/filesystem. So when a program like `chkdsk`, `e2fsck` or `badblocks` identifies a bad sector, it can handle that at OS level or make it marked bad by HDD firmware. Quoted from here:

> If you give permission to overwrite a bad sector SeaTools will attempt to write a pattern of zeros to that sector. Usually, this action will assist the disk drive firmware in managing the problem by retiring the problem LBA and activating a spare in its place.

That's what `hdparm --write-sector` does.

Mostly filesystems can also maintain a list of bad sectors to be ignored during read/write operations. For instance on ext4, `dumpe2fs -b` shows a list of bad blocks reserved in bad block inode.

Mostly HDDs (as well as SSDs) are also built with SMART technology to monitor device health, but not eMMCs. In case of eMMC, the only thing `e2fsck` does is to identify errors within filesystem (and possibly repair using e.g. information from jornal), not in flash memory. All OS's including Android perform filesystem checks on boot before mounting, so that manual checking is not needed.

---
Tags: boot, storage, bootloader, reboot, ram
---


title: CamScanner: Trojan detected by ESET

text:
# Question
Title: CamScanner: Trojan detected by ESET
I usually use CamScanner to scan my documents. After updating to the last version, ESET told me I have to remove it, because this app has Trojan and it can provide remote access to the infected device. That was strange for me, and I think it's not correct. Anyway, I'm not sure. Shall I really remove `CamScanner`?

# Answer
Uninstall the app. Google Play Store has removed it, and the company behind the app itself has accepted that an ad module was acting as a trojan. The latter claims that their new version available from their website is free from that trojan though.
> 1 votes

---
Tags: malware
---


# Question
Title: Does using an unofficial charger negatively affect overall battery lifetime of a GS4?
According to two employees at the Sprint store, using an unofficial charger for the Galaxy S4 will negatively impact the overall life of the phone's battery (*edit:* in other words, the battery will need to be replaced much sooner than if one always uses the official charger).

I've never heard this before. Does anyone else know what they are talking about? What is special about the S4 charger? I saw someone online mention that a "special code" is transmitted over the USB connector, which the phone will use to judge if it is an official charger; again, new to me, but I'm not a hardware expert.

**Update:** I still haven't figured out an answer to this. Regarding the "special code", the post I saw *may* have been referring to the IC chip, but I don't know. So if we look at the distinguishing characteristics of a Micro USB Charger, there's 1) whether it has the IC Chip; 2) whether it is 2 amp vs. 1 amp; anything else?

# Answer
> 1 votes
A li-ion battery is charged in stages. C refers to a measure of Charge which to my understanding is not a scientific calibrated measurement, but moreso a general approximation of how much energy the battery can provided in an hour.

* If the battery is deeply depleted, we must slowly trickle charge the depleted cells at a rate of \< 0.2C to avoid overheating issues. Once the battery cells are at 2.8-3.3V, we can charge rapidly.
* The rapid charge stage is referred to as the Constant Current stage. The battery can be charged at a maximum rate of 0.5-0.8C. Going above 1.0C does not make the battery charge faster, it just generates more heat which is a killer for batteries.
* Once the cells reach 4.2V, charging transitions to Constant Voltage charging at a rate of 0.1C or less. Essentially, it is not charging at this point. If the battery is depleted a few percentage points because the charger is smart enough to switch itself off, it will begin Constant Voltage charging to restore the small depletion.

Cheap chargers often don't do any of the slower phases by actively monitoring the voltage, they just deliver 1C or more. When your phone is charged up, this generates a lot of heat. An increase in temperature of 8 degrees Celsius can half battery life. Lithium ion batteries are basically hand grenades, which is why they have so many safety systems built in to vent pressure and avoid overcharging. Cheap chargers also are probably not UL certified and have terrible quality control, so they present a fire hazard.

The phone can probably detect if an appropriate current/voltage is being supplied for the battery's current charge level. The other possibility is that the charger has a data wire(chargers have no need to send data to the phone) and upon connection, a magic number is transmitted that identifies the device as a Samsung charger.

Source: Former Electrical Engineer

# Answer
> 2 votes
I shouldn't think so. Samsung is a signatory to the EU Common External Power Supply standard, which includes specs for a USB charger. As long as the charger you're using supplies something close enough to what the Samsung one supplies, you're good to go. You can even charge it from a Computer USB port, although it will be quite a bit slower (except some PCs which can supply a higher amperage via a micro-usb cable, making it almost as quick as a mains adaptor charger.)

But in any case, you should be fine as long as the charger is of decent quality and isn't going to catch alight or something. I've been mixing and matching HTC, Samsung, and Blackberry chargers for years now.

---
Tags: battery-life, charging, samsung-galaxy-s-4
---


title: How do I add a new language?

text:
# Question
Title: How do I add a new language?
The aftermarket ROM I use seems to have the language list parred down to just a couple selections, probably to save space.

I would like to add a language back into the system. I can already set the locale using programs such as MoreLocale 2 so that applications with my language support start with the right locale code, however that doesn't add missing system languages. Having the system in another language would be nice, but **the main thing is getting the dictionary files for the keyboard auto-complete**. How does one go about adding the language support files for an input language to a system or ROM?

I can access other ROM's or the AOSP project to rip things out, but I don't know where to start. What files do I need and what modifications need to be made? Is there an easy way to do this with say a language-pack or is it hackery all the way?

My ROM is fully rooted and I have `adb` access if necessary. It's Android 2.3.7 (Unofficial CM 7.1 port for Dream/Sapphire) and I'm using the stock Android keyboard. The language I want is Turkish, although unless somebody has a download to point me to it's mostly the process I'm looking for here.

# Answer
> 12 votes
Adding full language support for a device is done at rom level, the languages that the default keyboard will support are added before compilation and the android keyboard will only give you the option to download dictionaries for the languages it supports. A good workaround is to download a keyboard app (such as GOKeyboard) that supports adding languages unto it.

Locale changing apps are nice but they may not be as thorough in their translation as a rom that was made or specially translated to a specific/your desired language. If your language is Bi-Di (Bidirectional, such as hebrew or arab) and the rom doesn't support it, it may introduce bugs as well!

The best solution will be to flash a new rom that holds your desired language, either a stock rom made for your area by your device manufacturer or a custom rom, Cyanogen is good because it probably supports every language that complies to the unicode standard (including turkish).

# Answer
> 0 votes
See this video

https://www.google.com/search?ei=MLpoXaXLLYHykwXjwqHADQ&q=android+setting+language+missing&oq=android+setting+language+mis&gs\_l=psy-ab.3.0.33i22i29i30l2.271266.274795..276526...0.2..0.208.2395.0j13j2......0....1..gws-wiz.......0i71j35i39j0i67j0j0i20i263j0i203j0i22i30.5sRaXAommog#kpvalbx=\_R7toXaWQEdHxkwWXnIv4CA22

TL;DW

* install morelocale app
* use abd to change the app permission `pm grant dogfooderz.com.morelocales android.permission.CHANGE_CONFIGURATION`
* use the app to change the locale

NOTE: if you get

`Security exception: grantRuntimePermission: Neither user 2000 nor current process has android.permission.GRANT_RUNTIME_PERMISSIONS`

see this answer https://stackoverflow.com/questions/52079343/how-can-i-use-adb-to-grant-permission-without-root

---
Tags: languages, localization
---


# Question
Title: How to merge /data and /sdcard on Android 4.4?
Is it possible to use two partitions as one storage on a MediaTek device?

AFAIK, it is already implemented in Samsung Galaxy S III, may be.

# Answer
Not very large number of physical primary only devices were shipped with separate `/sdcard` partition (with attribute `removable="false"`) in transition phase from UMS to MTP. Most of those were shipped with ICS or JB, a few got updated to KK. Then mostly vendors moved to the dominant concept of emulation on `/data/media/0`. See Android's Storage Journey for more details.

You can take risk to paly with partition table in order to merge both partitions: `/data` and `/sdcard` (depends on the layout of partitions). But how would you get a compatible ROM? In fact you'll have to develop a custom ROM from scratch, which needs modification to both; AOSP and kernel code. Particularly `vold` configurations need special upgradation as it would be looking for partition to be mounted at `/sdcard` with *(permission-less)* FAT filesystem, which is now merged to `/data` with `ext4` filesystem. Storage configuration in framework, `fstab` and `init.*.rc` files would also needed to be changed.

So the struggle required isn't worth it. And I doubt even if you would be able to get complete source code for such an old device.
> 0 votes

---
Tags: 4.4-kitkat, external-sd, mount, partitions, internal-sd
---


# Question
Title: Galaxy Note 1 - Hangs on start up screen
This is the most tragedic thing ever happened to any of my electronic devices...

1. My phone was dead (naturally) battery charge was zero as I was outside waiting for a friend.
2. I wanted to charge it for couple of minutes
3. I went to Samsung Centre
4. The staff showed me a charger cable and asked me to charge there. (point A)
5. Phone was charging
6. Not more than 2 minutes, another staff came and asked me to connect to the negibouring laptop, where it had the charger cable connected (point B)
7. I disconnect from point A and connected to point B. Phone was charging and I started the phone. The was started normally yet battery was very low. (within the first 5 minutes) I shut it down.
8. She came back again and asked me to disconnect from the laptop (point B) as she has another customer who needs to use the laptop
9. So I disconnected from point B and connected back to point A. After 5 more minutes, I saw the charging green bar has increased. So I started the phone. Now phone hanged on the start up screen and keep showing "SAMSUNG"............

Then I asked them why has happened, they said sorry let us recover your phone, your phone has a problem. From the day I bought, I didn't have any issues with my phone and had been using it for year. Phone is up to date and well taken care.

This whole issue has occured due to the fact that Samsung staff asked me to connect my phone to the laptop which automatically upgrades softwares and while upgrading the softwares she disconnected my phone.

They refused to help me by at least giving me back my data. So can someone please help me with proven steps to connect to the kernal and recover my data back? And I have never connected this phone to a kernal.

I don't know how possible that is either. I saw this. But I have zero understanding what he is talking about ODIN, DOWNLOAD MODE...However if someone can guide me with the steps, I can manage it.

# Answer
I had same issue with my Galaxy Note 1, this happens mostly because of the reasons such as, Software Bugs, Software Manipulation, Stuck After An Update, Malfunctioning Apps or Defective Memory Card.

The Solution for this is pretty easy you just have to Wipe Cache Partition.

Wiping the cache partition of your phone allows you to remove the cache files which may have been corrupted and caused the phone to power off. There is a possibility that the corrupt cache files may not allow your phone to power On. These cache files are temporary in nature and will be created by the phone once again after you wipe out the current cache files. In order to wipe the cache partition, you need to enter the recovery mode by pressing a specific combination of keys. The combination varies from one Android device to another. Here are some examples:

Samsung: Power button, Volume Down button, Home button.

Nexus: Power button, Volume Down and Volume Up

LG: Power button and Volume Down button

HTC: Volume down and Power button.

To wipe the cache partition, follow these steps:

1. Press and hold the Power button, the Volume Down button, and the Home button (for Samsung) all at the same time.
2. Once you see the Android icon, release the Power button but continue to press and hold the other two buttons till you see the System Recover screen.
3. You will see a menu with many options. Use the Volume Down key to highlight the option that says ‘Wipe Cache Partition’.
4. Select the option by using the Power key and the process of wiping out the cache partition will initiate.

Once it completes, your phone will automatically reboot and new cache files will be built by your phone. If you are able to go through the entire process successfully and your phone switches on, Voila!! your problem is fixed, but if your Samsung Galaxy won’t turn on or charge even after wiping the cache partition then you must consider resetting the phone to factory settings.

Do let me know happens, after trying my suggested fix.
> 1 votes

# Answer
Download mode: `Volume Up` \+ `Menu` \+ `Power button`, then `Volume up`

It allegedly moves it to download mode so that you can download ODIN

I am in the same boat since yesterday and only saw the recommendation, now going to try.
> 0 votes

# Answer
I had this happen and took it to be fixed. The guy changed a chip on the motherboard. Said the fix was hitand miss. It worked. All the data and apps are gone though. Hope this helps.
> 0 votes

# Answer
Soft Reset

Start with a soft reset. A soft reset can sometimes resolve minor software issues and should be the first step to take when troubleshooting an Android smartphone.

Power Cycle

Chances are you have already performed a soft reset by attempting to power your phone off and on or by merely restarting your cell phone. If you have not already tried this then go ahead and do so. The solution might be as simple as rebooting your smartphone.

Battery Remove

If possible try removing the battery from your cell phone for 10-15 seconds then reinsert the battery put your phone back together and then see if it will power on properly. If the phone powers on correctly then enjoy your working smartphone.
> 0 votes

---
Tags: data-recovery, samsung-galaxy-note
---


title: How to find screeshots from PC?

text:
# Question
Title: How to find screeshots from PC?
I'm looking for a screenshot, which I can see in Google Photos under *Device folders* -\> *Screeshots*.

But when I browse it from my PC (Windows 10), in *DCIM* folder I can only see *Camera* one (I read it should be *Screenshots* next to it).

Why is that? Is it possible that I don't have permissions to see it?

# Answer
In my case screenshots were actually located under *Pictures/Screenshots*.

Yet for some reason this directory wasn't visible when I was connected in (I believe default) *Transfer files* mode.

When I switched to **Transfer Photos (PTP)** , the *Screenshots* folder became visible from file browser.

To change, I needed to click on notification *USB for file transfer*, which popped up on my phone.
> 1 votes

---
Tags: 7.0-nougat, files, screenshots
---


title: Download transfer question

text:
# Question
Title: Download transfer question
I downloaded a music album from the Google playstore on my Samsung phone. How do I transfer that album to my Samsung Music App?

# Answer
> 0 votes
It can be only used in Google Play Music app,unless you make it avaiable offline. Then you will find your music on your phone, and SMA will register it automaticly.

---
Tags: google-play-music
---


# Question
Title: Can developers build applications for unsupported Android versions?
My smartphone still works as a mobile phone. I would like to exploit it at its full potential but many applications don't support its "old" operating system `Gingerbread 2.3.6`.

I do not want to buy a new phone because it works well. However, I would like to develop apps for my personal use on this phone but Google does not support Gingerbread since 2017.

Can developers build applications for unsupported Android versions?

**Note:** the question is also about programmed software obsolescence. Currently, we cannot make libre software distributions on all devices. Android is an *open source* operating system so there may be possibilities to maintain smartphones despite proprietary locks (hardware and software). The question allows you to see *what can be done* for a working device: why a working Android device is become unusable? From my point of view, the device is still usable if someone maintains a functional development environment which allows to develop new applications.

# Answer
> 0 votes
**Qualified yes, but it becomes more difficult (and depending on the features required impossible)**

Devices with Google Play has a set of built in services - Google Play Services - which is provided for free (or nearly so) for apps. These services include Location & Maps, push messaging (was Google Cloud Messaging, now Firebase Cloud Messaging), Google Sign-in, and others. These services provide a lock-in to developers as they are available in any device that comes with Google Play Store.

All of these services are subject to change over their lifetime and Google has already announced that Google Play Services for Ice Cream Sandwich (ICS) API 14 & 15 will no longer be updated

What this means is that for any app developer interested in the current market of Android devices with Google Play Services, they will have to do additional work to support older devices where the Google APIs are frozen.

Another pain point for developers is that the WebView prior to Android 5.0 was tied to OS updates so WebView issues/quirks varied depending on manufacturer and OS version.

You would also need to find older web browsers as both Firefox and Chrome are at or above Android 4.0. So advances in mobile website development may break on older browsers.

**As mentioned by @Robert:**

The Android Tools Team has evolved the build tools from the time of Gingerbread: Eclipse IDE based to IntelliJ IDE, Java Ant build system to Gradle build system, etc. There may be a situation where either the tools no longer support the older SDK or the developers for old devices need a depreciated API which is no longer supported by the latest SDK or any recent ones. Additionally Android developers depend upon third-party support libraries written by Google or other developers each of which have their own depreciation schedule.

**What can I do**

Run a Custom ROM with a replacement for Google Services if necessary, see: Fakestore, blankstore, gms, microg, unifiednlp - what's best for Android without Gapps?

**What if I don't want to root/Custom ROM**

Any developer would need to find matching APIs for the Google Services which would work at the lower API of the device. They will probably need to pay for things which were free with Google Services like in-app map tiles and push notification.

Note that even the open-source app store F-Droid now has a minimum API level of 14, Ice Cream Sandwich

**Developers are still free to create apps which users can download and side-load on older devices, if they don't use any deprecated Google Services for that device**

# Answer
> 0 votes
You are free to build any app for unsupported versions of Android. However, you won't be able to publish on Google Play Store (if you intend to).

From an article published when Google ended support for ICS:

> First, Google won’t allow developers to publish apps that support the API level for ICS — that’s API 14 and 15. That means the oldest supported version of Android in the Play Store is Android 4.1 Jelly Bean (API 16).

---
Tags: 2.3-gingerbread, open-source
---


# Question
Title: Can I force a message to be sent as an MMS?
Is there a way to force a message to be sent as an MMS?

There are multiple reasons that MMS may be preferred. SMS and MMS may have different fee structures dependent on plan, carrier, and country. Additionally, some messaging software may allow for more delivery notification options for MMS than SMS.

# Answer
> 7 votes
*As per Broam's suggestion above, I'm posting my comment as an answer. Hopefully some people finds it useful.*

If you add a Subject to the message you're making, it gets converted to MMS format. Even if the Subject is empty, at least, that's what I know

# Answer
> 1 votes
# Force the MMS

I've saw this comment you provided on your question:

> @Flow In my tariff mms sending through the country is free whereas sms is not free

If this is the case, you can have a `.jpg` as a signature file, and attach it to every SMS you send. Since the image is a media component, your SMS will become an MMS, thus saving you some $$.

---

# Original Answer

As far as I know, you can't.

An MMS message is a plain old text message with contents attached.

If you attach a media file, it will be send as a MMS message. Otherwise it will follow as an SMS.

What is MMS? Wikipedia

> Multimedia Messaging Service, or MMS, is a standard way to send messages that include multimedia content to and from mobile phones. It extends the core SMS (Short Message Service) capability that allowed exchange of text messages only up to 160 characters in length.

# Answer
> 1 votes
I've found that another option, on phones or text messaging apps that support group texting but that don't force MMS when you add a Subject, is to create an artificial 'group' consisting of the person you're texting to .... AND yourself. In other words, send the text to the target person AND yourself. If you've got group texting support, doing so will force an MMS, and thereby bypass Google Voice. Hence, your emoji will get transmitted in spite of Voice. Once you send the group text, you will receive a redundant copy of your text. At that point, just delete it. This approach can become a little messy if you don't know what you're doing, but it works for me.:-)

# Answer
> 0 votes
Usually, messaging software determines the appropriate protocol literally for each message sent, based on its content. To force the choice, you have the following options:

* Attach a picture.
* Attach a signature.
* Add a subject.
* If the messaging software allows it, manually switch the message to MMS.

An example of messaging software that allows you to add a subject/signature/switch protocol: Android Messages.

# Answer
> 0 votes
Actually with some cell phone providers it is wise to use MMS because then you can use your home WiFi, if you are at home of course or at a WiFi location outside of home. That's because with some services you pay for every message but not for anything that goes over WiFi. The test is simple, first check how many messages you have sent so far or how many you have remaining, then just turn WiFi on, then write a new message and include a small picture or something and send it to a friend or yourself. If you send it to a friend it will normally take one message and if you send it to yourself it will take two messages (one ot send and one to receive) but if it really went over WiFi it will take zero messages so the original message count will stay the same. Good luck to you.

---
Tags: sms, mms
---


# Question
Title: How to use setprop via adb shell in recovery?
I messed up flashing a beta Android Q build on my phone.

After that, I can't flash my stable ROM without error 7 in TWRP - device mismatch. Removing the assert works, but not a permanent solution.

So, I digged through google and my own phone for hours and found out why. My device is identified as `raphael` in recovery, but it is identified as `raphaelin` in `fastboot` and while the phone is booted.

In recovery:

```
# getprop ro.product.device
# raphael

```

In booted mode (i.e. while the phone is booted):

```
# getprop ro.product.device
# raphaelin

```

In fastboot:

```
> fastboot getvar product
product: raphaelin

```

I checked my `build.prop` and the value in that file is `raphaelin` too. I tried `setprop` and it showed that it can't set that property.

So, please advise me on how to set the value using `setprop` in recovery mode. Or, if you know, please let me know from where the recovery is pulling data for `getprop` and if I can change that file.

# Answer
Firstly the main Android OS (what you call "boot mode") and recovery are two independent operating systems. When one is running, other is not. Running processes are different, environment is different, loaded properties are different and so on.

Recovery has its own `default.prop` file in ramdisk from which it reads properties. In order to permanently change the value of `ro.product.device` you'll have to unpack `recovery.img` (or `boot.img` on A/B devices), modify the file, repack and re-flash.

Secondly you can't set read-only (`ro.*`) properties once they are already set. Magisk's `resetprop` tool however can do this, going a little out of the way.

Thirdly `ro.product.device` is usually set in `/system/build.prop`. So you can edit this file and reboot device to see changes. There are also some other files from which properties are set on boot.
Make sure not to break `dm-verity` by modifying `/system` if enabled.

Since the (`/system` and other) partitions are accessible from recovery mode too, you can mount filesystem read/write in recovery and edit the file.

Fourthly the value you are getting in `fastboot` is independent of both main OS and recovery. That's hard-coded in bootloader. You'll get that value even if there is no recovery and no Android OS on device.
> 3 votes

---
Tags: adb, recovery-mode, fastboot, file-properties, device-name
---


# Question
Title: How to edit root files in /sys (Permission Denied)?
I have been trying to change root files in my phone through an app I am developing. The phone I have is a Moto G6, fully rooted. I'm using terminal emulators to run commands on my phone. I've tried "Terminal Emulator for Android" and "Shell Terminal Emulator" apps to try to make my files modifiable.

The commands I've tried to run are as follows:

```
su
mount -o rw,remount /system

```

In Terminal Emulator for Android this appears to work because it offers no error message but in Shell Terminal Emulator I'm hit with the following:

```
"...whatever.../system not user mountable in fstab"

```

So I went to check if it worked anyway and tried to modify a file in the root browser. The file:

```
/sys/devices/virtual/android_usb/android0/power/control

```

The file currently has the permissions set as "rw-r--r--" and filled with the text "auto" and after trying to save the file with the contents "0" instead I'm provided with this big ugly error message:

```
Error when saving file
=====Description=====
java.io.FileNotFoundException: "...file name..." and then (permission denied)

```

What I want to know is why I don't have permission to edit these files, afterall my phone is fully rooted and I have granted root access to the text editor.

Any solution or step in the right direction is greatly appreciated.

# Answer
> 1 votes
> in Shell Terminal Emulator app I'm hit with the following:
> `"...whatever.../system not user mountable in fstab"`

`toybox mount` returns that error when UID isn't 0 i.e. you aren't root.

> tried to modify a file in the root browser. The file:
> `/sys/devices/virtual/android_usb/android0/power/control`

`/system` and `/sys` are two different filesystems. Mounting one R/W won't allow you R/W access to the other. `/system` is the mount point of a partition which contains Android OS. It can't be mounted R/W without getting root access and without disabling dm-verity. `sysfs` is Linux kernel's pseudo filesystem which provides information related to hardware stuff and exposes some interfaces to userspace for kernel configuration and tweaking.

`sysfs` is mounted R/W by default but not every file in this filesystem can be modified. Only some specific values can be written to specific files. The file you are trying to write is related to power management of USB Gadget driver of kernel which is to let the device be in some kind of slave role (device mode), not in USB host role. Possible values for `control` file are `auto` and `on` as per documentation.

> after trying to save the file with the contents "0" instead I'm provided with this big ugly error message

I'm not sure about that Java related error, you can get better help at stackoverflow. However you can get a root shell and do:

```
~# echo -n on >/sys/devices/virtual/android_usb/android0/power/control

```

This must work, I've tried that in GUI text editor too. Probably the value `0` you are trying to write isn't a valid value for kernel, except if you are changing something at driver level.

If the purpose is only to edit files for testing which can't be accessed / modified without root, create / edit / delete a file in `/data/local`. `/data` doesn't need remounting.

---
Tags: root-access, mount, kernel, file-permissions, text-editor
---


# Question
Title: SELinux always set to permissive, how to set enforcing permanently?
I flash a custom ROM to my HTC B2UL. The ROM, by default, has the SELinux policy set to Permissive instead of Enforcing.

I can use `adb shell setenforce 1` to make SElinux enforcing. But after reboot, SElinux status still return to Permissive.

**Is there any way to make SElinux always be Enforcing?**

# Answer
> 1 votes
See this answer and this issue for details on how SELinux is enforced on Android. In short it depends on cmdline parameters of `kernel` and build configuration of `init`.

Check on your device:

```
~# cat /proc/cmdline

```

It must contain `androidboot.selinux=permissive`. You need to remove this parameter from kernel cmdline permanently in order to enforce SELinux on boot. This can be done by unpacking `boot.img`, modifying, repacking and re-flashing. Use AIK or magiskboot. Or you can also try Kernel Selinux Patcher.

But make sure you have a working `sepolicy` on your device or you may get into bootloop. Custom ROMs are usually `userdebug` builds with incomplete policy.

---
Tags: security, boot, kernel, selinux
---


# Question
Title: Apps don't work with IPv6 enabled in router
So I've been having this issue for a while now where apps work fine over mobile data won't work when mobile is connected to otherwise perfectly working WiFi. Some such apps are-

* Discord (keeps on connecting and asks to check server)
* Spotify (keeps on loading)
* twitter (continuously loads)
* google keyboard gif search tool while using WhatsApp (No gif preview and unable to send them.)

I'd like to mention that the same apps work great on other devices over the same wifi. I made a thread about it last week -

Here's my post on XDA which temporarily solved this issue

The temporary solution that doesn't work anymore was clearing phones cache and putting it on airplane mode. Now I found a way with which I was able to replicate this 'bug'. Turning IPv6 off in my wifi settings. It worked, for now at least.

Using this guide's 11th given solution fixed my problem for now.

~So do I keep the IPv6 off without any consequences or is there a workaround cause from what I know IPv6 is important and it should be on. Is there a better, more concrete solution?

Device-Xiaomi's Redmi Note 3-Kenzo Root- No OEM- Unlocked

# Answer
Solution- Keep IPv6 turned off. Reason- ISP not providing IPv6 connection so while it's on in the router settings it somehow stops my access to certain apps only on my redmi note 3. Yeah IDK but it's good enough for me.
> 1 votes

---
Tags: applications, wi-fi, 6.0-marshmallow, networking, connection-issues
---


# Question
Title: Data recovery from encrypted phone based on glitches in the encryption?
To make a long story short I needed to root my phone and didn't notice the warning that unlocking the bootloader erased all contents of the memory.

I contacted a data recovery company and told them that the memory was encrypted and the phone used Android 6. In response I was told that there was a chance, albeit small, that they could recover some data. However, they were unsuccessful and in their report they blamed the encryption.

This made me pretty upset since the encryption was the first thing I mentioned in my contact with them. When I called and complained about this I got the very "interesting" answer: sometimes there is a glitch when enabling encryption leaving some of the storage unencrypted and we might be able to recover that.

Is this really true??? It sounds completely absurd that something like that could happen frequent enough so they could base their business model on it. In my ears it sounds like a bad excuse for charging me money for something that could "never" work.

# Answer
> 5 votes
I'm not an expert in the filed, it's just an analyses of the case according to my limited knowledge.

## ANDROID'S ENCRYPTION

Android supports two modes of encryption; FDE and FBE. FDE encrypts whole block device i.e. `userdata` partition using Linux kernel's `dm-crypt` framework, while FBE is based on `fscrypt` available since Android 7. From data recovery's aspect, approach is similar for both. Both offer strong encryption and what's been attacked by hackers is not the encryption itself, but Android's mechanism to create and store keys required for decryption.

> sometimes there is a glitch when enabling encryption leaving some of the storage unencrypted

You are right, it's interesting. FDE, AFAIK, encrypts the whole block device, just excluding the crypto footer at the end of partition which includes keys for decryption. Initially all sectors might not be encrypted as is the case with inplace encryption:

> `vold` checks to see if a sector is in use before reading and writing it, which makes encryption much faster on a new device that has little to no data.

But the skipped sectors are the ones which contain no data in filesystem. However as data is written to the sectors (or if the encryption was initialized with random data which doesn't seem to be the case with Android), they get encrypted and very soon whole block device becomes one giant high entropy block of data with no visible structure. It's impossible to distinguish encrypted data from random noise. `TRIM`, however, if supported by hardware, kernel, filesystem and the OS, may reveal the empty space in filesystem. But reading from that space only returns zeros.

## POSSIBLE METHODS OF DATA RECOVERY

Data recovery works in two ways generally:

* Read just the file contents by carving method / signature search
* Or read the complete files along with metadata (file names, timestamps, permissions) from filesystem

Possible methods are:

* Reading flash memory through firmware controller (Flash Translation Layer) of eMMC using commonly available APIs e.g. of Liux kernel. It's the FTL which stores LBAs to PBAs mapping, and information related to partitions, bad sectors, deleted data etc. This can be done by exposing partitions to a PC in some bootloader mode if available, or by using some lower level communication protocol e.g. JTAG or by chip-off method.
* Or accessing silicon cells directly which is possible only with sophisticated equipment found in forensic labs, and not without manufacturer’s data sheet. In this case only carving method is possible. Data read from cells is random bytes from un-partitioned space and all 50+ partitions, including the ones which don't have filesystems at all. So the probability of recovering useful data is almost negligible, particularly of reasonably larger files. If the data saved is encrypted (using FDE, FBE or any other method), chances with this method are nil for sure.

The choice of method depends on multiple factors like if the purpose is:

* To recover deleted data
* To recover data off a dead phone
* To break the encryption mechanism, e.g. in case of forensics, phone theft etc.

Data recovery can be done either:

* On the device e.g. in recovery mode if the device is unlocked and some custom recovery environment is available.
* Or off the device. It's the only option in most cases as the devices have bootloaders locked. But if your device was shipped with Android 5+, the chances are it must have hardware-backed encryption enabled which makes it almost impossible to recover - even undeleted - data off-the-device, except trying some hacks, because you can't brute force RSA keys.

## BOOTLOADER UNLOCKING

Keeping all above facts and you situation in view, only an on-the-device or semi-offline approach can be tried to recover data. But then comes the bootloader unlocking part.

Google demands from SoC/OEM vendors to completely erase data on bootloader unlocking:

> As a best practice, unlockable Android devices must securely erase all user data prior to being unlocked.
> ...
> Failure to implement these protections is considered a moderate level security vulnerability.

Quoted from here:

> When the `fastboot flashing unlock` command is sent...
> ...
> a factory data reset should be done to prevent unauthorized data access

Depending on the device a `BLKSECDISCARD`, `BLKDISCARD` or a complete overwrite with zeros is recommended. It's then followed by filesystem creation which may again issue `TRIM`. Same happens during a factory reset i.e. `userdata` and `cache` partitions are completely erased (though conformance in past has been bad). See this answer for more details.

`BLKDISCARD` and `FITRIM` are Linux kernel's IOCTLs which issue special commands to underlying eMMC devices depending on their capabilities. `TRIM` is issued by the filesystem to the FTL, requesting the actual physical erasure of data blocks (LBAs) which have been deleted from the filesystem. `DISCARD` is kind of `TRIM` for whole block device. `TRIM` obviously doesn't touch undeleted files, filesystem structure and drive's partition table. `BLKDISCARD` saves nothing at all on block device, including the crypto footer. Both of these commands belong to **Logical Sanitization** level of secure data deletion. So is `ERASE` command issued by `BLKSECDISCARD` IOCTL, while others issued by the same - including `SECURE TRIM`, `SECURE ERASE` and `SANITIZE` \- are considered of **Digital Sanitization** level i.e. they cause even more secure deletion. Even a complete overwrite with zeros will render data irrecoverable - at least without melting eMMC - because of Overprovisioning and Garbage Collection.

## POSSIBILITY OF DATA RECOVERY

So in short these commands (if supported by underlying hardware and if required drivers provided by vendors) don't leave much space for deleted data recovery. Encryption adds to the trouble. As explained above, encryption type with FDE is, a kind of, all or nothing. If even a small part of crypto footer is erased during bootloader unlocking, forget about decryption. Quoted from a lead engineer for Android security <sup>(ref)</sup>:

> If you plan to resell or discard your device and you haven’t already, encrypt it and then perform a factory reset

And so does the removal of LUKS header on Linux. Quoted from warnings section on official page:

> By far the most questions on the cryptsetup mailing list are from people that managed to damage the start of their LUKS partitions, i.e. the LUKS header. In most cases, there is nothing that can be done to help these poor souls recover their data.

So without the crypto footer which contains encrypted master key, RSA key (hardware-bound) and other information related to encryption, everything is random data. But even if we assume that crypto footer wasn't erased in your case and hardware-backed encryption wasn't a hurdle either, the problems aren't over. With `dm-crypt` FDE a master key is used to encrypt / decrypt sectors (512B each) individually when they are written / read respectively (every sector has it's own IV). After decrypting `userdata` partiton a new virtual block device is created at `/dev/block/dm-0` which contains a filesystem, mostly `ext4`.

In order to mount the filesystem, the sectors containing basic structure of filesystem must be intact e.g. superblock(s), directory entries, inode tables, inode/block bitmaps, journal etc. It's next to impossible that all of this wasn't overwritten when unlocking bootloader and creating new filesystem. So the old filesystem is gone and what you would be left with is carving method which has a very small success rate particularly because of file fragmentation of large files. Mostly what you get is small nameless thumbnails or text files, that too after so many assumptions.

**CONCLUSION**

Bootloader unlocked on an encrypted device, the probability of data recovery seems very near to zero.

**RELATED**

---
Tags: 6.0-marshmallow, data-recovery, encryption, disk-encryption
---


# Question
Title: Are there any Google devices that support file based capabilities in their default kernel?
If I systemless root (no modification done to `/system` partition) a Nexus device, would I be able to able to set capabilities on executables without changing the original kernel binary ?

I often want to manage files without restrictions from my terminal *(require`CAP_DAC_READ_SEARCH`)*. However, I also want to not use the superuser.
The required things are tools for setting caps along kernel support for using them *(it doesn't rely on other user space things)*.

The problem is, I don’t own such device. So I can’t tell if it would work on any of `Nexus 5X Nexus 6P Nexus 9 Pixel C`.

# Answer
> 1 votes
Though the question is old, it keeps on appearing on top of ***Unanswered (my tags)*** questions. So I think I should answer this :)

## AOSP'S SUPPORT FOR CAPABILITIES:

Question is specifically about Google devices, I have never used a Google device. However what I can say for sure is that Linux (process) capabilities must have been enabled on most of the devices (if not all) running as low as Android 1.6. Reference is found in `init` and `system_server`, both very primary components of AOSP. In Android 4.2, for instance, `installd` \- another core component - was made to run with dropped capabilities.

Filesystem capabilities were one of the major Security Enhancements in Android 4.3 which removed `set-uid`/`set-gid` from binaries like `run-as`, setting file capabilities on them. This caused revolutionary changes in Android's rooting journey.

Support for Ambient capabilities was added in Android 8 which discourages the use of file capabilities:

> File capabilities, in turn, present a security risk since any process executing a file with file capabilities will be able to gain those capabilities.

Many `init` services depend on them e.g. `storaged`, including my own `sshd` and `dnscrypt-proxy` services.

## KERNEL'S SUPPORT FOR CAPABILITIES:

Coming to the kernel part, building kernel without capabilities isn't optional:

> From kernel 2.5.27 to kernel 2.6.26, capabilities were an optional kernel component, and could be enabled/disabled via the **CONFIG\_SECURITY\_CAPABILITIES** kernel configuration option.

And:

> In kernels before Linux 2.6.33, file capabilities were an optional feature configurable via the **CONFIG\_SECURITY\_FILE\_CAPABILITIES** option. Since Linux 2.6.33, the configuration option has been removed and file capabilities are always part of the kernel.

The oldest common kernel version on Android repositories is 2.6.39 which includes support for file capabilities too.

Support for filesystem capabilities on kernel side must have been delayed from some OEMs but they had to switch, because otherwise functionalities would break. For instance `surfaceflinger` (Android's surface composer) won't work without file capabilities since Android 7.1.

Mainline Linux kernel 4.3 was patched in in Sep'15 for Ambient (process) capabilities, backported to Android kernel 3.18 and 4.1 in 2016. So they are necessarily a part of kernel.

## CONCLUSION:

On Linux distros, a very few programs make use of Linux capabilities. Though there is `pam_cap`, mostly (or all?) distros still use `set-uid` on `su`, `sudo`, `ping`, `mount`, `passwd` and so on. But on Android capabilities are deeply integrated in framework and core services. Removing them would require editing hundreds or may be thousands of lines in AOSP and kernel source. It makes no sense that an OEM (particularly Google, who developed AOSP and modified Linux kernel for Android) doesn't make use of this *free-of-cost* security feature when it's readily available in Android kernel. It's a pure OS related feature, doesn't demand any extra hardware support. So any phone from any manufacturer must have capabilities supported.

---

**QUESTIONS:**

> would I be able to able to set capabilities on executables without changing the original kernel binary?

Yes, you must be.

> The required things are tools for setting caps ...

I have been using `capsh`, `getcap`, `setcap`, `getpcaps` from `libcap` and `netcap`, `pscap` from `libcap-ng` without any problems. But I prefer Ambient capabilities, those are easy to configure and don't depend on any filesystem features like **Extended Attributes** as in case of file capabilities. You can also use `listxattr`, `getxattr`, `setxattr` and `removexattr` tools from `xattr_syscall_wrapper` to manipulate `security.capability` or any other XATTR directly.

From your comment:

> I just noticed the `/system/bin/ping` command isn’t `setuid` on my real Samsung device, suggesting `CAP_NET_RAW`

Android's ping neither has `set-uid` nor `CAP_NET_RAW`. It creates a special non-RAW socket `IPPROTO_ICMP` which - unlike `IPPROTO_RAW` \- doesn't require any privileges.

---

**FURTHER REFERENCES:**

In addition to 10+ references given above, here are a few other parts of AOSP code supporting and making use of Linux capabilities:

* **Core components:** Bionic `libc`, `init`, `trusty` (OS)
* **External components:** `libcap`, `libcap-ng`
* **Daemons / services:** `zygote` (forked apps and `system_server`), `hostapd`, `wpa_supplicant`, `dnsmasq`, `logd`, `netd` (`NetLink` manager, private DNS), `debuggerd` (test), `sdcard` daemon, `performanced`, `incidentd`, `mtpd`, `traced_probes` (perfetto), `racoon` (IPSec), `wificond`, a number of HAL daemons including `rild`.
* **Executables:** `reboot` (init), `dumpstate`, `tcpdump`, `strace`, `iputils` (`ping`, `traceroute` etc.)
* **Minijail:** A dedicated sandboxing tool and library which revolves around capabilities. `adbd` makes use of this library to drop privileges.
* **SELinux** uses `capability` class to grant / deny capabilities to domains.

It concludes that Android highly depends on Linux capabilities, it's not a ***little-used*** feature.

---

**RELATED:**

---
Tags: rooting, root-access, security, file-system, kernel
---


# Question
Title: How to build LineageOS for a device without official support?
I have a Mi 8 Lite (platina), for which there is no official LineageOS support. But LineageOS custom ROM for the device is available on XDA. On further research, I can see that vendor files, device tree and kernel source code is available for my device:

1. Kernel Source
2. Device Tree
3. Vendor Files

How do I build a LineageOS ROM for my device without official support?

# Answer
> 7 votes
Firstly you need to setup the build environment. You should be running Ubuntu 18.04. LineageOS build guide for a random device can be used as a reference. Reproducing the steps here:

Install the build packages:

```
sudo apt install bc bison build-essential ccache curl flex g++-multilib gcc-multilib git gnupg gperf imagemagick lib32ncurses5-dev lib32readline-dev lib32z1-dev liblz4-tool libncurses5-dev libsdl1.2-dev libssl-dev libwxgtk3.0-dev libxml2 libxml2-utils lzop pngcrush rsync schedtool squashfs-tools xsltproc zip zlib1g-dev adb fastboot

```

Create the directories:

```
mkdir -p ~/bin
mkdir -p ~/android/lineage

```

Install the repo command:

```
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo

```

Put the ~/bin directory in your path of execution by adding the following to your `~/.profile` if it's missing:

```
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

```

Then, run `source ~/.profile` to update your environment. After that, initialize the LineageOS source repository and start downloading:

```
cd ~/android/lineage
repo init -u https://github.com/LineageOS/android.git -b lineage-16.0
repo sync

```

Downloading LineageOS source will take some time. After that we will deviate from the official build guide. Create a local manifest file telling the repo tool where to pick up the kernel source, device tree and vendor files. The corresponding file for platina can be downloaded from here. If you are building for a different device, use this manifest file as a reference and edit it accordingly. Save the file as

```
.repo/local_manifests/platina.xml

```

Rerun repo tool to fetch them:

```
repo sync

```

Initialise your build environment:

```
source build/envsetup.sh

```

Enable caching to speed up the build:

```
export USE_CCACHE=1

```

You should add the above line to your `.bashrc` file. Then set the max cache size:

```
ccache -M 50G

```

Configure jack:

```
export ANDROID_JACK_VM_ARGS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4G"

```

Edit `device/xiaomi/platina/BoardConfig.mk` and set the parameter `TARGET_KERNEL_CONFIG` to `platina_user_defconfig`:

`TARGET_KERNEL_SOURCE` points to the kernel code that is to be used during the build. `TARGET_KERNEL_CONFIG` specifies which configuration is to be used. By looking in `arch/arm64/configs/` in the kernel source, I set the value to `platina_user_defconfig`

Finally start the build:

```
lunch 16
mka bacon -j8

```

This should lake a few hours to complete. I usually leave it running overnight. Here is where things get challenging. It’s possible that the build can fail due to errors, in which case you will have to fix it. Once the build has completed, you will find the zip file, ready to flash:

---
Tags: custom-roms, lineageos, builds
---


# Question
Title: How can I debug my application while USB tethering is enabled?
I want to debug my application on the phone and at the same time I want to enable USB tethering so that I can access Internet on my PC.

Is there any way so that I can connect my phone then enable USB Tethering and USB Debugging at the same time? Are there any applications exist?

# Answer
> 1 votes
If you have root, once USB tethering is enabled, go to your terminal on Android and run

```
su (or su root)
adbd start (or sudo adbd start without previous su line)

```

That will start the daemon while your USB is in Ethernet mode and allow you to connect from your PC.

---
Tags: usb-debugging, usb-tethering
---


title: samsung galaxy tab 3 not charging

text:
# Question
Title: samsung galaxy tab 3 not charging
the 10.1 inch galaxy tab3 wifi version, is unable to charge when u plug the charger in, the battery logo shows a bit, but it does not show the charging animation, neither it is charging

**where the problem might be located**

my skill is decent regarding soldering and so on, and I am willing to repair it myself

P.S. the tab does not boot due to dry and un rechargeable battery

# Answer
My suggestion before you take the step of using your soldering skills, try using another charger, leave your tab connected with it for 3-4 hours, as sometime its just the charger that takes the toll of current fluctuation if that doesn't work, than Verify that your device port is not damaged. Carefully inspect your device's charging port and remove any debris. If all's well so far than verify that your Samsung Tab is running the most recent software. Just tap the System Updates dashboard -\> tap Device Software. If an update is available, follow the prompts to install. Lastly is problem still persist it's time to perform a soft reset. A soft reset restarts your device and does not erase any of your content or data.Just press and hold both the Power and Volume up keys until the device turns off.

I hope this help, let me know the results.
> 0 votes

---
Tags: samsung-galaxy-tab-3-10.1
---


# Question
Title: Why is there no option to choose size in TWRP's resize partition feature?
I'm trying to reflash an old Galaxy Note N5100 but I realized that the system partition is too big (~1.5GB). The current ROM uses only about 40% of the partition so I want to shrink it to make space for cache and data. I heard that newer TWRP has `resize2fs` so I installed the latest (3.0.2-0) TWRP and try.

But after selected ***wipe \> repair or change file system \> resize file system*** there's no option to choose the new size! I tried swiping to resize it and the system is now even larger (~2.5GB). I checked with `fdisk` and it's really bigger now.

```
~ # fdisk -l /dev/block/mmcblk0
Found valid GPT with protective MBR; using GPT

Disk /dev/block/mmcblk0: 30777344 sectors, 2740M
Logical sector size: 512
Disk identifier (GUID): 52444e41-494f-2044-4d4d-43204449534b
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 30777310

Number  Start (sector)    End (sector)  Size       Code  Name
   1            8192           16383       4096K   0700  BOTA0
   2           16384           24575       4096K   0700  BOTA1
   3           24576           65535       20.0M   0700  EFS
   4           65536           81919       8192K   0700  PARAM
   5           81920           98303       8192K   0700  BOOT
   6           98304          114687       8192K   0700  RECOVERY
   7          114688          180223       32.0M   0700  RADIO
   8          180224         3325951       1536M   0700  CACHE
   9         3325952         8568831       2560M   0700  SYSTEM
  10         8568832         9715711        560M   0700  HIDDEN
  11         9715712         9732095       8192K   0700  OTA
  12         9732096        30769151       10.0G   0700  USERDATA

```

Why is that? Where does the new size come from? Is there anyway to enter the size in TWRP?

# Answer
> 10 votes
First to clarify, ***Resize Partition*** is different than ***Resize File System***, TWRP provides latter option. It resizes the `ext2/3/4` filesystem to the size of partition it's created on. Filesystem size can be checked with `df` command when mounted, and partition size with `blockdev`.

Just like HDDs or SSDs on PC, Android's eMMC storage is divided into partitions (can be 50+). Some of them have filesystem e.g. the larger ones `userdata` and `system`. In simple cases a filesystem occupies a complete physical partition, but it's not always the case, LVM makes it possible to have single filesystem on multiple partitions. Or the opposite what happened in your case as explained here:

Sometimes the zip file of:

> a custom ROM does not have the correct size for the system partition and if the ROM flashes a raw system image, that image will not take up the full block device. Running resize2fs can fix the size

Similarly:

> Sometimes flashing a factory image may flash userdata with an image with a file system that does not take up the full size of the block device

So TWRP can expand the filesystem to reclaim wasted space. That's what happened in your case to the `/system` partition. The actual size of partition was 2.5 GB, but flashed image was of 1.5 GB.

Coming to your query:

> I realized that the system partition is too big (~1.5GB). The current ROM uses only about 40% of the partition so I want to shrink it to make space for cache and data.

You want to resize partition, not filesystem. So `resize2fs` (which TWRP uses at back end) isn't the right choice. As your partition table suggests, you need to delete and recreate partitions 9 to 12. **IT'S DANGEROUS AND NOT RECOMMENDED**, you may permanently brick your device. All data on these partitions will be lost, so do backup. Also, `fdisk` isn't proper tool for GPT, it's for MBR partition scheme. Use `parted` or `gdisk` instead, but with great care.

**RELATED:**

---
Tags: rom-flashing, twrp, file-system, storage, partitions
---


# Question
Title: Pixel 3 stuck in Fastboot mode with "no valid slot to boot" when trying to install factory image
I was trying to install the factory software image from https://developers.google.com/android/images#blueline on my Pixel 3. I downloaded the image as well as the platform-tools with adb and fastboot.

After plugging in my phone, I ran "adb reboot bootloader" which put me into Fastboot mode. After this I tried to run the flash-all.bat file, but it was just stuck on the "waiting for devices" prompt. I'm not sure what I did at this point, but I must have really messed up the phone, because now I can't even boot from Fastboot, where clicking "Start" just puts me back in fastboot with the reason "no valid slot to boot." Any idea how I can get my phone working again?

I tried putting my phone in recovery mode, but I just got "error booting boot.img"

# Answer
In this state I was just able to run "flash-all.bat" - which let me load. Not sure why it wasn't letting before.
> 1 votes

---
Tags: adb, factory-reset, fastboot, factory-image
---


# Question
Title: Folder "mtklog" on SDcard keeps getting full
I have a Jiayu G3S android phone. Its system is a rooted Android version 4.2.1.

I've noticed that a folder called "mtklog" on my SDCARD was getting full with files (log files, I guess) until there was no empty space left.

So I learned on the internet that there is a "MtkLogger" app. This app is accessible via the "Engineer mode" (or some MobileUncleTools app of sorts). The solution found on internet was to check the "/etc/mtklog-config.prop" file on my cellphone. I looked into it, and indeed it exists on my phone. It contains some tags like `mobile.log.enabled=false`.

The solution guided to set all to false. Much to my surprise, all of them were already set to false. All the logs were disabled already. (Another kind of line referred to was `max log size=300`, and I've already changed it to 0 and 1 with no effect)

After lots of tests and research, I opened the MTKLogger app, which I had never done before. I had never seen the app screen. It allows to log events of 3 types (network, disk and cpu).

Ever since, this app opens on startup with all logging options set to on. It even started appearing on running process accused by the terminal.

Now, when that happens, I open the app via the notification, and use the options to STOP all logs and Delete all logs.

But when that happens (That is, the MTKLOGGER is logging and showing me it is logging), the log files go to "SDCARD/mtklog/mdlog" or "SDCARD/mtklog/netlog". These folders refers to the different log types I mentioned earlier.

What is strange is that **none** of these is the folder that **originally bothered me**. (i.e. "sdcard/mtklog/aee\_exp") And this folder keeps getting filled even with mtklogger not logging anything. So now I have 2 problems: 1) MtkLogger keeps opening by himself, showing on the notification bar, with all logs enabled. 2) I still haven't found out the cause for the aeeexp folder to get filled. My guess is that another app is using it.

I have a Terminal Emulator app (with busybox commands installed).

Here's what I've already tried:

* I've tried to create a file with the same name of the folder, so whatever is trying to write there, won't be able to. With that, all the logs went directly to internal storage. (Didn't work well and I gave up on this approach) When I cleaned the internal storage, I cleared some \*.zip files with random numbers as name.
* I've tried to delete "/system/app/mtklogger.apk" and all the mtklog files that appeared as a find result on terminal. I've tried to check running processes on terminal but no logging one appeared to me. (The only one is Mtklogger, with started to run only after I opened it for the first time) Is there a way to check what app/process is writing on that folder? How can I really unninstall the mtlogger app once and for all? What files should I delete? It has no option on How can I investigate further on this?

I'm sorry for the long text and story-like question, I just couldn't sort clearly what informations would be useful or not.

# Answer
After a while, and no valid answers, I have come up with the following workaround. The required steps are:

* Have "Android Terminal Emulator" app installed, with busybox commands also installed (as described in question)
* Make a list and check the folders that bother you. The list I've provided contains only files that I'm sure my phone won't need.
* Create a bash script (.sh extension) with remove commands on that specific folders. Here is mine:

```
#!system/bin/sh
rm -rf /sdcard/mtklog
rm -f /data/log_other_mode/*
rm -f /data/core/*.zip
rm -rf /sdcard/DCIM/.thumbnails

```

```
mount -o rw,remount,rw /system

```

and to revert it back to read-only:

```
mount -o ro,remount,ro /system

```

Note: You probably will need super-user (sudo) privileges in order to do these commands.

* The terminal emulator contains an "Widget" option which allows you to place a shortcut to a command in your phone home page. I've used that option with the following command:

`su -c /system/etc/scriptName.sh; exit`

* Every once in a while I click on this icon to make a clean. This asks permission for the user, since it contains a su command. When clicking "allow" the terminal finishes and closes automatically.

It's not an optimal solution since it needs the phone to be rooted, and you have to manually click the widget button. However, it was the best one for me, since making it run automatically would require it to ask for permission. I didn't want also to give the terminal emulator permanent access to su-privileges. My guess is that a more complex script can be made (e.g. one that monitors the size of the folders with the Disk-Usage command), but I'm happy as it is.
> 1 votes

---
Tags: applications
---


title: Reload IMAP folder list in K-9 mail

text:
# Question
Title: Reload IMAP folder list in K-9 mail
Recently I changed the folder structure of my E-Mail account, actually merging a lot of them. K-9 didn't realize the changes. It neither added new new folders nor removed those, no longer existing.

Pressing the refresh button in folders view seems only to refresh the mails, rather that the folders.

How can I achieve a re-read of the account's folder list?

# Answer
> 0 votes
Go to the list of folders by clicking on the folder icon next to the IMAP account listed under the Accounts view. That's your list of folder's you'd like to update. Tap the three dots in the lower right. There should be an item called "refresh folder list."

---
Tags: k9-mail
---


# Question
Title: Google Play Books - Navigate back to reading passage text
Often in ebooks there are links embedded in paragraphs that reference some image or figure in the previous chapters or sections. Once I've clicked on it (and viewed that image), how do I get back to the paragraph I was reading?

Hitting android's back button always exits the app.

# Answer
> 3 votes
To return to the last page you visited, you can just tap on the screen to notice a bar in the bottom. If you look closer you can see a blue triangle that marks the last visited page. Click on it and you'll return to that page!

Click image for larger version

Hope this helps.

# Answer
> 2 votes
To return to the previous location just tap the centre of the screen to bring up page navigation and then click the back button.

Note: looks like the previous functionality of a blue triangle has been removed.

---
Tags: navigation, ebooks, google-play-books, reading
---