text:
What services are needed for Google Play Store to work?
I've got a Chinese Lenovo Z5 phone and an Amazon Fire HD 8, which do not come with Google Play Store by default. I know how to manually sideload APK and install Play Store, however I am not sure about the dependencies.
As far as I know the Google Play Services is an absolute requirements. Other than that, some services for account and/or authentication are needed to ensure normal operation. What are they? I've done this a long time ago so I cannot remember.

Don't think anything except for Play Services is needed. Not sure if sideloading it would make it work, though.

You can take a look at microG. It provides a light-weight alternative to Google Services which is much more privacy friendly. And there's reports of working Play Store installations with it – though, unless you've bought apps that use Play's license check, you could simply use Yalp or Aurora instead of Play Store and keep it light-weighter, not even needing Play Services at all. See my list here for the links to Yalp & Co. And especially F-Droid ;)


text:
How to delete an app without deleting app data?
I'm on an Android and my device is a Huawei. I got this device a few months ago and I don't want to root my device because I don't trust myself.
Is there a way to delete an app without deleting app data?
If possible, I don't want to use ADB because I don't know any good apps and my computer is in a bad state and I just don't want to use it. Even if it's a hard or complicated way, I might do it. I do have other devices that might help.

Possible duplicate of How to fully backup non-rooted devices?

Don't think it's possible, especially without root. When an app is uninstalled all its folders are automatically deleted unless it explicitly creates a folder in your internal storage (which is why many apps do).

@SSS for "user apps" it is easily possible, see my answer below. For pre-installed apps you need root, and a more complicated approach.

@lzzy is there any good abd app? how do I open abd

@gaurav patil and how am I supposed to acess root files without rooting?

I feel there's a missing context that might give alternative solutions: is there a reason why you want to uninstall the app but still keep the app's data?

https://www.xda-developers.com/google-releases-separate-adb-and-fastboot-binary-downloads

Assuming you are talking about apps you've installed yourself (and not about pre-installed apps), you can utilise adb for this. You need to know the app's package name first (the part shown in the Play Store URL in the id= parameter, or at F-Droid following the /package/ in the URL). Then, with your device connected:
adb uninstall -k <app.package.name>

replacing <app.package.name> by the app's package name. The -k parameter is telling uninstall to keep the app's data. So when you next install the app, the data is already there and will be used.

source: Stack Exchange

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

sort: votes


text:
Text recogniser could not be set up on your device error
I have a smartphone with stock ROM Android 7.0 (Nougat). I use OCR apps very often for scanning text documents. Previously, OCR used to work well, but recently I noticed that whatever OCR app I use, it always shows Text recogniser could not be set up on your device error.
Why is this happening and how to fix this? Please help.

Make sure you have updated version of Google play services or it's not disabled and many OCR apps offer a file to download for the functioning of the app

I have the latest version of Google Play Services and it's not disabled, and I have a strong internet connection.

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


