美文网首页
PreOdex for MultiDex APP

PreOdex for MultiDex APP

作者: 小磊长江大 | 来源:发表于2018-12-29 17:33 被阅读0次

    Patch:

    diff --git a/services/java/com/android/server/pm/PackageManagerService.java b/services/java/com/android/server/pm/PackageManagerService.java
    index 3b238935d42..aef537be806 100755
    --- a/services/java/com/android/server/pm/PackageManagerService.java
    +++ b/services/java/com/android/server/pm/PackageManagerService.java
    @@ -824,7 +824,15 @@ public class PackageManagerService extends IPackageManager.Stub {
                             InstallArgs args = data.args;
                             PackageInstalledInfo res = data.res;
     
    -                        if (res.returnCode == PackageManager.INSTALL_SUCCEEDED) {
    +           if (res.returnCode == PackageManager.INSTALL_SUCCEEDED) {
    +               if("droid.com.amllogo".equals(res.pkg.applicationInfo.packageName)){
    +                   try { 
    +                       Context c = mContext.createPackageContext("droid.com.amllogo", Context.CONTEXT_INCLUDE_CODE | Context.CONTEXT_IGNORE_SECURITY);  
    +                       MultiDex.install(c);
    +                   } catch (Exception e) {
    +                       Log.d(TAG, "0000000" + e.toString());
    +                   }
    +               }
                                 res.removedInfo.sendBroadcast(false, true, false);
                                 Bundle extras = new Bundle(1);
                                 extras.putInt(Intent.EXTRA_UID, res.uid);
    @@ -4123,7 +4131,15 @@ public class PackageManagerService extends IPackageManager.Stub {
                     //error from installer
                     return DEX_OPT_FAILED;
                 }
    -        }
    +       if("droid.com.amllogo".equals(pkg.applicationInfo.packageName)) {
    +           try {
    +               Context c = mContext.createPackageContext("droid.com.amllogo", Context.CONTEXT_INCLUDE_CODE | Context.CONTEXT_IGNORE_SECURITY);
    +               MultiDex.install(c);
    +           } catch (Exception e){
    +           Log.d(TAG,"22222" + e.toString());
    +           }
    +       }
    +   }
     
             return performed ? DEX_OPT_PERFORMED : DEX_OPT_SKIPPED;
         }
    

    Test:

    logcat -s MultiDex
    

    相关文章

      网友评论

          本文标题:PreOdex for MultiDex APP

          本文链接:https://www.haomeiwen.com/subject/jdeplqtx.html