How To Disable Ads in MIUI 11 on Xiaomi Devices

Next to my daily driver I also have an Xiaomi Redmi 7 running MIUI 11. The preloaded Xiaomi Applications such as the File Manager contain built-in Ads. It is known that Xiaomi has low-margins to hit certain price points while keeping the components relatively high.

Fortunately, there is a fairly easy work-around to disable the ads by revoking the system permissions that allows the MIUI System Ads daemon (msa) to collect data and push ads to you.

The ads first started appearing with MIUI 9 and with version 10 and now 11 available for the newest handsets the place in the settings menu has shifted multiple times. The following steps apply for MIUI 11 as of December 2019.

Go to Settings –> Password and Security

Select Authorization & revocation and toggle the switch of mda to revoke the authorization. A count-down will appear warning you that this operation might break the application which in this case is actually what we want in order to disable the ads.

The toggle should be disabled after the revocation. Enjoy the ad-free experience.

How to Clone any Application (Dual Apps) with EMUI’s App Twin Feature [No Root]

Huawei introduced the App Twin feature with Version 5.0 of Huawei’s EMUI, their Android skin. I believe that Huawei must consider this feature one of EMUI’s biggest selling points, since they present it in the topmost layer of the Settings application.

App Twin allows you to create a duplicate instance of an installed application so you can log-in to two different accounts at the same time. On Huawei Smartphones destined for the European Market with the Global Rom you’re able to clone WhatsApp or Facebook. On the equivalent Model for the Chinese Market you’re able to duplicate QQ or Wechat. Unfortunately these are your only options by default. I expect Huawei to add more applications to this list with upcoming version of EMUI.

When you duplicate one of those applications, a new app icon will be created on your home to start the cloned instance of the app. A small number is added to the original application icon to indicate which instance you’re using the cloned or the original application. Unfortunately, the duplicate application can only exist on Huawei’s stock launcher, and when the icon is cleared from the home screen, all the data associated with the App Twin instance is deleted.

The App Twin feature isn’t an innovative, never to be seen before concept on part of Huawei. There are several applications that perform the same function on the Google Play Store. Some of the most popular ones include App Cloner and Paralllel Space. In addition, Xiaomi’s MUI offers the same feature with greater compatibility and a larger selection of Applications. However, I would argue that by default, the third-party application alternatives are to some extent superior to Huwai’s implementation. Any application which you duplicate isn’t tied to Huawei’s stock EMUI launcher and even more importantly you aren’t limited to only 2 predetermined applications which Huawei has set.

In contrast, the third-party applications (with the exception of Xiaomi’s MIU implementation) have their own faire share of disadvantages. For example, App Cloner doesn’t work well on many applications including most Google Apps. Parallel Space is a pretty bloated application and quite the resource hog and is slow to launch any given cloned application.

I have to give Huawei credit to its implementation of the App Twin feature since it doesn’t suffer from either of this issues. However, for some odd reason Huawei decided to restrict the feature to a few apps. Despite their official claim that App Twin only works with WhatsApp/Facebook or QQ/Wechat it can actually work with pretty much any application on your device (with the exception of a few system application)

Clone any App with EMUI’s APP-Twin Feature

To clone any app you need access to the ADB shell and the application’s full package name.

First download the android SDK with the included ADB and fastboot tools or download the separate ADB binaries straight from Google:

Next install Huawei’s HiSuite which also installs the necessary drivers for ADB to work correctly. In order to be able to see the your Huawei smartphone you need to enable USB debugging in the developer settings:

Settings –> Developer options –> USB Debugging
(Tap on Build Number 7 times in Settings –> About Phone to unlock Developer options if you haven’t already done so)

Verify that ADB is set up properly by checking if adb recognises your device. Open up a command prompt and type adb devices . If you see your phone’s serial number and it doesn’t state ‘unauthorised’ then you’re good to go.

The first step in enabling the App-Twin Feature for your specific app is to find the package name of the specific application. The easiest way to accomplish this using an app like App Inspector From the Google Play Store

The package name is the first line underneath the app’s name e.g. com.google.android.apps.plus

If you don’t want to install another app just to see the package name of an installed application you can also see a list of all installed application using the following adb shell command: adb shell 'pm list packages -f

With the package name we can now enable the App-Twin feature. Start an adb shell with adb shell

Once in the adb shell enter the following command:

settings get secure clone_app_list

If you are already using the App Twin feature, then you should see either one or two package names returned with this command. If you aren’t using this feature, this string will be empty. Now, we will either append to the existing list or create a new list of apps to clone.

settings put secure clone_app_list "PACKAGE#1;PACKAGE#2;PACKAGE#3"

where PACKAGE#1…PACKAGE#3…PACKAGE#N is the full semi-colon separated list of app packagesyou want cloned. Make sure that you don’t forget to put the package list in-between quotation marks, otherwise the command won’t work.

