# Question
Title: Are multiple-users protected from each other differently than apps?
I confess that I come from the happy world of unix computers, and am used to the concept of user accounts and hence group `gid`s and userids `uid`s. For the occasional usage of an untrusted app (i.e. **whatsapp/facebook**) I have created another user profile for many reasons, but mostly because I wanted to reduce any potential access **whatsapp/facebook** might gain with regards to my main account.

Now the strange thing is that to the best of my understanding the protection mechanism of AOSP, relies on assigning a actually user ids to individual apps, as with those `uid`, the apps can be limited using that the underlying `linux` kernel provides *Unix Discretionary Access Controls* (i.e. file accesss dependent on `uid` and `gid`).

My question is if I am misleading myself that AOSP provides any stronger protection with regards to multi-users (in between the accounts) than it does with regards to the various apps to each other?

# Answer
## PRIVACY: ANDROID VS. \*NIX:

**PROTECTION:**

**Being protected** has a very vast meaning, varying for persons and situations. Comparing Android with \*NIX systems, admittedly the former offers more isolation between apps and a more fine-grained control over permissions. Quick examples:

* On PC, user is trusting all the processes / apps running under same UID (usually a human user) (). On Android it's not the case; every app is a different user to have possibly minimum influence on other apps.
* A PC user can easily get **superuser** / administrator rights, an Android user cannot ().

The demand and reason are obvious:

* **Privacy matters more** because a phone is a `24/7` *inevitable* assistant as well as a perfect **spy** equipped with all necessary hardware tools.
* And **the reason** is that it's easy to implement a more restrictive environment on a less customizable device.

Traditional \*NIX DAC dates back to the early days of personal computing, when the **isolation** was only focused between users (UID's/GID's), not between processes / apps. Because there were no closed-source **paid apps** in stores from *unknown* developers; not much personal data to be protected from **malicious processes**; no user **profiling**, targeted **advertisement**, trackers, analytics, **ransomware** and so on.

**SECURITY MECHANISMS:**

**\*NIX DAC** was found insufficient particularly with internet revolution, hence superuser privileges were divided into **capabilities** and new sandboxing mechanisms were introduced at kernel level, including **MAC** and **namespaces**. Android makes use of all of them more or less, they control which resources a process can access on device. Also, **cgroups** control how much resources a process can use. But even then, these security mechanisms weren't enough to **minutely lock-down the apps**, so a number of controls are handled within Android's own framework (in userspace). Android's system\_server has more services running inside it than native services. When I say *"mechanisms weren't enough"*, concern is not only to design an ecosystem to protect **user's privacy / security**, but also to protect Google's business model as well as of app developers.

**PC VS. ANDROID:**

It should also be noted that there is no **standardization** in Android (rather in embedded) world unlike PC's. Android uses a modified Linux kernel, which doesn't fully handle hardware in **kernel** space, instead relies on a number of userspace **closed source** processes from SoC / OEM vendors (), which interact with other processes and hardware drivers using Android-specific binder / HAL mechanism. So \*NIX DAC, which is heavily based on ***everything is a file*** philosophy, doesn't seem to work very far. A hardware device is no more simply a file in `/dev` which can be accessed by adding the app process to some supplementary group, there are layers of **APIs** and **IPCs** involved (Java and native).

However Android does take advantage of Linux kernel's robust frameworks e.g. DAC. Apps' **internet connectivity** is controlled by adding them to a special supplementary group `3003`. See: How Android's permissions mapping with UIDs/GIDs works?

## WHAT SHOULD BE PROTECTED ON ANDROID:

Coming to user's granular control over security / privacy on Android device, a few things one can be concerned about are who can:

* Access personal data (pictures, documents, videos, backups etc.)
* Get accounts information (added by apps including Google)
* Get read/write access to data from content providers like:
    + Contacts
    + Call log
    + Messages
* Read user / device identifiers (MAC address, IMEI, Android ID etc.)
* Read usage statistics
* Find installed apps
* Access camera, record audio/video
* Make calls, send messages
* Get internet connectivity
* Get device location
* Run in background (e.g. surveillance or tracking apps)

And so on.

## APP PERMISSIONS AND SANDBOXING:

Android divides its protected APIs in different Protection Levels. Apps' access to most of the above resources is either controlled by manifest permissions or user has **no control** over them.

* For instance you can't restrict an app's access to internet without using some third party firewall. Every app which requests for `INTERNET` permission is granted at installation time, you can't remove its supplementary group `AID_INET (3003)`.
* Similarly `READ_CONTACTS` and `GET_ACCOUNTS` permissions belong to same group and are controlled with same toggle switch on GUI.
* And you can't deny an app running in background unless you use Android's hidden permissions manager: AppOps.
* And that's not the end. If you want more fine-grained control over permissions e.g. revoking an app's ability to getInstalledApplications, you need some heavy framework modifier like Xposed and XPrivacy.

Every app is assigned a unique UID/GID at installation time and it runs inside its own stance of **Virtual Machine**, forked by `zygote`. DAC enforced to filesystems, apps are bound to access only their own directories, particularly on internal storage (`/data/user/<UserId>/<pkg_name>`), private/public external storage (`/data/media/<UserId>`) and procfs (`/proc/self/` etc.).

DAC sandboxing is also supplemented by MAC, e.g. **SELinux policy** won't allow apps to read `/proc/stat` and `rootfs (/)` (but allow them to read other app's data directory () ;). On the other hand `/data/misc/profiles/cur/<UserId>/<pkg_name>` is allowed by DAC but restricted by SELinux.

## MULTIPLE USERS ISOLATION:

An XYZ app in primary user account with UID/GID `10500` can access it's private data/settings/databases in `/data/user/0/<com.xyz>` but not in secondary user account because `/data/user/xx/<com.xyz>` has UID/GID owner `xx10500` where `xx` is UserID. How DAC controls access to `/sdcard` (external storage) is explained in What is the “u#\_everybody” UID?

Basic sandboxing **isolation exists between apps** whether those are from same or different users. But a notable additional isolation between apps of different user accounts / profiles is the **separate shared storage** (i.e. `/sdcard`), which is a benefit obviously if you don't trust the app. It's because an app has access either only to its private directories, or to whole external storage. This problem of **too open public files** is being controlled through Android Q's privacy change: Scoped Storage.

This isolation between apps of different user accounts / profiles also exists at **Java framework** level. For instance in our above example, `getInstalledApplications` *“returns a list of all application packages that are installed for the **current user*** only. So an app won't be able to find out what apps you have installed on other user account / profile.

Since the installed apps' data is isolated, the stock Android's **content providers** (which are also system apps) are also isolated. So the `contacts`, `call logs`, `calendars`, `messages`, `media` (list of files on external storage) etc. aren't shared among users.

Other things which are isolated between users (not necessarily enforced by DAC/MAC):

* User/app settings which are subject to FDE, FBE and password authentications (`/data/user_de/<UserId>/<pkg_name>`, `/data/misc/keystore/user_<UserId>`, `/data/misc/gatekeeper/<UserId>` etc.) (, )
* Apps' usage stats (`/data/system/usagestats/<UserId>`)
* System-wide accounts and settings, not all (`/data/system/users/<UserId>`)
* Custom CA certificates (`/data/misc/user/<UserId>`)
* ART profiles data (`/data/misc/profiles/cur/<UserId>`)

---

## CONCLUSION:

So in Android world unlike PC's, everything isn't governed by `uid's`/`gid's`, for a large part we are at the mercy of Android's core framework. But isolation between multiple users does exist, however it depends on what you want to protect from apps.

---

**REFERENCE:**
> 8 votes

---
Tags: security, linux, multi-user
---


# Question
Title: How to factory reset a locked phone when you cant access fastboot or usb debug mode
I have a Hyundai Orbit android phone. The situation is as follows:

1. The phone has a pin which we don't know
2. The phone was never signed into any google or other accounts
3. USB debugging is not turned on
4. We have tried starting the phone while holding all combinations of buttons and it always just boots normally, never into fastboot/recovery mode. We have been able to boot with "Safe mode" in the bottom right hand corner of the screen

Is there any way to do a factory reset under these conditions?

# Answer
> 1 votes
Some phone needs to be plugged to light before it can boot to recovery mode/hard reset. Try putting the plugged charger in the phone when it's switched off and immediately it shows the charging signal press the volume down⬇key+power key, if that doesn't work try volume up⬆key+power key. The both work for my phone innjoo i2s.

---
Tags: lock-screens, factory-reset, fastboot, usb-debugging
---


# Question
Title: How to automatically lock the screen or something when the Wi-fi disconnects?
I think this would be useful if you're entering data into a form, but you don't want to accidentally press "submit" when there's no Internet, causing you to have to re-enter everything.

Also, it would be nice for macros. Say you have a macro doing something on an app that requires Internet. When the Internet fails, the macro goes haywire by clicking on random stuff it's not supposed to click. It would be best to lock the screen in that case.

I have Android 4.4.2. I do not have cellular data on this phone.

# Answer
Using Macrodroid:

1. From the drawer, select variable and create a global variable of type boolean. Set it to false and save.
2. Create a macro. On the Triggers tab, on the Connectivity section, select Wifi Enable.
3. On the Actions tab, on the Conditions/Loops section, select Repeat actions, then "While condition repeat". On the Condition, go to the Connectivity section, select Wifi State, then Wifi is connected to, finally select Any network.
4. On the Actions tab, on the Macrodroid specific section, select "Wait Before Next Action", set a time (I set it at 1mn).
5. On the Actions tab, on the Connectivity section, select Connectivity check. Enter a website that the macro will keep checking if there is an internet connection to it or not. Set the timeout. Click the + and add a variable.
6. On the Actions tab, on the Conditions/Loops section, select "If clause", under Macrodroid specific, select Macrodroid variable and choose the variable created on the previous section. Set its value to False.
7. On the Actions tab, on the Screen section, select "Screen On/Off", choose Screen Off.
8. On the Constraints tab, under the Screen and Speaker section, select "Screen On/Off", choose Screen On.
9. Give the macro a name and save it.

The macro will look like the image below. Click the up and down arrows on the Actions section, to be able to move the actions up or down. Click the 3-dot on the top right and select Test Macro.

**Explanation:** When the macro starts, it checks if Wifi enabled and the device is connected to any network. It waits for a certain time before checking if there is a connection to the website enter in step 5. If after the set timeout in step 5 there is no connection, the screen will be switched off.

The delay in step 4 also serves as a fail-safe mechanism when you switch the screen on again to allow for example to disable the macro.

**Note:** To see the Conditions/Loops section under the Actions tab, the macro must be saved. Then when opened for an edit, the section will be visible.
> 1 votes

---
Tags: applications, wi-fi, 4.4-kitkat, automation
---


