text:
AAC HE-AACv2 file replay on smartphone Cubot R15 Pro with Android 9.0 fails
AAC replay on smartphone Cubot R15 Pro with Android 9.0 fails
When I tried to replay recorded music from www.afc.fm, my smartphone fails to replay it.
MediaInfo reports the following info about the audio file in question (not uploaded, would be probably illegal):
Audio
Format                                   : AAC
Format/Info                              : Advanced Audio Codec
Format-Version                           : Version 2
Format-Profil                            : HE-AACv2 / HE-AAC / LC
Bitraten-Modus                           : variabel
Kanäle                                   : 2 Kanäle / 1 Kanal / 1 Kanal
Kanal-Positionen                         : Front: L R / Front: C / Front: C
Samplingrate                             : 44,1 KHz / 44,1 KHz / 22,05 KHz
Stream-Größe                             : 1,52 MiB (100%)

The phone is a Cubot R15 Pro with Android 9.0.
According to
https://developer.android.com/guide/topics/media/media-formats
Android should play HE-AACv2 starting with version 3.0 already.
What did I do wrong or what is necessary to make the smartphone play those recordings?
Coudl somebody with sufficient reputation tag this question with "aac" and "he-aac v2"?

Have you read the sentence Codecs that are not guaranteed to be available on all Android platform versions are noted in parentheses? for HE-AACv2 all entries are shown in parentheses hence they are optional if I interpret the codec list correctly. More relevant may be the list of encodings that have to be supported: https://source.android.com/compatibility/android-cdd#5_multimedia_compatibility Also make sure you are using the correct container format that is marked as supported.

Robert, thank you. This is a very interesting source I was not aware of. If I understand it correctly then HE AACv2 is only supported in a MP4-Container. My files ends with ".aac" though.

did you try with some app, for example MX Player or VLC

After learning now that some apps do not rely on operating system support and use their own code or third party libraries I found some apps.


text:
How do I get rid of the search suggestions in Chrome?
I want to remove these suggestions on chrome for android, but I cannot find how to do it anywhere. Can someone help me with this?
Once I type a letter the normal suggestions appear. I just don't want to see all these recent searches I made.

They seem to be from your history. I don't see a toggle to turn off history suggestions in Chrome.

Sadly, there doesn't seem to be any way to do this without turning off History or using incognito mode.

Those are suggestions that you can turn off.

Go to the Chrome menu on the browser toolbar.
Click Settings.
Click Show advanced settings (on the bottom)
In the Privacy section, deselect the "Use a prediction service to help complete searches and URLs typed in the address bar" checkbox.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Can an app manipulate the cellular radio chip?
I have a few ideas for a couple local cell to cell apps, but want to use the radio signals to extend the range (the extra work is fine with me).
Just curious if it is possible to control the transmission and receiving of bits. If so, any good docs on it?

Android does not have any direct access to the radio chip. It only uses the Radio Interface Layer (RIL) which sends all commands to the radio subsystem which can be seen as separate OS inside your phone loaded as blob. Manipulation of the radio subsystem is possible with root permissions, just be aware that any changes usually have legal consequences, hence you should only do so while you are sitting a faraday cage preventing any signal to leave the cage.

Interesting, thank you @Robert! Do you by chance know of any diagrams or anything that illustrates that dual OS architecture a little better . . . Purely for educational purposes?

Nothing concrete my approach would be following image search https://www.google.com/search?q=android+ril&tbm=isch

I appreciate it, thanks for the direction @Robert!

Modem/BP runs its own RTOS which is completely isolated from the main OS: Linux kernel and Android, and even bootloaders. Android talks to it roughly like talking to a remote host on network (consider NFS). The protocols used for communication are proprietary in 99% cases with a very small implementation (e.g. to access a shared memory area) in kernel (which has to be open source by law; GPL). Rest of the communication is handled by a vendor provided userspace daemon named RIL, as Robert said. You can reverse engineer it to get protocol details. Usually it's some extension to old AT commands.

@ThatCampbellKid Also be aware of the Android Framework documentation on the Radio Interface Layer

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
How to write IMEI programmatically on Pixel XL
I have an unlocked Pixel XL device purchased recently.
I'd want to test changing IMEI of the device.
My final purpose is to randomize IMEI dynamically from a user space application.
Before this, I would like to check if IMEI writing basically works or not.
I've explored many communities and blogs for some days, but haven't found out working solution yet, even through fastboot.
For example,
fastboot oem writeimei 1234*****

is not working, but it keeps saying as if its unknown command !
Is there a way to change IMEI on Pixel XL unlocked?
Best

spoofing IMEI is illegal in some countries therefore most likely protected against changes. Nevertheless you should ask in a different wording (aka how to restore lost IMEI) because development is off-topic here

Thank you for advice. So do you have any workaround?

no. maybe interesting for you https://android.stackexchange.com/q/225881

Hi, @alecxs. Can I assume you are recommending AT commands? And if so, are you sure it will be definitely possible? Any examples running AT commands from user space apps would be much appreciated!

sorry if i knew it i would tell. for Mediatek there is NVRAM but HTC is qualcomm device. search on youtube maybe you find something you can start with

https://android.stackexchange.com/q/134911


text:
How do I get a USB stick with an adapter to work with an Android phone (rather than a tablet)?
I have a USB stick that lights up when it is plugged in.  I have attached it to laptops and tablets (with adapters), and it lights up and works well.  When I attach it to cell phones (through the same adapter that I do with tablets), it does not light up.  Is there a setting to enable the Android 7.x phone to give power to the attached devices (the way Android tablets do)?
Update: My phone does not support OTG.

your android device must support USB-OTG

regarding your other question https://android.stackexchange.com/q/213286

If your hardware or kernel doesn't support OTG, there's no way to use your phone in USB hosts mode with any USB device. Just to be sure: Is there a definite way to know if my phone supports USB-OTG or not?

How to set the default USB behavior in Android 10
When you plug something into your Android device, it will behave in accordance with how you have configured the action. With Android 10, you have five options:

File transfer/Android Auto: Transfer files to and from PC/Android or
open Android Auto.

USB tethering: Behave as an external network interface for the PC.

MIDI: Used when connecting your phone to a MIDI device (such as a
digital keyboard).

PTP: When connected, your device will appear to the PC as a digital
camera.

No data transfer: No action taken.

Steps to change the default USB dehaviour in Android 10:
First, you are going to want to enable Developer options

Open Settings. Tap About Phone.
Scroll down to the bottom.
Tap Build Number (seven times) until you are informed that
Developer Options have been enabled.

Now that you have Developer Options enabled, you can set the default USB behaviour.

Navigate to the developer options: (System > advanced > developer options, may differ from device to device)
Within Developer options, navigate to (in my case) Networking > Default USB configuration

your answer is not related to question

What you described is related to USB device mode settings. OP wants to use it in host mode i.e. attach a USB Mass Storage device to it.


text:
Grant permissions to a service launched with ADB?
I'm trying to get a simple accessibility service, like Google's Voice Access or Button Mapper to work on an LG Exalt LTE, running a stripped down version of Marshmellow.
The stock is missing many UI components, including system Accessibility Settings, which are normally used for turning accessibility services on or off.
I would like to know if it is possible to compensate for lack of UI with ADB.
I've tried the following:
Install the app (Take Button Mapper for example),
Its manifest declares a few permissions, that i've granted, say:
<uses-permission name="android.permission.WRITE_SECURE_SETTINGS" />
was granted
adb shell pm grant package.name.here android.permission.WRITE_SECURE_SETTINGS
I even gave it
android.permission.WRITE_SECURE_SETTINGS
even though its not declared in the permissions list in the top of the manifest.
I get this error:
Operation not allowed: java.lang.SecurityException: Package package.name.here has not requested permission android.permission.BIND_ACCESSIBILITY_SERVICE
However, It is declared in the manifest here though:
<service name="a.i" permission="android.permission.BIND_ACCESSIBILITY_SERVICE" stopWithTask="true">
  <meta-data name="android.accessibilityservice" resource="res/xml/accessibility.xml" />
  <intent-filter>
    <action name="android.accessibilityservice.AccessibilityService" />
  </intent-filter>
</service>

and thats where the problem is.
this is the service itself, and it requires a non-package-wide permission, BIND_ACCESSIBILITY_SERVICE.
if I start it with ADB like this
adb shell am startservice -n package.name.here/a.i
I get and error
Error: Requires permission android.permission.BIND_ACCESSIBILITY_SERVICE
even though I already granted the permission to the package.
I've even tried adb shell settings put secure enabled_accessibility_services package.name.here/.a.i, but still get the same error.
Bottom line:
How do I start a service and grant permissions to that service with ADB? To be clear. I already know that I can use adb shell pm grant to grant a permission to the whole package, but in this case it is a permission not required by the whole package it is declared in a specific component and I am at loss as to how to launch the component with the permissions it requires through ADB.

obviously, i used the real package name in place of package.name.here... lol

BIND_ACCESSIBILITY_SERVICE is a permission with signature protection level which means it cannot be granted using pm like permissions with dangerous protection level. But it can be granted to packages asking for it using: appops set <pkg> BIND_ACCESSIBILITY_SERVICE allow. If only a component (service) is asking for it, what you mentioned should work: settings put secure enabled_accessibility_services <pkg1>/<service 1>:<pkg2>/<service2>:.... That's what happens when you allow apps from GUI settings.

Try killing app process after granting permission. Also AFAIK service should be exported in Manifest to launch it from ADB or by other apps.

@IrfanLatif heres the cmd output:  $ adb shell am kill flar2.homebutton   $ adb shell appops set flar2.homebutton BIND_ACCESSIBILITY_SERVICE allow Error: Unknown operation string: BIND_ACCESSIBILITY_SERVICE $ adb shell settings put secure enabled_accessibility_services flar2.homebutton/a.i $ adb shell am startservice -n flar2.homebutton/a.i Starting service: Intent { cmp=flar2.homebutton/a.i } Error: Requires permission android.permission.BIND_ACCESSIBILITY_SERVICE

I believe I figured it out.
I'll use Voice Access as the example app.
adb shell am startservice com.android.cts.apps.accessibility.voiceaccess/com.google.android.apps.accessibility.voiceaccess.JustSpeakService

Next
adb shell settings put secure enabled_accessibility_services com.android.cts.apps.accessibility.voiceaccess/com.google.android.apps.accessibility.voiceaccess.JustSpeakService

Then
adb shell settings put secure accessibility_enabled 1

