text:
What's inside the Android A/B-Update payload.bin?
I am using Android 8 for an embedded device, with Android Verified Boot 2.0 secured via HW-keys, and A/B OTA update (no streaming). I want to make sure that the software on the device is tightly secured; however, I'm having a hard time to trace the individual steps the update performs. One hint would be the metadata contained in the update payload.bin.
Unfortunately, there seems to be no documentation on the payload.bin file format and its contents. Is there an official documentation for the file format? Or is there a crisp piece of code (e.g., build tools( that I haven't found out about yet?
The tools for "dumping" payload.bin give me the contained images, but not the metadata.
What I'd like to understand is the following:

Which parts of payload.bin are signed with which key?
Are there parts that are not signed?
Which additional verification elements are contained in payload.bin, and how does the update_engine use them? For example: there are hashes to verify the target partitions following the installation
For a differential update, there must be a means to ensure that the system on the device is exactly the one used as source for the update diff. Where are those hash-values?
How about a full update - can the updater ensure that the update is installed only atop a specific version on the device?

I apologise if I have missed sources that answer these questions. The books about Android system programming I came across are outdated by now. Any pointers to relevant documentation beyond the basic Android docs would be highly appreciated.

What I understand is that Google moved A/B updates infrastructure from their closed-source Chrome OS to AOSP. But they want OEMs use Google's A/B update client (integrated in Play Service) and hence Google's update servers along with cloud hosting. After all it's about business. There is no clear documentation available but for tech-savvy souls the complete code is available in update_engine, enough to understand and implement from scratch. This is more a development related question.

"OEMs not using Google's OTA infrastructure will be able to reuse the AOSP system code but will need to supply their own client." https://source.android.com/devices/tech/ota/ab#overview

build tool for A/B payload.bin is a call chain:
ota_from_target_files.py -> GenerateAbOtaPackage() -> payload.Generate() -> brillo_update_payload.sh -> generate_delta_main.cc

payload file format - system/update_engine/update_engine/update_metadata.proto


text:
S6: Folder is empty when trying to view the files on PC, display broken
So my phones display recently died and trying to view it on my PC leaves me with an empty folder...
The phone is still on and running though, only the display is broke
There are different solutions to this, I link them below:
Galaxy S6 Folder is Empty on PC
There must be a way to operate the phone from my PC, right?
Would be happy if someone could help

S6 supports no MHL but OTG, connect keyboard and press space + pin + enter to unlock, this should bring up your files. if you have pattern, set temporary lock screen pin from https://www.google.com/android/devicemanager (secure device)

untested, but if it works you can use scrcpy to fully remote control your device from usb-debugging https://android.stackexchange.com/questions/159551

source: Stack Exchange

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

sort: votes


text:
Real time switching for playing audio as microphone input for online speaking in external app
I like to play my podcast played from some other apps like Telegram or Castbox into my realtime mic which is played in another app like Hangouts or WhatsApp conference, two-person calls, or for streaming a live podcast.
I found some apps like Lesser AudioSwitch or Microphone Pro which don't work for this purpose.
There are apps like VB-CABLE Virtual Audio Device as per this answer on Stack Overflow, but it is for Windows, not for Android.
There are some apps which convert audio call in realtime, but is there any way to combine played audio with the phone mic into some other apps like Phone or Hangouts?

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


text:
How to enforce Selinux (setprop ro.boot.selinux=enforcing)
I have a Xiaomi Redmi K20 Pro (raphael, China Version) device.
I set the prop "ro.boot.selinux" to "permissive", by installing this Magisk Module.
Now I'd like to set it back to "enforcing", but didn't find a way to do so.
I tried using the Module to reset the prop and got this Error: "This root method has no boot script support!
!You will need to add init.d support!
!Addon.d not detected. Backup script not installed..."
It further says it installs files and reports a success, but selinux is still permissive.
After a couple hours on google now, I still don't know what init.d support really is and how I set it up. I hope you can help me.
I tried further:
setenforce 1 -> works till reboot
edit sys/fs/selinux/enforce to 1 -> back to 0 after reboot
setprop ro.boot.selinux=enforcing from terminal in twrp -> error: "unable to set property "ro.boot.selinux" to "enforcing" error code 0xb"
flash both, a recovery.img and boot.img with "androidboot.selinux=enforcing" via fastboot
flash stock miui 11
flash stock miui 10 and upgrade to miui 11
getenforce still results in permissive :/
Thanks a lot!
Edit: After reflashing LOS17 and Magisk and using the module again, I managed to set selinux back to enforcing. Now the popup camera comes up on every boot though, lol
This can be closed, thx

consider answering your own question with reproduceable steps

The only step is to delete the module or init.d script which executes setenforce 0 on boot. ro.boot.selinux was abandoned back in Android 6, replacing with kernel cmdline parameter.


text:
Samsung Galaxy Tab A stuck at logo
My Samsung Galaxy Tab A stuck at the logo screen.

All I could find on internet so far were advices to push power button together with  Volume up.
But it doesn't react for me.
Push and hold power button also doesn't react.
The only combination where I see a reaction is Power + Volume down after 7 seconds screen is black for a couple of seconds after that the logo screen just comes back and here we are again.
What could be the (any) next step?

wipe cache from recovery mode, this won't harm your userdata. if you want to factory reset but want to do a backup before, flash twrp recovery from download mode (Heimdall/Odin) https://www.hardreset.info/devices/samsung/samsung-t580-galaxy-tab-a-101-2016-wifi/recovery-mode

I can't come to recovery mode. As I wrote the only combination of buttons the Tab reacts to is power+volume down.

if the three-button-combination does not work (and home button is not broken) your device is still on. disconnect the battery to make sure it is powered off https://youtu.be/y8HmbYrKsS0

... except for the very rare case you have installed a third party device management software which has removed Download mode from your device (Safe Mode)?
https://forum.xda-developers.com/showthread.php?t=3775903


text:
How do I select a gallery album/folder when selecting what image to comment?
In the Facebook app, if you're going to post a picture, you can select a album from your gallery, like so:

But when it comes to the comments, there are no option for it:

Facebook Lite allows you select what folder since it opens the Gallery app directly; for some reason the main Facebook ap doesn't have any option for it.
Is there any way to do it or am I stuck with this photo reel in the comments?


text:
How to replace SD card formatted as internal storage?
I need help..
I have a redmi 4a device, with android 7,
 I formatted a 64 gb ADATA SD card as internal storage, worked great for long, until after a restart the SD card is corrupted with precious data on it..
It says tap to format, but it doesn't format, I tried on my laptop and windows cd and Easeus partition manager, but none worked..
I lost hope to fix the SD card, but the phone isn't accepting to show photos or store any data, even with new card identical to the old is mounted.. it says unmount usb storage..
When I try to see a photo status on whatsapp, says can't download because no internal storage is available, please unmount it as a disk drive, and try again..
Also I can't see any picture sent to me in chat..
I tried to format the new card as internal, but same problem..
Any help?

In general fixing an sd-card with corrupt data should be done on raw disk not on partition level, overwriting potential corrupt partition data.
Assuming that the sd-card is physically fully working the best way to reset it is by overwriting the first blocks with zeros.
Unfortunately I don't know a good erase tool that works on Windows and that works on RAW disk level. On Linux this can be easily done using dd writing to the block device of the sdcard (e.g. sdb, sdc or something like this).
For Windows the Hex editor HxD may be an alternative if you know what you are doing. It allows to open the full disk in read-write mode and then you can overwrite the first few kilobytes. Just make sure you are writing to the correct disk (and not overwriting e.g. your main HDD/SSD).
Once you have managed to reset the sd-card eject it and then re-insert it. Then format it on the PC and apply then test it using the tool H2Testw. It fills the sd-card with dummy data and then verifies if the all the written data can be read.

thanks buddy.. and very sorry for replying so late,

I don't have a linux, but I inserted an identical sd card into my phone, but didn't work..
Tried to format it as internal, but still says turn off USB storage and try again..


text:
What does TWRP "Fix Contexts" do?
In my blu_spark TWRP, I have an option (under "Advanced") named 'Fix Contexts'.
When I press it, it says:

Note: Fixing contexts is rarely needed
Fixing SELinux Contexts may cause your device to not boot properly.

What does this option do, and when would I want to use it?

Zero one seems to have a good explanation

SELinux is a security mechanism which stops unauthorized access of processes to other processes, actions and filesystems (UNIX's "file" includes all regular files, directories, block devices, character devices, sockets etc.). Every process, file, directory and action is labeled with an SELinux context, then a policy is defined what a context can do to other context. Policy is loaded by kernel or init on every boot, and anything not defined in policy is denied by kernel. For more details see this answer.
Filesystem contexts are also generated along with policy. On Android both sepolicy and file_contexts are saved in rootfs / or /{system,vendor,odm}/etc/selinux/ directories. Filesystem contexts can be manually changed using chcon or from file_contexts using restorecon. Process can be run with a given context using runcon. init also starts all processes with a predefined seclabel in *.rc files. Some filesystem contexts are also set on every boot by using restorecon command in *.rc files.
Fix Contexts in TWRP fixes filesystem context labels from a saved /file_contexts file. But if this file is for different device or contains wrong or outdated or incomplete contexts, device may get into bootloop. Better avoid using "Fix Contexts", instead use chcon or restorecon manually if necessary. Or replace file_contexts in recovery ramdisk with an updated file from your current ROM.

EXAMPLE:
I have around 40000 policy rules on my device, one is:
~# sesearch --allow -s init -t system_data_file -c dir /sys/fs/selinux/policy
Found 1 semantic av rules:
   allow init system_data_file : dir { search read open ioctl write create getattr setattr relabelfrom relabelto mounton add_name remove_name rmdir } ;

Out of 2000+ filesystem contexts, one is:
~# grep system_data_file /system/etc/selinux/*contexts
/data(/.*)?    u:object_r:system_data_file:s0

SELinux context of init process:
~# ps -p 1 -o pid,cmd,label
  PID     CMD             LABEL
    1     /init           u:r:init:s0

SELinux context of directory containing system settings:
~# ls -dZ /data/system
u:object_r:system_data_file:s0   /data/system

So if /data/system is labeled with wrong context, init won't be able to perform search, read and open operations on the the directory and the device may bootloop.

DAC vs MAC:
SELinux is an implementation of Mandatory Access Control (MAC). Discretionary Access Control (DAC) achieves the same goal in less aggressive way by assigning UIDs/GIDs to processes and files:
~# ls -ld /data /data/system
drwxrwx--x   41 system   system        4096 Oct 21 17:40 /data
drwxrwxr-x   21 system   system        3488 Nov  9 13:36 /data/system

Permission mode and ownership explains that only processes running with UID or GID 1000 (system) will be able to read and write to the directory and normal apps (with UIDs/GIDs in range 10000 to 19999)  are not allowed to read system settings.
A drawback of DAC is that it's allowed by default and has a Super User (root  user with UID 0 is allowed to do anything). While MAC is denied by default and there is no Super Context, so it's less prone to exploits. Root user's authorities are also divided in capabilities to follow the principle of least privileges. Combined together, both DAC and MAC provide a more robust isolation, protection and sandboxing.


text:
Rooting the android subsystem on a Acer Chromebook R11
I already have my chromebook in developer mode.
I have play store apps enabled.
How do I root the android os on my chromebook, so I can use apps like AdAway?
I have tried the commands
sudo /usr/share/vboot/bin/make_dev_ssd.sh --remove_rootfs_verification --partitions $(( $(rootdev -s | sed -r 's/.*(.)$/\1/') - 1))
curl -Ls https://raw.githubusercontent.com/nolirium/aroc/onescript/RootandSEpatch.sh | sudo sh
curl -Ls https://raw.githubusercontent.com/nolirium/aroc/master/01Root.sh | sudo sh
curl -Ls https://raw.githubusercontent.com/nolirium/aroc/master/02SEPatch.sh | sudo sh

and I still get the following message from root checker.

background/source https://www.xda-developers.com/root-android-subsystem-chromebooks

"Please check the output of this script for any errors."


text:
What does the "Volume Level" in Spotify do?
What does the "Volume Level" option in the Spotify settings do?

I don't notice anything when changing it. A coarse volume level like this also seems redundant to the system-wide volume level.

I haven't used Spotify for a long while but from memory the volume setting affects the next song, not the current song.And you would need to disable Normalize Volume logically speaking.
This reddit says the same with more description

.... changing the volume level in setting will affect the next song you will listen to but not the one you are currently listening to


text:
Xiaomy (Redmi 4x) not synchronizing Calendar
I have a Xiaomi phone and almost since the beginning the calendar had sync problems. Until now they were most up to 1 week sync delay but now it stopped sync for good... I've tried to reset the phone, delete and reset the Google account, free up some internal memory space but nothing seems to work.
This problem happens both on the native Xiaomi App and the Google Calendar App so I believe the calendar sync is the problem itself.
The settings sync menu says it was updated today but no events show on the calendar...
Any help?
Thanks a lot!
UPDATE
After a new reboot the Google Calendar App started to work so I'm sticking with this App but if anyone can solve the Xiaomi Calendar issue please post an answer here.
DATA
Model: Xiaomi Redmi 4X
Android version: 7.1.2 N2G47H
MIUI version: 10.3.1.0 (NAMMIXM)


text:
Is there a reason to install, say, VLC from F-droid instead of play store?
I'm a fan/contributor/user of FOSS, but not an RMS-style purist. Is there some advantage I'd get installing OSMAnd or VLC, etc. from there instead of the playstore? Some privacy thing or frequent updates?
I'm basically worried that I'd be hurting VLC's exposure by not adding to their download numbers in the playstore with no real advantage for me or VLC or FOSS in general. I'm explicitly asking if I know an app is FOSS and ensure the author's the right one, why not download from the playstore?

Play Store releases usually get frequent updates (there is money involved). But wherever possible FOSS must be used and promoted. You and me are the community, so we have to keep the concept alive, if we really support it.

I can't prove this since I haven't used F-droid yet, but developers can also build different flavors for each store/download source, such as ad-free on XDA but ad-supported on Play Store.

As an enthusiastic F-Droid user (and, disclosure, Maintainer), one major reason I see is enhanced privacy: no tracking by the store, nor by the app. Other than in Play Store, on F-Droid "AntiFeatures" are explicitly named if present. More transparency hence.

I'm basically worried that I'd be hurting VLC's exposure by not adding to their download numbers in the playstore with no real advantage for me or VLC or FOSS in general. I'm explicitly asking if I know an app is FOSS and ensure the author's the right one, why not download from the playstore?

Given the second para of your question, where you are sure of developer, I would go with downloading from Play Store -:

Faster updates. Updates from F-Droid are typically slower than Play Store, more noticeable if developer updates app very frequently. For instance, check out open source email app "FairEmail" and see the versions on Play Store and F-Droid. Admittedly, this is an extreme example because developer at times pushed out 3 updates per day!
If it is a paid app, it is easier to use Play Store while installing on a new device.
Not sure of this but I have noticed that non Play Store apps are at times not backed up by Google and restored on new devices. Backing up and restoring has too many factors, so wouldn't weigh this heavily.


text:
Disable vibration in Samsung?
(Attention: Samsung's 9.0-Pie / One UI is different from stock Android)
Is there any way to completely disable vibration in a Samsung phone running their flavor of Android Pie (9.0)?
I already have Settings / Sound and vibration / Vibrate while ringing tuned OFF, but the phone still vibrates for various notifications.
The problem is that vibration makes this phone slide off whatever hard surface it's on.

Go to Settings -> Accessibility -> Vibration and switch it off

I don't see "vibration" under "accessibility". Are you also using Android 9.0-Pie?

yes men. my phone is running pie

can you share screenshoot in accessibility menu?

It's a bit of a hassle, bc I'm not using SE on my phone.

All my options are different from yours. I have: Screen reader; Visibility enhancements; Hearing enhancements; Interaction and dexterity; Advanced settings; Installed services

vibrate is in the accessibility menu and all android pie has this default feature

what model are you using?


text:
"No Photos" in OSX with PTP?
I delayed trying to fix this for a few years but now I'm having enough of it: photos on my Android phones do not show up in Image Capture/Lightroom/Photos.app on my OS X machines.

File transfer (MTP) mode works just fine. I can see the DCIM folder, the photos in it, and there is no .NOMEDIA file that I can find.
PTP sort of works I guess? The apps recognize the phone, but do not display any of the files.
Tried power cycling the phones, but no go.
Tried connection the cable at different stages, with the phone locked/unlocked, still no go.
Problem started with Yosemite/El Capitan/Sierra -- I don't quite remember which but a long while ago.

Anyone ever encountered this?

I have the exact same situation. Photos.app opens when I connect the phone but it says there are no photos on the phone.


text:
IMO Notifications on Home Screen Won't Go Away
I have a Samsung Phone with Android Pie and with IMO messaging app installed.
Every now and then I see a big pop-up notification on lock screen with nothing else. I have to press on the home button then unlock my phone.
I disabled IMO notifications by going to Settings > Apps > IMO > Notifications and turning off the Show Notifications setting.
That did not work, so I disabled the whole lock screen notifications from Settings > Lock Screen > Notifications and I turned it off.
It did not work either.
What should I do? What am I missing?


text:
Forced Factory Reset on Android TV (reboot loop)
My Android Sony Bravia has the boot-loop problem. It turns on, gets to the Sony logo, reboots, infinitely. Sometimes it gets to the android logo but never further than that.
So I am following the instructions from Sony, after about 20 trials and after reading that you are supposed to press the volume down button lightly I finally managed to see the green light. However after that it restarts and the loops simply continues. What am I doing wrong? Is this an indication, that there is a hardware problem? Can I deduce from this, that the motherboard is working, but that there is perhaps a faulty power cable? Or could this be a software problem?
I also tried to flash the firmware via USB, which didn't work.

Does the TV has an external or internal power converter? If it is external you may be right with the "faulty cable theory".

Its internal I think. Just a cable comes out the tv, which I plug in directly into the power outlet, no box.


text:
How can I change Outlook default image?
I have the application Outlook on my Samsung Galaxy Note 8 and I have several accounts, but both adresses start with the same letter (see picture below).

I would like to know how to customize these icons so that I do not confuse the two accounts. Thanks in advance.

Have you tried to set a profile photo to one of the accounts? In the end it does not have to be a real photo of you, just some image that then will be displayed in the app instead of the standard "M".

@Robert No I didn't because I didn't find a way to do this in the app, that's what I am asking actually, sorry if it wasn't clear.

Office 365 is a cloud service. It is totally irrelevant which client you use for changing the profile photo. Some clients may not support to set the profile photo, in such a case you have to use a different client, e.g. the web UI via chrome or your favorite web browser.

@Robert I changed my profile picture with chrome as you advised, but it didn't update on the app.


text:
TWRP ask for password - cant mount data partition
I want to install an open ROM like AospExtended on a new Xiaomi Redmi Note 5 with stock MUI. To avoid issues with Xiaomi's anti rollback mechanism, I'd like to boot TWRP then copy its image and install it permanently as described in many posts like here.
But TWRP can't mount my data partition, it asks me for a password. I had none set. Regarding to this post I tried setting a password for the lockscreen. Altough he has the same problem with an older version of android, it doesn't accept the password.
Some threads like this recommend OrangeFox instead of TWRP. But the 9.0-1 shows the same behavior:

With 9.0.2 of OrangeFox it doesn't ask for password any more, so this seems to work. But why isn't it working with TWRP? This post said it's fixed in 3.2.3_1. Since I booted 3.3.1-0 like this:
> .\fastboot.exe boot D:\Downloads\twrp-3.3.1-0-whyred.img

This fix should be included. As a workaround, I'll try OrangeBox (especially in regard to OTA updates, havent tried OrangeBox before). But I'd like to know why those problem exist with TWRP and how could it be fixed?
I've used TWRP over the time with different devices and it always worked well (also with OTA updates).

i have experienced this with two other Xiaomi devices. first i could track it down to older unofficial variant of twrp 3.2.3 which is still decrypting with default password when official twrp 3.3.1 fails. so implementation of decrypting differs from each build, sometimes it is just a missing line in fstab, sometimes they forgot a flag during build.
But this is not the full explanation. Recently working twrp started to fail after MIUI OTA update. This means the encryption depends on ROM (system or vendor) therefore these partitions need to be mounted for decryption (which twrp normally does automatically).
encryption security may have changed/improved with new android version and twrp has not implemented that in your build. I have also seen twrp variant which does successfully decrypt userdata but does not mount /data because of a wired parameter related to disk quota. Flashing a disk quota disabler may help in this case. basically its a try and error to find a recovery which is working - which you have found.
Your question is therefore ot and should be discussed on github or developer boards


text:
Reclaim space occupied by an uninstalled app
I have recently uninstalled Economist.
According to Settings -> Apps, it was taking up ca. 530Mb in data (from the internal memory).
After uninstalling, I did not get that space freed.
Is there any way to reclaim that space, without installing any utility app?
I have seen Clean Master is mentioned a few times. I am not certain who of those mentioning it actually tried it, successfully; and it seems to be quite annoying.
I cannot root the phone.
Related, but not providing an answer:
I uninstalled an app,but did not clear space
Manage files left by uninstalled apps?
Why my phone is always out of space recently, but I didn't install any new software (I tried

$adb shell

su -c "du /data" | sort -n

but my shell doesn't have su)
Completely uninstall an app on Lollipop
Why doesn't uninstalling an app free all the space it had used?
How can I reclaim space used by the defaul email client
(I reinstalled The Economist, to see if Settings -> Apps reported again the same occupied space, so I could Clear Data from there; but not it shows a mere 15Mb of data).
spy / invisible file occupying 4gb+ space in internal storage
Space deleted but not reclaimed for re-use
What else is occupying my android phone's internal space

You don't need to install any cleaners, they can't free space fro you except clearing apps' caches. That you can do yourself too. Android's package manager itself deletes all files related to an app when it's uninstalled. But sometimes the space usage is not updated immediately, even sometimes until restart. However, there is no way to verify how much space an app is actually taking without rooting phone: https://android.stackexchange.com/a/216132/218526

Try SD Maid, in my view best possible option. Been using for years. Corpse finder option in that specifically targets your need. Without root ss @IrfanLatif said, no way

@beeshyams - Thanks. I did not understand... does SD Maid need root or not?

@IrfanLatif - I am certain the space I am talking about was never recovered. I would have noticed 500Mb+ space.

@sancho.sReinstateMonica right. But (un)fortunately no app including SDMaid can scan outside /sdcard without root access. Actual app space usage is in /data partition. See given link for explanation. If the app can explore files or provides commandline access, you can see exact size of only its self owned files in /data/app, /data/data and other directories.

SD maid can work with /without root. As @IrfanLatif made it clear , you can't expect full results without root but since your device isn't rooted SD maid can reclaim what it can. Recommended that based on reputation of app + my experience// Ah, I see the confusion now, sorry for the typo for "ss" read 'as" in my first comment

Just out of curiosity, is there anything in /sdcard/Android/obb?

@beeshyams - @IrfanLatif mentioned that no app can scan outside /sdcard without rooting. Would you agree?

Yes. @IrfanLatif knows what he is talking about

@beeshyams sir I'm honored. @sancho.sReinstateMonica /sdcard is actually /data/media/0. So by "outside /sdcard" I meant in /data partition. Apps can scan or access other partitions partially or fully including /system and /vendor.

@beeshyams - Thanks. I was not clear from your answer whether you meant that specifically or not.

@IrfanLatif - Thanks, will try and post feedback.

@DeathMaskSalesman - In /sdcard/Android/obb I have a few dirs, like com.avast.android.cleaner, com.facebook.katana, ...

@beeshyams - Is SD Maid also ok for files in the internal memory? (The name SD may be misleading then)

oh, yes, the name hasn't got any bearing


text:
Access WiFi Beacons from Android Application
I was wondering if an android App can have access to the beacon data of the nearby WiFi access points (AP), while the phone is associated with a WiFi AP.
Note: I do not want to root the phone or use startscan because it is going to be removed in a future release. I skimmed through WiFi RTT API but it does not seem to provide any other beacon information than RSSI and BSSID.
Thanks for any hints or clues in advance!

As there are several such apps available, I'd assume it's possible, yes. Cannot say if each of your details is met, though :)

@Izzy thanks for your comment. As far as I looked into your link, I only found Bluetooth or BLE scanners. I am interested in WiFi beacons only. WifiManager scanning cannot be triggered using app in a future release, and my guess is that all the WiFi scanning apps use this API and will soon fail. Also I am wondering if it is possible to limit the scanning frequency range.

Argh, OK – I must have missed the WiFi part and just seen the "Beacon" keyword. Sorry, no idea, I'm no dev…

I was also looking for this as well and I found this thesis submitted in 2015. They were able to get IEs using Android NDK. I still haven't tried it yet. Also if you have found some other solution could share it.

No I have not found a solutions yet. Thanks for the thesis reference. It is mentioned on page 61 that: "The disadvantage is the problem that currently the extended API is not part of the official Android source (AOSP) and therefore the only possibility using it would be by updating the current Android via Fastboot Mode27 or by replacing the current Android operating system with a version that was built with the changed source"


text:
Can't move or share files in My Files app
just downloaded some mp3 files and needed to move them from downloads to my music folder. not sure if its because of the new system update, but for some reason there is literally no option to move, copy, share - nothing. just move to secure folder. i tried that but all you can do is move the files out of the folder once theyre in so that was worthless. i can select them or select them to edit or select them to share. no options come up except 'move to secure folder' or 'compress'.

went to app settings and cleared the cache for my files app. when i went back to the app i was able to see all of the file options (move, copy, delete, etc) again.


text:
Check the last time the SD card was inserted/used on Android phone
I have obviously not been paying attention to the fact that I no longer have an SD card in my Samsung Galaxy S7, that I know used to be there. I just recently discovered that it is missing, and now I am paranoid that someone has removed it in order to look at its contents.
I am hoping that there is some way to check the records in the phone and see the last time an SD card was inserted, or to see a timestamp of when it was last used, to help narrow down when it went missing.

check notification history https://www.guidingtech.com/53398/view-android-notifications-history

thank you. I did try this, but there is no settings widget that I can select from. The closest thing I can find is going to the Novo Launcher Activity widget, and going to its settings, where I can scroll down past about 150 other settings Activity options until I can chose notification log. However this only shows notifications until about 2 days in the past.

in /data/system/storage.xml is a creation date not sure if this is resetted when sdcard is missing

I'm sorry for the late reply. I've been struggling to figure out how to read this folder for the past few days. I downloaded an app called FX File Explorer to access /data/system/storage.xml but there is no way to read the folder or download it. Do I need to go about rooting my phone to view this? Or could you recommend an app that works?

sorry, forget it. yes, only with root access, but its not worth it. there is nothing helpful in this file. sorry for misleading. wait for someone how know answer, i just spread "Gefährliches Halbwissen"


text:
Dalvik vm heap props resetting on reboot
I am running android 9 and I tried changing heapsize prop by the following command
setprop dalvik.vm.heapsize 384m

and then verifying by
getprop | grep heapsize

which returns 384m so it works.
But after a reboot the value returns to its default 768m.I also tried to modify the build.prop file by adding the lines but still the props revert on every boot (the file itself still shows the change).
Any help ?

Did you wipe dalvik and cache after changing?

yes I do, and it works without even wiping on other devices. I guess this is something specific to pie because of added ART stuff. This wasn't happening in marshmallow.


text:
What folder are Google Podcasts downloads stored in?
I want to pull some podcast downloads off my phone, and put them on my computer.
I have plugged my phone into my computer's USB port.  What folder can I find my Google Podcast downloads in?  My computer is showing a lot of folders with cryptic names :-(.
I am looking in my computer's file manager, "Nokia 6.1" -> "Internal shared storage".  I do not have an SD card in my phone.

My computer runs GNOME.  I have connected to the phone using USB (MTP) before, and it worked great.  That was for some different files though :-).
Phone version:

Device name: Nokia 6.1
Model & Hardware: TA-1050
Android version: 9
Security patch level: 1 October 2019
Kernel version: 4.4.153-perf+
Build number: 00WW_3_54H_SP03

I bought the phone as new, and I have not rooted it.

I get it what you are trying to say, but I see no point in keeping X amount of questions lying around when the dupe target already answers them. All the user has to do is to take a step and see in which location (among the ones suggested by answers there) their target data might be lying. In a way, this as well answers where FB stores downloads, where a slides app stores slides, etc. Feel free to argue. If you feel the question should still remain open, you can also argue on meta site. :)

@Firelord Apart from how I am expected to associate com.google.android.googlequicksearchbox with Google Podcasts, the duplicate can't possibly answer my question. It doesn't mention /data/0/ anywhere, and that's the only path to accessing these files over USB.

@sourcejedi Mapping an app label to its package name is a separate question. Why Google Podcasts (com.google.android.apps.podcasts) is saving its data to Google app's (com.google.android.googlequicksearchbox) directory is a separate question (how and why Google's apps rely on each other and how apps share data with each other by sharing UID or using other methods). Accessing /data (/data/0?) over MTP is an impossible case. So in my humble opinion your question doesn't contribute anything new to community which isn't already answered.