# Question
Title: Is it safe to delete logcat.txt files or the whole psysinfo folder to make more space on my Android phone?
I have an android phone and the space on the sdcard is getting scarce... (I don't understand how android functions - just a simple user.) In the following directory: `mnt > sdcard`

There is a `psysinfo folder`, which is 3.02 GB ... And in this folder there are subfolders like log6, log5 and so on. In these subfolders, there are a few logcat.txt files and three of them are like 1GB large.

Will my android phone function OK if I just delete these files and free some space (3.02 GB)? I view the folders with 'ES File Explorer' and am thinking of deleting these files using the same app. This app says the above folder and logcat.txt files are the largest in my phone. My Android version is 4.1.2.

I searched online to find what the \[ ...\> psysinfo \] folder in Android is, but I couldn't find any info about it and then searched about deleting logcat.txt files but the info available seems to be for folks like developers. I couldn't really understand it.

THANK YOU!

# Answer
It shouldn't be a problem to delete them if there are only .txt or .log files. If you are not sure, delete a few files with smaller to medium sizes. Restart your phone, and check if all apps are working normally. If they are, then proceed with deleting the others.

Log files are used mainly for debugging purposes. Deleting them should not bring chaos onto your phone.
> 1 votes

---
Tags: internal-storage
---


# Question
Title: How to access VNC server running in an android phone in another computer?
I have installed Ubuntu in my Android phone and I can access its GUI in my phone by connecting a VNC viewer to `localhost:1`. The VNC server is running inside Android.

Is it possible to access this in a computer connected to the wifi hotspot of the phone?

I connected to computer to the phone's hotspot and tried to access `locahost:1` in Real VNC Viewer, but it says "The connection was refused by the remote computer".

Please note that I am **not** trying to access vnc server running in another computer in my phone but the opposite.

# Answer
Go to **Setting** \> **About Phone** and note down the ip address of your mobile phone.

Now connect to the Wifi hotspot of your mobile phone. In the VNC viewer, connect to the address `ip-address-of-mobile-phone:1`, to access the `localhost:1` of the mobile phone.
> 0 votes

---
Tags: 6.0-marshmallow, linux, vnc
---


# Question
Title: SP Flash Tool does not recognize the firmware scatter file
I have a neffos X1 Lite and it seems that it boots only in the twrp recovery console.

Anyway I am trying to restore my official recovery console (i have no backup) using the official firmware http://www.neffos.com/en/support/download/X1-Lite

Inside this zipped file, there is a file scatter.txt that contains the following content.

```
preloader 0x0
pgpt 0x0
recovery 0x8000
para 0x1008000
expdb 0x1088000
frp 0x1a88000
ppl 0x1b88000
nvdata 0x1bc8000
metadata 0x3bc8000
protect1 0x5bc8000
protect2 0x63c8000
seccfg 0x7000000
proinfo 0x7040000
oemkeystore 0x7800000
md1img 0x8000000
md1dsp 0x9800000
md1arm7 0x9c00000
md3img 0x9f00000
nvram 0xa400000
lk 0xa900000
lk2 0xaa00000
boot 0xab00000
logo 0xbb00000
tee1 0xc300000
tee2 0xc800000
secro 0xcd00000
keystore 0xd300000
system 0xe000000
cache 0xeb800000
userdata 0x106800000
flashinfo 0xFFFF0080
sgpt 0xFFFF0000

```

Now, using *SP\_Flash\_Tool-5.1916\_Win* to load this scatter file I get an error "Invalid format". So, how am I supposed to un-brick my phone? I still have access to ADB, Fastboot and no matter what I can not boot to OS.

# Answer
> 2 votes
The ROM you provided does not contain a valid scatter file or recovery.img so you can not use SP Flash Tool.

I recommend you to make a backup of boot, copy the boot.emmc.win to PC, then to another phone and patch it with Magisk Manager apk

After successful patching, copy the patched file back to PC

Reboot the phone to bootloader, and flash the magisk\_patched.img from fastboot

```
fastboot flash boot "C:\adb\magisk_patched.img"

```

If for whatever reason you are not allowed to flash from fastboot, you can flash it from TWRP

When phone is working, just install Magisk Manager apk

**Note:** The /system partition and /data partition are encrypted, thats why you can not install Magisk.zip from TWRP

Patching the boot.img with Magisk Manager will remove the "verify" flag and patch against dm-verity, which will allow you to boot with modified recovery partition

**Edit:**

If you have a working similar phone, you can perform a "Read Back" of the recovery partition. based on your question, i have created a scatter file for the recovery partition

for the read back, select Region EMMC\_USER and use the start address and size from this:

```
############################################################################################################
#
#  General Setting
#
############################################################################################################
- general: MTK_PLATFORM_CFG
  info:
    - config_version: V1.1.2
      platform: MT6755
      project: TP904A
      storage: EMMC
      boot_channel: MSDC_0
      block_size: 0x20000
############################################################################################################
#
#  Layout Setting
#
############################################################################################################
- partition_index: SYS2
  partition_name: recovery
  file_name: recovery.img
  is_download: true
  type: NORMAL_ROM
  linear_start_addr: 0x8000
  physical_start_addr: 0x8000
  partition_size: 0x1000000
  region: EMMC_USER
  storage: HW_STORAGE_EMMC
  boundary_check: true
  is_reserved: false
  operation_type: UPDATE
  is_upgradable: true
  reserve: 0x00

```

**Edit 2:**

based on your output of /proc/partitions from twrp here is the complete scatter file (use carefully, no warranty it works)

MT6755\_Android\_scatter\_TP904A.txt

---
Tags: rom-flashing, recovery-mode, unbricking, device-firmware, mediatek
---


# Question
Title: Application being closed due to low memory error in Samsung Galaxy S
I am using a Samsung Galaxy S device. For the last month my device is continuously showing "Application being Closed due to Low Memory Error" notifications.

There is no any question about Internal & External Storage memory, both are 16 GB. Also RAM & ROM are almost clear every time.

Please suggest a solution!

# Answer
> 0 votes
Clear your cache by going to storage-\> Internal Storage-\> Cached Files

---
Tags: internal-storage, force-close
---


# Question
Title: How to spot folder of some application on Android (Galaxy Note 5)?
I intend to reset my phone to get rid of bad applications. I will reinstall all applications wanted, but there is the notes application I use that I want to get the data of (no option to back up notes)... how do I get the data?

the application is called Notes by programmer "Office"

# Answer
The application, Notes by Microsoft, stores your entries on OneDrive, they are not stored locally on your mobile device. This also means that your notes are always backed up.

If you remove the Notes application from your mobile device, you will have to log back into it when after you reinstall.
> 0 votes

# Answer
If you are able to access the following folder `/data/data/com.edi.masaki.mymemoapp`, open it. Then do the following:

1. Open the databases folder. Copy the following files:

```
myapp.db
myapp.db-journal

```

The first files contains the memos. You can open it and view the memos with apps that are capable to open sqlite database (search Play Store for sqlite apps, I use SQLPrime).

2. After installing/reinstalling, open then close Notes (close it also from the Recent apps). Go to `/data/data/com.edi.masaki.mymemoapp/databases`, delete the files found there, and paste the files from step 1.
3. Open Notes, you will find your files.
> 0 votes

---
Tags: backup
---


# Question
Title: I have android 7 but i cant locate factory reset protection(FRP)
I have android 7 on my device but i am cant find how i can enable FRP.

I was thinking that all devices above 5 have FRP protection app as the settings ought to have cloud and accounts menu that i can find the FRP support.

Is this to be expected?.

# Answer
> 0 votes
The Factory Reset Protection (FRP) is invisible and if it is present always active.

You only have to add one Google Account into the Android account list to "bind" your device to this account.

If the factory reset protection works or not you will only see if you perform a factory reset of such a device. If after the factory reset it asks for the password of that Google account it is active.

---
Tags: frp
---


# Question
Title: Android Accessibility: Click When Pointer Stops On Websites
I have a disability that requires me to use the *Interaction And Dexterity: Click When Pointer Stops* accessibility setting on my Samsung Galaxy S9+. Unfortunately, this setting (in combination with the *Assistant Menu*) does not allow me to click on hyperlinks. While you can use *Assistant Menu: Cursor* to move a second pointer that does click links, it is virtually impossible to do this with any degree of accuracy.

Is there any way of using the same pointer for navigating the UI and navigating web pages? I have tried using the *Samsung Internet* and *Google Chrome* apps without success.

See: Assistant Menu

# Answer
> 1 votes
Firefox for Android allows you to use *Accessibility: Interaction And Dexterity: Click When Pointer Stops* to click on hyperlinks. Having tested a number of browser apps, I have found the following browsers **do not** allow this:

* Samsung Internet
* Google Chrome
* Firefox Focus
* Opera / Opera Touch
* Microsoft Edge

I noticed that this accessibility feature does not work when the pointer is displayed as a hand.

---
Tags: accessibility
---


title: Create an unprivilleged user in android

text:
# Question
Title: Create an unprivilleged user in android
I want to create an account for android that cannot create another user or remove apps installed by the device owner.

I have looked at creating other accounts or logging as guest and that gives the user an opportunity to install and remove apps.

Does android enable one to have a none admin like account where a user cannot install or remove apps and cannot create accounts?

# Answer
> Does android enable one to have a none admin like account where a user cannot install or remove apps and cannot create accounts?

No. Secondary users can install and remove apps and create accounts. From Supporting Multiple Users:

> Account. Accounts are contained within a user but are not defined by a user, nor is a user defined by or linked to any given account. Users and profiles contain their own unique accounts but are not required to have accounts to be functional. The list of accounts differs by user.

And:

> When employing multiple users on an Android device, keep the following behavior in mind:
>
> * Notifications appear for all accounts of a single user at once.
> * Notifications for other users do not appear until active.
> * Each user gets a workspace to install and place apps.
> * No user has access to the app data of another user.
> * Any user can affect the installed apps for all users.
> * The primary user can remove apps or even the entire workspace established by secondary users.
> 1 votes

---
Tags: multi-user, accounts
---


# Question
Title: How can I know if fstrim was run when I put my phone on charging over night?
Is there any logging where I can confirm if `fstrim` was run when I put my phone on charging over night?

# Answer
> 9 votes
A ***charging, idle device over night*** is not the only way to run `fstrim`, there are other ways, too.

Quoting from this old article about scheduled `fstrim` on Android:

> The Android framework will send out a “start idle maintenance window” event that the MountService listens for, and then invokes vold to fstrim filesystems when a few conditions have been met – the device hasn’t been touched for over an hour, no idle maintenance window event has been sent in 24 hours, and the device is either off-charger with 80% battery or on-charger with 30% battery.

But `IdleMaintenanceService` was removed in Lollipop, things have changed. On Pie, scheduled `fstrim` is triggered from `StorageManagerService` () to `MountService` ():

> if the device is alive at ***midnight + idle***, fstrim gets run at the next available ***charging + idle*** time

* ()
Mount service calls `StorageManager` which in turn calls `Vold` to do `fstrim`.

If the schedule is being missed because the conditions aren't met and `fstrim` has not run for the last **3 days** (), it will be forced during device startup if the device is restarted. `SystemServer` (), `PackageManager` (), `StorageManager` () and `Vold` () are involved.

In each case, the file `/data/system/last-fstrim` () (since Lollipop) gets updated (10), so you can check its timestamp (**requires root**) to find out when `fstrim` was last run.

If you want to do `TRIM` manually, use Android's commandline tool **`sm fstrim` (requires root or `adb shell`**). Previously this was `vdc fstrim dotrim` but added to Storage Manager in Oreo (11) and removed from `vold` in Pie (12).

In order to send `FITRIM ioctl` to selected filesystem(s) only, use the `fstrim` tool (**requires root**); a BusyBox applet.

---

***What if you don't have root?***
And you suspect that the scheduled `fstrim` is being missed for 3+ days, restart the device, `fstrim` will be forced (since Lollipop 5.1 (13)). Simple.

Apps can't `TRIM` without root; see this answer.

---

**PS: HOW OFTEN TRIM SHOULD BE RUN?**

Flash memory (including SSDs, eMMCs, SD Cards, USB sticks etc.) has a limited number of Program/Erase (P/E) cycles before it dies. But unlike HDDs, data can't be just overwritten on flash memory, it has to be erased first, which is achieved through garbage collection (GC).

Now if we do too much `fstrim`, this will cause frequent GC in the background consuming precious `P/E` cycles and hence reducing life. If we don't do `fstrim` at all, there could be unnecessary GC (of already deleted data), plus the write operations will get too slow with time because erasure will have to be performed before overwriting data, which has significantly higher latency compared to the program operation.

So we need a balance between both.

Also there are other factors e.g. whether eMMC controller supports over provisioning, how effective it is in background GC scheduling, wear-leveling and managing write amplification etc.

So unless you have the data sheet of your phone's eMMC and you are sure what you are doing, it's better to leave the `fstrim` to the OS. On PCs (14):

> Running fstrim frequently, or even using `mount -o discard`, might negatively affect the lifetime of poor-quality SSD devices. For most desktop and server systems a sufficient trimming frequency is ***once a week***.

But this may vary depending on the situation.

**RELATED:**

---
Tags: file-system, logging
---


# Question
Title: Imitate a swipe down gesture periodically
There's an app that allows for monitoring of some specific process. This app gets locked every 5 minutes unless a screen activity is detected. The phone itself is not locked, the only app's interface is blocked. There's no way to configure the app's timeout to 10 or 30 or 60 minutes at all.

Is it possible to imitate a swipe down gesture periodically (for example, every 60 seconds)? I need it to run on Android 4.4.2.

I have seen AutoInput, but it appears it's not free.

# Answer
> 1 votes
Use Macrodoid. It offers 5 macros for free.

1. On the Triggers tab, under the Device Events section, select Screen On/Off then Screen On.
2. On the Actions tab, under the Device Actions section, select UI Interaction. Enable Macrodroid UI interaction accessibility option. Select UI Interaction, choose Gesture, then enter the X and Y values (X and Y screen coordinates: where to start and end the swipe).
3. Save the macro and give it a name.
4. Edit the macro. On the Actions tab, under the Conditions/Loops section, select Repeat actions, choose While 'conditions repeat. Add a condition (I selected Screen On, under the Screen and Speaker section, then Screen On/Off.
5. On the Actions tab, under the Macrodroid Specific section, select Wait Before Next Action, and set the time to 1 minute.
6. Click the up and down arrows on the Actions block, then move the items from steps 2 and 5 to be under the While/Do condition.
7. Save the macro. Click the 3-dot, then Test macro.

The macro will be like the image below:

When I tested it, I set the start values at X=100, Y=300 and the end values at X=500, Y=300 to simulate a swipe from left to right. The values on the steps described above should try to swipe the status bar down. I advise to change the X and Y values so they be based on your screen resolution and needs.

---
Tags: 4.4-kitkat, automation, gestures
---


# Question
Title: This app promises to run "fstrim" without root but I am not sure if it works
I am not sure if this app works. Can someone please help me? My phone is new and in its warranty period so I can't root it yet. I tried this app but I am not sure if it actually did something. Unlike the other famous app on the PlayStore for `fstrim`, it doesn't require root access which is quite incredible.

# Answer
> 1 votes
AFAIK, only apps running as root (UID 0) () or system (UID 1000) () or with `android.permission.MOUNT_UNMOUNT_FILESYSTEMS` () can do `fstrim`. But third party apps can neither get UID `0`/`1000` (without rooting phone), nor the said permission is for third party apps ().

Also manually sending `FITRIM ioctl` with `fstrim` command requires at least capability `SYS_ADMIN` (), which is almost root if not full root.

The app you have mentioned asks for permissions CLEAR\_APP\_CACHE (delete all apps cache data) and KILL\_BACKGROUND\_PROCESSES (close other apps). So it's quite evident what it must be doing to give a feel of lag-free experience.

**PS:** You don't need to run `fstrim` manually in most cases, OS can handle this. See this answer.

# Answer
> 1 votes
I highly doubt it. I use an app called Trimmer which requires root to trim /cache, /data, /system. I installed this app & ran only selecting cache, but it shower trimeed cache & data. I ran a logcat, did not catch anything. So most probably it is a snake oil or at best it clears your cache.

---
Tags: root-access, file-system, lagging, maintenance
---


title: When should fstrim run?

text:
# Question
Title: When should fstrim run?
Based on this cyanogenmod forum thread, I tried to address the delay in running applications and switching between applications on my Galaxy Nexus running cyanogenmod with Android 4.4.4 by running fstrim manually.

```
root@maguro:/ # fstrim -v /data
/data: 11649122304 bytes trimmed
root@maguro:/ # fstrim -v /cache
/cache: 436121600 bytes trimmed
root@maguro:/ # fstrim -v /system
/system: 80490496 bytes trimmed
root@maguro:/ # exit

```

This has largely fixed the delay issues. The delay to return to the home screen, for example, has reduced from about 4 seconds to less than 1 second. Based on this performance boost, I expect the delay was caused by the filesystem running inefficiently.

Isn't the Android OS supposed to run fstrim on its own? When is this supposed to happen?

# Answer
> 4 votes
Unforgettableid's comment included an AnandTech article that describes the conditions under which fstrim is supposed to run:

> I’ve learned a bit more on the conditions underlying when Android 4.3 will TRIM filesystems, as it wasn’t completely clear before. The Android framework will send out a “start idle maintenance window” event that the MountService listens for, and then invokes vold to fstrim filesystems when a few conditions have been met – the device hasn’t been touched for over an hour, no idle maintenance window event has been sent in 24 hours, and the device is either off-charger with 80% battery or on-charger with 30% battery. The goal is to have fstrim run roughly once every 24 hours if you’re in the habit of plugging the device in to charge every night.

# Answer
> 6 votes
The article referenced in @mattm's answer is a bit outdated. `IdleMaintenanceService` was removed in Lollipop, things have changed. On Pie, scheduled `fstrim` is triggered from `StorageManagerService` () to `MountService` ():

> if the device is alive at ***midnight + idle***, fstrim gets run at the next available ***charging + idle*** time

* ()
Mount service calls `StorageManager` which in turn calls `Vold` to do `fstrim`.

If the schedule is being missed because the conditions don't meet and `fstrim` has not run for last `3 days` (), it will be forced during device startup if the device is restarted. `SystemServer` (), `PackageManager` (), `StorageManager` () and `Vold` () are involved.

In each case, the file `/data/system/last-fstrim` () (since Lollipop) gets updated (10), so you can check its timestamp (**requires root**) to find out when `fstrim` was last run.

If you want to do `TRIM` manually, use Android's commandline tool **`sm fstrim` (requires root or `adb shell`**). Previously this was `vdc fstrim dotrim` but added to Storage Manager in Oreo (11) and removed from `vold` in Pie (12).

In order to send `FITRIM ioctl` to selected filesystem(s) only, use `fstrim` tool (**requires root**); a busybox applet.

---

***What if you don't have root?***
And you suspect that the scheduled `fstrim` is being missed for 3+ days, restart device, `fstrim` will be forced (since Lollipop 5.1 (13)). Simple.

Apps can't TRIM without root; see this answer.

---

**HOW OFTEN TRIM SHOULD BE RUN?**

Flash memory (including SSDs, eMMCs, SD Cards, USB sticks etc.) has limited number of Program/Erase cycles before it dies. But unlike HDDs, data can't be just overwritten on flash memory, it has to be Erased first, which is achieved through `Garbage Collection`.

Now if we do too much `fstrim`, this will cause frequent GC in background consuming precious `P/E` cycles and hence reducing life. If we don't do `fstrim` at all, there could be unnecessary GC (of already deleted data), plus the write operations will get too slow with time because `Erase` will have to be performed before overwriting data, which has very higher latency as compared to `Program` operation.

So we need a balance between both.

Also there are other factors e.g. whether eMMC controller supports `over provisioning`, how effective it is in background GC scheduling, wear-leveling and managing write amplification etc.

So unless you have the data sheet of your phone's eMMC and you are sure what you are doing, better is to leave the `fstrim` to OS. On PCs' (14):

> Running fstrim frequently, or even using `mount -o discard`, might negatively affect the lifetime of poor-quality SSD devices. For most desktop and server systems a sufficient trimming frequency is ***once a week***.

But this may vary with situations.

**RELATED:**

# Answer
> 1 votes
Answer by mattm indicates conditions under which, `fstrim` should run. I am not aware if the behaviour has changed in subsequent Android versions, but I came across an app that does `fstrim` **on demand as also on reboot** . Root needed. Sharing this information as it may be useful to those who are not Linux savvy ( like me :)

**SSD Boost**

> Android 4.3+ supports trim natively, it means that operating system after deleting a file will sends a trim command to nand controller notifying witch blocks the file used, the controller will erase them when idle so it can write fast without erasing next time.
>
> But users have no control over this process and Android doesn't trim the storage for a very long time.
>
> 'SSD Boost' helps you to run trim on your device manually if you feel it has become laggy and anyway it does trim for you on every reboot.

I know this directly doesn't answer the question, but felt this was the best question on site to share this

---
Tags: cyanogenmod, file-system, lagging, maintenance
---


title: Running TRIM from shell

text:
# Question
Title: Running TRIM from shell
Is it possible to run fstrim in stock android 4.3 from adb shell?

I understand it runs every 24 hours when the device is plugged in and idle but I would like to run on demand to test a few theories.

# Answer
**WARNING: I have not tested this procedure.**

You would need to have `fstrim` in `system/bin`. This XDA post has a DropBox download link.

start up `adb` and then switch users to root.

`$ adb shell` from your os terminal.

`$ su` to switch to the root user.

To copy fstrim to your `/system/bin` path you first need to mount the system path as Read/Write from adb or some other file manager

`# mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system` to mount /system as R/W

Then copy `fstrim` to the system path.

`# cp <pathtofstrim>/fstrim /system/bin`

Next you need to change permissions of fstrim to include execute.

`# chmod 766 /system/bin/fstrim` to make fstrim executable by root

After setting the correct permissions on `fstrim` you can run these commands from adb (as root):

`# fstrim -v /data`
`# fstrim -v /cache`
`# fstrim -v /system`

---

OR, you could go the **EASY WAY**. Install the LagFix app, and trigger fstrim on demand, provided your device has fstrim support!
> 8 votes

# Answer
On newer versions, Android runs `fstrim` with a daily schedule, provided that the conditions meet. Or it should run on a reboot if not run for 3+ days. See this answer for details.

However if you want to do `TRIM` manually, use Android's commandline tool **`sm fstrim`**. Previously this was `vdc fstrim dotrim` but added to Storage Manager in Oreo () and removed from `vold` in Pie ().

In order to send `FITRIM ioctl` to selected filesystem(s) only, use `fstrim` tool; a busybox applet.

Both commands require root, or `sm fstrim` can be executed from `adb shell`.
> 2 votes

# Answer
vold, the (disk/eMMC) volume management daemon, has this built in. Its shell client is called "vdc" (vold controller I guess, akin to rndc, remote name daemon controller for BIND). The command and its relevant arguments, as the superuser, would be:

`vdc fstrim dotrim`

Note that at least on my tablet, 4.4.4, this will only trim `/cache` and `/data`, but this is mostly what I think you'd want. You can see its progress with `logcat` (e.g., `logcat` from a shell on the device or `adb logcat` on a USB connected host). Vold will output a message about each volume it trims and the fact that it's finished (in logcat).
> 1 votes

---
Tags: adb, file-system, shell, system
---


# Question
Title: WhatsApp's backup to Google Drive doesn't work
I recently reinstalled WhatsApp because it stopped working. Then, I restored the Google Drive backup. For this backup, I used my primary Google account. Restoring worked fine.

However, after restoring the backup, no new backups would work. It always just got stuck at some percentage of progress. After many failed attempts of canceling the backup after hours of being stuck at the same percentage, I added my secondary Google account to my phone and chose it as WhatApp's backup location. It then went on to make a 2.3 GB backup to the secondary Google account (according to the information WhatsApp stated). This backup again got stuck. Repeating it several times always made it get stuck at a higher percentage of progress.

Eventually, I gave up and deleted the backup in Google drive (secondary account). I noticed that my secondary account only used a few hundred MB in total, according to the information found in the bottom left corner of the Google Drive website.

After deleting the backup, I started another backup. WhatsApp showed that it already completed 2.3 GB of 4.6 GB right from the beginning. This got stuck again at 99%. After deleting the backup again and starting it again, it now started at 4.6 GB of 6.9 GB, apparently always increasing by 2.3 GB.

What should I do to perform a full backup?

# Answer
> 0 votes
The exact same happened to me, it would never finish uploading the backup to Google Drive and in every new attempt it would tell me that the backup size was bigger, start the upload and stop somewhere between 97% and 99%.

The only difference is this started happening spontaneously, it was successfully making and uploading backups every day and then one day, out of the sudden it couldn't finish uploading it.

After trying many of the suggestions that I found all over the Internet, like force stopping WhatsApp, clearing the cache, set it to use another Google account for backups, nothing helped.

At the end, the cause was the same issue pointed out in your last comment, I had a few corrupt 0 byte media files within WhatsApp's `Media/` folder that couldn't be read, moved, copied or deleted: `Operation not permitted`.

I don't know how did that happen, but the best way I could get around it was to use a terminal App and run Linux commands for copying all non-corrupt files to a new folder:

```
cd WhatsApp
mkdir MediaCopies
cp -r Media/* MediaCopies

```

It will throw errors about the corrupt files but continue copying the good ones.

After checking `MediaCopies/` looks right and contains all files then:

```
mv Media Media~
mv MediaCopies Media

```

Then open WhatsApp, poke around open pictures, videos, etc. and finally:

```
rm -rf Media~

```

It will fail to remove those corrupt files, but at least you won't have the rest of the files duplicated.

And *voilà*! No more issues uploading the backup.

---
Tags: whatsapp-messenger
---


# Question
Title: Cannot open PDF file using Google Drive app
My device is running on Android Oreo, and I have study notes as a PDF file on Google Drive (link to the file for testing), but I can't open it on Google Drive app.

My file is not opening and it's saying "No connection" even though I've got an awesome connection. I don't know why it's not syncing my file.

>

I've even cleared cache, refreshed my Google Drive, and also rebooted my phone.

How to fix this issue so that I can open my PDF file from Google Drive app?

# Answer
It looks like a bug with Google Drive. I had the same problem in opening the link

**Workaround**

I pasted the link in Chrome and it opened! You should report the bug, also in Playstore

(Click to enlarge)

To download the file, open Chrome in desktop mode and click the option (print).
> 1 votes

# Answer
What I do, because I have the same issue, I use Open With option works like a charm. I use the Google PDF Viewer
> 0 votes

---
Tags: google-drive
---


# Question
Title: How to connect to a SSH server from Android client?
I can install and run an SSH server on my Android 6.0 phone (Banana SSH server), and I can run an SSH client on it (Termius), so how do I invoke the client from on the command line that the server provides? I type `ssh` and it's not a recognized command. I want to use the phone to link through to other servers.

# Answer
> 2 votes
You don't need to install server in order to use client. Install `openssh` package on Termux, that has both; server and client. To connect to a server, do: `ssh <user>@<server-IP>`. Mention port with `-p` option if different than default (`22`), such as Termux server uses 2222 `8022` (corrected by @Steve).

Or if you want to stick to GUI, you can go for Termius or ConnectBot etc.

In order to run SSH server, just execute `sshd` from Termux, but that gets killed with app. Or for a more complicated setup see: How to run SSH/SFTP server for multiple user logins with password authentication on Android?

---
Tags: command-line, ssh
---


# Question
Title: If I reset my phone, will it also TRIM the fragmented eMMC?
I know that Android supports `fstrim` but it only works if the phone is idle for a long time while charging. I think my phone is too fragmented and is lacking performance so I want to reset it but I am not sure if TRIM will also run if I do so. Since TRIM is important to improve the SSD's speed, I'd really like to run TRIM on my phone.

# Answer
> Android supports `fstrim` but it only works if the phone is idle for a long time while charging

It's not so. On newer versions, Android runs `fstrim` with a daily schedule, provided that the conditions meet. Or it should run on a reboot if not run for 3+ days. See this answer for details and how you can run `fstrim` manually.

**FRAGMENTATION ON FLASH MEMORY:**

> I think my phone is too fragmented and is lacking performance

No, fragmentation doesn't exist on flash memory, or at least doesn't affect the performance. It's actually the filesystem which gets fragmentation (that's why newly formatted filesystem has 0% fragmentation), transferring the same to underlying physical storage. However underlying medium handle it differently.