text:
Problem restoring from a CWM backup
I have a Samsung Galaxy Y (galaxy Young) GT-S5360 La Fleur edition with Android ver 2.3.6
Following method 1B given here, I first found an CWM update.zip file for my phone model from here
I also took a backup after booting into the recovery screen using this update.zip file
It created a clockworkmod\backup\2011-05-17.17.52.06 folder and this folder contains the following files:
.android_secure.vfat.tar   2 KB
cache.rfs.tar             60 KB
data.rfs.tar          166284 KB
nandroid.md5               1 KB
system.rfs.tar        216314 KB
Using the tutorial here, I managed to download android 7 nougat ROM, and it boots and works file (up to now, sometimes shows a crash message, not sure where it's from)
I tried going into recovery mode again (it turns out after after following all the steps of the tutorial above, when I press power+home+Volume up to go to the recovery screen, the built in recovery screen has already been replaced by the CWM one for good, but I think it's probably not important for now) and when I go to the restore option, the restore process completes almost immediately (so I suspect it is failing for some reason, but I can't see any relevant log message)
Then the screen goes back to the CWM recovery menu, and if I select restart system it boots back into the nougat 7 ROM
How do I restore my phone to my previous state (that is, back to gingerbread) using CWM recovery backup?

You can find logs of the process at /cache/recovery/last_log. That would be helpful to see what's going on. If you could paste it to a site such as pastebin.com or which ever you choose then attach the link to your post.

@BoLawSon Thanks I'n not at that computer anymore I'll post an update as soon as I get a chance to get back at it

Sounds good, just a heads up the last_log file is within your GT-S5360.


text:
How to upgrade SWM 8802 to Android 8.1
I purchased a SWM 8802 double din automotive head unit from ebay and I was under the impression that it would have android 7.1 installed as advertised. Turns out it actually has android 5.1, which has a tonne of limitations. I found a few forums online that contain some updates, but many members have bricked or bootlooped their units.
https://forum.xda-developers.com/android-auto/android-auto-general/failure-swm8802-t3750908/page4
https://www.needrom.com/download/swm-8802/
I am wondering if anyone has been able to successfully update the SWM 8802 headunit to android 8.1 and if so, what is the exact process?
More specifically I have a couple issues I need to resolve:
Bluetooth - I cannot connect to my OBDII bluetooth device or control any bluetooth settings as there are no options for this.
Touch Beep - The head unit beeps every time I touch it and there are no settings to disable it.
Any help would be greatly appreciated.

Not likely... The OEM's of these head units, especially the "cheap Chinese ones" (no offense to anyone) often do not release kernel source code or OS upgrades, , which are almost essential to 3rd party ROM development, and updates are often only issued for critical issues. Android is not "generic" and must be built specifically for each device, without the kernel source this is almost impossible. If the OEM hasn't followed the Android GPL license and released the kernel source code, which happens often with "generic" low dollar products, these are often just considered disposable products.

Ok, thanks for the info. Seems like I don't have many options but to find some work arounds.


text:
What is the proper method to manually odex an apk?
I am looking for a proper and simple method to odex an apk file. I have an upgraded apk file from a ROM with which I want to replace an older one, and it is located in the /system-priv directory. The older apk has the .odex file, but I figured out I can't directly overwrite it since I can't use the old .odex (hence I need to odex first), lest I'll be stuck with app crashes or bootloops.
I have tried searching for methods online but are not satisfactory in one of the ways:

This one which involves the use of a dexopt-wrapper.bin seems to be way outdated as binary is not supported, I have this error poping up:
 error: dexopt-wrapper error: only position independent executables (PIE) are supported.

The second one which is lengthy and links to other required resources are no longer there, and is somewhat not compatible with my system.

The only promising one which uses Auto Odexer Script, but currently I'm running issues adb and also seems it uses the same dexopt-wrapper binary which was giving me errors in terminal.

There are tools/methods for doing the entire system at once, but I  do not need the entire system re-odexed. I want to personally create an odexed "upgraded" .apk from the extracted ROM.
Update
I upgraded the wrapper binary (now PIE) and should be compatible however still encountering this error:
--- BEGIN '/sdcard/app/A.apk' (bootstrap=0) ---
--- waiting for verify+opt, pid=17200
--- would reduce privs here
execl(/bin/dexopt) failed: No such file or directory
--- END '/sdcard/app/A.apk' --- status=0x4300, process failed
1|mido:/ #

and the result is an empty .odex file in the dir. Someone to point out where I am going wrong here?

credits to com.modaco.odexme
xda link
Theoretically you should only need your Android device to manually odex, I ended up using both smartphone (running KitKat 4.4) and PC as explained later.
I successfully odexed apks using the following steps:
1.Create a /dir/odex on your Android device
2.Save next script as odex.sh in /dir/odex, give it execute permission 777
#!/system/bin/sh

cd /dir/odex

for filename in `find . -name '*.apk'`
do

# step 1 - odex the apk
./dexopt-wrapper $filename `echo $filename | sed 's/\(.*\.\)apk/\1odex/'`

# step 2 - did we succesfully odex?
if [ -f `echo $filename | sed 's/\(.*\.\)apk/\1odex/'` ]
then
    # step 3 - remove the classes.dex from the apk
    ./zip -d $filename classes.dex

    # step 4 - zipalign, just in case
    ./zipalign -f -v 4 $filename $filename.new
    mv $filename.new $filename
fi

done;

3.Obtain following binaries from com.modaco.odexme.apk\assets
dexopt-wrapper zip zipalign
put those in /dir/odex and give execute permission 777
4.Copy .apk(s) you want to odex from /system/app or /system/priv-app to /dir/odex
5.Open Terminal, cd to /dir/odex and execute ./odex.sh
At this point I had a problem with zipalign which could not LINK EXECUTABLE - cannot locate symbol... but nonetheless script partially executed and got odex(es) sitting next to apk(s) in our dir.
6.So I had to resort to the PC, copy original apk to PC, open it with WinRar or 7zip, manually remove classes.dex, then zipalign, and put "deodexed" apk back to Android device.
7.Now with a file explorer put newly created .odex and .apk in /system/app or /system/priv-app (have a backup of original apk first). If it fails to write mount system as rw. Give both permission 644 as all the other apks and odex in dir.
8.You can now delete corresponding dex in /data/dalvik-cache
9.Reboot (or soft-reboot)
10.Enjoy your newly odexed app
I successfully odexed LGEIME.apk, a modified keyboard for my G2, and GoogleDrive.apk, I moved it to /system/app to save space on /data partition because newer version are 5.0+ only. I was skeptical about GoogleDrive because it was multi-dex, infact apk contained classes.dex and classes2.dex: turned out I had to strip only classes.dex from the apk and leave classes2.dex inside the apk.
credits to com.modaco.odexme
xda link
YMMV

I tried it but it is  not working

For me it works, I don't even have to reboot to use the newly odexed app... I also found a static zipalign binary so I can make everything on the smartphone


text:
Auto wallpaper changer
I need to auto download wallpaper from internet and set based on a frequency ( daily or hourly ) ?
I'm using Samsung Galaxy Note 8 on Android Pie. Is this functionality available in android?

You can try Casualis:Auto wallpaper change. It can:

lets you have an always new wallpaper without lifting a finger: you just have to decide when you want Casualis to activate and you're done!
Features:

Set a random wallpaper every 1/3/6/12 hours or every 1/3/7 days, at the time you prefer;
Choose a wallpaper manually among over 3000 high-resolution images or use your own images;

In the settings, you can select the wallpapers from. Disadvantage: It shows ads.
Or you can try Wallpapers.

Enjoy a collection that keeps on growing. Access images from Google Earth, Google+, and other partners.
Double your fun. Show the world one wallpaper on your lock screen, and keep one for yourself on your home screen. (Requires Android™ 7.0, Nougat, and above.)
Start each day fresh. Pick your favorite category and you’ll get a new wallpaper image each day.

Disadvantage: Made by Google and not updated since 2018.


text:
How to setup Android Chrome to translate highlighted text via the pop-up Google search?
How to set up the little pop-up bar down below the screen, which generates a quick Google search whenever a word or phrase has been highlighted, to automatically translate what has been selected. That was my original setup but I guess I have messed up some settings and now it doesn't translate. How can I turn it back on?

Open Google Translate's settings.
Select "Tap to Translate", then enable "Enable".
In Preferred languages, set "Your primary language" and "Language you translate the most".
Go back to Chrome, select a word, "Translate" should appear. Click on it to translate the word.

Update
Based on Vadim's comment that the method might no longer work, to get the translation back:

Enter chrome://flags on your search bar
Type translation on the Search flag box
Set Contextual Search translations to Enabled.
Then Relaunch Chrome

You should be able again to see the translation at the bottom after selecting a word as seen on the image below.

Remarks:

Touch to Search must be enabled in Chrome's settings (Settings -> Sync and Google services -> Touch to search)
There are times when it stops working. You need either:
a. pressing the 3-dot then Translate or
b. to restart Chrome, or

It worked even without Google translate installed on my device - until the beginning of 2020. But now I still can’t get it back. Your answer doesn’t seem to address the specific problem, at least for me: I still can’t get that popup bar below the screen back.

@VadimSamokhin See edit.

Thanks, Reddy, I really appreciate your help, but still no luck :(

@VadimSamokhin Does the Google logo appears when you select a word when not using my workaround? If you have Google Translate installed, the only remaining solution is to select Translate from the menu that appears after selecting a word. The wors will be translated on the Google Translate bubble but not on the bottom bar.

I've ended up with exactly that option: I choose "translate" from the menu that appears after selecting a word. Thanks much for your help!


text:
Why is transmitting a file locally through AirDroid slower than downloading it from the internet?
I have a video file on my Android device (One Plus 7 Pro). I use the app AirDroid to download this file to my desktop computer through a web browser or application on the computer. This all happens locally, I can cut the internet connection in the middle of the transfer and it will not impede the transfer.
I find that this transfer is slower than I would expect. The fastest speed I have been able to achieve is 6 megabytes per second, which I only achieve when I host a hotspot with my phone, and connect the desktop to that.
If I connect both the phone and the desktop to a WiFi router, I only get roughly half that speed.
Both these devices are capable of both uploading and downloading data much faster than this. If I connect them to a sufficiently fast internet connection through WiFi, they can upload and download files from and to the Internet at multiple times the speeds mentioned above.
If their hardware are capable of that when transmitting to/from the Internet, why can they not do the same thing locally? I would assume that having removed the bottleneck of the Internet connection, the speed would be much faster.
I have noticed that this speed limitation also occurred with other apps that did similar things, such as ShareIt. I have also noticed it a multitude of Android devices from various brands, and various computers.

If I connect both the phone and the desktop to a WiFi router, I only get roughly half that speed.

This is because of the way a Wifi network works. If you transmit data from one Wifi device to a second Wifi device connected to the same Wifi network (using the Wifi frequency and the router does not support MIMO) the data will be always transmitted this way (defined by the Wifi standard):
device 1 -> Wifi router -> device 2
Therefore each packet has to be transmitted twice over the air and in your Wifi only one device can be active (sending or receiving data) at a time.
It looks like the limiting factor in your set-up is the Wifi transmission speed. Both devices seem to use the same Wifi frequencies and therefore can not communicate at the same time but alternating. Therefore you only get the half speed.
This situation would not occur if your Wifi would support one of the following techniques:

The Wifi works in both 2.4GHz and 5GHz mode (and one device supports 5GHz Wifi)
The router has multiple antennas and can use antenna diversity (MU-MIMO) so that multiple devices can communicate at the same time

Alternatively there would be the possibility to use a WiFi Direct connection. It does not involve the router, therefore the connection should be up to twice as fast. But I don't have any experience with such a connection and AirDroid.

So, if I can download a file from the Internet at 20 megabytes per second on either device, why is the local transmission limited to 6 megabytes per second, even when the phone acts as a hotspot and the file goes directly?

@Revetahw The "download on either device" is via Wifi or cellular connection? If it is Wifi which Wifi version is used by your router (frequency, channel-width, ...)? In the second case (Wifi hotspot to cellular network) what do you mean with "directly"? Also keep in mind that Wifi is a shared medium, therefore multiple devices may disturb each other.

By download, I mean the device is connected to a WiFi router somewhere and the file is downloaded from the Internet. By "directly", I mean that the phone hosts a WiFi hotspot and the desktop connects to that, cellular data or the Internet being irrelevant to the transfer. I say "directly" because there is no third router device involved, only the phone and the desktop.

@Revetahw If the phone hosts a Wifi hotspot it matters how you connect to the Internet. If you use cellular you have two technologies that don't collide because they use different frequencies. In case you use another Wifi connection your phone uses one Wifi chip for two Wifi connections. In the latter case it is clearly that a shared chip with two connections can only provide the half speed for each connection.


text:
How to use 2 sim cards & SD Card?
I have xiaomi redmi note 5 pro, and the sim tray has a hybrid configuration, Either using 2 sim cards or 1 sim and one micro sd card.
Is it anyway to use 2 sim cards and a micro SD card in the same time?

It is not really possible to do all of this in the phone, but you could insert both sim cards to the phone and use an SD to USB adapter.


text:
Is it possible to designate a Wi-FI SSID as metered "mobile network"?
I am wondering if there is a method by which I can designate a WLAN/WiFi connection as "mobile network" based on its SSID for the sake data usage policies by apps or the Android system in general.
Typically when you have a data plan with your mobile provider, your phone's LTE (or  3G ...) modem will connect to the provider to enable you to have internet access.
Now if I am using a mobile LTE/WLAN router instead, my phone assumes that it's on an unmetered WiFi uplink and apps/the system will (mis)behave accordingly.
Is there a way to tell the system that when it connects to a particular SSID it should treat that as "mobile network" in regards to how apps may use data?
Phone: Samsung S9+ (SM-G965F), Android 9
NB: the settings from this answer don't exist on my phone.

This option actually exists and I have just tested it on Android 10 (AOSP). The trick is to set a custom DHCP option 43 with the text value "ANDROID_METERED". What I find a bit confusion is that Android does not show you that it is on a metered Wi-Fi. I verified it with the NetworkMonitor app.
Someone documented this further: https://www.lorier.net/docs/android-metered.html

+1 Helpful only if WiFi router allows to configure custom DHCP option 43 which must not be the case with many routers.

Yeah, I wonder if that option gets set when you open a hotspot on one device and another connects to that hotspot. Gotta experiment a little.

I don't think WiFi can be designated as a Mobile Network, but stock Android provides option to set WiFi network as metered. When connected to the WiFi, go to that WiFi connection settings and you will find options to set the connection metered or unmetered (at least on Pie).

OEMs might be removing the option from GUI. You can also try CLI method as stated here. From adb shell execute:
~$ cmd netpolicy set metered-network <WIFI_SSID> true


text:
Exporting a full WhatsApp chat to .txt
So, I've decided to try and do some analysis on my WhatsApp chat history. For that purpose, the built-in export function would work quite well, but it is for some reason restricted to the latest 40.000 messages. Some of my chats go back way further than that, and I'd like to include those conversations in my dataset.
And that's where it gets complicated. Things I've tried so far:

A variety of recovery tools (drfone, BackupToolForWhatsApp,...) that invariably failed to connect and/or demanded a lot of money and/or contained malware

Finding the msgstore.db.crypt12 as a file on the phone and opening it as text with various apps (some people claimed that worked, it didn't though, everything just crashed or complained about the format)

Copying the msgstore.db.crypt12 onto my computer and there decrypting it with the key file, which led to the next problem, obtaining said key file.

A bunch of outdated and thus no longer functional WhatsApp key extractor tools which tried to either grab the backups off Google Drive, or temporarily install a legacy Version of WhatsApp with a vulnerability that allowed the key to be extracted. This failed because the tools haven't been updated in like three years and I'm not Java-savy enough to go digging in their source code myself. I actually downloaded a legacy APK to try and manually install that old WhatsApp version, but that only led to an error about the datetime of my phone (which was set to automatic and thus was correct) and no key.

Rooting my phone in order to get access to the directory where the key is hopefully located. This failed, perhaps because I did the mistake of updating my firmware to the July 2019 patch level, and so no root exploits seemed to work

Digging around in protected directories with tools that do not quite require root access. However, I wasn't able to locate anything that even looked like the place WhatsApp might store its key.

Reading through lots of forum posts on the same issue without any discernible results.

I'm using a Samsung Galaxy S8, model number SM-G950F, German localization, with Android 9.
My question is simple: What else can I do? It can't be that it's literally impossible to dig at the messages which WhatsApp is happily storing and backing up. I'd even be willing to buy some software as long as it's reasonably priced and guaranteed to work.
Also, what directory would I be looking for to get that key, assuming I'd somehow get root access?
Update 28.07.2020:
It seems that in some locales (specifically the EU?), the native export function was disabled in its entirety. The method detailed in my answer below still works excellently, however.

How about exporting each contact for its own? Maybe 40.000 is sufficient. regarding 4. someone managed it on S10 with Pie 9.0 the pitfall is reboot required between uninstall (-k)/install. date can be set to past manually 5. should be possible in near future (assuming you already unlocked) With root access you don't need the key, there is unencrypted database too you can use. its all in /data/data/com.whatsapp

@alecxs Unfortunately, I had individual chats with significantly more than 40.000 messages. And I saw the forum post where someone managed to do it with Android 9, but following the same steps did not yield any results.

So, here's the solution I ended up using. Even though it's not ideal, it worked out, so I'll leave this here in case anyone else stumbles upon this.
The weak link in the chain is WhatsApp Web. Specifically, it's possible to write a tool that just scrapes the data WhatsApp Web receives, and someone on the Chrome Web Store did exactly that: The Backup WhatsApp Chats extension. It's like €3, so well within what I'd consider reasonable. However, I'd expect that anyone with more knowledge of coding than I have could write such a script themselves, because the messages in WhatsApp Web are apparently just displayed as plain HTML.
It's reasonably fast and extracts all the non-media data you might want in csv format that can be parsed pretty well by pandas.
I'll accept my own answer because this is a solution within the parameters I set out, but if someone knows a better way, feel free to post it and I'll shift the accept.

Does this actually work with chats with millions of messages over several years though?

@Turkeyphant I've successfully done it with 391.000 messages stretching back to July 2015, so I at least have no reason to assume it would break at higher scales. The largest of those chats contained 128.095 messages, which took a few, but no more than twenty minutes to export fully.

Thanks. How long did that take? And do you see anything on the WhatApp Web screen while it scrapes?

@Turkeyphant In total it took me an hour for all the chats maybe, and while it scrapes, there's an overlay on the screen that says "Downloading messages" and displays a count of messages downloaded.

So you can't use WhatsApp Web at the same time?

@Turkeyphant Nope, I'm afraid with this method you have to wait for the program to finish exporting.

@Turkeyphant there's now an option to allow it to download in the background while you continue chatting!

As a quick update: As of October 25th 2021, the developers seem to be selling license codes for the extension through their own website at https://chatsaver.org/ , but if you previously bought the extension on the Chrome store, you can contact them to get a new license code. I don't know what the purpose of the move is (maybe trying not to pay a share to the Chrome store?), but for the moment, it still works.

It should also be noted that presumably this method will break if using the multi-device beta, as it no longer allows devices to go arbitrarily far into the past chat history.

Does this Chrome extension method somehow work for migrating to Telegram while maintaining media? That's my goal, I want to move all my family chats!

@ctrlbrk This method yields only chat transcripts, but I would not know how to migrate them to telegram. I believe, however, that downloading media is possible if you're just looking to preserve them, not have them appear in Telegram

Thanks a lot for the info. I just tried to apply this to a probably 200k messages chat, spanning over 7 years. So I installed the recommended Chrome extension, bought the license key, launched the WhatsApp web app, opened the chat I am interested in, and then launched the extension. I selected the chat's timeframe, chose format .txt, and pushed 'download'. After a very short message of 'checking license key' then nothing. No spinning wheel, no nothing. Did I do something wrong?

In the meantime, I realized I was using a Whatsapp app for PC which did not launch from Chrome. I corrected that, the download started as it should have, but it downloaded much less than even the max 40 thousand messages, probably about 4000 only :( Tried several times choosing different formats (.txt, html etc.) - same result.


text:
How to make SELinux injected rules persistent without unpacking-packing boot.img?
I am working on an application that needs root access and I have a device which is rooted but not with Magisk. This device has only adb shell root available. So, I need an alternative to call the required functionality without the use of Magisk or other tools. I did it by placing my executable inside system directory and run it as a daemon. This daemon required access on some location which is restricted by SELinux policies.
I have injected the required policy with following commands:
    sepolicy-inject -s init -t su -c process -p transition -l
    sepolicy-inject -s su -t system_file -c file -p entrypoint -l
    sepolicy-inject -s init -t su -c process -p rlimitinh -l
    sepolicy-inject -s init -t su -c process -p siginh -l
    sepolicy-inject -s su -t shell_exec -c file -p read -l
    sepolicy-inject -s su -t shell_exec -c file -p execute -l
    sepolicy-inject -s su -t shell_exec -c file -p getattr  -l
    sepolicy-inject -s su -t vendor_toolbox_exec -c file -p execute_no_trans -l
    sepolicy-inject -s init -t su -c process -p noatsecure -l
    sepolicy-inject -s su -t toolbox_exec -c file -p getattr -l
    sepolicy-inject -s su -t toolbox_exec -c file -p execute -l
    sepolicy-inject -s su -t system_file -c file -p execute_no_trans -l
    sepolicy-inject -s su -t storage_file -c dir -p search -l
    sepolicy-inject -s su -t storage_file -c lnk_file -p read -l
    sepolicy-inject -s su -t tmpfs -c dir -p search -l
    sepolicy-inject -s su -t mnt_user_file -c dir -p search -l
    sepolicy-inject -s su -t mnt_user_file -c lnk_file -p read -l
    sepolicy-inject -s su -t sdcardfs -c dir -p search -l
    sepolicy-inject -s su -t sdcardfs -c file -p append -l
    sepolicy-inject -s su -t toolbox_exec -c file -p read -l
    sepolicy-inject -s su -t toolbox_exec -c file -p open -l
    sepolicy-inject -s su -t sdcardfs -c file -p read -l
    sepolicy-inject -s su -t sdcardfs -c file -p write -l
    sepolicy-inject -s su -t sdcardfs -c file -p open -l
    sepolicy-inject -s su -t media_rw_data_file -c file -p read -l
    sepolicy-inject -s su -t media_rw_data_file -c file -p write -l
    sepolicy-inject -s su -t media_rw_data_file -c file -p open -l
    sepolicy-inject -s su -t media_rw_data_file -c file -p append -l

The problem is that they are not persistent after reboot. I know I can extract boot.img and ramdisk, replace /sepolicy with new policy file copied from /sys/fs/selinux/policy, repack boot.img and flash back.
I want to do it without reflashing boot.img. Is there any way with which I can execute above commands after Android finishes with generating SELinux files?
I have tried following rc files:
#/etc/init/custom.rc

# define service, use executable here if script not needed
service custom /system/bin/custom.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:r:su:s0

# start the service when boot is completed
on property:sys.boot_completed=1
    sepolicy-inject -s init -t su -c process -p transition -l
    sepolicy-inject -s su -t system_file -c file -p entrypoint -l
    sepolicy-inject -s init -t su -c process -p rlimitinh -l
    sepolicy-inject -s init -t su -c process -p siginh -l
    sepolicy-inject -s su -t shell_exec -c file -p read -l
    sepolicy-inject -s su -t shell_exec -c file -p execute -l
    sepolicy-inject -s su -t shell_exec -c file -p getattr  -l
    sepolicy-inject -s su -t vendor_toolbox_exec -c file -p execute_no_trans -l
    sepolicy-inject -s init -t su -c process -p noatsecure -l
    sepolicy-inject -s su -t toolbox_exec -c file -p getattr -l
    sepolicy-inject -s su -t toolbox_exec -c file -p execute -l
    sepolicy-inject -s su -t system_file -c file -p execute_no_trans -l
    sepolicy-inject -s su -t storage_file -c dir -p search -l
    sepolicy-inject -s su -t storage_file -c lnk_file -p read -l
    sepolicy-inject -s su -t tmpfs -c dir -p search -l
    sepolicy-inject -s su -t mnt_user_file -c dir -p search -l
    sepolicy-inject -s su -t mnt_user_file -c lnk_file -p read -l
    sepolicy-inject -s su -t sdcardfs -c dir -p search -l
    sepolicy-inject -s su -t sdcardfs -c file -p append -l
    sepolicy-inject -s su -t toolbox_exec -c file -p read -l
    sepolicy-inject -s su -t toolbox_exec -c file -p open -l
    sepolicy-inject -s su -t sdcardfs -c file -p read -l
    sepolicy-inject -s su -t sdcardfs -c file -p write -l
    sepolicy-inject -s su -t sdcardfs -c file -p open -l
    sepolicy-inject -s su -t media_rw_data_file -c file -p read -l
    sepolicy-inject -s su -t media_rw_data_file -c file -p write -l
    sepolicy-inject -s su -t media_rw_data_file -c file -p open -l
    sepolicy-inject -s su -t media_rw_data_file -c file -p append -l
    start custom

but it is not working because I think Android generates SELinux files after my custom service has been triggered.
Also tried above commands on onrestart option of init service but failed.
Any suggestion?

if timing is your only problem i would suggest sleep command

I have tried to add 5 minutes sleep with sleep 300 after on property:sys.boot_completed=1 but the service is started instantly on boot complete so this command is not working as expected.

The init service you have defined won't inject SELinux policy rules because of two reasons:

The syntax of sepolicy-inject commands is incomplete; .rc files aren't shell scripts. The correct syntax would be:
#/etc/init/custom.rc

...

on property:sys.boot_completed=1
    exec - -- /system/bin/sepolicy-inject -s init -t su -c process -p transition -l

...

This will execute the statement with context u:r:init.s0. But modifying SELinux policy requires permission load_policy i.e. you need to inject rule sepolicy-inject -s init -t kernel -c security -p load_policy -l which again won't be allowed to init. Read What sepolicy context will allow any other context to access it? to know how SELinux is enforced on Android.

So you are in the same chicken or the egg situation as you were at the start of your previous question. SELinux policy can only be modified with context u:r:su:s0 which is available only through adb shell on userdebug builds of ROMs. Or root the device e.g. with Magisk, or replace /sepolicy file in boot.img.
NOTE: You don't need to define rules like sepolicy-inject -s su ... as u:r:su:s0 is already set permissive in policy.
sepolicy File Locations:
On pre-Treble Android releases, there are two possible locations defined for sepolicy file:
/sepolicy
/data/security/current/sepolicy

As stated here:

The Android initialisation / reload process will first check for this file at: /data/security/current/sepolicy. If not present then check root directory: /sepolicy.

However sepolicy is loaded by init at very early boot process when /data is not mounted. As stated here:

Since only the root filesystem is mounted, it chooses /sepolicy at this time. The other path is for dynamic runtime reloads of policy.

So initially /sepolicy is loaded for sure. But you can put modified sepolicy at other locations to see if the previous policy is (or could possibly be) overwritten at some later boot stage. You might need to copy other files as well; this post could be helpful. I never tried this.
On Oreo+ a monolithic policy is loaded from /sepolicy if the device is not a Treble device (or if Magisk patched init to force load /sepolicy). On Treble devices /system, /vendor and /odm are mounted by kernel before starting init, as configured in DTB. Here a pre-compiled split policy is loaded from /vendor/etc/selinux/precompiled_sepolicy if it matches with /system, or the policy is built from .cil files in /system/etc/selinux and /vendor/etc/selinux before loading. See details here.
In both situations things are far more complicated to try than simply replacing /sepolicy file in boot.img, which is not a big deal in my opinion. You can dd out a backup of your original boot.img to /sdcard which can be restored in a few seconds anytime. However bootloader needs to be unlocked to boot a modified boot.img.
Please note that on devices with system-as-root (A/B or others) ramdisk is moved to system.img. So all files which were previously part of boot.img (except kernel and DTB) are now part of system partition.

Thanks for excellent knowledge. Now, I am trying to pack/unpack boot.img and facing a problem: https://stackoverflow.com/questions/57425339/isuue-in-repacking-boot-img-with-mkbootimg-tools Can you help in this?

I got a device with userdebug ROM that has split device policies to support treble but I am not able to patch the required policies. Please help in identify the problem: https://android.stackexchange.com/questions/218911/how-to-add-selinux-policy-on-a-user-debug-rom-that-has-split-policy-scheme

I know the question was asked quite some time ago, but since I tried doing something similar recently and this post was one of the top hits on Google, I want to share my recent experience to help others.
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:
Locked out of my device,
I used google find my device to locked my stolen Samsung galaxy j7 Prime. Its been recovered, but i can't unlock it because apparently, the password input bar wont take more than certain number of characters. What can i do please

you can set a temporary password from google find my device and unlock then

I already did that, no difference

what do you mean with "wont take more than certain number"? Why not use a shorter temporary password which fits in "certain number"?

Have you seen How to unlock Google Device Manager remote lock?


text:
“agrep” for Android Terminal?
How can I do this (agrep) in the Android Terminal?
This program allows elastic text searching, which means that searchqwery would match searchquery, and searching Android would also match Anfroid or Androis.
How can I install it so that it can be run from the Android Terminal?

you need to compile a static binary for your architecture from source. this can be done with Linux Deploy https://packages.ubuntu.com/source/xenial/agrep

Not sure if it has that, but worth a try: the Termux app is an Android terminal that a.o. comes with apt and a lot of packages to be installed that way. It might have the agrp package in its repository.

As commented by @Izzy, Termux has a wide repository of Linux packages, but agrep isn't among them so far. So you have to go for compiling the binary from source, or you may give this one a try. It's a static binary for aarch64 architecture.


text:
How to use Android device as router without cellular connection?
I have an Android tablet that has no SIM card and no cellular connection. Is it possible to set it up as a discoverable WiFi access point? I know when you have a cellular connection you can set up tethering and have an id and password that can be discovered by other devices. Is it possible to do this without any cellular connection?
I don't actually need internet access at all. All I'm looking for is to set up a small WiFi LAN between an Android tablet and a small device running Debian Linux.

Not without root and dual band WiFi... Is your tablet rooted? If so, then there are some router apps you can use. You can connect the tablet to the Internet via 2.4 or 5.2 Ghz, then use the other frequency to allow other devices to connect to it. Note that doing this is extremely inefficient and often will significantly cut-down bandwidth. It is usually better to get an older dual band router that has open source ROM's available such as Tomato or OpenWRT and set that up to act as a WiFi to WiFi router.

Thanks for the reply. I don't actually need internet access at all. All I'm looking for is to set up a small wifi LAN between an android tablet and a small device running Debian Linux. The tablet has to be visible to the device and I would ideally like to send and receive data over a wifi connection. I have absolutely no idea if this is even possible. I thought I might as well ask.

I don't think you need root. S10e does this automatically out of the box with mobile hotspot (presumably because it has two wifi antennae).

@Turkeyphant Perhaps the S10 does, but this is not an Android feature, it is something Samsung added. I have yet to see another device do this.

Does the tablet have the hotspot, tethering, or internet connection sharing options in the settings? If so, it may be possible to just turn it on even without a mobile data connection, if the settings are not there, the OEM probably didn't build the options into the ROM.

@acejavelin - are you saying this isn't an Android feature because you know its not part of stock Android or just because you haven't come across it? Not many phones would have the hardware to do this...

If you have root access and don't mind working on CLI, a shorter version of script used for How to use Android in Wi-Fi repeater mode? can be used to create a hotspot network provided that your WiFi interface supports AP mode:
#!/system/bin/sh
set -e
#set -x

# this scripts creates a hotspot network

[ "$(id -u)" = 0 ] || { echo 'Not running as root!' >&2; exit 1; }

# check required binaries are on PATH
for bin in iw ip iptables hostapd dnsmasq
do
    ! which $bin >/dev/null || continue
    echo "$bin not found." >&2
    exit 1
done

####################
# define variables #
####################
SSID=MyAP                           # set this to your desired string (avoid spaces and non-ascii characters)
PASSCODE=foobarfoobar               # set this to your desired string (8 to 63 characters)
WIFI_INTERFACE=wlan0                # set this according to your device (check with 'lshw' or 'ip link show')
AP_INTERFACE=${WIFI_INTERFACE}-AP
DIR=/data/local/tmp/$AP_INTERFACE
SUBNET=192.168.43
IP=${SUBNET}.1

##########################
# start / stop tethering #
##########################
STOP()
(
    echo 'Cleaning up...'

    # don't print error messages
    exec >/dev/null 2>&1

    # hope there are no other instances of same daemons
    pkill -15 hostapd
    pkill -15 wpa_supplicant
    pkill -15 dnsmasq
    # remove RPDB rule and iptables rule
    ip rule del lookup main
    iptables -D INPUT -i $AP_INTERFACE -p udp -m udp --dport 67 -j ACCEPT
    # delete AP interface
    iw $AP_INTERFACE del
    rm -rf $DIR
)

if [ "$1" = stop ]
then
    STOP || true
    exit
elif [ "$1" != start ]
then
    echo 'Usage:' >&2
    printf '\t%s\n' "$(basename "$0") start|stop" >&2
    exit 1
fi

################
# basic checks #
################
if ! iw phy | grep -A10 'Supported interface modes:' | grep -q '\*[ ]*AP'
then
    echo 'AP mode not supported.' >&2
    exit 1
fi

if ! iw dev $WIFI_INTERFACE link | grep -q '^Not connected'
then
    echo 'First disconnect form Wi-Fi.' >&2
    exit 1
fi

##########################
# stop running instances #
##########################
STOP || true

#####################################
# create virtual wireless interface #
#####################################
if ! iw dev $WIFI_INTERFACE interface add $AP_INTERFACE type __ap
then
    echo "Couldn't create AP interface." >&2
    exit 1
fi

#####################################
# configure newly created interface #
#####################################
echo 'Configuring network...'

# activate the interface and add IP
ip link set up dev $AP_INTERFACE
ip addr add ${IP}/24 broadcast ${SUBNET}.255 dev $AP_INTERFACE

# Android doesn't look up into main table by default
ip rule add lookup main

#######################
# access point daemon #
#######################
# create configuration file
mkdir -p "$DIR"
cat <<-EOF >$DIR/hostapd.conf
    # network name
    ssid=$SSID
    # passphrase to use for protected access
    wpa_passphrase=$PASSCODE

    # network interface to listen on
    interface=$AP_INTERFACE
    # wi-fi driver
    driver=nl80211

    # set operation mode, 'g' for 2.4GHz band
    hw_mode=g
    # WLAN frequency channel to use
    channel=1

    # key management protocol; use pre-share key
    wpa_key_mgmt=WPA-PSK
    # enforce WPA2
    wpa=2
EOF

echo 'Starting hostapd...'
hostapd -B $DIR/hostapd.conf

################################################
# run a dhcp server to assign IP's dynamically #
################################################
# create configuration file
cat <<-EOF >$DIR/dnsmasq.conf
    # we dont want DNS server, only DHCP
    port=0

    # nameservers to be sent to clients
    dhcp-option=6,1.1.1.1,1.0.0.1

    # range of IPs to make available to wlan devices and when to renew IP
    dhcp-range=$IP,${SUBNET}.254,24h
    # where to save leases
    dhcp-leasefile=$DIR/dnsmasq.leases

    # respond to requests from a different IP broadcast subnet
    dhcp-authoritative
    # don't look for any hosts file and resolv file
    no-hosts
    no-resolv
EOF

# open listening port
iptables -I INPUT -i $AP_INTERFACE -p udp -m udp --dport 67 -j ACCEPT

echo 'Starting DHCP server...'
dnsmasq -C $DIR/dnsmasq.conf </dev/null

echo Done.

Now you can connect to Access Point MyAP using key foobarfoobar.
wpa_supplicant can also be used in place of hostapd for simple cases like ours, but the one shipped with Android doesn't seem to work. You need to compile binary from source, or try this one. Configuration is even simpler:
...

#######################
# access point daemon #
#######################
# create configuration file
mkdir -p $DIR/wpa_supplicant
cat <<-EOF >$DIR/wpa_supplicant.conf
    ctrl_interface=$DIR/wpa_supplicant

    network={
        ssid="MyAP"
        psk="foobarfoobar"

        # force create AP network
        ap_scan=2

        # key management protocol; use pre-share key
        key_mgmt=WPA-PSK
        # enforce WPA2
        proto=RSA

        # set mode to AP
        mode=2

        # channel frequency
        frequency=2412
    }
EOF

echo 'Starting wpa_supplicant in AP mode...'
wpa_supplicant -B -D nl80211 -i $AP_INTERFACE -c $DIR/wpa_supplicant.conf

...

hostapd, wpa_supplicant and dnsmasq all are part of AOSP. hostapd is used for wireless tethering, wpa_supplicant for WiFi connections and dnsmasq as DHCP/DNS server (up to Pie).
dnsmasq isn't necessary if you prefer static IP configuration.
If your device doesn't contain hostapd binary, you can get one from some other device or compile from source, or try this one.
For more configuration options, see hostapd.conf, dnsmasq.conf and wpa_supplicant.conf. See WiFi channels detail here.
Also make sure both hostapd (runs with UID 1010 AID_WIFI) and dnsmasq (drops to UID 9999 AID_NOBODY) are able to make outbound connections through firewall.
SELinux may also cause problems with this manual setup, so set permissive for testing purpose or define policy rules.
Since you don't intend to use internet, there is no need to configure NAT and packet forwarding.

PS:
In case if you have cellular connection, the only extra thing to be done is internet sharing. For extra steps see How to create a WiFi hotspot from the terminal?

I tried the run the above script. It exits with "hostapd not found" however using find this three are returnded. /data/vendor/wifi/hostapd /sbin/.magisk/mirror/data/vendor/wifi/hostapd /system/vendor/bin/hw/hostapd. Should i install the one provided above,  and how should i install it, As zip in TWRP? Excuse my ignorance.

@kocj use any of the both binaries already available on your device. If they don't work, download the ZIP file, extract the hostapd binary, and place on your PATH.

@Ifran lativ if i copy the /system/vendor/bin/hw/hostapd to /system/bin the script runs till ++ hostapd -B /data/local/tmp/wlan0-AP/hostapd.conf if i use the one provided above the output of the script is one more line ./hotspot: line 131: /system/bin/hostapd: cannot execute binary file: Exec format error. what do i do wrong.

Ok, if figured out my testing device is not aarch64 but armeabi-v7a,armeabi. This might be the reason for Exec format error

@kocj correct. More details on architecture in this answer: https://android.stackexchange.com/a/208132/218526

If you don't need internet access and just a local network, why not just use WiFi Direct?
You should be able to access this through Settings > WiFi and set up an ad-hoc network between your tablet and Debian device.

Unfortunately the Debian device is not discoverable, i.e. it doesn't show up when you try to do a wifi direct connection. I think my only option at this point is to get a cellular device and try to establish a network with a hotspot.

Are you sure that the Debian device is working with Wifi Direct or could it be an issue with that?


text:
8 Ball Pool (Miniclip) on Android x86
I'm using Android x86 emulator on a Dell Vostro 3500.
I installed 8 Ball Pool by Miniclip
When I try to run the app, I get a message saying I need 20mb additional space before I can continue, but that's ridiculous because I'm using a 1TB drive.
What is wrong and how do I fix this?

it can be from the emulator and you can search for it on youtube or you can change it to bluestacks / nox or tencent gaming buddy if it has the game or you can use an android os besides your current os such as phoenix os / prime os :)

Thanks for the advice. I tried Phoenix and Bliss OS's and they were very unstable. Android x86 is the most stable for my laptop. I'll check out Prime OS and get back to you.


text:
Lock-screen passwords sometimes fails
I have recently updated from Android 8.1 to 9.
Since the update, there's a problem that keeps popping up every now and then. no matter how often I type the password, it does not get accepted. And I'm sure the password is right.
The only way out is to re-boot the phone. Then my password will be recognized again, until after a couple of days the problems arises again.
My phone is a Nokia 1, Build number 00WW_2_130_SP01.
Update:

tried changing the password, didn't work.
tried changing PIN for keyboard password input, didn't work
noticed that the previous login before this happens, I input the right password, the device lets me in, but shows the message "Wrong password". And in the next lock, it's for real, it won't recognize the right password.

Have you tried a factory reset? If it does not work correctly after a factory reset I would assume that this is just ab bug of the current version.

@Robert: if nothing appears, I'll give it a try.


text:
Will phone lose pairing if it was paired via WiFi direct and it connected to a WiFi network?
If a phone and another device is connected via WiFi direct, and the phone detected a home or free public WiFi network, will it connect with the WiFi network and lose pairing with the device it was originally paired to?

It will not connect the other wifi if you didn't connect it manually.

What if the WiFi network was set as "connect automatically" when detected by the mobile phone? Will connecting to WiFi then break up or cause the WiFi direct pairing to malfunction?

It will connect only when you end the connection with wifi direct


text:
How do I unlock bootloader when OEM unlock setting is missing in Developer options?
I have a HTC 816G Dual SIM. As you can see in the image below of Developer options there is no "OEM unlock" option. What can I do to unlock bootloader?

The "Allow OEM unlock" option is not standardized. Every manufacturer can implement an own mechanism. Therefore just use your favorite search engine and search for "htc 816g bootloader unlock". You will get some pages that show you how to unlock your device.

Android 4.x don't have this option, this option was first seen in lollipop (5.0).
This I've found on XDA if you don't find a guide to unlock your bootloader ask in the help thread.


text:
Is there an app, or method, to read .desktop file with url links via a file manager
At the moment I can move the .desktop file to the android device and (using FX File Explorer) open as application, choose Firefox, allow Firefox to access files and then it works. But whilst giving a file manager access to my files is a necessity, I don't really want Firefox to have access to my files (which it presumably needs by this method in order to 'read' the .desktop file). I really want the file explorer app to 'read' the .desktop file (as it already has access rights) and then forward the url it found there to my browser.
This is exactly the way both my cloud storage apps (Dropbox and Nextcloud) work when they encounter .desktop files. They just open the url in a browser without needing the browser itself to access the file.
Is there a way to make this happen within a file explorer app?

Are you talking about the .desktop files used by Linux desktop environments like this? It's just a text file that can be opened in any text editor. Or is it some other .desktop file?

Yes, the Linux created ones. Specifically just those used to store Url weblinks

You can use a file explorer like MiXplorer which has a text editor built-in. It's free and ad-free. Or you can go for some other similar file explorer.

As per the question. File explorers simply open the text document with a browser which then needs file access permissions (which I don't want to grant) to 'read' the URL. I was looking for an app which did the 'reading' and just opened a browser at the specified URL.

Sorry I still don't get your point. Do you want to open the .desktop file which contains a URL or you want to open the URL itself? Can you please share a sample of such .desktop file e.g. on https://pastebin.com/?

@Isaacson If FX File Explorer is your preferred file manager app why not writing to the author and ask for .desktop file support?

@Robert Looks like that might be my best bet, thanks.


text:
Network Locked SIM card on Unlocked Note 9
Have a Note9 on Tesco mobile, they have confirmned it is unlocked. I can use other UK SIM cards in this.
Trying my AIS (Thailand) SIM it asks me for a PIN for the Network Unlock?
Could this be a ROM issue? Is the phone region locked?
Any suggestions?
Cheers

OK Digging around found the solution.
Samsung devices have a regional warranty lock, I needed to make a 5-10 minute call to a local number using the Tesco SIM to unlock the phone for use with networks outside that region.
It is clearly printed on the box, but Tesco helpfully put thier own welcom to Tesco mnobile sticker over this.


text:
All calls are going to voicemail?
I'm still able to make outbound calls without any issue, however inbound calls are going straight to voicemail.  As in instantly.  Not a single ring or even delay.  Straight to voicemail.  Of course I get the voicemails right away and can call back.  Wondering what setting I might have changed to cause this problem?

A coworker suggested going into airplane mode and then back out.  That corrected the problem.


text:
What does "Global EU" mean in the context of smartphone versions?
While browsing smartphone offers, I encountered several offers like "Xiaomi Mi9 6/64GB Global EU". What does "Global EU" mean in this context?

It's the ROM version installed on the phone indicating the region. Manufacturers ship different ROMs depending on the region. Someone living in Europe will have a different ROM than one living in Africa or Asia. You can even find difference in ROMs within a continent or region.
Usually with Xiaomi phones, you have the Global and China ROMs. Then (if I am not mistaken -- someone corrects me here), the Global versions is divided in EU, Russia, India, etc depending on the market. Global EU is just the ROM version for the EU market.


text:
How can I block the update on my SM-G930V?
Note that my device is not rooted, and I have not downloaded the recent update yet

+1 because disabling com.wssyncmldm and com.sec.android.soagent via pm seems not sufficient according to XDA

@alecxs So it is impossible?

just wait for answer i am pretty sure it is possible. assuming you have already checked developer settings, there must be another solution


text:
'Recycling' off-the-shelf Android devices as server ('Toaster-Net')
Since Android devices tend to be relatively low-power un*x devices, this seems like an obvious usage, I was already able to run the basic setup of what I had in mind, but I think it's a right time for me to consult about this.
I have a few unused Android devices (tablets and phones, some with a broken display), I've seen there are several ways to install various Linux distributions on them, installed some scripting environment (Node.JS or Python) I've successfully ran a few that did not require rooting, and I've ran some server software from them (like Node-Express based REST etc) I'm left with the following open questions, maybe there are much simpler solutions to this scenario.
I'd be happy to hear of such a usage scenario.

All these non-rooted Linux apps I've installed - were running as long as the device did not go to 'sleep', I've tried several 'insomnia' apps, but actually non of them worked correctly, and they were all trying to keep the Display awake. I would actually prefer the Display to be Off, but the device to not sleep, is there a scheme for that, or is that not the general design of a common off-the-shelf Tablet let's say?
The app seemed to randomly go into 'background' even with the display on; Is there a settings to prevent that, so that I would have a reliable HTTP listener?
I understood that Battery life / performance - might be deteriorate severely - by keeping Tablets Changed 24/7, is there a standard solution for that? I've seen some recommendations for rooted apps that prevent charging on and off, but lacking another solution - a timer-AC-mains-Socket can be installed

Generally this seems like an ecological idea for 201x style ARM based Toaster-Nets; I found that I often need some 'cronjobs' to run and serve some not very CPU demanding experiments. It also seems like a good exercise in local net setup;
I can see this setup being used in schools for example to provide students a network they can play with and setup web-apps.
If there's a proper guide for this anywhere, please point, I've seen good guides for how to install Linux / a similar setup - on your phone for example for 'on and off' usage, but nothing that covered the actual aspect of leaving a bunch of these machines as a small server-farm.
Thank you!

I don't think you would be able to run something on a non-privileged app persistently. Android manages resources allotted to apps in its own way. Root your device, run the server as root and gain a wakelock. That's all. Process won't be killed, neither network connectivity would be dropped.

Thank @IrfanLatif! So Rooting a device, would help that, is the way for something like that? that's good to know, I'll keep on reading online for that direction then. I just didn't know whether the whole rooting procedure is necessary or helpful in the described use case; especially that rooting is Device-Dependent, right?

Rooting is danegerous to the degree of being fatal. It isn't the proper way to do things like that but it's the way how things like that work. And yes, rooting is device dependent most of the times as it involves unlocking bootloader, requires a custom recovery or needs some security flaw in device etc.


text:
What is the Samsung account on Android Phones for and what does it sync?
What is the purpose of the samsung account on my android phone? Does it make sense to use it and what does it sync to the cloud?
If I use a google account, isn't that basically enough? Do they interfere with each other?

What is the purpose of the samsung account on my android phone?

According to MySamsung:

Your Samsung account is a free integrated membership service that enables you to use Samsung services on smartphones, tablets, websites, TVs and other devices. Enjoy various Samsung services through your Samsung account, without having to sign up for each service separately.

Does it make sense to use it

Using it provides according to Samsung the benefits listed below. Whether it makes sense or not depends on whether you believe will add something to your experience while using a Samsung device.

A single ID for access, order tracking and support for all of your products
Exclusive services like Samsung Pay, Samsung+ and Samsung Health
Gift cards, special offers and more with Samsung Rewards
Product news and discounts from Samsung.com
Tips and tricks sent directly to your inbox for your registered products
With a Samsung Account, you are auto-enrolled into Samsung Rewards so you earn points from your purchases on Samsung.com and in the Shop Samsung app to redeem toward products and more.
  = With a mobile device, you get access to apps and services that also earns you points to use for great rewards.

and what does it sync to the cloud?

It can sync your files, pictures, SMS, etc. You will select what you want to sync.

If I use a google account, isn't that basically enough? Do they interfere with each other?

Yes, using a Google account is enough if you don't care about the benefits and the fact that some services offered are just redundant. But note that some updates may come only from Samsung store; and to use Samsung store, you need a Samsung account.
I don't think they interfere with each other but I might be wrong.


text:
Where are notepad notes stored?
A simple question really, where do apps such as notepad store their data (the notes)?
Additionally, where do offline games store their information (such as what level you're on)?
I've looked at the android/data/ files, but they're often empty. Any tips?
Example below:

According to that, the app uses 30+ mb of data

But, the file for that app (Internal Storage/Android/data/...) only has 8mb inside it. Where's the rest?
Edit: what's a "data" file? Here's my internal storage:
.
I'm on EMUI 9.1.0 and Android 9.

Welcome to Android Enthusiasts! The data should be in /data/data/ folder.

Can't find a data file. Updated with more info.

Android apps follow rules where each app is stored unter <pkgname>
and usually the data is stored in databases. big data (games) usually stored in obb
/storage/emulated/0 is your Internal Storage (which is a view for /data/media/0)
/data/user/0 is a symlink to /data/data (where you have no access)
/data/user_de/0 is rarely used for some apps (not sure if this my country code or stands for DeviceEncrypted)
so the example paths looks like this
/data/user[_de]/0/com.randomlogicgames.battletext/files/
/data/user[_de]/0/com.randomlogicgames.battletext/databases/
/data/user[_de]/0/com.randomlogicgames.battletext/shared_prefs/
/data/user[_de]/0/com.randomlogicgames.battletext/cache/
/storage/emulated/0/Android/obb/com.randomlogicgames.battletext/
/storage/emulated/0/Android/data/com.randomlogicgames.battletext/files/

So how exactly do I gain access to this "data/data" file (or the other ones)?

you don't. thats actually the sense of permissions

So there's physically no way (without rooting I assume)?

you can create backup and extract it https://android.stackexchange.com/a/211956


text:
What's the easiest way to add files to the Android system partition?
I need to add a root certificate to Android systems. I hope to achieve this by copying the appropriate file the following path: /system/etc/security/cacerts, or using a flashable zip.
Due to the fact that applications from Android version 7 and upwards no longer trust user-added CAs by default, I will need to do this to many tens of devices from multiple vendors.
Possible methods:

Rooting the devices
Via a custom recovery

Drawbacks:
Rooting:

I will need to separately find a method of rooting each device. There
is no generic rooting method that will work for all devices.

Custom recovery:

I will need to obtain multiple customized TWRP (or other) recovery images, one for each device model.
Not all devices have custom recovery images available.

Is there an easier and more generic method to achieve my goal?

it is OEMs ambition to avoid ROM manipulation, android becomes more and more secure with each version. for example Huawei stopped unlocking completely, and they recently introduced Extendable Read-Only File System "EROFS" which makes it "impossible" to add files (without flashing whole partition, at least). conclusion, Magisk and TWRP already are the most easiest and generic methods we can expect in future. Leave the rooting part at users responsibility, just create a generic Flashable zip or a Magisk Xposed module

Installing Magisk requires root or costam recovery?
This model requires root?
https://github.com/NVISO-BE/MagiskTrustUserCerts

Magisk IS root..


text:
Why Do Cables Affect Charging Speeds?
I had P1 Turbo with 5000mah battery. It's SC-13 could  0-100 in under a hour even with wifi enabled.
The charger is broken but I keep the cable. I use a third party 2.1A charger with dual ports. The weird thing is. My G7102 and Note 3 N9000 gets charged slowly with that cable compared to the original cable of Ace 2. Ampere says Samsung cable gives more than 2 times amperage.
Why is that? I don't know electronics can someone explain it to me why is that?

i can confirm this behaviour. i have noticed that Samsung phones charges only with Samsung cables, but i don't know the reason. and i am talking about "normal" microUSB <-> USB type A data cable (not the charger) maybe there is a tiny difference in length of contacts? on the other hand the samsung cables works fine for other devices

@Turkeyphant i believe this is more related to USB Charging Protocol than resistivity laws. the resistance does control the charging mode https://electronics.stackexchange.com/questions/177788 but this doesn't explain why Samsung isn't charging at all with non-samsung cables

@alecxs the only difference  I saw was the three pin design. 2 Power pins and a third pin probably for quick charge communication. So I believe its an internals thing.

Because some cables do not meet USB spec and are unable to negotiate faster charging protocols. Faster charging protocols such as USB-PD allow higher voltages and currents which provide a greater charging power to the device and increase charging speeds.

In addition, all cables have a resistance. This is affected by the length and cross sectional area supplying the power pins.

The formula is:

R =  ρ L / A

(Where R is resistance, ρ is resistivity, L is length and A is cross sectional area).
Other factors are the plug itself and the amount of power it can draw. Also, factors like QC 3.0 compatibility allow the phone to pull more current at a higher voltage. Phones intelligently decide how much power to draw as well based upon their own tables, the temperature and charge and other properties of the battery.
But, in general, a cable with higher resistance or unable to pull as much power will charge more slowly. Just because a cable is rated for 2A doesn't mean it will achieve this.
To see more detail, I suggest you get a meter that will allow you to measure the precise current and voltage using the same USB plug and different cables.


text:
Why is rooting considered dangerous?
I understand that being root, applications can do a lot more with your device, but an application first needs root access, so what is the problem? By that logic, Linux as a whole is a dangerous environment since you can give root access to commands by using "sudo". Wouldn't it be more correct to say that root access is as dangerous as the user? If the user is stupid and gives root access to all applications, then yes it is dangerous, but stupidity of users will always be present in the IT. field.
If you know what you give root access to, in what way is rooting your device more dangerous than not rooting?

root access is as dangerous as the user. thats it. if you talking about vulnerability "user" can also be the attacker. beware on android, apps permissions are based on user permissions - each app is another user. you can not compare with linux

Why is rooting considered dangerous

Because when you root your phone you have (basically) full access to your phone, if you accidentally delete a system file/application it can brick your phone & you have no way to get your files back unless, of course you have the stock firmware downloaded & restore your phone using Odin.

What is your affiliation with the site techwalla.com?

none lol, just a random site i found XP


text:
2 folders of same name in internal storage of Oneplus3
Currently on my phone, i have 2 folders of the same name. The content of both folder shows 0 bytes. EDIT : They are exactly the same. And the subfolders and files are also same with 0 bytes content. When i deleted the 2 folders with same name, then other new folder was seen with the same name of an existing folder. I know it sounds confusing and impossible. But could this be due to storage problem?
I only want to ask, is this a known problem or has this happened with someone else before ?

What exactly is the name of those duplicate folders? How are you looking at them? I mean which app you are using?

I am using 'FX file explorer'. Initially it was Whatsapp. Then after deleting 2 folders of Whatsapp, it was Viper4android.

May be a problem with File Explorer or Media Storage. Filesystems don't support multiple files/folder of identical names in same directory. Try some other explorer or Termux to see directory names.

@IrfanLatif i checked in termux too. It was still the same. All my pictures in whatsapp folder were gone from gallery.


text:
How to block LINE stamp spam
In the Android app LINE, since yesterday, I started receiving spam messages like this one (below the advertisment):

The spammer (with the name LINEスタンプ in this case, can also be LINEで応募) appears in my messages list despite not being my friend.
I have deleted the conversation, but more messages have kept coming yesterday and today.
Is there any way to block or report the spammer?

I would rather not open the message.
The long-press menu does not show any block option, only "Delete" which I tried already.

The LINEスタンプ account is automatically added (with your permission nor knowledge) to your friends (in the Official accounts tab) when you download any stamp collection:

Long-press it and select Block:

Then delete the conversation. It should not reappear this time.

The same idea applies for groups that turned spammy: Rather than tapping Hide or Delete in Chats, tap Leave in Home>Groups.


text:
How to configure a Bluetooth keyboard to open and close a specific app?
I want to convert my Bluetooth keyboard to some sort of control panel for my car, to open maps etc on keypress. So that I don't need to use the touchscreen while driving.
Is that possible?

Looks like some old phones with integrated physical keyboard had this functionality:https://www.dummies.com/consumer-electronics/smartphones/droid/quick-launch-feature-for-android-phone-apps/

Does your keyboard have media buttons by any chance? If so you can use something like Tasker or Automate (Free) to programatically set actions. I happen to have Automate on my phone and just checked you can use media buttons as a trigger e.g. pause, play, next, previous, eject etc. Then you can hook this up to start apps and voice searches easily - the interface is pretty straightforward if you haven't used one of these apps before.
If your keyboard doesn't have media buttons a generic bluetooth remote of some sort could work (try ebay/aliexpress etc.)
Quick google search says Tasker can't capture generic keypresses but that might've changed since 2015.

Awesome! I have some media buttons on it, great!


text:
Moto G back up without booting
I have a Moto G first generation that is stuck on the M boot screen.  I have tried going to recovery and wiping cache but the cache wipe does not complete even after hours (it stays on wiping/formatting cache).  Is there a way to back up what's on the phone without it booting (so I can then try the factory reset)?  Thanks!

I assume the device bootloader has not been unlocked, right?

Right, the bootloader has not been unlocked.


text:
My GPS location changes when on a call
My GPS location is accurate in Google Maps except when I am on the phone.  It consistently changes my location to another house 5 blocks away. When I end the call it goes back to my real location.
How can I resolve this?
Scott

May be this is your "non-GPS" location (automatic disabling of GPS while calling or you cover the GPS sensor so that it no longer finds the satellites)? Have you checked what happens if you disable GPS? Try to perform the call hands-free may be the position then doe snot change.

Now that I understand the difference between GPS and non GPS location it makes sense because it always puts me in the same wrong place when I’m on a call which must be where one of the cell towers try to locate me.


text:
How to troubleshoot a regularly crashing Google Play?
I'm using a Lineage OS custom ROM on a Xiaomi Redmi 4A. I can't remember when it started, but quite often, I see a message telling me that "Google Play has stopped working".
This can happen on the launcher screen, or while using an app. I have seen it happen in all apps I use regularly. It happened around 6 times while I was writing this post, but the frequency varies.
I have installed a Logcat Reader application, and captured the log after a crash. This is what I think is the relevant part:
[07-24 15:26:38.492 2654:2699 F/libc]
invalid address or address of corrupt block 0x78 passed to dlfree

[07-24 15:26:38.492 2654:2699 F/libc]
Fatal signal 11 (SIGSEGV), code 2, fault addr 0xdeadbaad in tid 2699 (bgExecutor #2)

[07-24 15:26:38.602 708:708 F/DEBUG]
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***

[07-24 15:26:38.602 708:708 F/DEBUG]
LineageOS Version: '13.0-20170307-UNOFFICIAL-rolex'

[07-24 15:26:38.603 708:708 F/DEBUG]
Build fingerprint: 'Xiaomi/lineage_rolex/rolex:6.0.1/MOB31K/fc38c175e6:userdebug/test-keys'

[07-24 15:26:38.603 708:708 F/DEBUG]
Revision: '0'

[07-24 15:26:38.603 708:708 F/DEBUG]
ABI: 'arm'

[07-24 15:26:38.603 708:708 F/DEBUG]
pid: 2654, tid: 2699, name: bgExecutor #2  >>> com.android.vending <<<

[07-24 15:26:38.603 708:708 F/DEBUG]
signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0xdeadbaad

[07-24 15:26:38.650 708:708 F/DEBUG]
Abort message: 'invalid address or address of corrupt block 0x78 passed to dlfree'

[07-24 15:26:38.650 708:708 F/DEBUG]
    r0 00000000  r1 00000000  r2 00000000  r3 00000002

[07-24 15:26:38.651 708:708 F/DEBUG]
    r4 00000078  r5 deadbaad  r6 f7073f38  r7 ab33a000

[07-24 15:26:38.651 708:708 F/DEBUG]
    r8 00000080  r9 dccd2afc  sl f6fd58db  fp f6fd58e4

[07-24 15:26:38.651 708:708 F/DEBUG]
    ip f706e5d8  sp dccd29e8  lr f703fc6d  pc f703fc6c  cpsr 600f0030

[07-24 15:26:38.658 708:708 F/DEBUG]

backtrace:

[07-24 15:26:38.658 708:708 F/DEBUG]
    #00 pc 00030c6c  /system/lib/libc.so (dlfree+1287)

[07-24 15:26:38.658 708:708 F/DEBUG]
    #01 pc 000157cd  /system/lib/libandroidfw.so (_ZN7android13ResStringPool6uninitEv+38)

[07-24 15:26:38.658 708:708 F/DEBUG]
    #02 pc 0001651d  /system/lib/libandroidfw.so (_ZN7android10ResXMLTree6uninitEv+14)

[07-24 15:26:38.659 708:708 F/DEBUG]
    #03 pc 0001653b  /system/lib/libandroidfw.so (_ZN7android10ResXMLTreeD1Ev+4)

[07-24 15:26:38.659 708:708 F/DEBUG]
    #04 pc 00013267  /system/lib/libandroidfw.so (_ZN7android12AssetManager10getPkgNameEPKc+258)

[07-24 15:26:38.659 708:708 F/DEBUG]
    #05 pc 000132c3  /system/lib/libandroidfw.so (_ZN7android12AssetManager18getBasePackageNameEj+62)

[07-24 15:26:38.659 708:708 F/DEBUG]
    #06 pc 0008894b  /system/lib/libandroid_runtime.so

[07-24 15:26:38.659 708:708 F/DEBUG]
    #07 pc 726cc6e1  /data/dalvik-cache/arm/system@framework@boot.oat (offset 0x1f93000)

[07-24 15:26:39.752 708:708 F/DEBUG]

Tombstone written to: /data/tombstones/tombstone_06

[07-24 15:26:39.752 708:708 E/DEBUG]
AM write failed: Broken pipe

I have tried to wipe the dalvik cache partition, as well as reinstalling Google Play from opengapps.org. Neither fixed the problem.
What should I do to work towards fixing this?

On which device does this occur? Is the device rooted and/or is a custom ROM installed?

@Robert This is a Xiaomi Redmi 4A, with a LineageOS custom ROM installed.

When installing Open GApps on Lineage OS, it must be flashed together with the Rom. Installing GApps after flashing the rom and booting the phone cause crashes. If you want to use Open GApps with Lineage OS, download both and place them in the memory and first flash the rom zip file. Without exiting the rom flash GApps zip and boot the phone. At the firts boot, you will be asked to configure your google logins and then GApps can be used.
Read installation instructions on LineageOS wiki

Hmm, this might be a thing I did wrong back when I flashed this ROM. What would be the best way of backing up the data before a factory reset? I've heard of NANDroid as a good, comprehensive backup, but I'd think that it would also restore the erroneous state that creates these crashes.

What is the recovery you currently on? TWRP or CWM? They provide recovery/backup tools too. Read this article on XDA or this thread for some comparison.

Thanks for the info. I am currently using TWRP. However, a too-comprehensive backup might, ironically, be a problem. The crashes must be caused by an some incorrect data stored somewhere by something. Therefore, restoring absolutely all data, of all apps, would restore the crashes too. How can I make sure I don't "overshoot"?

I suggest trial and error


text:
ADB: what are system/secure/global namespaces about?
In the 'settings' command (i.e. which invokes cmd command) there are 3 namespaces

system
secure
global

What are these and why are some features on one rather than another?

I assume that "system" and "secure" refer to the sections in the Android settings UI that existed at the time the settings command was introduced. The third namespace "global" is may be just a nice name for the "everything else" category.

The Android developers pages give the answers to both your questions.

System

System settings, containing miscellaneous system preferences.

Secure

Secure system settings, containing system preferences that applications can read but are not allowed to write. These are for preferences that the user must explicitly modify through the system UI or specialized APIs for those values, not modified directly by applications.

Global

Global system settings, containing preferences that always apply identically to all defined users. Applications can read these but are not allowed to write; like the "Secure" settings, these are for preferences that the user must explicitly modify through the system UI or specialized APIs for those values.

Each link also states when the settings were first introduced and provides a list of variables, functions that can be accessed programmatically (not just through adb), if they are deprecated, etc.


text:
Samsung's device care app and running services option in developers settings show two different values for the amount of RAM free on my device
As shown by Samsung:- https://m.imgur.com/gallery/yoiOnlS
As shown by developer options by Android:- https://m.imgur.com/gallery/OzNwRMO
Why is it happening? Why is Samsung lying?

Both of your images are removed. Please re-add here in the post. Also, what free -h and dumpsys meminfo | grep -A10 'Total RAM' show?

https://imgur.com/Gus2qzG - Device care @IrfanLatif

https://imgur.com/y8N7Z6G - Developer options @IrfanLatif

What about the remaining part of my query?

@IrfanLatif dang sorry I forgot to mention the results. The first one shows that 2.6/2.6 gb of RAM is being used and the second one says "grep" is not recognized as an internal or external command.


text:
What info does a Mobile Browser send to the Web Server
What info can be gleaned from a Mobile Phone by a website? (Not an app).
Is user specific information such as Phone Number, IMEI, Google Account info etc obtainable via HTTP headers?

Visit https://whoer.net/ from different browsers.

You only get very basic information on the device.
See for example the following sample requests from a Samsung Galaxy S7:
Samsung Browser:
Accept-Language: de-DE,de,en-US,en
User-Agent: Mozilla/5.0 (Linux; Android 8.0.0; SAMSUNG SM-G930F Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/9.2 Chrome/67.0.3396.87 Mobile Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Accept-Encoding: gzip, deflate

Chrome:
User-Agent: Mozilla/5.0 (Linux; Android 8.0.0; SM-G930F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.143 Mobile Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3
Accept-Encoding: gzip, deflate
Accept-Language: de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7

Firefox:
User-Agent: Mozilla/5.0 (Android 8.0.0; Mobile; rv:68.0) Gecko/68.0 Firefox/68.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: de-DE,de;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate

Firefox Klar:
User-Agent: Mozilla/5.0 (Linux; Android 8.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Focus/8.0.15 Chrome/75.0.3770.143 Mobile Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3
x-requested-with:
Accept-Encoding: gzip, deflate
Accept-Language: de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7

As you can see the HTTP headers of some browsers contain the device model and the Android version number and the used browser app.
Note: Other web browsers may send additional headers.


text:
How to organize photos from Camera folder in to folders sorted by month names?
For various reasons, I often end up pulling photos of my phones by connecting the USB connection to a computer and extracting what I need.
The problem I am facing is that my DCIM/100ANDRO folder is now huge, and simply loading the full list of files takes considerable time. Is there some way (ideally in basic Android 7.1.1, but additional apps are acceptable) to sort these in to separate folders possibly by month of taking or similar. Onus points if this happens dynamically as photos are taken.
I'd also be interested in alternatives to the USB -> browse device options, but I'd want something that does full resolution, doesn't upload to an internet location first, and doesn't require bluetooth.

Android 7 stock Photo Gallery has some basic views by default, you can group by time or by location. Is this sufficient for your needs, or do you mandatory need to sort in folders?

@alecxs folder's I'm afraid - the problem isn't navigating on the device itself, it's when I browse the SD card from an attached device.
If there's a quick way to "send" full res photos to a nearby PC, ideally via the USB as the network situation is complicated, that would work too.

Do you mean when connected via USB MTP, it takes too long to show, so you never be able to start copying DCIM folder, because you can't see/select folder for copying?

You could run a shell script each time on triggering event (for example on gallery start) which creates subfolders and move files into with MacroDroid

for a simply transfer you could enable USB debugging in developer settings and run from cmd.exe when connected via USB cable (or adb over wifi) adb.exe pull -a -p /sdcard/DCIM/Camera

There must be apps to facilitate what you want to achieve, but one of very straight forward method (for me at least) is to use a shell script as suggested by @alecxs in comment. We can read date of Photo Taken using exiv2 commandline tool. You can build from source or try this one. Or get Modified Time of photo using stat command, but the former is usually more accurate because some programs like file explorers badly change the modified date e.g. during copy/move operation.
Once the month of photo is known, create respective folder and move photo there:
#!/system/bin/sh
set -e

DIR='/sdcard/DCIM/100ANDRO'

find $DIR -maxdepth 1 -type f -iname '*.jp*g' -o -iname '*.png' |
while read -r photo
do
    month=$(exiv2 -q pr "$photo" | busybox awk -v c=1 -F '[: ]' '/timestamp.*[0-9]{4}:[0-9]{2}:[0-9]{2}/{print $5"_"$6; c=0} END{exit c}') ||
    month=$(busybox stat -c %y "$photo" | busybox awk -v c=1 -F '[- ]' '/[0-9]{4}-[0-9]{2}-[0-9]{2}/{print $1"_"$2; c=0} END{exit c}') ||
    { echo "Couldn't find month for $photo" >&2; continue; }

    mkdir -p "$DIR/$month"
    mv -n "$photo" "$DIR/$month/"
done

echo Done.

Android's awk and stat are buggy or show non-standard behavior. Better use busybox.
Let's name the script sort.sh. This is how it works:
~$ find /sdcard/DCIM/100ANDRO/ -type f
/sdcard/DCIM/100ANDRO/00100sPORTRAIT_00100_BURST20190222182032908_COVER.jpg
/sdcard/DCIM/100ANDRO/IMG_20170312_013609.jpg
/sdcard/DCIM/100ANDRO/IMG_20180818_180827_HDR.jpg
/sdcard/DCIM/100ANDRO/IMG_20190222_164812.jpg
/sdcard/DCIM/100ANDRO/PANO_20190421_132245.jpg

~$ sort.sh
Done.

~$ find /sdcard/DCIM/100ANDRO/ -type f
/sdcard/DCIM/100ANDRO/2017_03/IMG_20170312_013609.jpg
/sdcard/DCIM/100ANDRO/2018_08/IMG_20180818_180827_HDR.jpg
/sdcard/DCIM/100ANDRO/2019_04/PANO_20190421_132245.jpg
/sdcard/DCIM/100ANDRO/2019_02/00100sPORTRAIT_00100_BURST20190222182032908_COVER.jpg
/sdcard/DCIM/100ANDRO/2019_02/IMG_20190222_164812.jpg

Additionally you may use file command (instead of relying on file extensions) to only move photos and not videos or other files. But again Android's /system/bin/file is very limited. Either use one from Termux, or build from source, or try this one.
You can run this script manually or on a regular basis using some automation app. crond is also an option if you have root.

I'd also be interested in alternatives to the USB -> browse device options

This part is itself a separate question. If you want to browse files from PC you can go for adbfs, SSHFS/SFTP, FTP, WebDAV, SMB etc. Or to simply transfer files adb pull will suffice and is reasonably faster. If you have root and the volume of data to be transferred is high, consider using USB Mass Storage (UMS) from custom recovery. It's very high speed and reliable method.

Can this be run without root? (I'll have to search on how to pull up shell etc, but sure I can figure that out)

No root required. You can run script from adb shell or terminal emulator app like Termux.


text:
Configure Emergency Alerts on Android Pie
My phone is in either vibrate or DND mode at night. I enabled developer mode in order to be able to allow the emergency alerts to ignore DND, since otherwise they make no sound at night (don't know why this requires developer mode, I would have thought it would be the default setting).
I would like more fine-grained control than just that setting. When I'm sleeping, there's no reason for me to be woken up by one of the frequent Amber alerts, since I'm not going to be much help from my bed. If there's an Incoming Ballistic Missile alert on the other hand, I wouldn't mind be roused for that.
Currently, it seems that I have the following options:

Prevent all alerts from breaking through DND - Makes alerts useless
Allow all alerts to break through DND - Get woken up constantly by
Amber alerts
Turn off Amber alerts and allow other alerts to break
through DND - Prevents me from helping with Amber alerts when I'm out
of the house

Is there a way to configure the alert settings between the various types of emergency alert in Android 9? Maybe an app that give me better control? I'm using an Essential PH-1, if the phone type matters.

Are you sure the emergency message system is used in your region and by your mobile network operator? Some countries/regions do use an app-based emergency notification system instead.

I forgot to mention that I'm in Canada. I do receive messages from the emergency message system (I've received some severe weather alerts and many Amber alerts)


text:
How to unlock bootloader on nexus from bootloader/PC command line
I have a nexus 5X phone, which needs a factory reset to fix it's infinite boot loop. The problem is that the bootloader says DEVICE STATE - locked. Is it possible to fix this?

I can't boot into android, and oem and the bootloader are locked out.

ah ok, i understand. so you can not unlock from fastboot because oem unlocking is not allowed in developer settings. but did you try factory reset from recovery mode?

Tried, but can't even access recovery mode. That too gives infinite  boot loop. Its completely locked into fastboot. I'm looking for a way around that isn't a new phone.

Maybe flashing a new system with a factory signed .img will work.  https://developers.google.com/android/images

@BoLawson can signed img flashed from fastboot without unlocking, or you mean flashing with QFIL or QPST?

Google Nexus is in real LG brand!? Here someone claimed to use LGUP Tool https://forum.xda-developers.com/showpost.php?p=63969457&postcount=10

@alecxs yes a factory signed .img can be flashed from a locked bootloader especially from a developmental device such as a Nexus. Another possible option, there is the Nexus root toolkit from Wugfresh.

@BoLawson so step 4. from the tutorial you posted can just be skipped?

@alecxs should be at least it was like that in the past.I believe that is why it states if necessary. However it also I states if "updated".

Nexus root toolkit looks promising, but i am afraid it is just a gui for fastboot/adb commands

Tried all of these, and contacted LG and google. They both say the phone is probably toast, even in the unlikely event I manage to flash a new img.