data/user/0/com.google.android.googlequicksearchbox/filesvelour/feature_data/wernicke_player/downloaded_episodes

Found using the Disk Space Analyzer on my GNOME computer :-).
This is the only folder that appears in data/user/0/.
Apparently, there are a lot of other folders that might look similar, but would not be accessible by other non-system Android apps, and would not be expected to be accessible through USB either.  But my Android is quite happy for me to access this specific folder through USB.
I have enabled "Developer options", but I have not used it to change anything AFAIR.  If I disabling "Developer options", I can still plug my phone in and access the above folder using USB.

Unless I'm mistaken /data/user/0 corresponds to /data/data/ which can be accessed by a user only through root.

@Firelord ? I completed my task successfully.  I don't run the GNOME file browser on my laptop as root, that's a terrible idea and is/was absolutely not necessary :-).

As @Firelord said /data/user/0 is actually /data/data. Any directory inside that is either accessible to root (UID 0) or system (UID 1000; can see directory only) or the app itself. SELinux restrictions are in addition to this. Which Android version are you on?

@IrfanLatif If someone tells me they've tested this, accessing their own phone's internal filesystem over a USB cable, I'll dig up my exact software version. (Seems to me like the  USB MTP host is running with all necessary privileges).

@sourcejedi interesting. MTP relies on MediaStore which indexes files from /storage/emulated/0 and external SD card. Other contents on /data aren't scanned at all (neither are accessible). So there's something very exceptional happening on your phone.