Let's first take a brief insight into ***filesystem vs. storage media*** relationship. Filesystem interacts with Logical Block Addresses (LBAs), which are just numbers representing a unit of memory. Filesystem to LBAs mapping is irrespective of whether underlying media is HDD or SSD.

On HDDs, LBAs to Cylinder-Head-Sectors (CHS; rotating magnetic disks) mapping (1:1 / sequenced / linear) () is created during `low-level formatting` of disk drive when manufacturing, which never changes except if some sector is marked bad by disk controller firmware (in g-list from disk's defects table) and remapped to some spare sector. OS may also mark sectors bad in filesystem to exclude them for future use, as `CHKDSK` does on Windows during full format and `e2fsck`/`badblocks` do on Linux. So Operating system is aware of the physical geometry of the disk, which is propotional to the geometry of LBAs.

On flash memory (including SSDs, eMMCs, SD Cards and USB sticks etc.), LBAs to Physical Block Addresses (PBAs; silicon cells) mapping is fully controlled by Flash Translation Layer (FTL); a part of memory controller firmware. OS knows nothing about it, it can see at maximum the LBAs, not what's happening below it, not even the ECC of failed memory cells (just like bad sectors on HDD), and that's why we don't realize the bad health of eMMC unless it fails. Since a page of memory can't be just overwritten unlike HDDs, it has to be Erased first before being Programmed (written). A side effect is that a number of pages are erased/re-written and the physical mapping changes even if a small file is edited. On HDDs, files aren't physically replaced unless shortened or elongated. OS is aware of these physical changes on HDD, but not on flash memory.

So on HDDs, OS is aware of the physical fragmentation which is same as filesystem (LBAs) fragmentation, and `defragmentation` (as done by Windows regularly) occurs at physical level. But on flash memory, you can't simply do `defragmentation` in actual, rather good flash memory controllers do fragmentation purposely as a `wear-leveling` strategy. OS has no control over the actual fragmentation at physical level (unless you have some advanced tools to communicate with flash controller). However OS is aware of the fragmentation within filesystem. But if you defragment the filesystem, it won't defragment the flash memory.

Also as @Robert mentioned in comment, there is no effect of physical fragmentation on the performance of flash memory at all because there are no mechanical components in flash memory i.e. no seek latency because of head moving over different tracks as in HDDs. Filesystem fragmentation - as some experts think - may have somewhat impact due to increased number of I/O requests OS has to make to read/write scattered data.

---

Summarizing the above lines:

* On HDDs it's the OS/filesystem which controls where the data is actually saved on physical memory, so it can de-fragment it.
* On flash storage media, OS/filesystem doesn't know where the data is actually saved on physical memory, so it can't de-fragment it.

---

> Since TRIM is important to improve the SSD's speed, I'd really like to run TRIM on my phone

When an OS asks a filesystem to send TRIM to eMMC, it actually requests flash memory controller to do `Garbage Collection` \- Erase the PBAs which map to LBAs which belong to deleted files. So the eMMC controller maps those LBAs to already/newly Erased blocks (PBAs). This won't do defragmentation. See above mentioned answer to know how often `fstrim` should be run.

**DOES FACTORY RESET DOES TRIM?**

> I want to reset it but I am not sure if TRIM will also run if I do so

`Factory reset` on Android devices format `/data` and `/cache` () partitions. So the question is whether formatting is accompanied by TRIM or not.

Well this can't be standardized. Formatting and TRIM are different things, so it depends on the formatting utility whether it sends TRIM command to eMMC or not. Formatting may involve `partitioning` but in most cases (particularly on Android) it's just the `high-level formatting` i.e. to create data structures (e.g. superblocks, file tables, directories, inode/block bitmaps, journals etc.) used by the OS to identify the partition's contents.

If we go through the lines in source code of `stock recovery` which handles formatting of partitions during factory reset, we see no notion of TRIM it does `wipe_block_device` () which calls `BLKDISCARD` or `BLKSECDISCARD` provided that they are supported (). Both ioctls are essentially TRIM on block device level (not on filesystem level). `fstrim` is only run by `vold` inside the main Android OS. Additionally one of the tools used for creating filesystem `mke2fs_static` does try *to discard device before fs creation* (), but not the other tool `e2fsdroid_static`. So there are chances eMMC will be sent a TRIM/discard request during factory reset, but be aware of the past: Android phones don't completely wipe data when their factory reset option is run.
> 6 votes

---
Tags: recovery-mode, file-system, performance, formatting, lagging
---


# Question
Title: Does installing GApps save space compared to PlayStore install?
I am about to clean-install a Lineage ROM on my Android and I want to maximize the internal storage space left for the apps I want. What I understand so far is:

* The GApps package will reside in the /system read-only partition.
* Updates of apps from the GApps package will reside in the user partition.
* Apps installed via the Play Store will reside in the user partition.

I see the two following options:

1. Install a lean GApps package (e.g. OpenGApps pico) and then install the apps I want from Google's Play Store.
2. Install a GApps package which includes additional apps (e.g. OpenGApps mini).

Question 1: Is there a drawback to making the /system partition as full as possible by selecting the biggest fitting GApps package?

Question 2: If I need some Google apps such as *Maps* and *YouTube*, which option maximizes the space left available to install other apps, updates and user data?

Additional information:

* The device is a Motorola G 2015 (osprey) with 8Gb internal storage.
* When comparing the difference between the mini and pico packages, the only apps I need from the mini package not included in the pico package are *Maps* and *Youtube*, all the rest is useless to me.
* I can get the most recent OpenGApps package and it's ok for me to disable the update of apps such as Maps and Youtube if it results in more available user data space. (My aim is to extend the lifetime of my device by avoiding the lack of internal memory.)
* I saw this StackExchange answer, but it didn't answer my question well enough.

# Answer
> Question 1: Is there a drawback to making the /system partition as full as possible by selecting the biggest fitting GApps package?

Whether you install the smallest or largest version of GApps, /system partition will remain the same, unaffected in term of its size. The partition size is fixed for the device by the manufacturer (Yes, if you are rooted it is possible to re-size the partition but it is not recommended).

> Question 2: If I need some Google apps such as Maps and YouTube, which option maximizes the space left available to install other apps, updates and user data?

When you install GApps from the recovery, they will be installed as system apps under /system partition. Then when you start your device, their data will be under /data partition as any other apps. Subsequent update and usage may (will) increase their sizes on the /data partition while /system will be same. Making new version or updates part of /system partition will allow to recoup some space from the /data partition.

If you need Maps and Youtube, install GApps mini, then disable/uninstall apps that are not part of the pico or nano packages.
> 1 votes

# Answer
whats the os version?

install gapps from this site: OpenGapps

mini installs to the system partition, if the rom version is higher than 8.0 (android version) is (the most times) the system partition smaller try first gapps mini, if you get a error try pico (sorry for my bad english)
> 0 votes

---
Tags: internal-storage, insufficient-memory, lineageos
---


title: How to use "drag & drop" on websites?

text:
# Question
Title: How to use "drag & drop" on websites?
I use the adroid stock-browser and I'd like to play chess using e.g. http://www.shredderchess.de/schachproblem-des-tages.html Unfortunately you have to drag and drop the pawns. I tried several gestures, but I was not able to use the drag and drop feature. Do I have to change any options (where?) or should I use a different browser?

# Answer
Pair a Bluetooth mouse with your device. YouTube is full of demonstration videos such as **this video** by Android Tech Tips.

Or use an OTG mouse, as demonstrated in **this video** by XDA Developers.
> 2 votes

# Answer
Unless the website specifically supports touch screen, there's no way to do so. Unless the website uses a wrapper library like certain jquery plugins that can abstract the differences, the JavaScript code used to support mouse based drag and drop and touch screen drag and drop is quite different and incompatible with each other.
> 1 votes

# Answer
You can use puffin web browser and enable virtual mouse
> 1 votes

---
Tags: browser, stock-browser, drag-n-drop
---


# Question
Title: Pushing to TWRP, adb shows "adb: error: connect failed: no devices/emulators found"
When I try to push my rom to `/sdcard/` with TWRP, I get

```
adb push myRom.zip /sdcard/
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
adb: error: connect failed: no devices/emulators found

```

How do I resolve this error. Things seem to work with `adb sideload` but the rom doesn't boot. The LineageOS install instructions say specifically to use with `adb push`.

# Answer
> 1 votes
Try killing the process and then retrying:

```
adb kill-server
adb push myRom.zip /sdcard/

```

---
Tags: adb
---


# Question
Title: How can I determine what is transmitting data?
Recently I noticed that even while no applications are actively running (at home screen), the up and down arrows under the WiFi status bar item are turning on/off. This is a recent change, and seems to have started after some automatic updates.

I've gone through and killed all the running processes (that allow you to kill them), and the behavior continues. I'm assuming it must be a system process that's causing this, but I can't for the life of me figure out which one or why.

I have a Samsung Galaxy S4 with KitKat 4.4.2, if that matters. And I've already tried restarting the device.

How can I determine what is causing the WiFi indicator to signal data is being transferred? I'm comfortable creating simple android applications, so a programming solution is an option.

# Answer
I use an application called “App Snitch” which monitors all network access and let’s you know what each app is doing. The Play Store link is **HERE**.
> 1 votes

# Answer
I'd recommend you taking a look at the app **OS Monitor** (see my answer here). Next to the "usual process list" it also offers a view on open connections, which app holds them, and where they go to. As an app requires an open connection to transmit data, it must be listed there. Even if you "almost miss the end of transmission", the socket is usually still listed as `CLOSE_WAIT` for a little more time – so if you see the "transission arrows" and launch *OS Monitor*, you should be sure to see it there.
> 0 votes

---
Tags: wi-fi, 4.4-kitkat, samsung-galaxy-s-4
---


# Question
Title: how can i get the http sends requests from chrome just like from the network tab?
just like that . pls do not mention network monitoring tools like wireshark

# Answer
There are two possibilities:

# On-device solutions

Use an app like

# PC based solutions:

Use a proxy on your PC and redirecty all traffic through that proxy. There are a large number of Proxy that can be used like

* Burp Suite (Java)
* Fiddler (Windows/.Net)
* Charles Proxy (Java)
* mitmproxy
> 1 votes

---
Tags: chrome-for-android, networking, developer-options, copy-paste, url
---


title: Block game download from ads

text:
# Question
Title: Block game download from ads
How do I keep a senior citizen from downloading and installing every game from ads that pop up from games that are installed? He has a few games he likes and ads pop up and he cannot be told about the X in the corner to keep from installing them. His memory is a factor. I need a block of some sort. Every day that he plays, he has five more new games installed. I need ad-free solitaire, mahjong, and pyramid solitaire, and he likes Bejeweled. Does anyone get any ideas? And YES.. we have shown and told him not to. It is forgotten.

# Answer
> 1 votes
One option would be to minimize the displayed ads using an app like Blokada (not available on Play Store). This app filters out ads and app trackers using filter lists that clock certain requests. This usually reduces the number of ads.

A second option would be to use the multi-user system on Android (if it is available on your device). Additionally to the primary user, you can create a second user who is not able to install any app.

The third option would be the Google parental control system which is AFAIK able to block certain app installations. Just switch "parent" and "child" while reading ;)

