Android Tips and Tricks

Fixed

Android Device turning on it's hidden night light that keeps turning on daily

Issue: Android device keeps turning on night light by itself even though the setting has been turned off. Here's a video showing the same.

Why: In Android devices with their own skin of Android they usually forget to disable the native android's own night light while implementing their own such stupid night light to get stupid fucking shit certifications for eye care.

Solution: Sorry to write this but you need developer mode and USB security settings enabled which will require you to enable developer mode but might also require you to sign in with the brand's own account system(like in mi devices for example). Once you have done that, connect to a computer and type the following.

adb shell settings put secure night_display_auto_mode 0
adb shell settings put secure night_display_activated 0

Bypass OS per App security settings toggle disabled for user / or / Fluid Navigation Gestures stopped working due to MIUI stopping the accessability service permission as Restricted Setting

Pre-Requisites: PC with adb already setup, Android USB Debugging enabled (Security Settings that require MI sign not the normal one).

Solution:
1. Install Shizuku from Playstore.
2. Install AppOps from Playstore or ApkMirror(Had to download with this since the Playstore one was "old" and it won't let me download).
3. Run Shizuku ADB Command on PC:
adb shell sh /sdcard/Android/data/moe.shizuku.privileged.api/start.sh
4. Open Shizuku once and close it. Then open AppOps and select working method as Shizuku.
5. Find Fluid Navigation Gesture in AppOps and allow ACCESS_RESTRICTED_SETTTINGS.

Further Note:
Even after you have allowed this, FNG's accessibility was enabled but it was unable to hide the navigation bar at all. I tried a bunch of other apps and none of them fully worked. In the end you are left with two choices: Either use the default launcher with full screen navigation or use FNG with Nova but buttons will be enabled.
P.S: Yes, I tried hiding the navigation bars with ADB, didn't work.
Any other extra steps and it looks like Custom ROM will be the answer which I am reluctant to go back to again(too much setups, too many bugs to have a stable phone with limited functionality like fast charging, camera and app's cameras just being broken being one of many.)

Read external USB Storage Devices (HDD/SSD) on Android

Normally phones pick up such storage devices normally like I showed here but one some heavily skinned Android phones and older phones you will have to use these:

Total Commander File Manager

exFat/NTFS Paragon Plugin: Play Store (Just clear data of this app when trial expires)

App: Total Commander File Manager: Amazing piece of technology

Download: Play Store Version, Android Forum with two versions: Shizuku Support (For accessing obb and data folders without root) and the non-restricted versions to gain access to other folders on your Android system.

Plug-ins for the same: Play Store Links

Have been using this application from my Java days and when Android was first introduced. To this day, this is the only app that has so much functionality that other apps can only dream of. The play store version is heavily restricted so you can get some other versions by going through the forums

Unfixed/Ongoing

Old Stuff(Might not work anymore)

MIUI Bootloop (redmi 2 Prime)

1) Flash TWRP or OrangeFox (i did it with OF)

2) Clean Flash any custom rom, probably still bootloop

3) Reboot recovery

4) Wipe everything (dalvik, data, system, cache), also format data (format ≠ wipe)

5) Reboot recovery

6) Flash your MIUI rom

7) Reboot recovery

8) Wipe everything (dalvik, data, system, cache), also format data (format ≠ wipe)

9) Reboot recovery

10) Flash again your MIUI rom

11) Reboot recovery

12) Flash persist.img file in persist partition, you can find this file in your fastboot MIUI rom downloaded at https://c.mi.com/miuidownload/index

13) Reboot system

14) Wait a lot, take a cup of tea.​

Making Android phones ad-free and Bloatware free

Video: Video on MI Phone