@IrfanLatif thanks for your response! I have edited further details into both the question and the answer.

For clarity, the many cryptic folders I first tried to look at were in Android/data.

Android/data is /storage/emulated/0/Android/data which is obviously accessible to apps as well as MTP (which is also in fact an app). The point is that /data or any of it's subdirectories (except app's own private directory) are not and should not be accessible to apps, adb, MTP or any other possible access method. Such open access breaks Android's security model and must be considered a high priority security vulnerability.

I was searching for this info myself today. After plugging in my phone, I was able to locate the downloaded podcasts here: \Internal storage\Android\data\com.google.android.googlequicksearchbox\files\Podcasts\Downloads


text:
How to exit KDE connect
As simple as the title states - How to exit/kill the KDE connect app when I don't use it. Even if I kill the app from task manager (not sure if it is the correct term) I still see the notification in the notification bar which I assume means the app is still running in the background.
I found answers on how to turn off the notification, but I don't want to do that.
I want the notification visible when the app is running.

The app uses a small background service that is active independently of the GUI. Depending on the Android version you can enable the "Background Restriction" (disallow running the app in background) in the app's settings (not the one inside the app, but the one provided by Android settings).


text:
Forward calls to messenger
Is it possible to forward network calls on an Android mobile phone through a messenger, like Telegram or Whatsapp, to a set contact?
Could IFTTT be used for this?