---
Tags: applications, downloading, ads
---


title: fastboot works, adb doesn't

text:
# Question
Title: fastboot works, adb doesn't
I picked up a second-hand Motorola Moto G (2nd gen) device. The model is technically XT1064 (Titan).

On my Windows machine, I'm sometimes able to see an error message when I power down the phone stating that the USB device was unrecognized (Device Descriptor Request Failed).

After days of trying, I've yet to have it show up in `adb`. But it works just fine if I boot into the bootloader and run `fastboot` commands!

I've tried all of the "easy" things people recommend:

* enabling USB debugging under Developer Options
* different USB cables (although since `fastboot` works fine, that implies the cable is also fine)
* different computers (tried a Mac, a Windows 10 machine, and a Windows Vista laptop)
* `adb kill-server` followed by `adb devices`
* various `adb` versions (Android SDK platform tools and Universal ADB driver)
* manually uninstalling Windows drivers
* force installing drivers (doesn't work, since the device doesn't make it past the device descriptor request so Windows won't allow drivers to be installed)
* installing the Universal ADB driver
* re-flashing the device (tried stock Marshmallow, stock KitKat, and Lineage OS)

I'm frustrated by the process because `fastboot` works just fine. That's how I've flashed the separate ROMs on there.

If this were a hardware issue with USB, why would it be that `fastboot` operates correctly but `adb` does not?

Also, if it's a hardware issue, what physical part would be the problem? It seems unlikely to be the USB port itself (again, because `fastboot` works just fine). Is there some kind of USB controller in the phone that could be the issue? Since the device is pretty useless to me unless `adb` works, I'd entertain the idea of trying to solder in a new part to fix the problem if I could!

# Answer
If your device is rooted, you may set up adb over network as a workaround for all USB driver problems.

* Make sure both PC and Android device are in same network
* On Android, install Terminal Emulator
* Open Terminal Emulator and type the following:

`su`
`setprop service.adb.tcp.port 5555`
`stop adbd`
`start adbd`

* On a PC side, enter:

`adb connect 192.168.1.2`

(replace 192.168.1.2 with the IP address of your device)

* Proceed with adb as if it was connected over USB

Alternatively, you may create a script with GScript instead of using Terminal Emulator.
Also, you can add these lines to your Android boot scripts, in which case you don't have to do it manually every time.
> 2 votes

# Answer
***You may need to enable USB Debugging enabled***

**To enable follow these steps:**

1. Open settings
2. Open `Info`
3. Find the `Build Number` and tap on it alot until it says `You are now a developer!`
4. Exit `Info`
5. Open `Developer options`
6. Tap on `USB debugging`
7. Tap on `OK`

**Notes:**

* In 4.1.x and before skip steps 2-4
* In 2.2.x and before goto `Settings`-\>`Applications`-\>`Development`-\>`USB debugging`
> 2 votes

# Answer
fastboot works, adb doesn't? my ans: you can use image loader which is compatible with that device,erase all the previous data and freshly build new Meta data by including the partitioning,after success u might get expected output like flatten success(related to build of that device).then adb will work fine with usb port detection.

hopes this works!
> 1 votes

---
Tags: adb, usb, fastboot, hardware
---


# Question
Title: Android Auto not working with Samsung Galaxy S10
I've a Samsung Galaxy S10e smartphone with Android Pie as OS. When I connect it using an USB cable to my car *(Audi A1)* and start Android Auto from the car display, it doesn't work.

I can't say what the problem is because I don't see any error message.

What's wrong with it? I'm using Android Auto from Belgium *(Europe)*.

# Answer
I've found the problem. To solve it I've installed the Android Auto from APKMirror app on my smartphone. This I've done because Android Auto is not yet supported in my country *(Belgium)* and The Netherlands.
> 2 votes

---
Tags: 9.0-pie, android-auto, samsung-galaxy-s-10
---


# Question
Title: Android O VirtualBox can't set up device - Google Play services keep crashing
I have an Android O Virtualbox and when I go to set it up, it asks if I want to set it up with data from my old phone or start new. I've tried both options, and it says that the Google Play Services have stopped, every time I try. I don't know what to do.

# Answer
Tested for ubuntu 16.04.

* You can use this link to follow steps.,

`https://www.howtogeek.com/164570/how-to-install-android-in-virtualbox/`

* for 32-bit system use this link for latest Android-orio.,

`https://osdn.net/projects/android-x86/downloads/69704/android-x86-8.1-r2.iso/`

* for 64-bit system i used this link for latest Android-orio.,

`https://osdn.net/projects/android-x86/downloads/69704/android-x86_64-8.1-r2.iso/`

and at one step there is no Primary or Logical partition option as mention in the post, there you have to create a partition, you have to enter some values too, where there is default just let it be like it, and enter 8300 for linux. Actually that and name of the pariton is the only value i've entered in rest i just pressed enter.
> -1 votes

---
Tags: google-play-services, 8.0-oreo, 8.1-oreo, android-x86, virtualbox
---


title: Backup WhatsApp from NANDROID

text:
# Question
Title: Backup WhatsApp from NANDROID
Hi guys: refering to this: Restore Whatsapp

Get the same issue.

I just reset all my phone after an OTA bricked.

I made an nandroid backup, but, i dunno how to acces - on my phone - the "data/data/com.whatsapp" file to read owner and group. I think for the nandroid its going to be ok.

Cheers

# Answer
**install WhatsApp, then boot in TWRP and look from adb shell**

* show the folder attributes with the `ls` command

```
ls -dln /data/data/com.whatsapp

```

example output:

```
mint@debian ~ $ adb shell
/ # ls -dln /data/data/com.whatsapp
drwx------   13 10104    10104         4096 Jan 15 04:15 /data/data/com.whatsapp

```

**next, restore the backup (or part of it)**

* download open-gapps-pico.zip for your platform (ARM) to PC
* extract the tar binary (tar-arm for ARM) and push it to phone (in TWRP)

```
adb push C:\adb\tar-arm /tmp/

```
* open adb shell and make the binary executable (TWRP)

```
chmod 0750 /tmp/tar-arm

```

example output:

```
mint@debian ~/Downloads $ adb push tar-arm /tmp/
387 KB/s (427448 bytes in 1.075s)
mint@debian ~/Downloads $ adb shell
/ # chmod 0750 /tmp/tar-arm

```
* in TWRP look for the location where your (internal/external) sdcard is mounted

```
df

```

example output:

```
/ # df
Filesystem           1K-blocks      Used Available Use% Mounted on
tmpfs                  1010636        44   1010592   0% /dev
tmpfs                  1010636        28   1010608   0% /tmp
/dev/block/mmcblk0p19   253920      2380    246300   1% /cache
/dev/block/mmcblk0p20 11608792   9847780   1728244  85% /data
/dev/block/mmcblk0p20 11608792   9847780   1728244  85% /sdcard
/dev/block/mmcblk1p1  31150720  22588512   8562208  73% /external_sd

```
* find the backup folder with the `ls` and `cd` commands

example output for `cd` change directory:

```
/ # cd /external_sd
/external_sd # cd TWRP
/external_sd/TWRP # cd BACKUPS/CUBOT_KING_KONG

```

example output for `ls` list files and folders:

```
/external_sd/TWRP/BACKUPS/CUBOT_KING_KONG # ls
2019-03-20--03-44-24_CUBOT_KING_KONG_7081C_V16_20180517
2019-04-16--08-03-32_CUBOT_KING_KONG_7081C_V16_20180517
2019-04-21--07-15-28_CUBOT_KING_KONG_7081C_V22_20181228
2019-06-18--20-30-44_CUBOT_KING_KONG_7081C_V16_20180517
2019-06-23--05-37-30_CUBOT_KING_KONG_7081C_V16_20180517
2019-06-26--08-30-17_du_s3ve3g-userdebug_712_NZH54D_engroot20180

```

enter the latest backup folder (you can also use `*` as wildcard)

```
/external_sd/TWRP/BACKUPS/CUBOT_KING_KONG # cd 2019-06-26*

```

list `ls` the backup file names inside. the interesting is the data.ext4.win\* backup

```
/external_sd/TWRP/BACKUPS/CUBOT_KING_KONG/2019-06-26--08-30-17_du_s3ve3g-userdebug_712_NZH54D_engroot20180 # ls
boot.emmc.win          data.ext4.win002       recovery.emmc.win.md5
boot.emmc.win.md5      data.ext4.win002.md5   recovery.log
data.ext4.win000       data.ext4.win003       system.ext4.win
data.ext4.win000.md5   data.ext4.win003.md5   system.ext4.win.md5
data.ext4.win001       data.info              system.info
data.ext4.win001.md5   recovery.emmc.win

```
* Before unpacking, find the required file name(s) which contains your whatsapp files. use the `tar-arm` binary with parameters `-t` (test) and look into each file `-f data.ext4.win*`, while the error output is filtered out with `2> /dev/null` and the the file list is filtered for folder name `/data/data/com.whatsapp` with the `grep` command

```
/tmp/tar-arm -tf data.ext4.win000 2> /dev/null | grep /data/data/com.whatsapp

```

example output: (no result for `data.ext4.win000` `data.ext4.win001` `data.ext4.win002`)

```
/external_sd/TWRP/BACKUPS/CUBOT_KING_KONG/2019-06-26--08-30-17_du_s3ve3g-userdebug_712_NZH54D_engroot20180 # /tmp/tar-arm -tf data.ext4.win000 2> /dev/null | grep /data/data/com.whatsapp
/external_sd/TWRP/BACKUPS/CUBOT_KING_KONG/2019-06-26--08-30-17_du_s3ve3g-userdebug_712_NZH54D_engroot20180 # /tmp/tar-arm -tf data.ext4.win001 2> /dev/null | grep /data/data/com.whatsapp
/external_sd/TWRP/BACKUPS/CUBOT_KING_KONG/2019-06-26--08-30-17_du_s3ve3g-userdebug_712_NZH54D_engroot20180 # /tmp/tar-arm -tf data.ext4.win002 2> /dev/null | grep /data/data/com.whatsapp
/external_sd/TWRP/BACKUPS/CUBOT_KING_KONG/2019-06-26--08-30-17_du_s3ve3g-userdebug_712_NZH54D_engroot20180 # /tmp/tar-arm -tf data.ext4.win003 2> /dev/null | grep /data/data/com.whatsapp
/data/data/com.whatsapp/
/data/data/com.whatsapp/cache/
/data/data/com.whatsapp/code_cache/
/data/data/com.whatsapp/lib
/data/data/com.whatsapp/app_minidumps/
^C

```
* now you can extract the folder `/data/data/com.whatsapp` (as last argument) from the file(s) `-f data.ext4.win003` with the `tar-arm` binary with `-x` and additional parameters `--selinux` `--xattrs` `-p` for file attributes, while `-P` will keep the leading `/` which will restore everything to `/data` and `-v` make the whole thing more visible for you. handle each data.ext4.win\* file for its own:

```
/tmp/tar-arm --selinux --xattrs -vxpPf data.ext4.win003 /data/data/com.whatsapp

```

example output:

```
/external_sd/TWRP/BACKUPS/CUBOT_KING_KONG/2019-06-26--08-30-17_du_s3ve3g-userdebug_712_NZH54D_engroot20180 # /tmp/tar-arm --selinux --xattrs -vxpPf data.ext4.win003 /data/data/com.whatsapp
/data/data/com.whatsapp/
/data/data/com.whatsapp/cache/
/data/data/com.whatsapp/code_cache/
/data/data/com.whatsapp/lib
/data/data/com.whatsapp/app_minidumps/
^C

```

**finally, change the owner and group**

```
/ # chown -Rh 10104.10104 /data/data/com.whatsapp

```
> 1 votes

---
Tags: root-access
---


# Question
Title: How to change the default hotspot DHCP IP address range on Android?
As the title says I look for a way to permanently change the default IP address range form `192.168.43.xxx` to `192.168.1.xxx`.

Reason: On my router some of my devices get a static IP trough DHCP, in the `192.168.1.xxx` range. Using the hotspot on the road I would like to have the same setup.

I have tried to change the range following this steps, but it did not work out on both of my devices. They are rooted and Lineage OS is installed. The last answer suggest an easy way to do this, but it is not possible in Lineage OS.

Also this post from anroidpolice.com suggests that it is possible by an app, I look for a solution to do this with `adb`. I have no access to Google Play, and do not want it.

# Answer
***NOTE:*** *Root is required.*

---

Default DHCP IP address range is hard-coded (), you can't change it without rebuilding ROM with modified source code. Or use a little hack.

When you switch on tethering, what happens (at least):

* `hostapd` \- the daemon which manages access points - is started.
* Network interfaces are set up, IP address is added to Wi-Fi interface (hard-coded before Android Pie (, ), randomized afterwards ()), and routing table is added () for local network.
* `dnsmasq` \- the DHCP/DNS server (up to Pie) - is started with hard-coded commandline arguments () (which can be set through `/etc/dnsmasq.conf` () otherwise).

So we can replace `/system/bin/dnsmasq` with a custom shell script, taking control of the process in between. Rename the original binary to something else:

```
~# mv /system/bin/dnsmasq /system/bin/dnsmasq.bin

```

Create script `/system/bin/dnsmasq`:

```
#!/system/bin/sh

OLD_SUBNET='192.168.43'
NEW_SUBNET='192.168.1'
WIFI_INTERFACE='wlan0'
LOCAL_TABLE=$(awk '$2=="local_network" {print $1}' /data/misc/net/rt_tables)

export PATH=/system/bin

# delete old route, add new
ip route del ${OLD_SUBNET}.0/24 dev ${WIFI_INTERFACE} table $LOCAL_TABLE
ip route add ${NEW_SUBNET}.0/24 dev ${WIFI_INTERFACE} table $LOCAL_TABLE

# set new IP address on Wi-Fi interface
ip address add ${NEW_SUBNET}.1/24 dev $WIFI_INTERFACE

# inject new subnet in hard-coded arguments received from netd
set -- $(printf '%s' "$*" | sed 's/'"${OLD_SUBNET}"'/'"${NEW_SUBNET}"'/g')
unset OLD_SUBNET NEW_SUBNET WIFI_INTERFACE LOCAL_TABLE

# execute original binary with new arguments
exec dnsmasq.bin $*

```

Confirm the name of your Wi-Fi interface (`wlan0` usually). Check with `ip link` or `ls /sys/class/net/` or `iw`:

```
WIFI_INTERFACE=$(iw dev | grep -E 'ssid |Interface ' | grep -B1 ssid | awk '$1=="Interface" {print $2}')

```

Also confirm your `local_network` (, ) routing table (`97`) is being used for hotspot. Android's routing is a mess, getting more complex with every new release. So I'm not sure if this has been persistent or not. Also before making any changes, check your routing policies and tables to figure out what you should put in your script:

```
~# RULES="$(ip rule | grep -vE 'unreachable|local')"
~# echo "$RULES"
~# for t in $(echo "$RULES" | awk '{print $NF}' | uniq); do ip r s table $t; done

```

SELinux rules also need to be defined if (all or some) not already defined and if status is `enforcing`. Use Magisk's `suploicy` or some other similar tool like `sepolicy-inject`:

```
# execute binaries from /system/bin
allow netd system_file dir { read open getattr search }
allow netd system_file file { read gettattr open execute execute_no_trans }

# execute /system/bin/sh
allow netd shell_exec file { read getattr open execute execute_no_trans }

# execute /system/bin/toolbox and its applets
allow netd toolbox_exec file { read gettattr open execute execute_no_trans }

# configure RPDB rules / routing tables
allow netd netd capability { sys_admin }

```

* Rules are not persistent across reboots, use some `init.d` script or replace `/sepolicy` in `ramdisk`

Set permissions on files:

```
~# chown 0.0 /system/bin/dnsmasq*; chmod 0755 /system/bin/dnsmasq*
~# chcon u:object_r:system_file:s0 /system/bin/dnsmasq
~# chcon u:object_r:dnsmasq_exec:s0 /system/bin/dnsmasq.bin

```

Enjoy!

Another options is to modify the value of `config_tether_dhcp_range` (10) in Android framework as explained in this answer, but I haven't tested this.

Or you can setup complete tethering from commandline, running your own processes. This answer includes the instructions, though the question is different.

---

**RELATED:**
> 8 votes

---
Tags: networking, wifi-hotspot, wifi-tethering, usb-tethering, dhcp
---


# Question
Title: How can I increase the number of volume levels?
Is it possible to increase the number of steps in the volume control? I'd like a finer grained control over the volume level. I have a Galaxy Nexus.

Note: I don't want to boost the volume just change the number of levels so I can find a sweet spot when listening to music.

# Answer
Many people have this problem with Android. You can see it has been reported in Android's bug tracking system. The number of levels is controlled by a setting that's compiled into the Android system image.

## Use a different ROM

It's possible that a could increase the number of levels, but I don't know which, if any, custom ROMs do this. This bug report in 's tracker suggests they don't plan to add that feature, for fear it may cause compatibility problems with some apps.

## Use a different app (easy)

Some media apps have their own volume control, on top of that provided by Android. I believe Poweramp is one such (but I don't use it myself). If there's one particular app you need more control of, such as a music app, you might want to replace it with one that has this feature.

## Edit your phone's OS (advanced)

If you're not worried about the risk of breaking some (badly-written) apps, and your device is ed, then you can follow these instructions to edit the Android system image to increase the number of levels. That site gives step-by-step instructions, including installing the developer tools you'll need to make system changes; a summary for knowledgeable people is as follows:

1. Get `framework.jar` from your device and run `baksmali` on it.
2. Edit `framework\android\media\AudioService.smali`
3. Search for `0xft 0x0t 0x0t 0x0t` to find the table of audio levels.
4. Replace the first number of each row with the desired number of levels (in hexadecimal).
5. Run `smali` to generate a new `framework.jar`, and then replace the original on the device.
> 21 votes

# Answer
This should help some folks and it does enable better control, not louder volume.

1. Go to developer options (enable developer options if you haven't previously done so).
2. Then, turn on "Disable absolute volume".
3. You may need to restart your Android device for it to take effect.

The steps now are *way* more reasonable. In other words, it answers your "Note", as now the volume (at least on my Bluetooth headphones) now has much smaller steps -- it no longer goes from too quiet to too loud in one step.
> 21 votes

# Answer
If you're phone is rooted or you have a custom recovery (like TWRP), this is actually much easier. The only thing you'll have to do, is to add the following line to your `build.prop` file located in `/system`:

```
ro.config.media_vol_steps=30

```

Where 30 represents the number of steps.

This can be done with a root file explorer (like Root Browser) or via `VI` in the TWRP terminal or via `adb`.
> 11 votes

# Answer
I ended up using Fine Volume Control V2 (Trial version) on my Nexus 4 - supports up to 100 volume levels. It's not perfect but should suffice till they *hopefully* fix what seems like such a simple problem.

Precise Volume (XDA Forums, Play Store) also looks worth a go.
> 6 votes

# Answer
I had initially posted this as an answer to this question: How to increase/decrease volume in smaller increments/decrements?, unfortunately this method won't work officially with Nougat (due to some missing requirements)

**The workaround:**

As expected, such a modification, will require root or some kind of zip flashing proceedure to install **Xposed framework.**

*Kuba Kalamarz* created an Xposed module called VolumeSteps+ which allows one to adjust the amount of steps for every system volume function.

The good thing I noticed about this **module is it binds to settings system (i.e you don’t have to open the module UI, instead you can control via the volume button)**

**Prerequisites**

> Features
>
> * Change the number of volume steps for the alarm, music, notification, ringer, system and in-call streams.
> * Ability to change it to somewhere between 5 and 50 steps
> * Use the music volume as default for the Volume Panel when pressing the volume buttons.

**Instructions**

1. Download VolumeSteps+ and install

2. Activate the module in Xposed Settings, and reboot the device to effect changes.
3. Open VolumeSteps+ in the app drawer
4. Adjust your volume steps:

* Each volume category has its own menu entry. Select the one you want to adjust, then use the slider to fine-tune the volume steps, press OK when done.

* Find the increment that suits your needs.

3. **Reboot** (important) your device and the new volume steps will be available, even when pressing the volume button. Viola!

Disclaimer (I am not associated with this application, however I use it so I wrote the post to share my experience with other end users)

**Nb: I tested this workaround myself and it does exactly as described**

Special thanks to
> 3 votes

# Answer
The Samsung SoundAssistant is your huckleberry. Free app. Provides system-wide fine control over volume, with adjustable increments and per-application settings.
> 3 votes

---
Tags: audio, volume-control
---


# Question
Title: How to fix the problem of offline packages not downloading in Google Translate?
I'm having a problem with Google Translate and downloading offline packages for any language. I tap the download button next to the language, it says "Starting download" and the indicator is spinning, but nothing happens and the language pack is not downloaded. The app **has** the permission to use the storage.

My setup: the latest version of Google Translate (v5.20.0.RC10.199570264), on an Xperia L1 with Android 7. I should stress that with previous versions this used to work.

What I have tried:

1) Clearing cache and data of both the app and Google play (also the services).

2) Unistalling and reinstalling.

3) Rebooting.