If you are already using the App Twin feature and you received a list of packages during the“get”command, then be sure to APPEND your list to the ones that were returned. Otherwise, the existing apps will be deleted.

For example, if I want to clone Gmail, Solid Explorer, Chromium, and Reddit is Fun, I would enter the following command:

settings put secure clone_app_list "com.google.android.gm;pl.solidexplorer2;org.chromium.chrome;com.andrewshu.android.reddit"

Immediately after entering this command, you should see a toast message telling you that a cloned app has been placed on your home screen.

Disabling factory installed Applications on an Android Phone without root

If you ever have used an Android phone I am pretty sure that you all experienced the following: Android Phones usually come with dozens of pre-installed applications. If you happen to receive your phone from a carrier it might even come with more carrier – centric applications which you might or might not like. The Android application managers offers the ability to disable most of these apps similar to how you uninstall applications acquired through the Google Play Store.

Disable Built - in Application
Disable Built – in Application

Short Remark: If the application came factory pre-installed and meanwhile has received updates through the Play Store the “Disable” button will probably be labelled with: “Uninstall Updates”

In contrast, the manufacturer may turn off the “Disable” functionality for certain system applications. As you can see on the next screenshot, the application cannot be disabled. The button is greyed out.

Application Management - Disabling Application not allowed
Application Management – Disabling Application not allowed

Fortunately, a way still exist to disable those apps without rooting your mobile phone using Android’s Debug Bridge.

  • Connect your device via USB and fire up a Terminal
  • Check that your device is connected using adb devices
  • Connect to a shell on your mobile phone using adb shell
  • pm list packages will show the package names of all installed applications on the phone (including built-in applications)

[bash]

shell@C6903:/ $ pm list packages
package:com.google.android.ears
package:com.sonyericsson.cameraextension.permission
package:ch.admin.meteoswiss
package:com.android.defcontainer
package:com.sonymobile.cameracommon
package:bbc.mobile.news.ww
package:com.audible.application
package:com.sonyericsson.orangetheme
package:com.android.phone
package:com.sonyericsson.initialbootsetup
package:com.mobisystems.fileman
package:com.sonyericsson.unsupportedheadsetnotifier
package:com.sonyericsson.providers.protectedmedia

[/bash]

To disable any app use the block command. Even those with Disable turned off can be disabled.
For example to disable Sony’s What’s New Application:

pm block com.sonymobile.advancedwidget.entrance

To turn off the small app widgets found in the recent app launcher execute the following commands:

[bash]
shell@C6903:/ $ pm block com.sony.smallapp.launcher
Package com.sony.smallapp.launcher new blocked state: true
shell@C6903:/ $ pm block com.sony.smallapp.app.widget
Package com.sony.smallapp.app.widget new blocked state: true
[/bash]

Reboot and you’re done.

Android Application Debugging over WiFi

When developing android applications I sometimes run out of usb ports on my notebook and have no free ports left to connect my nexus device. Luckily a friend of mine showed me a neat little trick to run ADB (Android Debug Bridge) using TCP/IP over Wifi. This means that you don’t have to tether your Android device to your computer when you are developing.

This allows to quickly charge up a device using wall-mounted usb charger while still being able to develop your program and push new builds to the device as long as it is connected to the same wireless network. I guess in a project where multiple developers are working on the same project at the same time, multiple computers can connect to the same android device via tcp/ip and push out new builds to the device simultaneously. (Only prerequisite being that all computers must use the same debug key to code sign the build).

Follow these steps to connect your android device using ADB over TCP/IP:

Connect your Android device to your computer and make sure that you have USB Debugging enabled (Settings –> Developer options –> USB debugging)

Fire up your favourite Terminal/Console application. In case you didn’t add the SDK folder to your PATH system variable. Navigate to your directory.
Make sure ADB can see your device via usb:

[bash]$ adb devices
List of devices attached
02ccbd8c093efac2 device
[/bash]

Restart ADB in TCP/IP mode with the following command: (5555 represents the port used for the adb onnection – can be changed to your liking)

[bash]$ adb tcpip 5555
restarting in TCP mode port: 5555
[/bash]

ADB will promptly respond that it has restarted ADB in TCP/IP mode. Now you need to connect adb to your phone using the phone’s ip address (Settings –> About phone –> Status –> IP address)

[bash]$ adb connect 10.1.1.161 #replace 10.1.1.161 with your phone’s ip address
connected to 10.1.1.161:5555[/bash]

again listing all your connected devices with

[bash]$ adb devices
List of devices attached
10.1.1.161:5555 device[/bash]

should now list your phone’s ip address and you can install and push new builds directly from eclipse to your phone via WiFi

Logcat Window in Eclipse
Logcat Window in Eclipse – Pushing a build to a phone