Call forwarding is a telephony or carrier function. It works amongst voice networks or some VOIP sites. For it to work with messenger apps:

They should mutually allow it, which is unlikely given the revenue models of voice calling (at times call forwarding is a paid service even for voice networks) .
Security concerns - for example, if the calling number cannot be identified across messaging apps, it would not be permitted. There could be more such scenarios.
Encryption. Voice calls of WhatsApp are encrypted. Same is the case with
Telegram.
They would not like to expose or let others use their proprietary encryption.

There may be more reasons too. Only after it is legally and financially viable a messaging app will expose an API that can be used for this. Till such time this is possible, automation is ruled out irrespective of the app


text:
Finding WPS pin without accessing router
So my android phone is not rooted. I have username and password of my friends WPS enabled wifi. So now if I want to view it's WPS pin remotely is it possible without root?
(EDUCATIONAL PURPOSE)

The WPS PIN technology is fundamentally broken and should be disabled in any Wifi. Anyway a simple Google search would have pointed to dozens of posts describing how to hack WPS PIN for example: https://null-byte.wonderhowto.com/how-to/hack-wi-fi-breaking-wps-pin-get-password-with-bully-0158819/

i wonder this is android question

maybe related to your question if you don't care about WPS Pin https://android.stackexchange.com/questions/218514


text:
App Passwords Sync between devices
On an Android device, if we sign up on any app, the password gets automatically stored on the Google Account. With this, we can use Google Chrome to access the saved password on Desktop too. Can we do this with other browsers too, like Microsoft Edge or Firefox, if we install it on both, the Android device and the Desktop ?

Firefox has it's own sync service with an Google-independent account (Firefox Sync). If you enter your Firefox account credentials on Android and Windows/Linux you can also sync your settings and passwords.

no i meant individual app passwords, like if i log into Instagram, the password somehow gets synced with the Desktop version of Google Chrome. So I'm asking, how to make it work with other browsers too @Robert

You are misinterpreting the functionality. There is no synchronization of apps between your Android and your desktop. Only the web browser Chrome syncs it's data between the two platform because you are logged in in both with the same Google account. The same works for some other web browsers but this is totally independent of Android.


text:
Firefox for Android doesn't autofill saved/synced paswords since installing and uninstalling external password manager
Firefox sync was working on all my devices as my logins and passwords were perfectly synced. The problem started when I was offered to install the Lockwise app on Android. Where logins were available in the Firefox for Android app they wouldn't sync with the Lockwise app, the syncing went in an infinite loop and did not sync anything. Reinstalling or rebooting did not help. From this moment Firefox for Android offered to fill in the passwords from the Lockwise app, but since there were no passwords synced, there were none to fill. So I decided to uninstall the Lockwise app and go back to Google Autofill service for my global Android password management. But in the Firefox for Android app (which I use the most) I still like to use the build-in Firefox Sync autofill feature like I used to before installing the Lockwise app. Firefox for Android does not offer to fill in any password information anymore. When I look in Tools > Logins all my passwords are there, perfectly synced.
After some research I checked if the following about:config booleans were enabled: and yes they were.
signon.autofillForms
signon.autofillForms.autocompleteOff
signon.autofillForms.http

Firefox for Android version: 68.2.0

External autofill apps change a certain boolean in the Firefox for Android configuration variables, this "setting" can only set back to the old setting by completely uninstalling and reinstalling Firefox or (better) by changing a variable in: about:config

goto about:config
search for: dom.forms.autocomplete.formautofill
set it back to true
refresh your login window and... fixed!


text:
Strip /lib from installed apk
Most apks have a /lib dir inside with .so files that can be several megabytes. Some even come loaded with libs for different architectures (arm, mips, x86). Libs for relevant arch are copied in /data/app-lib/[package name] at install time, so they take double the space.
I tried to strip the apk from the /lib folder, rewrite, zipalign and put back to install location /data/app or /system/app or /system/priv-appto reclaim some space.
Tried with Chrome v78, it went from 45 mb apk to 15 mb...
Other apps too.
Everything seems to work.
Anyone thinks it's a bad idea? IMO the very Android system should perform this operation by default at install time...
edit 13 Nov
I wrote a script to automate the strip operation, just have to copy the apk to strip in a dir where this script resides, along with zip and zipalign binaries.
#!/system/bin/sh
for filename in `find . -name '*.apk'`
do
        ./zip -d $filename "lib/*"
        ./zipalign -fv 4 $filename $filename.new|tail
        mv $filename.new $filename
        chmod 644 $filename
done;

On my device I can swap original with stripped apks on the fly and they (usually) run fine  without rebooting, even system apps.

Based on my experience, modifying an APK file after the installation is not a big problem as long as you don't touch the DEX files. Especially the native libraries for other architectures than the one of your device can usually be stripped without problems as they are totally ignored after the installation.
However there are apps that implement extra security checks (usually banking, finance, streaming apps with DRM or otherwise extra hardened apps) that performs some sort of self-test to check whether they have been modified or not. Modifying those apps will end up in a non-working app.

How is this part handled exactly e.g. to not break future updates from original developer? "During validation, v2+ scheme treats the APK file as a blob and performs signature checking across the entire file. Any modification to the APK, including ZIP metadata modifications, invalidates the APK signature." Any thoughts? Retaining original META-INF folder and AndroidManifest.xml should work?

@Irfan Good point, however the APK v2+ signature is not the problem as the APK file is AFAIK not checked after it has been installed. However the Google Play Frosting signature will also be destroyed/removed by modifying the APK file. Therefore Google Play may complain that the modified apps are not genuine. But I am not sure what and when this Forsting signature is checked.

APK signatures are checked after app is installed: on update. To me that seems to be the only (or at least major) purpose of signing apps. Otherwise those are self-signed, can't be verified against a CA. And (if not downloaded from Play Store) there's no way to confirm if an app with certain package name is from original developer. Anyone can develop app with any package name signed with his/her own certificate. Contradiction occurs on update. Or am I going in wrong direction?

@Irfan I have not tested it but it in theory it is not necessary to verify an installed app before you update it. As Android already has verified the APK file at installation time you could simply extract the certificate without verification and compare it with the certificate from the update to-be-installed. Or even more likely the package manager uses the certificate data from it's cache e.g. /data/system/packages.xml.

Got your point. Updated version is verified against pre-installed app's signatures but the old app itself isn't re-verfied (most probably). It makes sense because pm would be using signatures from packages.xml. Thanks.


text:
How do I open an offline website on Android?
I have a directory with some .html files, some .jpgs, an index.html file, and some other stuff. If I drag the index.html into chrome (or other browsers) on my desktop PC this static/offline website will display in the browser and I can navigate the site without issues.
When I go to the same directory in Android Pie and open the same index.html file in Android-Chrome I get the error "file can't be found". I've tried other Android browsers with the same result.
In Android File Explorer the directory (and respective file) appear as:
/Internal Storage/my_site/index.html

How can I open a simple static offline HTML website on Android? Is there a specific app or browser I need to use?

You need to enter in Chrome address bar file:///path/to/file. In case you aren't sure about the path use any file explorer that tells you the path.
In this case it is file:///storage/emulated/0/my_site/index.html
Also many file explorers including MiXplorer offer to open .html files with all supported apps (registered mime type):


text:
Force stopping bloatware apps on android phone
I don't use Facebook and don't intend to. Can I force stop on android phone (LG Stylo 4) without destabilizing anything else? I have installed WhatsApp which I know is owned by Facebook but which I think (hope) functions independently and hopefully would not be impacted by stopping Facebook.

You ca simply disable and/or deinstall the Facebook app. That will permanently stop it.

Yes, WhatsApps runs separately from Facebook, despite them being owned by the same company. You can safely force stop Facebook.
If you don't intend to use Facebook, the more logical solution is to remove it, which will prevent it from doing anything and free up space.


text:
Is SIM network unlocking using app normal if phone simply expects a code?
I bought a rare version of Galaxy S10 which was out-of-stock in my country so the distributor got it for me from another country. But by mistake the phone is locked to original network operator in the country of origin. I was offered to send the phone back for unlocking/change but it can take a few weeks. So I decided to try online unlocking service. All looks good except of the requirement to do the unlocking via side-loaded app instead of entering the code directly. Is it normal that the 8-digit unlock code does not work directly in unlock screen but it needs a helper app?
Their e-mail after purchase of unlocking code contained instructions similar to these:

Please make sure that your phone is on the stock factory firmware. Unlock code will work correctly only on the stock factory firmware.

Connect your phone to Wi-Fi network and download and install  official Unlocker tool:
https://www.htconlineunlock.net/---path-was-removed---
Power off the phone by long pressing power button and then Power off icon.
Remove the sim card from the phone and switch on the phone.
Run the Unlocker tool you installed.
Tap 'Proceed' button. Wait until your phone communicates with servers.
The phone will ask you to enter SIM Network Unlock Pin. Enter the code, tap 'Unlock' button and wait for result.
Message "Your device is now unlocked" appears. Long press the power button, choose 'Restart' and confirm.

They claim they bought the code directly from the operator. So why direct unlock does not work (I made one attempt) but I am instructed to run an app?

there are lot of unlocking apps in Play Store i don't think it is unusual. It is just a service they provide own app, but all do the same job. if the code is not working ask for a second code, if still not working get your money back https://forum.xda-developers.com/showthread.php?t=2388668

@alecxs – honestly I do not understand this: if there is a direct input of the code, what are all these apps for?

