mercredi 8 mars 2017

How to Add Third-Party Music Apps to EMUI’s Music Lock Screen [Root]

EMUI, like many OEM skins, modifies the stock lock screen to fit its theme and incorporate features that the company believes their users will need quick access to.

One of the features that EMUI's lock screen offers is the ability to display the currently playing music track with beautiful, full screen album art and large track control buttons, as shown in the feature image. However, this feature is restricted to only a handful of predefined applications chosen by Huawei/Honor. This list* includes:


* There may be other applications that work with EMUI's music lockscreen. This list is pulled straight from Huawei's application white-list, which I will describe in further detail below.

What happens if you don't use one of the approved applications in EMUI, such as Phonograph or Encore? What if you want to display beautiful art and have large track control buttons for some podcast apps like Podcast Addict? In those cases, when you start a track or podcast, your lock screen will look like this:

Larger screen Huawei/Honor devices may find this annoying to deal with, since the buttons are so small relative to the entire screen. It makes it difficult to control your music, and it's a fairly ugly way to display your music too. Fortunately, there's a way to whitelist your app of choice so music tracks will display on the lock screen like the stock music player.


Add Third-Party Music Apps to EMUI's Music Lock Screen

There's a System setting that contains the list of packages EMUI uses to determine which apps get the special music lock screen treatment. If you send the following ADB command, then you can see the list of packages for yourself:

  adb shell settings get system white_music_for_keyguard  

Unfortunately, modifying this list via an ADB command does nothing. However, when I began researching how to solve this problem, I came across a solution on our very own XDA forums.

This trick was originally discovered by XDA Senior Member superior8888 on the Huawei Mate 8 forum, but this should work on the majority of Huawei and Honor devices that have this feature. This method does require you to have root access, unfortunately, as you will need to modify a system preference file to add your favorite music app to the list of whitelisted packages.

Download a root file browser from the Play Store (any app will do). If you have knowledge of using the command line, you can also follow along by using Terminal Emulator. In any case, depending on your device model, you'll have to edit hw_defaults.xml which is located in different directories depending on your device's locale. This is because Huawei/Honor uses different EMUI configuration files depending on your device's locale.

For international models, the file you need to edit is located in:

  /system/emui/oversea/xml/  

For Chinese models, the file you need to edit is located in:

  /system/emui/china/xml/  

Once you've opened this file, you will need to either edit or add a certain line in order to whitelist your app. There is a string that you will edit/add, called white_music_for_keyguard, which contains a semi-colon separated list of package names. Thus, you will need to know the package name for the application you want to whitelist.

There are multiple ways to find the package name for your app. You can download App Inspector from the Play Store and find the package name by selecting your app and looking at the name of the data directory. Or you can look at the URL of the Play Store listing to find the package name, as such:

http://ift.tt/OQdlpncom.fastbootmobile.encore.app

Note that the bolded part of the URL is the package name. Once you've got the list of packages you want, we can now modify hw_defaults.xml.

First, for the international models:

Before Edit

    <resources>  <string settings.secure.default_input_method="http://ift.tt/2nfzlz5"/>  <!-- AR0002K5QJ begin -->  <integer settings.secure.fingerprint_gallery_slide="0"/>  <!-- AR0002K5QJ end -->  <string white_languages="en_US,ar_EG,de_DE,bs_BA,es_ES,uk_UA,fr_FR,pt_PT,ru_RU,zh_CN,zh_TW,zh_HK,es_US,cs_CZ,da_DK,el_GR,hu_HU,pt_BR,it_IT,ja_JP,lt_LT,lv_LV,bg_BG,nb_NO,pl_PL,ro_RO,et_EE,sk_SK,sr_Latn,sv_SE,tr_TR,th_TH,fi_FI,in_ID,mk_MK,sl_SI,ms_MY,vi_VN,hr_HR,nl_NL,ca_ES,hi_IN,ko_KR,en_GB,iw_IL,my_ZG,my_MM,eu_ES,gl_ES,ka_GE,az_AZ,uz_UZ,km_KH,si_LK,ur_PK,kk_KZ,lo_LA,be_BY,bn_BD,ne_NP,tl_PH,jv_Latn"/>  <!-- AR0003UGK3 zhoufan/wx335113 20160224 begin -->  <string white_music_for_keyguard="deezer.android.app;com.maxmpz.audioplayer;com.qobuz.music;com.soundcloud.android;com.spotify.music"/>  <!-- AR0003UGK3 zhoufan/wx335113 20160224 end -->  <!-- DTS2016022503341 linneng/wx296161 20160304 begin -->  <string hw_invert_txtclr_packages="google*;facebook*"/>  <!-- DTS2016022503341 linneng/wx296161 20160304 end -->  <!-- AR0003NTNK begin -->  <integer hw_displayafterfirstring="0"/>  <!-- AR0003NTNK end -->  </resources>    

