LightBlog

mardi 28 février 2017

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

If you've recently purchased a Huawei Mate 9 or you're one of the lucky few to partake in the EMUI 5.0 beta for some Huawei/Honor devices, then you might have heard of the new "App Twin" feature.

Evidently, Huawei must consider this feature one of EMUI's biggest selling points, since they stuck it in the top-most layer of the Settings application. App Twin, as you might expect from its name, allows you to create a duplicate application so you can log-in to two different accounts at the same time. Owners of a European model can duplicate Whatsapp or Facebook while Chinese models can duplicate QQ or Wechat, but these are your only options by default.

When you duplicate one of these applications, a new app icon will be created on your home screen that allows you to start the duplicated app. You'll see a little "2" card icon within the app icon that indicates which app you're using – the original or duplicate. This duplicate application can only exist on Huawei's stock launcher, and when the icon is cleared from the home screen, the App Twin is deleted.

Now, this certainly isn't an innovative concept on the part of Huawei. There are several applications that do this same function on the Play Store; some of the more popular ones include App Cloner and Parallel Space. I would argue that by default, these third-party alternatives are superior to Huawei's App Twin feature. Any app that you duplicate through one of the Play Store alternatives isn't tied to Huawei's stock EMUI launcher. But most importantly, you aren't limited to only 2 predetermined applications that Huawei has set.

These apps, and others like them on the Play Store, also have their own fair share of downsides, though. App Cloner, for instance, doesn't work on many applications (such as most Google apps). Parallel Space, while demonstrating greater compatibility, is in my opinion a pretty bloated application that is slow to launch any given duplicated app.

Fortunately, Huawei's App Twin feature does not suffer from either of these two problems, but for some odd reason Huawei decided to restrict the feature to so few apps. Despite Huawei's claims that App Twin only works for Whatsapp/Facebook or QQ/Wechat, it can actually work with pretty much any application on your device. Here's how it's done.


Clone any App with EMUI's App Twin Feature

Those of you who have been following my previous tutorials might know that I'm a huge fan of using Tasker and/or the ADB shell to discover and tweak hidden settings on your device. This time is no different, though you can breathe a sigh of relief as we won't be needing Tasker this time around. I almost completely missed this trick because I never gave App Twin a second thought after I switched over to using Nova Launcher, but while I was messing around with other tweaks, the ADB command I sent days before suddenly made a secondary Gmail, Solid Explorer, Chromium, and Reddit is Fun icon pop up.

To my surprise, these were fully functional duplicate apps. And it's really quite easy to add whatever application you want to the App Twin list. All you need is the application's package name and a working ADB shell (if you already have root access, then you can use Terminal Emulator instead).

First, download the ADB binary straight from Google and extract it to any folder on your computer. Next, install HiSuite from Huawei so your computer will have the latest drivers necessary for ADB to work. Finally, you need to enable USB Debugging in Settings –> Developer options (tap on Build Number 7 times in Settings –> About phone to unlock Developer options if you haven't already) and grant your computer ADB access.

Verify that ADB is set up properly by seeing if it recognizes your device. Open up a command prompt in the same directory as your ADB binary (Windows: right-click in the folder and click on "Open Command Prompt Here") and then type adb devices. If you see your phone's serial number (and it doesn't say "unauthorized") then you're ready to move on. If you don't see it, check to make sure that HiSuite recognizes your phone and double check that USB Debugging is enabled.

Now, we need to get a list of package names that we will clone using the App Twin feature. I recommend you install an application like App Inspector from the Play Store which will tell you the package name of all installed apps. Open up the application and tap on "App list" to show an alphabetical list of your apps. Tap on an application to open up a details page with a bunch of information including the install time, data storage location, usage statistics, and more.

What we're interested in is, of course, the package name. The package name is the first line underneath the app's name up top, or you can find it by looking after the last / in the data storage location. It will usually start with "com." but this is not always the case. For Gmail, the package name is com.google.android.gm.

Now that you've got the package name, open up a command prompt in the same directory as your ADB binary. We will now send an ADB command to create our cloned apps. First, you'll need to enter an ADB shell. Type the following:

  adb shell  

Once you're in an 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 packages you 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 instance, 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. Depending on how many packages you entered in this command, your home screen should now populate with one or more cloned apps.

You can have some fun with this command, as it can be used on pretty much any app on your phone (though I wouldn't recommend cloning SystemUI, as I have no idea what would happen). I was able to clone the Google Play Store and Fire Emblem Heroes, for instance.

The cloned Play Store is fully functional, but it does result in some peculiar behavior if you install an app from within it. As you can see in the screenshot below, I installed Parallel Space from within the clone Play Store. The system becomes confused, thinking that you've just created another cloned app, but when you tap on the home screen icon you are told that the app isn't installed. Not to worry, though, as the app is actually installed and accessible from the app drawer.

If you want to play around with this command on your own, there is one very important thing you should be careful of. Anytime you want to add a package to the list, you must append to the list and not overwrite the existing packages in the list, otherwise your existing cloned apps will all disappear. You can get the current list of cloned packages by entering the "get" command from earlier in this tutorial.


Conclusion

I hope you find this neat little trick useful. I don't know why Huawei decided to restrict which applications you can clone, especially since the feature seems to be fully functional with nearly every app on your device. In my experience, Huawei's App Twin (after this tweak) is actually better than using third-party apps from the Play Store, since it has wide compatibility and doesn't suffer from speed issues.

Although, the one remaining caveat is that this feature still only works on Huawei's default launcher. I haven't yet figured out a way to get around this restraint, but it might require third-party launchers to support this feature (which I don't think will happen). Nevertheless, this tutorial should still help those of you who were hoping that EMUI's App Twin feature could be more useful.

Try it out and let us know if it works for you!



from xda-developers http://ift.tt/2m9JMaJ
via IFTTT

Aucun commentaire:

Enregistrer un commentaire