@miroxlav the code they told you wouldn't be genuine. Might be their app is getting actual unlock code from their servers by sending your IMEI and then feeding that to modem through telephony/RIL APIs. But I don't think that would work without system privileges. I suggest you be careful when installing such apps, particularly if that's asking for some sensitive permissions and internet connectivity.

Related: How does carrier/network lock work? How is it implemented?

not every device may have "direct input" (system app) it depends on ROM

If you feel suspicious with the app, you can try to upload it on VirusTotal.

Such unlock apps aren't official.
They employ various methods of unlocking based on the information they gather from the app installed and querying from supposedly authentic database of unlock codes.
I have personally used an unlock service for an iPhone which was locked to a carrier. I needed to supply device information and within a few hours they reverted with the code, which worked. All at a pittance of $10. I chatted with them and they revealed their modus operandi. Official unlock codes are obtained (read stolen) from the carrier database and these operators pay to obtain these. Payment is done only after unlocking is successful.
Bottom line is that there is nothing official or expected in such methods. If it works, good, else ask for refund


text:
What is the folder called /storage/emulated/0/.photoShare/thumb/lcd

I have a folder named lcd or Icd (can't tell if it's a lowercase L or an uppercase letter i) which is inside the Hidden Folder called photoShare.
It contains over 300Mbs of images, all of which seem to be duplicates of images elsewhere in my Android Phone (Honor 9 lite).
There is a .thumbs folder beside it. It's 30 odd Mbs and is full of images too.
Oddly, despite many Google searches using every combo of words possible, I can find no mention anywhere of a folder called lcd/Icd, not one mention anywhere.
Question being,
Is it safe to delete the images inside /.photoShare/lcd/Icd?

it is safe to delete complete folder .photoShare. thumbs are smaller version of pictures for preview, they will be recreated anyway

@alecxs you mean "it's safe to delete the whole folder .photoShare"

yes, hidden folders with .dots are usually temporary files

.photoShare is a folder used by Huawei devices for it's Cloud service.

If Huawei's Cloud is enabled on your device, your gallery may have been synced to your Huawei's "personal" cloud storage.
You can turn off the cloud backup option for your photos, but maybe you need this service in case of emergency, where you accidentally deleted your pictures, at least you'll be able to restore what was synced before in the cloud service.
It's safe to delete the folder, but doing it from settings will be better to avoid any data loss if you're syncing your folder with the cloud service.


text:
gdb in virtual emulator
I am testing some code for an Android device, emulated with Android studio.
I would like to debug the c code ("POC") with gdb (which is not included in the binaries of the device) to find where it is breaking.
While debugging I will be connected through adb to emu device. My question may sound trivial: Is it possible to install gdb and how without packages like build-essential etc? What needs to be done? Just copying my gdb binary will definitely not work.
I have found something similar, when you are building another rootfs in system, concrete Debian https://github.com/corbinlc/GNURootDebian

https://developer.android.com/studio/debug/index may provide some assistance. Installation of debuggers on android has nothing to do with security, so I vote to close.

I mean debugging from command line and debugging C code built by android NDK

Andorid NDK should contain gdbserver for your Android architecture which runs on-device and allows you to connect a gdb instance from your host system. https://source.android.com/devices/tech/debug/gdb


text:
Disable Chromecast audio interrruption/autopauze when using camera, microphone or receiving phonecall
I know some people like the auto-pauze function when receiving a phone call so so they are not interrupted by their own music playing. But I am personally very annoyed by that function. When I'm listening to the radio (streaming trough Chromecast audio) I do not want my live stream to be interrupted because I make a photo or video, ask something to my phone or receive a phone call. When I'm listening to a podcast it doesn't even resume after using the camera, the podcast just restarts from the beginning. Very annoying.
After some trial and error I discovered it is the app who plays the audio that interrupts it on an event, not Android itself. Yes it's a bad app that does not offer options to disable that function but its the only one available as it is from the national government. So my question to the community is if there is a way to block the events (camera, microphone, phone call) from being noticed by the app streaming to my Chromecast.
ps: the app(s) I'm referring to are the ones from VRT/RTBF (Belgian national radio).

Possible if your device is rooted

good news, my device is rooted, with magisk. soo tell me how?

You need to install EdXposed (see https://android.stackexchange.com/q/218179/131553) and then Xprivacy Lua module and deny that app those permissions. If you have issues ask in the Xda thread of module. But note that it will work only if the app is using Java and not some obfuscated code


text:
sysui_nav_bar element that does nothing? (create a dead spot on the navigation bar)
For accessibility reasons, I want to create a dead spot on the bottom right corner of an Android Pie phone (Xiaomi Mi A3) so that touching it does nothing.
The phone comes with new style 2 button nav and pill shaped home button. I've tried to customize the nav bar with the "settings put secure sysui_nav_bar" trick and I've managed to get the buttons I want but cannot create a dead spot on the right side (or anywhere) because it always treats the left and right side as part of the nearest button, even if you add a "space" element there.  The best I've come up with is
adb shell
settings put secure sysui_nav_bar "back;space,home,space,space,space;recent,contextual"

This creates a left-justified nav bar, with the contextual button on the right acting as a dead spot EXCEPT when the contextual icon actually appears.
What I need is an element that does nothing, or perhaps one that practically no app uses any more so it effectively does nothing. Is there such a thing?
thanks

Simply removing the "contextual" part from your command seems to achieve what you need.
i.e.
adb shell
settings put secure sysui_nav_bar "back;space,home,space,space,space;recent"


text:
Switch "Google page" off on Android
I got Huawei P30 lite with Android 9. There is a page on the main screen (if you swipe right from Home) which looks like combination of Google assistant, search, news, weather etc..
What is it called and how to remove it?

Here are the instruction from Huaweihub on how to disable Google Feed on the P30 Lite

Hold your finger on an area of blank space on the Homescreen.
Select Homescreen Settings.
Locate Google Feed, then swipe the adjacent toggle from On to Off.

Original article here: How to disable Google Feed on the Huawei P30

Thanks! This works on an LG GPad 5 as well :)


text:
Where is info from /proc/dumchar_info used, on MediaTek devices?
There are plenty of instructions for changing partition layout on Android, including MediaTek devices, and they say I need to edit MBR, EBR and a ‘scatter file’ and to feed the latter to SP Flash or MTKDroidTools. However, as noted in an answer to “Where does the partition information in /proc/dumchar_info come from, on MTK devices?”, the MediaTek-specific /proc/dumchar_info can't be changed with those means.
Thus the question, where is info from /proc/dumchar_info used? And if it doesn't reflect the actual partition layout and doesn't agree with MBR, EBR and the ‘scatter file’ then what effects should I expect?

Mostly recent devices (with eMMC or UFS) have GPTs. dumchar_info is only specific to MTK devices with MBR partitioning scheme (EBRs allow to have 4+ partitions). Since proc/dumchar_info isn't a standard interface which AOSP code expects to be there, so it depends on the ROM you are using, whether it's reading partition info from the said file in userspace or not. Neither AOSP requires /proc/partitions from Linux kernel to expose necessarily. But programs like blkid and e2fsprpgs may depend on this.

However the proper way to update partition table should be to build everything with updated headers; preloader, bootloader (U-Boot/LK), boot kernel, recovery kernel and scatter file to be used later for flashing.


text:
My computer doesn't recognize my phone, neither on ubuntu nor windows
I own an LG-K430T, and I use it to share internet with my Desktop PC through USB tethering. Or I did it for a year straight until today, when my PC isn't recognizing my phone anymore, neither on Windows 7 nor Ubuntu 18.04.2. It doesn't even allow to share files, since there isn't a pop-up(neither in the phone nor the PC), but the phone does charge. I thought it could be my USB cable that worn off, but using this same USB cable with my sister's Huawei, it does allow to share files/internet. Furthermore, I tried with 3 different USB cables and different ports, and my phone still isn't recognized. Then, I tried it on Ubuntu, and to my surprise, it's still not recognized. So, I think it's safe to say the cable isn't the issue, nor the operative system( Also, I restarted both the phone and the PC) Then , In ubuntu, I tried to enable USB debugging followed by lsusb and nothing yet. My phone was last updated in april 2019 and its android version is 6.0, so I don't have a clue about what's causing the issue, although I'd blame the phone..
On windows,I have tried to update drivers of the 'Unknown device' on Device administration, but it says they are already up-to date
EDIT:
Answers to comments: lsusb output:
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 007 Device 002: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 003: ID 1004:6344 LG Electronics, Inc. G2 Android Phone [tethering mode]
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 002: ID 04f9:0413 Brother Industries, Ltd
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 002: ID 04f3:0235 Elan Microelectronics Corp.
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 009 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 008 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

(THE LG PHONE THAT IS TETHERING IS ANOTHER ONE, DIFFERENT FROM THE ONE WITH THE PROBLEM). So, in short, lsusb doesn't recognize it.
The MTP option looks already enabled
Further info
The other day a guy enabled USB debugging on my phone and got his computer to read its files!(He had a version of Windows). When I got home it worked too in my Windows! Then it downloaded some drivers and asked to reboot, which I did. After the reboot, I tried tethering and didn't work(The option to turn on was there, but when turned on, nothing happened). I thought it was because of the USB debugging and disabled developer options completely. Unfortunately, my PC stopped recognizing my phone. I said, "well, at least I can now share files..." but, surprisingly,when I turned USB-debugging back on nothing happened. Now, there is a difference which I observed between his way of activating USB-debug vs my way. It is that in his way the USB-debugging is shown active both on Settings AND in the Notification Panel(in a permanent way, i.e. it doesn't go if I press "clear all" notifications), while when I activate it,no message is shown in the notification Panel. He must have done it differently to give it more priority or something...

What is the output of lsusb. See this for help https://android.stackexchange.com/q/144966/131553

If your phone is not visible via lsusb it may have a damaged USB port (e.g. loose connection).

when connected, in developer options scroll down to usb configuration and select MTP

Just in case it's missing, download and install OEM USB Driver for Windows from the official LG site.

@AndrewT. Unfortunately there's nothing for my model there.

I think it should be universal, ignore the text box and the product category, just scroll down until you find "Popular Software" and "LG Mobile Drivers".

@AndrewT. Just installed them but nothing has changed.Curiosly enough, my other LG phone is recognized and some drivers are downloaded for it(Note:I disconnected both first, then installed the drivers, then tried with the bad phone, then connected the good one)

