The phone which is connected to the PC has crashed when I choose the mode "Transfer files"

时间:2017-12-18 07:46:10

标签: android

I want to push something into my phone on window.onscroll = function(){stickyNavbar()}; function stickyNavbar() { var navbar = $(".nav-tabs"); var sticky = navbar.offset().top; if (window.pageYOffset > sticky) { navbar.addClass("sticky") horizontalScroll(); } } function horizontalScroll(){ var counter = 0; var navLi = $('#resNav').find('li'); for (var i = 0; i < navLi.length; i++) { if ($(navLi[i]).hasClass('active')) { break; } else{ counter ++; } } var fixedLiWidth = $('#resNav').find('li:first-child').innerWidth(); var scrollWidth = counter * fixedLiWidth; $('#resNav').animate({ scrollLeft: scrollWidth }, 500); } ,but when my phone is connected to the PC, I choose the mode Android Oreo, it has crashed.here is my crashed log.

please see the log:

Transfer files

1 个答案:

答案 0 :(得分:0)

我已经解决了这个问题,因为函数中的第二个参数(BoostFramework.perfHint)是NULL。所以在MtpService.java中使用getApplicationContext()。getPackageName()而不是null,请看下面的内容:

-mPerfBoost.perfHint(BoostFramework.VENDOR_HINT_MTP_BOOST,null,Integer.MAX_VALUE,-1);
+mPerfBoost.perfHint(BoostFramework.VENDOR_HINT_MTP_BOOST,getApplicationContext().getPackageName(),Integer.MAX_VALUE,-1);