For more user-friendly of the same thing head over to https://github.com/Szaki/XiaomiADBFastbootTools.
The following is my version that I use. I like to have more control.

  1. Unlock Device from MIUI:
    Before going ahead. Unlock your device via en.miui.com/unlock which might require signing into MI account on your device(a pain in the a$$, I know) and a waiting period of few hours to a few days. This step is not needed but strongly recommended [1].
  2. After you have unlocked your bootloader, sign out of your Xiaomi account my going into settings->MI Account-> Sign out.
  3. Developer Options:
    Setting-> About Phone -> Click on the MIUI version (the below one) multiple times till a toast appears saying, “You’re now a developer.” (If only it was that easy to be a developer).
  4. OEM Unlocking check:
    Go to Settings-> Additional Settings -> Developer Options. Check if Mi Unlock status is unlocked. It should be if you have performed step 1 correctly. If not go back and make sure it’s on. Also make sure OEM Unlocking is turned on.
  5. USB Debugging:
    In the Developer options, scroll just a little bit and you will see the option to enable USB Debugging. Enable it, wait 5 seconds, read the warning if you want to, and then accept.
    Bonus1: Few Tweaks for faster experience:
    In Developer options under Drawing you will see the following options. Set them as specified:
    Window animation scale: Animation Off
    Transition animation scale: Animation Off
    Animator animation scale: Animation scale 0.5x
    Bonus2: Go all the way down and you will see the option, “Turn on MIUI optimisation.” This option is needed to be turned off when you are installing YouTube without ads (YouTube Vanced)
    DON’T CHANGE ANY OTHER SETTINGS.
  6. ADB Drivers:
    Now on your PC (Don’t connect phone yet), install ADB Drivers from here. Make sure during installation you
    select install for everyone.
  7. Connect via ADB:
    Now connect your phone to your PC and open Command Prompt from start menu.
    In Command Window type
    adb devices
    As soon as you type it on your phone it will ask for authorization. Select Yes. Now on your PC it should spit out a code. The code is not important to remember but it should show up.
    Driver Fix: If it doesn’t something needs to be revisited, check cable, check that you have enabled ADB in Developer option. Check that you have installed ADB Drivers. More likely than not it has to be a problem with Android Drivers not installing properly. To re-install drivers, visit this link by Google and then extract all files to any place on your PC. Go to the extracted files, right click android_winusb.inf and select Install.
  8. APK Name:
    Go into Setting->Apps->Manage Apps->Three Dots to the upper right->Show all apps
    Now there are many apps that you can see here but most of them are needed for crucial running of the system. You need the APK name name of the app to remove it. For that select an app you want to remove and click on the i option in the top right. It will show you the APK name.
  9. Command to remove an apk:
    Type the following followed by the package name:
    adb shell pm uninstall -k --user 0 <package name>
    For example,
    adb shell pm uninstall -k --user 0 com.micredit.in
  10. The following is the list of my commands that I use when setting up a new device.
    It also contains extra google apps because I can install them later from play store (because on many devices you can just install a lite version of the same apps if it’s too heavy for example, Maps Lie instead of Maps, Google lite instead of Google etc…). This list also removes msa (used for advertising).
    You can install Mi Music, Mi Calculator again from play store if needed and hence they are also being removed.
    You do not need to copy each lines one by one and then paste them, you can just copy all and paste in CMD.