This is one of those things that can be tricky to fix I think, because there are multiple points of failure (getting 2 different hardware devices to communicate over USB through 2 further operating system layers). But as AndrewT mentioned, my guess would be the drivers.
If I remember correctly I've had several episodes before of playing musical drivers + USB cables. I'm pretty sure what ended up happening most often was I'd finally get a successful connection upon switching cables (after focusing on reinstalling drivers over & over for a few hours). I also recall one time, the solution was switching from the USB 3.0 port I was using to a 2.0 port which fixed it instantly after hours of madness trying various drivers and cables.
You said you've tried a few of each of those though. One thing to keep in mind is it can be surprising just how picky your phone can be in terms of the cable you use. A couple times I've tried at least 4 or 5 different (microUSB) cables, switching back and forth and alternating with yet another driver install only for it to keep failing. Then when I eventually desperately dug a spare cable out from the couch cushion or something, it suddenly worked like a charm. I confirmed it on those occasions too by going back to each of the previous cables once I was 100% sure everything was indeed working, and sure enough, they all refused to work; only the weird, thin, chinese crap cable from who knows where seemed to do the trick. Android can be extremely picky, that's sort of the gist of what I've seen anyway.
Your "Further Info" makes me believe even more that it's probably your drivers though, if you know for sure that the connection stopped working following a driver update, and knowing that it DID work prior to that. The final thing I can offer is that I've ran a few LG phones over the years too, and I think they're particularly bad with fragmenting the driver situation with their own driver packages & LG-branded "Control Center" or "USB Tool"-type apps. While the android Universal Drivers have generally worked for most of my phones most of the time, I want to say you should try looking for any & all alternative drivers out there, especially if you can find some from LG's site specifically - that might be simply the only thing that will work, while all of the other usual "Universal" android software packages out there won't (for whatever reason).
But yeah... keep experimenting, try as many different connections as you can in The Trifecta (drivers, cables, USB ports), borrow some friends' cables or computers if you have to. I bet a single lucky one of them will suddenly work like nothing was ever wrong, and likely for no reason, as frustrating as it is.