Then finally delete the the readout app, to avoid the accessibility features from being overwritten
adb shell pm uninstall -k --user 0 com.lge.voicecommand

I don't think there should be any errors after that, leave a comment if there are though.

If you want to enable another accessibility service, just rewrite step 2 to a list of all the services, with a colon between them. Like so adb shell settings put secure enabled_accessibility_services pkg1/serv1:pkg2/serv2


text:
How to disable SmartLock Hints?
The docs explain that an app can ask the API to ask the user to choose an email address to use:

I am always thrown off by that thing popping up after I started typing my email address (in some apps) and in others I still prefer typing it manually to choosing in that huge list (because google adds every address without asking once it is set up in gmail).
How can I make my device act as if I pressed "None of the above" whenever that dialog would pop up?
I am running LineageOS 17 (Android 10), rooted with Magisk.


text:
Exfat misbehaviour on SD card
I got a new 512Gb SD card for my Samsung Galaxy J7 Crown and started experiencing problems when attempting to load my music folder onto it.

Unmounting the card and inserting into a Win 10 computer, copies more than two directories deep would fail, so I broke the task up into transfer units that the computer could handle. ("Fail" in this case means "refuse to perform, without error message or indication of the source of the problem")
Up to a certain point, transferred files would appear and be accessible. However, when roughly 1/3 of the files were transferred, all files would be erased. The folders would remain, but they would all be empty. This was true regardless of whether the SD card was inserted in the Win10 machine or in the phone.

Inserting the card into the Win10 machine and running chkdisk indicated no problems.
Reformatting the card as exFAT using the Win10 machine led to the same problems described above.
Inserting the card into the Win10 machine and reformatting as NTFS solved both problems. However, Android will not recognize NTFS.
I am currently reformatting the card using the phone to see if that solves my problem. If not, my plan is to use my Linux box to format the card with FAT32 and live with the 4GB/file limit.
Obviously I'd prefer a different solution, either "exFAT that works", NTFS or ext4.
Has this problem with exFAT on high capacity cards been observed before? It's sure not a subtle matter of a slight performance difference: it clobbers all the files that it makes you jump through hoops to copy onto the device. I would appreciate any advice on how to make this card work: whether that's how to get Android to recognize a filesystem which does not exhibit these issues or how to fix the issue with exFAT.
Thanks

Cards of that size are still expensive and therefore are often forged (card clains to be of size 512GB but has internally only 4GB or so). Please before using such a card make sure it is genuine by testing it using h2testw or F3

@Robert 4GB is the maximum file size limit on fat32 partition

https://android.stackexchange.com/q/219474 https://forum.xda-developers.com/showthread.php?t=2549628 or LineageOS

@alecxs My comment was on the failed test on the PC using ExFAT. The 4GB I mentioned was just a random value as you never know how much flash is really in a forged USB stick.


text:
Limit data rate of specific app (to avoid HD stream, for instance)
My data plan is decent, but not huge (2GB per month). Say that I want to watch a livestream on some app: I have no control over the data rate this app is getting. Since the cellular connection is good, the stream will default to HD quality. I want to manually restrict the data rate that a particular app is getting, since I'm totally fine watching a low-quality livestream, so that I can save my data. There are no livestream settings, but I know for a fact that the livestream will switch to lower quality video in case of limited bandwidth, since I have watched it when connected to some slow wi-fi hotspot.
My question: Is there a (developer) setting, or some app, that allows me to manually set a maximum data rate/bandwith that a SPECIFIC app is getting?
Most other questions on the stack seems to talk only about the data rate of the whole device (Is there a ways to set data speed limit in android?) or are about stopping a specific app (using firewall) after it has consumed X amount of data (How to limit data usage of individual apps?), and these questions seem to be a bit outdated as well.
I'm running Android 9, LineageOS 16, on a OnePlus A5010.
Thanks, cheers!
PS: I am aware I could select a lower speed "Prefered Network Type", such as GSM or 3G instead of LTE, but that seems to be a bit of a hassle to change this setting every time, since I obviously would like to profit from my fast cellular network when it comes to smaller quantities of data (e.g. navigation or messaging)

An ap that acts as local VPN server like some ad-filter or firewall software does could also throttle the bandwidth. Technically this should not be a big problem, but I don't know any app that allows to do so.


text:
Lenovo Tab 4 10 stuck on boot after factory reset with TWRP
I wanted to root my Lenovo Tab 4 10 tablet, so I installed TWRP successfully but then my internal storage was showing up 0 Mb. So I use OTG (Pendrive) to flash SuperSU zip. Then it was stuck on mounting, so I switched my tab off. Then I even factory reset my tab via TWRP and recovery mode. But now it is stuck on the boot logo and doesn't boot up no matter how many times I reboot or factory reset it.
I even tried flashing the stock firmware. Still got no good results
I don't have access to USB debugging or TWRP now.

https://android.stackexchange.com/q/214902