4) Unistalling, rebooting and then reinstalling.

5) Moving the app to SD. Also the opposite.

6) Checking the permissions (everything is allowed).

7) All combinations of all of the above.

I'm about to try a factory reset, but before going nuclear I'd like to try some alternative.

Any hints/ideas are welcome!

# Answer
> 6 votes
The issue was solved by clearing the data of download manager as confirmed by OP .

Go to Settings → Applications → Download manager → Clear data.

The download should proceed as normal.

# Answer
> 4 votes
Solved turning off VPN... Never thought about this been an issue here.

Thanks for suggestions!

# Answer
> 1 votes
1. Uninstall Google Translation (with the memory card on your mobile).
2. Turn off the mobile.
3. Remove the memory card.
4. Turn on the mobile.
5. Install the Google Translation from PlayStore and give full permisions to application.
6. Install ALL the languages you want to use offline.
7. Turn off the mobile phone.
8. Insert the memory card.
9. Turn on the mobile.
10. Copy the entire folder from the internal memory Android\data\ com.google.android.apps.translate to the exact same location on the memory card (if prompted, replace the same files that the memory card holds in the same slot).
11. Restart the mobile.
12. Now everything in Google translation works well.

# Answer
> 0 votes
I had this problem too. I changed wifi to cellular data . It solved!! Google couldn't downlad via wifi