I had the same issue with my rooted LG G2 D802. I run a heavily modified by me stock KK ROM, Xposed, modified kernel, boot image, busybox, init.d, build.prop, system files, xml, apks, db... and everything you can think of. I like to understand what every single file on my system is and does, and thought I've gone too far and broke things.
Had Developer Options and Debug USB enabled, so at least I could see it tru adb devices and adb pull / push files to and from PC, also adb shell to explore it (for conveniece I use ADB Putty https://github.com/sztupy/adbputty/downloads). USB tethering would definitely not work though.
When in TWRP recovery, phone was recognized no problem in Windows, and I could browse tru sdcard as usual.
I also tried different cables, computers, usb ports, operating systems, drivers, but nothing. Now I'm reasonably sure the issue is to be found in some corrupt data inside the smartphone. I say this because now my device works again in MTP mode and all the other available connection modes.
How did I solved the issue? Unfortunately I don't know exactly.
What I can say is that I was trying to solve an apparently blatant hardware issue, with the screen flickering, freezing to white noise, especially when warm (not even hot), and when fast scrolling. This screen problem happened for the first time about one  month ago, the connections issue was more than a year old, so the two are not related.
Disassembled the phone, disconneted and reconnected the screen connector. White noise / freezing problem still there (disabled animations in Developer Options as a work-around to flickering issues).
Entered TWRP recovery, tried the usual stuff Wipe Cache / Wipe Dalvik, noted that /data partition was non mounted as r/w (infact /data/dalvik-cache was non actually deleted), tried Fix Contexts, rebooted. It took a long time, was rebuilding cache or something else, welcomed by the dreadly dialog
UIDs on system are inconsistent
You need to wipe your data partition or your device will be unstable
[I'm feeling lucky]

Ok, at this point found many /data/data folders empty, so I had to open every app interested and reset things to my likings, not a great deal. Fixing the inconsistent UID thing was a bit trickier, had to read into /data/system/UIDerrors.txt to find the culprit app, and changed UID accordingly in respective /data/data folder.
After this my system was stable and MTP connection worked again.
I know it's not what you want to read, but with a backup + factory reset you will restore MTP functionality.


text:
recover WiFi password file Android Pie
I know that Android (at least Pie) uses a file WifiConfigStore.xml to store WiFi access points and passwords. It is located in /data/misc/wifi/.
I saved it before wipe and reinstall everything. The idea was to copy it back to this location. While the phone is on/powered it seems not to uses the information from this new file. But after reboot it is gone and overwritten.
So my question: is there a special trick? Or is this not the proper location? Is there some backup file stored somewhere else?
(I have a rooted LineageOS 16 device with Magisk. I even tried to change the file in TWRP with not better result.)
Edit: Found that this file is also located in
/data/misc_ce/0/wifi,
/sbin/.magisk/mirror/data/misc/wifi and
/sbin/.magisk/mirror/data/misc_ce/wifi
And there are also files
WifiConfigStore.xml.encrypted-checksum. From naming it sounds like there it is including a checksum to avoid errors in xml?
This file I have not saved. Am I lost now? Can I delete this and it will be created than?
What is function of this misc_ce folders?
Thanks!

/data/misc/wifi/wpa_supplicant.conf

This has been used in older versions - it is not active used anymore... I can see all the data in this (saved) WifiConfigStore.xml.

It seems that the magisk folder is just a link. Not sure about the misc_ce folder.
I copied WifiConfigStore.xml, changed properties and owners and renamed the checksum file. After reboot the checksum was recreated and the xml gets valid...

I can confirm it works. So I've written a tool to convert old wpa_supplicant.conf to WifiConfigStore.xml if anyone is interested: https://github.com/mnalis/android-wifi-upgrade


text:
Add usb to ethernet support to tablet Teclast t20
i would like to allow my tablet Teclast T20 to connect to ETHERNET via USB.
I already own a USB to ETHERNET ADAPTER, that i use succesfully with my windows 10 laptop.
It is an ASIX AX88772 USB2.0 to Fast Ethernet Adapter, and i found that for this adapter is available a driver (source) in ASIX website
ASIX AX88772 USB2.0 to Fast Ethernet Adapter Drivers
that should work for Linux and Android.
But when i connect the adapter to my tablet using an OTG Usb to microusb cable, and connect the ethernet cable to the adapter, nothing happens.
Searching on the web, i found that with Teclast T10, that is and older version of my tablet (that was without 3G module), was possible to connect to ethernet via a similar adapter with same chipset as mine : UtechSmart USB 2.0 to 10/100 Ethernet Network Adapter (Model US-USB2-E100).
Take a look here (min 5:55)
Video
My tablet Teclast T20 has cpu MT6797X (X27) and runs on Android Nougat 7.1 and has connectivity WiFi + LTE
The Teclast T10, instead, has cpu MT8176 and runs on Android Nougat 7.0 and has only WiFi connectivity
So perhaps the kernel is different and the drivers pre-built in the kernel are different.
How can i check if an USB to Ethernet driver is already built in the kernel of my tablet?
And, if it is not available, how can i add the driver to my tablet? I know that i should have the sources of my kernel, but i think it will be difficult to get them from Teclast.
Any suggestion?
Thank you!
Lodovico.

Usually you should see in the kernel messages (dmesg) when you plug in the USB Ethernet adapter if it has been loaded correctly. The main problem is that usually you would execute the dmesg command via ADB/USB but the port is required for the Ethernet adapter. Therefore I would try to use ADB over Wifi to establish an adb connection that does not block the USB port. Then connect the USB Ethernet adapter and check the dmesg messages. I did this just for testing and was able even to see the link up/down messages.

Thank you for the information. What i can say for now, is that installing an app 'Usb device info' i can see that the adapter is recognized when i connect it (because the app shows correct informations about brand (Asix) and model).

The problem is that the leds are not blinking and there is not data connection...

How to make Ethernet work on Android over OTG?


text:
Changing /system/build.prop issues on fully rooted and DM-verity removed device
SO, I have an MT6739 dveice with Android 8.1, it's not A/B seamless, and it is not TREBLE.
I have used a tried and tested method to remove DM-Verity. On this device it was in the DTB, in the boot and also in the vendor partitions. I use Magisk to get me root and I have removed and installed lots of /system/apps, changed the audio, bootanimations etc on the device. I even changed the backgrounds and tweaked the Launcher.
However whenever I come to change anything in /system/build.prop the device bootloops!
I have tried this with Magisk DM-verity ON/OFF with no effect. I also copied back a build.prop from my PC and it worked fine again. So, something must be looking up the build.prop and checking for changes.
All I have done is change the ro.product.model property to be super sure nothing in the build.prop is incorrect. I have tried with setting permissions (644, for some reason they are 600 (RW - - ) on the device so tried that too).
There is a build.prop in the /vendor partition. i have heard of this checking the fingerprint of the system/build.prop, but they are different anyway on the stock ROM.
I also tried just copying the build.prop from /system into here so they were identical.
Fresh out of ideas!!
Does anyone know what is going on here. I can literally change anything I want on the device as normal/pre-verity days except for the build.prop settings.

maybe you have CRLF instead of LF line ending (check with Notepad++)

As @alecxs mentioned CRLF could be a reason. Do dos2unix on build.prop. Also check SELinux label. Check kernel log and logcat for any hints to the reason of bootloop.

TY for the comments. I will try that, I have been out all day today so will try it tmw. Problem is, I am literally only changing the device name or model so I dont create a line feed or CR at all. I am on a W10 system though so it is a little bit notorious for that. Other clue is that if I edit the build.prop back to the way it was and then copy it to the device, it boots fine!!

One thing I am really poor with is getting logs from a device. Is there a decent thread anywhere that can help me set up Logcat on the device?

OK, so logcat learned, here's an update. I copied the build.prop, made 1 change to the device name, making sure to not make any line breaks etc. I ran the build.prop through DOS2UNIX. I replaced it on the device, chmodded it, made sure magisk was running and had verity checking off and restarted the device with logcat running in my ADB window. Still bootlooped. No logcat log a6t all, "still waiting for device".

OK, so today I did a couple of final things. First thing I did was to recopy fresh build.props from /system and /vendor. I then edited them changing 1 setting exactly the same in each one. Device bootlooped. I then re-edited them back and re-copied this build.prop back. The device booted fine. This really wipes out any argument for editing the files incorrectly. There is definitely something comparing values in the build.prop in /system and not liking any changes. I chmodded properly, ensured DM-verity was handled properly.

So to ask a new question: What could comparing values in build.prop and stopping boot if it sees changes? There must be some kind of file or build.prop being compared against?

Well I have now had a chance to do some more testing. So I have now tested conclusively that I can change lots of properties in the build.prop in both /system and /vendor versions. For example I changed ro.product.locale and the default ringtone, However as soon as I change anything to do with ro.product.brand or device, it bootloops. So this removes the editing issues out of the equation for good. Something somewhere is comparing these values. I have been unable to get any kind of logging set up during boot to give me any clues. Anyone have any ideas?

See when you did the DM Verity patch, have you patched the boot.img to support Android 8.1? if working on Win can use ClassyKitchen. If working on Linux, AIK Linux is the way to go. i'd suggest using classykitchen and patch for DM verity and enable 8.1 support. worked for me. running 8.0 Oreo. ;)

Hi Aleks, No I didn't patch the boot.img specifically to support Android 8.1. Would you expand a bit on that. In this device to remove DM-Verity you need to find the fstab files in vendor (easy) and also the boot DTB, (not so easy on Win10 because you cannot get write access into the RAMDISK from 7.zip). I have uised Magisk successfully to do this however, but even running Magisk the issue is present.

Hi Aleks, so to clarify this further, FSTAB is definitely removed from the device. I actually let Magisk do it and then manually find the fstab entries and remove tyhem. You can then either keep the magisk boot.img or not, all it seems to do is patch the FSTAB out of it anyway. So I am still in the same spot here. I can edit anything in build.prop files, but if I touch ro.product.brand or model it bootloops.


text:
How can one increase Microsoft Outlook (Android application)'s cache size?
How can one increase Microsoft Outlook (Android application)'s cache size (in terms of number of emails stored offline, disk space or some other measurements)?

What problem are you having?

@Firelord not being able to search through all my Outlook emails when offline

There is no way except to keep as much space free as possible. Since Oreo, space quotas are enforced at filesystem level (based on UIDs). An app can use up to 90% of disk space or 50% of filesystem inodes. But apps exceeding their cache quotas are on the top of list when OS clears apps' cache due to storage running short. But it depends on the app how it manages its files. Emails can be maintained as a database (like we have on PCs) in non-cached directories on internal or external storage. Even user can be given option to backup large databases on SD card or USB OTG.

@IrfanLatif Gmail allows to increase how many days of emails should be saved offline.

@FranckDernoncourt that's what I said. It's up to the app how it manages its files and space usage, and how much flexibility it gives to user in this regard. But if it doesn't, there's nothing we can do at OS level, except trying some hacks with root access.

@IrfanLatif thank you, you are welcome to convert your comments as answer

@FranckDernoncourt I don't think it's a proper answer. Feel free to answer your own question.


text:
Exploiting Janus (CVE-2017-13156) - what do these error messages mean?
I am working on a school research project about the Janus vulnerability (CVE-2017-13156).
Janus is a vulnerability of the signature scheme v1 while installing APKs. I know this does not correspond directly to the Android version, but I would like to make a statement in the text of my project, that says something like "Janus is a vulnerability that affects Android versions ABC to XYZ". I was researching the vulnerable versions and I found a small inconsistency between the Guardsquare Janus writeup and the CVE record:

Guardsquare says that Android versions 5.0 and newer are vulnerable and that apps using signature scheme v2 on Android 7 and higher are safe.
The CVE records lists the vulnerable versions as following: 5.1.1, 6.0, 6.0.1, 7.0, 7.1.1, 7.1.2, 8.0 (notice that 5.0 is not on the list).

I decided to make an experiment with Android Studio Emulator to find out which of the vulnerable version lists is correct: I created a simple app that puts some text in the TextView in its Main Activity and I signed the APK with v1 scheme only (APK compiled for API level 19). I disassembled the APK using APKtool, then I changed the TextView text in the Smali files, compiled it back and prepended its DEX file to the original APK (standard way to exploit Janus).
I attempted to install this Janus-forged APK on various Android versions . The results are following:

Android 4.4: printed this message while attempting to install:

attacked.apk: 1 file pushed. 40.0 MB/s (3378792 bytes in 0.080s)
WARNING: linker: libdvm.so has text relocations. This is wasting memory and is a security risk. Please fix.
pkg: /data/local/tmp/attacked.apk
Failure [INSTALL_FAILED_INVALID_APK]

Android 5.0-7.0: The installation was successful, the installed app was showing the text manually edited in the Smali files.
Android 8.0 and 8.1: Show the error message:

Performing Streamed Install
adb: failed to install attacked.apk:
Failure [INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION:
Failed to parse /data/app/vmdl173040809.tmp/base.apk: AndroidManifest.xml]

My questions here regard the error messages as I don't understand why they show up (I googled some possible reasons, but they didn't really fit my case).
My questions are:

Why are Android versions older than 5.0 safe if they use signature scheme v1 as well? Why does Android 4.4 say the APK is invalid, but Android 5.0 does not?
What does the error message of Android 8.0 and 8.1 mean? Is there a better APK check in Android 8 that reveals Janus even for APKs signed with signature scheme v1 only?

Thank you for your help!

Apps with v1 signature exploit bugs (like master key and janus exploits) cannot be installed on Android 7.+  Source: https://engineering.case.edu/groups/xusheng-xiao/sites/engineering.case.edu.groups.xusheng-xiao/files/docs/ase_signatures_cr.pdf

Thank you for the paper recommendation, it's a useful reference for me.
However, even this paper mentions Janus being present on Android 5.1.1 to 8.0 -- they even cite the same CVE record as me.
APKs with v1 can be installed on 7.x -- I managed to install my forged APK on 7.0 successfuly. What they mention in the paper are APKs with rollback protection issues -- you can sign your APK with both v1 and v2 and rollback protection issue means i.e. that your APK has indicated that it has both, but only v1 was found (not my case).
So even though you helped, my two questions still lack an answer.


text:
Why even new SIM card is corrupting in my both phones old and new?
My old phone which is running on Android 4.0.4 Sony Xperia ST21i (3G) and new one is Android 9.0 ASUS Zenfone Max Pro M2(4G) but this is not a case.

I've same problem in my new phone that I was facing in my old phone.

Problem is that I was unable to use Internet and sometimes calls couldn't connect too.
My assumption :

Because my old phone's SIM slot pins was scratching card and make it have such behavior.

So It is same in my new phone too, even I had changed SIM card few times but problem was same.
Now also I've changed a SIM card expecting positive result but it doesn't.
In both phones no SIM toolkit is present when insert SIM card.
But when I use other's SIM card it was there.
I was using Vodafone 3G in my old phone but when I bought new phone I used same SIM in it but later I have ported it with Jio 4G.
I've checked with both providers other SIM cards from another person their SIM cards working fine and SIM toolkit also present.
Restored APN settings even suggested by customer care.

I found that even new SIM card is corrupting when I'm insert in phone no matter in old or new.

"I think my new phone infected as I've used old SIM card from old phone."
So how can I get rid of this?

Which cellular service provider's SIM card are you using? To which service provider this another person's SIM card belongs? Have you contacted customer care and complained about this issue? Have you verified that the internet settings are saved inside the phone? Which Android phone are you using? Do you not get internet connectivity and call functionality on any of 2g/3g/4g?

I seconded Firelord's comment and probably going further: have you visited a physical Jio customer care to let them test and confirm if your new SIM card is broken?

I visited store but they said I've already changed SIM card so they won't give me new one.


text:
WhatsApp reply via notification not working
I am currently on Android 9 Pie. Whenever I get a WhatsApp message and I try to reply to it from notification, it freezes. More frustratingly, it doesn't happen every time but say, 1 out of 3 times it happens.
Steps to reproduce:

Receive a WhatsApp message
Click Reply on the notification
Type message in the notification
Click Arrow (send) button.

Result:
The arrow turns to a circular progress bar and the notification stays like that. The message is not sent.
I have tried clean installing WhatsApp, it still persists. Not sure if anyone else is facing this. No other apps like Telegram or even the SMS app are having any such problem.
Any solution will be helpful. Thanks.

Sounds like a problem with the way WhatsApp is handling PendingIntents.  I think you would be better off reaching out to the WhatsApp support channels as this doesn't seem like it is a problem with Android itself.


text:
How to install Vim text editor in Android?
How do I install Vim text editor in Android?

See https://wiki.termux.com/wiki/Text_Editors

DroidVim is a Vim clone text editor ported for Android. Vim 8 (huge version, multi language), grep, diff and ctags are ready to use.

Type "pkg install vim" in any Android emulator like termux.

pkg command is a shell script - a wrapper around apt. And it's specifically a part of only Termux, not other terminal emulators. Termux provides a minimal Linux environment and .deb package repositories, others don't.


text:
Google asistant keeps playing sounds
My google assistant keeps playing sounds even when th screen is off, the sound is the same as when it proposes to speak to the microphone. But I can't stop it, even after the screen is off.
So I need a simple solution, I know I can stop he application by forcing stop, but I relly prefer to do it by app settings if possible, just becouse if I open the app again the problem starts again, and I use this app often, so It's anoying.
I'm on Galaxy A10 running android 9.0

If you don't want to use the Assistant, you can:

Open Google app
Select More -> Settings -> Google Assistant
Choose Assistant tab -> Phone and turn off "Google Assistant" switch

This should disable the Assistant and let the rest of Google app still work fine.


text:
Disabling auto-correct in one language but not the other
I've setup my phone for two languages: English and Russian; I use both languages for texting and other communication. Although English auto-correct seems OK, the Russian language auto-correct is terrible: it doesn't understand inflections and constantly changes correctly spelled words into completely different ones.
I'd like to turn off Russian language auto-correct. How do I do that? I would prefer to keep English language auto-correct if possible.
The phone is Samsung Galaxy S9+, running Android 9, One UI 1.0.


text:
How to add SELinux policy on a user-debug ROM that has `split` policy scheme?
I have a Sony device that supports treble and is a system-as-root and A/B device. It has a user-debug ROM installed on it so, its adb shell is rooted.
I have disabled dm-verity using adb disable-verity after running adb root and adb remount commands.
As documented here, this device also has split policies at /system/etc/selinux(the 'plat' portion of the policy) and /vendor/etc/selinux(the 'nonplat' portion of the policy).
I am trying to run test.sh using following init script:
#/etc/init/m_daemon.rc

# define service, use executable here if script not needed
service m_daemon /system/xbin/test.sh

    # don't start unless explicitly asked to
    disabled

    # Use `seclabel u:r:magisk:s0` to run with unrestricted SELinux context to avoid avc denials
    # can also use "u:r:su:s0" on userdebug / eng builds if no Magisk.
    # It's required if SELinux is enforcing and service needs access
    # to some system resources not allowed by default sepolicy
    # seclabel u:object_r:qlogd_exec:s0
    seclabel u:r:su:s0

# start the service when the boot is completed
on property:sys.boot_completed=1
    # Use it to start the service
    start m_daemon

/system/xbin/test.sh file has the following contents:
#!/system/bin/sh
echo `date` > /sdcard/test

When the device reboot then it fails to run with the following error:

  202.932913 / 11-26 20:21:04.074 audit: type=1400 audit(1574763664.074:213): avc:  denied  { transition } for  pid=8534 comm="init" path="/system/xbin/test.sh" dev="sda24" ino=8150 scontext=u:r:init:s0 tcontext=u:r:su:s0 tclass=process permissive=0
  202.933268 / 11-26 20:21:04.074 init: cannot execve('/system/xbin/test.sh'): Permission denied

To fix it, I have used sepolicy-inject and run the following commands:
sepolicy-inject -s init -t su -c process -p transition -P /sys/fs/selinux/policy -l
sepolicy-inject -s init -t su -c process -p noatsecure -P /sys/fs/selinux/policy -l
sepolicy-inject -s init -t su -c process -p rlimitinh -P /sys/fs/selinux/policy -l
sepolicy-inject -s init -t su -c process -p siginh -P /sys/fs/selinux/policy -l

but these needs to be run again after reboot.
So, I have tried to patch precompiled_sepolicy using following commands:
sepolicy-inject -s init -t su -c process -p transition -P /vendor/etc/selinux/precompiled_sepolicy -l
sepolicy-inject -s init -t su -c process -p noatsecure -P /vendor/etc/selinux/precompiled_sepolicy -l
sepolicy-inject -s init -t su -c process -p rlimitinh -P /vendor/etc/selinux/precompiled_sepolicy -l
sepolicy-inject -s init -t su -c process -p siginh -P /vendor/etc/selinux/precompiled_sepolicy -l

but the policies are not injected: neither live nor after reboot.
To test, I am just checking the date in /sdcard/test file.
So, I just want to know:

Why patching precompiled_policy didn't work?
Where to patch the required policies using rooted adb shell that should persist after a reboot?

To patch the policies, do the following:

Change the value in /system/etc/selinux/plat_and_mapping_sepolicy.cil.sha256 OR empty this file.
Inject required policies in /system/etc/selinux/plat_sepolicy.cil
"Loading compiled SELinux policy" should show in logs and the init service will run fine.

As I believe the answer answer your questions, here is a shameless copy/paste of my answer to this question:
Note that this answer will focus solely on Android 9 to 13 and Treble devices.
If we want to know how to modify the SELinux policies, I believe it is good to first understand how the policies are loaded in the first place.
SELinux in the boot process
At an early stage of the Android boot process and after mounting most of the partitions, init will attempt to load the SELinux policies from a monolithic sepolicy file found at either /odm/etc/selinux/precompiled_sepolicy or /vendor/etc/selinux/precompiled_sepolicy. If init notices that the device is updated out of sync, init will instead recompile the SELinux policies based on .cil files that can be found on several locations.
You can find all the details in the comments of the init/selinux.cpp source file and by looking at the implementation, but here is a summary of the exact steps taken by init:

Find the sepolicy file to use:

if /odm/etc/selinux/precompiled_sepolicy exists, use it as the sepolicy file to use
else, if /vendor/etc/selinux/precompiled_sepolicy exists, use it as the sepolicy file to use
else if neither of the above exists, stop here, recompile the policies based on the .cil files and load the newly compiled sepolicy file.

Check if device was updated out of sync:

Compare /(odm|vendor)/etc/selinux/precompiled_sepolicy.plat_sepolicy_and_mapping.sha256 and /system/etc/selinux/plat_sepolicy_and_mapping.sha256
Compare /(odm|vendor)/etc/selinux/precompiled_sepolicy.system_ext_sepolicy_and_mapping.sha256 and /system_ext/etc/selinux/system_ext_sepolicy_and_mapping.sha256
Compare /(odm|vendor)/etc/selinux/precompiled_sepolicy.product_sepolicy_and_mapping.sha256 and /product/etc/selinux/product_sepolicy_and_mapping.sha256
(On Android 13) Compare /(odm|vendor)/etc/selinux/precompiled_sepolicy.apex_sepolicy.sha256 and /dev/selinux/apex_sepolicy.sha256
if any of the above pair of files do not match, stop here, recompile the policies based on the .cil files and load the newly compiled sepolicy file.

If everything is ok, load the precompiled sepolicy file (/odm/etc/selinux/precompiled_sepolicy or /vendor/etc/selinux/precompiled_sepolicy)

The compilation of the policies based on the .cil files is as follows:

Get the latest version of the policies that are compatible with the vendor version (/vendor/etc/selinux/plat_sepolicy_vers.txt, note that init does not look at the file in the /odm partition)
Gather the .cil files to compile:

/system/etc/selinux/mapping/{vendor_version}.cil
/system/etc/selinux/mapping/{vendor_version}.compat.cil
/system_ext/etc/selinux/system_ext_sepolicy.cil
/system_ext/etc/selinux/mapping/{vendor_version}.cil
/product/etc/selinux/product_sepolicy.cil
/product/etc/selinux/mapping/{vendor_version}.cil
/vendor/etc/selinux/plat_pub_versioned.cil
/vendor/etc/selinux/vendor_sepolicy.cil or if it does not exist: /vendor/etc/selinux/nonplat_sepolicy.cil
/odm/etc/selinux/odm_sepolicy.cil

Compile the above files with secilc to /dev/sepolicy.XXXXXX
Load policies from /dev/sepolicy.XXXXXX

Modifying SELinux policies permantently
Now that we understand how init loads the policies, it is easy to see how one could permanently add new policies to the system:

Directly add the policies to /odm/etc/selinux/precompiled_sepolicy or /vendor/etc/selinux/precompiled_sepolicy with sepolicy-inject:
sepolicy-inject -s su -t system_file -c file -p entrypoint -P /vendor/etc/selinux/precompiled_sepolicy -o /vendor/etc/selinux/precompiled_sepolicy

Make init thinks the device is updated out of sync (By modifying one of the above .sha256 files, or deleting the precompiled sepolicy files) and modify one of the above .cil files

Note that in both cases, you will need to have a read-write access to the partition you want to modify (/vendor, /odm, and/or /system). These partitions are normally mounted as read-only, so you will have to either:

Remount them as read-write if you have root access (either because your device is rooted, or using adb root on a userdebug Android build)
Boot in recovery mode, mount the partitions as read-write and modify them in recovery

This update-package template I made may interest you there

If you do not want to have to remount the partitions every time you want to change the SELinux policies, you can add some SELinux rules to allow init to load new policies, thereby resolving the chicken and egg problem (as mentioned in this excellent answer) you had with your init script. You can find which SELinux rules are needed by searching for SELinux violations (avc errors) in the device logs on startup:
adb logcat | grep avc

With this, you will be able to have an init script that loads new policies with sepolicy-inject.


text:
How to extract `magiskpolicy` from `magiskinit64`?
I have cloned the Magisk code at my Ubuntu machine. I have successfully run build.py and get the Magisk.zip file in Out directory. This zip contains arm, chromeos, common, META-INF and x86 folders.
As documented here. I should be able to get magiskpolicy using ./magiskinit64 -x magiskpolicy /system/ but this command is not working and neither giving any error. Similary ./magiskinit64 --help is also not working.
1|flashlm:/system/magisk # ls
META-INF Magisk.tar arm chromeos common x86
flashlm:/system/magisk # getprop ro.product.cpu.abi
arm64-v8a
flashlm:/system/magisk # ./arm/magiskinit64 --help
1|flashlm:/system/magisk # ./arm/magiskinit64 -x magisk /system/magisk
1|flashlm:/system/magisk # ls
META-INF Magisk.tar arm chromeos common x86
flashlm:/system/magisk # ./arm/magiskinit64 -x magiskpolicy /system/magisk
1|flashlm:/system/magisk # ls
META-INF Magisk.tar arm chromeos common x86
flashlm:/system/magisk # ./arm/magiskinit -x magiskpolicy /system/magisk
1|flashlm:/system/magisk # ls
META-INF Magisk.tar arm chromeos common x86
flashlm:/system/magisk # ./arm/magiskinit --help
1|flashlm:/system/magisk # ls
META-INF Magisk.tar arm chromeos common x86
flashlm:/system/magisk # ls -l -Z ./arm/*
-rwxr-xr-x 1 root root u:object_r:system_file:s0 533856 2019-11-26 17:42 ./arm/magiskboot
-rwxr-xr-x 1 root root u:object_r:system_file:s0 617216 2019-11-26 17:42 ./arm/magiskinit
-rwxr-xr-x 1 root root u:object_r:system_file:s0 596736 2019-11-26 17:42 ./arm/magiskinit64

Any suggestions about what I have missed?

wrong architecture? according to the path ./arm/magiskinit64 i guess you try to execute arm64 binary on x86_64 cpu (ubuntu machine)?

I am trying on the arm64-v8a android device. My understanding is that it has arm64 architecture and so trying to run magiskinit64. I have tried it on two arm64-v8a devices but I didn't get any result.

Also, magiskboot is working fine on the same android device.


text:
Why does Google Pay require location permission?
Google Pay uses mobile numbers and UPI to transact money.
Why does it require location permissions?

One thing that I want to know, but can't since Google Pay is not supported in my country: can you do a transaction with location service disabled?

no.. we cannot!

Apparently, Google Pay is more than just for payments. One of its features (or bloat) is that it can find jobs for you based on your profile and location, et al.
Per Google Pay Help:

How do I find specific types of jobs?
We recommend jobs for you based on your profile info, location, preferences and your activity in the app.
To find specific types of jobs, make sure that you update your profile info, location and preferences to reflect the sort of jobs that you’re interested in.

does that make location permission necessary for payments?

It seems to require it under the pretense of detecting suspicious activity.

This is yet another reason I choose to avoid Google products whenever possible (which is pretty much always).  Too many intrusive permissions by a data hoarding mega-corporation.  See also https://android.stackexchange.com/questions/231091/google-pay-scanning-credit-card-without-camera-permission