adb shell pm uninstall -k --user 0 com.miui.android.fashiongallery
adb shell pm uninstall -k --user 0 com.micredit.in
adb shell pm uninstall -k --user 0 com.xiaomi.midrop
adb shell pm uninstall -k --user 0 com.miui.miservices
adb shell pm uninstall -k --user 0 com.miui.miservice
adb shell pm uninstall -k --user 0 com.miui.player
adb shell pm uninstall -k --user 0 com.miui.msa.global
adb shell pm uninstall -k --user 0 miui.daemon
adb shell pm uninstall -k --user 0 com.miui.daemon
adb shell pm uninstall -k --user 0 com.miui.hybrid
adb shell pm uninstall -k --user 0 com.mfashiongallery.emag
adb shell pm uninstall -k --user 0 com.miui.videoplayer
adb shell pm uninstall -k --user 0 com.xiaomi.mirecycle
adb shell pm uninstall -k --user 0 com.mipay.wallet.in
adb shell pm uninstall -k --user 0 com.mipay.wallet.id
adb shell pm uninstall -k --user 0 com.xiaomi.payment
adb shell pm uninstall -k --user 0 com.miui.mishareconnectivity
adb shell pm uninstall -k --user 0 com.miui.mishare.connectivity
adb shell pm uninstall -k --user 0 com.google.android.music
adb shell pm uninstall -k --user 0 com.google.android.videos
adb shell pm uninstall -k --user 0 com.xiaomi.mipicks
adb shell pm uninstall -k --user 0 com.xiaomi.glgm
adb shell pm uninstall -k --user 0 com.miui.bugreport
adb shell pm uninstall -k --user 0 com.facebook.services
adb shell pm uninstall -k --user 0 com.facebook.appmanager
adb shell pm uninstall -k --user 0 com.facebook.system
adb shell pm uninstall -k --user 0 com.google.android.apps.tachyon
adb shell pm uninstall -k --user 0 com.android.browser
adb shell pm uninstall -k --user 0 com.mi.globalbrowser
adb shell pm uninstall -k --user 0 com.miui.android.fashiongallery
adb shell pm uninstall -k --user 0 com.facemoji.lite.xiaomi
adb shell pm uninstall -k --user 0 com.google.android.apps.docs
adb shell pm uninstall -k --user 0 com.facebook.katana
adb shell pm uninstall -k --user 0 com.google.android.gm
adb shell pm uninstall -k --user 0 com.google.android.apps.maps
adb shell pm uninstall -k --user 0 com.google.android.projection.gearhead
pause

Iqoo Phones Bloatware:

adb shell pm uninstall -k --user 0 com.google.android.youtube
adb shell pm uninstall -k --user 0 com.facebook.appmanager
adb shell pm uninstall -k --user 0 com.facebook.system
adb shell pm uninstall -k --user 0 com.facebook.services
adb shell pm uninstall -k --user 0 com.vivo.Tips
adb shell pm uninstall -k --user 0 com.google.android.apps.messaging
adb shell pm uninstall -k --user 0 com.yozo.vivo.office
adb shell pm uninstall -k --user 0 com.vivo.game
adb shell pm uninstall -k --user 0 com.vivo.livewallpaper.plant
adb shell pm uninstall -k --user 0 com.vivo.desktopstickers
adb shell pm uninstall -k --user 0 com.vivo.browser
adb shell pm uninstall -k --user 0 com.vivo.notes
adb shell pm uninstall -k --user 0 com.vivo.feedback
adb shell pm uninstall -k --user 0 com.vivo.livewallpaper.behaviormountain
adb shell pm uninstall -k --user 0 com.google.android.apps.tachyon

Reinstall from Playstore
Not Required to Run Facebook
Not Required to Run Facebook
Not Required to Run Facebook
I uninstalled Tips. Who wants Tips.
Reinstall from Playstore if required. Just use SMS Organizer.
Install some other Document viewer.
Malware.
Install other livewallpaper if you really want them. They eat battery.
Stickers!
Malware
Use another notes app
It reinstalled itself again.
Live Wallpaper
Reinstall from Playstore


Note: System apps if deleted and then reinstalled become system apps again if reinstalled from playstore.

For some lines, it will say Failure or Failure[-1000], just ignore them. As far as I know the Wallpaper Carousel can’t be removed from all phones.

The following Apps are NOT RECOMMENEDED to remove but you can if you don’t use them. Remember you will have to use Google’s equivalent from the Play Store for these:
adb shell pm uninstall -k --user 0 com.android.deskclock
adb shell pm uninstall -k --user 0 com.miui.notes
adb shell pm uninstall -k --user 0 com.xiaomi.joyose | Neede for gaming features
adb shell pm uninstall -k --user 0 com.miui.cleanmaster

Also you can easily get rid of MI Calendar but don’t remove Calendar Storage or Calendar Services. They both are needed on your phone for any calendar to work.

adb shell pm uninstall -k --user 0 com.xiaomi.calendar