# Answer
> 0 votes
Google translate offline the audio doesn'twork when you're trying to imput using audio ....the microphones is blanked out

and also the output there no audio ...... input is English and the output is Vietnamese I downloaded the file no problem

You can try to import in and afterwards you can get audio on the input but not on the output

---
Tags: 7.0-nougat, sony-xperia-l, google-translate
---


title: How to root Android with Samsung Odin

text:
# Question
Title: How to root Android with Samsung Odin
How to root A Samsung mobile phone or tablet using Samsung Odin?

# Answer
> 1 votes
Android rooting is not an uncommon term using tech nerds anymore. It is very common and everybody at least heard the term. So why we do this? As my opinion, we already have enough control over our device. Don't you think? that's how the less than half of the population of the Android community keep their devices without unstable it. But the other half sees the situation completely different. They root their devices to flash new ROMs, gain more control by customizing download unauthorized apps and modifying default functions in the system. So to do this you have o download rooting tool that most suitable for your device. For a Samsung user, it is not any software other than Samsung Odin. So let's talk about how to root with Odin.

**What is Samsung Odin**

It is a free utility that serving a wide range of devices and specially created for the Samsung devices by Samsung itself. With the time the software is updated so you can see there are several versions for the same tool. Select the best one for your device is your responsibility. This one-click rooting method is not like traditional root tools available out there. The flow starts with flashes the root package and then root it through the computer. And do not waste your time for searching direct rooting methods for Samsung Odin, because there isn't.