I had did this once on my Lenovo tab 4 10 So I installed the firmware of my tablet from here “https://firmwarefile.com/lenovo-tab-4-10-tb-x304l”
After downloading the firmware extract the files from the zip file and search for “recovery.img” in that folder and flash that recovery(your bootloader should be unlocked ) and then after that there will be system recovery installed on your device now go to fastboot and then to recovery mode and then reboot your device and you will see the Lenovo logo for atleast 2 mins and then your device is unlocked and then you can lock or keep the bootloader unlocked (I didn't use my PC I used this app called “Bugjaeger”


text:
Starting shell script at boot in SELinux enforcing mode
I am building Android Pie (tag android-9.0.0_r46, branch android-msm-marlin-3.18-pie-qpr2) from source. I am testing on a Pixel XL (marlin). I want to have a custom shell script run automatically when booting is completed while still having the device in SELinux enforcing mode. I figured I'd add a service for that. My knowledge of SELinux is limited though. This is what I did so far:

Create dar_script.sh in my AOSP source:

#!/system/bin/sh

echo "TEST" > /dev/kmsg

Add a line in device/google/marlin/device-common.mk to have my script copied to initramfs and thereby  make it appear in the root filesystem:

PRODUCT_COPY_FILES += \
    dar_script.sh:system/xbin/dar_script.sh

Add a line to system/sepolicy/private/file_contexts to give the script the dar_exec SELinux label:

/system/xbin/dar_script.sh u:object_r:dar_exec:s0

Create system/sepolicy/private/dar.te:

typeattribute dar coredomain;

init_daemon_domain(dar)

Create system/sepolicy/public/dar.te:

type dar, coredomain, domain;
type dar_exec, exec_type, file_type;

# /system/xbin/dar_script.sh is a shell script,
# so it needs to execute /system/bin/sh
allow dar shell_exec:file rx_file_perms;

# Allow writing to /dev/kmsg
allow dar kmsg_device:chr_file { write };

Edit system/core/rootdir/init.rc, add:

# Make the service start after boot
on property:sys.boot_completed=1
    ...
    start dar

# Define my service
service dar /system/xbin/dar_script.sh
    class core
    user root
    group root
    oneshot
    seclabel u:object_r:dar_exec:s0

Edit system/sepolicy/public/init.te, add:

allow init dar_exec:process transition;

Finally (figured by build error messages this needs to be done, don't know why):

cp system/sepolicy/private/dar.te system/sepolicy/prebuilts/api/26.0/private/dar.te
cp system/sepolicy/private/dar.te system/sepolicy/prebuilts/api/27.0/private/dar.te
cp system/sepolicy/private/dar.te system/sepolicy/prebuilts/api/28.0/private/dar.te
cp system/sepolicy/public/dar.te system/sepolicy/prebuilts/api/26.0/public/dar.te
cp system/sepolicy/public/dar.te system/sepolicy/prebuilts/api/27.0/public/dar.te
cp system/sepolicy/public/dar.te system/sepolicy/prebuilts/api/28.0/public/dar.te
cp system/sepolicy/private/file_contexts system/sepolicy/prebuilts/api/26.0/private/file_contexts
cp system/sepolicy/private/file_contexts system/sepolicy/prebuilts/api/27.0/private/file_contexts
cp system/sepolicy/private/file_contexts system/sepolicy/prebuilts/api/28.0/private/file_contexts
cp system/sepolicy/public/init.te system/sepolicy/prebuilts/api/26.0/public/init.te

However, this is what I find in dmsg after building, flashing and booting:
[   31.729946] init: starting service 'dar'...
[   31.754942] type=1400 audit(11289830.540:6): avc: denied { transition } for pid=691 comm="init" path="/system/xbin/dar_script.sh" dev="dm-0" ino=2720 scontext=u:r:init:s0 tcontext=u:object_r:dar_exec:s0 tclass=process permissive=0
[   31.973168] init: Service 'dar' (pid 691) exited with status 127

I already tried using the audit2allow tool as suggested in the AOSP docs, it gave me the following output:
#============= init ==============
allow init dar_exec:process transition;
allow init proc:file setattr;

#============= untrusted_app ==============
allow untrusted_app vnd_qcril_audio_hwservice:hwservice_manager find;

Of which I think only the first statement is relevant to me, the others are caused by unrelated SELinux issues that are already there in the original source. You see that I added the first statement when you look at the steps I described above, it didn't help.
What's going on? What do I need to change? Thank you very much for any help!


text:
I forgot the email i used to register on my Samsung S6 edge+ mobile
I forgot the email i used to register on my Samsung S6 edge+ mobile, it does not allow to use the phone without entering the registered email, Is there any way to find the email account.

i don't think so. which account do you mean Find My Mobile / Find My Device ?

Do you additionally mean the SAMSUNG account? It is another way into a device, apart from the google account. They are sometimes linked.

Have you performed a factory reset before? If yes this is the Factory Reset protection (FRP).

Get the originall bill to prove your ownership , contact customer support with IMEI of your device and tell them your problem

and then? how can costumer support help?


text:
Android can't view local content after OS upgrade
After upgrading to Android 10, I am not able to use the Files app to view local files on my phone. If I run Files and view the Downloads folder, for example, it merely says "Can't load content at the moment".
I've been using the built-in Files app for many versions of Android. But after upgrading to Android 10 it stopped working. I am able to view the contents of some directories. And if I choose / navigate to folders in a different way, e.g.

Images -> Download
Or

Device -> Download

Then the file explorer will view some files. But simply selecting "Downloads" from the menu gives me this error.
I have gone into App Permission -> Storage, but the Files app does not appear there. Inside App Info -> Files it says "No Permissions requested". I have installed two other file browsing apps, and both of them can access all of my folders just fine.
Is there something I'm missing to be able to browse my own local files, on my own device, using the OS built-in file browser?

Thanks to Scoped Storage. That's expected.

I'm having the exact same issue! Folders with lots of files, such as Download or DCIM/Camera, simply do not load. Neither on Files nor on an external file browser. But accessing via Images or Downloads on the files app sidebar, or through the Gallery, does work flawlessly. Surprisingly, going through root and /data/media/0 on an external file manager does open every folder instantly!

As pointed out in comment, this is because of Scoped Storage introduced from Android 10.
Before Android 10, any app could read or write any files to external storage (the place where apps store their data), if they requested the READ_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE permissions. Starting from Android 10,apps can only access data created by them and not other app's data or common data like images, downloads etc.
This enhances your privacy and is a good thing. Apps can access only data created by them and if they need access to external storage they need to access it using Storage Access Framework (SAF) . The file manager you are using isn't seeking  permissions through SAF, so it can't read while other file explorers you installed can because they use SAF. Apps like Local Storage may help for using SAF when they don't employ this.

Aside, for those users who are rooted and would like to address the security concerns of apps reading data created by other apps, they can try Storage Isolation Magisk Module or XPrivacyLua
also provides a solution by blocking app read/write access to the SD card completely (using the Privacy.BlockGuardOS.open repo hook) or by limiting access to the app's private directories (/sdcard/Android/data/app-id and others, using the Fif.BlockGuardOS.open repo hook).

In Android 11, we have package visibility

Just came across this same problem on a Galaxy Tab S4.
Fixed it by clearing the data of the system 'Files' app (Settings > Apps > Show system apps > Files > Clear data).

Are you running Android 10 or above? Otherwise, the answer might not be helpful to OP.


text:
Change Gboard microphone input
[

So when I clicked the microphone button on my Gboard, Pixel 2, it used to come up as pictures 1&2.
Now, this changed today, when I click the microphone, the keyboard goes away, and screenshot #3 is what comes up.
I know that this is extremely similar to Is it possible to trigger Gboard's voice-typing without switching keyboards?.
But I added screenshots to illustrate, and frankly, this issue is irritating me way more than it should, I don't even know why. Probably because it changed poof with no warning, rhyme or reason.

Based on experimenting on my Nexus 5, it looks like you're switching the keyboard to "Google voice typing" instead, a different keyboard app than Gboard. Can you try accessing the system's setting for the virtual keyboard and check if "Goggle voice typing" is enabled?

So if I disable Google voice typing the regular little microphone is gone. And I want to keep my mini-mic.


text:
Does LineageOS allow us to install apps via Google Play?
Someone told me we can't install Google apps after installing LineageOS and it doesn't support Google Play.
What is the truth behind this? Can I access Google Play in LineageOS?

https://android.stackexchange.com/questions/180142/which-version-of-gapps-to-install-for-lineage/180145#180145

LineageOS is Open Source OS. Google apps like Play Store, Gmail, Maps etc are proprietary Google products and cannot be bundled with LineageOS due to licencing issues.
However, you can always download these Google Apps Packages (Gapps) to run with LineageOS. These come in different flavors, starting with minimal Google services to full fledged suite of Google Apps . For more details see LineageOS Wiki. Related Which version of Gapps to install for Lineage?
So, LineageOS by itself does not have Google Play  but by installing Gapps of your choice, you can have Google Play and other Google apps of your choice.

To add to this, you have the option of flashing a .zip file of Gapps in recovery mode (at any time). It's usually less than 200MB. I'd recommend the smallest "lite" flavour which gives you the Play Store and other basics.


text:
How does Battery Management System work (at the hardware-interface level) ? And how is idle self-discharging of batteries handled?
I came across the following when I was reading up about fully drained batteries in phones:

If the phone is OFF for a month, then it is probable that the battery has gone down to a point that the BMS has shut it down. The BMS won't allow you to charge the battery because, in its own assessment, the battery is dead. Best way to test this case is to have another same phone with a good battery (or just a new battery altogether), detach the cable from that and test on yours.

Referring to the above, do Android phones have their BMS as part of their bootloader or kernel? Or is it a part of the Power IC itself?
Are there any safety mechanisms related to booting up a device with fully drained batteries? If so, why?
(Came across something similar)

I've had difficulties with phones in the past after batteries have fully discharged - eg the Moto G5 had some battery protection "feature" that stopped it starting up if it thought the battery was fully discharged - it was a bit over sensitive so would sometimes assume the phone was fully discharged when it wasn't. Try leaving it on charge for 24 hours or so then holding down the power button for for at least 20 seconds with it still on charge.

Battery Management System is a very broad term that covers battery charging /discharging/monitoring / power IC /responding to critical events like shutting down on low battery level / User Interface actions (increasing CPU speed when user touches screen - touch boost) and many other things.

Your first quote is only instance of management system where the battery voltage has fallen to a very low level, and a protection circuit kicks in and prevents further charging. This protection mechanism is mandatory

To prevent the battery from over-discharging, a control circuit cuts off the current path at about 2.20V/cell.

Booting up from a fully drained battery, is not permitted, since it would only further drain the battery. Booting  consumes a lot of power and doing so on an already drained battery can lead to irreversible damage to the battery. And what's the point of booting up, if the device can't be used thereafter?

There are ways to overcome these problems but it is best left to  qualified technicians to handle it. There are many questions on this site dealing with such situations.
As you would guess from the first  paragraph, this being a complex system, it is dealt at a low level, meaning at a kernel level with proprietary hardware interfaces. Related Where are the battery capacity files located?

Thanks a lot :) I have some questions, which it would be great if you could answer them in your answer.  1. In context to this, do our stock phone chargers feature a wake-up feature or “boost” to reactivate and recharge batteries that have fallen asleep?  2. I remember having one of my old Nokia phones kept idle and separated from its battery from almost more than 3 years, and it worked seamlessly when it put it back and charged the phone. Why didn't self-discharge affect in that case?

Please feel free to edit the question title/OP if it's very broad; something related to how self-discharging is handled by devices?. BTW related to the 2nd question above, I found this on Wiki: Li-ion rechargeable batteries have a self-discharge rate typically stated by manufacturers to be 1.5–2% per month

For the first comment Gokul  1. No, they don't have, never read or heard about it. Besides, they would like you to buy a new battery or device? 2. When it is separated from the device, my guess is that the self discharge is lower, since it doesn't need to be monitored by system. I can't say why your Nokia worked after 3 years. A few weeks ago I was able to charge and use a Bose Bluetooth headset after it was lying unused for 7 years! That was a pleasant shock //Next comment, wiki you quoted is in line with what Battery University also

Says. Battery University adds more self discharge for to the protection circuit but then all these are broad guidelines and the specific characteristics can only be provided by battery manufacturers. Re:edit, it's OK, you only asked based on what you read, so I don't think it needs to be edited just because it turns out to be a broad idea, rather than a specific issue. Of course, you are welcome to edit!

I got in touch with Bose service, had a detailed discussion - Bose products have a mechanism of automatically cutting off battery connections to the CPU or controller, if the device isn't used for a long time. Effectively, it is like taking out the battery from device - hence the discharge rate is very low (you go to a shop and buy even a two year old device, it's battery will about 40%, ideal for long storage). That's how I could use it after 7 years though the overall life had become very low //

//probably Nokia does something similar??? I couldn't find anything on the net, though for Nokia that supports this

That's great, thanks for the info. But it seems to be generally agreed that even disconnected Li-Ion batteries have a self-discharge rate of around 2% per month. Meaning, if I take out my battery after charging it to 100% and keep it isolated for 4 years, the charge would fall down to 4% by 4 years. But I also read somewhere that storing the batteries at lower temperatures say 5 deg C or something would drop the self-discharge rate to below 1% per month, and recommended for long-term storage.

mechanism of automatically cutting off battery connections to the CPU or controller, if the device isn't used for a long time If this is true, I believe even smartphones should have a mechanism like this, given that a phone's Power IC is more sophisticated than a headphone's.

For prolonged storage 40%-see Table 3// smartphones should have a mechanism like this, yes, if they care about a customer using the phone for a long time. What's more profitable for them? Obviously customer changing phones fast, so why should they bother? Another example - fast charging is bad for battery (see answers on this site) but they keep improving the charging speed - so that in two years you change the phone. I have a Note 2 - which is 8 years old, still usable

Yes, the discharge rate which you quoted is generally said to be around that. Thanks for accepting


text:
Xiaomi source code
Does anyone know where I can find the source code of Xiaomi. I don't mean only the kernel code like this here, but the whole code for their OS just like I can get it from here for Android in general.

You won't find it
OEMs are forced to reveal kernel code because they use Linux kernel code suitably modified (see licenses)
. Rest is proprietary. They are not obliged to share and on the contrary, it is guarded so that competitors do not take advantage of their features


text:
fastboot flashing error: "Partition should be flashed in fastbootd"
I am new to Android development and trying to flash a custom ROM to my Pixel 3a. It was built through the Android Open Source Project. But I am facing the following error.
user@user-Predator-PH315-52:~/aosp$ fastboot flashall -w
--------------------------------------------
Bootloader Version...: b4s4-0.2-5736883
Baseband Version.....: g670-00030-191028-B-5972069
Serial Number........: 9A9AY1CEC7
--------------------------------------------
Checking product
OKAY [  0.060s]
target reported max download size of 268435456 bytes
Erase successful, but not automatically formatting.
File system type raw not supported.
Erase successful, but not automatically formatting.
File system type raw not supported.
Sending 'boot_b' (65536 KB)...
OKAY [  2.340s]
Writing 'boot_b'...
OKAY [  0.346s]
Sending 'dtbo_b' (8192 KB)...
OKAY [  0.384s]
Writing 'dtbo_b'...
OKAY [  0.095s]
Sending sparse 'system_b' 1/5 (262140 KB)...
OKAY [  9.245s]
Writing 'system_b' 1/5...
FAILED (remote: Partition should be flashed in fastbootd)
Finished. Total time: 14.348s

How to fix this error?
Phone: Pixel 3a
Build: 9.0.0(PD2A.190115.032, Mar 2019)

I had the exact same issue on my Pixel 3a XL. You need the most up-to-date version of ADB and fastboot. Grab it from Google to be sure you have the most recent, you only need the SDK Platform-Tools. Don't have to download the whole SDK Platform.

I think you need to go into fastbootd mode.
Hold power key + volume down, you will boot into recovery. Choose to enter fastboot, then run:
fastboot flashall -w


text:
How to completely block popups / dialogs from WhatsApp without deleting the app?
I have a Nexus 5 phone with Android 6.0.1 and I'm trying to use it for time-lapse videos ("Lapse it" app) which means it needs to be on for many hours undisturbed.
The problem is that WhatsApp creates a dialog regularly which interrupts the time lapse photo app that I'm using.
I have disabled all notifications for WhatsApp, but this dialog comes up anyway.
Deleting WhatsApp would of course solve the problem, but it not possible for other reasons (message history etc stored). Registering the app would also stop the dialog, but is also not an option since I'm using the same number on another phone.
I think it should be possible to disable all dialogs, but since I've tried that and this dialog still comes up, what else is there? Is there a stronger blocking option? Can it be done if I root the phone?
Attaching screenshots of the notification and of the settings.

Rooting would definitely offer more powerful options but to root you'd need to unlock bootloader and that would wipe all data. It's the same as the option you are avoiding (uninstall whatsapp) // You can't anyway use the device when taking a time lapse, so the simplest would be to put it in airplane mode, isn't it? // your second screen shot is confusing - if it is not registered, how are you getting messages on WhatsApp? Unless you are using that SIM on another phone

Sorry, I missed seeing the edit where you clarified the last point. Simply use airplane mode to solve the problem

Technically, that's not an Android notification, but a custom pop-up dialog. In this case, you're right that blocking the notification won't help. Possibly there's a background service that checks this periodically and shows the dialog. If that's the case, it might be possible to disable this using pm command.

Related https://android.stackexchange.com/q/43970/131553

Related https://android.stackexchange.com/questions/52789/popups-dialogs-notifications-toasts-whats-the-difference?rq=1


text:
How to use Android sdk to flash android system images
Can I use android sdk to flash a system image to a device? If yes, how to do?
Device: Samsung galaxy note3
Model:SM-N9000
Can I install an Android generic system image?.

Your duplicate question: Can I install Android using Android studio on any supporting devices?

The Android SDK contains fastboot for flashing images. But Samsung devices are usually not flashable via fastboot.
Instead you need a software named Odin or for Linux an "Odin clone" named Heimdall exists that can AFAIR also flash firmware images on Samsung devices.
For flashing an "Android generic system image" the current firmware of a device has to be compliant to Googles "Project Treble". There are apps in the Google Play Store that claim to be able to check if a device is "Project Treble" compatible. But I don't have any experience how accurate those apps are.


text:
msgstore.db whatsapp android
Does the msgstore.db whatsapp file on android contain every msg every sent and received?
If so are voice notes digitally recoverable from the msgstore.db file?
Latest version whatsapp on android 9.
Regards

yes and no. every message is in this database. but no attachments

Are deleted voice notes recoverable at all using forensics? Thanks for answering.

we recently discussed that it is impossible to recover a deleted file from FBE https://chat.stackexchange.com/transcript/108420 but for FDE it's not completely hopeless

Is it only unrecoverable on a factory reset or normally deleted aswel? Thank you for the answers

some people claim this device is not encrypted. search for root exploit (if exist) https://forum.xda-developers.com/huawei-p20-pro/help/how-to-device-encryption-t3800297


text:
SD formatted as internal storage got corrupted in a weird way on Android. Can I recover the data somehow?
So, I am not quite sure what happened. I'm on Android 6.0 and using an SD formatted as internal storage. Today, when I took a photo I realised it didn't save, and upon further inspections all the photos, videos and other media appear to be completely gone from the card. Those were backed up, so it's not a huge issue - the bigger problem are my Whatsapp logs which also appear to be missing. Whatsapp does a daily backup to Google Drive, but in my case it appears it backed up after the card got corrupted - and all the media are missing. I really need those backups.
Curiously, the card didn't get completely corrupted. All the apps installed on the card still work. Not quite sure what happened.
I realise that the internally-formatted microSD is encrypted and it can only be used on the original device... but I have access to that device. Is there any way at all for me to perform data recovery on that card? One issue I have is that this particular phone (Blackberry Priv) apparently can't be rooted.
I have read in a few sources (eg. here) that re-formatting the card as portable from my phone would decrypt it and allow to do normal data recovery, but that seems somehow dubious.
I also found this post that suggests that I should use dd to clone my microSD and see if it works, or to use a microUSB to microSD adapter. I have also thought about imaging the entire phone via ADB but would that work without root?

See adoptable-storage tag wiki & questions for more info

you misunderstood. re-formatting won't in any way help you to recover data. dd would be useful only if you want to clone the (weared-out?) microSD to another microSD. sorry to say but your data is lost, you may have more luck to check for older google backups https://drive.google.com/drive/backups


text:
Autoboot Samsung Galaxy on Charger connect, but cannot run fastboot command
I need to autoboot a Samsung Galaxy Tab A (SM-T510) when the charger is connected, I know that to do this, I need to issue the following command to the device fastboot oem-off-mode charge 0 but as I understand, I Samsung Galaxy's do not have a fastboot mode, so I am stuck now.
I've tried to root the tablet, but failed miserably trying now for last few days getting stuck with one thing or another.
Is there any other way to achieve this (boot device on charger connect)?
I've managed to get int adb shell, but cannot find any relevant files to edit to achieve this.
Thanks.

See my answer to Automatically power on Android when the charger is connected

Your duplicate question: https://android.stackexchange.com/q/225675/218526

@Irfan Latif Thank you, but I have no /system/bin/playlpm or system/bin/lpm files to edit so I cannot follow that guide

Sorry, I was looking at a different suggested solution, I will try your answer

@omega1 The only way I could make this to work is by using Samsung KNOX. They have an option that does exactly that.

@zolakt Thanks for your note, do you have a link or more info on this as I dropped the project but would like to pick it back up again and some time. Thanks.


text:
Android Auto fails to start on the car monitor
I have a Samsung Galaxy Android Phone which runs on Android 10, One UI Version 2.0. It is an AT&T phone. I also have a Subaru Crosstrek.
The phone connected to the car thru Bluetooth and it does react to phone calls and texts without any issues through the Android Auto. All other applications work fine.
However, when I tried to connect the phone with the USB wire, the Android Auto application is not available on the car dashboard.

I tried to connect a different phone - works correctly.
I tried to put the SIM card from my phone to some other phone - works correctly.
I also tried to re-install Android Auto and re-pair the phone with the car - still USB connection doesn't work
I also consulted with Subaru. They exchanged the radio. It helped for a while and then it stopped working again.

When the phone does not connect through the USB, just Bluetooth - Android Auto does start on the phone and establishes the connection to the car. Then everything works fine.
Basically, I am connecting the phone with the USB and the button to the dashboard does not become enabled.
Any idea how to fix it?


text:
ADB connect to device with Python
Can I connect to an Android device for the first time with python adb, in USB debug mode, without having to manually allow the connection?
This is my code from python adb library:
signer = sign_cryptography.CryptographySigner(
            op.expanduser('~/.android/adbkey'))
        # Connect to the device
        device = adb_commands.AdbCommands()
        device.ConnectDevice(port_path=None, serial=deviceIP, rsa_keys=[signer])

When I call this piece of code, it opens the pop up message with "Allow USB debugging ..." on the device. Is there a way to go around this pop up?

This popup is there for security reasons and can't be bypassed without system manipulation (root required).
Without that dialog an Android device would be once the user activated ADB wide open to anyone who connects to the device via USB. Therefore since Android 4.2 if I remember correctly Google added the RSA based authentication on ADB level to avoid unauthorized data access via ADB.


text:
Google and Chrome - are they independent?
I have a Hudl 2 tablet and am running out of space. I have just bought an SD card but it seems I am very limited with what I can move to the SD card. Also it seems I can not install new apps directly onto the SD card. So I am trying to delete as much data as possible from the existing apps.
I am considering deleting all data from the Google app but am concerned it may be linked in some way to the Chrome app and I do not want to lose my Chrome bookmarks or any ids/passwords I have in Chrome.
Will deleting all data from Google affect in any way anything I have in Chrome?
Thanks.

The Google app is your search and assistant app, it is not directly tied to Chrome and you can safely delete it's data without directly affecting Chrome. That said, unless you don't search, or want notifications from any Google service, such as reminders, weather conditions, and any of about 25 categories of notifications, it will grow and take up a lot of space over time anyway. Disabling the Google app is not recommended as it is deeply tied into the OS, and although it won't cause functional problems, the usability of it's features could be hampered.


text:
How to keep Google Maps sounds in Phone, while calls in Car Sound system, while driving?
I am driving with Google Maps, while Bluetooth on. I cannot hear any Google Maps sounds if Bluetooth is on, my car stereo system is not playing them, while listening radio (I know you could change the input source but I do not want that).
So I turn Bluetooth off because then the sounds of Google Maps come from the phone.
How can you force all sounds from Google Maps to come from the phone, although you have Bluetooth on and connected to car stereo?

I installed the application Waze which has the setting Play sound to phone speaker, which solves the case, at least for now: all sounds of the applications go the phone speakers, while calls etc go to the car speakers.
I could not do that on Google Maps.

Current version of Google Maps (10.47.1) seems to support this function:

tap on your avatar icon
tap on "Settings"
Scroll down and tap on "Navigation Settings"
Disable "play voice over Bluetooth

Tested with Bosch Infotainment headunit in Suzuki car and it worked exactly as expected.


text:
What does an Android-encrypted SD card do/look like on PC
Long story short - my Galaxy Active S8 apparently got wet inside, and stopped working (although I think I can revive).  I've let the Samsung microSD card for almost 24 hours, and as it's simply a card I believe the data should be easily retrievable as I've had SD cards get wet before, but would work after drying.
However, when I put the microSD card in my PC, doesn't show up in the Windows Explorer like normal.  I don't see an additional drive pop up at all.
I can't remember if I encrypted my card or not.  So, I'm hoping I did, and that's why it's not appearing as mounted on my PC.  What would an encrypted SD Card do, or look like, when inserted in a computer?  Would it appear as a drive, but prevent any access - or would it simply not show up at all?

Android/Linux use different file-system formats than Windows. Windows can't read them at all so they may not be displayed (depends on the used Windows version and revision). Also make sure to check hat is displayed in the disk management view. It shows more details than the Explorer.

@Robert - Thanks for that comment! I have Ubuntu on a separate drive - let me boot in to that, cross my fingers, and see if it works!

Bah, nope. Nothing appeared or showed up. Disk Management doesn't show a drive get connected either.

@beeshyams any way to confirm? I'm trying to get my phone working again, but would be surprised if it's dead.  If so, are there ways to retrieve the media (a yes/no is fine, I get that's a big question)?

Let us continue this discussion in chat.

Run dmsg -w on Linux before connecting SD card. That's the simplest way to know if card is detected properly regardless of whether it's encrypted, or the filesystem is broken etc.

@IrfanLatif - Ah! I ran dmesg -w and got the following, primarily "no support for card's volts" and "card claims to support voltages belo defined range".  Screenshot here

@BruceWayne that indicates the failure is at hardware level. RIP!

@IrfanLatif - Noooooo! That means it's 100% unable to be recovered, even by a service (and I'd assume it'd be really expensive)?

@BruceWayne you can try your luck. Hard to say anything.

@IrfanLatif Thanks for your help. If you want, put the dmesg -w troubleshooting tip in an answer, and I'll mark it.

You could look at it with gparted in Linux.  If it's toast, it is.
Give it a try ... it is the standard partition mounting gui tool in Linux.
Else take it to a repair center from your Phone Service Provider.  Give them a try.

Do you have any links/more info on how to use gparted?

parted/gparted/fdisk/gdisk are partitioning tools. Kernel does not recognize the card at hardware level. There are no block devices evaluated, so no partition table, no /dev or /sys entries. What would gparted do there! It simply won't be aware of the existence of the card. @BruceWayne please update your question with the actual problem to avoid irrelevant answers.

@IrfanLatif - Yeah, I need to edit my OP...it spiraled from my original question.  In any case, for now I consider this specific question closed thanks to your tips :)


text:
How do I run 2 Android phones on a PC simultaneously so that DroidCam on one phone & TC games screen mirror on another phone?
I have 2 Android phones and I want to connect both of them to my PC via USB cables like this:

Motorola Moto G3 5.1.1 (Lollipop) goes to the DroidCam app to use as a webcam.
Samsung S4 Zoom (KitKat) goes to mirror screen Android to PC app called "TC games" for screen share and controlling my phone from my PC.

Right now, I have Universal ADB Driver installed on PC and I can't run both programs at the same time. This message pops up when I use DroidCam at the same time with Tc games: "adb server is out of date. Killing...".
How can I connect Motorola to DroidCam as a default, and TC games to Samsung and run both of them at the same time without any problem?

Are you using the Lollipop device for webcam & mic audio or just webcam? If only webcam but no audio on Lollipop, can you swap webcam android and mirror screen android devices so that you can use something like QTScrcpy so like Robert stated use one adb version? Or can't as you are streaming over Skype or something?

Applications like DroidCam or Scrcpy that require adb to work often include an own version of adb. For DroidCam you can see it in the sub-directory adb the three files that belong to adb:

adb.exe
AdbWinApi.dll
AdbWinUsbApi.dll

However adb is designed to be present one time on a system because when it starts it remains loaded invisible in the background.
Now if a program has it's own adb version it prefers this versions and therefore when it starts it's own adb version the previous adb daemon running background is killed and replaced with the different adb version.
In your case the message adb server is out of date. additionally indicates that you have two different versions of adb installed and the newer version kills the older version that was already running (old version = out of date version).
Some programs like Scrcpy allow to specify via environment variable where adb.exe is located so that you can redirect it to one adb versions that is available on your system.
I am not sure if DroidCam also supports such an environment variable.
But in any way you should "equalize" all adb versions you have installed:

Search your system where it has adb.exe installed
On each found adb.exe execute adb.exe --version and identify the newest version (the version installed with Android Studio shows at the moment Android Debug Bridge version 1.0.41 - Version 30.0.2-6538114
From the newest adb version copy the three files adb.exe, AdbWinApi.dll and AdbWinUsbApi.dll to the other locations adb.exe was found overwriting the existing files.

This should at least solve your problem that the adb versions installed have a different version.

thank you for your answer. the problem is with the old android in s4 zoom it can run only with TC games screen mirror via USB because TC provides older adb:
adb-1-0-32-platform-23-0-1.exe
adb-1-0-40-platform-28-0-2.exe
adb-1-0-41-platform-29-0-6.exe
I've tried so many time connect s4 zoom to iVCam via USB and it did not work, but it has worked via WiFi. and when i copied the 3 adb files from TC folder to iVCam the 2nd did not work correctly via USB with neither 2 phones.


text:
Not receiving texts from one person
I have an Razer Phone 2 android phone with Android 9 (Build Number P-SMR3-RC002-RZR-200226.3141).  I've been on Android for about 2 years, before that Windows phone, then Android before that.  I've never had an iPhone.  I did change from a TMobile MVNO to a Verizon MVNO about four months ago.  My wife is a long time iPhone user and has been using Verizon for a couple of years.  My dad is a long time Android user, not sure what carrier.
I recently realized that I'm not seeing texts from my dad in an MMS thread to my wife and I.  She sees texts from both of us.  I only see her texts.  I'm using the default Messages App.
I see MMS texts from my Android and iPhone using friends.  I've definitely seen MMS texts from my dad up until a few weeks ago.
The only way I'm aware that this can happen is if I recently switched from IPhone to Android and he had formerly sent me texts from an IPhone, but neither my dad nor I have ever had an iPhone.  I checked in the phone app and his phone number isn't blocked.
Thinking about trying a reset.

Before a reset, please check if your messaging app is updated. Or try with a different messaging app. If this still happens, try it in safe mode (Google instructions for your device). [Edit] to add device and Android version details and the messaging app you are  using.

I tried the Textra app, but it doesn't show my dad's texts either.

I restarted in safe mode and his texts don't show up.  If I do a reset will it redownload my texts from my carrier?

No they won't be downloaded again. On factory reset All user data and apps are deleted. Read more about factory reset// with Textra or on in safe mode, did you ask your father to send SMS and check? That's the way to confirm. Just by downloading Textra or entering safe mode, those missing messages don't show up automatically


text:
Is Google Voice susceptible to hacking like regular MMS or Whatsapp messages?
I have been using Google voice in a public facing way so as to reduce the chance of receiving malware messages over SMS/MMS or Whatsapp.
But is it just as susceptible for someone to be able to sneak something in over a GVoice MMS or SMS?
I am worried because I received a photo from an unsolicited phone. Is there a chance that having clicked on that photo (which just enlarged  and presented information about itself)  compromised my phone? For context:

95% of Android phones can be hacked with one just MMS | Kaspersky official blog

Jeff Bezos phone hacking explained: What you need to know for your own security

When it comes to attacks via MMS I would expect from my mobile network provider to have some "virus scanner" running filtering out all MMS that have this malicious pattern. If that is the case the "persons" able to attack are intelligence or similar.

Google Voice, aka Hangouts, is fully encrypted point to point.  If you've posted anywhere with your Gmail account, you could have a message pushed to you.  Unless you have OS 6-10 you'll need an "anti-spam" app HIYA is a very good one. The newer OS have been given the ability to flag calls & SMS - MSMs as spam.
Good luck.

Hi - thank you for this explanation. To confirm, if let's say someone is sending out malware to random phones over MMS, and my GV happens to be one of them, GV would prevent a malicious MMS from being received (especially when using the GVoice app on my phone).


text:
Cannot use the "Alt-C" app on Android phone and Mac laptop
I bought a Samsung Galaxy A71 recently then I installed an app called Alt-C on my phone and my MacBook air. It works fine, but the app cannot copy text from my own phone to my Mac, and a message appears on my phone, saying:

Alt-C could not paste text to PC: make sure you copied the text on your device.

and a notification appears on my Mac saying:

there was no text in the device's clipboard.

Does anyone have a solution for that?

Had the same problem and it seems that since Android 10, apps can only access the clipboard if they are in the foreground. So the only way for the copy to work from Phone to Mac is to open the app on your phone after you've copied the text, and then paste on the Mac.

ah, makes sense for security I guess. Better than nothing. iOS and MacOS clipboard sync is so good I missed this feature when I went android.

I just tested Alt C on Android 11 and it works in the background, at least when I've recently opened it. It wasn't working before that though.

I've found that Alt C works on Android 11 if you've recently opened it on your phone, or if you allow it to keep use battery in the background.
For the latter, the ways to do this vary - here's an example for Pixel phones. I haven't tested this thoroughly with Alt C.

In Android 12, I faced the same issue where I was able to copy text from PC to phone but not able to copy text from phone to PC, it showed "couldn't paste text from realme", but later I found the way to copy text from phone to PC.
Basically, when you copy text from your phone then you have to open the Alt-C app in order to sync with your PC, and when the app is open on your phone, then you try to paste it on your PC, then it will be paste. It worked for me in Android 12.


text:
How do we verify that a phone call is going through WiFi?
How do we verify that a phone call is going through WiFi?
I am hoping that there is some special little icon like this one:

Cricket wireless is my provider and my phone is a Motorola moto g7 SUPRA.
My carrier does support WiFi calling. I spent an hour on the phone with them trying to answer the question the above question. The device also supports WiFi calling and reports that WiFi calling has been correctly activated
Our local cell towers went down today so I wanted to have another way to make phone calls that did not depend on an active cell tower. I set up WiFi calling on my phone and it confirmed that it was set up correctly and enabled. The WiFi also indicated that it was connected. It is a very strong connection because it is only ten feet way and direct line-of-sight.
After I did this I still experienced the same issues that I had because of the bad cell tower. This would seem to indicate that the phone calls were not going through WiFi.

Most phones will actually say "WiFi Call" or something similar on the dialer screen while in call, I know my Pixel does.

@beeshyams Yes my carrier supports this I spent an hour on the phone with them trying to answer the question the above question. The device supports this and the device reports that WiFi calling has been correctly activated.

You can test whether Wi-Fi calling is working by activating Airplane
mode, then turning just Wi-Fi back on, and connecting to your home
Wi-Fi network. The icon should appear in your notification bar and
you’ll be able to make or receive calls. Testing WiFi Phone
Calling

I tried this and it worked. I turned my WiFi router off and because I was still in airplane mode phone calls did not work. This proves that the above advice is correct.

I'm using a Pixel 3 XL, I've not "seen" any top menu icon or place to know if my phone is using 802.11 protocols for a call.
The only way I know to easily force a TCP/IP 802.11 protocol is to use Google Hangouts. You can dial any phone number from there for free.
I have 2 "Google Phone Numbers" but I've not seen/dug for the information on how to receive calls on those numbers.


text:
How to unlock my device after locking with Google's “Find My Device”?
I now have my phone (Xiaomi Redmi 4), but it's locked from Google's "Find My Device". Everyone keeps talking about a password option in Find My Device, but nothing like that exists! How do I unlock my phone without erasing the data? Here's all I see on Google's Find My Device:

I managed to solve this, so for future readers:

I went to emergency and pressed back(this brought up the phone lock screen with the pattern option). Rebooting seems to also bring up the lock screen temporarily.
I managed to enter the lock-screen pattern correctly from muscle memory(even though it didn't seem to work all the times I had tried before). I believe if you enter it incorrectly enough times, it'll let you enter your google account info to reset the password, but I never got to that point.
After the phone unlocked I changed my default password and all seems good now.

I'm still not sure why google wouldn't let me set a temporary password. God help anyone that doesn't remember their original one.


text:
Can I install replicant on a Galaxy A10e without bricking it?
I'm trying to UnGoogle my phone for privacy/security reasons, and from one source I heard that if you want to use a smartphone, you're better off getting a Pinephone running GrapheneOS / LineageOS. But the problem is I have a Samsung and there's no way I would be able to install those types of custom ROMs on my device without essentially destroying it. I wonder if you can install replicant.us on a Samsung phone. Any help?

Does this answer your question? Can I install a ROM made for a different device?

If it is not meant for you phone, don't try

Installing a pure open source OS on phones is the dream of many. But unfortunately proprietorship is so deep rooted in software. Particularly in phones world. There aren't many people who practically support Replicant. Ubuntu also miserably failed trying to achieve something similar. Graphene/Lineage aren't fully open source though (vendor HALs are always proprietary), but still much better than ROMs shipped by many OEMs. In fact Google is not the only entity you need to get rid of. Phones in particular are by design meant to have closed source components. There's no way to fully avoid it.


text:
Reason of existence of An App named "-5"
I was trying to look at the battery usage of different apps and saw this weird app named "-5" on inspection it takes me to google photos which is weird since why will google photos use its name as "-5". I can't find any reasoning for this and want others to shed some light on this topic. I have also reported this weird behavior to google as well.

Find out which is that app, using method here

What beeshyams want's to say with the link is that "-5" may be not the app name but the Linux User ID (UID) that belongs (or had belong) to the app.

@rameshgupta1368 have recently uninstalled any app, just before this screen shot? Also, based on the icon seen on screenshot maybe its a system app.

@RahulGopi I'd agree the icon pointed to a system app if the userid wasn't prefixed with a "-". It's rather the "default icon" as the real one went away with the app being deinstalled. System apps which do not reveal their package names rather show up with "positive numbers", as they are still there. But yes, good point I fully agree with: most likely an app recently uninstalled, hence the negative prefix ("that used to be X but it no longer exists").

I did a search in Play Store for "-5" with no results, also on YEE ole great god Google.  Not much returned.
I would start with your phone service provider.  They are suppose to give you a level of device support.  I've personally stumped the US Cellular chumps before.  Give it a try.  They do keep a knowledge base of customer calls. Who knows, you might be lucky.  Else download "HouseCall" from the Play Store, it is a TrendMicro manual scan for nasty things.  It is very powerful.  Free, only runs's when you run it.  TrendMicro has a variety of very good pay products for Android and web safe stuff.   Good luck.

"-5" is unlikely to be the app name. It's more likely an app that was recently removed, so the stats can only show its "Linux user id" (prefixed with a "-" to show it no longer exists) and a default icon.

@Izzy Having 5 as a UID, even for a system app seems unlikely. See https://android.googlesource.com/platform/system/core/+/master/libcutils/include/private/android_filesystem_config.h#39

@Firelord indeed, that made me wonder too (I'd expect at least 4 digits). Oh, thanks for the link! That explains one such thing I had 9 years ago. Now I finally know what 1010 stands for :D

It's for Wireless hotspot. Other users have reported same. read more about here

This should be accepted answer


text:
Open attachment that contains forwarded email (MIME type message/rfc822)
When I forward an email with Mutt from my laptop, Mutt adds the forwarded email as an attachment with MIME type "message/rfc822".
Unfortunately, Android's stock email client "com.android.email" version 8.1.0 displays the received email like this:

Two things are wrong with that:

It doesn't show the forwarded email's content.
It doesn't show the content of the non-forwarded email, the body of the email I wrote in Mutt.

The email displays properly when using K-9 Mail.
Is there a way to make the email app show the email and its attachment?

I'm on a Samsung Galaxy J5 running LineageOS.

You're right, I had set mime_forward because I wanted to forward attachments per default. If I unset mime_forward, the forwarded email is just text (not a message/rfc822) and the stock email app shows it fine.

Gmail cannot support this as I understand from FairEmail discussion on XDA (outlook mail client has related limitations).
There is a workaround, in case one is willing to have the forwarded email as text and not attachment.
OP had set mime_forward because they wanted to forward attachments per default
. If this is unset as per mutt documentation (to ask-no or ask-yes), the forwarded email is just text (not a message/rfc822) and the stock email app shows it fine as confirmed by them.

The FairEmail discussion on XDA sounds interesting. Can you provide a link to it?

You can search for "rfc822", even better would be reach out to developer--he is very prompt and helpful

It isn't a single instance I was quoting but the general sense of difficulties with various email clients, like this. My guess is FairEmail will support your need but it's best confirmed by you checking and if not asking developer to consider. I find him unbelievably supportive and tries his best to accommodate. I answered it just so that it may help somebody who comes looking for a solution, though this may not be what you want


text:
How to disable automount of /dev/block/mmcblk1p2?
I installed link2sd then formatted my 2nd partition as ext2. Then I used link2sd to create mount script. Now,due to free version i'm unable to link internal data to this partition. So i removed the link2sd app from my device. But the problem is even after uninstalling the app, a unmount command and a restart the /dev/block/mmcblk1p2 is still getting mounted after reboot.
How can I fix this? Where does this auto mount script located ?
Note 1: I tried removing install script located at /data/data/com.buak.link2sd/files. But still the partition is getting mounted automatically.

Remove the init.d script

Can you specify the location of init.d file?

See https://duckduckgo.com/?q=link2sd+init.d+script and https://duckduckgo.com/?q=where+are+android+init.d+scripts+saved. Also see my answers to https://android.stackexchange.com/a/217265/218526 and https://android.stackexchange.com/a/213623/218526

I tried the following: 1.removed link2sd
2. mount -o rw,remount /system
3. edited /system/bin/debuggerd and removed mount related lines
4. reboot... still 2nd partition is mouted at /data/sdext2

/su/su.d/11link2sd or /data/adb/service.d/11link2sd

Thanks. In my case , the script was there in /data/adb/services.d/11link2sd. I moved that file to some place to keep it as backup, unmounted the /data/sdext2 manually and performed a reboot... Now, it's not mounted... thanx @alecxs


text:
Does my Smartphone Listen to me for Ads?
I was talking to a friend about a tour to a location, the next day I'm getting ads about that travel plans. I asked a friend something about the best way to root an android device... the next day when I open youtube the very first suggestion for me to watch was how to root an android device!”
Is Google always listening on Android? Does Google keep a log of everything we say? And if so, what can we do about it?

If you are using "OK Google", it's been reported many times that Google stores voice snippets. You can turn that off and other invasive privacy features. https://clark.com/technology/google-recording-you-delete-files/

Related question https://android.stackexchange.com/q/188597/131553

Your question cannot be answered with certainty. None will tell you clearly what data they collect and how they use it for profiling. // I observed the same thing with Facebook app in past. The suggestions and ads were personalized based on the keywords I used in my conversation with friends and colleagues. Many of my friends also observed the same from time to time. I don't use Facebook, OK Google or other similar apps, particularly those which run background/foreground services. If using such apps is unavoidable (like Google Play Services), I restrict their permissions as much as possible.


text:
How to diagnose bootloop?
My Sony Xperia Z5 sometimes heats up, starts lagging and crashes after a few minutes to end up in a boot loop. I have the teamwin recovery project 3.1.1-0 installed and the phone is rooted with magisk on Android 7.
Usually, it was enough to keep power and volume down pressed, enter the recovery, and choose "reboot" to get out of the bootloop. This time, it seems different, so I'm caring a bit more now.
What are steps to take for finding the reason of and/or getting out of the bootloop?
I have access to a terminal through the recovery.
I have used a script called mm that I had lying around on my sdcard and that I have used before when I had a bootloop due to a broken magisk module, to activate "Core Only Mode" which is supposed to deactivate the loading of any magisk modules. So I assume that the problem is actually not magisk.
Also, I haven't updated magisk, modules, or the system since at least a few months, so it would be weird if that were it.
Wiping the dalvik cache as adviced by the boot-loop tag wiki did not help either.
The tag wiki for logging sent me to android boot up messages for debugging which recommends a few things.  But /proc/last_kmsg is inexistent, dmesg is more output than I know what to do with, especially much recovery stuff which I don't care about, and adb logcat won't react because the device crashes before it is found.
The boot process crashes at the xperia logo - so before the animation

See [tag:logging] and [tag:logcat] wiki's and questions


text:
how to export bookmarks from Silk web browser without rooting?
I would like to export my Silk browser bookmarks, ideally to an HTML file.  Amazon has apparently made it impossible to export bookmarks from its Silk web browser on Kindle Fire.
Searching on StackExchange, I note several old recommendations to download certain apps in order to export bookmarks from Chrome or Firefox, and recommendations to root the Kindle.  I would rather not root the Kindle as I am not particularly tech-savvy and my connection to Amazon via the Kindle is important to me right now.
I have enabled the Google Play Store.  Is my best bet to download some app from there, or is there another way I can export Silk bookmarks without possibly messing up my ability to access Amazon content?


text:
What is "rmnet_gsi" USB function?
I was looking through the init files from my boot image and noticed a USB flag labelled rmnet_gsi here.
What does this setting do?
Example source:
on property:sys.usb.config=diag,serial_cdev,rmnet_gsi,adb && property:sys.usb.configfs=1
    start adbd

Rmnet is Qualcomm's modem control and data transfer protocol based on QMI. rmnet_gsi is one of the functions of Android USB Composite Gadget driver whcih is configurable through /sys or /config. The configuration must be related to USB tethering.

In addition to Android's generic USB functions (like adb, mtp, rndis), rmnet_gsi is a hardware specific USB function which exposes some of your GSM/3G/LTE modem's functionality to PC over USB. Usually this is not something an ordinary user is concerned about.

It involves understanding two core concepts:

How Android communicates with modem/BP (which lives on SoC along with other core components including CPU/AP and RAM) for internet data. Communication with modem/BP occurs e.g. through serial channels (like USB or UART, as other components of SoC do: QDL 9006/9008, EDL, fastboot etc.), or by sharing a reserved area of RAM (e.g. SMD or SSM in case of Qualcomm).
How different USB functions of Android Composite Gadget driver (which is an extension to Linux kernel's USB Gadget API) are used to expose Android in USB device mode to a USB host like PC. Different USB functions (like UMS, MTP, RNDIS etc.) can be configured and switched using sysfs or configfs.

On devices with Qualcomm's MSM SoCs (like USB modems or phones), RmNet (Remote Network) is modem's data transfer and control protocol which exposes Ethernet like IP interface as data channel and uses QMI as control protocol. Generic Software Interface (GSI, which replaced BAM) transports communication with IPA core of the modem. Internet Packet Accelerator (IPA) is an IP packet processor which performs better than CPU/AP for this specific purpose.
IPA/GSI can be used with different tethering protocols including RNDIS, RmNet and DIAG/DPL/QDSS. In order to access BP from PC (e.g. to use internet or do some debugging), Android kernel includes USB functions (like rmnet_gsi) for these protocols in order to expose them through USB (so that Android device appears like a USB modem). Proprietary protocols may not be used without vendor provided software. E.g. on Android devices we have RIL and cnd - vendor provided daemons - to communicate with BP. However there are open source tools like QCSuper which can talk Diag protocol over /dev/diag.

RESOURCES:

Gadget RmNet
Qualcomm MSM specific device drivers
Qualcomm Kernel


text:
How to make Ethernet work on Android over OTG?
I am trying to use an LTE modem connected to an Android 7 device over an OTG cable. The kernel recognizes the device and registers it with cdc_ether, but I am unable to use the connection from the device. Is this because it is subsequently mounted as USB storage?
The device does not show up as a device in the Android UI / status bar.
If I disable MTP support, then the device wont register cdc_ether at all.
dmesg:
[10946.408785] usb 1-1.3: new high-speed USB device number 21 using msm_hsusb_host
[10946.525287] usb 1-1.3: New USB device found, idVendor=19d2, idProduct=1225
[10946.525306] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[10946.525316] usb 1-1.3: Product: ZTE Mobile Broadband
[10946.525325] usb 1-1.3: Manufacturer: ZTE,Incorporated
[10946.525335] usb 1-1.3: SerialNumber: MF8610ZTED000000
[10946.529662] usb-storage 1-1.3:1.0: USB Mass Storage device detected
[10946.532702] scsi host19: usb-storage 1-1.3:1.0
[10947.538579] scsi 19:0:0:0: CD-ROM            ZTE      USB SCSI CD-ROM  2.31 PQ: 0 ANSI: 2
[10952.740595] usb 1-1.3: USB disconnect, device number 21
[10953.087891] usb 1-1.3: new high-speed USB device number 22 using msm_hsusb_host
[10953.232955] usb 1-1.3: New USB device found, idVendor=19d2, idProduct=1405
[10953.232969] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[10953.232977] usb 1-1.3: Product: ZTE Mobile Broadband
[10953.232984] usb 1-1.3: Manufacturer: ZTE,Incorporated
[10953.232991] usb 1-1.3: SerialNumber: MF8610ZTED000000
[10953.260856] cdc_ether 1-1.3:1.0 usb0: register 'cdc_ether' at usb-msm_hsusb_host-1.3, CDC Ethernet Device, 36:4b:50:b7:ef:da
[10953.262322] usb-storage 1-1.3:1.2: USB Mass Storage device detected
[10953.262652] scsi host20: usb-storage 1-1.3:1.2
[10954.261139] scsi 20:0:0:0: CD-ROM            ZTE      USB SCSI CD-ROM  2.31 PQ: 0 ANSI: 2

dmesg with MTP disabled:
[10664.987934] usb 1-1.3: new high-speed USB device number 19 using msm_hsusb_host
[10665.105272] usb 1-1.3: New USB device found, idVendor=19d2, idProduct=1225
[10665.105291] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[10665.105301] usb 1-1.3: Product: ZTE Mobile Broadband
[10665.105310] usb 1-1.3: Manufacturer: ZTE,Incorporated
[10665.105320] usb 1-1.3: SerialNumber: MF8610ZTED000000
[10665.110339] usb-storage 1-1.3:1.0: USB Mass Storage device detected
[10665.111320] scsi host17: usb-storage 1-1.3:1.0
[10666.110748] scsi 17:0:0:0: CD-ROM            ZTE      USB SCSI CD-ROM  2.31 PQ: 0 ANSI: 2
[10671.223090] usb 1-1.3: USB disconnect, device number 19
[10671.407859] msm_otg 78db000.usb: OTG runtime idle
[10671.407887] msm_otg 78db000.usb: OTG runtime suspend

ifconfig:
TB-8504F:/ # ifconfig
wlan0     Link encap:Ethernet  HWaddr 40:a1:08:36:5b:0d
          inet addr:192.168.1.133  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: 2605:a601:ab2b:9900:b19e:4f2e:5d28:5fa9/64 Scope: Global
          inet6 addr: fe80::42a1:8ff:fe36:5b0d/64 Scope: Link
          inet6 addr: 2605:a601:ab2b:9900:42a1:8ff:fe36:5b0d/64 Scope: Global
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:27906 errors:0 dropped:4 overruns:0 frame:0
          TX packets:17795 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:14342222 TX bytes:8697917

dummy0    Link encap:Ethernet  HWaddr c6:b9:c8:82:8f:7e
          inet6 addr: fe80::c4b9:c8ff:fe82:8f7e/64 Scope: Link
          UP BROADCAST RUNNING NOARP  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 TX bytes:210

p2p0      Link encap:Ethernet  HWaddr 42:a1:08:36:5b:0d
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 TX bytes:0

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope: Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 TX bytes:0

ip l:
255|TB-8504F:/ # ip l
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: dummy0: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT group default
    link/ether c6:b9:c8:82:8f:7e brd ff:ff:ff:ff:ff:ff
3: sit0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN mode DEFAULT group default
    link/sit 0.0.0.0 brd 0.0.0.0
20: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DORMANT group default qlen 1000
    link/ether 40:a1:08:36:5b:0d brd ff:ff:ff:ff:ff:ff
21: p2p0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN mode DORMANT group default qlen 1000
    link/ether 42:a1:08:36:5b:0d brd ff:ff:ff:ff:ff:ff
31: usb0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 36:4b:50:b7:ef:da brd ff:ff:ff:ff:ff:ff

The device does show up as usb0 with the MAC address that was listed in dmesg.

but I am unable to use the connection from the device How did you try using it? Android won't configure it (unless a custom configuration is added to some of  init's .rc files), you have to do it manually. Does it appear as a network interface (check using ip l or ifconfig)?

thank you for the response - i added the requested logs - do you have an example of how to add a custom entry to init.rc files? I can modify the boot partition on this device

I think usb0 is the interface. You can confirm though by removing the dongle. You can configure this interface using ip commands (set up, set IP, add route etc.). But Android framework won't be aware of this interface, so some APIs would report device offline. Android doesn't configure and manage hardware resources directly but through vendor provided HALs. So if you want to add a new hardware resource, you need to run its HAL as a native service. Android framework would interact with that. In simple words it requires rebuilding a custom ROM.

I have the source for this device and have been building the ROM / modifying it to support a quectel modem. Thank you so much for your information! usb0 is the interface - it disappears when I remove it

Development related questions are off-topic here. // Android provides limited support for Ethernet. See this, this, this and this. If only Mass Storage device appears and not the Ethernet, your dongle must be a flip flop device which needs USB_ModeSwitch.

where are development questions allowed? If I ask in SO, I get directed here...

Moderators have their own constraints and line of action. But you should state clearly AMAP that your question is development oriented. As in the case of this question, it looks like it's related to end users. But after conversation it turns out to be development oriented. This can mislead.

There is a long list of Ethernet related questions but none has a comprehensive answer covering all aspects. I'm generalizing your question in order to share my knowledge on this.
This is what you need to do in order to make Ethernet work on Android:

Make sure OTG support is available
Kernel must be built with Ethernet (and USB Ethernet) support
Handle USB mode switch and kernel module loading (if applicable)
Make Android framework do network configuration or do it manually

Note: Everything described below requires a rooted device, or at least the one with unlocked bootloader.
You should be familiar with commandline interface.

OTG SUPPORT
Your device must be able to operate in USB host mode.EthernetService is started only if device supports feature USB host (android.hardware.usb.host) or Ethernet (android.hardware.ethernet). You may also need to use a powered USB hub if Android's USB power supply is not enough for connected device. Related question:

Is there a definite way to know if my phone supports USB-OTG or not?

KERNEL CONFIGURATION
In order to use Ethernet over USB (adapters or modem-like devices) kernel must be built with CONFIG_USB_USBNET and other configurations like USB_NET_CDCETHER, USB_NET_HUAWEI_CDC_NCM, USB_NET_CDC_MBIM etc. depending on the type of connected device and the protocol it talks. Related questions:

Where kernel modules are installed?
Add a driver to kernel without flashing a new kernel
Load an unsigned Kernel Module to signature enforcing Kernel

USB MODE SWITCH AND LOADING KERNEL MODULE
Many USB network devices are multi-mode or flip flop devices. They appear as USB Mass Storage device (also called ZeroCD mode) when inserted and need to be switched to Ethernet/PPP mode. USB_ModeSwitch is a Linux tool commonly used for this purpose. See some details here how it works. You need to build this tool for your device, or may download this binary for aarch64. Get device database from here.
In order to automatically switch mode whenever the device is connected to Android, we need to listen to kernel USB uevents, either through hotplug helper or a userspace daemon (like udev on Linux and ueventd on Android). Additionally the kernel module can also be loaded/unloaded automatically. I'm defining an init service here to achieve this, you can do it manually too.
Note: There is an Android app PPP Widget (by the developer of USB_ModeSwitch, I have no affiliation) which handles mode switching automatically and needs "no kernel driver modules, the 'driver' implementation is based on the Android USB host API". You might be interested in that too.
# /system/etc/init/custom.rc

# kernel hotplug or uevent daemon service
service cust.udevd /system/sbin/busybox uevent /system/sbin/udev.sh
    seclabel u:r:magisk:s0
    disabled
    writepid /dev/cpuset/system-background/tasks

# set kernel hotplug helper or start uevent daemon on boot
on property:sys.boot_completed=1
    #write /proc/sys/kernel/hotplug /system/sbin/udev.sh
    start cust.udevd

* In case of hotplug you need to define custom SELinux policies to let kernel make changes (see this answer for details).
#!/system/bin/sh

# /system/sbin/udev.sh script is executed from kernel hotplug or uevent daemon

# set PATH where you placed binaries
export PATH=/system/bin

# save log
exec >>/dev/udev.log 2>&1

# don't execute multiple instances
exec 200<>/dev/udev.lock
flock 200

VID="12d1"          # USB vendor ID of a Huawei devcie
PID_UMS="1f01"      # product ID in ZeroCD mode
PID_ETH="14db"      # product ID in Ethernet mode
MODULE="cdc_ether"  # kernel module for USB Ethernet
IFACE="usb0"        # Ethernet interface name

matches() {
    [ -e "/sys/$DEVPATH/$1" ] || return 1
    [ "$(cat "/sys/$DEVPATH/$1")" = "$2" ] || return 1
    return 0
}

# check if a new USB device is added or removed
if [ "$SUBSYSTEM" = "usb" ]
then
    # check if a USB device is added, then match VID and PID for mode switching
    # also device must belong to UMS class: https://www.usb.org/defined-class-codes#anchor_BaseClass08h
    if [ "$ACTION" = "add" ] && echo "$PRODUCT" | grep -q "$VID/$PID_UMS/" &&
        matches bInterfaceClass 08 && matches bInterfaceNumber 00
    then
        echo "Switching USB mode..."

        # USB mode switching of flip flop devices (USB modems, routers etc.)
        # usb_modeswitch_dispatcher needs /system/sbin/usb_modeswitch binary and configuration files in /etc
        # so you need to modify the hard-coded paths in source code as per your requirement
        usb_modeswitch_dispatcher --switch-mode "$(basename "$DEVPATH")"
    fi

    # match VID and PID for module loading
    # modprobe should be built with the hard-coded path to where you place modules e.g. /system/lib
    if echo "$PRODUCT" | grep -q "$VID/$PID_ETH/"
    then
        if [ "$ACTION" = "add" ] && ! grep -q "^$MODULE " /proc/modules
        then
            echo "Loading $MODULE module..."
            modprobe "$MODULE"

        elif [ "$ACTION" = "remove" ] && grep -q "^$MODULE " /proc/modules
        then
            echo "Removing $MODULE module..."
            modprobe -r "$MODULE"
        fi
    fi
fi

# on network interface event
if [ "$SUBSYSTEM" = "net" ] && [ "$INTERFACE" = "$IFACE" ]
then
    if [ "$ACTION" = "add" ]
    then
        echo "Starting cust.eth_config service..."
        #start cust.eth_config    # uncomment if you want to do manual network configuration
    fi

    if [ "$ACTION" = "remove" ]
    then
        echo "Stopping cust.eth_config service..."
        #stop cust.eth_config    # uncomment if you want to do manual network configuration
    fi
fi

NETWORK CONFIGURATION
Android framework has a hard-coded name for Ethernet interface (default is eth0, eth1, ...). Whenever an Ethernet interface appears, its name is matched with the hard-coded value. Renaming interface afterwards doesn't work because only kernel provided interface name is tracked.
So you need to make this naming convention consistent between kernel and AOSP by modifying one of the both (if needed). Kernel provided name can be seen using ip tool (as in your case it's usb0). Use dumpsys or de-compile /system/framework/framework-res.apk using apktool to see the AOSP value.
~$ dumpsys ethernet
...
  Ethernet interface name filter: eth\d
...

As soon as an Ethernet interface appears, Android configures it automatically, NetworkMonitor validates the connectivity and ConnectivityService turns off WiFi and Mobile Data (if it's ON). Other services and components involved in configuration include UsbHostManager, EthernetTracker, EthernetNetworkFactory, IpClient.eth0, DhcpClient, DnsManager and Netd.
EthernetService was added in Android 5. Before that AOSP was patched to make Ethernet work (e.g. see this and this). Still stock Android provides no GUI settings for Ethernet, but some custom ROM developers and OEMs do (e.g. see this). EthernetManager class which is used to set and save manual IP configuration (to /data/misc/ethernet/ipconfig.txt) is hidden. Default is to use a hard-coded configuration (see using dumpsys ethernet under "IP Configurations:") or DHCP provided configuration.
MANUAL CONFIGURATION
You might want to do manual network configuration e.g. if:

Android framework doesn't configure the Ethernet interface (on older devices or due to interface name inconsistency).
You want to set static IP address or different DNS server.
You want to use Ethernet along with WiFi or Mobile Data, or want to share internet among any of these.

But in this case Android's Java network stack remains down, so some apps depending on Android APIs may not behave normally. For related details see Connecting to WiFi via ADB Shell.
# /system/etc/init/custom.rc

# Ethernet IP configuration service
service cust.eth_config /system/sbin/eth_config.sh
    seclabel u:r:magisk:s0
    disabled
    writepid /dev/cpuset/system-background/tasks

# clear routing and DNS
on property:init.svc.cust.eth_config=stopped
    exec u:r:magisk:s0 -- /system/sbin/eth_config.sh stop

#!/system/bin/sh

# /system/sbin/eth_config.sh script is executed from eth_config init service

# set PATH where you placed binaries
export PATH=/system/bin

IFACE=usb0                    # Ethernet interface name
DIR=/data/local/tmp/ethernet  # temporary directory
mkdir -p $DIR

# save log
exec >$DIR/eth_config.log 2>&1

if [ "$1" = stop ]
then
    echo "Clearing configuration..."
    ip ru del lookup main
    ip r f table main
    ndc resolver setnetdns 0 '' 0.0.0.0
    exit
fi

# destroy set network if any
ndc network default set 0

# turn WiFi and Mobile Data off
svc wifi disable
svc data disable

# set interfaces up
ip link set dev lo up
ip link set dev $IFACE up

# Android doesn't use main table by default
ip rule add lookup main

# set IP, route and DNS manually here
# or add any other IP/routing configuration
# or run a minimal DHCP client as follows

# create 'udhcpc' script
<<-'SCRIPT' cat >$DIR/udhcpc_default.script
#!/system/bin/sh

case $1 in
    bound|renew)
        echo "Setting IP address, gateway route and DNS for $interface..."
        ip address f dev $interface
        ip route f table main
        ip address add $ip/$mask dev $interface
        ip route add default via $router dev $interface
        ndc resolver setnetdns 0 '' $dns
    ;;
    *)
        echo "Ignoring $1"
    ;;
esac
SCRIPT

# start DHCP client to obtain IP from server
chmod 0755 $DIR/udhcpc_default.script
exec busybox udhcpc -v -f -i $IFACE -s $DIR/udhcpc_default.script

Do not forget to set proper permissions on .rc file and shell scripts. Once setup, Ethernet works as soon as you connect USB adapter.

@moderators merge it with some other similar question if needed.

https://chat.stackexchange.com/transcript/121034

This seems precisely the problem that I am facing. But I cannot understand how the usbX interface is renamed as ethX... Could you please provide more details?

@EM90 I think I've already explained it well: "So you need to make this naming convention consistent between kernel and AOSP by modifying one of the both". In simple words: rebuild your kernel or the ROM. Or "you might want to do manual network configuration if Android framework doesn't configure the Ethernet interface due to interface name inconsistency".

Ok, thanks. I read it with more care. If I understand it correctly, I can use the scripts above to manually configure the network settings. Trying those.

+1 Thank you a lot for this great answer! Really a lot of specifics that are super hard to find anywhere else... If I didn't find the  "Android doesn't use main table by default" remark, I would have likely wasted so much time on trying to make an RNDIS ethernet connection work!


text:
Blocking apps to be installed in AVD environment?
Is it possible for developers to block their Google Play apps to be installed at AVD or am I just picking the unsupported AVD profile? I'm trying to install the app into the AVD and debug in a more controlled environment, however, it says:

Your device isn't compatible with this version

So, it isn't an error message. It's a Google Play message before installing the app.

There are multiple ways to detect if an app is running on an emulator. But in your case it seems to be a general problem because the error already occurs on installation:
Emulators are usually x86 devices because of emulation speed (as PCs usually have x86 based CPUs). The number of real Android devices with x86 architecture is very very low hence if a developer does not support x86 this can result in an error like you encountered.
Try the latest beta emulators image for Android R it supports both x86 and arm. Therefore on on this emulator image you should be able to at least install the app. If it runs is a different question.
In any way a rooted physical device is usually suited better for an analysis.


text:
Opening compressed file attachments from GMail using Total Commander
On a newly configured Android 9 tablet, I installed Total Commander which can open most of the known compressed file types (zip, tgz, etc). I want to open such a compressed attachment directly from the Gmail application without first saving it. However, when I tap to a zip attachment in a mail, only a list of other installed applications that can handle the zip file are shown, but not Total Commander. How can I add Total Commander to this list?

The Total Commander app can only work with saved ZIP files. This is defined in it's AndroidManifest.xml:
<intent-filter>
    <action android:name="android.intent.action.VIEW"/>
    <data android:mimeType="application/zip" android:scheme="file"/>
    <category android:name="android.intent.category.DEFAULT"/>
</intent-filter>

As you can see there is only an entry for the file scheme, but no for the content scheme.
On Android users can not modify which app can handle what file format. Hence without a change by the author of Total Commands you can't do change this behavior on an unrooted device.

@Robert Can this be changed on a rooted device? How?

@Sruly You should be to modify a system wide xml file to show Total Commander in the list of apps. However Total Commander defines for some file types the content scheme and for some not, hence I would assume that the content scheme is missing for ZIP files is not an accident but was done intentionally because TC does not support this way of processing ZIP files. Therefore I would assume that modifying the system to show TC as target will result in an crash of TC.

I contacted the developer of this software. They are going to make the necessary modifications in the coming releases. Currently, the first beta version fulfills my need with a limitation ("only when Total Commander was already running in the background when I click on the downloaded file"). This limitation will be addressed in "beta 2". I will update my answer when this is generally available.