After Edit

    <resources>  <string settings.secure.default_input_method="http://ift.tt/2nfzlz5"/>  <!-- AR0002K5QJ begin -->  <integer settings.secure.fingerprint_gallery_slide="0"/>  <!-- AR0002K5QJ end -->  <string white_languages="en_US,ar_EG,de_DE,bs_BA,es_ES,uk_UA,fr_FR,pt_PT,ru_RU,zh_CN,zh_TW,zh_HK,es_US,cs_CZ,da_DK,el_GR,hu_HU,pt_BR,it_IT,ja_JP,lt_LT,lv_LV,bg_BG,nb_NO,pl_PL,ro_RO,et_EE,sk_SK,sr_Latn,sv_SE,tr_TR,th_TH,fi_FI,in_ID,mk_MK,sl_SI,ms_MY,vi_VN,hr_HR,nl_NL,ca_ES,hi_IN,ko_KR,en_GB,iw_IL,my_ZG,my_MM,eu_ES,gl_ES,ka_GE,az_AZ,uz_UZ,km_KH,si_LK,ur_PK,kk_KZ,lo_LA,be_BY,bn_BD,ne_NP,tl_PH,jv_Latn"/>  <!-- AR0003UGK3 zhoufan/wx335113 20160224 begin -->  <string white_music_for_keyguard="deezer.android.app;com.maxmpz.audioplayer;com.qobuz.music;com.soundcloud.android;com.spotify.music;YOUR.MUSIC.PACKAGE.HERE"/>  <!-- AR0003UGK3 zhoufan/wx335113 20160224 end -->  <!-- DTS2016022503341 linneng/wx296161 20160304 begin -->  <string hw_invert_txtclr_packages="google*;facebook*"/>  <!-- DTS2016022503341 linneng/wx296161 20160304 end -->  <!-- AR0003NTNK begin -->  <integer hw_displayafterfirstring="0"/>  <!-- AR0003NTNK end -->  </resources>    

For the Chinese models:

Before Edit

  <resources>  <string default_input_method="com.baidu.input_huawei/.ImeService"/>  <string custom_certify_picture="/system/emui/china/media/certify_infor.png"/>  <string white_languages="en_US,ar_EG,de_DE,bs_BA,es_ES,uk_UA,fr_FR,pt_PT,ru_RU,zh_CN,zh_TW,zh_HK,es_US,cs_CZ,da_DK,el_GR,hu_HU,pt_BR,it_IT,ja_JP,lt_LT,lv_LV,bg_BG,nb_NO,pl_PL,ro_RO,et_EE,sk_SK,sr_Latn,sv_SE,tr_TR,th_TH,fi_FI,in_ID,mk_MK,sl_SI,ms_MY,vi_VN,hr_HR,nl_NL,ca_ES,hi_IN,ko_KR,en_GB,iw_IL,eu_ES,gl_ES,bo_CN,ka_GE,az_AZ,uz_UZ,km_KH,si_LK,ur_PK,kk_KZ,lo_LA,be_BY,bn_BD,ne_NP,tl_PH,jv_Latn"/>  <string hw_theme_support_hwid="true"/>  <string hw_theme_support_pay="true"/>  <integer is_show_google="0"/>  </resources>    

After Edit

    <resources>  <string default_input_method="com.baidu.input_huawei/.ImeService"/>  <string custom_certify_picture="/system/emui/china/media/certify_infor.png"/>  <string white_languages="en_US,ar_EG,de_DE,bs_BA,es_ES,uk_UA,fr_FR,pt_PT,ru_RU,zh_CN,zh_TW,zh_HK,es_US,cs_CZ,da_DK,el_GR,hu_HU,pt_BR,it_IT,ja_JP,lt_LT,lv_LV,bg_BG,nb_NO,pl_PL,ro_RO,et_EE,sk_SK,sr_Latn,sv_SE,tr_TR,th_TH,fi_FI,in_ID,mk_MK,sl_SI,ms_MY,vi_VN,hr_HR,nl_NL,ca_ES,hi_IN,ko_KR,en_GB,iw_IL,eu_ES,gl_ES,bo_CN,ka_GE,az_AZ,uz_UZ,km_KH,si_LK,ur_PK,kk_KZ,lo_LA,be_BY,bn_BD,ne_NP,tl_PH,jv_Latn"/>  <string hw_theme_support_hwid="true"/>  <string hw_theme_support_pay="true"/>  <string white_music_for_keyguard="YOUR.LIST.OF.PACKAGES.SEPARATED.BY.SEMI.COLON.HERE"/>  <integer is_show_google="0"/>  </resources>    

Once you've made this edit, reboot your device. You should hopefully see full screen album art with large track control buttons on the lock screen now. However, I can't guarantee this tweak will work with every multimedia application out there, but I believe it will work with most apps out there.


Give this trick a shot and let us know if it works for your Honor/Huawei device!



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

Aucun commentaire:

Enregistrer un commentaire