**Compatible list**

As I mentioned earlier there are different versions of Odin for the different operating system. So check the list below and select the suitable version for your device.

* v. 1.85 - GingerBread and Ice Cream Sandwich
* v. 3.09 - Jellybean and KitKat
* v. 3.10.7 - Lollipop
* v. 3.11.1 - Marshmallows
* v. 3.13.1 - more latest versions

**Android rooting with Samsung Odin**

*Preparation*

* Samsung Odin is only compatible with windows. So install necessary drivers to the PC and make it ready.
* It's not hurt be ready to whatever happens. So backup all of the mobile phone for more security.
* Enable USB debugging on the device. (Settings --\> about --\> Build number --\> Tap 5 times --\> You are a developer now --\> USB debugging --\> enable)
* The process could not be continued. So keep a sufficient battery power.

*Let's start the process of Android rooting*

1. Go to this site and download the suitable root package. Check your device name, model number, Android version, and build number beforehand.
2. Now extract the downloaded package in a new folder.
3. Power off the device and boot it into download mode. To do this press and hold Power Key, Home Key, and Volume Down Key simultaneously.
4. Open the Odin file in the extracted folder.
5. Connect the mobile device with the PC using a USB cable.
6. The software will automatically detect the device you will see "Added" in the lower left panel
7. Click the "AP/PDA" button and select the extracted file.
8. Then click "Start" button
9. Now the rooting will start. After it completes you will see the message "PASS"
10. The device will be rebooted for one last time. There will be SuperSu installed already on the device if the root was a success.