You can uninstall Google app and install a lighter version Google Go. This will not remove the google account from your phone just the search app.
adb shell pm uninstall -k --user 0 com.google.android.googlequicksearchbox
Also the Google Assistant won’t work with your voice if you remove this. You can still search from Google Go but Assistant won’t work, so you might as well remove it:
adb shell pm uninstall -k --user 0 com.google.android.apps.googleassistant

Authorization and Revoke:
Setting->Password & Security -> Authorization & Revocation -> Remove autorization for all apps. All of them. The ones that will be needed will be turned on automatically.
Search for “Special App Access” in settings.
In Usage Access-> Turn it off for everyone except Camera which stops working if not allowed.
In Display Over Other apps-> Turn it off for those apps that aren’t needed to show over other apps. Basically all Xiaomi apps because this is what they use to show full screen ads. Keep it enabled for the following:
Android Accessibility Suite, App vault, Screen Recorder, YouTube, VLC.

I am assuming you have already disabled normal ads in all the system apps, if not just go into those apps which show you ads especially security and turn off receive recommendations.

Further reading and explanation:
[1] Xiaomi’s updates are very bad. You can lock your device later if you wish to (via Xiaomi Flash tool) but it is not recommended. I had a new MI A2 and the first update that it had bricked(rendered it completely useless) because of an update and because the Bootloader was locked. This is just a safety step so that later if something goes wrong by Xiaomi or by You, you have a way to fix it.
[5] The reason to keep the animator scale at 0.5x is that loading icons stop working if set to zero.
[Bonus2] YouTube Vanced’s official website is vancedapp.com

How to uninstall system app or any app without having rooted?

adb shell

pm uninstall -k --user 0 com.my.demo.app

List of safe to remove apps on MIUI: Just copy and paste all inside ADB Shell.
 

adb shell pm uninstall -k --user 0 com.miui.android.fashiongallery

adb shell pm uninstall -k --user 0 com.micredit.in

adb shell pm uninstall -k --user 0 com.xiaomi.midrop

adb shell pm uninstall -k --user 0 com.miui.miservice

adb shell pm uninstall -k --user 0 com.miui.msa.global

adb shell pm uninstall -k --user 0 miui.daemon

adb shell pm uninstall -k --user 0 com.miui.daemon

adb shell pm uninstall -k --user 0 com.miui.hybrid

adb shell pm uninstall -k --user 0 com.mfashiongallery.emag

adb shell pm uninstall -k --user 0 com.miui.videoplayer

adb shell pm uninstall -k --user 0 com.xiaomi.mirecycle

adb shell pm uninstall -k --user 0 com.mipay.wallet.in

adb shell pm uninstall -k --user 0 com.mipay.wallet.id

adb shell pm uninstall -k --user 0 com.xiaomi.payment

adb shell pm uninstall -k --user 0 com.miui.mishareconnectivity

adb shell pm uninstall -k --user 0 com.miui.mishare.connectivity

adb shell pm uninstall -k --user 0 com.xiaomi.joyose

adb shell pm uninstall -k --user 0 com.google.android.music

adb shell pm uninstall -k --user 0 com.google.android.videos

adb shell pm uninstall -k --user 0 com.xiaomi.mipics

adb shell pm uninstall -k --user 0 com.xiaomi.mipicks

adb shell pm uninstall -k --user 0 com.xiaomi.glgm

adb shell pm uninstall -k --user 0 com.miui.bugreport

adb shell pm uninstall -k --user 0 com.facebook.services

adb shell pm uninstall -k --user 0 com.facebook.appmanager

adb shell pm uninstall -k --user 0 com.facebook.syste

adb shell pm uninstall -k --user 0 com.google.android.apps.tachyon

adb shell pm uninstall -k --user 0 com.android.browser

 

Grant PowerAmp Media Player Long press Volume to change tracks option:
adb shell pm grant com.maxmpz.audioplayer android.permission.SET_VOLUME_KEY_LONG_PRESS_LISTENER

 

Universal ADB Drivers: https://adb.clockworkmod.com/

 

FlagSecureMagisk: https://forum.xda-developers.com/apps/magisk/module-smali-patcher-0-7-t3680053