\**Wrap up\* Odin is an application specifically created for Samsung smartphones and tablets. But it does not say it limited to that brand. It can serve various brands like HTC, LG, etc.\*

---
Tags: applications, rooting
---


title: How to force TRIM on Android device?

text:
# Question
Title: How to force TRIM on Android device?
With 4.3 enabling the support for TRIM (though I read that it was present since the first JB). I was wondering if there is a way for me to force TRIM on my device? Is there an app that I can sideload and have it issue it? I have a rooted chinese Tablet running on 4.2.2 JellyBean release.

Just to add, it's a PiPo M1 Max tablet.

# Answer
> 2 votes
There is an app called LagFix, which can let you trim your device literally.

It can only run if the device is rooted, and since your device is already rooted then it is perfect for you.

And here is the thread on Xda developers about LagFix.

I hope it helps.

# Answer
> 1 votes
On newer versions, Android runs `fstrim` with a daily schedule, provided that the conditions meet. Or it should run on a reboot if not run for 3+ days. See this answer for details.

However if you want to do `TRIM` manually, use Android's commandline tool **`sm fstrim`**. Previously this was `vdc fstrim dotrim` but added to Storage Manager in Oreo () and removed from `vold` in Pie ().

In order to send `FITRIM ioctl` to selected filesystem(s) only, use `fstrim` tool; a busybox applet.

Both commands require root, or `sm fstrim` can be executed from `adb shell`.

# Answer
> 0 votes
I was having lag issues on my N7 2012. After doing some research I was lead to Forever Gone.

This app has been used to overwrite the free space on the device so that it can be more efficiently used. Until 4.3 is released for you device I would give this a try to see if it helps with performance. It sure helped my N7.

---
Tags: root-access, file-system, performance, lagging, maintenance
---


# Question
Title: Use 4G while being connected to a WiFi direct printer
Is it possible to use 4G for internet while being connected to a wireless printer with WiFi direct?

If not, are there any alternatives to use both, the printer as well as the internet, simultaneously without requiring another WiFi access point?

(The printer in question is the Epson L3150 Wireless Printer)

# Answer
This is an ongoing issue that has been described as an optional implementation of the wifi direct. Or rather a lack of implemented options. My self a team testing an app for a developer, found that some phones have an option or feature for load balancing over wifi and data as a feature. Those that have this balancing, print and access internet without issue. Those without have no data over cellular while connected to wifi.
> 1 votes

# Answer
I was looking to the similar solution with my 360 camera and I found it. Even though my problem seems to be more complicated than yours. I needed some app to get data from internet while my phone wifi was being used for wireless connection with the camera. The app just always wanted to use wifi to get data and ignored all settings and even restrictions through mobiwal to use mobile connection only.

Below is where I asked about it and described a solution before I got any answers

Need wifi to be connected to a camera(no internet) and one app using 4G for internet

In your case, why don't you want to try to do it as simple as that:

1)create a hotspot on your phone where your 4G connection 2) connect your printer to the hotspot?

I did almost the same but in my case I used a second phone just as a hotspot. The reason I had to do it that way is I cannot connect to anything from the camera directly so I had to go through Wireless LAN client mode as a feature of the camera. In your case your printer should have some kind of screen that can help to connect to your hotspot.
> 0 votes

---
Tags: wi-fi, networking, wifi-direct
---


# Question
Title: Prevent user to uninstall application from android phone
I have `Moto G5 Plus Android phone`. I don't want to allow someone to uninstall the application from my android phone. The android phone allows to press on the application and drag it to delete icon and allow uninstallation. I want if someone does the same operation in my phone then before uninstall it ask password or pattern lock.

Thanks.

# Answer
When a user tries to uninstall an app through the home launcher, Settings app, or through any third-party app, the system app Package Installer is invoked and user is asked to confirm the uninstallation. So the solution for you is to either disable that Package Installer app (or at least its component which is invoked for user confirmation) or find an app locker which can lock this system app.

I tried some app locker apps and found that AppLock - Fingerprint can lock down Package Installer app. It even recommends it. From then on, anyone trying to uninstall an app would need to authenticate with your preferred choice of authentication before proceeding to uninstall. At the risk of redundancy, this does take care of uninstallation via Settings app too, as I explained the reason for it in the beginning.

**Note:** app locker apps alike many privacy protector apps are notorious for floundering a user's privacy and shoving ads down the user's throat.
> 2 votes

# Answer
That is not possible. The other way to uninstall app is going to Settings and under usually **Applications** where you can uninstall the apps easily.

What you can do instead is move your app as a System app, but it needs your phone to be rooted. System apps cannot be uninstalled easily without the person having the knowledge how to uninstall it. Systems apps are like your Messaging, Dialer, Gallery Apps, if you'll notice there is no uninstall option but disable option only.
> 0 votes

---
Tags: motorola-moto-g, uninstallation
---


title: itel phone unable to switch on

text:
# Question
Title: itel phone unable to switch on
I bought a new itel phone yesterday. I charged it a bit then added apps and photos and music. I played some music during the night. I tried rebooting does not go on, it vibrates but screen is blank.

# Answer
According to what you said,

> played some music during the night

Its most probable that your phone is out of battery juice, given that it must have been drained overnight. That's why you're only able to get a vibration and a quick blink on the screen and nothing more.

So charge your phone mate, and you're good to go
> 0 votes

---
Tags: boot
---


# Question
Title: Trigger Setup Wizard at next boot using command-line
I am looking for a way to use ADB to trigger Setup Wizard at next boot. I know I can run the following command and get it to pop up. However, I can't figure out what triggers it to start at boot.

```
adb shell am start -a android.intent.action.MAIN -n com.google.android.setupwizard/.SetupWizardTestActivity

```

The phone I am currently using is **stock** and I would like to keep it that way.

I've read the question: how to re-enable first time setup at next boot?

# Answer
> 6 votes
**Note**: This solution:

* requires a rooted Android;
* is tested on Android 4.4.2, Vanir (Android 5.1.1) and on an unofficial CM13 build;
* requires setup in PC.

---

Following are some screenshots serving as a proof:

<sub>(Click image to enlarge)</sub>

**Note** that you cannot replicate those images by issuing that shell command, because the test activity you would run would hide all the icons in the left of status bar and even time in my ROM.

Here are the instructions I followed:

1. Find the disabled components. Do:

```
adb shell dumpsys PACKAGE

```

Replace `PACKAGE` with package name of Setup Wizard app. Often, it would be a setup wizard from Google with package name `com.google.android.setupwizard`. Package name of CyanogenMod's setup wizard is `com.cyanogenmod.setupwizard`. If it has GApps installed, then use package name of Google's setup wizard. If none of the package name works then this resource may help: View app's full package name?

This step *inter alia* provided me a list of components of that app currently disabled. Here is a relevant excerpt under the heading `Packages:` from the output of the said command:

```
User 0: installed=true hidden=false stopped=false notLaunched=false enabled=0
  disabledComponents:
  com.google.android.setupwizard.account.RestoreServicee
  com.google.android.setupwizard.carrier.MobileDataActivity$HfaChangeReceiver
  com.google.android.setupwizard.util.SetupWizardAdminReceiver
  com.google.android.setupwizard.SetupWizardActivity
  com.google.android.setupwizard.util.GservicesChangedReceiver
  com.google.android.setupwizard.carrier.MobileConnectivityChangeReceiver

```

`com.google.android.setupwizard.SetupWizardActivity` is the main and default activity of that app. Although the app has requested the permission `android.permission.RECEIVE_BOOT_COMPLETED`, strangely, there is no receiver declared in the manifest to receive `android.intent.action.BOOT_COMPLETED` broadcast. My guess is that the property `user_setup_complete` alone is used for the purpose of launching that app.
2. Whatsoever the disabled components shown in your command's output for User 0 are, simply enable all of them for the same user. The simplest way is to use `pm` command.

```
adb shell
su
pm enable PACKAGE/COMPONENT

```

An example to enable a component:

```
pm enable com.google.android.setupwizard/com.google.android.setupwizard.carrier.MobileDataActivity\$HfaChangeReceiver

```

**Note:** It is not clear to me why but when I tried to enable the components using an app (say X), they were disabled automatically once I exited the X app. So I recommend you enable the components using the command-line and refrain from interacting with screen at all costs.
3. Get the property name:

```
adb shell 'content query --uri content://settings/global | grep -e "setup" -e "complete"'
adb shell 'content query --uri content://settings/secure | grep -e "setup" -e "complete"'
adb shell 'content query --uri content://settings/system | grep -e "setup" -e "complete"'

```

One of the commands must return output containing either the key `user_setup_complete` or, as Andrew T. noted, `setup_wizard_has_run`.

Once you have the key, do:

```
adb shell settings put secure KEY 0  # replace KEY with the key noted above.

```
4. Do `adb reboot` for full reboot or `adb shell su -c 'setprop ctl.restart zygote'` for soft-reboot or reboot ordinarily as you would and there you would have the Setup Wizard app waiting for interaction after reboot is completed.

# Answer
> 6 votes
In addition to Christopher's answer

*settings put global device\_provisioned 0*

Will disable some of the functionalities of the phone and will be unlocked after setup wizard.

```
adb shell settings put global setup_wizard_has_run 1

adb shell settings put secure user_setup_complete 1

adb shell settings put global device_provisioned 1

```

Will unlock all features of the phone as far as I know, vice versa.

Just in case someone needs these information

# Answer
> 4 votes
The following shell script will trigger the Google Setup Wizard:

```
#!/bin/bash

adb root
adb remount

adb shell settings put global setup_wizard_has_run 0

adb shell settings put secure user_setup_complete 0

adb shell 'content query --uri content://settings/global | grep -e "setup" -e "complete"'
adb shell 'content query --uri content://settings/secure | grep -e "setup" -e "complete"'
adb shell 'content query --uri content://settings/system | grep -e "setup" -e "complete"'

adb shell pm enable com.google.android.setupwizard/.SetupWizardActivity

adb shell am start -n com.google.android.setupwizard/.SetupWizardActivity

```

# Answer
> 4 votes
The following command worked for me *without* root access:

```
adb shell am start -a android.intent.action.MAIN -n com.google.android.setupwizard/.deferred.DeferredSetupWizardActivity

```

# Answer
> 2 votes
Had the same issue with my new Pixel 2 XL. I'd used Nova Launcher to make a widget "activities" for launching system apps previously and sure enough, Pixel Setup was in the list so I added that widget/button and it fired up and offered me to restore from a cloud backup etc.

# Answer
> 0 votes
If you got root you can do something like this:

```
#!/bin/bash

adb root
wait ${!}
adb shell pm enable com.google.android.setupwizard || true
wait ${!}
adb shell pm disable com.android.provision || true
wait ${!}
adb shell am start com.google.android.setupwizard/com.google.android.setupwizard.SetupWizardTestActivity

```

You can find LineageOS sample script there

---
Tags: command-line, setup-wizard
---